@waycraft/waypoint-mcp 0.1.0 → 0.1.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/dist/index.js +69 -46
- package/package.json +9 -3
- package/dist/context.js +0 -79
- package/dist/tools/audit.js +0 -311
- package/dist/tools/build.js +0 -112
- package/dist/tools/compare.js +0 -92
- package/dist/tools/debug.js +0 -148
- package/dist/tools/design.js +0 -276
- package/dist/tools/document.js +0 -107
- package/dist/tools/fix.js +0 -103
- package/dist/tools/goal.js +0 -94
- package/dist/tools/improve.js +0 -99
- package/dist/tools/measure.js +0 -101
- package/dist/tools/plan.js +0 -107
- package/dist/tools/research.js +0 -104
- package/dist/tools/review.js +0 -123
- package/dist/tools/test.js +0 -107
package/dist/tools/audit.js
DELETED
|
@@ -1,311 +0,0 @@
|
|
|
1
|
-
import { getBaseContext, getArtifact, saveArtifact } from "../context.js";
|
|
2
|
-
export const definition = {
|
|
3
|
-
name: "waypoint_audit",
|
|
4
|
-
description: "Diagnostic design health check on existing code. Infers project tier, confirms with one question, then produces tiered findings: Must Fix, Should Fix, Consider Later. Runs after Build or Fix, or standalone on any existing codebase.",
|
|
5
|
-
inputSchema: {
|
|
6
|
-
type: "object",
|
|
7
|
-
properties: {
|
|
8
|
-
workspacePath: {
|
|
9
|
-
type: "string",
|
|
10
|
-
description: "Absolute path to the workspace root.",
|
|
11
|
-
},
|
|
12
|
-
tier: {
|
|
13
|
-
type: "string",
|
|
14
|
-
enum: ["prototype", "product", "platform"],
|
|
15
|
-
description: "Explicitly set the project tier (optional). Omit to let waypoint_audit infer it and ask for confirmation.",
|
|
16
|
-
},
|
|
17
|
-
focus: {
|
|
18
|
-
type: "string",
|
|
19
|
-
description: "Specific file, folder, or concern to audit (optional). E.g. 'auth/', 'routes/user.js', 'error handling'. Omit to audit the full codebase.",
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
required: ["workspacePath"],
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
// ─── Tier inference ───────────────────────────────────────────────────────────
|
|
26
|
-
function inferTier(ctx) {
|
|
27
|
-
let score = 0;
|
|
28
|
-
const fileTree = ctx.fileTree ?? "";
|
|
29
|
-
const pkg = (() => {
|
|
30
|
-
try {
|
|
31
|
-
return JSON.parse(ctx.packageJson ?? "{}");
|
|
32
|
-
}
|
|
33
|
-
catch {
|
|
34
|
-
return {};
|
|
35
|
-
}
|
|
36
|
-
})();
|
|
37
|
-
const deps = Object.keys({ ...pkg.dependencies, ...pkg.devDependencies });
|
|
38
|
-
const allText = [fileTree, ctx.packageJson ?? ""].join("\n").toLowerCase();
|
|
39
|
-
const fileCount = (fileTree.match(/\n/g) ?? []).length;
|
|
40
|
-
if (fileCount > 40)
|
|
41
|
-
score += 2;
|
|
42
|
-
else if (fileCount > 15)
|
|
43
|
-
score += 1;
|
|
44
|
-
if (allText.includes("dockerfile") || allText.includes("docker-compose"))
|
|
45
|
-
score += 2;
|
|
46
|
-
if (allText.includes(".github/workflows") || allText.includes("ci.yml"))
|
|
47
|
-
score += 1;
|
|
48
|
-
if (allText.includes(".env.example") || allText.includes("config/"))
|
|
49
|
-
score += 1;
|
|
50
|
-
if (deps.some(d => ["prisma", "typeorm", "sequelize", "drizzle", "mongoose"].includes(d)))
|
|
51
|
-
score += 2;
|
|
52
|
-
if (deps.some(d => ["passport", "jsonwebtoken", "next-auth", "clerk"].includes(d)))
|
|
53
|
-
score += 1;
|
|
54
|
-
if (deps.some(d => ["jest", "vitest", "mocha", "playwright", "cypress"].includes(d)))
|
|
55
|
-
score += 1;
|
|
56
|
-
if (deps.some(d => ["@anthropic-ai/sdk", "openai", "langchain"].includes(d)))
|
|
57
|
-
score += 1;
|
|
58
|
-
if (allText.includes("console.log") && fileCount < 10)
|
|
59
|
-
score -= 1;
|
|
60
|
-
if (!ctx.packageJson)
|
|
61
|
-
score -= 1;
|
|
62
|
-
if (score >= 6)
|
|
63
|
-
return { tier: "platform", confidence: "high" };
|
|
64
|
-
if (score >= 3)
|
|
65
|
-
return { tier: "product", confidence: score >= 4 ? "high" : "medium" };
|
|
66
|
-
return { tier: "prototype", confidence: score <= 1 ? "high" : "medium" };
|
|
67
|
-
}
|
|
68
|
-
const FINDINGS = [
|
|
69
|
-
{
|
|
70
|
-
id: "secrets",
|
|
71
|
-
label: "Hardcoded secrets or credentials in code",
|
|
72
|
-
detail: "Any API key, password, or token literal in source code is a credential leak risk. Move to environment variables and add to .env.example.",
|
|
73
|
-
severity: { prototype: "must", product: "must", platform: "must" },
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
id: "no-error-handling",
|
|
77
|
-
label: "Unhandled promise rejections or missing try/catch on I/O",
|
|
78
|
-
detail: "Silent failures corrupt state and are hard to debug in production. Every async I/O path needs explicit error handling.",
|
|
79
|
-
severity: { prototype: "must", product: "must", platform: "must" },
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
id: "god-file",
|
|
83
|
-
label: "God file or module (single file doing too much)",
|
|
84
|
-
detail: "Files over ~200 lines that mix concerns (routing, logic, data access) become hard to test and change. Split by responsibility.",
|
|
85
|
-
severity: { prototype: "should", product: "must", platform: "must" },
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
id: "auth-inline",
|
|
89
|
-
label: "Auth logic inside route handlers",
|
|
90
|
-
detail: "Auth mixed into handlers can't be tested in isolation and is easy to omit on new routes. Extract to middleware.",
|
|
91
|
-
severity: { prototype: "should", product: "must", platform: "must" },
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
id: "no-input-validation",
|
|
95
|
-
label: "No input validation at system boundaries",
|
|
96
|
-
detail: "Unvalidated input leads to silent data corruption and security risks. Add schema validation (Zod, joi) before handler logic.",
|
|
97
|
-
severity: { prototype: "should", product: "must", platform: "must" },
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
id: "no-service-layer",
|
|
101
|
-
label: "Direct DB or external API calls in route handlers",
|
|
102
|
-
detail: "Bypassing a service layer makes testing require real infrastructure and makes the DB/API harder to swap. Add a services/ or repositories/ layer.",
|
|
103
|
-
severity: { prototype: "consider", product: "should", platform: "must" },
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
id: "scattered-env",
|
|
107
|
-
label: "Scattered process.env access throughout the codebase",
|
|
108
|
-
detail: "Direct process.env reads in multiple files make config hard to audit and validate. Centralise in a config module.",
|
|
109
|
-
severity: { prototype: "consider", product: "should", platform: "must" },
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
id: "no-tests",
|
|
113
|
-
label: "No automated tests",
|
|
114
|
-
detail: "Without tests, changes regress silently. Add at minimum unit tests for core logic and one integration test per entry point.",
|
|
115
|
-
severity: { prototype: "consider", product: "should", platform: "must" },
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
id: "magic-values",
|
|
119
|
-
label: "Magic numbers or strings in logic",
|
|
120
|
-
detail: "Unexplained literals (timeouts, limits, status codes) are hard to understand and change safely. Use named constants.",
|
|
121
|
-
severity: { prototype: "should", product: "should", platform: "must" },
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
id: "no-logging",
|
|
125
|
-
label: "No structured logging",
|
|
126
|
-
detail: "console.log is fine early on, but structured logging (with levels and context) is needed before onboarding a team or going to production.",
|
|
127
|
-
severity: { prototype: "consider", product: "consider", platform: "must" },
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
id: "inconsistent-naming",
|
|
131
|
-
label: "Inconsistent naming conventions",
|
|
132
|
-
detail: "Mixed camelCase/snake_case, unclear abbreviations, or generic names (data, result, obj) slow down reading. Align on a convention and apply it.",
|
|
133
|
-
severity: { prototype: "consider", product: "should", platform: "should" },
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
id: "inline-prompts",
|
|
137
|
-
label: "Prompt strings hardcoded inline in business logic",
|
|
138
|
-
detail: "Inline prompt strings mix concerns and make prompt iteration require code changes. Extract to a dedicated prompts/ module.",
|
|
139
|
-
severity: { prototype: "consider", product: "should", platform: "must" },
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
id: "no-llm-resilience",
|
|
143
|
-
label: "LLM calls without retry or error handling",
|
|
144
|
-
detail: "LLM APIs are unreliable — timeouts, rate limits, and transient errors are common. Wrap every call in retry logic with a fallback.",
|
|
145
|
-
severity: { prototype: "should", product: "must", platform: "must" },
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
id: "fat-agent-tools",
|
|
149
|
-
label: "Agent tool functions with multiple responsibilities",
|
|
150
|
-
detail: "Tool functions that do too many things degrade model tool-use accuracy and are hard to test. Each tool should do exactly one thing.",
|
|
151
|
-
severity: { prototype: "consider", product: "should", platform: "must" },
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
id: "no-llm-observability",
|
|
155
|
-
label: "No token usage or cost tracking on LLM calls",
|
|
156
|
-
detail: "Without observability on LLM usage, costs are invisible and runaway spending is easy to miss. Log token counts at the call site or service layer.",
|
|
157
|
-
severity: { prototype: "consider", product: "consider", platform: "must" },
|
|
158
|
-
},
|
|
159
|
-
];
|
|
160
|
-
// ─── Tier label map ───────────────────────────────────────────────────────────
|
|
161
|
-
const TIER_LABELS = {
|
|
162
|
-
prototype: "Prototype",
|
|
163
|
-
product: "Product",
|
|
164
|
-
platform: "Platform",
|
|
165
|
-
};
|
|
166
|
-
// ─── Confirmation note ────────────────────────────────────────────────────────
|
|
167
|
-
function confirmationNote(tier, confidence, explicit) {
|
|
168
|
-
if (explicit) {
|
|
169
|
-
return `> **Tier set explicitly: ${TIER_LABELS[tier]}**`;
|
|
170
|
-
}
|
|
171
|
-
if (confidence === "high") {
|
|
172
|
-
return `> **Tier inferred: ${TIER_LABELS[tier]}** (high confidence)\n> If this is wrong, re-run \`waypoint_audit\` with an explicit \`tier\` parameter.`;
|
|
173
|
-
}
|
|
174
|
-
const alternates = ["prototype", "product", "platform"].filter(t => t !== tier);
|
|
175
|
-
return [
|
|
176
|
-
`> **Tier inferred: ${TIER_LABELS[tier]}** (medium confidence — mixed signals)`,
|
|
177
|
-
`> Re-run with \`tier: "${alternates[0]}"\` or \`"${alternates[1]}"\` if this doesn't match your intent.`,
|
|
178
|
-
].join("\n");
|
|
179
|
-
}
|
|
180
|
-
// ─── Run ──────────────────────────────────────────────────────────────────────
|
|
181
|
-
export async function run(args) {
|
|
182
|
-
const { workspacePath, tier: explicitTier, focus } = args;
|
|
183
|
-
const ctx = await getBaseContext(workspacePath);
|
|
184
|
-
const buildArtifact = await getArtifact(workspacePath, "build.md");
|
|
185
|
-
const goalArtifact = await getArtifact(workspacePath, "goal.md");
|
|
186
|
-
const designArtifact = await getArtifact(workspacePath, "design.md");
|
|
187
|
-
const fixArtifact = await getArtifact(workspacePath, "fix.md");
|
|
188
|
-
const goalLine = goalArtifact?.match(/^# Goal\n+(.+)/m)?.[1] ?? "(no goal defined)";
|
|
189
|
-
let tierKey;
|
|
190
|
-
let confidence;
|
|
191
|
-
if (explicitTier) {
|
|
192
|
-
tierKey = explicitTier;
|
|
193
|
-
confidence = "explicit";
|
|
194
|
-
}
|
|
195
|
-
else {
|
|
196
|
-
const inferred = inferTier(ctx);
|
|
197
|
-
tierKey = inferred.tier;
|
|
198
|
-
confidence = inferred.confidence;
|
|
199
|
-
}
|
|
200
|
-
const tierLabel = TIER_LABELS[tierKey];
|
|
201
|
-
const tierNote = confirmationNote(tierKey, confidence, !!explicitTier);
|
|
202
|
-
const contextNotes = [
|
|
203
|
-
!buildArtifact && !goalArtifact && "> ℹ️ No EDP context found — running as standalone audit on existing codebase.",
|
|
204
|
-
!buildArtifact && goalArtifact && "> ⚠️ No build.md found — audit has no build baseline.",
|
|
205
|
-
designArtifact && "> ✅ design.md found — checking compliance with design contract.",
|
|
206
|
-
fixArtifact && "> ℹ️ fix.md present — checking that recent fixes haven't introduced structural drift.",
|
|
207
|
-
].filter(Boolean);
|
|
208
|
-
const must = FINDINGS.filter(f => f.severity[tierKey] === "must");
|
|
209
|
-
const should = FINDINGS.filter(f => f.severity[tierKey] === "should");
|
|
210
|
-
const consider = FINDINGS.filter(f => f.severity[tierKey] === "consider");
|
|
211
|
-
const pkg = (() => {
|
|
212
|
-
try {
|
|
213
|
-
return JSON.parse(ctx.packageJson ?? "{}");
|
|
214
|
-
}
|
|
215
|
-
catch {
|
|
216
|
-
return {};
|
|
217
|
-
}
|
|
218
|
-
})();
|
|
219
|
-
const deps = Object.keys({ ...pkg.dependencies, ...pkg.devDependencies });
|
|
220
|
-
const isAiNative = deps.some(d => ["@anthropic-ai/sdk", "openai", "langchain", "@langchain"].includes(d));
|
|
221
|
-
const aiFindings = ["inline-prompts", "no-llm-resilience", "fat-agent-tools", "no-llm-observability"];
|
|
222
|
-
function renderFindings(findings) {
|
|
223
|
-
if (findings.length === 0)
|
|
224
|
-
return ["_None at this tier._"];
|
|
225
|
-
return findings.flatMap((f, i) => {
|
|
226
|
-
const isAi = aiFindings.includes(f.id);
|
|
227
|
-
const tag = isAiNative && isAi ? " _(AI-native)_" : "";
|
|
228
|
-
const focusNote = focus ? ` _(check in: ${focus})_` : "";
|
|
229
|
-
return [
|
|
230
|
-
`### ${i + 1}. ${f.label}${tag}`,
|
|
231
|
-
`${f.detail}${focusNote}`,
|
|
232
|
-
"- [ ] Investigated",
|
|
233
|
-
"- [ ] Action taken or explicitly deferred",
|
|
234
|
-
"",
|
|
235
|
-
];
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
const artifact = [
|
|
239
|
-
"# Audit",
|
|
240
|
-
"",
|
|
241
|
-
`**Goal:** ${goalLine}`,
|
|
242
|
-
focus ? `**Focus:** ${focus}` : "",
|
|
243
|
-
`**Tier:** ${tierLabel}`,
|
|
244
|
-
...contextNotes,
|
|
245
|
-
"",
|
|
246
|
-
tierNote,
|
|
247
|
-
"",
|
|
248
|
-
"## Must Fix",
|
|
249
|
-
"<!-- Address these before shipping or sharing this code -->",
|
|
250
|
-
"",
|
|
251
|
-
...renderFindings(must),
|
|
252
|
-
"## Should Fix",
|
|
253
|
-
"<!-- Address before next release or when touching this area -->",
|
|
254
|
-
"",
|
|
255
|
-
...renderFindings(should),
|
|
256
|
-
"## Consider Later",
|
|
257
|
-
"<!-- Worth doing at scale — not urgent at current tier -->",
|
|
258
|
-
"",
|
|
259
|
-
...renderFindings(consider),
|
|
260
|
-
"## Design contract compliance",
|
|
261
|
-
designArtifact
|
|
262
|
-
? "<!-- Check findings against the contract in design.md -->"
|
|
263
|
-
: "<!-- No design.md found — run `waypoint_design` to establish a contract, then re-audit -->",
|
|
264
|
-
"- [ ] All Must Fix items from the design contract are addressed",
|
|
265
|
-
"- [ ] Structure matches design.md recommendations",
|
|
266
|
-
"",
|
|
267
|
-
"## Audit summary",
|
|
268
|
-
`| Severity | Count |`,
|
|
269
|
-
`|----------|-------|`,
|
|
270
|
-
`| Must Fix | ${must.length} |`,
|
|
271
|
-
`| Should Fix | ${should.length} |`,
|
|
272
|
-
`| Consider Later | ${consider.length} |`,
|
|
273
|
-
"",
|
|
274
|
-
"**Overall verdict:**",
|
|
275
|
-
"<!-- ✅ Clean | ⚠️ Needs attention | ❌ Significant issues -->",
|
|
276
|
-
"",
|
|
277
|
-
`_Generated by waypoint_audit (${tierLabel}) — ${new Date().toISOString()}_`,
|
|
278
|
-
]
|
|
279
|
-
.filter(l => l !== undefined)
|
|
280
|
-
.join("\n");
|
|
281
|
-
await saveArtifact(workspacePath, "audit.md", artifact);
|
|
282
|
-
const hasMust = must.length > 0;
|
|
283
|
-
const hasShould = should.length > 0;
|
|
284
|
-
const nextStep = hasMust
|
|
285
|
-
? "Run `waypoint_fix` for Must Fix items — minimal targeted patches. Then re-run `waypoint_audit` to confirm."
|
|
286
|
-
: hasShould
|
|
287
|
-
? "No Must Fix items. Run `waypoint_improve` to work through Should Fix items as structured refactors."
|
|
288
|
-
: "No Must Fix or Should Fix items. Run `waypoint_review` for a final pre-ship quality check.";
|
|
289
|
-
return [
|
|
290
|
-
"## waypoint_audit — Audit complete",
|
|
291
|
-
"",
|
|
292
|
-
`**Tier:** ${tierLabel}`,
|
|
293
|
-
`**Goal:** ${goalLine}`,
|
|
294
|
-
focus ? `**Focus:** ${focus}` : "",
|
|
295
|
-
isAiNative ? "**AI-native patterns:** checked" : "",
|
|
296
|
-
"",
|
|
297
|
-
"### Findings summary",
|
|
298
|
-
`- **Must Fix:** ${must.length} — address before shipping`,
|
|
299
|
-
`- **Should Fix:** ${should.length} — address before next release`,
|
|
300
|
-
`- **Consider Later:** ${consider.length} — low urgency at current tier`,
|
|
301
|
-
"",
|
|
302
|
-
"### Artifact saved",
|
|
303
|
-
"`audit.md` written to `.waypoint/audit.md`.",
|
|
304
|
-
"Work through each checklist item — check off as you investigate and act.",
|
|
305
|
-
"",
|
|
306
|
-
"### Suggested next step",
|
|
307
|
-
nextStep,
|
|
308
|
-
]
|
|
309
|
-
.filter(l => l !== undefined)
|
|
310
|
-
.join("\n");
|
|
311
|
-
}
|
package/dist/tools/build.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { getBaseContext, getArtifact, saveArtifact } from "../context.js";
|
|
2
|
-
export const definition = {
|
|
3
|
-
name: "waypoint_build",
|
|
4
|
-
description: "Scaffold and implement. Generate prompts and guidance for AI coding tools.",
|
|
5
|
-
inputSchema: {
|
|
6
|
-
type: "object",
|
|
7
|
-
properties: {
|
|
8
|
-
workspacePath: {
|
|
9
|
-
type: "string",
|
|
10
|
-
description: "Absolute path to the workspace root.",
|
|
11
|
-
},
|
|
12
|
-
task: {
|
|
13
|
-
type: "string",
|
|
14
|
-
description: "Specific build task or milestone to implement (optional). Omit to build from the full plan.",
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
required: ["workspacePath"],
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
export async function run(args) {
|
|
21
|
-
const { workspacePath, task } = args;
|
|
22
|
-
const ctx = await getBaseContext(workspacePath);
|
|
23
|
-
const planArtifact = await getArtifact(workspacePath, "plan.md");
|
|
24
|
-
const goalArtifact = await getArtifact(workspacePath, "goal.md");
|
|
25
|
-
if (!planArtifact && !goalArtifact) {
|
|
26
|
-
return [
|
|
27
|
-
"## waypoint_build — No plan or goal found",
|
|
28
|
-
"",
|
|
29
|
-
"Run `waypoint_goal` → `waypoint_plan` before building.",
|
|
30
|
-
].join("\n");
|
|
31
|
-
}
|
|
32
|
-
const goalLine = goalArtifact?.match(/^# Goal\n+(.+)/m)?.[1] ?? "(goal not parsed)";
|
|
33
|
-
const hasPlan = !!planArtifact;
|
|
34
|
-
const pkgName = (() => {
|
|
35
|
-
try {
|
|
36
|
-
return JSON.parse(ctx.packageJson ?? "{}").name ?? "this project";
|
|
37
|
-
}
|
|
38
|
-
catch {
|
|
39
|
-
return "this project";
|
|
40
|
-
}
|
|
41
|
-
})();
|
|
42
|
-
const artifact = [
|
|
43
|
-
"# Build",
|
|
44
|
-
"",
|
|
45
|
-
`**Goal:** ${goalLine}`,
|
|
46
|
-
task ? `**Task:** ${task}` : "",
|
|
47
|
-
!hasPlan ? "\n> ⚠️ No plan.md found — consider running `waypoint_plan` first." : "",
|
|
48
|
-
"",
|
|
49
|
-
"## Implementation checklist",
|
|
50
|
-
"<!-- Track each implementation unit -->",
|
|
51
|
-
"- [ ] Set up project structure / scaffold",
|
|
52
|
-
"- [ ] Implement core logic",
|
|
53
|
-
"- [ ] Wire up integrations",
|
|
54
|
-
"- [ ] Handle edge cases and errors",
|
|
55
|
-
"- [ ] Self-review before handoff to waypoint_test",
|
|
56
|
-
"",
|
|
57
|
-
"## AI coding prompts",
|
|
58
|
-
"<!-- Paste these into your AI coding tool (Claude Code, Cursor, etc.) -->",
|
|
59
|
-
"",
|
|
60
|
-
"### Scaffold prompt",
|
|
61
|
-
"```",
|
|
62
|
-
`Scaffold the implementation for: ${task ?? goalLine}`,
|
|
63
|
-
`Project: ${pkgName}`,
|
|
64
|
-
"Requirements:",
|
|
65
|
-
"- [fill from plan milestones]",
|
|
66
|
-
"- Keep changes minimal and focused",
|
|
67
|
-
"- No speculative features",
|
|
68
|
-
"```",
|
|
69
|
-
"",
|
|
70
|
-
"### Implementation prompt",
|
|
71
|
-
"```",
|
|
72
|
-
`Implement: ${task ?? goalLine}`,
|
|
73
|
-
"Constraints:",
|
|
74
|
-
"- Match existing code style",
|
|
75
|
-
"- No new dependencies unless necessary",
|
|
76
|
-
"- Write no comments unless the why is non-obvious",
|
|
77
|
-
"```",
|
|
78
|
-
"",
|
|
79
|
-
"## Implementation notes",
|
|
80
|
-
"<!-- Record decisions made during build, gotchas, deviations from plan -->",
|
|
81
|
-
"- ",
|
|
82
|
-
"",
|
|
83
|
-
"## Files changed",
|
|
84
|
-
"<!-- List key files created or modified -->",
|
|
85
|
-
"- ",
|
|
86
|
-
"",
|
|
87
|
-
`_Generated by waypoint_build — ${new Date().toISOString()}_`,
|
|
88
|
-
]
|
|
89
|
-
.filter((l) => l !== undefined)
|
|
90
|
-
.join("\n");
|
|
91
|
-
await saveArtifact(workspacePath, "build.md", artifact);
|
|
92
|
-
return [
|
|
93
|
-
"## waypoint_build — Build guide generated",
|
|
94
|
-
"",
|
|
95
|
-
`**Goal:** ${goalLine}`,
|
|
96
|
-
task ? `**Task:** ${task}` : "",
|
|
97
|
-
!hasPlan ? "\n> No plan.md found — output may be generic. Run `waypoint_plan` first." : "",
|
|
98
|
-
"",
|
|
99
|
-
"### AI coding prompts included",
|
|
100
|
-
"- **Scaffold prompt** — use to create initial structure",
|
|
101
|
-
"- **Implementation prompt** — use for each milestone or task",
|
|
102
|
-
"",
|
|
103
|
-
"### Artifact saved",
|
|
104
|
-
"`build.md` written to `.waypoint/build.md`.",
|
|
105
|
-
"Fill in the implementation checklist as you work.",
|
|
106
|
-
"",
|
|
107
|
-
"### Suggested next step",
|
|
108
|
-
"Run `waypoint_test` to verify feature-level requirements once implementation is ready.",
|
|
109
|
-
]
|
|
110
|
-
.filter((l) => l !== undefined)
|
|
111
|
-
.join("\n");
|
|
112
|
-
}
|
package/dist/tools/compare.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { getBaseContext, getArtifact, saveArtifact } from "../context.js";
|
|
2
|
-
export const definition = {
|
|
3
|
-
name: "waypoint_compare",
|
|
4
|
-
description: "Present decision tradeoffs, comparison methods, UI mockups if relevant.",
|
|
5
|
-
inputSchema: {
|
|
6
|
-
type: "object",
|
|
7
|
-
properties: {
|
|
8
|
-
workspacePath: {
|
|
9
|
-
type: "string",
|
|
10
|
-
description: "Absolute path to the workspace root.",
|
|
11
|
-
},
|
|
12
|
-
decision: {
|
|
13
|
-
type: "string",
|
|
14
|
-
description: "Specific decision to evaluate (optional). Omit to evaluate all open decisions from research.",
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
required: ["workspacePath"],
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
export async function run(args) {
|
|
21
|
-
const { workspacePath, decision } = args;
|
|
22
|
-
const ctx = await getBaseContext(workspacePath);
|
|
23
|
-
const goalArtifact = await getArtifact(workspacePath, "goal.md");
|
|
24
|
-
const researchArtifact = await getArtifact(workspacePath, "research.md");
|
|
25
|
-
if (!goalArtifact) {
|
|
26
|
-
return [
|
|
27
|
-
"## waypoint_compare — No goal found",
|
|
28
|
-
"",
|
|
29
|
-
"Run `waypoint_goal` first, then `waypoint_research` before evaluating options.",
|
|
30
|
-
].join("\n");
|
|
31
|
-
}
|
|
32
|
-
const goalLine = goalArtifact.match(/^# Goal\n+(.+)/m)?.[1] ?? "(goal not parsed)";
|
|
33
|
-
const hasResearch = !!researchArtifact;
|
|
34
|
-
const artifact = [
|
|
35
|
-
"# Options",
|
|
36
|
-
"",
|
|
37
|
-
`**Goal:** ${goalLine}`,
|
|
38
|
-
decision ? `**Decision under evaluation:** ${decision}` : "",
|
|
39
|
-
!hasResearch ? "\n> ⚠️ No research.md found — options may be incomplete. Run `waypoint_research` first." : "",
|
|
40
|
-
"",
|
|
41
|
-
"## Decision log",
|
|
42
|
-
"<!-- Record each key decision, the options considered, and the choice made -->",
|
|
43
|
-
"",
|
|
44
|
-
"### Decision 1",
|
|
45
|
-
`**Question:** ${decision ?? "What approach best satisfies the goal?"}`,
|
|
46
|
-
"",
|
|
47
|
-
"| Option | Pros | Cons | Fit |",
|
|
48
|
-
"|--------|------|------|-----|",
|
|
49
|
-
"| Option A | | | |",
|
|
50
|
-
"| Option B | | | |",
|
|
51
|
-
"| Option C | | | |",
|
|
52
|
-
"",
|
|
53
|
-
"**Recommended:** <!-- State your recommendation and the deciding factor -->",
|
|
54
|
-
"**Rationale:** <!-- Why this option over the others? -->",
|
|
55
|
-
"",
|
|
56
|
-
"## Eliminated approaches",
|
|
57
|
-
"<!-- Options ruled out early and why — prevents revisiting dead ends -->",
|
|
58
|
-
"- ",
|
|
59
|
-
"",
|
|
60
|
-
"## Assumptions & constraints",
|
|
61
|
-
"<!-- What must be true for the chosen option to work? -->",
|
|
62
|
-
"- ",
|
|
63
|
-
"",
|
|
64
|
-
`_Generated by waypoint_compare — ${new Date().toISOString()}_`,
|
|
65
|
-
]
|
|
66
|
-
.filter((l) => l !== undefined)
|
|
67
|
-
.join("\n");
|
|
68
|
-
await saveArtifact(workspacePath, "compare.md", artifact);
|
|
69
|
-
return [
|
|
70
|
-
"## waypoint_compare — Decision framework generated",
|
|
71
|
-
"",
|
|
72
|
-
`**Goal:** ${goalLine}`,
|
|
73
|
-
decision ? `**Decision focus:** ${decision}` : "",
|
|
74
|
-
!hasResearch
|
|
75
|
-
? "\n> No research.md found — consider running `waypoint_research` first for more informed options."
|
|
76
|
-
: "",
|
|
77
|
-
"",
|
|
78
|
-
"### How to use compare.md",
|
|
79
|
-
"1. Fill in the decision table — one row per option",
|
|
80
|
-
"2. State pros, cons, and fit for each",
|
|
81
|
-
"3. Write a **Recommended** line with clear rationale",
|
|
82
|
-
"4. List eliminated approaches to avoid revisiting them",
|
|
83
|
-
"",
|
|
84
|
-
"### Artifact saved",
|
|
85
|
-
"`compare.md` written to `.waypoint/compare.md`.",
|
|
86
|
-
"",
|
|
87
|
-
"### Suggested next step",
|
|
88
|
-
"Run `waypoint_plan` once decisions are recorded.",
|
|
89
|
-
]
|
|
90
|
-
.filter((l) => l !== undefined)
|
|
91
|
-
.join("\n");
|
|
92
|
-
}
|
package/dist/tools/debug.js
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { getBaseContext, getArtifact, saveArtifact } from "../context.js";
|
|
2
|
-
export const definition = {
|
|
3
|
-
name: "waypoint_debug",
|
|
4
|
-
description: "Read-only diagnostics. Mode troubleshoot = root cause framing. Mode trace = execution path analysis.",
|
|
5
|
-
inputSchema: {
|
|
6
|
-
type: "object",
|
|
7
|
-
properties: {
|
|
8
|
-
workspacePath: {
|
|
9
|
-
type: "string",
|
|
10
|
-
description: "Absolute path to the workspace root.",
|
|
11
|
-
},
|
|
12
|
-
mode: {
|
|
13
|
-
type: "string",
|
|
14
|
-
enum: ["troubleshoot", "trace"],
|
|
15
|
-
description: "troubleshoot = root cause framing. trace = execution path analysis.",
|
|
16
|
-
},
|
|
17
|
-
symptom: {
|
|
18
|
-
type: "string",
|
|
19
|
-
description: "Observed symptom or failure to diagnose (optional).",
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
required: ["workspacePath", "mode"],
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
export async function run(args) {
|
|
26
|
-
const { workspacePath, mode, symptom } = args;
|
|
27
|
-
const ctx = await getBaseContext(workspacePath);
|
|
28
|
-
const buildArtifact = await getArtifact(workspacePath, "build.md");
|
|
29
|
-
const goalArtifact = await getArtifact(workspacePath, "goal.md");
|
|
30
|
-
const goalLine = goalArtifact?.match(/^# Goal\n+(.+)/m)?.[1] ?? "(no goal defined)";
|
|
31
|
-
const focus = symptom ?? "unspecified symptom";
|
|
32
|
-
let modeContent;
|
|
33
|
-
if (mode === "troubleshoot") {
|
|
34
|
-
modeContent = [
|
|
35
|
-
"## Troubleshoot — Root cause framing",
|
|
36
|
-
"",
|
|
37
|
-
`**Symptom:** ${focus}`,
|
|
38
|
-
"",
|
|
39
|
-
"### Is/Is-not analysis",
|
|
40
|
-
"| Dimension | Is | Is Not |",
|
|
41
|
-
"|-----------|-----|--------|",
|
|
42
|
-
"| What | | |",
|
|
43
|
-
"| Where | | |",
|
|
44
|
-
"| When | | |",
|
|
45
|
-
"| Extent | | |",
|
|
46
|
-
"",
|
|
47
|
-
"### Root cause hypotheses",
|
|
48
|
-
"<!-- Rank by likelihood — most likely first -->",
|
|
49
|
-
"1. ",
|
|
50
|
-
"2. ",
|
|
51
|
-
"3. ",
|
|
52
|
-
"",
|
|
53
|
-
"### Diagnostic steps",
|
|
54
|
-
"<!-- Ordered read-only checks to confirm or rule out each hypothesis -->",
|
|
55
|
-
"- [ ] Check logs for errors around the time of symptom",
|
|
56
|
-
"- [ ] Reproduce symptom in isolation",
|
|
57
|
-
"- [ ] Identify the last known good state",
|
|
58
|
-
"- [ ] Diff current state against known good",
|
|
59
|
-
"",
|
|
60
|
-
"### AI diagnostic prompt",
|
|
61
|
-
"```",
|
|
62
|
-
`Diagnose the following symptom without modifying any code: ${focus}`,
|
|
63
|
-
"",
|
|
64
|
-
"Steps:",
|
|
65
|
-
"1. Identify the likely root cause",
|
|
66
|
-
"2. List evidence that supports or refutes each hypothesis",
|
|
67
|
-
"3. Propose the minimal targeted fix — do not implement it yet",
|
|
68
|
-
"```",
|
|
69
|
-
];
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
modeContent = [
|
|
73
|
-
"## Trace — Execution path analysis",
|
|
74
|
-
"",
|
|
75
|
-
`**Symptom:** ${focus}`,
|
|
76
|
-
"",
|
|
77
|
-
"### Entry point",
|
|
78
|
-
"<!-- Where does execution begin for this flow? -->",
|
|
79
|
-
"- ",
|
|
80
|
-
"",
|
|
81
|
-
"### Execution path",
|
|
82
|
-
"<!-- Step-by-step: function → function → output -->",
|
|
83
|
-
"1. ",
|
|
84
|
-
"2. ",
|
|
85
|
-
"3. ",
|
|
86
|
-
"",
|
|
87
|
-
"### Observed vs expected at each step",
|
|
88
|
-
"| Step | Expected | Observed | Diverges? |",
|
|
89
|
-
"|------|----------|----------|-----------|",
|
|
90
|
-
"| | | | |",
|
|
91
|
-
"",
|
|
92
|
-
"### Divergence point",
|
|
93
|
-
"<!-- Where exactly does actual behavior first differ from expected? -->",
|
|
94
|
-
"- ",
|
|
95
|
-
"",
|
|
96
|
-
"### AI trace prompt",
|
|
97
|
-
"```",
|
|
98
|
-
`Trace the execution path for: ${focus}`,
|
|
99
|
-
"",
|
|
100
|
-
"Without modifying any code:",
|
|
101
|
-
"1. Follow the call chain from entry point to output",
|
|
102
|
-
"2. Identify where the observed behavior first diverges from expected",
|
|
103
|
-
"3. Explain why that divergence occurs",
|
|
104
|
-
"```",
|
|
105
|
-
];
|
|
106
|
-
}
|
|
107
|
-
const artifact = [
|
|
108
|
-
"# Diagnose",
|
|
109
|
-
"",
|
|
110
|
-
`**Mode:** ${mode}`,
|
|
111
|
-
`**Goal context:** ${goalLine}`,
|
|
112
|
-
!buildArtifact ? "\n> ⚠️ No build.md found — diagnosis has no build baseline." : "",
|
|
113
|
-
"",
|
|
114
|
-
...modeContent,
|
|
115
|
-
"",
|
|
116
|
-
"## Workspace snapshot",
|
|
117
|
-
`**Files:** \n\`\`\`\n${ctx.fileTree}\n\`\`\``,
|
|
118
|
-
"",
|
|
119
|
-
`_Generated by waypoint_debug (${mode}) — ${new Date().toISOString()}_`,
|
|
120
|
-
]
|
|
121
|
-
.filter((l) => l !== undefined)
|
|
122
|
-
.join("\n");
|
|
123
|
-
await saveArtifact(workspacePath, "debug.md", artifact);
|
|
124
|
-
return [
|
|
125
|
-
`## waypoint_debug — ${mode === "troubleshoot" ? "Troubleshoot" : "Trace"} guide generated`,
|
|
126
|
-
"",
|
|
127
|
-
`**Mode:** ${mode}`,
|
|
128
|
-
`**Symptom:** ${focus}`,
|
|
129
|
-
"",
|
|
130
|
-
mode === "troubleshoot"
|
|
131
|
-
? [
|
|
132
|
-
"### Framework: Is/Is-not analysis",
|
|
133
|
-
"Define what the symptom IS and IS NOT across: what, where, when, extent.",
|
|
134
|
-
"Rank hypotheses by likelihood. Run diagnostic steps read-only first.",
|
|
135
|
-
].join("\n")
|
|
136
|
-
: [
|
|
137
|
-
"### Framework: Execution path trace",
|
|
138
|
-
"Map the call chain from entry point to output.",
|
|
139
|
-
"Find the exact step where observed behavior diverges from expected.",
|
|
140
|
-
].join("\n"),
|
|
141
|
-
"",
|
|
142
|
-
"### Artifact saved",
|
|
143
|
-
"`debug.md` written to `.waypoint/debug.md`.",
|
|
144
|
-
"",
|
|
145
|
-
"### Suggested next step",
|
|
146
|
-
"Run `waypoint_fix` once the root cause is confirmed.",
|
|
147
|
-
].join("\n");
|
|
148
|
-
}
|