aiwcli 0.15.5 → 0.15.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 +6 -3
- package/dist/capabilities/branch/adapters.d.ts +2 -0
- package/dist/capabilities/branch/adapters.js +21 -0
- package/dist/capabilities/branch/contracts.d.ts +57 -0
- package/dist/capabilities/branch/contracts.js +1 -0
- package/dist/capabilities/branch/control-plane.d.ts +2 -0
- package/dist/capabilities/branch/control-plane.js +343 -0
- package/dist/capabilities/branch/runtime-core.d.ts +5 -0
- package/dist/capabilities/branch/runtime-core.js +36 -0
- package/dist/capabilities/installation/control-plane/clean-command.d.ts +41 -0
- package/dist/capabilities/installation/control-plane/clean-command.js +196 -0
- package/dist/capabilities/installation/control-plane/clear-command.d.ts +160 -0
- package/dist/capabilities/installation/control-plane/clear-command.js +1220 -0
- package/dist/capabilities/installation/control-plane/init-command.d.ts +81 -0
- package/dist/capabilities/installation/control-plane/init-command.js +449 -0
- package/dist/capabilities/launch/contracts.d.ts +51 -0
- package/dist/capabilities/launch/contracts.js +1 -0
- package/dist/capabilities/launch/control-plane/execute-launch.d.ts +2 -0
- package/dist/capabilities/launch/control-plane/execute-launch.js +222 -0
- package/dist/capabilities/launch/runtime-core/launch-options.d.ts +14 -0
- package/dist/capabilities/launch/runtime-core/launch-options.js +69 -0
- package/dist/cli/base-command.d.ts +18 -0
- package/dist/cli/base-command.js +55 -0
- package/dist/commands/branch.d.ts +0 -20
- package/dist/commands/branch.js +24 -416
- package/dist/commands/clean.d.ts +1 -41
- package/dist/commands/clean.js +1 -196
- package/dist/commands/clear.d.ts +1 -161
- package/dist/commands/clear.js +1 -1121
- package/dist/commands/init/index.d.ts +1 -98
- package/dist/commands/init/index.js +4 -478
- package/dist/commands/launch.d.ts +36 -11
- package/dist/commands/launch.js +135 -159
- package/dist/lib/base-command.d.ts +1 -114
- package/dist/lib/base-command.js +1 -153
- package/dist/lib/claude-settings-types.d.ts +31 -19
- package/dist/lib/context/context-formatter.d.ts +74 -0
- package/dist/lib/context/context-formatter.js +493 -0
- package/dist/lib/context/context-selector.d.ts +42 -0
- package/dist/lib/context/context-selector.js +451 -0
- package/dist/lib/context/context-store.d.ts +100 -0
- package/dist/lib/context/context-store.js +618 -0
- package/dist/lib/context/plan-manager.d.ts +54 -0
- package/dist/lib/context/plan-manager.js +282 -0
- package/dist/lib/context/task-tracker.d.ts +44 -0
- package/dist/lib/context/task-tracker.js +146 -0
- package/dist/lib/core-ide-base.d.ts +4 -0
- package/dist/lib/core-ide-base.js +77 -0
- package/dist/lib/core-installer.d.ts +5 -0
- package/dist/lib/core-installer.js +54 -0
- package/dist/lib/git-exclude-manager.d.ts +2 -2
- package/dist/lib/git-exclude-manager.js +3 -3
- package/dist/lib/hooks/hook-utils.d.ts +143 -0
- package/dist/lib/hooks/hook-utils.js +609 -0
- package/dist/lib/hooks/session-end-logic.d.ts +5 -0
- package/dist/lib/hooks/session-end-logic.js +63 -0
- package/dist/lib/hooks-merger.js +25 -19
- package/dist/lib/ide-path-resolver.d.ts +19 -7
- package/dist/lib/ide-path-resolver.js +25 -9
- package/dist/lib/install-state.d.ts +34 -0
- package/dist/lib/install-state.js +161 -0
- package/dist/lib/launch-options.d.ts +1 -0
- package/dist/lib/launch-options.js +1 -0
- package/dist/lib/lsp-patch.d.ts +12 -0
- package/dist/lib/lsp-patch.js +156 -0
- package/dist/lib/multiplexer.d.ts +57 -0
- package/dist/lib/multiplexer.js +19 -0
- package/dist/lib/multiplexers/psmux.d.ts +75 -0
- package/dist/lib/multiplexers/psmux.js +384 -0
- package/dist/lib/multiplexers/tmux.d.ts +44 -0
- package/dist/lib/multiplexers/tmux.js +262 -0
- package/dist/lib/mux-utils.d.ts +5 -0
- package/dist/lib/mux-utils.js +42 -0
- package/dist/lib/paths.d.ts +2 -2
- package/dist/lib/paths.js +2 -2
- package/dist/lib/platform-commands.d.ts +27 -0
- package/dist/lib/platform-commands.js +49 -0
- package/dist/lib/runtime/aiw-cli.d.ts +37 -0
- package/dist/lib/runtime/aiw-cli.js +74 -0
- package/dist/lib/runtime/atomic-write.d.ts +19 -0
- package/dist/lib/runtime/atomic-write.js +121 -0
- package/dist/lib/runtime/cli-args.d.ts +55 -0
- package/dist/lib/runtime/cli-args.js +185 -0
- package/dist/lib/runtime/constants.d.ts +56 -0
- package/dist/lib/runtime/constants.js +230 -0
- package/dist/lib/runtime/executable-policy.d.ts +16 -0
- package/dist/lib/runtime/executable-policy.js +57 -0
- package/dist/lib/runtime/git-state.d.ts +9 -0
- package/dist/lib/runtime/git-state.js +59 -0
- package/dist/lib/runtime/inference.d.ts +37 -0
- package/dist/lib/runtime/inference.js +262 -0
- package/dist/lib/runtime/lint-dispatch.d.ts +40 -0
- package/dist/lib/runtime/lint-dispatch.js +285 -0
- package/dist/lib/runtime/logger.d.ts +66 -0
- package/dist/lib/runtime/logger.js +201 -0
- package/dist/lib/runtime/models.d.ts +14 -0
- package/dist/lib/runtime/models.js +14 -0
- package/dist/lib/runtime/platform-adapter.d.ts +7 -0
- package/dist/lib/runtime/platform-adapter.js +21 -0
- package/dist/lib/runtime/preflight.d.ts +24 -0
- package/dist/lib/runtime/preflight.js +65 -0
- package/dist/lib/runtime/sentinel-ipc.d.ts +14 -0
- package/dist/lib/runtime/sentinel-ipc.js +67 -0
- package/dist/lib/runtime/state-io.d.ts +30 -0
- package/dist/lib/runtime/state-io.js +174 -0
- package/dist/lib/runtime/stop-words.d.ts +20 -0
- package/dist/lib/runtime/stop-words.js +150 -0
- package/dist/lib/runtime/subprocess-utils.d.ts +29 -0
- package/dist/lib/runtime/subprocess-utils.js +96 -0
- package/dist/lib/runtime/tmux-preflight.d.ts +13 -0
- package/dist/lib/runtime/tmux-preflight.js +78 -0
- package/dist/lib/runtime/utils.d.ts +54 -0
- package/dist/lib/runtime/utils.js +162 -0
- package/dist/lib/sentinel-wrapper.d.ts +9 -0
- package/dist/lib/sentinel-wrapper.js +20 -0
- package/dist/lib/shell-quoting.d.ts +5 -0
- package/dist/lib/shell-quoting.js +17 -0
- package/dist/lib/spawn-errors.d.ts +6 -0
- package/dist/lib/spawn-errors.js +15 -0
- package/dist/lib/spawn.js +5 -11
- package/dist/lib/template-installer.d.ts +4 -5
- package/dist/lib/template-installer.js +36 -34
- package/dist/lib/template-resolver.d.ts +6 -7
- package/dist/lib/template-resolver.js +26 -21
- package/dist/lib/template-settings-reconstructor.d.ts +7 -2
- package/dist/lib/template-settings-reconstructor.js +76 -45
- package/dist/lib/terminal-strategy.d.ts +11 -0
- package/dist/lib/terminal-strategy.js +49 -0
- package/dist/lib/terminal.d.ts +28 -0
- package/dist/lib/terminal.js +162 -112
- package/dist/lib/tmux-pane-placement.d.ts +17 -0
- package/dist/lib/tmux-pane-placement.js +58 -0
- package/dist/lib/tmux-primitives.d.ts +5 -0
- package/dist/lib/tmux-primitives.js +15 -0
- package/dist/lib/tmux-session.d.ts +32 -0
- package/dist/lib/tmux-session.js +86 -0
- package/dist/lib/tty-detection.js +1 -1
- package/dist/lib/types.d.ts +168 -0
- package/dist/lib/types.js +6 -0
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/platform/launch.d.ts +10 -0
- package/dist/platform/launch.js +10 -0
- package/dist/templates/CLAUDE.md +31 -40
- package/dist/templates/cc-native/.claude/settings.json +27 -27
- package/dist/templates/cc-native/CC-NATIVE-README.md +1 -1
- package/dist/templates/cc-native/TEMPLATE-SCHEMA.md +10 -9
- package/dist/templates/cc-native/_cc-native/CLAUDE.md +18 -18
- package/dist/templates/cc-native/_cc-native/artifacts/CLAUDE.md +3 -3
- package/dist/templates/cc-native/_cc-native/artifacts/lib/format.ts +14 -14
- package/dist/templates/cc-native/_cc-native/artifacts/lib/tracker.ts +1 -1
- package/dist/templates/cc-native/_cc-native/artifacts/lib/write.ts +3 -3
- package/dist/templates/cc-native/_cc-native/cc-native.config.json +3 -3
- package/dist/templates/cc-native/_cc-native/hooks/CLAUDE.md +16 -15
- package/dist/templates/cc-native/_cc-native/hooks/cc-native-plan-review.ts +3 -3
- package/dist/templates/cc-native/_cc-native/hooks/enhance_plan_post_subagent.ts +2 -2
- package/dist/templates/cc-native/_cc-native/hooks/enhance_plan_post_write.ts +2 -2
- package/dist/templates/cc-native/_cc-native/hooks/mark_questions_asked.ts +3 -3
- package/dist/templates/cc-native/_cc-native/hooks/plan_questions_early.ts +2 -2
- package/dist/templates/cc-native/_cc-native/hooks/validate_task_prompt.ts +3 -3
- package/dist/templates/cc-native/_cc-native/lib-ts/CLAUDE.md +8 -8
- package/dist/templates/cc-native/_cc-native/lib-ts/aggregate-agents.ts +1 -1
- package/dist/templates/cc-native/_cc-native/lib-ts/cc-native-state.ts +4 -4
- package/dist/templates/cc-native/_cc-native/lib-ts/cli-output-parser.ts +1 -1
- package/dist/templates/cc-native/_cc-native/lib-ts/config.ts +1 -1
- package/dist/templates/cc-native/_cc-native/lib-ts/debug.ts +1 -1
- package/dist/templates/cc-native/_cc-native/lib-ts/json-parser.ts +1 -1
- package/dist/templates/cc-native/_cc-native/lib-ts/plan-discovery.ts +2 -2
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/logger.ts +1 -1
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/retrieval-pipeline.ts +2 -2
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/types.ts +1 -1
- package/dist/templates/cc-native/_cc-native/lib-ts/settings.ts +8 -8
- package/dist/templates/cc-native/_cc-native/lib-ts/state.ts +3 -3
- package/dist/templates/cc-native/_cc-native/lib-ts/tsconfig.json +2 -2
- package/dist/templates/cc-native/_cc-native/lib-ts/types.ts +3 -3
- package/dist/templates/cc-native/_cc-native/plan-review/CLAUDE.md +3 -1
- package/dist/templates/cc-native/_cc-native/plan-review/lib/__tests__/agent-selection.test.ts +345 -0
- package/dist/templates/cc-native/_cc-native/plan-review/lib/__tests__/preflight.test.ts +344 -0
- package/dist/templates/cc-native/_cc-native/plan-review/lib/agent-selection.ts +37 -15
- package/dist/templates/cc-native/_cc-native/plan-review/lib/corroboration.ts +16 -69
- package/dist/templates/cc-native/_cc-native/plan-review/lib/orchestrator.ts +1 -1
- package/dist/templates/cc-native/_cc-native/plan-review/lib/output-builder.ts +1 -1
- package/dist/templates/cc-native/_cc-native/plan-review/lib/plan-questions.ts +2 -2
- package/dist/templates/cc-native/_cc-native/plan-review/lib/preflight.ts +56 -26
- package/dist/templates/cc-native/_cc-native/plan-review/lib/review-pipeline.ts +7 -7
- package/dist/templates/cc-native/_cc-native/plan-review/lib/reviewers/agent.ts +4 -4
- package/dist/templates/cc-native/_cc-native/plan-review/lib/reviewers/base/base-agent.ts +3 -3
- package/dist/templates/cc-native/_cc-native/plan-review/lib/reviewers/index.ts +1 -1
- package/dist/templates/cc-native/_cc-native/plan-review/lib/reviewers/providers/claude-agent.ts +2 -2
- package/dist/templates/cc-native/_cc-native/plan-review/lib/reviewers/providers/codex-agent.ts +4 -4
- package/dist/templates/cc-native/_cc-native/plan-review/lib/reviewers/providers/gemini-agent.ts +1 -1
- package/dist/templates/cc-native/_cc-native/plan-review/lib/reviewers/providers/orchestrator-claude-agent.ts +5 -6
- package/dist/templates/core/.codex/workflows/codex.md +17 -0
- package/dist/templates/core/.codex/workflows/handoff.md +5 -0
- package/dist/templates/core/.codex/workflows/meta-plan.md +7 -0
- package/dist/templates/core/.cognition/AGENTS.md +5 -0
- package/dist/templates/core/.cognition/config.json +12 -0
- package/dist/templates/{_shared → core}/.windsurf/workflows/handoff.md +1 -1
- package/dist/templates/{_shared → core}/.windsurf/workflows/meta-plan.md +1 -1
- package/dist/templates/core/hooks-ts/_utils/git-state.ts +2 -0
- package/dist/templates/{_shared → core}/hooks-ts/archive_plan.ts +14 -23
- package/dist/templates/core/hooks-ts/codex_explorer.ts +160 -0
- package/dist/templates/{_shared → core}/hooks-ts/context_monitor.ts +23 -55
- package/dist/templates/{_shared → core}/hooks-ts/file-suggestion.ts +4 -3
- package/dist/templates/{_shared → core}/hooks-ts/lint_after_edit.ts +7 -9
- package/dist/templates/{_shared → core}/hooks-ts/pre_compact.ts +5 -5
- package/dist/templates/{_shared → core}/hooks-ts/session_end.ts +38 -78
- package/dist/templates/{_shared → core}/hooks-ts/session_start.ts +5 -5
- package/dist/templates/core/hooks-ts/task_create_capture.ts +32 -0
- package/dist/templates/{_shared → core}/hooks-ts/task_update_capture.ts +9 -24
- package/dist/templates/core/hooks-ts/user_prompt_submit.ts +46 -0
- package/dist/templates/{_shared → core}/lib-ts/CLAUDE.md +27 -16
- package/dist/templates/{_shared → core}/lib-ts/agent-exec/backends/headless.ts +3 -2
- package/dist/templates/{_shared → core}/lib-ts/agent-exec/backends/tmux.ts +44 -15
- package/dist/templates/{_shared → core}/lib-ts/agent-exec/base-agent.ts +6 -4
- package/dist/templates/{_shared → core}/lib-ts/agent-exec/execution-backend.ts +1 -1
- package/dist/templates/{_shared → core}/lib-ts/agent-exec/index.ts +2 -2
- package/dist/templates/{_shared → core}/lib-ts/agent-exec/structured-output.ts +4 -5
- package/dist/templates/{_shared → core}/lib-ts/context/CLAUDE.md +9 -6
- package/dist/templates/{_shared → core}/lib-ts/context/context-formatter.ts +16 -21
- package/dist/templates/{_shared → core}/lib-ts/context/context-selector.ts +8 -6
- package/dist/templates/{_shared → core}/lib-ts/context/context-store.ts +32 -20
- package/dist/templates/{_shared → core}/lib-ts/context/plan-manager.ts +19 -15
- package/dist/templates/{_shared → core}/lib-ts/context/task-tracker.ts +3 -3
- package/dist/templates/core/lib-ts/hooks/context-monitor-logic.ts +32 -0
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/hooks}/hook-utils.ts +168 -41
- package/dist/templates/core/lib-ts/hooks/prompt-binding-logic.ts +80 -0
- package/dist/templates/core/lib-ts/hooks/session-end-logic.ts +93 -0
- package/dist/templates/core/lib-ts/package.json +19 -0
- package/dist/templates/core/lib-ts/runtime/agent-launcher.ts +295 -0
- package/dist/templates/core/lib-ts/runtime/aiw-cli.ts +106 -0
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/atomic-write.ts +12 -7
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/cli-args.ts +8 -6
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/constants.ts +326 -324
- package/dist/templates/core/lib-ts/runtime/executable-policy.ts +89 -0
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/git-state.ts +6 -4
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/inference.ts +59 -10
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/lint-dispatch.ts +25 -23
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/logger.ts +32 -29
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/models.ts +2 -2
- package/dist/templates/core/lib-ts/runtime/platform-adapter.ts +33 -0
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/preflight.ts +4 -3
- package/dist/templates/core/lib-ts/runtime/sentinel-ipc.ts +91 -0
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/state-io.ts +11 -7
- package/dist/templates/core/lib-ts/runtime/stop-words.ts +185 -0
- package/dist/templates/core/lib-ts/runtime/subprocess-utils.ts +147 -0
- package/dist/templates/core/lib-ts/runtime/tmux-preflight.ts +93 -0
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/utils.ts +4 -3
- package/dist/templates/{_shared → core}/lib-ts/templates/formatters.ts +7 -5
- package/dist/templates/{_shared → core}/lib-ts/templates/plan-context.ts +2 -1
- package/dist/templates/{_shared → core}/lib-ts/tsconfig.json +3 -1
- package/dist/templates/{_shared → core}/lib-ts/types.ts +78 -77
- package/dist/templates/core/scripts/resolve-run.ts +61 -0
- package/dist/templates/{_shared → core}/scripts/resolve_context.ts +3 -3
- package/dist/templates/{_shared → core}/scripts/status_line.ts +25 -20
- package/dist/templates/core/skills/codex/CLAUDE.md +78 -0
- package/dist/templates/{_shared → core}/skills/codex/SKILL.md +21 -18
- package/dist/templates/{_shared → core}/skills/codex/lib/codex-watcher.ts +76 -103
- package/dist/templates/{_shared → core}/skills/codex/scripts/launch-codex.ts +119 -133
- package/dist/templates/{_shared → core}/skills/codex/scripts/watch-codex.ts +6 -4
- package/dist/templates/core/skills/devin/CLAUDE.md +65 -0
- package/dist/templates/core/skills/devin/SKILL.md +73 -0
- package/dist/templates/core/skills/devin/lib/devin-watcher.ts +280 -0
- package/dist/templates/core/skills/devin/scripts/launch-devin.ts +257 -0
- package/dist/templates/{_shared → core}/skills/handoff-system/CLAUDE.md +436 -433
- package/dist/templates/{_shared → core}/skills/handoff-system/lib/document-generator.ts +9 -7
- package/dist/templates/{_shared → core}/skills/handoff-system/lib/handoff-reader.ts +6 -4
- package/dist/templates/{_shared → core}/skills/handoff-system/scripts/resume_handoff.ts +10 -8
- package/dist/templates/{_shared → core}/skills/handoff-system/scripts/save_handoff.ts +12 -10
- package/dist/templates/{_shared → core}/skills/handoff-system/workflows/handoff-resume.md +2 -2
- package/dist/templates/{_shared → core}/skills/handoff-system/workflows/handoff.md +6 -5
- package/dist/templates/{_shared → core}/skills/meta-plan/CLAUDE.md +2 -1
- package/dist/templates/{_shared → core}/skills/meta-plan/workflows/meta-plan.md +8 -7
- package/oclif.manifest.json +89 -13
- package/package.json +13 -12
- package/dist/templates/_shared/.claude/settings.json +0 -120
- package/dist/templates/_shared/.claude/skills/codex/SKILL.md +0 -35
- package/dist/templates/_shared/.claude/skills/handoff/SKILL.md +0 -13
- package/dist/templates/_shared/.claude/skills/handoff-resume/SKILL.md +0 -13
- package/dist/templates/_shared/.claude/skills/meta-plan/SKILL.md +0 -43
- package/dist/templates/_shared/.codex/workflows/codex.md +0 -11
- package/dist/templates/_shared/.codex/workflows/handoff.md +0 -226
- package/dist/templates/_shared/.codex/workflows/meta-plan.md +0 -347
- package/dist/templates/_shared/hooks-ts/_utils/git-state.ts +0 -2
- package/dist/templates/_shared/hooks-ts/task_create_capture.ts +0 -48
- package/dist/templates/_shared/hooks-ts/user_prompt_submit.ts +0 -93
- package/dist/templates/_shared/lib-ts/base/launchers/tmux-launcher.ts +0 -173
- package/dist/templates/_shared/lib-ts/base/launchers/window-launcher.ts +0 -93
- package/dist/templates/_shared/lib-ts/base/launchers/wt-launcher.ts +0 -64
- package/dist/templates/_shared/lib-ts/base/pane-launcher.ts +0 -55
- package/dist/templates/_shared/lib-ts/base/sentinel-ipc.ts +0 -87
- package/dist/templates/_shared/lib-ts/base/stop-words.ts +0 -184
- package/dist/templates/_shared/lib-ts/base/subprocess-utils.ts +0 -249
- package/dist/templates/_shared/lib-ts/base/tmux-driver.ts +0 -341
- package/dist/templates/_shared/lib-ts/base/tmux-pane-placement.ts +0 -78
- package/dist/templates/_shared/lib-ts/package.json +0 -20
- package/dist/templates/_shared/scripts/resolve-run.ts +0 -62
- package/dist/templates/_shared/skills/codex/CLAUDE.md +0 -70
- /package/dist/templates/{_shared → core}/lib-ts/agent-exec/backends/index.ts +0 -0
|
@@ -17,20 +17,20 @@
|
|
|
17
17
|
|
|
18
18
|
---
|
|
19
19
|
|
|
20
|
-
## Shared Infrastructure (`
|
|
20
|
+
## Shared Infrastructure (`_core/lib-ts/`)
|
|
21
21
|
|
|
22
|
-
CC-native code depends heavily on shared infrastructure. Full API details: `
|
|
22
|
+
CC-native code depends heavily on shared infrastructure. Full API details: `_core/lib-ts/CLAUDE.md`.
|
|
23
23
|
|
|
24
24
|
| Module | Capability | Use When |
|
|
25
25
|
|--------|-----------|----------|
|
|
26
|
-
| `
|
|
27
|
-
| `
|
|
28
|
-
| `
|
|
29
|
-
| `
|
|
30
|
-
| `
|
|
31
|
-
| `
|
|
32
|
-
| `
|
|
33
|
-
| `
|
|
26
|
+
| `hooks/hook-utils` | Hook lifecycle (load input, run, emit context) | Writing hooks |
|
|
27
|
+
| `runtime/logger` | Structured logging (debug/info/warn/error) | Any hook or lib module |
|
|
28
|
+
| `runtime/constants` | Project paths, context dirs, sanitization | Resolving file locations |
|
|
29
|
+
| `runtime/subprocess-utils` | Find executables, exec with env, shell quoting | Spawning agent CLIs |
|
|
30
|
+
| `runtime/cli-args` | CLI invocation builder, review spec construction | Launching review agents |
|
|
31
|
+
| `runtime/atomic-write` | Crash-safe file writes | Writing state or artifacts |
|
|
32
|
+
| `runtime/state-io` | State read/write helpers | Context state persistence |
|
|
33
|
+
| `runtime/inference` | Claude CLI subprocess calls | AI inference from hooks |
|
|
34
34
|
| `context/context-store` | Context CRUD (get by session, list all) | Session/context binding |
|
|
35
35
|
| `context/plan-manager` | Plan lifecycle (archive, hash, sign) | Plan discovery and hashing |
|
|
36
36
|
| `types` | Shared type definitions (`ContextState`, etc.) | Type imports |
|
|
@@ -39,19 +39,19 @@ CC-native code depends heavily on shared infrastructure. Full API details: `_sha
|
|
|
39
39
|
|
|
40
40
|
## Import Patterns
|
|
41
41
|
|
|
42
|
-
**Import direction:** `hooks/` → `lib-ts/` → `
|
|
42
|
+
**Import direction:** `hooks/` → `lib-ts/` → `_core/lib-ts/`. Never the reverse.
|
|
43
43
|
|
|
44
44
|
```typescript
|
|
45
|
-
// From hooks/ (2 levels up to
|
|
46
|
-
import { runHook, logInfo } from "../../
|
|
45
|
+
// From hooks/ (2 levels up to _core):
|
|
46
|
+
import { runHook, logInfo } from "../../_core/lib-ts/hooks/hook-utils.js";
|
|
47
47
|
import { loadConfig } from "../lib-ts/config.js";
|
|
48
48
|
|
|
49
|
-
// From lib-ts/ (2 levels up to
|
|
50
|
-
import { logDebug } from "../../
|
|
51
|
-
import { atomicWrite } from "../../
|
|
49
|
+
// From lib-ts/ (2 levels up to _core):
|
|
50
|
+
import { logDebug } from "../../_core/lib-ts/runtime/logger.js";
|
|
51
|
+
import { atomicWrite } from "../../_core/lib-ts/runtime/atomic-write.js";
|
|
52
52
|
|
|
53
|
-
// From plan-review/lib/ (3 levels up to
|
|
54
|
-
import { logInfo } from "../../../
|
|
53
|
+
// From plan-review/lib/ (3 levels up to _core):
|
|
54
|
+
import { logInfo } from "../../../_core/lib-ts/runtime/logger.js";
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
---
|
|
@@ -41,9 +41,9 @@ artifacts/
|
|
|
41
41
|
|
|
42
42
|
- `../../lib-ts/types.ts` — `CombinedReviewResult`, `CorroborationResult` types
|
|
43
43
|
- `../../lib-ts/constants.ts` — `ENABLE_ROBUST_PLAN_WRITES` feature flag
|
|
44
|
-
- `../../../
|
|
45
|
-
- `../../../
|
|
46
|
-
- `../../../
|
|
44
|
+
- `../../../_core/lib-ts/runtime/atomic-write.ts` — atomic file I/O
|
|
45
|
+
- `../../../_core/lib-ts/runtime/constants.ts` — `sanitizeFilename`
|
|
46
|
+
- `../../../_core/lib-ts/runtime/logger.ts` — logging
|
|
47
47
|
|
|
48
48
|
## Hooks
|
|
49
49
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Extracted from artifacts.ts — no file I/O.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { sanitizeFilename } from "../../../
|
|
6
|
+
import { sanitizeFilename } from "../../../_core/lib-ts/runtime/constants.js";
|
|
7
7
|
import { DEFAULT_DISPLAY } from "../../lib-ts/types.js";
|
|
8
8
|
import type {
|
|
9
9
|
CombinedReviewResult,
|
|
@@ -75,14 +75,14 @@ export function formatCombinedMarkdown(
|
|
|
75
75
|
if (corroboration.blocking.length > 0) {
|
|
76
76
|
lines.push("### Blocking Dimensions\n");
|
|
77
77
|
for (const group of corroboration.blocking) {
|
|
78
|
-
lines.push(`- **${group.dimension}**: ${group.agentCount} agents
|
|
78
|
+
lines.push(`- **${group.dimension}**: ${group.issues.length} issues from ${group.agentCount} agents (threshold: ≥${group.threshold})`);
|
|
79
79
|
}
|
|
80
80
|
lines.push("");
|
|
81
81
|
}
|
|
82
82
|
if (corroboration.solo.length > 0) {
|
|
83
83
|
lines.push("### Solo Dimensions (informational)\n");
|
|
84
84
|
for (const s of corroboration.solo) {
|
|
85
|
-
lines.push(`- **${s.dimension}**: ${s.
|
|
85
|
+
lines.push(`- **${s.dimension}**: ${s.issues.length} issues from ${s.agentCount} agents (threshold: >${s.threshold}, not exceeded)`);
|
|
86
86
|
}
|
|
87
87
|
lines.push("");
|
|
88
88
|
}
|
|
@@ -192,7 +192,7 @@ export function buildInlineReviewSummary(
|
|
|
192
192
|
if (corroboration && dim) {
|
|
193
193
|
const group = corroboration.blocking.find(g => g.dimension === dim);
|
|
194
194
|
if (group) {
|
|
195
|
-
annotation = ` [CORROBORATED — ${group.agentCount} agents
|
|
195
|
+
annotation = ` [CORROBORATED — ${group.issues.length} issues from ${group.agentCount} agents exceeds threshold ${group.threshold}]`;
|
|
196
196
|
} else {
|
|
197
197
|
annotation = " [perspective]";
|
|
198
198
|
}
|
|
@@ -259,10 +259,10 @@ export function buildHighIssuesDocument(
|
|
|
259
259
|
): string {
|
|
260
260
|
if (corroboration && corroboration.blocking.length > 0) {
|
|
261
261
|
const lines = ["# Corroborated High-Severity Issues\n"];
|
|
262
|
-
lines.push("> Only issues from dimensions where
|
|
262
|
+
lines.push("> Only issues from dimensions where the total count exceeded the proportional threshold are shown.\n");
|
|
263
263
|
|
|
264
264
|
for (const group of corroboration.blocking) {
|
|
265
|
-
lines.push(`## ${group.dimension} (${group.
|
|
265
|
+
lines.push(`## ${group.dimension} (${group.issues.length} issues from ${group.agentCount} agents, threshold: ${group.threshold})\n`);
|
|
266
266
|
for (const { agent, issue } of group.issues) {
|
|
267
267
|
const cat = issue.category ?? "general";
|
|
268
268
|
const text = String(issue.issue ?? "").trim();
|
|
@@ -275,7 +275,7 @@ export function buildHighIssuesDocument(
|
|
|
275
275
|
|
|
276
276
|
if (corroboration.solo.length > 0) {
|
|
277
277
|
lines.push("---\n");
|
|
278
|
-
lines.push(`> ${corroboration.solo.length} dimension${corroboration.solo.length !== 1 ? "s" : ""} had
|
|
278
|
+
lines.push(`> ${corroboration.solo.length} dimension${corroboration.solo.length !== 1 ? "s" : ""} had issues below threshold (not blocking): ${corroboration.solo.map(s => `${s.dimension} (${s.issues.length}/${s.threshold})`).join(", ")}\n`);
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
return lines.join("\n");
|
|
@@ -332,18 +332,18 @@ export function buildCorroborationReport(
|
|
|
332
332
|
if (corroborationResult.blocking.length > 0) {
|
|
333
333
|
lines.push("## Blocking Issues (Corroborated)");
|
|
334
334
|
lines.push("");
|
|
335
|
-
lines.push("| Dimension |
|
|
336
|
-
lines.push("
|
|
335
|
+
lines.push("| Dimension | Issues | Agents | Threshold | Status |");
|
|
336
|
+
lines.push("|-----------|--------|--------|-----------|--------|");
|
|
337
337
|
|
|
338
338
|
for (const group of corroborationResult.blocking) {
|
|
339
339
|
lines.push(
|
|
340
|
-
`| ${group.dimension} | ${group.
|
|
340
|
+
`| ${group.dimension} | ${group.issues.length} | ${group.agentCount} | ${group.threshold} | ⛔ EXCEEDED |`
|
|
341
341
|
);
|
|
342
342
|
}
|
|
343
343
|
lines.push("");
|
|
344
344
|
|
|
345
345
|
for (const group of corroborationResult.blocking) {
|
|
346
|
-
lines.push(`### ${group.dimension} (${group.
|
|
346
|
+
lines.push(`### ${group.dimension} (${group.issues.length} issues)`);
|
|
347
347
|
lines.push("");
|
|
348
348
|
for (const {agent, issue} of group.issues) {
|
|
349
349
|
lines.push(`- **[${agent}]** ${issue.issue || "No description"}`);
|
|
@@ -355,12 +355,12 @@ export function buildCorroborationReport(
|
|
|
355
355
|
if (corroborationResult.solo.length > 0) {
|
|
356
356
|
lines.push("## Solo Findings (Below Threshold)");
|
|
357
357
|
lines.push("");
|
|
358
|
-
lines.push("| Dimension |
|
|
359
|
-
lines.push("
|
|
358
|
+
lines.push("| Dimension | Issues | Agents | Threshold | Status |");
|
|
359
|
+
lines.push("|-----------|--------|--------|-----------|--------|");
|
|
360
360
|
|
|
361
361
|
for (const group of corroborationResult.solo) {
|
|
362
362
|
lines.push(
|
|
363
|
-
`| ${group.dimension} | ${group.
|
|
363
|
+
`| ${group.dimension} | ${group.issues.length} | ${group.agentCount} | ${group.threshold} | ℹ️ SOLO |`
|
|
364
364
|
);
|
|
365
365
|
}
|
|
366
366
|
lines.push("");
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import * as fs from "node:fs";
|
|
7
7
|
import * as path from "node:path";
|
|
8
8
|
|
|
9
|
-
import { logWarn } from "../../../
|
|
9
|
+
import { logWarn } from "../../../_core/lib-ts/runtime/logger.js";
|
|
10
10
|
|
|
11
11
|
// ---------------------------------------------------------------------------
|
|
12
12
|
// Types
|
|
@@ -11,9 +11,9 @@ import {
|
|
|
11
11
|
buildCombinedJson,
|
|
12
12
|
generateReviewIndex,
|
|
13
13
|
} from "./format.js";
|
|
14
|
-
import { atomicWrite } from "../../../
|
|
15
|
-
import { sanitizeFilename } from "../../../
|
|
16
|
-
import { logDebug, logWarn, logError } from "../../../
|
|
14
|
+
import { atomicWrite } from "../../../_core/lib-ts/runtime/atomic-write.js";
|
|
15
|
+
import { sanitizeFilename } from "../../../_core/lib-ts/runtime/constants.js";
|
|
16
|
+
import { logDebug, logWarn, logError } from "../../../_core/lib-ts/runtime/logger.js";
|
|
17
17
|
import { ENABLE_ROBUST_PLAN_WRITES } from "../../lib-ts/constants.js";
|
|
18
18
|
import type { CombinedReviewResult, CorroborationResult } from "../../lib-ts/types.js";
|
|
19
19
|
|
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
},
|
|
8
8
|
"codex": {
|
|
9
9
|
"enabled": true,
|
|
10
|
-
"models": ["gpt-5.3-codex"]
|
|
11
|
-
"reasoningEffort": "low"
|
|
10
|
+
"models": ["gpt-5.3-codex"]
|
|
12
11
|
}
|
|
13
12
|
}
|
|
14
13
|
},
|
|
@@ -27,7 +26,8 @@
|
|
|
27
26
|
"maxIssuesPerAgent": 3,
|
|
28
27
|
"orchestrator": {
|
|
29
28
|
"enabled": true,
|
|
30
|
-
"model": "
|
|
29
|
+
"model": "gpt-5.3-codex",
|
|
30
|
+
"provider": "codex",
|
|
31
31
|
"timeout": 60
|
|
32
32
|
},
|
|
33
33
|
"preflight": {
|
|
@@ -21,6 +21,7 @@ The hook is a thin coordinator (~70 lines) that delegates to `plan-review/lib/re
|
|
|
21
21
|
|
|
22
22
|
| Module | Location | Responsibility |
|
|
23
23
|
|--------|----------|----------------|
|
|
24
|
+
| `cli-args.ts` | `_core/lib-ts/runtime/` | Centralized CLI arg construction for Claude/Codex agents — all providers delegate here |
|
|
24
25
|
| `plan-discovery.ts` | `lib-ts/` | Find plan file, read content, compute hash |
|
|
25
26
|
| `settings.ts` | `lib-ts/` | Load + merge config with defaults, load agent library |
|
|
26
27
|
| `agent-selection.ts` | `plan-review/lib/` | Mandatory agent resolution, orchestrator-based selection, model assignment |
|
|
@@ -42,10 +43,10 @@ Before running plan review agents, the pipeline checks `wasQuestionsAsked()`. If
|
|
|
42
43
|
CC-native hooks are TypeScript, run via `bun`. Use relative imports from the hook file location.
|
|
43
44
|
|
|
44
45
|
```typescript
|
|
45
|
-
// Shared library imports (via
|
|
46
|
-
import { loadHookInput, runHook, logInfo, emitContext } from "../../
|
|
47
|
-
import { isInternalCall } from "../../
|
|
48
|
-
import { getProjectRoot } from "../../
|
|
46
|
+
// Shared library imports (via _core/lib-ts/)
|
|
47
|
+
import { loadHookInput, runHook, logInfo, emitContext } from "../../_core/lib-ts/hooks/hook-utils.js";
|
|
48
|
+
import { isInternalCall } from "../../_core/lib-ts/runtime/subprocess-utils.js";
|
|
49
|
+
import { getProjectRoot } from "../../_core/lib-ts/runtime/constants.js";
|
|
49
50
|
|
|
50
51
|
// CC-native library imports (via ../lib-ts/)
|
|
51
52
|
import { wasQuestionsAsked, markQuestionsAsked } from "../lib-ts/cc-native-state.js";
|
|
@@ -55,7 +56,7 @@ import type { AgentConfig } from "../lib-ts/types.js";
|
|
|
55
56
|
|
|
56
57
|
**Important:** Always use `.js` extensions in import paths — Bun resolves `.ts` files from `.js` imports.
|
|
57
58
|
|
|
58
|
-
**Import direction:** Hooks → `_cc-native/lib-ts/` → `
|
|
59
|
+
**Import direction:** Hooks → `_cc-native/lib-ts/` → `_core/lib-ts/`. Never reverse.
|
|
59
60
|
|
|
60
61
|
---
|
|
61
62
|
|
|
@@ -64,7 +65,7 @@ import type { AgentConfig } from "../lib-ts/types.js";
|
|
|
64
65
|
Hooks can be invoked recursively when spawning subprocesses (agents, orchestrator). Always check and skip:
|
|
65
66
|
|
|
66
67
|
```typescript
|
|
67
|
-
import { isInternalCall } from "../../
|
|
68
|
+
import { isInternalCall } from "../../_core/lib-ts/runtime/subprocess-utils.js";
|
|
68
69
|
|
|
69
70
|
function main(): void {
|
|
70
71
|
// FIRST LINE of main - before any other logic
|
|
@@ -87,7 +88,7 @@ Claude Code hooks return JSON to stdout. The format is specific to each hook typ
|
|
|
87
88
|
Use the shared hook utilities — never construct JSON manually:
|
|
88
89
|
|
|
89
90
|
```typescript
|
|
90
|
-
import { emitContext, emitContextAndBlock } from "../../
|
|
91
|
+
import { emitContext, emitContextAndBlock } from "../../_core/lib-ts/hooks/hook-utils.js";
|
|
91
92
|
|
|
92
93
|
// Inject context without blocking:
|
|
93
94
|
emitContext("Information for Claude to see...");
|
|
@@ -105,7 +106,7 @@ emitContextAndBlock(
|
|
|
105
106
|
|
|
106
107
|
## Debugging Output
|
|
107
108
|
|
|
108
|
-
For logging tiers, visibility rules, and stderr behavior, see **`
|
|
109
|
+
For logging tiers, visibility rules, and stderr behavior, see **`_core/lib-ts/CLAUDE.md`** (the shared library guide). The key rules:
|
|
109
110
|
|
|
110
111
|
- **stderr is opt-in.** `log_debug/log_info/log_warn/log_error` write to file only (no UI noise)
|
|
111
112
|
- **`logBlocking()` / `log_hook_error()`** for problems that must be visible
|
|
@@ -115,7 +116,7 @@ For logging tiers, visibility rules, and stderr behavior, see **`_shared/lib-ts/
|
|
|
115
116
|
TypeScript hooks use re-exported logger functions from `hook-utils.ts`:
|
|
116
117
|
|
|
117
118
|
```typescript
|
|
118
|
-
import { logDebug, logInfo, logWarn, logError } from "../../
|
|
119
|
+
import { logDebug, logInfo, logWarn, logError } from "../../_core/lib-ts/hooks/hook-utils.js";
|
|
119
120
|
|
|
120
121
|
logDebug("hook-name", `Found ${items.length} items`); // file only
|
|
121
122
|
logInfo("hook-name", "Starting hook..."); // file only
|
|
@@ -129,8 +130,8 @@ logError("hook-name", `Failed: ${e}`); // file only
|
|
|
129
130
|
Plan review hooks integrate with the shared context system for state management:
|
|
130
131
|
|
|
131
132
|
```typescript
|
|
132
|
-
import { getContextBySessionId, getAllContexts } from "../../
|
|
133
|
-
import { getContextReviewsDir } from "../../
|
|
133
|
+
import { getContextBySessionId, getAllContexts } from "../../_core/lib-ts/context/context-store.js";
|
|
134
|
+
import { getContextReviewsDir } from "../../_core/lib-ts/runtime/constants.js";
|
|
134
135
|
|
|
135
136
|
// Find active context
|
|
136
137
|
const context = getContextBySessionId(sessionId, projectRoot);
|
|
@@ -160,7 +161,7 @@ import { isPlanAlreadyReviewed, markPlanReviewed, wasQuestionsAsked } from "../l
|
|
|
160
161
|
Hooks should fail gracefully — a broken hook shouldn't break the user's workflow. `runHook()` and `runHookAsync()` handle this automatically: uncaught errors log to file and exit 0 (non-blocking).
|
|
161
162
|
|
|
162
163
|
```typescript
|
|
163
|
-
import { runHook, logInfo } from "../../
|
|
164
|
+
import { runHook, logInfo } from "../../_core/lib-ts/hooks/hook-utils.js";
|
|
164
165
|
|
|
165
166
|
function main(): void {
|
|
166
167
|
// Hook logic — uncaught errors are handled by runHook
|
|
@@ -173,7 +174,7 @@ runHook(main, "hook_name");
|
|
|
173
174
|
For async hooks (plan review with parallel agents):
|
|
174
175
|
|
|
175
176
|
```typescript
|
|
176
|
-
import { runHookAsync } from "../../
|
|
177
|
+
import { runHookAsync } from "../../_core/lib-ts/hooks/hook-utils.js";
|
|
177
178
|
|
|
178
179
|
async function main(): Promise<void> {
|
|
179
180
|
// Async hook logic with Promise.all() etc.
|
|
@@ -188,7 +189,7 @@ Use `emitContextAndBlock()` for intentional blocking (e.g., plan review denial).
|
|
|
188
189
|
|
|
189
190
|
## Error Handling: Non-Critical Operations
|
|
190
191
|
|
|
191
|
-
Wrap non-critical shared library calls in try/catch to prevent false "hook error" UI display. See **`
|
|
192
|
+
Wrap non-critical shared library calls in try/catch to prevent false "hook error" UI display. See **`_core/lib-ts/CLAUDE.md`** > Context Store for the pattern and rationale.
|
|
192
193
|
|
|
193
194
|
**When to catch locally vs let bubble:**
|
|
194
195
|
- **Catch locally:** Side effects like mode transitions, state saves — the hook's primary purpose can still succeed without them
|
|
@@ -264,4 +265,4 @@ is stale — update or regenerate before relying on it.
|
|
|
264
265
|
- 30+ days without touching this file → Audit
|
|
265
266
|
- Agent mistake caused by this file → fix immediately, then Audit
|
|
266
267
|
|
|
267
|
-
<!-- context-layer: generated=2026-02-10 | last-audited=2026-
|
|
268
|
+
<!-- context-layer: generated=2026-02-10 | last-audited=2026-03-01 | version=3 | dir-commits-at-audit=58 -->
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
* Output: _output/cc-native/plans/{YYYY-MM-DD}/{slug}/reviews/
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import { getProjectRoot, getAiwcliDir } from "../../_shared/lib-ts/base/constants.js";
|
|
14
13
|
import {
|
|
15
14
|
loadHookInput,
|
|
16
15
|
runHookAsync,
|
|
@@ -19,8 +18,9 @@ import {
|
|
|
19
18
|
logWarn,
|
|
20
19
|
emitContext,
|
|
21
20
|
emitContextAndBlock,
|
|
22
|
-
} from "../../
|
|
23
|
-
import {
|
|
21
|
+
} from "../../_core/lib-ts/hooks/hook-utils.js";
|
|
22
|
+
import { getProjectRoot, getAiwcliDir } from "../../_core/lib-ts/runtime/constants.js";
|
|
23
|
+
import { isInternalCall } from "../../_core/lib-ts/runtime/subprocess-utils.js";
|
|
24
24
|
import type { PipelineResult } from "../lib-ts/types.js";
|
|
25
25
|
import { runReviewPipeline } from "../plan-review/lib/review-pipeline.js";
|
|
26
26
|
|
|
@@ -18,8 +18,8 @@ import {
|
|
|
18
18
|
logDebug,
|
|
19
19
|
emitContext,
|
|
20
20
|
getToolInput,
|
|
21
|
-
} from "../../
|
|
22
|
-
import { isInternalCall } from "../../
|
|
21
|
+
} from "../../_core/lib-ts/hooks/hook-utils.js";
|
|
22
|
+
import { isInternalCall } from "../../_core/lib-ts/runtime/subprocess-utils.js";
|
|
23
23
|
import { getPlanQualityReviewContext } from "../lib-ts/plan-enhancement.js";
|
|
24
24
|
|
|
25
25
|
function main(): void {
|
|
@@ -20,8 +20,8 @@ import {
|
|
|
20
20
|
runHook,
|
|
21
21
|
logInfo,
|
|
22
22
|
emitContext,
|
|
23
|
-
} from "../../
|
|
24
|
-
import { isInternalCall } from "../../
|
|
23
|
+
} from "../../_core/lib-ts/hooks/hook-utils.js";
|
|
24
|
+
import { isInternalCall } from "../../_core/lib-ts/runtime/subprocess-utils.js";
|
|
25
25
|
import { getPlanQualityReviewContext } from "../lib-ts/plan-enhancement.js";
|
|
26
26
|
|
|
27
27
|
function main(): void {
|
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
* Fail-safe: Any error exits 0 (non-blocking).
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import { getProjectRoot } from "../../_shared/lib-ts/base/constants.js";
|
|
15
14
|
import {
|
|
16
15
|
loadHookInput,
|
|
17
16
|
runHook,
|
|
18
17
|
logInfo,
|
|
19
18
|
logDiagnostic,
|
|
20
|
-
} from "../../
|
|
21
|
-
import {
|
|
19
|
+
} from "../../_core/lib-ts/hooks/hook-utils.js";
|
|
20
|
+
import { getProjectRoot } from "../../_core/lib-ts/runtime/constants.js";
|
|
21
|
+
import { isInternalCall } from "../../_core/lib-ts/runtime/subprocess-utils.js";
|
|
22
22
|
import { markQuestionsAsked } from "../lib-ts/cc-native-state.js";
|
|
23
23
|
|
|
24
24
|
function main(): void {
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* Skips if questions were already asked this session.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
12
|
+
import { loadHookInput, runHook, logDebug, logInfo, emitContext } from "../../_core/lib-ts/hooks/hook-utils.js";
|
|
13
|
+
import { getProjectRoot } from "../../_core/lib-ts/runtime/constants.js";
|
|
14
14
|
import { wasEarlyQuestionsAsked } from "../lib-ts/cc-native-state.js";
|
|
15
15
|
|
|
16
16
|
// Unconditional injection by design — no code-detection gate.
|
|
@@ -19,9 +19,9 @@ import {
|
|
|
19
19
|
logWarn,
|
|
20
20
|
emitContextAndBlock,
|
|
21
21
|
getToolInput,
|
|
22
|
-
} from "../../
|
|
23
|
-
import { inference } from "../../
|
|
24
|
-
import { isInternalCall } from "../../
|
|
22
|
+
} from "../../_core/lib-ts/hooks/hook-utils.js";
|
|
23
|
+
import { inference } from "../../_core/lib-ts/runtime/inference.js";
|
|
24
|
+
import { isInternalCall } from "../../_core/lib-ts/runtime/subprocess-utils.js";
|
|
25
25
|
|
|
26
26
|
const VALIDATION_SYSTEM_PROMPT = `The sub-agent receives ONLY the prompt text — no conversation history, no prior context.
|
|
27
27
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**Location:** `_cc-native/lib-ts/` — TypeScript modules for plan review, state, and agent orchestration.
|
|
4
4
|
|
|
5
|
-
**Import direction:** `hooks/` → `lib-ts/` → `
|
|
5
|
+
**Import direction:** `hooks/` → `lib-ts/` → `_core/lib-ts/`. Never the reverse.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -32,13 +32,13 @@ The barrel `index.ts` re-exports most modules. Three files are **not** re-export
|
|
|
32
32
|
|
|
33
33
|
## Shared Dependencies
|
|
34
34
|
|
|
35
|
-
These `
|
|
35
|
+
These `_core/lib-ts` modules are used across cc-native lib-ts:
|
|
36
36
|
|
|
37
37
|
| Shared Module | Used By |
|
|
38
38
|
|--------------|---------|
|
|
39
|
-
| `
|
|
40
|
-
| `
|
|
41
|
-
| `
|
|
39
|
+
| `runtime/logger` | All modules (logging) |
|
|
40
|
+
| `runtime/atomic-write` | `state.ts` (crash-safe writes) |
|
|
41
|
+
| `runtime/utils` | `cc-native-state.ts` (`nowIso`) |
|
|
42
42
|
| `context/context-store` | `cc-native-state.ts` (state access) |
|
|
43
43
|
| `context/plan-manager` | `plan-discovery.ts` (plan path lookup) |
|
|
44
44
|
| `types` | `types.ts` (re-exports `ContextState`, `HookInput`, `HookOutput`) |
|
|
@@ -48,11 +48,11 @@ These `_shared/lib-ts` modules are used across cc-native lib-ts:
|
|
|
48
48
|
## Import Direction
|
|
49
49
|
|
|
50
50
|
```
|
|
51
|
-
hooks/ (entry points — import from lib-ts/ and
|
|
51
|
+
hooks/ (entry points — import from lib-ts/ and _core/)
|
|
52
52
|
↓
|
|
53
|
-
lib-ts/ (this directory — import from
|
|
53
|
+
lib-ts/ (this directory — import from _core/ only)
|
|
54
54
|
↓
|
|
55
|
-
|
|
55
|
+
_core/lib-ts/ (cross-method infrastructure — no reverse imports)
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
Never import from `hooks/` or `plan-review/` into `lib-ts/`. The one exception noted in `aggregate-agents.ts`: it stays in `lib-ts/` because both `settings.ts` and `plan-review/` depend on it.
|
|
@@ -12,7 +12,7 @@ import * as fs from "node:fs";
|
|
|
12
12
|
import * as path from "node:path";
|
|
13
13
|
|
|
14
14
|
import type { AgentConfig } from "./types.js";
|
|
15
|
-
import { logDebug, logInfo, logWarn } from "../../
|
|
15
|
+
import { logDebug, logInfo, logWarn } from "../../_core/lib-ts/runtime/logger.js";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Extract simple YAML frontmatter from markdown content.
|
|
@@ -10,10 +10,10 @@ import type {
|
|
|
10
10
|
IterationState,
|
|
11
11
|
StuckDetectionState,
|
|
12
12
|
} from "./types.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import type { ContextState } from "../../
|
|
13
|
+
import { getContextBySessionId, saveState } from "../../_core/lib-ts/context/context-store.js";
|
|
14
|
+
import { logInfo, logWarn } from "../../_core/lib-ts/runtime/logger.js";
|
|
15
|
+
import { nowIso } from "../../_core/lib-ts/runtime/utils.js";
|
|
16
|
+
import type { ContextState } from "../../_core/lib-ts/types.js";
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* ContextState extended with the cc_native method-specific data.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Keeps existing import surface stable for provider implementations.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { parseStructuredOutput } from "../../
|
|
6
|
+
import { parseStructuredOutput } from "../../_core/lib-ts/agent-exec/structured-output.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Parse CLI JSON output into a structured object.
|
|
@@ -8,7 +8,7 @@ import * as path from "node:path";
|
|
|
8
8
|
|
|
9
9
|
import type { DisplaySettings, PlanReviewConfig } from "./types.js";
|
|
10
10
|
import { DEFAULT_DISPLAY } from "./types.js";
|
|
11
|
-
import { logWarn } from "../../
|
|
11
|
+
import { logWarn } from "../../_core/lib-ts/runtime/logger.js";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Load full CC-Native config from _cc-native/cc-native.config.json.
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import * as fs from "node:fs";
|
|
10
10
|
import * as path from "node:path";
|
|
11
11
|
|
|
12
|
-
import { hookLog } from "../../
|
|
12
|
+
import { hookLog } from "../../_core/lib-ts/runtime/logger.js";
|
|
13
13
|
|
|
14
14
|
/** Feature flag — set CCNATIVE_DEBUG_DISABLE=1 to turn off */
|
|
15
15
|
const DEBUG_ENABLED = !["1", "true", "yes"].includes(
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { ReviewData, Verdict } from "./types.js";
|
|
7
|
-
import { logDebug, logWarn } from "../../
|
|
7
|
+
import { logDebug, logWarn } from "../../_core/lib-ts/runtime/logger.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Try strict JSON parse. If that fails, attempt to extract the first {...} block.
|
|
@@ -9,8 +9,8 @@ import * as os from "node:os";
|
|
|
9
9
|
import * as path from "node:path";
|
|
10
10
|
|
|
11
11
|
import type { DiscoveredPlan } from "./types.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
12
|
+
import { findPlanPathInTranscript } from "../../_core/lib-ts/context/plan-manager.js";
|
|
13
|
+
import { logInfo, logDebug } from "../../_core/lib-ts/runtime/logger.js";
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
const HOOK = "plan-discovery";
|
|
@@ -18,7 +18,7 @@ let logDebug: (hookName: string, message: string, opts?: Record<string, unknown>
|
|
|
18
18
|
|
|
19
19
|
try {
|
|
20
20
|
// Try shared logger (works when imported as part of the hook pipeline)
|
|
21
|
-
const mod = await import("../../../../
|
|
21
|
+
const mod = await import("../../../../_core/lib-ts/runtime/logger.js");
|
|
22
22
|
logInfo = mod.logInfo;
|
|
23
23
|
logWarn = mod.logWarn;
|
|
24
24
|
logError = mod.logError;
|
|
@@ -36,10 +36,10 @@ import { openVectorDb, searchKnn } from "./vector-store.js";
|
|
|
36
36
|
const HOOK_NAME = "rlm_retrieve";
|
|
37
37
|
|
|
38
38
|
// Dynamic import for inference (crosses package boundary)
|
|
39
|
-
let inferenceAsync: typeof import("../../../../
|
|
39
|
+
let inferenceAsync: typeof import("../../../../_core/lib-ts/runtime/inference.js").inferenceAsync;
|
|
40
40
|
|
|
41
41
|
try {
|
|
42
|
-
const mod = await import("../../../../
|
|
42
|
+
const mod = await import("../../../../_core/lib-ts/runtime/inference.js");
|
|
43
43
|
inferenceAsync = mod.inferenceAsync;
|
|
44
44
|
} catch {
|
|
45
45
|
// Fallback: warn and provide a stub that always fails
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { homedir } from "node:os";
|
|
9
9
|
import { join } from "node:path";
|
|
10
10
|
|
|
11
|
-
import { getProjectRoot } from "../../../
|
|
11
|
+
import { getProjectRoot } from "../../../_core/lib-ts/runtime/constants.js";
|
|
12
12
|
import { loadConfig } from "../config.js";
|
|
13
13
|
|
|
14
14
|
// ---------------------------------------------------------------------------
|
|
@@ -19,8 +19,8 @@ import type {
|
|
|
19
19
|
ProviderConfig,
|
|
20
20
|
} from "./types.js";
|
|
21
21
|
import { DEFAULT_DISPLAY, DEFAULT_SANITIZATION } from "./types.js";
|
|
22
|
-
import { logInfo } from "../../
|
|
23
|
-
import { CODEX_MODELS } from "../../
|
|
22
|
+
import { logInfo } from "../../_core/lib-ts/runtime/logger.js";
|
|
23
|
+
import { CODEX_MODELS } from "../../_core/lib-ts/runtime/models.js";
|
|
24
24
|
|
|
25
25
|
const HOOK = "settings";
|
|
26
26
|
|
|
@@ -180,8 +180,8 @@ export function loadSettings(projDir: string): LoadedSettings {
|
|
|
180
180
|
const topLevelFallbackByComplexity = asRecord(raw.fallbackByComplexity) as Record<string, number> | undefined;
|
|
181
181
|
if (nestedFallbackByComplexity || topLevelFallbackByComplexity) {
|
|
182
182
|
mergedAgent.fallbackByComplexity = {
|
|
183
|
-
...
|
|
184
|
-
...
|
|
183
|
+
...nestedFallbackByComplexity,
|
|
184
|
+
...topLevelFallbackByComplexity,
|
|
185
185
|
};
|
|
186
186
|
}
|
|
187
187
|
|
|
@@ -195,8 +195,8 @@ export function loadSettings(projDir: string): LoadedSettings {
|
|
|
195
195
|
const topLevelPreflight = asRecord(raw.preflight);
|
|
196
196
|
if (nestedPreflight || topLevelPreflight) {
|
|
197
197
|
mergedAgent.preflight = {
|
|
198
|
-
...
|
|
199
|
-
...
|
|
198
|
+
...nestedPreflight,
|
|
199
|
+
...topLevelPreflight,
|
|
200
200
|
};
|
|
201
201
|
}
|
|
202
202
|
|
|
@@ -204,8 +204,8 @@ export function loadSettings(projDir: string): LoadedSettings {
|
|
|
204
204
|
const topLevelReviewIterations = asRecord(raw.reviewIterations) as Record<string, number> | undefined;
|
|
205
205
|
mergedAgent.reviewIterations = {
|
|
206
206
|
...DEFAULT_REVIEW_ITERATIONS,
|
|
207
|
-
...
|
|
208
|
-
...
|
|
207
|
+
...nestedReviewIterations,
|
|
208
|
+
...topLevelReviewIterations,
|
|
209
209
|
};
|
|
210
210
|
|
|
211
211
|
const modelsRaw = (raw.models ?? {}) as Record<string, unknown>;
|