aiwcli 0.12.6 → 0.12.8
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/bin/dev.cmd +3 -3
- package/bin/dev.js +16 -16
- package/bin/run.cmd +3 -3
- package/bin/run.js +21 -21
- package/dist/commands/branch.js +7 -2
- package/dist/lib/bmad-installer.js +37 -37
- package/dist/lib/terminal.d.ts +2 -0
- package/dist/lib/terminal.js +57 -7
- package/dist/templates/CLAUDE.md +232 -205
- package/dist/templates/_shared/.claude/settings.json +65 -65
- package/dist/templates/_shared/.claude/{commands/handoff.md → skills/handoff/SKILL.md} +13 -12
- package/dist/templates/_shared/.claude/{commands/handoff-resume.md → skills/handoff-resume/SKILL.md} +13 -12
- package/dist/templates/_shared/.codex/workflows/handoff.md +226 -226
- package/dist/templates/_shared/.windsurf/workflows/handoff.md +226 -226
- package/dist/templates/_shared/handoff-system/CLAUDE.md +15 -3
- package/dist/templates/_shared/handoff-system/lib/document-generator.ts +215 -215
- package/dist/templates/_shared/handoff-system/lib/handoff-reader.ts +158 -158
- package/dist/templates/_shared/handoff-system/scripts/resume_handoff.ts +373 -373
- package/dist/templates/_shared/handoff-system/scripts/save_handoff.ts +469 -469
- package/dist/templates/_shared/handoff-system/workflows/handoff-resume.md +66 -66
- package/dist/templates/_shared/handoff-system/workflows/handoff.md +254 -254
- package/dist/templates/_shared/hooks-ts/_utils/git-state.ts +2 -2
- package/dist/templates/_shared/hooks-ts/archive_plan.ts +159 -159
- package/dist/templates/_shared/hooks-ts/context_monitor.ts +147 -147
- package/dist/templates/_shared/hooks-ts/file-suggestion.ts +128 -128
- package/dist/templates/_shared/hooks-ts/pre_compact.ts +49 -49
- package/dist/templates/_shared/hooks-ts/session_end.ts +196 -196
- package/dist/templates/_shared/hooks-ts/session_start.ts +163 -163
- package/dist/templates/_shared/hooks-ts/task_create_capture.ts +48 -48
- package/dist/templates/_shared/hooks-ts/task_update_capture.ts +74 -74
- package/dist/templates/_shared/hooks-ts/user_prompt_submit.ts +93 -93
- package/dist/templates/_shared/lib-ts/CLAUDE.md +367 -367
- package/dist/templates/_shared/lib-ts/base/atomic-write.ts +138 -138
- package/dist/templates/_shared/lib-ts/base/constants.ts +24 -6
- package/dist/templates/_shared/lib-ts/base/git-state.ts +58 -58
- package/dist/templates/_shared/lib-ts/base/hook-utils.ts +582 -582
- package/dist/templates/_shared/lib-ts/base/inference.ts +301 -301
- package/dist/templates/_shared/lib-ts/base/logger.ts +247 -247
- package/dist/templates/_shared/lib-ts/base/state-io.ts +202 -202
- package/dist/templates/_shared/lib-ts/base/stop-words.ts +184 -184
- package/dist/templates/_shared/lib-ts/base/utils.ts +184 -184
- package/dist/templates/_shared/lib-ts/context/CLAUDE.md +134 -0
- package/dist/templates/_shared/lib-ts/context/context-formatter.ts +566 -566
- package/dist/templates/_shared/lib-ts/context/context-selector.ts +524 -524
- package/dist/templates/_shared/lib-ts/context/context-store.ts +712 -712
- package/dist/templates/_shared/lib-ts/context/plan-manager.ts +312 -312
- package/dist/templates/_shared/lib-ts/context/task-tracker.ts +185 -185
- package/dist/templates/_shared/lib-ts/package.json +20 -20
- package/dist/templates/_shared/lib-ts/templates/formatters.ts +102 -102
- package/dist/templates/_shared/lib-ts/templates/plan-context.ts +58 -58
- package/dist/templates/_shared/lib-ts/tsconfig.json +13 -13
- package/dist/templates/_shared/lib-ts/types.ts +186 -186
- package/dist/templates/_shared/scripts/resolve_context.ts +33 -33
- package/dist/templates/_shared/scripts/status_line.ts +687 -690
- package/dist/templates/cc-native/.claude/commands/cc-native/rlm/ask.md +136 -136
- package/dist/templates/cc-native/.claude/commands/cc-native/rlm/index.md +21 -21
- package/dist/templates/cc-native/.claude/commands/cc-native/rlm/overview.md +56 -56
- package/dist/templates/cc-native/.claude/commands/cc-native/specdev.md +10 -10
- package/dist/templates/cc-native/.claude/settings.json +3 -2
- package/dist/templates/cc-native/.windsurf/workflows/cc-native/fix.md +8 -8
- package/dist/templates/cc-native/.windsurf/workflows/cc-native/implement.md +8 -8
- package/dist/templates/cc-native/.windsurf/workflows/cc-native/research.md +8 -8
- package/dist/templates/cc-native/CC-NATIVE-README.md +189 -189
- package/dist/templates/cc-native/TEMPLATE-SCHEMA.md +304 -304
- package/dist/templates/cc-native/_cc-native/agents/CLAUDE.md +143 -143
- package/dist/templates/cc-native/_cc-native/agents/PLAN-ORCHESTRATOR.md +213 -213
- package/dist/templates/cc-native/_cc-native/agents/plan-questions/PLAN-QUESTIONER.md +70 -70
- package/dist/templates/cc-native/_cc-native/artifacts/CLAUDE.md +64 -0
- package/dist/templates/cc-native/_cc-native/{lib-ts/artifacts → artifacts/lib}/format.ts +1 -1
- package/dist/templates/cc-native/_cc-native/{lib-ts/artifacts → artifacts/lib}/write.ts +2 -2
- package/dist/templates/cc-native/_cc-native/cc-native.config.json +96 -96
- package/dist/templates/cc-native/_cc-native/hooks/CLAUDE.md +14 -24
- package/dist/templates/cc-native/_cc-native/hooks/cc-native-plan-review.ts +1 -1
- package/dist/templates/cc-native/_cc-native/hooks/enhance_plan_post_subagent.ts +54 -54
- package/dist/templates/cc-native/_cc-native/hooks/enhance_plan_post_write.ts +51 -51
- package/dist/templates/cc-native/_cc-native/hooks/mark_questions_asked.ts +53 -53
- package/dist/templates/cc-native/_cc-native/hooks/plan_questions_early.ts +61 -61
- package/dist/templates/cc-native/_cc-native/hooks/validate_task_prompt.ts +76 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/aggregate-agents.ts +9 -2
- package/dist/templates/cc-native/_cc-native/lib-ts/cc-native-state.ts +319 -319
- package/dist/templates/cc-native/_cc-native/lib-ts/cli-output-parser.ts +144 -144
- package/dist/templates/cc-native/_cc-native/lib-ts/config.ts +57 -57
- package/dist/templates/cc-native/_cc-native/lib-ts/constants.ts +83 -83
- package/dist/templates/cc-native/_cc-native/lib-ts/debug.ts +79 -79
- package/dist/templates/cc-native/_cc-native/lib-ts/index.ts +4 -4
- package/dist/templates/cc-native/_cc-native/lib-ts/json-parser.ts +168 -168
- package/dist/templates/cc-native/_cc-native/lib-ts/plan-discovery.ts +80 -80
- package/dist/templates/cc-native/_cc-native/lib-ts/plan-enhancement.ts +41 -41
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/CLAUDE.md +480 -480
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/embedding-indexer.ts +287 -287
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/hyde.ts +148 -148
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/index.ts +54 -54
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/logger.ts +58 -58
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/ollama-client.ts +208 -208
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/retrieval-pipeline.ts +460 -460
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-indexer.ts +446 -446
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-loader.ts +280 -280
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-searcher.ts +274 -274
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/types.ts +201 -201
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/vector-store.ts +278 -278
- package/dist/templates/cc-native/_cc-native/lib-ts/settings.ts +184 -184
- package/dist/templates/cc-native/_cc-native/lib-ts/state.ts +275 -275
- package/dist/templates/cc-native/_cc-native/lib-ts/tsconfig.json +18 -18
- package/dist/templates/cc-native/_cc-native/lib-ts/types.ts +1 -1
- package/dist/templates/cc-native/_cc-native/plan-review/CLAUDE.md +149 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/CLAUDE.md +143 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/PLAN-ORCHESTRATOR.md +213 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-questions/PLAN-QUESTIONER.md +70 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ARCH-EVOLUTION.md +62 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ARCH-PATTERNS.md +61 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ARCH-STRUCTURE.md +62 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ASSUMPTION-TRACER.md +56 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/CLARITY-AUDITOR.md +53 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/COMPLETENESS-FEASIBILITY.md +66 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/COMPLETENESS-GAPS.md +70 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/COMPLETENESS-ORDERING.md +62 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/CONSTRAINT-VALIDATOR.md +72 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DESIGN-ADR-VALIDATOR.md +61 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DESIGN-SCALE-MATCHER.md +64 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DEVILS-ADVOCATE.md +56 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DOCUMENTATION-PHILOSOPHY.md +86 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/HANDOFF-READINESS.md +59 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/HIDDEN-COMPLEXITY.md +58 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/INCREMENTAL-DELIVERY.md +66 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-DEPENDENCY.md +62 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-FMEA.md +66 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-PREMORTEM.md +71 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-REVERSIBILITY.md +74 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/SCOPE-BOUNDARY.md +77 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/SIMPLICITY-GUARDIAN.md +62 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/SKEPTIC.md +68 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-BEHAVIOR-AUDITOR.md +61 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-CHARACTERIZATION.md +71 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-FIRST-VALIDATOR.md +61 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-PYRAMID-ANALYZER.md +61 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TRADEOFF-COSTS.md +67 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TRADEOFF-STAKEHOLDERS.md +65 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/VERIFY-COVERAGE.md +74 -0
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/VERIFY-STRENGTH.md +69 -0
- package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/agent-selection.ts +3 -3
- package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/corroboration.ts +1 -1
- package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/graduation.ts +1 -1
- package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/orchestrator.ts +2 -2
- package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/output-builder.ts +3 -3
- package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/plan-questions.ts +6 -6
- package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/review-pipeline.ts +15 -15
- package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/reviewers/agent.ts +5 -5
- package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/reviewers/base/base-agent.ts +4 -4
- package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/reviewers/providers/claude-agent.ts +4 -4
- package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/reviewers/providers/codex-agent.ts +6 -6
- package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/reviewers/providers/gemini-agent.ts +1 -1
- package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/reviewers/providers/orchestrator-claude-agent.ts +4 -4
- package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/reviewers/types.ts +3 -3
- package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/verdict.ts +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +108 -108
- package/dist/templates/cc-native/_cc-native/lib-ts/artifacts.ts +0 -21
- package/dist/templates/cc-native/_cc-native/lib-ts/nul +0 -3
- /package/dist/templates/cc-native/_cc-native/{lib-ts/artifacts → artifacts/lib}/index.ts +0 -0
- /package/dist/templates/cc-native/_cc-native/{lib-ts/artifacts → artifacts/lib}/tracker.ts +0 -0
- /package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/reviewers/index.ts +0 -0
- /package/dist/templates/cc-native/_cc-native/{lib-ts → plan-review/lib}/reviewers/schemas.ts +0 -0
- /package/dist/templates/cc-native/_cc-native/{workflows → plan-review/workflows}/specdev.md +0 -0
|
@@ -1,96 +1,96 @@
|
|
|
1
|
-
{
|
|
2
|
-
"models": {
|
|
3
|
-
"providers": {
|
|
4
|
-
"claude": {
|
|
5
|
-
"enabled": true,
|
|
6
|
-
"models": ["sonnet"]
|
|
7
|
-
},
|
|
8
|
-
"codex": {
|
|
9
|
-
"enabled": true,
|
|
10
|
-
"models": ["gpt-5.1-codex-mini"]
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
"planReview": {
|
|
15
|
-
"enabled": true,
|
|
16
|
-
"display": {
|
|
17
|
-
"maxIssues": 12,
|
|
18
|
-
"maxMissingSections": 12,
|
|
19
|
-
"maxQuestions": 12
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
"agentReview": {
|
|
23
|
-
"enabled": true,
|
|
24
|
-
"timeout": 180,
|
|
25
|
-
"warnThreshold": 0.01,
|
|
26
|
-
"maxIssuesPerAgent": 3,
|
|
27
|
-
"orchestrator": {
|
|
28
|
-
"enabled": true,
|
|
29
|
-
"model": "opus",
|
|
30
|
-
"timeout": 60
|
|
31
|
-
},
|
|
32
|
-
"legacyMode": false,
|
|
33
|
-
"mandatoryAgents": {
|
|
34
|
-
"always": ["handoff-readiness", "clarity-auditor", "skeptic"],
|
|
35
|
-
"medium+": ["documentation-philosophy"]
|
|
36
|
-
},
|
|
37
|
-
"fallbackByComplexity": {
|
|
38
|
-
"simple": 0,
|
|
39
|
-
"medium": 12,
|
|
40
|
-
"high": 6
|
|
41
|
-
},
|
|
42
|
-
"reviewIterations": {
|
|
43
|
-
"simple": 1,
|
|
44
|
-
"medium": 3,
|
|
45
|
-
"high": 5
|
|
46
|
-
},
|
|
47
|
-
"highIssueThreshold": 2,
|
|
48
|
-
"earlyExitOnAllPass": true,
|
|
49
|
-
"display": {
|
|
50
|
-
"maxIssues": 12,
|
|
51
|
-
"maxMissingSections": 12,
|
|
52
|
-
"maxQuestions": 12
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
"agentSelection": {
|
|
56
|
-
"simple": { "min": 3, "max": 3 },
|
|
57
|
-
"medium": { "min": 12, "max": 12 },
|
|
58
|
-
"high": { "min": 6, "max": 6 },
|
|
59
|
-
"fallbackCount": 3
|
|
60
|
-
},
|
|
61
|
-
"agentDefaults": {
|
|
62
|
-
"model": "sonnet"
|
|
63
|
-
},
|
|
64
|
-
"complexityCategories": [
|
|
65
|
-
"code", "infrastructure", "documentation",
|
|
66
|
-
"life", "business", "design", "research"
|
|
67
|
-
],
|
|
68
|
-
"sanitization": {
|
|
69
|
-
"maxSessionIdLength": 32,
|
|
70
|
-
"maxTitleLength": 50
|
|
71
|
-
},
|
|
72
|
-
"planContext": {
|
|
73
|
-
"enabled": true,
|
|
74
|
-
"offerClarifyingQuestions": true
|
|
75
|
-
},
|
|
76
|
-
"stuckDetection": {
|
|
77
|
-
"enabled": true,
|
|
78
|
-
"errorThreshold": 3,
|
|
79
|
-
"fileEditThreshold": 4,
|
|
80
|
-
"testFailureThreshold": 3,
|
|
81
|
-
"cooldown": 10,
|
|
82
|
-
"maxSuggestions": 3
|
|
83
|
-
},
|
|
84
|
-
"rlm": {
|
|
85
|
-
"hyde": {
|
|
86
|
-
"enabled": false,
|
|
87
|
-
"provider": "ollama",
|
|
88
|
-
"ollamaModel": "qwen2.5:1.5b",
|
|
89
|
-
"numResponses": 5,
|
|
90
|
-
"maxTokens": 200,
|
|
91
|
-
"timeoutMs": 10000,
|
|
92
|
-
"fallbackToQuery": true,
|
|
93
|
-
"fallbackToClaude": false
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"models": {
|
|
3
|
+
"providers": {
|
|
4
|
+
"claude": {
|
|
5
|
+
"enabled": true,
|
|
6
|
+
"models": ["sonnet"]
|
|
7
|
+
},
|
|
8
|
+
"codex": {
|
|
9
|
+
"enabled": true,
|
|
10
|
+
"models": ["gpt-5.1-codex-mini"]
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"planReview": {
|
|
15
|
+
"enabled": true,
|
|
16
|
+
"display": {
|
|
17
|
+
"maxIssues": 12,
|
|
18
|
+
"maxMissingSections": 12,
|
|
19
|
+
"maxQuestions": 12
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"agentReview": {
|
|
23
|
+
"enabled": true,
|
|
24
|
+
"timeout": 180,
|
|
25
|
+
"warnThreshold": 0.01,
|
|
26
|
+
"maxIssuesPerAgent": 3,
|
|
27
|
+
"orchestrator": {
|
|
28
|
+
"enabled": true,
|
|
29
|
+
"model": "opus",
|
|
30
|
+
"timeout": 60
|
|
31
|
+
},
|
|
32
|
+
"legacyMode": false,
|
|
33
|
+
"mandatoryAgents": {
|
|
34
|
+
"always": ["handoff-readiness", "clarity-auditor", "skeptic"],
|
|
35
|
+
"medium+": ["documentation-philosophy"]
|
|
36
|
+
},
|
|
37
|
+
"fallbackByComplexity": {
|
|
38
|
+
"simple": 0,
|
|
39
|
+
"medium": 12,
|
|
40
|
+
"high": 6
|
|
41
|
+
},
|
|
42
|
+
"reviewIterations": {
|
|
43
|
+
"simple": 1,
|
|
44
|
+
"medium": 3,
|
|
45
|
+
"high": 5
|
|
46
|
+
},
|
|
47
|
+
"highIssueThreshold": 2,
|
|
48
|
+
"earlyExitOnAllPass": true,
|
|
49
|
+
"display": {
|
|
50
|
+
"maxIssues": 12,
|
|
51
|
+
"maxMissingSections": 12,
|
|
52
|
+
"maxQuestions": 12
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"agentSelection": {
|
|
56
|
+
"simple": { "min": 3, "max": 3 },
|
|
57
|
+
"medium": { "min": 12, "max": 12 },
|
|
58
|
+
"high": { "min": 6, "max": 6 },
|
|
59
|
+
"fallbackCount": 3
|
|
60
|
+
},
|
|
61
|
+
"agentDefaults": {
|
|
62
|
+
"model": "sonnet"
|
|
63
|
+
},
|
|
64
|
+
"complexityCategories": [
|
|
65
|
+
"code", "infrastructure", "documentation",
|
|
66
|
+
"life", "business", "design", "research"
|
|
67
|
+
],
|
|
68
|
+
"sanitization": {
|
|
69
|
+
"maxSessionIdLength": 32,
|
|
70
|
+
"maxTitleLength": 50
|
|
71
|
+
},
|
|
72
|
+
"planContext": {
|
|
73
|
+
"enabled": true,
|
|
74
|
+
"offerClarifyingQuestions": true
|
|
75
|
+
},
|
|
76
|
+
"stuckDetection": {
|
|
77
|
+
"enabled": true,
|
|
78
|
+
"errorThreshold": 3,
|
|
79
|
+
"fileEditThreshold": 4,
|
|
80
|
+
"testFailureThreshold": 3,
|
|
81
|
+
"cooldown": 10,
|
|
82
|
+
"maxSuggestions": 3
|
|
83
|
+
},
|
|
84
|
+
"rlm": {
|
|
85
|
+
"hyde": {
|
|
86
|
+
"enabled": false,
|
|
87
|
+
"provider": "ollama",
|
|
88
|
+
"ollamaModel": "qwen2.5:1.5b",
|
|
89
|
+
"numResponses": 5,
|
|
90
|
+
"maxTokens": 200,
|
|
91
|
+
"timeoutMs": 10000,
|
|
92
|
+
"fallbackToQuery": true,
|
|
93
|
+
"fallbackToClaude": false
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -14,19 +14,19 @@
|
|
|
14
14
|
|
|
15
15
|
### Plan Review Architecture
|
|
16
16
|
|
|
17
|
-
The hook is a thin coordinator (~70 lines) that delegates to `
|
|
18
|
-
|
|
19
|
-
| Module | Responsibility |
|
|
20
|
-
|
|
21
|
-
| `plan-discovery.ts` | Find plan file, read content, compute hash |
|
|
22
|
-
| `settings.ts` | Load + merge config with defaults, load agent library |
|
|
23
|
-
| `agent-selection.ts` | Mandatory agent resolution, orchestrator-based selection, model assignment |
|
|
24
|
-
| `graduation.ts` | Pass eligibility, pass streaks, graduation threshold, iteration advancement |
|
|
25
|
-
| `output-builder.ts` | Issue truncation, verdict override, context/block message construction |
|
|
26
|
-
| `review-pipeline.ts` | Pipeline orchestrator wiring all modules together |
|
|
27
|
-
| `artifacts/format.ts` | Pure formatting (markdown, JSON, inline summaries) |
|
|
28
|
-
| `artifacts/write.ts` | File I/O for review artifacts |
|
|
29
|
-
| `artifacts/tracker.ts` | Review tracker management |
|
|
17
|
+
The hook is a thin coordinator (~70 lines) that delegates to `plan-review/lib/review-pipeline.ts`. The pipeline wires together focused modules:
|
|
18
|
+
|
|
19
|
+
| Module | Location | Responsibility |
|
|
20
|
+
|--------|----------|----------------|
|
|
21
|
+
| `plan-discovery.ts` | `lib-ts/` | Find plan file, read content, compute hash |
|
|
22
|
+
| `settings.ts` | `lib-ts/` | Load + merge config with defaults, load agent library |
|
|
23
|
+
| `agent-selection.ts` | `plan-review/lib/` | Mandatory agent resolution, orchestrator-based selection, model assignment |
|
|
24
|
+
| `graduation.ts` | `plan-review/lib/` | Pass eligibility, pass streaks, graduation threshold, iteration advancement |
|
|
25
|
+
| `output-builder.ts` | `plan-review/lib/` | Issue truncation, verdict override, context/block message construction |
|
|
26
|
+
| `review-pipeline.ts` | `plan-review/lib/` | Pipeline orchestrator wiring all modules together |
|
|
27
|
+
| `artifacts/lib/format.ts` | `artifacts/` | Pure formatting (markdown, JSON, inline summaries) |
|
|
28
|
+
| `artifacts/lib/write.ts` | `artifacts/` | File I/O for review artifacts |
|
|
29
|
+
| `artifacts/lib/tracker.ts` | `artifacts/` | Review tracker management |
|
|
30
30
|
|
|
31
31
|
### Questions Gate (in review-pipeline.ts)
|
|
32
32
|
|
|
@@ -134,7 +134,7 @@ const context = getContextBySessionId(sessionId, projectRoot);
|
|
|
134
134
|
if (!context) {
|
|
135
135
|
// Fallback: find single planning context
|
|
136
136
|
const allActive = getAllContexts("active", projectRoot);
|
|
137
|
-
const planning = allActive.filter((c: any) => c.mode === "active" || c.mode === "
|
|
137
|
+
const planning = allActive.filter((c: any) => c.mode === "active" || c.mode === "has_staged_work");
|
|
138
138
|
if (planning.length === 1) {
|
|
139
139
|
context = planning[0];
|
|
140
140
|
}
|
|
@@ -235,13 +235,3 @@ Hooks fail silently on import errors — verify after any import path changes.
|
|
|
235
235
|
| 2026-02-10 | **Migrated cc-native hooks from Python to TypeScript.** `cc-native-plan-review.ts` (async, parallel agent reviews via `Promise.all()`), `add_plan_context.ts`, `plan_questions_early.ts`. All hooks use `runHook()`/`runHookAsync()` entry points. Library code in `_cc-native/lib-ts/` (18 files). Settings.json updated to use `bun` runner. Python `.py` files kept as fallback until TS hooks verified. |
|
|
236
236
|
| 2026-02-10 | Flipped TS logger stderr default to opt-in (`opts?.stderr === true`). Added `logBlocking()` for intentional stderr visibility. Removed redundant `{stderr: false}` from hook-utils.ts, user_prompt_submit.ts, context_monitor.ts. Added "Hook Error Visibility" section documenting visibility tiers and exit code behavior. |
|
|
237
237
|
| 2026-02-10 | Fixed `debug.py` `context_path` crash. Added local try/catch around `maybeActivate` in `user_prompt_submit.ts` and `context_monitor.ts` to prevent stderr error display on non-critical I/O failures. Removed dead `context_path` from `_emitHookEnd` in `hook-utils.ts`. Added "Error Handling" section to CLAUDE.md. |
|
|
238
|
-
| 2026-02-07 | Handoff staging lifecycle: `has_handoff` mode + `handoff_consumed` flag mirrors plan lifecycle. `save_handoff.py` no longer transitions to idle — stays active for session_end staging. `session_end.py` stages `active→has_handoff` when handoff_path set and not consumed. `session_start.py` restores `has_handoff→active` on /clear. `context_selector.py` has fallback Case 3b for has_handoff. PostToolUse context_monitor matcher simplified from specific tool list to `*`. |
|
|
239
|
-
| 2026-02-07 | Removed PreToolUse:Write matcher from `add_plan_context.py`. Write-time plan nudges were redundant after consolidating enforcement to PreToolUse:Task. Removed `is_plan_file_write()`, `load_plan_context_config()`, `PHASE_B_ENFORCEMENT`, `nudge_write_questions()`, and `project_dir` import. |
|
|
240
|
-
| 2026-02-07 | Question enforcement is now advisory-only (never blocks). `add_plan_context.py` uses `emit_context()` for all question nudges — no `permissionDecision:deny` anywhere. Removed `emit_context_and_block` import and `TASK_ENFORCEMENT_REASON` constant. |
|
|
241
|
-
| 2026-02-07 | Moved question enforcement to PreToolUse:Task (Plan subagent gate). `add_plan_context.py` now handles three events: PostToolUse:AskUserQuestion, PreToolUse:Task (primary gate), PreToolUse:Write (fallback). Added `is_plan_task()`, `is_internal_call()` guard, `TASK_ENFORCEMENT_CONTEXT` constant. Registered `^Task$` command hook in settings.json. |
|
|
242
|
-
| 2026-02-07 | Deleted `plan_accepted.py` (dead code — PostToolUse:ExitPlanMode never fires due to /clear race). Plan field assignment handled by `session_end.py` fallback. Added `plan_consumed` flag to prevent infinite plan re-staging. |
|
|
243
|
-
| 2026-02-07 | Hook lifecycle diagnostics: all hooks now use `run_hook(main, "hook_name")` entry point. Logs HOOK_START/HOOK_END with template origin, event type, duration_ms, and status. Millisecond timestamps in logger. |
|
|
244
|
-
| 2026-02-07 | Unified logger: all diagnostic logging uses `log_debug/log_info/log_warn/log_error` from `_shared/lib/base/logger.py` instead of eprint/print-to-stderr. Updated debugging and error handling docs. |
|
|
245
|
-
| 2026-02-06 | Merged mark_questions_asked.py into add_plan_context.py. Hook now handles both PostToolUse:AskUserQuestion and PreToolUse:Write. Deleted standalone mark_questions_asked.py. |
|
|
246
|
-
| 2026-02-06 | Fixed add_plan_context.py trigger docs (was PostToolUse: EnterPlanMode, is PreToolUse: Write). Added emit_context/emit_context_and_block utility docs. |
|
|
247
|
-
| 2026-02-03 | Initial creation |
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
} from "../../_shared/lib-ts/base/hook-utils.js";
|
|
22
22
|
import { isInternalCall } from "../../_shared/lib-ts/base/subprocess-utils.js";
|
|
23
23
|
import { getProjectRoot, getAiwcliDir } from "../../_shared/lib-ts/base/constants.js";
|
|
24
|
-
import { runReviewPipeline } from "../
|
|
24
|
+
import { runReviewPipeline } from "../plan-review/lib/review-pipeline.js";
|
|
25
25
|
import type { PipelineResult } from "../lib-ts/types.js";
|
|
26
26
|
|
|
27
27
|
const HOOK = "cc-native-plan-review";
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
/**
|
|
3
|
-
* PostToolUse:Task Hook: Plan Quality Review Context
|
|
4
|
-
*
|
|
5
|
-
* Fires after Task tool completes with a Plan subagent. Emits plan quality review guidance
|
|
6
|
-
* as context for the main agent to review the plan before ExitPlanMode.
|
|
7
|
-
*
|
|
8
|
-
* Design:
|
|
9
|
-
* - Never blocks (all errors exit 0)
|
|
10
|
-
* - Emits context via emitContext() — no file mutation
|
|
11
|
-
* - Only fires for Task tool with subagent_type="Plan"
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import {
|
|
15
|
-
loadHookInput,
|
|
16
|
-
runHook,
|
|
17
|
-
logInfo,
|
|
18
|
-
logDebug,
|
|
19
|
-
emitContext,
|
|
20
|
-
getToolInput,
|
|
21
|
-
} from "../../_shared/lib-ts/base/hook-utils.js";
|
|
22
|
-
import { isInternalCall } from "../../_shared/lib-ts/base/subprocess-utils.js";
|
|
23
|
-
import { getPlanQualityReviewContext } from "../lib-ts/plan-enhancement.js";
|
|
24
|
-
|
|
25
|
-
function main(): void {
|
|
26
|
-
if (isInternalCall()) return;
|
|
27
|
-
|
|
28
|
-
const payload = loadHookInput();
|
|
29
|
-
if (!payload) {
|
|
30
|
-
logDebug("enhance_plan_post_subagent", "No payload received");
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Check if this is a Task tool call
|
|
35
|
-
if (payload.tool_name !== "Task") {
|
|
36
|
-
logDebug("enhance_plan_post_subagent", `Skipping: tool_name is "${payload.tool_name}", not "Task"`);
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Check if the Task is spawning a Plan subagent
|
|
41
|
-
const toolInput = getToolInput(payload);
|
|
42
|
-
const subagentType = toolInput?.subagent_type;
|
|
43
|
-
logDebug("enhance_plan_post_subagent", `subagent_type: ${subagentType ?? "undefined"}`);
|
|
44
|
-
|
|
45
|
-
if (subagentType !== "Plan") {
|
|
46
|
-
logDebug("enhance_plan_post_subagent", `Skipping: subagent_type is "${subagentType}", not "Plan"`);
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
logInfo("enhance_plan_post_subagent", "Emitting plan quality review context");
|
|
51
|
-
emitContext(getPlanQualityReviewContext());
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
runHook(main, "enhance_plan_post_subagent");
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/**
|
|
3
|
+
* PostToolUse:Task Hook: Plan Quality Review Context
|
|
4
|
+
*
|
|
5
|
+
* Fires after Task tool completes with a Plan subagent. Emits plan quality review guidance
|
|
6
|
+
* as context for the main agent to review the plan before ExitPlanMode.
|
|
7
|
+
*
|
|
8
|
+
* Design:
|
|
9
|
+
* - Never blocks (all errors exit 0)
|
|
10
|
+
* - Emits context via emitContext() — no file mutation
|
|
11
|
+
* - Only fires for Task tool with subagent_type="Plan"
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import {
|
|
15
|
+
loadHookInput,
|
|
16
|
+
runHook,
|
|
17
|
+
logInfo,
|
|
18
|
+
logDebug,
|
|
19
|
+
emitContext,
|
|
20
|
+
getToolInput,
|
|
21
|
+
} from "../../_shared/lib-ts/base/hook-utils.js";
|
|
22
|
+
import { isInternalCall } from "../../_shared/lib-ts/base/subprocess-utils.js";
|
|
23
|
+
import { getPlanQualityReviewContext } from "../lib-ts/plan-enhancement.js";
|
|
24
|
+
|
|
25
|
+
function main(): void {
|
|
26
|
+
if (isInternalCall()) return;
|
|
27
|
+
|
|
28
|
+
const payload = loadHookInput();
|
|
29
|
+
if (!payload) {
|
|
30
|
+
logDebug("enhance_plan_post_subagent", "No payload received");
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Check if this is a Task tool call
|
|
35
|
+
if (payload.tool_name !== "Task") {
|
|
36
|
+
logDebug("enhance_plan_post_subagent", `Skipping: tool_name is "${payload.tool_name}", not "Task"`);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Check if the Task is spawning a Plan subagent
|
|
41
|
+
const toolInput = getToolInput(payload);
|
|
42
|
+
const subagentType = toolInput?.subagent_type;
|
|
43
|
+
logDebug("enhance_plan_post_subagent", `subagent_type: ${subagentType ?? "undefined"}`);
|
|
44
|
+
|
|
45
|
+
if (subagentType !== "Plan") {
|
|
46
|
+
logDebug("enhance_plan_post_subagent", `Skipping: subagent_type is "${subagentType}", not "Plan"`);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
logInfo("enhance_plan_post_subagent", "Emitting plan quality review context");
|
|
51
|
+
emitContext(getPlanQualityReviewContext());
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
runHook(main, "enhance_plan_post_subagent");
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
/**
|
|
3
|
-
* PostToolUse:Write Hook: Plan Quality Review Context
|
|
4
|
-
*
|
|
5
|
-
* Fires after Write tool completes. Detects writes to ~/.claude/plans/*.md files
|
|
6
|
-
* and emits plan quality review guidance as context.
|
|
7
|
-
*
|
|
8
|
-
* Design:
|
|
9
|
-
* - Never blocks (all paths exit 0)
|
|
10
|
-
* - Uses normalized path comparison (cross-platform)
|
|
11
|
-
* - Shares prompt logic with SubagentStop hook via plan-enhancement.ts
|
|
12
|
-
* - Emits context via emitContext() — no file mutation
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import * as os from "node:os";
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/**
|
|
3
|
+
* PostToolUse:Write Hook: Plan Quality Review Context
|
|
4
|
+
*
|
|
5
|
+
* Fires after Write tool completes. Detects writes to ~/.claude/plans/*.md files
|
|
6
|
+
* and emits plan quality review guidance as context.
|
|
7
|
+
*
|
|
8
|
+
* Design:
|
|
9
|
+
* - Never blocks (all paths exit 0)
|
|
10
|
+
* - Uses normalized path comparison (cross-platform)
|
|
11
|
+
* - Shares prompt logic with SubagentStop hook via plan-enhancement.ts
|
|
12
|
+
* - Emits context via emitContext() — no file mutation
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import * as os from "node:os";
|
|
16
16
|
import * as path from "node:path";
|
|
17
|
-
|
|
18
|
-
import {
|
|
19
|
-
loadHookInput,
|
|
20
|
-
runHook,
|
|
21
|
-
logInfo,
|
|
22
|
-
emitContext,
|
|
23
|
-
} from "../../_shared/lib-ts/base/hook-utils.js";
|
|
24
|
-
import { isInternalCall } from "../../_shared/lib-ts/base/subprocess-utils.js";
|
|
25
|
-
import { getPlanQualityReviewContext } from "../lib-ts/plan-enhancement.js";
|
|
26
|
-
|
|
27
|
-
function main(): void {
|
|
28
|
-
if (isInternalCall()) return;
|
|
29
|
-
|
|
30
|
-
const payload = loadHookInput();
|
|
31
|
-
if (!payload) return;
|
|
32
|
-
|
|
33
|
-
const toolInput = payload.tool_input;
|
|
34
|
-
if (!toolInput || typeof toolInput !== "object") return;
|
|
35
|
-
|
|
36
|
-
const filePath = toolInput.file_path as string | undefined;
|
|
37
|
-
if (!filePath) return;
|
|
38
|
-
|
|
39
|
-
// Normalize paths for cross-platform comparison
|
|
40
|
-
const normalizedPath = path.normalize(path.resolve(filePath));
|
|
41
|
-
const plansDir = path.normalize(path.join(os.homedir(), ".claude", "plans"));
|
|
42
|
-
|
|
43
|
-
// Check if file is a markdown file in the plans directory
|
|
44
|
-
if (!normalizedPath.startsWith(plansDir) || !normalizedPath.endsWith(".md")) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
logInfo("enhance_plan_write", `Detected plan file write: ${filePath}`);
|
|
49
|
-
emitContext(getPlanQualityReviewContext());
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
runHook(main, "enhance_plan_post_write");
|
|
17
|
+
|
|
18
|
+
import {
|
|
19
|
+
loadHookInput,
|
|
20
|
+
runHook,
|
|
21
|
+
logInfo,
|
|
22
|
+
emitContext,
|
|
23
|
+
} from "../../_shared/lib-ts/base/hook-utils.js";
|
|
24
|
+
import { isInternalCall } from "../../_shared/lib-ts/base/subprocess-utils.js";
|
|
25
|
+
import { getPlanQualityReviewContext } from "../lib-ts/plan-enhancement.js";
|
|
26
|
+
|
|
27
|
+
function main(): void {
|
|
28
|
+
if (isInternalCall()) return;
|
|
29
|
+
|
|
30
|
+
const payload = loadHookInput();
|
|
31
|
+
if (!payload) return;
|
|
32
|
+
|
|
33
|
+
const toolInput = payload.tool_input;
|
|
34
|
+
if (!toolInput || typeof toolInput !== "object") return;
|
|
35
|
+
|
|
36
|
+
const filePath = toolInput.file_path as string | undefined;
|
|
37
|
+
if (!filePath) return;
|
|
38
|
+
|
|
39
|
+
// Normalize paths for cross-platform comparison
|
|
40
|
+
const normalizedPath = path.normalize(path.resolve(filePath));
|
|
41
|
+
const plansDir = path.normalize(path.join(os.homedir(), ".claude", "plans"));
|
|
42
|
+
|
|
43
|
+
// Check if file is a markdown file in the plans directory
|
|
44
|
+
if (!normalizedPath.startsWith(plansDir) || !normalizedPath.endsWith(".md")) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
logInfo("enhance_plan_write", `Detected plan file write: ${filePath}`);
|
|
49
|
+
emitContext(getPlanQualityReviewContext());
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
runHook(main, "enhance_plan_post_write");
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
/**
|
|
3
|
-
* Mark Questions Asked Hook
|
|
4
|
-
*
|
|
5
|
-
* Tracks when AskUserQuestion tool is used during a session.
|
|
6
|
-
* Used by other hooks to determine if user clarification was gathered.
|
|
7
|
-
*
|
|
8
|
-
* Registered for:
|
|
9
|
-
* - PostToolUse: AskUserQuestion — marks questions asked state for this session
|
|
10
|
-
*
|
|
11
|
-
* Fail-safe: Any error exits 0 (non-blocking).
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import { getProjectRoot } from "../../_shared/lib-ts/base/constants.js";
|
|
15
|
-
import {
|
|
16
|
-
loadHookInput,
|
|
17
|
-
runHook,
|
|
18
|
-
logInfo,
|
|
19
|
-
logDiagnostic,
|
|
20
|
-
} from "../../_shared/lib-ts/base/hook-utils.js";
|
|
21
|
-
import { isInternalCall } from "../../_shared/lib-ts/base/subprocess-utils.js";
|
|
22
|
-
import { markQuestionsAsked } from "../lib-ts/cc-native-state.js";
|
|
23
|
-
|
|
24
|
-
function main(): void {
|
|
25
|
-
// Guard: skip for internal subprocess calls (prevents recursive hook execution)
|
|
26
|
-
if (isInternalCall()) return;
|
|
27
|
-
|
|
28
|
-
const payload = loadHookInput();
|
|
29
|
-
if (!payload) return;
|
|
30
|
-
|
|
31
|
-
const toolName = payload.tool_name;
|
|
32
|
-
const hookEvent = payload.hook_event_name ?? "unknown";
|
|
33
|
-
logDiagnostic(
|
|
34
|
-
"add_plan_context",
|
|
35
|
-
"receive",
|
|
36
|
-
`tool=${toolName}, event=${hookEvent}`,
|
|
37
|
-
{ inputs: { tool_name: toolName, hook_event: hookEvent } },
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
const projectRoot = getProjectRoot(payload.cwd);
|
|
41
|
-
|
|
42
|
-
// PostToolUse: AskUserQuestion — mark that early questions (Phase A) were asked
|
|
43
|
-
if (toolName === "AskUserQuestion") {
|
|
44
|
-
const sessionId = String(payload.session_id ?? "");
|
|
45
|
-
if (sessionId) {
|
|
46
|
-
markQuestionsAsked(sessionId, projectRoot, "early");
|
|
47
|
-
logInfo("add_plan_context", `Marked early questions asked for session ${sessionId.slice(0, 8)}...`);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
runHook(main, "mark_questions_asked");
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
/**
|
|
3
|
+
* Mark Questions Asked Hook
|
|
4
|
+
*
|
|
5
|
+
* Tracks when AskUserQuestion tool is used during a session.
|
|
6
|
+
* Used by other hooks to determine if user clarification was gathered.
|
|
7
|
+
*
|
|
8
|
+
* Registered for:
|
|
9
|
+
* - PostToolUse: AskUserQuestion — marks questions asked state for this session
|
|
10
|
+
*
|
|
11
|
+
* Fail-safe: Any error exits 0 (non-blocking).
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { getProjectRoot } from "../../_shared/lib-ts/base/constants.js";
|
|
15
|
+
import {
|
|
16
|
+
loadHookInput,
|
|
17
|
+
runHook,
|
|
18
|
+
logInfo,
|
|
19
|
+
logDiagnostic,
|
|
20
|
+
} from "../../_shared/lib-ts/base/hook-utils.js";
|
|
21
|
+
import { isInternalCall } from "../../_shared/lib-ts/base/subprocess-utils.js";
|
|
22
|
+
import { markQuestionsAsked } from "../lib-ts/cc-native-state.js";
|
|
23
|
+
|
|
24
|
+
function main(): void {
|
|
25
|
+
// Guard: skip for internal subprocess calls (prevents recursive hook execution)
|
|
26
|
+
if (isInternalCall()) return;
|
|
27
|
+
|
|
28
|
+
const payload = loadHookInput();
|
|
29
|
+
if (!payload) return;
|
|
30
|
+
|
|
31
|
+
const toolName = payload.tool_name;
|
|
32
|
+
const hookEvent = payload.hook_event_name ?? "unknown";
|
|
33
|
+
logDiagnostic(
|
|
34
|
+
"add_plan_context",
|
|
35
|
+
"receive",
|
|
36
|
+
`tool=${toolName}, event=${hookEvent}`,
|
|
37
|
+
{ inputs: { tool_name: toolName, hook_event: hookEvent } },
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
const projectRoot = getProjectRoot(payload.cwd);
|
|
41
|
+
|
|
42
|
+
// PostToolUse: AskUserQuestion — mark that early questions (Phase A) were asked
|
|
43
|
+
if (toolName === "AskUserQuestion") {
|
|
44
|
+
const sessionId = String(payload.session_id ?? "");
|
|
45
|
+
if (sessionId) {
|
|
46
|
+
markQuestionsAsked(sessionId, projectRoot, "early");
|
|
47
|
+
logInfo("add_plan_context", `Marked early questions asked for session ${sessionId.slice(0, 8)}...`);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
runHook(main, "mark_questions_asked");
|