glenn-code 1.0.0 → 1.0.2

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/core.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // Glenn Code - Bundled and minified
2
2
  // (c) DNM Lab - All rights reserved
3
3
 
4
- import{createSdkMcpServer as lt}from"@anthropic-ai/claude-agent-sdk";import{tool as ne}from"@anthropic-ai/claude-agent-sdk";import{z as te}from"zod";import*as se from"fs";import*as Re from"path";var I=null;function Ie(e){I=e}function me(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}var xt=ne("save_specification",`Save a specification to the database.
4
+ import{createSdkMcpServer as ut}from"@anthropic-ai/claude-agent-sdk";import{tool as oe}from"@anthropic-ai/claude-agent-sdk";import{z as se}from"zod";import*as re from"fs";import*as De from"path";var I=null;function Oe(e){I=e}function me(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}var It=oe("save_specification",`Save a specification to the database.
5
5
 
6
6
  IMPORTANT: First write the specification content to a file using the Write tool, then call this with the file path.
7
7
 
@@ -12,10 +12,10 @@ Workflow:
12
12
 
13
13
  Example:
14
14
  1. Write tool \u2192 save to /tmp/user-auth-spec.md
15
- 2. save_specification(name: "User Authentication", filePath: "/tmp/user-auth-spec.md")`,{name:te.string().describe("Specification name (e.g., 'User Authentication')"),filePath:te.string().describe("Path to the file containing the specification content (written via Write tool)")},async e=>{if(!I)return{content:[{type:"text",text:"\u274C Planning transport not initialized"}]};let t=Re.resolve(e.filePath);if(!se.existsSync(t))return{content:[{type:"text",text:`\u274C File not found: ${e.filePath}. Use Write tool first to create the file.`}]};let n=se.readFileSync(t,"utf-8"),a=me(e.name);return await I.saveSpecification(a,n),{content:[{type:"text",text:`\u2705 Saved specification: ${a}.spec.md`}]}}),Rt=ne("read_specification","Read the content of a specification.",{name:te.string().describe("Name of the specification to read")},async e=>{if(!I)return{content:[{type:"text",text:"\u274C Planning transport not initialized"}]};let t=me(e.name),n=await I.getSpecification(t);return n?{content:[{type:"text",text:n}]}:{content:[{type:"text",text:`\u274C Specification "${e.name}" not found.`}]}}),It=ne("list_specifications","List all specifications.",{},async()=>{if(!I)return{content:[{type:"text",text:"\u274C Planning transport not initialized"}]};let e=await I.listSpecifications();return e.length===0?{content:[{type:"text",text:"\u{1F4CB} No specifications found."}]}:{content:[{type:"text",text:`\u{1F4CB} Specifications:
15
+ 2. save_specification(name: "User Authentication", filePath: "/tmp/user-auth-spec.md")`,{name:se.string().describe("Specification name (e.g., 'User Authentication')"),filePath:se.string().describe("Path to the file containing the specification content (written via Write tool)")},async e=>{if(!I)return{content:[{type:"text",text:"\u274C Planning transport not initialized"}]};let t=De.resolve(e.filePath);if(!re.existsSync(t))return{content:[{type:"text",text:`\u274C File not found: ${e.filePath}. Use Write tool first to create the file.`}]};let n=re.readFileSync(t,"utf-8"),a=me(e.name);return await I.saveSpecification(a,n),{content:[{type:"text",text:`\u2705 Saved specification: ${a}.spec.md`}]}}),Dt=oe("read_specification","Read the content of a specification.",{name:se.string().describe("Name of the specification to read")},async e=>{if(!I)return{content:[{type:"text",text:"\u274C Planning transport not initialized"}]};let t=me(e.name),n=await I.getSpecification(t);return n?{content:[{type:"text",text:n}]}:{content:[{type:"text",text:`\u274C Specification "${e.name}" not found.`}]}}),Ot=oe("list_specifications","List all specifications.",{},async()=>{if(!I)return{content:[{type:"text",text:"\u274C Planning transport not initialized"}]};let e=await I.listSpecifications();return e.length===0?{content:[{type:"text",text:"\u{1F4CB} No specifications found."}]}:{content:[{type:"text",text:`\u{1F4CB} Specifications:
16
16
 
17
17
  ${e.map(n=>`- ${n.name} (${n.slug}.spec.md)`).join(`
18
- `)}`}]}}),Dt=ne("delete_specification","Delete a specification.",{name:te.string().describe("Name of the specification to delete")},async e=>{if(!I)return{content:[{type:"text",text:"\u274C Planning transport not initialized"}]};let t=me(e.name);return await I.deleteSpecification(t)?{content:[{type:"text",text:`\u{1F5D1}\uFE0F Deleted: ${t}.spec.md`}]}:{content:[{type:"text",text:`\u274C Specification "${e.name}" not found.`}]}});import{tool as M}from"@anthropic-ai/claude-agent-sdk";import{z as K}from"zod";var y=null;function De(e){y=e}var Oe=M("restart_services",`Rebuild and restart services. Call this after making backend changes (.cs files) to apply them.
18
+ `)}`}]}}),Ft=oe("delete_specification","Delete a specification.",{name:se.string().describe("Name of the specification to delete")},async e=>{if(!I)return{content:[{type:"text",text:"\u274C Planning transport not initialized"}]};let t=me(e.name);return await I.deleteSpecification(t)?{content:[{type:"text",text:`\u{1F5D1}\uFE0F Deleted: ${t}.spec.md`}]}:{content:[{type:"text",text:`\u274C Specification "${e.name}" not found.`}]}});import{tool as M}from"@anthropic-ai/claude-agent-sdk";import{z as K}from"zod";var y=null;function Fe(e){y=e}var Ne=M("restart_services",`Rebuild and restart services. Call this after making backend changes (.cs files) to apply them.
19
19
 
20
20
  Parameters:
21
21
  - target: "backend" (default) | "frontend" | "both"
@@ -25,39 +25,39 @@ Use target="frontend" if Vite is stuck (rare, HMR usually works).
25
25
  Use target="both" if unsure or both need restart.`,{target:K.enum(["backend","frontend","both"]).default("backend").describe("Which service to restart")},async e=>{if(!y)return{content:[{type:"text",text:"\u274C Service manager not initialized"}]};let t=e.target||"backend";console.log(`[MCP] restart_services called (target: ${t})`);let n=await y.restartServices(t);if(!n.success){let s=[];return n.backendError&&s.push(`Backend: ${n.backendError}`),n.frontendError&&s.push(`Frontend: ${n.frontendError}`),{content:[{type:"text",text:`\u274C Restart failed:
26
26
  ${s.join(`
27
27
 
28
- `)}`}]}}return{content:[{type:"text",text:`\u2705 ${t==="both"?"Backend and frontend":t==="backend"?"Backend":"Frontend"} restarted successfully.`}]}}),Fe=M("stop_services",`Stop running services. Call this BEFORE running scaffold to prevent port conflicts and ensure clean migrations.
28
+ `)}`}]}}return{content:[{type:"text",text:`\u2705 ${t==="both"?"Backend and frontend":t==="backend"?"Backend":"Frontend"} restarted successfully.`}]}}),Ue=M("stop_services",`Stop running services. Call this BEFORE running scaffold to prevent port conflicts and ensure clean migrations.
29
29
 
30
30
  Parameters:
31
31
  - target: "backend" (default) | "frontend" | "both"
32
32
 
33
- Use target="backend" before running scaffold (required for migrations).`,{target:K.enum(["backend","frontend","both"]).default("backend").describe("Which service to stop")},async e=>{if(!y)return{content:[{type:"text",text:"\u274C Service manager not initialized"}]};let t=e.target||"backend";console.log(`[MCP] stop_services called (target: ${t})`);let n=t==="backend"||t==="both",a=t==="frontend"||t==="both";n&&await y.stopBackend(),a&&await y.stopFrontend();let s=5e3,r=Date.now(),o=!n,g=!a;for(;Date.now()-r<s;){let p=await y.checkHealth();if(n&&!p.api&&(o=!0),a&&!p.web&&(g=!0),o&&g)break;await new Promise(T=>setTimeout(T,500))}let k=t==="both"?"Backend and frontend":t==="backend"?"Backend":"Frontend";return{content:[{type:"text",text:o&&g?`\u2705 ${k} stopped successfully.`:`\u26A0\uFE0F ${k} stop requested but health check still shows running. Proceeding anyway.`}]}}),Ne=M("start_services",`Start services. Call this AFTER running scaffold to bring services back up.
33
+ Use target="backend" before running scaffold (required for migrations).`,{target:K.enum(["backend","frontend","both"]).default("backend").describe("Which service to stop")},async e=>{if(!y)return{content:[{type:"text",text:"\u274C Service manager not initialized"}]};let t=e.target||"backend";console.log(`[MCP] stop_services called (target: ${t})`);let n=t==="backend"||t==="both",a=t==="frontend"||t==="both";n&&await y.stopBackend(),a&&await y.stopFrontend();let s=5e3,r=Date.now(),o=!n,g=!a;for(;Date.now()-r<s;){let p=await y.checkHealth();if(n&&!p.api&&(o=!0),a&&!p.web&&(g=!0),o&&g)break;await new Promise(T=>setTimeout(T,500))}let k=t==="both"?"Backend and frontend":t==="backend"?"Backend":"Frontend";return{content:[{type:"text",text:o&&g?`\u2705 ${k} stopped successfully.`:`\u26A0\uFE0F ${k} stop requested but health check still shows running. Proceeding anyway.`}]}}),Le=M("start_services",`Start services. Call this AFTER running scaffold to bring services back up.
34
34
 
35
35
  Parameters:
36
36
  - target: "backend" (default) | "frontend" | "both"
37
37
 
38
- Use target="backend" after running scaffold.`,{target:K.enum(["backend","frontend","both"]).default("backend").describe("Which service to start")},async e=>{if(!y)return{content:[{type:"text",text:"\u274C Service manager not initialized"}]};let t=e.target||"backend";console.log(`[MCP] start_services called (target: ${t})`);let n=t==="backend"||t==="both",a=t==="frontend"||t==="both";n&&await y.startBackend(),a&&await y.startFrontend();let s=await y.waitForHealth(15e3),r=!n||s.api,o=!a||s.web,g=r&&o,k=t==="both"?"Backend and frontend":t==="backend"?"Backend":"Frontend";if(!g){let f=[];return n&&!s.api&&f.push("Backend failed to start"),a&&!s.web&&f.push("Frontend failed to start"),{content:[{type:"text",text:`\u274C ${k} failed to start: ${f.join(", ")}`}]}}return{content:[{type:"text",text:`\u2705 ${k} started successfully.`}]}}),Ue=M("check_service_health",`Check if services are running and healthy. Returns current status of backend API and frontend.
38
+ Use target="backend" after running scaffold.`,{target:K.enum(["backend","frontend","both"]).default("backend").describe("Which service to start")},async e=>{if(!y)return{content:[{type:"text",text:"\u274C Service manager not initialized"}]};let t=e.target||"backend";console.log(`[MCP] start_services called (target: ${t})`);let n=t==="backend"||t==="both",a=t==="frontend"||t==="both";n&&await y.startBackend(),a&&await y.startFrontend();let s=await y.waitForHealth(15e3),r=!n||s.api,o=!a||s.web,g=r&&o,k=t==="both"?"Backend and frontend":t==="backend"?"Backend":"Frontend";if(!g){let f=[];return n&&!s.api&&f.push("Backend failed to start"),a&&!s.web&&f.push("Frontend failed to start"),{content:[{type:"text",text:`\u274C ${k} failed to start: ${f.join(", ")}`}]}}return{content:[{type:"text",text:`\u2705 ${k} started successfully.`}]}}),Me=M("check_service_health",`Check if services are running and healthy. Returns current status of backend API and frontend.
39
39
  Note: This only checks if ports are responding, NOT build/type errors. Use check_backend_build or check_frontend_types for that.`,{},async()=>{if(!y)return{content:[{type:"text",text:"\u274C Service manager not initialized"}]};let e=await y.checkHealth();return{content:[{type:"text",text:`Service Health:
40
40
  \u{1F5A5}\uFE0F Backend API: ${e.api?"\u2705 running":"\u274C not running"}
41
- \u{1F310} Frontend: ${e.web?"\u2705 running":"\u274C not running"}`}]}}),Le=M("check_backend_build","Run dotnet build to check for C# compilation errors. Use this after fixing backend code to verify the fix works.",{},async()=>{if(!y)return{content:[{type:"text",text:"\u274C Service manager not initialized"}]};console.log("[MCP] check_backend_build called");let e=await y.checkBackendBuild();return e.success?{content:[{type:"text",text:"\u2705 Backend build succeeded - no errors"}]}:{content:[{type:"text",text:`\u274C Backend build failed:
41
+ \u{1F310} Frontend: ${e.web?"\u2705 running":"\u274C not running"}`}]}}),je=M("check_backend_build","Run dotnet build to check for C# compilation errors. Use this after fixing backend code to verify the fix works.",{},async()=>{if(!y)return{content:[{type:"text",text:"\u274C Service manager not initialized"}]};console.log("[MCP] check_backend_build called");let e=await y.checkBackendBuild();return e.success?{content:[{type:"text",text:"\u2705 Backend build succeeded - no errors"}]}:{content:[{type:"text",text:`\u274C Backend build failed:
42
42
 
43
- ${e.errors}`}]}}),Me=M("check_frontend_types","Run TypeScript type check (tsc) on frontend code. Use this after fixing frontend code to verify the fix works.",{},async()=>{if(!y)return{content:[{type:"text",text:"\u274C Service manager not initialized"}]};console.log("[MCP] check_frontend_types called");let e=await y.checkFrontendTypes();return e.success?{content:[{type:"text",text:"\u2705 Frontend type check passed - no errors"}]}:{content:[{type:"text",text:`\u274C Frontend type errors:
43
+ ${e.errors}`}]}}),Be=M("check_frontend_types","Run TypeScript type check (tsc) on frontend code. Use this after fixing frontend code to verify the fix works.",{},async()=>{if(!y)return{content:[{type:"text",text:"\u274C Service manager not initialized"}]};console.log("[MCP] check_frontend_types called");let e=await y.checkFrontendTypes();return e.success?{content:[{type:"text",text:"\u2705 Frontend type check passed - no errors"}]}:{content:[{type:"text",text:`\u274C Frontend type errors:
44
44
 
45
- ${e.errors}`}]}}),Ut=M("tail_service_log",`Get the last N lines of service logs. Use this to debug startup failures or verify that the application is running correctly.
45
+ ${e.errors}`}]}}),Mt=M("tail_service_log",`Get the last N lines of service logs. Use this to debug startup failures or verify that the application is running correctly.
46
46
 
47
47
  Parameters:
48
48
  - target: "backend" | "frontend"
49
49
  - lines: number (default 50)`,{target:K.enum(["backend","frontend"]).describe("Which log to read"),lines:K.number().default(50).describe("Number of lines to read")},async e=>{if(!y)return{content:[{type:"text",text:"\u274C Service manager not initialized"}]};let t=await y.tailLogs(e.target,e.lines);return{content:[{type:"text",text:`Last ${e.lines} lines of ${e.target} log:
50
50
 
51
51
  ${t.join(`
52
- `)}`}]}}),Lt=M("check_swagger_endpoints",`Search for endpoints in the generated swagger.json. Use this to verify that new backend endpoints are correctly exposed.
52
+ `)}`}]}}),jt=M("check_swagger_endpoints",`Search for endpoints in the generated swagger.json. Use this to verify that new backend endpoints are correctly exposed.
53
53
 
54
54
  Parameters:
55
55
  - pattern: string (e.g., "users", "api/reports")`,{pattern:K.string().describe("Text to search for in endpoint paths")},async e=>{if(!y)return{content:[{type:"text",text:"\u274C Service manager not initialized"}]};let t=await y.checkSwaggerEndpoints(e.pattern);return t.foundEndpoints.length===0?{content:[{type:"text",text:`\u274C No endpoints found matching "${e.pattern}" (Total endpoints: ${t.totalEndpoints})`}]}:{content:[{type:"text",text:`\u2705 Found ${t.foundEndpoints.length} matching endpoints:
56
56
 
57
57
  ${t.foundEndpoints.join(`
58
- `)}`}]}});import*as P from"fs";import*as Q from"path";var je="/tmp";function he(e){let t=e?Q.join(e,".sdd","insights"):Q.join(process.cwd(),".sdd","insights");return{async reportInsight(n,a){P.mkdirSync(t,{recursive:!0});let s=a.type==="learning"?"learnings.jsonl":"bugs.jsonl",r=Q.join(t,s);P.appendFileSync(r,JSON.stringify(a)+`
59
- `,"utf-8")},async reportProgress(n,a,s){let r=Q.join(je,`agent-progress-${n}.json`),o={timestamp:new Date().toISOString(),event:a,data:s};P.appendFileSync(r,JSON.stringify(o)+`
60
- `,"utf-8")}}}function ye(e){let t=Q.join(je,`agent-questions-${e}.json`);if(!P.existsSync(t))return null;try{let n=P.readFileSync(t,"utf-8");return P.unlinkSync(t),JSON.parse(n)}catch{return null}}import*as S from"fs";import*as oe from"path";function be(e){let t=oe.join(e,".sdd","specifications");function n(){S.existsSync(t)||S.mkdirSync(t,{recursive:!0})}function a(s){return oe.join(t,`${s}.spec.md`)}return{async saveSpecification(s,r){n(),S.writeFileSync(a(s),r,"utf-8")},async getSpecification(s){n();let r=a(s);return S.existsSync(r)?S.readFileSync(r,"utf-8"):null},async listSpecifications(){return n(),S.readdirSync(t).filter(r=>r.endsWith(".spec.md")).map(r=>{let o=S.readFileSync(oe.join(t,r),"utf-8"),g=o.match(/name: "([^"]+)"/),k=o.match(/status: (\w+)/),f=o.match(/version: "([^"]+)"/);return{slug:r.replace(".spec.md",""),name:g?.[1]||r,status:k?.[1]||"unknown",version:f?.[1]||"1.0.0"}})},async deleteSpecification(s){n();let r=a(s);return S.existsSync(r)?(S.unlinkSync(r),!0):!1},async specificationExists(s){return n(),S.existsSync(a(s))}}}function ke(){return lt({name:"agent-insights",version:"1.0.0",tools:[Oe,Fe,Ne,Ue,Le,Me]})}import{query as wt}from"@anthropic-ai/claude-agent-sdk";var _e={description:"Delegate to this agent when scaffolding new entities or creating CRUD features. This agent handles entity generation using the scaffold CLI with multi-entity support.",model:"inherit",prompt:`You are a scaffolding specialist. Your ONLY job is:
58
+ `)}`}]}});import*as P from"fs";import*as Q from"path";var $e="/tmp";function he(e){let t=e?Q.join(e,".sdd","insights"):Q.join(process.cwd(),".sdd","insights");return{async reportInsight(n,a){P.mkdirSync(t,{recursive:!0});let s=a.type==="learning"?"learnings.jsonl":"bugs.jsonl",r=Q.join(t,s);P.appendFileSync(r,JSON.stringify(a)+`
59
+ `,"utf-8")},async reportProgress(n,a,s){let r=Q.join($e,`agent-progress-${n}.json`),o={timestamp:new Date().toISOString(),event:a,data:s};P.appendFileSync(r,JSON.stringify(o)+`
60
+ `,"utf-8")}}}function ye(e){let t=Q.join($e,`agent-questions-${e}.json`);if(!P.existsSync(t))return null;try{let n=P.readFileSync(t,"utf-8");return P.unlinkSync(t),JSON.parse(n)}catch{return null}}import*as S from"fs";import*as ae from"path";function be(e){let t=ae.join(e,".sdd","specifications");function n(){S.existsSync(t)||S.mkdirSync(t,{recursive:!0})}function a(s){return ae.join(t,`${s}.spec.md`)}return{async saveSpecification(s,r){n(),S.writeFileSync(a(s),r,"utf-8")},async getSpecification(s){n();let r=a(s);return S.existsSync(r)?S.readFileSync(r,"utf-8"):null},async listSpecifications(){return n(),S.readdirSync(t).filter(r=>r.endsWith(".spec.md")).map(r=>{let o=S.readFileSync(ae.join(t,r),"utf-8"),g=o.match(/name: "([^"]+)"/),k=o.match(/status: (\w+)/),f=o.match(/version: "([^"]+)"/);return{slug:r.replace(".spec.md",""),name:g?.[1]||r,status:k?.[1]||"unknown",version:f?.[1]||"1.0.0"}})},async deleteSpecification(s){n();let r=a(s);return S.existsSync(r)?(S.unlinkSync(r),!0):!1},async specificationExists(s){return n(),S.existsSync(a(s))}}}function ke(){return ut({name:"agent-insights",version:"1.0.0",tools:[Ne,Ue,Le,Me,je,Be]})}import{query as Ct}from"@anthropic-ai/claude-agent-sdk";var _e={description:"Delegate to this agent when scaffolding new entities or creating CRUD features. This agent handles entity generation using the scaffold CLI with multi-entity support.",model:"inherit",prompt:`You are a scaffolding specialist. Your ONLY job is:
61
61
  1. Check existing features (quick ls)
62
62
  2. Write ALL entities to ONE /tmp/scaffold.json (big bang, no phasing!)
63
63
  3. Run scaffold CLI ONCE
@@ -241,7 +241,7 @@ DO NOT phase/split into multiple runs - that's slower and error-prone.
241
241
  - Enrollment depends on Student + CourseOffering - CLI handles it
242
242
  - ONE scaffold run creates ALL 6 entities with correct FK relationships
243
243
 
244
- REMEMBER: ls \u2192 Write \u2192 Run \u2192 Restart \u2192 STOP. No verification needed.`};var re={description:"Delegate to this agent to fix errors, type issues, or bugs in the code",model:"inherit",prompt:`You are a bug-fixing specialist. Your job is to FIX errors, not just report them.
244
+ REMEMBER: ls \u2192 Write \u2192 Run \u2192 Restart \u2192 STOP. No verification needed.`};var ie={description:"Delegate to this agent to fix errors, type issues, or bugs in the code",model:"inherit",prompt:`You are a bug-fixing specialist. Your job is to FIX errors, not just report them.
245
245
 
246
246
  ## Process
247
247
  1. Read the error message carefully - understand WHAT and WHERE
@@ -271,7 +271,7 @@ REMEMBER: ls \u2192 Write \u2192 Run \u2192 Restart \u2192 STOP. No verification
271
271
  - Fix the ROOT CAUSE, not symptoms
272
272
  - Make minimal changes
273
273
  - Don't add unnecessary code
274
- - If multiple files have the same issue, fix all of them`};var ae={description:"Delegate to this agent for specification-driven development. Use when the user wants to plan, specify, or design a feature before implementation.",model:"inherit",prompt:`You are a Spec-Driven Development (SDD) specialist.
274
+ - If multiple files have the same issue, fix all of them`};var ce={description:"Delegate to this agent for specification-driven development. Use when the user wants to plan, specify, or design a feature before implementation.",model:"inherit",prompt:`You are a Spec-Driven Development (SDD) specialist.
275
275
 
276
276
  ## \u26D4 CRITICAL RULES - READ FIRST
277
277
 
@@ -577,7 +577,7 @@ queryClient.invalidateQueries({ queryKey: getGetApi{Entities}QueryKey() })
577
577
  ## WHEN DONE
578
578
  1. Run typecheck: \`cd /workspace/packages/backoffice-web && npx tsc --noEmit\`
579
579
  2. If errors, fix them
580
- 3. Report what you created and STOP`};var ie={description:"Delegate to this agent to help the user write or improve their project context. This agent researches the codebase, asks strategic questions about product goals and users, then writes comprehensive project context.",model:"inherit",prompt:`You are a Project Context Specialist - an expert at understanding codebases and extracting the essential context that helps AI agents work effectively on projects.
580
+ 3. Report what you created and STOP`};var le={description:"Delegate to this agent to help the user write or improve their project context. This agent researches the codebase, asks strategic questions about product goals and users, then writes comprehensive project context.",model:"inherit",prompt:`You are a Project Context Specialist - an expert at understanding codebases and extracting the essential context that helps AI agents work effectively on projects.
581
581
 
582
582
  ## \u26D4 CRITICAL RULES - READ FIRST
583
583
 
@@ -771,14 +771,14 @@ Before saving, verify your context:
771
771
  3. **Show patterns** - Include small code examples for common tasks
772
772
  4. **Prioritize** - Put most critical info in <critical_rules>
773
773
  5. **Keep it scannable** - Use bullets, clear sections
774
- 6. **Update, don't replace** - If context exists, improve it rather than starting fresh`};import*as V from"fs";import*as Be from"path";var ce=class{buffer=[];flushInterval=null;sessionId=null;outputDir;flushIntervalMs;constructor(t){this.outputDir=t.outputDir||"/tmp/agent-debug",this.flushIntervalMs=t.flushIntervalMs||3e3,t.enabled&&(this.ensureOutputDir(),this.startFlushInterval())}ensureOutputDir(){V.existsSync(this.outputDir)||V.mkdirSync(this.outputDir,{recursive:!0})}startFlushInterval(){this.flushInterval=setInterval(()=>{this.flush()},this.flushIntervalMs)}setSessionId(t){this.sessionId=t}log(t){let a={timestamp:new Date().toISOString(),message:t};this.buffer.push(JSON.stringify(a,null,2)+`
774
+ 6. **Update, don't replace** - If context exists, improve it rather than starting fresh`};import*as V from"fs";import*as qe from"path";var de=class{buffer=[];flushInterval=null;sessionId=null;outputDir;flushIntervalMs;constructor(t){this.outputDir=t.outputDir||"/tmp/agent-debug",this.flushIntervalMs=t.flushIntervalMs||3e3,t.enabled&&(this.ensureOutputDir(),this.startFlushInterval())}ensureOutputDir(){V.existsSync(this.outputDir)||V.mkdirSync(this.outputDir,{recursive:!0})}startFlushInterval(){this.flushInterval=setInterval(()=>{this.flush()},this.flushIntervalMs)}setSessionId(t){this.sessionId=t}log(t){let a={timestamp:new Date().toISOString(),message:t};this.buffer.push(JSON.stringify(a,null,2)+`
775
775
  ---
776
- `)}getLogFilePath(){let n=(this.sessionId||"unknown").replace(/[^a-zA-Z0-9-]/g,"_").slice(0,50),a=new Date().toISOString().split("T")[0];return Be.join(this.outputDir,`session-${a}-${n}.log`)}flush(){if(this.buffer.length===0)return;let t=this.buffer.join("");this.buffer=[];let n=this.getLogFilePath();V.appendFileSync(n,t)}stop(){this.flushInterval&&(clearInterval(this.flushInterval),this.flushInterval=null),this.flush()}};function $e(e){return e?typeof e=="boolean"?e?new ce({enabled:!0}):null:e.enabled?new ce(e):null:null}import{z as c}from"zod";import*as z from"fs/promises";import*as E from"path";var qe=c.object({port:c.number(),startCommand:c.string(),buildCommand:c.string().optional(),typecheckCommand:c.string().optional(),logFile:c.string().optional(),healthEndpoint:c.string().optional(),extensions:c.array(c.string())}),dt=c.object({port:c.number(),type:c.enum(["postgres","mysql","sqlite","mongodb"])}),ut=c.object({command:c.string(),schemaPath:c.string().optional()}),pt=c.object({email:c.string().optional(),name:c.string().optional(),commitPrefix:c.string().optional()}),ft=c.object({enabled:c.boolean(),port:c.number().optional()}),Z=c.object({version:c.literal("1.0"),paths:c.object({workspace:c.string(),backend:c.string().optional(),frontend:c.string().optional(),features:c.object({backend:c.string().optional(),frontend:c.string().optional()}).optional()}),services:c.object({backend:qe.optional(),frontend:qe.optional(),database:dt.optional()}).optional(),scaffold:ut.optional(),git:pt.optional(),techStack:c.object({backend:c.array(c.string()).optional(),frontend:c.array(c.string()).optional(),patterns:c.array(c.string()).optional()}).optional(),tunnel:ft.optional()});function D(e){return{version:"1.0",paths:{workspace:e||process.env.WORKSPACE_DIR||"/workspace",backend:"packages/dotnet-api",frontend:"packages/backoffice-web",features:{backend:"Source/Features",frontend:"src/applications/super-admin/features"}},services:{backend:{port:5338,startCommand:"dotnet run",buildCommand:"dotnet build",typecheckCommand:"dotnet build --no-restore",logFile:"/tmp/api.log",healthEndpoint:"http://localhost:5338",extensions:[".cs",".csproj"]},frontend:{port:5173,startCommand:"npm run dev",typecheckCommand:"npx tsc -p tsconfig.app.json --noEmit",logFile:"/tmp/web.log",healthEndpoint:"http://localhost:5173",extensions:[".ts",".tsx",".json"]},database:{port:43594,type:"postgres"}},scaffold:{command:"scaffold --schema /tmp/scaffold.json --output /workspace --force --full",schemaPath:"/tmp/scaffold.json"},git:{email:"agent@dotnetmentor.se",name:"Agent",commitPrefix:"[agent]"},techStack:{backend:[".NET 9","PostgreSQL","MediatR (CQRS)","EF Core"],frontend:["React 19","TypeScript","Vite","MUI","TanStack Query"],patterns:["Vertical slices","CQRS","Soft delete","Timestamps"]},tunnel:{enabled:!0,port:5173}}}var We="project-config.json",Ge=".sdd";async function Ye(e){let{workspaceDir:t,providedConfig:n,requireConfig:a}=e;if(n)return{config:Z.parse(n),source:"provided"};let s=E.join(t,Ge,We);try{let r=await z.readFile(s,"utf-8"),o=JSON.parse(r);return{config:Z.parse(o),source:"file",configPath:s}}catch(r){r instanceof Error&&"code"in r&&r.code!=="ENOENT"&&console.warn(`[Config] Warning: Invalid project-config.json at ${s}:`,r instanceof c.ZodError?r.errors:r.message)}if(a)throw new Error(`No project configuration found at ${s} and requireConfig is true`);return{config:D(t),source:"default"}}async function He(e,t){let n=E.join(e,Ge),a=E.join(n,We);await z.mkdir(n,{recursive:!0});let s=Z.parse(t);return await z.writeFile(a,JSON.stringify(s,null,2),"utf-8"),a}function le(e,t){if(t)return E.isAbsolute(t)?t:E.join(e.paths.workspace,t)}function O(e){return le(e,e.paths.backend)}function F(e){return le(e,e.paths.frontend)}function ee(e){let t=O(e);if(!(!t||!e.paths.features?.backend))return E.join(t,e.paths.features.backend)}function J(e){let t=F(e);if(!(!t||!e.paths.features?.frontend))return E.join(t,e.paths.features.frontend)}function Ke(e,t){if(!e.services?.backend?.extensions)return!1;let n=E.extname(t).toLowerCase();return e.services.backend.extensions.includes(n)}function Qe(e,t){if(!e.services?.frontend?.extensions)return!1;let n=E.extname(t).toLowerCase();return e.services.frontend.extensions.includes(n)}function de(e){let t=[];return e.techStack?.backend?.length&&t.push(`**Backend:** ${e.techStack.backend.join(", ")}`),e.techStack?.frontend?.length&&t.push(`**Frontend:** ${e.techStack.frontend.join(", ")}`),e.techStack?.patterns?.length&&t.push(`**Patterns:** ${e.techStack.patterns.join(", ")}`),t.join(`
777
- `)}function Ve(e){let t=[];return e.paths.backend&&t.push(`- Backend: ${O(e)}`),e.paths.frontend&&t.push(`- Frontend: ${F(e)}`),e.paths.features?.backend&&t.push(`- Backend Features: ${ee(e)}`),e.paths.features?.frontend&&t.push(`- Frontend Features: ${J(e)}`),t.join(`
778
- `)}function ue(e){let t=[];return e.services?.backend&&t.push(`| Backend | ${O(e)} | ${e.services.backend.port} | ${e.services.backend.logFile||"N/A"} |`),e.services?.frontend&&t.push(`| Frontend | ${F(e)} | ${e.services.frontend.port} | ${e.services.frontend.logFile||"N/A"} |`),e.services?.database&&t.push(`| Database (${e.services.database.type}) | localhost | ${e.services.database.port} | - |`),t.length===0?"":`| Service | Location | Port | Logs |
776
+ `)}getLogFilePath(){let n=(this.sessionId||"unknown").replace(/[^a-zA-Z0-9-]/g,"_").slice(0,50),a=new Date().toISOString().split("T")[0];return qe.join(this.outputDir,`session-${a}-${n}.log`)}flush(){if(this.buffer.length===0)return;let t=this.buffer.join("");this.buffer=[];let n=this.getLogFilePath();V.appendFileSync(n,t)}stop(){this.flushInterval&&(clearInterval(this.flushInterval),this.flushInterval=null),this.flush()}};function We(e){return e?typeof e=="boolean"?e?new de({enabled:!0}):null:e.enabled?new de(e):null:null}import{z as c}from"zod";import*as z from"fs/promises";import*as E from"path";var Ge=c.object({port:c.number(),startCommand:c.string(),buildCommand:c.string().optional(),typecheckCommand:c.string().optional(),logFile:c.string().optional(),healthEndpoint:c.string().optional(),extensions:c.array(c.string())}),pt=c.object({port:c.number(),type:c.enum(["postgres","mysql","sqlite","mongodb"])}),ft=c.object({command:c.string(),schemaPath:c.string().optional()}),gt=c.object({email:c.string().optional(),name:c.string().optional(),commitPrefix:c.string().optional()}),mt=c.object({enabled:c.boolean(),port:c.number().optional()}),Z=c.object({version:c.literal("1.0"),paths:c.object({workspace:c.string(),backend:c.string().optional(),frontend:c.string().optional(),features:c.object({backend:c.string().optional(),frontend:c.string().optional()}).optional()}),services:c.object({backend:Ge.optional(),frontend:Ge.optional(),database:pt.optional()}).optional(),scaffold:ft.optional(),git:gt.optional(),techStack:c.object({backend:c.array(c.string()).optional(),frontend:c.array(c.string()).optional(),patterns:c.array(c.string()).optional()}).optional(),tunnel:mt.optional()});function D(e){return{version:"1.0",paths:{workspace:e||process.env.WORKSPACE_DIR||"/workspace",backend:"packages/dotnet-api",frontend:"packages/backoffice-web",features:{backend:"Source/Features",frontend:"src/applications/super-admin/features"}},services:{backend:{port:5338,startCommand:"dotnet run",buildCommand:"dotnet build",typecheckCommand:"dotnet build --no-restore",logFile:"/tmp/api.log",healthEndpoint:"http://localhost:5338",extensions:[".cs",".csproj"]},frontend:{port:5173,startCommand:"npm run dev",typecheckCommand:"npx tsc -p tsconfig.app.json --noEmit",logFile:"/tmp/web.log",healthEndpoint:"http://localhost:5173",extensions:[".ts",".tsx",".json"]},database:{port:43594,type:"postgres"}},scaffold:{command:"scaffold --schema /tmp/scaffold.json --output /workspace --force --full",schemaPath:"/tmp/scaffold.json"},git:{email:"agent@dotnetmentor.se",name:"Agent",commitPrefix:"[agent]"},techStack:{backend:[".NET 9","PostgreSQL","MediatR (CQRS)","EF Core"],frontend:["React 19","TypeScript","Vite","MUI","TanStack Query"],patterns:["Vertical slices","CQRS","Soft delete","Timestamps"]},tunnel:{enabled:!0,port:5173}}}var Ye="project-config.json",He=".sdd";async function Ke(e){let{workspaceDir:t,providedConfig:n,requireConfig:a}=e;if(n)return{config:Z.parse(n),source:"provided"};let s=E.join(t,He,Ye);try{let r=await z.readFile(s,"utf-8"),o=JSON.parse(r);return{config:Z.parse(o),source:"file",configPath:s}}catch(r){r instanceof Error&&"code"in r&&r.code!=="ENOENT"&&console.warn(`[Config] Warning: Invalid project-config.json at ${s}:`,r instanceof c.ZodError?r.errors:r.message)}if(a)throw new Error(`No project configuration found at ${s} and requireConfig is true`);return{config:D(t),source:"default"}}async function Qe(e,t){let n=E.join(e,He),a=E.join(n,Ye);await z.mkdir(n,{recursive:!0});let s=Z.parse(t);return await z.writeFile(a,JSON.stringify(s,null,2),"utf-8"),a}function ue(e,t){if(t)return E.isAbsolute(t)?t:E.join(e.paths.workspace,t)}function O(e){return ue(e,e.paths.backend)}function F(e){return ue(e,e.paths.frontend)}function ee(e){let t=O(e);if(!(!t||!e.paths.features?.backend))return E.join(t,e.paths.features.backend)}function J(e){let t=F(e);if(!(!t||!e.paths.features?.frontend))return E.join(t,e.paths.features.frontend)}function Ve(e,t){if(!e.services?.backend?.extensions)return!1;let n=E.extname(t).toLowerCase();return e.services.backend.extensions.includes(n)}function ze(e,t){if(!e.services?.frontend?.extensions)return!1;let n=E.extname(t).toLowerCase();return e.services.frontend.extensions.includes(n)}function pe(e){let t=[];return e.techStack?.backend?.length&&t.push(`**Backend:** ${e.techStack.backend.join(", ")}`),e.techStack?.frontend?.length&&t.push(`**Frontend:** ${e.techStack.frontend.join(", ")}`),e.techStack?.patterns?.length&&t.push(`**Patterns:** ${e.techStack.patterns.join(", ")}`),t.join(`
777
+ `)}function Je(e){let t=[];return e.paths.backend&&t.push(`- Backend: ${O(e)}`),e.paths.frontend&&t.push(`- Frontend: ${F(e)}`),e.paths.features?.backend&&t.push(`- Backend Features: ${ee(e)}`),e.paths.features?.frontend&&t.push(`- Frontend Features: ${J(e)}`),t.join(`
778
+ `)}function fe(e){let t=[];return e.services?.backend&&t.push(`| Backend | ${O(e)} | ${e.services.backend.port} | ${e.services.backend.logFile||"N/A"} |`),e.services?.frontend&&t.push(`| Frontend | ${F(e)} | ${e.services.frontend.port} | ${e.services.frontend.logFile||"N/A"} |`),e.services?.database&&t.push(`| Database (${e.services.database.type}) | localhost | ${e.services.database.port} | - |`),t.length===0?"":`| Service | Location | Port | Logs |
779
779
  |---------|----------|------|------|
780
780
  ${t.join(`
781
- `)}`}function ze(e={}){let{debugMode:t=!1,projectPrompt:n=null,isLocal:a=!1,projectConfig:s=D(),useDefaultStack:r=!0}=e,o=n?`
781
+ `)}`}function Xe(e={}){let{debugMode:t=!1,projectPrompt:n=null,isLocal:a=!1,projectConfig:s=D(),useDefaultStack:r=!0}=e,o=n?`
782
782
  <project_context>
783
783
  ${n}
784
784
  </project_context>
@@ -823,7 +823,7 @@ Then STOP. Do not continue. Do not try to fix it. Wait for user.
823
823
 
824
824
  ---
825
825
 
826
- `:"",k=gt(s),f=mt(s,a),p=bt(s,r),T=ht(r),R=r?kt(s):"",B=r?_t(s,a):"",$=yt(r);return`${o}${g}# Agent Instructions
826
+ `:"",k=ht(s),f=yt(s,a),p=_t(s,r),T=bt(r),R=r?St(s):"",B=r?wt(s,a):"",$=kt(r);return`${o}${g}# Agent Instructions
827
827
 
828
828
  ## \u26D4 CRITICAL: EVERYTHING IS A KANBAN TASK
829
829
 
@@ -967,7 +967,7 @@ ${$}
967
967
  ${R}
968
968
 
969
969
  ${B}
970
- `}function gt(e){let t=de(e),n=O(e),a=F(e),s=ee(e),r=J(e),o=[];s&&o.push(`- Backend: "${s}/{Entity}/"`),r&&o.push(`- Frontend: "${r}/{entity}/"`);let g=e.techStack?.patterns?.length?`
970
+ `}function ht(e){let t=pe(e),n=O(e),a=F(e),s=ee(e),r=J(e),o=[];s&&o.push(`- Backend: "${s}/{Entity}/"`),r&&o.push(`- Frontend: "${r}/{entity}/"`);let g=e.techStack?.patterns?.length?`
971
971
  **Key patterns:**
972
972
  ${e.techStack.patterns.map(p=>`- ${p}`).join(`
973
973
  `)}`:"",f=e.techStack?.backend?.some(p=>p.includes(".NET")||p.includes("C#"))??!1?`
@@ -979,7 +979,7 @@ ${o.length>0?`
979
979
  ${o.join(`
980
980
  `)}`:""}
981
981
  ${g}${f}
982
- </tech-stack>`}function mt(e,t){return t?`<environment>
982
+ </tech-stack>`}function yt(e,t){return t?`<environment>
983
983
  **LOCAL MODE - User manages their own services.**
984
984
 
985
985
  You are running on the user's local machine, NOT in a Docker container.
@@ -1000,11 +1000,11 @@ The user is responsible for:
1000
1000
  </environment>`:`<environment>
1001
1001
  Docker container with pre-started services:
1002
1002
 
1003
- ${ue(e)}
1003
+ ${fe(e)}
1004
1004
  ${e.tunnel?.enabled?"| Tunnel | - | - | Exposes frontend to user |":""}
1005
1005
 
1006
1006
  User sees app through **Cloudflare tunnel** (live preview in browser).
1007
- </environment>`}function ht(e){return e?`**\u2705 ALWAYS delegate to these subagents:**
1007
+ </environment>`}function bt(e){return e?`**\u2705 ALWAYS delegate to these subagents:**
1008
1008
 
1009
1009
  | Trigger | Subagent | Example |
1010
1010
  |---------|----------|---------|
@@ -1024,7 +1024,7 @@ User sees app through **Cloudflare tunnel** (live preview in browser).
1024
1024
  **Flow:** @planning \u2192 **[Create Kanban Cards]** \u2192 Execute work \u2192 @debugger (if issues)
1025
1025
 
1026
1026
  Note: For this project, you implement the code directly after planning (no stack-specific subagents).
1027
- Check \`.claude/skills/\` for project-specific patterns and conventions.`}function yt(e){return e?`<workflow>
1027
+ Check \`.claude/skills/\` for project-specific patterns and conventions.`}function kt(e){return e?`<workflow>
1028
1028
  **Standard feature flow:**
1029
1029
  1. **@planning** - Gather requirements, design spec, saves it.
1030
1030
  2. **\u23F8\uFE0F STOP & WAIT** - Tell user: "Spec is ready! Review it and tell me when to implement."
@@ -1107,7 +1107,7 @@ Check \`.claude/skills/\` for project-specific patterns and conventions.`}functi
1107
1107
  - After @planning \u2192 STOP and wait for user to approve the spec
1108
1108
  - Check project's existing code for patterns before implementing
1109
1109
  - Use @debugger if you encounter build errors or bugs
1110
- </workflow>`}function bt(e,t){let n=`**@planning** - Design before building:
1110
+ </workflow>`}function _t(e,t){let n=`**@planning** - Design before building:
1111
1111
  - Complex features \u2192 plan first
1112
1112
  - Asks questions, designs spec
1113
1113
  - **Saves spec using save_specification MCP tool**
@@ -1138,7 +1138,7 @@ ${r?"- **Must complete before @frontend starts!**":""}
1138
1138
  **\u26A0\uFE0F MANDATORY DELEGATION - You MUST use subagents:**
1139
1139
 
1140
1140
  ${n}
1141
- </subagents>`}function kt(e){return e.services?.frontend?e.techStack?.frontend?.some(n=>n.includes("TanStack")||n.includes("React Query")||n.includes("MUI"))??!1?`<frontend-api>
1141
+ </subagents>`}function St(e){return e.services?.frontend?e.techStack?.frontend?.some(n=>n.includes("TanStack")||n.includes("React Query")||n.includes("MUI"))??!1?`<frontend-api>
1142
1142
  ## Orval-Generated API Hooks
1143
1143
 
1144
1144
  Frontend uses **Orval** to auto-generate React Query hooks from Swagger. Import from 'api/queries-commands.ts'.
@@ -1172,7 +1172,7 @@ queryClient.invalidateQueries({ queryKey: getGetApiPeopleQueryKey() })
1172
1172
 
1173
1173
  Check the project's existing patterns for API calls and data fetching.
1174
1174
  Look for existing feature code to understand the correct patterns before writing new API calls.
1175
- </frontend-api>`:""}function _t(e,t){if(!e.services?.frontend)return"";let n=e.services.frontend.port,a=J(e),s=`http://localhost:${n}`;return`<ui-verification>
1175
+ </frontend-api>`:""}function wt(e,t){if(!e.services?.frontend)return"";let n=e.services.frontend.port,a=J(e),s=`http://localhost:${n}`;return`<ui-verification>
1176
1176
  ## \u{1F50D} UI Verification with Playwright
1177
1177
 
1178
1178
  You have access to **Playwright MCP** tools to verify the UI works correctly after making changes.
@@ -1219,13 +1219,13 @@ You have access to **Playwright MCP** tools to verify the UI works correctly aft
1219
1219
  - Use \`browser_evaluate\` to run JavaScript when you need complex interactions
1220
1220
  - Use screenshots when you want to show the user what you see
1221
1221
  - ${t?"In local mode, the browser window will be visible to you":"In container mode, browser runs headless"}
1222
- </ui-verification>`}function Je(e){return e&&e.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"\uFFFD")}var St=null;function Xe(){return Je(St)}import*as fe from"path";import{fileURLToPath as vt}from"url";var Ct=ke(),Ze=fe.dirname(vt(import.meta.url)),pe=fe.resolve(Ze,"../mcps/stdio-server.js");console.log("[MCP] Stdio server path resolved:",pe);console.log("[MCP] __dirname:",Ze);async function et(e,t={}){let{model:n,sessionId:a=null,projectId:s=null,apiUrl:r=null,callbacks:o={},debugLog:g,abortController:k,debugMode:f=!1,isLocal:p=process.env.LOCAL_MODE==="true",projectConfig:T=D(process.env.WORKSPACE_DIR||process.cwd()),useDefaultStack:R=!0}=t,B=$e(g),$=new Set,Y=a||"",H,q,C,N=!1,X=!1,U=process.env.WORKSPACE_DIR||process.cwd();console.log("[MCP] Configuring agent-planning stdio server:"),console.log("[MCP] Command: node"),console.log("[MCP] Args:",[pe]),console.log("[MCP] Env: API_URL=",process.env.API_URL||"http://localhost:5338",", PROJECT_ID=",s||process.env.PROJECT_ID||"",", PROJECT_KEY=",process.env.PROJECT_KEY?"***set***":"(not set)",", WORKSPACE_DIR=",U),console.log("[MCP] File exists check:",pe);try{for await(let d of wt({prompt:e,options:{abortController:k,cwd:U,resume:a??void 0,allowedTools:["Bash","Read","Write","Edit","MultiEdit","Glob","Grep","LS","WebFetch","NotebookRead","NotebookEdit","mcp__agent-insights__check_backend_build","mcp__agent-insights__check_frontend_types","mcp__agent-insights__check_service_health",...p?[]:["mcp__agent-insights__stop_services","mcp__agent-insights__start_services","mcp__agent-insights__restart_services"],"mcp__agent-planning__start_question_session","mcp__agent-planning__ask_question","mcp__agent-planning__end_question_session","mcp__agent-planning__save_specification","mcp__agent-planning__list_specifications","mcp__agent-planning__read_specification","mcp__agent-planning__delete_specification","mcp__agent-planning__report_learning","mcp__agent-planning__report_bug","mcp__agent-planning__report_debug_insight","mcp__agent-planning__get_kanban_board","mcp__agent-planning__get_column_cards","mcp__agent-planning__get_card_details","mcp__agent-planning__create_kanban_card","mcp__agent-planning__update_kanban_card","mcp__agent-planning__move_kanban_card","mcp__agent-planning__delete_kanban_card","mcp__agent-planning__create_subtask","mcp__agent-planning__toggle_subtask","mcp__agent-planning__delete_subtask","mcp__agent-planning__get_project_prompt","mcp__agent-planning__update_project_prompt","mcp__agent-planning__create_command","mcp__agent-planning__get_test_suites","mcp__agent-planning__get_test_suite_details","mcp__agent-planning__get_test_details","mcp__agent-planning__run_test","mcp__agent-planning__run_test_suite","mcp__agent-planning__report_test_status","mcp__agent-planning__create_test_suite","mcp__agent-planning__create_test","mcp__agent-planning__update_test","mcp__playwright__browser_navigate","mcp__playwright__browser_snapshot","mcp__playwright__browser_take_screenshot","mcp__playwright__browser_click","mcp__playwright__browser_type","mcp__playwright__browser_scroll_down","mcp__playwright__browser_scroll_up","mcp__playwright__browser_go_back","mcp__playwright__browser_go_forward","mcp__playwright__browser_wait","mcp__playwright__browser_screen_capture","mcp__playwright__browser_screen_move_mouse","mcp__playwright__browser_screen_click","mcp__playwright__browser_screen_drag","mcp__playwright__browser_screen_type","mcp__playwright__browser_evaluate","mcp__playwright__browser_tab_list","mcp__playwright__browser_tab_new","mcp__playwright__browser_tab_select","mcp__playwright__browser_tab_close"],model:n,mcpServers:{"agent-insights":Ct,"agent-planning":{type:"stdio",command:"node",args:[pe],env:{WORKSPACE_DIR:U,API_URL:r||process.env.API_URL||process.env.MASTER_URL||"http://localhost:5338",PROJECT_ID:s||process.env.PROJECT_ID||"",PROJECT_KEY:process.env.PROJECT_KEY||""}},playwright:{type:"stdio",command:"npx",args:["@playwright/mcp@latest","--caps=vision",...p?[]:["--headless"]]}},settingSources:["project"],disallowedTools:["AskUserQuestion","TodoWrite","EnterPlanMode"],agents:R?{scaffolding:_e,debugger:re,planning:ae,backend:Se,frontend:we,"project-context":ie}:{debugger:re,planning:ae,"project-context":ie},systemPrompt:ze({debugMode:f,projectPrompt:Xe(),isLocal:p,projectConfig:T,useDefaultStack:R})}}))if(!(!d.uuid||$.has(d.uuid))){switch($.add(d.uuid),B?.log(d),o.onRawMessage?.(d),d.type){case"assistant":if(d.message?.content)for(let w of d.message.content)w.type==="text"?o.onAssistantText?.(w.text):w.type==="tool_use"?o.onAssistantToolUse?.(w.name,w.input):w.type==="tool_result"&&o.onAssistantToolResult?.(w.tool_use_id,w.content);break;case"user":o.onUserMessage?.(d);break;case"result":if(d.subtype==="success")H=d.result,q=d.total_cost_usd,o.onResult?.(d.result,d.total_cost_usd);else{let w=`Agent error: ${d.subtype}`;C=w,o.onError?.(w)}X=!0;break;case"system":switch(d.subtype){case"init":Y=d.session_id,B?.setSessionId(d.session_id),o.onSystemInit?.(d.session_id);break;case"status":o.onSystemStatus?.(JSON.stringify(d));break;case"compact_boundary":break;case"hook_response":break}break;case"stream_event":o.onStreamEvent?.(d);break;case"tool_progress":o.onToolProgress?.(d);break;case"auth_status":o.onAuthStatus?.(d);break}if(X)break}}catch(d){d instanceof Error&&d.name==="AbortError"||d instanceof Error&&d.message.includes("aborted by user")?(N=!0,o.onAborted?.()):(C=d instanceof Error?d.message:String(d),o.onError?.(C))}finally{B?.stop()}return console.log("after try"),{sessionId:Y,result:H,cost:q,error:C,aborted:N}}function tt(e){return`User answered the questions:
1222
+ </ui-verification>`}function Ze(e){return e&&e.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g,"\uFFFD")}var vt=null;function et(){return Ze(vt)}import*as ne from"path";import*as Ce from"fs";import{fileURLToPath as Tt}from"url";var Et=ke(),ve=ne.dirname(Tt(import.meta.url)),tt=[ne.resolve(ve,"../mcps/stdio-server.js"),ne.resolve(ve,"./adapters/mcps/stdio-server.js")],te=tt.find(e=>Ce.existsSync(e))||tt[0];console.log("[MCP] Stdio server path resolved:",te);console.log("[MCP] __dirname:",ve);console.log("[MCP] File exists:",Ce.existsSync(te));async function nt(e,t={}){let{model:n,sessionId:a=null,projectId:s=null,apiUrl:r=null,callbacks:o={},debugLog:g,abortController:k,debugMode:f=!1,isLocal:p=process.env.LOCAL_MODE==="true",projectConfig:T=D(process.env.WORKSPACE_DIR||process.cwd()),useDefaultStack:R=!0}=t,B=We(g),$=new Set,Y=a||"",H,q,C,N=!1,X=!1,U=process.env.WORKSPACE_DIR||process.cwd();console.log("[MCP] Configuring agent-planning stdio server:"),console.log("[MCP] Command: node"),console.log("[MCP] Args:",[te]),console.log("[MCP] Env: API_URL=",process.env.API_URL||"http://localhost:5338",", PROJECT_ID=",s||process.env.PROJECT_ID||"",", PROJECT_KEY=",process.env.PROJECT_KEY?"***set***":"(not set)",", WORKSPACE_DIR=",U),console.log("[MCP] File exists check:",te);try{for await(let d of Ct({prompt:e,options:{abortController:k,cwd:U,resume:a??void 0,allowedTools:["Bash","Read","Write","Edit","MultiEdit","Glob","Grep","LS","WebFetch","NotebookRead","NotebookEdit","mcp__agent-insights__check_backend_build","mcp__agent-insights__check_frontend_types","mcp__agent-insights__check_service_health",...p?[]:["mcp__agent-insights__stop_services","mcp__agent-insights__start_services","mcp__agent-insights__restart_services"],"mcp__agent-planning__start_question_session","mcp__agent-planning__ask_question","mcp__agent-planning__end_question_session","mcp__agent-planning__save_specification","mcp__agent-planning__list_specifications","mcp__agent-planning__read_specification","mcp__agent-planning__delete_specification","mcp__agent-planning__report_learning","mcp__agent-planning__report_bug","mcp__agent-planning__report_debug_insight","mcp__agent-planning__get_kanban_board","mcp__agent-planning__get_column_cards","mcp__agent-planning__get_card_details","mcp__agent-planning__create_kanban_card","mcp__agent-planning__update_kanban_card","mcp__agent-planning__move_kanban_card","mcp__agent-planning__delete_kanban_card","mcp__agent-planning__create_subtask","mcp__agent-planning__toggle_subtask","mcp__agent-planning__delete_subtask","mcp__agent-planning__get_project_prompt","mcp__agent-planning__update_project_prompt","mcp__agent-planning__create_command","mcp__agent-planning__get_test_suites","mcp__agent-planning__get_test_suite_details","mcp__agent-planning__get_test_details","mcp__agent-planning__run_test","mcp__agent-planning__run_test_suite","mcp__agent-planning__report_test_status","mcp__agent-planning__create_test_suite","mcp__agent-planning__create_test","mcp__agent-planning__update_test","mcp__playwright__browser_navigate","mcp__playwright__browser_snapshot","mcp__playwright__browser_take_screenshot","mcp__playwright__browser_click","mcp__playwright__browser_type","mcp__playwright__browser_scroll_down","mcp__playwright__browser_scroll_up","mcp__playwright__browser_go_back","mcp__playwright__browser_go_forward","mcp__playwright__browser_wait","mcp__playwright__browser_screen_capture","mcp__playwright__browser_screen_move_mouse","mcp__playwright__browser_screen_click","mcp__playwright__browser_screen_drag","mcp__playwright__browser_screen_type","mcp__playwright__browser_evaluate","mcp__playwright__browser_tab_list","mcp__playwright__browser_tab_new","mcp__playwright__browser_tab_select","mcp__playwright__browser_tab_close"],model:n,mcpServers:{"agent-insights":Et,"agent-planning":{type:"stdio",command:"node",args:[te],env:{WORKSPACE_DIR:U,API_URL:r||process.env.API_URL||process.env.MASTER_URL||"http://localhost:5338",PROJECT_ID:s||process.env.PROJECT_ID||"",PROJECT_KEY:process.env.PROJECT_KEY||""}},playwright:{type:"stdio",command:"npx",args:["@playwright/mcp@latest","--caps=vision",...p?[]:["--headless"]]}},settingSources:["project"],disallowedTools:["AskUserQuestion","TodoWrite","EnterPlanMode"],agents:R?{scaffolding:_e,debugger:ie,planning:ce,backend:Se,frontend:we,"project-context":le}:{debugger:ie,planning:ce,"project-context":le},systemPrompt:Xe({debugMode:f,projectPrompt:et(),isLocal:p,projectConfig:T,useDefaultStack:R})}}))if(!(!d.uuid||$.has(d.uuid))){switch($.add(d.uuid),B?.log(d),o.onRawMessage?.(d),d.type){case"assistant":if(d.message?.content)for(let w of d.message.content)w.type==="text"?o.onAssistantText?.(w.text):w.type==="tool_use"?o.onAssistantToolUse?.(w.name,w.input):w.type==="tool_result"&&o.onAssistantToolResult?.(w.tool_use_id,w.content);break;case"user":o.onUserMessage?.(d);break;case"result":if(d.subtype==="success")H=d.result,q=d.total_cost_usd,o.onResult?.(d.result,d.total_cost_usd);else{let w=`Agent error: ${d.subtype}`;C=w,o.onError?.(w)}X=!0;break;case"system":switch(d.subtype){case"init":Y=d.session_id,B?.setSessionId(d.session_id),o.onSystemInit?.(d.session_id);break;case"status":o.onSystemStatus?.(JSON.stringify(d));break;case"compact_boundary":break;case"hook_response":break}break;case"stream_event":o.onStreamEvent?.(d);break;case"tool_progress":o.onToolProgress?.(d);break;case"auth_status":o.onAuthStatus?.(d);break}if(X)break}}catch(d){d instanceof Error&&d.name==="AbortError"||d instanceof Error&&d.message.includes("aborted by user")?(N=!0,o.onAborted?.()):(C=d instanceof Error?d.message:String(d),o.onError?.(C))}finally{B?.stop()}return console.log("after try"),{sessionId:Y,result:H,cost:q,error:C,aborted:N}}function st(e){return`User answered the questions:
1223
1223
 
1224
1224
  ${Object.entries(e).map(([n,a])=>{let s=Array.isArray(a)?a.join(", "):a;return`${n}: ${s}`}).join(`
1225
- `)}`}import{spawn as nt,execSync as W}from"child_process";import*as b from"fs";import*as st from"http";import*as j from"path";function ot(e){let{workspaceDir:t,apiPort:n,webPort:a,onBackendError:s,onFrontendError:r,projectConfig:o=D(t)}=e,g=n??o.services?.backend?.port??5338,k=a??o.services?.frontend?.port??5173,f=O(o),p=F(o),T=o.services?.backend?.startCommand??"dotnet run",R=o.services?.backend?.buildCommand??"dotnet build",B=o.services?.backend?.typecheckCommand??"dotnet build --no-restore",$=o.services?.frontend?.startCommand??"npm run dev",Y=o.services?.frontend?.typecheckCommand??"npx tsc -p tsconfig.app.json --noEmit",H=o.services?.backend?.logFile??"/tmp/api.log",q=o.services?.frontend?.logFile??"/tmp/web.log",C=null,N=null,X=l=>new Promise(i=>{let u=setTimeout(()=>i(!1),3e3);st.get(`http://localhost:${l}`,v=>{clearTimeout(u),i(v.statusCode!==void 0&&v.statusCode<500)}).on("error",()=>{clearTimeout(u),i(!1)})}),U=l=>{try{let i=W(`lsof -ti:${l} 2>/dev/null || true`,{encoding:"utf-8"}).trim();if(i){let u=i.split(`
1226
- `).filter(Boolean);console.log(`[Services] Killing ${u.length} process(es) on port ${l}: ${u.join(", ")}`);for(let m of u)try{process.kill(parseInt(m,10),"SIGKILL")}catch{}}}catch{try{W(`fuser -k ${l}/tcp 2>/dev/null || true`,{encoding:"utf-8"})}catch{}}},d=(l,i)=>new Promise(u=>{if(!l||!l.pid){u();return}console.log(`[Services] Stopping ${i} (PID: ${l.pid})...`);try{process.kill(-l.pid,"SIGTERM")}catch{try{l.kill("SIGTERM")}catch{}}setTimeout(u,500)}),w=async()=>{if(!f||!b.existsSync(f)){console.log("[Services] No backend found, skipping backend start");return}U(g),console.log(`[Services] Starting backend with: ${T}...`);let l=j.dirname(H);b.existsSync(l)||b.mkdirSync(l,{recursive:!0});let i=b.createWriteStream(H,{flags:"a"}),[u,...m]=T.split(" ");C=nt(u,m,{cwd:f,stdio:["ignore","pipe","pipe"],detached:!0,shell:!0});let v="",_=h=>{let L=h.toString();i.write(L);let A=(v+L).split(`
1227
- `);v=A.pop()||"";for(let x of A)x&&Tt(x)&&s&&s(x)};C.stdout?.on("data",_),C.stderr?.on("data",_),C.on("exit",h=>{i.end(),h!==0&&h!==null&&s&&s(`Process exited with code ${h}`)}),C.unref()},ve=async()=>{if(!p||!b.existsSync(j.join(p,"package.json"))){console.log("[Services] No frontend found, skipping frontend start");return}U(k),console.log(`[Services] Starting frontend with: ${$}...`);let l=j.dirname(q);b.existsSync(l)||b.mkdirSync(l,{recursive:!0});let[i,...u]=$.split(" ");N=nt(i,u,{cwd:p,stdio:["ignore",b.openSync(q,"w"),b.openSync(q,"w")],detached:!0,shell:!0}),N.unref()},Ce=async()=>{await d(C,"backend"),C=null,U(g)},Te=async()=>{await d(N,"frontend"),N=null,U(k)},ge=async()=>{let[l,i]=await Promise.all([X(g),X(k)]);return{api:l,web:i}},Ee=async(l=15e3)=>{let i=Date.now(),u=1e3,m=0,v=null,_=null;for(console.log(`[Services] Waiting for health (timeout: ${l}ms)...`);Date.now()-i<l;){m++;let A=await ge(),x=Date.now()-i;if(A.web&&_===null&&(_=x,console.log(`[Services] \u2713 Frontend (Vite) ready after ${x}ms`)),A.api&&v===null&&(v=x,console.log(`[Services] \u2713 Backend (dotnet) ready after ${x}ms`)),console.log(`[Services] Health poll #${m} (${x}ms): api=${A.api}, web=${A.web}`),A.api&&A.web)return console.log(`[Services] \u2713 Both services healthy after ${x}ms (${m} polls)`),A;await new Promise(ct=>setTimeout(ct,u))}let h=await ge(),L=Date.now()-i;return h.web&&_===null&&console.log(`[Services] \u2713 Frontend (Vite) ready after ${L}ms`),h.api&&v===null&&console.log(`[Services] \u2713 Backend (dotnet) ready after ${L}ms`),console.log(`[Services] \u26A0 Health timeout after ${L}ms: api=${h.api}, web=${h.web}`),h},at=async l=>{console.log(`[Services] Restarting ${l}...`);let i={success:!0},u=l==="backend"||l==="both",m=l==="frontend"||l==="both";if(u&&await Ce(),m&&await Te(),u&&f&&b.existsSync(f)){console.log(`[Services] Building backend with: ${R}...`);try{W(R,{cwd:f,stdio:"pipe",timeout:12e4,encoding:"utf-8"}),console.log("[Services] \u2713 Backend build succeeded")}catch(_){let h=_;i.success=!1,i.backendError=h.stderr||h.stdout||"Build failed",console.error("[Services] \u2717 Backend build failed")}}if(m&&p&&b.existsSync(j.join(p,"package.json"))){console.log(`[Services] Type-checking frontend with: ${Y}...`);try{W(Y,{cwd:p,stdio:"pipe",timeout:6e4,encoding:"utf-8"}),console.log("[Services] \u2713 Frontend types OK")}catch(_){let h=_;i.success=!1,i.frontendError=h.stderr||h.stdout||"Type check failed",console.error("[Services] \u2717 Frontend type check failed")}}console.log(`[Services] Starting ${l}...`),u&&await w(),m&&await ve();let v=await Ee(1e4);if(u&&!v.api){i.success=!1;let _=await xe("backend",20),h=_.length>0?`
1225
+ `)}`}import{spawn as ot,execSync as W}from"child_process";import*as b from"fs";import*as rt from"http";import*as j from"path";function at(e){let{workspaceDir:t,apiPort:n,webPort:a,onBackendError:s,onFrontendError:r,projectConfig:o=D(t)}=e,g=n??o.services?.backend?.port??5338,k=a??o.services?.frontend?.port??5173,f=O(o),p=F(o),T=o.services?.backend?.startCommand??"dotnet run",R=o.services?.backend?.buildCommand??"dotnet build",B=o.services?.backend?.typecheckCommand??"dotnet build --no-restore",$=o.services?.frontend?.startCommand??"npm run dev",Y=o.services?.frontend?.typecheckCommand??"npx tsc -p tsconfig.app.json --noEmit",H=o.services?.backend?.logFile??"/tmp/api.log",q=o.services?.frontend?.logFile??"/tmp/web.log",C=null,N=null,X=l=>new Promise(i=>{let u=setTimeout(()=>i(!1),3e3);rt.get(`http://localhost:${l}`,v=>{clearTimeout(u),i(v.statusCode!==void 0&&v.statusCode<500)}).on("error",()=>{clearTimeout(u),i(!1)})}),U=l=>{try{let i=W(`lsof -ti:${l} 2>/dev/null || true`,{encoding:"utf-8"}).trim();if(i){let u=i.split(`
1226
+ `).filter(Boolean);console.log(`[Services] Killing ${u.length} process(es) on port ${l}: ${u.join(", ")}`);for(let m of u)try{process.kill(parseInt(m,10),"SIGKILL")}catch{}}}catch{try{W(`fuser -k ${l}/tcp 2>/dev/null || true`,{encoding:"utf-8"})}catch{}}},d=(l,i)=>new Promise(u=>{if(!l||!l.pid){u();return}console.log(`[Services] Stopping ${i} (PID: ${l.pid})...`);try{process.kill(-l.pid,"SIGTERM")}catch{try{l.kill("SIGTERM")}catch{}}setTimeout(u,500)}),w=async()=>{if(!f||!b.existsSync(f)){console.log("[Services] No backend found, skipping backend start");return}U(g),console.log(`[Services] Starting backend with: ${T}...`);let l=j.dirname(H);b.existsSync(l)||b.mkdirSync(l,{recursive:!0});let i=b.createWriteStream(H,{flags:"a"}),[u,...m]=T.split(" ");C=ot(u,m,{cwd:f,stdio:["ignore","pipe","pipe"],detached:!0,shell:!0});let v="",_=h=>{let L=h.toString();i.write(L);let A=(v+L).split(`
1227
+ `);v=A.pop()||"";for(let x of A)x&&Pt(x)&&s&&s(x)};C.stdout?.on("data",_),C.stderr?.on("data",_),C.on("exit",h=>{i.end(),h!==0&&h!==null&&s&&s(`Process exited with code ${h}`)}),C.unref()},Te=async()=>{if(!p||!b.existsSync(j.join(p,"package.json"))){console.log("[Services] No frontend found, skipping frontend start");return}U(k),console.log(`[Services] Starting frontend with: ${$}...`);let l=j.dirname(q);b.existsSync(l)||b.mkdirSync(l,{recursive:!0});let[i,...u]=$.split(" ");N=ot(i,u,{cwd:p,stdio:["ignore",b.openSync(q,"w"),b.openSync(q,"w")],detached:!0,shell:!0}),N.unref()},Ee=async()=>{await d(C,"backend"),C=null,U(g)},Pe=async()=>{await d(N,"frontend"),N=null,U(k)},ge=async()=>{let[l,i]=await Promise.all([X(g),X(k)]);return{api:l,web:i}},Ae=async(l=15e3)=>{let i=Date.now(),u=1e3,m=0,v=null,_=null;for(console.log(`[Services] Waiting for health (timeout: ${l}ms)...`);Date.now()-i<l;){m++;let A=await ge(),x=Date.now()-i;if(A.web&&_===null&&(_=x,console.log(`[Services] \u2713 Frontend (Vite) ready after ${x}ms`)),A.api&&v===null&&(v=x,console.log(`[Services] \u2713 Backend (dotnet) ready after ${x}ms`)),console.log(`[Services] Health poll #${m} (${x}ms): api=${A.api}, web=${A.web}`),A.api&&A.web)return console.log(`[Services] \u2713 Both services healthy after ${x}ms (${m} polls)`),A;await new Promise(dt=>setTimeout(dt,u))}let h=await ge(),L=Date.now()-i;return h.web&&_===null&&console.log(`[Services] \u2713 Frontend (Vite) ready after ${L}ms`),h.api&&v===null&&console.log(`[Services] \u2713 Backend (dotnet) ready after ${L}ms`),console.log(`[Services] \u26A0 Health timeout after ${L}ms: api=${h.api}, web=${h.web}`),h},ct=async l=>{console.log(`[Services] Restarting ${l}...`);let i={success:!0},u=l==="backend"||l==="both",m=l==="frontend"||l==="both";if(u&&await Ee(),m&&await Pe(),u&&f&&b.existsSync(f)){console.log(`[Services] Building backend with: ${R}...`);try{W(R,{cwd:f,stdio:"pipe",timeout:12e4,encoding:"utf-8"}),console.log("[Services] \u2713 Backend build succeeded")}catch(_){let h=_;i.success=!1,i.backendError=h.stderr||h.stdout||"Build failed",console.error("[Services] \u2717 Backend build failed")}}if(m&&p&&b.existsSync(j.join(p,"package.json"))){console.log(`[Services] Type-checking frontend with: ${Y}...`);try{W(Y,{cwd:p,stdio:"pipe",timeout:6e4,encoding:"utf-8"}),console.log("[Services] \u2713 Frontend types OK")}catch(_){let h=_;i.success=!1,i.frontendError=h.stderr||h.stdout||"Type check failed",console.error("[Services] \u2717 Frontend type check failed")}}console.log(`[Services] Starting ${l}...`),u&&await w(),m&&await Te();let v=await Ae(1e4);if(u&&!v.api){i.success=!1;let _=await Ie("backend",20),h=_.length>0?`
1228
1228
  Recent logs:
1229
1229
  ${_.join(`
1230
- `)}`:"";i.backendError||(i.backendError=`Backend failed to start.${h}`)}return m&&!v.web&&(i.success=!1,i.frontendError||(i.frontendError="Frontend failed to start")),i},Pe=async()=>{if(!f||!b.existsSync(f))return{success:!0};try{return W(B,{cwd:f,stdio:"pipe",timeout:12e4,encoding:"utf-8"}),{success:!0}}catch(l){let i=l;return{success:!1,errors:i.stdout||i.stderr||"Build failed"}}},Ae=async()=>{if(!p||!b.existsSync(j.join(p,"package.json")))return{success:!0};try{return W(Y,{cwd:p,stdio:"pipe",timeout:6e4,encoding:"utf-8"}),{success:!0}}catch(l){let i=l;return{success:!1,errors:i.stdout||i.stderr||"Type check failed"}}},it=async()=>{let[l,i]=await Promise.all([Pe(),Ae()]);return{backend:l,frontend:i}},xe=async(l,i)=>{let u=l==="backend"?H:q;if(!b.existsSync(u))return[`Log file not found: ${u}`];try{return W(`tail -n ${i} ${u}`,{encoding:"utf-8"}).split(`
1231
- `).filter(Boolean)}catch(m){return[`Error reading logs: ${m instanceof Error?m.message:String(m)}`]}};return{startBackend:w,startFrontend:ve,stopBackend:Ce,stopFrontend:Te,restartServices:at,checkHealth:ge,waitForHealth:Ee,getProcesses:()=>({backend:C,frontend:N}),checkBackendBuild:Pe,checkFrontendTypes:Ae,runTypeChecks:it,tailLogs:xe,checkSwaggerEndpoints:async l=>{let i=j.join(t,"swagger.json");if(!b.existsSync(i))return{foundEndpoints:["Error: swagger.json not found"],totalEndpoints:0};try{let u=JSON.parse(b.readFileSync(i,"utf-8")),m=Object.keys(u.paths||{}),v=[];for(let _ of m)if(_.toLowerCase().includes(l.toLowerCase())){let h=Object.keys(u.paths[_]);for(let L of h)v.push(`${L.toUpperCase()} ${_}`)}return{foundEndpoints:v,totalEndpoints:m.length}}catch(u){return{foundEndpoints:[`Error parsing swagger.json: ${u instanceof Error?u.message:String(u)}`],totalEndpoints:0}}}}}function Tt(e){let t=e.toLowerCase();return t.includes("exception")||t.includes("fail:")||t.includes("[err]")||t.includes("[error]")}import{execSync as G}from"child_process";function rt(e){let t=async()=>{try{return G("git status --porcelain",{cwd:e,encoding:"utf-8"}).trim().length>0}catch{return!1}},n=async()=>{try{return G("git branch --show-current",{cwd:e,encoding:"utf-8"}).trim()}catch{return"unknown"}};return{hasChanges:t,commitAndPush:async(s,r)=>{try{if(!await t())return{success:!0,noChanges:!0};let o=s.length>60?s.substring(0,60)+"...":s,k=`${r?"[agent] (partial)":"[agent]"} ${o}`;G("git add -A",{cwd:e}),G(`git commit -m "${k.replace(/"/g,'\\"')}"`,{cwd:e,encoding:"utf-8"});let f=G("git rev-parse --short HEAD",{cwd:e,encoding:"utf-8"}).trim();try{G("git push",{cwd:e,stdio:"pipe"})}catch(p){let T=p instanceof Error?p.message:String(p);if(T.includes("no upstream branch")){let R=await n();G(`git push --set-upstream origin ${R}`,{cwd:e,stdio:"pipe"})}else return console.error("[Git] Push failed:",T),{success:!0,commitHash:f,error:`Committed but push failed: ${T}`}}return{success:!0,commitHash:f}}catch(o){let g=o instanceof Error?o.message:String(o);return console.error("[Git] Error:",g),{success:!1,error:g}}},getCurrentBranch:n}}export{Z as ProjectConfigSchema,be as createFilePlanningTransport,he as createFileTransport,rt as createLocalGitManager,ot as createLocalServiceManager,ke as createMcpServer,tt as formatAnswersAsPrompt,ee as getBackendFeaturesPath,O as getBackendPath,D as getDefaultConfig,J as getFrontendFeaturesPath,F as getFrontendPath,Ve as getPathsDescription,ue as getServicesDescription,de as getTechStackDescription,Ke as isBackendFile,Qe as isFrontendFile,Ye as loadProjectConfig,ye as readPendingQuestions,le as resolveConfigPath,et as runAgent,He as saveProjectConfig,Ie as setPlanningTransport,De as setServiceManager};
1230
+ `)}`:"";i.backendError||(i.backendError=`Backend failed to start.${h}`)}return m&&!v.web&&(i.success=!1,i.frontendError||(i.frontendError="Frontend failed to start")),i},xe=async()=>{if(!f||!b.existsSync(f))return{success:!0};try{return W(B,{cwd:f,stdio:"pipe",timeout:12e4,encoding:"utf-8"}),{success:!0}}catch(l){let i=l;return{success:!1,errors:i.stdout||i.stderr||"Build failed"}}},Re=async()=>{if(!p||!b.existsSync(j.join(p,"package.json")))return{success:!0};try{return W(Y,{cwd:p,stdio:"pipe",timeout:6e4,encoding:"utf-8"}),{success:!0}}catch(l){let i=l;return{success:!1,errors:i.stdout||i.stderr||"Type check failed"}}},lt=async()=>{let[l,i]=await Promise.all([xe(),Re()]);return{backend:l,frontend:i}},Ie=async(l,i)=>{let u=l==="backend"?H:q;if(!b.existsSync(u))return[`Log file not found: ${u}`];try{return W(`tail -n ${i} ${u}`,{encoding:"utf-8"}).split(`
1231
+ `).filter(Boolean)}catch(m){return[`Error reading logs: ${m instanceof Error?m.message:String(m)}`]}};return{startBackend:w,startFrontend:Te,stopBackend:Ee,stopFrontend:Pe,restartServices:ct,checkHealth:ge,waitForHealth:Ae,getProcesses:()=>({backend:C,frontend:N}),checkBackendBuild:xe,checkFrontendTypes:Re,runTypeChecks:lt,tailLogs:Ie,checkSwaggerEndpoints:async l=>{let i=j.join(t,"swagger.json");if(!b.existsSync(i))return{foundEndpoints:["Error: swagger.json not found"],totalEndpoints:0};try{let u=JSON.parse(b.readFileSync(i,"utf-8")),m=Object.keys(u.paths||{}),v=[];for(let _ of m)if(_.toLowerCase().includes(l.toLowerCase())){let h=Object.keys(u.paths[_]);for(let L of h)v.push(`${L.toUpperCase()} ${_}`)}return{foundEndpoints:v,totalEndpoints:m.length}}catch(u){return{foundEndpoints:[`Error parsing swagger.json: ${u instanceof Error?u.message:String(u)}`],totalEndpoints:0}}}}}function Pt(e){let t=e.toLowerCase();return t.includes("exception")||t.includes("fail:")||t.includes("[err]")||t.includes("[error]")}import{execSync as G}from"child_process";function it(e){let t=async()=>{try{return G("git status --porcelain",{cwd:e,encoding:"utf-8"}).trim().length>0}catch{return!1}},n=async()=>{try{return G("git branch --show-current",{cwd:e,encoding:"utf-8"}).trim()}catch{return"unknown"}};return{hasChanges:t,commitAndPush:async(s,r)=>{try{if(!await t())return{success:!0,noChanges:!0};let o=s.length>60?s.substring(0,60)+"...":s,k=`${r?"[agent] (partial)":"[agent]"} ${o}`;G("git add -A",{cwd:e}),G(`git commit -m "${k.replace(/"/g,'\\"')}"`,{cwd:e,encoding:"utf-8"});let f=G("git rev-parse --short HEAD",{cwd:e,encoding:"utf-8"}).trim();try{G("git push",{cwd:e,stdio:"pipe"})}catch(p){let T=p instanceof Error?p.message:String(p);if(T.includes("no upstream branch")){let R=await n();G(`git push --set-upstream origin ${R}`,{cwd:e,stdio:"pipe"})}else return console.error("[Git] Push failed:",T),{success:!0,commitHash:f,error:`Committed but push failed: ${T}`}}return{success:!0,commitHash:f}}catch(o){let g=o instanceof Error?o.message:String(o);return console.error("[Git] Error:",g),{success:!1,error:g}}},getCurrentBranch:n}}export{Z as ProjectConfigSchema,be as createFilePlanningTransport,he as createFileTransport,it as createLocalGitManager,at as createLocalServiceManager,ke as createMcpServer,st as formatAnswersAsPrompt,ee as getBackendFeaturesPath,O as getBackendPath,D as getDefaultConfig,J as getFrontendFeaturesPath,F as getFrontendPath,Je as getPathsDescription,fe as getServicesDescription,pe as getTechStackDescription,Ve as isBackendFile,ze as isFrontendFile,Ke as loadProjectConfig,ye as readPendingQuestions,ue as resolveConfigPath,nt as runAgent,Qe as saveProjectConfig,Oe as setPlanningTransport,Fe as setServiceManager};
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- // Type declarations for dnm-agent-local
1
+ // Type declarations for glenn-code
2
2
  export { startSignalRAgent } from "./cli.js";
3
3
  export * from "./core.js";