workspai 0.43.1 → 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 (137) hide show
  1. package/README.md +28 -11
  2. package/contracts/agent-customization-pack.v1.json +1 -1
  3. package/contracts/autopilot-release.v1.json +204 -0
  4. package/contracts/cli-operation-result.v1.json +119 -0
  5. package/contracts/cli-runtime-command-inventory.v1.snapshot.json +1368 -0
  6. package/contracts/command-capabilities.v1.json +303 -0
  7. package/contracts/compatibility-matrix.v1.json +37 -0
  8. package/contracts/create-planner-capabilities.v1.json +156 -65
  9. package/contracts/doctor-project-scan.v2.json +60 -0
  10. package/contracts/doctor-remediation-plan.v1.json +19 -4
  11. package/contracts/doctor-remediation-plan.v2.json +7 -0
  12. package/contracts/doctor-workspace-cache.v2.json +82 -0
  13. package/contracts/extension-cli-compatibility.v1.json +48 -3
  14. package/contracts/infra-plan.v1.json +189 -0
  15. package/contracts/private-product-manifest.v1.json +155 -0
  16. package/contracts/product-factory-plan.v1.json +200 -0
  17. package/contracts/project-archive.v1.json +40 -0
  18. package/contracts/project-entry-capability.v1.json +127 -0
  19. package/contracts/published-contract-catalog.v1.json +339 -0
  20. package/contracts/runtime-command-surface.v1.json +1680 -11
  21. package/contracts/version.v1.json +48 -0
  22. package/contracts/workspace-archive-capabilities.v1.json +90 -0
  23. package/contracts/workspace-archive-manifest.v1.json +107 -0
  24. package/contracts/workspace-archive-operation-result.v1.json +565 -0
  25. package/contracts/workspace-intelligence/agent-customization-pack-report.v1.json +98 -0
  26. package/contracts/workspace-intelligence/agent-hooks.v1.json +38 -0
  27. package/contracts/workspace-intelligence/agent-reports-index.v1.json +56 -0
  28. package/contracts/workspace-intelligence/mcp-design.v1.json +42 -0
  29. package/contracts/workspace-intelligence/workspace-context.v1.json +12 -0
  30. package/contracts/workspace-intelligence/workspace-explain.v1.json +1 -0
  31. package/contracts/workspace-intelligence-architecture.v1.json +723 -0
  32. package/contracts/workspace-intelligence-chain.v1.json +1194 -0
  33. package/contracts/workspace-list.v1.json +56 -0
  34. package/contracts/workspace-model-cache.v1.json +55 -0
  35. package/contracts/workspace-snapshot.v1.json +58 -0
  36. package/contracts/workspace-snapshot.v2.json +97 -0
  37. package/contracts/workspace-sync.v1.json +30 -0
  38. package/contracts/workspace-watch-event.v1.json +112 -0
  39. package/dist/analyze-YLV7NVLF.js +1 -0
  40. package/dist/{artifact-remediation-plan-244S5K6I.js → artifact-remediation-plan-WLZGROUU.js} +2 -2
  41. package/dist/autopilot-release-YBN3SWAA.js +1 -0
  42. package/dist/{chunk-LZQNVH7D.js → chunk-2K3GYCPS.js} +1 -1
  43. package/dist/chunk-2QOWRBQD.js +1 -0
  44. package/dist/chunk-42G2OK64.js +1 -0
  45. package/dist/chunk-5AKYMAIL.js +1 -0
  46. package/dist/chunk-5GNT4RJI.js +8 -0
  47. package/dist/{chunk-FDDDQMJ2.js → chunk-5PVEQ6CZ.js} +1 -1
  48. package/dist/chunk-6AA3WWQZ.js +2 -0
  49. package/dist/chunk-6ZENXBMG.js +33 -0
  50. package/dist/chunk-7RIWU5TZ.js +1 -0
  51. package/dist/chunk-BJLE5CH7.js +4 -0
  52. package/dist/{chunk-PPHTYJ7G.js → chunk-DXPU4DDV.js} +36 -37
  53. package/dist/{chunk-DOCPUNWS.js → chunk-G3H5R3RR.js} +1 -1
  54. package/dist/chunk-HYJK7W3B.js +1 -0
  55. package/dist/chunk-IMUU5Q2V.js +13 -0
  56. package/dist/chunk-J4AICQFB.js +1 -0
  57. package/dist/{chunk-EMTQ6OKI.js → chunk-JP25YL3J.js} +1 -1
  58. package/dist/{chunk-ONU457VN.js → chunk-K63BSU56.js} +52 -50
  59. package/dist/chunk-KPPGZCUW.js +78 -0
  60. package/dist/chunk-KU4S7RCM.js +1 -0
  61. package/dist/chunk-LCRROMRR.js +2 -0
  62. package/dist/chunk-LG6RFLPZ.js +1 -0
  63. package/dist/{chunk-JHC6SCJC.js → chunk-NHN4QXPP.js} +1 -1
  64. package/dist/{chunk-U6AXYUQY.js → chunk-OOOPYUL2.js} +1 -1
  65. package/dist/chunk-P7SCWJFG.js +8 -0
  66. package/dist/chunk-QWU2CZBG.js +2 -0
  67. package/dist/chunk-V2H2KRMZ.js +1 -0
  68. package/dist/chunk-WANW4QA4.js +4 -0
  69. package/dist/chunk-XIVFLY6G.js +1 -0
  70. package/dist/chunk-ZWO6K24C.js +2 -0
  71. package/dist/{create-42RTNLH2.js → create-KFR6FLRT.js} +1 -1
  72. package/dist/doctor-YJDM5XBH.js +1 -0
  73. package/dist/index.d.ts +284 -25
  74. package/dist/index.js +214 -204
  75. package/dist/pipeline-FEDYO3IA.js +5 -0
  76. package/dist/{platform-capabilities-XAVU4HSM.js → platform-capabilities-YICBF4FA.js} +1 -1
  77. package/dist/{pythonRapidkitExec-GCQ3M46E.js → pythonRapidkitExec-UJYIB6FL.js} +1 -1
  78. package/dist/{workspace-DZHWB7BV.js → workspace-PLXOO6ST.js} +1 -1
  79. package/dist/workspace-agent-sync-G5YVI3BJ.js +1 -0
  80. package/dist/workspace-archive-EEGLHZDW.js +10 -0
  81. package/dist/workspace-context-E3UFWL5X.js +1 -0
  82. package/dist/{workspace-contract-2TA27LGT.js → workspace-contract-LQJDZV36.js} +1 -1
  83. package/dist/workspace-explain-G74ZIF23.js +1 -0
  84. package/dist/workspace-explain-contract-KT757JGQ.js +1 -0
  85. package/dist/{workspace-feedback-R6H4UFZB.js → workspace-feedback-YY6WQPWQ.js} +1 -1
  86. package/dist/{workspace-foundation-FQWHPQGX.js → workspace-foundation-3C2DLCVI.js} +1 -1
  87. package/dist/{workspace-history-CGCK2DJI.js → workspace-history-VF3CHDYQ.js} +1 -1
  88. package/dist/workspace-intelligence-3GG7GEDQ.js +1 -0
  89. package/dist/workspace-mcp-serve-MJMUV4RY.js +3 -0
  90. package/dist/{workspace-model-F3B75TYT.js → workspace-model-NG45SRM5.js} +1 -1
  91. package/dist/workspace-registry-summary-JM2XY52C.js +1 -0
  92. package/dist/workspace-run-WEQYIERE.js +1 -0
  93. package/dist/{workspace-verify-OAATQV5T.js → workspace-verify-ZNT6JX7D.js} +1 -1
  94. package/dist/workspace-watch-W47T4RX2.js +1 -0
  95. package/docs/AI_FEATURES.md +67 -34
  96. package/docs/README.md +2 -1
  97. package/docs/commands-reference.md +39 -14
  98. package/docs/contracts/ARTIFACT_CATALOG.md +60 -36
  99. package/docs/contracts/COMMAND_OWNERSHIP_MATRIX.md +27 -6
  100. package/docs/contracts/README.md +3 -2
  101. package/docs/create-planner-capabilities.md +36 -18
  102. package/docs/workspace-operations.md +25 -0
  103. package/package.json +27 -14
  104. package/scripts/enterprise-package-smoke.mjs +40 -8
  105. package/scripts/prepack-enterprise.mjs +12 -0
  106. package/dist/analyze-5BU4QIPK.js +0 -1
  107. package/dist/autopilot-release-45YVOBQO.js +0 -1
  108. package/dist/chunk-3QVTWKUI.js +0 -4
  109. package/dist/chunk-753LOKFZ.js +0 -2
  110. package/dist/chunk-AMDKXXLP.js +0 -1
  111. package/dist/chunk-AQ4XZZC6.js +0 -1
  112. package/dist/chunk-CDE4Q77U.js +0 -2
  113. package/dist/chunk-DNAY5ALC.js +0 -1
  114. package/dist/chunk-FHSMY75W.js +0 -1
  115. package/dist/chunk-FM7GMFZA.js +0 -2
  116. package/dist/chunk-HV5ZFXAZ.js +0 -13
  117. package/dist/chunk-LRW2SAGL.js +0 -4
  118. package/dist/chunk-LTWYYP6E.js +0 -7
  119. package/dist/chunk-NAAQMSO3.js +0 -1
  120. package/dist/chunk-NFUXULIF.js +0 -1
  121. package/dist/chunk-OL64GWQC.js +0 -9
  122. package/dist/chunk-SI3AQKIP.js +0 -1
  123. package/dist/chunk-TH5Y3EMA.js +0 -33
  124. package/dist/chunk-UQKCCWUL.js +0 -78
  125. package/dist/chunk-XNGANEXM.js +0 -2
  126. package/dist/doctor-DK4BON3N.js +0 -1
  127. package/dist/pipeline-HQ57V6OZ.js +0 -5
  128. package/dist/workspace-agent-sync-5ADIQS7B.js +0 -1
  129. package/dist/workspace-archive-GCZNI44O.js +0 -3
  130. package/dist/workspace-context-GEXDHA7A.js +0 -1
  131. package/dist/workspace-explain-D5NNL3NG.js +0 -1
  132. package/dist/workspace-explain-contract-DNS2YEL7.js +0 -1
  133. package/dist/workspace-intelligence-BEM6WGCZ.js +0 -1
  134. package/dist/workspace-mcp-serve-OMBA5V3C.js +0 -3
  135. package/dist/workspace-registry-summary-6MFBRWDS.js +0 -1
  136. package/dist/workspace-run-3WJXIQKR.js +0 -1
  137. package/dist/workspace-watch-HU2OTQ52.js +0 -1
@@ -0,0 +1,2 @@
1
+ import {a as a$1}from'./chunk-LG6RFLPZ.js';import {a,c,b as b$1,f}from'./chunk-5AKYMAIL.js';import {r,s}from'./chunk-5XATWNME.js';import n from'path';import {randomUUID}from'crypto';import {open}from'fs/promises';import a$2 from'fs-extra';var N=Object.keys(a).flatMap(r=>{let t=r,e=b$1[t],o=c[t];return !e||!o?[]:[{artifactPath:a[t],schemaVersion:e,contractPath:o}]}),M=[{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"},{artifactPath:".workspai/reports/infra-plan.json",schemaVersion:"rapidkit.infra-plan.v1",contractPath:"contracts/infra-plan.v1.json"}],b={[a.snapshot]:[["workspace","snapshot"]],[a.history]:[["workspace","feedback","record","--json"]],".workspai/cache/workspace-model.v1.json":[["workspace","model"]],".workspai/workspace-registry.v1.json":[["workspace","sync"]],".workspai/reports/doctor-project-last-run.json":[["doctor","project"]],".workspai/reports/doctor-remediation-plan-last-run.json":[["workspace","remediation-plan"]],".workspai/reports/artifact-remediation-plan-last-run.json":[["workspace","remediation-plan"]],".workspai/reports/doctor-fix-result-last-run.json":[["doctor","workspace"]],".workspai/reports/pipeline-last-run.json":[["pipeline"]],".workspai/reports/autopilot-release-last-run.json":[["autopilot","release"]],".workspai/reports/autopilot-release.json":[["autopilot","release"]],".workspai/reports/workspace-run-last.json":[["workspace","run"]],".workspai/reports/workspace-why-last-run.json":[["workspace","why"]],".workspai/reports/workspace-trace-last-run.json":[["workspace","trace"]],".vscode/workspai-agent-hooks.json":[["workspace","agent-sync"]],".workspai/reports/infra-plan.json":[["infra","plan"]]};function O(r){let t=Object.values(f).filter(o=>o.produces.includes(r)).map(o=>[...o.command]),e=b[r]??[];return [...t,...e.map(o=>[...o])]}var $=Object.freeze(Object.fromEntries([...N,...M].map(r=>[r.artifactPath,{...r,producerCommands:O(r.artifactPath)}])));function D(r){return r.split(n.sep).join("/").replace(/^\.\//,"")}function L(r){return $[D(r)]??null}function C(r,t,e=r){let o=L(r);if(!o)return;let i=t&&typeof t=="object"&&"schemaVersion"in t?t.schemaVersion:void 0;if(i!==o.schemaVersion)throw new Error(`${e} schemaVersion is ${String(i)}, expected ${o.schemaVersion}`);a$1(t,o.contractPath,e);}function W(r,t){let e=n.resolve(r),o=t.trim();if(!o||n.isAbsolute(o))throw new Error(`Workspace artifact path must be non-empty and relative: ${t}`);let i=n.resolve(e,o),s=n.relative(e,i);if(s===".."||s.startsWith(`..${n.sep}`)||n.isAbsolute(s))throw new Error(`Workspace artifact path escapes workspace root: ${t}`);return i}function P(r$1,t){return W(r$1,r(t))}function J(r,t){return W(r,s(t))}async function I(r,t){let e=n.resolve(r);await a$2.ensureDir(e);let o=n.dirname(t);await a$2.ensureDir(o);let[i,s]=await Promise.all([a$2.realpath(e),a$2.realpath(o)]),p=n.relative(i,s);if(p===".."||p.startsWith(`..${n.sep}`)||n.isAbsolute(p))throw new Error(`Workspace artifact parent resolves outside workspace root: ${o}`)}async function K(r,t){let e=n.resolve(r),[o,i]=await Promise.all([a$2.realpath(e),a$2.realpath(t)]),s=n.relative(o,i);if(s===".."||s.startsWith(`..${n.sep}`)||n.isAbsolute(s))throw new Error(`Workspace artifact resolves outside workspace root: ${t}`)}function U(r){let t=r?.code;return process.platform==="win32"&&(t==="EPERM"||t==="EINVAL"||t==="ENOSYS")}async function S(r){try{await r.sync();}catch(t){if(!U(t))throw t}}async function G(r,t,e){await I(r,t);let o=n.dirname(t),i=`${n.basename(t)}.`,s=Date.now();for(let l of await a$2.readdir(o)){if(!l.startsWith(i)||!l.endsWith(".tmp"))continue;let f=n.join(o,l),c=await a$2.stat(f).catch(()=>null);c&&s-c.mtimeMs>3e4&&await a$2.remove(f).catch(()=>{});}let p=`${t}.${process.pid}.${randomUUID()}.tmp`;try{await e(p);let l=await open(p,"r");try{await S(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 w=c.code;if(w!=="EEXIST"&&w!=="EPERM")throw c;await a$2.move(p,t,{overwrite:true});}}finally{await a$2.remove(p).catch(()=>{});}}async function at(r,t,e,o={}){let i=P(r,t);await I(r,i);let s=`${i}.lock`,p=o.timeoutMs??1e4,l=o.staleAfterMs??3e4,f=Date.now(),c;for(;!c;)try{c=await open(s,"wx"),await c.writeFile(`${JSON.stringify({pid:process.pid,createdAt:new Date().toISOString()})}
2
+ `),await S(c);}catch(w){if(w.code!=="EEXIST")throw c&&(await c.close().catch(()=>{}),c=void 0,await a$2.remove(s).catch(()=>{})),w;let A=await a$2.stat(s).catch(()=>null);if(A&&Date.now()-A.mtimeMs>l){let h=await a$2.readJson(s).catch(()=>null),k=Number(h?.pid),g=false;if(Number.isInteger(k)&&k>0)try{process.kill(k,0),g=true;}catch(x){g=x.code==="EPERM";}if(!g){await a$2.remove(s).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 e()}finally{await c.close().catch(()=>{}),await a$2.remove(s).catch(()=>{});}}async function st(r,t){let e=[P(r,t),J(r,t)];for(let o of e)if(await a$2.pathExists(o))return await K(r,o),o;return null}async function nt(r,t,e){C(t,e);let o=P(r,t);return await G(r,o,i=>a$2.writeJson(i,e,{spaces:2})),o}export{L as a,C as b,P as c,J as d,at as e,st as f,nt as g};
@@ -0,0 +1,33 @@
1
+ import {d as d$1,b as b$2,e,f as f$1}from'./chunk-LCRROMRR.js';import {d as d$2}from'./chunk-42G2OK64.js';import {b as b$1,f as f$2,j as j$1,k,h,i,l,m,n as n$1,o,p,q,r,t,v,x,s as s$1,u,w,y,z,A as A$1,B,C,D,E,F,G,a as a$2,H,I}from'./chunk-XIVFLY6G.js';import {n,k as k$1,b as b$4}from'./chunk-HYJK7W3B.js';import {j}from'./chunk-QWU2CZBG.js';import {f,b as b$3,a as a$1}from'./chunk-6AA3WWQZ.js';import {b,a}from'./chunk-5AKYMAIL.js';import s from'path';import f$3 from'fs-extra';var J=["Scope","Evidence","Diagnosis","Fix Plan","Run","Verify","Assumptions"];var lt="workspace-operational-skill.v1";function dt(e){if(typeof e!="string")return null;let t=e.trim();return !t||t.includes("/")||t.includes("..")?null:t}function Ke(e){let t=dt(e.skillId);if(!t)throw new Error(`Invalid skill id: ${e.skillId}`);return {schemaVersion:lt,skillId:t,canonicalPath:H(t),title:e.title,triggers:[...e.triggers].sort((r,n)=>r.localeCompare(n)),requiredReports:[...e.requiredReports].sort((r,n)=>r.localeCompare(n)),scopedProjects:[...e.scopedProjects??[]].sort((r,n)=>r.localeCompare(n)),verificationCommands:[...e.verificationCommands],answerContractSections:[...J],...e.promptStem?{promptStem:e.promptStem}:{},markdown:e.markdown}}var pt=b.skillsIndex;function qe(e){let t=[...e.skills].sort((n,l)=>n.skillId.localeCompare(l.skillId)),r=e.inputsHash??b$4({skillIds:t.map(n=>n.skillId),paths:t.map(n=>n.canonicalPath)});return {schemaVersion:pt,generatedAt:e.generatedAt,inputsHash:r,skills:t.map(n=>({skillId:n.skillId,path:n.canonicalPath,schemaVersion:n.schemaVersion,title:n.title}))}}var Ve=[a.agentIndex,d$1,d$2],ut=[{skillId:"workspai-diagnose-api-failure",title:"Diagnose API failure",triggers:["api failure","500 error","integration test failed","service unreachable"],objective:"Investigate a failing API or service using Workspai evidence before editing application code.",steps:[`Read \`${a.agentIndex}\` and identify fail/warn reports for the scoped project.`,`Read \`${a.doctor}\`, \`doctor-project-last-run.json\`, and project-scoped run evidence if present.`,"If a fix was requested, read `artifact-remediation-plan-last-run.json` for cross-artifact next steps, then `doctor-remediation-plan-last-run.json` for Doctor-specific file edits.","Map the failure to workspace vs project scope; cite exit codes and blocker messages.","Propose the smallest safe fix (config, env, dependency) with explicit verification commands."]},{skillId:"workspai-release-readiness",title:"Release readiness",triggers:["release","ship","production","readiness gate"],objective:"Assess whether this workspace is release-ready using governed Workspai gates.",steps:[`Read \`${a.readiness}\` and \`pipeline-last-run.json\`.`,`Read \`${a.verify}\` for verdict and blocking reasons.`,"Read `.workspai/reports/artifact-remediation-plan-last-run.json` when a Studio or agent repair path is needed.","List blocking gates first; never claim ready without cited report fields.","Provide one safe next command and a verification checklist."]},{skillId:"workspai-safe-schema-migration",title:"Safe schema migration",triggers:["migration","schema change","database migration","db migrate"],objective:"Plan and verify a schema migration with blast-radius awareness.",steps:["Identify affected projects from workspace model and dependency graph.","Run or review impact/verify evidence for transitive dependents.","Require project-scoped test/build commands before promoting the migration.","Document rollback and verification signals."]},{skillId:"workspai-dependency-upgrade",title:"Dependency upgrade",triggers:["upgrade dependency","bump package","security advisory","outdated deps"],objective:"Upgrade dependencies with graph-aware verification.",steps:["Scope the upgrade to the owning project from workspace model.","Check transitive dependents via workspace graph / impact reports.","Prefer workspace run test/build for affected projects.","Re-run `workspace verify` after evidence refresh."]},{skillId:"workspai-rename-contract",title:"Rename contract safely",triggers:["rename contract","rename event","breaking api","contract change"],objective:"Rename or change a shared contract with consumer awareness.",steps:["Read `.workspai/workspace.contract.json` for publishes/consumes/owns edges.","List all consumer projects before proposing renames.","Update contract file and regenerate workspace model.","Verify contract gate and integration tests for consumers."]}];function X(e){return `npx workspai ${e}`.trim()}function gt(e){let t=[`# ${e.template.title}`,"",`> Workspace: **${e.workspaceName}** \xB7 Skill: \`${e.template.skillId}\``,"","## Objective","",e.template.objective,"","## Triggers","",...e.template.triggers.map(r=>`- ${r}`),"","## Required evidence (read first)","",...Ve.map(r=>`- \`${r}\``),"","## Procedure","",...e.template.steps.map((r,n)=>`${n+1}. ${r}`),""];if(e.scopedProjects.length>0&&t.push("## Scoped projects","",...e.scopedProjects.map(r=>`- ${r}`),""),e.contractSummary&&t.push("## Contract context","",e.contractSummary,""),e.verificationCommands.length>0){t.push("## Verification commands (this workspace)","");for(let r of e.verificationCommands)t.push(`- \`${r}\``);t.push("");}return t.push("## Answer contract","","Return: Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.","","## Refresh stale evidence","","```bash",X("workspace agent-sync --write --refresh-context"),"```",""),t.join(`
2
+ `)}function mt(e){return e?.safeCommands?.length?e.safeCommands.slice(0,8).map(t=>t.display):[X("workspace verify --json"),X("doctor workspace --json")]}function kt(e){return e?.projects?.length?e.projects.slice(0,12).map(r=>{let n=r.contracts?.owns?.join(", ")||"none",l=r.contracts?.publishes?.join(", ")||"none",p=r.contracts?.consumes?.join(", ")||"none";return `- **${r.slug}**: owns \`${n}\`; publishes \`${l}\`; consumes \`${p}\``}).join(`
3
+ `):void 0}function Ue(e){let t=e.model.workspace.name,r=e.model.projects.map(p=>p.name).sort(),n=mt(e.context??null),l=kt(e.contract??null);return ut.map(p=>{let u=gt({template:p,workspaceName:t,scopedProjects:r,verificationCommands:n,contractSummary:l});return Ke({skillId:p.skillId,title:p.title,triggers:p.triggers,requiredReports:[...Ve],scopedProjects:r,verificationCommands:n,promptStem:I[p.skillId],markdown:u})})}async function ze(e){let t=s.resolve(e.workspacePath),r=[],n=b$4({skills:e.skills.map(p=>({id:p.skillId,path:p.canonicalPath,hash:b$4({markdown:p.markdown})}))}),l=qe({generatedAt:e.generatedAt,skills:e.skills,inputsHash:n});if(e.write){for(let u of e.skills){let i=s.join(t,u.canonicalPath);await f$3.ensureDir(s.dirname(i)),await f$3.writeFile(i,u.markdown,"utf8"),r.push(u.canonicalPath);}let p=s.join(t,b$1);await f$3.ensureDir(s.dirname(p)),await f$3.writeJson(p,l,{spaces:2}),r.push(b$1);}return {skills:e.skills,index:l,writtenPaths:r}}function Fe(e){return ["## Operational skills (canonical)","","Read workspace-native playbooks from `.workspai/skills/` before generic repo scans. Legacy `.rapidkit/skills/` playbooks are read only when already present from older workspaces:","",...e.skills.map(r=>`- \`${r.path}\` \u2014 ${r.title} (\`${r.skillId}\`)`),"","Regenerate:","","```bash",X("workspace agent-sync --write --refresh-context"),"```",""].join(`
4
+ `)}var ft={"workspai-diagnose-api-failure":p,"workspai-release-readiness":t},xe="## Workspace verification (hydrated)";function ht(e){let t=[xe,"","Verification commands for this workspace:","",...e.verificationCommands.length?e.verificationCommands.map(r=>`- \`${r}\``):["- `npx workspai workspace verify --json`"]];return e.scopedProjects.length>0&&t.push("","Scoped projects:","",...e.scopedProjects.map(r=>`- ${r}`)),t.push(""),t.join(`
5
+ `)}async function Be(e){let t=s.resolve(e.workspacePath),r=[];for(let n of e.skills){let l=ft[n.skillId];if(!l)continue;let p=s.join(t,l);if(!await f$3.pathExists(p))continue;let u=await f$3.readFile(p,"utf8"),i=ht(n),b=u.includes(xe)?u.replace(new RegExp(`${xe}[\\s\\S]*$`),i.trimEnd()):`${u.trimEnd()}
6
+
7
+ ${i}`;e.write&&await f$3.writeFile(p,`${b.trimEnd()}
8
+ `,"utf8"),r.push(l);}return r}var At="workspai-agent-customization-pack-capabilities.v1";function Ye(){return {schemaVersion:At,presets:{minimal:{meaning:"Generate the portable grounding index, AGENTS.md, and provider-specific lightweight instructions.",requiredOutputs:[a.agentIndex,a.agentCustomizationPack,a.agents]},enterprise:{meaning:"Generate the full VS Code-native pack: instructions, prompts, skills, custom agents, and validation metadata.",requiredOutputs:[a.agentIndex,a.agentCustomizationPack,a.agents,l,p,B,".github/agents/workspai-advisor.agent.md",D,b$1]}},targets:{all:{meaning:"Generate every supported customization surface.",outputFamilies:["portable","vscode","copilot","cursor","claude"]},vscode:{meaning:"Generate VS Code-native customizations for Copilot Chat and agent workflows.",outputFamilies:["instructions","prompts","skills","agents","hooks"]},agents:{meaning:"Generate portable AGENTS.md grounding for any agent.",outputFamilies:["portable"]},copilot:{meaning:"Generate GitHub Copilot instructions, prompts, and skills.",outputFamilies:["instructions","prompts","skills"]},cursor:{meaning:"Generate Cursor rules.",outputFamilies:["rules"]},claude:{meaning:"Generate Claude Code grounding files.",outputFamilies:["rules","portable"]},codex:{meaning:"Use AGENTS.md and the report index as the Codex grounding layer.",outputFamilies:["portable"]},orca:{meaning:"Use AGENTS.md and the report index as the Orca/Grok grounding layer.",outputFamilies:["portable"]}},standardAnswerContract:[...J],requiredReports:$.map(e=>({path:e.relativePath,label:e.label,required:e.required})),strictRules:["Required reports must exist.","Generated report paths must stay inside the workspace root.","Generated customization text must be English-only.","Agent answers must not claim pass, ready, or healthy without cited evidence.","Commands must distinguish display guidance from execution requests.","Agent hook files must be advisory and disabled by default unless the user explicitly enables them.","MCP design artifacts must stay read-mostly until write tools have explicit approval boundaries."],outputKinds:["report","grounding","instruction","prompt","skill","skill-resource","operational-skill","skills-index","explain-report","agent","rule","hook","mcp-design"],pathLayers:{l1CanonicalRoots:[".workspai/reports/",`${a$2}/`],l2PrefixedMirrorRoots:[".github/",".cursor/",".claude/"],l3SharedIndustryFiles:["AGENTS.md",".github/copilot-instructions.md","CLAUDE.md"]}}}var wt=b.agentIndex,Pt=b.agentCustomizationPack,te=a.agentIndex,Z=a.agentCustomizationPack;var $=[{relativePath:d$1,label:"Agent context pack",required:true},{relativePath:b$1,label:"Operational skills index",required:true},{relativePath:a.model,label:"Workspace model graph",required:false},{relativePath:a.doctor,label:"Workspace doctor",required:false},{relativePath:".workspai/reports/doctor-project-last-run.json",label:"Project doctor",required:false},{relativePath:".workspai/reports/doctor-remediation-plan-last-run.json",label:"Doctor remediation plan",required:false},{relativePath:".workspai/reports/artifact-remediation-plan-last-run.json",label:"Artifact remediation plan",required:false},{relativePath:".workspai/reports/doctor-fix-result-last-run.json",label:"Doctor fix result",required:false},{relativePath:a.analyze,label:"Workspace analyze",required:false},{relativePath:".workspai/reports/pipeline-last-run.json",label:"Governance pipeline",required:false},{relativePath:a.readiness,label:"Release readiness",required:false},{relativePath:a.impact,label:"Workspace impact",required:false},{relativePath:a.verify,label:"Workspace verify",required:false},{relativePath:a.snapshot,label:"Workspace model snapshot",required:false},{relativePath:a.diff,label:"Workspace model diff",required:false},{relativePath:a.explain,label:"Workspace explain",required:false},{relativePath:a.contractVerify,label:"Workspace contract verify",required:false},{relativePath:a.history,label:"Workspace intelligence history",required:false}];function Rt(){let e=$.map(n=>n.relativePath),r=b$2().consumers.agents.canonicalReadOrder.filter(n=>n!==te&&e.includes(n));return [...new Set([...r,...e])]}function A(e){return `npx workspai ${e}`.trim()}function it(e){return e&&typeof e=="object"?e:null}function Ie(e,t=12){return Array.isArray(e)?e.filter(r=>typeof r=="string"&&r.trim().length>0).slice(0,t):[]}function St(e){let t=Ie(e.blockers,12);if(t.length>0)return t;let r=Ie(e.blockingReasons,12);if(r.length>0)return r;let n=it(e.summary);return n&&Array.isArray(n.blockingReasons)?Ie(n.blockingReasons,12):[]}function Ct(e){for(let t of ["generatedAt","timestamp"]){let r=e[t];if(typeof r=="string"&&r.trim())return r.trim()}}function xt(e,t,r){if(!e)return true;let n=Date.parse(e);return Number.isFinite(n)?r.getTime()-n>t*60*60*1e3:true}function It(e){let t=e&&e.length>0?e:["all"];return t.includes("all")?new Set(["all","vscode","agents","copilot","cursor","claude","codex","orca"]):new Set(t)}function P(e,t){return e.has("all")||e.has(t)}function yt(e){return P(e,"copilot")||P(e,"vscode")}function Ot(e){return e??"enterprise"}function Et(e){return e===b$1?"skills-index":e.includes("workspace-explain-last-run.json")?"explain-report":(e.startsWith(`${a$2}/`)||e.startsWith(".rapidkit/skills/"))&&e.endsWith(".md")?"operational-skill":e.includes("hooks")||e===F||e===G?"hook":e.includes("mcp")||e===D||e===E?"mcp-design":e.endsWith(".json")?"report":e.includes("/instructions/")||e.endsWith("copilot-instructions.md")?"instruction":e.includes("/prompts/")?"prompt":e.includes("/skills/")&&e.endsWith("/SKILL.md")?"skill":e.includes("/skills/")?"skill-resource":e.includes("/agents/")?"agent":e.includes("/rules/")||e.endsWith(".mdc")?"rule":"grounding"}function _t(e){return e.startsWith(".github/")?["vscode","copilot"]:e.startsWith(".cursor/")?["cursor"]:e.startsWith(".claude/")||e==="CLAUDE.md"?["claude"]:e==="AGENTS.md"||e.startsWith(".rapidkit/")?["agents","codex","orca","vscode"]:e.startsWith(".vscode/")?["vscode"]:["agents"]}function bt(e,t){return Ye().presets[t].requiredOutputs.includes(e)}async function Tt(e,t){if(t)return t;let r=await f(e,k$1)??s.join(e,k$1);if(await f$3.pathExists(r))try{let n=await f$3.readJson(r);return b$3(k$1,n,r),n}catch{}return n({workspacePath:e,includeEvidence:true})}function vt(e){return e.length>0&&!s.isAbsolute(e)&&!e.split(/[\\/]+/).includes("..")}function Wt(e){return Object.fromEntries(["all","vscode","agents","copilot","cursor","claude","codex","orca"].map(r=>[r,{enabled:e.targets.includes("all")||e.targets.includes(r),outputs:e.outputs.filter(n=>n.targets.includes(r)).map(n=>n.path).sort()}]))}async function jt(e,t){try{if(!await f$3.pathExists(e))return {payload:null,exists:false,validity:"missing"};let r=await f$3.readJson(e),n=it(r);return n?a$1(t)?(b$3(t,n,e),{payload:n,exists:true,validity:"valid"}):{payload:n,exists:true,validity:"uncontracted"}:{payload:null,exists:true,validity:"invalid",validationError:"Artifact root must be a JSON object"}}catch(r){return {payload:null,exists:true,validity:"invalid",validationError:r instanceof Error?r.message:String(r)}}}async function Je(e){let t=e.now??new Date,r=e.staleAfterHours??24,n=[],l=[];for(let i of $){let b=await f(e.workspacePath,i.relativePath)??s.join(e.workspacePath,i.relativePath),R=await jt(b,i.relativePath),k=R.payload;R.validity==="invalid"?l.push(`Invalid evidence contract: ${i.relativePath}`):k&&l.push(...St(k)),n.push({path:i.relativePath,label:i.label,required:i.required,exists:R.exists,validity:R.validity,validationError:R.validationError,generatedAt:k?Ct(k):void 0,commandId:typeof k?.commandId=="string"?k.commandId:void 0,exitCode:typeof k?.exitCode=="number"?k.exitCode:void 0});}let p=[...new Set(l.map(i=>i.trim()).filter(Boolean))].slice(0,16),u=b$2();return {schemaVersion:wt,generatedAt:t.toISOString(),workspaceRoot:e.workspacePath,intelligenceChain:{schemaVersion:u.schemaVersion,contractPath:u.contractPath,currentStep:"agent-sync"},readOrder:Rt(),blockers:p,staleAfterHours:r,reports:n,refreshCommand:A("workspace agent-sync --write --refresh-context")}}function Xe(e){let t=["# Workspai agent grounding","","Cross-tool instructions for Copilot, Cursor, Claude Code, Codex, Grok, and other agents.","","## Read order (mandatory before workspace diagnosis)","",`1. \`${a.agentIndex}\` \u2014 latest blockers, timestamps, and report paths`,`2. \`${a.agentContext}\` \u2014 canonical agent context pack`,"3. Evidence artifacts listed in the index (doctor, analyze, pipeline, readiness, impact, verify)","","Do **not** full-repo scan until these reports are read or regenerated.","","## Regenerate intelligence","","```bash",A("workspace agent-sync --write --refresh-context"),A("workspace context --for-agent --json --write"),A("pipeline --json --write"),"```",""];if(e.index.blockers.length>0){t.push("## Current blockers","");for(let r of e.index.blockers.slice(0,12))t.push(`- ${r}`);t.push("");}if(e.context?.safeCommands?.length){t.push("## Safe commands (prefer these)","");for(let r of e.context.safeCommands.slice(0,10))t.push(`- \`${r.display}\` \u2014 ${r.description}`);t.push("");}return t.push("## Rules","","- Treat `.workspai/reports/*` as the source of truth for health, gates, and release posture.","- Prefer deterministic Workspai CLI commands over heuristic framework guesses.","- If evidence is missing or stale, run the refresh commands above before proposing fixes.","- Keep project-scoped advice aligned with the active project named in the context pack.",""),t.join(`
9
+ `)}function Nt(e){return ["# Workspai agent grounding","",`Generated: ${e.generatedAt}`,"",`This file is tool-agnostic. Synced agents should read it together with \`${a.agentIndex}\`.`,"","## Mandatory read order","",...e.readOrder.map((t,r)=>`${r+1}. \`${t}\``),"",e.blockers.length>0?"## Blockers":"",...e.blockers.length>0?e.blockers.map(t=>`- ${t}`):[],"","## Refresh","","```bash",e.refreshCommand,"```",""].filter(t=>t!=="").join(`
10
+ `)}function Lt(){return ["# Workspai workspace grounding","","Before answering workspace, release, or architecture questions:","","1. Read `AGENTS.md` (managed Workspai section).",`2. Read \`${a.agentIndex}\` and \`${a.agentContext}\`.`,"3. Use evidence reports before scanning the full repository.","","Regenerate stale intelligence:","","```bash",A("workspace agent-sync --write --refresh-context"),"```",""].join(`
11
+ `)}function Gt(){return ["## Claude Code","",`- Load \`${a.agentIndex}\` before diagnosing blockers.`,"- Use `.claude/rules/workspai-evidence.md` for scoped Workspai evidence rules.","- Treat `.claude/rules/rapidkit-evidence.md` as a legacy compatibility mirror.","- Refresh grounding with `npx workspai workspace agent-sync --write`.",""].join(`
12
+ `)}function Ze(){return ["---","description: Workspai workspace evidence and intelligence grounding","globs: []","alwaysApply: true","---","","Before proposing fixes in this workspace:","",`1. Read \`${a.agents}\` and \`${a.agentIndex}\`.`,`2. Read \`${a.agentContext}\`.`,"3. Prefer evidence in `.workspai/reports/*` over full-repo exploration.","","Refresh when stale:","","```bash",A("workspace agent-sync --write --refresh-context"),"```",""].join(`
13
+ `)}function Qe(){return ["---",'applyTo: ".workspai/**,**/.workspai/**,.rapidkit/**,**/.rapidkit/**"',"description: Workspai evidence and intelligence artifacts","---","","When working under `.workspai/` or legacy `.rapidkit/`:","","- Treat `.workspai/reports/*` JSON reports as canonical gate and health evidence.",`- Start from \`${a.agentIndex}\` for read order and blockers.`,"- Do not invent pass/fail state \u2014 cite `exitCode`, `blockers`, and `generatedAt` fields.",""].join(`
14
+ `)}function et(){return ["---",'applyTo: "**"',"description: Workspai workspace scope, evidence, and command discipline","---","","# Workspai Workspace Intelligence","","Use Workspai reports as the workspace source of truth before giving architectural, repair, release, or project lifecycle advice.","","## Scope rules","",`- Start from \`${a.agentIndex}\` and \`${a.agentContext}\`.`,"- Distinguish workspace-level blockers from project-level blockers.","- When a project is active, cite its name, path, framework, and evidence source.","- Do not translate unsupported stack requests into unrelated native kits.","","## Answer contract","","Return answers with: Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.",""].join(`
15
+ `)}function tt(){return ["# Workspai evidence","","Applies when reading or editing `.workspai/reports/*`.","","- Start from `INDEX.json`, then `workspace-context-agent.json`.","- Use report blockers as the primary fix target.","- Regenerate with `npx workspai workspace agent-sync --write`.",""].join(`
16
+ `)}function rt(){return ["---","description: Diagnose Workspai workspace blockers from evidence reports","---","","Diagnose this workspace using Workspai evidence only.","","Read:","",`- \`${a.agentIndex}\``,`- \`${a.agentContext}\``,"- Any fail/warn reports referenced in the index","","Return:","","1. Root cause grounded in report blockers","2. Smallest safe fix path (commands + file edits)","3. One verification command to prove recovery",""].join(`
17
+ `)}function Q(e){return ["---",`description: ${e.description}`,"---","",e.objective,"","Read first:","",`- \`${a.agentIndex}\``,`- \`${a.agentContext}\``,"- Any report referenced by the current blocker or task","","Return:","",...e.expectedOutput.map((t,r)=>`${r+1}. ${t}`),"","Use the standard Workspai answer contract: Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.",""].join(`
18
+ `)}function _(e){return ["# "+e.title,"",...e.lines,""].join(`
19
+ `)}function Dt(){return _({title:"MCP Tool Design",lines:["Workspai MCP is a future read-mostly bridge. Use the CLI reports today; do not assume a running MCP server exists.","","Candidate read tools:",`- \`getWorkspaceModel\` \u2014 read \`${a.model}\`.`,`- \`getEvidenceIndex\` \u2014 read \`${a.agentIndex}\`.`,"- `getBlockers` \u2014 derive current blockers from INDEX and gate reports.","- `getSafeCommands` \u2014 read safe commands from `workspace-context-agent.json`.","- `getProjectContext` \u2014 return one project-scoped slice of the workspace model.","- `getArtifact` \u2014 read one explicit artifact path inside the workspace root.",`- \`listOperationalSkills\` \u2014 read \`${a.skillsIndex}\`.`,"- `getWorkspaceExplain` \u2014 read/build workspace explain for release-blocked or project scope.","- `refreshWorkspaceIntelligence` \u2014 explicit user-approved refresh command only.","","Write or repair tools require explicit approval boundaries and are intentionally not part of the first read-mostly design."]})}function $t(e){return `${JSON.stringify({schemaVersion:"workspai-mcp-design.v1",generatedAt:e.generatedAt,workspaceRoot:e.workspacePath,status:"design-only",mode:"read-mostly",safety:{writeToolsEnabled:false,approvalRequiredForRefresh:true,artifactReadsMustStayInsideWorkspace:true},candidateTools:[{name:"getWorkspaceModel",reads:[a.model],mutates:false},{name:"getEvidenceIndex",reads:[a.agentIndex],mutates:false},{name:"getBlockers",reads:[a.agentIndex,a.verify,".workspai/reports/pipeline-last-run.json"],mutates:false},{name:"getSafeCommands",reads:[a.agentContext],mutates:false},{name:"getProjectContext",reads:[a.model,a.agentContext],mutates:false},{name:"getArtifact",reads:["requested workspace-relative artifact path"],mutates:false},{name:"listOperationalSkills",reads:[a.skillsIndex],mutates:false},{name:"getWorkspaceExplain",reads:[a.explain,a.verify,a.impact],mutates:false},{name:"refreshWorkspaceIntelligence",command:A("workspace agent-sync --write --refresh-context"),mutates:true,approvalRequired:true}]},null,2)}
20
+ `}function Ht(e){return `${JSON.stringify({schemaVersion:"workspai-agent-hooks.v1",generatedAt:e.generatedAt,workspaceRoot:e.workspacePath,enabledByDefault:false,mode:"advisory",hooks:[{name:"workspai-pre-tool-use-workspace-boundary",event:"PreToolUse",purpose:"Block or warn on state-changing commands outside the active workspace root.",defaultAction:"warn",rules:["Allow read-only commands.","Warn before write/delete commands outside workspaceRoot.","Never run destructive commands without explicit user approval."]},{name:"workspai-post-tool-use-verify-suggestion",event:"PostToolUse",purpose:"Suggest non-destructive verification commands after edits.",defaultAction:"suggest",commands:[A("doctor workspace"),A("workspace verify --strict --json")]},{name:"workspai-user-prompt-submit-scope-hint",event:"UserPromptSubmit",purpose:"Inject lightweight workspace scope and evidence index hints.",defaultAction:"inject-context-hint",reads:[a.agentIndex,a.agentContext]}]},null,2)}
21
+ `}function nt(e){let t=["---","name: workspai-workspace-intelligence","description: Use Workspai workspace intelligence reports to answer, repair, verify, and release with evidence","---","","# Workspai Workspace Intelligence","","Use this skill for workspace architecture, project lifecycle, blocker repair, release readiness, agent grounding, and CI evidence questions.","","## Decision flow","","1. Load `resources/scope-model.md`.",`2. Load \`${a.agentIndex}\`.`,`3. Load \`${a.agentContext}\`.`,`4. Load \`${a.skillsIndex}\` when operational playbooks are needed.`,"5. Load the smallest evidence report required for the task.","6. Answer with Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.","","## Rules","","- Prefer Workspai reports over full-repo scans.","- Never claim a gate passed without a cited report.","- Separate display commands from execution requests.","- Keep project-scoped fixes inside the active project unless workspace evidence says otherwise.",""];return e?.trim()&&t.push(e.trim(),""),t.join(`
22
+ `)}function ee(e){return ["---",`name: ${e.name}`,`description: ${e.description}`,`tools: [${e.tools.map(t=>`'${t}'`).join(", ")}]`,"---","",`You are the ${e.name} agent for Workspai Workspace Intelligence.`,"",`Mode: ${e.mode}.`,"",`Start every task by reading \`${a.agentIndex}\` and \`${a.agentContext}\`.`,"","Use this answer contract:","","- Scope","- Evidence","- Diagnosis","- Fix Plan","- Run","- Verify","- Assumptions","","Do not invent health, readiness, or policy status. Cite report paths and command outputs.",""].join(`
23
+ `)}function ot(){return ["---","name: workspai-grounding","description: Load Workspai workspace intelligence reports before diagnosing or changing code","---","","# Workspai grounding","","Use when the user asks about workspace health, release gates, doctor/pipeline failures, or project structure.","","## Workflow","",`1. Read \`${a.agentIndex}\``,`2. Read \`${a.agentContext}\``,"3. Read fail/warn evidence artifacts listed in the index","4. Propose the smallest safe fix with explicit verification commands","","## Refresh stale evidence","","```bash",A("workspace agent-sync --write --refresh-context"),"```",""].join(`
24
+ `)}async function d(e,t,r){return r?(await f$3.ensureDir(s.dirname(e)),await f$3.writeFile(e,t,"utf8"),"written"):"skipped"}async function ye(e){if(!e.write)return "skipped";let t=await f$3.pathExists(e.absolutePath)?await f$3.readFile(e.absolutePath,"utf8"):null,{upsertManagedAgentSection:r}=await import('./managed-agent-markers-AXUM75OE.js'),n=r(t,e.generatedBody),l=e.preamble?`${e.preamble.trimEnd()}
25
+
26
+ ${n}`:n;return await f$3.ensureDir(s.dirname(e.absolutePath)),await f$3.writeFile(e.absolutePath,l,"utf8"),"written"}function br(e){if(!e?.trim())return;let t=new Set(["all","vscode","agents","copilot","cursor","claude","codex","orca"]),r=e.split(",").map(n=>n.trim().toLowerCase()).filter(n=>t.has(n));return r.length>0?r:void 0}function Mt(e){let t=[...e.outputs].sort((n,l)=>n.path.localeCompare(l.path)),r=b$2();return {schemaVersion:Pt,generatedAt:e.generatedAt,workspaceRoot:e.workspacePath,preset:e.preset,targets:[...e.targets].sort(),sourceReports:e.index.reports.filter(n=>n.exists).map(n=>n.path).sort(),intelligenceChain:{schemaVersion:r.schemaVersion,contractPath:r.contractPath,currentStep:"agent-sync"},outputInventory:t,capabilityMatrix:Wt({targets:e.targets,outputs:t}),drift:{missingRequired:e.missingRequired,staleReports:e.staleReports,strictViolations:e.strictViolations},answerContract:["Scope","Evidence","Diagnosis","Fix Plan","Run","Verify","Assumptions"],refreshCommand:A(`workspace agent-sync --write --refresh-context --preset ${e.preset}`),experimental:{hooksEnabled:e.experimentalHooks,mcpReady:t.some(n=>n.kind==="mcp-design")}}}async function Tr(e$1){let t$1=s.resolve(e$1.workspacePath),r$1=new Date,n$2=e$1.staleAfterHours??24,l$1=It(e$1.targets),p$1=[...l$1].sort(),u$1=Ot(e$1.preset),i$1=e$1.write===true,b=e$1.strict===true,R,k$1=null,re;e$1.refreshContext&&(re=await n({workspacePath:t$1,includeEvidence:true}),k$1=await e({workspacePath:t$1,model:re,agent:e$1.agent??"generic",scope:e$1.scope,includeEvidence:true}),i$1&&(R=await f$1(k$1,t$1)));let S=await Je({workspacePath:t$1,staleAfterHours:n$2,now:r$1}),T=[],ne=[],oe=[],ie=[],c=(a,m)=>{a==="written"?ne.push(m):oe.push(m),ie.push({path:m,kind:Et(m),targets:_t(m),required:bt(m,u$1),status:a==="written"?"written":e$1.dryRun?"planned":"skipped"});};c(await d(s.join(t$1,te),`${JSON.stringify(S,null,2)}
27
+ `,i$1),te),c(await d(s.join(t$1,f$2),`${Nt(S)}
28
+ `,i$1),f$2);let se="",st=await Tt(t$1,re),ae=null;try{ae=(await j({workspacePath:t$1})).contract;}catch{ae=null;}let at=Ue({model:st,context:k$1,contract:ae}),ce=await ze({workspacePath:t$1,skills:at,generatedAt:r$1.toISOString(),write:i$1});for(let a of ce.skills)c(i$1?"written":"skipped",a.canonicalPath);if(c(i$1?"written":"skipped",b$1),se=Fe(ce.index),(P(l$1,"agents")||P(l$1,"vscode"))&&c(await ye({absolutePath:s.join(t$1,"AGENTS.md"),generatedBody:Xe({index:S,context:k$1}),write:i$1}),"AGENTS.md"),P(l$1,"claude")){let a=s.join(t$1,"CLAUDE.md");if(i$1){let{upsertManagedAgentSection:m}=await import('./managed-agent-markers-AXUM75OE.js'),g=await f$3.pathExists(a)?await f$3.readFile(a,"utf8"):"",h=m(g,Gt()),C=h.includes("@AGENTS.md")?h:`@AGENTS.md
29
+
30
+ ${h}`;await f$3.ensureDir(s.dirname(a)),await f$3.writeFile(a,C,"utf8"),ne.push("CLAUDE.md");}else oe.push("CLAUDE.md");c(await d(s.join(t$1,j$1),`${tt()}
31
+ `,i$1),j$1),c(await d(s.join(t$1,k),`${tt()}
32
+ `,i$1),k);}if(P(l$1,"cursor")&&(c(await d(s.join(t$1,h),Ze(),i$1),h),c(await d(s.join(t$1,i),Ze(),i$1),i)),yt(l$1)){if(c(await ye({absolutePath:s.join(t$1,".github/copilot-instructions.md"),generatedBody:Lt(),write:i$1}),".github/copilot-instructions.md"),c(await d(s.join(t$1,l),et(),i$1),l),c(await d(s.join(t$1,m),et(),i$1),m),c(await d(s.join(t$1,n$1),Qe(),i$1),n$1),c(await d(s.join(t$1,o),Qe(),i$1),o),c(await d(s.join(t$1,p),rt(),i$1),p),c(await d(s.join(t$1,q),rt(),i$1),q),u$1==="enterprise"){let a=[[r,Q({description:"Repair Workspai blockers with evidence and verification",objective:"Plan the smallest safe repair for the current Workspai blocker.",expectedOutput:["Blocker and affected workspace/project scope","Evidence paths and exact failing signals","Minimal fix plan","Human-run commands","Verification command and expected success signal"]})],[t,Q({description:"Assess Workspai release readiness from evidence",objective:"Assess whether this workspace is release-ready using Workspai gates.",expectedOutput:["Readiness verdict with cited reports","Blocking gates","Safe next command","Verification checklist"]})],[v,Q({description:"Onboard a project into Workspai Workspace Intelligence",objective:"Guide project onboarding using workspace model and create planner capabilities.",expectedOutput:["Target project scope","Native create, official generator, or existing lane","Safe commands","Post-onboarding verification"]})],[x,Q({description:"Adopt an existing project into Workspai governance",objective:"Adopt an existing project without changing its runtime behavior.",expectedOutput:["Detected stack and confidence","Adoption plan","Generated metadata expectations","Doctor and workspace model verification"]})]];for(let[g,h]of a)c(await d(s.join(t$1,g),h,i$1),g);let m=[[s$1,a[0][1]],[u,a[1][1]],[w,a[2][1]],[y,a[3][1]]];for(let[g,h]of m)c(await d(s.join(t$1,g),h,i$1),g);if(e$1.hydratePrompts===true)for(let g of await Be({workspacePath:t$1,skills:ce.skills,write:i$1}))c(i$1?"written":"skipped",g);}if(c(await d(s.join(t$1,z),ot(),i$1),z),c(await d(s.join(t$1,A$1),ot(),i$1),A$1),u$1==="enterprise"){c(await d(s.join(t$1,B),nt(se),i$1),B),c(await d(s.join(t$1,C),nt(se),i$1),C);let a=[["artifact-map.md",_({title:"Artifact Map",lines:$.map(g=>`- \`${g.relativePath}\` \u2014 ${g.label}`)})],["command-map.md",_({title:"Command Map",lines:["- `npx workspai workspace agent-sync --write --refresh-context` \u2014 refresh agent grounding.","- `npx workspai workspace model --json --write` \u2014 refresh workspace model.","- `npx workspai doctor workspace` \u2014 refresh health evidence.","- `npx workspai workspace verify --strict --json` \u2014 verify release gates."]})],["scope-model.md",_({title:"Scope Model",lines:["- Workspace scope is the default source of truth.","- Project scope is selected only when the active task targets a specific project.","- Always name the workspace and project when giving repair or lifecycle advice."]})],["runtime-support.md",_({title:"Runtime Support",lines:["- Native create is available only for Workspai-owned scaffold contracts.","- Unsupported stacks should use the official lane when a stable ecosystem generator exists.","- Existing projects should use the existing lane when native create is unavailable."]})],["create-planner-capabilities.md",_({title:"Create Planner Capabilities",lines:["- Use `contracts/create-planner-capabilities.v1.json` to decide native, official, or existing.","- Do not map PHP, WordPress, Laravel, Rails, or Symfony requests to unrelated native kits.","- Explain unsupported native create requests and guide users to adopt/import."]})],["mcp-tools.md",Dt()]];for(let[g,h]of a){let C$1=`${s.dirname(B)}/resources/${g}`;c(await d(s.join(t$1,C$1),h,i$1),C$1);let Ee=`${s.dirname(C)}/resources/${g}`;c(await d(s.join(t$1,Ee),h,i$1),Ee);}let m=[["workspai-advisor.agent.md",ee({name:"Workspai Advisor",description:"Read-only workspace and project guidance using Workspai evidence",mode:"read-only",tools:["search","read"]})],["workspai-repair.agent.md",ee({name:"Workspai Repair",description:"Turn Workspai blockers into minimal fixes and verification steps",mode:"repair",tools:["search","read","edit"]})],["workspai-release.agent.md",ee({name:"Workspai Release",description:"Assess readiness, governance gates, and release safety from evidence",mode:"release",tools:["search","read"]})],["workspai-project-onboarder.agent.md",ee({name:"Workspai Project Onboarder",description:"Guide create, import, and adopt flows with Workspai contracts",mode:"onboard",tools:["search","read","edit"]})]];for(let[g,h]of m){let C=`.github/agents/${g}`;c(await d(s.join(t$1,C),h,i$1),C);}}}if(u$1==="enterprise"){let a=$t({workspacePath:t$1,generatedAt:S.generatedAt});b$3(D,JSON.parse(a)),c(await d(s.join(t$1,D),a,i$1),D),c(await d(s.join(t$1,E),a,i$1),E);}if(u$1==="enterprise"&&e$1.experimentalHooks===true){let a=Ht({workspacePath:t$1,generatedAt:S.generatedAt});b$3(F,JSON.parse(a)),c(await d(s.join(t$1,F),a,i$1),F),c(await d(s.join(t$1,G),a,i$1),G);}(P(l$1,"codex")||P(l$1,"orca"))&&(P(l$1,"agents")||c(await ye({absolutePath:s.join(t$1,"AGENTS.md"),generatedBody:Xe({index:S,context:k$1}),write:i$1}),"AGENTS.md"));let le=i$1?await Je({workspacePath:t$1,staleAfterHours:n$2,now:r$1}):S,H=le.reports.filter(a=>a.required&&!a.exists).map(a=>a.path),M=le.reports.filter(a=>a.exists&&xt(a.generatedAt,n$2,r$1)).map(a=>a.path);if(b){H.length>0&&T.push(`Missing required reports: ${H.join(", ")}`),M.length>0&&T.push(`Stale reports (>${n$2}h): ${M.join(", ")}`);let a=ie.map(m=>m.path).filter(m=>!vt(m));a.length>0&&T.push(`Unsafe generated output paths: ${a.join(", ")}`);}let Oe=Mt({workspacePath:t$1,generatedAt:r$1.toISOString(),preset:u$1,targets:p$1,index:le,outputs:[...ie,{path:Z,kind:"report",targets:["agents","vscode","copilot","codex","orca"],required:true,status:i$1?"written":e$1.dryRun?"planned":"skipped"}],missingRequired:H,staleReports:M,strictViolations:T,experimentalHooks:e$1.experimentalHooks===true});return c(await d(s.join(t$1,Z),`${JSON.stringify(Oe,null,2)}
33
+ `,i$1),Z),{workspacePath:t$1,indexPath:s.join(t$1,te),packPath:s.join(t$1,Z),pack:Oe,contextPath:R,writtenFiles:ne,skippedFiles:oe,blockers:S.blockers,missingRequired:H,staleReports:M,strictViolations:T}}export{lt as a,pt as b,wt as c,Pt as d,te as e,Z as f,$ as g,Rt as h,Je as i,br as j,Tr as k,At as l};
@@ -0,0 +1 @@
1
+ var i="workspai-workspace-archive-capabilities-v1",r="workspai-workspace-archive-manifest-v1",s="workspai-workspace-archive-operation-result-v1";var a="contracts/workspace-archive-manifest.v1.json",o="contracts/workspace-archive-operation-result.v1.json",n={archiveCompression:{signature:"--archive-compression <mode>",description:"Archive compression: store (default) or deflate",appliesTo:["export"]},maxDownloadSize:{signature:"--max-download-size <size>",description:"Optional maximum remote archive download size (for example 8gb)",appliesTo:["inspect","verify","doctor","hydrate"]},maxExpandedSize:{signature:"--max-expanded-size <size>",description:"Optional maximum expanded archive payload size (for example 20gb)",appliesTo:["inspect","verify","doctor","hydrate"]},downloadTimeoutMs:{signature:"--download-timeout-ms <ms>",description:"Remote archive download timeout in milliseconds; 0 disables it",appliesTo:["inspect","verify","doctor","hydrate"]}};export{i as a,r as b,s as c,a as d,o as e,n as f};
@@ -0,0 +1,4 @@
1
+ import {f as f$1,e}from'./chunk-T3GJ7YVG.js';import {a,b}from'./chunk-22DT744Z.js';import {c as c$1}from'./chunk-2QOWRBQD.js';import {d as d$1,e as e$1,g,f as f$2,i}from'./chunk-7UZVOYF5.js';import {b as b$2,c,g as g$1}from'./chunk-6AA3WWQZ.js';import {b as b$1,a as a$1}from'./chunk-5AKYMAIL.js';import {o}from'./chunk-5XATWNME.js';import d from'chalk';import l from'fs';import p from'path';var _="workspai-cli-operation-result-v1";function ie(e,t,s){return {schemaVersion:_,operation:e,status:"success",exitCode:0,artifact:t,...s?{outputPath:s}:{}}}function oe(e){return {schemaVersion:_,operation:e.operation,status:"error",exitCode:e.exitCode??1,error:{code:e.code,message:e.message},...e.context?{context:e.context}:{},...e.examples?{examples:e.examples}:{},...e.nextActions?{nextActions:e.nextActions}:{}}}var M=a$1.readiness,q=b$1.readiness;function H(e,t){let s=p.resolve(e);if(!b(s))return s;let r=z(t,"workspace.contract.json");if(l.existsSync(r))try{let o=JSON.parse(l.readFileSync(r,"utf-8")),n=Array.isArray(o.projects)?o.projects:[];for(let a of n){let u=f(a),v=typeof u.relativePath=="string"?u.relativePath.trim():"";if(v)return p.join(t,v)}}catch{}let i=T(t),c=Array.isArray(i.payload?.projects)?i.payload.projects:[];for(let o of c){let n=f(o),a=typeof n.path=="string"?n.path.trim():"";if(a)return p.resolve(a)}return s}function K(e){let t=d$1(e);return e$1(t,e)?"go":g(t,e)?"java":f$2(t,e)?"node":i(t,e)?"python":"unknown"}function $(e,t){if(!l.existsSync(e))return null;let s=l.readdirSync(e).filter(r=>r.endsWith(".json")&&t.some(i=>i.test(r))).map(r=>p.join(e,r));return s.length===0?null:(s.sort((r,i)=>l.statSync(i).mtimeMs-l.statSync(r).mtimeMs),s[0])}function f(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function W(e){for(let t of e)if(l.existsSync(t))return t;return null}function z(e,...t){let s=o(e,...t);return W(s)??s[0]}function S(e,t){let s=c(e,`.workspai/reports/${t}`);return W([s,p.join(e,".rapidkit","reports",t)])??s}async function U(e){let{readWorkspaceRegistrySummary:t,resolveWorkspaceRegisteredProjects:s}=await import('./workspace-registry-summary-JM2XY52C.js'),r=await t(e);return r?r.projectCount:(await s(e)).summary.projectCount}function B(e,t,s){let r=z(e,"toolchain.lock");if(!l.existsSync(r))return {gate:"env",status:"fail",summary:"toolchain.lock is missing",details:["Run workspai bootstrap to pin runtime versions and generate a reproducible toolchain."],evidencePath:r};try{let i=JSON.parse(l.readFileSync(r,"utf-8")),c=f(i.runtime),n=["python","node","go","java"].filter(a=>{let u=f(c[a]);return typeof u.version=="string"&&u.version.trim().length>0});if(n.length===0)return {gate:"env",status:"fail",summary:"No runtime versions are pinned in toolchain.lock",details:["Pin at least one runtime version via workspai setup <runtime> and re-run bootstrap."],evidencePath:r};if(t!=="unknown"){let a=f(c[t]);if(typeof a.version!="string"||a.version.trim().length===0)return {gate:"env",status:"fail",summary:`${s?.hasRegisteredProjects?"Project runtime":"Workspace"} (${t}) is not pinned in toolchain.lock`,details:[`Run workspai setup ${t} and workspai bootstrap to lock ${t} for this workspace.`],evidencePath:r}}return {gate:"env",status:"pass",summary:`Pinned runtimes: ${n.join(", ")}`,details:[],evidencePath:r}}catch{return {gate:"env",status:"fail",summary:"toolchain.lock is invalid JSON",details:["Regenerate lockfile with workspai bootstrap."],evidencePath:r}}}function T(e){let t=S(e,"doctor-last-run.json");if(!l.existsSync(t))return {payload:null,path:t};try{let s=JSON.parse(l.readFileSync(t,"utf-8"));return c$1(s,"workspace")?{payload:s,path:t}:{payload:null,path:t}}catch{return {payload:null,path:t}}}function Q(e){let t=T(e);if(!t.payload)return {gate:{gate:"doctor",status:"fail",summary:"Doctor evidence is missing",details:["Run workspai doctor workspace --json before release readiness checks."],evidencePath:t.path},payload:null};let s=f(t.payload.summary),r=Number(s.totalIssues??0);return s.hasSystemErrors?{gate:{gate:"doctor",status:"fail",summary:"Doctor reported system errors",details:["Resolve system-level doctor errors before proceeding."],evidencePath:t.path},payload:t.payload}:r>0?{gate:{gate:"doctor",status:"warn",summary:`Doctor found ${r} issue(s)`,details:["Run workspai doctor workspace --fix and re-run readiness checks."],evidencePath:t.path},payload:t.payload}:{gate:{gate:"doctor",status:"pass",summary:"Doctor checks passed without issues",details:[],evidencePath:t.path},payload:t.payload}}function X(e){let t=S(e,"analyze-last-run.json");if(!l.existsSync(t))return {gate:"analyze",status:"fail",summary:"Analyze evidence is missing",details:["Run workspai analyze --json before release readiness checks."],evidencePath:t};try{let s=JSON.parse(l.readFileSync(t,"utf-8"));b$2(a$1.analyze,s,t);let r=f(s.summary),i=String(r.verdict??"").toLowerCase(),c=Number(r.score??0),o=f(r.findings),n=Number(o.fail??0);return i==="blocked"||n>0?{gate:"analyze",status:"fail",summary:`Analyze verdict is blocked (score ${c}/100)`,details:["Resolve analyze findings and regenerate analyze-last-run.json."],evidencePath:t}:i==="needs-attention"?{gate:"analyze",status:"warn",summary:`Analyze needs attention (score ${c}/100)`,details:["Review analyze warnings before release."],evidencePath:t}:{gate:"analyze",status:"pass",summary:`Analyze passed (score ${c}/100)`,details:[],evidencePath:t}}catch{return {gate:"analyze",status:"fail",summary:"Analyze evidence is invalid or violates its contract",details:["Re-run workspai analyze --json to regenerate evidence."],evidencePath:t}}}function Y(e){try{let t=JSON.parse(l.readFileSync(e,"utf-8")),s=String(t.status??"").toLowerCase(),r=f(t.summary),i=Number(r.failedChecks??0);return s==="fail"||i>0?{gate:"verify",status:"fail",summary:"Verify-pack contract reports failed checks",details:["Fix failed verify checks and regenerate verify-pack contract evidence."],evidencePath:e}:s==="pass"?{gate:"verify",status:"pass",summary:"Verify-pack contract passed",details:[],evidencePath:e}:{gate:"verify",status:"warn",summary:"Verify-pack contract status is not explicit",details:["Ensure contract status is pass/fail and keep schema aligned with v1 contract."],evidencePath:e}}catch{return {gate:"verify",status:"fail",summary:"Verify-pack contract is invalid JSON",details:["Regenerate verify-pack contract artifact."],evidencePath:e}}}async function Z(e,t){if(t.skipVerify)return {gate:"verify",status:"pass",summary:"Verify gate skipped (--skip-verify)",details:["Verification was explicitly skipped for this readiness run."]};let s=[c(e,".workspai/reports"),p.join(e,".rapidkit","reports")],r=s[0],i=s.map(n=>$(n,[/verify-pack-contract/i,/^verify.*\.json$/i])).find(n=>typeof n=="string")??null;if(i)return Y(i);let c$1=c(e,a$1.contractVerify),o=s.map(n=>$(n,[/workspace-contract-verify-last-run/i,/workspace-contract-verify/i])).find(n=>typeof n=="string")??null;if(o)try{let n=JSON.parse(l.readFileSync(o,"utf-8")),a=String(n.status??"").toLowerCase();if(a==="passed"||a==="pass")return {gate:"verify",status:"pass",summary:"Workspace contract verification passed (CLI cache)",details:[],evidencePath:o};if(a==="failed"||a==="fail")return {gate:"verify",status:"fail",summary:"Workspace contract verification failed (CLI cache)",details:(Array.isArray(n.violations)?n.violations:[]).slice(0,5),evidencePath:o}}catch{}try{let{verifyWorkspaceContract:n}=await import('./workspace-contract-LQJDZV36.js'),a=await n({workspacePath:e}),u={schemaVersion:"v1",source:"cli",generatedAt:new Date().toISOString(),status:a.status,contractPath:a.contractPath,projectCount:a.projectCount,checks:a.checks,violations:a.violations};return await g$1(e,a$1.contractVerify,u),a.status==="failed"?{gate:"verify",status:"fail",summary:"Workspace contract verification failed (CLI)",details:a.violations.slice(0,5),evidencePath:c$1}:{gate:"verify",status:"pass",summary:"Workspace contract verification passed (CLI)",details:[],evidencePath:c$1}}catch(n){return {gate:"verify",status:"fail",summary:"No verify evidence and workspace contract verification unavailable",details:["Run workspai workspace contract verify --json or export verify-pack contract from CI.",n instanceof Error?n.message:String(n)],evidencePath:p.join(r,"*verify*.json")}}}function ee(e,t){let s=S(t,"doctor-last-run.json");if(!e)return {gate:"dependency",status:"warn",summary:"Dependency risk check skipped (doctor evidence missing)",details:["Run workspai doctor workspace --json to include dependency findings."],evidencePath:s};let r=Array.isArray(e.projects)?e.projects:[],i=r.reduce((o,n)=>{let a=Number(n.vulnerabilities??0);return Number.isFinite(a)?o+Math.max(0,a):o},0),c=r.filter(o=>o.depsInstalled===false).length;return i>0?{gate:"dependency",status:"fail",summary:`${i} dependency vulnerability(ies) reported`,details:["Resolve vulnerabilities (npm/pip/go audit pipelines) before release."],evidencePath:s}:c>0?{gate:"dependency",status:"warn",summary:`${c} project(s) report missing dependencies`,details:["Run project init/bootstrap and regenerate doctor evidence."],evidencePath:s}:{gate:"dependency",status:"pass",summary:"No dependency vulnerabilities reported",details:[],evidencePath:s}}function te(e){return e.some(t=>t.status==="fail")?"fail":e.some(t=>t.status==="warn")?"warn":"pass"}async function se(e,t){return g$1(e,M,t)}async function re(e$1={}){let t=p.resolve(e$1.startPath??process.cwd()),s=a(t)??t,r=await U(s)>0,i=r&&b(t)?s:H(t,s),c=i===s?"unknown":K(i),n=B(s,r?c:"unknown",{hasRegisteredProjects:r}),a$1=Q(s),u=X(s),v=await Z(s,{skipVerify:e$1.skipVerify}),D=ee(a$1.payload,s),k=[n,a$1.gate,u,v,D],h=te(k),m={schemaVersion:q,generatedAt:new Date().toISOString(),workspacePath:s,projectPath:i,action:e$1.action,overallStatus:h,blocking:h==="fail",blockingReasons:k.filter(y=>y.status==="fail").map(y=>`${y.gate}: ${y.summary}`),gates:k};if(e$1.writeReport!==false){let y=f$1(m,{commandId:"workspaceReadiness",exitCode:h==="fail"?2:h==="warn"?1:0,generatedAt:m.generatedAt,blockers:m.blockingReasons,runId:e()});m.evidencePath=await se(s,y);}return m}function ne(e){return e==="pass"?d.green("PASS"):e==="warn"?d.yellow("WARN"):d.red("FAIL")}function ae(e){return e==="pass"?d.green("PASS"):e==="warn"?d.yellow("WARN"):d.red("FAIL")}async function we(e){let t=await re({startPath:e.workspace,writeReport:true,skipVerify:e.skipVerify===true});if(e.json)console.log(JSON.stringify(t,null,2));else {console.log(d.bold.cyan(`
2
+ \u{1F6A6} Workspai Release Readiness
3
+ `)),console.log(d.bold(`Workspace: ${d.cyan(p.basename(t.workspacePath))}`)),console.log(d.gray(`Path: ${t.workspacePath}`)),console.log(`Overall: ${ae(t.overallStatus)}`);for(let s of t.gates){console.log(` - ${s.gate}: ${ne(s.status)} ${s.summary}`);for(let r of s.details)console.log(d.gray(` ${r}`));s.evidencePath&&console.log(d.gray(` evidence: ${s.evidencePath}`));}t.evidencePath&&console.log(d.gray(`
4
+ Evidence saved: ${t.evidencePath}`));}e.strict&&t.overallStatus!=="pass"&&process.exit(1);}export{_ as a,ie as b,oe as c,re as d,we as e};
@@ -1,14 +1,13 @@
1
- import {f as f$1,e as e$2}from'./chunk-DOCPUNWS.js';import {b as b$2}from'./chunk-JHC6SCJC.js';import {e,g,f as f$2,b as b$4,c as c$3,d as d$2}from'./chunk-FDDDQMJ2.js';import {a as a$1,d,b as b$1}from'./chunk-GSWPGELT.js';import {c}from'./chunk-Y45WZR5N.js';import {f,c as c$2,e as e$3}from'./chunk-7YHK5NM3.js';import {a as a$2}from'./chunk-TQEMLBAG.js';import {b as b$3,j,i,l,h,s}from'./chunk-LZQNVH7D.js';import {b,a,c as c$1,d as d$1}from'./chunk-5XATWNME.js';import {promises}from'fs';import*as v from'fs-extra';import y from'path';import e$1 from'chalk';import {execa}from'execa';async function V(t,o={}){let n=y.resolve(t),s=o.workspaceName??y.basename(n);try{let{registerWorkspace:a}=await import('./workspace-DZHWB7BV.js');await a(n,s);}catch(a){o.silent||console.warn(e$1.gray(`Note: Could not register workspace in shared registry: ${a?.message??a}`));}try{let{syncWorkspaceContract:a}=await import('./workspace-contract-2TA27LGT.js'),l=await a({workspacePath:n});if(o.silent||console.log(e$1.gray(`\u2139\uFE0F Workspace intelligence synced (contract + registry summary, ${l.contract.projects.length} project(s)).`)),!o.silent&&l.verification.status!=="passed"){console.log(e$1.yellow("\u26A0\uFE0F Workspace contract verification reported issues."));for(let p of l.verification.violations)console.log(e$1.gray(` Violation: ${p}`));console.log(e$1.white(" Next: npx workspai workspace contract inspect"));}}catch(a){o.silent||console.warn(e$1.gray(`Note: Could not sync workspace intelligence layer: ${a?.message??a}`));}}function D(){return h()}async function B(t,o,n,s,a){let l=d(o,c(),n,a?.pythonEngine?{coreStatus:a.pythonEngine,...a.pythonEngineReason?{coreReason:a.pythonEngineReason}:{},...s?{pythonVersion:s}:{}}:void 0);s&&!a?.pythonEngine&&(l.metadata||(l.metadata={}),l.metadata.python={pythonVersion:s}),await b$1(t,l);}async function G(t){await v.outputFile(y.join(t,".gitignore"),`.venv/
1
+ import {f as f$1,e as e$2}from'./chunk-G3H5R3RR.js';import {b as b$2}from'./chunk-NHN4QXPP.js';import {e,g,f as f$2,b as b$4,c as c$3,d as d$3}from'./chunk-5PVEQ6CZ.js';import {d as d$1,b as b$1}from'./chunk-GSWPGELT.js';import {c}from'./chunk-Y45WZR5N.js';import {f,c as c$2,e as e$3}from'./chunk-7YHK5NM3.js';import {a as a$1}from'./chunk-TQEMLBAG.js';import {b as b$3,j,i,l,h,s}from'./chunk-2K3GYCPS.js';import {b,a,c as c$1,d as d$2}from'./chunk-5XATWNME.js';import {promises}from'fs';import*as v from'fs-extra';import d from'path';import e$1 from'chalk';import {execa}from'execa';async function V(t,o={}){let n=d.resolve(t),s=o.workspaceName??d.basename(n);try{let{registerWorkspace:a}=await import('./workspace-PLXOO6ST.js');await a(n,s);}catch(a){o.silent||console.warn(e$1.gray(`Note: Could not register workspace in shared registry: ${a?.message??a}`));}try{let{syncWorkspaceContract:a}=await import('./workspace-contract-LQJDZV36.js'),l=await a({workspacePath:n});if(o.silent||console.log(e$1.gray(`\u2139\uFE0F Workspace intelligence synced (contract + registry summary, ${l.contract.projects.length} project(s)).`)),!o.silent&&l.verification.status!=="passed"){console.log(e$1.yellow("\u26A0\uFE0F Workspace contract verification reported issues."));for(let p of l.verification.violations)console.log(e$1.gray(` Violation: ${p}`));console.log(e$1.white(" Next: npx workspai workspace contract inspect"));}}catch(a){o.silent||console.warn(e$1.gray(`Note: Could not sync workspace intelligence layer: ${a?.message??a}`));}}function D(){return h()}async function B(t,o,n,s,a){let l=d$1(o,c(),n,a?.pythonEngine?{coreStatus:a.pythonEngine,...a.pythonEngineReason?{coreReason:a.pythonEngineReason}:{},...s?{pythonVersion:s}:{}}:void 0);s&&!a?.pythonEngine&&(l.metadata||(l.metadata={}),l.metadata.python={pythonVersion:s}),await b$1(t,l);}async function G(t){await v.outputFile(d.join(t,".gitignore"),`.venv/
2
2
  __pycache__/
3
3
  *.pyc
4
4
  .env
5
- ${c$1}
6
- ${d$1}
5
+ ${d$2}
7
6
  ${b}/
8
7
 
9
- `,"utf-8");}async function $e(t){try{let o=await execa("git",["rev-parse","--show-toplevel"],{cwd:t,env:a$2()});return o.stdout.trim()?y.resolve(t,o.stdout.trim()):null}catch{return null}}async function J(t,o,n){if(await $e(t)){o.warn("Git initialization skipped because target is already inside a git worktree");return}o.start("Initializing git repository");try{await execa("git",["init"],{cwd:t,env:a$2()}),await execa("git",["add","."],{cwd:t,env:a$2()}),await execa("git",["commit","-m",n],{cwd:t,env:a$2()}),o.succeed("Git repository initialized");}catch{o.warn("Could not initialize git repository");}}async function Se(t,o){let n=o.replace(/[^a-z0-9-]/gi,"-").toLowerCase();await v.outputFile(y.join(t,"poetry.toml"),`[virtualenvs]
8
+ `,"utf-8");}async function Ae(t){try{let o=await execa("git",["rev-parse","--show-toplevel"],{cwd:t,env:a$1()});return o.stdout.trim()?d.resolve(t,o.stdout.trim()):null}catch{return null}}async function J(t,o,n){if(await Ae(t)){o.warn("Git initialization skipped because target is already inside a git worktree");return}o.start("Initializing git repository");try{await execa("git",["init"],{cwd:t,env:a$1()}),await execa("git",["add","."],{cwd:t,env:a$1()}),await execa("git",["commit","-m",n],{cwd:t,env:a$1()}),o.succeed("Git repository initialized");}catch{o.warn("Could not initialize git repository");}}async function $e(t,o){let n=o.replace(/[^a-z0-9-]/gi,"-").toLowerCase();await v.outputFile(d.join(t,"poetry.toml"),`[virtualenvs]
10
9
  in-project = true
11
- `,"utf-8"),await v.outputFile(y.join(t,"pyproject.toml"),`[tool.poetry]
10
+ `,"utf-8"),await v.outputFile(d.join(t,"pyproject.toml"),`[tool.poetry]
12
11
  name = "${n}"
13
12
  version = "0.1.0"
14
13
  description = "Workspai workspace"
@@ -22,7 +21,7 @@ rapidkit-core = "*"
22
21
  [build-system]
23
22
  requires = ["poetry-core"]
24
23
  build-backend = "poetry.core.masonry.api"
25
- `,"utf-8");}function Me(t,o,n,s,a){return JSON.stringify({schema_version:"1.0",workspace_name:t,workspai_version:c(),rapidkit_version:c(),created_at:new Date().toISOString(),created_by:"workspai",profile:s||"minimal",...a?.profileRequested?{profile_requested:a.profileRequested}:{},...a?.bootstrapNote?{bootstrap_note:a.bootstrapNote}:{},engine:{install_method:o,python_version:n||null,...a?.pythonEngine?{python_core:{status:a.pythonEngine,...a.pythonEngineReason?{reason:a.pythonEngineReason}:{}}}:{}}},null,2)}function De(t,o,n,s,a,l){return JSON.stringify({schema_version:"1.0",generated_by:"workspai",generated_at:new Date().toISOString(),runtime:{python:{version:o||null,install_method:t,...l?.pythonEngine?{core:{status:l.pythonEngine,...l.pythonEngineReason?{reason:l.pythonEngineReason}:{}}}:{}},node:{version:n||process.version},go:{version:s||null},java:{version:null,build_tool:null,build_tool_version:null},dotnet:{version:a||null,sdk:a||null}}},null,2)}function Te(){return `version: "1.0"
24
+ `,"utf-8");}function Se(t,o,n,s,a){return JSON.stringify({schema_version:"1.0",workspace_name:t,workspai_version:c(),rapidkit_version:c(),created_at:new Date().toISOString(),created_by:"workspai",profile:s||"minimal",...a?.profileRequested?{profile_requested:a.profileRequested}:{},...a?.bootstrapNote?{bootstrap_note:a.bootstrapNote}:{},engine:{install_method:o,python_version:n||null,...a?.pythonEngine?{python_core:{status:a.pythonEngine,...a.pythonEngineReason?{reason:a.pythonEngineReason}:{}}}:{}}},null,2)}function Me(t,o,n,s,a,l){return JSON.stringify({schema_version:"1.0",generated_by:"workspai",generated_at:new Date().toISOString(),runtime:{python:{version:o||null,install_method:t,...l?.pythonEngine?{core:{status:l.pythonEngine,...l.pythonEngineReason?{reason:l.pythonEngineReason}:{}}}:{}},node:{version:n||process.version},go:{version:s||null},java:{version:null,build_tool:null,build_tool_version:null},dotnet:{version:a||null,sdk:a||null}}},null,2)}function De(){return `version: "1.0"
26
25
  mode: warn # "warn" or "strict"
27
26
  dependency_sharing_mode: isolated # "isolated" or "shared-runtime-caches" or "shared-node-deps"
28
27
  # change profile (recommended): npx workspai bootstrap --profile polyglot
@@ -31,20 +30,20 @@ rules:
31
30
  enforce_workspace_marker: true
32
31
  enforce_toolchain_lock: false
33
32
  disallow_untrusted_tool_sources: false
34
- `}function Ne(){return `version: "1.0"
33
+ `}function Te(){return `version: "1.0"
35
34
  cache:
36
35
  strategy: shared # "shared" or "on-demand"
37
36
  prune_on_bootstrap: false
38
37
  self_heal: true
39
38
  verify_integrity: false
40
- `}async function Ke(){try{let{stdout:t}=await execa("go",["version"],{timeout:3e3,stdio:"pipe"}),o=t.match(/go(\d+\.\d+(?:\.\d+)?)/i);return o?o[1]:void 0}catch{return}}async function Oe(){try{let{stdout:t}=await execa("dotnet",["--version"],{timeout:3e3,stdio:"pipe"}),o=t.trim();return o.length>0?o:void 0}catch{return}}async function Q(t,o,n,s,a$1,l){let[p,u]=await Promise.all([Ke(),Oe()]),c=[{fileName:"workspace.json",content:Me(o,n,s,a$1,l)},{fileName:"toolchain.lock",content:De(n,s,process.version,p,u,l)},{fileName:"policies.yml",content:Te()},{fileName:"cache-config.yml",content:Ne()}];for(let h of c)await v.outputFile(y.join(t,a,h.fileName),h.content,"utf-8");}async function St(t,o){let{workspaceName:n=y.basename(t),installMethod:s="venv",pythonVersion:a$2,profile:l,writeMarker:p=true,writeGitignore:u=true,onlyIfMissing:c$2=true}=o||{},h=[],[m,g]=await Promise.all([Ke(),Oe()]),r=[{relPath:y.join(a,"workspace.json"),legacyRelPath:y.join(b,"workspace.json"),content:Me(n,s,a$2,l)},{relPath:y.join(a,"toolchain.lock"),legacyRelPath:y.join(b,"toolchain.lock"),content:De(s,a$2,process.version,m,g)},{relPath:y.join(a,"policies.yml"),legacyRelPath:y.join(b,"policies.yml"),content:Te()},{relPath:y.join(a,"cache-config.yml"),legacyRelPath:y.join(b,"cache-config.yml"),content:Ne()}];for(let i of r){let P=y.join(t,i.relPath),w=y.join(t,i.legacyRelPath),j=await v.pathExists(P),E=await v.pathExists(w);c$2&&j||(c$2&&E?(await v.copy(w,P),h.push(i.relPath)):(await v.outputFile(P,i.content,"utf-8"),h.push(i.relPath)));}if(p&&(!!!await a$1(t)||!c$2)){let P=d(n,c(),s);a$2&&(P.metadata||(P.metadata={}),P.metadata.python={pythonVersion:a$2}),await b$1(t,P),h.push(c$1);}if(u){let i=y.join(t,".gitignore");(!c$2||!await v.pathExists(i))&&(await G(t),h.push(".gitignore"));}return h}var We=new Set(["go-only","java-only","dotnet-only","node-only","minimal"]),Be={"python-only":"minimal",polyglot:"node-only",enterprise:"polyglot"};function Je(t){let o=t,n=new Set;for(;!We.has(o);){if(n.has(o))return "minimal";n.add(o);let s=Be[o];if(!s)return "minimal";o=s;}return o}var L="3.10",Fe=["3.10","3.11","3.12"];async function je(t){try{let{stdout:o}=await execa(t,["--version"],{timeout:3e3}),n=o.match(/Python (\d+\.\d+\.\d+)/);if(n)return n[1]}catch{}return null}async function Qe(t,o){try{await promises.writeFile(y.join(t,".python-version"),`${o}
41
- `,"utf-8"),f.debug(`Created .python-version with ${o}`);}catch(n){f.warn(`Failed to create .python-version: ${n}`);}}function U(){let n=[...(process.env.PATH||"").split(y.delimiter).filter(Boolean)];for(let s$1 of s())n.includes(s$1)||n.unshift(s$1);process.env.PATH=n.join(y.delimiter);}async function re(t,o){U(),t.start("Checking pipx installation");try{return await execa("pipx",["--version"]),t.succeed("pipx found"),{kind:"binary"}}catch{}let n=D();try{return await execa(n,["-m","pipx","--version"]),t.succeed("pipx found"),{kind:"python-module",pythonCmd:n}}catch{}if(o)throw new d$2;t.stop?.();let{installPipx:s}=await b$2([{type:"confirm",name:"installPipx",message:"pipx is not installed. Install it now (user install via python -m pip)?",default:true}]);if(!s)throw new d$2;t.start("Installing pipx (user install)");try{try{await execa(n,["-m","pip","install","--user","--upgrade","pip"]);}catch{}await execa(n,["-m","pip","install","--user","--upgrade","pipx"]);}catch(a){let l=a,p=String(l?.stderr||l?.shortMessage||l?.message||"");throw new f$2("Install pipx with python -m pip",a instanceof Error?a:new Error(p))}t.succeed("pipx installed"),U();try{return await execa(n,["-m","pipx","--version"]),{kind:"python-module",pythonCmd:n}}catch(a){let l=a,p=String(l?.stderr||l?.shortMessage||l?.message||"pipx not runnable after install");throw new f$2("Verify pipx after install",new Error(`${p}
39
+ `}async function Ne(){try{let{stdout:t}=await execa("go",["version"],{timeout:3e3,stdio:"pipe"}),o=t.match(/go(\d+\.\d+(?:\.\d+)?)/i);return o?o[1]:void 0}catch{return}}async function Ke(){try{let{stdout:t}=await execa("dotnet",["--version"],{timeout:3e3,stdio:"pipe"}),o=t.trim();return o.length>0?o:void 0}catch{return}}async function Q(t,o,n,s,a$1,l){let[p,u]=await Promise.all([Ne(),Ke()]),c=[{fileName:"workspace.json",content:Se(o,n,s,a$1,l)},{fileName:"toolchain.lock",content:Me(n,s,process.version,p,u,l)},{fileName:"policies.yml",content:De()},{fileName:"cache-config.yml",content:Te()}];for(let h of c)await v.outputFile(d.join(t,a,h.fileName),h.content,"utf-8");}async function $t(t,o){let{workspaceName:n=d.basename(t),installMethod:s="venv",pythonVersion:a$1,profile:l,writeMarker:p=true,writeGitignore:u=true,onlyIfMissing:c$2=true}=o||{},h=[],[m,g]=await Promise.all([Ne(),Ke()]),r=[{relPath:d.join(a,"workspace.json"),legacyRelPath:d.join(b,"workspace.json"),content:Se(n,s,a$1,l)},{relPath:d.join(a,"toolchain.lock"),legacyRelPath:d.join(b,"toolchain.lock"),content:Me(s,a$1,process.version,m,g)},{relPath:d.join(a,"policies.yml"),legacyRelPath:d.join(b,"policies.yml"),content:De()},{relPath:d.join(a,"cache-config.yml"),legacyRelPath:d.join(b,"cache-config.yml"),content:Te()}];for(let i of r){let P=d.join(t,i.relPath),w=d.join(t,i.legacyRelPath),j=await v.pathExists(P),E=await v.pathExists(w);c$2&&j||(c$2&&E?(await v.copy(w,P),h.push(i.relPath)):(await v.outputFile(P,i.content,"utf-8"),h.push(i.relPath)));}if(p&&(!await v.pathExists(d.join(t,c$1))||!c$2)){let P=d$1(n,c(),s);a$1&&(P.metadata||(P.metadata={}),P.metadata.python={pythonVersion:a$1}),await b$1(t,P),h.push(c$1);}if(u){let i=d.join(t,".gitignore");(!c$2||!await v.pathExists(i))&&(await G(t),h.push(".gitignore"));}return h}var Oe=new Set(["go-only","java-only","dotnet-only","node-only","minimal"]),ze={"python-only":"minimal",polyglot:"node-only",enterprise:"polyglot"};function Be(t){let o=t,n=new Set;for(;!Oe.has(o);){if(n.has(o))return "minimal";n.add(o);let s=ze[o];if(!s)return "minimal";o=s;}return o}var L="3.10",We=["3.10","3.11","3.12"];async function Ce(t){try{let{stdout:o}=await execa(t,["--version"],{timeout:3e3}),n=o.match(/Python (\d+\.\d+\.\d+)/);if(n)return n[1]}catch{}return null}async function Je(t,o){try{await promises.writeFile(d.join(t,".python-version"),`${o}
40
+ `,"utf-8"),f.debug(`Created .python-version with ${o}`);}catch(n){f.warn(`Failed to create .python-version: ${n}`);}}function U(){let n=[...(process.env.PATH||"").split(d.delimiter).filter(Boolean)];for(let s$1 of s())n.includes(s$1)||n.unshift(s$1);process.env.PATH=n.join(d.delimiter);}async function re(t,o){U(),t.start("Checking pipx installation");try{return await execa("pipx",["--version"]),t.succeed("pipx found"),{kind:"binary"}}catch{}let n=D();try{return await execa(n,["-m","pipx","--version"]),t.succeed("pipx found"),{kind:"python-module",pythonCmd:n}}catch{}if(o)throw new d$3;t.stop?.();let{installPipx:s}=await b$2([{type:"confirm",name:"installPipx",message:"pipx is not installed. Install it now (user install via python -m pip)?",default:true}]);if(!s)throw new d$3;t.start("Installing pipx (user install)");try{try{await execa(n,["-m","pip","install","--user","--upgrade","pip"]);}catch{}await execa(n,["-m","pip","install","--user","--upgrade","pipx"]);}catch(a){let l=a,p=String(l?.stderr||l?.shortMessage||l?.message||"");throw new f$2("Install pipx with python -m pip",a instanceof Error?a:new Error(p))}t.succeed("pipx installed"),U();try{return await execa(n,["-m","pipx","--version"]),{kind:"python-module",pythonCmd:n}}catch(a){let l=a,p=String(l?.stderr||l?.shortMessage||l?.message||"pipx not runnable after install");throw new f$2("Verify pipx after install",new Error(`${p}
42
41
 
43
- Try reopening your terminal or run: ${n} -m pipx ensurepath`))}}async function H(t,o){return t.kind==="binary"?execa("pipx",o):execa(t.pythonCmd,["-m","pipx",...o])}function Xe(t){let o=t.match(/^(\d+)\.(\d+)/);return o?`${o[1]}.${o[2]}`:null}function Ae(t){if(!t)return null;let o=t.match(/Python\s+(\d+)\.(\d+)(?:\.\d+)?/i);return o?`${o[1]}.${o[2]}`:null}function we(t,o){let[n,s]=t.split(".").map(p=>Number(p)),[a,l]=o.split(".").map(p=>Number(p));return n!==a?n-a:s-l}function X(t,o){return we(t,o)>=0}async function Ze(t){let o=new Set,n=j(14,10);for(let g of n)try{let r=await execa(g.command,g.args,{timeout:2500}),i=Ae(`${r.stdout||""}
44
- ${r.stderr||""}`);i&&X(i,L)&&o.add(i);}catch{}let s=null;try{let g=await execa(D(),["--version"],{timeout:2500}),r=Ae(`${g.stdout||""}
45
- ${g.stderr||""}`);r&&X(r,L)&&(s=r,o.add(r));}catch{}let a=Fe.filter(g=>X(g,L)),l=new Set([...a,...o]),p=Array.from(l).sort((g,r)=>we(r,g)),u=t?Xe(t):null,c=u&&X(u,L)?u:s||p[0]||L;return l.has(c)||l.add(c),{choices:Array.from(l).sort((g,r)=>we(r,g)).map(g=>{let r=[];return g===s&&r.push("current system"),g===L&&r.push("minimum supported"),o.has(g)&&g!==s&&r.push("detected"),{name:r.length>0?`${g} (${r.join(", ")})`:g,value:g}}),defaultValue:c}}async function et(){U();let t=false,o=false;try{await execa("poetry",["--version"],{timeout:2500}),t=true;}catch{t=false;}try{await execa("pipx",["--version"],{timeout:2500}),o=true;}catch{let n=h();try{await execa(n,["-m","pipx","--version"],{timeout:2500}),o=true;}catch{o=false;}}return {poetry:t,pipx:o}}async function Ve(){U();try{return await execa("poetry",["--version"],{timeout:2500}),true}catch{return false}}function tt(t,o){return t==="poetry"&&o.poetry?"poetry":t==="pipx"&&o.pipx?"pipx":t==="venv"?"venv":o.poetry?"poetry":"venv"}async function ot(t,o){U(),t.start("Checking Poetry installation");try{await execa("poetry",["--version"]),t.succeed("Poetry found");return}catch{}if(o)throw new c$3;let{installPoetry:n}=await b$2([{type:"confirm",name:"installPoetry",message:"Poetry is not installed. Install it now using pipx?",default:true}]);if(!n)throw new c$3;let s=await re(t,o);t.start("Installing Poetry with pipx");try{await H(s,["install","poetry"]);}catch(a){let l=a,p=String(l?.stderr||l?.shortMessage||l?.message||"");if(/already\s+installed|already\s+seems\s+to\s+be\s+installed|exists/i.test(p))try{await H(s,["upgrade","poetry"]);}catch{}else throw new f$2("Install Poetry with pipx",a instanceof Error?a:new Error(p))}t.succeed("Poetry installed"),U();try{await execa("poetry",["--version"]);}catch(a){let l=a,p=String(l?.stderr||l?.shortMessage||l?.message||"Poetry not found on PATH");throw new f$2("Verify Poetry after pipx install",new Error(`${p}
42
+ Try reopening your terminal or run: ${n} -m pipx ensurepath`))}}async function H(t,o){return t.kind==="binary"?execa("pipx",o):execa(t.pythonCmd,["-m","pipx",...o])}function Qe(t){let o=t.match(/^(\d+)\.(\d+)/);return o?`${o[1]}.${o[2]}`:null}function je(t){if(!t)return null;let o=t.match(/Python\s+(\d+)\.(\d+)(?:\.\d+)?/i);return o?`${o[1]}.${o[2]}`:null}function we(t,o){let[n,s]=t.split(".").map(p=>Number(p)),[a,l]=o.split(".").map(p=>Number(p));return n!==a?n-a:s-l}function X(t,o){return we(t,o)>=0}async function Xe(t){let o=new Set,n=j(14,10);for(let g of n)try{let r=await execa(g.command,g.args,{timeout:2500}),i=je(`${r.stdout||""}
43
+ ${r.stderr||""}`);i&&X(i,L)&&o.add(i);}catch{}let s=null;try{let g=await execa(D(),["--version"],{timeout:2500}),r=je(`${g.stdout||""}
44
+ ${g.stderr||""}`);r&&X(r,L)&&(s=r,o.add(r));}catch{}let a=We.filter(g=>X(g,L)),l=new Set([...a,...o]),p=Array.from(l).sort((g,r)=>we(r,g)),u=t?Qe(t):null,c=u&&X(u,L)?u:s||p[0]||L;return l.has(c)||l.add(c),{choices:Array.from(l).sort((g,r)=>we(r,g)).map(g=>{let r=[];return g===s&&r.push("current system"),g===L&&r.push("minimum supported"),o.has(g)&&g!==s&&r.push("detected"),{name:r.length>0?`${g} (${r.join(", ")})`:g,value:g}}),defaultValue:c}}async function Ze(){U();let t=false,o=false;try{await execa("poetry",["--version"],{timeout:2500}),t=true;}catch{t=false;}try{await execa("pipx",["--version"],{timeout:2500}),o=true;}catch{let n=h();try{await execa(n,["-m","pipx","--version"],{timeout:2500}),o=true;}catch{o=false;}}return {poetry:t,pipx:o}}async function Fe(){U();try{return await execa("poetry",["--version"],{timeout:2500}),true}catch{return false}}function et(t,o){return t==="poetry"&&o.poetry?"poetry":t==="pipx"&&o.pipx?"pipx":t==="venv"?"venv":o.poetry?"poetry":"venv"}async function tt(t,o){U(),t.start("Checking Poetry installation");try{await execa("poetry",["--version"]),t.succeed("Poetry found");return}catch{}if(o)throw new c$3;let{installPoetry:n}=await b$2([{type:"confirm",name:"installPoetry",message:"Poetry is not installed. Install it now using pipx?",default:true}]);if(!n)throw new c$3;let s=await re(t,o);t.start("Installing Poetry with pipx");try{await H(s,["install","poetry"]);}catch(a){let l=a,p=String(l?.stderr||l?.shortMessage||l?.message||"");if(/already\s+installed|already\s+seems\s+to\s+be\s+installed|exists/i.test(p))try{await H(s,["upgrade","poetry"]);}catch{}else throw new f$2("Install Poetry with pipx",a instanceof Error?a:new Error(p))}t.succeed("Poetry installed"),U();try{await execa("poetry",["--version"]);}catch(a){let l=a,p=String(l?.stderr||l?.shortMessage||l?.message||"Poetry not found on PATH");throw new f$2("Verify Poetry after pipx install",new Error(`${p}
46
45
 
47
- Poetry may be installed but not on PATH yet. Try reopening your terminal or run: pipx ensurepath`))}}function nt(t,o={}){let n=t==="poetry",s=o.pythonEngineSkipped?`echo "- Python engine installation was intentionally skipped for this workspace." 1>&2
46
+ Poetry may be installed but not on PATH yet. Try reopening your terminal or run: pipx ensurepath`))}}function ot(t,o={}){let n=t==="poetry",s=o.pythonEngineSkipped?`echo "- Python engine installation was intentionally skipped for this workspace." 1>&2
48
47
  echo "- For npm-owned workspace commands, run: npx workspai <command>" 1>&2
49
48
  echo "- To install the local Python engine later, create a RapidKit Core module-enabled project, then run: npx workspai workspace run init" 1>&2
50
49
  `:`echo "- If you used venv: ensure .venv exists (or re-run the installer)." 1>&2
@@ -80,7 +79,7 @@ ${s}${o.pythonEngineSkipped?"":n?`echo "- If you used Poetry: run 'poetry instal
80
79
  `:""}${o.pythonEngineSkipped?`echo "Tip: use 'npx workspai workspace model --json' for Workspace Intelligence without the Python engine." 1>&2
81
80
  `:`echo "Tip: you can also run: ./.venv/bin/rapidkit --help" 1>&2
82
81
  `}exit 1
83
- `}function it(t,o={}){let n=t==="poetry",s=o.pythonEngineSkipped?`echo - Python engine installation was intentionally skipped for this workspace. 1>&2
82
+ `}function nt(t,o={}){let n=t==="poetry",s=o.pythonEngineSkipped?`echo - Python engine installation was intentionally skipped for this workspace. 1>&2
84
83
  echo - For npm-owned workspace commands, run: npx workspai ^<command^> 1>&2
85
84
  echo - To install the local Python engine later, create a RapidKit Core module-enabled project, then run: npx workspai workspace run init 1>&2
86
85
  `:`echo Tip: run .venv\\Scripts\\rapidkit.exe --help 1>&2
@@ -120,8 +119,8 @@ for %%R in ("%USERPROFILE%\\.local\\bin\\rapidkit.exe" "%APPDATA%\\Python\\Scrip
120
119
  echo RapidKit launcher could not find a local Python CLI. 1>&2
121
120
  ${s}echo Tip: for npm-owned workspace commands, run npx --yes --package workspai workspai %* from a shell where npm is on PATH. 1>&2
122
121
  exit /b 1
123
- `}async function fe(t,o,n={}){await v.outputFile(y.join(t,"rapidkit"),nt(o,n),{encoding:"utf-8",mode:493}),await v.outputFile(y.join(t,"rapidkit.cmd"),it(o,n),"utf-8");}async function Mt(t,o){let{skipGit:n=false,skipPythonEngine:s=false,testMode:a=false,demoMode:l=false,dryRun:p=false,yes:u=false,userConfig:c={},installMethod:h,profile:m,parentDirectory:g}=o,r=t||"rapidkit",i=g?y.resolve(g,r):y.resolve(process.cwd(),r);if(await v.pathExists(i))throw new e(r);if(p){let f=m||(u?"minimal":void 0),R=h||c.defaultInstallMethod||"poetry",x=c.pythonVersion||"3.10";await rt(i,r,l,c,f,R,x);return}if(l){await at(i,r,n);return}let P=new Set(["python-only","polyglot","enterprise"]),w=m||"";if(!u&&!m){let{selectedProfile:f}=await b$2([{type:"rawlist",name:"selectedProfile",message:"Select workspace profile:",choices:[{name:"minimal \u2014 Foundation files only (fastest bootstrap, mixed projects)",value:"minimal"},{name:"java-only \u2014 Java runtime (Spring Boot services)",value:"java-only"},{name:"python-only \u2014 Python + Poetry (FastAPI, Django, ML pipelines)",value:"python-only"},{name:"node-only \u2014 Node.js runtime (NestJS, Express, Next.js)",value:"node-only"},{name:"go-only \u2014 Go runtime (Fiber, Gin, gRPC, microservices)",value:"go-only"},{name:"dotnet-only \u2014 .NET runtime (ASP.NET Core services)",value:"dotnet-only"},{name:"polyglot \u2014 Python + Node.js + Go + Java + .NET multi-runtime workspace",value:"polyglot"},{name:"enterprise \u2014 Polyglot + governance + Sigstore verification",value:"enterprise"}],default:1}]);w=f;}else w||(w="minimal");let j=!u&&P.has(w),E=P.has(w)&&s?"skip":j?(await b$2([{type:"confirm",name:"installPythonEngine",message:"Install the optional RapidKit Python engine now? (needed for Python-backed kits/modules)",default:true}])).installPythonEngine!==false?"install":"skip":"install",W=j&&E==="install",se=typeof c.pythonVersion=="string"&&c.pythonVersion.trim().length>0?c.pythonVersion.trim():void 0,Ye=h||c.defaultInstallMethod||"poetry",le=W?await et():{poetry:true,pipx:true},ke=W?await Ze(se):{choices:Fe.map(f=>({name:f,value:f})),defaultValue:L},qe=tt(Ye,le),ze=[{name:le.poetry?"\u{1F3AF} Poetry (Recommended - includes virtual env + dependency mgmt)":"\u{1F3AF} Poetry (Recommended) \u2014 not detected (we can install it)",value:"poetry"},{name:"\u{1F4E6} pip with venv (Standard, zero extra tools)",value:"venv"},{name:le.pipx?"\u{1F527} pipx (Global isolated - RapidKit Core only, no local venv)":"\u{1F527} pipx (Global isolated) \u2014 not detected (we can install it)",value:"pipx"}],I=W?await b$2([{type:"rawlist",name:"pythonVersion",message:"Select Python version for RapidKit:",choices:ke.choices,default:ke.defaultValue},{type:"rawlist",name:"installMethod",message:"How would you like to manage the workspace environment?",choices:ze,default:qe}]):await(async()=>{if(E==="skip")return {pythonVersion:c.pythonVersion||"3.10",installMethod:"venv"};let f$1=h||c.defaultInstallMethod||await(async()=>{try{return await execa("poetry",["--version"],{timeout:3e3}),"poetry"}catch{return f.warn("Poetry not found \u2014 auto-selecting venv. Pass --install-method poetry to override."),"venv"}})();return {pythonVersion:c.pythonVersion||"3.10",installMethod:f$1}})();W&&(console.log(e$1.gray(`
124
- \u{1F4CC} Configuration notes:`)),I.pythonVersion==="3.10"?console.log(e$1.gray(" \u2022 Python 3.10: Latest stable with widespread compatibility")):I.pythonVersion==="3.11"?console.log(e$1.gray(" \u2022 Python 3.11: Newer, faster (3.10-3.11: ~10% speed improvement)")):I.pythonVersion==="3.12"&&console.log(e$1.gray(" \u2022 Python 3.12: Cutting edge, excellent for performance")),I.installMethod==="poetry"?console.log(e$1.gray(" \u2022 Poetry: Dependency management + virtual env (recommended for teams)")):I.installMethod==="venv"?console.log(e$1.gray(" \u2022 venv: Standard library approach, lightweight, zero dependencies")):console.log(e$1.gray(" \u2022 pipx: Global isolated, RapidKit Core only, no local venv")),console.log(""));let ce=We;if(ce.has(w)){let f=c$2("Creating workspace",{component:"create",phase:"workspace.python-free"});try{await v.ensureDir(i),f.succeed("Directory created"),await B(i,r,"venv",void 0),await Q(i,r,"venv",void 0,w),await G(i);let R={"go-only":"Go-only","java-only":"Java-only","dotnet-only":".NET-only","node-only":"Node.js-only",minimal:"Minimal"};if(await v.outputFile(y.join(i,"README.md"),`# ${r}
122
+ `}async function fe(t,o,n={}){await v.outputFile(d.join(t,"rapidkit"),ot(o,n),{encoding:"utf-8",mode:493}),await v.outputFile(d.join(t,"rapidkit.cmd"),nt(o,n),"utf-8");}async function St(t,o){let{skipGit:n=false,skipPythonEngine:s=false,testMode:a=false,demoMode:l=false,dryRun:p=false,yes:u=false,userConfig:c={},installMethod:h,profile:m,parentDirectory:g}=o,r=t||"rapidkit",i=g?d.resolve(g,r):d.resolve(process.cwd(),r);if(await v.pathExists(i))throw new e(r);if(p){let f=m||(u?"minimal":void 0),R=h||c.defaultInstallMethod||"poetry",x=c.pythonVersion||"3.10";await at(i,r,l,c,f,R,x);return}if(l){await it(i,r,n);return}let P=new Set(["python-only","polyglot","enterprise"]),w=m||"";if(!u&&!m){let{selectedProfile:f}=await b$2([{type:"rawlist",name:"selectedProfile",message:"Select workspace profile:",choices:[{name:"minimal \u2014 Foundation files only (fastest bootstrap, mixed projects)",value:"minimal"},{name:"java-only \u2014 Java runtime (Spring Boot services)",value:"java-only"},{name:"python-only \u2014 Python + Poetry (FastAPI, Django, ML pipelines)",value:"python-only"},{name:"node-only \u2014 Node.js runtime (NestJS, Express, Next.js)",value:"node-only"},{name:"go-only \u2014 Go runtime (Fiber, Gin, gRPC, microservices)",value:"go-only"},{name:"dotnet-only \u2014 .NET runtime (ASP.NET Core services)",value:"dotnet-only"},{name:"polyglot \u2014 Python + Node.js + Go + Java + .NET multi-runtime workspace",value:"polyglot"},{name:"enterprise \u2014 Polyglot + governance + Sigstore verification",value:"enterprise"}],default:1}]);w=f;}else w||(w="minimal");let j=!u&&P.has(w),E=P.has(w)&&s?"skip":j?(await b$2([{type:"confirm",name:"installPythonEngine",message:"Install the optional RapidKit Python engine now? (needed for Python-backed kits/modules)",default:true}])).installPythonEngine!==false?"install":"skip":"install",W=j&&E==="install",se=typeof c.pythonVersion=="string"&&c.pythonVersion.trim().length>0?c.pythonVersion.trim():void 0,Ue=h||c.defaultInstallMethod||"poetry",le=W?await Ze():{poetry:true,pipx:true},ke=W?await Xe(se):{choices:We.map(f=>({name:f,value:f})),defaultValue:L},Ye=et(Ue,le),qe=[{name:le.poetry?"\u{1F3AF} Poetry (Recommended - includes virtual env + dependency mgmt)":"\u{1F3AF} Poetry (Recommended) \u2014 not detected (we can install it)",value:"poetry"},{name:"\u{1F4E6} pip with venv (Standard, zero extra tools)",value:"venv"},{name:le.pipx?"\u{1F527} pipx (Global isolated - RapidKit Core only, no local venv)":"\u{1F527} pipx (Global isolated) \u2014 not detected (we can install it)",value:"pipx"}],I=W?await b$2([{type:"rawlist",name:"pythonVersion",message:"Select Python version for RapidKit:",choices:ke.choices,default:ke.defaultValue},{type:"rawlist",name:"installMethod",message:"How would you like to manage the workspace environment?",choices:qe,default:Ye}]):await(async()=>{if(E==="skip")return {pythonVersion:c.pythonVersion||"3.10",installMethod:"venv"};let f$1=h||c.defaultInstallMethod||await(async()=>{try{return await execa("poetry",["--version"],{timeout:3e3}),"poetry"}catch{return f.warn("Poetry not found \u2014 auto-selecting venv. Pass --install-method poetry to override."),"venv"}})();return {pythonVersion:c.pythonVersion||"3.10",installMethod:f$1}})();W&&(console.log(e$1.gray(`
123
+ \u{1F4CC} Configuration notes:`)),I.pythonVersion==="3.10"?console.log(e$1.gray(" \u2022 Python 3.10: Latest stable with widespread compatibility")):I.pythonVersion==="3.11"?console.log(e$1.gray(" \u2022 Python 3.11: Newer, faster (3.10-3.11: ~10% speed improvement)")):I.pythonVersion==="3.12"&&console.log(e$1.gray(" \u2022 Python 3.12: Cutting edge, excellent for performance")),I.installMethod==="poetry"?console.log(e$1.gray(" \u2022 Poetry: Dependency management + virtual env (recommended for teams)")):I.installMethod==="venv"?console.log(e$1.gray(" \u2022 venv: Standard library approach, lightweight, zero dependencies")):console.log(e$1.gray(" \u2022 pipx: Global isolated, RapidKit Core only, no local venv")),console.log(""));let ce=Oe;if(ce.has(w)){let f=c$2("Creating workspace",{component:"create",phase:"workspace.python-free"});try{await v.ensureDir(i),f.succeed("Directory created"),await B(i,r,"venv",void 0),await Q(i,r,"venv",void 0,w),await G(i);let R={"go-only":"Go-only","java-only":"Java-only","dotnet-only":".NET-only","node-only":"Node.js-only",minimal:"Minimal"};if(await v.outputFile(d.join(i,"README.md"),`# ${r}
125
124
 
126
125
  Workspai **${R[w]}** workspace.
127
126
 
@@ -161,7 +160,7 @@ npx workspai dev
161
160
  `)),console.log(e$1.gray("\u{1F4A1} Node lifecycle commands run through Node tooling. RapidKit Core module commands for module-enabled kits can install the local Python engine later with workspace run init."))):(console.log(e$1.white(" npx workspai create project")),console.log(e$1.white(" cd <project-name>")),console.log(e$1.white(" npx workspai init")),console.log(e$1.white(` npx workspai dev
162
161
  `)),console.log(e$1.gray("\u{1F4A1} Bootstrap a specific runtime: workspai bootstrap --profile java-only|python-only|node-only|go-only|dotnet-only|polyglot|enterprise")));console.log(e$1.cyan(`
163
162
  \u{1F4DA} More info:`)),console.log(e$1.gray(" \u2022 Change profile anytime: workspai bootstrap --profile <profile>")),console.log(e$1.gray(" \u2022 View config: cat "+r+"/.workspai-workspace")),console.log(e$1.gray(" \u2022 Check health: workspai doctor")),console.log("");}catch(R){throw f.fail("Failed to create workspace"),console.error(e$1.red(`
164
- \u274C Error:`),R),R}return}if(P.has(w)&&E==="skip"){let f=c$2("Creating workspace",{component:"create",phase:"workspace.python-engine-skipped"});try{await v.ensureDir(i),f.succeed("Directory created");let R={bootstrapNote:"python-engine-skipped",pythonEngine:"skipped",pythonEngineReason:"user-opted-out"};await B(i,r,"venv",void 0,R),await Q(i,r,"venv",void 0,w,R),await G(i),await fe(i,"venv",{pythonEngineSkipped:true});let x={"python-only":"Python-aware",polyglot:"Polyglot",enterprise:"Enterprise"};await v.outputFile(y.join(i,"README.md"),`# ${r}
163
+ \u274C Error:`),R),R}return}if(P.has(w)&&E==="skip"){let f=c$2("Creating workspace",{component:"create",phase:"workspace.python-engine-skipped"});try{await v.ensureDir(i),f.succeed("Directory created");let R={bootstrapNote:"python-engine-skipped",pythonEngine:"skipped",pythonEngineReason:"user-opted-out"};await B(i,r,"venv",void 0,R),await Q(i,r,"venv",void 0,w,R),await G(i),await fe(i,"venv",{pythonEngineSkipped:true});let x={"python-only":"Python-aware",polyglot:"Polyglot",enterprise:"Enterprise"};await v.outputFile(d.join(i,"README.md"),`# ${r}
165
164
 
166
165
  Workspai **${x[w]??w}** workspace with Workspace Intelligence enabled and Python engine installation skipped.
167
166
 
@@ -187,7 +186,7 @@ npx workspai workspace run init
187
186
  `)),console.log(e$1.cyan(`\u{1F4A1} Add Python-backed kits/modules later:
188
187
  `)),console.log(e$1.gray(" npx workspai create project fastapi.standard api --yes")),console.log(e$1.gray(` npx workspai workspace run init
189
188
  `));return}catch(R){throw f.fail("Failed to create workspace"),console.error(e$1.red(`
190
- \u274C Error:`),R),R}}{let f=D(),R=false;try{await execa(f,["--version"],{timeout:5e3}),R=true;}catch{try{await execa("python",["--version"],{timeout:5e3}),R=true;}catch{R=false;}}if(!R){let x=w,k=Je(w);if(j&&!u){console.log(e$1.yellow(`
189
+ \u274C Error:`),R),R}}{let f=D(),R=false;try{await execa(f,["--version"],{timeout:5e3}),R=true;}catch{try{await execa("python",["--version"],{timeout:5e3}),R=true;}catch{R=false;}}if(!R){let x=w,k=Be(w);if(j&&!u){console.log(e$1.yellow(`
191
190
  \u26A0\uFE0F Python 3.10+ is not detected on this system.
192
191
  `)),console.log(e$1.cyan(`You have 3 options:
193
192
  `));let{pythonAction:A}=await b$2([{type:"rawlist",name:"pythonAction",message:"What would you like to do?",choices:[{name:"\u{1F4E5} Install Python now (I'll show you the command for your OS)",value:"install"},{name:`\u{1F504} Switch to "${k}" profile (no Python required)`,value:"fallback"},{name:"\u274C Cancel and install Python manually",value:"cancel"}]}]);if(A==="cancel"&&(console.log(e$1.cyan(`
@@ -203,7 +202,7 @@ npx workspai workspace run init
203
202
  `))),console.log(e$1.gray(` After installing, run: npx workspai ${r}
204
203
  `)),process.exit(0);}if(A==="fallback"&&(console.log(e$1.green(`
205
204
  \u2705 Switching to "${k}" profile (no Python required).
206
- `)),w=k,ce.has(k))){let $=c$2("Creating workspace",{component:"create",phase:"workspace.python-free"});try{await v.ensureDir(i),$.succeed("Directory created"),await B(i,r,"venv",void 0),await Q(i,r,"venv",void 0,k,{profileRequested:x,bootstrapNote:"python-free-fallback"}),await G(i);let oe={"go-only":"Go-only","java-only":"Java-only","dotnet-only":".NET-only","node-only":"Node.js-only",minimal:"Minimal"};await v.outputFile(y.join(i,"README.md"),`# ${r}
205
+ `)),w=k,ce.has(k))){let $=c$2("Creating workspace",{component:"create",phase:"workspace.python-free"});try{await v.ensureDir(i),$.succeed("Directory created"),await B(i,r,"venv",void 0),await Q(i,r,"venv",void 0,k,{profileRequested:x,bootstrapNote:"python-free-fallback"}),await G(i);let oe={"go-only":"Go-only","java-only":"Java-only","dotnet-only":".NET-only","node-only":"Node.js-only",minimal:"Minimal"};await v.outputFile(d.join(i,"README.md"),`# ${r}
207
206
 
208
207
  Workspai **${oe[k]}** workspace (switched from ${x} due to missing Python).
209
208
 
@@ -248,7 +247,7 @@ npx workspai dev
248
247
  `)),console.log(e$1.cyan(`\u{1F4A1} Add Python later:
249
248
  `)),console.log(e$1.gray(" 1. Install Python 3.10+")),console.log(e$1.gray(` 2. Run: ${f$1(i)} && workspai bootstrap --profile ${x}
250
249
  `)),console.log("");return}catch($){throw A.fail("Failed to create workspace"),console.error(e$1.red(`
251
- \u274C Error:`),$),$}}}}f.step(1,3,"Setting up Workspai environment");let _=c$2("Creating directory",{component:"create",phase:"workspace.directory"});try{await v.ensureDir(i),_.succeed("Directory created"),_.start("Detecting Python version");let f$2=null,R=await Le(I.pythonVersion);if(R)f$2=await je(R),f$2?(f.info(` Detected Python ${f$2}`),_.succeed(`Python ${f$2} detected`)):_.warn("Could not detect exact Python version");else {let x=D();f$2=await je(x),f$2?_.succeed(`Python ${f$2} detected`):_.warn("Could not detect Python version, proceeding with defaults");}if(I.installMethod==="poetry"&&!await Ve()&&(_.warn("Poetry not found \u2014 auto-fallback to pip + venv"),I.installMethod="venv"),await B(i,r,I.installMethod,f$2||void 0),f$2&&await Qe(i,f$2),await Q(i,r,I.installMethod,f$2||I.pythonVersion,w||m),await G(i),await Se(i,r),I.installMethod==="poetry")try{await Ge(i,I.pythonVersion,_,a,c,u);}catch(x){let k=x?.details||x?.message||String(x);if(k.includes("pyenv")||k.includes("exit status 127")||k.includes("returned non-zero exit status 127")){_.warn("Poetry encountered Python discovery issues, trying venv method"),f.debug(`Poetry error (attempting venv fallback): ${k}`);try{await ve(i,I.pythonVersion,_,a,c),I.installMethod="venv";}catch(A){throw A}}else throw x}else I.installMethod==="venv"?await ve(i,I.pythonVersion,_,a,c):await He(i,_,a,c,u);if(await fe(i,I.installMethod),await Ue(i,I.installMethod),_.succeed("Workspai environment ready!"),o.skipGit||await J(i,_,"Initial commit: Workspai environment"),await V(i,{workspaceName:r,silent:a}),console.log(e$1.green(`
250
+ \u274C Error:`),$),$}}}}f.step(1,3,"Setting up Workspai environment");let _=c$2("Creating directory",{component:"create",phase:"workspace.directory"});try{await v.ensureDir(i),_.succeed("Directory created"),_.start("Detecting Python version");let f$2=null,R=await Ve(I.pythonVersion);if(R)f$2=await Ce(R),f$2?(f.info(` Detected Python ${f$2}`),_.succeed(`Python ${f$2} detected`)):_.warn("Could not detect exact Python version");else {let x=D();f$2=await Ce(x),f$2?_.succeed(`Python ${f$2} detected`):_.warn("Could not detect Python version, proceeding with defaults");}if(I.installMethod==="poetry"&&!await Fe()&&(_.warn("Poetry not found \u2014 auto-fallback to pip + venv"),I.installMethod="venv"),await B(i,r,I.installMethod,f$2||void 0),f$2&&await Je(i,f$2),await Q(i,r,I.installMethod,f$2||I.pythonVersion,w||m),await G(i),await $e(i,r),I.installMethod==="poetry")try{await Le(i,I.pythonVersion,_,a,c,u);}catch(x){let k=x?.details||x?.message||String(x);if(k.includes("pyenv")||k.includes("exit status 127")||k.includes("returned non-zero exit status 127")){_.warn("Poetry encountered Python discovery issues, trying venv method"),f.debug(`Poetry error (attempting venv fallback): ${k}`);try{await ve(i,I.pythonVersion,_,a,c),I.installMethod="venv";}catch(A){throw A}}else throw x}else I.installMethod==="venv"?await ve(i,I.pythonVersion,_,a,c):await Ge(i,_,a,c,u);if(await fe(i,I.installMethod),await He(i,I.installMethod),_.succeed("Workspai environment ready!"),o.skipGit||await J(i,_,"Initial commit: Workspai environment"),await V(i,{workspaceName:r,silent:a}),console.log(e$1.green(`
252
251
  \u2728 Workspai environment created successfully!
253
252
  `)),console.log(e$1.cyan("\u{1F4C2} Location:"),e$1.white(i)),console.log(e$1.cyan("\u2699\uFE0F Configuration:")),console.log(e$1.gray(` \u2022 Profile: ${w}`)),console.log(e$1.gray(` \u2022 Python: ${I.pythonVersion}`)),console.log(e$1.gray(` \u2022 Install method: ${I.installMethod}`)),console.log(e$1.cyan(`
254
253
  \u{1F680} Get started:
@@ -260,7 +259,7 @@ npx workspai dev
260
259
  \u{1F4A1} Profile management:`)),console.log(e$1.gray(" \u2022 Add Python? \u2192 workspai bootstrap --profile python-only|polyglot")),console.log(e$1.gray(" \u2022 Add Node.js? \u2192 workspai bootstrap --profile node-only|polyglot")),console.log(e$1.gray(" \u2022 Add Go? \u2192 workspai bootstrap --profile go-only|polyglot")),console.log(e$1.gray(" \u2022 Add .NET? \u2192 workspai bootstrap --profile dotnet-only|polyglot")),console.log(e$1.gray(" \u2022 Full setup? \u2192 workspai bootstrap --profile enterprise")),console.log(e$1.cyan(`
261
260
  \u{1F4D6} Common commands:`)),console.log(e$1.white(" workspai create - Create a new project (interactive)")),console.log(e$1.white(" workspai list - List available kits")),console.log(e$1.white(" workspai modules - List available modules")),console.log(e$1.white(" workspai doctor - Check workspace health")),console.log(e$1.white(` workspai bootstrap --help - Advanced workspace configuration
262
261
  `));try{let{stdout:x}=await execa("go",["version"],{timeout:3e3}),k=x.match(/go version go(\d+\.\d+(?:\.\d+)?)/),T=k?k[1]:"unknown";console.log(e$1.gray(`\u{1F439} Go ${T} detected \u2014 ready for gofiber.standard projects`));}catch{console.log(e$1.yellow("\u26A0\uFE0F Go not installed \u2014 needed for gofiber.standard/gogin.standard projects")),console.log(e$1.gray(" Install: https://go.dev/dl/"));}console.log("");}catch(f){_.fail("Failed to create Workspai environment"),console.error(e$1.red(`
263
- \u274C Error:`),f);try{await v.remove(i);}catch{}throw f}}async function Le(t){let o=[];if(!b$3())try{let{stdout:l}=await execa("pyenv",["which","python"]),p=l.trim();p&&o.push(p);}catch{}let n=Number(t.split(".")[1]),s=j(n,10).map(l=>l.command).filter(Boolean);o.push(`python${t}`,...s,...i());let a=[...new Set(o)];for(let l of a)try{let p=l==="py"?["-3","--version"]:["--version"],u=l==="py"?["-3","-c","import sys; sys.exit(0)"]:["-c","import sys; sys.exit(0)"],{stdout:c}=await execa(l,p,{timeout:2e3}),h=c.match(/Python (\d+\.\d+)/)?.[1];if(h&&X(h,t))return await execa(l,u,{timeout:2e3}),l}catch{continue}return null}async function Ge(t,o,n,s,a,l$1=false){await ot(n,l$1),n.start("Finding Python interpreter");let p=await Le(o);p?(f.debug(`Found working Python: ${p}`),n.succeed("Python found")):n.warn("Could not verify Python path, proceeding with default"),n.start("Initializing Poetry project");let u=y.join(t,"pyproject.toml"),h=(await v.pathExists(u)?await promises.readFile(u,"utf-8"):"").includes("rapidkit-core");if(h)n.succeed("Poetry project initialized");else {await execa("poetry",["init","--no-interaction","--python",`^${o}`],{cwd:t}),n.succeed("Poetry project initialized");let i=await promises.readFile(u,"utf-8");i.includes("[tool.poetry]")?i=i.replace("[tool.poetry]",`[tool.poetry]
262
+ \u274C Error:`),f);try{await v.remove(i);}catch{}throw f}}async function Ve(t){let o=[];if(!b$3())try{let{stdout:l}=await execa("pyenv",["which","python"]),p=l.trim();p&&o.push(p);}catch{}let n=Number(t.split(".")[1]),s=j(n,10).map(l=>l.command).filter(Boolean);o.push(`python${t}`,...s,...i());let a=[...new Set(o)];for(let l of a)try{let p=l==="py"?["-3","--version"]:["--version"],u=l==="py"?["-3","-c","import sys; sys.exit(0)"]:["-c","import sys; sys.exit(0)"],{stdout:c}=await execa(l,p,{timeout:2e3}),h=c.match(/Python (\d+\.\d+)/)?.[1];if(h&&X(h,t))return await execa(l,u,{timeout:2e3}),l}catch{continue}return null}async function Le(t,o,n,s,a,l$1=false){await tt(n,l$1),n.start("Finding Python interpreter");let p=await Ve(o);p?(f.debug(`Found working Python: ${p}`),n.succeed("Python found")):n.warn("Could not verify Python path, proceeding with default"),n.start("Initializing Poetry project");let u=d.join(t,"pyproject.toml"),h=(await v.pathExists(u)?await promises.readFile(u,"utf-8"):"").includes("rapidkit-core");if(h)n.succeed("Poetry project initialized");else {await execa("poetry",["init","--no-interaction","--python",`^${o}`],{cwd:t}),n.succeed("Poetry project initialized");let i=await promises.readFile(u,"utf-8");i.includes("[tool.poetry]")?i=i.replace("[tool.poetry]",`[tool.poetry]
264
263
  package-mode = false`):i.includes("[project]")&&(i.includes("[build-system]")?i=i.replace("[build-system]",`
265
264
  [tool.poetry]
266
265
  package-mode = false
@@ -269,33 +268,33 @@ package-mode = false
269
268
 
270
269
  [tool.poetry]
271
270
  package-mode = false
272
- `),await promises.writeFile(u,i,"utf-8");}n.start("Configuring Poetry");try{await execa("poetry",["config","virtualenvs.in-project","true","--local"],{cwd:t}),n.succeed("Poetry configured");}catch{n.warn("Could not configure Poetry virtualenvs.in-project");}n.start("Creating virtualenv");let m=p||D(),g$1=l(y.join(t,".venv"));try{await execa(m,["-m","venv",".venv"],{cwd:t,timeout:6e4}),n.succeed("Virtualenv created");}catch(r){f.debug(`python -m venv failed: ${r}`),n.warn("Could not pre-create virtualenv, Poetry will try"),g$1=p||D();}try{await execa("poetry",["env","use",g$1||D()],{cwd:t}),f.debug(`Poetry env set to: ${g$1}`);}catch(r){f.debug(`Could not set Poetry env: ${r}`);}if(n.start("Installing RapidKit"),h&&!s){let r=e$2(a||{}),i=r?await v.pathExists(r):false,P=i&&r?r:"rapidkit-core";r&&!i&&f.warn(`WORKSPAI_DEV_PATH/RAPIDKIT_DEV_PATH points to a path that does not exist: ${r}. Falling back to PyPI.`),n.text=i?"Installing RapidKit from local path":"Installing RapidKit from PyPI";let w=false,j=null;for(let E=1;E<=3;E++)try{i||e$3({status:"started",message:"Installing RapidKit from PyPI",installMethod:"poetry",attempt:E,maxAttempts:3}),await execa(g$1,["-m","pip","install",P,"--quiet"],{cwd:t,timeout:18e4}),w=true,i||e$3({status:"succeeded",message:"RapidKit installed from PyPI",installMethod:"poetry",attempt:E,maxAttempts:3});break}catch(W){j=W,f.debug(`pip install rapidkit-core attempt ${E} failed: ${W}`),E<3&&(n.text=`Retrying installation (attempt ${E+1}/3)`,await new Promise(se=>setTimeout(se,2e3)));}if(!w){let E=j?.stderr||j?.message||"Unknown error";throw f.debug(`All pip install attempts failed. Last error: ${E}`),E.includes("Could not find")||E.includes("No matching distribution")?new g:new f$2("Install rapidkit-core with pip",new Error(`Failed to install rapidkit-core after 3 attempts.
271
+ `),await promises.writeFile(u,i,"utf-8");}n.start("Configuring Poetry");try{await execa("poetry",["config","virtualenvs.in-project","true","--local"],{cwd:t}),n.succeed("Poetry configured");}catch{n.warn("Could not configure Poetry virtualenvs.in-project");}n.start("Creating virtualenv");let m=p||D(),g$1=l(d.join(t,".venv"));try{await execa(m,["-m","venv",".venv"],{cwd:t,timeout:6e4}),n.succeed("Virtualenv created");}catch(r){f.debug(`python -m venv failed: ${r}`),n.warn("Could not pre-create virtualenv, Poetry will try"),g$1=p||D();}try{await execa("poetry",["env","use",g$1||D()],{cwd:t}),f.debug(`Poetry env set to: ${g$1}`);}catch(r){f.debug(`Could not set Poetry env: ${r}`);}if(n.start("Installing RapidKit"),h&&!s){let r=e$2(a||{}),i=r?await v.pathExists(r):false,P=i&&r?r:"rapidkit-core";r&&!i&&f.warn(`WORKSPAI_DEV_PATH/RAPIDKIT_DEV_PATH points to a path that does not exist: ${r}. Falling back to PyPI.`),n.text=i?"Installing RapidKit from local path":"Installing RapidKit from PyPI";let w=false,j=null;for(let E=1;E<=3;E++)try{i||e$3({status:"started",message:"Installing RapidKit from PyPI",installMethod:"poetry",attempt:E,maxAttempts:3}),await execa(g$1,["-m","pip","install",P,"--quiet"],{cwd:t,timeout:18e4}),w=true,i||e$3({status:"succeeded",message:"RapidKit installed from PyPI",installMethod:"poetry",attempt:E,maxAttempts:3});break}catch(W){j=W,f.debug(`pip install rapidkit-core attempt ${E} failed: ${W}`),E<3&&(n.text=`Retrying installation (attempt ${E+1}/3)`,await new Promise(se=>setTimeout(se,2e3)));}if(!w){let E=j?.stderr||j?.message||"Unknown error";throw f.debug(`All pip install attempts failed. Last error: ${E}`),E.includes("Could not find")||E.includes("No matching distribution")?new g:new f$2("Install rapidkit-core with pip",new Error(`Failed to install rapidkit-core after 3 attempts.
273
272
  Error: ${E}
274
273
 
275
274
  Possible solutions:
276
275
  1. Check your internet connection
277
- 2. Try installing manually: cd ${y.basename(t)} && poetry add rapidkit-core
278
- 3. Use venv method instead: npx workspai ${y.basename(t)} --install-method=venv`))}}else {n.text="Syncing Poetry environment";try{await execa("poetry",["install","--no-root"],{cwd:t,timeout:12e4}),n.succeed("Poetry environment synced");}catch(r){f.debug(`poetry install --no-root failed: ${r}`),n.warn("Could not sync Poetry environment, proceeding with add command");}if(n.start("Installing RapidKit"),s){let r=e$2(a||{});if(!r)throw new f$2("Test mode installation",new Error("No local RapidKit path configured. Set WORKSPAI_DEV_PATH (or legacy RAPIDKIT_DEV_PATH)."));f.debug(`Installing from local path: ${r}`),n.text="Installing RapidKit from local path (test mode)",await execa("poetry",["add",r],{cwd:t});}else {n.text="Installing RapidKit from PyPI";let r=false,i=null;for(let P=1;P<=3;P++)try{e$3({status:"started",message:"Installing RapidKit from PyPI",installMethod:"poetry",attempt:P,maxAttempts:3}),await execa("poetry",["add","rapidkit-core"],{cwd:t,timeout:6e4*P}),r=true,e$3({status:"succeeded",message:"RapidKit installed from PyPI",installMethod:"poetry",attempt:P,maxAttempts:3});break}catch(w){i=w,f.debug(`Poetry add attempt ${P} failed: ${w}`),P<3&&(n.text=`Retrying installation (attempt ${P+1}/3)`,await new Promise(j=>setTimeout(j,2e3)));}if(!r){let P=i?.stderr||i?.message||"Unknown error";throw f.debug(`All Poetry install attempts failed. Last error: ${P}`),P.includes("Could not find")||P.includes("No matching distribution")?new g:new f$2("Install rapidkit-core with Poetry",new Error(`Failed to install rapidkit-core after 3 attempts.
276
+ 2. Try installing manually: cd ${d.basename(t)} && poetry add rapidkit-core
277
+ 3. Use venv method instead: npx workspai ${d.basename(t)} --install-method=venv`))}}else {n.text="Syncing Poetry environment";try{await execa("poetry",["install","--no-root"],{cwd:t,timeout:12e4}),n.succeed("Poetry environment synced");}catch(r){f.debug(`poetry install --no-root failed: ${r}`),n.warn("Could not sync Poetry environment, proceeding with add command");}if(n.start("Installing RapidKit"),s){let r=e$2(a||{});if(!r)throw new f$2("Test mode installation",new Error("No local RapidKit path configured. Set WORKSPAI_DEV_PATH (or legacy RAPIDKIT_DEV_PATH)."));f.debug(`Installing from local path: ${r}`),n.text="Installing RapidKit from local path (test mode)",await execa("poetry",["add",r],{cwd:t});}else {n.text="Installing RapidKit from PyPI";let r=false,i=null;for(let P=1;P<=3;P++)try{e$3({status:"started",message:"Installing RapidKit from PyPI",installMethod:"poetry",attempt:P,maxAttempts:3}),await execa("poetry",["add","rapidkit-core"],{cwd:t,timeout:6e4*P}),r=true,e$3({status:"succeeded",message:"RapidKit installed from PyPI",installMethod:"poetry",attempt:P,maxAttempts:3});break}catch(w){i=w,f.debug(`Poetry add attempt ${P} failed: ${w}`),P<3&&(n.text=`Retrying installation (attempt ${P+1}/3)`,await new Promise(j=>setTimeout(j,2e3)));}if(!r){let P=i?.stderr||i?.message||"Unknown error";throw f.debug(`All Poetry install attempts failed. Last error: ${P}`),P.includes("Could not find")||P.includes("No matching distribution")?new g:new f$2("Install rapidkit-core with Poetry",new Error(`Failed to install rapidkit-core after 3 attempts.
279
278
  Error: ${P}
280
279
 
281
280
  Possible solutions:
282
281
  1. Check your internet connection
283
- 2. Try installing manually: cd ${y.basename(t)} && poetry add rapidkit-core
284
- 3. Use venv method instead: npx workspai ${y.basename(t)} --install-method=venv`))}}}n.succeed("RapidKit installed in project virtualenv");try{let{checkRapidkitCoreAvailable:r}=await import('./pythonRapidkitExec-GCQ3M46E.js');if(!await r()&&!s){n.start("Checking optional global pipx installation");let P=await re(n,true);try{n.start("Installing RapidKit globally with pipx for CLI access"),await H(P,["install","rapidkit-core"]),n.succeed("RapidKit installed globally");}catch(w){n.warn("Could not install globally (non-fatal, project virtualenv has RapidKit)"),f.debug(`pipx install failed: ${w}`);}}}catch(r){n.succeed("Skipped optional global pipx installation"),f.debug(`Global install check skipped: ${r}`);}}async function ve(t,o,n,s,a,l$1=false){n.start(`Checking Python ${o}`);let p=D();try{let{stdout:c}=await execa(p,["--version"]),h=c.match(/Python (\d+\.\d+)/)?.[1];if(h&&!X(h,o))throw new b$4(o,h);n.succeed(`Python ${h} found`);}catch(c){throw c instanceof b$4?c:new b$4(o)}n.start("Creating virtual environment");try{await execa(p,["-m","venv",".venv"],{cwd:t}),n.succeed("Virtual environment created");}catch(c){if(n.fail("Failed to create virtual environment"),(m=>typeof m=="object"&&m!==null&&"stdout"in m&&typeof m.stdout=="string")(c)&&c.stdout.includes("ensurepip is not")){let m=c.stdout.match(/apt install (python[\d.]+-venv)/),g=m?m[1]:"python3-venv";throw new f$2("Python venv module not available",new Error(`Virtual environment creation failed.
282
+ 2. Try installing manually: cd ${d.basename(t)} && poetry add rapidkit-core
283
+ 3. Use venv method instead: npx workspai ${d.basename(t)} --install-method=venv`))}}}n.succeed("RapidKit installed in project virtualenv");try{let{checkRapidkitCoreAvailable:r}=await import('./pythonRapidkitExec-UJYIB6FL.js');if(!await r()&&!s){n.start("Checking optional global pipx installation");let P=await re(n,true);try{n.start("Installing RapidKit globally with pipx for CLI access"),await H(P,["install","rapidkit-core"]),n.succeed("RapidKit installed globally");}catch(w){n.warn("Could not install globally (non-fatal, project virtualenv has RapidKit)"),f.debug(`pipx install failed: ${w}`);}}}catch(r){n.succeed("Skipped optional global pipx installation"),f.debug(`Global install check skipped: ${r}`);}}async function ve(t,o,n,s,a,l$1=false){n.start(`Checking Python ${o}`);let p=D();try{let{stdout:c}=await execa(p,["--version"]),h=c.match(/Python (\d+\.\d+)/)?.[1];if(h&&!X(h,o))throw new b$4(o,h);n.succeed(`Python ${h} found`);}catch(c){throw c instanceof b$4?c:new b$4(o)}n.start("Creating virtual environment");try{await execa(p,["-m","venv",".venv"],{cwd:t}),n.succeed("Virtual environment created");}catch(c){if(n.fail("Failed to create virtual environment"),(m=>typeof m=="object"&&m!==null&&"stdout"in m&&typeof m.stdout=="string")(c)&&c.stdout.includes("ensurepip is not")){let m=c.stdout.match(/apt install (python[\d.]+-venv)/),g=m?m[1]:"python3-venv";throw new f$2("Python venv module not available",new Error(`Virtual environment creation failed.
285
284
 
286
285
  On Debian/Ubuntu systems, install the venv package:
287
286
  sudo apt install ${g}
288
287
 
289
288
  Or use Poetry instead (recommended):
290
- npx workspai ${y.basename(t)} --yes`))}throw new f$2("Virtual environment creation",c instanceof Error?c:new Error(String(c)))}n.start("Installing RapidKit");let u=l(y.join(t,".venv"));if(await execa(u,["-m","pip","install","--upgrade","pip"],{cwd:t}),s){let c=e$2(a||{});if(!c)throw new f$2("Test mode installation",new Error("No local RapidKit path configured. Set WORKSPAI_DEV_PATH (or legacy RAPIDKIT_DEV_PATH)."));f.debug(`Installing from local path: ${c}`),n.text="Installing RapidKit from local path (test mode)",await execa(u,["-m","pip","install","-e",c],{cwd:t});}else {n.text="Installing RapidKit from PyPI";let c=false,h=null;for(let m=1;m<=3;m++)try{e$3({status:"started",message:"Installing RapidKit from PyPI",installMethod:"venv",attempt:m,maxAttempts:3}),await execa(u,["-m","pip","install","rapidkit-core"],{cwd:t,timeout:6e4*m}),c=true,e$3({status:"succeeded",message:"RapidKit installed from PyPI",installMethod:"venv",attempt:m,maxAttempts:3});break}catch(g){h=g,f.debug(`pip install attempt ${m} failed: ${g}`),m<3&&(n.text=`Retrying installation (attempt ${m+1}/3)`,await new Promise(r=>setTimeout(r,2e3)));}if(!c){let m=h?.stderr||h?.message||"Unknown error";throw f.debug(`All pip install attempts failed. Last error: ${m}`),m.includes("Could not find")||m.includes("No matching distribution")?new g:new f$2("Install rapidkit-core with pip",new Error(`Failed to install rapidkit-core after 3 attempts.
289
+ npx workspai ${d.basename(t)} --yes`))}throw new f$2("Virtual environment creation",c instanceof Error?c:new Error(String(c)))}n.start("Installing RapidKit");let u=l(d.join(t,".venv"));if(await execa(u,["-m","pip","install","--upgrade","pip"],{cwd:t}),s){let c=e$2(a||{});if(!c)throw new f$2("Test mode installation",new Error("No local RapidKit path configured. Set WORKSPAI_DEV_PATH (or legacy RAPIDKIT_DEV_PATH)."));f.debug(`Installing from local path: ${c}`),n.text="Installing RapidKit from local path (test mode)",await execa(u,["-m","pip","install","-e",c],{cwd:t});}else {n.text="Installing RapidKit from PyPI";let c=false,h=null;for(let m=1;m<=3;m++)try{e$3({status:"started",message:"Installing RapidKit from PyPI",installMethod:"venv",attempt:m,maxAttempts:3}),await execa(u,["-m","pip","install","rapidkit-core"],{cwd:t,timeout:6e4*m}),c=true,e$3({status:"succeeded",message:"RapidKit installed from PyPI",installMethod:"venv",attempt:m,maxAttempts:3});break}catch(g){h=g,f.debug(`pip install attempt ${m} failed: ${g}`),m<3&&(n.text=`Retrying installation (attempt ${m+1}/3)`,await new Promise(r=>setTimeout(r,2e3)));}if(!c){let m=h?.stderr||h?.message||"Unknown error";throw f.debug(`All pip install attempts failed. Last error: ${m}`),m.includes("Could not find")||m.includes("No matching distribution")?new g:new f$2("Install rapidkit-core with pip",new Error(`Failed to install rapidkit-core after 3 attempts.
291
290
  Error: ${m}
292
291
 
293
292
  Possible solutions:
294
293
  1. Check your internet connection
295
- 2. Try installing manually: cd ${y.basename(t)} && ${l(".venv")} -m pip install rapidkit-core
296
- 3. Use Poetry instead: npx workspai ${y.basename(t)} --install-method=poetry`))}}n.succeed("RapidKit installed in project virtualenv");try{let{checkRapidkitCoreAvailable:c}=await import('./pythonRapidkitExec-GCQ3M46E.js');if(!await c()&&!s){n.start("Checking optional global pipx installation");let m=await re(n,true);try{n.start("Installing RapidKit globally with pipx for CLI access"),await H(m,["install","rapidkit-core"]),n.succeed("RapidKit installed globally");}catch(g){n.warn("Could not install globally (non-fatal, project virtualenv has RapidKit)"),f.debug(`pipx install failed: ${g}`);}}}catch(c){n.succeed("Skipped optional global pipx installation"),f.debug(`Global install check skipped: ${c}`);}}async function He(t,o,n,s,a=false){if(!n)try{let{checkRapidkitCoreVersionCompatible:p}=await import('./pythonRapidkitExec-GCQ3M46E.js'),u=await p();if(u.isCompatible){o.succeed(`RapidKit ${u.installedVersion??""} already compatible globally; skipping pipx installation`),await v.outputFile(y.join(t,".rapidkit-global"),`RapidKit already available globally (version ${u.installedVersion??"unknown"}) and satisfies expected constraint ${u.expectedConstraint??"n/a"}; workspace will reuse the existing installation
297
- `,"utf-8");return}u.reason==="constraint-missing"?o.warn('Version-aware global reuse skipped: no explicit rapidkit-core version constraint found. Set RAPIDKIT_CORE_PYTHON_PACKAGE (example: RAPIDKIT_CORE_PYTHON_PACKAGE="rapidkit-core>=0.4.0,<0.9.0") to enable version-aware reuse. Proceeding with pipx install/upgrade.'):u.reason==="constraint-unsupported"&&o.warn('Version-aware global reuse skipped: RAPIDKIT_CORE_PYTHON_PACKAGE uses an unsupported spec (path/url/git). Use a version range instead (example: RAPIDKIT_CORE_PYTHON_PACKAGE="rapidkit-core==0.4.0" or "rapidkit-core>=0.4.0,<0.9.0"). Proceeding with pipx install/upgrade.'),f.debug(`Global RapidKit install is not reusable via version-aware policy (reason=${u.reason}, installed=${u.installedVersion??"unknown"}, expected=${u.expectedConstraint??"none"}). Proceeding with pipx install/upgrade.`);}catch(p){f.debug(`Global RapidKit version-aware check failed before pipx install: ${p}`);}let l=await re(o,a);if(o.start("Installing RapidKit globally with pipx"),n){let p=e$2(s||{});if(!p)throw new f$2("Test mode installation",new Error("No local RapidKit path configured. Set WORKSPAI_DEV_PATH (or legacy RAPIDKIT_DEV_PATH)."));f.debug(`Installing from local path: ${p}`),o.text="Installing RapidKit from local path (test mode)",await H(l,["install","-e",p]);}else {o.text="Installing RapidKit from PyPI",e$3({status:"started",message:"Installing RapidKit from PyPI",installMethod:"pipx"});try{await H(l,["install","rapidkit-core"]),e$3({status:"succeeded",message:"RapidKit installed from PyPI",installMethod:"pipx"});}catch(p){try{o.text="RapidKit already installed globally, upgrading to match expected version",await H(l,["upgrade","rapidkit-core"]),e$3({status:"succeeded",message:"RapidKit upgraded from PyPI",installMethod:"pipx"});}catch(u){throw f.debug(`pipx install/upgrade failed: install=${p}, upgrade=${u}`),new g}}}o.succeed("RapidKit installed globally"),await v.outputFile(y.join(t,".rapidkit-global"),`RapidKit installed globally with pipx
298
- `,"utf-8");}async function Dt(t,o){let{skipGit:n=false,testMode:s=false,userConfig:a={},yes:l=false,installMethod:p,pythonVersion:u="3.10"}=o||{},c=p||a.defaultInstallMethod||await(async()=>{try{return await execa("poetry",["--version"],{timeout:3e3}),"poetry"}catch{return f.warn("Poetry not found \u2014 auto-selecting venv. Pass --install-method poetry to override."),"venv"}})(),h=c==="poetry"&&!await Ve()?"venv":c;await B(t,y.basename(t),h),await G(t),await Q(t,y.basename(t),h,u,o?.profile);let m=c$2("Registering workspace",{component:"create",phase:"workspace.register"});try{h==="poetry"?(await Se(t,y.basename(t)),await Ge(t,u,m,s,a,l)):h==="venv"?await ve(t,u,m,s,a):await He(t,m,s,a,l),await fe(t,h),await Ue(t,h),m.succeed("Workspace registered"),await V(t,{workspaceName:y.basename(t),silent:s}),n||await J(t,m,"Initial commit: Workspai workspace");}catch(g){throw m.fail("Failed to register workspace"),g}}async function Ue(t,o){let n=o==="poetry"?`source $(poetry env info --path)/bin/activate
294
+ 2. Try installing manually: cd ${d.basename(t)} && ${l(".venv")} -m pip install rapidkit-core
295
+ 3. Use Poetry instead: npx workspai ${d.basename(t)} --install-method=poetry`))}}n.succeed("RapidKit installed in project virtualenv");try{let{checkRapidkitCoreAvailable:c}=await import('./pythonRapidkitExec-UJYIB6FL.js');if(!await c()&&!s){n.start("Checking optional global pipx installation");let m=await re(n,true);try{n.start("Installing RapidKit globally with pipx for CLI access"),await H(m,["install","rapidkit-core"]),n.succeed("RapidKit installed globally");}catch(g){n.warn("Could not install globally (non-fatal, project virtualenv has RapidKit)"),f.debug(`pipx install failed: ${g}`);}}}catch(c){n.succeed("Skipped optional global pipx installation"),f.debug(`Global install check skipped: ${c}`);}}async function Ge(t,o,n,s,a=false){if(!n)try{let{checkRapidkitCoreVersionCompatible:p}=await import('./pythonRapidkitExec-UJYIB6FL.js'),u=await p();if(u.isCompatible){o.succeed(`RapidKit ${u.installedVersion??""} already compatible globally; skipping pipx installation`),await v.outputFile(d.join(t,".rapidkit-global"),`RapidKit already available globally (version ${u.installedVersion??"unknown"}) and satisfies expected constraint ${u.expectedConstraint??"n/a"}; workspace will reuse the existing installation
296
+ `,"utf-8");return}u.reason==="constraint-missing"?o.warn('Version-aware global reuse skipped: no explicit rapidkit-core version constraint found. Set RAPIDKIT_CORE_PYTHON_PACKAGE (example: RAPIDKIT_CORE_PYTHON_PACKAGE="rapidkit-core>=0.4.0,<0.9.0") to enable version-aware reuse. Proceeding with pipx install/upgrade.'):u.reason==="constraint-unsupported"&&o.warn('Version-aware global reuse skipped: RAPIDKIT_CORE_PYTHON_PACKAGE uses an unsupported spec (path/url/git). Use a version range instead (example: RAPIDKIT_CORE_PYTHON_PACKAGE="rapidkit-core==0.4.0" or "rapidkit-core>=0.4.0,<0.9.0"). Proceeding with pipx install/upgrade.'),f.debug(`Global RapidKit install is not reusable via version-aware policy (reason=${u.reason}, installed=${u.installedVersion??"unknown"}, expected=${u.expectedConstraint??"none"}). Proceeding with pipx install/upgrade.`);}catch(p){f.debug(`Global RapidKit version-aware check failed before pipx install: ${p}`);}let l=await re(o,a);if(o.start("Installing RapidKit globally with pipx"),n){let p=e$2(s||{});if(!p)throw new f$2("Test mode installation",new Error("No local RapidKit path configured. Set WORKSPAI_DEV_PATH (or legacy RAPIDKIT_DEV_PATH)."));f.debug(`Installing from local path: ${p}`),o.text="Installing RapidKit from local path (test mode)",await H(l,["install","-e",p]);}else {o.text="Installing RapidKit from PyPI",e$3({status:"started",message:"Installing RapidKit from PyPI",installMethod:"pipx"});try{await H(l,["install","rapidkit-core"]),e$3({status:"succeeded",message:"RapidKit installed from PyPI",installMethod:"pipx"});}catch(p){try{o.text="RapidKit already installed globally, upgrading to match expected version",await H(l,["upgrade","rapidkit-core"]),e$3({status:"succeeded",message:"RapidKit upgraded from PyPI",installMethod:"pipx"});}catch(u){throw f.debug(`pipx install/upgrade failed: install=${p}, upgrade=${u}`),new g}}}o.succeed("RapidKit installed globally"),await v.outputFile(d.join(t,".rapidkit-global"),`RapidKit installed globally with pipx
297
+ `,"utf-8");}async function Mt(t,o){let{skipGit:n=false,testMode:s=false,userConfig:a={},yes:l=false,installMethod:p,pythonVersion:u="3.10"}=o||{},c=p||a.defaultInstallMethod||await(async()=>{try{return await execa("poetry",["--version"],{timeout:3e3}),"poetry"}catch{return f.warn("Poetry not found \u2014 auto-selecting venv. Pass --install-method poetry to override."),"venv"}})(),h=c==="poetry"&&!await Fe()?"venv":c;await B(t,d.basename(t),h),await G(t),await Q(t,d.basename(t),h,u,o?.profile);let m=c$2("Registering workspace",{component:"create",phase:"workspace.register"});try{h==="poetry"?(await $e(t,d.basename(t)),await Le(t,u,m,s,a,l)):h==="venv"?await ve(t,u,m,s,a):await Ge(t,m,s,a,l),await fe(t,h),await He(t,h),m.succeed("Workspace registered"),await V(t,{workspaceName:d.basename(t),silent:s}),n||await J(t,m,"Initial commit: Workspai workspace");}catch(g){throw m.fail("Failed to register workspace"),g}}async function He(t,o){let n=o==="poetry"?`source $(poetry env info --path)/bin/activate
299
298
  # Or simply use: poetry run rapidkit <command>`:o==="venv"?"source .venv/bin/activate # On Windows: .venv\\Scripts\\activate":"N/A (globally installed)",s=o==="poetry"?`# No activation needed (recommended):
300
299
  ./rapidkit --help
301
300
  # or:
@@ -406,7 +405,7 @@ If you encounter issues:
406
405
  2. Check Workspai installation: \`workspai --version\`
407
406
  3. Run diagnostics: \`workspai doctor\`
408
407
  4. Visit Workspai documentation or GitHub issues
409
- `;await promises.writeFile(y.join(t,"README.md"),l,"utf-8");}async function at(t,o,n){let s=c$2("Creating demo workspace",{component:"create",phase:"workspace.demo"});try{await v.ensureDir(t),s.succeed("Directory created"),s.start("Setting up demo kit generator");let a=JSON.stringify({name:`${o}-workspace`,version:"1.0.0",private:true,description:"Workspai demo workspace",scripts:{generate:"node generate-demo.js"}},null,2);await promises.writeFile(y.join(t,"package.json"),a,"utf-8"),await promises.writeFile(y.join(t,"generate-demo.js"),`#!/usr/bin/env node
408
+ `;await promises.writeFile(d.join(t,"README.md"),l,"utf-8");}async function it(t,o,n){let s=c$2("Creating demo workspace",{component:"create",phase:"workspace.demo"});try{await v.ensureDir(t),s.succeed("Directory created"),s.start("Setting up demo kit generator");let a=JSON.stringify({name:`${o}-workspace`,version:"1.0.0",private:true,description:"Workspai demo workspace",scripts:{generate:"node generate-demo.js"}},null,2);await promises.writeFile(d.join(t,"package.json"),a,"utf-8"),await promises.writeFile(d.join(t,"generate-demo.js"),`#!/usr/bin/env node
410
409
  /**
411
410
  * Demo Kit Generator - Create FastAPI demo projects
412
411
  *
@@ -804,7 +803,7 @@ venv/
804
803
  }
805
804
 
806
805
  main().catch(console.error);
807
- `,"utf-8");try{await execa("chmod",["+x",y.join(t,"generate-demo.js")]);}catch{}let p=`# Workspai Demo Workspace
806
+ `,"utf-8");try{await execa("chmod",["+x",d.join(t,"generate-demo.js")]);}catch{}let p=`# Workspai Demo Workspace
808
807
 
809
808
  Welcome to your Workspai demo workspace! This environment lets you generate FastAPI demo projects using bundled Workspai templates, without needing to install Python RapidKit Core.
810
809
 
@@ -891,7 +890,7 @@ ${o}/
891
890
  ---
892
891
 
893
892
  **Generated with Workspai** | [GitHub](https://github.com/rapidkitlabs/workspai)
894
- `;if(await promises.writeFile(y.join(t,"README.md"),p,"utf-8"),s.succeed("Demo workspace setup complete"),!n)if(await $e(t))s.warn("Git initialization skipped because target is already inside a git worktree");else {s.start("Initializing git repository");try{await execa("git",["init"],{cwd:t,env:a$2()}),await v.outputFile(y.join(t,".gitignore"),`# Dependencies
893
+ `;if(await promises.writeFile(d.join(t,"README.md"),p,"utf-8"),s.succeed("Demo workspace setup complete"),!n)if(await Ae(t))s.warn("Git initialization skipped because target is already inside a git worktree");else {s.start("Initializing git repository");try{await execa("git",["init"],{cwd:t,env:a$1()}),await v.outputFile(d.join(t,".gitignore"),`# Dependencies
895
894
  node_modules/
896
895
 
897
896
  # Generated projects
@@ -904,10 +903,10 @@ __pycache__/
904
903
  *.pyc
905
904
  .venv/
906
905
  .env
907
- `,"utf-8"),await execa("git",["add","."],{cwd:t,env:a$2()}),await execa("git",["commit","-m","Initial commit: Demo workspace"],{cwd:t,env:a$2()}),s.succeed("Git repository initialized");}catch{s.warn("Could not initialize git repository");}}console.log(e$1.green(`
906
+ `,"utf-8"),await execa("git",["add","."],{cwd:t,env:a$1()}),await execa("git",["commit","-m","Initial commit: Demo workspace"],{cwd:t,env:a$1()}),s.succeed("Git repository initialized");}catch{s.warn("Could not initialize git repository");}}console.log(e$1.green(`
908
907
  \u2728 Demo workspace created successfully!
909
908
  `)),console.log(e$1.cyan("\u{1F4C2} Location:"),e$1.white(t)),console.log(e$1.cyan(`\u{1F680} Get started:
910
- `)),console.log(e$1.white(` ${f$1(t)}`)),console.log(e$1.white(" node generate-demo.js my-api")),console.log(e$1.white(" cd my-api")),console.log(e$1.white(" workspai init")),console.log(e$1.white(" workspai dev")),console.log(),console.log(e$1.yellow("\u{1F4A1} Note:"),"This is a demo workspace. For Python engine features:"),console.log(e$1.cyan(" pipx install rapidkit")),console.log();}catch(a){throw s.fail("Failed to create demo workspace"),a}}async function rt(t,o,n,s,a,l,p){if(console.log(e$1.cyan(`
909
+ `)),console.log(e$1.white(` ${f$1(t)}`)),console.log(e$1.white(" node generate-demo.js my-api")),console.log(e$1.white(" cd my-api")),console.log(e$1.white(" workspai init")),console.log(e$1.white(" workspai dev")),console.log(),console.log(e$1.yellow("\u{1F4A1} Note:"),"This is a demo workspace. For Python engine features:"),console.log(e$1.cyan(" pipx install rapidkit")),console.log();}catch(a){throw s.fail("Failed to create demo workspace"),a}}async function at(t,o,n,s,a,l,p){if(console.log(e$1.cyan(`
911
910
  \u{1F50D} Dry-run mode - what would be created:
912
911
  `)),console.log(e$1.white("\u{1F4C2} Workspace path:"),t),console.log(e$1.white("\u{1F4DB} Name:"),e$1.cyan(o)),n)console.log(e$1.white("\u{1F4E6} Type:"),"Demo environment"),console.log(e$1.white(`
913
912
  \u{1F4DD} Files to create:`)),console.log(e$1.gray(" - package.json")),console.log(e$1.gray(" - generate-demo.js (project generator)")),console.log(e$1.gray(" - README.md")),console.log(e$1.gray(" - .gitignore")),console.log(e$1.white(`
@@ -917,4 +916,4 @@ __pycache__/
917
916
  \u{1F680} Next steps:`)),console.log(e$1.gray(` 1. ${f$1(t)}`)),console.log(e$1.gray(" 2. npx workspai create project")),console.log(e$1.gray(" 3. npx workspai init")),console.log(e$1.gray(" 4. npx workspai dev")),console.log(e$1.white(`
918
917
  \u{1F4A1} Learn more:`)),console.log(e$1.gray(" \u2022 Change profile later: workspai bootstrap --profile <profile>")),console.log(e$1.gray(" \u2022 Profile options: minimal|java-only|python-only|node-only|go-only|dotnet-only|polyglot|enterprise")),console.log(e$1.gray(" \u2022 Help: npx workspai --help"));}console.log(e$1.white(`
919
918
  \u2728 To proceed: remove --dry-run flag
920
- `));}export{Me as a,St as b,We as c,Je as d,fe as e,Mt as f,Dt as g};
919
+ `));}export{Se as a,$t as b,Oe as c,Be as d,fe as e,St as f,Mt as g};
@@ -1 +1 @@
1
- import {b as b$1}from'./chunk-JHC6SCJC.js';import {j as j$1}from'./chunk-FDDDQMJ2.js';import {c}from'./chunk-P424XYHP.js';import {a}from'./chunk-Y45WZR5N.js';import {f}from'./chunk-7YHK5NM3.js';import {b}from'./chunk-RO73VVHW.js';import {h,g}from'./chunk-5XATWNME.js';import {promises}from'fs';import i from'path';import P,{homedir}from'os';import {pathToFileURL}from'url';import l from'process';function W(e){let t=e.label.indexOf(" \u2014 ");return t>=0?e.label.slice(t+3).trim():e.label.trim()}function j(){let e=c().map(t=>({value:t.id,label:W(t),hint:t.description,name:t.label})),o=j$1().map(t=>({value:t.kitId,label:t.displayName,hint:t.commandDisplay("my-app"),name:`${t.displayName} \u2014 ${t.framework}`}));return [...e,...o]}var E=".workspairc.json",D=".rapidkitrc.json",U=["workspai.config.js","workspai.config.mjs","workspai.config.cjs","rapidkit.config.js","rapidkit.config.mjs","rapidkit.config.cjs"];function I(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="ENOENT"}function x(e,o){let t=o instanceof Error?o.message:String(o),n=e.endsWith(".js")&&/module is not defined in ES module scope/i.test(t)?' CommonJS syntax in a .js config is not valid when the project package uses "type": "module"; rename the file to .cjs or use export default.':"";return `Failed to load Workspai config at ${e}.${n} Cause: ${t}`}async function he(){for(let e of [i.join(P.homedir(),E),i.join(P.homedir(),D)])try{let o=await promises.readFile(e,"utf-8"),t=JSON.parse(o);return f.debug(`Loaded config from ${e}`),t}catch{}return f.debug("No user config found, using defaults"),{}}async function ke(e=process.cwd()){let o=e,t=i.parse(o).root;for(;o!==t;){for(let n of U){let r=i.join(o,n);try{await promises.access(r);}catch(s){if(I(s))continue;throw new Error(x(r,s))}f.debug(`Found config file: ${r}`);try{let d=await import(pathToFileURL(r).href),u=d.default||d;return f.debug(`Loaded Workspai config from ${n}`),u}catch(s){throw new Error(x(r,s))}}o=i.dirname(o);}return f.debug("No Workspai config file found, using defaults"),{}}function ye(e,o,t){return {author:t.author||o.workspace?.defaultAuthor||e.author,pythonVersion:t.pythonVersion||o.workspace?.pythonVersion||e.pythonVersion,defaultInstallMethod:t.defaultInstallMethod||o.workspace?.installMethod||e.defaultInstallMethod,defaultKit:t.defaultKit||o.projects?.defaultKit||e.defaultKit,skipGit:t.skipGit??o.projects?.skipGit??e.skipGit,license:t.license||e.license,testRapidKitPath:t.testRapidKitPath||e.testRapidKitPath}}function we(e){return a("DEV_PATH")||e.testRapidKitPath||void 0}function M(e,o){let t=e.indexOf(o);if(t>=0&&t+1<e.length)return e[t+1];let n=e.find(r=>r.startsWith(`${o}=`));if(n)return n.slice(o.length+1)}function S(e){return e.includes("--here")}function v(e,o=l.cwd()){if(S(e))return i.resolve(o);let t=M(e,"--output");if(t)return i.resolve(t)}function Fe(e,o=l.cwd()){let t=i.resolve(e),n=i.resolve(o),r=i.relative(n,t);return r.length>0&&!r.startsWith("..")&&!i.isAbsolute(r)?`cd ${r}`:`cd ${t}`}function Ee(e,o={}){let t=o.argv??[],n=o.outputParent??v(t,l.cwd());return h(e.trim(),{homeDir:o.homeDir,outputDir:n})}function De(e,o,t={}){return e?i.resolve(e)===i.resolve(o)?true:t.outputParent===void 0:false}async function Ue(e,o={}){let t=o.cwd??l.cwd(),n=o.homeDir??homedir(),r=v(e,t);if(r!==void 0)return r;let s=o.hasYes??(e.includes("--yes")||e.includes("-y"));if(!(o.interactive??(!s&&!!l.stdin.isTTY&&!b())))return;let u=g(n),{location:K}=await b$1([{type:"rawlist",name:"location",message:"Where should the workspace be created?",choices:[{value:"managed",label:"Managed home",hint:u},{value:"here",label:"Current directory",hint:t}],default:0}]);if(K==="here")return i.resolve(t)}export{j as a,he as b,ke as c,ye as d,we as e,Fe as f,Ee as g,De as h,Ue as i};
1
+ import {b as b$1}from'./chunk-NHN4QXPP.js';import {j as j$1}from'./chunk-5PVEQ6CZ.js';import {c}from'./chunk-P424XYHP.js';import {a}from'./chunk-Y45WZR5N.js';import {f}from'./chunk-7YHK5NM3.js';import {b}from'./chunk-RO73VVHW.js';import {h,g}from'./chunk-5XATWNME.js';import {promises}from'fs';import i from'path';import P,{homedir}from'os';import {pathToFileURL}from'url';import l from'process';function W(e){let t=e.label.indexOf(" \u2014 ");return t>=0?e.label.slice(t+3).trim():e.label.trim()}function j(){let e=c().map(t=>({value:t.id,label:W(t),hint:t.description,name:t.label})),o=j$1().map(t=>({value:t.kitId,label:t.displayName,hint:t.commandDisplay("my-app"),name:`${t.displayName} \u2014 ${t.framework}`}));return [...e,...o]}var E=".workspairc.json",D=".rapidkitrc.json",U=["workspai.config.js","workspai.config.mjs","workspai.config.cjs","rapidkit.config.js","rapidkit.config.mjs","rapidkit.config.cjs"];function I(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="ENOENT"}function x(e,o){let t=o instanceof Error?o.message:String(o),n=e.endsWith(".js")&&/module is not defined in ES module scope/i.test(t)?' CommonJS syntax in a .js config is not valid when the project package uses "type": "module"; rename the file to .cjs or use export default.':"";return `Failed to load Workspai config at ${e}.${n} Cause: ${t}`}async function ge(){for(let e of [i.join(P.homedir(),E),i.join(P.homedir(),D)])try{let o=await promises.readFile(e,"utf-8"),t=JSON.parse(o);return f.debug(`Loaded config from ${e}`),t}catch{}return f.debug("No user config found, using defaults"),{}}async function he(e=process.cwd()){let o=e,t=i.parse(o).root;for(;o!==t;){for(let n of U){let r=i.join(o,n);try{await promises.access(r);}catch(s){if(I(s))continue;throw new Error(x(r,s))}f.debug(`Found config file: ${r}`);try{let d=await import(pathToFileURL(r).href),u=d.default||d;return f.debug(`Loaded Workspai config from ${n}`),u}catch(s){throw new Error(x(r,s))}}o=i.dirname(o);}return f.debug("No Workspai config file found, using defaults"),{}}function ke(e,o,t){return {author:t.author||o.workspace?.defaultAuthor||e.author,pythonVersion:t.pythonVersion||o.workspace?.pythonVersion||e.pythonVersion,defaultInstallMethod:t.defaultInstallMethod||o.workspace?.installMethod||e.defaultInstallMethod,defaultKit:t.defaultKit||o.projects?.defaultKit||e.defaultKit,skipGit:t.skipGit??o.projects?.skipGit??e.skipGit,license:t.license||e.license,testRapidKitPath:t.testRapidKitPath||e.testRapidKitPath}}function ye(e){return a("DEV_PATH")||e.testRapidKitPath||void 0}function M(e,o){let t=e.indexOf(o);if(t>=0&&t+1<e.length)return e[t+1];let n=e.find(r=>r.startsWith(`${o}=`));if(n)return n.slice(o.length+1)}function S(e){return e.includes("--here")}function v(e,o=l.cwd()){if(S(e))return i.resolve(o);let t=M(e,"--output");if(t)return i.resolve(t)}function je(e,o=l.cwd()){let t=i.resolve(e),n=i.resolve(o),r=i.relative(n,t);return r.length>0&&!r.startsWith("..")&&!i.isAbsolute(r)?`cd ${r}`:`cd ${t}`}function Fe(e,o={}){let t=o.argv??[],n=o.outputParent??v(t,l.cwd());return h(e.trim(),{homeDir:o.homeDir,outputDir:n})}function Ee(e,o,t={}){return e?i.resolve(e)===i.resolve(o)?true:t.outputParent===void 0:false}async function De(e,o={}){let t=o.cwd??l.cwd(),n=o.homeDir??homedir(),r=v(e,t);if(r!==void 0)return r;let s=o.hasYes??(e.includes("--yes")||e.includes("-y"));if(!(o.interactive??(!s&&!!l.stdin.isTTY&&!b())))return;let u=g(n),{location:K}=await b$1([{type:"rawlist",name:"location",message:"Where should the workspace be created?",choices:[{value:"managed",label:"Managed home",hint:u},{value:"here",label:"Current directory",hint:t}],default:0}]);if(K==="here")return i.resolve(t)}export{j as a,ge as b,he as c,ke as d,ye as e,je as f,Fe as g,Ee as h,De as i};