@kodus/cli 0.4.4 → 0.4.7
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/README.md +110 -7
- package/dist/agents/agent.interface.d.ts.map +1 -1
- package/dist/agents/claude-code.agent.d.ts.map +1 -1
- package/dist/agents/claude-code.agent.js +16 -5
- package/dist/agents/claude-code.agent.js.map +1 -1
- package/dist/agents/codex.agent.d.ts +14 -0
- package/dist/agents/codex.agent.d.ts.map +1 -0
- package/dist/agents/codex.agent.js +77 -0
- package/dist/agents/codex.agent.js.map +1 -0
- package/dist/agents/cursor.agent.d.ts +29 -0
- package/dist/agents/cursor.agent.d.ts.map +1 -0
- package/dist/agents/cursor.agent.js +85 -0
- package/dist/agents/cursor.agent.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +8 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/config.d.ts +8 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +84 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/hook/index.js +4 -2
- package/dist/commands/hook/index.js.map +1 -1
- package/dist/commands/hook/install.d.ts +3 -1
- package/dist/commands/hook/install.d.ts.map +1 -1
- package/dist/commands/hook/install.js +76 -37
- package/dist/commands/hook/install.js.map +1 -1
- package/dist/commands/hook/uninstall.d.ts +4 -1
- package/dist/commands/hook/uninstall.d.ts.map +1 -1
- package/dist/commands/hook/uninstall.js +54 -19
- package/dist/commands/hook/uninstall.js.map +1 -1
- package/dist/commands/memory/capture.d.ts.map +1 -1
- package/dist/commands/memory/capture.js +3 -36
- package/dist/commands/memory/capture.js.map +1 -1
- package/dist/commands/memory/disable.d.ts +4 -1
- package/dist/commands/memory/disable.d.ts.map +1 -1
- package/dist/commands/memory/disable.js +58 -15
- package/dist/commands/memory/disable.js.map +1 -1
- package/dist/commands/memory/enable.d.ts.map +1 -1
- package/dist/commands/memory/enable.js +24 -7
- package/dist/commands/memory/enable.js.map +1 -1
- package/dist/commands/memory/hooks.d.ts +2 -1
- package/dist/commands/memory/hooks.d.ts.map +1 -1
- package/dist/commands/memory/hooks.js +13 -5
- package/dist/commands/memory/hooks.js.map +1 -1
- package/dist/commands/memory/index.d.ts.map +1 -1
- package/dist/commands/memory/index.js +13 -3
- package/dist/commands/memory/index.js.map +1 -1
- package/dist/commands/memory/session-hooks/claude-code.d.ts.map +1 -1
- package/dist/commands/memory/session-hooks/claude-code.js +4 -1
- package/dist/commands/memory/session-hooks/claude-code.js.map +1 -1
- package/dist/commands/memory/session-hooks/codex.d.ts +2 -0
- package/dist/commands/memory/session-hooks/codex.d.ts.map +1 -0
- package/dist/commands/memory/session-hooks/codex.js +16 -0
- package/dist/commands/memory/session-hooks/codex.js.map +1 -0
- package/dist/commands/memory/session-hooks/cursor.d.ts.map +1 -1
- package/dist/commands/memory/session-hooks/cursor.js +7 -12
- package/dist/commands/memory/session-hooks/cursor.js.map +1 -1
- package/dist/commands/memory/session-hooks/index.d.ts.map +1 -1
- package/dist/commands/memory/session-hooks/index.js +8 -3
- package/dist/commands/memory/session-hooks/index.js.map +1 -1
- package/dist/commands/memory/session-hooks/shared.d.ts.map +1 -1
- package/dist/commands/memory/session-hooks/shared.js +7 -31
- package/dist/commands/memory/session-hooks/shared.js.map +1 -1
- package/dist/commands/memory/session-hooks-install-codex.d.ts +19 -0
- package/dist/commands/memory/session-hooks-install-codex.d.ts.map +1 -0
- package/dist/commands/memory/session-hooks-install-codex.js +91 -0
- package/dist/commands/memory/session-hooks-install-codex.js.map +1 -0
- package/dist/commands/memory/session-hooks-install-cursor.d.ts +9 -0
- package/dist/commands/memory/session-hooks-install-cursor.d.ts.map +1 -0
- package/dist/commands/memory/session-hooks-install-cursor.js +119 -0
- package/dist/commands/memory/session-hooks-install-cursor.js.map +1 -0
- package/dist/commands/memory/session-hooks-install.d.ts.map +1 -1
- package/dist/commands/memory/session-hooks-install.js +61 -27
- package/dist/commands/memory/session-hooks-install.js.map +1 -1
- package/dist/commands/pr.d.ts.map +1 -1
- package/dist/commands/pr.js +71 -20
- package/dist/commands/pr.js.map +1 -1
- package/dist/commands/review.d.ts.map +1 -1
- package/dist/commands/review.js +76 -24
- package/dist/commands/review.js.map +1 -1
- package/dist/commands/schema.d.ts +3 -0
- package/dist/commands/schema.d.ts.map +1 -0
- package/dist/commands/schema.js +62 -0
- package/dist/commands/schema.js.map +1 -0
- package/dist/commands/skills.d.ts +3 -0
- package/dist/commands/skills.d.ts.map +1 -0
- package/dist/commands/skills.js +85 -0
- package/dist/commands/skills.js.map +1 -0
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +3 -1
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +17 -2
- package/dist/commands/update.js.map +1 -1
- package/dist/index.js +18 -1
- package/dist/index.js.map +1 -1
- package/dist/services/api/api.interface.d.ts +7 -4
- package/dist/services/api/api.interface.d.ts.map +1 -1
- package/dist/services/api/api.real.d.ts +2 -1
- package/dist/services/api/api.real.d.ts.map +1 -1
- package/dist/services/api/api.real.js +36 -10
- package/dist/services/api/api.real.js.map +1 -1
- package/dist/services/api/sessions.api.d.ts.map +1 -1
- package/dist/services/api/sessions.api.js +12 -6
- package/dist/services/api/sessions.api.js.map +1 -1
- package/dist/services/git-hooks.service.d.ts.map +1 -1
- package/dist/services/git-hooks.service.js +14 -6
- package/dist/services/git-hooks.service.js.map +1 -1
- package/dist/services/git.service.d.ts.map +1 -1
- package/dist/services/git.service.js +6 -2
- package/dist/services/git.service.js.map +1 -1
- package/dist/services/hook-logger.service.d.ts.map +1 -1
- package/dist/services/hook-logger.service.js +2 -1
- package/dist/services/hook-logger.service.js.map +1 -1
- package/dist/services/lifecycle.service.d.ts +1 -0
- package/dist/services/lifecycle.service.d.ts.map +1 -1
- package/dist/services/lifecycle.service.js +101 -16
- package/dist/services/lifecycle.service.js.map +1 -1
- package/dist/services/repo-config.service.d.ts +22 -0
- package/dist/services/repo-config.service.d.ts.map +1 -0
- package/dist/services/repo-config.service.js +87 -0
- package/dist/services/repo-config.service.js.map +1 -0
- package/dist/services/review.service.d.ts +0 -3
- package/dist/services/review.service.d.ts.map +1 -1
- package/dist/services/review.service.js.map +1 -1
- package/dist/services/session-local.service.d.ts +16 -0
- package/dist/services/session-local.service.d.ts.map +1 -1
- package/dist/services/session-local.service.js +49 -0
- package/dist/services/session-local.service.js.map +1 -1
- package/dist/services/transcript.service.d.ts.map +1 -1
- package/dist/services/transcript.service.js +44 -13
- package/dist/services/transcript.service.js.map +1 -1
- package/dist/types/command-output.d.ts +29 -0
- package/dist/types/command-output.d.ts.map +1 -0
- package/dist/types/command-output.js +2 -0
- package/dist/types/command-output.js.map +1 -0
- package/dist/types/index.d.ts +18 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/session-events.d.ts.map +1 -1
- package/dist/types/session.d.ts +3 -1
- package/dist/types/session.d.ts.map +1 -1
- package/dist/types/session.js +5 -1
- package/dist/types/session.js.map +1 -1
- package/dist/utils/banner.d.ts.map +1 -1
- package/dist/utils/banner.js +2 -0
- package/dist/utils/banner.js.map +1 -1
- package/dist/utils/command-context.d.ts +12 -0
- package/dist/utils/command-context.d.ts.map +1 -0
- package/dist/utils/command-context.js +15 -0
- package/dist/utils/command-context.js.map +1 -0
- package/dist/utils/command-errors.d.ts +12 -0
- package/dist/utils/command-errors.d.ts.map +1 -0
- package/dist/utils/command-errors.js +88 -0
- package/dist/utils/command-errors.js.map +1 -0
- package/dist/utils/command-output.d.ts +5 -0
- package/dist/utils/command-output.d.ts.map +1 -0
- package/dist/utils/command-output.js +46 -0
- package/dist/utils/command-output.js.map +1 -0
- package/dist/utils/command-schema.d.ts +29 -0
- package/dist/utils/command-schema.d.ts.map +1 -0
- package/dist/utils/command-schema.js +74 -0
- package/dist/utils/command-schema.js.map +1 -0
- package/dist/utils/field-mask.d.ts +2 -0
- package/dist/utils/field-mask.d.ts.map +1 -0
- package/dist/utils/field-mask.js +93 -0
- package/dist/utils/field-mask.js.map +1 -0
- package/dist/utils/input-validation.d.ts +11 -0
- package/dist/utils/input-validation.d.ts.map +1 -0
- package/dist/utils/input-validation.js +73 -0
- package/dist/utils/input-validation.js.map +1 -0
- package/dist/utils/install-instructions.d.ts +6 -0
- package/dist/utils/install-instructions.d.ts.map +1 -0
- package/dist/utils/install-instructions.js +18 -0
- package/dist/utils/install-instructions.js.map +1 -0
- package/dist/utils/skills-sync.d.ts +39 -0
- package/dist/utils/skills-sync.d.ts.map +1 -0
- package/dist/utils/skills-sync.js +396 -0
- package/dist/utils/skills-sync.js.map +1 -0
- package/dist/utils/skills.d.ts +7 -0
- package/dist/utils/skills.d.ts.map +1 -1
- package/dist/utils/skills.js +61 -22
- package/dist/utils/skills.js.map +1 -1
- package/dist/utils/stream-input.d.ts +13 -0
- package/dist/utils/stream-input.d.ts.map +1 -0
- package/dist/utils/stream-input.js +36 -0
- package/dist/utils/stream-input.js.map +1 -0
- package/package.json +10 -8
- package/skills/README.md +12 -5
- package/skills/kodus-business-rules-validation/SKILL.md +65 -0
- package/skills/kodus-pr-suggestions-resolver/SKILL.md +6 -6
- package/skills/kodus-review/SKILL.md +20 -7
- package/skills/kodus-review-dev/SKILL.md +22 -8
- package/skills/business-rules-validation/SKILL.md +0 -43
package/README.md
CHANGED
|
@@ -109,14 +109,22 @@ Stored in `.kody/pr/by-sha/<head-sha>.md` — versioned with your code, readable
|
|
|
109
109
|
|
|
110
110
|
Kodus is designed to work **inside AI coding agents**. While you can use it standalone, the real power comes when your agent runs reviews automatically and fixes issues in a loop — no manual intervention needed.
|
|
111
111
|
|
|
112
|
-
**Works with:** Claude Code, Cursor, Windsurf, GitHub Copilot, Gemini CLI, and
|
|
112
|
+
**Works with:** Claude Code, Cursor, Windsurf, GitHub Copilot, Gemini CLI, and 20+ more environments.
|
|
113
113
|
|
|
114
114
|
### Install the Skill (recommended)
|
|
115
115
|
|
|
116
116
|
The fastest way to get started. Auto-detects your installed IDEs and sets everything up:
|
|
117
117
|
|
|
118
|
+
macOS/Linux:
|
|
119
|
+
|
|
118
120
|
```bash
|
|
119
|
-
curl -fsSL https://
|
|
121
|
+
curl -fsSL https://raw.githubusercontent.com/kodustech/cli/main/install.sh | bash
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Windows PowerShell:
|
|
125
|
+
|
|
126
|
+
```powershell
|
|
127
|
+
powershell -NoProfile -ExecutionPolicy Bypass -Command "$tmp = Join-Path $env:TEMP 'kodus-install.ps1'; Invoke-WebRequest https://raw.githubusercontent.com/kodustech/cli/main/install.ps1 -OutFile $tmp; & $tmp"
|
|
120
128
|
```
|
|
121
129
|
|
|
122
130
|
This installs the Kodus CLI globally and deploys the review skill into every supported agent on your machine — Claude Code, Cursor, Windsurf, and others. One command, all environments.
|
|
@@ -187,30 +195,63 @@ The copied prompt includes file path, line numbers, severity, and detailed sugge
|
|
|
187
195
|
|
|
188
196
|
### Skill installer (recommended — CLI + all your agents)
|
|
189
197
|
|
|
198
|
+
macOS/Linux:
|
|
199
|
+
|
|
190
200
|
```bash
|
|
191
|
-
curl -fsSL https://
|
|
201
|
+
curl -fsSL https://raw.githubusercontent.com/kodustech/cli/main/install.sh | bash
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Windows PowerShell:
|
|
205
|
+
|
|
206
|
+
```powershell
|
|
207
|
+
powershell -NoProfile -ExecutionPolicy Bypass -Command "$tmp = Join-Path $env:TEMP 'kodus-install.ps1'; Invoke-WebRequest https://raw.githubusercontent.com/kodustech/cli/main/install.ps1 -OutFile $tmp; & $tmp"
|
|
192
208
|
```
|
|
193
209
|
|
|
194
210
|
Installs the CLI and deploys the review skill to all detected agents in one step.
|
|
195
211
|
|
|
196
212
|
### Keep everything updated
|
|
197
213
|
|
|
198
|
-
`kodus update` updates the CLI package
|
|
214
|
+
`kodus update` updates the CLI package.
|
|
199
215
|
|
|
200
|
-
|
|
216
|
+
For end users, the recommended way to refresh skills and agent integrations is:
|
|
217
|
+
|
|
218
|
+
macOS/Linux:
|
|
201
219
|
|
|
202
220
|
```bash
|
|
203
|
-
curl -fsSL https://
|
|
221
|
+
curl -fsSL https://raw.githubusercontent.com/kodustech/cli/main/install.sh | bash
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
Windows PowerShell:
|
|
225
|
+
|
|
226
|
+
```powershell
|
|
227
|
+
powershell -NoProfile -ExecutionPolicy Bypass -Command "$tmp = Join-Path $env:TEMP 'kodus-install.ps1'; Invoke-WebRequest https://raw.githubusercontent.com/kodustech/cli/main/install.ps1 -OutFile $tmp; & $tmp"
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Fallback via CLI for common local agent roots:
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
kodus skills install # install into detected local agent roots
|
|
234
|
+
kodus skills resync # re-sync/refresh managed skills
|
|
235
|
+
kodus skills uninstall # remove managed skills from detected targets
|
|
204
236
|
```
|
|
205
237
|
|
|
206
238
|
If you want to inspect the script before execution:
|
|
207
239
|
|
|
240
|
+
macOS/Linux:
|
|
241
|
+
|
|
208
242
|
```bash
|
|
209
|
-
curl -fsSL https://
|
|
243
|
+
curl -fsSL https://raw.githubusercontent.com/kodustech/cli/main/install.sh -o /tmp/kodus-install.sh
|
|
210
244
|
less /tmp/kodus-install.sh
|
|
211
245
|
bash /tmp/kodus-install.sh
|
|
212
246
|
```
|
|
213
247
|
|
|
248
|
+
Windows PowerShell:
|
|
249
|
+
|
|
250
|
+
```powershell
|
|
251
|
+
powershell -NoProfile -ExecutionPolicy Bypass -Command "Invoke-WebRequest https://raw.githubusercontent.com/kodustech/cli/main/install.ps1 -OutFile install.ps1"
|
|
252
|
+
powershell -NoProfile -ExecutionPolicy Bypass -File .\install.ps1
|
|
253
|
+
```
|
|
254
|
+
|
|
214
255
|
### CLI only
|
|
215
256
|
|
|
216
257
|
<details>
|
|
@@ -240,6 +281,15 @@ curl -fsSL https://raw.githubusercontent.com/kodustech/cli/main/install.sh | bas
|
|
|
240
281
|
|
|
241
282
|
</details>
|
|
242
283
|
|
|
284
|
+
<details>
|
|
285
|
+
<summary><strong>PowerShell</strong></summary>
|
|
286
|
+
|
|
287
|
+
```powershell
|
|
288
|
+
powershell -NoProfile -ExecutionPolicy Bypass -Command "$tmp = Join-Path $env:TEMP 'kodus-install.ps1'; Invoke-WebRequest https://raw.githubusercontent.com/kodustech/cli/main/install.ps1 -OutFile $tmp; & $tmp"
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
</details>
|
|
292
|
+
|
|
243
293
|
<details>
|
|
244
294
|
<summary><strong>Homebrew (coming soon)</strong></summary>
|
|
245
295
|
|
|
@@ -249,6 +299,59 @@ brew install kodus/tap/kodus
|
|
|
249
299
|
|
|
250
300
|
</details>
|
|
251
301
|
|
|
302
|
+
## Agent Mode
|
|
303
|
+
|
|
304
|
+
Kodus now supports an explicit **agent mode** for deterministic automation output.
|
|
305
|
+
|
|
306
|
+
### Global flag
|
|
307
|
+
|
|
308
|
+
Use `--agent` on any command to return a stable JSON envelope:
|
|
309
|
+
|
|
310
|
+
```json
|
|
311
|
+
{
|
|
312
|
+
"ok": true,
|
|
313
|
+
"command": "review",
|
|
314
|
+
"data": {},
|
|
315
|
+
"error": null,
|
|
316
|
+
"meta": {
|
|
317
|
+
"schemaVersion": "1.0",
|
|
318
|
+
"cliVersion": "x.y.z",
|
|
319
|
+
"mode": "agent",
|
|
320
|
+
"durationMs": 123
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
### Command schema introspection
|
|
326
|
+
|
|
327
|
+
```bash
|
|
328
|
+
kodus schema
|
|
329
|
+
kodus schema --command "pr suggestions"
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
### Field selection for smaller payloads
|
|
333
|
+
|
|
334
|
+
Available on `review` and `pr suggestions`:
|
|
335
|
+
|
|
336
|
+
```bash
|
|
337
|
+
kodus review --agent --fields summary,issues.file,issues.line
|
|
338
|
+
kodus pr suggestions --agent --pr-url https://github.com/org/repo/pull/42 --fields summary,issues.file
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
`--fields` requires `--agent` or `--format json`.
|
|
342
|
+
|
|
343
|
+
### Dry-run for mutable commands
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
kodus hook install --dry-run
|
|
347
|
+
kodus hook uninstall --dry-run
|
|
348
|
+
kodus decisions enable --dry-run
|
|
349
|
+
kodus decisions disable --dry-run
|
|
350
|
+
kodus decisions promote --dry-run
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
Dry-run prints the planned actions and does not mutate local hooks/config/files.
|
|
354
|
+
|
|
252
355
|
## Review Modes
|
|
253
356
|
|
|
254
357
|
### Interactive (default)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.interface.d.ts","sourceRoot":"","sources":["../../src/agents/agent.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"agent.interface.d.ts","sourceRoot":"","sources":["../../src/agents/agent.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,cAAc,EACd,SAAS,EACT,UAAU,EACV,qBAAqB,EACxB,MAAM,qBAAqB,CAAC;AAE7B;;;;GAIG;AACH,MAAM,WAAW,YAAY;IACzB,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAE9B;;OAEG;IACH,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,CAAC;IAE1E;;;;OAIG;IACH,cAAc,CACV,cAAc,EAAE,MAAM,EACtB,UAAU,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAElC;;OAEG;IACH,cAAc,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAE1D;;OAEG;IACH,cAAc,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAExD;;OAEG;IACH,oBAAoB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAEhE;;OAEG;IACH,mBAAmB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAEjE;;;OAGG;IACH,sBAAsB,CAClB,cAAc,EAAE,MAAM,EACtB,SAAS,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,OAAO,CAAC,CAAC;CACvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-code.agent.d.ts","sourceRoot":"","sources":["../../src/agents/claude-code.agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"claude-code.agent.d.ts","sourceRoot":"","sources":["../../src/agents/claude-code.agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,KAAK,EACR,SAAS,EACT,cAAc,EAEd,UAAU,EACV,qBAAqB,EAExB,MAAM,qBAAqB,CAAC;AAe7B,qBAAa,eAAgB,YAAW,YAAY;IAChD,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAiB;IAE9C,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI;IAgDnE,cAAc,CAChB,cAAc,EAAE,MAAM,EACtB,UAAU,SAAI,GACf,OAAO,CAAC,qBAAqB,CAAC;IAI3B,cAAc,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAIzD,cAAc,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIvD,oBAAoB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAI/D,mBAAmB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAIhE,sBAAsB,CACxB,cAAc,EAAE,MAAM,EACtB,SAAS,SAAO,GACjB,OAAO,CAAC,OAAO,CAAC;CAGtB;AAmBD,eAAO,MAAM,eAAe,iBAAwB,CAAC"}
|
|
@@ -4,26 +4,37 @@ const HOOK_TO_EVENT_TYPE = {
|
|
|
4
4
|
'session-end': 'SessionEnd',
|
|
5
5
|
'stop': 'TurnEnd',
|
|
6
6
|
'user-prompt-submit': 'TurnStart',
|
|
7
|
+
'subagent-start': 'SubagentStart',
|
|
8
|
+
'subagent-stop': 'SubagentEnd',
|
|
9
|
+
'post-todo': 'TurnEnd',
|
|
10
|
+
// Legacy aliases — old installations used PreToolUse(Task)/PostToolUse(Task)
|
|
7
11
|
'pre-task': 'SubagentStart',
|
|
8
12
|
'post-task': 'SubagentEnd',
|
|
9
|
-
'post-todo': 'TurnEnd',
|
|
10
13
|
};
|
|
11
14
|
export class ClaudeCodeAgent {
|
|
12
15
|
agentType = 'claude-code';
|
|
13
16
|
parseHookEvent(hookName, payload) {
|
|
14
17
|
const eventType = HOOK_TO_EVENT_TYPE[hookName];
|
|
15
|
-
if (!eventType)
|
|
18
|
+
if (!eventType) {
|
|
16
19
|
return null;
|
|
17
|
-
|
|
20
|
+
}
|
|
21
|
+
const obj = payload && typeof payload === 'object' && !Array.isArray(payload)
|
|
18
22
|
? payload
|
|
19
23
|
: {};
|
|
20
24
|
const sessionId = pickString(obj, ['session_id', 'sessionId']) ?? '';
|
|
21
|
-
const sessionRef = pickString(obj, [
|
|
25
|
+
const sessionRef = pickString(obj, [
|
|
26
|
+
'transcript_path',
|
|
27
|
+
'transcriptPath',
|
|
28
|
+
'session_ref',
|
|
29
|
+
]) ?? '';
|
|
22
30
|
const prompt = pickString(obj, ['prompt', 'user_message']);
|
|
23
31
|
const toolUseId = pickString(obj, ['tool_use_id', 'toolUseId']);
|
|
24
32
|
const subagentId = pickString(obj, ['subagent_id', 'subagentId']);
|
|
25
33
|
const subagentType = pickString(obj, ['subagent_type', 'subagentType']);
|
|
26
|
-
const taskDescription = pickString(obj, [
|
|
34
|
+
const taskDescription = pickString(obj, [
|
|
35
|
+
'task_description',
|
|
36
|
+
'taskDescription',
|
|
37
|
+
]);
|
|
27
38
|
let toolInput;
|
|
28
39
|
if (obj['tool_input'] !== undefined) {
|
|
29
40
|
toolInput = obj['tool_input'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-code.agent.js","sourceRoot":"","sources":["../../src/agents/claude-code.agent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAUtE,MAAM,kBAAkB,GAA2C;
|
|
1
|
+
{"version":3,"file":"claude-code.agent.js","sourceRoot":"","sources":["../../src/agents/claude-code.agent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAUtE,MAAM,kBAAkB,GAA2C;IAC/D,eAAe,EAAE,cAAc;IAC/B,aAAa,EAAE,YAAY;IAC3B,MAAM,EAAE,SAAS;IACjB,oBAAoB,EAAE,WAAW;IACjC,gBAAgB,EAAE,eAAe;IACjC,eAAe,EAAE,aAAa;IAC9B,WAAW,EAAE,SAAS;IACtB,6EAA6E;IAC7E,UAAU,EAAE,eAAe;IAC3B,WAAW,EAAE,aAAa;CAC7B,CAAC;AAEF,MAAM,OAAO,eAAe;IACf,SAAS,GAAc,aAAa,CAAC;IAE9C,cAAc,CAAC,QAAgB,EAAE,OAAgB;QAC7C,MAAM,SAAS,GAAG,kBAAkB,CAAC,QAA+B,CAAC,CAAC;QACtE,IAAI,CAAC,SAAS,EAAE,CAAC;YACb,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,MAAM,GAAG,GACL,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,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age, TranscriptParseResult } from '../types/session.js';
|
|
3
|
+
export declare class CodexAgent implements AgentAdapter {
|
|
4
|
+
readonly agentType: AgentType;
|
|
5
|
+
parseHookEvent(hookName: string, payload: unknown): LifecycleEvent | null;
|
|
6
|
+
readTranscript(transcriptPath: string, fromOffset?: number): Promise<TranscriptParseResult>;
|
|
7
|
+
extractPrompts(transcriptPath: string): Promise<string[]>;
|
|
8
|
+
extractSummary(transcriptPath: string): Promise<string>;
|
|
9
|
+
extractModifiedFiles(transcriptPath: string): Promise<string[]>;
|
|
10
|
+
calculateTokenUsage(transcriptPath: string): Promise<TokenUsage>;
|
|
11
|
+
waitForTranscriptFlush(transcriptPath: string, timeoutMs?: number): Promise<boolean>;
|
|
12
|
+
}
|
|
13
|
+
export declare const codexAgent: CodexAgent;
|
|
14
|
+
//# sourceMappingURL=codex.agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex.agent.d.ts","sourceRoot":"","sources":["../../src/agents/codex.agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,KAAK,EACR,SAAS,EACT,cAAc,EAEd,UAAU,EACV,qBAAqB,EAExB,MAAM,qBAAqB,CAAC;AAqB7B,qBAAa,UAAW,YAAW,YAAY;IAC3C,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAW;IAExC,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI;IAgCnE,cAAc,CAChB,cAAc,EAAE,MAAM,EACtB,UAAU,SAAI,GACf,OAAO,CAAC,qBAAqB,CAAC;IAI3B,cAAc,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAIzD,cAAc,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIvD,oBAAoB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAI/D,mBAAmB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAIhE,sBAAsB,CACxB,cAAc,EAAE,MAAM,EACtB,SAAS,SAAO,GACjB,OAAO,CAAC,OAAO,CAAC;CAGtB;AAeD,eAAO,MAAM,UAAU,YAAmB,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { transcriptService } from '../services/transcript.service.js';
|
|
2
|
+
/**
|
|
3
|
+
* Codex CLI hook-to-event mapping.
|
|
4
|
+
*
|
|
5
|
+
* As of v0.100, Codex only supports two hooks:
|
|
6
|
+
* - AfterAgent (v0.99+) — fires after the agent completes a full turn
|
|
7
|
+
* - AfterToolUse (v0.100+) — fires after each individual tool call
|
|
8
|
+
*
|
|
9
|
+
* Missing hooks (confirmed in development by OpenAI):
|
|
10
|
+
* - SessionStart / SessionEnd
|
|
11
|
+
* - UserPromptSubmit (turn_start)
|
|
12
|
+
* - PreToolUse (blocking)
|
|
13
|
+
*
|
|
14
|
+
* We map AfterAgent → TurnEnd. AfterToolUse is observed but not mapped
|
|
15
|
+
* to a lifecycle event (could be used for analytics later).
|
|
16
|
+
*/
|
|
17
|
+
const HOOK_TO_EVENT_TYPE = {
|
|
18
|
+
AfterAgent: 'TurnEnd',
|
|
19
|
+
};
|
|
20
|
+
export class CodexAgent {
|
|
21
|
+
agentType = 'codex';
|
|
22
|
+
parseHookEvent(hookName, payload) {
|
|
23
|
+
const eventType = HOOK_TO_EVENT_TYPE[hookName];
|
|
24
|
+
if (!eventType) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
const obj = payload && typeof payload === 'object' && !Array.isArray(payload)
|
|
28
|
+
? payload
|
|
29
|
+
: {};
|
|
30
|
+
// Codex doesn't provide session_id in hook payloads yet.
|
|
31
|
+
// We use the thread_id or conversation_id if available, otherwise
|
|
32
|
+
// fall back to a generated ID that will be consistent within a session
|
|
33
|
+
// via the local state file.
|
|
34
|
+
const sessionId = pickString(obj, [
|
|
35
|
+
'session_id',
|
|
36
|
+
'sessionId',
|
|
37
|
+
'thread_id',
|
|
38
|
+
'threadId',
|
|
39
|
+
'conversation_id',
|
|
40
|
+
]) ?? '';
|
|
41
|
+
return {
|
|
42
|
+
type: eventType,
|
|
43
|
+
sessionId,
|
|
44
|
+
sessionRef: '',
|
|
45
|
+
timestamp: new Date().toISOString(),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
async readTranscript(transcriptPath, fromOffset = 0) {
|
|
49
|
+
return transcriptService.parse(transcriptPath, fromOffset);
|
|
50
|
+
}
|
|
51
|
+
async extractPrompts(transcriptPath) {
|
|
52
|
+
return transcriptService.extractPrompts(transcriptPath);
|
|
53
|
+
}
|
|
54
|
+
async extractSummary(transcriptPath) {
|
|
55
|
+
return transcriptService.extractSummary(transcriptPath);
|
|
56
|
+
}
|
|
57
|
+
async extractModifiedFiles(transcriptPath) {
|
|
58
|
+
return transcriptService.extractModifiedFiles(transcriptPath);
|
|
59
|
+
}
|
|
60
|
+
async calculateTokenUsage(transcriptPath) {
|
|
61
|
+
return transcriptService.calculateTokenUsage(transcriptPath);
|
|
62
|
+
}
|
|
63
|
+
async waitForTranscriptFlush(transcriptPath, timeoutMs = 3000) {
|
|
64
|
+
return transcriptService.waitForFlush(transcriptPath, timeoutMs);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function pickString(obj, keys) {
|
|
68
|
+
for (const key of keys) {
|
|
69
|
+
const value = obj[key];
|
|
70
|
+
if (typeof value === 'string' && value.trim()) {
|
|
71
|
+
return value.trim();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
export const codexAgent = new CodexAgent();
|
|
77
|
+
//# sourceMappingURL=codex.agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex.agent.js","sourceRoot":"","sources":["../../src/agents/codex.agent.ts"],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C;IAED,KAAK,CAAC,oBAAoB,CAAC,cAAsB;QAC7C,OAAO,iBAAiB,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;IAClE,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,cAAsB;QAC5C,OAAO,iBAAiB,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,sBAAsB,CACxB,cAAsB,EACtB,SAAS,GAAG,IAAI;QAEhB,OAAO,iBAAiB,CAAC,YAAY,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;IACrE,CAAC;CACJ;AAED,SAAS,UAAU,CACf,GAA4B,EAC5B,IAAc;IAEd,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACrB,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;QACvB,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC;YAC5C,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC;QACxB,CAAC;IACL,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { AgentAdapter } from './agent.interface.js';
|
|
2
|
+
import type { AgentType, LifecycleEvent, TokenUsage, TranscriptParseResult } from '../types/session.js';
|
|
3
|
+
/**
|
|
4
|
+
* Cursor agent adapter.
|
|
5
|
+
*
|
|
6
|
+
* Cursor has its own hooks system (.cursor/hooks.json) with payloads that
|
|
7
|
+
* differ from Claude Code. This adapter normalizes Cursor-specific payloads
|
|
8
|
+
* into the shared LifecycleEvent format.
|
|
9
|
+
*
|
|
10
|
+
* Cursor hook payloads (from docs):
|
|
11
|
+
* sessionStart: { session_id, is_background_agent, composer_mode }
|
|
12
|
+
* sessionEnd: { session_id, reason, duration_ms, error }
|
|
13
|
+
* beforeSubmitPrompt: { session_id, prompt, attachments }
|
|
14
|
+
* stop: { session_id, status, loop_count }
|
|
15
|
+
* subagentStart: { session_id, subagent_id, subagent_type, task_description, ... }
|
|
16
|
+
* subagentStop: { session_id, subagent_id, subagent_type, status, summary, duration_ms, modified_files, ... }
|
|
17
|
+
*/
|
|
18
|
+
export declare class CursorAgent implements AgentAdapter {
|
|
19
|
+
readonly agentType: AgentType;
|
|
20
|
+
parseHookEvent(hookName: string, payload: unknown): LifecycleEvent | null;
|
|
21
|
+
readTranscript(transcriptPath: string, fromOffset?: number): Promise<TranscriptParseResult>;
|
|
22
|
+
extractPrompts(transcriptPath: string): Promise<string[]>;
|
|
23
|
+
extractSummary(transcriptPath: string): Promise<string>;
|
|
24
|
+
extractModifiedFiles(transcriptPath: string): Promise<string[]>;
|
|
25
|
+
calculateTokenUsage(transcriptPath: string): Promise<TokenUsage>;
|
|
26
|
+
waitForTranscriptFlush(transcriptPath: string, timeoutMs?: number): Promise<boolean>;
|
|
27
|
+
}
|
|
28
|
+
export declare const cursorAgent: CursorAgent;
|
|
29
|
+
//# sourceMappingURL=cursor.agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor.agent.d.ts","sourceRoot":"","sources":["../../src/agents/cursor.agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,KAAK,EACR,SAAS,EACT,cAAc,EAEd,UAAU,EACV,qBAAqB,EAExB,MAAM,qBAAqB,CAAC;AAW7B;;;;;;;;;;;;;;GAcG;AACH,qBAAa,WAAY,YAAW,YAAY;IAC5C,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAY;IAEzC,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI;IAkCnE,cAAc,CAChB,cAAc,EAAE,MAAM,EACtB,UAAU,SAAI,GACf,OAAO,CAAC,qBAAqB,CAAC;IAI3B,cAAc,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAIzD,cAAc,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIvD,oBAAoB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAI/D,mBAAmB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAIhE,sBAAsB,CACxB,cAAc,EAAE,MAAM,EACtB,SAAS,SAAO,GACjB,OAAO,CAAC,OAAO,CAAC;CAGtB;AAeD,eAAO,MAAM,WAAW,aAAoB,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { transcriptService } from '../services/transcript.service.js';
|
|
2
|
+
const HOOK_TO_EVENT_TYPE = {
|
|
3
|
+
sessionStart: 'SessionStart',
|
|
4
|
+
sessionEnd: 'SessionEnd',
|
|
5
|
+
stop: 'TurnEnd',
|
|
6
|
+
beforeSubmitPrompt: 'TurnStart',
|
|
7
|
+
subagentStart: 'SubagentStart',
|
|
8
|
+
subagentStop: 'SubagentEnd',
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Cursor agent adapter.
|
|
12
|
+
*
|
|
13
|
+
* Cursor has its own hooks system (.cursor/hooks.json) with payloads that
|
|
14
|
+
* differ from Claude Code. This adapter normalizes Cursor-specific payloads
|
|
15
|
+
* into the shared LifecycleEvent format.
|
|
16
|
+
*
|
|
17
|
+
* Cursor hook payloads (from docs):
|
|
18
|
+
* sessionStart: { session_id, is_background_agent, composer_mode }
|
|
19
|
+
* sessionEnd: { session_id, reason, duration_ms, error }
|
|
20
|
+
* beforeSubmitPrompt: { session_id, prompt, attachments }
|
|
21
|
+
* stop: { session_id, status, loop_count }
|
|
22
|
+
* subagentStart: { session_id, subagent_id, subagent_type, task_description, ... }
|
|
23
|
+
* subagentStop: { session_id, subagent_id, subagent_type, status, summary, duration_ms, modified_files, ... }
|
|
24
|
+
*/
|
|
25
|
+
export class CursorAgent {
|
|
26
|
+
agentType = 'cursor';
|
|
27
|
+
parseHookEvent(hookName, payload) {
|
|
28
|
+
const eventType = HOOK_TO_EVENT_TYPE[hookName];
|
|
29
|
+
if (!eventType) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
const obj = payload && typeof payload === 'object' && !Array.isArray(payload)
|
|
33
|
+
? payload
|
|
34
|
+
: {};
|
|
35
|
+
const sessionId = pickString(obj, ['session_id', 'sessionId']) ?? '';
|
|
36
|
+
const prompt = pickString(obj, ['prompt']);
|
|
37
|
+
const subagentId = pickString(obj, ['subagent_id', 'subagentId']);
|
|
38
|
+
const subagentType = pickString(obj, ['subagent_type', 'subagentType']);
|
|
39
|
+
const taskDescription = pickString(obj, [
|
|
40
|
+
'task_description',
|
|
41
|
+
'taskDescription',
|
|
42
|
+
'task',
|
|
43
|
+
]);
|
|
44
|
+
return {
|
|
45
|
+
type: eventType,
|
|
46
|
+
sessionId,
|
|
47
|
+
sessionRef: '',
|
|
48
|
+
prompt,
|
|
49
|
+
timestamp: new Date().toISOString(),
|
|
50
|
+
toolUseId: subagentId,
|
|
51
|
+
subagentId,
|
|
52
|
+
subagentType,
|
|
53
|
+
taskDescription,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
async readTranscript(transcriptPath, fromOffset = 0) {
|
|
57
|
+
return transcriptService.parse(transcriptPath, fromOffset);
|
|
58
|
+
}
|
|
59
|
+
async extractPrompts(transcriptPath) {
|
|
60
|
+
return transcriptService.extractPrompts(transcriptPath);
|
|
61
|
+
}
|
|
62
|
+
async extractSummary(transcriptPath) {
|
|
63
|
+
return transcriptService.extractSummary(transcriptPath);
|
|
64
|
+
}
|
|
65
|
+
async extractModifiedFiles(transcriptPath) {
|
|
66
|
+
return transcriptService.extractModifiedFiles(transcriptPath);
|
|
67
|
+
}
|
|
68
|
+
async calculateTokenUsage(transcriptPath) {
|
|
69
|
+
return transcriptService.calculateTokenUsage(transcriptPath);
|
|
70
|
+
}
|
|
71
|
+
async waitForTranscriptFlush(transcriptPath, timeoutMs = 3000) {
|
|
72
|
+
return transcriptService.waitForFlush(transcriptPath, timeoutMs);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function pickString(obj, keys) {
|
|
76
|
+
for (const key of keys) {
|
|
77
|
+
const value = obj[key];
|
|
78
|
+
if (typeof value === 'string' && value.trim()) {
|
|
79
|
+
return value.trim();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
export const cursorAgent = new CursorAgent();
|
|
85
|
+
//# sourceMappingURL=cursor.agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor.agent.js","sourceRoot":"","sources":["../../src/agents/cursor.agent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAUtE,MAAM,kBAAkB,GAAuC;IAC3D,YAAY,EAAE,cAAc;IAC5B,UAAU,EAAE,YAAY;IACxB,IAAI,EAAE,SAAS;IACf,kBAAkB,EAAE,WAAW;IAC/B,aAAa,EAAE,eAAe;IAC9B,YAAY,EAAE,aAAa;CAC9B,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,WAAW;IACX,SAAS,GAAc,QAAQ,CAAC;IAEzC,cAAc,CAAC,QAAgB,EAAE,OAAgB;QAC7C,MAAM,SAAS,GAAG,kBAAkB,CAAC,QAA2B,CAAC,CAAC;QAClE,IAAI,CAAC,SAAS,EAAE,CAAC;YACb,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,MAAM,GAAG,GACL,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;YAC7D,CAAC,CAAE,OAAmC;YACtC,CAAC,CAAC,EAAE,CAAC;QAEb,MAAM,SAAS,GAAG,UAAU,CAAC,GAA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AC,sBAAsB,CACxB,cAAsB,EACtB,SAAS,GAAG,IAAI;QAEhB,OAAO,iBAAiB,CAAC,YAAY,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;IACrE,CAAC;CACJ;AAED,SAAS,UAAU,CACf,GAA4B,EAC5B,IAAc;IAEd,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACrB,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;QACvB,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC;YAC5C,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC;QACxB,CAAC;IACL,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC"}
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmBpC,QAAA,MAAM,OAAO,SAAgB,CAAC;AA+C9B,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
package/dist/cli.js
CHANGED
|
@@ -8,6 +8,9 @@ import { prCommand } from './commands/pr.js';
|
|
|
8
8
|
import { hookCommand } from './commands/hook/index.js';
|
|
9
9
|
import { decisionsCommand } from './commands/memory/index.js';
|
|
10
10
|
import { statusCommand } from './commands/status.js';
|
|
11
|
+
import { skillsCommand } from './commands/skills.js';
|
|
12
|
+
import { createSchemaCommand } from './commands/schema.js';
|
|
13
|
+
import { configCommand } from './commands/config.js';
|
|
11
14
|
import { checkForUpdates } from './utils/update-check.js';
|
|
12
15
|
import { setCliOutputMode } from './utils/logger.js';
|
|
13
16
|
import { recordRecentActivity } from './utils/recent-activity.js';
|
|
@@ -22,7 +25,8 @@ program
|
|
|
22
25
|
.option('-f, --format <format>', 'Output format: terminal, json, markdown', 'terminal')
|
|
23
26
|
.option('-o, --output <file>', 'Output file (for json/markdown)')
|
|
24
27
|
.option('-v, --verbose', 'Verbose output', false)
|
|
25
|
-
.option('-q, --quiet', 'Quiet mode (errors only)', false)
|
|
28
|
+
.option('-q, --quiet', 'Quiet mode (errors only)', false)
|
|
29
|
+
.option('--agent', 'Agent mode: deterministic machine-readable output');
|
|
26
30
|
program.addCommand(reviewCommand);
|
|
27
31
|
program.addCommand(authCommand);
|
|
28
32
|
program.addCommand(subscribeCommand);
|
|
@@ -31,6 +35,9 @@ program.addCommand(prCommand);
|
|
|
31
35
|
program.addCommand(hookCommand);
|
|
32
36
|
program.addCommand(decisionsCommand);
|
|
33
37
|
program.addCommand(statusCommand);
|
|
38
|
+
program.addCommand(skillsCommand);
|
|
39
|
+
program.addCommand(configCommand);
|
|
40
|
+
program.addCommand(createSchemaCommand(() => program));
|
|
34
41
|
program.hook('preAction', (_thisCommand, actionCommand) => {
|
|
35
42
|
const opts = actionCommand.optsWithGlobals();
|
|
36
43
|
setCliOutputMode({
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,SAAS,EA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C,UAAU,CAAC,WAAW,CAAC,CAAC;AAChC,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;AACrC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAClC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AAC9B,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;AAChC,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;AACrC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAClC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAClC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAClC,OAAO,CAAC,UAAU,CAAC,mBAAmB,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;AAEvD,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,EAAE;IACtD,MAAM,IAAI,GAAG,aAAa,CAAC,eAAe,EAGzC,CAAC;IACF,gBAAgB,CAAC;QACb,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK;QACnB,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO;KAC1B,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,IAAI,EAAE;IAClC,MAAM,OAAO,CAAC,GAAG,CAAC;QACd,eAAe,EAAE;QACjB,oBAAoB,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC;KAC9D,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAEH,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
export declare function configRepoAction(repository?: string): Promise<void>;
|
|
3
|
+
export declare function configRepoAddAction(repository?: string): Promise<void>;
|
|
4
|
+
export declare function configRemoteAction(repository?: string): Promise<void>;
|
|
5
|
+
export declare function configRemoteAddAction(repository?: string): Promise<void>;
|
|
6
|
+
export declare function configRepoListAction(): Promise<void>;
|
|
7
|
+
export declare const configCommand: Command;
|
|
8
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAsB,gBAAgB,CAAC,UAAU,SAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAuBtE;AAED,wBAAsB,mBAAmB,CAAC,UAAU,SAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEzE;AAED,wBAAsB,kBAAkB,CAAC,UAAU,SAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAExE;AAED,wBAAsB,qBAAqB,CAAC,UAAU,SAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE3E;AAED,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC,CAkB1D;AAED,eAAO,MAAM,aAAa,SAEzB,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { repoConfigService } from '../services/repo-config.service.js';
|
|
4
|
+
import { exitWithCode } from '../utils/cli-exit.js';
|
|
5
|
+
import { cliError, cliInfo } from '../utils/logger.js';
|
|
6
|
+
import { normalizeCommandError } from '../utils/command-errors.js';
|
|
7
|
+
export async function configRepoAction(repository = '.') {
|
|
8
|
+
try {
|
|
9
|
+
const result = await repoConfigService.addRepository(repository);
|
|
10
|
+
if (result.status === 'already-added') {
|
|
11
|
+
cliInfo(chalk.yellow(`Repository '${result.repositoryFullName}' is already added to Kodus.`));
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
cliInfo(chalk.green(`Repository '${result.repositoryFullName}' was added to Kodus successfully.`));
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
const normalized = normalizeCommandError(error);
|
|
18
|
+
cliError(chalk.red(normalized.message));
|
|
19
|
+
exitWithCode(normalized.exitCode);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export async function configRepoAddAction(repository = '.') {
|
|
23
|
+
await configRepoAction(repository);
|
|
24
|
+
}
|
|
25
|
+
export async function configRemoteAction(repository = '.') {
|
|
26
|
+
await configRepoAction(repository);
|
|
27
|
+
}
|
|
28
|
+
export async function configRemoteAddAction(repository = '.') {
|
|
29
|
+
await configRepoAction(repository);
|
|
30
|
+
}
|
|
31
|
+
export async function configRepoListAction() {
|
|
32
|
+
try {
|
|
33
|
+
const repositories = await repoConfigService.listRepositories();
|
|
34
|
+
if (repositories.length === 0) {
|
|
35
|
+
cliInfo(chalk.yellow('No repositories are currently configured.'));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
cliInfo('Configured repositories:');
|
|
39
|
+
for (const repository of repositories) {
|
|
40
|
+
cliInfo(`- ${repository.fullName}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
const normalized = normalizeCommandError(error);
|
|
45
|
+
cliError(chalk.red(normalized.message));
|
|
46
|
+
exitWithCode(normalized.exitCode);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export const configCommand = new Command('config').description('Configuration commands');
|
|
50
|
+
configCommand
|
|
51
|
+
.option('-r, --remote [repository]', "Add remote repository config. Use '.' for the current repo.")
|
|
52
|
+
.action(async (options, command) => {
|
|
53
|
+
if (options.remote !== undefined) {
|
|
54
|
+
const repository = typeof options.remote === 'string' ? options.remote : '.';
|
|
55
|
+
await configRemoteAction(repository);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
command.help();
|
|
59
|
+
});
|
|
60
|
+
function registerRemoteRepositoryConfig(command, description, handlers) {
|
|
61
|
+
command
|
|
62
|
+
.description(description)
|
|
63
|
+
.argument('[repository]', "Repository to add. Use '.' for the current repo.", '.')
|
|
64
|
+
.action(handlers.action);
|
|
65
|
+
command
|
|
66
|
+
.command('add [repository]')
|
|
67
|
+
.description("Add a repository to Kodus. Use '.' for the current repo.")
|
|
68
|
+
.action(handlers.addAction);
|
|
69
|
+
command
|
|
70
|
+
.command('list')
|
|
71
|
+
.description('List repositories already configured in Kodus.')
|
|
72
|
+
.action(configRepoListAction);
|
|
73
|
+
}
|
|
74
|
+
registerRemoteRepositoryConfig(configCommand.command('remote'), 'Manage remote repository configuration in Kodus.', {
|
|
75
|
+
action: configRemoteAction,
|
|
76
|
+
addAction: configRemoteAddAction,
|
|
77
|
+
});
|
|
78
|
+
const repoAliasCommand = configCommand.command('repo');
|
|
79
|
+
repoAliasCommand._hidden = true;
|
|
80
|
+
registerRemoteRepositoryConfig(repoAliasCommand, 'Manage remote repository configuration in Kodus.', {
|
|
81
|
+
action: configRepoAction,
|
|
82
|
+
addAction: configRepoAddAction,
|
|
83
|
+
});
|
|
84
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,UAAU,GAAG,GAAG;IACnD,IAAI,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,iBAA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