@qoder-ai/qodercli 0.2.2-beta.3 → 0.2.2-beta.4
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/LICENSE +202 -0
- package/README.md +368 -0
- package/{bundle → bin}/builtin/agent-creator/SKILL.md +15 -26
- package/{bundle → bin}/builtin/skill-creator/SKILL.md +4 -3
- package/bin/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js.map +1 -0
- package/bin/node_modules/@google/gemini-cli-devtools/dist/src/index.js.map +1 -0
- package/bin/node_modules/@google/gemini-cli-devtools/dist/src/types.js.map +1 -0
- package/bin/qodercli +0 -0
- package/bin/run.js +28 -0
- package/package.json +16 -25
- package/bundle/builtin/hook-config/SKILL.md +0 -480
- package/bundle/builtin/mcp-config/SKILL.md +0 -155
- package/bundle/policies/sandbox-default.toml +0 -19
- package/bundle/postinstall.cjs +0 -16
- package/bundle/qodercli.js +0 -5170
- package/bundle/sandbox-macos-permissive-open.sb +0 -27
- package/bundle/sandbox-macos-permissive-proxied.sb +0 -37
- package/bundle/sandbox-macos-restrictive-open.sb +0 -96
- package/bundle/sandbox-macos-restrictive-proxied.sb +0 -98
- package/bundle/sandbox-macos-strict-open.sb +0 -131
- package/bundle/sandbox-macos-strict-proxied.sb +0 -133
- /package/{bundle → bin}/node_modules/@google/gemini-cli-devtools/dist/client/main.js +0 -0
- /package/{bundle → bin}/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.d.ts +0 -0
- /package/{bundle → bin}/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js +0 -0
- /package/{bundle → bin}/node_modules/@google/gemini-cli-devtools/dist/src/index.d.ts +0 -0
- /package/{bundle → bin}/node_modules/@google/gemini-cli-devtools/dist/src/index.js +0 -0
- /package/{bundle → bin}/node_modules/@google/gemini-cli-devtools/dist/src/types.d.ts +0 -0
- /package/{bundle → bin}/node_modules/@google/gemini-cli-devtools/dist/src/types.js +0 -0
- /package/{bundle → bin}/node_modules/@google/gemini-cli-devtools/package.json +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_client-assets.js","sourceRoot":"","sources":["../../src/_client-assets.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,oDAAoD;AACpD,MAAM,CAAC,MAAM,UAAU,GAAG,ynBAAynB,CAAC;AACppB,MAAM,CAAC,MAAM,SAAS,GAAG,278NAA278N,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAkB,MAAM,IAAI,CAAC;AAMrD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAsB5D;;;;GAIG;AACH,MAAM,OAAO,QAAS,SAAQ,YAAY;IAChC,MAAM,CAAC,QAAQ,CAAuB;IACtC,IAAI,GAAiB,EAAE,CAAC;IACxB,WAAW,GAA0B,EAAE,CAAC;IACxC,MAAM,GAAuB,IAAI,CAAC;IAClC,GAAG,GAA2B,IAAI,CAAC;IACnC,QAAQ,GAAG,IAAI,GAAG,EAAuB,CAAC;IAC1C,cAAc,GAA0B,IAAI,CAAC;IAC7C,IAAI,GAAG,KAAK,CAAC;IACb,MAAM,CAAU,YAAY,GAAG,KAAK,CAAC;IACrC,MAAM,CAAU,gBAAgB,GAAG,EAAE,CAAC;IAE9C;QACE,KAAK,EAAE,CAAC;QACR,sEAAsE;QACtE,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IAC3B,CAAC;IAED,MAAM,CAAC,WAAW;QAChB,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;YACvB,QAAQ,CAAC,Q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,OAAgC;QAEhC,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC7C,IAAI,CAAC,OAAO;YAAE,OAAO;QAErB,QAAQ,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YACxB,KAAK,MAAM;gBACT,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;gBAC9B,MAAM;YAER,KAAK,SAAS;gBACZ,IAAI,CAAC,qBAAqB,CACxB,OAAO,CAAC,SAAS,CAAsB,EACvC,SAAS,EACT,OAAO,CAAC,WAAW,CAAW,CAC/B,CAAC;gBACF,MAAM;YAER,KAAK,SAAS;gBACZ,IAAI,CAAC,qBAAqB,CACxB,OAAO,CAAC,SAAS,CAA2B,EAC5C,SAAS,EACT,OAAO,CAAC,WAAW,CAAW,CAC/B,CAAC;gBACF,MAAM;YAER;gBACE,MAAM;QACV,CAAC;IACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/bin/qodercli
ADDED
|
Binary file
|
package/bin/run.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { spawn } = require('child_process');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
|
|
6
|
+
const BINARY_NAME = process.platform === 'win32' ? 'qodercli.exe' : 'qodercli';
|
|
7
|
+
const binPath = path.join(__dirname, BINARY_NAME);
|
|
8
|
+
|
|
9
|
+
if (!fs.existsSync(binPath)) {
|
|
10
|
+
console.error(`qodercli binary not found at: ${binPath}`);
|
|
11
|
+
console.error(`Platform: ${process.platform}/${process.arch}`);
|
|
12
|
+
console.error('This package may not support your platform.');
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const child = spawn(binPath, process.argv.slice(2), {
|
|
17
|
+
stdio: 'inherit',
|
|
18
|
+
windowsHide: false,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
child.on('close', (code) => {
|
|
22
|
+
process.exit(code !== null ? code : 1);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
child.on('error', (error) => {
|
|
26
|
+
console.error('Failed to execute qodercli:', error.message);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
});
|
package/package.json
CHANGED
|
@@ -1,35 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qoder-ai/qodercli",
|
|
3
|
-
"version": "0.2.2-beta.
|
|
4
|
-
"description": "QoderCLI - AI-powered coding assistant for
|
|
5
|
-
"
|
|
6
|
-
"
|
|
3
|
+
"version": "0.2.2-beta.4",
|
|
4
|
+
"description": "QoderCLI - AI-powered coding assistant (Node SEA binary for darwin-arm64)",
|
|
5
|
+
"private": false,
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
7
9
|
"bin": {
|
|
8
|
-
"qodercli": "
|
|
10
|
+
"qodercli": "./bin/run.js"
|
|
9
11
|
},
|
|
10
12
|
"files": [
|
|
11
|
-
"
|
|
13
|
+
"bin/",
|
|
14
|
+
"README.md",
|
|
15
|
+
"LICENSE"
|
|
12
16
|
],
|
|
17
|
+
"os": ["darwin"],
|
|
18
|
+
"cpu": ["arm64"],
|
|
13
19
|
"engines": {
|
|
14
|
-
"node": ">=
|
|
15
|
-
},
|
|
16
|
-
"optionalDependencies": {
|
|
17
|
-
"keytar": "^7.9.0"
|
|
18
|
-
},
|
|
19
|
-
"scripts": {
|
|
20
|
-
"postinstall": "node bundle/postinstall.cjs"
|
|
20
|
+
"node": ">=14"
|
|
21
21
|
},
|
|
22
|
-
"
|
|
23
|
-
"access": "public"
|
|
24
|
-
},
|
|
25
|
-
"keywords": [
|
|
26
|
-
"qoder",
|
|
27
|
-
"ai",
|
|
28
|
-
"cli",
|
|
29
|
-
"coding",
|
|
30
|
-
"assistant",
|
|
31
|
-
"terminal"
|
|
32
|
-
],
|
|
22
|
+
"keywords": ["qoder", "ai", "cli", "coding", "assistant", "terminal"],
|
|
33
23
|
"author": "Qoder AI",
|
|
24
|
+
"license": "Apache-2.0",
|
|
34
25
|
"homepage": "https://qoder.com"
|
|
35
|
-
}
|
|
26
|
+
}
|
|
@@ -1,480 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: hook-config
|
|
3
|
-
description:
|
|
4
|
-
Guide for creating and configuring hooks. Use when users want to add
|
|
5
|
-
automated behaviors triggered by tool execution, session lifecycle,
|
|
6
|
-
or other events in the Qoder CLI hook system.
|
|
7
|
-
allowed-tools: Edit, Write
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# Creating Hooks for Qoder CLI
|
|
11
|
-
|
|
12
|
-
This skill guides you through creating hooks — automated behaviors that
|
|
13
|
-
trigger on specific events like tool execution, session lifecycle, file
|
|
14
|
-
changes, and notifications. Hooks are configured in settings.json files.
|
|
15
|
-
|
|
16
|
-
## When to Use Hooks
|
|
17
|
-
|
|
18
|
-
Use hooks when you need:
|
|
19
|
-
|
|
20
|
-
- **Automated side effects** after tool execution (format, lint, test)
|
|
21
|
-
- **Guardrails** before tool execution (block protected files, detect secrets)
|
|
22
|
-
- **Notifications** when events occur (desktop alerts, webhooks)
|
|
23
|
-
- **Validation gates** that block or allow operations based on conditions
|
|
24
|
-
- **Session automation** at start, end, or compaction
|
|
25
|
-
|
|
26
|
-
**When NOT to use hooks:**
|
|
27
|
-
|
|
28
|
-
- One-off tasks (just do them directly)
|
|
29
|
-
- Complex multi-step workflows (use agents or skills instead)
|
|
30
|
-
- Anything that needs user interaction mid-execution
|
|
31
|
-
|
|
32
|
-
## Configuration Scopes
|
|
33
|
-
|
|
34
|
-
| Scope | File | Use Case |
|
|
35
|
-
| ----------- | ------------------------------------ | -------------------------------- |
|
|
36
|
-
| **Project** | `${QODER_CONFIG_DIR}/settings.json` | Team-shared, version controlled |
|
|
37
|
-
| **Local** | `${QODER_CONFIG_DIR}/settings.local.json` | Personal, not committed |
|
|
38
|
-
| **User** | `~/${QODER_CONFIG_DIR}/settings.json` | Global across all projects |
|
|
39
|
-
|
|
40
|
-
**Choose project** for team guardrails and standards.
|
|
41
|
-
**Choose local** for personal preferences and notifications.
|
|
42
|
-
**Choose user** for global behaviors across all projects.
|
|
43
|
-
|
|
44
|
-
## Configuration Format
|
|
45
|
-
|
|
46
|
-
```jsonc
|
|
47
|
-
{
|
|
48
|
-
"hooks": {
|
|
49
|
-
"<EventName>": [
|
|
50
|
-
{
|
|
51
|
-
"matcher": "<regex>",
|
|
52
|
-
"hooks": [
|
|
53
|
-
{
|
|
54
|
-
"type": "command",
|
|
55
|
-
"command": "${QODER_CONFIG_DIR}/hooks/my-hook.sh",
|
|
56
|
-
"name": "my-hook",
|
|
57
|
-
"timeout": 60
|
|
58
|
-
}
|
|
59
|
-
]
|
|
60
|
-
}
|
|
61
|
-
]
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
Each event maps to an array of **hook definitions**. Each definition has:
|
|
67
|
-
|
|
68
|
-
| Field | Required | Description |
|
|
69
|
-
| ------------ | -------- | --------------------------------------------------- |
|
|
70
|
-
| `matcher` | No | Regex filter (matches tool name for tool events) |
|
|
71
|
-
| `hooks` | Yes | Array of hook handlers |
|
|
72
|
-
| `sequential` | No | Run hooks in order instead of parallel |
|
|
73
|
-
| `async` | No | Fire-and-forget, don't block the operation |
|
|
74
|
-
|
|
75
|
-
### Hook Handler Fields
|
|
76
|
-
|
|
77
|
-
| Field | Required | Description |
|
|
78
|
-
| --------------- | ------------ | ----------------------------------------------------- |
|
|
79
|
-
| `type` | Yes | `command`, `http`, `prompt`, or `agent` |
|
|
80
|
-
| `command` | command type | Shell command to execute |
|
|
81
|
-
| `url` | http type | Webhook URL to POST to |
|
|
82
|
-
| `prompt` | prompt/agent | LLM prompt text |
|
|
83
|
-
| `if` | No | Per-hook condition: `"ToolName(glob)"` or `"ToolName"` |
|
|
84
|
-
| `name` | No | Display name |
|
|
85
|
-
| `description` | No | Human-readable description |
|
|
86
|
-
| `timeout` | No | Seconds before timeout |
|
|
87
|
-
| `statusMessage` | No | Text shown in UI during execution |
|
|
88
|
-
| `async` | No | Run in background without blocking |
|
|
89
|
-
| `asyncRewake` | No | Background hook; exit code 2 wakes model |
|
|
90
|
-
|
|
91
|
-
## Hook Events
|
|
92
|
-
|
|
93
|
-
### Tool Events (matcher = tool name regex)
|
|
94
|
-
|
|
95
|
-
| Event | When |
|
|
96
|
-
| -------------------- | ------------------------------- |
|
|
97
|
-
| `PreToolUse` | Before tool execution |
|
|
98
|
-
| `PostToolUse` | After successful tool execution |
|
|
99
|
-
| `PostToolUseFailure` | After tool execution fails |
|
|
100
|
-
| `PermissionRequest` | Tool requests user permission |
|
|
101
|
-
|
|
102
|
-
### Session & Agent Lifecycle
|
|
103
|
-
|
|
104
|
-
| Event | When |
|
|
105
|
-
| --------------- | ------------------------------------ |
|
|
106
|
-
| `SessionStart` | Session initializes |
|
|
107
|
-
| `SessionEnd` | Session tears down |
|
|
108
|
-
| `SubagentStart` | Sub-agent session begins |
|
|
109
|
-
| `SubagentStop` | Sub-agent session ends |
|
|
110
|
-
| `Stop` | Agent decides to stop |
|
|
111
|
-
| `StopFailure` | Stop process fails (error, timeout) |
|
|
112
|
-
| `PreCompact` | Before context compaction |
|
|
113
|
-
| `PostCompact` | After context compaction |
|
|
114
|
-
|
|
115
|
-
### User, Config & Notification Events
|
|
116
|
-
|
|
117
|
-
| Event | When |
|
|
118
|
-
| -------------------- | ------------------------------- |
|
|
119
|
-
| `UserPromptSubmit` | User submits a prompt |
|
|
120
|
-
| `ConfigChange` | Settings change at runtime |
|
|
121
|
-
| `Notification` | External notification arrives |
|
|
122
|
-
| `InstructionsLoaded` | System instructions loaded |
|
|
123
|
-
|
|
124
|
-
### File & Workspace Events
|
|
125
|
-
|
|
126
|
-
| Event | When |
|
|
127
|
-
| ---------------- | -------------------------- |
|
|
128
|
-
| `CwdChanged` | Working directory changes |
|
|
129
|
-
| `FileChanged` | Watched file changes |
|
|
130
|
-
| `WorktreeCreate` | Git worktree created |
|
|
131
|
-
| `WorktreeRemove` | Git worktree removed |
|
|
132
|
-
|
|
133
|
-
### Task Events
|
|
134
|
-
|
|
135
|
-
| Event | When |
|
|
136
|
-
| --------------- | ----------------------------- |
|
|
137
|
-
| `TaskCreated` | Background task created |
|
|
138
|
-
| `TaskCompleted` | Background task completes |
|
|
139
|
-
|
|
140
|
-
## Handler Types
|
|
141
|
-
|
|
142
|
-
### Command (`type: "command"`)
|
|
143
|
-
|
|
144
|
-
Executes a shell command. Hook input arrives as JSON on **stdin**.
|
|
145
|
-
Output is parsed from **stdout** as JSON.
|
|
146
|
-
|
|
147
|
-
**Exit code semantics:**
|
|
148
|
-
|
|
149
|
-
| Exit Code | Meaning |
|
|
150
|
-
| --------- | -------------------------------- |
|
|
151
|
-
| 0 | Success — parse stdout as JSON |
|
|
152
|
-
| 2 | Blocking deny — stderr is reason |
|
|
153
|
-
| Other | Non-blocking warning |
|
|
154
|
-
|
|
155
|
-
**Stdin** receives the full hook input as JSON (fields vary by event):
|
|
156
|
-
|
|
157
|
-
```json
|
|
158
|
-
{
|
|
159
|
-
"session_id": "abc-123",
|
|
160
|
-
"cwd": "/path/to/project",
|
|
161
|
-
"hook_event_name": "PreToolUse",
|
|
162
|
-
"tool_name": "Edit",
|
|
163
|
-
"tool_input": { "file_path": "src/app.ts", "old_string": "...", "new_string": "..." }
|
|
164
|
-
}
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
**Stdout** JSON output (all fields optional):
|
|
168
|
-
|
|
169
|
-
```json
|
|
170
|
-
{
|
|
171
|
-
"decision": "allow",
|
|
172
|
-
"reason": "Checks passed",
|
|
173
|
-
"hookSpecificOutput": {
|
|
174
|
-
"additionalContext": "Message injected into conversation"
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
Best for: scripts, linters, formatters, external CLI tools.
|
|
180
|
-
|
|
181
|
-
### HTTP (`type: "http"`)
|
|
182
|
-
|
|
183
|
-
POSTs hook input as JSON to the URL. Response parsed as JSON hook
|
|
184
|
-
output. Headers support `${ENV_VAR}` interpolation.
|
|
185
|
-
|
|
186
|
-
```jsonc
|
|
187
|
-
{
|
|
188
|
-
"type": "http",
|
|
189
|
-
"url": "https://api.example.com/hooks",
|
|
190
|
-
"headers": { "Authorization": "Bearer ${API_TOKEN}" }
|
|
191
|
-
}
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
Best for: webhooks, external integrations, CI/CD triggers.
|
|
195
|
-
|
|
196
|
-
### Prompt (`type: "prompt"`)
|
|
197
|
-
|
|
198
|
-
Single-turn LLM evaluation. The prompt plus hook input go to the model,
|
|
199
|
-
which returns a structured JSON decision.
|
|
200
|
-
|
|
201
|
-
```jsonc
|
|
202
|
-
{
|
|
203
|
-
"type": "prompt",
|
|
204
|
-
"prompt": "Review this edit for security issues. Return {\"decision\": \"allow\"} or {\"decision\": \"deny\", \"reason\": \"...\"}"
|
|
205
|
-
}
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
Best for: AI-powered review gates, semantic validation.
|
|
209
|
-
|
|
210
|
-
### Agent (`type: "agent"`)
|
|
211
|
-
|
|
212
|
-
Spawns a sub-agent with tool access.
|
|
213
|
-
|
|
214
|
-
```jsonc
|
|
215
|
-
{
|
|
216
|
-
"type": "agent",
|
|
217
|
-
"prompt": "Verify the edited file passes type checking. $ARGUMENTS",
|
|
218
|
-
"tools": ["Bash", "Read"],
|
|
219
|
-
"maxTurns": 10,
|
|
220
|
-
"timeout": 120
|
|
221
|
-
}
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
Best for: complex verification needing tool use (run tests, read files,
|
|
225
|
-
check types).
|
|
226
|
-
|
|
227
|
-
## The `if` Condition
|
|
228
|
-
|
|
229
|
-
Narrow when a hook fires within a matched definition:
|
|
230
|
-
|
|
231
|
-
```jsonc
|
|
232
|
-
{ "if": "Edit(*.ts)" } // Only Edit calls on .ts files
|
|
233
|
-
{ "if": "Write(src/**)" } // Only Write calls under src/
|
|
234
|
-
{ "if": "Bash" } // Any Bash call
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
Format: `"ToolName(glob_pattern)"` or `"ToolName"`.
|
|
238
|
-
The glob matches the tool's primary argument (typically a file path).
|
|
239
|
-
|
|
240
|
-
## Hook Creation Workflow
|
|
241
|
-
|
|
242
|
-
### Step 1: Determine the Behavior
|
|
243
|
-
|
|
244
|
-
Understand what the user wants:
|
|
245
|
-
|
|
246
|
-
- What should happen automatically?
|
|
247
|
-
- When should it trigger? (before/after tool use, session event, etc.)
|
|
248
|
-
- Should it block operations or just observe?
|
|
249
|
-
- Who needs it? (team or personal)
|
|
250
|
-
|
|
251
|
-
**Avoid interrogation loops.** Propose a concrete hook config based on
|
|
252
|
-
initial understanding and ask the user to refine.
|
|
253
|
-
|
|
254
|
-
### Step 2: Choose Event, Matcher, and Handler
|
|
255
|
-
|
|
256
|
-
Map the behavior:
|
|
257
|
-
|
|
258
|
-
| Behavior | Event | Matcher | Handler |
|
|
259
|
-
| ---------------------- | ------------- | -------------- | ------- |
|
|
260
|
-
| Auto-format after edits| `PostToolUse` | `Edit\|Write` | command |
|
|
261
|
-
| Block protected files | `PreToolUse` | `Edit\|Write` | command |
|
|
262
|
-
| Secret detection | `PreToolUse` | `Edit\|Write` | command |
|
|
263
|
-
| Desktop notifications | `Notification`| — | command |
|
|
264
|
-
| Run tests after changes| `PostToolUse` | `Edit\|Write` | command |
|
|
265
|
-
| AI code review gate | `PreToolUse` | `Edit` | prompt |
|
|
266
|
-
| Type-check verification| `PostToolUse` | `Edit\|Write` | agent |
|
|
267
|
-
| Webhook to CI/CD | `PostToolUse` | `Edit\|Write` | http |
|
|
268
|
-
| Dependency guard | `PreToolUse` | `Edit` | command |
|
|
269
|
-
|
|
270
|
-
### Step 3: Choose Scope
|
|
271
|
-
|
|
272
|
-
- **Project** (`${QODER_CONFIG_DIR}/settings.json`): Team standards, check in
|
|
273
|
-
- **Local** (`${QODER_CONFIG_DIR}/settings.local.json`): Personal, not committed
|
|
274
|
-
- **User** (`~/${QODER_CONFIG_DIR}/settings.json`): Global, all projects
|
|
275
|
-
|
|
276
|
-
### Step 4: Create the Configuration
|
|
277
|
-
|
|
278
|
-
1. Read the target settings.json (if it exists)
|
|
279
|
-
2. Merge the new hook into the existing `hooks` object
|
|
280
|
-
3. Write back the file
|
|
281
|
-
|
|
282
|
-
If no hooks exist yet, create the full structure.
|
|
283
|
-
|
|
284
|
-
### Step 5: Create Script Files (command type)
|
|
285
|
-
|
|
286
|
-
For command hooks with non-trivial logic, create scripts in
|
|
287
|
-
`${QODER_CONFIG_DIR}/hooks/`:
|
|
288
|
-
|
|
289
|
-
```bash
|
|
290
|
-
mkdir -p ${QODER_CONFIG_DIR}/hooks
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
Script requirements:
|
|
294
|
-
- Read JSON from stdin
|
|
295
|
-
- Write JSON to stdout (or nothing for simple success)
|
|
296
|
-
- Exit 0 for success, 2 for blocking deny, other for warning
|
|
297
|
-
- Use stderr for error messages and debug output
|
|
298
|
-
- Make executable: `chmod +x ${QODER_CONFIG_DIR}/hooks/my-hook.sh`
|
|
299
|
-
|
|
300
|
-
Test independently:
|
|
301
|
-
|
|
302
|
-
```bash
|
|
303
|
-
echo '{"tool_name":"Edit","tool_input":{"file_path":"test.ts"}}' | \
|
|
304
|
-
${QODER_CONFIG_DIR}/hooks/my-hook.sh
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
### Step 6: Verify
|
|
308
|
-
|
|
309
|
-
Tell the user to verify:
|
|
310
|
-
|
|
311
|
-
1. Restart the session or trigger the relevant event
|
|
312
|
-
2. Check the hook fires and produces expected output
|
|
313
|
-
3. Test the blocking path (for PreToolUse guards)
|
|
314
|
-
4. Confirm `async` hooks don't block the session
|
|
315
|
-
|
|
316
|
-
## Best Practices
|
|
317
|
-
|
|
318
|
-
1. **Keep hooks fast** — Target <5s for synchronous hooks
|
|
319
|
-
2. **Test scripts independently** — Pipe sample JSON stdin, verify output
|
|
320
|
-
3. **Use `async: true`** for non-blocking side effects (notifications, logging)
|
|
321
|
-
4. **Scope matchers narrowly** — Don't fire on every tool invocation
|
|
322
|
-
5. **Prefer `if` conditions** for file-type filtering
|
|
323
|
-
6. **Log to stderr** — stdout is parsed as JSON; debug output goes to stderr
|
|
324
|
-
7. **Handle edge cases** — Exit 0 if the condition doesn't apply
|
|
325
|
-
8. **Use `statusMessage`** for meaningful UI feedback during execution
|
|
326
|
-
|
|
327
|
-
## Anti-Patterns to Avoid
|
|
328
|
-
|
|
329
|
-
- **Overly broad matchers** — `".*"` on PreToolUse fires on every single tool call
|
|
330
|
-
- **Long synchronous hooks** — Block the entire interactive session
|
|
331
|
-
- **Stdout pollution** — Non-JSON stdout causes parse errors
|
|
332
|
-
- **Missing shebang** — Scripts without `#!/bin/bash` may fail silently
|
|
333
|
-
|
|
334
|
-
## Examples
|
|
335
|
-
|
|
336
|
-
### Auto-Format TypeScript
|
|
337
|
-
|
|
338
|
-
Runs Prettier on TypeScript files after every Edit or Write.
|
|
339
|
-
|
|
340
|
-
**`${QODER_CONFIG_DIR}/settings.json`:**
|
|
341
|
-
|
|
342
|
-
```jsonc
|
|
343
|
-
{
|
|
344
|
-
"hooks": {
|
|
345
|
-
"PostToolUse": [{
|
|
346
|
-
"matcher": "Edit|Write",
|
|
347
|
-
"hooks": [{
|
|
348
|
-
"type": "command",
|
|
349
|
-
"command": "${QODER_CONFIG_DIR}/hooks/auto-format.sh",
|
|
350
|
-
"if": "Edit(*.{ts,tsx,js,jsx})",
|
|
351
|
-
"name": "auto-format",
|
|
352
|
-
"statusMessage": "Formatting..."
|
|
353
|
-
}]
|
|
354
|
-
}]
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
```
|
|
358
|
-
|
|
359
|
-
**`${QODER_CONFIG_DIR}/hooks/auto-format.sh`:**
|
|
360
|
-
|
|
361
|
-
```bash
|
|
362
|
-
#!/bin/bash
|
|
363
|
-
INPUT=$(cat)
|
|
364
|
-
FILE=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty')
|
|
365
|
-
[ -z "$FILE" ] && exit 0
|
|
366
|
-
[ -f "$FILE" ] || exit 0
|
|
367
|
-
npx prettier --write "$FILE" >/dev/null 2>&1
|
|
368
|
-
exit 0
|
|
369
|
-
```
|
|
370
|
-
|
|
371
|
-
### Protected File Guard
|
|
372
|
-
|
|
373
|
-
Blocks edits to lock files and CI configuration.
|
|
374
|
-
|
|
375
|
-
**`${QODER_CONFIG_DIR}/settings.json`:**
|
|
376
|
-
|
|
377
|
-
```jsonc
|
|
378
|
-
{
|
|
379
|
-
"hooks": {
|
|
380
|
-
"PreToolUse": [{
|
|
381
|
-
"matcher": "Edit|Write",
|
|
382
|
-
"hooks": [{
|
|
383
|
-
"type": "command",
|
|
384
|
-
"command": "${QODER_CONFIG_DIR}/hooks/protected-files.sh",
|
|
385
|
-
"name": "protected-file-guard",
|
|
386
|
-
"statusMessage": "Checking file permissions..."
|
|
387
|
-
}]
|
|
388
|
-
}]
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
```
|
|
392
|
-
|
|
393
|
-
**`${QODER_CONFIG_DIR}/hooks/protected-files.sh`:**
|
|
394
|
-
|
|
395
|
-
```bash
|
|
396
|
-
#!/bin/bash
|
|
397
|
-
INPUT=$(cat)
|
|
398
|
-
FILE=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty')
|
|
399
|
-
[ -z "$FILE" ] && exit 0
|
|
400
|
-
|
|
401
|
-
PROTECTED_PATTERNS=(
|
|
402
|
-
"package-lock.json"
|
|
403
|
-
"yarn.lock"
|
|
404
|
-
"pnpm-lock.yaml"
|
|
405
|
-
".github/workflows/*"
|
|
406
|
-
".gitlab-ci.yml"
|
|
407
|
-
)
|
|
408
|
-
|
|
409
|
-
for PATTERN in "${PROTECTED_PATTERNS[@]}"; do
|
|
410
|
-
if [[ "$FILE" == $PATTERN ]]; then
|
|
411
|
-
echo "Blocked: $FILE is a protected file" >&2
|
|
412
|
-
exit 2
|
|
413
|
-
fi
|
|
414
|
-
done
|
|
415
|
-
|
|
416
|
-
exit 0
|
|
417
|
-
```
|
|
418
|
-
|
|
419
|
-
### Desktop Notification
|
|
420
|
-
|
|
421
|
-
Sends a macOS notification when Qoder CLI needs attention.
|
|
422
|
-
|
|
423
|
-
**`${QODER_CONFIG_DIR}/settings.local.json`:**
|
|
424
|
-
|
|
425
|
-
```jsonc
|
|
426
|
-
{
|
|
427
|
-
"hooks": {
|
|
428
|
-
"Notification": [{
|
|
429
|
-
"hooks": [{
|
|
430
|
-
"type": "command",
|
|
431
|
-
"command": "${QODER_CONFIG_DIR}/hooks/notify.sh",
|
|
432
|
-
"name": "desktop-notify",
|
|
433
|
-
"async": true
|
|
434
|
-
}]
|
|
435
|
-
}]
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
```
|
|
439
|
-
|
|
440
|
-
**`${QODER_CONFIG_DIR}/hooks/notify.sh`:**
|
|
441
|
-
|
|
442
|
-
```bash
|
|
443
|
-
#!/bin/bash
|
|
444
|
-
INPUT=$(cat)
|
|
445
|
-
TITLE=$(echo "$INPUT" | jq -r '.title // "Qoder CLI"')
|
|
446
|
-
MSG=$(echo "$INPUT" | jq -r '.message // "Notification"')
|
|
447
|
-
|
|
448
|
-
if command -v osascript &>/dev/null; then
|
|
449
|
-
osascript -e "display notification \"$MSG\" with title \"$TITLE\""
|
|
450
|
-
elif command -v notify-send &>/dev/null; then
|
|
451
|
-
notify-send "$TITLE" "$MSG"
|
|
452
|
-
fi
|
|
453
|
-
exit 0
|
|
454
|
-
```
|
|
455
|
-
|
|
456
|
-
### Type-Check Gate
|
|
457
|
-
|
|
458
|
-
Uses an agent to verify TypeScript compiles after edits.
|
|
459
|
-
|
|
460
|
-
**`${QODER_CONFIG_DIR}/settings.json`:**
|
|
461
|
-
|
|
462
|
-
```jsonc
|
|
463
|
-
{
|
|
464
|
-
"hooks": {
|
|
465
|
-
"PostToolUse": [{
|
|
466
|
-
"matcher": "Edit|Write",
|
|
467
|
-
"hooks": [{
|
|
468
|
-
"type": "agent",
|
|
469
|
-
"prompt": "Run `npx tsc --noEmit` and check for type errors in the edited file. If there are errors, report them. $ARGUMENTS",
|
|
470
|
-
"tools": ["Bash", "Read"],
|
|
471
|
-
"if": "Edit(*.{ts,tsx})",
|
|
472
|
-
"name": "type-check",
|
|
473
|
-
"statusMessage": "Type checking...",
|
|
474
|
-
"maxTurns": 5,
|
|
475
|
-
"timeout": 60
|
|
476
|
-
}]
|
|
477
|
-
}]
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
```
|