[DOCS] Missing documentation for `Setup` hook event and associated CLI flags (`--init`, `--init-only`, `--maintenance`)
Documentation Type
Missing documentation (feature not documented)
Documentation Location
Section/Topic
- Hooks Reference: The "Hook Events" section. - CLI Reference: The "CLI flags" table.
Current Documentation
In the Hooks Reference (docs/en/hooks.md), the "Hook Events" section lists:
PreToolUse PermissionRequest PostToolUse Notification UserPromptSubmit Stop SubagentStop PreCompact SessionStart SessionEnd
In the CLI Reference (docs/en/cli-reference.md), the flags table covers standard flags like --add-dir, --model, and --print, but does not mention any flags related to initialization or maintenance.
What's Wrong or Missing?
According to the Claude Code Changelog for Version 2.1.10, a significant new feature was added:
"- Added newSetuphook event that can be triggered via--init,--init-only, or--maintenanceCLI flags for repository setup and maintenance operations"
This information is entirely missing from the current documentation. Users who want to automate repository bootstrapping or maintenance tasks using Claude Code have no documentation on:
- What the
Setuphook event does or what its input JSON schema looks like. - The existence of the
--init,--init-only, and--maintenanceflags. - How
Setuphooks differ fromSessionStarthooks (e.g., if they run before/after or only during specific flag invocations).
Suggested Improvement
In docs/en/hooks.md:
Add a new entry for the Setup event:
#### Setup Runs when Claude Code is invoked with setup or maintenance flags. This is intended for initial repository indexing, dependency installation, or environment health checks. Trigger Flags:--init,--init-only,--maintenanceMatchers: (None)
In docs/en/cli-reference.md:
Add the following entries to the CLI flags table:
| Flag | Description | Example |
| :--- | :--- | :--- |
| --init | Triggers the Setup hook event and then proceeds to the interactive REPL. | claude --init |
| --init-only | Triggers the Setup hook event and exits immediately after completion. | claude --init-only |
| --maintenance | Runs repository maintenance tasks defined in the Setup hook. | claude --maintenance |
Impact
High - Prevents users from using a feature
Additional Context
- This issue was identified by comparing the v2.1.10 changelog against the live documentation files.
- The
Setuphook is particularly important for enterprise users who need to ensure a repository is "Claude-ready" (e.g., generating a.mcp.jsonor running a custom indexing script) before developers start their first session. - Similar projects (like
huskyfor git hooks) typically provide a "Lifecycle" table; adding a small lifecycle diagram showing whenSetupruns vsSessionStartwould be very helpful.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗