workspai 0.43.1 → 0.44.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 (134) hide show
  1. package/README.md +23 -10
  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/command-capabilities.v1.json +138 -0
  6. package/contracts/compatibility-matrix.v1.json +37 -0
  7. package/contracts/create-planner-capabilities.v1.json +156 -65
  8. package/contracts/doctor-project-scan.v2.json +60 -0
  9. package/contracts/doctor-remediation-plan.v1.json +19 -4
  10. package/contracts/doctor-remediation-plan.v2.json +7 -0
  11. package/contracts/doctor-workspace-cache.v2.json +82 -0
  12. package/contracts/extension-cli-compatibility.v1.json +47 -3
  13. package/contracts/infra-plan.v1.json +189 -0
  14. package/contracts/private-product-manifest.v1.json +155 -0
  15. package/contracts/product-factory-plan.v1.json +200 -0
  16. package/contracts/project-archive.v1.json +40 -0
  17. package/contracts/project-entry-capability.v1.json +127 -0
  18. package/contracts/published-contract-catalog.v1.json +334 -0
  19. package/contracts/runtime-command-surface.v1.json +239 -10
  20. package/contracts/version.v1.json +48 -0
  21. package/contracts/workspace-archive-capabilities.v1.json +90 -0
  22. package/contracts/workspace-archive-manifest.v1.json +107 -0
  23. package/contracts/workspace-archive-operation-result.v1.json +565 -0
  24. package/contracts/workspace-intelligence/agent-customization-pack-report.v1.json +98 -0
  25. package/contracts/workspace-intelligence/agent-hooks.v1.json +38 -0
  26. package/contracts/workspace-intelligence/agent-reports-index.v1.json +56 -0
  27. package/contracts/workspace-intelligence/mcp-design.v1.json +42 -0
  28. package/contracts/workspace-intelligence/workspace-context.v1.json +12 -0
  29. package/contracts/workspace-intelligence/workspace-explain.v1.json +1 -0
  30. package/contracts/workspace-intelligence-architecture.v1.json +723 -0
  31. package/contracts/workspace-intelligence-chain.v1.json +1194 -0
  32. package/contracts/workspace-list.v1.json +56 -0
  33. package/contracts/workspace-model-cache.v1.json +55 -0
  34. package/contracts/workspace-snapshot.v1.json +58 -0
  35. package/contracts/workspace-snapshot.v2.json +97 -0
  36. package/contracts/workspace-sync.v1.json +30 -0
  37. package/contracts/workspace-watch-event.v1.json +112 -0
  38. package/dist/analyze-6OCBM4ID.js +1 -0
  39. package/dist/{artifact-remediation-plan-244S5K6I.js → artifact-remediation-plan-Z7OCSME3.js} +2 -2
  40. package/dist/autopilot-release-LI2WJCEW.js +1 -0
  41. package/dist/{chunk-LZQNVH7D.js → chunk-2K3GYCPS.js} +1 -1
  42. package/dist/chunk-2QN6BMM7.js +2 -0
  43. package/dist/chunk-2QOWRBQD.js +1 -0
  44. package/dist/chunk-5AKYMAIL.js +1 -0
  45. package/dist/{chunk-FDDDQMJ2.js → chunk-5PVEQ6CZ.js} +1 -1
  46. package/dist/{chunk-DOCPUNWS.js → chunk-7EIMPQR3.js} +1 -1
  47. package/dist/{chunk-U6AXYUQY.js → chunk-7IHLTPZ6.js} +1 -1
  48. package/dist/chunk-7RIWU5TZ.js +1 -0
  49. package/dist/chunk-B66A4TVP.js +1 -0
  50. package/dist/chunk-CL6TGI4Q.js +8 -0
  51. package/dist/chunk-FWJV7CCI.js +2 -0
  52. package/dist/chunk-J4AICQFB.js +1 -0
  53. package/dist/chunk-JICOD2GI.js +1 -0
  54. package/dist/{chunk-EMTQ6OKI.js → chunk-JP25YL3J.js} +1 -1
  55. package/dist/chunk-L2Q7B2OJ.js +1 -0
  56. package/dist/chunk-L3E6IRUQ.js +8 -0
  57. package/dist/chunk-LG6RFLPZ.js +1 -0
  58. package/dist/chunk-LGP6WXS2.js +4 -0
  59. package/dist/{chunk-ONU457VN.js → chunk-M4VITK6X.js} +52 -50
  60. package/dist/chunk-NTXO7BMH.js +4 -0
  61. package/dist/{chunk-PPHTYJ7G.js → chunk-OW4UNG27.js} +36 -37
  62. package/dist/chunk-P4SWTY5X.js +33 -0
  63. package/dist/chunk-TRMDODFM.js +13 -0
  64. package/dist/chunk-UNF72FTB.js +1 -0
  65. package/dist/chunk-V5JN4TDX.js +2 -0
  66. package/dist/chunk-VA5MRHKM.js +2 -0
  67. package/dist/chunk-XIVFLY6G.js +1 -0
  68. package/dist/chunk-YUX4YFGL.js +78 -0
  69. package/dist/{create-42RTNLH2.js → create-DFAWAS5C.js} +1 -1
  70. package/dist/doctor-PVSWDBJL.js +1 -0
  71. package/dist/index.d.ts +250 -24
  72. package/dist/index.js +194 -195
  73. package/dist/pipeline-ND734AJM.js +5 -0
  74. package/dist/{platform-capabilities-XAVU4HSM.js → platform-capabilities-YICBF4FA.js} +1 -1
  75. package/dist/{pythonRapidkitExec-GCQ3M46E.js → pythonRapidkitExec-UJYIB6FL.js} +1 -1
  76. package/dist/{workspace-DZHWB7BV.js → workspace-FQT3QIRS.js} +1 -1
  77. package/dist/workspace-agent-sync-ZYCPXTU3.js +1 -0
  78. package/dist/workspace-archive-EEGLHZDW.js +10 -0
  79. package/dist/workspace-context-WAGGJCDL.js +1 -0
  80. package/dist/{workspace-contract-2TA27LGT.js → workspace-contract-SEI4SNSG.js} +1 -1
  81. package/dist/workspace-explain-MVGGRCDN.js +1 -0
  82. package/dist/workspace-explain-contract-KT757JGQ.js +1 -0
  83. package/dist/{workspace-feedback-R6H4UFZB.js → workspace-feedback-RCB25NFO.js} +1 -1
  84. package/dist/{workspace-foundation-FQWHPQGX.js → workspace-foundation-KXDL6P6X.js} +1 -1
  85. package/dist/{workspace-history-CGCK2DJI.js → workspace-history-M4QQBIPB.js} +1 -1
  86. package/dist/workspace-intelligence-QOGD2TZS.js +1 -0
  87. package/dist/workspace-mcp-serve-CEFKEMYG.js +3 -0
  88. package/dist/{workspace-model-F3B75TYT.js → workspace-model-GMSRBICO.js} +1 -1
  89. package/dist/workspace-registry-summary-S52SEJAG.js +1 -0
  90. package/dist/workspace-run-VC4OUPRF.js +1 -0
  91. package/dist/{workspace-verify-OAATQV5T.js → workspace-verify-NP4GMFSV.js} +1 -1
  92. package/dist/workspace-watch-IIBH3Y25.js +1 -0
  93. package/docs/AI_FEATURES.md +67 -34
  94. package/docs/README.md +2 -1
  95. package/docs/commands-reference.md +26 -14
  96. package/docs/contracts/ARTIFACT_CATALOG.md +60 -36
  97. package/docs/contracts/README.md +3 -2
  98. package/docs/create-planner-capabilities.md +36 -18
  99. package/docs/workspace-operations.md +25 -0
  100. package/package.json +26 -14
  101. package/scripts/enterprise-package-smoke.mjs +40 -8
  102. package/scripts/prepack-enterprise.mjs +8 -0
  103. package/dist/analyze-5BU4QIPK.js +0 -1
  104. package/dist/autopilot-release-45YVOBQO.js +0 -1
  105. package/dist/chunk-3QVTWKUI.js +0 -4
  106. package/dist/chunk-753LOKFZ.js +0 -2
  107. package/dist/chunk-AMDKXXLP.js +0 -1
  108. package/dist/chunk-AQ4XZZC6.js +0 -1
  109. package/dist/chunk-CDE4Q77U.js +0 -2
  110. package/dist/chunk-DNAY5ALC.js +0 -1
  111. package/dist/chunk-FHSMY75W.js +0 -1
  112. package/dist/chunk-FM7GMFZA.js +0 -2
  113. package/dist/chunk-HV5ZFXAZ.js +0 -13
  114. package/dist/chunk-LRW2SAGL.js +0 -4
  115. package/dist/chunk-LTWYYP6E.js +0 -7
  116. package/dist/chunk-NAAQMSO3.js +0 -1
  117. package/dist/chunk-NFUXULIF.js +0 -1
  118. package/dist/chunk-OL64GWQC.js +0 -9
  119. package/dist/chunk-SI3AQKIP.js +0 -1
  120. package/dist/chunk-TH5Y3EMA.js +0 -33
  121. package/dist/chunk-UQKCCWUL.js +0 -78
  122. package/dist/chunk-XNGANEXM.js +0 -2
  123. package/dist/doctor-DK4BON3N.js +0 -1
  124. package/dist/pipeline-HQ57V6OZ.js +0 -5
  125. package/dist/workspace-agent-sync-5ADIQS7B.js +0 -1
  126. package/dist/workspace-archive-GCZNI44O.js +0 -3
  127. package/dist/workspace-context-GEXDHA7A.js +0 -1
  128. package/dist/workspace-explain-D5NNL3NG.js +0 -1
  129. package/dist/workspace-explain-contract-DNS2YEL7.js +0 -1
  130. package/dist/workspace-intelligence-BEM6WGCZ.js +0 -1
  131. package/dist/workspace-mcp-serve-OMBA5V3C.js +0 -3
  132. package/dist/workspace-registry-summary-6MFBRWDS.js +0 -1
  133. package/dist/workspace-run-3WJXIQKR.js +0 -1
  134. package/dist/workspace-watch-HU2OTQ52.js +0 -1
@@ -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-7EIMPQR3.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$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-FQT3QIRS.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-SEI4SNSG.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};
@@ -0,0 +1,33 @@
1
+ import {d as d$1,b as b$2,e,f as f$1}from'./chunk-V5JN4TDX.js';import {d as d$2}from'./chunk-UNF72FTB.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-JICOD2GI.js';import {j}from'./chunk-2QN6BMM7.js';import {f,b as b$3,a as a$1}from'./chunk-FWJV7CCI.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,13 @@
1
+ import {a as a$1}from'./chunk-JEI6BTZI.js';import {d as d$1,b}from'./chunk-UNF72FTB.js';import {g}from'./chunk-VA5MRHKM.js';import {a}from'./chunk-J4AICQFB.js';import {c,e,d}from'./chunk-XIVFLY6G.js';import {n}from'./chunk-JICOD2GI.js';import {j as j$1,a as a$2}from'./chunk-2QN6BMM7.js';import {g as g$1,b as b$1}from'./chunk-FWJV7CCI.js';import {a as a$3}from'./chunk-LG6RFLPZ.js';import j from'path';import W from'fs-extra';function G(e$1){switch(e$1){case "why":return d;case "trace":return e;default:return c}}async function P(e,n,o){try{if(!await W.pathExists(e))return null;let r=await W.readJson(e);return n?b$1(n,r,e):o&&a$3(r,o,e),r}catch(r){if((n||o)&&await W.pathExists(e))throw r;return null}}function z(e,n){if(!e)return null;let o=n.trim().toLowerCase();return e.projects.find(r=>r.slug.toLowerCase()===o||r.relativePath.toLowerCase()===o)??null}function J(e,n,o){let r=o.trim().toLowerCase(),t=(e.graph?.nodes.map(a=>a.id)??e.projects.map(a=>a.name)).find(a=>a.toLowerCase()===r);if(t)return t;let d=e.projects.find(a=>[a.name,a.path,j.basename(a.path)].filter(u=>u.trim().length>0).some(u=>u.toLowerCase()===r));if(d)return d.name;let c=z(n,o);if(c){let a=e.projects.find(u=>u.path===c.relativePath||u.path.endsWith(`/${c.relativePath}`));if(a)return a.name}return o}function X(e,n){if(!e)return [];let o=n.trim().toLowerCase(),r=new Set;for(let l of e.projects){l.contracts.dependsOn?.some(t=>t.toLowerCase()===o)&&r.add(l.slug);for(let t of l.contracts.consumes??[])for(let d of e.projects)d.contracts.publishes?.includes(t)&&d.slug===o&&r.add(l.slug);}return [...r].sort()}function Y(e,n){if(!e)return [];let o=n.trim().toLowerCase();return e.steps.filter(r=>r.scope==="project"&&r.project?.toLowerCase()===o&&r.command?.display).map(r=>r.command.display).slice(0,8)}function p(e,n,o){return {id:e,title:n,body:o.trim()}}async function me(e){let n$1=j.resolve(e.workspacePath),o=(e.now??new Date).toISOString(),r=e.model??await n({workspacePath:n$1,includeEvidence:true}),l=e.contract;if(l===void 0)try{l=(await j$1({workspacePath:n$1})).contract;}catch{l=null;}let t=e.verify;t===void 0&&(t=await P(j.join(n$1,d$1),d$1));let d=e.impact;if(d===void 0&&(d=await P(j.join(n$1,g),g)),e.target.kind==="release-blocked"){let s=t?.blockingReasons??[],i=(r.summary?.projectCount??r.projects.length)===0,g=[p("verdict",i?"Workspace scaffold posture":"Release verdict",t?i?`Scaffold posture: **${t.summary.verdict}** (exit ${t.summary.exitCode}). Freshness: **${t.freshness.verdict}**. No registered projects yet \u2014 release gates apply after the first project is added.`:`Verdict: **${t.summary.verdict}** (exit ${t.summary.exitCode}). Risk: **${t.impact.risk}**. Freshness: **${t.freshness.verdict}**.`:"No workspace verify report found. Run `npx workspai workspace verify --json --write` first."),p("blockers",i?"Pre-project signals":"Blocking reasons",s.length?s.map(h=>`- ${h}`).join(`
2
+ `):i?"No pre-project signals in the latest verify report.":"No blocking reasons in the latest verify report.")];return t?.resolutionHints?.length&&g.push(p("resolution","Resolution hints",t.resolutionHints.map(h=>`- **${h.blockerId}** (${h.resolutionClass}): ${h.commandRetryHint??h.fixHints[0]?.detail??"See fix hints"}`).join(`
3
+ `))),{schemaVersion:a,generatedAt:o,workspacePath:n$1,target:e.target,summary:t?i?b(s.length,t.summary.verdict):`Release blocked: ${t.summary.verdict} with ${s.length} blocking reason(s).`:"Release posture unknown \u2014 verify report missing.",sections:g,releaseRisk:t?.impact.risk,blockingReasons:s,resolutionHints:t?.resolutionHints}}if(e.target.kind==="blocker"){let s=e.target,m=t?.resolutionHints?.find(g=>g.blockerId===s.blockerId),i=t?.blockingReasons.find(g=>g.includes(s.blockerId))??t?.blockingReasons[0];return {schemaVersion:a,generatedAt:o,workspacePath:n$1,target:s,summary:m?`Blocker ${s.blockerId}: ${m.resolutionClass}`:`Blocker ${s.blockerId} (no structured hint)`,sections:[p("reason","Blocking signal",i??"No matching blocking reason in verify."),p("hint","Resolution class",m?`${m.resolutionClass}
4
+
5
+ ${m.commandRetryHint??""}
6
+
7
+ ${m.fixHints.map(g=>`- ${g.detail}`).join(`
8
+ `)}`:"Run workspace verify to emit resolutionHints for this blocker.")],blockingReasons:i?[i]:[],resolutionHints:m?[m]:[]}}if(e.target.kind==="trace"){let s=j.isAbsolute(e.target.diffRef)?e.target.diffRef:j.join(n$1,e.target.diffRef),m=await P(s,void 0,"contracts/workspace-intelligence/workspace-model-diff.v1.json"),i=m?.summary?.changedProjects??[...new Set((m?.changes??[]).map(f=>f.project).filter(Boolean))],h=(r.summary?.projectCount??r.projects.length)===0,T=d?.transitiveImpact?.map(f=>`${f.project?.name??f.target} (d${f.distance??0}, via ${f.via??"\u2014"})`)??[],y=t?.affectedSubgraph;return {schemaVersion:a,generatedAt:o,workspacePath:n$1,target:e.target,summary:i?.length?`Trace from ${i.length} changed project(s) through blast radius to gate coverage.`:h?"Trace: workspace scaffold baseline \u2014 no project changes in the latest diff.":"Trace: diff baseline present with no project changes.",sections:[p("origin","Change origin",i?.length?i.map(f=>`- ${f}`).join(`
9
+ `):"No changed projects in diff."),p("blast-radius","Transitive impact",T.length?T.map(f=>`- ${f}`).join(`
10
+ `):"No transitive impact report."),p("gate","Subgraph gate",y?`Directly changed: ${y.directlyChanged}; transitive dependents: ${y.transitiveDependents}; covered: ${y.covered}; uncovered: ${y.uncovered}; unverifiable: ${y.unverifiable}.`:"No verify subgraph coverage available.")],releaseRisk:d?.summary?.risk??t?.impact.risk,blockingReasons:t?.blockingReasons}}let c=e.target.project,a$2=J(r,l,c),u=r.graph,k=u?a$1(u,a$2):{found:false,centrality:null,directDependents:[],transitiveDependents:[]},w=z(l,c),E=X(l,c),b$1=Y(t,c),v=r.projects.find(s=>s.name.toLowerCase()===c.toLowerCase()),x=[p("overview","Project overview",v?`${v.name} (${v.frameworkDisplayName}, ${v.runtime}) at \`${v.path}\`.`:`Project **${c}** ${k.found?"exists in graph":"not found in workspace model"}.`),p("consumers","Consumers / dependents",[`Direct dependents: ${k.directDependents.join(", ")||"none"}`,`Contract consumers: ${E.join(", ")||"none"}`,`Transitive dependents (blast radius): ${k.transitiveDependents.length}`].join(`
11
+ `)),p("contracts","Critical contracts",w?[`Owns: ${w.contracts?.owns?.join(", ")||"none"}`,`Publishes: ${w.contracts.publishes.join(", ")||"none"}`,`Consumes: ${w.contracts.consumes.join(", ")||"none"}`,`APIs: ${w.contracts.apis.map(s=>s.name).join(", ")||"none"}`].join(`
12
+ `):"No workspace.contract.json entry for this project."),p("verification","Required verification",b$1.length?b$1.map(s=>`- ${s}`).join(`
13
+ `):"- `npx workspai workspace verify --json`\n- Project test/build via `workspace run` when configured")];k.centrality&&x.push(p("centrality","Graph centrality",`fanIn ${k.centrality.fanIn}, fanOut ${k.centrality.fanOut}, reach ${k.centrality.reach}, hotspot ${k.centrality.isHotspot?"yes":"no"}.`));let I=c.trim().toLowerCase(),A=s=>s.project?.name?.toLowerCase()===I||s.target.toLowerCase()===I,S=d?.affectedProjects?.find(A)?.risk??d?.transitiveImpact?.find(A)?.risk??t?.impact.risk??"unknown";return {schemaVersion:a,generatedAt:o,workspacePath:n$1,target:e.target,summary:`${c}: ${E.length} consumer(s), release risk **${S}**.`,sections:x,releaseRisk:String(S)}}async function fe(e,n,o="explain"){let r=G(o);return await g$1(n,r,a$2(e)),r}export{G as a,me as b,fe as c};
@@ -0,0 +1 @@
1
+ import {c as c$1}from'./chunk-B66A4TVP.js';import {a as a$2,b as b$2}from'./chunk-PYCJWW4B.js';import {b as b$1,c,d}from'./chunk-7IHLTPZ6.js';import {j,a as a$1,o,g as g$1,d as d$1,p,f as f$1}from'./chunk-VA5MRHKM.js';import {n,b as b$3}from'./chunk-JICOD2GI.js';import {a as a$3}from'./chunk-2QN6BMM7.js';import {f,g}from'./chunk-FWJV7CCI.js';import {a as a$4}from'./chunk-LG6RFLPZ.js';import {b,a}from'./chunk-5AKYMAIL.js';import m from'path';import v from'fs-extra';var re="rapidkit-blocker-resolution-v1";function ie(e){let t=e.blockers.map(s=>s.trim()).filter(Boolean).slice(0,12),r=e.stderrTail?.trim().slice(-400)??"";return b$3({blockers:t,exitCode:e.exitCode??null,stderrTail:r})}function me(e){let t=e.trim().toLowerCase();return t?t.includes("missing evidence")||t.includes(": missing")||t.includes("artifact missing")||t.includes("not found on disk")?"artifact-missing":t.includes("policy.")||t.includes("contract")?"config-fixable":t.includes("impact")||t.includes("untracked")||t.includes("grounding")?"semantic-attention":t.includes("failed")||t.includes("blocked")||t.includes(": fail")?"command-failed-repeat":"config-fixable":"unresolvable-without-human"}function ge(e){let t=me(e.reason),r=ie({blockers:[e.reason]}),s=t==="artifact-missing"?[{actionKind:"run-once",detail:e.sourceCommand?`Run the source command once: ${e.sourceCommand}`:"Run the mapped workspace intelligence command once to generate the missing artifact.",studioActionId:"run-analyze"}]:t==="semantic-attention"?[{actionKind:"commit-files",detail:"Review workspace-level grounding files (AGENTS.md, agent-sync outputs) and commit or refresh the impact baseline."},{actionKind:"refresh-baseline",detail:"Refresh snapshot + diff + impact before re-running verify."}]:[{actionKind:"edit-file",detail:"Apply the smallest safe file or policy fix for this blocker before re-running verification.",studioActionId:"fix-lens"}];return {schemaVersion:re,blockerId:e.blockerId,sourceCommand:e.sourceCommand,sourceArtifact:e.sourceArtifact,resolutionClass:t,blockerSignature:r,commandRetryHint:t==="artifact-missing"?"Run the source command once, then verify.":"Do not re-run the same failing command; fix the source issue first, then verify.",fixHints:s,verifyCommand:e.verifyCommand,verifyArtifact:e.verifyArtifact}}function ne(e){return Array.from(new Set(e.blockingReasons.map(r=>r.trim()).filter(Boolean))).slice(0,12).map((r,s)=>ge({reason:r,blockerId:`blocker-${s+1}`,sourceCommand:e.sourceCommand,sourceArtifact:e.sourceArtifact,verifyCommand:e.verifyCommand,verifyArtifact:e.verifyArtifact}))}function ke(e){let t=e.toLowerCase();return t.includes("stale")||t.includes("missing evidence")||t.includes("no projects")||t.includes("projects.empty")||t.includes("projects discovered")||t.includes("projects.missing")||t.includes("not yet run")||t.includes("doctor-last-run")||t.includes("doctor-project-last-run")||t.includes("doctor-remediation-plan-last-run")||t.includes("doctor-fix-result-last-run")||t.includes("pipeline-last-run")||t.includes("release-readiness")||t.includes("analyze-last-run")||t.includes("analyze reported")||t.includes("analyze verdict")||t.includes("analyze needs attention")||t.includes("toolchain.lock")||t.includes("not pinned")||t.includes("readiness:")||t.includes("env:")||t.includes("workspace-run-last")||t.includes("pre-project")||t.includes("before adding projects")||t.includes("workspace.projects.missing")||t.includes("no backend projects")||t.includes("index.json")||t.includes("workspace-intelligence-history")||t.includes("validation warning")||t.includes("workspace model validation")||t.includes("workspace.marker")||t.includes("no project roots")||t.includes("no infrastructure services")||t.includes("infra/overrides")||t.includes("infra dependencies")||t.includes("contract verify")||t.includes("contract inspect")||t.includes("publish verify evidence")}function he(e){return e.length===0||e.every(t=>ke(t))}function oe(e){return e.projectCount>0||e.policyErrorCount>0?{verdict:e.verdict,exitCode:e.exitCode}:e.verdict==="blocked"&&he(e.blockingReasons)?{verdict:"needs-attention",exitCode:1}:{verdict:e.verdict,exitCode:e.exitCode}}function Ge(e,t){let r=t&&t!=="ready"?` (${t.replace(/-/g," ")})`:"";return e===0?`Workspace scaffold ready${r} \u2014 add your first project to continue.`:`Workspace scaffold${r}: ${e} pre-project signal(s) \u2014 add your first project to continue.`}var ce=b.verify,T=a.verify;function ye(e,t){return m.isAbsolute(t)?t:m.join(e,t)}async function ae(e){let t=await v.readJson(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Workspace impact input is not a JSON object: ${e}`);let r=t;if(r.schemaVersion!==f$1)throw new Error(`Unsupported workspace impact schema: ${String(r.schemaVersion)}`);a$4(t,"contracts/workspace-intelligence/workspace-impact.v1.json",`Workspace impact ${e}`);let s=r;a$4(s.diff,"contracts/workspace-intelligence/workspace-model-diff.v1.json",`Embedded workspace diff in ${e}`);let i=[];s.summary.affectedProjects!==s.affectedProjects.length&&i.push("summary.affectedProjects does not match affectedProjects.length"),s.summary.workspaceItems!==s.workspaceImpact.length&&i.push("summary.workspaceItems does not match workspaceImpact.length"),s.summary.recommendedCommands!==s.verificationPlan.length&&i.push("summary.recommendedCommands does not match verificationPlan.length"),s.summary.blastRadius.directlyAffected!==s.affectedProjects.length&&i.push("blastRadius.directlyAffected does not match affectedProjects.length"),s.summary.blastRadius.transitivelyAffected!==s.transitiveImpact.length&&i.push("blastRadius.transitivelyAffected does not match transitiveImpact.length");let n=s.transitiveImpact.reduce((a,l)=>Math.max(a,l.distance??0),0);s.summary.blastRadius.maxDistance!==n&&i.push("blastRadius.maxDistance does not match transitive impact distances");let g=s.diff.currentModel.graph?.edges.length??0;if(s.summary.blastRadius.graphEdges!==g&&i.push("blastRadius.graphEdges does not match the embedded model graph"),s.summary.changed!==s.diff.summary.changed&&i.push("summary.changed does not match embedded diff summary"),s.fromRef!==s.diff.fromRef&&i.push("fromRef does not match embedded diff fromRef"),s.workspace.name!==s.diff.currentModel.workspace.name&&i.push("workspace.name does not match the embedded model"),s.diff.toHash!==j(s.diff.currentModel)&&i.push("embedded diff current-model hash does not match toHash"),i.length>0)throw new Error(`Workspace impact semantic integrity failed: ${i.join("; ")} (${e})`);return s}function ve(e){let t=new Set,r=[];for(let s of e){let i=`${s.scope}:${s.project??""}:${s.display}`;t.has(i)||(t.add(i),r.push(s));}return r}function be(e,t){if(!e||e==="workspace")return true;let r=(e.startsWith("project:")?e.slice(8):e).trim().toLowerCase();return t.scope==="workspace"?true:(t.project??"").trim().toLowerCase()===r}function we(e,t){if(e.id==="workspace.doctor")return m.join(t,a.doctor);if(e.id==="workspace.contract.verify")return m.join(t,a.contractVerify);if(e.id==="workspace.readiness")return m.join(t,a.readiness);if(e.id==="workspace.analyze")return m.join(t,".workspai","reports","analyze-last-run.json");if(e.id==="workspace.pipeline")return m.join(t,".workspai","reports","pipeline-last-run.json");if(e.id==="workspace.doctor-fix")return m.join(t,".workspai","reports","doctor-fix-result-last-run.json");if(e.id.startsWith("project.")&&e.id.includes("."))return m.join(t,".workspai","reports","workspace-run-last.json")}function C(e){return !e||typeof e!="object"||Array.isArray(e)?null:e}function Re(e){let t=C(e.healthScore),r=typeof t?.errors=="number"?t.errors:0,s=typeof t?.percent=="number"?t.percent:void 0;return r>0?{status:"fail",message:`Doctor evidence reports ${r} error(s).`}:typeof s=="number"&&s<70?{status:"warn",message:`Doctor health score is ${s}%.`}:{status:"pass",message:"Doctor evidence is present and healthy."}}function Ce(e){let t=typeof e.overallStatus=="string"?e.overallStatus:"unknown";return t==="fail"?{status:"fail",message:"Release readiness evidence reports blocking failures."}:t==="warn"?{status:"warn",message:"Release readiness evidence reports warnings."}:t==="pass"?{status:"pass",message:"Release readiness evidence passed."}:{status:"warn",message:`Release readiness evidence status is ${t}.`}}function We(e){let t=typeof e.status=="string"?e.status:"unknown";return t==="failed"||t==="fail"?{status:"fail",message:"Workspace contract verify evidence failed."}:t==="passed"||t==="pass"?{status:"pass",message:"Workspace contract verify evidence passed."}:{status:"warn",message:`Workspace contract verify evidence status is ${t}.`}}function xe(e){let t=C(e.summary);if(t?.blocking===true||e.blocking===true)return {status:"fail",message:"Analyze evidence reports blocking findings."};let s=typeof t?.status=="string"?t.status:void 0;return s==="warn"||s==="warning"?{status:"warn",message:"Analyze evidence reports warnings."}:{status:"pass",message:"Analyze evidence is present."}}function je(e){let t=e.schemaVersion==="rapidkit-doctor-fix-result-v1"?e:e.fixResult;if(!t||typeof t!="object"||Array.isArray(t))return {status:"skipped",message:"Doctor fix result not present; run doctor workspace --fix --json to record fixes."};let r=t,s=Array.isArray(r.remainingBlockers)?r.remainingBlockers:[];if(s.length>0)return {status:"fail",message:`Doctor fix result reports ${s.length} remaining blocker(s).`};let i=Array.isArray(r.appliedFixes)?r.appliedFixes:[];return i.length===0?{status:"pass",message:"Doctor fix result recorded with no remaining blockers."}:{status:"pass",message:`Doctor fix result recorded ${i.length} applied fix(es) with no remaining blockers.`}}async function Ae(e,t){let r=await f(e,".workspai/reports/doctor-remediation-plan-last-run.json");if(!r)return false;try{let s=C(await v.readJson(r));if(!s||(Array.isArray(s.steps)?s.steps:[]).length>0)return false;let n=typeof s.generatedAt=="string"?s.generatedAt:void 0;if(!n||!t)return true;let g=Date.parse(n),a=Date.parse(t);return !Number.isFinite(g)||!Number.isFinite(a)?true:g>=a}catch{return false}}function Ee(e){return e.id.endsWith(".init")?"init":e.id.endsWith(".test")?"test":e.id.endsWith(".build")?"build":e.id.endsWith(".start")?"start":null}function Se(e){let t=C(e.summary),r=typeof t?.verdict=="string"?t.verdict:void 0;return r==="blocked"?{status:"fail",message:"Pipeline evidence is blocked."}:r==="needs-attention"?{status:"warn",message:"Pipeline evidence needs attention."}:r==="ready"?{status:"pass",message:"Pipeline evidence is ready."}:{status:"warn",message:"Pipeline evidence status is unknown."}}function Pe(e,t,r){let s=Ee(t),i=c$1(e,s??void 0);if(!i)return {status:"missing",message:"Workspace run evidence is missing or unreadable."};let n=i.stage;if(s&&n!==s)return {status:"missing",message:`Workspace run evidence is for stage "${n}", expected "${s}".`};let g=Array.isArray(i.projects)?i.projects:[],a=t.project?.toLowerCase();if(!a)return {status:"missing",message:"Project-scoped workspace run evidence is missing a project identifier."};let l=g.find(d=>{let p=C(d);if(!p)return false;let c=typeof p.projectName=="string"?p.projectName.toLowerCase():"",o=["projectPath","relativePath","path"].map(f=>p[f]).filter(f=>typeof f=="string"&&f.trim().length>0).map(f=>f.replace(/\\/g,"/").toLowerCase());return c===a||o.some(f=>f.endsWith(`/${a}`)||f===a)});if(l){let d=R(i.generatedAt,r,`Workspace run evidence for ${t.project??t.id}`);if(d)return {status:"fail",message:d};let p=C(l),c=typeof p?.status=="string"?p.status:"unknown";return c==="failed"?{status:"fail",message:`Workspace run evidence failed for ${t.project}.`}:c==="passed"?{status:"pass",message:`Workspace run evidence passed for ${t.project}.`}:c==="skipped"?{status:"warn",message:`Workspace run evidence skipped for ${t.project}.`}:{status:"warn",message:`Workspace run evidence status is ${c} for ${t.project}.`}}return {status:"missing",message:`Workspace run evidence does not include project ${t.project}.`}}function R(e,t,r){if(!t)return null;if(typeof e!="string"||e.trim().length===0)return `${r} is stale: missing generatedAt timestamp (required after impact ${t}).`;let s=Date.parse(e),i=Date.parse(t);return Number.isFinite(s)?Number.isFinite(i)&&s<i?`${r} is stale: generated at ${e}, before impact ${t}.`:null:`${r} is stale: invalid generatedAt timestamp (required after impact ${t}).`}async function Ie(e,t,r,s){let i=we(e,t),n=i?m.relative(t,i).split(m.sep).join("/"):void 0;if(e.id==="workspace.contract.verify"&&!r)return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"skipped",required:e.required,message:"Workspace contract is not present; contract verify skipped."};let g=i?await f(t,n??""):null;if(!i||!g)return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"missing",required:e.required,evidencePath:n,message:n?`Missing evidence report: ${n}`:"No evidence mapping exists for this command."};let a=C(await v.readJson(g));if(!a)return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"fail",required:e.required,evidencePath:n,message:"Evidence report is not a JSON object."};let l;if(e.id==="workspace.doctor"){let d=R(a.generatedAt,s,"Doctor evidence");d?l={status:"fail",message:d}:l=Re(a);}else if(e.id==="workspace.readiness"){let d=R(a.generatedAt,s,"Release readiness evidence");d?l={status:"fail",message:d}:l=Ce(a);}else if(e.id==="workspace.contract.verify"){let d=R(a.generatedAt,s,"Workspace contract verify evidence");d?l={status:"fail",message:d}:l=We(a);}else if(e.id==="workspace.analyze"){let d=R(a.generatedAt,s,"Analyze evidence");d?l={status:"fail",message:d}:l=xe(a);}else if(e.id==="workspace.pipeline"){let d=R(a.generatedAt,s,"Pipeline evidence");d?l={status:"fail",message:d}:l=Se(a);}else if(e.id==="workspace.doctor-fix"){let d=a.schemaVersion==="rapidkit-doctor-fix-result-v1"?a:a.fixResult,p=C(d),c=typeof p?.generatedAt=="string"?p.generatedAt:void 0,o=R(c,s,"Doctor fix result");o?l={status:"fail",message:o}:await Ae(t,c)?l={status:"skipped",message:"No current doctor remediation steps are pending."}:l=je(a);}else if(e.id.startsWith("project."))l=Pe(a,e,s);else {let d=R(a.generatedAt,s,"Evidence report");d?l={status:"fail",message:d}:l={status:"pass",message:"Evidence report is present."};}return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:l.status,required:e.required,evidencePath:n,message:l.message}}function Ve(e,t={blockingReasons:[],needsAttention:false}){let r=e.filter(c=>c.status==="pass").length,s=e.filter(c=>c.status==="warn").length,i=e.filter(c=>c.status==="fail").length,n=e.filter(c=>c.status==="missing").length,g=e.filter(c=>c.status==="skipped").length,a=e.filter(c=>c.required&&(c.status==="fail"||c.status==="missing")).map(c=>`${c.id}: ${c.message}`),l=e.filter(c=>c.required&&c.status==="missing").length,d="ready",p=0;return a.length>0||t.blockingReasons.length>0?(d="blocked",p=2):(s>0||l>0||t.needsAttention)&&(d="needs-attention",p=1),{verdict:d,exitCode:p,stepsPassed:r,stepsWarn:s,stepsFailed:i,stepsMissing:n,stepsSkipped:g}}function $e(e,t){let r=x(e.affectedProjects.map(o=>o.project?.name).filter(o=>typeof o=="string")),s=new Set(r.map(o=>o.toLowerCase())),i=x(e.transitiveImpact.map(o=>o.project?.name).filter(o=>typeof o=="string").filter(o=>!s.has(o.toLowerCase()))),n=new Map;for(let o of t){if(o.scope!=="project"||!o.project)continue;let f=o.project.toLowerCase(),h=n.get(f)??[];h.push(o),n.set(f,h);}let g=[],a=[],l=[],d=[],p=false,c=(o,f)=>{let h=n.get(o.toLowerCase())??[];if(h.length===0){l.push(o);return}let j=h.filter(k=>k.status==="fail"),b=h.filter(k=>k.status==="missing"),A=b.filter(k=>k.required),E=h.some(k=>k.status==="pass"||k.status==="warn");if(j.length>0){a.push(o),d.push(`graph.subgraph.${o}: ${f} has failed verification evidence (${j.map(k=>k.id).join(", ")}).`);return}if(A.length>0){a.push(o),d.push(`graph.subgraph.${o}: ${f} has missing required verification evidence (${A.map(k=>k.id).join(", ")}).`);return}if(b.length>0){a.push(o),p=true;return}if(E){g.push(o);return}l.push(o);};for(let o of r)c(o,"directly-changed");for(let o of i)c(o,"transitive dependent");return {subgraph:{totalProjects:r.length+i.length,directlyChanged:r,transitiveDependents:i,covered:x(g),uncovered:x(a),unverifiable:x(l)},blockingReasons:d,needsAttention:p}}function x(e){return [...new Set(e)].sort((t,r)=>t.localeCompare(r))}async function Fe(e){let t=m.resolve(e.workspacePath);if(e.fromImpactPath){let n=ye(t,e.fromImpactPath);return {impact:await ae(n),fromImpactRef:m.relative(t,n).split(m.sep).join("/"),impactFromDisk:true}}let r=m.join(t,g$1);if(await v.pathExists(r))return {impact:await ae(r),fromImpactRef:g$1,impactFromDisk:true};let s=m.join(t,d$1);if(await v.pathExists(s))return {impact:await p({workspacePath:t,fromPath:d$1,scope:e.scope,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,observableScanDepth:e.observableScanDepth,now:e.now}),fromImpactRef:d$1,impactFromDisk:false};let i=await n({workspacePath:t,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,observableScanDepth:e.observableScanDepth,now:e.now});return {impact:{schemaVersion:f$1,generatedAt:(e.now??new Date).toISOString(),fromRef:"baseline",diffRef:a.diff,workspace:{name:i.workspace.name,profile:i.workspace.profile,type:i.workspace.type},summary:{changed:false,risk:"none",affectedProjects:0,workspaceItems:0,recommendedCommands:0,blastRadius:{directlyAffected:0,transitivelyAffected:0,maxDistance:0,graphEdges:i.graph?.edges.length??0}},affectedProjects:[],transitiveImpact:[],criticalPathHotspots:[],workspaceImpact:[],verificationPlan:[],agentBrief:{headline:"Baseline workspace verify run.",bullets:["No impact report or snapshot was available; baseline gates were evaluated."],unsafeAssumptions:["Do not claim runtime verification passed unless evidence exists."]},diff:{schemaVersion:b.diff,generatedAt:(e.now??new Date).toISOString(),fromRef:"baseline",toRef:a.model,fromHash:"baseline",toHash:"baseline",summary:{changed:false,addedProjects:0,removedProjects:0,changedProjects:0,workspaceChanges:0,validationChanges:0,gitChangedFiles:0},git:{available:false,dirty:false,changedFiles:0,untrackedFiles:0,deletedFiles:0},changes:[],currentModel:i}},impactFromDisk:false}}function Oe(e,t){if(t)return e.generatedAt}async function lt(e){let t=m.resolve(e.workspacePath),{impact:r,fromImpactRef:s,impactFromDisk:i}=await Fe(e),n$1=r.diff.currentModel,g=i?await n({workspacePath:t,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,observableScanDepth:e.observableScanDepth,now:e.now}):n$1,a=[];i&&j(g)!==r.diff.toHash&&a.push("workspace.impact: Impact evidence is stale because the current workspace model no longer matches the embedded model. Regenerate diff and impact.");let l=r.diff.git;if(i&&l?.available){let u=a$1(t,{ref:l.ref}),pe=r.diff.changes.filter(y=>y.type.startsWith("git.")).map(y=>`${y.type}:${y.target.replace(/^git:/,"")}`).sort(),fe=[...u.changedFiles.map(y=>`git.file.changed:${y}`),...u.untrackedFiles.map(y=>`git.untracked:${y}`),...u.deletedFiles.map(y=>`git.deleted:${y}`)].sort();(!u.available||u.commit!==l.commit||JSON.stringify(fe)!==JSON.stringify(pe))&&a.push("workspace.impact: Impact evidence is stale because Git changes no longer match the diff observation. Regenerate diff and impact.");}let d$1=Oe(r,i),p=ve([...o(),...r.verificationPlan]).filter(u=>be(e.scope,u)),c$1=[];for(let u of p)c$1.push(await Ie(u,t,n$1.contracts.exists===true,d$1));let o$1=$e(r,c$1),f=a$2(n$1.graph??{nodes:[],edges:[]}),h=b$1(n$1),j$1=await _e(t),b=c(h,j$1?.freshness?.projectHashes),A={verdict:b.verdict,baseline:b.baseline,changed:b.changed,added:b.added,removed:b.removed,projectHashes:d(h)},E=b$2(f),k=n$1.policies?.mode??"warn",V=await Be(n$1,t),$=De(k,V),W=Ve(c$1,{blockingReasons:[...o$1.blockingReasons,...E,...$.blockingReasons,...a],needsAttention:o$1.needsAttention||$.needsAttention}),de=c$1.filter(u=>u.status==="missing"&&u.evidencePath).map(u=>u.evidencePath),S=[...c$1.filter(u=>u.required&&(u.status==="fail"||u.status==="missing")).map(u=>`${u.id}: ${u.message}`),...o$1.blockingReasons,...E,...$.blockingReasons,...a],le=V.filter(u=>u.severity==="error").length,ue=n$1.summary?.projectCount??n$1.projects.length,L=oe({projectCount:ue,verdict:W.verdict,exitCode:W.exitCode,blockingReasons:S,policyErrorCount:le});W.verdict=L.verdict,W.exitCode=L.exitCode;let K=S.length>0?ne({blockingReasons:S,verifyCommand:"npx workspai workspace verify --from-impact .workspai/reports/workspace-impact-last-run.json --json",verifyArtifact:T}):[];return {schemaVersion:ce,generatedAt:(e.now??new Date).toISOString(),workspacePath:t,mode:"evidence",fromImpactRef:s,scope:e.scope,impact:{changed:r.summary.changed,risk:r.summary.risk,affectedProjects:r.summary.affectedProjects,recommendedCommands:r.summary.recommendedCommands},summary:W,steps:c$1,missingEvidence:de,blockingReasons:S,...K.length>0?{resolutionHints:K}:{},verificationPlan:p,affectedSubgraph:o$1.subgraph,graphIntegrity:f,freshness:A,policyMode:k,policyViolations:V}}async function Be(e,t){let r=[];for(let i of e.validation?.issues??[])r.push({source:"model",severity:i.severity,code:i.code,message:i.message,target:i.target});let s=await f(t,a.contractVerify);try{if(s&&await v.pathExists(s)){let i=await v.readJson(s);if(Array.isArray(i.violations))for(let n of i.violations)typeof n=="string"&&n.trim().length>0&&r.push({source:"contract",severity:"error",code:"contract.violation",message:n});}}catch{}return r.sort((i,n)=>i.source!==n.source?i.source.localeCompare(n.source):i.code!==n.code?i.code.localeCompare(n.code):i.message.localeCompare(n.message))}function De(e,t){let r=t.filter(s=>s.severity==="error");return e==="enforce"&&r.length>0?{blockingReasons:r.map(s=>`policy.${s.code}: ${s.message}`),needsAttention:false}:{blockingReasons:[],needsAttention:r.length>0}}async function _e(e){let t=m.join(e,T);try{if(!await v.pathExists(t))return null;let r=await v.readJson(t);return r&&r.schemaVersion===ce?r:null}catch{return null}}async function ut(e,t){return g(t,T,a$3(e))}function Me(e,t){let r=t?.strict?"strict":"default",s=[];if(e.summary.verdict==="blocked")return s.push(...e.blockingReasons),s.length===0&&s.push("verify verdict is blocked."),{passed:false,mode:r,exitCode:2,reasons:s};if(r==="strict"){if(e.summary.verdict!=="ready"&&s.push(`verify verdict is ${e.summary.verdict} (strict requires ready).`),e.freshness.verdict==="stale"){let i=[...e.freshness.changed,...e.freshness.added].slice(0,5);s.push(`freshness is stale${i.length>0?`: ${i.join(", ")}`:""} (strict requires fresh).`);}if(s.length>0)return {passed:false,mode:r,exitCode:1,reasons:s}}return {passed:true,mode:r,exitCode:0,reasons:s}}function pt(e,t){return Me(e,t).exitCode}export{re as a,Ge as b,ce as c,T as d,$e as e,lt as f,ut as g,Me as h,pt as i};