workspai 0.44.0 → 0.45.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 (59) hide show
  1. package/README.md +5 -1
  2. package/contracts/cli-runtime-command-inventory.v1.snapshot.json +1368 -0
  3. package/contracts/command-capabilities.v1.json +166 -1
  4. package/contracts/extension-cli-compatibility.v1.json +2 -1
  5. package/contracts/published-contract-catalog.v1.json +5 -0
  6. package/contracts/runtime-command-surface.v1.json +1441 -1
  7. package/dist/analyze-YLV7NVLF.js +1 -0
  8. package/dist/{artifact-remediation-plan-Z7OCSME3.js → artifact-remediation-plan-WLZGROUU.js} +1 -1
  9. package/dist/autopilot-release-YBN3SWAA.js +1 -0
  10. package/dist/{chunk-UNF72FTB.js → chunk-42G2OK64.js} +1 -1
  11. package/dist/{chunk-CL6TGI4Q.js → chunk-5GNT4RJI.js} +1 -1
  12. package/dist/chunk-6AA3WWQZ.js +2 -0
  13. package/dist/{chunk-P4SWTY5X.js → chunk-6ZENXBMG.js} +1 -1
  14. package/dist/{chunk-LGP6WXS2.js → chunk-BJLE5CH7.js} +1 -1
  15. package/dist/{chunk-OW4UNG27.js → chunk-DXPU4DDV.js} +1 -1
  16. package/dist/{chunk-7EIMPQR3.js → chunk-G3H5R3RR.js} +1 -1
  17. package/dist/{chunk-JICOD2GI.js → chunk-HYJK7W3B.js} +1 -1
  18. package/dist/{chunk-TRMDODFM.js → chunk-IMUU5Q2V.js} +1 -1
  19. package/dist/{chunk-M4VITK6X.js → chunk-K63BSU56.js} +2 -2
  20. package/dist/{chunk-YUX4YFGL.js → chunk-KPPGZCUW.js} +1 -1
  21. package/dist/{chunk-B66A4TVP.js → chunk-KU4S7RCM.js} +1 -1
  22. package/dist/{chunk-V5JN4TDX.js → chunk-LCRROMRR.js} +1 -1
  23. package/dist/{chunk-JHC6SCJC.js → chunk-NHN4QXPP.js} +1 -1
  24. package/dist/{chunk-7IHLTPZ6.js → chunk-OOOPYUL2.js} +1 -1
  25. package/dist/{chunk-L3E6IRUQ.js → chunk-P7SCWJFG.js} +1 -1
  26. package/dist/{chunk-2QN6BMM7.js → chunk-QWU2CZBG.js} +1 -1
  27. package/dist/{chunk-L2Q7B2OJ.js → chunk-V2H2KRMZ.js} +1 -1
  28. package/dist/{chunk-NTXO7BMH.js → chunk-WANW4QA4.js} +1 -1
  29. package/dist/{chunk-VA5MRHKM.js → chunk-ZWO6K24C.js} +1 -1
  30. package/dist/{create-DFAWAS5C.js → create-KFR6FLRT.js} +1 -1
  31. package/dist/{doctor-PVSWDBJL.js → doctor-YJDM5XBH.js} +1 -1
  32. package/dist/index.d.ts +37 -4
  33. package/dist/index.js +180 -169
  34. package/dist/pipeline-FEDYO3IA.js +5 -0
  35. package/dist/{workspace-FQT3QIRS.js → workspace-PLXOO6ST.js} +1 -1
  36. package/dist/{workspace-agent-sync-ZYCPXTU3.js → workspace-agent-sync-G5YVI3BJ.js} +1 -1
  37. package/dist/{workspace-context-WAGGJCDL.js → workspace-context-E3UFWL5X.js} +1 -1
  38. package/dist/{workspace-contract-SEI4SNSG.js → workspace-contract-LQJDZV36.js} +1 -1
  39. package/dist/workspace-explain-G74ZIF23.js +1 -0
  40. package/dist/{workspace-feedback-RCB25NFO.js → workspace-feedback-YY6WQPWQ.js} +1 -1
  41. package/dist/{workspace-foundation-KXDL6P6X.js → workspace-foundation-3C2DLCVI.js} +1 -1
  42. package/dist/{workspace-history-M4QQBIPB.js → workspace-history-VF3CHDYQ.js} +1 -1
  43. package/dist/{workspace-intelligence-QOGD2TZS.js → workspace-intelligence-3GG7GEDQ.js} +1 -1
  44. package/dist/{workspace-mcp-serve-CEFKEMYG.js → workspace-mcp-serve-MJMUV4RY.js} +1 -1
  45. package/dist/{workspace-model-GMSRBICO.js → workspace-model-NG45SRM5.js} +1 -1
  46. package/dist/{workspace-registry-summary-S52SEJAG.js → workspace-registry-summary-JM2XY52C.js} +1 -1
  47. package/dist/workspace-run-WEQYIERE.js +1 -0
  48. package/dist/{workspace-verify-NP4GMFSV.js → workspace-verify-ZNT6JX7D.js} +1 -1
  49. package/dist/{workspace-watch-IIBH3Y25.js → workspace-watch-W47T4RX2.js} +1 -1
  50. package/docs/commands-reference.md +14 -1
  51. package/docs/contracts/COMMAND_OWNERSHIP_MATRIX.md +27 -6
  52. package/package.json +2 -1
  53. package/scripts/prepack-enterprise.mjs +4 -0
  54. package/dist/analyze-6OCBM4ID.js +0 -1
  55. package/dist/autopilot-release-LI2WJCEW.js +0 -1
  56. package/dist/chunk-FWJV7CCI.js +0 -2
  57. package/dist/pipeline-ND734AJM.js +0 -5
  58. package/dist/workspace-explain-MVGGRCDN.js +0 -1
  59. package/dist/workspace-run-VC4OUPRF.js +0 -1
@@ -0,0 +1,5 @@
1
+ import {a as a$2}from'./chunk-P7SCWJFG.js';import {c as c$1}from'./chunk-5GNT4RJI.js';import {e}from'./chunk-KPPGZCUW.js';import {b}from'./chunk-K63BSU56.js';import {d,c as c$2}from'./chunk-BJLE5CH7.js';import {f as f$1,e as e$1}from'./chunk-T3GJ7YVG.js';import {a}from'./chunk-22DT744Z.js';import {f,c,g}from'./chunk-6AA3WWQZ.js';import {a as a$1}from'./chunk-5AKYMAIL.js';import c$3 from'chalk';import p from'path';function G(a){return a===0?"pass":a===2?"warn":"fail"}function I(a){return a.some(r=>r.status==="fail")?"blocked":a.some(r=>r.status==="warn")?"needs-attention":"ready"}function j(a,r){if(r)return 3;let i=a.some(o=>o.status==="fail"),t=a.some(o=>o.status==="warn");return i?1:t?2:0}function N(a,r){return a===2&&!r?0:a}async function O(a){let r=await b(a,true),i=false;try{let{syncWorkspaceContract:t}=await import('./workspace-contract-LQJDZV36.js');await t({workspacePath:a}),i=true;}catch{i=false;}return {sync:r,contractSynced:i}}async function V(a$3={}){let r=p.resolve(a$3.workspacePath??process.cwd()),i=a(r);if(!i)throw new Error("No Workspai workspace found in current directory or parents");let t=[],o=[],l=false,d$1,f$2,m,y=Date.now();try{let{sync:e,contractSynced:s}=await O(i),n=e.workspaceFound&&(e.added.length>0||e.skipped>=0)||e.workspaceFound?"pass":"warn";t.push({name:"sync",status:n,durationMs:Date.now()-y,summary:e.workspaceFound?`registry sync complete (${e.added.length} added, ${e.skipped} existing)${s?", contract synced":""}`:"workspace not registered in global registry; contract sync attempted"}),e.workspaceFound||o.push("workspace registry entry missing \u2014 run workspai create workspace or register manually");}catch(e){l=true,t.push({name:"sync",status:"fail",durationMs:Date.now()-y,summary:`sync failed: ${e instanceof Error?e.message:String(e)}`}),o.push("workspace sync stage failed");}let w=Date.now();try{let e$1=await e({workspace:true,json:true,quiet:true,strict:a$3.strict===true,ci:a$3.strict!==true}),s=G(e$1),n=await f(i,a$1.doctor)??c(i,a$1.doctor);t.push({name:"doctor",status:s,durationMs:Date.now()-w,summary:s==="pass"?"doctor workspace passed":s==="warn"?"doctor workspace reported warnings":"doctor workspace did not pass",exitCode:e$1,evidencePath:n}),s==="fail"?o.push("doctor workspace gate failed"):s==="warn"&&o.push("doctor workspace reported warnings");}catch(e){l=true,t.push({name:"doctor",status:"fail",durationMs:Date.now()-w,summary:`doctor failed: ${e instanceof Error?e.message:String(e)}`}),o.push("doctor workspace stage failed");}if(a$3.skipAnalyze)t.push({name:"analyze",status:"skipped",durationMs:0,summary:"analyze stage skipped"});else {let e=Date.now();try{let s=await a$2({workspacePath:i,json:true,strict:a$3.strict===true});d$1=p.isAbsolute(s.enterpriseControls.evidencePath)?s.enterpriseControls.evidencePath:p.join(i,s.enterpriseControls.evidencePath);let n=s.summary.verdict==="blocked"?"fail":s.summary.verdict==="needs-attention"?"warn":"pass";t.push({name:"analyze",status:n,durationMs:Date.now()-e,summary:`analyze verdict: ${s.summary.verdict} (score ${s.summary.score}/100)`,evidencePath:d$1}),n==="fail"?o.push("analyze reported blocked verdict"):n==="warn"&&o.push("analyze reported needs-attention verdict");}catch(s){l=true,t.push({name:"analyze",status:"fail",durationMs:Date.now()-e,summary:`analyze failed: ${s instanceof Error?s.message:String(s)}`}),o.push("analyze stage failed");}}let h=Date.now();try{let e=await d({startPath:i,writeReport:true,skipVerify:a$3.skipVerify===true});f$2=e.evidencePath;let s=e.overallStatus==="pass"?"pass":e.overallStatus==="warn"?"warn":"fail";t.push({name:"readiness",status:s,durationMs:Date.now()-h,summary:`readiness overall: ${e.overallStatus}`,evidencePath:e.evidencePath}),s==="fail"?o.push(...e.blockingReasons.map(n=>`readiness: ${n}`)):s==="warn"&&o.push(...e.gates.filter(n=>n.status==="warn").map(n=>`readiness warn: ${n.gate}: ${n.summary}`));}catch(e){l=true,t.push({name:"readiness",status:"fail",durationMs:Date.now()-h,summary:`readiness failed: ${e instanceof Error?e.message:String(e)}`}),o.push("readiness stage failed");}if(a$3.skipAutopilot)t.push({name:"autopilot",status:"skipped",durationMs:0,summary:"autopilot stage skipped"});else {let e=Date.now(),s=a$3.autopilotMode??"audit";try{let n=await c$1({workspacePath:i,mode:s,json:true,skipPipelineStages:true});m=n.artifacts.reportPath;let P=n.summary.verdict==="approved"?"pass":n.summary.verdict==="partial"?"warn":"fail";t.push({name:"autopilot",status:P,durationMs:Date.now()-e,summary:`autopilot ${s}: ${n.summary.verdict}`,exitCode:n.summary.exitCode,evidencePath:m}),P!=="pass"&&o.push(...n.blockingReasons.slice(0,5));}catch(n){l=true,t.push({name:"autopilot",status:"fail",durationMs:Date.now()-e,summary:`autopilot failed: ${n instanceof Error?n.message:String(n)}`}),o.push("autopilot release stage failed");}}let M=I(t),k=j(t,l),F=p.join(i,".workspai","reports","pipeline-last-run.json"),u={schemaVersion:"rapidkit-pipeline-v1",generatedAt:new Date().toISOString(),workspacePath:i,summary:{verdict:M,exitCode:k,stagesPassed:t.filter(e=>e.status==="pass").length,stagesWarn:t.filter(e=>e.status==="warn").length,stagesFailed:t.filter(e=>e.status==="fail").length},stages:t,blockingReasons:[...new Set(o)],artifacts:{reportPath:F,analyzeEvidencePath:d$1,readinessEvidencePath:f$2,autopilotEvidencePath:m}};if(a$3.writeReport!==false){let e=f$1(u,{commandId:"workspacePipeline",exitCode:k,generatedAt:u.generatedAt,blockers:u.blockingReasons,runId:e$1()});await g(i,".workspai/reports/pipeline-last-run.json",e);}if(a$3.writeReport!==false&&a$3.noAgentSync!==true&&process.env.RAPIDKIT_NO_AGENT_SYNC!=="1"&&a$3.agentSync!==false)try{let{syncWorkspaceAgentGrounding:e}=await import('./workspace-agent-sync-G5YVI3BJ.js'),s=await e({workspacePath:i,write:true,refreshContext:true,strict:false});u.agentGrounding={indexPath:s.indexPath,writtenFiles:s.writtenFiles,blockers:s.blockers};}catch{}return u}async function ae(a){let r;try{r=await V(a);}catch(t){let o=t instanceof Error?t.message:String(t);a.json?console.log(JSON.stringify(c$2({operation:"pipeline",code:"pipeline.failed",message:o}),null,2)):console.log(c$3.red(`Pipeline failed: ${o}`)),process.exit(1);}if(a.json)console.log(JSON.stringify(r,null,2));else {console.log(c$3.bold.cyan(`
2
+ \u{1F517} Workspai Governance Pipeline
3
+ `)),console.log(c$3.bold(`Workspace: ${c$3.cyan(p.basename(r.workspacePath))}`)),console.log(c$3.gray(`Path: ${r.workspacePath}`)),console.log(c$3.white(`Verdict: ${r.summary.verdict} Exit: ${r.summary.exitCode} (${r.summary.stagesPassed} pass / ${r.summary.stagesWarn} warn / ${r.summary.stagesFailed} fail)`));for(let t of r.stages){let o=t.status==="pass"?c$3.green("PASS"):t.status==="warn"?c$3.yellow("WARN"):t.status==="skipped"?c$3.gray("SKIP"):c$3.red("FAIL");console.log(` - ${t.name}: ${o} ${t.summary}`);}if(r.blockingReasons.length>0){console.log(c$3.bold(`
4
+ Blocking reasons:`));for(let t of r.blockingReasons.slice(0,8))console.log(c$3.gray(` \u2022 ${t}`));}console.log(c$3.gray(`
5
+ Evidence: ${r.artifacts.reportPath}`)),r.agentGrounding?.writtenFiles.length&&console.log(c$3.gray(`Agent grounding: ${r.agentGrounding.writtenFiles.length} file(s) synced (INDEX + AGENTS.md + Copilot/Cursor/Claude hooks)`));}let i=N(r.summary.exitCode,a.strict===true);i!==0&&process.exit(i);}export{N as pipelineProcessExitCode,V as runPipeline,ae as runPipelineCommand};
@@ -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-M4VITK6X.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-K63BSU56.js';
@@ -1 +1 @@
1
- export{f as AGENT_CUSTOMIZATION_PACK_REPORT_PATH,d as AGENT_CUSTOMIZATION_PACK_SCHEMA,e as AGENT_REPORTS_INDEX_PATH,c as AGENT_REPORTS_INDEX_SCHEMA,g as AGENT_REPORT_CATALOG,h as buildCanonicalAgentReportReadOrder,i as buildWorkspaceAgentReportsIndex,j as parseAgentGroundingTargets,k as syncWorkspaceAgentGrounding}from'./chunk-P4SWTY5X.js';export{f as AGENT_GROUNDING_DOC_PATH,g as LEGACY_AGENT_GROUNDING_DOC_PATH,A as LEGACY_COPILOT_GROUNDING_SKILL_PATH,m as LEGACY_COPILOT_WORKSPACE_INSTRUCTIONS_PATH,C as LEGACY_COPILOT_WORKSPACE_INTELLIGENCE_SKILL_PATH,i as LEGACY_CURSOR_GROUNDING_RULE_PATH,E as LEGACY_MCP_DESIGN_REPORT_PATH,G as LEGACY_VSCODE_AGENT_HOOKS_PATH,z as WORKSPAI_COPILOT_GROUNDING_SKILL_PATH,l as WORKSPAI_COPILOT_WORKSPACE_INSTRUCTIONS_PATH,B as WORKSPAI_COPILOT_WORKSPACE_INTELLIGENCE_SKILL_PATH,h as WORKSPAI_CURSOR_GROUNDING_RULE_PATH,D as WORKSPAI_MCP_DESIGN_REPORT_PATH,F as WORKSPAI_VSCODE_AGENT_HOOKS_PATH}from'./chunk-XIVFLY6G.js';
1
+ export{f as AGENT_CUSTOMIZATION_PACK_REPORT_PATH,d as AGENT_CUSTOMIZATION_PACK_SCHEMA,e as AGENT_REPORTS_INDEX_PATH,c as AGENT_REPORTS_INDEX_SCHEMA,g as AGENT_REPORT_CATALOG,h as buildCanonicalAgentReportReadOrder,i as buildWorkspaceAgentReportsIndex,j as parseAgentGroundingTargets,k as syncWorkspaceAgentGrounding}from'./chunk-6ZENXBMG.js';export{f as AGENT_GROUNDING_DOC_PATH,g as LEGACY_AGENT_GROUNDING_DOC_PATH,A as LEGACY_COPILOT_GROUNDING_SKILL_PATH,m as LEGACY_COPILOT_WORKSPACE_INSTRUCTIONS_PATH,C as LEGACY_COPILOT_WORKSPACE_INTELLIGENCE_SKILL_PATH,i as LEGACY_CURSOR_GROUNDING_RULE_PATH,E as LEGACY_MCP_DESIGN_REPORT_PATH,G as LEGACY_VSCODE_AGENT_HOOKS_PATH,z as WORKSPAI_COPILOT_GROUNDING_SKILL_PATH,l as WORKSPAI_COPILOT_WORKSPACE_INSTRUCTIONS_PATH,B as WORKSPAI_COPILOT_WORKSPACE_INTELLIGENCE_SKILL_PATH,h as WORKSPAI_CURSOR_GROUNDING_RULE_PATH,D as WORKSPAI_MCP_DESIGN_REPORT_PATH,F as WORKSPAI_VSCODE_AGENT_HOOKS_PATH}from'./chunk-XIVFLY6G.js';
@@ -1 +1 @@
1
- export{d as WORKSPACE_CONTEXT_AGENT_REPORT_PATH,c as WORKSPACE_CONTEXT_SCHEMA_VERSION,e as buildWorkspaceAgentContext,f as writeWorkspaceAgentContext}from'./chunk-V5JN4TDX.js';
1
+ export{d as WORKSPACE_CONTEXT_AGENT_REPORT_PATH,c as WORKSPACE_CONTEXT_SCHEMA_VERSION,e as buildWorkspaceAgentContext,f as writeWorkspaceAgentContext}from'./chunk-LCRROMRR.js';
@@ -1 +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-2QN6BMM7.js';
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-QWU2CZBG.js';
@@ -0,0 +1 @@
1
+ export{b as buildWorkspaceExplain,a as resolveWorkspaceExplainArtifactPath,c as writeWorkspaceExplainReport}from'./chunk-IMUU5Q2V.js';export{e as WORKSPACE_MODEL_DIFF_REPORT_PATH}from'./chunk-ZWO6K24C.js';export{c as WORKSPACE_EXPLAIN_REPORT_PATH,e as WORKSPACE_TRACE_REPORT_PATH,d as WORKSPACE_WHY_REPORT_PATH}from'./chunk-XIVFLY6G.js';
@@ -1 +1 @@
1
- import {b}from'./chunk-ICGWHIMK.js';import {b as b$1,f,j}from'./chunk-L2Q7B2OJ.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 j(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
+ import {b}from'./chunk-ICGWHIMK.js';import {b as b$1,f,j}from'./chunk-V2H2KRMZ.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 j(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-OW4UNG27.js';import {a}from'./chunk-GSWPGELT.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-S52SEJAG.js');return await y(t),{workspacePath:t,created:s,status:s.length>0?"passed":"skipped"}}export{W as ensureWorkspaceFoundation};
1
+ import {b}from'./chunk-DXPU4DDV.js';import {a}from'./chunk-GSWPGELT.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-JM2XY52C.js');return await y(t),{workspacePath:t,created:s,status:s.length>0?"passed":"skipped"}}export{W as ensureWorkspaceFoundation};
@@ -1 +1 @@
1
- export{c as DEFAULT_HISTORY_RETENTION,b as WORKSPACE_HISTORY_PATH,a as WORKSPACE_HISTORY_SCHEMA_VERSION,i as appendHistoryEntry,f as historyEntryFromAgentAction,g as historyEntryFromDoctorFixResult,e as historyEntryFromVerify,d as normalizeHistoryEntry,h as readWorkspaceHistory,j as recordWorkspaceHistory}from'./chunk-L2Q7B2OJ.js';
1
+ export{c as DEFAULT_HISTORY_RETENTION,b as WORKSPACE_HISTORY_PATH,a as WORKSPACE_HISTORY_SCHEMA_VERSION,i as appendHistoryEntry,f as historyEntryFromAgentAction,g as historyEntryFromDoctorFixResult,e as historyEntryFromVerify,d as normalizeHistoryEntry,h as readWorkspaceHistory,j as recordWorkspaceHistory}from'./chunk-V2H2KRMZ.js';
@@ -1 +1 @@
1
- export{g as WORKSPACE_IMPACT_REPORT_PATH,f as WORKSPACE_IMPACT_SCHEMA_VERSION,e as WORKSPACE_MODEL_DIFF_REPORT_PATH,c as WORKSPACE_MODEL_DIFF_SCHEMA_VERSION,d as WORKSPACE_MODEL_SNAPSHOT_REPORT_PATH,b as WORKSPACE_MODEL_SNAPSHOT_SCHEMA_VERSION,p as buildWorkspaceImpact,k as buildWorkspaceModelSnapshot,m as diffWorkspaceModel,j as hashWorkspaceModel,h as isGitDiffSource,i as parseGitDiffRef,o as workspaceVerificationPlan,q as writeWorkspaceImpact,n as writeWorkspaceModelDiff,l as writeWorkspaceModelSnapshot}from'./chunk-VA5MRHKM.js';
1
+ export{g as WORKSPACE_IMPACT_REPORT_PATH,f as WORKSPACE_IMPACT_SCHEMA_VERSION,e as WORKSPACE_MODEL_DIFF_REPORT_PATH,c as WORKSPACE_MODEL_DIFF_SCHEMA_VERSION,d as WORKSPACE_MODEL_SNAPSHOT_REPORT_PATH,b as WORKSPACE_MODEL_SNAPSHOT_SCHEMA_VERSION,p as buildWorkspaceImpact,k as buildWorkspaceModelSnapshot,m as diffWorkspaceModel,j as hashWorkspaceModel,h as isGitDiffSource,i as parseGitDiffRef,o as workspaceVerificationPlan,q as writeWorkspaceImpact,n as writeWorkspaceModelDiff,l as writeWorkspaceModelSnapshot}from'./chunk-ZWO6K24C.js';
@@ -1,3 +1,3 @@
1
- import {b}from'./chunk-TRMDODFM.js';import {d}from'./chunk-V5JN4TDX.js';import {d as d$1}from'./chunk-UNF72FTB.js';import {c as c$1,e}from'./chunk-J4AICQFB.js';import {c as c$2,b as b$2}from'./chunk-XIVFLY6G.js';import {k}from'./chunk-JICOD2GI.js';import {c as c$3}from'./chunk-2QN6BMM7.js';import {f}from'./chunk-FWJV7CCI.js';import {a as a$1}from'./chunk-LG6RFLPZ.js';import {a,c}from'./chunk-5AKYMAIL.js';import {r}from'./chunk-5XATWNME.js';import m from'path';import v from'readline';import b$1 from'fs-extra';var W=a.agentIndex,I=new Map(Object.keys(a).flatMap(e=>{let t=c[e];return t?[[a[e],t]]:[]}));function N(e,t){return e.kind!==t.kind?false:e.kind==="project"&&t.kind==="project"?e.project.toLowerCase()===t.project.toLowerCase():e.kind==="blocker"&&t.kind==="blocker"?e.blockerId===t.blockerId:e.kind==="trace"&&t.kind==="trace"?e.diffRef===t.diffRef:true}var L=[{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 M(e){let t=e.trim().replace(/\\/g,"/");return t.length>0&&!m.isAbsolute(t)&&!t.split("/").includes("..")&&(t.startsWith(".workspai/")||t.startsWith(".rapidkit/"))}async function l(e,t){if(!M(t))throw new Error(`Unsafe artifact path: ${t}`);let i=await f(e,t)??m.join(e,t);if(!await b$1.pathExists(i))return null;let r$1=await b$1.readJson(i),s=r(t),a=I.get(s);return a&&a$1(r$1,a,`MCP artifact ${s}`),r$1}async function J(e$1){let t=[],i=new Set,s=((await l(e$1,d$1))?.blockingReasons??[]).filter(n=>typeof n=="string"&&n.trim().length>0);if(s.length>0){t.push({artifact:d$1,reasons:s});for(let n of s)i.add(n);}let a=await l(e$1,c$2);if(e(a)){let n=(a.blockingReasons??[]).filter(o=>typeof o=="string"&&o.trim().length>0);if(n.length>0){t.push({artifact:c$2,reasons:n});for(let o of n)i.add(o);}}let c=await l(e$1,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"];t.push({artifact:c$3,reasons:n});for(let o of n)i.add(o);}return {blockingReasons:[...i],sources:t}}async function O(e$1,t,i){switch(t){case "getWorkspaceModel":return l(e$1,k);case "getEvidenceIndex":return l(e$1,W);case "getBlockers":return J(e$1);case "getSafeCommands":return {safeCommands:(await l(e$1,d))?.safeCommands??[]};case "getProjectContext":{let r=await l(e$1,d);if(!r)return null;let s=String(i.project??"").trim(),a=r.scope?.activeProject??void 0,c=s||a,p=Array.isArray(r.projects)?r.projects:[],n=c&&p.find(o=>typeof o.name=="string"&&o.name.toLowerCase()===c.toLowerCase());return {workspace:r.workspace??null,scope:r.scope??null,validation:r.validation??null,project:n??null,safeCommands:r.safeCommands??[]}}case "getArtifact":{let r=String(i.relativePath??"").trim();return l(e$1,r)}case "listOperationalSkills":return l(e$1,b$2);case "getWorkspaceExplain":{let r=String(i.target??"release-blocked").trim(),s=c$1(r);if(!s)throw new Error(`Invalid explain target: ${r}`);let a=await l(e$1,c$2);return e(a)&&N(a.target,s)?a:b({workspacePath:e$1,target:s})}default:throw new Error(`Unknown tool: ${t}`)}}function E(e,t){process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:e??null,result:t})}
1
+ import {b}from'./chunk-IMUU5Q2V.js';import {d}from'./chunk-LCRROMRR.js';import {d as d$1}from'./chunk-42G2OK64.js';import {c as c$1,e}from'./chunk-J4AICQFB.js';import {c as c$2,b as b$2}from'./chunk-XIVFLY6G.js';import {k}from'./chunk-HYJK7W3B.js';import {c as c$3}from'./chunk-QWU2CZBG.js';import {f}from'./chunk-6AA3WWQZ.js';import {a as a$1}from'./chunk-LG6RFLPZ.js';import {a,c}from'./chunk-5AKYMAIL.js';import {r}from'./chunk-5XATWNME.js';import m from'path';import v from'readline';import b$1 from'fs-extra';var W=a.agentIndex,I=new Map(Object.keys(a).flatMap(e=>{let t=c[e];return t?[[a[e],t]]:[]}));function N(e,t){return e.kind!==t.kind?false:e.kind==="project"&&t.kind==="project"?e.project.toLowerCase()===t.project.toLowerCase():e.kind==="blocker"&&t.kind==="blocker"?e.blockerId===t.blockerId:e.kind==="trace"&&t.kind==="trace"?e.diffRef===t.diffRef:true}var L=[{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 M(e){let t=e.trim().replace(/\\/g,"/");return t.length>0&&!m.isAbsolute(t)&&!t.split("/").includes("..")&&(t.startsWith(".workspai/")||t.startsWith(".rapidkit/"))}async function l(e,t){if(!M(t))throw new Error(`Unsafe artifact path: ${t}`);let i=await f(e,t)??m.join(e,t);if(!await b$1.pathExists(i))return null;let r$1=await b$1.readJson(i),s=r(t),a=I.get(s);return a&&a$1(r$1,a,`MCP artifact ${s}`),r$1}async function J(e$1){let t=[],i=new Set,s=((await l(e$1,d$1))?.blockingReasons??[]).filter(n=>typeof n=="string"&&n.trim().length>0);if(s.length>0){t.push({artifact:d$1,reasons:s});for(let n of s)i.add(n);}let a=await l(e$1,c$2);if(e(a)){let n=(a.blockingReasons??[]).filter(o=>typeof o=="string"&&o.trim().length>0);if(n.length>0){t.push({artifact:c$2,reasons:n});for(let o of n)i.add(o);}}let c=await l(e$1,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"];t.push({artifact:c$3,reasons:n});for(let o of n)i.add(o);}return {blockingReasons:[...i],sources:t}}async function O(e$1,t,i){switch(t){case "getWorkspaceModel":return l(e$1,k);case "getEvidenceIndex":return l(e$1,W);case "getBlockers":return J(e$1);case "getSafeCommands":return {safeCommands:(await l(e$1,d))?.safeCommands??[]};case "getProjectContext":{let r=await l(e$1,d);if(!r)return null;let s=String(i.project??"").trim(),a=r.scope?.activeProject??void 0,c=s||a,p=Array.isArray(r.projects)?r.projects:[],n=c&&p.find(o=>typeof o.name=="string"&&o.name.toLowerCase()===c.toLowerCase());return {workspace:r.workspace??null,scope:r.scope??null,validation:r.validation??null,project:n??null,safeCommands:r.safeCommands??[]}}case "getArtifact":{let r=String(i.relativePath??"").trim();return l(e$1,r)}case "listOperationalSkills":return l(e$1,b$2);case "getWorkspaceExplain":{let r=String(i.target??"release-blocked").trim(),s=c$1(r);if(!s)throw new Error(`Invalid explain target: ${r}`);let a=await l(e$1,c$2);return e(a)&&N(a.target,s)?a:b({workspacePath:e$1,target:s})}default:throw new Error(`Unknown tool: ${t}`)}}function E(e,t){process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:e??null,result:t})}
2
2
  `);}function w(e,t){process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:e??null,error:{code:-32e3,message:t}})}
3
3
  `);}async function et(e){let t=m.resolve(e.workspacePath),i=v.createInterface({input:process.stdin,terminal:false});for await(let r of i){let s=r.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"){E(c,{protocolVersion:"2024-11-05",capabilities:{tools:{}},serverInfo:{name:"workspai-workspace-mcp",version:"0.1.0"}});continue}if(p==="notifications/initialized")continue;if(p==="tools/list"){E(c,{tools:L.map(o=>({name:o.name,description:o.description,inputSchema:o.inputSchema}))});continue}if(p==="tools/call"){let o=String(n?.name??""),h=n?.arguments&&typeof n.arguments=="object"?n.arguments:{},A=await O(t,o,h);E(c,{content:[{type:"text",text:JSON.stringify(A,null,2)}],isError:A==null});continue}w(c,`Unsupported method: ${p??"unknown"}`);}catch(o){w(c,o instanceof Error?o.message:String(o));}}}async function nt(e,t,i={}){return O(m.resolve(e),t,i)}export{L as WORKSPACE_MCP_READ_TOOLS,nt as invokeMcpToolForTest,et as runWorkspaceMcpServe};
@@ -1 +1 @@
1
- export{k as WORKSPACE_MODEL_REPORT_PATH,j as WORKSPACE_MODEL_SCHEMA_VERSION,n as buildWorkspaceModel,o as buildWorkspaceModelCached,m as buildWorkspaceModelFacts,p as buildWorkspaceModelIncremental,l as validateWorkspaceModelStrict,q as writeWorkspaceModel}from'./chunk-JICOD2GI.js';
1
+ export{k as WORKSPACE_MODEL_REPORT_PATH,j as WORKSPACE_MODEL_SCHEMA_VERSION,n as buildWorkspaceModel,o as buildWorkspaceModelCached,m as buildWorkspaceModelFacts,p as buildWorkspaceModelIncremental,l as validateWorkspaceModelStrict,q as writeWorkspaceModel}from'./chunk-HYJK7W3B.js';
@@ -1 +1 @@
1
- import {a}from'./chunk-A5FBGRJA.js';import {b as b$1,j}from'./chunk-2QN6BMM7.js';import {f,g}from'./chunk-FWJV7CCI.js';import {r,p}from'./chunk-2K3GYCPS.js';import {o}from'./chunk-5XATWNME.js';import n from'path';import {existsSync}from'fs';import y from'fs-extra';var k=".workspai/workspace-registry.v1.json",w="workspace-registry.v1";function C(t){return {slug:t.slug,relativePath:t.relativePath,framework:t.framework,kit:t.kit,source:t.source}}async function x(t){let r=o(t,"workspace.json").find(e=>existsSync(e));if(!r)return {exists:false,legacyProjectCount:0};try{let e=await y.readJson(r),s=Array.isArray(e.projects)?e.projects.length:0,o=typeof e.workspace_name=="string"&&e.workspace_name.trim()||typeof e.name=="string"&&e.name.trim()||n.basename(t);return {exists:true,manifestPath:r,workspaceName:o,profile:typeof e.profile=="string"?e.profile:void 0,legacyProjectCount:s}}catch{return {exists:true,manifestPath:r,legacyProjectCount:0,workspaceName:n.basename(t)}}}async function A(t){let r$1=a(t);for(let e of r())if(await y.pathExists(e))try{let o=((await y.readJson(e)).workspaces||[]).find(a$1=>a(a$1.path)===r$1);if(o)return {exists:true,projectCount:Array.isArray(o.projects)?o.projects.length:0,registryPath:e}}catch{continue}return {exists:false,projectCount:0,registryPath:n.join(p(),"workspaces.json")}}async function b(t){let r=n.resolve(t),e=await f(r,b$1),s=await x(r),o=await A(r),a=!!e,c=[];if(a)try{let{contract:S}=await j({workspacePath:r});c=S.projects||[];}catch{c=[];}let W={contract:{exists:a,projectCount:c.length,path:b$1},globalRegistry:{exists:o.exists,projectCount:o.projectCount,path:o.registryPath},legacyWorkspaceJson:{exists:s.exists,projectCount:s.legacyProjectCount,path:s.manifestPath?n.relative(r,s.manifestPath):void 0}},i="none",u=[],p=0;return a?(i="workspace.contract.json",u=c.map(C),p=u.length):o.projectCount>0?(i="global-registry",p=o.projectCount):s.legacyProjectCount>0&&(i="legacy-workspace.json",p=s.legacyProjectCount),{contractExists:a,summary:{schemaVersion:w,kind:"rapidkit.workspace.registry",workspacePath:r,workspaceName:s.workspaceName||n.basename(r),profile:s.profile,projectCount:p,authority:i,contractPath:b$1,projects:u,sources:W}}}async function J(t){let r=await f(t,k);if(!r)return null;try{let e=await y.readJson(r);return e?.schemaVersion!==w?null:e}catch{return null}}async function V(t,r){let s={...(await b(t)).summary,generatedAt:(r?.now??new Date).toISOString(),registrySummaryPath:k};return await g(t,k,s),s}function Y(t,r=""){return t.projectCount>0?t.authority==="workspace.contract.json"?`${t.projectCount} project(s) registered in workspace contract${r}.`:t.authority==="global-registry"?`${t.projectCount} project(s) registered in global workspace registry${r}.`:`${t.projectCount} project(s) registered in legacy workspace manifest${r}.`:`Workspace state exists, but no projects are registered yet${r}.`}export{k as WORKSPACE_REGISTRY_SUMMARY_RELATIVE_PATH,w as WORKSPACE_REGISTRY_SUMMARY_SCHEMA_VERSION,Y as formatWorkspaceRegistrySyncSummary,V as publishWorkspaceRegistrySummary,J as readWorkspaceRegistrySummary,b as resolveWorkspaceRegisteredProjects};
1
+ import {a}from'./chunk-A5FBGRJA.js';import {b as b$1,j}from'./chunk-QWU2CZBG.js';import {f,g}from'./chunk-6AA3WWQZ.js';import {r,p}from'./chunk-2K3GYCPS.js';import {o}from'./chunk-5XATWNME.js';import n from'path';import {existsSync}from'fs';import y from'fs-extra';var k=".workspai/workspace-registry.v1.json",w="workspace-registry.v1";function C(t){return {slug:t.slug,relativePath:t.relativePath,framework:t.framework,kit:t.kit,source:t.source}}async function x(t){let r=o(t,"workspace.json").find(e=>existsSync(e));if(!r)return {exists:false,legacyProjectCount:0};try{let e=await y.readJson(r),s=Array.isArray(e.projects)?e.projects.length:0,o=typeof e.workspace_name=="string"&&e.workspace_name.trim()||typeof e.name=="string"&&e.name.trim()||n.basename(t);return {exists:true,manifestPath:r,workspaceName:o,profile:typeof e.profile=="string"?e.profile:void 0,legacyProjectCount:s}}catch{return {exists:true,manifestPath:r,legacyProjectCount:0,workspaceName:n.basename(t)}}}async function A(t){let r$1=a(t);for(let e of r())if(await y.pathExists(e))try{let o=((await y.readJson(e)).workspaces||[]).find(a$1=>a(a$1.path)===r$1);if(o)return {exists:true,projectCount:Array.isArray(o.projects)?o.projects.length:0,registryPath:e}}catch{continue}return {exists:false,projectCount:0,registryPath:n.join(p(),"workspaces.json")}}async function b(t){let r=n.resolve(t),e=await f(r,b$1),s=await x(r),o=await A(r),a=!!e,c=[];if(a)try{let{contract:S}=await j({workspacePath:r});c=S.projects||[];}catch{c=[];}let W={contract:{exists:a,projectCount:c.length,path:b$1},globalRegistry:{exists:o.exists,projectCount:o.projectCount,path:o.registryPath},legacyWorkspaceJson:{exists:s.exists,projectCount:s.legacyProjectCount,path:s.manifestPath?n.relative(r,s.manifestPath):void 0}},i="none",u=[],p=0;return a?(i="workspace.contract.json",u=c.map(C),p=u.length):o.projectCount>0?(i="global-registry",p=o.projectCount):s.legacyProjectCount>0&&(i="legacy-workspace.json",p=s.legacyProjectCount),{contractExists:a,summary:{schemaVersion:w,kind:"rapidkit.workspace.registry",workspacePath:r,workspaceName:s.workspaceName||n.basename(r),profile:s.profile,projectCount:p,authority:i,contractPath:b$1,projects:u,sources:W}}}async function J(t){let r=await f(t,k);if(!r)return null;try{let e=await y.readJson(r);return e?.schemaVersion!==w?null:e}catch{return null}}async function V(t,r){let s={...(await b(t)).summary,generatedAt:(r?.now??new Date).toISOString(),registrySummaryPath:k};return await g(t,k,s),s}function Y(t,r=""){return t.projectCount>0?t.authority==="workspace.contract.json"?`${t.projectCount} project(s) registered in workspace contract${r}.`:t.authority==="global-registry"?`${t.projectCount} project(s) registered in global workspace registry${r}.`:`${t.projectCount} project(s) registered in legacy workspace manifest${r}.`:`Workspace state exists, but no projects are registered yet${r}.`}export{k as WORKSPACE_REGISTRY_SUMMARY_RELATIVE_PATH,w as WORKSPACE_REGISTRY_SUMMARY_SCHEMA_VERSION,Y as formatWorkspaceRegistrySyncSummary,V as publishWorkspaceRegistrySummary,J as readWorkspaceRegistrySummary,b as resolveWorkspaceRegisteredProjects};
@@ -0,0 +1 @@
1
+ export{a as runWorkspaceStage}from'./chunk-WANW4QA4.js';export{a as WORKSPACE_RUN_LAST_REPORT_FILENAME}from'./chunk-KU4S7RCM.js';
@@ -1 +1 @@
1
- export{d as WORKSPACE_VERIFY_REPORT_PATH,c as WORKSPACE_VERIFY_SCHEMA_VERSION,f as buildWorkspaceVerify,e as computeAffectedSubgraphGate,h as evaluateWorkspaceVerifyGate,i as workspaceVerifyExitCode,g as writeWorkspaceVerify}from'./chunk-UNF72FTB.js';
1
+ export{d as WORKSPACE_VERIFY_REPORT_PATH,c as WORKSPACE_VERIFY_SCHEMA_VERSION,f as buildWorkspaceVerify,e as computeAffectedSubgraphGate,h as evaluateWorkspaceVerifyGate,i as workspaceVerifyExitCode,g as writeWorkspaceVerify}from'./chunk-42G2OK64.js';
@@ -1 +1 @@
1
- import {a}from'./chunk-7IHLTPZ6.js';import {b as b$1,p}from'./chunk-JICOD2GI.js';import {a as a$1}from'./chunk-LG6RFLPZ.js';import P from'fs';var w="workspace-watch-event.v1";function b(t){return a$1(t,"contracts/workspace-watch-event.v1.json","Workspace watch event"),t}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$1({projects:o,edges:c})}function R(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??(()=>p({...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=R(c,a),i=m(a),l=c?m(c)!==i:true;return b({schemaVersion:w,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})}},C=new Set([".git",".hg",".svn","node_modules",".venv","venv","dist","build","out","target","coverage","htmlcov",".next",".turbo",".cache"]),y=new Set(["reports","cache","tmp",".cache"]);function S(t){if(!t)return false;let r=t.split(/[\\/]/).filter(Boolean);if(r.some(o=>C.has(o)))return false;for(let o=0;o<r.length-1;o+=1)if((r[o]===".workspai"||r[o]===".rapidkit")&&y.has(r[o+1]))return false;return true}async function I(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(b({schemaVersion:w,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=>{S(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=P.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{w as WORKSPACE_WATCH_EVENT_SCHEMA_VERSION,k as WorkspaceWatchEngine,m as computeWatchModelHash,R as diffWatchModels,S as isWatchRelevantPath,I as runWorkspaceWatch};
1
+ import {a}from'./chunk-OOOPYUL2.js';import {b as b$1,p}from'./chunk-HYJK7W3B.js';import {a as a$1}from'./chunk-LG6RFLPZ.js';import P from'fs';var w="workspace-watch-event.v1";function b(t){return a$1(t,"contracts/workspace-watch-event.v1.json","Workspace watch event"),t}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$1({projects:o,edges:c})}function R(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??(()=>p({...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=R(c,a),i=m(a),l=c?m(c)!==i:true;return b({schemaVersion:w,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})}},C=new Set([".git",".hg",".svn","node_modules",".venv","venv","dist","build","out","target","coverage","htmlcov",".next",".turbo",".cache"]),y=new Set(["reports","cache","tmp",".cache"]);function S(t){if(!t)return false;let r=t.split(/[\\/]/).filter(Boolean);if(r.some(o=>C.has(o)))return false;for(let o=0;o<r.length-1;o+=1)if((r[o]===".workspai"||r[o]===".rapidkit")&&y.has(r[o+1]))return false;return true}async function I(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(b({schemaVersion:w,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=>{S(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=P.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{w as WORKSPACE_WATCH_EVENT_SCHEMA_VERSION,k as WorkspaceWatchEngine,m as computeWatchModelHash,R as diffWatchModels,S as isWatchRelevantPath,I as runWorkspaceWatch};
@@ -61,7 +61,7 @@ npx workspai workspace graph [emit|explain|dot|mermaid] [key] [--workspace <path
61
61
  npx workspai workspace watch [--workspace <path>] [--json] [--once] [--scan-depth <count>]
62
62
  npx workspai workspace explain|why <target> [--workspace <path>] [--json] [--write]
63
63
  npx workspai workspace trace --from <workspace-diff-report> [--workspace <path>] [--json] [--write]
64
- npx workspai workspace feedback record [--workspace <path>] [--json]
64
+ printf '%s\n' '{"actionId":"fix-api","summary":"API tests passed","outcome":"ok"}' | npx workspai workspace feedback record [--workspace <path>] --json
65
65
  npx workspai workspace mcp serve [--workspace <path>] [--json]
66
66
  npx workspai workspace export --output team-workspace.workspai-archive.zip [--archive-compression store|deflate]
67
67
  npx workspai workspace archive inspect team-workspace.workspai-archive.zip [--max-download-size <size>] [--max-expanded-size <size>] [--download-timeout-ms <ms>] [--json]
@@ -86,6 +86,19 @@ npx workspai infra down [--workspace <path>] [--volumes]
86
86
  npx workspai infra status [--workspace <path>] [--json] [--strict]
87
87
  ```
88
88
 
89
+ `workspace feedback record` is a non-interactive machine interface. It requires
90
+ exactly one JSON object on stdin and `--json`; an empty stdin or interactive TTY
91
+ is rejected. Required fields are `actionId`, `summary`, and `outcome`. The
92
+ accepted outcome values and optional scope/evidence fields are governed by
93
+ `contracts/workspace-intelligence/agent-action-outcome.v1.json`. Successful
94
+ records are appended to
95
+ `.workspai/reports/workspace-intelligence-history.json`; no separate feedback
96
+ artifact is created.
97
+
98
+ `workspace graph dot` and `workspace graph mermaid` intentionally emit raw DOT
99
+ and Mermaid text for direct piping to renderers. Use `workspace graph emit
100
+ --json` or `workspace graph explain <project> --json` for structured JSON.
101
+
89
102
  See [workspace-run.md](./workspace-run.md) for fleet orchestration semantics.
90
103
 
91
104
  After cloning or moving an existing workspace, `workspace sync` repairs its
@@ -32,23 +32,44 @@ These commands are implemented and orchestrated by Workspai CLI:
32
32
  - `product`
33
33
  - `infra`
34
34
  - `commands`
35
+ - `create`
36
+ - `project`
35
37
  - `shell activate`
36
38
 
37
39
  Reason: workspace-level policy, registry, and platform orchestration live in npm wrapper.
38
40
 
39
41
  ### 1.1) Wrapper-owned scoped commands
40
42
 
41
- These scoped commands are implemented and orchestrated by Workspai CLI:
42
-
43
+ These nested Commander commands are implemented and orchestrated by Workspai CLI:
44
+
45
+ - `ai generate-embeddings`
46
+ - `ai info`
47
+ - `ai recommend`
48
+ - `ai update-embeddings`
49
+ - `config ai`
50
+ - `config remove-api-key`
51
+ - `config set-api-key`
52
+ - `config show`
53
+ - `infra down`
54
+ - `infra plan`
55
+ - `infra status`
56
+ - `infra up`
57
+ - `product manifest`
58
+ - `product manifest create`
59
+ - `product plan`
43
60
  - `project commands`
44
61
  - `project archives`
45
62
  - `project archive`
46
63
  - `project restore`
47
64
  - `project delete`
48
-
49
- Reason: these are workspace project lifecycle and capability operations with
50
- archive manifests, safety snapshots, workspace registry side effects, and
51
- runtime-aware command discovery.
65
+ - `snapshot create`
66
+ - `snapshot inspect`
67
+ - `snapshot list`
68
+ - `snapshot restore`
69
+
70
+ Reason: these routes are registered directly in the npm wrapper's live
71
+ Commander tree. Their completeness is verified against `commands --json` and
72
+ the generated runtime command surface during tests and prepack.
52
73
 
53
74
  `project detect` remains Core-owned because it is the stable machine-readable
54
75
  contract used by wrappers to detect Python RapidKit projects.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workspai",
3
- "version": "0.44.0",
3
+ "version": "0.45.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": [
@@ -94,6 +94,7 @@
94
94
  "test:prepare-embeddings": "node scripts/prepare-mock-embeddings.mjs",
95
95
  "generate-embeddings": "npx tsx src/ai/generate-embeddings.ts",
96
96
  "verify:package-cli": "node scripts/verify-package-cli.mjs",
97
+ "verify:cli-command-surface": "node scripts/verify-cli-command-surface.mjs",
97
98
  "check:workspace-intelligence-runtime": "node scripts/check-workspace-intelligence-runtime-conformance.mjs",
98
99
  "check:workspace-intelligence-adversarial": "node scripts/check-workspace-intelligence-adversarial.mjs",
99
100
  "check:windows-registry": "node scripts/check-windows-registry-invariants.mjs",
@@ -36,6 +36,10 @@ if (!fs.existsSync(tsupCli)) {
36
36
  runNode([tsupCli], 'building dist');
37
37
  runNode(['scripts/prepare-mock-embeddings.mjs'], 'preparing packaged embeddings');
38
38
  runNode(['scripts/verify-package-cli.mjs'], 'verifying bundled CLI command ownership');
39
+ runNode(
40
+ ['scripts/verify-cli-command-surface.mjs'],
41
+ 'verifying live packaged CLI command surface against the published contract'
42
+ );
39
43
  runNode(
40
44
  ['scripts/check-workspace-intelligence-runtime-conformance.mjs'],
41
45
  'validating Workspace Intelligence runtime artifacts against canonical schemas'
@@ -1 +0,0 @@
1
- export{b as printAnalyzeReport,a as runAnalyze}from'./chunk-L3E6IRUQ.js';
@@ -1 +0,0 @@
1
- export{b as AUTOPILOT_RELEASE_ALIAS_FILENAME,a as AUTOPILOT_RELEASE_LAST_RUN_FILENAME,c as runAutopilotRelease}from'./chunk-CL6TGI4Q.js';
@@ -1,2 +0,0 @@
1
- import {a as a$1}from'./chunk-LG6RFLPZ.js';import {a,c,b as b$1}from'./chunk-5AKYMAIL.js';import {r,s}from'./chunk-5XATWNME.js';import s$1 from'path';import {randomUUID}from'crypto';import {open}from'fs/promises';import a$2 from'fs-extra';var _=Object.keys(a).flatMap(r=>{let t=r,o=b$1[t],e=c[t];return !o||!e?[]:[{artifactPath:a[t],schemaVersion:o,contractPath:e}]}),N=[{artifactPath:".workspai/cache/workspace-model.v1.json",schemaVersion:"workspace-model-cache.v1",contractPath:"contracts/workspace-model-cache.v1.json"},{artifactPath:".workspai/workspace-registry.v1.json",schemaVersion:"workspace-registry.v1",contractPath:"contracts/workspace-registry.v1.json"},{artifactPath:".workspai/reports/doctor-project-last-run.json",schemaVersion:"doctor-project-evidence-v1",contractPath:"contracts/doctor-project-evidence.v1.json"},{artifactPath:".workspai/reports/doctor-remediation-plan-last-run.json",schemaVersion:"doctor-remediation-plan-v2",contractPath:"contracts/doctor-remediation-plan.v2.json"},{artifactPath:".workspai/reports/artifact-remediation-plan-last-run.json",schemaVersion:"artifact-remediation-plan-v1",contractPath:"contracts/artifact-remediation-plan.v1.json"},{artifactPath:".workspai/reports/doctor-fix-result-last-run.json",schemaVersion:"rapidkit-doctor-fix-result-v1",contractPath:"contracts/workspace-intelligence/doctor-fix-result.v1.json"},{artifactPath:".workspai/reports/pipeline-last-run.json",schemaVersion:"rapidkit-pipeline-v1",contractPath:"contracts/pipeline-last-run.v1.json"},{artifactPath:".workspai/reports/autopilot-release-last-run.json",schemaVersion:"autopilot-release-v1",contractPath:"contracts/autopilot-release.v1.json"},{artifactPath:".workspai/reports/autopilot-release.json",schemaVersion:"autopilot-release-v1",contractPath:"contracts/autopilot-release.v1.json"},{artifactPath:".workspai/reports/workspace-run-last.json",schemaVersion:"workspace-run-v1",contractPath:"contracts/workspace-run-last.v1.json"},{artifactPath:".workspai/reports/workspai-mcp-design.json",schemaVersion:"workspai-mcp-design.v1",contractPath:"contracts/workspace-intelligence/mcp-design.v1.json"},{artifactPath:".workspai/reports/workspace-why-last-run.json",schemaVersion:b$1.explain,contractPath:c.explain},{artifactPath:".workspai/reports/workspace-trace-last-run.json",schemaVersion:b$1.explain,contractPath:c.explain},{artifactPath:".vscode/workspai-agent-hooks.json",schemaVersion:"workspai-agent-hooks.v1",contractPath:"contracts/workspace-intelligence/agent-hooks.v1.json"}],M=Object.freeze(Object.fromEntries([..._,...N].map(r=>[r.artifactPath,r])));function b(r){return r.split(s$1.sep).join("/").replace(/^\.\//,"")}function $(r){return M[b(r)]??null}function j(r,t,o=r){let e=$(r);if(!e)return;let i=t&&typeof t=="object"&&"schemaVersion"in t?t.schemaVersion:void 0;if(i!==e.schemaVersion)throw new Error(`${o} schemaVersion is ${String(i)}, expected ${e.schemaVersion}`);a$1(t,e.contractPath,o);}function T(r,t){let o=s$1.resolve(r),e=t.trim();if(!e||s$1.isAbsolute(e))throw new Error(`Workspace artifact path must be non-empty and relative: ${t}`);let i=s$1.resolve(o,e),n=s$1.relative(o,i);if(n===".."||n.startsWith(`..${s$1.sep}`)||s$1.isAbsolute(n))throw new Error(`Workspace artifact path escapes workspace root: ${t}`);return i}function A(r$1,t){return T(r$1,r(t))}function O(r,t){return T(r,s(t))}async function x(r,t){let o=s$1.resolve(r);await a$2.ensureDir(o);let e=s$1.dirname(t);await a$2.ensureDir(e);let[i,n]=await Promise.all([a$2.realpath(o),a$2.realpath(e)]),p=s$1.relative(i,n);if(p===".."||p.startsWith(`..${s$1.sep}`)||s$1.isAbsolute(p))throw new Error(`Workspace artifact parent resolves outside workspace root: ${e}`)}async function F(r,t){let o=s$1.resolve(r),[e,i]=await Promise.all([a$2.realpath(o),a$2.realpath(t)]),n=s$1.relative(e,i);if(n===".."||n.startsWith(`..${s$1.sep}`)||s$1.isAbsolute(n))throw new Error(`Workspace artifact resolves outside workspace root: ${t}`)}function L(r){let t=r?.code;return process.platform==="win32"&&(t==="EPERM"||t==="EINVAL"||t==="ENOSYS")}async function C(r){try{await r.sync();}catch(t){if(!L(t))throw t}}async function J(r,t,o){await x(r,t);let e=s$1.dirname(t),i=`${s$1.basename(t)}.`,n=Date.now();for(let l of await a$2.readdir(e)){if(!l.startsWith(i)||!l.endsWith(".tmp"))continue;let f=s$1.join(e,l),c=await a$2.stat(f).catch(()=>null);c&&n-c.mtimeMs>3e4&&await a$2.remove(f).catch(()=>{});}let p=`${t}.${process.pid}.${randomUUID()}.tmp`;try{await o(p);let l=await open(p,"r");try{await C(l);}finally{await l.close();}let f=Number(process.env.WORKSPAI_TEST_ATOMIC_WRITE_DELAY_MS??0);Number.isFinite(f)&&f>0&&await new Promise(c=>setTimeout(c,Math.min(f,3e4)));try{await a$2.rename(p,t);}catch(c){let m=c.code;if(m!=="EEXIST"&&m!=="EPERM")throw c;await a$2.move(p,t,{overwrite:true});}}finally{await a$2.remove(p).catch(()=>{});}}async function rt(r,t,o,e={}){let i=A(r,t);await x(r,i);let n=`${i}.lock`,p=e.timeoutMs??1e4,l=e.staleAfterMs??3e4,f=Date.now(),c;for(;!c;)try{c=await open(n,"wx"),await c.writeFile(`${JSON.stringify({pid:process.pid,createdAt:new Date().toISOString()})}
2
- `),await C(c);}catch(m){if(m.code!=="EEXIST")throw c&&(await c.close().catch(()=>{}),c=void 0,await a$2.remove(n).catch(()=>{})),m;let P=await a$2.stat(n).catch(()=>null);if(P&&Date.now()-P.mtimeMs>l){let h=await a$2.readJson(n).catch(()=>null),u=Number(h?.pid),k=false;if(Number.isInteger(u)&&u>0)try{process.kill(u,0),k=true;}catch(I){k=I.code==="EPERM";}if(!k){await a$2.remove(n).catch(()=>{});continue}}if(Date.now()-f>=p)throw new Error(`Timed out waiting for workspace artifact lock: ${t}`);await new Promise(h=>setTimeout(h,20));}try{return await o()}finally{await c.close().catch(()=>{}),await a$2.remove(n).catch(()=>{});}}async function et(r,t){let o=[A(r,t),O(r,t)];for(let e of o)if(await a$2.pathExists(e))return await F(r,e),e;return null}async function ot(r,t,o){j(t,o);let e=A(r,t);return await J(r,e,i=>a$2.writeJson(i,o,{spaces:2})),e}export{$ as a,j as b,A as c,O as d,rt as e,et as f,ot as g};
@@ -1,5 +0,0 @@
1
- import {a as a$2}from'./chunk-L3E6IRUQ.js';import {c as c$1}from'./chunk-CL6TGI4Q.js';import {e}from'./chunk-YUX4YFGL.js';import {b}from'./chunk-M4VITK6X.js';import {d,c as c$2}from'./chunk-LGP6WXS2.js';import {f as f$1,e as e$1}from'./chunk-T3GJ7YVG.js';import {a}from'./chunk-22DT744Z.js';import {f,c,g}from'./chunk-FWJV7CCI.js';import {a as a$1}from'./chunk-5AKYMAIL.js';import c$3 from'chalk';import p from'path';function G(s){return s===0?"pass":s===2?"warn":"fail"}function I(s){return s.some(r=>r.status==="fail")?"blocked":s.some(r=>r.status==="warn")?"needs-attention":"ready"}function j(s,r){if(r)return 3;let t=s.some(i=>i.status==="fail"),n=s.some(i=>i.status==="warn");return t?1:n?2:0}async function N(s){let r=await b(s,true),t=false;try{let{syncWorkspaceContract:n}=await import('./workspace-contract-SEI4SNSG.js');await n({workspacePath:s}),t=true;}catch{t=false;}return {sync:r,contractSynced:t}}async function O(s={}){let r=p.resolve(s.workspacePath??process.cwd()),t=a(r);if(!t)throw new Error("No Workspai workspace found in current directory or parents");let n=[],i=[],l=false,d$1,f$2,m,y=Date.now();try{let{sync:e,contractSynced:a}=await N(t),o=e.workspaceFound&&(e.added.length>0||e.skipped>=0)||e.workspaceFound?"pass":"warn";n.push({name:"sync",status:o,durationMs:Date.now()-y,summary:e.workspaceFound?`registry sync complete (${e.added.length} added, ${e.skipped} existing)${a?", contract synced":""}`:"workspace not registered in global registry; contract sync attempted"}),e.workspaceFound||i.push("workspace registry entry missing \u2014 run workspai create workspace or register manually");}catch(e){l=true,n.push({name:"sync",status:"fail",durationMs:Date.now()-y,summary:`sync failed: ${e instanceof Error?e.message:String(e)}`}),i.push("workspace sync stage failed");}let w=Date.now();try{let e$1=await e({workspace:true,json:true,quiet:true,strict:s.strict===true,ci:s.strict!==true}),a=G(e$1),o=await f(t,a$1.doctor)??c(t,a$1.doctor);n.push({name:"doctor",status:a,durationMs:Date.now()-w,summary:a==="pass"?"doctor workspace passed":a==="warn"?"doctor workspace reported warnings":"doctor workspace did not pass",exitCode:e$1,evidencePath:o}),a==="fail"?i.push("doctor workspace gate failed"):a==="warn"&&i.push("doctor workspace reported warnings");}catch(e){l=true,n.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(s.skipAnalyze)n.push({name:"analyze",status:"skipped",durationMs:0,summary:"analyze stage skipped"});else {let e=Date.now();try{let a=await a$2({workspacePath:t,json:true,strict:s.strict===true});d$1=p.isAbsolute(a.enterpriseControls.evidencePath)?a.enterpriseControls.evidencePath:p.join(t,a.enterpriseControls.evidencePath);let o=a.summary.verdict==="blocked"?"fail":a.summary.verdict==="needs-attention"?"warn":"pass";n.push({name:"analyze",status:o,durationMs:Date.now()-e,summary:`analyze verdict: ${a.summary.verdict} (score ${a.summary.score}/100)`,evidencePath:d$1}),o==="fail"?i.push("analyze reported blocked verdict"):o==="warn"&&i.push("analyze reported needs-attention verdict");}catch(a){l=true,n.push({name:"analyze",status:"fail",durationMs:Date.now()-e,summary:`analyze failed: ${a instanceof Error?a.message:String(a)}`}),i.push("analyze stage failed");}}let h=Date.now();try{let e=await d({startPath:t,writeReport:true,skipVerify:s.skipVerify===true});f$2=e.evidencePath;let a=e.overallStatus==="pass"?"pass":e.overallStatus==="warn"?"warn":"fail";n.push({name:"readiness",status:a,durationMs:Date.now()-h,summary:`readiness overall: ${e.overallStatus}`,evidencePath:e.evidencePath}),a==="fail"?i.push(...e.blockingReasons.map(o=>`readiness: ${o}`)):a==="warn"&&i.push(...e.gates.filter(o=>o.status==="warn").map(o=>`readiness warn: ${o.gate}: ${o.summary}`));}catch(e){l=true,n.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(s.skipAutopilot)n.push({name:"autopilot",status:"skipped",durationMs:0,summary:"autopilot stage skipped"});else {let e=Date.now(),a=s.autopilotMode??"audit";try{let o=await c$1({workspacePath:t,mode:a,json:true,skipPipelineStages:true});m=o.artifacts.reportPath;let P=o.summary.verdict==="approved"?"pass":o.summary.verdict==="partial"?"warn":"fail";n.push({name:"autopilot",status:P,durationMs:Date.now()-e,summary:`autopilot ${a}: ${o.summary.verdict}`,exitCode:o.summary.exitCode,evidencePath:m}),P!=="pass"&&i.push(...o.blockingReasons.slice(0,5));}catch(o){l=true,n.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 M=I(n),k=j(n,l),F=p.join(t,".workspai","reports","pipeline-last-run.json"),u={schemaVersion:"rapidkit-pipeline-v1",generatedAt:new Date().toISOString(),workspacePath:t,summary:{verdict:M,exitCode:k,stagesPassed:n.filter(e=>e.status==="pass").length,stagesWarn:n.filter(e=>e.status==="warn").length,stagesFailed:n.filter(e=>e.status==="fail").length},stages:n,blockingReasons:[...new Set(i)],artifacts:{reportPath:F,analyzeEvidencePath:d$1,readinessEvidencePath:f$2,autopilotEvidencePath:m}};if(s.writeReport!==false){let e=f$1(u,{commandId:"workspacePipeline",exitCode:k,generatedAt:u.generatedAt,blockers:u.blockingReasons,runId:e$1()});await g(t,".workspai/reports/pipeline-last-run.json",e);}if(s.writeReport!==false&&s.noAgentSync!==true&&process.env.RAPIDKIT_NO_AGENT_SYNC!=="1"&&s.agentSync!==false)try{let{syncWorkspaceAgentGrounding:e}=await import('./workspace-agent-sync-ZYCPXTU3.js'),a=await e({workspacePath:t,write:true,refreshContext:true,strict:false});u.agentGrounding={indexPath:a.indexPath,writtenFiles:a.writtenFiles,blockers:a.blockers};}catch{}return u}async function te(s){let r;try{r=await O(s);}catch(t){let n=t instanceof Error?t.message:String(t);s.json?console.log(JSON.stringify(c$2({operation:"pipeline",code:"pipeline.failed",message:n}),null,2)):console.log(c$3.red(`Pipeline failed: ${n}`)),process.exit(1);}if(s.json)console.log(JSON.stringify(r,null,2));else {console.log(c$3.bold.cyan(`
2
- \u{1F517} Workspai Governance Pipeline
3
- `)),console.log(c$3.bold(`Workspace: ${c$3.cyan(p.basename(r.workspacePath))}`)),console.log(c$3.gray(`Path: ${r.workspacePath}`)),console.log(c$3.white(`Verdict: ${r.summary.verdict} Exit: ${r.summary.exitCode} (${r.summary.stagesPassed} pass / ${r.summary.stagesWarn} warn / ${r.summary.stagesFailed} fail)`));for(let t of r.stages){let n=t.status==="pass"?c$3.green("PASS"):t.status==="warn"?c$3.yellow("WARN"):t.status==="skipped"?c$3.gray("SKIP"):c$3.red("FAIL");console.log(` - ${t.name}: ${n} ${t.summary}`);}if(r.blockingReasons.length>0){console.log(c$3.bold(`
4
- Blocking reasons:`));for(let t of r.blockingReasons.slice(0,8))console.log(c$3.gray(` \u2022 ${t}`));}console.log(c$3.gray(`
5
- Evidence: ${r.artifacts.reportPath}`)),r.agentGrounding?.writtenFiles.length&&console.log(c$3.gray(`Agent grounding: ${r.agentGrounding.writtenFiles.length} file(s) synced (INDEX + AGENTS.md + Copilot/Cursor/Claude hooks)`));}r.summary.exitCode!==0&&process.exit(r.summary.exitCode);}export{O as runPipeline,te as runPipelineCommand};
@@ -1 +0,0 @@
1
- export{b as buildWorkspaceExplain,a as resolveWorkspaceExplainArtifactPath,c as writeWorkspaceExplainReport}from'./chunk-TRMDODFM.js';export{e as WORKSPACE_MODEL_DIFF_REPORT_PATH}from'./chunk-VA5MRHKM.js';export{c as WORKSPACE_EXPLAIN_REPORT_PATH,e as WORKSPACE_TRACE_REPORT_PATH,d as WORKSPACE_WHY_REPORT_PATH}from'./chunk-XIVFLY6G.js';
@@ -1 +0,0 @@
1
- export{a as runWorkspaceStage}from'./chunk-NTXO7BMH.js';export{a as WORKSPACE_RUN_LAST_REPORT_FILENAME}from'./chunk-B66A4TVP.js';