runok init
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.
runok init [options]--scope <scope>
Section titled “--scope <scope>”Configuration scope. Available values:
user— Create~/.config/runok/runok.ymlfor global rules that apply to all projects. Also registers the runok PreToolUse hook in~/.claude/settings.jsonif Claude Code is detected.project— Createrunok.ymlin the current directory for project-specific rules.
When omitted, the wizard prompts you to choose.
-y, --yes
Section titled “-y, --yes”Accept all defaults without prompting. Useful for scripted setups.
What the wizard does
Section titled “What the wizard does”- Scope selection — Choose
userorprojectscope (skipped if--scopeis given). - Claude Code detection — If a
.claude/settings.jsonexists with Bash permissions or a missing runok hook, the wizard offers to:- Migrate Bash permissions — Convert
permissions.allowandpermissions.denyentries forBash(...)patterns into runok rules, and remove them fromsettings.json. - Register the hook — Add the
runok checkPreToolUse hook tosettings.json(user scope only).
- Migrate Bash permissions — Convert
- Preview and confirm — Show a unified diff of all proposed changes and ask for confirmation.
- Create
runok.yml— Write the configuration file with migrated rules (if any) or a boilerplate template. - Conflicting hook detection — The wizard checks for other PreToolUse hooks that also match
Bash. Due to a known Claude Code issue, runok’s sandbox may not work when multiple PreToolUse hooks match Bash — commands that should be sandboxed could run without any restrictions. If conflicts are found, a warning is displayed advising you to merge all Bash-matching hooks into a single entry.
Examples
Section titled “Examples”Interactive setup (prompts for scope and options):
runok initSet up user-global configuration non-interactively:
runok init --scope user -ySet up project-local configuration:
runok init --scope projectRelated
Section titled “Related”- Quick Start — Getting started with runok.
- Claude Code Integration — Manual hook setup and sandbox configuration.
- Configuration — Full configuration reference.