|
| 1 | +--- |
| 2 | +title: runok init |
| 3 | +description: Initialize runok configuration with an interactive setup wizard. |
| 4 | +sidebar: |
| 5 | + order: 4 |
| 6 | +--- |
| 7 | + |
| 8 | +`runok init` creates a `runok.yml` configuration file through an interactive setup wizard. It can also detect existing Claude Code Bash permissions and migrate them to runok rules. |
| 9 | + |
| 10 | +## Usage |
| 11 | + |
| 12 | +```sh |
| 13 | +runok init [options] |
| 14 | +``` |
| 15 | + |
| 16 | +## Flags |
| 17 | + |
| 18 | +### `--scope <scope>` |
| 19 | + |
| 20 | +Configuration scope. Available values: |
| 21 | + |
| 22 | +- `user` — Create `~/.config/runok/runok.yml` for global rules that apply to all projects. Also registers the runok PreToolUse hook in `~/.claude/settings.json` if Claude Code is detected. |
| 23 | +- `project` — Create `runok.yml` in the current directory for project-specific rules. |
| 24 | + |
| 25 | +When omitted, the wizard prompts you to choose. |
| 26 | + |
| 27 | +### `-y`, `--yes` |
| 28 | + |
| 29 | +Accept all defaults without prompting. Useful for scripted setups. |
| 30 | + |
| 31 | +## What the wizard does |
| 32 | + |
| 33 | +1. **Scope selection** — Choose `user` or `project` scope (skipped if `--scope` is given). |
| 34 | +2. **Claude Code detection** — If a `.claude/settings.json` exists with Bash permissions or a missing runok hook, the wizard offers to: |
| 35 | + - **Migrate Bash permissions** — Convert `permissions.allow` and `permissions.deny` entries for `Bash(...)` patterns into runok rules, and remove them from `settings.json`. |
| 36 | + - **Register the hook** — Add the `runok check` PreToolUse hook to `settings.json` (user scope only). |
| 37 | +3. **Preview and confirm** — Show a unified diff of all proposed changes and ask for confirmation. |
| 38 | +4. **Create `runok.yml`** — Write the configuration file with migrated rules (if any) or a boilerplate template. |
| 39 | + |
| 40 | +## Examples |
| 41 | + |
| 42 | +Interactive setup (prompts for scope and options): |
| 43 | + |
| 44 | +```sh |
| 45 | +runok init |
| 46 | +``` |
| 47 | + |
| 48 | +Set up user-global configuration non-interactively: |
| 49 | + |
| 50 | +```sh |
| 51 | +runok init --scope user -y |
| 52 | +``` |
| 53 | + |
| 54 | +Set up project-local configuration: |
| 55 | + |
| 56 | +```sh |
| 57 | +runok init --scope project |
| 58 | +``` |
| 59 | + |
| 60 | +## Related |
| 61 | + |
| 62 | +- [Quick Start](/getting-started/quickstart/) — Getting started with runok. |
| 63 | +- [Claude Code Integration](/getting-started/claude-code/) — Manual hook setup and sandbox configuration. |
| 64 | +- [Configuration](/configuration/schema/) — Full configuration reference. |
0 commit comments