@draht/coding-agent 2026.3.4 → 2026.3.5
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 +24 -0
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +4 -2
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/gsd/domain-validator.d.ts +18 -0
- package/dist/gsd/domain-validator.d.ts.map +1 -0
- package/dist/gsd/domain-validator.js +61 -0
- package/dist/gsd/domain-validator.js.map +1 -0
- package/dist/gsd/domain.d.ts +12 -0
- package/dist/gsd/domain.d.ts.map +1 -0
- package/dist/gsd/domain.js +113 -0
- package/dist/gsd/domain.js.map +1 -0
- package/dist/gsd/git.d.ts +20 -0
- package/dist/gsd/git.d.ts.map +1 -0
- package/dist/gsd/git.js +59 -0
- package/dist/gsd/git.js.map +1 -0
- package/dist/gsd/hook-utils.d.ts +22 -0
- package/dist/gsd/hook-utils.d.ts.map +1 -0
- package/dist/gsd/hook-utils.js +100 -0
- package/dist/gsd/hook-utils.js.map +1 -0
- package/dist/gsd/index.d.ts +9 -0
- package/dist/gsd/index.d.ts.map +1 -0
- package/dist/gsd/index.js +8 -0
- package/dist/gsd/index.js.map +1 -0
- package/dist/gsd/planning.d.ts +20 -0
- package/dist/gsd/planning.d.ts.map +1 -0
- package/dist/gsd/planning.js +167 -0
- package/dist/gsd/planning.js.map +1 -0
- package/dist/hooks/gsd/draht-post-task.js +44 -11
- package/dist/hooks/gsd/draht-quality-gate.js +99 -57
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +2 -2
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/prompts/agents/build.md +5 -1
- package/dist/prompts/agents/plan.md +5 -1
- package/dist/prompts/agents/verify.md +5 -1
- package/dist/prompts/commands/atomic-commit.md +8 -16
- package/dist/prompts/commands/discuss-phase.md +9 -3
- package/dist/prompts/commands/execute-phase.md +15 -8
- package/dist/prompts/commands/fix.md +6 -0
- package/dist/prompts/commands/init-project.md +9 -3
- package/dist/prompts/commands/map-codebase.md +7 -1
- package/dist/prompts/commands/new-project.md +8 -2
- package/dist/prompts/commands/next-milestone.md +4 -0
- package/dist/prompts/commands/pause-work.md +4 -0
- package/dist/prompts/commands/plan-phase.md +11 -5
- package/dist/prompts/commands/progress.md +4 -0
- package/dist/prompts/commands/quick.md +8 -2
- package/dist/prompts/commands/resume-work.md +4 -0
- package/dist/prompts/commands/review.md +6 -0
- package/dist/prompts/commands/verify-work.md +10 -4
- package/hooks/gsd/draht-post-task.js +44 -11
- package/hooks/gsd/draht-quality-gate.js +99 -57
- package/package.json +5 -5
- package/prompts/agents/build.md +5 -1
- package/prompts/agents/plan.md +5 -1
- package/prompts/agents/verify.md +5 -1
- package/prompts/commands/atomic-commit.md +8 -16
- package/prompts/commands/discuss-phase.md +9 -3
- package/prompts/commands/execute-phase.md +15 -8
- package/prompts/commands/fix.md +6 -0
- package/prompts/commands/init-project.md +9 -3
- package/prompts/commands/map-codebase.md +7 -1
- package/prompts/commands/new-project.md +8 -2
- package/prompts/commands/next-milestone.md +4 -0
- package/prompts/commands/pause-work.md +4 -0
- package/prompts/commands/plan-phase.md +11 -5
- package/prompts/commands/progress.md +4 -0
- package/prompts/commands/quick.md +8 -2
- package/prompts/commands/resume-work.md +4 -0
- package/prompts/commands/review.md +6 -0
- package/prompts/commands/verify-work.md +10 -4
|
@@ -12,13 +12,67 @@
|
|
|
12
12
|
|
|
13
13
|
const { execSync } = require("node:child_process");
|
|
14
14
|
const fs = require("node:fs");
|
|
15
|
+
const path = require("node:path");
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
// ── Toolchain detection — mirrors src/gsd/hook-utils.ts ──────────────────────
|
|
18
|
+
function detectToolchain(cwd) {
|
|
19
|
+
if (fs.existsSync(path.join(cwd, "bun.lockb")) || fs.existsSync(path.join(cwd, "bun.lock"))) {
|
|
20
|
+
return { pm: "bun", testCmd: "bun test", coverageCmd: "bun test --coverage", lintCmd: "bunx biome check ." };
|
|
21
|
+
}
|
|
22
|
+
if (fs.existsSync(path.join(cwd, "pnpm-lock.yaml"))) {
|
|
23
|
+
return { pm: "pnpm", testCmd: "pnpm test", coverageCmd: "pnpm run test:coverage", lintCmd: "pnpm run lint" };
|
|
24
|
+
}
|
|
25
|
+
if (fs.existsSync(path.join(cwd, "yarn.lock"))) {
|
|
26
|
+
return { pm: "yarn", testCmd: "yarn test", coverageCmd: "yarn run test:coverage", lintCmd: "yarn run lint" };
|
|
27
|
+
}
|
|
28
|
+
return { pm: "npm", testCmd: "npm test", coverageCmd: "npm run test:coverage", lintCmd: "npm run lint" };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function readHookConfig(cwd) {
|
|
32
|
+
const defaults = { coverageThreshold: 80, tddMode: "advisory", qualityGateStrict: false };
|
|
33
|
+
const configPath = path.join(cwd, ".planning", "config.json");
|
|
34
|
+
if (!fs.existsSync(configPath)) return defaults;
|
|
35
|
+
try {
|
|
36
|
+
const raw = JSON.parse(fs.readFileSync(configPath, "utf-8"));
|
|
37
|
+
const h = raw.hooks || {};
|
|
38
|
+
return {
|
|
39
|
+
coverageThreshold: typeof h.coverageThreshold === "number" ? h.coverageThreshold : defaults.coverageThreshold,
|
|
40
|
+
tddMode: h.tddMode === "strict" || h.tddMode === "advisory" ? h.tddMode : defaults.tddMode,
|
|
41
|
+
qualityGateStrict: typeof h.qualityGateStrict === "boolean" ? h.qualityGateStrict : defaults.qualityGateStrict,
|
|
42
|
+
};
|
|
43
|
+
} catch { return defaults; }
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Inline domain validator — mirrors src/gsd/domain-validator.ts
|
|
47
|
+
function extractGlossaryTerms(content) {
|
|
48
|
+
const terms = new Set();
|
|
49
|
+
const sectionMatch = content.match(/## Ubiquitous Language([\s\S]*?)(?:\n## |$)/);
|
|
50
|
+
const section = sectionMatch ? sectionMatch[1] : content;
|
|
51
|
+
for (const m of section.matchAll(/\*\*([A-Z][a-zA-Z0-9]+)\*\*/g)) terms.add(m[1]);
|
|
52
|
+
for (const m of section.matchAll(/^[-*]\s+([A-Z][a-zA-Z0-9]+)\s*:/gm)) terms.add(m[1]);
|
|
53
|
+
for (const m of section.matchAll(/\|\s*([A-Z][a-zA-Z0-9]+)\s*\|/g)) terms.add(m[1]);
|
|
54
|
+
return terms;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function loadDomainContent(cwd) {
|
|
58
|
+
const modelPath = path.join(cwd, ".planning", "DOMAIN-MODEL.md");
|
|
59
|
+
if (fs.existsSync(modelPath)) return fs.readFileSync(modelPath, "utf-8");
|
|
60
|
+
const domainPath = path.join(cwd, ".planning", "DOMAIN.md");
|
|
61
|
+
if (fs.existsSync(domainPath)) return fs.readFileSync(domainPath, "utf-8");
|
|
62
|
+
return "";
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// ── Main ──────────────────────────────────────────────────────────────────────
|
|
66
|
+
const cwd = process.cwd();
|
|
67
|
+
const toolchain = detectToolchain(cwd);
|
|
68
|
+
const hookConfig = readHookConfig(cwd);
|
|
69
|
+
const strict = process.argv.includes("--strict") || hookConfig.qualityGateStrict;
|
|
17
70
|
const issues = [];
|
|
18
71
|
|
|
19
72
|
// 1. TypeScript check
|
|
20
73
|
try {
|
|
21
|
-
|
|
74
|
+
const tsCmd = toolchain.pm === "bun" ? "bun run tsgo --noEmit 2>&1" : "npx tsc --noEmit 2>&1";
|
|
75
|
+
execSync(tsCmd, { timeout: 60000, encoding: "utf-8", cwd });
|
|
22
76
|
} catch (error) {
|
|
23
77
|
const output = error.stdout || error.stderr || "";
|
|
24
78
|
const errorCount = (output.match(/error TS/g) || []).length;
|
|
@@ -27,19 +81,19 @@ try {
|
|
|
27
81
|
}
|
|
28
82
|
}
|
|
29
83
|
|
|
30
|
-
// 2.
|
|
31
|
-
if (fs.existsSync("biome.json")) {
|
|
84
|
+
// 2. Lint check (if biome.json exists use biome, else use toolchain lint)
|
|
85
|
+
if (fs.existsSync(path.join(cwd, "biome.json"))) {
|
|
32
86
|
try {
|
|
33
|
-
execSync(
|
|
87
|
+
execSync(`${toolchain.lintCmd} --error-on-warnings 2>&1`, { timeout: 30000, encoding: "utf-8", cwd });
|
|
34
88
|
} catch (error) {
|
|
35
89
|
const output = error.stdout || error.stderr || "";
|
|
36
|
-
issues.push({ severity: strict ? "error" : "warning", message: "
|
|
90
|
+
issues.push({ severity: strict ? "error" : "warning", message: "Lint issues", details: output.slice(0, 500) });
|
|
37
91
|
}
|
|
38
92
|
}
|
|
39
93
|
|
|
40
94
|
// 3. Run tests
|
|
41
95
|
try {
|
|
42
|
-
const testOutput = execSync(
|
|
96
|
+
const testOutput = execSync(`${toolchain.testCmd} 2>&1`, { timeout: 120000, encoding: "utf-8", cwd });
|
|
43
97
|
const failMatch = testOutput.match(/(\d+) fail/);
|
|
44
98
|
if (failMatch && parseInt(failMatch[1], 10) > 0) {
|
|
45
99
|
issues.push({ severity: strict ? "error" : "warning", message: `${failMatch[1]} test(s) failing` });
|
|
@@ -56,71 +110,56 @@ try {
|
|
|
56
110
|
try {
|
|
57
111
|
const result = execSync(
|
|
58
112
|
"grep -rn 'console\\.log' src/ --include='*.ts' --include='*.tsx' 2>/dev/null | grep -v '// debug' | head -5",
|
|
59
|
-
{ encoding: "utf-8" }
|
|
113
|
+
{ encoding: "utf-8", cwd }
|
|
60
114
|
).trim();
|
|
61
115
|
if (result) {
|
|
62
|
-
issues.push({ severity: "warning", message:
|
|
116
|
+
issues.push({ severity: "warning", message: "console.log found in source", details: result });
|
|
63
117
|
}
|
|
64
|
-
} catch { /* grep returns 1 when no match — that's
|
|
118
|
+
} catch { /* grep returns 1 when no match — that's fine */ }
|
|
65
119
|
|
|
66
|
-
// 5. Domain glossary compliance
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if (fs.existsSync(domainMdPath)) {
|
|
120
|
+
// 5. Domain glossary compliance (checks DOMAIN-MODEL.md, falls back to DOMAIN.md)
|
|
121
|
+
const domainContent = loadDomainContent(cwd);
|
|
122
|
+
if (domainContent) {
|
|
70
123
|
try {
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
{
|
|
84
|
-
).trim().split("\n").filter((f) => f.endsWith(".ts") || f.endsWith(".tsx"));
|
|
85
|
-
|
|
86
|
-
const unknownTerms = [];
|
|
87
|
-
for (const file of changedFiles) {
|
|
88
|
-
if (!fs.existsSync(file)) continue;
|
|
89
|
-
const src = fs.readFileSync(file, "utf-8");
|
|
90
|
-
const declarations = [...src.matchAll(/(?:class|interface|type|enum)\s+([A-Z][a-zA-Z0-9]+)/g)].map((m) => m[1]);
|
|
91
|
-
for (const term of declarations) {
|
|
92
|
-
if (!glossaryTerms.has(term)) {
|
|
93
|
-
unknownTerms.push(`${file}: ${term}`);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
124
|
+
const glossaryTerms = extractGlossaryTerms(domainContent);
|
|
125
|
+
const changedFiles = execSync(
|
|
126
|
+
"git diff --cached --name-only 2>/dev/null || git diff --name-only HEAD~1",
|
|
127
|
+
{ encoding: "utf-8", cwd }
|
|
128
|
+
).trim().split("\n").filter((f) => f.endsWith(".ts") || f.endsWith(".tsx"));
|
|
129
|
+
|
|
130
|
+
const unknownTerms = [];
|
|
131
|
+
for (const file of changedFiles) {
|
|
132
|
+
if (!fs.existsSync(path.join(cwd, file))) continue;
|
|
133
|
+
const src = fs.readFileSync(path.join(cwd, file), "utf-8");
|
|
134
|
+
const declarations = [...src.matchAll(/(?:class|interface|type|enum)\s+([A-Z][a-zA-Z0-9]+)/g)].map((m) => m[1]);
|
|
135
|
+
for (const term of declarations) {
|
|
136
|
+
if (!glossaryTerms.has(term)) unknownTerms.push(`${file}: ${term}`);
|
|
96
137
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
} catch { /* ignore
|
|
138
|
+
}
|
|
139
|
+
if (unknownTerms.length > 0) {
|
|
140
|
+
issues.push({
|
|
141
|
+
severity: hookConfig.tddMode === "strict" ? "error" : "warning",
|
|
142
|
+
message: `${unknownTerms.length} PascalCase type(s) not in domain glossary (DOMAIN-MODEL.md)`,
|
|
143
|
+
details: unknownTerms.slice(0, 5).join(", "),
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
} catch { /* ignore */ }
|
|
106
147
|
}
|
|
107
148
|
|
|
108
149
|
// 6. Bounded context boundary check — flag suspicious cross-directory imports
|
|
109
150
|
try {
|
|
110
151
|
const changedSrcFiles = execSync(
|
|
111
152
|
"git diff --cached --name-only 2>/dev/null || git diff --name-only HEAD~1",
|
|
112
|
-
{ encoding: "utf-8" }
|
|
153
|
+
{ encoding: "utf-8", cwd }
|
|
113
154
|
).trim().split("\n").filter((f) => /^src\/[^/]+\//.test(f) && (f.endsWith(".ts") || f.endsWith(".tsx")));
|
|
114
155
|
|
|
115
156
|
const crossContextImports = [];
|
|
116
157
|
for (const file of changedSrcFiles) {
|
|
117
|
-
if (!fs.existsSync(file)) continue;
|
|
118
|
-
// Determine this file's context (first path segment under src/)
|
|
158
|
+
if (!fs.existsSync(path.join(cwd, file))) continue;
|
|
119
159
|
const ownContext = file.split("/")[1];
|
|
120
|
-
const src = fs.readFileSync(file, "utf-8");
|
|
160
|
+
const src = fs.readFileSync(path.join(cwd, file), "utf-8");
|
|
121
161
|
const imports = [...src.matchAll(/from\s+['"](\.\.\/.+?)['"]/g)].map((m) => m[1]);
|
|
122
162
|
for (const imp of imports) {
|
|
123
|
-
// Resolve relative import against the file's directory
|
|
124
163
|
const resolved = path.normalize(path.join(path.dirname(file), imp));
|
|
125
164
|
const parts = resolved.split(path.sep);
|
|
126
165
|
const srcIdx = parts.indexOf("src");
|
|
@@ -142,11 +181,11 @@ try {
|
|
|
142
181
|
try {
|
|
143
182
|
const allSrc = execSync(
|
|
144
183
|
"find src -name '*.ts' -not -name '*.test.ts' -not -name '*.spec.ts' 2>/dev/null | wc -l",
|
|
145
|
-
{ encoding: "utf-8" }
|
|
184
|
+
{ encoding: "utf-8", cwd }
|
|
146
185
|
).trim();
|
|
147
186
|
const allTests = execSync(
|
|
148
187
|
"find src -name '*.test.ts' -o -name '*.spec.ts' 2>/dev/null | wc -l",
|
|
149
|
-
{ encoding: "utf-8" }
|
|
188
|
+
{ encoding: "utf-8", cwd }
|
|
150
189
|
).trim();
|
|
151
190
|
const srcCount = parseInt(allSrc, 10) || 0;
|
|
152
191
|
const testCount = parseInt(allTests, 10) || 0;
|
|
@@ -163,12 +202,15 @@ try {
|
|
|
163
202
|
|
|
164
203
|
// 8. Check for TODO/FIXME/HACK comments in changed files
|
|
165
204
|
try {
|
|
166
|
-
const diff = execSync(
|
|
205
|
+
const diff = execSync(
|
|
206
|
+
"git diff --cached --name-only 2>/dev/null || git diff --name-only HEAD~1",
|
|
207
|
+
{ encoding: "utf-8", cwd }
|
|
208
|
+
).trim();
|
|
167
209
|
if (diff) {
|
|
168
210
|
const files = diff.split("\n").filter((f) => f.endsWith(".ts") || f.endsWith(".tsx"));
|
|
169
211
|
for (const file of files) {
|
|
170
212
|
try {
|
|
171
|
-
const content = fs.readFileSync(file, "utf-8");
|
|
213
|
+
const content = fs.readFileSync(path.join(cwd, file), "utf-8");
|
|
172
214
|
const todos = content.match(/\/\/\s*(TODO|FIXME|HACK|XXX):/gi) || [];
|
|
173
215
|
if (todos.length > 0) {
|
|
174
216
|
issues.push({ severity: "info", message: `${file}: ${todos.length} TODO/FIXME comment(s)` });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draht/coding-agent",
|
|
3
|
-
"version": "2026.3.
|
|
3
|
+
"version": "2026.3.5",
|
|
4
4
|
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"drahtConfig": {
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@mariozechner/jiti": "^2.6.2",
|
|
49
|
-
"@draht/agent-core": "2026.3.
|
|
50
|
-
"@draht/ai": "2026.3.
|
|
51
|
-
"@draht/tui": "2026.3.
|
|
49
|
+
"@draht/agent-core": "2026.3.5",
|
|
50
|
+
"@draht/ai": "2026.3.5",
|
|
51
|
+
"@draht/tui": "2026.3.5",
|
|
52
52
|
"@silvia-odwyer/photon-node": "^0.3.4",
|
|
53
53
|
"chalk": "^5.5.0",
|
|
54
54
|
"cli-highlight": "^2.1.11",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"tui",
|
|
93
93
|
"agent"
|
|
94
94
|
],
|
|
95
|
-
"author": "
|
|
95
|
+
"author": "Oskar Freye",
|
|
96
96
|
"license": "MIT",
|
|
97
97
|
"publishConfig": {
|
|
98
98
|
"access": "public"
|
package/prompts/agents/build.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Execution agent that implements plans precisely"
|
|
3
|
+
---
|
|
4
|
+
|
|
1
5
|
# Draht Build Agent
|
|
2
6
|
|
|
3
|
-
You are an execution agent
|
|
7
|
+
You are an execution agent. Your job is to implement plans precisely.
|
|
4
8
|
|
|
5
9
|
## Core Rules
|
|
6
10
|
1. Read the plan FIRST — it is your instruction set
|
package/prompts/agents/plan.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Planning agent that creates atomic, executable plans"
|
|
3
|
+
---
|
|
4
|
+
|
|
1
5
|
# Draht Plan Agent
|
|
2
6
|
|
|
3
|
-
You are a planning agent
|
|
7
|
+
You are a planning agent. Your job is to create atomic, executable plans.
|
|
4
8
|
|
|
5
9
|
## Core Rules
|
|
6
10
|
1. Plans are prompts — they tell the executor EXACTLY what to build
|
package/prompts/agents/verify.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Verification agent that tests work against acceptance criteria"
|
|
3
|
+
---
|
|
4
|
+
|
|
1
5
|
# Draht Verify Agent
|
|
2
6
|
|
|
3
|
-
You are a verification agent
|
|
7
|
+
You are a verification agent. Your job is to test completed work against acceptance criteria.
|
|
4
8
|
|
|
5
9
|
## Core Rules
|
|
6
10
|
1. Test from the USER's perspective, not the developer's
|
|
@@ -4,19 +4,13 @@ description: "Analyze changes and create atomic commits"
|
|
|
4
4
|
|
|
5
5
|
# Git Atomic Commit Analysis
|
|
6
6
|
|
|
7
|
-
First,
|
|
7
|
+
First, gather the current state:
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
1. Run `git status` to see what changed
|
|
10
|
+
2. Run `git diff` to see unstaged changes
|
|
11
|
+
3. Run `git diff --cached` to see staged changes
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
*! git diff*
|
|
14
|
-
|
|
15
|
-
And staged changes:
|
|
16
|
-
|
|
17
|
-
*! git diff --cached*
|
|
18
|
-
|
|
19
|
-
Based on the changes shown above, analyze and group them into logical, ATOMIC commits. Each commit should:
|
|
13
|
+
Based on the changes, analyze and group them into logical, ATOMIC commits. Each commit should:
|
|
20
14
|
|
|
21
15
|
1. Contain ONE logical change only
|
|
22
16
|
2. Be self-contained and complete
|
|
@@ -27,13 +21,11 @@ For each group of changes you identify:
|
|
|
27
21
|
- Generate a clear, descriptive commit message following conventional commits format
|
|
28
22
|
- Explain WHY these changes belong in one commit
|
|
29
23
|
|
|
30
|
-
Then
|
|
24
|
+
Then execute the `git add` and `git commit` commands for each atomic commit in the order they should be applied.
|
|
31
25
|
|
|
32
26
|
Format each commit message as:
|
|
27
|
+
```
|
|
33
28
|
type(scope): brief description
|
|
34
|
-
|
|
35
|
-
- Why the change was necessary
|
|
36
|
-
|
|
29
|
+
```
|
|
37
30
|
|
|
38
31
|
Common types: feat, fix, refactor, docs, test, chore, style, perf
|
|
39
|
-
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Capture implementation decisions before planning a phase"
|
|
3
|
+
---
|
|
4
|
+
|
|
1
5
|
# /discuss-phase
|
|
2
6
|
|
|
3
7
|
Capture implementation decisions before planning a phase.
|
|
@@ -7,13 +11,15 @@ Capture implementation decisions before planning a phase.
|
|
|
7
11
|
/discuss-phase [N]
|
|
8
12
|
```
|
|
9
13
|
|
|
14
|
+
Phase: $1
|
|
15
|
+
|
|
10
16
|
## Steps
|
|
11
|
-
1. Run `draht-tools phase-info
|
|
17
|
+
1. Run `draht-tools phase-info $1` to load phase context
|
|
12
18
|
2. Identify gray areas based on what's being built
|
|
13
19
|
3. Present 1-2 questions at a time about preferences
|
|
14
20
|
4. If `.planning/DOMAIN.md` exists, load it and validate discovered terms against the glossary. Add any new domain terms found during discussion.
|
|
15
|
-
5. Record decisions with `draht-tools save-context
|
|
16
|
-
6. Commit: `draht-tools commit-docs "capture phase
|
|
21
|
+
5. Record decisions with `draht-tools save-context $1`
|
|
22
|
+
6. Commit: `draht-tools commit-docs "capture phase $1 context"`
|
|
17
23
|
|
|
18
24
|
## Gray Area Categories
|
|
19
25
|
- **Visual features** → Layout, density, interactions, empty states
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Execute all plans in a phase with atomic commits"
|
|
3
|
+
---
|
|
4
|
+
|
|
1
5
|
# /execute-phase
|
|
2
6
|
|
|
3
7
|
Execute all plans in a phase with atomic commits.
|
|
@@ -7,37 +11,40 @@ Execute all plans in a phase with atomic commits.
|
|
|
7
11
|
/execute-phase [N] [--gaps-only]
|
|
8
12
|
```
|
|
9
13
|
|
|
14
|
+
Phase: $1
|
|
15
|
+
Arguments: $ARGUMENTS
|
|
16
|
+
|
|
10
17
|
## Steps
|
|
11
|
-
1. Run `draht-tools discover-plans
|
|
18
|
+
1. Run `draht-tools discover-plans $1` to find and order plans
|
|
12
19
|
2. For each plan in dependency order:
|
|
13
|
-
a. Load plan: `draht-tools read-plan
|
|
20
|
+
a. Load plan: `draht-tools read-plan $1 P`
|
|
14
21
|
b. Execute each task in strict TDD cycle:
|
|
15
22
|
|
|
16
23
|
**🔴 RED — Write failing tests first**
|
|
17
24
|
- Write the test cases from `<test>`
|
|
18
25
|
- Run tests — confirm they FAIL (if they pass, the test is wrong)
|
|
19
|
-
- Commit failing tests: `draht-tools commit-task
|
|
26
|
+
- Commit failing tests: `draht-tools commit-task $1 P T "red: test description"`
|
|
20
27
|
|
|
21
28
|
**🟢 GREEN — Minimal implementation**
|
|
22
29
|
- Write the minimum code from `<action>` to make tests pass
|
|
23
30
|
- Use domain language from `<context>` and `<domain>` for all names
|
|
24
31
|
- Run tests — confirm they PASS
|
|
25
|
-
- Commit: `draht-tools commit-task
|
|
32
|
+
- Commit: `draht-tools commit-task $1 P T "green: task name"`
|
|
26
33
|
|
|
27
34
|
**🔵 REFACTOR — Clean up with safety net**
|
|
28
35
|
- Apply improvements from `<refactor>` (if any)
|
|
29
36
|
- Run tests after each change — must stay green
|
|
30
37
|
- Verify domain language compliance (names match DOMAIN.md)
|
|
31
|
-
- Commit: `draht-tools commit-task
|
|
38
|
+
- Commit: `draht-tools commit-task $1 P T "refactor: description"`
|
|
32
39
|
|
|
33
40
|
**✅ VERIFY**
|
|
34
41
|
- Run the `<verify>` step
|
|
35
42
|
- Confirm `<done>` criteria met
|
|
36
43
|
|
|
37
|
-
c. Write summary: `draht-tools write-summary
|
|
38
|
-
3. Phase verification: `draht-tools verify-phase
|
|
44
|
+
c. Write summary: `draht-tools write-summary $1 P`
|
|
45
|
+
3. Phase verification: `draht-tools verify-phase $1`
|
|
39
46
|
4. Update state: `draht-tools update-state`
|
|
40
|
-
5. Final commit: `draht-tools commit-docs "complete phase
|
|
47
|
+
5. Final commit: `draht-tools commit-docs "complete phase $1 execution"`
|
|
41
48
|
|
|
42
49
|
## TDD Rules
|
|
43
50
|
- Never write implementation before a failing test exists
|
package/prompts/commands/fix.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Diagnose and fix a bug with TDD discipline"
|
|
3
|
+
---
|
|
4
|
+
|
|
1
5
|
# /fix
|
|
2
6
|
|
|
3
7
|
Diagnose and fix a specific bug or failing task with TDD discipline.
|
|
@@ -7,6 +11,8 @@ Diagnose and fix a specific bug or failing task with TDD discipline.
|
|
|
7
11
|
/fix [description of what's broken]
|
|
8
12
|
```
|
|
9
13
|
|
|
14
|
+
Issue: $ARGUMENTS
|
|
15
|
+
|
|
10
16
|
## Steps
|
|
11
17
|
1. **Diagnose**: Read the relevant code and error output to identify the root cause
|
|
12
18
|
- If a test is failing, run it first to see the actual error
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Initialize planning for an existing project"
|
|
3
|
+
---
|
|
4
|
+
|
|
1
5
|
# /init-project
|
|
2
6
|
|
|
3
|
-
Initialize
|
|
7
|
+
Initialize planning framework for an existing project: codebase mapping → questioning → domain model → requirements → roadmap.
|
|
4
8
|
|
|
5
9
|
## Usage
|
|
6
10
|
```
|
|
7
11
|
/init-project [focus area or goal]
|
|
8
12
|
```
|
|
9
13
|
|
|
10
|
-
|
|
14
|
+
Focus: $ARGUMENTS
|
|
15
|
+
|
|
16
|
+
Use this when you have an existing codebase and want to add structured planning.
|
|
11
17
|
For greenfield projects, use `/new-project` instead.
|
|
12
18
|
|
|
13
19
|
## Steps
|
|
@@ -37,7 +43,7 @@ For greenfield projects, use `/new-project` instead.
|
|
|
37
43
|
10. Run `draht-tools create-requirements` with v1/v2/out-of-scope (map requirements to bounded contexts)
|
|
38
44
|
11. Run `draht-tools create-roadmap` with phases
|
|
39
45
|
12. Run `draht-tools init-state`
|
|
40
|
-
13. Git commit via `draht-tools commit-docs "initialize
|
|
46
|
+
13. Git commit via `draht-tools commit-docs "initialize project planning"`
|
|
41
47
|
|
|
42
48
|
## Rules
|
|
43
49
|
- Ask 1-2 questions at a time, never dump 10 at once
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Analyze existing codebase before planning"
|
|
3
|
+
---
|
|
4
|
+
|
|
1
5
|
# /map-codebase
|
|
2
6
|
|
|
3
7
|
Analyze existing codebase before planning.
|
|
@@ -7,8 +11,10 @@ Analyze existing codebase before planning.
|
|
|
7
11
|
/map-codebase [directory]
|
|
8
12
|
```
|
|
9
13
|
|
|
14
|
+
Directory: $1
|
|
15
|
+
|
|
10
16
|
## Steps
|
|
11
|
-
1. Run `draht-tools map-codebase
|
|
17
|
+
1. Run `draht-tools map-codebase $1`
|
|
12
18
|
2. Tool generates: STACK.md, ARCHITECTURE.md, CONVENTIONS.md, CONCERNS.md
|
|
13
19
|
3. Review output, supplement with your own analysis if needed
|
|
14
20
|
4. Identify implicit bounded contexts from directory structure:
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Initialize a new project with structured planning"
|
|
3
|
+
---
|
|
4
|
+
|
|
1
5
|
# /new-project
|
|
2
6
|
|
|
3
|
-
Initialize a new
|
|
7
|
+
Initialize a new project: questioning → research → requirements → roadmap.
|
|
4
8
|
|
|
5
9
|
## Usage
|
|
6
10
|
```
|
|
7
11
|
/new-project [description]
|
|
8
12
|
```
|
|
9
13
|
|
|
14
|
+
Description: $ARGUMENTS
|
|
15
|
+
|
|
10
16
|
## Steps
|
|
11
17
|
1. Run `draht-tools init` to check preconditions
|
|
12
18
|
2. If existing code detected, run `draht-tools map-codebase` first
|
|
@@ -29,7 +35,7 @@ Initialize a new GSD project: questioning → research → requirements → road
|
|
|
29
35
|
9. Run `draht-tools create-requirements` with v1/v2/out-of-scope (map requirements to bounded contexts)
|
|
30
36
|
10. Run `draht-tools create-roadmap` with phases
|
|
31
37
|
11. Run `draht-tools init-state`
|
|
32
|
-
12. Git commit via `draht-tools commit-docs "initialize
|
|
38
|
+
12. Git commit via `draht-tools commit-docs "initialize project planning"`
|
|
33
39
|
|
|
34
40
|
## Rules
|
|
35
41
|
- Ask 1-2 questions at a time, never dump 10 at once
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Create atomic execution plans for a roadmap phase"
|
|
3
|
+
---
|
|
4
|
+
|
|
1
5
|
# /plan-phase
|
|
2
6
|
|
|
3
7
|
Create atomic execution plans for a roadmap phase.
|
|
@@ -7,18 +11,20 @@ Create atomic execution plans for a roadmap phase.
|
|
|
7
11
|
/plan-phase [N]
|
|
8
12
|
```
|
|
9
13
|
|
|
14
|
+
Phase: $1
|
|
15
|
+
|
|
10
16
|
## Steps
|
|
11
|
-
1. Run `draht-tools load-phase-context
|
|
12
|
-
2. Optional: `draht-tools research-phase
|
|
17
|
+
1. Run `draht-tools load-phase-context $1` to gather all context
|
|
18
|
+
2. Optional: `draht-tools research-phase $1` for domain research
|
|
13
19
|
3. Goal-backward planning:
|
|
14
20
|
a. State the goal (outcome, not activity)
|
|
15
21
|
b. Derive observable truths (3-7 from user perspective)
|
|
16
22
|
c. From each observable truth, derive the test scenarios that would prove it (specific inputs → expected outputs or state changes)
|
|
17
23
|
d. Map to required artifacts (files, endpoints, schemas)
|
|
18
24
|
e. Break into atomic tasks (2-5 per plan)
|
|
19
|
-
4. Write plans: `draht-tools create-plan
|
|
20
|
-
5. Validate: `draht-tools validate-plans
|
|
21
|
-
6. Commit: `draht-tools commit-docs "create phase
|
|
25
|
+
4. Write plans: `draht-tools create-plan $1 P`
|
|
26
|
+
5. Validate: `draht-tools validate-plans $1`
|
|
27
|
+
6. Commit: `draht-tools commit-docs "create phase $1 plans"`
|
|
22
28
|
|
|
23
29
|
## Plan Format
|
|
24
30
|
Plans use XML task format:
|
|
@@ -1,15 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Execute a small ad-hoc task with tracking"
|
|
3
|
+
---
|
|
4
|
+
|
|
1
5
|
# /quick
|
|
2
6
|
|
|
3
|
-
Execute a small ad-hoc task with
|
|
7
|
+
Execute a small ad-hoc task with tracking.
|
|
4
8
|
|
|
5
9
|
## Usage
|
|
6
10
|
```
|
|
7
11
|
/quick [description]
|
|
8
12
|
```
|
|
9
13
|
|
|
14
|
+
Task: $ARGUMENTS
|
|
15
|
+
|
|
10
16
|
## Steps
|
|
11
17
|
1. Run `draht-tools next-quick-number` to get task number
|
|
12
|
-
2. Create quick plan: `draht-tools create-quick-plan NNN "
|
|
18
|
+
2. Create quick plan: `draht-tools create-quick-plan NNN "$ARGUMENTS"`
|
|
13
19
|
3. Execute tasks following the TDD cycle:
|
|
14
20
|
- **🔴 RED** — Write a failing test that describes the desired behaviour
|
|
15
21
|
- **🟢 GREEN** — Write the minimum implementation to make it pass
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Code review and security audit of recent changes"
|
|
3
|
+
---
|
|
4
|
+
|
|
1
5
|
# /review
|
|
2
6
|
|
|
3
7
|
Ad-hoc code review and security audit of recent changes or a specific scope.
|
|
@@ -7,6 +11,8 @@ Ad-hoc code review and security audit of recent changes or a specific scope.
|
|
|
7
11
|
/review [scope]
|
|
8
12
|
```
|
|
9
13
|
|
|
14
|
+
Scope: $ARGUMENTS
|
|
15
|
+
|
|
10
16
|
If no scope given, reviews all recent uncommitted changes.
|
|
11
17
|
|
|
12
18
|
## Steps
|