sqlew 4.1.2 → 4.3.1
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/CHANGELOG.md +59 -0
- package/README.md +268 -409
- package/assets/claude-md-snippets/plan-mode-integration.md +36 -10
- package/assets/config.example.toml +120 -282
- package/assets/sample-skills/sqlew-decision-format/SKILL.md +73 -0
- package/dist/cli/hooks/check-completion.d.ts.map +1 -1
- package/dist/cli/hooks/check-completion.js +90 -2
- package/dist/cli/hooks/check-completion.js.map +1 -1
- package/dist/cli/hooks/init-hooks.d.ts.map +1 -1
- package/dist/cli/hooks/init-hooks.js +97 -5
- package/dist/cli/hooks/init-hooks.js.map +1 -1
- package/dist/cli/hooks/on-enter-plan.d.ts +22 -0
- package/dist/cli/hooks/on-enter-plan.d.ts.map +1 -0
- package/dist/cli/hooks/on-enter-plan.js +51 -0
- package/dist/cli/hooks/on-enter-plan.js.map +1 -0
- package/dist/cli/hooks/on-exit-plan.d.ts +20 -0
- package/dist/cli/hooks/on-exit-plan.d.ts.map +1 -0
- package/dist/cli/hooks/on-exit-plan.js +66 -0
- package/dist/cli/hooks/on-exit-plan.js.map +1 -0
- package/dist/cli/hooks/on-stop.d.ts +19 -0
- package/dist/cli/hooks/on-stop.d.ts.map +1 -0
- package/dist/cli/hooks/on-stop.js +152 -0
- package/dist/cli/hooks/on-stop.js.map +1 -0
- package/dist/cli/hooks/on-subagent-stop.d.ts +20 -0
- package/dist/cli/hooks/on-subagent-stop.d.ts.map +1 -0
- package/dist/cli/hooks/on-subagent-stop.js +94 -0
- package/dist/cli/hooks/on-subagent-stop.js.map +1 -0
- package/dist/cli/hooks/plan-pattern-extractor.d.ts +87 -0
- package/dist/cli/hooks/plan-pattern-extractor.d.ts.map +1 -0
- package/dist/cli/hooks/plan-pattern-extractor.js +218 -0
- package/dist/cli/hooks/plan-pattern-extractor.js.map +1 -0
- package/dist/cli/hooks/plan-processor.d.ts +43 -0
- package/dist/cli/hooks/plan-processor.d.ts.map +1 -0
- package/dist/cli/hooks/plan-processor.js +115 -0
- package/dist/cli/hooks/plan-processor.js.map +1 -0
- package/dist/cli/hooks/plan-toml-parser.d.ts +42 -0
- package/dist/cli/hooks/plan-toml-parser.d.ts.map +1 -0
- package/dist/cli/hooks/plan-toml-parser.js +178 -0
- package/dist/cli/hooks/plan-toml-parser.js.map +1 -0
- package/dist/cli/hooks/save.d.ts +7 -9
- package/dist/cli/hooks/save.d.ts.map +1 -1
- package/dist/cli/hooks/save.js +50 -25
- package/dist/cli/hooks/save.js.map +1 -1
- package/dist/cli/hooks/stdin-parser.d.ts +66 -2
- package/dist/cli/hooks/stdin-parser.d.ts.map +1 -1
- package/dist/cli/hooks/stdin-parser.js +57 -2
- package/dist/cli/hooks/stdin-parser.js.map +1 -1
- package/dist/cli/hooks/suggest.d.ts +8 -4
- package/dist/cli/hooks/suggest.d.ts.map +1 -1
- package/dist/cli/hooks/suggest.js +21 -123
- package/dist/cli/hooks/suggest.js.map +1 -1
- package/dist/cli/hooks/track-plan.d.ts +8 -1
- package/dist/cli/hooks/track-plan.d.ts.map +1 -1
- package/dist/cli/hooks/track-plan.js +64 -66
- package/dist/cli/hooks/track-plan.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +107 -6
- package/dist/cli.js.map +1 -1
- package/dist/config/global-config.d.ts +90 -0
- package/dist/config/global-config.d.ts.map +1 -1
- package/dist/config/global-config.js +86 -1
- package/dist/config/global-config.js.map +1 -1
- package/dist/database/initialization/init.js +3 -3
- package/dist/database/initialization/init.js.map +1 -1
- package/dist/database/migrations/v4/20260102204000_v4_fix_decision_set_example.d.ts +15 -0
- package/dist/database/migrations/v4/20260102204000_v4_fix_decision_set_example.d.ts.map +1 -0
- package/dist/database/migrations/v4/20260102204000_v4_fix_decision_set_example.js +74 -0
- package/dist/database/migrations/v4/20260102204000_v4_fix_decision_set_example.js.map +1 -0
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/dist/init-skills.d.ts +12 -3
- package/dist/init-skills.d.ts.map +1 -1
- package/dist/init-skills.js +96 -24
- package/dist/init-skills.js.map +1 -1
- package/dist/knexfile.d.ts.map +1 -1
- package/dist/knexfile.js +16 -12
- package/dist/knexfile.js.map +1 -1
- package/dist/server/setup.js +5 -5
- package/dist/server/setup.js.map +1 -1
- package/dist/server/tool-handlers.d.ts.map +1 -1
- package/dist/server/tool-handlers.js +7 -1
- package/dist/server/tool-handlers.js.map +1 -1
- package/dist/server/tool-registry.js +1 -1
- package/dist/server/tool-registry.js.map +1 -1
- package/dist/tests/feature/decision/truncate.test.d.ts +8 -0
- package/dist/tests/feature/decision/truncate.test.d.ts.map +1 -0
- package/dist/tests/feature/decision/truncate.test.js +192 -0
- package/dist/tests/feature/decision/truncate.test.js.map +1 -0
- package/dist/tests/unit/config/plan-toml-cache.test.d.ts +9 -0
- package/dist/tests/unit/config/plan-toml-cache.test.d.ts.map +1 -0
- package/dist/tests/unit/config/plan-toml-cache.test.js +230 -0
- package/dist/tests/unit/config/plan-toml-cache.test.js.map +1 -0
- package/dist/tests/unit/hooks/plan-toml-parser.test.d.ts +10 -0
- package/dist/tests/unit/hooks/plan-toml-parser.test.d.ts.map +1 -0
- package/dist/tests/unit/hooks/plan-toml-parser.test.js +316 -0
- package/dist/tests/unit/hooks/plan-toml-parser.test.js.map +1 -0
- package/dist/tools/constraints/actions/activate.d.ts +46 -0
- package/dist/tools/constraints/actions/activate.d.ts.map +1 -0
- package/dist/tools/constraints/actions/activate.js +105 -0
- package/dist/tools/constraints/actions/activate.js.map +1 -0
- package/dist/tools/constraints/actions/add.d.ts.map +1 -1
- package/dist/tools/constraints/actions/add.js +30 -13
- package/dist/tools/constraints/actions/add.js.map +1 -1
- package/dist/tools/constraints/actions/deactivate.d.ts.map +1 -1
- package/dist/tools/constraints/actions/deactivate.js +7 -4
- package/dist/tools/constraints/actions/deactivate.js.map +1 -1
- package/dist/tools/constraints/actions/get.d.ts.map +1 -1
- package/dist/tools/constraints/actions/get.js +10 -7
- package/dist/tools/constraints/actions/get.js.map +1 -1
- package/dist/tools/constraints/actions/suggest-pending.d.ts +41 -0
- package/dist/tools/constraints/actions/suggest-pending.d.ts.map +1 -0
- package/dist/tools/constraints/actions/suggest-pending.js +71 -0
- package/dist/tools/constraints/actions/suggest-pending.js.map +1 -0
- package/dist/tools/constraints/help/example.d.ts.map +1 -1
- package/dist/tools/constraints/help/example.js +65 -1
- package/dist/tools/constraints/help/example.js.map +1 -1
- package/dist/tools/constraints/help/help.d.ts.map +1 -1
- package/dist/tools/constraints/help/help.js +10 -5
- package/dist/tools/constraints/help/help.js.map +1 -1
- package/dist/tools/constraints/index.d.ts +2 -0
- package/dist/tools/constraints/index.d.ts.map +1 -1
- package/dist/tools/constraints/index.js +2 -0
- package/dist/tools/constraints/index.js.map +1 -1
- package/dist/tools/context/actions/add-context.d.ts.map +1 -1
- package/dist/tools/context/actions/add-context.js +13 -6
- package/dist/tools/context/actions/add-context.js.map +1 -1
- package/dist/tools/context/actions/has-updates.d.ts.map +1 -1
- package/dist/tools/context/actions/has-updates.js +0 -4
- package/dist/tools/context/actions/has-updates.js.map +1 -1
- package/dist/tools/context/actions/list-contexts.d.ts.map +1 -1
- package/dist/tools/context/actions/list-contexts.js +12 -7
- package/dist/tools/context/actions/list-contexts.js.map +1 -1
- package/dist/tools/context/actions/list.d.ts.map +1 -1
- package/dist/tools/context/actions/list.js +8 -0
- package/dist/tools/context/actions/list.js.map +1 -1
- package/dist/tools/context/actions/search-advanced.d.ts.map +1 -1
- package/dist/tools/context/actions/search-advanced.js +41 -27
- package/dist/tools/context/actions/search-advanced.js.map +1 -1
- package/dist/tools/context/actions/search-layer.d.ts.map +1 -1
- package/dist/tools/context/actions/search-layer.js +8 -0
- package/dist/tools/context/actions/search-layer.js.map +1 -1
- package/dist/tools/context/actions/search-tags.d.ts.map +1 -1
- package/dist/tools/context/actions/search-tags.js +8 -0
- package/dist/tools/context/actions/search-tags.js.map +1 -1
- package/dist/tools/files/actions/check-lock.d.ts.map +1 -1
- package/dist/tools/files/actions/check-lock.js +9 -3
- package/dist/tools/files/actions/check-lock.js.map +1 -1
- package/dist/tools/files/actions/get.d.ts.map +1 -1
- package/dist/tools/files/actions/get.js +18 -13
- package/dist/tools/files/actions/get.js.map +1 -1
- package/dist/tools/files/actions/record-batch.d.ts.map +1 -1
- package/dist/tools/files/actions/record-batch.js +11 -6
- package/dist/tools/files/actions/record-batch.js.map +1 -1
- package/dist/tools/files/actions/record.d.ts.map +1 -1
- package/dist/tools/files/actions/record.js +8 -2
- package/dist/tools/files/actions/record.js.map +1 -1
- package/dist/tools/files/help/example.d.ts.map +1 -1
- package/dist/tools/files/help/example.js +11 -0
- package/dist/tools/files/help/example.js.map +1 -1
- package/dist/tools/files/help/help.d.ts.map +1 -1
- package/dist/tools/files/help/help.js +11 -0
- package/dist/tools/files/help/help.js.map +1 -1
- package/dist/tools/suggest/actions/by-context.d.ts.map +1 -1
- package/dist/tools/suggest/actions/by-context.js +5 -15
- package/dist/tools/suggest/actions/by-context.js.map +1 -1
- package/dist/tools/suggest/actions/by-key.d.ts.map +1 -1
- package/dist/tools/suggest/actions/by-key.js +5 -15
- package/dist/tools/suggest/actions/by-key.js.map +1 -1
- package/dist/tools/suggest/actions/by-tags.d.ts.map +1 -1
- package/dist/tools/suggest/actions/by-tags.js +5 -15
- package/dist/tools/suggest/actions/by-tags.js.map +1 -1
- package/dist/tools/suggest/actions/constraint-by-context.d.ts +1 -1
- package/dist/tools/suggest/actions/constraint-by-context.d.ts.map +1 -1
- package/dist/tools/suggest/actions/constraint-by-context.js +9 -16
- package/dist/tools/suggest/actions/constraint-by-context.js.map +1 -1
- package/dist/tools/suggest/actions/constraint-by-tags.d.ts +1 -1
- package/dist/tools/suggest/actions/constraint-by-tags.d.ts.map +1 -1
- package/dist/tools/suggest/actions/constraint-by-tags.js +11 -17
- package/dist/tools/suggest/actions/constraint-by-tags.js.map +1 -1
- package/dist/tools/suggest/actions/constraint-by-text.d.ts +1 -1
- package/dist/tools/suggest/actions/constraint-by-text.d.ts.map +1 -1
- package/dist/tools/suggest/actions/constraint-by-text.js +6 -15
- package/dist/tools/suggest/actions/constraint-by-text.js.map +1 -1
- package/dist/types/actions.d.ts +1 -1
- package/dist/types/actions.d.ts.map +1 -1
- package/dist/types.d.ts +9 -230
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/action-specs/constraint-specs.d.ts +1 -1
- package/dist/utils/action-specs/constraint-specs.d.ts.map +1 -1
- package/dist/utils/action-specs/constraint-specs.js +22 -5
- package/dist/utils/action-specs/constraint-specs.js.map +1 -1
- package/dist/utils/action-specs/decision-specs.d.ts.map +1 -1
- package/dist/utils/action-specs/decision-specs.js +11 -10
- package/dist/utils/action-specs/decision-specs.js.map +1 -1
- package/dist/utils/action-specs/file-specs.js +4 -4
- package/dist/utils/action-specs/file-specs.js.map +1 -1
- package/dist/utils/hook-queue.d.ts +43 -3
- package/dist/utils/hook-queue.d.ts.map +1 -1
- package/dist/utils/hook-queue.js +326 -32
- package/dist/utils/hook-queue.js.map +1 -1
- package/dist/utils/param-normalizer.d.ts +52 -0
- package/dist/utils/param-normalizer.d.ts.map +1 -0
- package/dist/utils/param-normalizer.js +70 -0
- package/dist/utils/param-normalizer.js.map +1 -0
- package/dist/utils/parameter-validator.d.ts.map +1 -1
- package/dist/utils/parameter-validator.js +2 -0
- package/dist/utils/parameter-validator.js.map +1 -1
- package/dist/utils/suggest-helpers.d.ts +82 -0
- package/dist/utils/suggest-helpers.d.ts.map +1 -0
- package/dist/utils/suggest-helpers.js +93 -0
- package/dist/utils/suggest-helpers.js.map +1 -0
- package/dist/utils/text-truncate.d.ts +13 -0
- package/dist/utils/text-truncate.d.ts.map +1 -0
- package/dist/utils/text-truncate.js +18 -0
- package/dist/utils/text-truncate.js.map +1 -0
- package/dist/utils/validators.d.ts +1 -1
- package/dist/utils/validators.d.ts.map +1 -1
- package/dist/utils/validators.js +1 -1
- package/dist/utils/validators.js.map +1 -1
- package/dist/watcher/base-watcher.d.ts.map +1 -1
- package/dist/watcher/base-watcher.js +4 -3
- package/dist/watcher/base-watcher.js.map +1 -1
- package/dist/watcher/file-watcher.d.ts.map +1 -1
- package/dist/watcher/file-watcher.js +5 -1
- package/dist/watcher/file-watcher.js.map +1 -1
- package/dist/watcher/queue-watcher.d.ts +12 -1
- package/dist/watcher/queue-watcher.d.ts.map +1 -1
- package/dist/watcher/queue-watcher.js +92 -12
- package/dist/watcher/queue-watcher.js.map +1 -1
- package/docs/ADR_CONCEPTS.md +4 -0
- package/docs/HOOKS_GUIDE.md +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plan TOML Parser
|
|
3
|
+
*
|
|
4
|
+
* Parses ```toml blocks from plan markdown files to extract
|
|
5
|
+
* [[decision]] and [[constraint]] entries.
|
|
6
|
+
*
|
|
7
|
+
* Uses smol-toml (already a project dependency) for parsing.
|
|
8
|
+
*
|
|
9
|
+
* @since v4.2.0
|
|
10
|
+
*/
|
|
11
|
+
import { parse as parseToml } from 'smol-toml';
|
|
12
|
+
// ============================================================================
|
|
13
|
+
// TOML Block Extraction
|
|
14
|
+
// ============================================================================
|
|
15
|
+
/**
|
|
16
|
+
* Extract all ```toml blocks from markdown content
|
|
17
|
+
*
|
|
18
|
+
* @param content - Full markdown content
|
|
19
|
+
* @returns Array of TOML block contents (without fences)
|
|
20
|
+
*/
|
|
21
|
+
export function extractTomlBlocks(content) {
|
|
22
|
+
const blocks = [];
|
|
23
|
+
// Match ```toml ... ``` blocks (case-insensitive for 'toml')
|
|
24
|
+
// Use non-greedy matching to handle multiple blocks
|
|
25
|
+
const regex = /```toml\s*\n([\s\S]*?)```/gi;
|
|
26
|
+
let match;
|
|
27
|
+
while ((match = regex.exec(content)) !== null) {
|
|
28
|
+
if (match[1]) {
|
|
29
|
+
blocks.push(match[1].trim());
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return blocks;
|
|
33
|
+
}
|
|
34
|
+
// ============================================================================
|
|
35
|
+
// Decision Parsing
|
|
36
|
+
// ============================================================================
|
|
37
|
+
/**
|
|
38
|
+
* Parse and validate a decision entry
|
|
39
|
+
*
|
|
40
|
+
* @param raw - Raw decision object from TOML
|
|
41
|
+
* @returns Validated DecisionCandidate or null if invalid
|
|
42
|
+
*/
|
|
43
|
+
function parseDecision(raw) {
|
|
44
|
+
if (typeof raw !== 'object' || raw === null) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const obj = raw;
|
|
48
|
+
// Required fields
|
|
49
|
+
if (typeof obj.key !== 'string' || typeof obj.value !== 'string') {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
const decision = {
|
|
53
|
+
key: obj.key,
|
|
54
|
+
value: obj.value,
|
|
55
|
+
};
|
|
56
|
+
// Optional fields
|
|
57
|
+
if (typeof obj.status === 'string') {
|
|
58
|
+
decision.status = obj.status;
|
|
59
|
+
}
|
|
60
|
+
if (typeof obj.layer === 'string') {
|
|
61
|
+
decision.layer = obj.layer;
|
|
62
|
+
}
|
|
63
|
+
if (Array.isArray(obj.tags)) {
|
|
64
|
+
decision.tags = obj.tags.filter((t) => typeof t === 'string');
|
|
65
|
+
}
|
|
66
|
+
if (typeof obj.rationale === 'string') {
|
|
67
|
+
decision.rationale = obj.rationale;
|
|
68
|
+
}
|
|
69
|
+
if (Array.isArray(obj.alternatives)) {
|
|
70
|
+
decision.alternatives = obj.alternatives.filter((a) => typeof a === 'string');
|
|
71
|
+
}
|
|
72
|
+
if (typeof obj.tradeoffs === 'string') {
|
|
73
|
+
decision.tradeoffs = obj.tradeoffs;
|
|
74
|
+
}
|
|
75
|
+
return decision;
|
|
76
|
+
}
|
|
77
|
+
// ============================================================================
|
|
78
|
+
// Constraint Parsing
|
|
79
|
+
// ============================================================================
|
|
80
|
+
/**
|
|
81
|
+
* Parse and validate a constraint entry
|
|
82
|
+
*
|
|
83
|
+
* @param raw - Raw constraint object from TOML
|
|
84
|
+
* @returns Validated ConstraintCandidate or null if invalid
|
|
85
|
+
*/
|
|
86
|
+
function parseConstraint(raw) {
|
|
87
|
+
if (typeof raw !== 'object' || raw === null) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
const obj = raw;
|
|
91
|
+
// Required fields
|
|
92
|
+
if (typeof obj.text !== 'string' || typeof obj.category !== 'string') {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
const constraint = {
|
|
96
|
+
text: obj.text,
|
|
97
|
+
category: obj.category,
|
|
98
|
+
};
|
|
99
|
+
// Optional fields
|
|
100
|
+
if (typeof obj.priority === 'string') {
|
|
101
|
+
constraint.priority = obj.priority;
|
|
102
|
+
}
|
|
103
|
+
if (typeof obj.layer === 'string') {
|
|
104
|
+
constraint.layer = obj.layer;
|
|
105
|
+
}
|
|
106
|
+
if (Array.isArray(obj.tags)) {
|
|
107
|
+
constraint.tags = obj.tags.filter((t) => typeof t === 'string');
|
|
108
|
+
}
|
|
109
|
+
if (typeof obj.rationale === 'string') {
|
|
110
|
+
constraint.rationale = obj.rationale;
|
|
111
|
+
}
|
|
112
|
+
return constraint;
|
|
113
|
+
}
|
|
114
|
+
// ============================================================================
|
|
115
|
+
// Main Parser
|
|
116
|
+
// ============================================================================
|
|
117
|
+
/**
|
|
118
|
+
* Parse a single TOML block and extract decisions/constraints
|
|
119
|
+
*
|
|
120
|
+
* @param tomlContent - TOML content (without fences)
|
|
121
|
+
* @returns Parsed decisions and constraints
|
|
122
|
+
*/
|
|
123
|
+
export function parseTomlBlock(tomlContent) {
|
|
124
|
+
const result = {
|
|
125
|
+
decisions: [],
|
|
126
|
+
constraints: [],
|
|
127
|
+
};
|
|
128
|
+
try {
|
|
129
|
+
const parsed = parseToml(tomlContent);
|
|
130
|
+
// Parse [[decision]] entries
|
|
131
|
+
if (Array.isArray(parsed.decision)) {
|
|
132
|
+
for (const raw of parsed.decision) {
|
|
133
|
+
const decision = parseDecision(raw);
|
|
134
|
+
if (decision) {
|
|
135
|
+
result.decisions.push(decision);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
// Parse [[constraint]] entries
|
|
140
|
+
if (Array.isArray(parsed.constraint)) {
|
|
141
|
+
for (const raw of parsed.constraint) {
|
|
142
|
+
const constraint = parseConstraint(raw);
|
|
143
|
+
if (constraint) {
|
|
144
|
+
result.constraints.push(constraint);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
// TOML parse error - return empty result
|
|
151
|
+
// Errors are expected for non-TOML content or malformed blocks
|
|
152
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
153
|
+
console.error(`[plan-toml-parser] TOML parse error: ${message}`);
|
|
154
|
+
}
|
|
155
|
+
return result;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Parse plan content and extract all decisions/constraints from TOML blocks
|
|
159
|
+
*
|
|
160
|
+
* @param content - Full markdown content of plan file
|
|
161
|
+
* @returns Merged decisions and constraints from all TOML blocks
|
|
162
|
+
*/
|
|
163
|
+
export function parsePlanToml(content) {
|
|
164
|
+
const result = {
|
|
165
|
+
decisions: [],
|
|
166
|
+
constraints: [],
|
|
167
|
+
};
|
|
168
|
+
// Extract all ```toml blocks
|
|
169
|
+
const blocks = extractTomlBlocks(content);
|
|
170
|
+
// Parse each block and merge results
|
|
171
|
+
for (const block of blocks) {
|
|
172
|
+
const parsed = parseTomlBlock(block);
|
|
173
|
+
result.decisions.push(...parsed.decisions);
|
|
174
|
+
result.constraints.push(...parsed.constraints);
|
|
175
|
+
}
|
|
176
|
+
return result;
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=plan-toml-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-toml-parser.js","sourceRoot":"","sources":["../../../src/cli/hooks/plan-toml-parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;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,CAAC,WAAW,CAAC,CAAC;IACjD,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/cli/hooks/save.d.ts
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Save Hook Command
|
|
3
3
|
*
|
|
4
|
-
* PostToolUse hook for
|
|
5
|
-
* When
|
|
6
|
-
*
|
|
4
|
+
* PostToolUse hook for Edit|Write - promotes decisions/constraints when implementation starts.
|
|
5
|
+
* When non-markdown files are modified, promotes draft decisions to in_progress
|
|
6
|
+
* and activates inactive constraints.
|
|
7
7
|
*
|
|
8
8
|
* Usage:
|
|
9
|
-
* echo '{"tool_name": "
|
|
9
|
+
* echo '{"tool_name": "Write", "tool_input": {"file_path": "src/foo.ts"}}' | sqlew save
|
|
10
10
|
*
|
|
11
11
|
* @since v4.1.0
|
|
12
|
-
* @updated v4.1
|
|
13
|
-
* @updated v4.1.0 - File queue architecture (no DB operations in hooks)
|
|
12
|
+
* @updated v4.2.1 - Changed to detect implementation files (NOT *.md) and promote decisions/constraints
|
|
14
13
|
*/
|
|
15
14
|
/**
|
|
16
15
|
* Main save command entry point
|
|
17
16
|
*
|
|
18
|
-
* Called as PostToolUse hook when
|
|
19
|
-
*
|
|
20
|
-
* No DB operations - fast execution (<100ms).
|
|
17
|
+
* Called as PostToolUse hook when Edit|Write completes.
|
|
18
|
+
* When implementation files are modified, promotes decisions and activates constraints.
|
|
21
19
|
*/
|
|
22
20
|
export declare function saveCommand(): Promise<void>;
|
|
23
21
|
//# sourceMappingURL=save.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"save.d.ts","sourceRoot":"","sources":["../../../src/cli/hooks/save.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"save.d.ts","sourceRoot":"","sources":["../../../src/cli/hooks/save.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA4CH;;;;;GAKG;AACH,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAsEjD"}
|
package/dist/cli/hooks/save.js
CHANGED
|
@@ -1,43 +1,63 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Save Hook Command
|
|
3
3
|
*
|
|
4
|
-
* PostToolUse hook for
|
|
5
|
-
* When
|
|
6
|
-
*
|
|
4
|
+
* PostToolUse hook for Edit|Write - promotes decisions/constraints when implementation starts.
|
|
5
|
+
* When non-markdown files are modified, promotes draft decisions to in_progress
|
|
6
|
+
* and activates inactive constraints.
|
|
7
7
|
*
|
|
8
8
|
* Usage:
|
|
9
|
-
* echo '{"tool_name": "
|
|
9
|
+
* echo '{"tool_name": "Write", "tool_input": {"file_path": "src/foo.ts"}}' | sqlew save
|
|
10
10
|
*
|
|
11
11
|
* @since v4.1.0
|
|
12
|
-
* @updated v4.1
|
|
13
|
-
* @updated v4.1.0 - File queue architecture (no DB operations in hooks)
|
|
12
|
+
* @updated v4.2.1 - Changed to detect implementation files (NOT *.md) and promote decisions/constraints
|
|
14
13
|
*/
|
|
15
14
|
import { readStdinJson, sendContinue, getProjectPath } from './stdin-parser.js';
|
|
16
15
|
import { loadCurrentPlan, saveCurrentPlan } from '../../config/global-config.js';
|
|
17
|
-
import { enqueueDecisionUpdate } from '../../utils/hook-queue.js';
|
|
16
|
+
import { enqueueDecisionUpdate, enqueueConstraintActivate } from '../../utils/hook-queue.js';
|
|
18
17
|
// ============================================================================
|
|
19
18
|
// Constants
|
|
20
19
|
// ============================================================================
|
|
21
|
-
/** Decision key prefix for plan-based decisions */
|
|
22
|
-
const PLAN_DECISION_PREFIX = 'plan/implementation';
|
|
23
20
|
/** Status for in-progress decisions */
|
|
24
21
|
const IN_PROGRESS_STATUS = 'in_progress';
|
|
25
22
|
// ============================================================================
|
|
23
|
+
// Helpers
|
|
24
|
+
// ============================================================================
|
|
25
|
+
/**
|
|
26
|
+
* Check if a file path is an implementation file (not a markdown or plan file)
|
|
27
|
+
*/
|
|
28
|
+
function isImplementationFile(filePath) {
|
|
29
|
+
if (!filePath)
|
|
30
|
+
return false;
|
|
31
|
+
const normalized = filePath.replace(/\\/g, '/').toLowerCase();
|
|
32
|
+
// Exclude markdown files
|
|
33
|
+
if (normalized.endsWith('.md'))
|
|
34
|
+
return false;
|
|
35
|
+
// Exclude plan files explicitly
|
|
36
|
+
if (normalized.includes('.claude/plans/'))
|
|
37
|
+
return false;
|
|
38
|
+
// Exclude documentation directories
|
|
39
|
+
if (normalized.includes('/docs/'))
|
|
40
|
+
return false;
|
|
41
|
+
// Exclude config files that aren't really implementation
|
|
42
|
+
if (normalized.endsWith('.json') && !normalized.includes('/src/'))
|
|
43
|
+
return false;
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
// ============================================================================
|
|
26
47
|
// Main Entry Point
|
|
27
48
|
// ============================================================================
|
|
28
49
|
/**
|
|
29
50
|
* Main save command entry point
|
|
30
51
|
*
|
|
31
|
-
* Called as PostToolUse hook when
|
|
32
|
-
*
|
|
33
|
-
* No DB operations - fast execution (<100ms).
|
|
52
|
+
* Called as PostToolUse hook when Edit|Write completes.
|
|
53
|
+
* When implementation files are modified, promotes decisions and activates constraints.
|
|
34
54
|
*/
|
|
35
55
|
export async function saveCommand() {
|
|
36
56
|
try {
|
|
37
57
|
const input = await readStdinJson();
|
|
38
|
-
// Only process
|
|
58
|
+
// Only process Edit and Write tools
|
|
39
59
|
const toolName = input.tool_name;
|
|
40
|
-
if (toolName !== '
|
|
60
|
+
if (toolName !== 'Edit' && toolName !== 'Write') {
|
|
41
61
|
sendContinue();
|
|
42
62
|
return;
|
|
43
63
|
}
|
|
@@ -46,6 +66,13 @@ export async function saveCommand() {
|
|
|
46
66
|
sendContinue();
|
|
47
67
|
return;
|
|
48
68
|
}
|
|
69
|
+
// Get file path from tool input
|
|
70
|
+
const filePath = input.tool_input?.file_path;
|
|
71
|
+
// Only process implementation files
|
|
72
|
+
if (!isImplementationFile(filePath)) {
|
|
73
|
+
sendContinue();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
49
76
|
// Check if there's a current plan being tracked
|
|
50
77
|
const planInfo = loadCurrentPlan(projectPath);
|
|
51
78
|
if (!planInfo) {
|
|
@@ -59,18 +86,16 @@ export async function saveCommand() {
|
|
|
59
86
|
sendContinue();
|
|
60
87
|
return;
|
|
61
88
|
}
|
|
62
|
-
//
|
|
63
|
-
|
|
64
|
-
const decisionKey = `${PLAN_DECISION_PREFIX}/${planName}`;
|
|
65
|
-
// Enqueue status update (no DB operations here)
|
|
89
|
+
// Enqueue decision status update: draft → in_progress
|
|
90
|
+
// This will update all decisions with the plan_id tag
|
|
66
91
|
enqueueDecisionUpdate(projectPath, {
|
|
67
|
-
key:
|
|
68
|
-
value: `Implementation in progress for plan: ${planInfo.plan_file}`,
|
|
92
|
+
key: `plan/${planInfo.plan_file.replace(/\.md$/, '')}`,
|
|
69
93
|
status: IN_PROGRESS_STATUS,
|
|
70
|
-
|
|
71
|
-
tags: ['plan', 'implementation', 'active', planInfo.plan_id.slice(0, 8)],
|
|
94
|
+
tags: ['plan', planInfo.plan_id.slice(0, 8)],
|
|
72
95
|
});
|
|
73
|
-
//
|
|
96
|
+
// Enqueue constraint activation: active=0 → active=1
|
|
97
|
+
enqueueConstraintActivate(projectPath, planInfo.plan_id);
|
|
98
|
+
// Mark plan as recorded (implementation started)
|
|
74
99
|
const updatedInfo = {
|
|
75
100
|
...planInfo,
|
|
76
101
|
recorded: true,
|
|
@@ -78,10 +103,10 @@ export async function saveCommand() {
|
|
|
78
103
|
plan_updated_at: new Date().toISOString(),
|
|
79
104
|
};
|
|
80
105
|
saveCurrentPlan(projectPath, updatedInfo);
|
|
81
|
-
sendContinue(`[sqlew]
|
|
106
|
+
sendContinue(`[sqlew] Implementation started for plan: ${planInfo.plan_file} | ` +
|
|
107
|
+
`Queued: decisions → in_progress, constraints → active`);
|
|
82
108
|
}
|
|
83
109
|
catch (error) {
|
|
84
|
-
// On error, log to stderr but continue execution
|
|
85
110
|
const message = error instanceof Error ? error.message : String(error);
|
|
86
111
|
console.error(`[sqlew save] Error: ${message}`);
|
|
87
112
|
sendContinue();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"save.js","sourceRoot":"","sources":["../../../src/cli/hooks/save.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"save.js","sourceRoot":"","sources":["../../../src/cli/hooks/save.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,eAAe,EAAwB,MAAM,+BAA+B,CAAC;AACvG,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAE7F,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E,uCAAuC;AACvC,MAAM,kBAAkB,GAAG,aAAsB,CAAC;AAElD,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E;;GAEG;AACH,SAAS,oBAAoB,CAAC,QAA4B;IACxD,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IAE5B,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;IAE9D,yBAAyB;IACzB,IAAI,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAE7C,gCAAgC;IAChC,IAAI,UAAU,CAAC,QAAQ,CAAC,gBAAgB,CAAC;QAAE,OAAO,KAAK,CAAC;IAExD,oCAAoC;IACpC,IAAI,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAAE,OAAO,KAAK,CAAC;IAEhD,yDAAyD;IACzD,IAAI,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,KAAK,CAAC;IA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C,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SAC7C,CAAC,CAAC;QAEH,qDAAqD;QACrD,yBAAyB,CAAC,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;QAEzD,iDAAiD;QACjD,MAAM,WAAW,GAAoB;YACnC,GAAG,QAAQ;YACX,QAAQ,EAAE,IAAI;YACd,gBAAgB,EAAE,KAAK;YACvB,eAAe,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SAC1C,CAAC;QACF,eAAe,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;QAE1C,YAAY,CACV,4CAA4C,QAAQ,CAAC,SAAS,KAAK;YACnE,uDAAuD,CACxD,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,OAAO,CAAC,KAAK,CAAC,uBAAuB,OAAO,EAAE,CAAC,CAAC;QAChD,YAAY,EAAE,CAAC;IACjB,CAAC;AACH,CAAC"}
|
|
@@ -58,7 +58,7 @@ export interface HookInput {
|
|
|
58
58
|
/** Current working directory */
|
|
59
59
|
cwd?: string;
|
|
60
60
|
/** Hook event name */
|
|
61
|
-
hook_event_name?: 'PreToolUse' | 'PostToolUse' | 'SessionStart' | 'SessionEnd' | 'Stop' | 'SubagentStop';
|
|
61
|
+
hook_event_name?: 'PreToolUse' | 'PostToolUse' | 'SessionStart' | 'SessionEnd' | 'Stop' | 'SubagentStop' | 'Notification' | 'PreCompact' | 'UserPromptSubmit';
|
|
62
62
|
/** Tool name being called */
|
|
63
63
|
tool_name?: string;
|
|
64
64
|
/** Tool input parameters */
|
|
@@ -69,6 +69,32 @@ export interface HookInput {
|
|
|
69
69
|
transcript_path?: string;
|
|
70
70
|
/** Permission mode */
|
|
71
71
|
permission_mode?: string;
|
|
72
|
+
/** Stop hook active flag (for Stop/SubagentStop - prevents infinite loops) */
|
|
73
|
+
stop_hook_active?: boolean;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Hook-specific output for PreToolUse (v4.2.0+)
|
|
77
|
+
* Used for permission decisions and input modification
|
|
78
|
+
*/
|
|
79
|
+
export interface PreToolUseHookOutput {
|
|
80
|
+
/** Hook event name */
|
|
81
|
+
hookEventName: 'PreToolUse';
|
|
82
|
+
/** Permission decision */
|
|
83
|
+
permissionDecision?: 'allow' | 'deny' | 'ask';
|
|
84
|
+
/** Reason for the decision */
|
|
85
|
+
permissionDecisionReason?: string;
|
|
86
|
+
/** Updated tool input - modifies the tool's input before execution */
|
|
87
|
+
updatedInput?: ToolInput;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Hook-specific output for PostToolUse (v4.2.0+)
|
|
91
|
+
* Used for injecting context after tool execution
|
|
92
|
+
*/
|
|
93
|
+
export interface PostToolUseHookOutput {
|
|
94
|
+
/** Hook event name */
|
|
95
|
+
hookEventName: 'PostToolUse';
|
|
96
|
+
/** Additional context to inject into Claude's context */
|
|
97
|
+
additionalContext?: string;
|
|
72
98
|
}
|
|
73
99
|
/**
|
|
74
100
|
* Hook output to Claude Code
|
|
@@ -78,12 +104,16 @@ export interface HookOutput {
|
|
|
78
104
|
continue?: boolean;
|
|
79
105
|
/** Reason for stopping (if continue=false) */
|
|
80
106
|
stopReason?: string;
|
|
81
|
-
/** Additional context to inject */
|
|
107
|
+
/** Additional context to inject (PostToolUse, UserPromptSubmit, SessionStart only) */
|
|
82
108
|
additionalContext?: string;
|
|
83
109
|
/** System message to add */
|
|
84
110
|
systemMessage?: string;
|
|
85
111
|
/** Whether to suppress output */
|
|
86
112
|
suppressOutput?: boolean;
|
|
113
|
+
/** Hook-specific output (PreToolUse, PostToolUse) - v4.2.0+ */
|
|
114
|
+
hookSpecificOutput?: PreToolUseHookOutput | PostToolUseHookOutput;
|
|
115
|
+
/** @deprecated Use hookSpecificOutput.updatedInput instead */
|
|
116
|
+
updatedInput?: ToolInput;
|
|
87
117
|
}
|
|
88
118
|
/**
|
|
89
119
|
* Read and parse JSON from stdin
|
|
@@ -108,15 +138,42 @@ export declare function writeHookOutput(output: HookOutput): void;
|
|
|
108
138
|
* @param systemMessage - Optional system message
|
|
109
139
|
*/
|
|
110
140
|
export declare function sendContinue(additionalContext?: string, systemMessage?: string): void;
|
|
141
|
+
/**
|
|
142
|
+
* Send a continue response with context for PostToolUse
|
|
143
|
+
*
|
|
144
|
+
* Uses hookSpecificOutput format which is required for PostToolUse hooks
|
|
145
|
+
* to properly inject context into Claude's conversation.
|
|
146
|
+
*
|
|
147
|
+
* @param additionalContext - Context to inject after tool execution
|
|
148
|
+
*/
|
|
149
|
+
export declare function sendPostToolUseContext(additionalContext: string): void;
|
|
111
150
|
/**
|
|
112
151
|
* Send a block response (exit code 2)
|
|
113
152
|
*
|
|
114
153
|
* @param reason - Reason for blocking
|
|
115
154
|
*/
|
|
116
155
|
export declare function sendBlock(reason: string): void;
|
|
156
|
+
/**
|
|
157
|
+
* Send an updatedInput response (PreToolUse only)
|
|
158
|
+
*
|
|
159
|
+
* Modifies the tool's input before execution.
|
|
160
|
+
* Use this to inject context into Task tool prompts.
|
|
161
|
+
*
|
|
162
|
+
* NOTE: Uses root-level updatedInput format (not hookSpecificOutput) because
|
|
163
|
+
* that's what Claude Code actually processes. Verified in debug logs from
|
|
164
|
+
* 2025-12-26 where TOML template injection worked correctly.
|
|
165
|
+
*
|
|
166
|
+
* @param originalInput - Original tool input
|
|
167
|
+
* @param modifications - Fields to modify/add
|
|
168
|
+
*/
|
|
169
|
+
export declare function sendUpdatedInput(originalInput: ToolInput, modifications: Partial<ToolInput>): void;
|
|
117
170
|
/**
|
|
118
171
|
* Check if the hook input is for a plan file
|
|
119
172
|
*
|
|
173
|
+
* Plan files can be in:
|
|
174
|
+
* - Global: ~/.claude/plans/*.md (e.g., C:/Users/xxx/.claude/plans/my-plan.md)
|
|
175
|
+
* - Project: .claude/plans/*.md (relative path)
|
|
176
|
+
*
|
|
120
177
|
* @param input - Hook input
|
|
121
178
|
* @returns true if the tool is operating on a plan file
|
|
122
179
|
*/
|
|
@@ -136,4 +193,11 @@ export declare function areAllTodosCompleted(input: HookInput): boolean;
|
|
|
136
193
|
* @returns Project path or undefined
|
|
137
194
|
*/
|
|
138
195
|
export declare function getProjectPath(input: HookInput): string | undefined;
|
|
196
|
+
/**
|
|
197
|
+
* Check if the hook input is for a Plan agent
|
|
198
|
+
*
|
|
199
|
+
* @param input - Hook input
|
|
200
|
+
* @returns true if subagent_type is 'Plan'
|
|
201
|
+
*/
|
|
202
|
+
export declare function isPlanAgent(input: HookInput): boolean;
|
|
139
203
|
//# sourceMappingURL=stdin-parser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdin-parser.d.ts","sourceRoot":"","sources":["../../../src/cli/hooks/stdin-parser.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0BAA0B;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yBAAyB;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gCAAgC;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,6BAA6B;IAC7B,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB,8BAA8B;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,mBAAmB;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,mDAAmD;IACnD,MAAM,EAAE,SAAS,GAAG,aAAa,GAAG,WAAW,CAAC;IAChD,8BAA8B;IAC9B,UAAU,EAAE,MAAM,C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AMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAEnE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAErD"}
|
|
@@ -74,6 +74,24 @@ export function sendContinue(additionalContext, systemMessage) {
|
|
|
74
74
|
}
|
|
75
75
|
writeHookOutput(output);
|
|
76
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Send a continue response with context for PostToolUse
|
|
79
|
+
*
|
|
80
|
+
* Uses hookSpecificOutput format which is required for PostToolUse hooks
|
|
81
|
+
* to properly inject context into Claude's conversation.
|
|
82
|
+
*
|
|
83
|
+
* @param additionalContext - Context to inject after tool execution
|
|
84
|
+
*/
|
|
85
|
+
export function sendPostToolUseContext(additionalContext) {
|
|
86
|
+
const output = {
|
|
87
|
+
continue: true,
|
|
88
|
+
hookSpecificOutput: {
|
|
89
|
+
hookEventName: 'PostToolUse',
|
|
90
|
+
additionalContext,
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
writeHookOutput(output);
|
|
94
|
+
}
|
|
77
95
|
/**
|
|
78
96
|
* Send a block response (exit code 2)
|
|
79
97
|
*
|
|
@@ -83,12 +101,37 @@ export function sendBlock(reason) {
|
|
|
83
101
|
console.error(reason);
|
|
84
102
|
process.exit(2);
|
|
85
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Send an updatedInput response (PreToolUse only)
|
|
106
|
+
*
|
|
107
|
+
* Modifies the tool's input before execution.
|
|
108
|
+
* Use this to inject context into Task tool prompts.
|
|
109
|
+
*
|
|
110
|
+
* NOTE: Uses root-level updatedInput format (not hookSpecificOutput) because
|
|
111
|
+
* that's what Claude Code actually processes. Verified in debug logs from
|
|
112
|
+
* 2025-12-26 where TOML template injection worked correctly.
|
|
113
|
+
*
|
|
114
|
+
* @param originalInput - Original tool input
|
|
115
|
+
* @param modifications - Fields to modify/add
|
|
116
|
+
*/
|
|
117
|
+
export function sendUpdatedInput(originalInput, modifications) {
|
|
118
|
+
const updatedInput = { ...originalInput, ...modifications };
|
|
119
|
+
const output = {
|
|
120
|
+
continue: true,
|
|
121
|
+
updatedInput,
|
|
122
|
+
};
|
|
123
|
+
writeHookOutput(output);
|
|
124
|
+
}
|
|
86
125
|
// ============================================================================
|
|
87
126
|
// Helpers
|
|
88
127
|
// ============================================================================
|
|
89
128
|
/**
|
|
90
129
|
* Check if the hook input is for a plan file
|
|
91
130
|
*
|
|
131
|
+
* Plan files can be in:
|
|
132
|
+
* - Global: ~/.claude/plans/*.md (e.g., C:/Users/xxx/.claude/plans/my-plan.md)
|
|
133
|
+
* - Project: .claude/plans/*.md (relative path)
|
|
134
|
+
*
|
|
92
135
|
* @param input - Hook input
|
|
93
136
|
* @returns true if the tool is operating on a plan file
|
|
94
137
|
*/
|
|
@@ -97,9 +140,12 @@ export function isPlanFile(input) {
|
|
|
97
140
|
if (!filePath) {
|
|
98
141
|
return false;
|
|
99
142
|
}
|
|
100
|
-
//
|
|
143
|
+
// Normalize path separators for cross-platform support
|
|
101
144
|
const normalizedPath = filePath.replace(/\\/g, '/');
|
|
102
|
-
|
|
145
|
+
// Match both global and project-local plan paths:
|
|
146
|
+
// - Global: /Users/xxx/.claude/plans/foo.md, C:/Users/xxx/.claude/plans/foo.md
|
|
147
|
+
// - Project: .claude/plans/foo.md
|
|
148
|
+
return /[/\\]?\.claude\/plans\/[^/]+\.md$/.test(normalizedPath);
|
|
103
149
|
}
|
|
104
150
|
/**
|
|
105
151
|
* Check if all todos are completed
|
|
@@ -124,4 +170,13 @@ export function areAllTodosCompleted(input) {
|
|
|
124
170
|
export function getProjectPath(input) {
|
|
125
171
|
return input.cwd || process.env.CLAUDE_PROJECT_DIR;
|
|
126
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* Check if the hook input is for a Plan agent
|
|
175
|
+
*
|
|
176
|
+
* @param input - Hook input
|
|
177
|
+
* @returns true if subagent_type is 'Plan'
|
|
178
|
+
*/
|
|
179
|
+
export function isPlanAgent(input) {
|
|
180
|
+
return input.tool_input?.subagent_type === 'Plan';
|
|
181
|
+
}
|
|
127
182
|
//# sourceMappingURL=stdin-parser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdin-parser.js","sourceRoot":"","sources":["../../../src/cli/hooks/stdin-parser.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"stdin-parser.js","sourceRoot":"","sources":["../../../src/cli/hooks/stdin-parser.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA0HH,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,IAAI,IAAI,GAAG,EAAE,CAAC;QAEd,8BAA8B;QAC9B,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAElC,2BAA2B;QAC3B,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE;YACzC,IAAI,IAAI,KAAK,CAAC;QAChB,CAAC,CAAC,CAAC;QAEH,0BAA0B;QAC1B,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;YAC3B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;gBACjB,oCAAoC;gBACpC,OAAO,CAAC,EAAE,CAAC,CAAC;gBACZ,OAAO;YACT,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAc,CAAC;gBAC7C,OAAO,CAAC,MAAM,CAAC,CAAC;YAClB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,CAAC,IAAI,KAAK,CAAC,uBAAuB,KAAK,YAAY,KAAK,C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C,KAAgB;IAC7C,OAAO,KAAK,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;AACrD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,KAAgB;IAC1C,OAAO,KAAK,CAAC,UAAU,EAAE,aAAa,KAAK,MAAM,CAAC;AACpD,CAAC"}
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Suggest Hook Command
|
|
3
3
|
*
|
|
4
|
-
* PreToolUse hook for Task tool -
|
|
5
|
-
*
|
|
4
|
+
* PreToolUse hook for Task tool - manages Plan agent sessions.
|
|
5
|
+
* Clears stale caches when a new Plan agent starts.
|
|
6
|
+
*
|
|
7
|
+
* NOTE: Template injection removed in v4.2.2 - didn't work reliably.
|
|
8
|
+
* Using Skills-based template injection instead.
|
|
6
9
|
*
|
|
7
10
|
* Usage:
|
|
8
|
-
* echo '{"tool_input": {"
|
|
11
|
+
* echo '{"tool_input": {"subagent_type": "Plan"}}' | sqlew suggest
|
|
9
12
|
*
|
|
10
13
|
* @since v4.1.0
|
|
14
|
+
* @modified v4.2.2 - Removed template injection, simplified to cache management
|
|
11
15
|
*/
|
|
12
16
|
/**
|
|
13
17
|
* Main suggest command entry point
|
|
14
18
|
*
|
|
15
19
|
* Called as PreToolUse hook when Task tool is invoked.
|
|
16
|
-
*
|
|
20
|
+
* For Plan agents: clears stale caches from previous sessions.
|
|
17
21
|
*/
|
|
18
22
|
export declare function suggestCommand(): Promise<void>;
|
|
19
23
|
//# sourceMappingURL=suggest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggest.d.ts","sourceRoot":"","sources":["../../../src/cli/hooks/suggest.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"suggest.d.ts","sourceRoot":"","sources":["../../../src/cli/hooks/suggest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AASH;;;;;GAKG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CA6BpD"}
|