docs: sync to Claude Code v2.1.176 (#141)
* docs: sync to Claude Code v2.1.176 Fix the subagent-nesting self-contradiction in 04-subagents and document additive features shipped in v2.1.172-v2.1.176: - 04-subagents: subagents can now spawn subagents (up to 5 levels, v2.1.172), replacing the stale "no nested spawning" line; footer bumped to 2.1.176 - 07-plugins: /plugin marketplace search bar (v2.1.172) - 10-cli: new settings.json keys wheelScrollAccelerationEnabled, footerLinksRegexes, language (v2.1.174-v2.1.176) - 09-advanced-features: enforceAvailableModels managed setting (v2.1.175) - 06-hooks: if-condition tool-argument path matchers (verified against the official permissions reference) - claude_concepts_guide & CATALOG: subagent nesting note + VSCode /usage attribution breakdown (v2.1.174) * fix(10-cli): correct language setting scope and fix link-checker false positive - check_links.py: skip bare-hostname captures (no dot in host) that URL_RE truncates from regex strings in JSON config examples, e.g. "https://jira\\.example\\.com/.*" was captured as "https://jira" and flagged as a dead link in CI strict mode. Dotted hosts (real URLs) and SKIP_DOMAINS single-label hosts are unaffected, so no link coverage is lost. - 10-cli/README.md: language is Claude's general response/voice-dictation language setting (e.g. french/japanese), which v2.1.176 also wired to session-title generation — not a session-titles-only key. Updated the description and the JSON example value to match the official settings docs. * chore(idd): exempt docs-sync PRs from traceability Closes #N requirement Adds .gitissue.yml so 'docs: sync to Claude Code vX' PRs (which aren't tied to a single tracked issue) are not hard-blocked on a missing Closes #N — they opt in via a 'Type: docs' body line, matching how chore/refactor PRs work. The other three traceability checks still run.
This commit is contained in:
@@ -77,6 +77,45 @@ Hooks are configured in settings files with a specific structure:
|
||||
| `nested_traversal` | Instructions loaded during nested directory traversal |
|
||||
| `path_glob_match` | Instructions loaded via path glob pattern matching |
|
||||
|
||||
### Narrowing with `if` conditions (tool-argument paths)
|
||||
|
||||
The `matcher` field selects a hook by **tool name** (`"Write"`, `"Edit|Write"`, `"*"`). To filter more narrowly by the tool's **arguments** — for example, to run a hook only when an edit touches `src/`, or to guard reads of secret files — add an `if` condition to an individual hook handler. This is distinct from the tool-name matcher: the `matcher` decides *which tool*, the `if` decides *which call*.
|
||||
|
||||
`if` uses [permission-rule syntax](https://code.claude.com/docs/en/permissions) (`ToolName(pattern)`), evaluated against the tool name **and** its arguments together. For `Read`/`Edit`/`Write`, the path pattern follows gitignore semantics, with the same anchors as permission rules: a bare name like `.env` matches at any depth, `src/**` is relative to the current directory, `/src/**` to the project root, `~/...` to your home directory, and `//...` is an absolute filesystem path.
|
||||
|
||||
The `if` field sits at the **hook-handler level** — a sibling of `type` and `command`, inside the `hooks` array — not on `matcher`:
|
||||
|
||||
```json
|
||||
{
|
||||
"hooks": {
|
||||
"PreToolUse": [
|
||||
{
|
||||
"matcher": "Edit|Write",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"if": "Edit(src/**)",
|
||||
"command": "./hooks/lint-src.sh"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"matcher": "Read",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"if": "Read(.env)",
|
||||
"command": "./hooks/block-secret-read.sh"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Examples of valid `if` patterns: `Edit(src/**)` (edits under `src/`), `Read(~/.ssh/**)` (reads of any SSH key), `Read(.env)` (any `.env` at or below the current directory), `Bash(git push *)` (only `git push` subcommands).
|
||||
|
||||
## Hook Types
|
||||
|
||||
Claude Code supports five hook types:
|
||||
@@ -1460,11 +1499,13 @@ Edit `~/.claude/settings.json` or `.claude/settings.json` with the hook configur
|
||||
|
||||
---
|
||||
|
||||
**Last Updated**: June 10, 2026
|
||||
**Claude Code Version**: 2.1.170
|
||||
**Last Updated**: June 15, 2026
|
||||
**Claude Code Version**: 2.1.176
|
||||
**Sources**:
|
||||
- https://code.claude.com/docs/en/hooks
|
||||
- https://code.claude.com/docs/en/permissions
|
||||
- https://code.claude.com/docs/en/changelog
|
||||
- https://code.claude.com/docs/en/changelog#2-1-176
|
||||
- https://github.com/anthropics/claude-code/releases/tag/v2.1.139
|
||||
- https://github.com/anthropics/claude-code/releases/tag/v2.1.145
|
||||
- https://github.com/anthropics/claude-code/releases/tag/v2.1.152
|
||||
|
||||
Reference in New Issue
Block a user