@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/index.js
CHANGED
|
@@ -1,46 +1,69 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}));
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
await
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var re=Object.defineProperty;var w=(i,e)=>{for(var t in e)re(i,t,{get:e[t],enumerable:!0})};import{Server as Je}from"@modelcontextprotocol/sdk/server/index.js";import{StdioServerTransport as He}from"@modelcontextprotocol/sdk/server/stdio.js";import{ListToolsRequestSchema as Ke,CallToolRequestSchema as ze}from"@modelcontextprotocol/sdk/types.js";var j={};w(j,{definition:()=>ue,run:()=>me});import{readFile as P,writeFile as se,readdir as V,mkdir as ce,stat as le}from"fs/promises";import{join as b,relative as de}from"path";var pe=new Set(["node_modules",".git","dist","build",".next",".nuxt","coverage",".cache",".turbo","out"]);async function U(i,e,t){if(e===0)return[];let n;try{n=await V(i)}catch{return[]}let a=[];for(let r of n.sort()){if(r.startsWith(".")&&r!==".waypoint"||pe.has(r))continue;let s=b(i,r),c=de(t,s),o=!1;try{o=(await le(s)).isDirectory()}catch{continue}a.push(o?`${c}/`:c),o&&a.push(...await U(s,e-1,t))}return a}async function u(i){let e=await U(i,2,i),t=e.length>0?e.join(`
|
|
3
|
+
`):"(empty workspace)",n=null;try{n=await P(b(i,"package.json"),"utf8")}catch{}let a={},r=b(i,".waypoint");try{let s=await V(r);for(let c of s.sort())try{a[c]=await P(b(r,c),"utf8")}catch{}}catch{}return{workspacePath:i,fileTree:t,packageJson:n,waypointArtifacts:a}}async function d(i,e){try{return await P(b(i,".waypoint",e),"utf8")}catch{return null}}async function m(i,e,t){let n=b(i,".waypoint");await ce(n,{recursive:!0}),await se(b(n,e),t,"utf8")}var ue={name:"waypoint_goal",description:"Define or refine the project goal. Analyzes existing code and business logic if present.",inputSchema:{type:"object",properties:{workspacePath:{type:"string",description:"Absolute path to the workspace root."},goal:{type:"string",description:"The goal to define or refine. Omit to review an existing goal.md."}},required:["workspacePath"]}};async function me(i){let{workspacePath:e,goal:t}=i,n=await u(e),a=await d(e,"goal.md"),r=t??a?.match(/^# Goal\n+(.+)/m)?.[1]??null,s=[`**Path:** ${e}`,n.packageJson?`**Package:** ${(()=>{try{let o=JSON.parse(n.packageJson);return`${o.name??"unnamed"} v${o.version??"?"}`}catch{return"present (unparseable)"}})()}`:"**Package:** none detected",`**Files (2 levels):**
|
|
4
|
+
\`\`\`
|
|
5
|
+
${n.fileTree}
|
|
6
|
+
\`\`\``,Object.keys(n.waypointArtifacts).length>0?`**Existing .waypoint artifacts:** ${Object.keys(n.waypointArtifacts).join(", ")}`:"**Existing .waypoint artifacts:** none"].join(`
|
|
7
|
+
`);if(!r)return["## waypoint_goal \u2014 No goal defined yet","","### Workspace snapshot",s,"","### Next step","Call `waypoint_goal` again with a `goal` parameter describing what you want to achieve.",'Example: _"Add user authentication with email/password and OAuth"_',"","A clear goal should answer:","- What capability or outcome are we delivering?","- Who benefits and how?","- What does done look like?"].join(`
|
|
8
|
+
`);let c=["# Goal","",r,"","## Success criteria","<!-- Define 2-4 measurable outcomes that confirm this goal is met -->","- [ ] ","","## Out of scope","<!-- Explicitly list what this goal does NOT cover -->","- ","","## Workspace observations",s,"",`_Generated by waypoint_goal \u2014 ${new Date().toISOString()}_`].join(`
|
|
9
|
+
`);return await m(e,"goal.md",c),["## waypoint_goal \u2014 Goal captured","",`**Goal:** ${r}`,"","### Workspace snapshot",s,"","### Artifact saved","`goal.md` written to `.waypoint/goal.md`.","Fill in **Success criteria** and **Out of scope** before moving to `waypoint_research`.","","### Suggested next step","Run `waypoint_research` to surface best practices and open questions for this goal."].join(`
|
|
10
|
+
`)}var I={};w(I,{definition:()=>fe,run:()=>ge});var fe={name:"waypoint_research",description:"Gather best practices, surface the right questions, explore the solution space.",inputSchema:{type:"object",properties:{workspacePath:{type:"string",description:"Absolute path to the workspace root."},topic:{type:"string",description:"Specific research focus (optional). Omit to research the full goal."}},required:["workspacePath"]}};async function ge(i){let{workspacePath:e,topic:t}=i,n=await u(e),a=await d(e,"goal.md");if(!a)return["## waypoint_research \u2014 No goal found","","Run `waypoint_goal` first to define the project goal before researching."].join(`
|
|
11
|
+
`);let r=a.match(/^# Goal\n+(.+)/m)?.[1]??"(goal not parsed)",s=t??r,c=["# Research","",`**Goal:** ${r}`,t?`**Focus:** ${t}`:"","","## Key questions to answer","<!-- What must be understood before committing to a design? -->","- What existing solutions or libraries handle this well?","- What constraints (performance, security, compatibility) apply?","- What has failed in similar past attempts?","- What unknowns could invalidate the plan?","","## Areas to investigate","","### Prior art & libraries","- [ ] Survey existing libraries and tools relevant to the goal","- [ ] Review documentation and known limitations","","### Architecture & patterns","- [ ] Identify applicable design patterns","- [ ] Assess integration points with existing code","","### Risks & constraints","- [ ] List technical risks","- [ ] Note hard constraints (runtime, platform, team)","","### Open decisions","<!-- Questions that will need to be resolved in waypoint_compare -->","- [ ] ","","## Workspace observations",`**Path:** ${e}`,n.packageJson?(()=>{try{let o=JSON.parse(n.packageJson);return`**Package:** ${o.name??"unnamed"} v${o.version??"?"}`}catch{return"**Package:** present (unparseable)"}})():"**Package:** none detected","",`_Generated by waypoint_research \u2014 ${new Date().toISOString()}_`].filter(o=>o!==void 0).join(`
|
|
12
|
+
`);return await m(e,"research.md",c),["## waypoint_research \u2014 Research brief generated","",`**Goal:** ${r}`,t?`**Focus:** ${t}`:"","","### What to investigate","1. **Prior art & libraries** \u2014 survey what exists, note limitations","2. **Architecture & patterns** \u2014 find applicable patterns, assess fit","3. **Risks & constraints** \u2014 surface blockers early","4. **Open decisions** \u2014 list what must be resolved before planning","","### Artifact saved","`research.md` written to `.waypoint/research.md`.","Fill in findings before moving forward.","","### Suggested next step","Run `waypoint_compare` to turn research findings into concrete decision tradeoffs."].filter(o=>o!==void 0).join(`
|
|
13
|
+
`)}var N={};w(N,{definition:()=>he,run:()=>ye});var he={name:"waypoint_compare",description:"Present decision tradeoffs, comparison methods, UI mockups if relevant.",inputSchema:{type:"object",properties:{workspacePath:{type:"string",description:"Absolute path to the workspace root."},decision:{type:"string",description:"Specific decision to evaluate (optional). Omit to evaluate all open decisions from research."}},required:["workspacePath"]}};async function ye(i){let{workspacePath:e,decision:t}=i,n=await u(e),a=await d(e,"goal.md"),r=await d(e,"research.md");if(!a)return["## waypoint_compare \u2014 No goal found","","Run `waypoint_goal` first, then `waypoint_research` before evaluating options."].join(`
|
|
14
|
+
`);let s=a.match(/^# Goal\n+(.+)/m)?.[1]??"(goal not parsed)",c=!!r,o=["# Options","",`**Goal:** ${s}`,t?`**Decision under evaluation:** ${t}`:"",c?"":"\n> \u26A0\uFE0F No research.md found \u2014 options may be incomplete. Run `waypoint_research` first.","","## Decision log","<!-- Record each key decision, the options considered, and the choice made -->","","### Decision 1",`**Question:** ${t??"What approach best satisfies the goal?"}`,"","| Option | Pros | Cons | Fit |","|--------|------|------|-----|","| Option A | | | |","| Option B | | | |","| Option C | | | |","","**Recommended:** <!-- State your recommendation and the deciding factor -->","**Rationale:** <!-- Why this option over the others? -->","","## Eliminated approaches","<!-- Options ruled out early and why \u2014 prevents revisiting dead ends -->","- ","","## Assumptions & constraints","<!-- What must be true for the chosen option to work? -->","- ","",`_Generated by waypoint_compare \u2014 ${new Date().toISOString()}_`].filter(p=>p!==void 0).join(`
|
|
15
|
+
`);return await m(e,"compare.md",o),["## waypoint_compare \u2014 Decision framework generated","",`**Goal:** ${s}`,t?`**Decision focus:** ${t}`:"",c?"":"\n> No research.md found \u2014 consider running `waypoint_research` first for more informed options.","","### How to use compare.md","1. Fill in the decision table \u2014 one row per option","2. State pros, cons, and fit for each","3. Write a **Recommended** line with clear rationale","4. List eliminated approaches to avoid revisiting them","","### Artifact saved","`compare.md` written to `.waypoint/compare.md`.","","### Suggested next step","Run `waypoint_plan` once decisions are recorded."].filter(p=>p!==void 0).join(`
|
|
16
|
+
`)}var R={};w(R,{definition:()=>we,run:()=>be});var we={name:"waypoint_plan",description:"Create a structured plan for new features or significant changes only.",inputSchema:{type:"object",properties:{workspacePath:{type:"string",description:"Absolute path to the workspace root."},scope:{type:"string",description:"Specific scope or milestone to plan (optional). Omit to plan the full goal."}},required:["workspacePath"]}};async function be(i){let{workspacePath:e,scope:t}=i,n=await u(e),a=await d(e,"goal.md"),r=await d(e,"compare.md"),s=await d(e,"research.md");if(!a)return["## waypoint_plan \u2014 No goal found","","Run `waypoint_goal` before planning."].join(`
|
|
17
|
+
`);let c=a.match(/^# Goal\n+(.+)/m)?.[1]??"(goal not parsed)",o=[!s&&"research.md",!r&&"compare.md"].filter(Boolean),p=["# Plan","",`**Goal:** ${c}`,t?`**Scope:** ${t}`:"",o.length>0?`
|
|
18
|
+
> \u26A0\uFE0F Missing prior artifacts: ${o.join(", ")}. Plan may be incomplete.`:"","","## Milestones","<!-- Break the work into 2\u20135 ordered milestones -->","","### Milestone 1 \u2014 Foundation","**Deliverable:** ","**Done when:** ","**Steps:**","- [ ] ","","### Milestone 2 \u2014 Core feature","**Deliverable:** ","**Done when:** ","**Steps:**","- [ ] ","","### Milestone 3 \u2014 Polish & ship","**Deliverable:** ","**Done when:** ","**Steps:**","- [ ] ","","## Dependencies","<!-- External dependencies or blockers between milestones -->","- ","","## Out of scope for this plan","- ","","## Risk register","| Risk | Likelihood | Impact | Mitigation |","|------|-----------|--------|------------|","| | | | |","",`_Generated by waypoint_plan \u2014 ${new Date().toISOString()}_`].filter(l=>l!==void 0).join(`
|
|
19
|
+
`);return await m(e,"plan.md",p),["## waypoint_plan \u2014 Plan generated","",`**Goal:** ${c}`,t?`**Scope:** ${t}`:"",o.length>0?`
|
|
20
|
+
> Missing: ${o.join(", ")} \u2014 plan may be incomplete.`:"","","### Structure","- **3 milestones** scaffolded \u2014 fill in deliverables, done-when criteria, and steps","- **Risk register** \u2014 add any known risks before building","- **Dependencies** \u2014 note anything that must be resolved first","","### Artifact saved","`plan.md` written to `.waypoint/plan.md`.","","### Suggested next step","Run `waypoint_build` to scaffold implementation from this plan."].filter(l=>l!==void 0).join(`
|
|
21
|
+
`)}var O={};w(O,{definition:()=>ve,run:()=>Ae});var ve={name:"waypoint_design",description:"Produce a design contract before building. Infers project tier (Prototype / Product / Platform) from the workspace and plan, confirms with one question, then prescribes patterns, structure, and anti-patterns for Build to follow.",inputSchema:{type:"object",properties:{workspacePath:{type:"string",description:"Absolute path to the workspace root."},tier:{type:"string",enum:["prototype","product","platform"],description:"Explicitly set the project tier (optional). Omit to let waypoint_design infer it from the workspace and ask for confirmation."},focus:{type:"string",description:"Specific area to produce design guidance for (optional). E.g. 'auth layer', 'data access', 'API structure'. Omit to cover the full plan."}},required:["workspacePath"]}};function ke(i,e){let t=0,n=i.fileTree??"",a=(()=>{try{return JSON.parse(i.packageJson??"{}")}catch{return{}}})(),r=Object.keys({...a.dependencies,...a.devDependencies}),s=[n,e??"",i.packageJson??""].join(`
|
|
22
|
+
`).toLowerCase(),c=(n.match(/\n/g)??[]).length;return c>40?t+=2:c>15&&(t+=1),(s.includes("dockerfile")||s.includes("docker-compose"))&&(t+=2),(s.includes(".github/workflows")||s.includes("ci.yml"))&&(t+=1),(s.includes(".env.example")||s.includes("config/"))&&(t+=1),r.some(o=>["prisma","typeorm","sequelize","drizzle","mongoose"].includes(o))&&(t+=2),r.some(o=>["passport","jsonwebtoken","next-auth","clerk"].includes(o))&&(t+=1),r.some(o=>["jest","vitest","mocha","playwright","cypress"].includes(o))&&(t+=1),s.includes("console.log")&&c<10&&(t-=1),(s.includes("todo")||s.includes("fixme"))&&(t-=1),i.packageJson||(t-=1),r.some(o=>["@anthropic-ai/sdk","openai","langchain","@langchain"].includes(o))&&(t+=1),t>=6?{tier:"platform",confidence:"high"}:t>=3?{tier:"product",confidence:t>=4?"high":"medium"}:{tier:"prototype",confidence:t<=1?"high":"medium"}}var D={prototype:{label:"Prototype",description:"Solo or exploratory \u2014 readable, no obvious traps. Avoid premature abstraction.",structure:["Flat file structure \u2014 group by feature, not by layer","Single entry point (index.js / main.py)","Inline config via process.env \u2014 no config module needed yet"],apply:["Meaningful naming \u2014 variables and functions describe intent","No magic numbers \u2014 use named constants even in early code","Early returns to reduce nesting","Basic error handling \u2014 don't silently swallow errors"],avoid:["Dependency injection frameworks \u2014 premature at this scale","Layered architecture (controllers/services/repos) \u2014 adds overhead without benefit","Abstract base classes or interface hierarchies","Over-engineered config systems"],aiNative:["Prompt strings can live inline \u2014 extract to a prompts.js file when there are 3+","LLM calls should have at minimum a try/catch with a readable error message","No observability needed yet \u2014 console.log is fine"]},product:{label:"Product",description:"Small team, real users, will grow \u2014 SOLID basics, modularity, testability.",structure:["Feature-based folders at the top level (e.g. auth/, payments/, users/)","Within each feature: route/handler \u2192 service \u2192 repository/data-access","Shared utilities in lib/ or utils/ \u2014 no circular imports","Config module (config.js) as single source of truth for env vars","Separate entry point from app setup (index.js bootstraps, app.js configures)"],apply:["Single responsibility \u2014 each function/module does one thing","Dependency injection \u2014 pass dependencies as arguments, don't import globals into logic","Input validation at system boundaries (Zod, joi, or equivalent)","Centralized error handling \u2014 one error middleware, not scattered try/catches","Named exports over default exports \u2014 easier to refactor and trace","No direct DB calls in route handlers \u2014 always through a service"],avoid:["God modules \u2014 files over ~200 lines are a warning sign","Hardcoded secrets or environment-specific values in code","Shared mutable state across modules","Deep callback nesting \u2014 use async/await throughout","Direct SDK calls scattered across the codebase \u2014 wrap in a service"],aiNative:["Extract prompt strings to a dedicated prompts/ module \u2014 never inline in business logic","Wrap every LLM call in a resilience layer: retry on transient errors, timeout, fallback message","Agent tool functions must have single responsibility \u2014 one tool = one action","Log token usage at the service layer for cost visibility","Never put raw user input directly into a prompt \u2014 sanitize or structure first"]},platform:{label:"Platform",description:"Multi-team, high scale, long-lived \u2014 full patterns, contracts, observability.",structure:["Domain-driven folder structure \u2014 packages or modules per bounded context","Explicit interface contracts between layers (TypeScript interfaces or JSDoc types)","Shared kernel for cross-cutting concerns (logging, auth, config, errors)","Infrastructure layer isolated from domain logic (ports & adapters)","Separate read and write paths where contention is expected"],apply:["Full SOLID compliance \u2014 especially Open/Closed and Liskov","Repository pattern \u2014 domain logic never touches query syntax","Dependency inversion \u2014 depend on abstractions, inject implementations","Structured logging with correlation IDs on every request","Circuit breakers on all external service calls","Event-driven side effects \u2014 don't couple services via direct calls","Idempotency on all write operations that may be retried"],avoid:["Anemic domain models \u2014 logic belongs in the domain, not scattered in services","Shotgun surgery patterns \u2014 a single change requiring edits in 5+ files","Implicit service coupling \u2014 make dependencies explicit and injectable","Unversioned external contracts (APIs, events, schemas)","Synchronous calls to non-critical services in the request path"],aiNative:["Prompt versioning \u2014 treat prompts as versioned artifacts with changelogs","LLM call abstraction layer \u2014 swap providers without touching business logic","Structured output validation \u2014 never trust LLM output shape, always validate","Agent observability \u2014 trace each tool call with input, output, latency, tokens","Prompt injection hardening \u2014 sanitize all user-controlled content before interpolation","Async agent pipelines \u2014 long-running agent tasks should be queued, not blocking"]}};function xe(i,e){let t=D[i].label;if(e==="high")return`> **Tier inferred: ${t}** (high confidence)
|
|
23
|
+
> If this is wrong, re-run \`waypoint_design\` with an explicit \`tier\` parameter.`;let n=["prototype","product","platform"].filter(a=>a!==i);return[`> **Tier inferred: ${t}** (medium confidence \u2014 mixed signals in the workspace)`,`> If this doesn't match your intent, re-run \`waypoint_design\` with \`tier: "${n[0]}"\` or \`"${n[1]}"\`.`].join(`
|
|
24
|
+
`)}async function Ae(i){let{workspacePath:e,tier:t,focus:n}=i,a=await u(e),r=await d(e,"plan.md"),s=await d(e,"goal.md"),c=await d(e,"compare.md");if(!r&&!s)return["## waypoint_design \u2014 No plan or goal found","","Run `waypoint_goal` \u2192 `waypoint_plan` before producing a design contract.","waypoint_design needs to know what you're building before it can prescribe how to build it."].join(`
|
|
25
|
+
`);let o=s?.match(/^# Goal\n+(.+)/m)?.[1]??"(goal not parsed)",p,l,g;if(t)p=t,l="explicit",g=`> **Tier set explicitly: ${D[p].label}**`;else{let h=ke(a,r);p=h.tier,l=h.confidence,g=xe(p,h.confidence)}let f=D[p],S=n?`
|
|
26
|
+
**Focus:** ${n}`:"",x=!!c,v=x?"":"\n> \u26A0\uFE0F No compare.md found \u2014 design contract is based on goal/plan only. Run `waypoint_compare` for richer context.",k=["# Design","",`**Goal:** ${o}`,S,`**Tier:** ${f.label} \u2014 ${f.description}`,v,"",g,"","## Recommended structure",...f.structure.map(h=>`- ${h}`),"","## Patterns to apply",...f.apply.map(h=>`- ${h}`),"","## Anti-patterns to avoid",...f.avoid.map(h=>`- \u274C ${h}`),"","## AI-native considerations",...f.aiNative.map(h=>`- ${h}`),"","## Design decisions","<!-- Record any project-specific choices made here \u2014 deviations from the above and why -->","- ","","## Contract for Build","<!-- Summarise what Build must honour \u2014 fill this in before handing off -->","- [ ] Follow the recommended structure above","- [ ] Apply all patterns marked for this tier","- [ ] Avoid all listed anti-patterns","- [ ] ","",`_Generated by waypoint_design (${f.label}) \u2014 ${new Date().toISOString()}_`].filter(h=>h!==void 0).join(`
|
|
27
|
+
`);return await m(e,"design.md",k),["## waypoint_design \u2014 Design contract generated","",`**Goal:** ${o}`,`**Tier:** ${f.label}`,n?`**Focus:** ${n}`:"",x?"":"\n> No compare.md \u2014 run `waypoint_compare` for decision context.","","### Contract covers",`- **Structure** \u2014 ${f.structure.length} recommendations`,`- **Patterns to apply** \u2014 ${f.apply.length} rules`,`- **Anti-patterns to avoid** \u2014 ${f.avoid.length} rules`,`- **AI-native** \u2014 ${f.aiNative.length} considerations`,"","### Artifact saved","`design.md` written to `.waypoint/design.md`.","Fill in **Design decisions** for any project-specific deviations, then complete the **Contract for Build** checklist.","","### Suggested next step","Run `waypoint_build` \u2014 it will read `design.md` as a constraint alongside `plan.md`."].filter(h=>h!==void 0).join(`
|
|
28
|
+
`)}var C={};w(C,{definition:()=>Se,run:()=>_e});var Se={name:"waypoint_build",description:"Scaffold and implement. Generate prompts and guidance for AI coding tools.",inputSchema:{type:"object",properties:{workspacePath:{type:"string",description:"Absolute path to the workspace root."},task:{type:"string",description:"Specific build task or milestone to implement (optional). Omit to build from the full plan."}},required:["workspacePath"]}};async function _e(i){let{workspacePath:e,task:t}=i,n=await u(e),a=await d(e,"plan.md"),r=await d(e,"goal.md");if(!a&&!r)return["## waypoint_build \u2014 No plan or goal found","","Run `waypoint_goal` \u2192 `waypoint_plan` before building."].join(`
|
|
29
|
+
`);let s=r?.match(/^# Goal\n+(.+)/m)?.[1]??"(goal not parsed)",c=!!a,o=(()=>{try{return JSON.parse(n.packageJson??"{}").name??"this project"}catch{return"this project"}})(),p=["# Build","",`**Goal:** ${s}`,t?`**Task:** ${t}`:"",c?"":"\n> \u26A0\uFE0F No plan.md found \u2014 consider running `waypoint_plan` first.","","## Implementation checklist","<!-- Track each implementation unit -->","- [ ] Set up project structure / scaffold","- [ ] Implement core logic","- [ ] Wire up integrations","- [ ] Handle edge cases and errors","- [ ] Self-review before handoff to waypoint_test","","## AI coding prompts","<!-- Paste these into your AI coding tool (Claude Code, Cursor, etc.) -->","","### Scaffold prompt","```",`Scaffold the implementation for: ${t??s}`,`Project: ${o}`,"Requirements:","- [fill from plan milestones]","- Keep changes minimal and focused","- No speculative features","```","","### Implementation prompt","```",`Implement: ${t??s}`,"Constraints:","- Match existing code style","- No new dependencies unless necessary","- Write no comments unless the why is non-obvious","```","","## Implementation notes","<!-- Record decisions made during build, gotchas, deviations from plan -->","- ","","## Files changed","<!-- List key files created or modified -->","- ","",`_Generated by waypoint_build \u2014 ${new Date().toISOString()}_`].filter(l=>l!==void 0).join(`
|
|
30
|
+
`);return await m(e,"build.md",p),["## waypoint_build \u2014 Build guide generated","",`**Goal:** ${s}`,t?`**Task:** ${t}`:"",c?"":"\n> No plan.md found \u2014 output may be generic. Run `waypoint_plan` first.","","### AI coding prompts included","- **Scaffold prompt** \u2014 use to create initial structure","- **Implementation prompt** \u2014 use for each milestone or task","","### Artifact saved","`build.md` written to `.waypoint/build.md`.","Fill in the implementation checklist as you work.","","### Suggested next step","Run `waypoint_test` to verify feature-level requirements once implementation is ready."].filter(l=>l!==void 0).join(`
|
|
31
|
+
`)}var G={};w(G,{definition:()=>$e,run:()=>Pe});var $e={name:"waypoint_test",description:"Verify feature-level requirements. Generate test checklists and prompts.",inputSchema:{type:"object",properties:{workspacePath:{type:"string",description:"Absolute path to the workspace root."},feature:{type:"string",description:"Specific feature or behavior to test (optional). Omit to test all built features."}},required:["workspacePath"]}};async function Pe(i){let{workspacePath:e,feature:t}=i,n=await u(e),a=await d(e,"build.md"),r=await d(e,"goal.md");if(!a&&!r)return["## waypoint_test \u2014 No build or goal found","","Run `waypoint_build` before testing."].join(`
|
|
32
|
+
`);let s=r?.match(/^# Goal\n+(.+)/m)?.[1]??"(goal not parsed)",c=!!a,o=t??s,p=["# Test","",`**Goal:** ${s}`,t?`**Feature under test:** ${t}`:"",c?"":`
|
|
33
|
+
> \u26A0\uFE0F No build.md found \u2014 test coverage may be incomplete.`,"","## Feature checklist","<!-- Verify each feature works as intended from a user perspective -->",`- [ ] ${o} \u2014 happy path works end to end`,"- [ ] Edge cases handled correctly","- [ ] Error states produce clear, safe output","- [ ] No regressions in adjacent functionality","","## Test prompts for AI coding tools","","### Unit test prompt","```",`Write unit tests for: ${o}`,"Requirements:","- Test the happy path","- Test at least 2 edge cases","- Test error/failure paths","- No mocks unless absolutely necessary","```","","### Integration test prompt","```",`Write integration tests for: ${o}`,"Requirements:","- Exercise the full stack from entry point to output","- Verify against real data or fixtures, not mocks","- Assert on observable behavior, not implementation details","```","","## Manual test cases","<!-- Scenarios that are hard to automate -->","| Scenario | Steps | Expected | Actual | Pass? |","|----------|-------|----------|--------|-------|","| Happy path | | | | |","| Empty input | | | | |","| Invalid input | | | | |","","## Known gaps","<!-- Tests not written yet and why -->","- ","",`_Generated by waypoint_test \u2014 ${new Date().toISOString()}_`].filter(l=>l!==void 0).join(`
|
|
34
|
+
`);return await m(e,"test.md",p),["## waypoint_test \u2014 Test plan generated","",`**Goal:** ${s}`,t?`**Feature:** ${t}`:"",c?"":`
|
|
35
|
+
> No build.md found \u2014 test plan may be incomplete.`,"","### Coverage areas","- **Feature checklist** \u2014 happy path, edge cases, errors, regressions","- **AI test prompts** \u2014 unit and integration test generation","- **Manual test cases** \u2014 scenarios needing human verification","","### Artifact saved","`test.md` written to `.waypoint/test.md`.","","### Suggested next step","If tests reveal bugs, run `waypoint_fix`. Otherwise run `waypoint_measure` to evaluate overall success."].filter(l=>l!==void 0).join(`
|
|
36
|
+
`)}var F={};w(F,{definition:()=>je,run:()=>Ie});var je={name:"waypoint_fix",description:"Targeted bug patches with minimal footprint.",inputSchema:{type:"object",properties:{workspacePath:{type:"string",description:"Absolute path to the workspace root."},bug:{type:"string",description:"Description of the bug to fix (optional). Omit to review existing fix.md."}},required:["workspacePath"]}};async function Ie(i){let{workspacePath:e,bug:t}=i,n=await u(e),a=await d(e,"build.md"),r=await d(e,"goal.md"),s=await d(e,"fix.md");if(!t&&!s)return["## waypoint_fix \u2014 No bug description provided","","Call `waypoint_fix` with a `bug` parameter describing the problem.",'Example: _"Tool returns isError:true when workspacePath has spaces"_',"",a?"":"Run `waypoint_build` first to establish a build baseline."].filter(Boolean).join(`
|
|
37
|
+
`);let c=t??s?.match(/^## Bug\n+(.+)/m)?.[1]??"(bug not parsed)",o=r?.match(/^# Goal\n+(.+)/m)?.[1]??"(goal not parsed)",p=!!a,l=["# Fix","","## Bug",c,"",`**Goal context:** ${o}`,p?"":`
|
|
38
|
+
> \u26A0\uFE0F No build.md found \u2014 fix has no established baseline.`,"","## Root cause hypothesis","<!-- What is causing this bug? Be specific. -->","- ","","## Fix approach","**Principle:** minimal footprint \u2014 change only what is necessary to fix this bug.","","### AI fix prompt","```",`Fix the following bug: ${c}`,"","Constraints:","- Change only the code required to fix this specific bug","- Do not refactor surrounding code","- Do not add features or improve unrelated behavior","- Verify the fix does not break adjacent functionality","```","","## Changes made","<!-- List exact files and lines changed -->","| File | Line(s) | Change |","|------|---------|--------|","| | | |","","## Verification","- [ ] Bug no longer reproduced with original steps","- [ ] No regressions in adjacent functionality","- [ ] Fix is the minimum change required","",`_Generated by waypoint_fix \u2014 ${new Date().toISOString()}_`].filter(g=>g!==void 0).join(`
|
|
39
|
+
`);return await m(e,"fix.md",l),["## waypoint_fix \u2014 Fix guide generated","",`**Bug:** ${c}`,p?"":`
|
|
40
|
+
> No build.md found \u2014 fix has no baseline context.`,"","### Approach","- Minimal footprint: only change what fixes this bug","- AI fix prompt included \u2014 paste into Claude Code or Cursor","- Verification checklist: confirm no regressions","","### Artifact saved","`fix.md` written to `.waypoint/fix.md`.","","### Suggested next step","Run `waypoint_test` after applying the fix to confirm no regressions."].filter(g=>g!==void 0).join(`
|
|
41
|
+
`)}var T={};w(T,{definition:()=>Ne,run:()=>Re});var Ne={name:"waypoint_debug",description:"Read-only diagnostics. Mode troubleshoot = root cause framing. Mode trace = execution path analysis.",inputSchema:{type:"object",properties:{workspacePath:{type:"string",description:"Absolute path to the workspace root."},mode:{type:"string",enum:["troubleshoot","trace"],description:"troubleshoot = root cause framing. trace = execution path analysis."},symptom:{type:"string",description:"Observed symptom or failure to diagnose (optional)."}},required:["workspacePath","mode"]}};async function Re(i){let{workspacePath:e,mode:t,symptom:n}=i,a=await u(e),r=await d(e,"build.md"),c=(await d(e,"goal.md"))?.match(/^# Goal\n+(.+)/m)?.[1]??"(no goal defined)",o=n??"unspecified symptom",p;t==="troubleshoot"?p=["## Troubleshoot \u2014 Root cause framing","",`**Symptom:** ${o}`,"","### Is/Is-not analysis","| Dimension | Is | Is Not |","|-----------|-----|--------|","| What | | |","| Where | | |","| When | | |","| Extent | | |","","### Root cause hypotheses","<!-- Rank by likelihood \u2014 most likely first -->","1. ","2. ","3. ","","### Diagnostic steps","<!-- Ordered read-only checks to confirm or rule out each hypothesis -->","- [ ] Check logs for errors around the time of symptom","- [ ] Reproduce symptom in isolation","- [ ] Identify the last known good state","- [ ] Diff current state against known good","","### AI diagnostic prompt","```",`Diagnose the following symptom without modifying any code: ${o}`,"","Steps:","1. Identify the likely root cause","2. List evidence that supports or refutes each hypothesis","3. Propose the minimal targeted fix \u2014 do not implement it yet","```"]:p=["## Trace \u2014 Execution path analysis","",`**Symptom:** ${o}`,"","### Entry point","<!-- Where does execution begin for this flow? -->","- ","","### Execution path","<!-- Step-by-step: function \u2192 function \u2192 output -->","1. ","2. ","3. ","","### Observed vs expected at each step","| Step | Expected | Observed | Diverges? |","|------|----------|----------|-----------|","| | | | |","","### Divergence point","<!-- Where exactly does actual behavior first differ from expected? -->","- ","","### AI trace prompt","```",`Trace the execution path for: ${o}`,"","Without modifying any code:","1. Follow the call chain from entry point to output","2. Identify where the observed behavior first diverges from expected","3. Explain why that divergence occurs","```"];let l=["# Diagnose","",`**Mode:** ${t}`,`**Goal context:** ${c}`,r?"":`
|
|
42
|
+
> \u26A0\uFE0F No build.md found \u2014 diagnosis has no build baseline.`,"",...p,"","## Workspace snapshot",`**Files:**
|
|
43
|
+
\`\`\`
|
|
44
|
+
${a.fileTree}
|
|
45
|
+
\`\`\``,"",`_Generated by waypoint_debug (${t}) \u2014 ${new Date().toISOString()}_`].filter(g=>g!==void 0).join(`
|
|
46
|
+
`);return await m(e,"debug.md",l),[`## waypoint_debug \u2014 ${t==="troubleshoot"?"Troubleshoot":"Trace"} guide generated`,"",`**Mode:** ${t}`,`**Symptom:** ${o}`,"",t==="troubleshoot"?["### Framework: Is/Is-not analysis","Define what the symptom IS and IS NOT across: what, where, when, extent.","Rank hypotheses by likelihood. Run diagnostic steps read-only first."].join(`
|
|
47
|
+
`):["### Framework: Execution path trace","Map the call chain from entry point to output.","Find the exact step where observed behavior diverges from expected."].join(`
|
|
48
|
+
`),"","### Artifact saved","`debug.md` written to `.waypoint/debug.md`.","","### Suggested next step","Run `waypoint_fix` once the root cause is confirmed."].join(`
|
|
49
|
+
`)}var q={};w(q,{definition:()=>De,run:()=>Ge});var De={name:"waypoint_audit",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.",inputSchema:{type:"object",properties:{workspacePath:{type:"string",description:"Absolute path to the workspace root."},tier:{type:"string",enum:["prototype","product","platform"],description:"Explicitly set the project tier (optional). Omit to let waypoint_audit infer it and ask for confirmation."},focus:{type:"string",description:"Specific file, folder, or concern to audit (optional). E.g. 'auth/', 'routes/user.js', 'error handling'. Omit to audit the full codebase."}},required:["workspacePath"]}};function Oe(i){let e=0,t=i.fileTree??"",n=(()=>{try{return JSON.parse(i.packageJson??"{}")}catch{return{}}})(),a=Object.keys({...n.dependencies,...n.devDependencies}),r=[t,i.packageJson??""].join(`
|
|
50
|
+
`).toLowerCase(),s=(t.match(/\n/g)??[]).length;return s>40?e+=2:s>15&&(e+=1),(r.includes("dockerfile")||r.includes("docker-compose"))&&(e+=2),(r.includes(".github/workflows")||r.includes("ci.yml"))&&(e+=1),(r.includes(".env.example")||r.includes("config/"))&&(e+=1),a.some(c=>["prisma","typeorm","sequelize","drizzle","mongoose"].includes(c))&&(e+=2),a.some(c=>["passport","jsonwebtoken","next-auth","clerk"].includes(c))&&(e+=1),a.some(c=>["jest","vitest","mocha","playwright","cypress"].includes(c))&&(e+=1),a.some(c=>["@anthropic-ai/sdk","openai","langchain"].includes(c))&&(e+=1),r.includes("console.log")&&s<10&&(e-=1),i.packageJson||(e-=1),e>=6?{tier:"platform",confidence:"high"}:e>=3?{tier:"product",confidence:e>=4?"high":"medium"}:{tier:"prototype",confidence:e<=1?"high":"medium"}}var L=[{id:"secrets",label:"Hardcoded secrets or credentials in code",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.",severity:{prototype:"must",product:"must",platform:"must"}},{id:"no-error-handling",label:"Unhandled promise rejections or missing try/catch on I/O",detail:"Silent failures corrupt state and are hard to debug in production. Every async I/O path needs explicit error handling.",severity:{prototype:"must",product:"must",platform:"must"}},{id:"god-file",label:"God file or module (single file doing too much)",detail:"Files over ~200 lines that mix concerns (routing, logic, data access) become hard to test and change. Split by responsibility.",severity:{prototype:"should",product:"must",platform:"must"}},{id:"auth-inline",label:"Auth logic inside route handlers",detail:"Auth mixed into handlers can't be tested in isolation and is easy to omit on new routes. Extract to middleware.",severity:{prototype:"should",product:"must",platform:"must"}},{id:"no-input-validation",label:"No input validation at system boundaries",detail:"Unvalidated input leads to silent data corruption and security risks. Add schema validation (Zod, joi) before handler logic.",severity:{prototype:"should",product:"must",platform:"must"}},{id:"no-service-layer",label:"Direct DB or external API calls in route handlers",detail:"Bypassing a service layer makes testing require real infrastructure and makes the DB/API harder to swap. Add a services/ or repositories/ layer.",severity:{prototype:"consider",product:"should",platform:"must"}},{id:"scattered-env",label:"Scattered process.env access throughout the codebase",detail:"Direct process.env reads in multiple files make config hard to audit and validate. Centralise in a config module.",severity:{prototype:"consider",product:"should",platform:"must"}},{id:"no-tests",label:"No automated tests",detail:"Without tests, changes regress silently. Add at minimum unit tests for core logic and one integration test per entry point.",severity:{prototype:"consider",product:"should",platform:"must"}},{id:"magic-values",label:"Magic numbers or strings in logic",detail:"Unexplained literals (timeouts, limits, status codes) are hard to understand and change safely. Use named constants.",severity:{prototype:"should",product:"should",platform:"must"}},{id:"no-logging",label:"No structured logging",detail:"console.log is fine early on, but structured logging (with levels and context) is needed before onboarding a team or going to production.",severity:{prototype:"consider",product:"consider",platform:"must"}},{id:"inconsistent-naming",label:"Inconsistent naming conventions",detail:"Mixed camelCase/snake_case, unclear abbreviations, or generic names (data, result, obj) slow down reading. Align on a convention and apply it.",severity:{prototype:"consider",product:"should",platform:"should"}},{id:"inline-prompts",label:"Prompt strings hardcoded inline in business logic",detail:"Inline prompt strings mix concerns and make prompt iteration require code changes. Extract to a dedicated prompts/ module.",severity:{prototype:"consider",product:"should",platform:"must"}},{id:"no-llm-resilience",label:"LLM calls without retry or error handling",detail:"LLM APIs are unreliable \u2014 timeouts, rate limits, and transient errors are common. Wrap every call in retry logic with a fallback.",severity:{prototype:"should",product:"must",platform:"must"}},{id:"fat-agent-tools",label:"Agent tool functions with multiple responsibilities",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.",severity:{prototype:"consider",product:"should",platform:"must"}},{id:"no-llm-observability",label:"No token usage or cost tracking on LLM calls",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.",severity:{prototype:"consider",product:"consider",platform:"must"}}],A={prototype:"Prototype",product:"Product",platform:"Platform"};function Ce(i,e,t){if(t)return`> **Tier set explicitly: ${A[i]}**`;if(e==="high")return`> **Tier inferred: ${A[i]}** (high confidence)
|
|
51
|
+
> If this is wrong, re-run \`waypoint_audit\` with an explicit \`tier\` parameter.`;let n=["prototype","product","platform"].filter(a=>a!==i);return[`> **Tier inferred: ${A[i]}** (medium confidence \u2014 mixed signals)`,`> Re-run with \`tier: "${n[0]}"\` or \`"${n[1]}"\` if this doesn't match your intent.`].join(`
|
|
52
|
+
`)}async function Ge(i){let{workspacePath:e,tier:t,focus:n}=i,a=await u(e),r=await d(e,"build.md"),s=await d(e,"goal.md"),c=await d(e,"design.md"),o=await d(e,"fix.md"),p=s?.match(/^# Goal\n+(.+)/m)?.[1]??"(no goal defined)",l,g;if(t)l=t,g="explicit";else{let y=Oe(a);l=y.tier,g=y.confidence}let f=A[l],S=Ce(l,g,!!t),x=[!r&&!s&&"> \u2139\uFE0F No EDP context found \u2014 running as standalone audit on existing codebase.",!r&&s&&"> \u26A0\uFE0F No build.md found \u2014 audit has no build baseline.",c&&"> \u2705 design.md found \u2014 checking compliance with design contract.",o&&"> \u2139\uFE0F fix.md present \u2014 checking that recent fixes haven't introduced structural drift."].filter(Boolean),v=L.filter(y=>y.severity[l]==="must"),k=L.filter(y=>y.severity[l]==="should"),h=L.filter(y=>y.severity[l]==="consider"),K=(()=>{try{return JSON.parse(a.packageJson??"{}")}catch{return{}}})(),z=Object.keys({...K.dependencies,...K.devDependencies}).some(y=>["@anthropic-ai/sdk","openai","langchain","@langchain"].includes(y)),Z=["inline-prompts","no-llm-resilience","fat-agent-tools","no-llm-observability"];function _(y){return y.length===0?["_None at this tier._"]:y.flatMap(($,oe)=>{let ie=Z.includes($.id),ne=z&&ie?" _(AI-native)_":"",ae=n?` _(check in: ${n})_`:"";return[`### ${oe+1}. ${$.label}${ne}`,`${$.detail}${ae}`,"- [ ] Investigated","- [ ] Action taken or explicitly deferred",""]})}let X=["# Audit","",`**Goal:** ${p}`,n?`**Focus:** ${n}`:"",`**Tier:** ${f}`,...x,"",S,"","## Must Fix","<!-- Address these before shipping or sharing this code -->","",..._(v),"## Should Fix","<!-- Address before next release or when touching this area -->","",..._(k),"## Consider Later","<!-- Worth doing at scale \u2014 not urgent at current tier -->","",..._(h),"## Design contract compliance",c?"<!-- Check findings against the contract in design.md -->":"<!-- No design.md found \u2014 run `waypoint_design` to establish a contract, then re-audit -->","- [ ] All Must Fix items from the design contract are addressed","- [ ] Structure matches design.md recommendations","","## Audit summary","| Severity | Count |","|----------|-------|",`| Must Fix | ${v.length} |`,`| Should Fix | ${k.length} |`,`| Consider Later | ${h.length} |`,"","**Overall verdict:**","<!-- \u2705 Clean | \u26A0\uFE0F Needs attention | \u274C Significant issues -->","",`_Generated by waypoint_audit (${f}) \u2014 ${new Date().toISOString()}_`].filter(y=>y!==void 0).join(`
|
|
53
|
+
`);await m(e,"audit.md",X);let Y=v.length>0,ee=k.length>0,te=Y?"Run `waypoint_fix` for Must Fix items \u2014 minimal targeted patches. Then re-run `waypoint_audit` to confirm.":ee?"No Must Fix items. Run `waypoint_improve` to work through Should Fix items as structured refactors.":"No Must Fix or Should Fix items. Run `waypoint_review` for a final pre-ship quality check.";return["## waypoint_audit \u2014 Audit complete","",`**Tier:** ${f}`,`**Goal:** ${p}`,n?`**Focus:** ${n}`:"",z?"**AI-native patterns:** checked":"","","### Findings summary",`- **Must Fix:** ${v.length} \u2014 address before shipping`,`- **Should Fix:** ${k.length} \u2014 address before next release`,`- **Consider Later:** ${h.length} \u2014 low urgency at current tier`,"","### Artifact saved","`audit.md` written to `.waypoint/audit.md`.","Work through each checklist item \u2014 check off as you investigate and act.","","### Suggested next step",te].filter(y=>y!==void 0).join(`
|
|
54
|
+
`)}var M={};w(M,{definition:()=>Fe,run:()=>Te});var Fe={name:"waypoint_measure",description:"Evaluate overall project success against defined goals.",inputSchema:{type:"object",properties:{workspacePath:{type:"string",description:"Absolute path to the workspace root."}},required:["workspacePath"]}};async function Te(i){let{workspacePath:e}=i,t=await u(e),n=await d(e,"goal.md"),a=await d(e,"build.md"),r=await d(e,"test.md");if(!n)return["## waypoint_measure \u2014 No goal found","","Run `waypoint_goal` first \u2014 measurement requires a defined goal to evaluate against."].join(`
|
|
55
|
+
`);let s=n.match(/^# Goal\n+(.+)/m)?.[1]??"(goal not parsed)",o=(n.match(/## Success criteria\n([\s\S]*?)(?=\n##|$)/)?.[1]?.trim()??"").split(`
|
|
56
|
+
`).filter(f=>f.trim().startsWith("- [")).map(f=>f.trim()),p=o.length>0?o.map(f=>`| ${f} | | |`):["| - (no criteria defined in goal.md) | | |"],l=[!a&&"build.md",!r&&"test.md"].filter(Boolean),g=["# Measure","",`**Goal:** ${s}`,l.length>0?`
|
|
57
|
+
> \u26A0\uFE0F Missing: ${l.join(", ")} \u2014 measurement may be incomplete.`:"","","## Success criteria scorecard","| Criterion | Status | Evidence |","|-----------|--------|----------|",...p,"","## Overall verdict","<!-- One of: \u2705 Goal met | \u26A0\uFE0F Partially met | \u274C Not met -->","**Verdict:** ","**Summary:** ","","## What worked well","- ","","## What fell short","- ","","## Quantitative signals","<!-- Add any measurable data: test pass rate, latency, bundle size, etc. -->","| Metric | Target | Actual | Pass? |","|--------|--------|--------|-------|","| | | | |","",`_Generated by waypoint_measure \u2014 ${new Date().toISOString()}_`].filter(f=>f!==void 0).join(`
|
|
58
|
+
`);return await m(e,"measure.md",g),["## waypoint_measure \u2014 Measurement framework generated","",`**Goal:** ${s}`,l.length>0?`
|
|
59
|
+
> Missing: ${l.join(", ")} \u2014 add these for fuller measurement.`:"","",o.length>0?`**${o.length} success criteria** pulled from goal.md into scorecard.`:"**No success criteria found in goal.md.** Fill in the scorecard manually.","","### How to use measure.md","1. Score each criterion: \u2705 met / \u26A0\uFE0F partial / \u274C not met","2. Add evidence for each","3. Record quantitative signals where available","4. Write the overall verdict","","### Artifact saved","`measure.md` written to `.waypoint/measure.md`.","","### Suggested next step","Run `waypoint_improve` to identify refinements based on what fell short."].filter(f=>f!==void 0).join(`
|
|
60
|
+
`)}var B={};w(B,{definition:()=>Le,run:()=>qe});var Le={name:"waypoint_improve",description:"Propose refinements. Distinguish must-haves from optional enhancements.",inputSchema:{type:"object",properties:{workspacePath:{type:"string",description:"Absolute path to the workspace root."},area:{type:"string",description:"Specific area to improve (optional). Omit to generate improvements across all areas."}},required:["workspacePath"]}};async function qe(i){let{workspacePath:e,area:t}=i,n=await u(e),a=await d(e,"goal.md"),r=await d(e,"measure.md"),s=await d(e,"build.md");if(!a)return["## waypoint_improve \u2014 No goal found","","Run `waypoint_goal` first \u2014 improvements require a defined goal to improve toward."].join(`
|
|
61
|
+
`);let c=a.match(/^# Goal\n+(.+)/m)?.[1]??"(goal not parsed)",o=!!r,p=["# Improve","",`**Goal:** ${c}`,t?`**Area:** ${t}`:"",o?"":"\n> \u26A0\uFE0F No measure.md found \u2014 running `waypoint_measure` first gives better improvement signals.","","## Must-have improvements","<!-- Fixes that affect correctness, reliability, or core usability \u2014 do these now -->","- [ ] ","","## Should-have improvements","<!-- Meaningful quality improvements \u2014 do before next major release -->","- [ ] ","","## Nice-to-have enhancements","<!-- Optional upgrades \u2014 only if time and priority allow -->","- [ ] ","","## Out of scope","<!-- Improvements explicitly not being pursued and why -->","- ","","## Improvement prompts for AI coding tools","","### Refactor prompt","```",`Improve the following area without changing behavior: ${t??c}`,"","Constraints:","- Do not change externally observable behavior","- Keep changes focused on the area being improved","- Prefer simplicity over cleverness","```","",`_Generated by waypoint_improve \u2014 ${new Date().toISOString()}_`].filter(l=>l!==void 0).join(`
|
|
62
|
+
`);return await m(e,"improve.md",p),["## waypoint_improve \u2014 Improvement plan generated","",`**Goal:** ${c}`,t?`**Area:** ${t}`:"",o?"":"\n> No measure.md found \u2014 run `waypoint_measure` for data-driven improvements.","","### Three tiers","- **Must-have** \u2014 correctness and reliability issues; do these now","- **Should-have** \u2014 meaningful quality improvements; do before next release","- **Nice-to-have** \u2014 optional enhancements; defer unless time allows","","### Artifact saved","`improve.md` written to `.waypoint/improve.md`.","","### Suggested next step","Run `waypoint_document` to document the improved state, or `waypoint_review` for a final quality check."].filter(l=>l!==void 0).join(`
|
|
63
|
+
`)}var E={};w(E,{definition:()=>Me,run:()=>Be});var Me={name:"waypoint_document",description:"Generate documentation for the current state of the project.",inputSchema:{type:"object",properties:{workspacePath:{type:"string",description:"Absolute path to the workspace root."},audience:{type:"string",description:"Intended audience for the documentation (optional). E.g. 'new contributors', 'end users', 'API consumers'."}},required:["workspacePath"]}};async function Be(i){let{workspacePath:e,audience:t}=i,n=await u(e),a=await d(e,"goal.md"),r=await d(e,"build.md"),s=await d(e,"plan.md"),c=a?.match(/^# Goal\n+(.+)/m)?.[1]??"(goal not defined)",o=(()=>{try{let g=JSON.parse(n.packageJson??"{}");return{name:g.name??"this project",version:g.version??"0.0.0",description:g.description??""}}catch{return{name:"this project",version:"0.0.0",description:""}}})(),p=t??"contributors and users",l=["# Documentation","",`**Project:** ${o.name} v${o.version}`,o.description?`**Description:** ${o.description}`:"",`**Audience:** ${p}`,"","## What this is",`<!-- 2-3 sentences explaining what ${o.name} does and why it exists -->`,c!=="(goal not defined)"?c:"","","## How it works","<!-- High-level architecture or flow \u2014 no code, just concepts -->","","```",n.fileTree,"```","","## Getting started","","### Prerequisites","- ","","### Installation","```sh","# installation steps","```","","### Quick start","```sh","# minimal working example","```","","## Key concepts","<!-- Define the 3-5 concepts a reader must understand to use this effectively -->","","### Concept 1","<!-- What it is and why it matters -->","","## Reference","<!-- API, CLI flags, configuration options \u2014 one sub-section per entry point -->","","## Known limitations","- ","",`_Generated by waypoint_document \u2014 ${new Date().toISOString()}_`].filter(g=>g!==void 0).join(`
|
|
64
|
+
`);return await m(e,"docs.md",l),["## waypoint_document \u2014 Documentation generated","",`**Project:** ${o.name} v${o.version}`,`**Audience:** ${p}`,"","### Sections scaffolded","- **What this is** \u2014 project purpose pulled from goal.md","- **How it works** \u2014 architecture overview with file tree","- **Getting started** \u2014 prerequisites, install, quick start","- **Key concepts** \u2014 fill in 3-5 concepts readers need","- **Reference** \u2014 API/CLI/config reference","- **Known limitations** \u2014 be honest about what doesn't work yet","","### Artifact saved","`docs.md` written to `.waypoint/docs.md`.","","### Suggested next step","Run `waypoint_review` for a final quality check before shipping."].join(`
|
|
65
|
+
`)}var J={};w(J,{definition:()=>Ee,run:()=>We});var Ee={name:"waypoint_review",description:"Final quality check before shipping or handoff. Reads all prior artifacts.",inputSchema:{type:"object",properties:{workspacePath:{type:"string",description:"Absolute path to the workspace root."}},required:["workspacePath"]}},W=["goal.md","research.md","compare.md","plan.md","design.md","build.md","test.md","fix.md","debug.md","audit.md","measure.md","improve.md","docs.md"];async function We(i){let{workspacePath:e}=i,t=await u(e),n=await d(e,"goal.md");if(!n)return["## waypoint_review \u2014 No goal found","","Run `waypoint_goal` first \u2014 review requires a defined goal to evaluate against."].join(`
|
|
66
|
+
`);let a=n.match(/^# Goal\n+(.+)/m)?.[1]??"(goal not parsed)",r=[];for(let l of W){let g=await d(e,l);r.push({name:l,present:!!g})}let s=r.filter(l=>l.present),c=r.filter(l=>!l.present),o=r.map(l=>`| ${l.name} | ${l.present?"\u2705":"\u274C"} |`),p=["# Review","",`**Goal:** ${a}`,"","## Artifact inventory","| Artifact | Present |","|----------|---------|",...o,"",`**${s.length} of ${W.length} artifacts present.**`,c.length>0?`Missing: ${c.map(l=>l.name).join(", ")}`:"All artifacts present.","","## Pre-ship checklist","<!-- Work through these before marking done -->","","### Goal","- [ ] Goal is clearly stated and success criteria are defined","- [ ] All success criteria are met (see measure.md)","","### Code quality","- [ ] No dead code or commented-out blocks","- [ ] No hardcoded values that should be configuration","- [ ] Error states produce safe, clear output","","### Tests","- [ ] Happy path tested","- [ ] Edge cases tested","- [ ] No known failing tests","","### Documentation","- [ ] README or docs.md reflects current state","- [ ] Breaking changes documented","","### Security","- [ ] No secrets or credentials in code or artifacts","- [ ] Input validation at system boundaries","","## Reviewer notes","<!-- Open issues, questions for the team, or follow-up items -->","- ","","## Verdict","<!-- \u2705 Ready to ship | \u26A0\uFE0F Ship with caveats | \u274C Not ready -->","**Verdict:** ","**Rationale:** ","",`_Generated by waypoint_review \u2014 ${new Date().toISOString()}_`].join(`
|
|
67
|
+
`);return await m(e,"review.md",p),["## waypoint_review \u2014 Final review generated","",`**Goal:** ${a}`,"",`### Artifact inventory: ${s.length}/${W.length} present`,...r.map(l=>`- ${l.present?"\u2705":"\u274C"} ${l.name}`),"","### Pre-ship checklist covers","Goal, code quality, tests, documentation, security","","### Artifact saved","`review.md` written to `.waypoint/review.md`.","Complete the checklist and record your verdict.","",c.length>0?`### Missing artifacts
|
|
68
|
+
Consider running: ${c.map(l=>`\`waypoint_${l.name.replace(".md","")}\``).join(", ")}`:"### All artifacts present \u2014 ready for final checklist."].join(`
|
|
69
|
+
`)}import{createRequire as Ve}from"module";var Q=[j,I,N,R,O,C,G,F,T,q,M,B,E,J],{version:Ue}=Ve(import.meta.url)("../package.json"),H=new Je({name:"waypoint-mcp",version:Ue},{capabilities:{tools:{}}});H.setRequestHandler(Ke,async()=>({tools:Q.map(i=>i.definition)}));H.setRequestHandler(ze,async i=>{let{name:e,arguments:t}=i.params,n=Q.find(a=>a.definition.name===e);if(!n)return{content:[{type:"text",text:`Unknown tool: ${e}`}],isError:!0};try{return{content:[{type:"text",text:await n.run(t)}]}}catch(a){return{content:[{type:"text",text:`Tool error: ${a instanceof Error?a.message:String(a)}`}],isError:!0}}});var Qe=new He;await H.connect(Qe);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@waycraft/waypoint-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "A structured development protocol as an MCP server. 14 tools that guide any project from goal to ship.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,17 +21,23 @@
|
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
|
-
"build": "
|
|
24
|
+
"build": "node build.js",
|
|
25
25
|
"start": "node dist/index.js",
|
|
26
26
|
"dev": "tsx src/index.ts",
|
|
27
27
|
"test": "tsx tests/goal.test.ts && tsx tests/research.test.ts && tsx tests/compare.test.ts && tsx tests/plan.test.ts && tsx tests/build.test.ts && tsx tests/test.test.ts && tsx tests/fix.test.ts && tsx tests/debug.test.ts && tsx tests/measure.test.ts && tsx tests/improve.test.ts && tsx tests/document.test.ts && tsx tests/review.test.ts",
|
|
28
|
-
"prepare": "
|
|
28
|
+
"prepare": "node build.js"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@modelcontextprotocol/sdk": "^1.0.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/node": "^22.0.0",
|
|
35
|
+
"esbuild": "^0.28.0",
|
|
36
|
+
"pptxgenjs": "^4.0.1",
|
|
37
|
+
"react": "^19.2.7",
|
|
38
|
+
"react-dom": "^19.2.7",
|
|
39
|
+
"react-icons": "^5.6.0",
|
|
40
|
+
"sharp": "^0.34.5",
|
|
35
41
|
"tsx": "^4.0.0",
|
|
36
42
|
"typescript": "^5.0.0"
|
|
37
43
|
}
|
package/dist/context.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { readFile, writeFile, readdir, mkdir, stat } from "fs/promises";
|
|
2
|
-
import { join, relative } from "path";
|
|
3
|
-
const SKIP_DIRS = new Set([
|
|
4
|
-
"node_modules", ".git", "dist", "build", ".next", ".nuxt",
|
|
5
|
-
"coverage", ".cache", ".turbo", "out",
|
|
6
|
-
]);
|
|
7
|
-
async function listTree(dir, depth, root) {
|
|
8
|
-
if (depth === 0)
|
|
9
|
-
return [];
|
|
10
|
-
let entries;
|
|
11
|
-
try {
|
|
12
|
-
entries = await readdir(dir);
|
|
13
|
-
}
|
|
14
|
-
catch {
|
|
15
|
-
return [];
|
|
16
|
-
}
|
|
17
|
-
const lines = [];
|
|
18
|
-
for (const entry of entries.sort()) {
|
|
19
|
-
if (entry.startsWith(".") && entry !== ".waypoint")
|
|
20
|
-
continue;
|
|
21
|
-
if (SKIP_DIRS.has(entry))
|
|
22
|
-
continue;
|
|
23
|
-
const full = join(dir, entry);
|
|
24
|
-
const rel = relative(root, full);
|
|
25
|
-
let isDir = false;
|
|
26
|
-
try {
|
|
27
|
-
isDir = (await stat(full)).isDirectory();
|
|
28
|
-
}
|
|
29
|
-
catch {
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
lines.push(isDir ? `${rel}/` : rel);
|
|
33
|
-
if (isDir) {
|
|
34
|
-
lines.push(...await listTree(full, depth - 1, root));
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return lines;
|
|
38
|
-
}
|
|
39
|
-
export async function getBaseContext(workspacePath) {
|
|
40
|
-
const treeLines = await listTree(workspacePath, 2, workspacePath);
|
|
41
|
-
const fileTree = treeLines.length > 0 ? treeLines.join("\n") : "(empty workspace)";
|
|
42
|
-
let packageJson = null;
|
|
43
|
-
try {
|
|
44
|
-
packageJson = await readFile(join(workspacePath, "package.json"), "utf8");
|
|
45
|
-
}
|
|
46
|
-
catch {
|
|
47
|
-
// not a Node project — fine
|
|
48
|
-
}
|
|
49
|
-
const waypointArtifacts = {};
|
|
50
|
-
const waypointDir = join(workspacePath, ".waypoint");
|
|
51
|
-
try {
|
|
52
|
-
const files = await readdir(waypointDir);
|
|
53
|
-
for (const file of files.sort()) {
|
|
54
|
-
try {
|
|
55
|
-
waypointArtifacts[file] = await readFile(join(waypointDir, file), "utf8");
|
|
56
|
-
}
|
|
57
|
-
catch {
|
|
58
|
-
// skip unreadable files
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
catch {
|
|
63
|
-
// no .waypoint directory yet — fine
|
|
64
|
-
}
|
|
65
|
-
return { workspacePath, fileTree, packageJson, waypointArtifacts };
|
|
66
|
-
}
|
|
67
|
-
export async function getArtifact(workspacePath, filename) {
|
|
68
|
-
try {
|
|
69
|
-
return await readFile(join(workspacePath, ".waypoint", filename), "utf8");
|
|
70
|
-
}
|
|
71
|
-
catch {
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
export async function saveArtifact(workspacePath, filename, content) {
|
|
76
|
-
const waypointDir = join(workspacePath, ".waypoint");
|
|
77
|
-
await mkdir(waypointDir, { recursive: true });
|
|
78
|
-
await writeFile(join(waypointDir, filename), content, "utf8");
|
|
79
|
-
}
|