cclaw-cli 0.48.9 → 0.48.11

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/dist/config.d.ts CHANGED
@@ -4,7 +4,7 @@ export declare class InvalidConfigError extends Error {
4
4
  }
5
5
  export declare function configPath(projectRoot: string): string;
6
6
  /**
7
- * Default test-path patterns used by workflow-guard.sh to classify TDD writes.
7
+ * Default test-path patterns used by the workflow-guard hook to classify TDD writes.
8
8
  *
9
9
  * Scope is intentionally narrow and language-agnostic; users can extend this
10
10
  * list in config when their repository uses different conventions.
package/dist/config.js CHANGED
@@ -100,7 +100,7 @@ export function configPath(projectRoot) {
100
100
  return path.join(projectRoot, CONFIG_PATH);
101
101
  }
102
102
  /**
103
- * Default test-path patterns used by workflow-guard.sh to classify TDD writes.
103
+ * Default test-path patterns used by the workflow-guard hook to classify TDD writes.
104
104
  *
105
105
  * Scope is intentionally narrow and language-agnostic; users can extend this
106
106
  * list in config when their repository uses different conventions.
@@ -13,7 +13,7 @@ Reference docs for \`cclaw doctor\` checks.
13
13
  - \`state-and-gates.md\` - flow-state integrity and gate evidence contracts
14
14
  - \`delegation-and-preamble.md\` - mandatory delegations and lightweight announce discipline
15
15
  - \`traceability.md\` - spec/plan/tdd trace matrix expectations
16
- - \`tooling-capabilities.md\` - local runtime prerequisites (bash/node/python/jq)
16
+ - \`tooling-capabilities.md\` - local runtime prerequisites (node only)
17
17
  - \`config-and-policy.md\` - config schema, rules policy, and validation references
18
18
  `,
19
19
  "runtime-layout.md": `# Runtime Layout
@@ -116,17 +116,21 @@ Reference docs for \`cclaw doctor\` checks.
116
116
 
117
117
  ## Required
118
118
 
119
- - \`bash\` for runtime hook scripts
120
- - \`node\` for generated runtime scripts/plugins
119
+ - \`node\` (>=20) — the only runtime dependency. All hooks, git-hook relays, and the
120
+ \`cclaw\` CLI itself run on Node.js. No \`bash\`, \`python3\`, or \`jq\` required.
121
+ - \`git\` — needed for worktree and pre-commit/pre-push relays.
121
122
 
122
- ## Optional fallback
123
+ ## Not required (removed)
123
124
 
124
- - at least one of \`python3\` or \`jq\` for JSON parsing fallback paths
125
+ Earlier releases relied on \`bash\` to execute generated shell hooks and on
126
+ \`python3\`/\`jq\` as JSON fallback parsers. Node-only mode removes both: hooks
127
+ dispatch through \`node .cclaw/hooks/run-hook.mjs <hook-name>\`, so these tools
128
+ are no longer part of the supported runtime contract.
125
129
 
126
130
  ## Typical fixes
127
131
 
128
- 1. Install missing runtime tools.
129
- 2. Keep at least one JSON fallback parser available (\`python3\` or \`jq\`).
132
+ 1. Install Node.js 20 or newer (matches \`package.json\` \`engines\`) and ensure \`node\` is on \`PATH\`.
133
+ 2. Re-run \`cclaw sync\` to regenerate hook configs after upgrading Node.
130
134
  `,
131
135
  "config-and-policy.md": `# Config And Policy
132
136
 
@@ -103,7 +103,7 @@ shared casing silently breaks generated wiring.
103
103
  - Codex-specific ceiling: \`PreToolUse\` can only intercept \`Bash\`. Direct
104
104
  \`Write\`/\`Edit\` to \`.cclaw/state/flow-state.json\` cannot be hard-blocked
105
105
  at hook level, so the canonical path is
106
- \`bash .cclaw/hooks/stage-complete.sh <stage>\` plus the non-blocking
106
+ \`node .cclaw/hooks/stage-complete.mjs <stage>\` plus the non-blocking
107
107
  \`UserPromptSubmit\` state nudge.
108
108
 
109
109
  ## Shared command contract
@@ -233,7 +233,7 @@ Codex CLI has a different shape from Claude/Cursor:
233
233
  \`PostToolUse\` events only fire for the \`Bash\` tool. \`Write\`,
234
234
  \`Edit\`, \`WebSearch\`, and MCP tool calls are **not** gated by hooks.
235
235
  cclaw partially compensates by wiring \`UserPromptSubmit\` to both
236
- \`prompt-guard.sh\` and a non-blocking
236
+ \`prompt-guard\` and a non-blocking
237
237
  \`cclaw internal verify-current-state --quiet\` nudge that emits
238
238
  unmet-delegation / missing-evidence warnings before the turn executes.
239
239
  This is still a nudge, not a hard block: workflow-guard (TDD red-first,
@@ -291,7 +291,7 @@ disabled in v0.33 and remains off.
291
291
  - \`/use cc\` — open the \`/cc\` skill and pick a track.
292
292
  - \`/use cc-next\` — advance the flow one stage.
293
293
  - \`/use cc-ops\` — compound / archive / rewind.
294
- - \`bash .cclaw/hooks/stage-complete.sh <stage>\` — canonical stage closeout helper;
294
+ - \`node .cclaw/hooks/stage-complete.mjs <stage>\` — canonical stage closeout helper;
295
295
  validates delegations + gate evidence before mutating \`flow-state.json\`.
296
296
  - Typing \`/cc …\` or \`/cc-next …\` in plain text also works: Codex
297
297
  matches the skill descriptions (which spell out these tokens) and
@@ -318,12 +318,12 @@ continue to work regardless.
318
318
 
319
319
  | Hook intent | Codex mapping | Coverage |
320
320
  |-------------|---------------|----------|
321
- | SessionStart rehydration | \`SessionStart\` matcher \`startup|resume\` → \`session-start.sh\` | Full. |
322
- | PreToolUse prompt-guard | \`PreToolUse\` matcher \`Bash\` + \`UserPromptSubmit\` → \`prompt-guard.sh\` | Bash tool calls are gated inline; \`UserPromptSubmit\` catches prompts before any tool fires, so non-Bash writes (\`Write\`/\`Edit\`) are still prompt-guarded at the turn boundary. |
321
+ | SessionStart rehydration | \`SessionStart\` matcher \`startup|resume\` → \`session-start\` | Full. |
322
+ | PreToolUse prompt-guard | \`PreToolUse\` matcher \`Bash\` + \`UserPromptSubmit\` → \`prompt-guard\` | Bash tool calls are gated inline; \`UserPromptSubmit\` catches prompts before any tool fires, so non-Bash writes (\`Write\`/\`Edit\`) are still prompt-guarded at the turn boundary. |
323
323
  | UserPromptSubmit state nudge | \`UserPromptSubmit\` → \`cclaw internal verify-current-state --quiet\` | Non-blocking warning only. Prints unmet mandatory delegation / gate-evidence counts before the turn; cannot block non-Bash \`Write\`/\`Edit\`. |
324
- | PreToolUse workflow-guard | \`PreToolUse\` matcher \`Bash\` → \`workflow-guard.sh\` | Bash-only. For \`Write\`/\`Edit\` calls the agent performs the TDD-order / artifact check in-turn (see the stage skill). |
325
- | PostToolUse context-monitor | \`PostToolUse\` matcher \`Bash\` → \`context-monitor.sh\` | Bash-only. Other tool calls get context-monitored at end-of-turn via \`.cclaw/references/protocols/ethos.md\`. |
326
- | Stop checkpoint | \`Stop\` → \`stop-checkpoint.sh\` | Full. |
324
+ | PreToolUse workflow-guard | \`PreToolUse\` matcher \`Bash\` → \`workflow-guard\` | Bash-only. For \`Write\`/\`Edit\` calls the agent performs the TDD-order / artifact check in-turn (see the stage skill). |
325
+ | PostToolUse context-monitor | \`PostToolUse\` matcher \`Bash\` → \`context-monitor\` | Bash-only. Other tool calls get context-monitored at end-of-turn via \`.cclaw/references/protocols/ethos.md\`. |
326
+ | Stop checkpoint | \`Stop\` → \`stop-checkpoint\` | Full. |
327
327
  | PreCompact digest | Not supported — Codex has no \`PreCompact\` event. | Covered by \`/cc-ops retro\` and the user running \`/cc-view status\` before Codex's \`/compact\` command. |
328
328
 
329
329
  ## Verification
@@ -9,27 +9,27 @@ export const HOOK_SEMANTIC_EVENTS = [
9
9
  export const HOOK_EVENTS_BY_HARNESS = {
10
10
  claude: {
11
11
  session_rehydrate: "SessionStart matcher startup|resume|clear|compact",
12
- pre_tool_prompt_guard: "PreToolUse -> prompt-guard.sh",
13
- pre_tool_workflow_guard: "PreToolUse -> workflow-guard.sh",
14
- post_tool_context_monitor: "PostToolUse -> context-monitor.sh",
15
- stop_checkpoint: "Stop -> stop-checkpoint.sh",
16
- precompact_digest: "PreCompact -> pre-compact.sh"
12
+ pre_tool_prompt_guard: "PreToolUse -> prompt-guard",
13
+ pre_tool_workflow_guard: "PreToolUse -> workflow-guard",
14
+ post_tool_context_monitor: "PostToolUse -> context-monitor",
15
+ stop_checkpoint: "Stop -> stop-checkpoint",
16
+ precompact_digest: "PreCompact -> pre-compact"
17
17
  },
18
18
  cursor: {
19
19
  session_rehydrate: "sessionStart/sessionResume/sessionClear/sessionCompact",
20
- pre_tool_prompt_guard: "preToolUse -> prompt-guard.sh",
21
- pre_tool_workflow_guard: "preToolUse -> workflow-guard.sh",
22
- post_tool_context_monitor: "postToolUse -> context-monitor.sh",
23
- stop_checkpoint: "stop -> stop-checkpoint.sh",
24
- precompact_digest: "sessionCompact -> pre-compact.sh"
20
+ pre_tool_prompt_guard: "preToolUse -> prompt-guard",
21
+ pre_tool_workflow_guard: "preToolUse -> workflow-guard",
22
+ post_tool_context_monitor: "postToolUse -> context-monitor",
23
+ stop_checkpoint: "stop -> stop-checkpoint",
24
+ precompact_digest: "sessionCompact -> pre-compact"
25
25
  },
26
26
  opencode: {
27
27
  session_rehydrate: "plugin event handlers + transform rehydration",
28
- pre_tool_prompt_guard: "plugin tool.execute.before -> prompt-guard.sh",
29
- pre_tool_workflow_guard: "plugin tool.execute.before -> workflow-guard.sh",
30
- post_tool_context_monitor: "plugin tool.execute.after -> context-monitor.sh",
31
- stop_checkpoint: "plugin session.idle -> stop-checkpoint.sh",
32
- precompact_digest: "plugin session.compacted -> pre-compact.sh"
28
+ pre_tool_prompt_guard: "plugin tool.execute.before -> prompt-guard",
29
+ pre_tool_workflow_guard: "plugin tool.execute.before -> workflow-guard",
30
+ post_tool_context_monitor: "plugin tool.execute.after -> context-monitor",
31
+ stop_checkpoint: "plugin session.idle -> stop-checkpoint",
32
+ precompact_digest: "plugin session.compacted -> pre-compact"
33
33
  },
34
34
  codex: {
35
35
  // Codex CLI v0.114+ exposes lifecycle hooks via `.codex/hooks.json`,
@@ -39,9 +39,9 @@ export const HOOK_EVENTS_BY_HARNESS = {
39
39
  // calls do not trigger them). `precompact_digest` is unmapped —
40
40
  // Codex has no PreCompact event; cclaw covers it via `/cc-ops retro`.
41
41
  session_rehydrate: "SessionStart matcher startup|resume",
42
- pre_tool_prompt_guard: "PreToolUse matcher Bash -> prompt-guard.sh (plus UserPromptSubmit for non-Bash prompts)",
43
- pre_tool_workflow_guard: "PreToolUse matcher Bash -> workflow-guard.sh (Bash-only)",
44
- post_tool_context_monitor: "PostToolUse matcher Bash -> context-monitor.sh (Bash-only)",
45
- stop_checkpoint: "Stop -> stop-checkpoint.sh"
42
+ pre_tool_prompt_guard: "PreToolUse matcher Bash -> prompt-guard (plus UserPromptSubmit for non-Bash prompts)",
43
+ pre_tool_workflow_guard: "PreToolUse matcher Bash -> workflow-guard (Bash-only)",
44
+ post_tool_context_monitor: "PostToolUse matcher Bash -> context-monitor (Bash-only)",
45
+ stop_checkpoint: "Stop -> stop-checkpoint"
46
46
  }
47
47
  };
@@ -1,20 +1,4 @@
1
- /**
2
- * Hook generators for all supported harnesses.
3
- *
4
- * SessionStart: injects using-cclaw + flow state + knowledge + checkpoint/activity summary.
5
- * Stop: writes checkpoint.json and reminds about flow consistency.
6
- * Harness hook JSON wiring is generated in observe.ts.
7
- */
8
- export interface HookRuntimeOptions {
9
- }
10
- /** Shared bash preamble for generated hook scripts. */
11
- export declare const RUNTIME_SHELL_DETECT_ROOT = "CCLAW_HOOK_LIB_PATH=\"\"\nfor candidate in \"${CCLAW_PROJECT_ROOT:-}\" \"${CLAUDE_PROJECT_DIR:-}\" \"${CURSOR_PROJECT_DIR:-}\" \"${CURSOR_PROJECT_ROOT:-}\" \"${OPENCODE_PROJECT_DIR:-}\" \"${OPENCODE_PROJECT_ROOT:-}\" \"${PWD:-}\"; do\n if [ -n \"$candidate\" ] && [ -f \"$candidate/.cclaw/hooks/_lib.sh\" ]; then\n CCLAW_HOOK_LIB_PATH=\"$candidate/.cclaw/hooks/_lib.sh\"\n break\n fi\ndone\nif [ -n \"$CCLAW_HOOK_LIB_PATH\" ] && [ -f \"$CCLAW_HOOK_LIB_PATH\" ]; then\n # shellcheck disable=SC1090\n . \"$CCLAW_HOOK_LIB_PATH\"\nfi\n\nif command -v cclaw_hook_detect_root >/dev/null 2>&1; then\n cclaw_hook_detect_root\nelse\n HARNESS=\"codex\"\n if [ -n \"${CLAUDE_PROJECT_DIR:-}\" ]; then\n HARNESS=\"claude\"\n elif [ -n \"${CURSOR_PROJECT_DIR:-}\" ] || [ -n \"${CURSOR_PROJECT_ROOT:-}\" ]; then\n HARNESS=\"cursor\"\n elif [ -n \"${OPENCODE_PROJECT_DIR:-}\" ] || [ -n \"${OPENCODE_PROJECT_ROOT:-}\" ]; then\n HARNESS=\"opencode\"\n fi\n\n ROOT=\"\"\n for candidate in \"${CCLAW_PROJECT_ROOT:-}\" \"${CLAUDE_PROJECT_DIR:-}\" \"${CURSOR_PROJECT_DIR:-}\" \"${CURSOR_PROJECT_ROOT:-}\" \"${OPENCODE_PROJECT_DIR:-}\" \"${OPENCODE_PROJECT_ROOT:-}\" \"${PWD:-}\"; do\n if [ -n \"$candidate\" ] && [ -d \"$candidate/.cclaw\" ]; then\n ROOT=\"$candidate\"\n break\n fi\n done\n if [ -z \"$ROOT\" ]; then\n ROOT=\"${CCLAW_PROJECT_ROOT:-${CLAUDE_PROJECT_DIR:-${CURSOR_PROJECT_DIR:-${CURSOR_PROJECT_ROOT:-${OPENCODE_PROJECT_DIR:-${OPENCODE_PROJECT_ROOT:-${PWD}}}}}}}\"\n fi\nfi";
12
- export declare function hookLibScript(): string;
13
- export declare function sessionStartScript(_options?: HookRuntimeOptions): string;
14
- export declare function stopCheckpointScript(): string;
15
- export declare function runHookDispatcherScript(): string;
16
1
  export declare function stageCompleteScript(): string;
17
- export declare function preCompactScript(): string;
18
2
  export { claudeHooksJsonWithObservation as claudeHooksJson } from "./observe.js";
19
3
  export { cursorHooksJsonWithObservation as cursorHooksJson } from "./observe.js";
20
4
  export { codexHooksJsonWithObservation as codexHooksJson } from "./observe.js";