rapidkit 0.40.0 → 0.41.0

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.
Files changed (95) hide show
  1. package/README.md +49 -23
  2. package/contracts/agent-customization-pack.v1.json +52 -2
  3. package/contracts/extension-cli-compatibility.v1.json +14 -2
  4. package/contracts/runtime-command-surface.v1.json +7 -1
  5. package/contracts/workspace-intelligence/agent-action-outcome.v1.json +22 -0
  6. package/contracts/workspace-intelligence/blocker-resolution.v1.json +65 -0
  7. package/contracts/workspace-intelligence/doctor-fix-result.v1.json +34 -0
  8. package/contracts/workspace-intelligence/studio-blocker-handoff.v1.json +91 -0
  9. package/contracts/workspace-intelligence/workspace-contract-verify.v1.json +51 -0
  10. package/contracts/workspace-intelligence/workspace-explain.v1.json +31 -0
  11. package/contracts/workspace-intelligence/workspace-intelligence-history.v1.json +36 -0
  12. package/contracts/workspace-intelligence/workspace-operational-skill.v1.json +37 -0
  13. package/contracts/workspace-intelligence/workspace-skills-index.v1.json +27 -0
  14. package/dist/analyze-JVMUCQ22.js +1 -0
  15. package/dist/autopilot-release-GM5ALPWO.js +1 -0
  16. package/dist/chunk-424B73UF.js +1 -0
  17. package/dist/chunk-44GSDNPQ.js +1 -0
  18. package/dist/chunk-56RL5OB6.js +2 -0
  19. package/dist/chunk-64RTZBHU.js +2 -0
  20. package/dist/chunk-73IS6RIM.js +7 -0
  21. package/dist/{chunk-VQMZC5TC.js → chunk-AO6PG3K2.js} +1 -1
  22. package/dist/chunk-AT3EQ2S7.js +2 -0
  23. package/dist/{chunk-3YLMCP3V.js → chunk-CDCYRBAY.js} +1 -1
  24. package/dist/chunk-DMUEGR36.js +2 -0
  25. package/dist/{chunk-4FJQWL7P.js → chunk-FPUNOIAR.js} +1 -1
  26. package/dist/chunk-FVCZGUVX.js +1 -0
  27. package/dist/chunk-ICGWHIMK.js +1 -0
  28. package/dist/{workspace-graph-ICB7OVAZ.js → chunk-JEI6BTZI.js} +1 -1
  29. package/dist/{chunk-ERCD6NFF.js → chunk-KTQZUWAM.js} +1 -1
  30. package/dist/{chunk-RXWM5DSC.js → chunk-MGUJWRZA.js} +2 -2
  31. package/dist/chunk-MIWDCR6I.js +2 -0
  32. package/dist/{chunk-6G2KSHP6.js → chunk-OLDPVVSV.js} +1 -1
  33. package/dist/chunk-P5ODFWB2.js +13 -0
  34. package/dist/{chunk-4Q2ZZKGB.js → chunk-PCXSTKZ5.js} +1 -1
  35. package/dist/{chunk-6KD5F6LX.js → chunk-Q2KZIBV4.js} +1 -1
  36. package/dist/chunk-QN2LPLHO.js +1 -0
  37. package/dist/chunk-RIZCWYRR.js +1 -0
  38. package/dist/chunk-VMJA36WD.js +1 -0
  39. package/dist/chunk-WA6JYVJM.js +2 -0
  40. package/dist/{chunk-G76C74EV.js → chunk-XOVB2ZP5.js} +1 -1
  41. package/dist/chunk-Y2SCTWL4.js +32 -0
  42. package/dist/chunk-YOQ2546V.js +50 -0
  43. package/dist/{chunk-ZWKLRZE5.js → chunk-ZQRFVFKK.js} +2 -2
  44. package/dist/{create-XVDDQA42.js → create-UGXMC4CT.js} +1 -1
  45. package/dist/{demo-kit-RWGOEDW4.js → demo-kit-2VI4H6OJ.js} +1 -1
  46. package/dist/{doctor-UOLOGJ2Z.js → doctor-LCKG5S76.js} +1 -1
  47. package/dist/{dotnet-webapi-clean-RTBRPDPL.js → dotnet-webapi-clean-K33C77EI.js} +1 -1
  48. package/dist/{gofiber-standard-UGIRKPKL.js → gofiber-standard-BQ4HCXL2.js} +1 -1
  49. package/dist/{gogin-standard-HJ7SPFNT.js → gogin-standard-PUBCYW3A.js} +1 -1
  50. package/dist/index.d.ts +45 -7
  51. package/dist/index.js +190 -115
  52. package/dist/{pipeline-M52LR5FJ.js → pipeline-MKNYPNGD.js} +1 -1
  53. package/dist/{springboot-standard-IWJSVDLZ.js → springboot-standard-XFVQI37R.js} +1 -1
  54. package/dist/{workspace-L4ITCKMM.js → workspace-FDMJD5XI.js} +1 -1
  55. package/dist/workspace-agent-sync-WJIZCZX5.js +1 -0
  56. package/dist/{workspace-context-NMMQMHNU.js → workspace-context-RYOQYGOP.js} +1 -1
  57. package/dist/workspace-contract-ITFCJCHI.js +1 -0
  58. package/dist/workspace-explain-VKSUKP3O.js +1 -0
  59. package/dist/workspace-explain-contract-CLHQ3XEH.js +1 -0
  60. package/dist/workspace-feedback-65NR3EZH.js +1 -0
  61. package/dist/{workspace-foundation-HNIRAIBF.js → workspace-foundation-SILFUKL5.js} +1 -1
  62. package/dist/workspace-graph-2A5THUCI.js +1 -0
  63. package/dist/workspace-history-VPDADQKG.js +1 -0
  64. package/dist/{workspace-intelligence-64IWAYHS.js → workspace-intelligence-YOZQBAK5.js} +1 -1
  65. package/dist/workspace-mcp-serve-OOLITFCK.js +3 -0
  66. package/dist/workspace-model-VMMLHJWI.js +1 -0
  67. package/dist/workspace-registry-summary-ZXGKL2NT.js +1 -0
  68. package/dist/workspace-run-IHB2TPMD.js +1 -0
  69. package/dist/workspace-verify-3CAKAZIL.js +1 -0
  70. package/dist/workspace-watch-3MEZRSEE.js +1 -0
  71. package/docs/contracts/ARTIFACT_CATALOG.md +3 -1
  72. package/docs/contracts/NAMING_AND_COEXISTENCE.md +58 -0
  73. package/docs/workspace-run.md +25 -1
  74. package/package.json +1 -1
  75. package/dist/analyze-RHQM4AB2.js +0 -1
  76. package/dist/autopilot-release-S32GYUAQ.js +0 -1
  77. package/dist/chunk-CY2WXWYQ.js +0 -7
  78. package/dist/chunk-FV5A3N3I.js +0 -2
  79. package/dist/chunk-GDGATWR5.js +0 -2
  80. package/dist/chunk-GOM3RFB3.js +0 -2
  81. package/dist/chunk-KYH364KQ.js +0 -1
  82. package/dist/chunk-NAMOYGLS.js +0 -2
  83. package/dist/chunk-OWNGSAO3.js +0 -2
  84. package/dist/chunk-QPEBI6AB.js +0 -2
  85. package/dist/chunk-TYZPPUBH.js +0 -1
  86. package/dist/chunk-WHCON2VN.js +0 -50
  87. package/dist/chunk-X7PWDIQW.js +0 -1
  88. package/dist/workspace-agent-sync-G7JU77IK.js +0 -25
  89. package/dist/workspace-contract-D5O4OZD5.js +0 -1
  90. package/dist/workspace-history-LHUTLE3S.js +0 -1
  91. package/dist/workspace-model-SDHH5RBC.js +0 -1
  92. package/dist/workspace-registry-summary-MIPHVB56.js +0 -1
  93. package/dist/workspace-run-A26PEGQT.js +0 -1
  94. package/dist/workspace-verify-6Q6MGRG6.js +0 -1
  95. package/dist/workspace-watch-JDXVGW4H.js +0 -1
@@ -1,4 +1,4 @@
1
- import {c}from'./chunk-CY2WXWYQ.js';import {b}from'./chunk-WHCON2VN.js';import {b as b$1}from'./chunk-RXWM5DSC.js';import {a as a$1}from'./chunk-VQMZC5TC.js';import {a as a$2}from'./chunk-4FJQWL7P.js';import {a}from'./chunk-KMUWWZRT.js';import {f,e}from'./chunk-4Q2ZZKGB.js';import c$1 from'chalk';import D from'fs-extra';import u from'path';function C(t){return t===0?"pass":t===2?"warn":"fail"}function M(t){return t.some(s=>s.status==="fail")?"blocked":t.some(s=>s.status==="warn")?"needs-attention":"ready"}function F(t,s){if(s)return 3;let a=t.some(i=>i.status==="fail"),r=t.some(i=>i.status==="warn");return a?1:r?2:0}async function j(t){let s=await b$1(t,true),a=false;try{let{syncWorkspaceContract:r}=await import('./workspace-contract-D5O4OZD5.js');await r({workspacePath:t}),a=true;}catch{a=false;}return {sync:s,contractSynced:a}}async function G(t={}){let s=u.resolve(t.workspacePath??process.cwd()),a$3=a(s);if(!a$3)throw new Error("No RapidKit workspace found in current directory or parents");let r=[],i=[],l=false,p,y,m,f$1=Date.now();try{let{sync:e,contractSynced:n}=await j(a$3),o=e.workspaceFound&&(e.added.length>0||e.skipped>=0)||e.workspaceFound?"pass":"warn";r.push({name:"sync",status:o,durationMs:Date.now()-f$1,summary:e.workspaceFound?`registry sync complete (${e.added.length} added, ${e.skipped} existing)${n?", contract synced":""}`:"workspace not registered in global registry; contract sync attempted"}),e.workspaceFound||i.push("workspace registry entry missing \u2014 run rapidkit create workspace or register manually");}catch(e){l=true,r.push({name:"sync",status:"fail",durationMs:Date.now()-f$1,summary:`sync failed: ${e instanceof Error?e.message:String(e)}`}),i.push("workspace sync stage failed");}let w=Date.now();try{let e=await b({workspace:true,json:true,quiet:true,strict:t.strict===true,ci:t.strict!==true}),n=C(e),o=u.join(a$3,".rapidkit","reports","doctor-last-run.json");r.push({name:"doctor",status:n,durationMs:Date.now()-w,summary:n==="pass"?"doctor workspace passed":n==="warn"?"doctor workspace reported warnings":"doctor workspace reported errors",exitCode:e,evidencePath:o}),n==="fail"?i.push("doctor workspace gate failed"):n==="warn"&&i.push("doctor workspace reported warnings");}catch(e){l=true,r.push({name:"doctor",status:"fail",durationMs:Date.now()-w,summary:`doctor failed: ${e instanceof Error?e.message:String(e)}`}),i.push("doctor workspace stage failed");}if(t.skipAnalyze)r.push({name:"analyze",status:"skipped",durationMs:0,summary:"analyze stage skipped"});else {let e=Date.now();try{let n=await a$1({workspacePath:a$3,json:true,strict:t.strict===true});p=u.join(a$3,".rapidkit","reports","analyze-last-run.json");let o=n.summary.verdict==="blocked"?"fail":n.summary.verdict==="needs-attention"?"warn":"pass";r.push({name:"analyze",status:o,durationMs:Date.now()-e,summary:`analyze verdict: ${n.summary.verdict} (score ${n.summary.score}/100)`,evidencePath:p}),o==="fail"?i.push("analyze reported blocked verdict"):o==="warn"&&i.push("analyze reported needs-attention verdict");}catch(n){l=true,r.push({name:"analyze",status:"fail",durationMs:Date.now()-e,summary:`analyze failed: ${n instanceof Error?n.message:String(n)}`}),i.push("analyze stage failed");}}let h=Date.now();try{let e=await a$2({startPath:a$3,writeReport:true,skipVerify:t.skipVerify===true});y=e.evidencePath;let n=e.overallStatus==="pass"?"pass":e.overallStatus==="warn"?"warn":"fail";r.push({name:"readiness",status:n,durationMs:Date.now()-h,summary:`readiness overall: ${e.overallStatus}`,evidencePath:e.evidencePath}),n==="fail"?i.push(...e.blockingReasons.map(o=>`readiness: ${o}`)):n==="warn"&&i.push(...e.gates.filter(o=>o.status==="warn").map(o=>`readiness warn: ${o.gate}: ${o.summary}`));}catch(e){l=true,r.push({name:"readiness",status:"fail",durationMs:Date.now()-h,summary:`readiness failed: ${e instanceof Error?e.message:String(e)}`}),i.push("readiness stage failed");}if(t.skipAutopilot)r.push({name:"autopilot",status:"skipped",durationMs:0,summary:"autopilot stage skipped"});else {let e=Date.now(),n=t.autopilotMode??"audit";try{let o=await c({workspacePath:a$3,mode:n,json:true,skipPipelineStages:true});m=o.artifacts.reportPath;let P=o.summary.verdict==="approved"?"pass":o.summary.verdict==="partial"?"warn":"fail";r.push({name:"autopilot",status:P,durationMs:Date.now()-e,summary:`autopilot ${n}: ${o.summary.verdict}`,exitCode:o.summary.exitCode,evidencePath:m}),P!=="pass"&&i.push(...o.blockingReasons.slice(0,5));}catch(o){l=true,r.push({name:"autopilot",status:"fail",durationMs:Date.now()-e,summary:`autopilot failed: ${o instanceof Error?o.message:String(o)}`}),i.push("autopilot release stage failed");}}let z=M(r),k=F(r,l),g=u.join(a$3,".rapidkit","reports","pipeline-last-run.json"),d={schemaVersion:"rapidkit-pipeline-v1",generatedAt:new Date().toISOString(),workspacePath:a$3,summary:{verdict:z,exitCode:k,stagesPassed:r.filter(e=>e.status==="pass").length,stagesWarn:r.filter(e=>e.status==="warn").length,stagesFailed:r.filter(e=>e.status==="fail").length},stages:r,blockingReasons:[...new Set(i)],artifacts:{reportPath:g,analyzeEvidencePath:p,readinessEvidencePath:y,autopilotEvidencePath:m}};if(t.writeReport!==false){await D.ensureDir(u.dirname(g));let e$1=f(d,{commandId:"workspacePipeline",exitCode:k,generatedAt:d.generatedAt,blockers:d.blockingReasons,runId:e()});await D.writeJSON(g,e$1,{spaces:2});}if(t.writeReport!==false&&t.noAgentSync!==true&&process.env.RAPIDKIT_NO_AGENT_SYNC!=="1"&&t.agentSync!==false)try{let{syncWorkspaceAgentGrounding:e}=await import('./workspace-agent-sync-G7JU77IK.js'),n=await e({workspacePath:a$3,write:true,refreshContext:true,strict:false});d.agentGrounding={indexPath:n.indexPath,writtenFiles:n.writtenFiles,blockers:n.blockers};}catch{}return d}async function X(t){let s;try{s=await G(t);}catch(a){let r=a instanceof Error?a.message:String(a);t.json?console.log(JSON.stringify({schemaVersion:"rapidkit-pipeline-error-v1",ok:false,error:{message:r}},null,2)):console.log(c$1.red(`Pipeline failed: ${r}`)),process.exit(1);}if(t.json)console.log(JSON.stringify(s,null,2));else {console.log(c$1.bold.cyan(`
1
+ import {c}from'./chunk-73IS6RIM.js';import {b}from'./chunk-YOQ2546V.js';import {a as a$1}from'./chunk-AO6PG3K2.js';import {b as b$1}from'./chunk-MGUJWRZA.js';import {a as a$2}from'./chunk-FPUNOIAR.js';import {a}from'./chunk-KMUWWZRT.js';import {f,e}from'./chunk-PCXSTKZ5.js';import c$1 from'chalk';import D from'fs-extra';import u from'path';function C(t){return t===0?"pass":t===2?"warn":"fail"}function M(t){return t.some(s=>s.status==="fail")?"blocked":t.some(s=>s.status==="warn")?"needs-attention":"ready"}function F(t,s){if(s)return 3;let a=t.some(i=>i.status==="fail"),r=t.some(i=>i.status==="warn");return a?1:r?2:0}async function j(t){let s=await b$1(t,true),a=false;try{let{syncWorkspaceContract:r}=await import('./workspace-contract-ITFCJCHI.js');await r({workspacePath:t}),a=true;}catch{a=false;}return {sync:s,contractSynced:a}}async function G(t={}){let s=u.resolve(t.workspacePath??process.cwd()),a$3=a(s);if(!a$3)throw new Error("No RapidKit workspace found in current directory or parents");let r=[],i=[],l=false,p,y,m,f$1=Date.now();try{let{sync:e,contractSynced:n}=await j(a$3),o=e.workspaceFound&&(e.added.length>0||e.skipped>=0)||e.workspaceFound?"pass":"warn";r.push({name:"sync",status:o,durationMs:Date.now()-f$1,summary:e.workspaceFound?`registry sync complete (${e.added.length} added, ${e.skipped} existing)${n?", contract synced":""}`:"workspace not registered in global registry; contract sync attempted"}),e.workspaceFound||i.push("workspace registry entry missing \u2014 run rapidkit create workspace or register manually");}catch(e){l=true,r.push({name:"sync",status:"fail",durationMs:Date.now()-f$1,summary:`sync failed: ${e instanceof Error?e.message:String(e)}`}),i.push("workspace sync stage failed");}let w=Date.now();try{let e=await b({workspace:true,json:true,quiet:true,strict:t.strict===true,ci:t.strict!==true}),n=C(e),o=u.join(a$3,".rapidkit","reports","doctor-last-run.json");r.push({name:"doctor",status:n,durationMs:Date.now()-w,summary:n==="pass"?"doctor workspace passed":n==="warn"?"doctor workspace reported warnings":"doctor workspace reported errors",exitCode:e,evidencePath:o}),n==="fail"?i.push("doctor workspace gate failed"):n==="warn"&&i.push("doctor workspace reported warnings");}catch(e){l=true,r.push({name:"doctor",status:"fail",durationMs:Date.now()-w,summary:`doctor failed: ${e instanceof Error?e.message:String(e)}`}),i.push("doctor workspace stage failed");}if(t.skipAnalyze)r.push({name:"analyze",status:"skipped",durationMs:0,summary:"analyze stage skipped"});else {let e=Date.now();try{let n=await a$1({workspacePath:a$3,json:true,strict:t.strict===true});p=u.join(a$3,".rapidkit","reports","analyze-last-run.json");let o=n.summary.verdict==="blocked"?"fail":n.summary.verdict==="needs-attention"?"warn":"pass";r.push({name:"analyze",status:o,durationMs:Date.now()-e,summary:`analyze verdict: ${n.summary.verdict} (score ${n.summary.score}/100)`,evidencePath:p}),o==="fail"?i.push("analyze reported blocked verdict"):o==="warn"&&i.push("analyze reported needs-attention verdict");}catch(n){l=true,r.push({name:"analyze",status:"fail",durationMs:Date.now()-e,summary:`analyze failed: ${n instanceof Error?n.message:String(n)}`}),i.push("analyze stage failed");}}let h=Date.now();try{let e=await a$2({startPath:a$3,writeReport:true,skipVerify:t.skipVerify===true});y=e.evidencePath;let n=e.overallStatus==="pass"?"pass":e.overallStatus==="warn"?"warn":"fail";r.push({name:"readiness",status:n,durationMs:Date.now()-h,summary:`readiness overall: ${e.overallStatus}`,evidencePath:e.evidencePath}),n==="fail"?i.push(...e.blockingReasons.map(o=>`readiness: ${o}`)):n==="warn"&&i.push(...e.gates.filter(o=>o.status==="warn").map(o=>`readiness warn: ${o.gate}: ${o.summary}`));}catch(e){l=true,r.push({name:"readiness",status:"fail",durationMs:Date.now()-h,summary:`readiness failed: ${e instanceof Error?e.message:String(e)}`}),i.push("readiness stage failed");}if(t.skipAutopilot)r.push({name:"autopilot",status:"skipped",durationMs:0,summary:"autopilot stage skipped"});else {let e=Date.now(),n=t.autopilotMode??"audit";try{let o=await c({workspacePath:a$3,mode:n,json:true,skipPipelineStages:true});m=o.artifacts.reportPath;let P=o.summary.verdict==="approved"?"pass":o.summary.verdict==="partial"?"warn":"fail";r.push({name:"autopilot",status:P,durationMs:Date.now()-e,summary:`autopilot ${n}: ${o.summary.verdict}`,exitCode:o.summary.exitCode,evidencePath:m}),P!=="pass"&&i.push(...o.blockingReasons.slice(0,5));}catch(o){l=true,r.push({name:"autopilot",status:"fail",durationMs:Date.now()-e,summary:`autopilot failed: ${o instanceof Error?o.message:String(o)}`}),i.push("autopilot release stage failed");}}let z=M(r),k=F(r,l),g=u.join(a$3,".rapidkit","reports","pipeline-last-run.json"),d={schemaVersion:"rapidkit-pipeline-v1",generatedAt:new Date().toISOString(),workspacePath:a$3,summary:{verdict:z,exitCode:k,stagesPassed:r.filter(e=>e.status==="pass").length,stagesWarn:r.filter(e=>e.status==="warn").length,stagesFailed:r.filter(e=>e.status==="fail").length},stages:r,blockingReasons:[...new Set(i)],artifacts:{reportPath:g,analyzeEvidencePath:p,readinessEvidencePath:y,autopilotEvidencePath:m}};if(t.writeReport!==false){await D.ensureDir(u.dirname(g));let e$1=f(d,{commandId:"workspacePipeline",exitCode:k,generatedAt:d.generatedAt,blockers:d.blockingReasons,runId:e()});await D.writeJSON(g,e$1,{spaces:2});}if(t.writeReport!==false&&t.noAgentSync!==true&&process.env.RAPIDKIT_NO_AGENT_SYNC!=="1"&&t.agentSync!==false)try{let{syncWorkspaceAgentGrounding:e}=await import('./workspace-agent-sync-WJIZCZX5.js'),n=await e({workspacePath:a$3,write:true,refreshContext:true,strict:false});d.agentGrounding={indexPath:n.indexPath,writtenFiles:n.writtenFiles,blockers:n.blockers};}catch{}return d}async function X(t){let s;try{s=await G(t);}catch(a){let r=a instanceof Error?a.message:String(a);t.json?console.log(JSON.stringify({schemaVersion:"rapidkit-pipeline-error-v1",ok:false,error:{message:r}},null,2)):console.log(c$1.red(`Pipeline failed: ${r}`)),process.exit(1);}if(t.json)console.log(JSON.stringify(s,null,2));else {console.log(c$1.bold.cyan(`
2
2
  \u{1F517} RapidKit Governance Pipeline
3
3
  `)),console.log(c$1.bold(`Workspace: ${c$1.cyan(u.basename(s.workspacePath))}`)),console.log(c$1.gray(`Path: ${s.workspacePath}`)),console.log(c$1.white(`Verdict: ${s.summary.verdict} Exit: ${s.summary.exitCode} (${s.summary.stagesPassed} pass / ${s.summary.stagesWarn} warn / ${s.summary.stagesFailed} fail)`));for(let a of s.stages){let r=a.status==="pass"?c$1.green("PASS"):a.status==="warn"?c$1.yellow("WARN"):a.status==="skipped"?c$1.gray("SKIP"):c$1.red("FAIL");console.log(` - ${a.name}: ${r} ${a.summary}`);}if(s.blockingReasons.length>0){console.log(c$1.bold(`
4
4
  Blocking reasons:`));for(let a of s.blockingReasons.slice(0,8))console.log(c$1.gray(` \u2022 ${a}`));}console.log(c$1.gray(`
@@ -1,4 +1,4 @@
1
- import {b as b$1,c}from'./chunk-3Q7264EJ.js';import {b}from'./chunk-6KD5F6LX.js';import {promises}from'fs';import g from'path';import r from'chalk';import R from'ora';import {execa}from'execa';var y="21",$="3.5.0",j="2.8.9";function u(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,".").replace(/^\.+|\.+$/g,"").replace(/\.{2,}/g,".").split(".").map(p=>p.replace(/^[^a-z]+/,"").replace(/[^a-z0-9]/g,"")).filter(Boolean).join(".")}function _(e,t){return e.replace(/[\r\n\t]+/g," ").trim()||t}function x(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-")}function M(e,t){let s=u(e)||"com.rapidkit.apps",p=u(t)||"service";return `${s}.${p}`}function E(e){return e.replace(/\./g,"/")}function T(){return JSON.stringify({engine:"npm",runtime:"java"},null,2)}function A(e,t){return JSON.stringify({kit_name:"springboot.standard",runtime:"java",module_support:false,project_name:e.project_name,artifact_id:e.artifact_id,group_id:e.group_id,package_name:e.package_name,app_version:e.app_version,created_by:"rapidkit-npm",rapidkit_version:t,created_at:new Date().toISOString()},null,2)}function P(e){return `<?xml version="1.0" encoding="UTF-8"?>
1
+ import {b as b$1,c}from'./chunk-3Q7264EJ.js';import {b}from'./chunk-Q2KZIBV4.js';import {promises}from'fs';import g from'path';import r from'chalk';import R from'ora';import {execa}from'execa';var y="21",$="3.5.0",j="2.8.9";function u(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,".").replace(/^\.+|\.+$/g,"").replace(/\.{2,}/g,".").split(".").map(p=>p.replace(/^[^a-z]+/,"").replace(/[^a-z0-9]/g,"")).filter(Boolean).join(".")}function _(e,t){return e.replace(/[\r\n\t]+/g," ").trim()||t}function x(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-")}function M(e,t){let s=u(e)||"com.rapidkit.apps",p=u(t)||"service";return `${s}.${p}`}function E(e){return e.replace(/\./g,"/")}function T(){return JSON.stringify({engine:"npm",runtime:"java"},null,2)}function A(e,t){return JSON.stringify({kit_name:"springboot.standard",runtime:"java",module_support:false,project_name:e.project_name,artifact_id:e.artifact_id,group_id:e.group_id,package_name:e.package_name,app_version:e.app_version,created_by:"rapidkit-npm",rapidkit_version:t,created_at:new Date().toISOString()},null,2)}function P(e){return `<?xml version="1.0" encoding="UTF-8"?>
2
2
  <project xmlns="http://maven.apache.org/POM/4.0.0"
3
3
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
4
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
@@ -1 +1 @@
1
- export{e as createProject,d as createWorkspace,g as createWorkspaceShareBundle,f as listWorkspaces,c as registerProjectInWorkspace,a as registerWorkspace,b as syncWorkspaceProjects}from'./chunk-RXWM5DSC.js';
1
+ export{e as createProject,d as createWorkspace,g as createWorkspaceShareBundle,f as listWorkspaces,c as registerProjectInWorkspace,a as registerWorkspace,b as syncWorkspaceProjects}from'./chunk-MGUJWRZA.js';
@@ -0,0 +1 @@
1
+ export{g as AGENT_CUSTOMIZATION_PACK_REPORT_PATH,d as AGENT_CUSTOMIZATION_PACK_SCHEMA,f as AGENT_GROUNDING_DOC_PATH,e as AGENT_REPORTS_INDEX_PATH,c as AGENT_REPORTS_INDEX_SCHEMA,h as AGENT_REPORT_CATALOG,i as buildWorkspaceAgentReportsIndex,j as parseAgentGroundingTargets,k as syncWorkspaceAgentGrounding}from'./chunk-Y2SCTWL4.js';
@@ -1 +1 @@
1
- export{b as WORKSPACE_CONTEXT_AGENT_REPORT_PATH,a as WORKSPACE_CONTEXT_SCHEMA_VERSION,c as buildWorkspaceAgentContext,d as writeWorkspaceAgentContext}from'./chunk-OWNGSAO3.js';
1
+ export{b as WORKSPACE_CONTEXT_AGENT_REPORT_PATH,a as WORKSPACE_CONTEXT_SCHEMA_VERSION,c as buildWorkspaceAgentContext,d as writeWorkspaceAgentContext}from'./chunk-WA6JYVJM.js';
@@ -0,0 +1 @@
1
+ export{b as WORKSPACE_CONTRACT_PATH,d as WORKSPACE_CONTRACT_SCHEMA_VERSION,c as WORKSPACE_CONTRACT_VERIFY_REPORT_PATH,e as WORKSPACE_CONTRACT_VERIFY_SCHEMA_VERSION,g as buildWorkspaceContract,k as buildWorkspaceContractGraph,f as discoverProjectJsonFiles,j as readWorkspaceContract,i as syncWorkspaceContract,l as verifyWorkspaceContract,h as writeWorkspaceContract,m as writeWorkspaceContractVerifyEvidence}from'./chunk-DMUEGR36.js';
@@ -0,0 +1 @@
1
+ export{a as buildWorkspaceExplain,b as writeWorkspaceExplainReport}from'./chunk-P5ODFWB2.js';export{d as WORKSPACE_MODEL_DIFF_REPORT_PATH}from'./chunk-AT3EQ2S7.js';export{c as WORKSPACE_EXPLAIN_REPORT_PATH}from'./chunk-RIZCWYRR.js';
@@ -0,0 +1 @@
1
+ export{a as WORKSPACE_EXPLAIN_SCHEMA_VERSION,b as WORKSPACE_EXPLAIN_TARGETS,d as isWorkspaceExplainReport,c as parseWorkspaceExplainTarget}from'./chunk-424B73UF.js';export{c as WORKSPACE_EXPLAIN_REPORT_PATH}from'./chunk-RIZCWYRR.js';
@@ -0,0 +1 @@
1
+ import {b}from'./chunk-ICGWHIMK.js';import {b as b$1,f,i}from'./chunk-VMJA36WD.js';import o from'path';async function m(r){let t=o.resolve(r.workspacePath),n=b(r.payload);if(!n)return {ok:false,error:"Invalid agent-action-outcome payload",historyPath:o.join(t,b$1)};let c=f(n),p=o.join(t,b$1);return await i(t,c,{retention:r.retention}),{ok:true,entry:c,historyPath:p}}function l(r){let t=r.trim();if(!t)return null;try{return JSON.parse(t)}catch{return null}}async function h(){let r=[];for await(let t of process.stdin)r.push(typeof t=="string"?Buffer.from(t):t);return Buffer.concat(r).toString("utf8")}export{l as parseFeedbackStdinPayload,h as readStdinAll,m as recordWorkspaceFeedback};
@@ -1 +1 @@
1
- import {b}from'./chunk-ERCD6NFF.js';import {a}from'./chunk-RV6HBTFC.js';import c from'path';import u from'fs-extra';async function W(t,r){let o=await a(t),d=o?.name||c.basename(t),n,i=c.join(t,".python-version");if(await u.pathExists(i)){let a=(await u.readFile(i,"utf-8")).trim();a&&(n=a);}let e=r?.profile||"polyglot",m=e==="python-only"||e==="polyglot"||e==="enterprise",f=r?.installMethod||o?.metadata?.npm?.installMethod||(m?"poetry":"venv"),s=await b(t,{workspaceName:d,installMethod:f,pythonVersion:n,profile:e,writeMarker:true,writeGitignore:true,onlyIfMissing:!r?.force}),{publishWorkspaceRegistrySummary:y}=await import('./workspace-registry-summary-MIPHVB56.js');return await y(t),{workspacePath:t,created:s,status:s.length>0?"passed":"skipped"}}export{W as ensureWorkspaceFoundation};
1
+ import {b}from'./chunk-KTQZUWAM.js';import {a}from'./chunk-RV6HBTFC.js';import c from'path';import u from'fs-extra';async function W(t,r){let o=await a(t),d=o?.name||c.basename(t),n,i=c.join(t,".python-version");if(await u.pathExists(i)){let a=(await u.readFile(i,"utf-8")).trim();a&&(n=a);}let e=r?.profile||"polyglot",m=e==="python-only"||e==="polyglot"||e==="enterprise",f=r?.installMethod||o?.metadata?.npm?.installMethod||(m?"poetry":"venv"),s=await b(t,{workspaceName:d,installMethod:f,pythonVersion:n,profile:e,writeMarker:true,writeGitignore:true,onlyIfMissing:!r?.force}),{publishWorkspaceRegistrySummary:y}=await import('./workspace-registry-summary-ZXGKL2NT.js');return await y(t),{workspacePath:t,created:s,status:s.length>0?"passed":"skipped"}}export{W as ensureWorkspaceFoundation};
@@ -0,0 +1 @@
1
+ export{d as buildGraphEmit,a as explainGraphNode,b as renderGraphDot,c as renderGraphMermaid}from'./chunk-JEI6BTZI.js';
@@ -0,0 +1 @@
1
+ export{c as DEFAULT_HISTORY_RETENTION,b as WORKSPACE_HISTORY_PATH,a as WORKSPACE_HISTORY_SCHEMA_VERSION,h as appendHistoryEntry,f as historyEntryFromAgentAction,e as historyEntryFromVerify,d as normalizeHistoryEntry,g as readWorkspaceHistory,i as recordWorkspaceHistory}from'./chunk-VMJA36WD.js';
@@ -1 +1 @@
1
- export{f as WORKSPACE_IMPACT_REPORT_PATH,e as WORKSPACE_IMPACT_SCHEMA_VERSION,d as WORKSPACE_MODEL_DIFF_REPORT_PATH,b as WORKSPACE_MODEL_DIFF_SCHEMA_VERSION,c as WORKSPACE_MODEL_SNAPSHOT_REPORT_PATH,a as WORKSPACE_MODEL_SNAPSHOT_SCHEMA_VERSION,n as buildWorkspaceImpact,i as buildWorkspaceModelSnapshot,k as diffWorkspaceModel,g as isGitDiffSource,h as parseGitDiffRef,m as workspaceVerificationPlan,o as writeWorkspaceImpact,l as writeWorkspaceModelDiff,j as writeWorkspaceModelSnapshot}from'./chunk-QPEBI6AB.js';
1
+ export{f as WORKSPACE_IMPACT_REPORT_PATH,e as WORKSPACE_IMPACT_SCHEMA_VERSION,d as WORKSPACE_MODEL_DIFF_REPORT_PATH,b as WORKSPACE_MODEL_DIFF_SCHEMA_VERSION,c as WORKSPACE_MODEL_SNAPSHOT_REPORT_PATH,a as WORKSPACE_MODEL_SNAPSHOT_SCHEMA_VERSION,n as buildWorkspaceImpact,i as buildWorkspaceModelSnapshot,k as diffWorkspaceModel,g as isGitDiffSource,h as parseGitDiffRef,m as workspaceVerificationPlan,o as writeWorkspaceImpact,l as writeWorkspaceModelDiff,j as writeWorkspaceModelSnapshot}from'./chunk-AT3EQ2S7.js';
@@ -0,0 +1,3 @@
1
+ import {a}from'./chunk-P5ODFWB2.js';import {c as c$2}from'./chunk-FVCZGUVX.js';import {c,d}from'./chunk-424B73UF.js';import {c as c$1,b as b$2}from'./chunk-RIZCWYRR.js';import {b as b$1}from'./chunk-WA6JYVJM.js';import {h as h$1}from'./chunk-QN2LPLHO.js';import {c as c$3}from'./chunk-DMUEGR36.js';import f from'path';import T from'readline';import b from'fs-extra';var P=".rapidkit/reports/INDEX.json";function h(t,e){return t.kind!==e.kind?false:t.kind==="project"&&e.kind==="project"?t.project.toLowerCase()===e.project.toLowerCase():t.kind==="blocker"&&e.kind==="blocker"?t.blockerId===e.blockerId:t.kind==="trace"&&e.kind==="trace"?t.diffRef===e.diffRef:true}var O=[{name:"getWorkspaceModel",description:"Read workspace-model.json",inputSchema:{type:"object",properties:{}}},{name:"getEvidenceIndex",description:"Read agent reports INDEX.json",inputSchema:{type:"object",properties:{}}},{name:"getBlockers",description:"Aggregate blocking reasons from verify, explain, and contract-verify reports",inputSchema:{type:"object",properties:{}}},{name:"getSafeCommands",description:"Read safe commands from workspace-context-agent.json",inputSchema:{type:"object",properties:{}}},{name:"getProjectContext",description:"Read scoped project context from workspace-context-agent.json",inputSchema:{type:"object",properties:{project:{type:"string",description:"Optional project name; defaults to active scope"}}}},{name:"getArtifact",description:"Read one workspace-relative artifact path",inputSchema:{type:"object",properties:{relativePath:{type:"string"}},required:["relativePath"]}},{name:"listOperationalSkills",description:"Read workspace-skills-index.json",inputSchema:{type:"object",properties:{}}},{name:"getWorkspaceExplain",description:"Build or read workspace explain report",inputSchema:{type:"object",properties:{target:{type:"string",description:"release-blocked | project:<name> | blocker:<id> | trace:<diffRef> | <project>"}}}}];function C(t){let e=t.trim().replace(/\\/g,"/");return e.length>0&&!f.isAbsolute(e)&&!e.split("/").includes("..")&&e.startsWith(".rapidkit/")}async function l(t,e){if(!C(e))throw new Error(`Unsafe artifact path: ${e}`);let i=f.join(t,e);return await b.pathExists(i)?b.readJson(i):null}async function _(t){let e=[],i=new Set,s=((await l(t,c$2))?.blockingReasons??[]).filter(n=>typeof n=="string"&&n.trim().length>0);if(s.length>0){e.push({artifact:c$2,reasons:s});for(let n of s)i.add(n);}let a=await l(t,c$1);if(d(a)){let n=(a.blockingReasons??[]).filter(r=>typeof r=="string"&&r.trim().length>0);if(n.length>0){e.push({artifact:c$1,reasons:n});for(let r of n)i.add(r);}}let c=await l(t,c$3),p=(c?.violations??[]).filter(n=>typeof n=="string"&&n.trim().length>0);if(p.length>0||String(c?.status??"").toLowerCase()==="failed"){let n=p.length>0?p:["Workspace contract verification failed"];e.push({artifact:c$3,reasons:n});for(let r of n)i.add(r);}return {blockingReasons:[...i],sources:e}}async function x(t,e,i){switch(e){case "getWorkspaceModel":return l(t,h$1);case "getEvidenceIndex":return l(t,P);case "getBlockers":return _(t);case "getSafeCommands":return {safeCommands:(await l(t,b$1))?.safeCommands??[]};case "getProjectContext":{let o=await l(t,b$1);if(!o)return null;let s=String(i.project??"").trim(),a=o.scope?.activeProject??void 0,c=s||a,p=Array.isArray(o.projects)?o.projects:[],n=c&&p.find(r=>typeof r.name=="string"&&r.name.toLowerCase()===c.toLowerCase());return {workspace:o.workspace??null,scope:o.scope??null,validation:o.validation??null,project:n??null,safeCommands:o.safeCommands??[]}}case "getArtifact":{let o=String(i.relativePath??"").trim();return l(t,o)}case "listOperationalSkills":return l(t,b$2);case "getWorkspaceExplain":{let o=String(i.target??"release-blocked").trim(),s=c(o);if(!s)throw new Error(`Invalid explain target: ${o}`);let a$1=await l(t,c$1);return d(a$1)&&h(a$1.target,s)?a$1:a({workspacePath:t,target:s})}default:throw new Error(`Unknown tool: ${e}`)}}function R(t,e){process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:t??null,result:e})}
2
+ `);}function w(t,e){process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:t??null,error:{code:-32e3,message:e}})}
3
+ `);}async function B(t){let e=f.resolve(t.workspacePath),i=T.createInterface({input:process.stdin,terminal:false});for await(let o of i){let s=o.trim();if(!s)continue;let a;try{a=JSON.parse(s);}catch{w(null,"Invalid JSON-RPC request");continue}let{id:c,method:p,params:n}=a;try{if(p==="initialize"){R(c,{protocolVersion:"2024-11-05",capabilities:{tools:{}},serverInfo:{name:"rapidkit-workspace-mcp",version:"0.1.0"}});continue}if(p==="notifications/initialized")continue;if(p==="tools/list"){R(c,{tools:O.map(r=>({name:r.name,description:r.description,inputSchema:r.inputSchema}))});continue}if(p==="tools/call"){let r=String(n?.name??""),A=n?.arguments&&typeof n.arguments=="object"?n.arguments:{},E=await x(e,r,A);R(c,{content:[{type:"text",text:JSON.stringify(E,null,2)}],isError:E==null});continue}w(c,`Unsupported method: ${p??"unknown"}`);}catch(r){w(c,r instanceof Error?r.message:String(r));}}}async function F(t,e,i={}){return x(f.resolve(t),e,i)}export{O as WORKSPACE_MCP_READ_TOOLS,F as invokeMcpToolForTest,B as runWorkspaceMcpServe};
@@ -0,0 +1 @@
1
+ export{h as WORKSPACE_MODEL_REPORT_PATH,g as WORKSPACE_MODEL_SCHEMA_VERSION,j as buildWorkspaceModel,k as buildWorkspaceModelCached,l as buildWorkspaceModelIncremental,i as validateWorkspaceModelStrict,m as writeWorkspaceModel}from'./chunk-QN2LPLHO.js';
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-A5FBGRJA.js';import {b,j}from'./chunk-DMUEGR36.js';import {j as j$1}from'./chunk-Z5LKRG57.js';import s from'path';import n from'fs-extra';var l=".rapidkit/workspace-registry.v1.json",h="workspace-registry.v1";function P(r){return {slug:r.slug,relativePath:r.relativePath,framework:r.framework,kit:r.kit,source:r.source}}async function f(r){let t=s.join(r,".rapidkit","workspace.json");if(!await n.pathExists(t))return {exists:false,legacyProjectCount:0};try{let e=await n.readJson(t),o=Array.isArray(e.projects)?e.projects.length:0;return {exists:true,workspaceName:typeof e.workspace_name=="string"&&e.workspace_name.trim()||typeof e.name=="string"&&e.name.trim()||s.basename(r),profile:typeof e.profile=="string"?e.profile:void 0,legacyProjectCount:o}}catch{return {exists:true,legacyProjectCount:0,workspaceName:s.basename(r)}}}async function W(r){let t=a(r),e=s.join(j$1(),"workspaces.json");if(!await n.pathExists(e))return 0;try{let a$1=((await n.readJson(e)).workspaces||[]).find(c=>a(c.path)===t);return Array.isArray(a$1?.projects)?a$1.projects.length:0}catch{return 0}}async function S(r){let t=s.resolve(r),e=s.join(t,b),o=await f(t),a=await W(t),c=await n.pathExists(e),i=[];if(c)try{let{contract:w}=await j({workspacePath:t});i=w.projects||[];}catch{i=[];}let R={contract:{exists:c,projectCount:i.length,path:b},globalRegistry:{exists:a>0,projectCount:a,path:s.join(j$1(),"workspaces.json")},legacyWorkspaceJson:{exists:o.exists,projectCount:o.legacyProjectCount,path:".rapidkit/workspace.json"}},p="none",u=[],y=0;return c?(p="workspace.contract.json",u=i.map(P),y=u.length):a>0?(p="global-registry",y=a):o.legacyProjectCount>0&&(p="legacy-workspace.json",y=o.legacyProjectCount),{contractExists:c,summary:{schemaVersion:h,kind:"rapidkit.workspace.registry",workspacePath:t,workspaceName:o.workspaceName||s.basename(t),profile:o.profile,projectCount:y,authority:p,contractPath:b,projects:u,sources:R}}}async function v(r){let t=s.join(s.resolve(r),l);if(!await n.pathExists(t))return null;try{let e=await n.readJson(t);return e?.schemaVersion!==h?null:e}catch{return null}}async function N(r,t){let e=await S(r),o=s.join(s.resolve(r),l),a={...e.summary,generatedAt:(t?.now??new Date).toISOString(),registrySummaryPath:l};return await n.ensureDir(s.dirname(o)),await n.writeJson(o,a,{spaces:2}),a}function M(r,t=""){return r.projectCount>0?r.authority==="workspace.contract.json"?`${r.projectCount} project(s) registered in workspace contract${t}.`:r.authority==="global-registry"?`${r.projectCount} project(s) registered in global workspace registry${t}.`:`${r.projectCount} project(s) registered in legacy workspace manifest${t}.`:`Workspace state exists, but no projects are registered yet${t}.`}export{l as WORKSPACE_REGISTRY_SUMMARY_RELATIVE_PATH,h as WORKSPACE_REGISTRY_SUMMARY_SCHEMA_VERSION,M as formatWorkspaceRegistrySyncSummary,N as publishWorkspaceRegistrySummary,v as readWorkspaceRegistrySummary,S as resolveWorkspaceRegisteredProjects};
@@ -0,0 +1 @@
1
+ export{a as runWorkspaceStage}from'./chunk-56RL5OB6.js';export{a as WORKSPACE_RUN_LAST_REPORT_FILENAME}from'./chunk-64RTZBHU.js';
@@ -0,0 +1 @@
1
+ export{c as WORKSPACE_VERIFY_REPORT_PATH,b as WORKSPACE_VERIFY_SCHEMA_VERSION,e as buildWorkspaceVerify,d as computeAffectedSubgraphGate,g as evaluateWorkspaceVerifyGate,h as workspaceVerifyExitCode,f as writeWorkspaceVerify}from'./chunk-FVCZGUVX.js';
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-44GSDNPQ.js';import {b,l}from'./chunk-QN2LPLHO.js';import b$1 from'fs';var M="workspace-watch-event.v1";function g(t){return `${t.from}\0${t.to}\0${t.kind}`}function f(t){return (t.graph?.edges??[]).map(r=>({from:r.from,to:r.to,kind:r.kind}))}function m(t){let o=[...a(t).entries()].sort((a,n)=>a[0].localeCompare(n[0])).map(([a,n])=>({id:a,hash:n})),c=f(t).map(g).sort((a,n)=>a.localeCompare(n));return b({projects:o,edges:c})}function w(t,r){let o=a(r),c=t?a(t):new Map,a$1=[],n=[];for(let[e,s]of o.entries())c.has(e)?c.get(e)!==s&&a$1.push(e):n.push(e);let d=[];for(let e of c.keys())o.has(e)||d.push(e);let i=new Map(t?f(t).map(e=>[g(e),e]):[]),l=new Map(f(r).map(e=>[g(e),e])),p=[];for(let[e,s]of l.entries())i.has(e)||p.push(s);let h=[];for(let[e,s]of i.entries())l.has(e)||h.push(s);let u=(e,s)=>g(e).localeCompare(g(s));return a$1.sort((e,s)=>e.localeCompare(s)),n.sort((e,s)=>e.localeCompare(s)),d.sort((e,s)=>e.localeCompare(s)),p.sort(u),h.sort(u),{changedProjects:a$1,addedProjects:n,removedProjects:d,edgesAdded:p,edgesRemoved:h}}var k=class{model=null;sequence=0;rebuild;now;constructor(r,o){this.rebuild=o?.rebuild??(()=>l({...r})),this.now=o?.now??(()=>new Date);}get currentModel(){return this.model}async start(){let r=Date.now(),{model:o}=await this.rebuild();return this.model=o,this.buildEvent("ready","initial",null,o,Date.now()-r)}async pulse(){let r=Date.now(),o=this.model,{model:c,mode:a}=await this.rebuild(),n=this.buildEvent(this.hasStructuralChange(o,c)?"changed":"unchanged",a,o,c,Date.now()-r);return this.model=c,n}hasStructuralChange(r,o){return r?m(r)!==m(o):true}buildEvent(r,o,c,a,n){let d=w(c,a),i=m(a),l=c?m(c)!==i:true;return {schemaVersion:M,kind:r,sequence:this.sequence++,timestamp:this.now().toISOString(),mode:o,modelHash:i,modelHashChanged:l,changedProjects:d.changedProjects,addedProjects:d.addedProjects,removedProjects:d.removedProjects,graph:{nodeCount:a.graph?.nodes.length??0,edgeCount:a.graph?.edges.length??0,edgesAdded:d.edgesAdded,edgesRemoved:d.edgesRemoved},durationMs:n}}},P=new Set([".git",".hg",".svn","node_modules",".venv","venv","dist","build","out","target","coverage","htmlcov",".next",".turbo",".cache"]),R=new Set(["reports","cache","tmp",".cache"]);function y(t){if(!t)return false;let r=t.split(/[\\/]/).filter(Boolean);if(r.some(o=>P.has(o)))return false;for(let o=0;o<r.length-1;o+=1)if(r[o]===".rapidkit"&&R.has(r[o+1]))return false;return true}async function D(t){let r=new k(t.buildOptions,t.engineOptions),o=await r.start();if(t.emit(o),t.once)return;let c=t.debounceMs??250,a=t.selfWriteSuppressionMs??Math.max(400,c+150),n=null,d=false,i=false,l=0,p=async()=>{if(d){i=true;return}d=true;try{let e=await r.pulse();t.emit(e);}catch(e){t.emit({schemaVersion:M,kind:"error",sequence:-1,timestamp:new Date().toISOString(),mode:"full",modelHash:r.currentModel?m(r.currentModel):"",modelHashChanged:false,changedProjects:[],addedProjects:[],removedProjects:[],graph:{nodeCount:0,edgeCount:0,edgesAdded:[],edgesRemoved:[]},durationMs:0,error:e instanceof Error?e.message:String(e)});}finally{d=false,l=Date.now()+a,i&&(i=false,p());}},h=e=>{y(e)&&(d||Date.now()<l||(n&&clearTimeout(n),n=setTimeout(()=>{n=null,p();},c)));};t.onProgress?.(`Watching ${t.workspacePath} for changes (Ctrl+C to stop).`);let u=b$1.watch(t.workspacePath,{recursive:true},(e,s)=>{typeof s=="string"?h(s):s&&h(Buffer.from(s).toString("utf8"));});await new Promise(e=>{let s=()=>{n&&clearTimeout(n),u.close(),e();};if(t.signal){if(t.signal.aborted){s();return}t.signal.addEventListener("abort",s,{once:true});}u.on("error",()=>s());});}export{M as WORKSPACE_WATCH_EVENT_SCHEMA_VERSION,k as WorkspaceWatchEngine,m as computeWatchModelHash,w as diffWatchModels,y as isWatchRelevantPath,D as runWorkspaceWatch};
@@ -43,7 +43,9 @@ Side/cache (not gates): `.rapidkit/reports/doctor-workspace-cache.json` (`doctor
43
43
  | `workspace impact --from <diff>` | `workspace-impact-last-run.json` | `workspace-impact.v1` | `workspace-impact.v1.json` |
44
44
  | `workspace verify` | `workspace-verify-last-run.json` | `workspace-verify.v1` | `workspace-verify.v1.json` |
45
45
  | `workspace context --write` | `workspace-context-agent.json` | `workspace-context.v1` | `workspace-context.v1.json` |
46
- | `workspace agent-sync --write` | `reports/INDEX.json`, `reports/agent-customization-pack.json`, `reports/rapidkit-mcp-design.json`, `AGENT-GROUNDING.md`, `AGENTS.md`, Copilot/Cursor/Claude/VS Code agent surfaces | `rapidkit-agent-customization-pack.v1` | `contracts/agent-customization-pack.v1.json` |
46
+ | `workspace agent-sync --write` | `reports/INDEX.json`, `reports/agent-customization-pack.json`, `reports/rapidkit-mcp-design.json`, `reports/workspace-skills-index.json`, `.rapidkit/skills/*.md`, `AGENT-GROUNDING.md`, `AGENTS.md`, Copilot/Cursor/Claude/VS Code agent surfaces | `rapidkit-agent-customization-pack.v1` | `contracts/agent-customization-pack.v1.json` |
47
+ | `workspace explain --write` | `workspace-explain-last-run.json` | `workspace-explain.v1` | `contracts/workspace-intelligence/workspace-explain.v1.json` |
48
+ | `workspace feedback record` | `workspace-intelligence-history.json` (`kind: agent-action`) | `workspace-intelligence-history.v1` | `contracts/workspace-intelligence/workspace-intelligence-history.v1.json` |
47
49
 
48
50
  **CLI semantics:** `workspace diff --from` expects a **model or snapshot** baseline. `workspace impact --from` expects a **diff report**.
49
51
 
@@ -0,0 +1,58 @@
1
+ # Naming and coexistence (Phase 4.0)
2
+
3
+ Rules for **operational intelligence** artifacts so npm CLI, VS Code extension, and agent tools share one canonical layout without duplicate generators.
4
+
5
+ ## Canonical vs generated surfaces
6
+
7
+ | Layer | Canonical (workspace-native) | Generated (agent-sync) |
8
+ | ----- | ---------------------------- | ---------------------- |
9
+ | Operational playbooks | `.rapidkit/skills/{skillId}.md` | — |
10
+ | Skills index | `.rapidkit/reports/workspace-skills-index.json` | — |
11
+ | Copilot skill umbrella | — | `.github/skills/rapidkit-workspace-intelligence/SKILL.md` |
12
+ | Explain report | `.rapidkit/reports/workspace-explain-last-run.json` | — |
13
+ | Action feedback | `.rapidkit/reports/workspace-intelligence-history.json` (`kind: agent-action`) | — |
14
+
15
+ **Rule:** Never add a standalone `workspace skills generate` command. Operational skills are produced only by `workspace agent-sync --write` (extend the Agent Customization Pack).
16
+
17
+ ## Skill identifiers
18
+
19
+ Built-in operational skill ids use the `rapidkit-*` prefix:
20
+
21
+ - `rapidkit-diagnose-api-failure`
22
+ - `rapidkit-release-readiness`
23
+ - `rapidkit-safe-schema-migration`
24
+ - `rapidkit-dependency-upgrade`
25
+ - `rapidkit-rename-contract`
26
+
27
+ Paths are derived from id via `operationalSkillPath()` in `src/contracts/workspace-artifact-paths.ts`.
28
+
29
+ ## Command coexistence
30
+
31
+ | User intent | Command | Notes |
32
+ | ----------- | ------- | ----- |
33
+ | Project / release / blocker narrative | `workspace explain …` | Primary explain surface |
34
+ | Shorthand alias | `workspace why …` | Same parser as `explain` |
35
+ | Diff → blast radius → gates | `workspace trace --from <diff>` | Slice of explain (`kind: trace`) |
36
+ | Graph node centrality | `workspace graph explain <project>` | Graph-topology slice; see **Graph explain coexistence** below |
37
+ | Record agent outcome | `workspace feedback record --json` | Appends to history, no separate feedback file |
38
+ | MCP read bridge | `workspace mcp serve` | Read-mostly stdio JSON-RPC; maps Phase 4 explain + skills tools |
39
+
40
+ ## Graph explain coexistence (4.11)
41
+
42
+ `workspace graph explain <project>` remains the **graph-topology slice** — centrality, direct/transitive dependents via `explainGraphNode` in `workspace-graph.ts`.
43
+
44
+ `workspace explain project:<name>` is the **unified narrative** — consumers, contracts, verification plan, release risk from reports.
45
+
46
+ Do not duplicate BFS/traversal: graph explain stays single-sourced in `workspace-graph.ts`; unified explain composes it when building project sections.
47
+
48
+ ## Extension alignment
49
+
50
+ Schema versions advertised by `rapidkit --version --json` and `commands --json` must match files under `contracts/workspace-intelligence/`. Run `npm run sync:shared-contracts` after npm changes so `rapidkit-vscode/contracts` stays aligned.
51
+
52
+ ## Answer contract (shared)
53
+
54
+ All operational skills and the workspace-intelligence Copilot skill use the same answer shape:
55
+
56
+ **Scope → Evidence → Diagnosis → Fix Plan → Run → Verify → Assumptions**
57
+
58
+ Defined in `src/contracts/standard-answer-contract.ts` and referenced by the agent customization pack.
@@ -46,7 +46,31 @@ Override stage commands per project via `.rapidkit/context.json`:
46
46
  }
47
47
  ```
48
48
 
49
- Enterprise features include command overrides, multi-framework projects, error categorization (setup vs test vs runtime), preflight validation, health checks, custom stages, stage dependencies, environment variants, caching, and composite steps.
49
+ Enterprise features include command overrides, multi-framework projects, error categorization (setup vs test vs runtime), preflight validation, health checks, custom stages (via `.rapidkit/context.json` `commands`), stage dependencies (from framework registry), environment variants, result caching (`--reuse-passed`), and composite steps.
50
+
51
+ ### Custom stages
52
+
53
+ Declare extra fleet stages in `.rapidkit/context.json`:
54
+
55
+ ```json
56
+ {
57
+ "commands": {
58
+ "lint": "php bin/phpstan analyse --level=8"
59
+ }
60
+ }
61
+ ```
62
+
63
+ Run them with `npx rapidkit workspace run lint --scope project:<name>`.
64
+
65
+ ### Stage dependencies and caching
66
+
67
+ Framework registry entries may declare `dependencies` (for example `start` depends on `build`). When `.rapidkit/reports/workspace-run-last.json` exists, projects skip until dependency stages show `passed`.
68
+
69
+ Use `--reuse-passed` to skip projects that already passed the requested stage in the cached report:
70
+
71
+ ```bash
72
+ npx rapidkit workspace run test --reuse-passed --json
73
+ ```
50
74
 
51
75
  ## JSON reporting
52
76
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rapidkit",
3
- "version": "0.40.0",
3
+ "version": "0.41.0",
4
4
  "type": "module",
5
5
  "description": "Open-source workspace intelligence CLI for software systems: create, adopt, govern, verify, and align polyglot workspaces for humans, CI, IDEs, and AI agents.",
6
6
  "keywords": [
@@ -1 +0,0 @@
1
- export{b as printAnalyzeReport,a as runAnalyze}from'./chunk-VQMZC5TC.js';
@@ -1 +0,0 @@
1
- export{b as AUTOPILOT_RELEASE_ALIAS_FILENAME,a as AUTOPILOT_RELEASE_LAST_RUN_FILENAME,c as runAutopilotRelease}from'./chunk-CY2WXWYQ.js';
@@ -1,7 +0,0 @@
1
- import {a}from'./chunk-NAMOYGLS.js';import {a as a$1,d}from'./chunk-FV5A3N3I.js';import {a as a$2}from'./chunk-KMUWWZRT.js';import l from'chalk';import Y from'fs';import y from'path';import {execa}from'execa';var Z="autopilot-release-last-run.json",ee="autopilot-release.json";function $(s){try{return JSON.parse(s)}catch{return null}}function ge(s){let t=y.resolve(s),o=a$2(t);if(!o)throw new Error("No RapidKit workspace found in current directory or parents");return o}async function b(s,t){let o=process.argv[1];if(!o)return {exitCode:1,stdout:"",stderr:"RapidKit entrypoint is unavailable for autopilot execution.",crashed:true};try{let a=await execa(process.execPath,[o,...s],{cwd:t,reject:false,env:{...process.env,RAPIDKIT_AUTOPILOT_CHILD:"1"}});return {exitCode:Number(a.exitCode??1),stdout:a.stdout,stderr:a.stderr,crashed:false}}catch(a){return {exitCode:1,stdout:"",stderr:a instanceof Error?a.message:String(a),crashed:true}}}function te(s){let t=s.toLowerCase();return t==="pass"?"pass":t==="warn"?"warn":t==="fail"?"fail":"warn"}function se(s){return s.summary.failed>0||s.gates.results.some(t=>t.status==="fail")?"fail":s.gates.results.some(t=>t.status==="warn")?"warn":"pass"}function we(s){let t=s.filter(a=>a.status!=="skipped");if(t.length===0)return 100;let o=t.reduce((a,e)=>e.status==="pass"?a+1:e.status==="warn"?a+.6:a,0);return Math.round(o/t.length*100)}function he(s){return s.executionError?["Re-run: npx rapidkit autopilot release --mode audit --json","Inspect .rapidkit/reports/autopilot-release-last-run.json for execution failure details"]:s.blockers.length>0?["Run: npx rapidkit doctor workspace --plan","Run: npx rapidkit readiness --json --strict","Run: npx rapidkit workspace run test --affected --strict"]:s.hasWarnings&&s.mode!=="enforce"?["Review warning-level findings in autopilot report","Optionally run: npx rapidkit autopilot release --mode safe-fix"]:["Workspace is release-ready based on current autopilot policy"]}async function U(s,t){await Y.promises.mkdir(y.dirname(s),{recursive:true}),await Y.promises.writeFile(s,`${JSON.stringify(t,null,2)}
2
- `,"utf-8");}async function je(s){let t=ge(s.workspacePath),o=s.mode,a$2=[],e=[],F,B,C,O,J,G=0,f=false,I=0,T=0,D=-1,N=-1,c="skipped",p="skipped",re=o==="enforce"?["doctor","workspace","--json","--strict"]:["doctor","workspace","--json","--ci"];if(s.skipPipelineStages)a$2.push({name:"doctor-workspace",status:"skipped",durationMs:0,summary:"doctor stage skipped (pipeline already executed)"},{name:"analyze",status:"skipped",durationMs:0,summary:"analyze stage skipped (pipeline already executed)"},{name:"readiness",status:"skipped",durationMs:0,summary:"readiness stage skipped (pipeline already executed)"});else {let r=Date.now(),i=await b([...re],t),m=Date.now()-r;if(c="pass",i.crashed)c="fail",f=true,e.push(`doctor workspace execution error: ${i.stderr||"unknown error"}`);else if(i.exitCode===1)c="fail",e.push("doctor workspace command failed or reported errors");else if(i.exitCode===2)c="warn",e.push("doctor workspace reported warnings");else if(i.exitCode!==0)c="fail",e.push("doctor workspace command failed");else {let d=$(i.stdout),j=d&&d.healthScore&&typeof d.healthScore=="object"?d.healthScore:{},k=Number(j.errors??0),E=Number(j.warnings??0);Number.isFinite(k)&&k>0?(c="fail",e.push(`doctor workspace reports ${k} error(s)`)):Number.isFinite(E)&&E>0&&(c="warn");}D=a$2.push({name:"doctor-workspace",status:c,durationMs:m,summary:c==="pass"?"doctor workspace passed":c==="warn"?"doctor workspace reported warnings":"doctor workspace reported errors"})-1,o==="enforce"&&c==="warn"&&e.push("doctor workspace reported warnings under enforce mode");let g=Date.now(),w=await b(["analyze","--json"],t),v=Date.now()-g;B=y.join(t,".rapidkit","reports","analyze-last-run.json");let n="pass";if(w.crashed)n="fail",f=true,e.push(`analyze execution error: ${w.stderr||"unknown error"}`);else if(w.exitCode!==0)n=w.exitCode===2?"warn":"fail",e.push(w.exitCode===2?"analyze reported needs-attention verdict":"analyze command failed or reported blocked verdict");else {let d=$(w.stdout),j=d&&d.summary&&typeof d.summary=="object"?d.summary:{},k=String(j.verdict??"ready");k==="blocked"?(n="fail",e.push("analyze reported blocked verdict")):k==="needs-attention"&&(n="warn");}a$2.push({name:"analyze",status:n,durationMs:v,summary:n==="pass"?"analyze passed":n==="warn"?"analyze reported needs-attention":"analyze reported blocked verdict"}),o==="enforce"&&n==="warn"&&e.push("analyze reported warnings under enforce mode");let P=Date.now(),h=await b(["readiness","--json"],t),R=Date.now()-P;if(p="fail",h.crashed)p="fail",f=true,e.push(`readiness execution error: ${h.stderr||"unknown error"}`);else if(h.exitCode!==0)p="fail",e.push("readiness command failed");else {let d=$(h.stdout),j=String(d?.overallStatus??"fail");if(p=te(j),typeof d?.evidencePath=="string"&&d.evidencePath.trim().length>0&&(F=d.evidencePath),p==="fail"){let k=Array.isArray(d?.blockingReasons)?d?.blockingReasons.filter(E=>typeof E=="string"):[];k.length>0?e.push(...k.map(E=>`readiness: ${E}`)):e.push("readiness overall status is fail");}}N=a$2.push({name:"readiness",status:p,durationMs:R,summary:`readiness overall status is ${p}`})-1,o==="enforce"&&p==="warn"&&e.push("readiness reported warnings under enforce mode");}let ae=Date.now(),M=await b(["doctor","workspace","--plan","--json"],t),oe=Date.now()-ae,S="warn";if(M.crashed)S="fail",f=true,e.push(`doctor remediation plan execution error: ${M.stderr||"unknown error"}`);else if(M.exitCode!==0)S="fail",e.push("doctor remediation plan command failed");else {let r=$(M.stdout),i=r&&r.remediationPlan&&typeof r.remediationPlan=="object"?r.remediationPlan:null,m=Number(i?.totalSteps??0),g=Number(i?.executableSteps??0);Number.isFinite(m)&&m>0&&(I=m),Number.isFinite(g)&&g>0&&(T=g),Number.isFinite(m)&&m===0?S="pass":S="warn";}if(a$2.push({name:"remediation-plan",status:S,durationMs:oe,summary:S==="pass"?"no remediation steps required":"remediation steps available"}),o==="enforce"&&S==="warn"&&e.push("remediation plan has pending steps under enforce mode"),o==="safe-fix"){let r=Date.now(),i=await b(["doctor","workspace","--apply"],t),m=Date.now()-r,g=i.crashed||i.exitCode!==0?"fail":"pass";if(i.crashed)f=true,e.push(`doctor remediation apply execution error: ${i.stderr||"unknown error"}`);else if(g==="fail")e.push("doctor remediation apply failed");else {G=T>0?T:I>0?I:1;let w=await b(["doctor","workspace","--json"],t);if(w.crashed)c="fail",f=true,e.push(`post-apply doctor execution error: ${w.stderr||"unknown error"}`);else if(w.exitCode!==0)c="fail",e.push("post-apply doctor workspace command failed");else {let n=$(w.stdout),P=n&&n.healthScore&&typeof n.healthScore=="object"?n.healthScore:{},h=Number(P.errors??0),R=Number(P.warnings??0);Number.isFinite(h)&&h>0?(c="fail",e.push(`post-apply doctor reports ${h} error(s)`)):Number.isFinite(R)&&R>0?c="warn":c="pass";}D>=0&&(a$2[D].status=c,a$2[D].summary=`doctor workspace post-apply status is ${c}`);let v=await b(["readiness","--json"],t);if(v.crashed)p="fail",f=true,e.push(`post-apply readiness execution error: ${v.stderr||"unknown error"}`);else if(v.exitCode!==0)p="fail",e.push("post-apply readiness command failed");else {let n=$(v.stdout),P=String(n?.overallStatus??"fail");if(p=te(P),typeof n?.evidencePath=="string"&&n.evidencePath.trim().length>0&&(F=n.evidencePath),p==="fail"){let h=Array.isArray(n?.blockingReasons)?n?.blockingReasons.filter(R=>typeof R=="string"):[];h.length>0?e.push(...h.map(R=>`post-apply readiness: ${R}`)):e.push("post-apply readiness overall status is fail");}}N>=0&&(a$2[N].status=p,a$2[N].summary=`readiness post-apply overall status is ${p}`);}a$2.push({name:"remediation-apply",status:g,durationMs:m,summary:g==="pass"?"safe remediation apply completed":"safe remediation apply failed"});}else a$2.push({name:"remediation-apply",status:"skipped",durationMs:0,summary:"remediation apply is skipped for this mode"});let ne=Date.now(),x="pass",A="workspace test/build completed for selected projects";try{let r=await a({workspacePath:t,stage:"test",affected:true,since:s.since,parallel:s.parallel,maxWorkers:s.maxWorkers,strict:true,json:true,enforceGates:false});C=y.join(t,".rapidkit","reports",a$1),await d(t,r),O=C;let i=se(r);if(i==="fail")x="fail",A="workspace test stage failed for selected projects",e.push("workspace run test failed for selected projects");else {i==="warn"&&(x="warn",A="workspace test stage completed with warnings",o==="enforce"&&e.push("workspace run test reported warnings under enforce mode"));let m=await a({workspacePath:t,stage:"build",affected:true,since:s.since,parallel:s.parallel,maxWorkers:s.maxWorkers,strict:true,json:true,enforceGates:false});await d(t,m),J=C;let g=se(m);g==="fail"?(x="fail",A="workspace build stage failed for selected projects",e.push("workspace run build failed for selected projects")):g==="warn"&&(x="warn",A="workspace test/build completed with warnings",o==="enforce"&&e.push("workspace run test/build reported warnings under enforce mode"));}}catch(r){x="fail",A="workspace test/build orchestration failed",f=true,e.push(`workspace run orchestration error: ${r instanceof Error?r.message:String(r)}`);}let ie=Date.now()-ne;a$2.push({name:"workspace-run-test-build",status:x,durationMs:ie,summary:A});let z=a$2.filter(r=>r.status==="warn").length,le=a$2.filter(r=>r.status==="fail").length,L=o==="enforce"?a$2.some(r=>r.status==="warn"||r.status==="fail"):le>0,W=[...new Set(e)],ce=f||L?Math.max(1,W.length):0,de=we(a$2),pe=f||L?"blocked":z>0?"partial":"approved",ue=f?3:L?1:z>0?2:0,fe=he({mode:o,executionError:f,blockers:W,hasWarnings:z>0}),V=y.join(t,".rapidkit","reports"),H=y.join(V,Z),q=y.join(V,ee),u={schemaVersion:"autopilot-release-v1",generatedAt:new Date().toISOString(),workspacePath:t,mode:o,summary:{releaseScore:de,verdict:pe,blockers:ce,warnings:z,safeFixesApplied:G,manualActions:W.length,exitCode:ue},stages:a$2,blockingReasons:W,nextActions:fe,artifacts:{reportPath:H,aliasEvidencePath:q,analyzeEvidencePath:B,readinessEvidencePath:F,workspaceRunEvidencePath:C,workspaceRunTestPath:O,workspaceRunBuildPath:J},enterpriseControls:{jsonReady:true,evidencePath:`.rapidkit/reports/${Z}`,aliasEvidencePath:`.rapidkit/reports/${ee}`}};if(await U(H,u),await U(q,u),s.output&&await U(y.resolve(s.output),u),!s.json){console.log(l.bold.cyan(`
3
- \u{1F680} RapidKit Autopilot Release
4
- `)),console.log(l.bold(`Workspace: ${l.cyan(y.basename(t))}`)),console.log(l.gray(`Path: ${t}`)),console.log(l.white(`Mode: ${o}`)),console.log(l.white(`Verdict: ${u.summary.verdict==="approved"?l.green("approved"):u.summary.verdict==="partial"?l.yellow("partial"):l.red("blocked")}`)),console.log(l.white(`Release score: ${u.summary.releaseScore}`));for(let r of u.stages){let i=r.status==="pass"?l.green("PASS"):r.status==="warn"?l.yellow("WARN"):r.status==="skipped"?l.gray("SKIP"):l.red("FAIL");console.log(` - ${r.name}: ${i} ${r.summary} (${r.durationMs}ms)`);}if(u.blockingReasons.length>0){console.log(l.bold.red(`
5
- Blocking reasons:`));for(let r of u.blockingReasons)console.log(l.red(` - ${r}`));}if(u.nextActions.length>0){console.log(l.bold(`
6
- Next actions:`));for(let r of u.nextActions)console.log(l.gray(` - ${r}`));}console.log(l.gray(`
7
- Report: ${u.artifacts.reportPath}`));}return u}export{Z as a,ee as b,je as c};
@@ -1,2 +0,0 @@
1
- import o from'fs';import a from'path';var s="workspace-run-v1",R="workspace-run-last.json",g=`.rapidkit/reports/${R}`;var E=new Set(["init","test","build","start"]);function d(e){return E.has(e)}async function S(e){try{let r=await o.promises.readFile(e,"utf-8");return JSON.parse(r)}catch{return null}}async function W(e,r){await o.promises.mkdir(a.dirname(e),{recursive:true}),await o.promises.writeFile(e,`${JSON.stringify(r,null,2)}
2
- `,"utf-8");}function k(e){return !e||typeof e!="object"||Array.isArray(e)?null:e}function f(e){let r=e.stage;return typeof r=="string"&&d(r)&&Array.isArray(e.projects)}function w(e){let r=k(e);return !r||r.schemaVersion===s?false:f(r)}function A(e){let r=k(e);return r?r.schemaVersion===s&&r.stages!=null:false}function l(e){if(A(e))return e;if(w(e)){let r=e.stage;return {schemaVersion:s,generatedAt:e.generatedAt,workspacePath:e.workspacePath,latestStage:r,stages:{[r]:e},enterpriseControls:e.enterpriseControls??{jsonReady:true,evidencePath:g}}}return null}function v(e,r){let n=l(e);if(!n)return null;let t=r??n.latestStage;return n.stages[t]??null}async function O(e,r){let n=a.resolve(e),t=a.join(n,".rapidkit","reports",R),i=await S(t),c=l(i),u=c?{...c.stages}:{};u[r.stage]=r;let p={schemaVersion:s,generatedAt:r.generatedAt,workspacePath:r.workspacePath,latestStage:r.stage,stages:u,enterpriseControls:{jsonReady:true,evidencePath:g}};return await W(t,p),p}export{R as a,g as b,v as c,O as d};
@@ -1,2 +0,0 @@
1
- import {a}from'./chunk-HHJAANUC.js';import {l}from'./chunk-OCGZNSOE.js';import c from'path';import h from'fs-extra';var j=".rapidkit/workspace.contract.json",w=1;function W(e){return e.replace(/\\/g,"/")}function y(e){let r=W(e).trim();return !r||r.startsWith("/")||r.startsWith("~")||/^[a-zA-Z]:\//.test(r)||r.includes("\0")?false:!r.split("/").filter(Boolean).some(o=>o===".."||o===".")}function $(e,r){return e.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/-+/g,"-").replace(/^[-_.]+|[-_.]+$/g,"").slice(0,80)||r}function E(e){return Array.isArray(e)?e.filter(r=>typeof r=="string"&&r.trim().length>0):[]}async function R(e){let r=c.join(e,".rapidkit","workspace.json");try{let o=await h.readJson(r);return {name:typeof o.workspace_name=="string"&&o.workspace_name.trim()||typeof o.name=="string"&&o.name.trim()||c.basename(e),profile:typeof o.profile=="string"?o.profile:void 0}}catch{return {name:c.basename(e)}}}async function O(e){let r=[],o=[e],n=new Set,i=new Set([".git","node_modules",".venv","venv","dist","build","target",".next",".turbo",".cache"]);for(;o.length>0;){let a=o.shift();if(!a||n.has(a))continue;n.add(a);let p=c.join(a,".rapidkit","project.json"),u=c.join(a,".rapidkit","context.json");if(await h.pathExists(p)||await h.pathExists(u)){r.push(await h.pathExists(p)?p:u);continue}let t;try{t=await h.readdir(a,{withFileTypes:true});}catch{continue}for(let s of t)!s.isDirectory()||i.has(s.name)||o.push(c.join(a,s.name));}return r.sort()}function J(e){let r=(e||"").toLowerCase();if(r.includes("fastapi"))return "fastapi";if(r.includes("nestjs"))return "nestjs";if(r.includes("springboot"))return "springboot";if(r.includes("gofiber"))return "fiber";if(r.includes("gogin"))return "gin"}function _(e,r){let o=(e||"").toLowerCase(),n=(r||"").toLowerCase();return o.includes("fastapi")?8e3:o.includes("nestjs")?3e3:o.includes("springboot")?8080:o.includes("gofiber")?3e3:o.includes("gogin")?8080:n==="node"?3e3:n==="python"?8e3:n==="java"||n==="go"?8080:null}function N(e,r){let o=e;for(;r.has(o)&&o<65535;)o+=1;return o}function P(e,r,o){let n=_(r.kit,r.runtime),i=e?.ports||[],a=i.length>0?i:n?[{name:"http",port:N(n,o),protocol:"http"}]:[];for(let t of a)o.add(t.port);let p={...r,...e,slug:e?.slug||r.slug,relativePath:e?.relativePath&&y(e.relativePath)?e.relativePath:r.relativePath,source:e?.source||r.source,relationship:e?.relationship||r.relationship,externalPath:e?.externalPath||r.externalPath,runtime:e?.runtime||r.runtime,framework:e?.framework||r.framework,kit:e?.kit||r.kit,modules:e?.modules?.length?e.modules:r.modules,ports:a,contracts:{owns:e?.contracts?.owns||[],apis:e?.contracts?.apis||[],publishes:e?.contracts?.publishes||[],consumes:e?.contracts?.consumes||[],dependsOn:e?.contracts?.dependsOn||[],env:e?.contracts?.env||[]}},u=JSON.stringify(e||null)!==JSON.stringify(p);return {project:p,changed:u}}async function A(e){let r=c.resolve(e.workspacePath),o=await R(r),n=await O(r),i=await a(r),a$1=[];for(let t of i){let s=c.resolve(t.path),d=c.join(s,".rapidkit","project.json"),f=c.join(s,".rapidkit","context.json"),k=await h.pathExists(d)?d:await h.pathExists(f)?f:null;!k||n.some(l=>c.resolve(l)===c.resolve(k))||a$1.push({projectJsonPath:k,registryEntry:t});}let p=[],u=[...n.map(t=>({projectJsonPath:t})),...a$1];for(let{projectJsonPath:t,registryEntry:s}of u){let d=c.dirname(c.dirname(t)),f=W(c.relative(r,d)),k=s!==void 0&&!y(f),l=$(s?.name||c.basename(d),c.basename(d)),m=k?`external/${l}`:f||l,g=await h.readJson(t),C=typeof g.kit_name=="string"&&g.kit_name||typeof g.kit=="string"&&g.kit||void 0,x=typeof g.framework=="string"&&g.framework||J(C);p.push({slug:s?.name||m||c.basename(d),relativePath:m,source:s?.source??"workspace",relationship:s?.relationship,externalPath:k?d:void 0,runtime:typeof g.runtime=="string"?g.runtime:void 0,framework:x,kit:C,modules:E(g.modules),ports:[],contracts:{owns:[],apis:[],publishes:[],consumes:[],dependsOn:[],env:[]}});}return {schemaVersion:w,kind:"rapidkit.workspace.contract",generatedAt:(e.now??new Date).toISOString(),workspace:o,projects:p}}async function F(e){let r=c.resolve(e.outputPath||c.join(e.workspacePath,j));if(await h.pathExists(r)&&e.force!==true)throw new Error(`Workspace contract already exists: ${r}. Use --force to overwrite.`);let o=await A({workspacePath:e.workspacePath,now:e.now}),n=new Set,i={...o,projects:o.projects.map(p=>P(void 0,p,n).project)};await h.ensureDir(c.dirname(r)),await h.writeJson(r,i,{spaces:2});let{publishWorkspaceRegistrySummary:a}=await import('./workspace-registry-summary-MIPHVB56.js');return await a(e.workspacePath,{now:e.now}),{contractPath:r,contract:i}}async function K(e){let r=c.resolve(e.workspacePath),o=c.join(r,j),n=await A({workspacePath:r,now:e.now}),i=await h.pathExists(o)?await h.readJson(o):null,a=new Map((i?.projects||[]).map(l=>[l.slug,l])),p=new Set,u=[],t=[],s=[];for(let l of n.projects){let m=a.get(l.slug),g=P(m,l,p);m?g.changed&&t.push(l.slug):u.push(l.slug),s.push(g.project),a.delete(l.slug);}for(let l of a.values()){let m=P(l,l,p);s.push(m.project);}let d={schemaVersion:w,kind:"rapidkit.workspace.contract",generatedAt:(e.now??new Date).toISOString(),workspace:{...n.workspace,...i?.workspace||{},name:i?.workspace?.name||n.workspace.name},projects:s.sort((l,m)=>l.slug.localeCompare(m.slug))};await h.ensureDir(c.dirname(o)),await h.writeJson(o,d,{spaces:2});let f=await V({workspacePath:r}),{publishWorkspaceRegistrySummary:k}=await import('./workspace-registry-summary-MIPHVB56.js');return await k(r,{now:e.now}),{contractPath:o,contract:d,addedProjects:u,updatedProjects:t,verification:f}}async function S(e){let r=c.resolve(e.contractPath||c.join(e.workspacePath,j)),o=await h.readJson(r);return {contractPath:r,contract:o}}async function L(e){let{contractPath:r,contract:o}=await S(e),n=o.projects.map(t=>({id:t.slug,label:t.slug,relativePath:t.relativePath,source:t.source,relationship:t.relationship,externalPath:t.externalPath,runtime:t.runtime,framework:t.framework,kit:t.kit,modules:t.modules,ports:t.ports,apis:t.contracts.apis,owns:t.contracts.owns,env:t.contracts.env})),i=new Set(n.map(t=>t.id)),a=new Map,p=[];for(let t of o.projects){for(let s of t.contracts.dependsOn||[])i.has(s)&&p.push({from:s,to:t.slug,type:"dependency",label:"dependsOn"});for(let s of t.contracts.publishes||[])a.has(s)||a.set(s,new Set),a.get(s)?.add(t.slug);}for(let t of o.projects)for(let s of t.contracts.consumes||[]){let d=a.get(s);if(d)for(let f of d)f!==t.slug&&p.push({from:f,to:t.slug,type:"event",label:s});}let u={schemaVersion:1,kind:"rapidkit.workspace.contract.graph",workspace:o.workspace,generatedAt:new Date().toISOString(),nodes:n.sort((t,s)=>t.id.localeCompare(s.id)),edges:p.sort((t,s)=>`${t.from}:${t.to}:${t.type}:${t.label}`.localeCompare(`${s.from}:${s.to}:${s.type}:${s.label}`)),summary:{projectCount:n.length,dependencyEdges:p.filter(t=>t.type==="dependency").length,eventEdges:p.filter(t=>t.type==="event").length,portCount:n.reduce((t,s)=>t+s.ports.length,0),apiCount:n.reduce((t,s)=>t+s.apis.length,0)}};return {contractPath:r,graph:u}}async function V(e){let{contractPath:r,contract:o}=await S(e),n=[],i=[];o.kind!=="rapidkit.workspace.contract"&&n.push("Contract kind must be rapidkit.workspace.contract."),o.schemaVersion!==w&&n.push(`Contract schemaVersion must be ${w}.`),o.workspace?.name||n.push("Contract workspace.name is required."),Array.isArray(o.projects)||n.push("Contract projects must be an array.");let a=new Set,p=new Map;for(let t of o.projects||[]){if(!t.slug){n.push("Every project must declare slug.");continue}a.has(t.slug)&&n.push(`Duplicate project slug: ${t.slug}.`),a.add(t.slug),t.relativePath?y(t.relativePath)||n.push(`Project ${t.slug} declares unsafe relativePath: ${t.relativePath}.`):n.push(`Project ${t.slug} must declare relativePath.`),t.externalPath&&(t.relationship==="adopted"||t.source==="adopted-local"||t.source==="local-folder"||t.source==="git-url"||n.push(`Project ${t.slug} declares externalPath without imported/adopted provenance.`),c.isAbsolute(t.externalPath)||n.push(`Project ${t.slug} declares non-absolute externalPath.`));for(let s of t.ports||[]){(!Number.isInteger(s.port)||s.port<1||s.port>65535)&&n.push(`Project ${t.slug} declares invalid port: ${s.port}.`);let d=p.get(s.port);d&&n.push(`Port ${s.port} is claimed by both ${d} and ${t.slug}.`),p.set(s.port,t.slug);}for(let s of t.contracts?.apis||[])(!s.name?.trim()||!s.basePath?.startsWith("/"))&&n.push(`Project ${t.slug} declares invalid API contract.`);for(let s of [...t.contracts?.publishes||[],...t.contracts?.consumes||[]])s.trim()||n.push(`Project ${t.slug} declares an empty event contract.`);for(let s of t.contracts?.env||[])/^[A-Z_][A-Z0-9_]*$/.test(s)||n.push(`Project ${t.slug} declares invalid env contract: ${s}.`);for(let s of t.contracts?.dependsOn||[])a.has(s);}for(let t of o.projects||[])for(let s of t.contracts?.dependsOn||[])a.has(s)||n.push(`Project ${t.slug} depends on unknown project: ${s}.`);i.push({id:"schema",status:o.kind==="rapidkit.workspace.contract"&&o.schemaVersion===w?"passed":"failed",message:"Contract schema and kind are valid."}),i.push({id:"projects",status:Array.isArray(o.projects)?"passed":"failed",message:`Contract declares ${Array.isArray(o.projects)?o.projects.length:0} project(s).`}),i.push({id:"ports",status:n.some(t=>t.toLowerCase().includes("port"))?"failed":"passed",message:"Project port declarations are valid and collision-free."}),i.push({id:"dependencies",status:n.some(t=>t.includes("depends on unknown project"))?"failed":"passed",message:"Project dependencies point to known project slugs."}),i.push({id:"contracts",status:n.some(t=>t.includes("unsafe relativePath")||t.includes("invalid API contract")||t.includes("event contract")||t.includes("env contract"))?"failed":"passed",message:"Project path, API, event, and env contracts are valid."});let u=await l(e.workspacePath);if(u.moduleCount>0){for(let t of u.issues)n.push(`${c.basename(t.projectRoot)}: ${t.message} (slug=${t.slug})`);i.push({id:"module-paths",status:u.status,message:u.status==="passed"?`All ${u.moduleCount} registered module(s) resolve under canonical paths.`:`${u.issues.length} registered module(s) missing canonical install paths.`});}else e.strict&&i.push({id:"module-paths",status:"passed",message:"No registry-backed modules declared in workspace projects."});return {status:n.length>0?"failed":"passed",contractPath:r,projectCount:Array.isArray(o.projects)?o.projects.length:0,checks:i,violations:n}}
2
- export{j as a,w as b,O as c,A as d,F as e,K as f,S as g,L as h,V as i};
@@ -1,2 +0,0 @@
1
- var a="cli-log-event-v1";var m="RAPIDKIT_LOG_FORMAT";function c(e=process.argv){let r=process.env[m]?.trim().toLowerCase();if(r==="json")return "json";if(r==="text")return "text";for(let o=0;o<e.length;o+=1){let t=e[o];if(t==="--log-json")return "json";if(t==="--log-format"){let n=e[o+1]?.trim().toLowerCase();if(n==="json")return "json";if(n==="text")return "text"}if(t?.startsWith("--log-format=")){let n=t.slice(13).trim().toLowerCase();if(n==="json")return "json";if(n==="text")return "text"}}return "text"}function l(e=process.argv){return c(e)==="json"}var g="unknown-run";function I(e){g=e;}function u(){return g}function L(e){return {schemaVersion:a,runId:u(),timestamp:new Date().toISOString(),level:e.level,event:e.event,component:e.component,message:e.message,...e.command?{command:e.command}:{},...e.metadata&&Object.keys(e.metadata).length>0?{metadata:f(e.metadata)}:{}}}function y(e){l()&&p(L(e));}function p(e){process.stderr.write(`${JSON.stringify(e)}
2
- `);}function f(e){let r={};for(let[o,t]of Object.entries(e))if(t!==void 0){if(t instanceof Error){r[o]={name:t.name,message:t.message};continue}if(t===null||typeof t=="string"||typeof t=="number"||typeof t=="boolean"){r[o]=t;continue}if(Array.isArray(t)){r[o]=t.map(n=>typeof n=="string"||typeof n=="number"||typeof n=="boolean"?n:String(n));continue}r[o]=String(t);}return r}export{c as a,l as b,a as c,I as d,u as e,y as f,p as g};
@@ -1 +0,0 @@
1
- import {a,b}from'./chunk-S5KTATOU.js';import {d}from'./chunk-X7PWDIQW.js';function f(r){let s=new Map;for(let n of r.projects)s.has(n.name)||s.set(n.name,d(n));return s}function j(r){let s=f(r),n=r.graph??{nodes:r.projects.map(t=>({id:t.name,path:t.path})),edges:[]},a$1=a(n),o=new Map;for(let t of n.nodes){let e=s.get(t.id)??d({missing:t.id}),g=[...b(a$1,[t.id],{direction:"dependencies"}).keys()].filter(c=>c!==t.id).sort((c,l)=>c.localeCompare(l)).map(c=>({id:c,hash:s.get(c)??"<unknown>"}));o.set(t.id,{id:t.id,ownHash:e,transitiveInputsHash:d({own:e,dependencies:g})});}return o}function v(r,s){if(!s||Object.keys(s).length===0)return {verdict:"unknown",baseline:"none",changed:[],added:[],removed:[]};let n=[],a=[];for(let[e,i]of r.entries())e in s?s[e]!==i.transitiveInputsHash&&n.push(e):a.push(e);let o=[];for(let e of Object.keys(s))r.has(e)||o.push(e);return n.sort((e,i)=>e.localeCompare(i)),a.sort((e,i)=>e.localeCompare(i)),o.sort((e,i)=>e.localeCompare(i)),{verdict:n.length>0||a.length>0||o.length>0?"stale":"fresh",baseline:"recorded",changed:n,added:a,removed:o}}function w(r){let s={};for(let[n,a]of [...r.entries()].sort((o,t)=>o[0].localeCompare(t[0])))s[n]=a.transitiveInputsHash;return s}export{f as a,j as b,v as c,w as d};
@@ -1,2 +0,0 @@
1
- import {a,b as b$1,d}from'./chunk-FV5A3N3I.js';import {d as d$1}from'./chunk-S5KTATOU.js';import {n,q as q$1,g}from'./chunk-YBS2HGO3.js';import {h,i,f,e}from'./chunk-UZW5QFRW.js';import {a as a$1}from'./chunk-VKLL63TL.js';import M from'fs';import b from'path';import v from'chalk';import {execa}from'execa';function pe(e){return M.existsSync(b.join(e,"bun.lock"))||M.existsSync(b.join(e,"bunfig.toml"))?"bun":M.existsSync(b.join(e,"pnpm-lock.yaml"))?"pnpm":M.existsSync(b.join(e,"yarn.lock"))?"yarn":(M.existsSync(b.join(e,"package-lock.json")),"npm")}function me(e,r,t=pe(e)){return t==="npm"?`npm run ${r}`:`${t} run ${r}`}function ge(e,r=pe(e)){return `${r} install`}var Ae={"python-fastapi":{runtime:"python",framework:"FastAPI",markers:["pyproject.toml","fastapi"],commands:{init:"python -m pip install -e .",test:"pytest",build:"python -m build",start:"uvicorn main:app --reload"},errorPatterns:{setup:["ModuleNotFoundError","No module named","pip: command not found"],"test-failure":["FAILED","ERROR","test session started"],dependency:["ImportError","missing.*dependency"],runtime:["TypeError","AttributeError","ValueError"],timeout:["timeout","Timeout","timed out"],unknown:[]},healthCheck:{stage:"start",type:"http",value:"http://localhost:8000/docs"},validation:{command:"python -m pip list | grep fastapi",error:"FastAPI not installed"}},"python-django":{runtime:"python",framework:"Django",markers:["manage.py","django"],commands:{init:"python manage.py migrate",test:"python manage.py test",build:"python manage.py collectstatic --noinput",start:"python manage.py runserver 0.0.0.0:8000"},errorPatterns:{setup:["ModuleNotFoundError","ProgrammingError.*migrate"],"test-failure":["FAILED","ERROR","Ran.*test"],dependency:["ImportError","missing.*dependency"],runtime:["DatabaseError","ImproperlyConfigured"],timeout:["timeout","Timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:8e3},dependencies:["init"]},"node-nestjs":{runtime:"node",framework:"NestJS",markers:["package.json","@nestjs/core"],commands:{init:"npm install",test:"npm run test",build:"npm run build",start:"npm run start"},errorPatterns:{setup:["npm ERR!","ENOENT","not found"],"test-failure":["Tests.*failed","FAIL","fail.*test"],dependency:["Cannot find module","ERR_MODULE_NOT_FOUND"],runtime:["TypeError","Error: ","ReferenceError"],timeout:["timeout","TIMEOUT"],unknown:[]},healthCheck:{stage:"start",type:"port",value:3e3}},"node-express":{runtime:"node",framework:"Express",markers:["package.json","express"],commands:{init:"npm install",test:"npm run test",build:"npm run build",start:"npm start"},errorPatterns:{setup:["npm ERR!","ENOENT"],"test-failure":["failed","FAIL"],dependency:["Cannot find module"],runtime:["Error","TypeError"],timeout:["timeout"],unknown:[]}},"go-fiber":{runtime:"go",framework:"Fiber",markers:["go.mod","fiber"],commands:{init:"go mod download && go mod tidy",test:"go test ./...",build:"go build -o app .",start:"./app"},errorPatterns:{setup:["go: .*not found","cannot find","go mod tidy"],"test-failure":["FAIL","--- FAIL"],dependency:["missing.*module"],runtime:["panic","fatal","Error"],timeout:["timeout","context deadline"],unknown:[]},dependencies:["init"]},"go-gin":{runtime:"go",framework:"Gin",markers:["go.mod","gin-gonic"],commands:{init:"go mod download && go mod tidy",test:"go test ./...",build:"go build -o app .",start:"./app"},errorPatterns:{setup:["go: .*not found"],"test-failure":["FAIL"],dependency:["missing.*module"],runtime:["panic"],timeout:["timeout"],unknown:[]}},"java-springboot":{runtime:"java",framework:"Spring Boot",markers:["pom.xml","build.gradle","spring-boot"],commands:{init:"mvn dependency:go-offline",test:"mvn test",build:"mvn package -DskipTests",start:"mvn spring-boot:run"},errorPatterns:{setup:["\\[ERROR\\]","BUILD FAILURE","missing dependencies"],"test-failure":["\\[ERROR\\] Tests run:","BUILD FAILURE"],dependency:["missing.*dependency"],runtime:["Exception","Error","NullPointerException"],timeout:["timeout","Timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:8080}},"php-laravel":{runtime:"php",framework:"Laravel",markers:["composer.json","artisan","app/Models"],commands:{init:"composer install && php artisan migrate:fresh --seed",test:"php artisan test",build:"php artisan config:cache && php artisan route:cache && php artisan view:cache",start:"php artisan serve --host=0.0.0.0 --port=8000"},errorPatterns:{setup:["Composer.*lock","Fatal error","Class.*not found"],"test-failure":["FAILED","Tests.*failed"],dependency:["Class.*not found","require.*failed"],runtime:["Fatal error","Exception","Error"],timeout:["timeout","Timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:8e3},dependencies:["init"]},"php-symfony":{runtime:"php",framework:"Symfony",markers:["composer.json","symfony.lock","bin/console"],commands:{init:"composer install && php bin/console doctrine:database:create",test:"php bin/phpunit",build:"php bin/console cache:clear --env=prod",start:"symfony serve --no-tls"},errorPatterns:{setup:["Composer.*error","Fatal error"],"test-failure":["FAILED","failure"],dependency:["Class.*not found"],runtime:["Fatal error","Exception"],timeout:["timeout"],unknown:[]},dependencies:["init"]},"rust-actix":{runtime:"rust",framework:"Actix-web",markers:["Cargo.toml","actix"],commands:{init:"cargo fetch",test:"cargo test",build:"cargo build --release",start:"cargo run --release"},errorPatterns:{setup:["error: .*could not find","failed.*download"],"test-failure":["test result:","FAILED"],dependency:["can.t find.*crate"],runtime:["error\\[E","thread.*panicked"],timeout:["timeout"],unknown:[]},validation:{command:"cargo --version",error:"Rust/Cargo not installed"}},"rust-axum":{runtime:"rust",framework:"Axum",markers:["Cargo.toml","axum"],commands:{init:"cargo fetch",test:"cargo test",build:"cargo build --release",start:"cargo run --release"},errorPatterns:{setup:["error: .*could not find"],"test-failure":["test result:","FAILED"],dependency:["can.t find.*crate"],runtime:["error\\[E"],timeout:["timeout"],unknown:[]}},"rust-rocket":{runtime:"rust",framework:"Rocket",markers:["Cargo.toml","rocket"],commands:{init:"cargo fetch",test:"cargo test",build:"cargo build --release",start:"cargo run --release"},errorPatterns:{setup:["error: .*could not find"],"test-failure":["FAILED"],dependency:["can.t find"],runtime:["error\\[E"],timeout:["timeout"],unknown:[]}},"dotnet-aspnetcore":{runtime:"dotnet",framework:"ASP.NET Core",markers:[".csproj",".sln","Program.cs"],commands:{init:"dotnet restore",test:"dotnet test",build:"dotnet build -c Release",start:"dotnet run"},errorPatterns:{setup:["error CS","CSPROJ.*not found","NuGet.*restore"],"test-failure":["Failed:.*test","FAILED"],dependency:["error NU1101"],runtime:["error CS","Exception"],timeout:["timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:5e3}},"elixir-phoenix":{runtime:"elixir",framework:"Phoenix",markers:["mix.exs","phoenix"],commands:{init:"mix setup",test:"mix test",build:"mix compile --all-warnings",start:"mix phx.server"},errorPatterns:{setup:["\\*\\* \\(.*Error\\)","Mix.InstallError"],"test-failure":["\\d+\\sfailed","FAILED"],dependency:["dependencies are not available"],runtime:["\\*\\* \\(","RuntimeError"],timeout:["timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:4e3},dependencies:["init"]},"ruby-rails":{runtime:"ruby",framework:"Rails",markers:["Gemfile","config/application.rb","bin/rails"],commands:{init:"bundle install && rails db:prepare",test:"rails test",build:"rails assets:precompile",start:"rails server --binding=0.0.0.0 --port=3000"},errorPatterns:{setup:["Bundler::.*Error","Gem::.*Error"],"test-failure":["failures,","error,","FAILED"],dependency:["Could not find.*gem"],runtime:["Error","Exception","NoMethodError"],timeout:["timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:3e3},dependencies:["init"]},"ruby-sinatra":{runtime:"ruby",framework:"Sinatra",markers:["Gemfile","app.rb","sinatra"],commands:{init:"bundle install",test:"rspec",build:`echo "Sinatra apps don't require build"`,start:"ruby app.rb"},errorPatterns:{setup:["Bundler.*Error","Gem.*Error"],"test-failure":["failure","FAILED"],dependency:["Could not find.*gem"],runtime:["Error","NoMethodError"],timeout:["timeout"],unknown:[]}}},Te={init:{python:["pip install -e .","poetry install","pip install -r requirements.txt"],node:["npm install","pnpm install","yarn install"],go:["go mod download && go mod tidy","go get ./..."],java:["mvn dependency:go-offline","gradle dependencies"],php:["composer install"],rust:["cargo fetch"],dotnet:["dotnet restore"],elixir:["mix deps.get"],ruby:["bundle install"],"jvm-generic":["mvn dependency:go-offline","gradle dependencies"],unknown:[]},test:{python:["pytest","python -m unittest","python -m pytest"],node:["npm test","npm run test"],go:["go test ./...","make test"],java:["mvn test","gradle test"],php:["php artisan test","phpunit","pest"],rust:["cargo test"],dotnet:["dotnet test"],elixir:["mix test"],ruby:["rspec","ruby -m minitest"],"jvm-generic":["mvn test","gradle test"],unknown:[]},build:{python:["python -m build","python setup.py build"],node:["npm run build"],go:["go build -o app .","go build ./..."],java:["mvn package -DskipTests","gradle build -x test"],php:['echo "PHP build: typically no build step"'],rust:["cargo build --release"],dotnet:["dotnet build -c Release"],elixir:["mix compile"],ruby:["gem build *.gemspec"],"jvm-generic":["mvn package -DskipTests","gradle build"],unknown:[]},start:{python:["python app.py","python main.py","uvicorn main:app --reload"],node:["npm start","node index.js","node src/index.js"],go:["./app","go run main.go","go run ./..."],java:["mvn spring-boot:run","gradle bootRun","java -jar target/*.jar"],php:["php -S 0.0.0.0:8000","php artisan serve"],rust:["cargo run --release","./target/release/app"],dotnet:["dotnet run"],elixir:["mix phx.server","iex -S mix"],ruby:["rails server","ruby app.rb","bundle exec puma"],"jvm-generic":["java -jar *.jar","gradle run"],unknown:[]}};function fe(e$1,r,t){if(r){let o=r.trim().toLowerCase().replace(/[_.\s]+/g,"-"),a=e(r),m=`${e$1}-${a==="gofiber"?"fiber":a==="gogin"?"gin":a==="dotnet"?"aspnetcore":a!=="unknown"?a:o==="fiber"?"fiber":o==="aspnetcore"||o==="asp-net-core"?"aspnetcore":o}`,g=Ae[m];if(g&&g.commands[t])return g.commands[t]}let n=Te[t]?.[e$1]??[];return n.length>0?n[0]:void 0}var Ne={test:"test",build:"build",start:"start"};function J(e){if(e.stage==="init")return e.runtime==="node"?ge(e.projectPath):fe(e.runtime,e.framework,e.stage);if(e.runtime==="node"){let r=Ne[e.stage];if(r){let t=g(e.projectPath,r,{framework:e.framework});if(t)return me(e.projectPath,t.scriptName)}}return fe(e.runtime,e.framework,e.stage)}function Ie(e){let r=h(e).map(t=>t==="python"?"python":t==="node"||t==="bun"?"node":t==="go"?"go":t==="java"?"java":t==="php"?"php":t==="rust"?"rust":t==="dotnet"?"dotnet":t==="elixir"?"elixir":t==="ruby"?"ruby":t==="clojure"||t==="scala"||t==="kotlin"?"jvm-generic":null).filter(t=>t!==null).filter((t,n,o)=>o.indexOf(t)===n);return {primary:r.length>0?r[0]:"unknown",secondary:r.slice(1)}}function ye(e){return Ie(e).primary}function he(e,r){if(!e)return "unknown";r||(r={setup:["ModuleNotFoundError","npm ERR!","error:","not found"],"test-failure":["FAILED","FAIL","failed"],dependency:["cannot find module","import.*error"],runtime:["Exception","Error:","panic","TypeError"],timeout:["timeout","Timeout","deadline exceeded"],unknown:[]});for(let[t,n]of Object.entries(r))for(let o of n)if(new RegExp(o,"i").test(e))return t;return "unknown"}async function G(e){let r=e.split(/[&|;]\s*/)[0].trim().split(/\s+/)[0];if(["echo","cd","pwd","test","true","false","exit"].includes(r))return {valid:true};try{let n=process.platform==="win32"?"where":"which";if((await execa(n,[r],{reject:false})).exitCode===0)return {valid:true}}catch{}return {valid:false,reason:`Command '${r}' not found or not executable`}}function ke(e,r,t){if(!r)return e;let n=typeof r=="object"&&!Array.isArray(r)&&("dev"in r||"staging"in r||"prod"in r||"default"in r)&&!Object.keys(r).some(o=>["init","test","build","start"].includes(o))?r:{};return t&&typeof n[t]=="string"?n[t]:typeof n.default=="string"?n.default:e}var we={init:"init",test:"test",build:"build",start:"start"};function We(e){return e in we?we[e]:null}function be(e,r,t=q$1(e)){let n=We(r);if(!n)return {supported:false,reason:`Workspace stage "${r}" is not part of the RapidKit fleet contract.`};if(!t.projectRoot)return {supported:false,reason:"No RapidKit project metadata was detected for this target."};let o=t.commandMap[n];return !o||o.status!=="supported"?{supported:false,reason:o?.reason??`Command "${n}" is not supported for this project runtime/framework.`}:{supported:true}}var $e=new Set(["init","test","build","start"]),De=new Set([".git","node_modules",".rapidkit",".venv","dist","build","coverage","htmlcov"]);async function T(e){try{return await M.promises.access(e,M.constants.F_OK),true}catch{return false}}async function Me(e,r,t){if(r==="python"){let n=b.join(e,".rapidkit","cli.py");return await T(n)?{valid:true}:{valid:false,reason:"Project-local .rapidkit/cli.py is missing. Run `rapidkit init` in this project first."}}return G(t)}async function Q(e){let r=await M.promises.readFile(e,"utf-8");return JSON.parse(r)}function P(e){return e.replace(/\\/g,"/")}function Oe(e){let r=e?.trim();return r?r.startsWith("project:")?r.slice(8).trim()||null:r:null}async function Le(e){return a$1(e,{skipDirs:De,includeHiddenDirs:false,descendIntoMatchedProjects:false,isProjectDir:async(r,t)=>await T(b.join(r,".rapidkit","context.json"))||await T(b.join(r,".rapidkit","project.json"))?true:b.resolve(r)===b.resolve(t)?false:h(r).length>0})}async function _e(e){for(let r of [b.join(".rapidkit","project.json"),b.join(".rapidkit","context.json")]){let t=b.join(e,r);if(await T(t))try{let n=await Q(t),o=n.name??n.projectName??n.slug;if(typeof o=="string"&&o.trim())return o.trim()}catch{}}return null}async function Ge(e,r,t){let n=Oe(t);if(!n)return {projects:r,normalizedScope:null};let o=P(n).toLowerCase(),a=[];for(let u of r){let m=P(b.relative(e,u)),g=b.basename(u),y=await _e(u);[m,g,y].filter(s=>typeof s=="string"&&s.length>0).map(s=>P(s).toLowerCase()).includes(o)&&a.push(u);}if(a.length===0)throw new Error(`Workspace run scope did not match any project: ${t}`);return {projects:a,normalizedScope:n}}async function Be(e,r,t){let n=await execa("git",["diff","--name-only",`${t}...HEAD`],{cwd:e,reject:false});if(n.exitCode!==0)return new Set(r);let o=n.stdout.split(/\r?\n/).map(u=>u.trim()).filter(u=>u.length>0).map(u=>P(u));if(o.length===0)return new Set;let a=new Set;for(let u of r){let m=P(b.relative(e,u));if(!m||m===".")continue;let g=`${m}/`;o.some(y=>y===m||y.startsWith(g))&&a.add(u);}return a}async function Ke(e,r,t){let n=b.join(e,".rapidkit","workspace.contract.json");if(await T(n))try{let p=await Ve(e,r,t,n);if(p.graphStatus!=="missing")return p}catch{return {expanded:t,graphStatus:"invalid",expansionDepth:0}}let o=b.join(e,".rapidkit","workspace-dependency-graph.json");if(!await T(o))return {expanded:t,graphStatus:"missing",expansionDepth:0};let a;try{a=await Q(o);}catch{return {expanded:t,graphStatus:"invalid",expansionDepth:0}}let u=new Set(r.map(p=>b.resolve(p))),m=new Map;if(!a||typeof a!="object"||Array.isArray(a))return {expanded:t,graphStatus:"invalid",expansionDepth:0};let g=Array.isArray(a.projects)?a.projects:[];for(let p of g){if(!p||typeof p!="object"||Array.isArray(p))continue;let s=p,d=typeof s.path=="string"?s.path:"",f=b.resolve(e,d);if(!u.has(f))continue;let k=Array.isArray(s.dependsOn)?s.dependsOn.filter(R=>typeof R=="string"):[];for(let R of k){let c=b.resolve(e,R);u.has(c)&&(m.has(c)||m.set(c,new Set),m.get(c)?.add(f));}}let y=d$1(m,t);return {expanded:y.reached,graphStatus:"loaded",expansionDepth:y.added}}async function Ve(e,r,t,n){let o=await Q(n);if(!o||typeof o!="object"||Array.isArray(o))return {expanded:t,graphStatus:"invalid",expansionDepth:0};let a=o,u=Array.isArray(a.projects)?a.projects:null;if(!u)return {expanded:t,graphStatus:"invalid",expansionDepth:0};let m=new Map,g=new Map;for(let f of r){let k=P(b.relative(e,f));g.set(k,b.resolve(f));}let y=new Map,p=new Map,s=new Map;for(let f of u){if(!f||typeof f!="object"||Array.isArray(f))continue;let k=f,R=typeof k.slug=="string"?k.slug:"",c=typeof k.relativePath=="string"?P(k.relativePath):R,h=g.get(c);!R||!h||m.set(R,h);}for(let f of u){if(!f||typeof f!="object"||Array.isArray(f))continue;let k=f,R=typeof k.slug=="string"?k.slug:"",c=m.get(R);if(!c)continue;let h=k.contracts&&typeof k.contracts=="object"&&!Array.isArray(k.contracts)?k.contracts:{},N=Array.isArray(h.dependsOn)?h.dependsOn.filter(x=>typeof x=="string"):[],W=Array.isArray(h.publishes)?h.publishes.filter(x=>typeof x=="string"):[],$=Array.isArray(h.consumes)?h.consumes.filter(x=>typeof x=="string"):[];for(let x of N){let S=m.get(x);S&&(s.has(S)||s.set(S,new Set),s.get(S)?.add(c));}for(let x of W)y.has(x)||y.set(x,new Set),y.get(x)?.add(c);for(let x of $)p.has(x)||p.set(x,new Set),p.get(x)?.add(c);}for(let[f,k]of y.entries()){let R=p.get(f);if(R)for(let c of k){s.has(c)||s.set(c,new Set);for(let h of R)h!==c&&s.get(c)?.add(h);}}let d=d$1(s,t);return {expanded:d.reached,graphStatus:"loaded",expansionDepth:d.added}}async function He(e,r){if(typeof r=="boolean")return r;let t=b.join(e,".rapidkit","policies.yml");if(!await T(t))return true;let n="";try{n=await M.promises.readFile(t,"utf-8");}catch{return true}let o=n.match(/^[\t ]*rules\.enforce_workspace_run_gates:\s*(true|false)\s*(?:#.*)?$/m);return o?o[1]==="true":true}async function q(e,r){let t=process.argv[1];if(!t)return {exitCode:1,stdout:"",stderr:"RapidKit entrypoint is unavailable for nested workspace-run execution."};let n=await execa(process.execPath,[t,...e],{cwd:r,reject:false,env:{...process.env,RAPIDKIT_WORKSPACE_RUN_CHILD:"1"}});return {exitCode:Number(n.exitCode??1),stdout:n.stdout,stderr:n.stderr}}function ze(e){return e==="node"||e==="go"||e==="java"||e==="python"||e==="dotnet"}function Ue(){return process.env.VITEST==="true"||process.env.VITEST==="1"||process.env.NODE_ENV==="test"}async function Je(e){let r=process.cwd();try{process.chdir(e);let{handleInitCommand:t}=await import('./index.js');return {exitCode:await t(["init"]),stdout:"",stderr:""}}finally{process.chdir(r);}}async function qe(e$1){let r=s=>{let d=f(s);return d==="node"||d==="bun"?"node":d==="python"?"python":d==="go"?"go":d==="java"?"java":d==="php"?"php":d==="ruby"?"ruby":d==="rust"?"rust":d==="dotnet"?"dotnet":d==="elixir"?"elixir":d==="clojure"||d==="scala"||d==="kotlin"?"jvm-generic":ye(e$1)},t=s=>{if(!s)return;let d=e(s);if(new Set(["fastapi","django","flask","nestjs","express","fastify","koa","gofiber","gogin","echo","springboot","laravel","symfony","rails","sinatra","dotnet","actix","axum","rocket","phoenix"]).has(d))return d},n$1=n(e$1),o=n$1?.detection??i(e$1,n$1?.projectJson??null),a=n$1?.contextJson,u=r(o.runtime),m=t(o.key),g={},y=new Set(["init","test","build","start"]);if(a?.commands&&typeof a.commands=="object")for(let[s,d]of Object.entries(a.commands))typeof d=="string"&&y.has(s)&&(g[s]=d);let p;if(a?.commandEnvironments&&typeof a.commandEnvironments=="object"){let s=a.commandEnvironments;p={dev:typeof s.dev=="string"?s.dev:void 0,staging:typeof s.staging=="string"?s.staging:void 0,prod:typeof s.prod=="string"?s.prod:void 0,default:typeof s.default=="string"?s.default:void 0};}return {runtime:u,framework:m,commandOverrides:Object.keys(g).length>0?g:void 0,environmentCommandVariants:p,environment:typeof a?.environment=="string"?a.environment:void 0}}async function Ye(e,r,t,n,o,a,u){let m=!o?.[r]&&ze(t),g;if(o&&o[r]?g=o[r]:m?g=`rapidkit ${r}`:g=J({projectPath:e,runtime:t,framework:n,stage:r}),!g)return {exitCode:127,command:`<stage not supported for ${t}>`,message:`No stage command found for runtime '${t}' and framework '${n||"unknown"}'`,errorCategory:"runtime"};let y=ke(g,a,u);if(!y)return {exitCode:127,command:g,message:"Failed to resolve stage command",errorCategory:"runtime"};let p=J({projectPath:e,runtime:t,framework:n,stage:r});if(m){if(p){let c=m?await Me(e,t,p):await G(p);if(!c.valid)return {exitCode:127,command:y,message:c.reason||"Command not available",errorCategory:"setup"}}}else {let c=await G(y);if(!c.valid)return {exitCode:127,command:y,message:c.reason||"Command not available",errorCategory:"setup"}}let s=0,d="",f="",k;try{let c=m?r==="init"&&Ue()?await Je(e):await q([r],e):await execa(y,[],{cwd:e,reject:false,shell:true});if(s=Number(c.exitCode??0),d=c.stdout,f=c.stderr,s!==0){let h=`${d}
2
- ${f}`;k=he(h);}}catch(c){return {exitCode:1,command:y,message:c instanceof Error?c.message:"Command execution failed",errorCategory:"runtime"}}return {exitCode:s,command:y,errorCategory:k,healthStatus:void 0,message:s!==0?`Stage failed with exit code ${s}`:void 0}}function xe(e){try{return JSON.parse(e)}catch{return null}}function Qe(e){switch(e){case "dotnet":return "Install .NET 8+ SDK, then rerun `npx rapidkit setup dotnet` or `npx rapidkit init`.";case "go":return "Install Go 1.21+, then rerun `npx rapidkit setup go` or `npx rapidkit init`.";case "java":case "jvm-generic":return "Install Java 21+ and Maven/Gradle, then rerun `npx rapidkit setup java` or `npx rapidkit init`.";case "node":return "Install Node.js LTS and npm/pnpm/yarn, then rerun `npx rapidkit setup node` or `npx rapidkit init`.";case "python":return "Install Python 3.10+ and pip/Poetry, then rerun `npx rapidkit setup python` or `npx rapidkit init`.";default:return null}}async function Xe(e){let r=[],t=await q(["doctor","workspace","--json"],e);if(t.exitCode!==0)r.push({gate:"doctor-workspace",status:"fail",summary:"doctor workspace command failed"});else {let a=xe(t.stdout)?.healthScore,u=Number(a?.errors??0);Number.isFinite(u)&&u>0?r.push({gate:"doctor-workspace",status:"fail",summary:`doctor workspace reports ${u} error(s)`}):r.push({gate:"doctor-workspace",status:"pass",summary:"doctor workspace passed"});}let n=await q(["readiness","--json"],e);if(n.exitCode!==0)r.push({gate:"readiness",status:"fail",summary:"readiness command failed"});else {let o=xe(n.stdout),a=String(o?.overallStatus??"").toLowerCase();a==="fail"?r.push({gate:"readiness",status:"fail",summary:"readiness overall status is fail"}):a==="warn"?r.push({gate:"readiness",status:"warn",summary:"readiness overall status is warn"}):r.push({gate:"readiness",status:"pass",summary:"readiness overall status is pass"});}return r}function Ze(e){return $e.has(e)}function et(e,r){let t=Math.max(1,Math.min(4,r)),n=Number(e??t);return Number.isFinite(n)?Math.max(1,Math.min(16,Math.trunc(n))):t}async function Ft(e){if(!Ze(e.stage))throw new Error(`Unsupported workspace run stage: ${e.stage}`);let r=Date.now(),t=b.resolve(e.workspacePath),n=await Le(t),{projects:o,normalizedScope:a$1}=await Ge(t,n,e.scope),u=e.affected===true,m=e.blastRadius===true,g=e.since?.trim()||"HEAD~1",y=u?await Be(t,o,g):new Set(o),p,s="not-applicable",d$1=0,f="all";if(u&&m){let l=await Ke(t,n,y);p=l.expanded,s=l.graphStatus,d$1=l.expansionDepth,f="affected+blast-radius";}else u?(p=y,f="affected"):(p=y,f="all");let k=e.stage==="init"?false:await He(t,e.enforceGates),R=k?await Xe(t):[{gate:"doctor-workspace",status:"skipped",summary:"workspace run gates disabled"},{gate:"readiness",status:"skipped",summary:"workspace run gates disabled"}],c=R.find(l=>l.status==="fail"),h=o.filter(l=>p.has(l)),N=e.continueOnError===true||e.stage==="init",W=e.parallel===true,$=et(e.maxWorkers,h.length),x=h.length,S=0;e.json||console.log(v.gray(`Workspace run (${e.stage}) started: ${x} target(s), ${W?`parallel x${$}`:"sequential"}`));let F=new Map;for(let l of n){let w=o.includes(l),i=w&&p.has(l);F.set(l,{path:l,relativePath:P(b.relative(t,l)),selected:i,affected:i,status:"skipped",exitCode:null,durationMs:0,reason:i?void 0:w?"not affected":"outside scope",framework:void 0,runtimeDetected:void 0,executionCommand:void 0});}if(c)for(let l of h){let w=F.get(l);w&&(w.status="skipped",w.reason=`blocked by ${c.gate}`);}else {let l=async w=>{let i=F.get(w);if(!i)return;let I=P(b.relative(t,w));e.json||console.log(v.gray(`\u23F3 [${S}/${x}] ${e.stage} ${I}`)),i.selected=true,i.affected=true;let E=Date.now(),{runtime:j,framework:C,commandOverrides:je,environmentCommandVariants:Se,environment:Ee}=await qe(w);i.runtimeDetected=j,i.framework=C;let re=be(w,e.stage);if(!re.supported){i.status="skipped",i.reason=re.reason??`stage "${e.stage}" unsupported for project`,i.durationMs=Date.now()-E,i.exitCode=null,S+=1;return}let A=await Ye(w,e.stage,j,C,je,Se,Ee);if(i.executionCommand=A.command,i.errorCategory=A.errorCategory,i.healthStatus=A.healthStatus,i.durationMs=Date.now()-E,i.exitCode=A.exitCode,A.exitCode===0?(i.status="passed",i.reason=void 0):(i.status="failed",i.reason=A.message||"stage command failed",i.errorMessage=A.message),S+=1,!e.json){let Ce=x>0?Math.round(S/x*100):100,Pe=i.status==="passed"?v.green("\u2705"):v.red("\u274C");if(console.log(v.gray(`${Pe} [${S}/${x}] (${Ce}%) ${I} ${i.durationMs}ms`)),i.status==="failed"){i.reason&&console.log(v.red(` Reason: ${i.reason}`)),i.executionCommand&&console.log(v.gray(` Command: ${i.executionCommand}`));let ne=Qe(i.runtimeDetected);ne&&i.errorCategory==="setup"&&console.log(v.gray(` Hint: ${ne}`));}}};if(W&&h.length>1){let w=0,i=false,I=new Array($).fill(null).map(async()=>{for(;w<h.length;){if(i&&!N)return;let E=w;w+=1;let j=h[E];await l(j),F.get(j)?.status==="failed"&&(i=true);}});if(await Promise.all(I),!N&&i){let E=false;for(let j of h){let C=F.get(j);if(C){if(C.status==="failed"){E=true;continue}E&&C.status==="skipped"&&(C.reason=C.reason||"stopped after failure");}}}}else for(let w of h){await l(w);let i=F.get(w);if(!N&&i?.status==="failed"){let I=h.slice(h.indexOf(w)+1);for(let E of I){let j=F.get(E);j&&(j.status="skipped",j.reason="stopped after failure");}break}}}let D=[];for(let l of n){let w=F.get(l);w&&D.push(w);}let X=D.filter(l=>l.status==="passed").length,K=D.filter(l=>l.status==="failed").length,Z=D.filter(l=>l.status==="skipped").length,ee=e.strict===true,Re=K>0||ee&&R.some(l=>l.status==="fail"||l.status==="warn")?1:0,te={schemaVersion:"1.0",workspacePath:t,stage:e.stage,generatedAt:new Date().toISOString(),durationMs:Date.now()-r,options:{affected:u,blastRadius:m,since:u?g:null,parallel:W,maxWorkers:$,continueOnError:N,strict:ee,enforceGates:k,scope:a$1},selection:{mode:f,since:u?g:null,scope:a$1,graphStatus:s,expansionDepth:d$1},gates:{enforced:k,results:R,blocked:!!c,blockingGate:c?.gate},summary:{projectCount:n.length,selectedCount:h.length,passed:X,failed:K,skipped:Z,exitCode:Re},projects:D,enterpriseControls:{jsonReady:true,evidencePath:b$1}},ve=b.join(t,".rapidkit","reports",a);return await d(t,te),e.json||(c&&(console.log(v.red(`\u274C Workspace run blocked by ${c.gate}`)),console.log(v.gray(` ${c.summary}`))),console.log(v.cyan(`Workspace run (${e.stage}) => passed: ${X}, failed: ${K}, skipped: ${Z}`)),console.log(v.gray(`Report: ${ve}`))),te}export{Ft as a};
@@ -1,2 +0,0 @@
1
- import {e,a}from'./chunk-TYZPPUBH.js';import d from'path';import g from'fs-extra';var f="workspace-context.v1",w=".rapidkit/reports/workspace-context-agent.json";function h(e){if(typeof e!="string"||!e.trim()||e==="true")return "generic";let t=e.trim().toLowerCase();return t==="codex"||t==="claude"||t==="cursor"||t==="orca"?t:"generic"}function y(e){return `npx --yes --package rapidkit rapidkit ${e}`.trim()}function j(e){return `npx rapidkit ${e}`.trim()}function i(e){return {id:e.id,scope:e.scope,display:j(e.args),execute:y(e.args),description:e.description,...e.project?{project:e.project}:{}}}function k(e,t){return `workspace run ${t} --scope project:${e.name}`}function C(e){return (e.startsWith("project:")?e.slice(8):e).trim().toLowerCase()}function v(e){return [e.name,e.path,d.basename(e.path),e.absolutePath].filter(t=>typeof t=="string"&&t.trim().length>0).map(t=>t.trim().toLowerCase())}function x(e,t){let s=[i({id:"workspace.model",scope:"workspace",args:"workspace model --json",description:"Read the canonical workspace intelligence model."}),i({id:"workspace.doctor",scope:"workspace",args:"doctor workspace --json",description:"Check workspace health before claiming verification."}),i({id:"workspace.pipeline",scope:"workspace",args:"pipeline --json",description:"Run the governed sync, doctor, analyze, readiness, and autopilot loop."}),i({id:"workspace.contract.verify",scope:"workspace",args:"workspace contract verify --json",description:"Verify workspace contract and dependency edges."}),i({id:"workspace.verify",scope:"workspace",args:"workspace verify --json",description:"Evaluate evidence freshness and verification gates before release decisions."})],r=t?[t]:e.projects;for(let o of r)o.commands.fleetStages.includes("test")&&s.push(i({id:`project.${o.name}.test`,scope:"project",project:o.name,args:k(o,"test"),description:`Run tests for ${o.name} through workspace orchestration.`})),o.commands.fleetStages.includes("build")&&s.push(i({id:`project.${o.name}.build`,scope:"project",project:o.name,args:k(o,"build"),description:`Build ${o.name} through workspace orchestration.`}));return s}function W(e){return e.commands.fleetStages.filter(t=>t==="test"||t==="build").map(t=>`workspace run ${t}`)}function b(e,t){if(!t?.startsWith("project:"))return;let s=C(t);if(s)return e.projects.find(r=>v(r).includes(s))}function S(e,t,s){let r=[...e.validation?.issues??[]];t?.startsWith("project:")&&!s&&r.push({severity:"error",code:"context.scope.project.missing",message:`Requested project scope was not found: ${t}`,target:t});let o=r.filter(a=>a.severity==="error").length,c=r.filter(a=>a.severity==="warning").length;return {status:o>0?"failed":c>0?"warning":"passed",errors:o,warnings:c,issues:r}}function P(e){let t=[],s=[];for(let[r,o]of Object.entries(e.evidence))o?.exists?t.push(`${r}: ${o.path}`):s.push(r);return {available:t.sort(),missing:s.sort()}}function A(e){let t=e.summary.projectCount,s=e.summary.runtimes.length?e.summary.runtimes.join(", "):"no runtime",r=e.identity.surfaces.length?e.identity.surfaces.join(", "):"no detected surfaces";return `${e.workspace.name} is a ${e.identity.workspaceType} with ${t} project${t===1?"":"s"}, ${s} runtime coverage, and ${r}.`}function M(e){let t=["Do not claim a command passed unless a report or command output proves it.","Do not infer secrets or environment values from file names.","Do not change project scope without checking the selected project."];return e.contracts.exists||t.push("Workspace contract is missing; dependency and API edges may be incomplete."),e.summary.observedProjects>0&&t.push("Some projects are observed rather than first-class; command support may be partial."),t}async function V(e$1){let t=e$1.model??await e({workspacePath:e$1.workspacePath,includeEvidence:e$1.includeEvidence===true,observableScanDepth:e$1.observableScanDepth,now:e$1.now}),s=h(e$1.agent),r=b(t,e$1.scope),o=S(t,e$1.scope,r);if(e$1.strict===true&&o.status!=="passed"){let n=o.issues.map(p=>`${p.severity}:${p.code}:${p.target}`).join(", ");throw new Error(`Workspace context strict validation failed: ${n}`)}let c=(r?[r]:t.projects).map(n=>({name:n.name,path:n.path,kind:n.kind,runtime:n.runtime,framework:n.frameworkDisplayName,...n.generator?{generator:n.generator}:{},createCapability:n.createCapability,supportTier:n.supportTier,safeCommands:W(n),importantFiles:n.importantFiles})),a=P(t),m=A(t);return {schemaVersion:f,generatedAt:(e$1.now??new Date).toISOString(),agent:s,workspaceSummary:m,modelRef:".rapidkit/reports/workspace-model.json",workspace:{name:t.workspace.name,root:t.workspace.root,type:t.identity.workspaceType,...t.workspace.profile?{profile:t.workspace.profile}:{}},scope:{requested:e$1.scope??"workspace",...r?{activeProject:r.name}:{}},projects:c,safeCommands:x(t,r),evidence:a,policies:{mode:t.policies.mode,source:t.policies.source},contracts:{exists:t.contracts.exists,path:t.contracts.workspaceContractPath},validation:o,agentInstructions:["Read `.rapidkit/reports/INDEX.json` first, then this context pack and linked evidence reports.","Use this context as the workspace source of truth before inspecting random files.","Prefer workspace-level evidence over generic framework assumptions.","Use `display` commands when explaining steps to a human.","Use `execute` commands when launching commands from automation or tooling.","Keep project-scoped advice tied to the active project scope.","Regenerate stale grounding with `npx rapidkit workspace agent-sync --write --refresh-context`."],unsafeAssumptions:M(t),humanSummary:[m,`Evidence available: ${a.available.length}. Missing evidence groups: ${a.missing.join(", ")||"none"}.`,r?`Active project scope: ${r.name} (${r.frameworkDisplayName}).`:"Scope: whole workspace."].join(`
2
- `)}}async function N(e,t){let s=d.join(t,w);return await g.ensureDir(d.dirname(s)),await g.writeJSON(s,a(e),{spaces:2}),s}export{f as a,w as b,V as c,N as d};
@@ -1,2 +0,0 @@
1
- import {a as a$1}from'./chunk-HTYMXMQM.js';import {e,c,a,b as b$1}from'./chunk-TYZPPUBH.js';import {c as c$1}from'./chunk-S5KTATOU.js';import pe from'crypto';import u from'path';import w from'fs-extra';import {spawnSync}from'child_process';function S(e,t){let r=spawnSync("git",t,{cwd:e,encoding:"utf8",stdio:["ignore","pipe","ignore"]});return r.status!==0?{ok:false,stdout:""}:{ok:true,stdout:(r.stdout??"").trim()}}function ce(e){let t=[],r=[],n=[];for(let c of e.split(`
2
- `)){if(!c.trim())continue;let o=c.slice(0,2),i=c.slice(3).trim();if(i){if(o==="??"){r.push(i);continue}o.includes("D")&&n.push(i),t.push(i);}}return {changedFiles:[...new Set(t)].sort(),untrackedFiles:[...new Set(r)].sort(),deletedFiles:[...new Set(n)].sort()}}function z(e,t){let r={available:false,dirty:false,changedFiles:[],untrackedFiles:[],deletedFiles:[]},n=S(e,["rev-parse","--is-inside-work-tree"]);if(!n.ok||n.stdout!=="true")return r;let c=S(e,["rev-parse","--abbrev-ref","HEAD"]),o=S(e,["rev-parse","HEAD"]),i=S(e,["status","--porcelain=v1","--untracked-files=all"]),p=ce(i.stdout),m=p.changedFiles.length>0||p.untrackedFiles.length>0||p.deletedFiles.length>0;return {available:true,branch:c.ok?c.stdout:void 0,commit:o.ok?o.stdout:void 0,ref:t?.ref,dirty:m,changedFiles:p.changedFiles,untrackedFiles:p.untrackedFiles,deletedFiles:p.deletedFiles}}var Q="workspace-model-snapshot.v1",T="workspace-model-diff.v1",E=".rapidkit/reports/workspace-model-snapshot.json",X=".rapidkit/reports/workspace-model-diff-last-run.json",de="workspace-impact.v1",le=".rapidkit/reports/workspace-impact-last-run.json";function Z(e){let t=e.trim().toLowerCase();return t==="git"||t.startsWith("git:")}function me(e){let t=e.trim();return t.toLowerCase()==="git"?"HEAD":t.toLowerCase().startsWith("git:")&&t.slice(4).trim()||"HEAD"}function _(e){if(Array.isArray(e))return e.map(t=>_(t));if(e&&typeof e=="object"){let t={};for(let r of Object.keys(e).sort())t[r]=_(e[r]);return t}return e}function k(e){return JSON.stringify(_(e))}function $(e){let{runId:t,...r}=e,n={...r,generatedAt:"<ignored>",graph:e.graph?{...e.graph,generatedAt:"<ignored>"}:void 0,validation:e.validation?{...e.validation,issues:e.validation.issues.map(c=>({...c})).sort((c,o)=>{let i=`${c.severity}:${c.code}:${c.target}:${c.message}`,p=`${o.severity}:${o.code}:${o.target}:${o.message}`;return i.localeCompare(p)})}:void 0};return pe.createHash("sha256").update(k(n)).digest("hex")}function ee(e,t){return u.isAbsolute(t)?t:u.join(e,t)}async function fe(e){let t=await w.readJson(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Workspace model input is not a JSON object: ${e}`);let r=t;if(r.schemaVersion===Q){let n=r;if(!n.model||n.model.schemaVersion!==b$1)throw new Error(`Invalid workspace model snapshot: ${e}`);return {model:n.model,hash:n.modelHash||$(n.model)}}if(r.schemaVersion===b$1){let n=r;return {model:n,hash:$(n)}}throw r.schemaVersion===T?new Error(`workspace diff --from received a diff report (${u.basename(e)}). Use a workspace model snapshot or model report as baseline, e.g. ${E}. To analyze an existing diff report, run: npx rapidkit workspace impact --from ${u.basename(e)} --json`):new Error(`Unsupported workspace model input schema: ${String(r.schemaVersion)}`)}async function ue(e){let t=await w.readJson(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Workspace diff input is not a JSON object: ${e}`);let r=t;if(r.schemaVersion!==T)return null;let n=r;if(!n.currentModel||n.currentModel.schemaVersion!==b$1||!n.summary||!Array.isArray(n.changes))throw new Error(`Invalid workspace model diff report: ${e}`);return n}async function Ve(e$1){let t=e$1.model??await e({workspacePath:e$1.workspacePath,includeAbsolutePaths:e$1.includeAbsolutePaths,includeEvidence:e$1.includeEvidence,observableScanDepth:e$1.observableScanDepth,now:e$1.now});return {schemaVersion:Q,generatedAt:(e$1.now??new Date).toISOString(),modelHash:$(t),modelRef:c,model:t}}async function Ge(e,t){let r=u.join(t,E);return await w.ensureDir(u.dirname(r)),await w.writeJson(r,a(e),{spaces:2}),r}function A(e){return {name:e.name,path:e.path,kind:e.kind,runtime:e.runtime,framework:e.framework,generator:e.generator,supportTier:e.supportTier,commands:e.commands,importantFiles:e.importantFiles}}function h(e,t){e.push(t);}function ge(e,t){let r=[],n=["name","profile","type"],c=["workspaceType","surfaces","runtimeFamilies","businessCapabilities"];for(let o of n){let i=e.workspace[o],p=t.workspace[o];k(i)!==k(p)&&h(r,{type:"workspace.changed",severity:"info",target:`workspace.${o}`,message:`Workspace metadata field changed: ${String(o)}`,before:i,after:p});}for(let o of c){let i=e.identity[o],p=t.identity[o];k(i)!==k(p)&&h(r,{type:"workspace.changed",severity:"info",target:`identity.${o}`,message:`Workspace identity field changed: ${String(o)}`,before:i,after:p});}return k(e.policies)!==k(t.policies)&&h(r,{type:"workspace.changed",severity:"warning",target:"policies",message:"Workspace policy summary changed.",before:e.policies,after:t.policies}),k(e.evidence)!==k(t.evidence)&&h(r,{type:"workspace.changed",severity:"info",target:"evidence",message:"Workspace evidence summary changed.",before:e.evidence,after:t.evidence}),k(e.discovery)!==k(t.discovery)&&h(r,{type:"workspace.changed",severity:"info",target:"discovery",message:"Workspace discovery settings changed.",before:e.discovery,after:t.discovery}),e.contracts.exists!==t.contracts.exists&&h(r,{type:"workspace.changed",severity:t.contracts.exists?"info":"warning",target:t.contracts.workspaceContractPath,message:"Workspace contract presence changed.",before:e.contracts.exists,after:t.contracts.exists}),r}function ke(e,t){let r=e.validation??null,n=t.validation??null;return k(r)===k(n)?[]:[{type:"validation.changed",severity:n?.status==="failed"?"critical":"warning",target:"validation",message:"Workspace model validation changed.",before:r,after:n}]}function he(e,t){let r=[],n=new Map(e.projects.map(o=>[o.path,o])),c=new Map(t.projects.map(o=>[o.path,o]));for(let[o,i]of c.entries()){let p=n.get(o);if(!p){h(r,{type:"project.added",severity:"info",target:o,message:`Project added: ${i.name}`,after:A(i)});continue}let m=A(p),l=A(i);if(k(m)!==k(l)){let f=p.runtime!==i.runtime||p.framework!==i.framework;h(r,{type:"project.changed",severity:f?"warning":"info",target:o,message:`Project changed: ${i.name}`,before:m,after:l});}}for(let[o,i]of n.entries())c.has(o)||h(r,{type:"project.removed",severity:"warning",target:o,message:`Project removed: ${i.name}`,before:A(i)});return r.sort((o,i)=>`${o.type}:${o.target}`.localeCompare(`${i.type}:${i.target}`))}async function we(e$1){let t=u.resolve(e$1.workspacePath),r=Z(e$1.fromPath),n=r?me(e$1.fromPath):void 0,c$1=e$1.fromPath;if(r){let g=u.join(t,E);if(!await w.pathExists(g))throw new Error("Git-aware workspace diff requires an existing snapshot at .rapidkit/reports/workspace-model-snapshot.json. Run: npx rapidkit workspace snapshot --json");c$1=E;}let o=ee(t,c$1),i=await fe(o),p=e$1.model??await e({workspacePath:t,includeAbsolutePaths:e$1.includeAbsolutePaths,includeEvidence:e$1.includeEvidence,observableScanDepth:e$1.observableScanDepth,now:e$1.now}),m=$(p),l=[...ge(i.model,p),...he(i.model,p),...ke(i.model,p)],f;e$1.includeGitObservation!==false&&(f=e$1.gitObservation??z(t,{ref:n}),f.available&&ve(l,f,p));let v=l.filter(g=>g.type.startsWith("git.")).length,I=i.hash!==m,y=r?`git:${n??"HEAD"}`:u.relative(t,o).split(u.sep).join("/");return {schemaVersion:T,generatedAt:(e$1.now??new Date).toISOString(),fromRef:y,toRef:c,fromHash:i.hash,toHash:m,summary:{changed:I||v>0,addedProjects:l.filter(g=>g.type==="project.added").length,removedProjects:l.filter(g=>g.type==="project.removed").length,changedProjects:l.filter(g=>g.type==="project.changed").length,workspaceChanges:l.filter(g=>g.type==="workspace.changed").length,validationChanges:l.filter(g=>g.type==="validation.changed").length,gitChangedFiles:v},git:f?.available?je(f,n):{available:false,dirty:false,changedFiles:0,untrackedFiles:0,deletedFiles:0},changes:l,currentModel:p}}async function Ne(e,t){let r=u.join(t,X);return await w.ensureDir(u.dirname(r)),await w.writeJson(r,a(e),{spaces:2}),r}function M(e){return {none:0,low:1,medium:2,high:3,critical:4}[e]}function q(e){return e.reduce((t,r)=>M(r)>M(t)?r:t,"none")}var H=["none","low","medium","high","critical"];function ye(e){let t=Math.max(1,M(e)-1);return H[t]}function We(e){let t=Math.min(H.length-1,M(e)+1);return H[t]}function J(e){return e.join(" ")}function b(e,t,r,n){return {id:e,label:t,scope:n.scope,project:n.project,display:J(["npx","rapidkit",...r]),execute:J(["npx","--yes","--package","rapidkit","rapidkit",...r]),required:n.required!==false}}function U(e){let t=`project:${e.name}`;return [b(`project.${e.name}.test`,`Run tests for ${e.name}`,["workspace","run","test","--scope",t,"--json"],{scope:"project",project:e.name,required:e.commands.fleetStages.includes("test")}),b(`project.${e.name}.build`,`Run build for ${e.name}`,["workspace","run","build","--scope",t,"--json"],{scope:"project",project:e.name,required:e.commands.fleetStages.includes("build")})]}function D(){return [b("workspace.doctor","Run workspace doctor",["doctor","workspace","--json"],{scope:"workspace"}),b("workspace.contract.verify","Verify workspace contract",["workspace","contract","verify","--json"],{scope:"workspace"}),b("workspace.readiness","Run release readiness",["readiness","--json"],{scope:"workspace"}),b("workspace.analyze","Run workspace analyze",["analyze","--json"],{scope:"workspace",required:false}),b("workspace.pipeline","Run governance pipeline",["pipeline","--json"],{scope:"workspace",required:false})]}function be(e,t){let r=t.split(u.sep).join("/");return e.projects.filter(c=>{let o=c.path.split(u.sep).join("/");return r===o||r.startsWith(`${o}/`)}).sort((c,o)=>o.path.length-c.path.length)[0]}function ve(e,t,r){let n=new Set(e.map(o=>o.target)),c=(o,i)=>{let p=i.split(u.sep).join("/"),m=`git:${p}`;if(n.has(m))return;let l=be(r,p),f=l?`${l.name} (${l.path})`:"workspace";h(e,{type:o,severity:o==="git.deleted"?"warning":"info",target:m,message:`Git ${o==="git.untracked"?"untracked":o==="git.deleted"?"deleted":"changed"} file affects ${f}: ${p}`,after:{path:p,project:l?.name,projectPath:l?.path}}),n.add(m);};for(let o of t.changedFiles)c("git.file.changed",o);for(let o of t.untrackedFiles)c("git.untracked",o);for(let o of t.deletedFiles)c("git.deleted",o);}function je(e,t){return {available:true,ref:t??e.ref,branch:e.branch,commit:e.commit,dirty:e.dirty,changedFiles:e.changedFiles.length,untrackedFiles:e.untrackedFiles.length,deletedFiles:e.deletedFiles.length}}function Me(e){let t=new Set,r=[];for(let n of e){let c=`${n.scope}:${n.project??""}:${n.display}`;t.has(c)||(t.add(c),r.push(n));}return r}function Pe(e){return e.type==="project.removed"?"high":e.severity==="critical"?"critical":e.severity==="warning"?"high":("medium")}function Ie(e,t){return e.severity==="critical"?"critical":e.target==="policies"||e.target.includes("contract")?"high":e.type==="validation.changed"?(t?.projectCount??0)===0?"low":"high":e.target==="evidence"?"low":e.severity==="warning"?"medium":"low"}function Ce(e){return e.affectedProjects>0||e.projectCount>0||!e.changes.every(r=>r.severity==="critical"?false:r.type.startsWith("git.")||r.type==="validation.changed")?e.risk:M(e.risk)>=M("high")||e.risk==="medium"?"low":e.risk}function Y(e,t){if(!e||e==="workspace")return true;let r=(e.startsWith("project:")?e.slice(8):e).trim().toLowerCase();return [t.name,t.path,u.basename(t.path),t.absolutePath].filter(n=>typeof n=="string"&&n.trim().length>0).map(n=>n.trim().toLowerCase()).includes(r)}function Re(e){if(!e.changed)return {headline:"No workspace model impact detected.",bullets:["The current workspace model matches the provided snapshot/report."],unsafeAssumptions:["Do not claim runtime verification passed unless a report exists."]};let t=e.affectedProjects.map(r=>r.project?.name??r.target);return {headline:`Workspace impact risk: ${e.risk}.`,bullets:[`Affected projects: ${t.length?t.join(", "):"none"}.`,`Workspace-level items: ${e.workspaceImpact.length}.`,"Use the verification plan before recommending apply, rollback, or release actions."],unsafeAssumptions:["Do not infer test/build success from impact alone.","Do not apply fixes without project scope and verification evidence.","Use display commands for users and execute commands for automation."]}}async function Be(e){let t=u.resolve(e.workspacePath),r=Z(e.fromPath),n=e.diff;if(!n&&!r){let a=ee(t,e.fromPath);n=await ue(a)??void 0;}n||(n=await we({workspacePath:t,fromPath:e.fromPath,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,includeGitObservation:e.includeGitObservation,gitObservation:e.gitObservation,now:e.now,model:e.model}));let c=new Map(n.currentModel.projects.map(a=>[a.path,a])),o=new Map(n.currentModel.projects.map(a=>[a.name,a])),i=n.changes.filter(a=>a.type.startsWith("project.")),p=new Map;for(let a of i){let d=(c.get(a.target)??(typeof a.before?.name=="string"?o.get(a.before.name):void 0))?.path??a.target,W=p.get(d)??[];W.push(a),p.set(d,W);}let m=[];for(let[a,s]of p.entries()){let d=c.get(a);if(d&&!Y(e.scope,d))continue;let W=q(s.map(Pe)),C=d?.name??(typeof s[0]?.before?.name=="string"?String(s[0].before.name):a);m.push({id:`project:${C}`,scope:"project",target:a,title:`Project impact: ${C}`,summary:s.map(j=>j.message).join(" "),risk:W,reasons:s.map(j=>`${j.type}: ${j.message}`),project:d?{name:d.name,path:d.path,kind:d.kind,runtime:d.runtime,framework:d.framework,supportTier:d.supportTier,...d.generator?{generator:d.generator}:{}}:void 0,verification:d?U(d):D()});}let l=n.currentModel.graph,f=l?a$1(l):void 0,v=new Set(m.map(a=>a.project?.name).filter(a=>typeof a=="string")),I=new Map;for(let a of m)if(a.project?.name){let s=f?.byId.get(a.project.name);s&&(a.centrality={fanIn:s.fanIn,fanOut:s.fanOut,reach:s.reach,betweenness:s.betweenness,isHotspot:s.isHotspot},s.isHotspot&&(a.risk=We(a.risk),a.reasons=[...a.reasons,`graph.hotspot: critical-path project with ${s.reach} transitive dependent(s); risk escalated.`])),a.origin="direct",a.distance=0,I.set(a.project.name,a.risk);}let y=[],g=0;if(l&&v.size>0){let a=c$1(l,v);for(let s of a.values()){if(s.distance===0||v.has(s.id))continue;let d=o.get(s.id);if(d&&!Y(e.scope,d))continue;let W=s.path[0],C=s.path[s.path.length-2]??W,j=I.get(W)??"medium",ae=ye(j);g=Math.max(g,s.distance),y.push({id:`transitive:${s.id}`,scope:"project",target:d?.path??s.id,title:`Transitive impact: ${s.id}`,summary:`Depends on changed project ${W}${s.via?` via ${s.via}`:""} (distance ${s.distance}).`,risk:ae,reasons:[`graph.dependent: depends on ${C}${s.via?` via ${s.via}`:""} (path ${s.path.join(" -> ")})`],project:d?{name:d.name,path:d.path,kind:d.kind,runtime:d.runtime,framework:d.framework,supportTier:d.supportTier,...d.generator?{generator:d.generator}:{}}:void 0,verification:d?U(d):D(),origin:"transitive",distance:s.distance,path:s.path,via:s.via,...f?.byId.get(s.id)?{centrality:{fanIn:f.byId.get(s.id).fanIn,fanOut:f.byId.get(s.id).fanOut,reach:f.byId.get(s.id).reach,betweenness:f.byId.get(s.id).betweenness,isHotspot:f.byId.get(s.id).isHotspot}}:{}});}}y.sort((a,s)=>a.target.localeCompare(s.target));let te=f?f.hotspots.map(a=>{let s=f.byId.get(a);return {project:a,fanIn:s.fanIn,fanOut:s.fanOut,reach:s.reach,betweenness:s.betweenness}}):[],re=n.changes.filter(a=>!a.type.startsWith("project.")),V=n.currentModel.summary?.projectCount??n.currentModel.projects.length,P=re.map(a=>({id:`workspace:${a.target}`,scope:"workspace",target:a.target,title:`Workspace impact: ${a.target}`,summary:a.message,risk:Ie(a,{projectCount:V}),reasons:[`${a.type}: ${a.message}`],verification:D()})),G=Me([...m.flatMap(a=>a.verification),...y.flatMap(a=>a.verification),...P.flatMap(a=>a.verification),...n.summary.changed?D():[]]).filter(a=>a.required),ne=q([...m.map(a=>a.risk),...y.map(a=>a.risk),...P.map(a=>a.risk)]),N=Ce({risk:ne,affectedProjects:m.length,projectCount:V,changes:n.changes}),B={changed:n.summary.changed,risk:N,affectedProjects:m.length,workspaceItems:P.length,recommendedCommands:G.length,blastRadius:{directlyAffected:m.length,transitivelyAffected:y.length,maxDistance:g,graphEdges:l?.edges.length??0}};return {schemaVersion:de,generatedAt:(e.now??new Date).toISOString(),fromRef:n.fromRef,diffRef:X,workspace:{name:n.currentModel.workspace.name,profile:n.currentModel.workspace.profile,type:n.currentModel.workspace.type},summary:B,affectedProjects:m.sort((a,s)=>a.target.localeCompare(s.target)),transitiveImpact:y,criticalPathHotspots:te,workspaceImpact:P.sort((a,s)=>a.target.localeCompare(s.target)),verificationPlan:G,agentBrief:Re({changed:B.changed,risk:N,affectedProjects:m,workspaceImpact:P}),diff:n}}async function Ke(e,t){let r=u.join(t,le);return await w.ensureDir(u.dirname(r)),await w.writeJson(r,a(e),{spaces:2}),r}export{Q as a,T as b,E as c,X as d,de as e,le as f,Z as g,me as h,Ve as i,Ge as j,we as k,Ne as l,D as m,Be as n,Ke as o};