@draht/coding-agent 2026.3.4 → 2026.3.6
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 +36 -0
- package/agents/architect.md +1 -0
- package/agents/debugger.md +1 -0
- package/agents/git-committer.md +1 -0
- package/agents/implementer.md +1 -0
- package/agents/reviewer.md +1 -0
- package/agents/security-auditor.md +1 -0
- package/agents/verifier.md +1 -0
- package/dist/agents/architect.md +1 -0
- package/dist/agents/debugger.md +1 -0
- package/dist/agents/git-committer.md +1 -0
- package/dist/agents/implementer.md +1 -0
- package/dist/agents/reviewer.md +1 -0
- package/dist/agents/security-auditor.md +1 -0
- package/dist/agents/verifier.md +1 -0
- package/dist/config.d.ts +7 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +15 -0
- package/dist/config.js.map +1 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +7 -7
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +8 -6
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +9 -8
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +2 -2
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +3 -3
- package/dist/core/skills.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/migrations.d.ts.map +1 -1
- package/dist/migrations.js +2 -2
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +3 -3
- package/dist/modes/interactive/components/config-selector.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 +19 -3
- package/dist/prompts/commands/execute-phase.md +59 -35
- package/dist/prompts/commands/fix.md +14 -6
- package/dist/prompts/commands/init-project.md +21 -3
- package/dist/prompts/commands/map-codebase.md +24 -19
- package/dist/prompts/commands/new-project.md +20 -2
- package/dist/prompts/commands/next-milestone.md +8 -2
- package/dist/prompts/commands/pause-work.md +4 -0
- package/dist/prompts/commands/plan-phase.md +35 -7
- package/dist/prompts/commands/progress.md +4 -0
- package/dist/prompts/commands/quick.md +20 -7
- package/dist/prompts/commands/resume-work.md +4 -0
- package/dist/prompts/commands/review.md +16 -10
- package/dist/prompts/commands/verify-work.md +37 -17
- 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 +19 -3
- package/prompts/commands/execute-phase.md +59 -35
- package/prompts/commands/fix.md +14 -6
- package/prompts/commands/init-project.md +21 -3
- package/prompts/commands/map-codebase.md +24 -19
- package/prompts/commands/new-project.md +20 -2
- package/prompts/commands/next-milestone.md +8 -2
- package/prompts/commands/pause-work.md +4 -0
- package/prompts/commands/plan-phase.md +35 -7
- package/prompts/commands/progress.md +4 -0
- package/prompts/commands/quick.md +20 -7
- package/prompts/commands/resume-work.md +4 -0
- package/prompts/commands/review.md +16 -10
- package/prompts/commands/verify-work.md +37 -17
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// GSD Planning module — phase/plan/task file system operations.
|
|
2
|
+
// Part of the draht GSD (Get Shit Done) methodology.
|
|
3
|
+
import * as fs from "node:fs";
|
|
4
|
+
import * as path from "node:path";
|
|
5
|
+
const PLANNING = ".planning";
|
|
6
|
+
function planningPath(cwd, ...segments) {
|
|
7
|
+
return path.join(cwd, PLANNING, ...segments);
|
|
8
|
+
}
|
|
9
|
+
function ensureDir(dir) {
|
|
10
|
+
if (!fs.existsSync(dir))
|
|
11
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
12
|
+
}
|
|
13
|
+
function padNum(n, digits = 2) {
|
|
14
|
+
return String(n).padStart(digits, "0");
|
|
15
|
+
}
|
|
16
|
+
function timestamp() {
|
|
17
|
+
return new Date().toISOString().replace("T", " ").slice(0, 19);
|
|
18
|
+
}
|
|
19
|
+
function getPhaseSlug(cwd, phaseNum) {
|
|
20
|
+
const roadmapPath = planningPath(cwd, "ROADMAP.md");
|
|
21
|
+
if (!fs.existsSync(roadmapPath))
|
|
22
|
+
return `phase-${phaseNum}`;
|
|
23
|
+
const content = fs.readFileSync(roadmapPath, "utf-8");
|
|
24
|
+
const re = new RegExp(`## Phase ${phaseNum}: (.+?) —`);
|
|
25
|
+
const m = re.exec(content);
|
|
26
|
+
if (!m)
|
|
27
|
+
return `phase-${phaseNum}`;
|
|
28
|
+
return m[1]
|
|
29
|
+
.toLowerCase()
|
|
30
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
31
|
+
.replace(/^-|-$/g, "")
|
|
32
|
+
.slice(0, 40);
|
|
33
|
+
}
|
|
34
|
+
function getPhaseDir(cwd, phaseNum) {
|
|
35
|
+
const phasesDir = planningPath(cwd, "phases");
|
|
36
|
+
if (!fs.existsSync(phasesDir))
|
|
37
|
+
return null;
|
|
38
|
+
const prefix = `${padNum(phaseNum)}-`;
|
|
39
|
+
const entry = fs.readdirSync(phasesDir).find((e) => e.startsWith(prefix));
|
|
40
|
+
return entry ? path.join(phasesDir, entry) : null;
|
|
41
|
+
}
|
|
42
|
+
export function createPlan(cwd, phaseNum, planNum, title) {
|
|
43
|
+
const slug = getPhaseSlug(cwd, phaseNum);
|
|
44
|
+
const dir = planningPath(cwd, "phases", `${padNum(phaseNum)}-${slug}`);
|
|
45
|
+
ensureDir(dir);
|
|
46
|
+
const planTitle = title || `Plan ${planNum}`;
|
|
47
|
+
const planFile = path.join(dir, `${padNum(phaseNum)}-${padNum(planNum)}-PLAN.md`);
|
|
48
|
+
const tmpl = `---
|
|
49
|
+
phase: ${phaseNum}
|
|
50
|
+
plan: ${planNum}
|
|
51
|
+
depends_on: []
|
|
52
|
+
must_haves:
|
|
53
|
+
- "[Observable truth this plan delivers]"
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
# Phase ${phaseNum}, Plan ${planNum}: ${planTitle}
|
|
57
|
+
|
|
58
|
+
## Goal
|
|
59
|
+
[What this plan achieves from user perspective]
|
|
60
|
+
|
|
61
|
+
## Context
|
|
62
|
+
[Key decisions that affect this plan]
|
|
63
|
+
|
|
64
|
+
## Tasks
|
|
65
|
+
|
|
66
|
+
<task type="auto">
|
|
67
|
+
<n>[Task name]</n>
|
|
68
|
+
<files>[affected files]</files>
|
|
69
|
+
<test>[Write tests first — what should pass when done]</test>
|
|
70
|
+
<action>
|
|
71
|
+
[Implementation to make tests pass]
|
|
72
|
+
</action>
|
|
73
|
+
<refactor>[Optional cleanup after green]</refactor>
|
|
74
|
+
<verify>[How to verify]</verify>
|
|
75
|
+
<done>[What "done" looks like]</done>
|
|
76
|
+
</task>
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
Created: ${timestamp()}
|
|
80
|
+
`;
|
|
81
|
+
fs.writeFileSync(planFile, tmpl, "utf-8");
|
|
82
|
+
return planFile;
|
|
83
|
+
}
|
|
84
|
+
export function discoverPlans(cwd, phaseNum) {
|
|
85
|
+
const phaseDir = getPhaseDir(cwd, phaseNum);
|
|
86
|
+
if (!phaseDir)
|
|
87
|
+
throw new Error(`Phase ${phaseNum} directory not found`);
|
|
88
|
+
const files = fs.readdirSync(phaseDir).sort();
|
|
89
|
+
const plans = files.filter((f) => f.endsWith("-PLAN.md") && !f.includes("FIX"));
|
|
90
|
+
const summaries = files.filter((f) => f.endsWith("-SUMMARY.md"));
|
|
91
|
+
const fixPlans = files.filter((f) => f.includes("FIX-PLAN.md"));
|
|
92
|
+
const completedPlanNums = new Set(summaries.map((s) => s.match(/\d+-(\d+)-SUMMARY/)?.[1]).filter((x) => Boolean(x)));
|
|
93
|
+
const incomplete = plans.filter((p) => {
|
|
94
|
+
const m = p.match(/\d+-(\d+)-PLAN/);
|
|
95
|
+
return m ? !completedPlanNums.has(m[1]) : true;
|
|
96
|
+
});
|
|
97
|
+
const planData = plans.map((p) => {
|
|
98
|
+
const content = fs.readFileSync(path.join(phaseDir, p), "utf-8");
|
|
99
|
+
const depsMatch = content.match(/depends_on:\s*\[(.*?)\]/);
|
|
100
|
+
const deps = depsMatch
|
|
101
|
+
? depsMatch[1]
|
|
102
|
+
.split(",")
|
|
103
|
+
.map((d) => d.trim())
|
|
104
|
+
.filter(Boolean)
|
|
105
|
+
: [];
|
|
106
|
+
return { file: p, deps };
|
|
107
|
+
});
|
|
108
|
+
return { plans: planData, incomplete, fixPlans };
|
|
109
|
+
}
|
|
110
|
+
export function readPlan(cwd, phaseNum, planNum) {
|
|
111
|
+
const phaseDir = getPhaseDir(cwd, phaseNum);
|
|
112
|
+
if (!phaseDir)
|
|
113
|
+
throw new Error(`Phase ${phaseNum} not found`);
|
|
114
|
+
const planFile = path.join(phaseDir, `${padNum(phaseNum)}-${padNum(planNum)}-PLAN.md`);
|
|
115
|
+
if (!fs.existsSync(planFile))
|
|
116
|
+
throw new Error(`Plan file not found: ${planFile}`);
|
|
117
|
+
return fs.readFileSync(planFile, "utf-8");
|
|
118
|
+
}
|
|
119
|
+
export function writeSummary(cwd, phaseNum, planNum) {
|
|
120
|
+
const phaseDir = getPhaseDir(cwd, phaseNum);
|
|
121
|
+
if (!phaseDir)
|
|
122
|
+
throw new Error(`Phase ${phaseNum} not found`);
|
|
123
|
+
const summaryPath = path.join(phaseDir, `${padNum(phaseNum)}-${padNum(planNum)}-SUMMARY.md`);
|
|
124
|
+
const tmpl = `# Phase ${phaseNum}, Plan ${planNum} Summary
|
|
125
|
+
|
|
126
|
+
## Completed Tasks
|
|
127
|
+
| # | Task | Status | Commit |
|
|
128
|
+
|---|------|--------|--------|
|
|
129
|
+
| 1 | [task] | ✅ Done | [hash] |
|
|
130
|
+
|
|
131
|
+
## Files Changed
|
|
132
|
+
- [files]
|
|
133
|
+
|
|
134
|
+
## Verification Results
|
|
135
|
+
- [results]
|
|
136
|
+
|
|
137
|
+
## Notes
|
|
138
|
+
[deviations, decisions]
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
Completed: ${timestamp()}
|
|
142
|
+
`;
|
|
143
|
+
fs.writeFileSync(summaryPath, tmpl, "utf-8");
|
|
144
|
+
return summaryPath;
|
|
145
|
+
}
|
|
146
|
+
export function verifyPhase(cwd, phaseNum) {
|
|
147
|
+
const phaseDir = getPhaseDir(cwd, phaseNum);
|
|
148
|
+
if (!phaseDir)
|
|
149
|
+
throw new Error(`Phase ${phaseNum} not found`);
|
|
150
|
+
const plans = fs.readdirSync(phaseDir).filter((f) => f.endsWith("-PLAN.md") && !f.includes("FIX"));
|
|
151
|
+
const summaries = fs.readdirSync(phaseDir).filter((f) => f.endsWith("-SUMMARY.md"));
|
|
152
|
+
const complete = summaries.length >= plans.length && plans.length > 0;
|
|
153
|
+
if (complete) {
|
|
154
|
+
const verPath = path.join(phaseDir, `${padNum(phaseNum)}-VERIFICATION.md`);
|
|
155
|
+
fs.writeFileSync(verPath, `# Phase ${phaseNum} Verification\n\nAll ${plans.length} plans executed.\nVerified: ${timestamp()}\n`, "utf-8");
|
|
156
|
+
}
|
|
157
|
+
return { plans: plans.length, summaries: summaries.length, complete };
|
|
158
|
+
}
|
|
159
|
+
export function updateState(cwd) {
|
|
160
|
+
const statePath = planningPath(cwd, "STATE.md");
|
|
161
|
+
if (!fs.existsSync(statePath))
|
|
162
|
+
throw new Error("No STATE.md found");
|
|
163
|
+
let state = fs.readFileSync(statePath, "utf-8");
|
|
164
|
+
state = state.replace(/## Last Activity:.*/, `## Last Activity: ${timestamp()}`);
|
|
165
|
+
fs.writeFileSync(statePath, state, "utf-8");
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=planning.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planning.js","sourceRoot":"","sources":["../../src/gsd/planning.ts"],"names":[],"mappings":"AAAA,kEAAgE;AAChE,qDAAqD;AAErD,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,MAAM,QAAQ,GAAG,WAAW,CAAC;AAE7B,SAAS,YAAY,CA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(Get Shit Done) methodology.\n\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n\nconst PLANNING = \".planning\";\n\nfunction planningPath(cwd: string, ...segments: string[]): string {\n\treturn path.join(cwd, PLANNING, ...segments);\n}\n\nfunction ensureDir(dir: string): void {\n\tif (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });\n}\n\nfunction padNum(n: number, digits = 2): string {\n\treturn String(n).padStart(digits, \"0\");\n}\n\nfunction timestamp(): string {\n\treturn new Date().toISOString().replace(\"T\", \" \").slice(0, 19);\n}\n\nfunction getPhaseSlug(cwd: string, phaseNum: number): string {\n\tconst roadmapPath = planningPath(cwd, \"ROADMAP.md\");\n\tif (!fs.existsSync(roadmapPath)) return `phase-${phaseNum}`;\n\tconst content = fs.readFileSync(roadmapPath, \"utf-8\");\n\tconst re = new RegExp(`## Phase ${phaseNum}: (.+?) —`);\n\tconst m = re.exec(content);\n\tif (!m) return `phase-${phaseNum}`;\n\treturn m[1]\n\t\t.toLowerCase()\n\t\t.replace(/[^a-z0-9]+/g, \"-\")\n\t\t.replace(/^-|-$/g, \"\")\n\t\t.slice(0, 40);\n}\n\nfunction getPhaseDir(cwd: string, phaseNum: number): string | null {\n\tconst phasesDir = planningPath(cwd, \"phases\");\n\tif (!fs.existsSync(phasesDir)) return null;\n\tconst prefix = `${padNum(phaseNum)}-`;\n\tconst entry = fs.readdirSync(phasesDir).find((e) => e.startsWith(prefix));\n\treturn entry ? path.join(phasesDir, entry) : null;\n}\n\nexport interface PlanDiscovery {\n\tplans: Array<{ file: string; deps: string[] }>;\n\tincomplete: string[];\n\tfixPlans: string[];\n}\n\nexport interface PhaseVerification {\n\tplans: number;\n\tsummaries: number;\n\tcomplete: boolean;\n}\n\nexport function createPlan(cwd: string, phaseNum: number, planNum: number, title?: string): string {\n\tconst slug = getPhaseSlug(cwd, phaseNum);\n\tconst dir = planningPath(cwd, \"phases\", `${padNum(phaseNum)}-${slug}`);\n\tensureDir(dir);\n\tconst planTitle = title || `Plan ${planNum}`;\n\tconst planFile = path.join(dir, `${padNum(phaseNum)}-${padNum(planNum)}-PLAN.md`);\n\tconst tmpl = `---\nphase: ${phaseNum}\nplan: ${planNum}\ndepends_on: []\nmust_haves:\n - \"[Observable truth this plan delivers]\"\n---\n\n# Phase ${phaseNum}, Plan ${planNum}: ${planTitle}\n\n## Goal\n[What this plan achieves from user perspective]\n\n## Context\n[Key decisions that affect this plan]\n\n## Tasks\n\n<task type=\"auto\">\n <n>[Task name]</n>\n <files>[affected files]</files>\n <test>[Write tests first — what should pass when done]</test>\n <action>\n [Implementation to make tests pass]\n </action>\n <refactor>[Optional cleanup after green]</refactor>\n <verify>[How to verify]</verify>\n <done>[What \"done\" looks like]</done>\n</task>\n\n---\nCreated: ${timestamp()}\n`;\n\tfs.writeFileSync(planFile, tmpl, \"utf-8\");\n\treturn planFile;\n}\n\nexport function discoverPlans(cwd: string, phaseNum: number): PlanDiscovery {\n\tconst phaseDir = getPhaseDir(cwd, phaseNum);\n\tif (!phaseDir) throw new Error(`Phase ${phaseNum} directory not found`);\n\n\tconst files = fs.readdirSync(phaseDir).sort();\n\tconst plans = files.filter((f) => f.endsWith(\"-PLAN.md\") && !f.includes(\"FIX\"));\n\tconst summaries = files.filter((f) => f.endsWith(\"-SUMMARY.md\"));\n\tconst fixPlans = files.filter((f) => f.includes(\"FIX-PLAN.md\"));\n\n\tconst completedPlanNums = new Set(\n\t\tsummaries.map((s) => s.match(/\\d+-(\\d+)-SUMMARY/)?.[1]).filter((x): x is string => Boolean(x)),\n\t);\n\n\tconst incomplete = plans.filter((p) => {\n\t\tconst m = p.match(/\\d+-(\\d+)-PLAN/);\n\t\treturn m ? !completedPlanNums.has(m[1]) : true;\n\t});\n\n\tconst planData = plans.map((p) => {\n\t\tconst content = fs.readFileSync(path.join(phaseDir, p), \"utf-8\");\n\t\tconst depsMatch = content.match(/depends_on:\\s*\\[(.*?)\\]/);\n\t\tconst deps = depsMatch\n\t\t\t? depsMatch[1]\n\t\t\t\t\t.split(\",\")\n\t\t\t\t\t.map((d) => d.trim())\n\t\t\t\t\t.filter(Boolean)\n\t\t\t: [];\n\t\treturn { file: p, deps };\n\t});\n\n\treturn { plans: planData, incomplete, fixPlans };\n}\n\nexport function readPlan(cwd: string, phaseNum: number, planNum: number): string {\n\tconst phaseDir = getPhaseDir(cwd, phaseNum);\n\tif (!phaseDir) throw new Error(`Phase ${phaseNum} not found`);\n\tconst planFile = path.join(phaseDir, `${padNum(phaseNum)}-${padNum(planNum)}-PLAN.md`);\n\tif (!fs.existsSync(planFile)) throw new Error(`Plan file not found: ${planFile}`);\n\treturn fs.readFileSync(planFile, \"utf-8\");\n}\n\nexport function writeSummary(cwd: string, phaseNum: number, planNum: number): string {\n\tconst phaseDir = getPhaseDir(cwd, phaseNum);\n\tif (!phaseDir) throw new Error(`Phase ${phaseNum} not found`);\n\tconst summaryPath = path.join(phaseDir, `${padNum(phaseNum)}-${padNum(planNum)}-SUMMARY.md`);\n\tconst tmpl = `# Phase ${phaseNum}, Plan ${planNum} Summary\n\n## Completed Tasks\n| # | Task | Status | Commit |\n|---|------|--------|--------|\n| 1 | [task] | ✅ Done | [hash] |\n\n## Files Changed\n- [files]\n\n## Verification Results\n- [results]\n\n## Notes\n[deviations, decisions]\n\n---\nCompleted: ${timestamp()}\n`;\n\tfs.writeFileSync(summaryPath, tmpl, \"utf-8\");\n\treturn summaryPath;\n}\n\nexport function verifyPhase(cwd: string, phaseNum: number): PhaseVerification {\n\tconst phaseDir = getPhaseDir(cwd, phaseNum);\n\tif (!phaseDir) throw new Error(`Phase ${phaseNum} not found`);\n\tconst plans = fs.readdirSync(phaseDir).filter((f) => f.endsWith(\"-PLAN.md\") && !f.includes(\"FIX\"));\n\tconst summaries = fs.readdirSync(phaseDir).filter((f) => f.endsWith(\"-SUMMARY.md\"));\n\tconst complete = summaries.length >= plans.length && plans.length > 0;\n\tif (complete) {\n\t\tconst verPath = path.join(phaseDir, `${padNum(phaseNum)}-VERIFICATION.md`);\n\t\tfs.writeFileSync(\n\t\t\tverPath,\n\t\t\t`# Phase ${phaseNum} Verification\\n\\nAll ${plans.length} plans executed.\\nVerified: ${timestamp()}\\n`,\n\t\t\t\"utf-8\",\n\t\t);\n\t}\n\treturn { plans: plans.length, summaries: summaries.length, complete };\n}\n\nexport function updateState(cwd: string): void {\n\tconst statePath = planningPath(cwd, \"STATE.md\");\n\tif (!fs.existsSync(statePath)) throw new Error(\"No STATE.md found\");\n\tlet state = fs.readFileSync(statePath, \"utf-8\");\n\tstate = state.replace(/## Last Activity:.*/, `## Last Activity: ${timestamp()}`);\n\tfs.writeFileSync(statePath, state, \"utf-8\");\n}\n"]}
|
|
@@ -19,28 +19,60 @@ if (!phaseNum || !planNum || !taskNum || !status) {
|
|
|
19
19
|
process.exit(1);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
// ── Toolchain detection — mirrors src/gsd/hook-utils.ts ──────────────────────
|
|
23
|
+
function detectToolchain(cwd) {
|
|
24
|
+
if (fs.existsSync(path.join(cwd, "bun.lockb")) || fs.existsSync(path.join(cwd, "bun.lock"))) {
|
|
25
|
+
return { pm: "bun", testCmd: "bun test", coverageCmd: "bun test --coverage", lintCmd: "bunx biome check ." };
|
|
26
|
+
}
|
|
27
|
+
if (fs.existsSync(path.join(cwd, "pnpm-lock.yaml"))) {
|
|
28
|
+
return { pm: "pnpm", testCmd: "pnpm test", coverageCmd: "pnpm run test:coverage", lintCmd: "pnpm run lint" };
|
|
29
|
+
}
|
|
30
|
+
if (fs.existsSync(path.join(cwd, "yarn.lock"))) {
|
|
31
|
+
return { pm: "yarn", testCmd: "yarn test", coverageCmd: "yarn run test:coverage", lintCmd: "yarn run lint" };
|
|
32
|
+
}
|
|
33
|
+
return { pm: "npm", testCmd: "npm test", coverageCmd: "npm run test:coverage", lintCmd: "npm run lint" };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function readHookConfig(cwd) {
|
|
37
|
+
const defaults = { coverageThreshold: 80, tddMode: "advisory", qualityGateStrict: false };
|
|
38
|
+
const configPath = path.join(cwd, ".planning", "config.json");
|
|
39
|
+
if (!fs.existsSync(configPath)) return defaults;
|
|
40
|
+
try {
|
|
41
|
+
const raw = JSON.parse(fs.readFileSync(configPath, "utf-8"));
|
|
42
|
+
const h = raw.hooks || {};
|
|
43
|
+
return {
|
|
44
|
+
coverageThreshold: typeof h.coverageThreshold === "number" ? h.coverageThreshold : defaults.coverageThreshold,
|
|
45
|
+
tddMode: h.tddMode === "strict" || h.tddMode === "advisory" ? h.tddMode : defaults.tddMode,
|
|
46
|
+
qualityGateStrict: typeof h.qualityGateStrict === "boolean" ? h.qualityGateStrict : defaults.qualityGateStrict,
|
|
47
|
+
};
|
|
48
|
+
} catch { return defaults; }
|
|
49
|
+
}
|
|
50
|
+
|
|
22
51
|
const PLANNING = ".planning";
|
|
23
52
|
const LOG_FILE = path.join(PLANNING, "execution-log.jsonl");
|
|
53
|
+
const cwd = process.cwd();
|
|
54
|
+
const toolchain = detectToolchain(cwd);
|
|
55
|
+
const hookConfig = readHookConfig(cwd);
|
|
24
56
|
|
|
25
57
|
// 0. TDD cycle compliance check
|
|
26
|
-
// If the current commit message starts with "green:", the previous commit for this
|
|
27
|
-
// task should start with "red:" — enforce the Red → Green order.
|
|
28
58
|
if (commitHash) {
|
|
29
59
|
try {
|
|
30
|
-
// Find the commit message for commitHash and the one before it
|
|
31
60
|
const currentMsg = execSync(`git log --format=%s -n 1 ${commitHash} 2>/dev/null`, { encoding: "utf-8" }).trim();
|
|
32
61
|
if (/^green:/i.test(currentMsg)) {
|
|
33
|
-
// Scope search to commits that mention this phase/plan/task in their message
|
|
34
|
-
// to avoid false positives from unrelated older commits
|
|
35
62
|
const taskPrefix = `${phaseNum}-${planNum}-${taskNum}`;
|
|
36
63
|
const recentMsgs = execSync(`git log --format=%s -n 50 ${commitHash}~1 2>/dev/null`, { encoding: "utf-8" })
|
|
37
64
|
.trim()
|
|
38
65
|
.split("\n")
|
|
39
66
|
.filter((m) => m.includes(taskPrefix) || /^(red|green|refactor):/i.test(m));
|
|
40
|
-
// Find the nearest TDD-cycle commit scoped to this task
|
|
41
67
|
const prevTaskMsg = recentMsgs.find((m) => /^(red|green|refactor):/i.test(m) && m.includes(taskPrefix));
|
|
42
68
|
if (!prevTaskMsg || !/^red:/i.test(prevTaskMsg)) {
|
|
43
|
-
|
|
69
|
+
const violation = `TDD violation: "green:" commit without preceding "red:" for task ${phaseNum}-${planNum}-${taskNum}`;
|
|
70
|
+
if (hookConfig.tddMode === "strict") {
|
|
71
|
+
console.error(`❌ ${violation}`);
|
|
72
|
+
process.exit(1);
|
|
73
|
+
} else {
|
|
74
|
+
console.log(`⚠️ ${violation}`);
|
|
75
|
+
}
|
|
44
76
|
fs.appendFileSync(LOG_FILE, JSON.stringify({
|
|
45
77
|
timestamp: new Date().toISOString(),
|
|
46
78
|
phase: parseInt(phaseNum, 10),
|
|
@@ -69,13 +101,15 @@ const entry = {
|
|
|
69
101
|
|
|
70
102
|
fs.appendFileSync(LOG_FILE, JSON.stringify(entry) + "\n");
|
|
71
103
|
|
|
72
|
-
// 2. Run type check if status is pass
|
|
104
|
+
// 2. Run type check and tests if status is pass
|
|
73
105
|
if (status === "pass") {
|
|
106
|
+
// Type check
|
|
74
107
|
try {
|
|
75
|
-
|
|
108
|
+
const tsCmd = toolchain.pm === "bun" ? "bun run tsgo --noEmit 2>&1" : "npx tsc --noEmit 2>&1";
|
|
109
|
+
execSync(tsCmd, { timeout: 30000, encoding: "utf-8", cwd });
|
|
76
110
|
// Run tests
|
|
77
111
|
try {
|
|
78
|
-
const testOutput = execSync(
|
|
112
|
+
const testOutput = execSync(`${toolchain.testCmd} 2>&1`, { timeout: 60000, encoding: "utf-8", cwd });
|
|
79
113
|
const testMatch = testOutput.match(/(\d+) pass/);
|
|
80
114
|
const testCount = testMatch ? testMatch[1] : "?";
|
|
81
115
|
console.log(`✅ Task ${phaseNum}-${planNum}-${taskNum}: passed + types clean + ${testCount} tests pass`);
|
|
@@ -93,7 +127,6 @@ if (status === "pass") {
|
|
|
93
127
|
const errorCount = (output.match(/error TS/g) || []).length;
|
|
94
128
|
if (errorCount > 0) {
|
|
95
129
|
console.log(`⚠️ Task ${phaseNum}-${planNum}-${taskNum}: passed but ${errorCount} type error(s) introduced`);
|
|
96
|
-
// Append warning to log
|
|
97
130
|
fs.appendFileSync(LOG_FILE, JSON.stringify({
|
|
98
131
|
...entry,
|
|
99
132
|
warning: `${errorCount} type errors introduced`,
|
|
@@ -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/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export { type BranchSummaryEntry, buildSessionContext, type CompactionEntry, CUR
|
|
|
17
17
|
export { type CompactionSettings, type ImageSettings, type PackageSource, type RetrySettings, SettingsManager, } from "./core/settings-manager.js";
|
|
18
18
|
export { formatSkillsForPrompt, type LoadSkillsFromDirOptions, type LoadSkillsResult, loadSkills, loadSkillsFromDir, type Skill, type SkillFrontmatter, } from "./core/skills.js";
|
|
19
19
|
export { type BashOperations, type BashSpawnContext, type BashSpawnHook, type BashToolDetails, type BashToolInput, type BashToolOptions, bashTool, codingTools, DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, type EditOperations, type EditToolDetails, type EditToolInput, type EditToolOptions, editTool, type FindOperations, type FindToolDetails, type FindToolInput, type FindToolOptions, findTool, formatSize, type GrepOperations, type GrepToolDetails, type GrepToolInput, type GrepToolOptions, grepTool, type LsOperations, type LsToolDetails, type LsToolInput, type LsToolOptions, lsTool, type ReadOperations, type ReadToolDetails, type ReadToolInput, type ReadToolOptions, readTool, type ToolsOptions, type TruncationOptions, type TruncationResult, truncateHead, truncateLine, truncateTail, type WriteOperations, type WriteToolInput, type WriteToolOptions, writeTool, } from "./core/tools/index.js";
|
|
20
|
+
export type { CommitResult, PhaseVerification, PlanDiscovery } from "./gsd/index.js";
|
|
21
|
+
export { commitDocs, commitTask, createDomainModel, createPlan, discoverPlans, hasTestFiles, mapCodebase, readPlan, updateState, verifyPhase, writeSummary, } from "./gsd/index.js";
|
|
20
22
|
export { main } from "./main.js";
|
|
21
23
|
export { InteractiveMode, type InteractiveModeOptions, type PrintModeOptions, runPrintMode, runRpcMode, } from "./modes/index.js";
|
|
22
24
|
export { ArminComponent, AssistantMessageComponent, appKey, appKeyHint, BashExecutionComponent, BorderedLoader, BranchSummaryMessageComponent, CompactionSummaryMessageComponent, CustomEditor, CustomMessageComponent, DynamicBorder, ExtensionEditorComponent, ExtensionInputComponent, ExtensionSelectorComponent, editorKey, FooterComponent, keyHint, LoginDialogComponent, ModelSelectorComponent, OAuthSelectorComponent, type RenderDiffOptions, rawKeyHint, renderDiff, SessionSelectorComponent, type SettingsCallbacks, type SettingsConfig, SettingsSelectorComponent, ShowImagesSelectorComponent, SkillInvocationMessageComponent, ThemeSelectorComponent, ThinkingSelectorComponent, ToolExecutionComponent, type ToolExecutionOptions, TreeSelectorComponent, truncateToVisualLines, UserMessageComponent, UserMessageSelectorComponent, type VisualTruncateResult, } from "./modes/interactive/components/index.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EACN,YAAY,EACZ,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,eAAe,EACf,KAAK,YAAY,GACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACN,KAAK,gBA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BAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE5E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["// Core session management\n\n// Config paths\nexport { getAgentDir, getPackageDir, isBunBinary, VERSION } from \"./config.js\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.js\";\n// Auth and model registry\nexport {\n\ttype ApiKeyCredential,\n\ttype AuthCredential,\n\tAuthStorage,\n\ttype AuthStorageBackend,\n\tFileAuthStorageBackend,\n\tInMemoryAuthStorageBackend,\n\ttype OAuthCredential,\n} from \"./core/auth-storage.js\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryResult,\n\ttype CollectEntriesResult,\n\ttype CompactionResult,\n\ttype CutPointResult,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tcompact,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileOperations,\n\tfindCutPoint,\n\tfindTurnStartIndex,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgenerateSummary,\n\tgetLastAssistantUsage,\n\tprepareBranchEntries,\n\tserializeConversation,\n\tshouldCompact,\n} from \"./core/compaction/index.js\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.js\";\n// Extension system\nexport type {\n\tAgentEndEvent,\n\tAgentStartEvent,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tAppAction,\n\tBashToolCallEvent,\n\tBeforeAgentStartEvent,\n\tCompactOptions,\n\tContextEvent,\n\tContextUsage,\n\tCustomToolCallEvent,\n\tEditToolCallEvent,\n\tExecOptions,\n\tExecResult,\n\tExtension,\n\tExtensionActions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tExtensionError,\n\tExtensionEvent,\n\tExtensionFactory,\n\tExtensionFlag,\n\tExtensionHandler,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tFindToolCallEvent,\n\tGrepToolCallEvent,\n\tInputEvent,\n\tInputEventResult,\n\tInputSource,\n\tKeybindingsManager,\n\tLoadExtensionsResult,\n\tLsToolCallEvent,\n\tMessageRenderer,\n\tMessageRenderOptions,\n\tProviderConfig,\n\tProviderModelConfig,\n\tReadToolCallEvent,\n\tRegisteredCommand,\n\tRegisteredTool,\n\tSessionBeforeCompactEvent,\n\tSessionBeforeForkEvent,\n\tSessionBeforeSwitchEvent,\n\tSessionBeforeTreeEvent,\n\tSessionCompactEvent,\n\tSessionForkEvent,\n\tSessionShutdownEvent,\n\tSessionStartEvent,\n\tSessionSwitchEvent,\n\tSessionTreeEvent,\n\tSlashCommandInfo,\n\tSlashCommandLocation,\n\tSlashCommandSource,\n\tTerminalInputHandler,\n\tToolCallEvent,\n\tToolDefinition,\n\tToolInfo,\n\tToolRenderResultOptions,\n\tToolResultEvent,\n\tTurnEndEvent,\n\tTurnStartEvent,\n\tUserBashEvent,\n\tUserBashEventResult,\n\tWidgetPlacement,\n\tWriteToolCallEvent,\n} from \"./core/extensions/index.js\";\nexport {\n\tcreateExtensionRuntime,\n\tdiscoverAndLoadExtensions,\n\tExtensionRunner,\n\tisBashToolResult,\n\tisEditToolResult,\n\tisFindToolResult,\n\tisGrepToolResult,\n\tisLsToolResult,\n\tisReadToolResult,\n\tisToolCallEventType,\n\tisWriteToolResult,\n\twrapRegisteredTool,\n\twrapRegisteredTools,\n\twrapToolsWithExtensions,\n\twrapToolWithExtensions,\n} from \"./core/extensions/index.js\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.js\";\nexport { convertToLlm } from \"./core/messages.js\";\nexport { ModelRegistry } from \"./core/model-registry.js\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.js\";\nexport { DefaultPackageManager } from \"./core/package-manager.js\";\nexport type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from \"./core/resource-loader.js\";\nexport { DefaultResourceLoader } from \"./core/resource-loader.js\";\n// SDK for programmatic usage\nexport {\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\t// Factory\n\tcreateAgentSession,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateGrepTool,\n\tcreateLsTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateWriteTool,\n\ttype PromptTemplate,\n\t// Pre-built tools (use process.cwd())\n\treadOnlyTools,\n} from \"./core/sdk.js\";\nexport {\n\ttype BranchSummaryEntry,\n\tbuildSessionContext,\n\ttype CompactionEntry,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype FileEntry,\n\tgetLatestCompactionEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\tparseSessionEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\ttype ThinkingLevelChangeEntry,\n} from \"./core/session-manager.js\";\nexport {\n\ttype CompactionSettings,\n\ttype ImageSettings,\n\ttype PackageSource,\n\ttype RetrySettings,\n\tSettingsManager,\n} from \"./core/settings-manager.js\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.js\";\n// Tools\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tbashTool,\n\tcodingTools,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\teditTool,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tfindTool,\n\tformatSize,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\tgrepTool,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\tlsTool,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\treadTool,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twriteTool,\n} from \"./core/tools/index.js\";\n// Main entry point\nexport { main } from \"./main.js\";\n// Run modes for programmatic SDK usage\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype PrintModeOptions,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.js\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tappKey,\n\tappKeyHint,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tBranchSummaryMessageComponent,\n\tCompactionSummaryMessageComponent,\n\tCustomEditor,\n\tCustomMessageComponent,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\teditorKey,\n\tFooterComponent,\n\tkeyHint,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderDiff,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tTreeSelectorComponent,\n\ttruncateToVisualLines,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\ttype VisualTruncateResult,\n} from \"./modes/interactive/components/index.js\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.js\";\n// Clipboard utilities\nexport { copyToClipboard } from \"./utils/clipboard.js\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.js\";\n// Shell utilities\nexport { getShellConfig } from \"./utils/shell.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EACN,YAAY,EACZ,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,eAAe,EACf,KAAK,YAAY,GACjB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,WAAW,EACX,KAAK,kBAAkB,EACvB,sBAAsB,EACtB,0BAA0B,EAC1B,KAAK,eAAe,GACpB,MAAM,wBAAwB,CAAC;AAEhC,OAAO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oCAAoC,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE5E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["// Core session management\n\n// Config paths\nexport { getAgentDir, getPackageDir, isBunBinary, VERSION } from \"./config.js\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.js\";\n// Auth and model registry\nexport {\n\ttype ApiKeyCredential,\n\ttype AuthCredential,\n\tAuthStorage,\n\ttype AuthStorageBackend,\n\tFileAuthStorageBackend,\n\tInMemoryAuthStorageBackend,\n\ttype OAuthCredential,\n} from \"./core/auth-storage.js\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryResult,\n\ttype CollectEntriesResult,\n\ttype CompactionResult,\n\ttype CutPointResult,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tcompact,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileOperations,\n\tfindCutPoint,\n\tfindTurnStartIndex,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgenerateSummary,\n\tgetLastAssistantUsage,\n\tprepareBranchEntries,\n\tserializeConversation,\n\tshouldCompact,\n} from \"./core/compaction/index.js\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.js\";\n// Extension system\nexport type {\n\tAgentEndEvent,\n\tAgentStartEvent,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tAppAction,\n\tBashToolCallEvent,\n\tBeforeAgentStartEvent,\n\tCompactOptions,\n\tContextEvent,\n\tContextUsage,\n\tCustomToolCallEvent,\n\tEditToolCallEvent,\n\tExecOptions,\n\tExecResult,\n\tExtension,\n\tExtensionActions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tExtensionError,\n\tExtensionEvent,\n\tExtensionFactory,\n\tExtensionFlag,\n\tExtensionHandler,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tFindToolCallEvent,\n\tGrepToolCallEvent,\n\tInputEvent,\n\tInputEventResult,\n\tInputSource,\n\tKeybindingsManager,\n\tLoadExtensionsResult,\n\tLsToolCallEvent,\n\tMessageRenderer,\n\tMessageRenderOptions,\n\tProviderConfig,\n\tProviderModelConfig,\n\tReadToolCallEvent,\n\tRegisteredCommand,\n\tRegisteredTool,\n\tSessionBeforeCompactEvent,\n\tSessionBeforeForkEvent,\n\tSessionBeforeSwitchEvent,\n\tSessionBeforeTreeEvent,\n\tSessionCompactEvent,\n\tSessionForkEvent,\n\tSessionShutdownEvent,\n\tSessionStartEvent,\n\tSessionSwitchEvent,\n\tSessionTreeEvent,\n\tSlashCommandInfo,\n\tSlashCommandLocation,\n\tSlashCommandSource,\n\tTerminalInputHandler,\n\tToolCallEvent,\n\tToolDefinition,\n\tToolInfo,\n\tToolRenderResultOptions,\n\tToolResultEvent,\n\tTurnEndEvent,\n\tTurnStartEvent,\n\tUserBashEvent,\n\tUserBashEventResult,\n\tWidgetPlacement,\n\tWriteToolCallEvent,\n} from \"./core/extensions/index.js\";\nexport {\n\tcreateExtensionRuntime,\n\tdiscoverAndLoadExtensions,\n\tExtensionRunner,\n\tisBashToolResult,\n\tisEditToolResult,\n\tisFindToolResult,\n\tisGrepToolResult,\n\tisLsToolResult,\n\tisReadToolResult,\n\tisToolCallEventType,\n\tisWriteToolResult,\n\twrapRegisteredTool,\n\twrapRegisteredTools,\n\twrapToolsWithExtensions,\n\twrapToolWithExtensions,\n} from \"./core/extensions/index.js\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.js\";\nexport { convertToLlm } from \"./core/messages.js\";\nexport { ModelRegistry } from \"./core/model-registry.js\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.js\";\nexport { DefaultPackageManager } from \"./core/package-manager.js\";\nexport type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from \"./core/resource-loader.js\";\nexport { DefaultResourceLoader } from \"./core/resource-loader.js\";\n// SDK for programmatic usage\nexport {\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\t// Factory\n\tcreateAgentSession,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateGrepTool,\n\tcreateLsTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateWriteTool,\n\ttype PromptTemplate,\n\t// Pre-built tools (use process.cwd())\n\treadOnlyTools,\n} from \"./core/sdk.js\";\nexport {\n\ttype BranchSummaryEntry,\n\tbuildSessionContext,\n\ttype CompactionEntry,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype FileEntry,\n\tgetLatestCompactionEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\tparseSessionEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\ttype ThinkingLevelChangeEntry,\n} from \"./core/session-manager.js\";\nexport {\n\ttype CompactionSettings,\n\ttype ImageSettings,\n\ttype PackageSource,\n\ttype RetrySettings,\n\tSettingsManager,\n} from \"./core/settings-manager.js\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.js\";\n// Tools\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tbashTool,\n\tcodingTools,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\teditTool,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tfindTool,\n\tformatSize,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\tgrepTool,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\tlsTool,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\treadTool,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twriteTool,\n} from \"./core/tools/index.js\";\nexport type { CommitResult, PhaseVerification, PlanDiscovery } from \"./gsd/index.js\";\n// GSD (Get Shit Done) — phase/plan/task lifecycle functions\nexport {\n\tcommitDocs,\n\tcommitTask,\n\tcreateDomainModel,\n\tcreatePlan,\n\tdiscoverPlans,\n\thasTestFiles,\n\tmapCodebase,\n\treadPlan,\n\tupdateState,\n\tverifyPhase,\n\twriteSummary,\n} from \"./gsd/index.js\";\n// Main entry point\nexport { main } from \"./main.js\";\n// Run modes for programmatic SDK usage\nexport {\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\ttype PrintModeOptions,\n\trunPrintMode,\n\trunRpcMode,\n} from \"./modes/index.js\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tappKey,\n\tappKeyHint,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tBranchSummaryMessageComponent,\n\tCompactionSummaryMessageComponent,\n\tCustomEditor,\n\tCustomMessageComponent,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\teditorKey,\n\tFooterComponent,\n\tkeyHint,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderDiff,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tTreeSelectorComponent,\n\ttruncateToVisualLines,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\ttype VisualTruncateResult,\n} from \"./modes/interactive/components/index.js\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.js\";\n// Clipboard utilities\nexport { copyToClipboard } from \"./utils/clipboard.js\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.js\";\n// Shell utilities\nexport { getShellConfig } from \"./utils/shell.js\";\n"]}
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,8 @@ export { SettingsManager, } from "./core/settings-manager.js";
|
|
|
26
26
|
export { formatSkillsForPrompt, loadSkills, loadSkillsFromDir, } from "./core/skills.js";
|
|
27
27
|
// Tools
|
|
28
28
|
export { bashTool, codingTools, DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, editTool, findTool, formatSize, grepTool, lsTool, readTool, truncateHead, truncateLine, truncateTail, writeTool, } from "./core/tools/index.js";
|
|
29
|
+
// GSD (Get Shit Done) — phase/plan/task lifecycle functions
|
|
30
|
+
export { commitDocs, commitTask, createDomainModel, createPlan, discoverPlans, hasTestFiles, mapCodebase, readPlan, updateState, verifyPhase, writeSummary, } from "./gsd/index.js";
|
|
29
31
|
// Main entry point
|
|
30
32
|
export { main } from "./main.js";
|
|
31
33
|
// Run modes for programmatic SDK usage
|