@aladac/hu 0.1.0-a1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.tool-versions +1 -0
- package/CLAUDE.md +122 -0
- package/HOOKS-DATA-INTEGRATION.md +457 -0
- package/SAMPLE.md +378 -0
- package/TODO.md +25 -0
- package/biome.json +51 -0
- package/commands/bootstrap.md +13 -0
- package/commands/c.md +1 -0
- package/commands/check-name.md +62 -0
- package/commands/disk.md +141 -0
- package/commands/docs/archive.md +27 -0
- package/commands/docs/check-internal.md +53 -0
- package/commands/docs/cleanup.md +65 -0
- package/commands/docs/consolidate.md +72 -0
- package/commands/docs/get.md +101 -0
- package/commands/docs/list.md +61 -0
- package/commands/docs/sync.md +64 -0
- package/commands/docs/update.md +49 -0
- package/commands/plans/clear.md +23 -0
- package/commands/plans/create.md +71 -0
- package/commands/plans/list.md +21 -0
- package/commands/plans/sync.md +38 -0
- package/commands/reinstall.md +20 -0
- package/commands/replicate.md +303 -0
- package/commands/warp.md +0 -0
- package/doc/README.md +35 -0
- package/doc/claude-code/capabilities.md +202 -0
- package/doc/claude-code/directory-structure.md +246 -0
- package/doc/claude-code/hooks.md +348 -0
- package/doc/claude-code/overview.md +109 -0
- package/doc/claude-code/plugins.md +273 -0
- package/doc/claude-code/sdk-protocols.md +202 -0
- package/document-manifest.toml +29 -0
- package/justfile +39 -0
- package/package.json +33 -0
- package/plans/compiled-watching-feather.md +217 -0
- package/plans/crispy-crafting-pnueli.md +103 -0
- package/plans/greedy-booping-coral.md +146 -0
- package/plans/imperative-sleeping-flamingo.md +192 -0
- package/plans/jaunty-sprouting-marble.md +171 -0
- package/plans/jiggly-discovering-lake.md +68 -0
- package/plans/magical-nibbling-spark.md +144 -0
- package/plans/mellow-kindling-acorn.md +110 -0
- package/plans/recursive-questing-engelbart.md +65 -0
- package/plans/serialized-roaming-kernighan.md +227 -0
- package/plans/structured-wondering-wirth.md +230 -0
- package/plans/vectorized-dreaming-iverson.md +191 -0
- package/plans/velvety-enchanting-ocean.md +92 -0
- package/plans/wiggly-sparking-pixel.md +48 -0
- package/plans/zippy-shimmying-fox.md +188 -0
- package/plugins/installed_plugins.json +4 -0
- package/sample-hooks.json +298 -0
- package/settings.json +24 -0
- package/settings.local.json +7 -0
- package/src/commands/bump.ts +130 -0
- package/src/commands/disk.ts +419 -0
- package/src/commands/docs.ts +729 -0
- package/src/commands/plans.ts +259 -0
- package/src/commands/utils.ts +299 -0
- package/src/index.ts +26 -0
- package/src/lib/colors.ts +87 -0
- package/src/lib/exec.ts +25 -0
- package/src/lib/fs.ts +119 -0
- package/src/lib/html.ts +205 -0
- package/src/lib/spinner.ts +42 -0
- package/src/types/index.ts +61 -0
- package/tests/lib/colors.test.ts +69 -0
- package/tests/lib/fs.test.ts +65 -0
- package/tsconfig.json +20 -0
- package/vitest.config.ts +15 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
---
|
|
2
|
+
source: https://idsc2025.substack.com/p/the-complete-technical-guide-to-claude
|
|
3
|
+
additional_sources:
|
|
4
|
+
- https://code.claude.com/docs/en/memory
|
|
5
|
+
- https://www.vincentschmalbach.com/migrate-claude-code-sessions-to-a-new-computer/
|
|
6
|
+
fetched: 2026-01-13
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Claude Code Directory Structure
|
|
10
|
+
|
|
11
|
+
The `~/.claude/` directory contains all local state, configuration, and data for Claude Code.
|
|
12
|
+
|
|
13
|
+
## Directory Overview
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
~/.claude/
|
|
17
|
+
├── CLAUDE.md # User memory/instructions (global)
|
|
18
|
+
├── settings.json # Global configuration
|
|
19
|
+
├── settings.local.json # Local overrides (not synced)
|
|
20
|
+
├── history.jsonl # Session index (metadata only)
|
|
21
|
+
│
|
|
22
|
+
├── projects/ # Conversation transcripts by project
|
|
23
|
+
│ └── -Users-chi-myproject/
|
|
24
|
+
│ └── {session-uuid}.jsonl
|
|
25
|
+
│
|
|
26
|
+
├── commands/ # Custom slash commands
|
|
27
|
+
│ └── mycommand.md
|
|
28
|
+
│
|
|
29
|
+
├── plans/ # Saved implementation plans
|
|
30
|
+
│ └── {adjective}-{verb}-{noun}.md
|
|
31
|
+
│
|
|
32
|
+
├── plugins/ # Installed plugins
|
|
33
|
+
│ └── installed_plugins.json
|
|
34
|
+
│
|
|
35
|
+
├── todos/ # Todo lists per session
|
|
36
|
+
│ └── {session-uuid}.json
|
|
37
|
+
│
|
|
38
|
+
├── cache/ # Cached data (changelog, etc.)
|
|
39
|
+
├── debug/ # Debug logs per session
|
|
40
|
+
├── documents/ # Global document store
|
|
41
|
+
├── file-history/ # File edit history per session
|
|
42
|
+
├── paste-cache/ # Clipboard paste cache
|
|
43
|
+
├── session-env/ # Persisted env vars per session
|
|
44
|
+
├── shell-snapshots/ # Shell environment snapshots
|
|
45
|
+
├── statsig/ # Feature flags cache
|
|
46
|
+
└── telemetry/ # Usage telemetry
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Key Directories
|
|
50
|
+
|
|
51
|
+
### projects/
|
|
52
|
+
|
|
53
|
+
**Purpose**: Stores all conversation transcripts.
|
|
54
|
+
|
|
55
|
+
**Path encoding**: `/Users/chi/myproject` → `-Users-chi-myproject`
|
|
56
|
+
|
|
57
|
+
**Format**: JSONL (one JSON object per line)
|
|
58
|
+
|
|
59
|
+
```jsonl
|
|
60
|
+
{"type":"summary","summary":"Topic description","leafUuid":"..."}
|
|
61
|
+
{"type":"user","message":{"role":"user","content":"..."},"uuid":"...","parentUuid":"..."}
|
|
62
|
+
{"type":"assistant","message":{"role":"assistant","content":[...]},"uuid":"...","parentUuid":"..."}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Key fields**:
|
|
66
|
+
- `uuid` / `parentUuid`: Thread linking
|
|
67
|
+
- `sessionId`: Session identifier
|
|
68
|
+
- `cwd`: Working directory at time of message
|
|
69
|
+
- `isSidechain`: Parallel thread flag
|
|
70
|
+
- `costUSD` / `durationMs`: Performance metrics
|
|
71
|
+
|
|
72
|
+
### todos/
|
|
73
|
+
|
|
74
|
+
**Purpose**: Per-session todo lists.
|
|
75
|
+
|
|
76
|
+
**Naming**: `{session-uuid}.json` or `{session-uuid}-agent-{agent-uuid}.json`
|
|
77
|
+
|
|
78
|
+
**Format**:
|
|
79
|
+
```json
|
|
80
|
+
[
|
|
81
|
+
{"content": "Task description", "status": "pending|in_progress|completed", "activeForm": "..."}
|
|
82
|
+
]
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### file-history/
|
|
86
|
+
|
|
87
|
+
**Purpose**: Stores file versions for undo/diff.
|
|
88
|
+
|
|
89
|
+
**Structure**: `{session-uuid}/{filename}` with version history.
|
|
90
|
+
|
|
91
|
+
### session-env/
|
|
92
|
+
|
|
93
|
+
**Purpose**: Environment variables persisted via `SessionStart` hooks.
|
|
94
|
+
|
|
95
|
+
**Usage**: Write to `$CLAUDE_ENV_FILE` in hooks to persist env vars.
|
|
96
|
+
|
|
97
|
+
### shell-snapshots/
|
|
98
|
+
|
|
99
|
+
**Purpose**: Captures shell environment (functions, aliases) for command execution.
|
|
100
|
+
|
|
101
|
+
**Format**: Executable shell scripts that recreate the environment.
|
|
102
|
+
|
|
103
|
+
### plans/
|
|
104
|
+
|
|
105
|
+
**Purpose**: Saved implementation plans from plan mode.
|
|
106
|
+
|
|
107
|
+
**Naming**: `{adjective}-{verb}-{noun}.md` (e.g., `crispy-crafting-pnueli.md`)
|
|
108
|
+
|
|
109
|
+
### statsig/
|
|
110
|
+
|
|
111
|
+
**Purpose**: Feature flag cache and evaluation state.
|
|
112
|
+
|
|
113
|
+
**Files**:
|
|
114
|
+
- `statsig.cached.evaluations.*` - Cached feature flags
|
|
115
|
+
- `statsig.stable_id.*` - Persistent user ID
|
|
116
|
+
- `statsig.session_id.*` - Current session tracking
|
|
117
|
+
|
|
118
|
+
### debug/
|
|
119
|
+
|
|
120
|
+
**Purpose**: Debug logs per session.
|
|
121
|
+
|
|
122
|
+
**Naming**: `{session-uuid}.txt`
|
|
123
|
+
|
|
124
|
+
## Configuration Files
|
|
125
|
+
|
|
126
|
+
### settings.json
|
|
127
|
+
|
|
128
|
+
Global settings applied to all projects.
|
|
129
|
+
|
|
130
|
+
```json
|
|
131
|
+
{
|
|
132
|
+
"permissions": {
|
|
133
|
+
"allow": ["Bash", "Read", "Write"],
|
|
134
|
+
"deny": []
|
|
135
|
+
},
|
|
136
|
+
"hooks": { ... },
|
|
137
|
+
"enabledPlugins": { ... }
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### settings.local.json
|
|
142
|
+
|
|
143
|
+
Local overrides (not committed to version control).
|
|
144
|
+
|
|
145
|
+
```json
|
|
146
|
+
{
|
|
147
|
+
"enableAllProjectMcpServers": false
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Session Data Format
|
|
152
|
+
|
|
153
|
+
### JSONL Message Types
|
|
154
|
+
|
|
155
|
+
**Summary** (session start):
|
|
156
|
+
```json
|
|
157
|
+
{"type": "summary", "summary": "Topic", "leafUuid": "last-msg-uuid"}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**User message**:
|
|
161
|
+
```json
|
|
162
|
+
{
|
|
163
|
+
"type": "user",
|
|
164
|
+
"userType": "external",
|
|
165
|
+
"message": {"role": "user", "content": "..."},
|
|
166
|
+
"uuid": "...",
|
|
167
|
+
"parentUuid": "...",
|
|
168
|
+
"timestamp": "2026-01-13T20:00:00.000Z",
|
|
169
|
+
"cwd": "/working/directory",
|
|
170
|
+
"sessionId": "...",
|
|
171
|
+
"version": "1.0.24"
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
**Assistant message**:
|
|
176
|
+
```json
|
|
177
|
+
{
|
|
178
|
+
"type": "assistant",
|
|
179
|
+
"message": {
|
|
180
|
+
"id": "msg_01XYZ...",
|
|
181
|
+
"role": "assistant",
|
|
182
|
+
"model": "claude-sonnet-4-20250514",
|
|
183
|
+
"content": [...],
|
|
184
|
+
"usage": {
|
|
185
|
+
"input_tokens": 1234,
|
|
186
|
+
"output_tokens": 567,
|
|
187
|
+
"cache_creation_input_tokens": 890,
|
|
188
|
+
"cache_read_input_tokens": 2345
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
"costUSD": 0.01234,
|
|
192
|
+
"durationMs": 5678,
|
|
193
|
+
"uuid": "...",
|
|
194
|
+
"parentUuid": "..."
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**Tool use** (in assistant content):
|
|
199
|
+
```json
|
|
200
|
+
{
|
|
201
|
+
"type": "tool_use",
|
|
202
|
+
"id": "toolu_01ABC...",
|
|
203
|
+
"name": "Read",
|
|
204
|
+
"input": {"file_path": "/path/to/file"}
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Storage Stats
|
|
209
|
+
|
|
210
|
+
Typical sizes:
|
|
211
|
+
- **projects/**: 85% of storage (conversation transcripts)
|
|
212
|
+
- **node_modules/**: 12% (local dependencies, if present)
|
|
213
|
+
- **todos/**: 2% (task management)
|
|
214
|
+
- **config/cache**: <1%
|
|
215
|
+
|
|
216
|
+
## Backup Strategies
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
# Conversation data only
|
|
220
|
+
rsync -av ~/.claude/projects/ backup/claude-conversations/
|
|
221
|
+
|
|
222
|
+
# Full backup excluding cache
|
|
223
|
+
rsync -av --exclude='node_modules' --exclude='statsig' \
|
|
224
|
+
~/.claude/ backup/claude-full/
|
|
225
|
+
|
|
226
|
+
# Configuration only
|
|
227
|
+
tar -czf claude-config.tar.gz \
|
|
228
|
+
~/.claude/settings*.json \
|
|
229
|
+
~/.claude/CLAUDE.md \
|
|
230
|
+
~/.claude/commands/
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## Session Cleanup
|
|
234
|
+
|
|
235
|
+
Sessions older than 30 days are auto-deleted. Override with:
|
|
236
|
+
```json
|
|
237
|
+
{
|
|
238
|
+
"cleanupPeriodDays": 365
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## Path Encoding
|
|
243
|
+
|
|
244
|
+
Project paths are encoded by replacing `/` with `-`:
|
|
245
|
+
- `/Users/chi/project` → `-Users-chi-project`
|
|
246
|
+
- When moving projects, manually rename the corresponding directory in `projects/`
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
---
|
|
2
|
+
source: https://code.claude.com/docs/en/hooks
|
|
3
|
+
additional_sources:
|
|
4
|
+
- https://code.claude.com/docs/en/hooks-guide
|
|
5
|
+
fetched: 2026-01-13
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Claude Code Hooks
|
|
9
|
+
|
|
10
|
+
Hooks are user-defined shell commands that execute at various points in Claude Code's lifecycle. They provide deterministic control over behavior.
|
|
11
|
+
|
|
12
|
+
## Configuration
|
|
13
|
+
|
|
14
|
+
Hooks are configured in settings files:
|
|
15
|
+
|
|
16
|
+
- `~/.claude/settings.json` - User settings (global)
|
|
17
|
+
- `.claude/settings.json` - Project settings
|
|
18
|
+
- `.claude/settings.local.json` - Local project settings (not committed)
|
|
19
|
+
|
|
20
|
+
### Structure
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"hooks": {
|
|
25
|
+
"EventName": [
|
|
26
|
+
{
|
|
27
|
+
"matcher": "ToolPattern",
|
|
28
|
+
"hooks": [
|
|
29
|
+
{
|
|
30
|
+
"type": "command",
|
|
31
|
+
"command": "your-command-here",
|
|
32
|
+
"timeout": 30
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Fields:**
|
|
42
|
+
- `matcher`: Pattern to match tool names (regex supported: `Edit|Write`, `Notebook.*`, `*` for all)
|
|
43
|
+
- `type`: `"command"` for bash or `"prompt"` for LLM-based evaluation
|
|
44
|
+
- `command`: Bash command to execute
|
|
45
|
+
- `timeout`: Optional, seconds before canceling
|
|
46
|
+
|
|
47
|
+
## Hook Events
|
|
48
|
+
|
|
49
|
+
| Event | Matcher | Description |
|
|
50
|
+
|-------|---------|-------------|
|
|
51
|
+
| `PreToolUse` | Yes | Before tool execution (can block) |
|
|
52
|
+
| `PostToolUse` | Yes | After tool completion |
|
|
53
|
+
| `PermissionRequest` | Yes | When permission dialog shown |
|
|
54
|
+
| `UserPromptSubmit` | No | Before Claude processes user input |
|
|
55
|
+
| `Notification` | Yes | When notifications sent |
|
|
56
|
+
| `Stop` | No | When Claude finishes responding |
|
|
57
|
+
| `SubagentStop` | No | When subagent finishes |
|
|
58
|
+
| `PreCompact` | Yes | Before compact operation |
|
|
59
|
+
| `SessionStart` | Yes | Session start/resume |
|
|
60
|
+
| `SessionEnd` | No | Session ends |
|
|
61
|
+
|
|
62
|
+
### Notification Matchers
|
|
63
|
+
|
|
64
|
+
- `permission_prompt` - Permission requests
|
|
65
|
+
- `idle_prompt` - Claude waiting for input
|
|
66
|
+
- `auth_success` - Authentication success
|
|
67
|
+
- `elicitation_dialog` - MCP tool elicitation
|
|
68
|
+
|
|
69
|
+
### SessionStart Matchers
|
|
70
|
+
|
|
71
|
+
- `startup` - Fresh start
|
|
72
|
+
- `resume` - From `--resume`, `--continue`, `/resume`
|
|
73
|
+
- `clear` - From `/clear`
|
|
74
|
+
- `compact` - Auto or manual compact
|
|
75
|
+
|
|
76
|
+
### PreCompact Matchers
|
|
77
|
+
|
|
78
|
+
- `manual` - From `/compact`
|
|
79
|
+
- `auto` - Auto-compact
|
|
80
|
+
|
|
81
|
+
## Environment Variables
|
|
82
|
+
|
|
83
|
+
- `$CLAUDE_PROJECT_DIR` - Project root directory
|
|
84
|
+
- `$CLAUDE_ENV_FILE` - (SessionStart only) File to persist env vars
|
|
85
|
+
- `${CLAUDE_PLUGIN_ROOT}` - Plugin directory (for plugins)
|
|
86
|
+
|
|
87
|
+
## Hook Input (stdin JSON)
|
|
88
|
+
|
|
89
|
+
Common fields in all hooks:
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"session_id": "abc123",
|
|
94
|
+
"transcript_path": "/path/to/transcript.jsonl",
|
|
95
|
+
"cwd": "/current/directory",
|
|
96
|
+
"permission_mode": "default",
|
|
97
|
+
"hook_event_name": "PreToolUse"
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### PreToolUse Input
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"tool_name": "Bash",
|
|
106
|
+
"tool_input": {
|
|
107
|
+
"command": "ls -la",
|
|
108
|
+
"description": "List files"
|
|
109
|
+
},
|
|
110
|
+
"tool_use_id": "toolu_01ABC123"
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### UserPromptSubmit Input
|
|
115
|
+
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"prompt": "Write a function..."
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Stop/SubagentStop Input
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"stop_hook_active": true
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Hook Output
|
|
131
|
+
|
|
132
|
+
### Exit Codes
|
|
133
|
+
|
|
134
|
+
- **0**: Success. stdout shown in verbose mode
|
|
135
|
+
- **2**: Blocking error. stderr shown to Claude
|
|
136
|
+
- **Other**: Non-blocking error. stderr shown to user
|
|
137
|
+
|
|
138
|
+
### JSON Output (exit 0)
|
|
139
|
+
|
|
140
|
+
```json
|
|
141
|
+
{
|
|
142
|
+
"continue": true,
|
|
143
|
+
"stopReason": "string",
|
|
144
|
+
"suppressOutput": true,
|
|
145
|
+
"systemMessage": "string"
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### PreToolUse Decision Control
|
|
150
|
+
|
|
151
|
+
```json
|
|
152
|
+
{
|
|
153
|
+
"hookSpecificOutput": {
|
|
154
|
+
"hookEventName": "PreToolUse",
|
|
155
|
+
"permissionDecision": "allow|deny|ask",
|
|
156
|
+
"permissionDecisionReason": "reason",
|
|
157
|
+
"updatedInput": { "field": "new value" }
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### PostToolUse Decision Control
|
|
163
|
+
|
|
164
|
+
```json
|
|
165
|
+
{
|
|
166
|
+
"decision": "block",
|
|
167
|
+
"reason": "Explanation",
|
|
168
|
+
"hookSpecificOutput": {
|
|
169
|
+
"hookEventName": "PostToolUse",
|
|
170
|
+
"additionalContext": "Info for Claude"
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### UserPromptSubmit Control
|
|
176
|
+
|
|
177
|
+
```json
|
|
178
|
+
{
|
|
179
|
+
"decision": "block",
|
|
180
|
+
"reason": "Explanation",
|
|
181
|
+
"hookSpecificOutput": {
|
|
182
|
+
"hookEventName": "UserPromptSubmit",
|
|
183
|
+
"additionalContext": "Context to add"
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Stop/SubagentStop Control
|
|
189
|
+
|
|
190
|
+
```json
|
|
191
|
+
{
|
|
192
|
+
"decision": "block",
|
|
193
|
+
"reason": "Must continue because..."
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### SessionStart Control
|
|
198
|
+
|
|
199
|
+
```json
|
|
200
|
+
{
|
|
201
|
+
"hookSpecificOutput": {
|
|
202
|
+
"hookEventName": "SessionStart",
|
|
203
|
+
"additionalContext": "Context to load"
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Examples
|
|
209
|
+
|
|
210
|
+
### Log All Bash Commands
|
|
211
|
+
|
|
212
|
+
```json
|
|
213
|
+
{
|
|
214
|
+
"hooks": {
|
|
215
|
+
"PreToolUse": [
|
|
216
|
+
{
|
|
217
|
+
"matcher": "Bash",
|
|
218
|
+
"hooks": [
|
|
219
|
+
{
|
|
220
|
+
"type": "command",
|
|
221
|
+
"command": "jq -r '.tool_input.command' >> ~/.claude/bash-log.txt"
|
|
222
|
+
}
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
]
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Auto-Format on Edit
|
|
231
|
+
|
|
232
|
+
```json
|
|
233
|
+
{
|
|
234
|
+
"hooks": {
|
|
235
|
+
"PostToolUse": [
|
|
236
|
+
{
|
|
237
|
+
"matcher": "Write|Edit",
|
|
238
|
+
"hooks": [
|
|
239
|
+
{
|
|
240
|
+
"type": "command",
|
|
241
|
+
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/format.sh",
|
|
242
|
+
"timeout": 30
|
|
243
|
+
}
|
|
244
|
+
]
|
|
245
|
+
}
|
|
246
|
+
]
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Block Main Branch Edits
|
|
252
|
+
|
|
253
|
+
```json
|
|
254
|
+
{
|
|
255
|
+
"hooks": {
|
|
256
|
+
"PreToolUse": [
|
|
257
|
+
{
|
|
258
|
+
"matcher": "Edit|Write",
|
|
259
|
+
"hooks": [
|
|
260
|
+
{
|
|
261
|
+
"type": "command",
|
|
262
|
+
"command": "[ \"$(git branch --show-current)\" != \"main\" ] || { echo 'Cannot edit on main' >&2; exit 2; }"
|
|
263
|
+
}
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
]
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### Load Context on Session Start
|
|
272
|
+
|
|
273
|
+
```json
|
|
274
|
+
{
|
|
275
|
+
"hooks": {
|
|
276
|
+
"SessionStart": [
|
|
277
|
+
{
|
|
278
|
+
"hooks": [
|
|
279
|
+
{
|
|
280
|
+
"type": "command",
|
|
281
|
+
"command": "cat ~/.claude/context.txt"
|
|
282
|
+
}
|
|
283
|
+
]
|
|
284
|
+
}
|
|
285
|
+
]
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### Persist Environment Variables
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
#!/bin/bash
|
|
294
|
+
# In SessionStart hook
|
|
295
|
+
if [ -n "$CLAUDE_ENV_FILE" ]; then
|
|
296
|
+
echo 'export NODE_ENV=development' >> "$CLAUDE_ENV_FILE"
|
|
297
|
+
fi
|
|
298
|
+
exit 0
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
## Prompt-Based Hooks
|
|
302
|
+
|
|
303
|
+
Use `type: "prompt"` for LLM-evaluated decisions (Stop, SubagentStop):
|
|
304
|
+
|
|
305
|
+
```json
|
|
306
|
+
{
|
|
307
|
+
"hooks": {
|
|
308
|
+
"Stop": [
|
|
309
|
+
{
|
|
310
|
+
"hooks": [
|
|
311
|
+
{
|
|
312
|
+
"type": "prompt",
|
|
313
|
+
"prompt": "Evaluate if Claude should stop: $ARGUMENTS",
|
|
314
|
+
"timeout": 30
|
|
315
|
+
}
|
|
316
|
+
]
|
|
317
|
+
}
|
|
318
|
+
]
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
Response schema:
|
|
324
|
+
```json
|
|
325
|
+
{
|
|
326
|
+
"ok": true,
|
|
327
|
+
"reason": "Explanation (required when ok=false)"
|
|
328
|
+
}
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
## Hooks in Skills/Commands
|
|
332
|
+
|
|
333
|
+
Define hooks in frontmatter (scoped to component lifecycle):
|
|
334
|
+
|
|
335
|
+
```yaml
|
|
336
|
+
---
|
|
337
|
+
name: secure-ops
|
|
338
|
+
hooks:
|
|
339
|
+
PreToolUse:
|
|
340
|
+
- matcher: "Bash"
|
|
341
|
+
hooks:
|
|
342
|
+
- type: command
|
|
343
|
+
command: "./scripts/check.sh"
|
|
344
|
+
once: true
|
|
345
|
+
---
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
`once: true` runs the hook only once per session.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
source: https://code.claude.com/docs/en/overview
|
|
3
|
+
fetched: 2026-01-13
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Claude Code Overview
|
|
7
|
+
|
|
8
|
+
Claude Code is Anthropic's agentic coding tool that lives in your terminal and helps developers turn ideas into code faster. It works within your existing workflow and development environment.
|
|
9
|
+
|
|
10
|
+
## What Claude Code Does
|
|
11
|
+
|
|
12
|
+
- **Build features from descriptions**: Write features in plain English. Claude Code makes a plan, writes the code, and ensures it works.
|
|
13
|
+
- **Debug and fix issues**: Describe bugs or paste error messages. Claude Code analyzes your codebase, identifies problems, and implements fixes.
|
|
14
|
+
- **Navigate any codebase**: Ask questions about your team's codebase and get thoughtful answers. Claude Code maintains awareness of your entire project structure, can find up-to-date information from the web, and can pull from external data sources (Google Drive, Figma, Slack) via MCP.
|
|
15
|
+
- **Automate tedious tasks**: Fix lint issues, resolve merge conflicts, write release notes—all from a single command. Run from your developer machines or automatically in CI.
|
|
16
|
+
|
|
17
|
+
## Why Developers Love Claude Code
|
|
18
|
+
|
|
19
|
+
- **Works in your terminal**: Not another chat window or IDE. Meets you where you already work with the tools you already love.
|
|
20
|
+
- **Takes action**: Directly edit files, run commands, create commits. With MCP, read design docs from Google Drive, update Jira tickets, or use custom tooling.
|
|
21
|
+
- **Unix philosophy**: Composable and scriptable:
|
|
22
|
+
```bash
|
|
23
|
+
tail -f app.log | claude -p "Slack me if you see any anomalies appear in this log stream"
|
|
24
|
+
claude -p "If there are new text strings, translate them into French and raise a PR for @lang-fr-team to review"
|
|
25
|
+
```
|
|
26
|
+
- **Enterprise-ready**: Use the Claude API or host on AWS/GCP with enterprise-grade security, privacy, and compliance. Supports Amazon Bedrock, Google Vertex AI, and Microsoft Foundry.
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
### Prerequisites
|
|
31
|
+
A Claude subscription (Pro, Max, Teams, or Enterprise) or Claude Console account.
|
|
32
|
+
|
|
33
|
+
### macOS/Linux/WSL
|
|
34
|
+
```bash
|
|
35
|
+
curl -fsSL https://claude.ai/install.sh | bash
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Windows PowerShell
|
|
39
|
+
```powershell
|
|
40
|
+
irm https://claude.ai/install.ps1 | iex
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Windows CMD
|
|
44
|
+
```cmd
|
|
45
|
+
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Homebrew
|
|
49
|
+
```bash
|
|
50
|
+
brew install --cask claude-code
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### WinGet
|
|
54
|
+
```powershell
|
|
55
|
+
winget install Anthropic.ClaudeCode
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### NPM (requires Node.js 18+)
|
|
59
|
+
```bash
|
|
60
|
+
npm install -g @anthropic-ai/claude-code
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Quick Start
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
cd your-project
|
|
67
|
+
claude
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
You'll be prompted to log in on first use. Claude Code automatically keeps itself up to date.
|
|
71
|
+
|
|
72
|
+
## Platform Support
|
|
73
|
+
|
|
74
|
+
- **Terminal**: Native CLI experience
|
|
75
|
+
- **Web**: Claude Code on the web
|
|
76
|
+
- **Desktop**: Claude desktop app
|
|
77
|
+
- **IDEs**: VS Code, JetBrains IDEs (IntelliJ, PyCharm, WebStorm, etc.)
|
|
78
|
+
- **Chrome**: Browser extension (beta)
|
|
79
|
+
- **CI/CD**: GitHub Actions, GitLab CI/CD integration
|
|
80
|
+
- **Team Tools**: Slack integration, GitHub @claude mentions
|
|
81
|
+
|
|
82
|
+
## Key Capabilities
|
|
83
|
+
|
|
84
|
+
| Feature | Description |
|
|
85
|
+
|---------|-------------|
|
|
86
|
+
| Codebase awareness | Full project structure understanding |
|
|
87
|
+
| File operations | Read, write, edit files directly |
|
|
88
|
+
| Command execution | Run shell commands and scripts |
|
|
89
|
+
| Git workflows | Commits, branches, PRs, merge conflicts |
|
|
90
|
+
| MCP integration | Connect to external data sources and tools |
|
|
91
|
+
| Custom commands | Slash commands for repeated workflows |
|
|
92
|
+
| Plugins | Extend with custom agents, hooks, and skills |
|
|
93
|
+
|
|
94
|
+
## Language Support
|
|
95
|
+
|
|
96
|
+
Supports 12+ languages including English, French, German, Italian, Japanese, Spanish, Korean, Chinese, Russian, Indonesian, and Portuguese (Brazil).
|
|
97
|
+
|
|
98
|
+
## Resources
|
|
99
|
+
|
|
100
|
+
- [Official Documentation](https://code.claude.com/docs/en/overview)
|
|
101
|
+
- [Quickstart Guide](https://code.claude.com/docs/en/quickstart) (5 minutes)
|
|
102
|
+
- [Common Workflows](https://code.claude.com/docs/en/common-workflows)
|
|
103
|
+
- [Troubleshooting](https://code.claude.com/docs/en/troubleshooting)
|
|
104
|
+
- [IDE Setup](https://code.claude.com/docs/en/vs-code)
|
|
105
|
+
- [Security Documentation](https://code.claude.com/docs/en/security)
|
|
106
|
+
- [Data Usage & Privacy](https://code.claude.com/docs/en/data-usage)
|
|
107
|
+
- [GitHub Repository](https://github.com/anthropics/claude-code)
|
|
108
|
+
- [Claude Developers Discord](https://anthropic.com/discord)
|
|
109
|
+
- [Report Issues](https://github.com/anthropics/claude-code/issues)
|