workspai 0.64.0 → 0.66.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 (207) hide show
  1. package/README.md +40 -44
  2. package/contracts/agent-customization-pack.v1.json +4 -2
  3. package/contracts/analyze-last-run.v1.json +9 -1
  4. package/contracts/cli-runtime-command-inventory.v1.snapshot.json +117 -0
  5. package/contracts/extension-cli-compatibility.v1.json +2 -0
  6. package/contracts/published-contract-catalog.v1.json +10 -0
  7. package/contracts/runtime-command-surface.v1.json +59 -3
  8. package/contracts/workspace-activity-event.v1.json +132 -0
  9. package/contracts/workspace-contract.v1.json +51 -6
  10. package/contracts/workspace-intelligence/agent-bootstrap-receipt.v1.json +17 -0
  11. package/contracts/workspace-intelligence/mcp-design.v1.json +49 -2
  12. package/contracts/workspace-intelligence/project-agent-entry.v1.json +3 -0
  13. package/contracts/workspace-intelligence/project-context-agent.v1.json +78 -7
  14. package/contracts/workspace-intelligence/project-knowledge-graph-reference.v1.json +51 -0
  15. package/contracts/workspace-intelligence/workspace-knowledge-graph.v1.json +108 -3
  16. package/contracts/workspace-intelligence/workspace-model.v1.json +28 -1
  17. package/contracts/workspace-intelligence/workspace-skills-index.v1.json +34 -0
  18. package/contracts/workspace-model-cache.v1.json +4 -0
  19. package/contracts/workspace-repair-capabilities.v1.json +66 -0
  20. package/dist/analyze-UJQWGNM2.js +1 -0
  21. package/dist/{artifact-remediation-plan-XIQNI35L.js → artifact-remediation-plan-M2XBS2IU.js} +1 -1
  22. package/dist/autopilot-release-U6F4M2BQ.js +1 -0
  23. package/dist/capabilities-command-XUKPO25Z.js +1 -0
  24. package/dist/chunk-2LIVMG5C.js +2 -0
  25. package/dist/{chunk-ZGS5NKEO.js → chunk-2PACEMNE.js} +1 -1
  26. package/dist/chunk-334J2KIP.js +7 -0
  27. package/dist/{chunk-6TBTMWNA.js → chunk-3H5ACWWZ.js} +1 -1
  28. package/dist/{chunk-HCFWT42C.js → chunk-3NM3JAZW.js} +1 -1
  29. package/dist/chunk-4XEH3WNV.js +13 -0
  30. package/dist/chunk-5OA33JH2.js +2 -0
  31. package/dist/chunk-5TY74LLW.js +2 -0
  32. package/dist/{chunk-QCKWQFCD.js → chunk-5U4L6VF2.js} +1 -1
  33. package/dist/{chunk-W6FHVXNL.js → chunk-5XGR3LRI.js} +1 -1
  34. package/dist/{chunk-KTN2ARZJ.js → chunk-6JX56VAL.js} +3 -3
  35. package/dist/chunk-6UNATTB7.js +1 -0
  36. package/dist/{chunk-J3X56S7L.js → chunk-727IQFGN.js} +1 -1
  37. package/dist/chunk-7FF5EOIO.js +2 -0
  38. package/dist/chunk-AP4PV6WJ.js +1 -0
  39. package/dist/chunk-AXUA7PFV.js +2 -0
  40. package/dist/chunk-B4IVVTMQ.js +2 -0
  41. package/dist/{chunk-LNXIMF3O.js → chunk-C4S22E6S.js} +1 -1
  42. package/dist/{chunk-PXWKMPPI.js → chunk-D4UHRJAP.js} +1 -1
  43. package/dist/chunk-DUBOKZMA.js +49 -0
  44. package/dist/{chunk-VYDURWN7.js → chunk-ECLMYTWT.js} +1 -1
  45. package/dist/{chunk-VB6I52ZT.js → chunk-EHH4SKVH.js} +50 -50
  46. package/dist/chunk-EP4CUWOO.js +9 -0
  47. package/dist/chunk-FY4X2VOE.js +39 -0
  48. package/dist/chunk-GAYK3WGV.js +2 -0
  49. package/dist/{chunk-YUGKQ44M.js → chunk-H5RJCS5E.js} +1 -1
  50. package/dist/{chunk-5SFCBZOH.js → chunk-H7MRINGP.js} +1 -1
  51. package/dist/chunk-HJLGXFMK.js +1 -0
  52. package/dist/{chunk-VRGEPPUB.js → chunk-HLWDIIWL.js} +1 -1
  53. package/dist/{chunk-KJXMLBSY.js → chunk-IIFFEEMX.js} +1 -1
  54. package/dist/chunk-IVF6NEHS.js +1 -0
  55. package/dist/chunk-JC4XSU7G.js +1 -0
  56. package/dist/chunk-JRP6WP5C.js +681 -0
  57. package/dist/chunk-JZJBA2V2.js +1 -0
  58. package/dist/{chunk-N4QQADXX.js → chunk-L5CCIIF2.js} +1 -1
  59. package/dist/chunk-L5Q2S5GY.js +3 -0
  60. package/dist/chunk-LPCZHKD5.js +1 -0
  61. package/dist/chunk-MZ7U4BIQ.js +157 -0
  62. package/dist/chunk-NMXGSVMD.js +1 -0
  63. package/dist/{chunk-GQSRNUCU.js → chunk-NVND4727.js} +3 -3
  64. package/dist/chunk-O37UBRMX.js +4 -0
  65. package/dist/chunk-OI2VOU6S.js +1 -0
  66. package/dist/chunk-PD7Y6HIM.js +2 -0
  67. package/dist/chunk-PJPS7CNH.js +1 -0
  68. package/dist/chunk-QGAPGZPL.js +97 -0
  69. package/dist/chunk-R2M5OJOK.js +5 -0
  70. package/dist/chunk-SX6A656X.js +1 -0
  71. package/dist/{chunk-X6TNBARH.js → chunk-TABXSDTR.js} +2 -2
  72. package/dist/chunk-TTHO4MFC.js +2 -0
  73. package/dist/chunk-U5ENEDJA.js +7 -0
  74. package/dist/chunk-UOCERSAN.js +1 -0
  75. package/dist/chunk-UPIPSSXY.js +1 -0
  76. package/dist/chunk-UTV4DTNM.js +1 -0
  77. package/dist/chunk-VA5VSOBL.js +2 -0
  78. package/dist/chunk-VQOWB26M.js +12 -0
  79. package/dist/chunk-VQZ5PI5J.js +1 -0
  80. package/dist/chunk-WCJU3CFG.js +1 -0
  81. package/dist/chunk-WTWRSEOW.js +1 -0
  82. package/dist/{chunk-D65FCQIO.js → chunk-XESFJN52.js} +1 -1
  83. package/dist/chunk-XQFWUM2P.js +1 -0
  84. package/dist/chunk-XWKGZRHN.js +1 -0
  85. package/dist/{chunk-WRQWVSBJ.js → chunk-YX5VWPR5.js} +1 -1
  86. package/dist/chunk-ZEEV5J4I.js +1 -0
  87. package/dist/chunk-ZQH2I5RQ.js +1 -0
  88. package/dist/{create-PWJDTKDN.js → create-SOLLXXAB.js} +1 -1
  89. package/dist/{demo-kit-QHIDCSBI.js → demo-kit-5UQH2OXC.js} +1 -1
  90. package/dist/{doctor-CGXY4IDE.js → doctor-NQ5PUCUP.js} +1 -1
  91. package/dist/{dotnet-webapi-clean-AVHPJG7Y.js → dotnet-webapi-clean-YEHYIGOT.js} +1 -1
  92. package/dist/{goal-lifecycle-BRFFTIU2.js → goal-lifecycle-IPNY7KNR.js} +1 -1
  93. package/dist/goal-pack-2WV3EA4Y.js +1 -0
  94. package/dist/{gofiber-standard-47S2GYAO.js → gofiber-standard-C44IIQYH.js} +1 -1
  95. package/dist/{gogin-standard-EWB4XNOI.js → gogin-standard-X7VKACVR.js} +1 -1
  96. package/dist/index.d.ts +8 -2
  97. package/dist/index.js +170 -170
  98. package/dist/live-command-Q6E45N7S.js +18 -0
  99. package/dist/{pipeline-DF4UIHAD.js → pipeline-MIMENSI7.js} +1 -1
  100. package/dist/{project-agent-entry-IWUCV72J.js → project-agent-entry-OWLJ3IHQ.js} +1 -1
  101. package/dist/project-intelligence-lens-I67EO6AE.js +1 -0
  102. package/dist/{project-test-coverage-4S7MEQ6T.js → project-test-coverage-OPDVSFPH.js} +1 -1
  103. package/dist/{pythonRapidkitExec-VAW5XE4Z.js → pythonRapidkitExec-44ORGQ4R.js} +1 -1
  104. package/dist/{rust-axum-M5X4ZC4Z.js → rust-axum-JKZTZDRZ.js} +1 -1
  105. package/dist/{springboot-standard-Y5ADLZMQ.js → springboot-standard-PI4FLTAN.js} +1 -1
  106. package/dist/verified-goal-46JWNCDY.js +1 -0
  107. package/dist/{workspace-35Q2IXAR.js → workspace-KO37XHF6.js} +1 -1
  108. package/dist/{workspace-agent-sync-FFNSW2PD.js → workspace-agent-sync-32FIJQBH.js} +1 -1
  109. package/dist/{workspace-archive-ZBCKJHXS.js → workspace-archive-6R5DRNZW.js} +1 -1
  110. package/dist/{workspace-context-IJ36ZP6G.js → workspace-context-JKRPX775.js} +1 -1
  111. package/dist/workspace-contract-4T3NYNK5.js +1 -0
  112. package/dist/workspace-explain-MOGL4GEA.js +1 -0
  113. package/dist/workspace-explain-contract-W2E6LF4Q.js +1 -0
  114. package/dist/{workspace-feedback-RQ4TGJW6.js → workspace-feedback-6VQ7T4CR.js} +1 -1
  115. package/dist/{workspace-foundation-GMGDUMPR.js → workspace-foundation-GHWO3BZU.js} +1 -1
  116. package/dist/workspace-graph-stream-PTVS47NJ.js +1 -0
  117. package/dist/workspace-graph-token-efficiency-Z5JD5NHI.js +1 -0
  118. package/dist/{workspace-history-SYCDK7FO.js → workspace-history-M2K4M2JY.js} +1 -1
  119. package/dist/{workspace-intelligence-5NO4K5SC.js → workspace-intelligence-PJIPTXL3.js} +1 -1
  120. package/dist/{workspace-intelligence-evaluation-CQDKOYZZ.js → workspace-intelligence-evaluation-GONCRE6O.js} +1 -1
  121. package/dist/{workspace-intelligence-runner-FGEBFVVM.js → workspace-intelligence-runner-M47QR3JM.js} +1 -1
  122. package/dist/{workspace-intelligence-runtime-registry-IW6J53LO.js → workspace-intelligence-runtime-registry-FFGQF4A7.js} +1 -1
  123. package/dist/workspace-knowledge-graph-V2EAYDCL.js +1 -0
  124. package/dist/workspace-knowledge-graph-contract-VANN7RCA.js +1 -0
  125. package/dist/{workspace-knowledge-graph-query-ON45H6Y7.js → workspace-knowledge-graph-query-RASPF7FS.js} +1 -1
  126. package/dist/workspace-knowledge-graph-snapshot-5YIG6EMG.js +1 -0
  127. package/dist/{workspace-marker-7NHMDIRL.js → workspace-marker-XGAWZZDX.js} +1 -1
  128. package/dist/workspace-mcp-serve-YRORNE4P.js +3 -0
  129. package/dist/workspace-model-VSVKLX7M.js +1 -0
  130. package/dist/{workspace-onboarding-VS3YYNGK.js → workspace-onboarding-2VMJZVLZ.js} +1 -1
  131. package/dist/{workspace-python-engine-state-J4QKW55K.js → workspace-python-engine-state-BE4A3BL5.js} +1 -1
  132. package/dist/{workspace-readme-G7TZ3V5T.js → workspace-readme-6X3GLTBM.js} +2 -2
  133. package/dist/{workspace-registry-summary-MIDFG6EC.js → workspace-registry-summary-QVSJKKTX.js} +1 -1
  134. package/dist/workspace-repair-engine-WSKV3Q4V.js +3 -0
  135. package/dist/workspace-run-3BXKTLVL.js +1 -0
  136. package/dist/{workspace-verify-4R7QHUPO.js → workspace-verify-EJCSOBIK.js} +1 -1
  137. package/dist/workspace-watch-JTIFBF4Z.js +1 -0
  138. package/docs/SETUP.md +10 -0
  139. package/docs/agent-entry.md +22 -7
  140. package/docs/ci-workflows.md +1 -1
  141. package/docs/commands-reference.md +43 -7
  142. package/docs/contracts/ARTIFACT_CATALOG.md +63 -44
  143. package/docs/contracts/COMMAND_OWNERSHIP_MATRIX.md +1 -0
  144. package/docs/contracts/NAMING_AND_COEXISTENCE.md +20 -18
  145. package/docs/contracts/README.md +4 -3
  146. package/docs/real-world-qualification.md +19 -3
  147. package/docs/workspace-knowledge-graph.md +131 -27
  148. package/docs/workspace-live-activity.md +199 -0
  149. package/docs/workspace-operations.md +54 -9
  150. package/docs/workspace-repair-engine.md +17 -0
  151. package/package.json +1 -1
  152. package/dist/analyze-NUGNB256.js +0 -1
  153. package/dist/autopilot-release-TWJWSVVF.js +0 -1
  154. package/dist/capabilities-command-LHM3XIS6.js +0 -1
  155. package/dist/chunk-2647BYBC.js +0 -1
  156. package/dist/chunk-27UR373Z.js +0 -1
  157. package/dist/chunk-2VJUAKMS.js +0 -2
  158. package/dist/chunk-3A23KJAQ.js +0 -1
  159. package/dist/chunk-4PUJVYRM.js +0 -1
  160. package/dist/chunk-5B2GAZAC.js +0 -5
  161. package/dist/chunk-6DAQ7PYT.js +0 -13
  162. package/dist/chunk-CCAXADKP.js +0 -49
  163. package/dist/chunk-CCDGHPEJ.js +0 -2
  164. package/dist/chunk-CJHWKXDN.js +0 -1
  165. package/dist/chunk-CT4IODPG.js +0 -2
  166. package/dist/chunk-DK6JNE6K.js +0 -2
  167. package/dist/chunk-DOXNVBX6.js +0 -1
  168. package/dist/chunk-DWB2RRF4.js +0 -1
  169. package/dist/chunk-FQSBOLM7.js +0 -1
  170. package/dist/chunk-ILIBOMYL.js +0 -1
  171. package/dist/chunk-ISOOENLW.js +0 -8
  172. package/dist/chunk-J7RU5WR5.js +0 -2
  173. package/dist/chunk-JQLJBK5N.js +0 -1
  174. package/dist/chunk-KANAJH65.js +0 -681
  175. package/dist/chunk-KV6PS54A.js +0 -8
  176. package/dist/chunk-L22EABIC.js +0 -7
  177. package/dist/chunk-MOSXTVPU.js +0 -1
  178. package/dist/chunk-NHTDPXTW.js +0 -4
  179. package/dist/chunk-NZ3WZYD5.js +0 -1
  180. package/dist/chunk-Q2WF7D5U.js +0 -2
  181. package/dist/chunk-RSG2GJXT.js +0 -2
  182. package/dist/chunk-SFO5GVRT.js +0 -1
  183. package/dist/chunk-T5YRFRJV.js +0 -1
  184. package/dist/chunk-THIOE2PB.js +0 -2
  185. package/dist/chunk-TOYN76K4.js +0 -144
  186. package/dist/chunk-U5WVR74V.js +0 -1
  187. package/dist/chunk-UXEO5QCF.js +0 -33
  188. package/dist/chunk-VR6XMUF3.js +0 -2
  189. package/dist/chunk-WY4DOMEA.js +0 -1
  190. package/dist/chunk-XKDR5BGS.js +0 -6
  191. package/dist/chunk-Y5YAP4F3.js +0 -2
  192. package/dist/chunk-ZH7CXQH3.js +0 -94
  193. package/dist/goal-pack-FG3QDNQH.js +0 -1
  194. package/dist/project-intelligence-lens-PZPPSCUW.js +0 -1
  195. package/dist/verified-goal-BBHZRYYH.js +0 -1
  196. package/dist/workspace-contract-JS4LZZQZ.js +0 -1
  197. package/dist/workspace-explain-TITIT5XN.js +0 -1
  198. package/dist/workspace-explain-contract-V2IVSROX.js +0 -1
  199. package/dist/workspace-graph-stream-7UU2YVHC.js +0 -1
  200. package/dist/workspace-graph-token-efficiency-D7CUT6NX.js +0 -1
  201. package/dist/workspace-knowledge-graph-RSDP2E36.js +0 -1
  202. package/dist/workspace-knowledge-graph-snapshot-3FJHH5IK.js +0 -1
  203. package/dist/workspace-mcp-serve-WUIQ2AE6.js +0 -3
  204. package/dist/workspace-model-OKY4CQ3X.js +0 -1
  205. package/dist/workspace-repair-engine-VUBT77Y7.js +0 -3
  206. package/dist/workspace-run-SSF6Z26G.js +0 -1
  207. package/dist/workspace-watch-IOPSHQS5.js +0 -1
@@ -1,8 +0,0 @@
1
- import {f as f$1,e as e$1}from'./chunk-ILIBOMYL.js';import {a,b}from'./chunk-VRGEPPUB.js';import {a as a$1}from'./chunk-27UR373Z.js';import {a as a$2}from'./chunk-T5YRFRJV.js';import {h,j as j$1}from'./chunk-XKDR5BGS.js';import {e as e$2}from'./chunk-CCDGHPEJ.js';import {e,f}from'./chunk-NZ3WZYD5.js';import {j,s,t}from'./chunk-MOSXTVPU.js';import w from'fs';import c from'path';import i from'chalk';var L=new Set([".git",".workspai",".rapidkit",".venv","node_modules","dist","build","target","coverage","htmlcov",".next"]);async function D(e){try{return await w.promises.access(e,w.constants.F_OK),true}catch{return false}}async function z(e){try{let t=JSON.parse(await w.promises.readFile(e,"utf-8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:null}catch{return null}}async function K(e){try{return await w.promises.readFile(e,"utf-8")}catch{return ""}}function B(e){return a(e)}async function U(e,t$1){return await M([...t(e,"project.json"),...t(e,"context.json")])?true:b(e)?false:c.resolve(e)===c.resolve(t$1)?h(e).length>0:h(e).length>0}async function V(e){let t=await a$1(e,{skipDirs:L,includeHiddenDirs:false,descendIntoMatchedProjects:false,isProjectDir:U}),r=(await a$2(e)).filter(o=>o.relationship==="adopted"||o.source==="adopted-local").map(o=>c.resolve(o.path)).filter(o=>w.existsSync(o)),s=[...new Set([...t.map(o=>c.resolve(o)),...r])];return s.length>0?s:b(e)?[]:h(e).length>0?[e]:[]}function q(e,t){return c.relative(e,t).replace(/\\/g,"/")||"."}async function A(e,t){for(let n of t)if(await D(c.join(e,n)))return true;return false}async function M(e){for(let t of e)if(await D(t))return true;return false}async function Q(e){if(await A(e,[".gitlab-ci.yml",".circleci/config.yml","azure-pipelines.yml","bitbucket-pipelines.yml","cloudbuild.yaml"]))return true;try{return (await w.promises.readdir(c.join(e,".github","workflows"),{withFileTypes:true})).some(n=>n.isFile()&&/\.(?:ya?ml)$/i.test(n.name)&&!n.name.startsWith("."))}catch{return false}}async function O(e){for(let t of e){let n=await z(t);if(n)return n}return null}async function X(e){return A(e,["health","health.ts","health.js","health.py","health.go","health.kt","health.rb","health.php","healthcheck","health-check","src/health.ts","src/health.js","src/health.py","src/health.go","src/health.kt","src/health.rb","src/health.php","src/healthcheck.ts","src/healthcheck.js","src/liveness.ts","src/readiness.ts","src/ping.ts"])}async function Y(e){if(await A(e,["tests","test","__tests__","src/__tests__","pytest.ini","vitest.config.ts","jest.config.ts"]))return true;let n=await z(c.join(e,"package.json")),r=n?.scripts&&typeof n.scripts=="object"?n.scripts:{};return typeof r.test=="string"&&r.test.trim().length>0}async function Z(e){let t=await z(c.join(e,"package.json")),n=t?.scripts&&typeof t.scripts=="object"?t.scripts:{};return Object.keys(n).sort()}function g(e,t,n,r,s,o,a){return {id:e,severity:t,target:n,title:r,detail:s,remediation:o,...a&&a.length>0?{files:[...a]}:{}}}function ee(e){let t=e.reduce((n,r)=>r.severity==="fail"?n+28:r.severity==="warn"?n+12:n+3,0);return Math.max(0,100-t)}async function ne(e,t$1){let n=await O(t(t$1,"project.json")),r=j$1(t$1,n),s=h(t$1),o=r.runtime==="unknown"?s[0]||"unknown":r.runtime,a=q(e,t$1),d=a,f=await Z(t$1),u=await M([...t(t$1,"project.json"),...t(t$1,"context.json")]),p=await Y(t$1),h$1=await A(t$1,["Dockerfile","dockerfile"]),k=await A(t$1,[".env.example","env.example","config/env.example"]),P=await Q(t$1),C=await X(t$1),m=[];return r.key==="unknown"&&m.push(g("project.stack.unknown","fail",d,"Project stack is unknown","Workspai cannot confidently classify this backend project.","Add .workspai/project.json metadata or import the project with `workspai import`.")),u||m.push(g("project.marker.missing","warn",d,"Workspai marker is missing","The project can be detected by files, but it is not registered with Workspai metadata.","Run `workspai import <path>` from a workspace or create the project through Workspai.")),p||m.push(g("project.tests.missing","warn",d,"Test entrypoint is missing","No common test folder, config, or package test script was found.","Add a test command so `workspai workspace run test --affected` can gate changes.")),k||m.push(g("project.env.example.missing","info",d,"Environment example is missing","No .env.example or env.example file was found.","Add an env example for onboarding and CI secret documentation.",[".env.example"])),P||m.push(g("project.ci.missing","warn",d,"Continuous integration is missing","No recognized CI/CD configuration file was detected for this project.","Add CI configuration so tests and checks run automatically for every change.",[".github/workflows/ci.yml"])),C||m.push(g("project.health.missing","info",d,"Health or readiness probe is missing","The project has no obvious health or readiness endpoint to support automated deployment and runtime checks.","Add a simple health endpoint and document it for readiness gates and observability.")),h$1||m.push(g("project.container.missing","info",d,"Container recipe is missing","No Dockerfile was found for this project.","Add a Dockerfile when the service is intended for containerized deployment.",["Dockerfile"])),{name:typeof n?.name=="string"&&n.name.trim()?n.name.trim():c.basename(t$1),path:t$1,relativePath:a,runtime:o,framework:r.key,confidence:r.confidence,supportTier:r.supportTier,hasRapidKitMarker:u,hasTests:p,hasDockerfile:h$1,hasEnvExample:k,hasCiConfig:P,hasHealthEndpoint:C,scripts:f,findings:m,score:ee(m)}}function te(e){return e.name.toLowerCase()}async function re(e){let t=new Map(e.map(s=>[te(s),s])),n=[];for(let s of e){let o=await z(c.join(s.path,"package.json")),a={...o?.dependencies??{},...o?.devDependencies??{},...o?.peerDependencies??{}};for(let f of Object.keys(a)){let u=f.replace(/^@[^/]+\//,"").toLowerCase(),p=t.get(u);p&&p.relativePath!==s.relativePath&&n.push({from:s.relativePath,to:p.relativePath,kind:"package"});}let d=await K(c.join(s.path,"pyproject.toml"));for(let f of e)f.relativePath!==s.relativePath&&d.includes(f.name)&&n.push({from:s.relativePath,to:f.relativePath,kind:"workspace-reference"});}let r=new Set;return n.filter(s=>{let o=`${s.from}\0${s.to}\0${s.kind}`;return r.has(o)?false:(r.add(o),true)})}function se(e,t){let n=new Map;for(let r of e)n.set(r.relativePath,{project:r.relativePath,directDependents:0,directDependencies:0});for(let r of t){let s=n.get(r.from),o=n.get(r.to);s&&(s.directDependencies+=1),o&&(o.directDependents+=1);}return Array.from(n.values()).sort((r,s)=>s.directDependents-r.directDependents||s.directDependencies-r.directDependencies)}async function oe(e){let t=await O(s(e,"workspace.json"));return typeof t?.profile=="string"?t.profile:null}function ie(e){return {fail:e.filter(t=>t.severity==="fail").length,warn:e.filter(t=>t.severity==="warn").length,info:e.filter(t=>t.severity==="info").length}}function ae(e){if(e.projectCount===0)return e.workspaceDetected?["Add your first project: npx workspai create project <name> --kit <kit>","Import an existing service: npx workspai import <path>"]:["Create a Workspai workspace: npx workspai create workspace my-workspace --profile polyglot","Import an existing service: npx workspai import ../service"];let t=[];return e.findings.some(n=>n.id==="workspace.marker.missing")&&t.push("Initialize workspace metadata with `workspai bootstrap --profile polyglot`."),e.findings.some(n=>n.id==="project.marker.missing")&&t.push("Register detected projects with `workspai import <path>` or recreate them via `workspai create project`."),e.findings.some(n=>n.id==="project.tests.missing")&&t.push("Add test entrypoints, then gate changes with `workspai workspace run test --affected --strict`."),e.findings.some(n=>n.id==="project.ci.missing")&&t.push("Add CI/CD configuration to catch regressions early and make workspace health checks actionable."),e.findings.some(n=>n.id==="project.health.missing")&&t.push("Add a health/readiness endpoint so runtime probes and deployment checks can verify service health."),e.hasGraph||t.push("Create `.workspai/workspace-dependency-graph.json` or use analyze output as the first graph seed."),t.push("Run `workspai autopilot release --mode audit --json` before release."),Array.from(new Set(t))}async function ve(e$3={}){let t=c.resolve(e$3.workspacePath||process.cwd());if(!await D(t))throw new Error(`Workspace path does not exist: ${t}`);let n=B(t)??t,r=j(n),s=await oe(n),o=await V(n),a=await Promise.all(o.map(l=>ne(n,l))),d=await re(a),f$2=se(a,d),u=[];r||u.push(g("workspace.marker.missing","warn",".","Workspace metadata is missing","The directory can be analyzed, but it is not a registered Workspai workspace.","Run `workspai create workspace` or `workspai bootstrap --profile polyglot` in a workspace root.")),a.length===0&&u.push(g("workspace.projects.missing","warn",".","No backend projects detected","Workspai did not find runtime markers or project metadata under this root.","Create a project with `workspai create project` or import one with `workspai import <path>`."));let p=[...u,...a.flatMap(l=>l.findings)],h=ie(p),k={};for(let l of a)k[l.runtime]=(k[l.runtime]||0)+1;let P=a.length>0?Math.round(a.reduce((l,y)=>l+y.score,0)/a.length):0,C=u.reduce((l,y)=>l+(y.severity==="fail"?20:y.severity==="warn"?8:2),0),m=Math.max(0,P-C),J=a.length===0&&h.fail===0&&p.length>0&&p.every(l=>l.id==="workspace.projects.missing"&&l.severity==="warn"),H=h.fail>0||e$3.strict&&h.warn>0&&!J?"blocked":h.warn>0?"needs-attention":"ready",j$1={schemaVersion:f.analyze,generatedAt:new Date().toISOString(),workspacePath:n,workspaceDetected:r,profile:s,summary:{score:m,verdict:H,projectCount:a.length,runtimeCount:Object.keys(k).length,findings:h},runtimes:k,projects:a,dependencyGraph:{status:d.length>0?"generated":"empty",edges:d,topImpactedProjects:f$2.slice(0,5)},findings:p,nextActions:ae({findings:p,projectCount:a.length,hasGraph:d.length>0,workspaceDetected:r}),enterpriseControls:{jsonReady:true,ciGateCommand:"workspai analyze --json --strict",releaseGateCommand:"workspai autopilot release --mode enforce --json",evidencePath:e.analyze}};if(e$3.output&&(await w.promises.mkdir(c.dirname(c.resolve(e$3.output)),{recursive:true}),await w.promises.writeFile(c.resolve(e$3.output),`${JSON.stringify(j$1,null,2)}
2
- `)),!e$3.output&&r){let l=f$1(j$1,{commandId:"workspaceAnalyze",exitCode:j$1.summary.verdict==="blocked"?2:j$1.summary.verdict==="needs-attention"?1:0,generatedAt:j$1.generatedAt,blockers:j$1.findings.filter(y=>y.severity==="fail").map(y=>y.title).slice(0,12),runId:e$1()});await e$2(n,e.analyze,l);}return j$1}function be(e){let t=e.summary.verdict==="ready"?i.green:e.summary.verdict==="needs-attention"?i.yellow:i.red;if(console.log(i.bold(`
3
- Workspai Workspace Analysis
4
- `)),console.log(i.cyan("Workspace:"),e.workspacePath),console.log(i.cyan("Profile:"),e.profile||"not configured"),console.log(i.cyan("Score:"),`${e.summary.score}/100`),console.log(i.cyan("Verdict:"),t(e.summary.verdict)),console.log(i.gray(`Projects: ${e.summary.projectCount}, runtimes: ${e.summary.runtimeCount}, findings: ${e.summary.findings.fail} fail / ${e.summary.findings.warn} warn / ${e.summary.findings.info} info`)),e.projects.length>0){console.log(i.bold(`
5
- Projects`));for(let n of e.projects){let r=n.score>=85?i.green("pass"):n.score>=65?i.yellow("watch"):i.red("risk");console.log(` ${n.relativePath} ${i.gray(`${n.runtime}/${n.framework}`)} ${r} ${n.score}/100`);}}if(e.dependencyGraph.status==="generated"&&(console.log(i.bold(`
6
- Dependency Graph`)),console.log(i.gray(` edges: ${e.dependencyGraph.edges.length}`)),e.dependencyGraph.topImpactedProjects.length>0)){console.log(i.gray(" Top impacted projects:"));for(let n of e.dependencyGraph.topImpactedProjects.slice(0,3))console.log(` ${n.project} (${n.directDependents} dependents, ${n.directDependencies} dependencies)`);}if(e.findings.length>0){console.log(i.bold(`
7
- Top Findings`));for(let n of e.findings.slice(0,8)){let r=n.severity==="fail"?i.red:n.severity==="warn"?i.yellow:i.gray;console.log(` ${r(n.severity.toUpperCase())} ${n.target}: ${n.title}`),console.log(i.gray(` ${n.remediation}`));}}console.log(i.bold(`
8
- Next Actions`));for(let n of e.nextActions.slice(0,5))console.log(i.gray(` - ${n}`));console.log();}export{ve as a,be as b};
@@ -1,7 +0,0 @@
1
- import {a}from'./chunk-A5FBGRJA.js';import {a as a$1}from'./chunk-AFIFZTOY.js';import {i as i$1,h}from'./chunk-NZ3WZYD5.js';import {j,u,e,a as a$2,t,f as f$1}from'./chunk-MOSXTVPU.js';import {s}from'./chunk-RGNCL5OB.js';import b from'crypto';import P from'fs';import d from'fs/promises';import i from'path';import T from'fs-extra';var x=h.projectWorkspaceLink.schemaVersion,L="workspai.project-workspace-link",l=class extends Error{constructor(r,a,o={}){super(a);this.code=r;this.context=o;this.name="ProjectWorkspaceResolutionError";}code;context};function $(e){return P.existsSync(i.join(e,".workspai-workspace"))?".workspai-workspace":".workspai/workspace.json"}function _(e){return b.createHash("sha256").update([e.workspaceName,a(e.workspacePath),e.projectName,a(e.projectPath),e.relativePath.replace(/\\/g,"/"),e.relationship].join("\0")).digest("hex")}function I(e){let t=i.resolve(e);for(;;){if(j(t))return t;let r=i.dirname(t);if(r===t)return null;t=r;}}function J(e){let t$1=i.resolve(e);for(;;){if([...t(t$1,"project.json"),...t(t$1,"context.json")].some(a=>P.existsSync(a)))return t$1;let r=i.dirname(t$1);if(r===t$1)return null;t$1=r;}}function y(e){return JSON.parse(P.readFileSync(e,"utf8"))}function K(e){let t=y(e);if(!t||typeof t!="object"||Array.isArray(t))throw new l("project.workspace.link-invalid",`Project workspace link is not a JSON object: ${e}`,{linkPath:e});let r=t;if(r.schemaVersion!==x||r.kind!==L||r.state!=="active"||!r.workspace||typeof r.workspace.name!="string"||r.workspace.name.trim().length===0||typeof r.workspace.root!="string"||!i.isAbsolute(r.workspace.root)||![".workspai-workspace",".workspai/workspace.json"].includes(r.workspace.marker??"")||r.workspace.contract!==i$1.workspaceContract||!r.project||typeof r.project.name!="string"||r.project.name.trim().length===0||typeof r.project.relativePath!="string"||i.isAbsolute(r.project.relativePath)||r.project.relativePath.split(/[\\/]/).includes("..")||!["managed","adopted","imported","linked","restored"].includes(r.project.relationship??"")||!r.integrity||r.integrity.algorithm!=="sha256"||typeof r.integrity.binding!="string"||!/^[a-f0-9]{64}$/.test(r.integrity.binding))throw new l("project.workspace.link-invalid",`Project workspace link does not satisfy ${x}: ${e}`,{linkPath:e});try{a$1(t,"contracts/project-workspace-link.v1.json","Project workspace link");}catch(a){throw new l("project.workspace.link-invalid",`Project workspace link does not satisfy ${x}: ${e}`,{linkPath:e,validationError:a instanceof Error?a.message:String(a)})}return r}function f(e,t){let r=i.join(e,".workspai","workspace.contract.json");if(!P.existsSync(r))return null;try{let a$1=y(r);if(!Array.isArray(a$1.projects))return false;let o=a(t);return a$1.projects.some(n=>typeof n.externalPath=="string"?a(n.externalPath)===o:typeof n.relativePath!="string"||n.relativePath.startsWith("external/")?false:a(i.resolve(e,n.relativePath))===o)}catch{return false}}function M(e,t,r){let a$1=a(e),o=new Map;for(let n of s(t,r)){if(!P.existsSync(n))continue;let c;try{c=y(n);}catch{continue}if(Array.isArray(c.workspaces))for(let p of c.workspaces){if(!p||typeof p.name!="string"||typeof p.path!="string"||!Array.isArray(p.projects)||!p.projects.some(w=>w&&typeof w.path=="string"&&a(w.path)===a$1))continue;let s=a(p.path);!j(s)||f(s,e)!==true||o.set(s,{name:p.name,path:s});}}return [...o.values()].sort((n,c)=>n.path.localeCompare(c.path))}function m(e,t){if(e)throw t;return null}function te(e$1){let t=e$1.strict===true,r=i.resolve(e$1.startPath),a=e$1.explicitWorkspacePath?i.resolve(e$1.explicitWorkspacePath):null,o=J(r);if(a)return j(a)?e$1.requireProjectMembership===true&&o&&f(a,o)!==true?m(t,new l("project.workspace.membership-missing",`Project is not registered in the explicit workspace contract: ${a}`,{workspacePath:a,projectPath:o})):{workspacePath:a,projectPath:o,source:"explicit",linkPath:o?u(o,e):null,recovered:false}:m(t,new l("project.workspace.explicit-invalid",`Explicit workspace path is not a Workspai workspace: ${a}`,{workspacePath:a,projectPath:o}));let n=I(r);if(n)return e$1.requireProjectMembership===true&&o&&f(n,o)!==true?m(t,new l("project.workspace.membership-missing",`Project is not registered in its parent workspace contract: ${n}`,{workspacePath:n,projectPath:o})):{workspacePath:n,projectPath:o,source:"parent",linkPath:o?u(o,e):null,recovered:false};if(!o)return m(t,new l("project.workspace.unlinked","No Workspai project or workspace could be resolved from the current directory.",{startPath:r}));let c=u(o,e),p=null;if(P.existsSync(c)){let s;try{s=K(c);}catch(O){if(t)throw O;return null}let u=_({workspaceName:s.workspace.name,workspacePath:s.workspace.root,projectName:s.project.name,projectPath:o,relativePath:s.project.relativePath,relationship:s.project.relationship}),w=f(s.workspace.root,o);if(s.integrity.binding===u&&j(s.workspace.root)&&P.existsSync(i.join(s.workspace.root,s.workspace.marker))&&w===true)return {workspacePath:i.resolve(s.workspace.root),projectPath:o,source:"local-link",linkPath:c,recovered:false};p=s;}let h=M(o,e$1.env??process.env,e$1.platform??process.platform);return h.length>1?m(t,new l("project.workspace.ambiguous",`Project is registered in more than one valid workspace: ${h.map(s=>s.name).join(", ")}. Pass --workspace <path> or run project workspace relink.`,{projectPath:o,candidates:h})):h.length===1?{workspacePath:h[0].path,projectPath:o,source:"registry",linkPath:c,recovered:p!==null}:p?m(t,new l("project.workspace.link-stale",`Project workspace link is stale and no valid registry relocation was found: ${p.workspace.root}`,{projectPath:o,linkPath:c,linkedWorkspacePath:p.workspace.root})):m(t,new l("project.workspace.unlinked","This Workspai project is not linked to a valid workspace. Run `npx workspai adopt .` or `npx workspai project workspace relink --workspace <path>`.",{projectPath:o,linkPath:c}))}async function F(e,t){await d.mkdir(i.dirname(e),{recursive:true});let r=`${e}.${process.pid}.${b.randomUUID()}.tmp`;try{await d.writeFile(r,`${JSON.stringify(t,null,2)}
2
- `,{encoding:"utf8",mode:384});try{await d.rename(r,e);}catch(a){let o=a.code;if(o!=="EEXIST"&&o!=="EPERM")throw a;await T.move(r,e,{overwrite:true});}}finally{await d.rm(r,{force:true}).catch(()=>{});}}async function D(e){let t=i.join(e,".gitignore"),r=await d.readFile(t,"utf8").catch(c=>{if(c.code==="ENOENT")return "";throw c});if(r.split(/\r?\n/).map(c=>c.trim()).includes(f$1))return;let n=`${r.length>0&&!r.endsWith(`
3
- `)?`
4
- `:""}
5
- # Workspai machine-local workspace binding
6
- ${f$1}
7
- `;await d.writeFile(t,`${r}${n}`,"utf8");}async function V(e$1){let t=i.resolve(e$1.workspacePath),r=i.resolve(e$1.projectPath);if(!j(t))throw new l("project.workspace.explicit-invalid",`Cannot link project to an invalid Workspai workspace: ${t}`,{workspacePath:t,projectPath:r});let a$3=i.join(t,".workspai","workspace.contract.json"),o=e$1.workspaceName??i.basename(t),n=e$1.relativePath;if(P.existsSync(a$3)){let h=y(a$3);typeof h.workspace?.name=="string"&&(o=h.workspace.name);let s=a(r),u=h.projects?.find(w=>typeof w.externalPath=="string"?a(w.externalPath)===s:typeof w.relativePath=="string"&&!w.relativePath.startsWith("external/")&&a(i.resolve(t,w.relativePath))===s);u&&typeof u.relativePath=="string"&&(n=u.relativePath);}if(n??=i.relative(t,r).replace(/\\/g,"/"),(!n||n.startsWith(".."))&&(n=`external/${e$1.projectName}`),f(t,r)!==true)throw new l("project.workspace.membership-missing",`Project is not registered in the canonical workspace contract: ${e$1.projectName}`,{workspacePath:t,projectPath:r,projectName:e$1.projectName});let c={schemaVersion:x,kind:L,generatedAt:(e$1.now??new Date).toISOString(),state:"active",workspace:{name:o,root:t,marker:$(t),contract:i$1.workspaceContract},project:{name:e$1.projectName,relativePath:n,relationship:e$1.relationship},integrity:{algorithm:"sha256",binding:_({workspaceName:o,workspacePath:t,projectName:e$1.projectName,projectPath:r,relativePath:n,relationship:e$1.relationship})}};a$1(c,"contracts/project-workspace-link.v1.json","Project workspace link");let p=i.join(r,a$2,e);return await D(r),await F(p,c),{linkPath:p,link:c}}async function oe(e,t$1="linked"){if(!e.projectPath)return null;let r=t(e.projectPath,"project.json").find(o=>P.existsSync(o)),a=i.basename(e.projectPath);if(r)try{let o=y(r);typeof o.name=="string"?a=o.name:typeof o.slug=="string"&&(a=o.slug);}catch{}return V({workspacePath:e.workspacePath,projectPath:e.projectPath,projectName:a,relationship:t$1})}export{l as a,te as b,V as c,oe as d};
@@ -1 +0,0 @@
1
- import s from'fs';import {homedir}from'os';import n from'path';var e=".workspai",a=".rapidkit",p=".workspai-workspace",g=".rapidkit-workspace",_="workspace-link.local.json",P="PROJECT-GROUNDING.md",d="project-context-agent.json",D=`${e}/${_}`,h=`${e}/${P}`,y=`${e}/reports/${d}`,c="workspai",K="Workspai";function R(t){return s.existsSync(n.join(t,p))||s.existsSync(n.join(t,g))||s.existsSync(n.join(t,e,"workspace.json"))||s.existsSync(n.join(t,a,"workspace.json"))}function A(t=homedir()){return n.join(t,".workspai","workspaces")}function E(t=homedir()){return n.join(t,"rapidkit","workspaces")}function l(t=homedir()){return n.join(t,"Workspai","rapidkits")}function u(t,r=homedir()){return n.join(A(r),t)}function k(t,r=homedir()){return [u(t,r),n.join(E(r),t),n.join(l(r),t)]}function S(t,r={}){let o=r.homeDir??homedir();return r.outputDir?n.resolve(r.outputDir,t):u(t,o)}function G(t,r=homedir()){for(let o of k(t,r))if(s.existsSync(o))return o}function N(t,r="my-workspace"){let o=1;for(;;){let f=o===1?r:`${r}-${o}`,x=n.join(t,f);if(!s.existsSync(x))return {name:f,targetPath:x};o+=1;}}function T(t=homedir()){return [n.join(A(t),c),n.join(E(t),c),n.join(l(t),c)]}function v(t=homedir()){for(let r of T(t))if(R(r))return r;return u(c,t)}function j(t,...r){return n.join(t,e,...r)}function W(t,...r){return n.join(t,a,...r)}function w(t){return n.join(t,p)}function $(t){return n.join(t,g)}function m(t,...r){return [j(t,...r),W(t,...r)]}function F(t,r){return [n.join(t,e,r),n.join(t,a,r)]}function J(t,r){return n.join(t,e,r)}function U(t){return t.replace(/\\/g,"/")===g?p:t.split(/[\\/]/g).map(o=>o===a?e:o).join("/")}function b(t){return t.replace(/\\/g,"/")===p?g:t.split(/[\\/]/g).map(o=>o===e?a:o).join("/")}export{e as a,a as b,p as c,g as d,_ as e,D as f,h as g,y as h,K as i,R as j,A as k,S as l,G as m,N as n,v as o,j as p,w as q,$ as r,m as s,F as t,J as u,U as v,b as w};
@@ -1,4 +0,0 @@
1
- import {f,e}from'./chunk-ILIBOMYL.js';import {a,b}from'./chunk-VRGEPPUB.js';import {a as a$1,b as b$2}from'./chunk-X7FYEKLI.js';import {c as c$1,d}from'./chunk-HCFWT42C.js';import {i,j as j$1,l,k,n}from'./chunk-J7RU5WR5.js';import {a as a$2,e as e$2}from'./chunk-CCDGHPEJ.js';import {b as b$1}from'./chunk-D65FCQIO.js';import {f as f$1,e as e$1}from'./chunk-NZ3WZYD5.js';import {s}from'./chunk-MOSXTVPU.js';import u from'chalk';import c from'fs';import y from'path';var H=e$1.readiness,K=f$1.readiness;function U(n,e){let t=y.resolve(n);if(!b(t))return t;let a=M(e,"workspace.contract.json");if(c.existsSync(a))try{let o=JSON.parse(c.readFileSync(a,"utf-8")),s=Array.isArray(o.projects)?o.projects:[];for(let i of s){let l=m(i),p=typeof l.relativePath=="string"?l.relativePath.trim():"";if(p)return y.join(e,p)}}catch{}let r=T(e),d=Array.isArray(r.payload?.projects)?r.payload.projects:[];for(let o of d){let s=m(o),i=typeof s.path=="string"?s.path.trim():"";if(i)return y.resolve(i)}return t}function z(n$1){let e=i(n$1);return j$1(e,n$1)?"go":l(e,n$1)?"java":k(e,n$1)?"node":n(e,n$1)?"python":"unknown"}function _(n,e){if(!c.existsSync(n))return null;let t=c.readdirSync(n).filter(a=>a.endsWith(".json")&&e.some(r=>r.test(a))).map(a=>y.join(n,a));return t.length===0?null:(t.sort((a,r)=>c.statSync(r).mtimeMs-c.statSync(a).mtimeMs),t[0])}function m(n){return n&&typeof n=="object"&&!Array.isArray(n)?n:{}}function J(n){for(let e of n)if(c.existsSync(e))return e;return null}function M(n,...e){let t=s(n,...e);return J(t)??t[0]}function j(n,e){let t=a$2(n,`.workspai/reports/${e}`);return J([t,y.join(n,".rapidkit","reports",e)])??t}async function B(n){let{readWorkspaceRegistrySummary:e,resolveWorkspaceRegisteredProjects:t}=await import('./workspace-registry-summary-MIDFG6EC.js'),a=await e(n);return a?a.projectCount:(await t(n)).summary.projectCount}function Q(n,e,t){let a=M(n,"toolchain.lock");if(!c.existsSync(a))return {gate:"env",status:"fail",summary:"toolchain.lock is missing",details:["Run workspai bootstrap to pin runtime versions and generate a reproducible toolchain."],evidencePath:a};try{let r=JSON.parse(c.readFileSync(a,"utf-8")),d=m(r.runtime),s=["python","node","go","java"].filter(p=>{let f=m(d[p]);return typeof f.version=="string"&&f.version.trim().length>0});if(s.length===0)return {gate:"env",status:"fail",summary:"No runtime versions are pinned in toolchain.lock",details:["Pin at least one runtime version via workspai setup <runtime> and re-run bootstrap."],evidencePath:a};let l=[...new Set((Array.isArray(e)?e:[e]).filter(p=>p!=="unknown"))].filter(p=>{let f=m(d[p]);return typeof f.version!="string"||f.version.trim().length===0});return l.length>0?{gate:"env",status:"fail",summary:`${t?.hasRegisteredProjects?"Project runtime":"Workspace"}${l.length===1?"":"s"} (${l.join(", ")}) ${l.length===1?"is":"are"} not pinned in toolchain.lock`,details:l.map(f=>`Run workspai setup ${f} and workspai bootstrap to lock ${f} for this workspace.`),evidencePath:a}:{gate:"env",status:"pass",summary:`Pinned runtimes: ${s.join(", ")}`,details:[],evidencePath:a}}catch{return {gate:"env",status:"fail",summary:"toolchain.lock is invalid JSON",details:["Regenerate lockfile with workspai bootstrap."],evidencePath:a}}}function T(n){let e=j(n,"doctor-last-run.json");if(!c.existsSync(e))return {payload:null,path:e};try{let t=JSON.parse(c.readFileSync(e,"utf-8"));return c$1(t,"workspace")?(d(t),{payload:t,path:e}):{payload:null,path:e}}catch{return {payload:null,path:e}}}function X(n){let e=T(n);if(!e.payload)return {gate:{gate:"doctor",status:"fail",summary:"Doctor evidence is missing",details:["Run workspai doctor workspace --json before release readiness checks."],evidencePath:e.path},payload:null};let t=a$1(e.payload);if(t.hasSystemErrors)return {gate:{gate:"doctor",status:"fail",summary:"Doctor reported system errors",details:["Resolve system-level doctor errors before proceeding."],evidencePath:e.path},payload:e.payload};if(t.blockingFindings>0)return {gate:{gate:"doctor",status:"fail",summary:`Doctor reported ${t.blockingFindings} blocking finding(s)`,details:["Resolve the canonical Doctor findings and regenerate fresh Doctor evidence."],evidencePath:e.path},payload:e.payload};let a=[...t.advisoryFindings>0?[`${t.advisoryFindings} advisory finding(s)`]:[],...t.unknownFindings>0?[`${t.unknownFindings} unknown finding(s)`]:[],...t.contradictionCount>0?[`${t.contradictionCount} evidence contradiction(s)`]:[],...t.missingDiagnosisProjects>0?[`${t.missingDiagnosisProjects} project(s) without canonical diagnosis`]:[],...t.staleEvidence?["stale Doctor evidence"]:[],...t.unknownFreshness?["unknown Doctor evidence freshness"]:[],...t.minimumDiagnosisCompleteness<100?[`diagnosis completeness ${t.minimumDiagnosisCompleteness}%`]:[]];return a.length>0?{gate:{gate:"doctor",status:"warn",summary:"Doctor evidence requires attention",details:a,evidencePath:e.path},payload:e.payload}:{gate:{gate:"doctor",status:"pass",summary:"Doctor checks passed without issues",details:[],evidencePath:e.path},payload:e.payload}}function Y(n){let e=j(n,"analyze-last-run.json");if(!c.existsSync(e))return {gate:"analyze",status:"fail",summary:"Analyze evidence is missing",details:["Run workspai analyze --json before release readiness checks."],evidencePath:e};try{let t=JSON.parse(c.readFileSync(e,"utf-8"));b$1(e$1.analyze,t,e);let a=m(t.summary),r=String(a.verdict??"").toLowerCase(),d=Number(a.score??0),o=m(a.findings),s=Number(o.fail??0);return r==="blocked"||s>0?{gate:"analyze",status:"fail",summary:`Analyze verdict is blocked (score ${d}/100)`,details:["Resolve analyze findings and regenerate analyze-last-run.json."],evidencePath:e}:r==="needs-attention"?{gate:"analyze",status:"warn",summary:`Analyze needs attention (score ${d}/100)`,details:["Review analyze warnings before release."],evidencePath:e}:{gate:"analyze",status:"pass",summary:`Analyze passed (score ${d}/100)`,details:[],evidencePath:e}}catch{return {gate:"analyze",status:"fail",summary:"Analyze evidence is invalid or violates its contract",details:["Re-run workspai analyze --json to regenerate evidence."],evidencePath:e}}}function Z(n){try{let e=JSON.parse(c.readFileSync(n,"utf-8")),t=String(e.status??"").toLowerCase(),a=m(e.summary),r=Number(a.failedChecks??0);return t==="fail"||r>0?{gate:"verify",status:"fail",summary:"Verify-pack contract reports failed checks",details:["Fix failed verify checks and regenerate verify-pack contract evidence."],evidencePath:n}:t==="pass"?{gate:"verify",status:"pass",summary:"Verify-pack contract passed",details:[],evidencePath:n}:{gate:"verify",status:"warn",summary:"Verify-pack contract status is not explicit",details:["Ensure contract status is pass/fail and keep schema aligned with v1 contract."],evidencePath:n}}catch{return {gate:"verify",status:"fail",summary:"Verify-pack contract is invalid JSON",details:["Regenerate verify-pack contract artifact."],evidencePath:n}}}async function ee(n,e){if(e.skipVerify)return {gate:"verify",status:"pass",summary:"Verify gate skipped (--skip-verify)",details:["Verification was explicitly skipped for this readiness run."]};let t=[a$2(n,".workspai/reports"),y.join(n,".rapidkit","reports")],a=t[0],r=t.map(s=>_(s,[/verify-pack-contract/i,/^verify.*\.json$/i])).find(s=>typeof s=="string")??null;if(r)return Z(r);let d=a$2(n,e$1.contractVerify),o=t.map(s=>_(s,[/workspace-contract-verify-last-run/i,/workspace-contract-verify/i])).find(s=>typeof s=="string")??null;if(o)try{let s=JSON.parse(c.readFileSync(o,"utf-8")),i=String(s.status??"").toLowerCase();if(i==="passed"||i==="pass")return {gate:"verify",status:"pass",summary:"Workspace contract verification passed (CLI cache)",details:[],evidencePath:o};if(i==="failed"||i==="fail")return {gate:"verify",status:"fail",summary:"Workspace contract verification failed (CLI cache)",details:(Array.isArray(s.violations)?s.violations:[]).slice(0,5),evidencePath:o}}catch{}try{let{verifyWorkspaceContract:s}=await import('./workspace-contract-JS4LZZQZ.js'),i=await s({workspacePath:n}),l={schemaVersion:"v1",source:"cli",generatedAt:new Date().toISOString(),status:i.status,contractPath:i.contractPath,projectCount:i.projectCount,checks:i.checks,violations:i.violations};return await e$2(n,e$1.contractVerify,l),i.status==="failed"?{gate:"verify",status:"fail",summary:"Workspace contract verification failed (CLI)",details:i.violations.slice(0,5),evidencePath:d}:{gate:"verify",status:"pass",summary:"Workspace contract verification passed (CLI)",details:[],evidencePath:d}}catch(s){return {gate:"verify",status:"fail",summary:"No verify evidence and workspace contract verification unavailable",details:["Run workspai workspace contract verify --json or export verify-pack contract from CI.",s instanceof Error?s.message:String(s)],evidencePath:y.join(a,"*verify*.json")}}}function te(n,e){let t=j(e,"doctor-last-run.json");if(!n)return {gate:"dependency",status:"warn",summary:"Dependency risk check skipped (doctor evidence missing)",details:["Run workspai doctor workspace --json to include dependency findings."],evidencePath:t};let a=b$2(n);return a.blockingFindings>0||a.vulnerableDependencies>0?{gate:"dependency",status:"fail",summary:`${Math.max(a.blockingFindings,a.vulnerableDependencies)} blocking dependency/security vulnerability finding(s) reported`,details:["Resolve the typed dependency/security findings and regenerate focused audit evidence."],evidencePath:t}:a.auditFailed>0?{gate:"dependency",status:"fail",summary:`${a.auditFailed} dependency audit(s) failed`,details:["Repair the audit runner or dependency environment; failed audits are not clean."],evidencePath:t}:a.missingDependencies>0||a.auditUnavailable>0||a.unknownFindings>0||a.advisoryFindings>0?{gate:"dependency",status:"warn",summary:"Dependency evidence is incomplete or requires attention",details:[...a.missingDependencies>0?[`${a.missingDependencies} project(s) have no materialized dependency tree.`]:[],...a.auditUnavailable>0?[`${a.auditUnavailable} audit provider(s) are unavailable or unsupported.`]:[],...a.unknownFindings>0?[`${a.unknownFindings} dependency/security finding(s) remain unknown.`]:[],...a.advisoryFindings>0?[`${a.advisoryFindings} dependency/security advisory finding(s) remain.`]:[]],evidencePath:t}:{gate:"dependency",status:"pass",summary:"No dependency vulnerabilities reported",details:[],evidencePath:t}}function ne(n){return n.some(e=>e.status==="fail")?"fail":n.some(e=>e.status==="warn")?"warn":"pass"}async function ae(n,e){return e$2(n,H,e)}async function se(n={}){let e$1=y.resolve(n.startPath??process.cwd()),t=a(e$1)??e$1,a$1=await B(t)>0,r=a$1&&b(e$1)?t:U(e$1,t),d=r===t?"unknown":z(r),o=a$1?d:"unknown";if(a$1&&r===t){let{resolveWorkspaceRegisteredProjects:g}=await import('./workspace-registry-summary-MIDFG6EC.js');o=(await g(t)).summary.projects.map(q=>z(y.resolve(t,q.relativePath)));}let s=Q(t,o,{hasRegisteredProjects:a$1}),i=X(t),l=Y(t),p=await ee(t,{skipVerify:n.skipVerify}),f$1=te(i.payload,t),w=[s,i.gate,l,p,f$1],k=ne(w),v={schemaVersion:K,generatedAt:new Date().toISOString(),workspacePath:t,projectPath:r,action:n.action,overallStatus:k,blocking:k==="fail",blockingReasons:w.filter(g=>g.status==="fail").map(g=>`${g.gate}: ${g.summary}`),gates:w};if(n.writeReport!==false){let g=f(v,{commandId:"workspaceReadiness",exitCode:k==="fail"?2:k==="warn"?1:0,generatedAt:v.generatedAt,blockers:v.blockingReasons,runId:e()});v.evidencePath=await ae(t,g);}return v}function re(n){return n==="pass"?u.green("PASS"):n==="warn"?u.yellow("WARN"):u.red("FAIL")}function ie(n){return n==="pass"?u.green("PASS"):n==="warn"?u.yellow("WARN"):u.red("FAIL")}async function Pe(n){let e=await se({startPath:n.workspace,writeReport:true,skipVerify:n.skipVerify===true});if(n.json)console.log(JSON.stringify(e,null,2));else {console.log(u.bold.cyan(`
2
- \u{1F6A6} Workspai Release Readiness
3
- `)),console.log(u.bold(`Workspace: ${u.cyan(y.basename(e.workspacePath))}`)),console.log(u.gray(`Path: ${e.workspacePath}`)),console.log(`Overall: ${ie(e.overallStatus)}`);for(let t of e.gates){console.log(` - ${t.gate}: ${re(t.status)} ${t.summary}`);for(let a of t.details)console.log(u.gray(` ${a}`));t.evidencePath&&console.log(u.gray(` evidence: ${t.evidencePath}`));}e.evidencePath&&console.log(u.gray(`
4
- Evidence saved: ${e.evidencePath}`));}n.strict&&e.overallStatus!=="pass"&&process.exit(1);}export{se as a,Pe as b};
@@ -1 +0,0 @@
1
- var r="workspai.doctor-capabilities.v1",k="universal-doctor-capabilities-v1",t="workspai.doctor-validation.v1",w="doctor-disease-corpus-v1";var o={model:".workspai/reports/workspace-model.json",knowledgeGraph:".workspai/reports/workspace-knowledge-graph.json",snapshot:".workspai/reports/workspace-model-snapshot.json",diff:".workspai/reports/workspace-model-diff-last-run.json",impact:".workspai/reports/workspace-impact-last-run.json",analyze:".workspai/reports/analyze-last-run.json",doctor:".workspai/reports/doctor-last-run.json",contractVerify:".workspai/reports/workspace-contract-verify-last-run.json",readiness:".workspai/reports/release-readiness-last-run.json",verify:".workspai/reports/workspace-verify-last-run.json",history:".workspai/reports/workspace-intelligence-history.json",agentContext:".workspai/reports/workspace-context-agent.json",agentIndex:".workspai/reports/INDEX.json",agentCustomizationPack:".workspai/reports/agent-customization-pack.json",skillsIndex:".workspai/reports/workspace-skills-index.json",agents:"AGENTS.md",explain:".workspai/reports/workspace-explain-last-run.json",intelligenceRun:".workspai/reports/workspace-intelligence-run-last-run.json",evaluationLive:".workspai/reports/workspace-intelligence-evaluation-live.json",evaluationLastRun:".workspai/reports/workspace-intelligence-evaluation-last-run.json",verifiedGoalStatus:".workspai/reports/verified-goal-last-run.json",repairTransaction:".workspai/reports/workspace-repair-last-run.json"},s={model:"workspace-model.v1",knowledgeGraph:"workspace-knowledge-graph.v1",snapshot:"workspace-model-snapshot.v1",diff:"workspace-model-diff.v1",impact:"workspace-impact.v1",analyze:"rapidkit-analyze-v1",doctor:"doctor-workspace-evidence-v1",contractVerify:"workspace-contract-verify.v1",readiness:"release-readiness-v1",verify:"workspace-verify.v1",history:"workspace-intelligence-history.v1",agentContext:"workspace-context.v1",agentIndex:"rapidkit-agent-reports-index.v1",agentCustomizationPack:"rapidkit-agent-customization-pack.v1",skillsIndex:"workspace-skills-index.v1",agents:null,explain:"workspace-explain.v1",intelligenceRun:"workspace-intelligence-run.v1",evaluationLive:"workspace-intelligence-evaluation.v1",evaluationLastRun:"workspace-intelligence-evaluation.v1",verifiedGoalStatus:"workspai.verified-goal-status.v1",repairTransaction:"workspai.workspace-repair-transaction.v1"},c={model:"contracts/workspace-intelligence/workspace-model.v1.json",knowledgeGraph:"contracts/workspace-intelligence/workspace-knowledge-graph.v1.json",snapshot:"contracts/workspace-intelligence/workspace-model-snapshot.v1.json",diff:"contracts/workspace-intelligence/workspace-model-diff.v1.json",impact:"contracts/workspace-intelligence/workspace-impact.v1.json",analyze:"contracts/analyze-last-run.v1.json",doctor:"contracts/doctor-workspace-evidence.v1.json",contractVerify:"contracts/workspace-intelligence/workspace-contract-verify.v1.json",readiness:"contracts/release-readiness.v1.json",verify:"contracts/workspace-intelligence/workspace-verify.v1.json",history:"contracts/workspace-intelligence/workspace-intelligence-history.v1.json",agentContext:"contracts/workspace-intelligence/workspace-context.v1.json",agentIndex:"contracts/workspace-intelligence/agent-reports-index.v1.json",agentCustomizationPack:"contracts/workspace-intelligence/agent-customization-pack-report.v1.json",skillsIndex:"contracts/workspace-intelligence/workspace-skills-index.v1.json",agents:null,explain:"contracts/workspace-intelligence/workspace-explain.v1.json",intelligenceRun:"contracts/workspace-intelligence/workspace-intelligence-run.v1.json",evaluationLive:"contracts/workspace-intelligence/workspace-intelligence-evaluation.v1.json",evaluationLastRun:"contracts/workspace-intelligence/workspace-intelligence-evaluation.v1.json",verifiedGoalStatus:"contracts/workspace-intelligence/verified-goal-status.v1.json",repairTransaction:"contracts/workspace-intelligence/workspace-repair-transaction.v1.json"},l={goalIndex:{artifactPath:".workspai/goals/index.json",schemaVersion:"workspai.goal-index.v1",contractPath:"contracts/workspace-intelligence/goal-index.v1.json",producerCommands:[["goal"]]},projectWorkspaceLink:{artifactPath:".workspai/workspace-link.local.json",schemaVersion:"project-workspace-link.v1",contractPath:"contracts/project-workspace-link.v1.json",producerCommands:[["adopt"],["import"],["project","workspace","relink"],["workspace","sync"]]},projectContextAgent:{artifactPath:".workspai/reports/project-context-agent.json",schemaVersion:"project-context-agent.v1",contractPath:"contracts/workspace-intelligence/project-context-agent.v1.json",producerCommands:[["adopt"],["import"],["workspace","sync"],["workspace","agent-sync","--write"]]},projectAgentEntry:{artifactPath:".workspai/agent-entry.v1.json",schemaVersion:"workspai.agent-entry.v1",contractPath:"contracts/workspace-intelligence/project-agent-entry.v1.json",producerCommands:[["adopt"],["import"],["workspace","sync"],["workspace","agent-sync","--write"]]},workspaceContract:{artifactPath:".workspai/workspace.contract.json",schemaVersion:1,contractPath:"contracts/workspace-contract.v1.json",producerCommands:[["workspace","sync"],["workspace","contract","sync"]]},workspaceModelCache:{artifactPath:".workspai/cache/workspace-model.v1.json",schemaVersion:"workspace-model-cache.v1",contractPath:"contracts/workspace-model-cache.v1.json",producerCommands:[["workspace","model"]]},workspaceRegistry:{artifactPath:".workspai/workspace-registry.v1.json",schemaVersion:"workspace-registry.v1",contractPath:"contracts/workspace-registry.v1.json",producerCommands:[["workspace","sync"]]},compatibilityMatrix:{artifactPath:".workspai/compatibility-matrix.json",schemaVersion:"rapidkit.compatibility-matrix.v1",contractPath:"contracts/compatibility-matrix.v1.json",producerCommands:[["bootstrap"]]},doctorWorkspaceCache:{artifactPath:".workspai/reports/doctor-workspace-cache.json",schemaVersion:"doctor-workspace-cache-v2",contractPath:"contracts/doctor-workspace-cache.v2.json",producerCommands:[["doctor","workspace"]]},doctorCapabilities:{artifactPath:".workspai/reports/doctor-capabilities.json",schemaVersion:r,contractPath:"contracts/workspace-intelligence/doctor-capabilities.v1.json",producerCommands:[["doctor","capabilities","--write"]]},doctorValidation:{artifactPath:".workspai/reports/doctor-validation-last-run.json",schemaVersion:t,contractPath:"contracts/workspace-intelligence/doctor-validation.v1.json",producerCommands:[["doctor","capabilities","--validate","--write"]]},bootstrapCompliance:{artifactPath:".workspai/reports/bootstrap-compliance.latest.json",schemaVersion:"bootstrap-compliance.v1",contractPath:"contracts/bootstrap-compliance.v1.json",producerCommands:[["bootstrap"]]},mirrorOps:{artifactPath:".workspai/reports/mirror-ops.latest.json",schemaVersion:"mirror-ops.v1",contractPath:"contracts/mirror-ops.v1.json",producerCommands:[["mirror","status"]]},transparencyEvidence:{artifactPath:".workspai/reports/transparency-evidence.latest.json",schemaVersion:"transparency-evidence.v1",contractPath:"contracts/transparency-evidence.v1.json",producerCommands:[["mirror","sync"]]},workspaceShareBundle:{artifactPath:".workspai/reports/share-bundle.json",schemaVersion:"1.1",schemaVersionField:"schema_version",contractPath:"contracts/workspace-share-bundle.v1.json",producerCommands:[["workspace","share"]]},doctorProject:{artifactPath:".workspai/reports/doctor-project-last-run.json",schemaVersion:"doctor-project-evidence-v1",contractPath:"contracts/doctor-project-evidence.v1.json",producerCommands:[["doctor","project"]]},doctorReceipt:{artifactPath:".workspai/reports/doctor-receipt-last-run.json",schemaVersion:"workspai.doctor-receipt.v1",contractPath:"contracts/workspace-intelligence/doctor-receipt.v1.json",producerCommands:[["doctor","workspace"],["doctor","project"]]},projectTestCoverage:{artifactPath:".workspai/reports/project-test-coverage-last-run.json",schemaVersion:"workspai.project-test-coverage.v1",contractPath:"contracts/project-test-coverage.v1.json",producerCommands:[["project","coverage"]]},goalPackLastRun:{artifactPath:".workspai/reports/goal-pack-last-run.json",schemaVersion:"workspai.goal-pack.v1",contractPath:"contracts/workspace-intelligence/goal-pack.v1.json",producerCommands:[["goal"]]},doctorRemediationPlan:{artifactPath:".workspai/reports/doctor-remediation-plan-last-run.json",schemaVersion:"doctor-remediation-plan-v2",contractPath:"contracts/doctor-remediation-plan.v2.json",producerCommands:[["workspace","remediation-plan"]]},artifactRemediationPlan:{artifactPath:".workspai/reports/artifact-remediation-plan-last-run.json",schemaVersion:"artifact-remediation-plan-v1",contractPath:"contracts/artifact-remediation-plan.v1.json",producerCommands:[["workspace","remediation-plan"]]},doctorFixResult:{artifactPath:".workspai/reports/doctor-fix-result-last-run.json",schemaVersion:"rapidkit-doctor-fix-result-v1",contractPath:"contracts/workspace-intelligence/doctor-fix-result.v1.json",producerCommands:[["doctor","workspace"]]},pipelineLastRun:{artifactPath:".workspai/reports/pipeline-last-run.json",schemaVersion:"rapidkit-pipeline-v1",contractPath:"contracts/pipeline-last-run.v1.json",producerCommands:[["pipeline"]]},autopilotReleaseLastRun:{artifactPath:".workspai/reports/autopilot-release-last-run.json",schemaVersion:"autopilot-release-v1",contractPath:"contracts/autopilot-release.v1.json",producerCommands:[["autopilot","release"]]},autopilotReleaseAlias:{artifactPath:".workspai/reports/autopilot-release.json",schemaVersion:"autopilot-release-v1",contractPath:"contracts/autopilot-release.v1.json",producerCommands:[["autopilot","release"]]},workspaceRunLast:{artifactPath:".workspai/reports/workspace-run-last.json",schemaVersion:"workspace-run-v1",contractPath:"contracts/workspace-run-last.v1.json",producerCommands:[["workspace","run"]]},workspaiMcpDesign:{artifactPath:".workspai/reports/workspai-mcp-design.json",schemaVersion:"workspai-mcp-design.v1",contractPath:"contracts/workspace-intelligence/mcp-design.v1.json",producerCommands:[["workspace","agent-sync","--write"]]},legacyMcpDesign:{artifactPath:".workspai/reports/rapidkit-mcp-design.json",schemaVersion:"workspai-mcp-design.v1",contractPath:"contracts/workspace-intelligence/mcp-design.v1.json",producerCommands:[["workspace","agent-sync","--write"]]},workspaceWhy:{artifactPath:".workspai/reports/workspace-why-last-run.json",schemaVersion:s.explain,contractPath:c.explain,producerCommands:[["workspace","why"]]},workspaceTrace:{artifactPath:".workspai/reports/workspace-trace-last-run.json",schemaVersion:s.explain,contractPath:c.explain,producerCommands:[["workspace","trace"]]},agentHooks:{artifactPath:".vscode/workspai-agent-hooks.json",schemaVersion:"workspai-agent-hooks.v1",contractPath:"contracts/workspace-intelligence/agent-hooks.v1.json",producerCommands:[["workspace","agent-sync"]]},infraPlan:{artifactPath:".workspai/reports/infra-plan.json",schemaVersion:"rapidkit.infra-plan.v1",contractPath:"contracts/infra-plan.v1.json",producerCommands:[["infra","plan"]]}},u=Object.freeze(Object.fromEntries(Object.entries(l).map(([a,n])=>[a,n.artifactPath]))),h={[o.intelligenceRun]:[["workspace","intelligence","run"]],[o.snapshot]:[["workspace","snapshot"]],[o.history]:[["workspace","feedback","record","--json"]],[o.evaluationLive]:[["workspace","eval","init"],["workspace","eval","record","--json"]],[o.evaluationLastRun]:[["workspace","eval","report","--json"]],[o.verifiedGoalStatus]:[["workspace","goal","plan"],["workspace","goal","verify"]],[o.repairTransaction]:[["workspace","repair","plan"],["workspace","repair","propose"],["workspace","repair","approve"],["workspace","repair","decide"],["workspace","repair","execute"],["workspace","repair","resume"],["workspace","repair","rollback"],["workspace","repair","cancel"]]},j={analyze:"analyze",workspace:"workspace <action> [subaction] [key] [value]",doctor:"doctor [scope]",readiness:"readiness"},f=["analyze","readiness","doctor","workspace"],C=["model","diff","impact","doctor-evidence","contract-evidence","analyze-evidence","readiness-evidence","verify","context","agent-sync","explain"],P=["sync","baseline"],y={sync:[".workspai/workspace.contract.json",".workspai/workspace-registry.v1.json"],baseline:[o.snapshot]},e=o,d={model:{command:["workspace","model","--json","--write"],produces:[e.model,e.knowledgeGraph]},diff:{command:["workspace","diff","--from",e.snapshot,"--json"],produces:[e.diff]},impact:{command:["workspace","impact","--from",e.diff,"--json"],produces:[e.impact]},"doctor-evidence":{command:["doctor","workspace","--json"],produces:[e.doctor]},"contract-evidence":{command:["workspace","contract","verify","--strict","--json"],produces:[e.contractVerify]},"analyze-evidence":{command:["analyze","--json"],produces:[e.analyze]},"readiness-evidence":{command:["readiness","--json","--skip-verify"],produces:[e.readiness]},verify:{command:["workspace","verify","--from-impact",e.impact,"--json"],produces:[e.verify,e.history]},context:{command:["workspace","context","--for-agent","--json","--write","--no-agent-sync"],produces:[e.agentContext]},"agent-sync":{command:["workspace","agent-sync","--write","--json","--preset","enterprise"],produces:[e.agentIndex,e.agentCustomizationPack,e.skillsIndex,e.agents]},explain:{command:["workspace","explain","release-blocked","--json","--write"],produces:[e.explain]}};function I(a){return d[a]}export{r as a,k as b,t as c,w as d,o as e,s as f,c as g,l as h,u as i,h as j,j as k,f as l,C as m,P as n,y as o,d as p,I as q};
@@ -1,2 +0,0 @@
1
- import {w}from'./chunk-J7RU5WR5.js';import {a as a$1}from'./chunk-T5YRFRJV.js';import {a}from'./chunk-GR6442P7.js';import {a as a$2,d,c as c$1,e as e$1}from'./chunk-CCDGHPEJ.js';import {b}from'./chunk-D65FCQIO.js';import {i,e,h,f}from'./chunk-NZ3WZYD5.js';import {l}from'./chunk-OCGZNSOE.js';import {c}from'./chunk-VR6XMUF3.js';import {t,s}from'./chunk-MOSXTVPU.js';import g from'path';import h$1 from'fs-extra';var ue="unknown-run";function Z(e){let t=c();return !t||t===ue?e:{...e,runId:t}}var xe="workspace-dependency-graph.v1",Q=["code-import","package-dep","event-pub-sub","service-dependsOn","shared-resource"],X=["inferred","contract","manual"];var E=i.workspaceContract,me=e.contractVerify,S=h.workspaceContract.schemaVersion,ge=f.contractVerify,x=class extends Error{constructor(r){super(`Workspace contract verification failed: ${r.violations.join("; ")}`);this.verification=r;this.name="WorkspaceContractVerificationError";}verification};function ne(e){return e.replace(/\\/g,"/")}function V(e){let t=ne(e).trim();return !t||t.startsWith("/")||t.startsWith("~")||/^[a-zA-Z]:\//.test(t)||t.includes("\0")?false:!t.split("/").filter(Boolean).some(r=>r===".."||r===".")}function ee(e,t){return e.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/-+/g,"-").replace(/^[-_.]+|[-_.]+$/g,"").slice(0,80)||t}function fe(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.trim().length>0):[]}function te(e){let r=(Array.isArray(e.ports)?e.ports:[]).map(p=>{if(!p||typeof p!="object"||Array.isArray(p))return null;let c=p,m=Number(c.port);if(!Number.isInteger(m)||m<1||m>65535)return null;let d=c.protocol==="https"||c.protocol==="grpc"||c.protocol==="tcp"||c.protocol==="udp"?c.protocol:"http";return {name:typeof c.name=="string"&&c.name.trim()?c.name:"http",port:m,protocol:d}}).filter(p=>p!==null);if(r.length>0)return r;let o=e.frontend&&typeof e.frontend=="object"&&!Array.isArray(e.frontend)?e.frontend:void 0,a=Number(e.port??o?.default_port);return Number.isInteger(a)&&a>=1&&a<=65535?[{name:"http",port:a,protocol:"http"}]:[]}async function he(e){let t=g.join(e,"Dockerfile");if(!await h$1.pathExists(t))return [];try{let r=await h$1.readFile(t,"utf8"),o=new Map;for(let a of r.matchAll(/^\s*EXPOSE\s+(.+)$/gim))for(let p of a[1].split(/\s+/)){let c=p.match(/^(\d{1,5})(?:\/(tcp|udp))?$/i),m=Number(c?.[1]);if(!c||!Number.isInteger(m)||m<1||m>65535)continue;let d=c[2]?.toLowerCase();o.set(m,{name:"http",port:m,protocol:d==="udp"?"udp":"http"});}return [...o.values()].sort((a,p)=>a.port-p.port)}catch{return []}}async function G(e){for(let t of e)if(await h$1.pathExists(t))return t;return null}async function ke(e){for(let t of s(e,"workspace.json"))try{let r=await h$1.readJson(t);return {name:typeof r.workspace_name=="string"&&r.workspace_name.trim()||typeof r.name=="string"&&r.name.trim()||g.basename(e),profile:typeof r.profile=="string"?r.profile:void 0}}catch{}return {name:g.basename(e)}}async function we(e){let t$1=[],r=[e],o=new Set,a$1=new Set([".git",".workspai",".rapidkit","node_modules",".venv","venv","dist","build","target",".next",".turbo",".cache"]);for(;r.length>0;){let p=r.shift();if(!p||o.has(p))continue;o.add(p);let c=await G(t(p,"project.json")),m=await G(t(p,"context.json"));if(c||m){t$1.push(c??m??"");continue}let d;try{d=await h$1.readdir(p,{withFileTypes:true});}catch{continue}for(let l of d)!l.isDirectory()||a$1.has(l.name)||a(l.name)||r.push(g.join(p,l.name));}return t$1.sort()}function Pe(e){let t=(e||"").toLowerCase();if(t.includes("fastapi"))return "fastapi";if(t.includes("nestjs"))return "nestjs";if(t.includes("springboot"))return "springboot";if(t.includes("gofiber"))return "fiber";if(t.includes("gogin"))return "gin"}function Ce(e,t){let r=(e||"").toLowerCase(),o=(t||"").toLowerCase();return r.includes("vscode-extension")?null:r.includes("fastapi")?8e3:r.includes("nestjs")?3e3:r.includes("springboot")?8080:r.includes("gofiber")?3e3:r.includes("gogin")?8080:r.startsWith("adopted.")?null:o==="node"?3e3:o==="python"?8e3:o==="java"||o==="go"?8080:null}function I(e,t){let r=e;for(;t.has(r)&&r<65535;)r+=1;return r}function T(e,t,r){let o=e!==void 0&&e.source===void 0,a=Ce(t.kit,t.runtime),p=e?.ports||[],c=t.ports||[],m=(t.kit||"").toLowerCase().includes("vscode-extension"),d=t.source==="adopted-local"&&e?.source==="adopted-local",l=d,i=(m&&c.length===0?[]:d?c.length>0?c:a?[{name:"http",port:I(a,r),protocol:"http"}]:[]:p.length>0?p:c.length>0?c:a?[{name:"http",port:I(a,r),protocol:"http"}]:[]).map(P=>({...P,port:I(P.port,r)}));for(let P of i)r.add(P.port);let k={...t,...e,slug:e?.slug||t.slug,relativePath:o&&e?.relativePath&&V(e.relativePath)?e.relativePath:t.relativePath,source:o&&e?.source||t.source,relationship:o&&e?.relationship||t.relationship,externalPath:o&&e?.externalPath||t.externalPath,runtime:l?t.runtime:e?.runtime||t.runtime,framework:l?t.framework:e?.framework||t.framework,kit:l?t.kit:e?.kit||t.kit,modules:e?.modules?.length?e.modules:t.modules,ports:i,contracts:{owns:e?.contracts?.owns||[],apis:e?.contracts?.apis||[],publishes:e?.contracts?.publishes||[],consumes:e?.contracts?.consumes||[],dependsOn:e?.contracts?.dependsOn||[],env:e?.contracts?.env||[]}},f=JSON.stringify(e||null)!==JSON.stringify(k);return {project:k,changed:f}}async function ae(e){let t$1=g.resolve(e.workspacePath),r=await ke(t$1),o=await we(t$1),a=await a$1(t$1),p=[];for(let l of a){let s=g.resolve(l.path),i=await G(t(s,"project.json"))??await G(t(s,"context.json"));!i||o.some(k=>g.resolve(k)===g.resolve(i))||p.push({projectJsonPath:i,registryEntry:l});}let c=[],m=[...o.map(l=>({projectJsonPath:l})),...p];for(let{projectJsonPath:l,registryEntry:s}of m){let i=g.dirname(g.dirname(l)),k=ne(g.relative(t$1,i)),f=s!==void 0&&!V(k),P=ee(s?.name||g.basename(i),g.basename(i)),C=f?`external/${P}`:k||P,w=await h$1.readJson(l),j=typeof w.kit_name=="string"&&w.kit_name||typeof w.kit=="string"&&w.kit||void 0,n=typeof w.framework=="string"&&w.framework||Pe(j);c.push({slug:s?.name||C||g.basename(i),relativePath:C,source:s?.source??"workspace",relationship:s?.relationship,externalPath:f?i:void 0,runtime:typeof w.runtime=="string"?w.runtime:void 0,framework:n,kit:j,modules:fe(w.modules),ports:te(w).length>0?te(w):await he(i),contracts:{owns:[],apis:[],publishes:[],consumes:[],dependsOn:[],env:[]}});}let d=new Map;for(let l of c){let s=ee(l.slug,l.relativePath),i=d.get(s);(!i||i.source!=="workspace"&&l.source==="workspace")&&d.set(s,l);}return {schemaVersion:S,kind:"rapidkit.workspace.contract",generatedAt:(e.now??new Date).toISOString(),workspace:r,projects:[...d.values()]}}async function Ue(e){let t=g.resolve(e.outputPath||a$2(e.workspacePath,E));if(await h$1.pathExists(t)&&e.force!==true)throw new Error(`Workspace contract already exists: ${t}. Use --force to overwrite.`);let r=await ae({workspacePath:e.workspacePath,now:e.now}),o=new Set,a={...r,projects:r.projects.map(c=>T(void 0,c,o).project)},p=await ie({workspacePath:e.workspacePath,contractPath:t,contract:a});if(e.strict&&p.status==="failed")throw new x(p);return await se({workspacePath:e.workspacePath,contractPath:t,contract:a,now:e.now}),{contractPath:t,contract:a}}async function ze(e){let t=g.resolve(e.workspacePath),r=a$2(t,E),o=await d(t,E)??r,a=await ae({workspacePath:t,now:e.now}),p=await h$1.pathExists(o)?await h$1.readJson(o):null,c=new Map((p?.projects||[]).map(f=>[f.slug,f])),m=new Set,d$1=[],l=[],s=[];for(let f of a.projects){let P=c.get(f.slug),C=T(P,f,m);P?C.changed&&l.push(f.slug):d$1.push(f.slug),s.push(C.project),c.delete(f.slug);}for(let f of c.values()){if(f.source)continue;let P=T(f,f,m);s.push(P.project);}let i={schemaVersion:S,kind:"rapidkit.workspace.contract",generatedAt:(e.now??new Date).toISOString(),workspace:{...p?.workspace||{},...a.workspace,name:a.workspace.name||p?.workspace?.name||g.basename(t)},projects:s.sort((f,P)=>f.slug.localeCompare(P.slug))},k=await ie({workspacePath:t,contractPath:r,contract:i});if(e.strict&&k.status==="failed")throw new x(k);return await se({workspacePath:t,contractPath:r,contract:i,now:e.now}),{contractPath:r,contract:i,addedProjects:d$1,updatedProjects:l,verification:k}}async function re(e){return await h$1.pathExists(e)?{exists:true,contents:await h$1.readFile(e)}:{exists:false}}async function oe(e,t){if(!t.exists){await h$1.remove(e);return}await h$1.outputFile(e,t.contents);}async function se(e){let{buildWorkspaceRegistrySummary:t,WORKSPACE_REGISTRY_SUMMARY_RELATIVE_PATH:r}=await import('./workspace-registry-summary-MIDFG6EC.js'),o=await t(e.workspacePath,{now:e.now,contract:e.contract}),a=a$2(e.workspacePath,r),p=c=>{if(!c||typeof c!="object"||Array.isArray(c))return JSON.stringify(c);let{generatedAt:m,...d}=c;return JSON.stringify(d)};if(await h$1.pathExists(e.contractPath)&&await h$1.pathExists(a)){let[c,m]=await Promise.all([h$1.readJson(e.contractPath),h$1.readJson(a)]);if(p(c)===p(e.contract)&&p(m)===p(o))return}b(E,e.contract),b(r,o),await c$1(e.workspacePath,E,async()=>{let[c,m]=await Promise.all([re(e.contractPath),re(a)]);try{if(e.contractPath===a$2(e.workspacePath,E)?await e$1(e.workspacePath,E,e.contract):(await h$1.ensureDir(g.dirname(e.contractPath)),await h$1.writeJson(e.contractPath,e.contract,{spaces:2})),process.env.WORKSPAI_TEST_FAIL_WORKSPACE_REGISTRY_PUBLISH==="1")throw new Error("Injected workspace registry summary publication failure.");await e$1(e.workspacePath,r,o);}catch(d){let s=(await Promise.allSettled([oe(e.contractPath,c),oe(a,m)])).filter(i=>i.status==="rejected");throw s.length>0?new AggregateError([d,...s.map(i=>i.reason)],"Workspace contract publication failed and rollback was incomplete."):d}});}async function ce(e){let t=e.contractPath??(await d(e.workspacePath,E)||a$2(e.workspacePath,E)),r=await h$1.readJson(t);return {contractPath:t,contract:r}}var ye={metadata:[".workspai/project.json",".workspai/context.json",".rapidkit/project.json",".rapidkit/context.json"],manifests:["package.json","package-lock.json","pnpm-lock.yaml","yarn.lock","pyproject.toml","poetry.lock","requirements.txt","go.mod","go.sum","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","Gemfile","composer.json"],entrypoints:["src/main.ts","src/index.ts","src/app.ts","src/main.js","src/index.js","main.py","app/main.py","manage.py","main.go","cmd/main.go","Program.cs"],apiSpecifications:["openapi.yaml","openapi.yml","openapi.json","swagger.yaml","swagger.yml","swagger.json"],infrastructure:["Dockerfile","docker-compose.yml","docker-compose.yaml","compose.yml","compose.yaml","k8s","kubernetes","terraform"],documentation:["README.md","ARCHITECTURE.md","CONTRIBUTING.md","docs"]};function Ee(e,t){return t.externalPath?g.resolve(t.externalPath):g.resolve(e,t.relativePath)}async function be(e){let t={metadata:[],manifests:[],entrypoints:[],apiSpecifications:[],infrastructure:[],documentation:[]};for(let[r,o]of Object.entries(ye))for(let a of o)await h$1.pathExists(g.join(e,a))&&t[r].push(a);try{let r=await h$1.readdir(e,{withFileTypes:true});for(let o of r)o.isFile()&&(o.name.endsWith(".csproj")||o.name.endsWith(".sln"))&&t.manifests.push(o.name),o.isFile()&&o.name.endsWith(".tf")&&t.infrastructure.push(o.name);}catch{}for(let r of Object.values(t))r.sort((o,a)=>o.localeCompare(a));return t}function A(e){return !e||typeof e!="object"||Array.isArray(e)?[]:Object.keys(e).sort((t,r)=>t.localeCompare(r))}async function We(e){try{let t=await h$1.readJson(g.join(e,"package.json")),r={runtime:A(t.dependencies),development:A(t.devDependencies),peer:A(t.peerDependencies),optional:A(t.optionalDependencies)};return {...typeof t.name=="string"?{name:t.name}:{},...typeof t.version=="string"?{version:t.version}:{},...typeof t.private=="boolean"?{private:t.private}:{},scripts:A(t.scripts),dependencies:r,dependencyCount:new Set(Object.values(r).flat()).size}}catch{return}}async function ve(e){for(let t of [".env.example",".env.sample",".env.template"])try{return (await h$1.readFile(g.join(e,t),"utf8")).split(/\r?\n/).map(o=>o.trim()).filter(o=>o.length>0&&!o.startsWith("#")&&o.includes("=")).map(o=>o.slice(0,o.indexOf("=")).trim()).filter(o=>/^[A-Za-z_][A-Za-z0-9_]*$/.test(o)).sort((o,a)=>o.localeCompare(a))}catch{}return []}function Ae(e,t){try{let r=w(e);if(r.engine!=="unknown")return r;let o=h$1.pathExistsSync(g.join(e,"package.json"))?"npm":h$1.pathExistsSync(g.join(e,"pyproject.toml"))?"python":h$1.pathExistsSync(g.join(e,"requirements.txt"))?"pip":"unknown";return {...r,engine:o,runtime:t.runtime??r.runtime,framework:t.framework??r.framework,frameworkDisplayName:t.framework??r.frameworkDisplayName}}catch{return {schemaVersion:1,scope:"project",projectRoot:null,engine:"unknown",runtime:"unknown",runtimeCandidates:["unknown"],compositeRuntime:false,lifecycleCoverage:"complete",framework:"unknown",frameworkDisplayName:"Unknown",frameworkConfidence:"low",frameworkSupportTier:"observed",runtimeSupportTier:"observed",runtimeDoctorSupport:"observed",moduleSupport:false,fleetStages:[],localOnlyCommands:[],commandMap:{},supportedCommands:[],unsupportedCommands:[],globalCommands:[]}}}function Se(e,t,r){let o=e.projects.map(a=>({id:a.slug,path:a.relativePath,runtime:a.runtime,framework:a.framework}));return {schemaVersion:"workspace-dependency-graph.v1",generatedAt:t,nodes:o,edges:[],stats:{nodeCount:o.length,edgeCount:0,inferredEdges:0,contractEdges:0,manualEdges:0,authoritativeEdges:0,lowConfidenceEdges:0,orphanCount:o.length,connectedNodeCount:0,density:0,edgeCoverageRatio:o.length===0?1:0,evidenceCoverageRatio:1,hotspotCount:0,hasCycle:false},diagnostics:[{code:"graph.enrichment.failed",severity:"warning",message:r,recommendation:"Review project manifests and graph overrides, then rerun workspace contract graph."}]}}async function Ye(e$1){let{contractPath:t,contract:r}=await ce(e$1),o=e$1.now??new Date,a=o.toISOString(),{buildWorkspaceModel:p,workspaceModelProjectTopology:c}=await import('./workspace-model-OKY4CQ3X.js'),{hashWorkspaceModel:m}=await import('./workspace-model-hash-ZXYPIGCW.js'),d=await p({workspacePath:e$1.workspacePath,includeEvidence:false,now:o}),l=c(d)??Se(r,a,"The canonical Workspace Model did not provide a project dependency topology."),s=new Map(l.nodes.map(n=>[n.id,n.operationalProfile])),{buildWorkspaceKnowledgeGraph:i}=await import('./workspace-knowledge-graph-RSDP2E36.js'),k=await i({workspacePath:e$1.workspacePath,workspace:{name:d.workspace.name,...d.workspace.profile?{profile:d.workspace.profile}:{}},contract:r,projectTopology:l,now:o,projects:d.projects.map(n=>({id:n.name,path:n.path,...n.absolutePath?{absolutePath:n.absolutePath}:{},runtime:n.runtime,runtimeCandidates:n.runtimeCandidates,framework:n.framework,...n.kit?{kit:n.kit}:{}})),source:{kind:"workspace-model",artifact:e.model,hashAlgorithm:"sha256",hash:m(d)}}),f=await Promise.all(r.projects.map(async n=>{let u=Ee(e$1.workspacePath,n),[R,W,pe]=await Promise.all([be(u),We(u),ve(u)]),y=Ae(u,n);return {id:n.slug,label:n.slug,relativePath:n.relativePath,source:n.source,relationship:n.relationship,externalPath:n.externalPath,runtime:n.runtime??y.runtime,framework:n.framework??y.framework,kit:n.kit,modules:n.modules,ports:n.ports,apis:n.contracts.apis,owns:n.contracts.owns,env:[...new Set([...n.contracts.env,...pe])].sort((le,de)=>le.localeCompare(de)),contracts:{owns:[...n.contracts.owns],apis:[...n.contracts.apis],publishes:[...n.contracts.publishes],consumes:[...n.contracts.consumes],dependsOn:[...n.contracts.dependsOn],env:[...n.contracts.env]},capabilities:{engine:y.engine,supportTier:y.frameworkSupportTier,runtimeSupportTier:y.runtimeSupportTier,doctorSupport:y.runtimeDoctorSupport,moduleSupport:y.moduleSupport,fleetStages:[...y.fleetStages],localOnlyCommands:[...y.localOnlyCommands],supportedCommands:[...y.supportedCommands]},files:R,...W?{package:W}:{},...s.get(n.slug)?{operationalProfile:s.get(n.slug)}:{}}})),P=new Set(f.map(n=>n.id)),C=new Map,w=[];for(let n of r.projects){for(let u of n.contracts.dependsOn||[])P.has(u)&&w.push({from:u,to:n.slug,type:"dependency",label:"dependsOn"});for(let u of n.contracts.publishes||[])C.has(u)||C.set(u,new Set),C.get(u)?.add(n.slug);}for(let n of r.projects)for(let u of n.contracts.consumes||[]){let R=C.get(u);if(R)for(let W of R)W!==n.slug&&w.push({from:W,to:n.slug,type:"event",label:u});}let j={schemaVersion:1,kind:"rapidkit.workspace.contract.graph",workspace:r.workspace,generatedAt:a,nodes:f.sort((n,u)=>n.id.localeCompare(u.id)),edges:w.sort((n,u)=>`${n.from}:${n.to}:${n.type}:${n.label}`.localeCompare(`${u.from}:${u.to}:${u.type}:${u.label}`)),dependencyGraph:l,knowledgeGraph:k,semantics:{legacyEdges:"producer-to-consumer",dependencyGraphEdges:"consumer-to-dependency"},summary:{projectCount:f.length,dependencyEdges:w.filter(n=>n.type==="dependency").length,eventEdges:w.filter(n=>n.type==="event").length,portCount:f.reduce((n,u)=>n+u.ports.length,0),apiCount:f.reduce((n,u)=>n+u.apis.length,0),relationshipEdges:l.stats.edgeCount,inferredEdges:l.stats.inferredEdges,authoritativeEdges:l.stats.authoritativeEdges,orphanProjects:l.stats.orphanCount,hotspotProjects:l.stats.hotspotCount,evidenceCoverageRatio:l.stats.evidenceCoverageRatio,edgeCoverageRatio:l.stats.edgeCoverageRatio,connectedProjects:l.stats.connectedNodeCount,lowConfidenceEdges:l.stats.lowConfidenceEdges,hasCycle:l.stats.hasCycle,manifestCount:f.reduce((n,u)=>n+u.files.manifests.length,0),entrypointCount:f.reduce((n,u)=>n+u.files.entrypoints.length,0),diagnostics:l.diagnostics?.length??0,relationshipKinds:Object.fromEntries(Q.map(n=>[n,l.edges.filter(u=>u.kind===n).length])),relationshipSources:Object.fromEntries(X.map(n=>[n,l.edges.filter(u=>u.source===n).length])),entityCount:k.quality.entityCount,knowledgeRelations:k.quality.relationCount,proofCount:k.quality.proofCount,providerCount:k.providers.length,knowledgeUnknowns:k.quality.unknownCount}};return {contractPath:t,graph:j}}async function ie(e){let t=e.contract?{contractPath:e.contractPath??a$2(e.workspacePath,E),contract:e.contract}:await ce(e),{contractPath:r,contract:o}=t,a=[],p=[];o.kind!=="rapidkit.workspace.contract"&&a.push("Contract kind must be rapidkit.workspace.contract."),o.schemaVersion!==S&&a.push(`Contract schemaVersion must be ${S}.`),o.workspace?.name||a.push("Contract workspace.name is required."),Array.isArray(o.projects)||a.push("Contract projects must be an array.");let c=new Set,m=new Map;for(let s of o.projects||[]){if(!s.slug){a.push("Every project must declare slug.");continue}c.has(s.slug)&&a.push(`Duplicate project slug: ${s.slug}.`),c.add(s.slug),s.relativePath?V(s.relativePath)||a.push(`Project ${s.slug} declares unsafe relativePath: ${s.relativePath}.`):a.push(`Project ${s.slug} must declare relativePath.`),s.externalPath&&(s.relationship==="adopted"||s.source==="adopted-local"||s.source==="local-folder"||s.source==="git-url"||a.push(`Project ${s.slug} declares externalPath without imported/adopted provenance.`),g.isAbsolute(s.externalPath)||a.push(`Project ${s.slug} declares non-absolute externalPath.`));for(let i of s.ports||[]){(!Number.isInteger(i.port)||i.port<1||i.port>65535)&&a.push(`Project ${s.slug} declares invalid port: ${i.port}.`);let k=m.get(i.port);k&&a.push(`Port ${i.port} is claimed by both ${k} and ${s.slug}.`),m.set(i.port,s.slug);}for(let i of s.contracts?.apis||[])(!i.name?.trim()||!i.basePath?.startsWith("/"))&&a.push(`Project ${s.slug} declares invalid API contract.`);for(let i of [...s.contracts?.publishes||[],...s.contracts?.consumes||[]])i.trim()||a.push(`Project ${s.slug} declares an empty event contract.`);for(let i of s.contracts?.env||[])/^[A-Z_][A-Z0-9_]*$/.test(i)||a.push(`Project ${s.slug} declares invalid env contract: ${i}.`);for(let i of s.contracts?.dependsOn||[])c.has(i);}for(let s of o.projects||[])for(let i of s.contracts?.dependsOn||[])c.has(i)||a.push(`Project ${s.slug} depends on unknown project: ${i}.`);p.push({id:"schema",status:o.kind==="rapidkit.workspace.contract"&&o.schemaVersion===S?"passed":"failed",message:"Contract schema and kind are valid."}),p.push({id:"projects",status:Array.isArray(o.projects)?"passed":"failed",message:`Contract declares ${Array.isArray(o.projects)?o.projects.length:0} project(s).`}),p.push({id:"ports",status:a.some(s=>s.toLowerCase().includes("port"))?"failed":"passed",message:"Project port declarations are valid and collision-free."}),p.push({id:"dependencies",status:a.some(s=>s.includes("depends on unknown project"))?"failed":"passed",message:"Project dependencies point to known project slugs."}),p.push({id:"contracts",status:a.some(s=>s.includes("unsafe relativePath")||s.includes("invalid API contract")||s.includes("event contract")||s.includes("env contract"))?"failed":"passed",message:"Project path, API, event, and env contracts are valid."});let d=await l(e.workspacePath);if(d.moduleCount>0){for(let s of d.issues)a.push(`${g.basename(s.projectRoot)}: ${s.message} (slug=${s.slug})`);p.push({id:"module-paths",status:d.status,message:d.status==="passed"?`All ${d.moduleCount} registered module(s) resolve under canonical paths.`:`${d.issues.length} registered module(s) missing canonical install paths.`});}else e.strict&&p.push({id:"module-paths",status:"passed",message:"No registry-backed modules declared in workspace projects."});return {status:a.length>0?"failed":"passed",contractPath:r,projectCount:Array.isArray(o.projects)?o.projects.length:0,checks:p,violations:a}}async function qe(e){let t=g.resolve(e.workspacePath),r={schemaVersion:ge,generatedAt:e.generatedAt??new Date().toISOString(),status:e.result.status,contractPath:e.result.contractPath,projectCount:e.result.projectCount,checks:e.result.checks,violations:e.result.violations};return e$1(t,me,Z(r))}
2
- export{Z as a,xe as b,Q as c,E as d,me as e,S as f,ge as g,x as h,we as i,ae as j,Ue as k,ze as l,ce as m,Ye as n,ie as o,qe as p};
@@ -1,2 +0,0 @@
1
- import {b}from'./chunk-LNXIMF3O.js';import {c}from'./chunk-ISOOENLW.js';import {p as p$1,h,i}from'./chunk-CJHWKXDN.js';import {a}from'./chunk-Q2WF7D5U.js';import {e as e$1,d}from'./chunk-CCDGHPEJ.js';import {f,e}from'./chunk-NZ3WZYD5.js';import E from'path';import S from'fs-extra';var te=f.agentContext,se=e.agentContext;function ae(e){if(typeof e!="string"||!e.trim()||e==="true")return "generic";let r=e.trim().toLowerCase();return r==="codex"||r==="claude"||r==="cursor"||r==="gemini"||r==="qwen"||r==="kimi"||r==="grok"||r==="copilot"||r==="windsurf"||r==="amazon-q"||r==="orca"?r:"generic"}function L(e){return `npx --yes --package workspai workspai ${e}`.trim()}function j(e){return `npx workspai ${e}`.trim()}async function C(e,r,i){let s=E.join(e,r);if(!await S.pathExists(s))return null;try{let a=await S.readJson(s);return !a||a.schemaVersion!==i?null:a}catch{return null}}function p(e$1){return {id:e$1.id,scope:e$1.scope,display:j(e$1.args),execute:L(e$1.args),description:e$1.description,...e$1.project?{project:e$1.project}:{},freshness:h({id:`command.${e$1.id}`,label:`${e$1.id} command`,scope:"command",value:{display:j(e$1.args),execute:L(e$1.args)},...e$1.project?{project:e$1.project}:{},freshness:{kind:"derived",category:"structure",generatedAt:e$1.generatedAt,now:e$1.now,sourceArtifact:e.model,sourcePath:`safeCommands.${e$1.id}`,reason:"Safe command surfaces are derived from workspace model command capabilities."}}).freshness}}function D(e,r){return `workspace run ${r} --scope project:${e.name}`}function ne(e){return (e.startsWith("project:")?e.slice(8):e).trim().toLowerCase()}function oe(e){return [e.name,e.path,E.basename(e.path),e.absolutePath].filter(r=>typeof r=="string"&&r.trim().length>0).map(r=>r.trim().toLowerCase())}function ie(e,r,i){let s={generatedAt:e.generatedAt,now:i},a=[p({id:"workspace.model",scope:"workspace",args:"workspace model --json",description:"Read the canonical workspace intelligence model.",...s}),p({id:"workspace.graph.entities",scope:"workspace",args:"workspace graph entities --json",description:"Query proof-backed workspace entities without loading the full graph.",...s}),p({id:"workspace.graph.evidence",scope:"workspace",args:"workspace graph evidence <entity-or-relation> --json",description:"Resolve portable evidence for a graph entity or relation.",...s}),p({id:"workspace.graph.path",scope:"workspace",args:"workspace graph path <from> <to> --json",description:"Find a shortest proof-carrying path between workspace entities.",...s}),p({id:"workspace.doctor",scope:"workspace",args:"doctor workspace --json",description:"Check workspace health before claiming verification.",...s}),p({id:"workspace.pipeline",scope:"workspace",args:"pipeline --json",description:"Run the governed sync, doctor, analyze, readiness, and autopilot loop.",...s}),p({id:"workspace.contract.verify",scope:"workspace",args:"workspace contract verify --json",description:"Verify workspace contract and dependency edges.",...s}),p({id:"workspace.verify",scope:"workspace",args:"workspace verify --json",description:"Evaluate evidence freshness and verification gates before release decisions.",...s})],c=r?[r]:e.projects;for(let n of c)n.commands.fleetStages.includes("test")&&a.push(p({id:`project.${n.name}.test`,scope:"project",project:n.name,args:D(n,"test"),description:`Run tests for ${n.name} through workspace orchestration.`,...s})),n.commands.fleetStages.includes("build")&&a.push(p({id:`project.${n.name}.build`,scope:"project",project:n.name,args:D(n,"build"),description:`Build ${n.name} through workspace orchestration.`,...s}));return a}function ce(e){return e.commands.fleetStages.filter(r=>r==="test"||r==="build").map(r=>`workspace run ${r}`)}function de(e,r){if(!r?.startsWith("project:"))return;let i=ne(r);if(i)return e.projects.find(s=>oe(s).includes(i))}function me(e,r,i){let s=[...e.validation?.issues??[]];r?.startsWith("project:")&&!i&&s.push({severity:"error",code:"context.scope.project.missing",message:`Requested project scope was not found: ${r}`,target:r});let a=s.filter(n=>n.severity==="error").length,c=s.filter(n=>n.severity==="warning").length;return {status:a>0?"failed":c>0?"warning":"passed",errors:a,warnings:c,issues:s}}async function pe(e,r){let i=[],s=[];for(let[a,c]of Object.entries(e.evidence))c&&await d(r,c.path)!==null?i.push(`${a}: ${c.path}`):s.push(a);return {available:i.sort(),missing:s.sort()}}function le(e){let r=e.summary.projectCount,i=e.summary.runtimes.length?`${e.summary.runtimes.join(", ")} runtime coverage`:"no runtime coverage",s=e.identity.surfaces.length?e.identity.surfaces.join(", "):"no detected surfaces";return `${e.workspace.name} is a ${e.identity.workspaceType} with ${r} project${r===1?"":"s"}, ${i}, and ${s}.`}function ue(e){let r=["Do not claim a command passed unless a report or command output proves it.","Do not infer secrets or environment values from file names.","Do not change project scope without checking the selected project."];return e.contracts.exists||r.push("Workspace contract is missing; dependency and API edges may be incomplete."),e.summary.observedProjects>0&&r.push("Some projects are observed rather than first-class; command support may be partial."),r}async function xe(e$1){let r=e$1.model??await p$1({workspacePath:e$1.workspacePath,includeEvidence:e$1.includeEvidence===true,observableScanDepth:e$1.observableScanDepth,now:e$1.now}),i$1=ae(e$1.agent),s=de(r,e$1.scope),a=me(r,e$1.scope,s);if(e$1.strict===true&&a.status!=="passed"){let t=a.issues.map(u=>`${u.severity}:${u.code}:${u.target}`).join(", ");throw new Error(`Workspace context strict validation failed: ${t}`)}let c$1=e$1.now??new Date,n=r.facts??[],K=new Set((s?[s]:r.projects).map(t=>t.name)),F=n.filter(t=>t.project?K.has(t.project):true),H=(s?[s]:r.projects).map(t=>{let u=F.filter(d=>d.project===t.name);return {name:t.name,path:t.path,kind:t.kind,category:t.category,runtime:t.runtime,framework:t.frameworkDisplayName,...t.generator?{generator:t.generator}:{},createCapability:t.createCapability,supportTier:t.supportTier,safeCommands:ce(t),importantFiles:t.importantFiles,facts:u}}),A=await pe(r,e$1.workspacePath),R=E.join(e$1.workspacePath,e.knowledgeGraph),g=await S.pathExists(R)?await S.readJson(R).catch(()=>null):null,$=false;if(g?.schemaVersion===f.knowledgeGraph)try{c(g,r),$=true;}catch{}let M=le(r),I=ie(r,s,c$1),v=await C(e$1.workspacePath,e.impact,f.impact),l=await C(e$1.workspacePath,e.doctor,f.doctor),b$1=await C(e$1.workspacePath,e.analyze,f.analyze),k=await C(e$1.workspacePath,e.readiness,f.readiness),h$1=await C(e$1.workspacePath,e.verify,f.verify),w=await C(e$1.workspacePath,e.explain,f.explain),f$1=await C(e$1.workspacePath,e.diff,f.diff),B=v?.summary?{changed:v.summary.changed,risk:v.summary.risk,affectedProjects:v.summary.affectedProjects,blastRadius:v.summary.blastRadius,recommendedCommands:v.summary.recommendedCommands}:void 0,U=l?.summary?{verdict:l.summary.verdict,totalIssues:l.summary.totalIssues,advisoryFindings:l.summary.advisoryFindings,blockingFindings:l.summary.blockingFindings,unknownFindings:l.summary.unknownFindings,hasSystemErrors:l.summary.hasSystemErrors,topSignals:(()=>{let t=Array.isArray(l.projects)?l.projects:[],u=[];for(let d of t.slice(0,6)){let re=Array.isArray(d?.probes)?d.probes:[];for(let y of re.slice(0,10))(y?.status==="fail"||y?.severity==="error")&&u.push({label:y.label,scope:y.scope,issueClass:y.issueClass,status:y.status,severity:y.severity,recommendation:y.recommendation});}return u.slice(0,8)})()}:void 0,J=b$1?.summary?{score:b$1.summary.score,verdict:b$1.summary.verdict,findingCounts:b$1.summary.findings,topFindings:(Array.isArray(b$1.findings)?b$1.findings:[]).filter(d=>d?.severity==="fail"||d?.severity==="warn").slice(0,8).map(d=>({severity:d.severity,title:d.title,target:d.target,remediation:d.remediation}))}:void 0,X=k?{overallStatus:k.overallStatus,blocking:k.blocking,blockingReasons:k.blockingReasons,evidencePath:k.evidencePath,gates:Array.isArray(k.gates)?k.gates.slice(0,6).map(t=>({gate:t.gate,status:t.status,summary:t.summary})):void 0}:void 0,Q=h$1?.summary?{verdict:h$1.summary.verdict,exitCode:h$1.summary.exitCode,stepsFailed:h$1.summary.stepsFailed,stepsMissing:h$1.summary.stepsMissing,blockingReasons:h$1.blockingReasons,missingEvidence:h$1.missingEvidence}:void 0,Y=w?{summary:w.summary,blockingReasons:w.blockingReasons,releaseVerdict:w.releaseVerdict,evidenceFreshness:w.evidenceFreshness,sections:Array.isArray(w.sections)?w.sections.slice(0,4).map(t=>({id:t.id,title:t.title,body:t.body})):void 0}:void 0,Z=f$1?.summary?{changed:f$1.summary.changed,addedProjects:f$1.summary.addedProjects,removedProjects:f$1.summary.removedProjects,changedProjects:f$1.summary.changedProjects,workspaceChanges:f$1.summary.workspaceChanges,validationChanges:f$1.summary.validationChanges,gitChangedFiles:f$1.summary.gitChangedFiles}:void 0,ee=I.map(t=>h({id:`context.command.${t.id}`,label:`${t.id} safe command`,scope:"command",value:{display:t.display,execute:t.execute,scope:t.scope},...t.project?{project:t.project}:{},freshness:{kind:"derived",category:"structure",generatedAt:r.generatedAt,now:c$1,sourceArtifact:e.agentContext,sourcePath:`safeCommands.${t.id}`,reason:"Context safe commands are derived from workspace model command capabilities."}})),T=[...F,...ee],x=i({facts:T,generatedAt:c$1.toISOString(),now:c$1}),W=b();return {schemaVersion:te,generatedAt:c$1.toISOString(),agent:i$1,workspaceSummary:M,modelRef:e.model,knowledgeGraph:{artifact:e.knowledgeGraph,schemaVersion:f.knowledgeGraph,available:$,...typeof g?.quality?.entityCount=="number"?{entityCount:g.quality.entityCount}:{},...typeof g?.quality?.relationCount=="number"?{relationCount:g.quality.relationCount}:{},...typeof g?.quality?.proofCount=="number"?{proofCount:g.quality.proofCount}:{},queryCommands:[j("workspace graph search <query> --limit 12 --json"),j("workspace graph entities [kind] --json"),j("workspace graph evidence <entity-or-relation> --json"),j("workspace graph path <from> <to> --json")]},intelligenceChain:{schemaVersion:W.schemaVersion,contractPath:W.contractPath,currentStep:"context",canonicalReadOrder:[...W.consumers.agents.canonicalReadOrder]},workspace:{name:r.workspace.name,root:`workspace:${r.workspace.name}`,type:r.identity.workspaceType,...r.workspace.profile?{profile:r.workspace.profile}:{}},scope:{requested:e$1.scope??"workspace",...s?{activeProject:s.name}:{}},projects:H,safeCommands:I,facts:T,factFreshness:x,evidence:A,policies:{mode:r.policies.mode,source:r.policies.source},contracts:{exists:r.contracts.exists,path:r.contracts.workspaceContractPath},validation:a,agentInstructions:[`Read \`${e.agentIndex}\` first, then this context pack and linked evidence reports.`,"Use `workspace graph search <query> --limit 12 --json` for bounded, proof-backed retrieval before loading the full graph.",`Load \`${e.knowledgeGraph}\` only when a complete graph export is explicitly required.`,"Use this context as the workspace source of truth before inspecting random files.","Prefer workspace-level evidence over generic framework assumptions.","Use `display` commands when explaining steps to a human.","Use `execute` commands when launching commands from automation or tooling.","Treat `facts[].freshness.verifyBeforeUse` as a hard refresh requirement before using that fact in advice, fixes, or release decisions.","Do not carry extracted facts beyond their freshness contract; re-read or regenerate evidence when the contract says stale, unknown, live, or verify-before-use.","Keep project-scoped advice tied to the active project scope.","Regenerate stale grounding with `npx workspai workspace agent-sync --write --refresh-context`."],unsafeAssumptions:[...ue(r),...x.verifyBeforeUseFacts>0?[`${x.verifyBeforeUseFacts} fact(s) require verification before use; do not treat them as durable workspace structure.`]:[]],humanSummary:[M,`Evidence available: ${A.available.length}. Missing evidence groups: ${A.missing.join(", ")||"none"}.`,s?`Active project scope: ${s.name} (${s.frameworkDisplayName}).`:"Scope: whole workspace."].join(`
2
- `),impactSummary:B,doctorSummary:U,analyzeSummary:J,readinessSummary:X,verifySummary:Q,explainSummary:Y,diffSummary:Z}}async function We(e,r){return e$1(r,se,a(e))}export{te as a,se as b,xe as c,We as d};
@@ -1 +0,0 @@
1
- import {a as a$1}from'./chunk-A5FBGRJA.js';import {d as d$1,m}from'./chunk-Q2WF7D5U.js';import {d,e}from'./chunk-CCDGHPEJ.js';import {i,h}from'./chunk-NZ3WZYD5.js';import {s}from'./chunk-MOSXTVPU.js';import {s as s$1,q}from'./chunk-RGNCL5OB.js';import a from'path';import {existsSync}from'fs';import m$1 from'fs-extra';var f=i.workspaceRegistry,w=h.workspaceRegistry.schemaVersion;function E(r){return {slug:r.slug,relativePath:r.relativePath,framework:r.framework,kit:r.kit,source:r.source}}async function b(r){let e=s(r,"workspace.json").find(t=>existsSync(t));if(!e)return {exists:false,legacyProjectCount:0};try{let t=await m$1.readJson(e),c=Array.isArray(t.projects)?t.projects.length:0,o=typeof t.workspace_name=="string"&&t.workspace_name.trim()||typeof t.name=="string"&&t.name.trim()||a.basename(r);return {exists:true,manifestPath:e,workspaceName:o,profile:typeof t.profile=="string"?t.profile:void 0,legacyProjectCount:c}}catch{return {exists:true,manifestPath:e,legacyProjectCount:0,workspaceName:a.basename(r)}}}async function _(r){let e=a$1(r);for(let t of s$1())if(await m$1.pathExists(t))try{let o=((await m$1.readJson(t)).workspaces||[]).find(s=>a$1(s.path)===e);if(o)return {exists:true,projectCount:Array.isArray(o.projects)?o.projects.length:0,registryPath:t}}catch{continue}return {exists:false,projectCount:0,registryPath:a.join(q(),"workspaces.json")}}async function T(r,e){let t=a.resolve(r),c=await d(t,d$1),o=await b(t),s=await _(t),i=e?.contract!==void 0||!!c,n=[];if(e?.contract)n=e.contract.projects||[];else if(i)try{let{contract:A}=await m({workspacePath:t});n=A.projects||[];}catch{n=[];}let d$2={contract:{exists:i,projectCount:n.length,path:d$1},globalRegistry:{exists:s.exists,projectCount:s.projectCount,path:s.registryPath},legacyWorkspaceJson:{exists:o.exists,projectCount:o.legacyProjectCount,path:o.manifestPath?a.relative(t,o.manifestPath):void 0}},p="none",u=[],y=0;return i?(p="workspace.contract.json",u=n.map(E),y=u.length):s.projectCount>0?(p="global-registry",y=s.projectCount):o.legacyProjectCount>0&&(p="legacy-workspace.json",y=o.legacyProjectCount),{contractExists:i,summary:{schemaVersion:w,kind:"rapidkit.workspace.registry",workspacePath:t,workspaceName:o.workspaceName||a.basename(t),profile:o.profile,projectCount:y,authority:p,contractPath:d$1,projects:u,sources:d$2}}}async function U(r){let e=await d(r,f);if(!e)return null;try{let t=await m$1.readJson(e);return t?.schemaVersion!==w?null:t}catch{return null}}async function D(r,e$1){let t=await M(r,e$1);return await e(r,f,t),t}async function M(r,e){return {...(await T(r,{contract:e?.contract})).summary,generatedAt:(e?.now??new Date).toISOString(),registrySummaryPath:f}}function F(r,e=""){return r.projectCount>0?r.authority==="workspace.contract.json"?`${r.projectCount} project(s) registered in workspace contract${e}.`:r.authority==="global-registry"?`${r.projectCount} project(s) registered in global workspace registry${e}.`:`${r.projectCount} project(s) registered in legacy workspace manifest${e}.`:`Workspace state exists, but no projects are registered yet${e}.`}export{f as a,w as b,T as c,U as d,D as e,M as f,F as g};
@@ -1 +0,0 @@
1
- import {s,p as p$1}from'./chunk-MOSXTVPU.js';import c from'fs-extra';import*as p from'path';async function y(e,o){await c.ensureDir(p.dirname(e));let t=`${e}.${process.pid}.${Date.now()}.tmp`;try{await c.writeJSON(t,o,{spaces:2}),await c.move(t,e,{overwrite:true});}finally{await c.remove(t).catch(()=>{});}}function g(e){return p$1(e,"imported-projects.json")}async function f(e){let o=(await Promise.all(s(e,"imported-projects.json").map(async t=>await c.pathExists(t)?t:null))).find(t=>typeof t=="string");if(!o)return [];try{let t=await c.readJSON(o);if(!t||typeof t!="object"||t.version!==1||!Array.isArray(t.projects))throw new Error("expected a version 1 registry with a projects array");let i=t.projects,a=i.filter(s=>{if(!s||typeof s!="object")return false;let n=s;return typeof n.name=="string"&&typeof n.path=="string"&&typeof n.stack=="string"&&typeof n.confidence=="string"&&typeof n.importedAt=="string"});if(a.length!==i.length)throw new Error("one or more project entries are invalid");return a}catch(t){throw new Error(`Imported-project registry is invalid: ${o}`,{cause:t})}}async function P(e,o){if(o.length===0)return;let t=await f(e),i=new Map;for(let r of t)i.set(r.path,r);for(let r of o)i.set(r.path,r);let a=Array.from(i.values()).sort((r,l)=>r.name.localeCompare(l.name)).map(r=>({...r})),s={version:1,updatedAt:new Date().toISOString(),projects:a},n=g(e);await y(n,s);}async function k(e,o){if(o.length===0)return;let t=await f(e),i=new Set(o.map(r=>p.resolve(r))),a=t.filter(r=>!i.has(p.resolve(r.path))),s={version:1,updatedAt:new Date().toISOString(),projects:a},n=g(e);await y(n,s);}export{f as a,P as b,k as c};
@@ -1,2 +0,0 @@
1
- import d from'crypto';import {constants}from'fs';import a from'fs/promises';import n from'path';var E="workspai.lifecycle-transaction",L=1,b="manifest.json",O="lifecycle-transaction-";async function p(r){try{return await a.lstat(r)}catch(e){if(e.code==="ENOENT")return null;throw e}}function k(r){let e=r?.code;return process.platform==="win32"&&(e==="EPERM"||e==="EINVAL"||e==="ENOSYS")}async function v(r){try{await r.sync();}catch(e){if(!k(e))throw e}}function j(r){if(typeof r!="string"||!n.isAbsolute(r))throw new Error("Lifecycle transaction journal contains a non-absolute target path.")}function A(r){if(typeof r!="string"||r.length===0||n.basename(r)!==r||r==="."||r==="..")throw new Error("Lifecycle transaction journal contains an unsafe backup reference.")}function F(r){if(!r||typeof r!="object")throw new Error("Lifecycle transaction journal is not an object.");let e=r;if(e.kind!==E||e.version!==L)throw new Error("Lifecycle transaction journal has an unsupported format.");if(!Number.isInteger(e.ownerPid)||e.ownerPid<=0)throw new Error("Lifecycle transaction journal has an invalid owner process.");if(!["active","committed","rolling-back"].includes(e.phase))throw new Error("Lifecycle transaction journal has an invalid phase.");if(!Array.isArray(e.operations))throw new Error("Lifecycle transaction journal has invalid operations.");for(let t of e.operations){if(!t||typeof t!="object")throw new Error("Lifecycle transaction journal contains an invalid operation.");let i=t;if(j(i.path),i.type!=="tree"){if(i.type!=="file"||!["absent","regular"].includes(i.state))throw new Error("Lifecycle transaction journal contains an invalid operation.");if(i.state==="regular"){if(!Number.isInteger(i.mode)||i.mode<0||i.mode>4095)throw new Error("Lifecycle transaction journal contains an invalid file mode.");A(i.backup);}}}return e}async function g(r){let e;try{e=await a.open(r,constants.O_RDONLY);}catch(t){if(k(t))return;throw t}try{await v(e);}finally{await e.close();}}async function N(r,e){let t=n.join(n.dirname(r),`.${n.basename(r)}.${process.pid}.${d.randomUUID()}.tmp`);try{let i=await a.open(t,constants.O_WRONLY|constants.O_CREAT|constants.O_EXCL,384);try{await i.writeFile(e),await v(i);}finally{await i.close();}await a.rename(t,r),await g(n.dirname(r));}catch(i){throw await a.rm(t,{force:true}).catch(()=>{}),i}}async function D(r,e){await N(n.join(r,b),Buffer.from(`${JSON.stringify(e,null,2)}
2
- `));}async function S(r,e){let t=await p(r.path);if(t?.isSymbolicLink()||t&&!t.isFile())throw new Error(`Refusing to restore over a non-regular file: ${r.path}`);if(r.state==="absent"){t&&await a.unlink(r.path);return}if(!e)throw new Error(`Missing durable backup for: ${r.path}`);if(!await p(n.dirname(r.path)))return;let i=n.join(e,r.backup),o=await a.lstat(i).catch(s=>{if(s.code==="ENOENT"&&t?.isFile())return t;throw s});if(o===t)return;if(!o.isFile()||o.isSymbolicLink())throw new Error(`Lifecycle transaction backup is not a regular file: ${i}`);let c=await a.readFile(i),f=n.join(n.dirname(r.path),`.${n.basename(r.path)}.${process.pid}.${d.randomUUID()}.rollback`),l=await a.open(f,constants.O_WRONLY|constants.O_CREAT|constants.O_EXCL,r.mode);try{await l.writeFile(c),await l.chmod(r.mode),await v(l);}finally{await l.close();}try{await a.rename(f,r.path),await g(n.dirname(r.path));}catch(s){throw await a.rm(f,{force:true}).catch(()=>{}),s}}async function P(r){let e=await p(r.path);if(e){if(e.isSymbolicLink()||!e.isDirectory())throw new Error(`Refusing to remove a non-directory owned tree: ${r.path}`);await a.rm(r.path,{recursive:true});}}async function T(r,e){let t=[];for(let i of [...r].reverse())try{i.type==="file"?await S(i,e):await P(i);}catch(o){t.push(o);}if(t.length>0)throw new AggregateError(t,"Lifecycle transaction rollback failed.")}var m=class r{constructor(e){this.transactionDirectory=e;this.journalPath=e?n.join(e,b):void 0;}transactionDirectory;journalPath;actions=[];durableOperations=[];phase="active";finished=false;static async create(e={}){if(!e.journalDirectory)return new r;let t=n.resolve(e.journalDirectory);await a.mkdir(t,{recursive:true});let i=await a.mkdtemp(n.join(t,O));await g(t);let o=new r(i);return await o.persist(),o}assertActive(){if(this.finished||this.phase!=="active")throw new Error("Lifecycle transaction is no longer active.")}async persist(e=this.durableOperations){this.transactionDirectory&&await D(this.transactionDirectory,{kind:E,version:L,ownerPid:process.pid,phase:this.phase,operations:e});}async addDurableOperation(e){let t=[...this.durableOperations,e];await this.persist(t),this.durableOperations.push(e),this.actions.push(e);}async captureFile(e){this.assertActive();let t=n.resolve(e),i=await p(t);if(!i){await this.addDurableOperation({type:"file",path:t,state:"absent"});return}if(i.isSymbolicLink()||!i.isFile())throw new Error(`Lifecycle transaction can only capture regular files: ${t}`);let o;try{o=await a.open(t,constants.O_RDONLY|(constants.O_NOFOLLOW??0));}catch(c){throw c.code==="ENOENT"?new Error(`File changed while being captured: ${t}`,{cause:c}):c}try{let c=await o.stat();if(!c.isFile())throw new Error(`Lifecycle transaction can only capture regular files: ${t}`);let f=await o.readFile(),l=c.mode&4095;if(this.transactionDirectory){let s=`file-${this.durableOperations.length}-${d.randomUUID()}.bin`;await N(n.join(this.transactionDirectory,s),f),await this.addDurableOperation({type:"file",path:t,state:"regular",mode:l,backup:s});}else {let s=`memory-${this.durableOperations.length}`,w={type:"file",path:t,state:"regular",mode:l,backup:s};this.durableOperations.push(w),this.actions.push({type:"compensation",run:async()=>{let h=await p(t);if(h?.isSymbolicLink()||h&&!h.isFile())throw new Error(`Refusing to restore over a non-regular file: ${t}`);let y=n.join(n.dirname(t),`.${n.basename(t)}.${process.pid}.${d.randomUUID()}.rollback`);await a.writeFile(y,f,{flag:"wx",mode:l}),await a.chmod(y,l);try{await a.rename(y,t);}catch(R){throw await a.rm(y,{force:true}).catch(()=>{}),R}}});}}finally{await o.close();}}async captureOwnedTree(e){this.assertActive();let t=n.resolve(e),i=await p(t);if(!i)return await this.addDurableOperation({type:"tree",path:t}),true;if(i.isSymbolicLink()||!i.isDirectory())throw new Error(`Lifecycle transaction tree must be absent or a directory: ${t}`);return false}registerCompensation(e){this.assertActive(),this.actions.push({type:"compensation",run:async()=>e()});}async commit(){if(!this.finished){this.assertActive(),this.phase="committed";try{await this.persist(),this.finished=true,this.actions.length=0,this.transactionDirectory&&await a.rm(this.transactionDirectory,{recursive:true}).catch(()=>{});}catch(e){throw this.phase="active",e}}}async rollback(){if(this.finished||this.phase==="committed")return;this.assertActive(),this.phase="rolling-back";try{await this.persist();}catch(t){throw this.phase="active",t}let e=[];for(let t of [...this.actions].reverse())try{t.type==="compensation"?await t.run():t.type==="file"?await S(t,this.transactionDirectory):await P(t);}catch(i){e.push(i);}if(e.length>0)throw new AggregateError(e,"Lifecycle transaction rollback failed.");this.finished=true,this.transactionDirectory&&await a.rm(this.transactionDirectory,{recursive:true});}};async function M(r={}){return m.create(r)}async function C(r){let e=n.resolve(r),t=await a.readdir(e,{withFileTypes:true}).catch(c=>{if(c.code==="ENOENT")return [];throw c}),i=[],o=[];for(let c of t){if(!c.isDirectory()||!c.name.startsWith(O))continue;let f=n.join(e,c.name);try{let l;try{l=await a.readFile(n.join(f,b),"utf8");}catch(h){if(h.code==="ENOENT")continue;throw h}let s=F(JSON.parse(l));if(s.phase==="committed"){await a.rm(f,{recursive:true});continue}let w=false;try{process.kill(s.ownerPid,0),w=true;}catch(h){w=h.code==="EPERM";}if(w)continue;s.phase==="active"&&(s.phase="rolling-back",await D(f,s)),await T(s.operations,f),await a.rm(f,{recursive:true}),i.push(f);}catch(l){o.push(l);}}if(o.length>0)throw new AggregateError(o,"Lifecycle transaction recovery failed.");return i}export{M as a,C as b};
@@ -1,144 +0,0 @@
1
- import {g,b,i as i$1,d as d$2,e as e$1,f}from'./chunk-DK6JNE6K.js';import {c}from'./chunk-L22EABIC.js';import {c as c$1}from'./chunk-X7FYEKLI.js';import {d as d$3,b as b$1,a as a$1}from'./chunk-3RBUSW7H.js';import {d as d$1}from'./chunk-EWZZUQBR.js';import {a}from'./chunk-AFIFZTOY.js';import {h,e,i}from'./chunk-NZ3WZYD5.js';import {t,h as h$1,g as g$1}from'./chunk-MOSXTVPU.js';import le from'crypto';import H from'fs';import k from'fs/promises';import d from'path';import {execa}from'execa';import he from'fs-extra';var ke=h.projectContextAgent.schemaVersion,Ze=["managed","local","off"],de="<!-- WORKSPAI:PROJECT-GROUNDING:START -->",pe="<!-- WORKSPAI:PROJECT-GROUNDING:END -->";function oe(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}async function E(e){try{return JSON.parse(await k.readFile(e,"utf8"))}catch(t){return null}}function x(e){return e.replace(/\\/g,"/").replace(/^\.\/+/,"")}function O(e,t,n){let o=e.replace(/\\/g,"/"),i=/^[A-Za-z]:\//.test(o);if(!d.isAbsolute(e)&&!i)return x(o);if(i&&process.platform!=="win32")return null;let c=d.resolve(e),s=d.relative(n,c);if(s&&!s.startsWith("..")&&!d.isAbsolute(s))return x(s);let l=d.relative(t,c);return l&&!l.startsWith("..")&&!d.isAbsolute(l)?`workspace:${x(l)}`:null}function P(e,t,n){return [[n,"project:"],[n.replace(/\\/g,"/"),"project:"],[t,"workspace:"],[t.replace(/\\/g,"/"),"workspace:"]].reduce((i,[c,s])=>c.length>0?i.split(c).join(s):i,e)}function ge(e,t){return oe(e?.adoption)?.mode==="linked"?"adopted":oe(e?.import)?"imported":t}function we(e){if(!e.model)return null;let t=x(e.relativePath);return e.model.projects.find(n=>n.name===e.projectName||x(n.path)===t)??null}function ne(e,t){e[t]=(e[t]??0)+1;}var ye=["project","language","service","api","endpoint","schema","protocol","runtime-unit","lifecycle-stage","database","queue","container","deployment","pipeline","environment","test-suite","owner","decision","document","package","file","module","symbol"];function je(e,t=160){let n={language:32,api:32,service:32,endpoint:32,schema:32,protocol:32,"runtime-unit":32,"lifecycle-stage":32,file:8,module:8,symbol:8},o=[];for(let i of ye){let c=e.filter(s=>s.kind===i).sort((s,l)=>s.label.localeCompare(l.label)||s.id.localeCompare(l.id)).slice(0,n[i]??32);for(let s of c){if(o.length>=t)return o;o.push(s);}}return o}function Pe(e,t){if(!e)return {entityCount:0,relationCount:0,proofCount:0,entitiesByKind:{},relationsByKind:{},languages:{},semantic:{protocolConceptCount:0,protocolImplementationBindings:0,equivalenceBindings:0,generationBindings:0,runtimeUnitCount:0,lifecycleStageCount:0,runtimeCoverage:[]},relatedProjects:[],proofArtifacts:[],entities:[],relations:[],proofs:[],topology:{status:"unavailable",dependencies:[],dependents:[]},diagnostics:[]};let n=e.entities.find(r=>r.kind==="project"&&(r.id===t||r.label===t||r.projectId===t)),o=new Set(e.entities.filter(r=>r.projectId===t||r.id===n?.id||r.kind==="project"&&r.label===t).map(r=>r.id));n&&o.add(n.id);let i=e.relations.filter(r=>o.has(r.from)||o.has(r.to)),c=new Set(o);for(let r of i)c.add(r.from),c.add(r.to);let s=e.entities.filter(r=>c.has(r.id)),l=new Set,p={},u={},f={},w=new Set(s.filter(r=>r.kind==="language").map(r=>r.attributes.language).filter(r=>typeof r=="string"));for(let r of s){ne(p,r.kind);let a=typeof r.attributes.language=="string"?r.attributes.language:void 0;if(a&&r.kind==="language")f[a]={fileCount:typeof r.attributes.fileCount=="number"?r.attributes.fileCount:0,symbolCount:f[a]?.symbolCount??0,generatedFileCount:typeof r.attributes.generatedFileCount=="number"?r.attributes.generatedFileCount:0};else if(a&&(r.kind==="file"||r.kind==="symbol")){let h=f[a]??{fileCount:0,symbolCount:0,generatedFileCount:0};r.kind==="file"&&!w.has(a)?(h.fileCount+=1,r.attributes.generated===true&&(h.generatedFileCount+=1)):r.kind==="symbol"&&(h.symbolCount+=1),f[a]=h;}for(let h of r.proofIds)l.add(h);}for(let r of i){ne(u,r.kind);for(let a of r.proofIds)l.add(a);}let y=e.proofs.filter(r=>l.has(r.id)),b=[...new Set(e.entities.filter(r=>c.has(r.id)&&r.projectId&&r.projectId!==t).map(r=>r.projectId))].sort(),m=e.diagnostics.filter(r=>r.entityIds?.some(a=>c.has(a))||r.relationIds?.some(a=>i.some(h=>h.id===a))).map(r=>({code:r.code,severity:r.severity,message:r.message,...r.recommendation?{recommendation:r.recommendation}:{}})),g=(r,a)=>({project:a,kind:r.kind,source:r.source,confidence:r.confidence,evidence:[...new Set(r.evidence.map(h=>h.file.replace(/\\/g,"/")))].sort()}),v=e.projectTopology.edges.filter(r=>r.from===t).map(r=>g(r,r.to)).sort((r,a)=>`${r.project}:${r.kind}`.localeCompare(`${a.project}:${a.kind}`)),C=e.projectTopology.edges.filter(r=>r.to===t).map(r=>g(r,r.from)).sort((r,a)=>`${r.project}:${r.kind}`.localeCompare(`${a.project}:${a.kind}`)),R=je(s),S=s.filter(r=>r.kind==="runtime-unit"),j=new Set(R.map(r=>r.id)),_=[...i].sort((r,a)=>{let h=Number(j.has(r.from)||j.has(r.to));return Number(j.has(a.from)||j.has(a.to))-h||r.id.localeCompare(a.id)}).slice(0,128),W=new Set([...R.flatMap(r=>r.proofIds),..._.flatMap(r=>r.proofIds)]);return {entityCount:s.length,relationCount:i.length,proofCount:y.length,entitiesByKind:p,relationsByKind:u,languages:Object.fromEntries(Object.entries(f).sort(([r],[a])=>r.localeCompare(a))),semantic:{protocolConceptCount:p.protocol??0,protocolImplementationBindings:u["implements-protocol"]??0,equivalenceBindings:u["equivalent-to"]??0,generationBindings:(u["generated-from"]??0)+(u["generated-by"]??0),runtimeUnitCount:S.length,lifecycleStageCount:p["lifecycle-stage"]??0,runtimeCoverage:[...new Set(S.map(r=>r.attributes.runtime).filter(r=>typeof r=="string"))].sort()},relatedProjects:b,proofArtifacts:[...new Set(y.map(r=>r.artifact))].sort(),entities:R,relations:_,proofs:y.filter(r=>W.has(r.id)).sort((r,a)=>r.id.localeCompare(a.id)).slice(0,128),topology:{status:v.length>0||C.length>0?"proven":e.projectTopology.nodes.some(r=>r.id===t)?"unproven":"unavailable",dependencies:v,dependents:C},diagnostics:m}}function ue(e,t,n){return Array.isArray(e)?e.map(o=>typeof o=="string"?P(o,t,n):o):typeof e=="string"?P(e,t,n):e}function be(e,t,n){return {id:e.id,kind:e.kind,label:P(e.label,t,n),attributes:Object.fromEntries(Object.entries(e.attributes).map(([o,i])=>[o,ue(i,t,n)])),proofIds:[...e.proofIds].sort()}}function ve(e,t,n){let o=(...c)=>e.filter(s=>c.includes(s.kind)).map(s=>be(s,t,n)).slice(0,32),i=[];for(let c of e){for(let[s,l]of Object.entries(c.attributes))if(/(?:^|[-_.])ports?(?:$|[-_.])/i.test(s)&&(i.push({entityId:c.id,label:P(c.label,t,n),attribute:s,value:ue(l,t,n)}),i.length>=32))break;if(i.length>=32)break}return {services:o("service"),packages:o("package"),protocols:o("protocol"),runtimeUnits:o("runtime-unit"),lifecycleStages:o("lifecycle-stage"),apis:o("api"),endpoints:o("endpoint"),dataStores:o("database","queue"),deployments:o("container","deployment","environment"),pipelines:o("pipeline"),tests:o("test-suite"),owners:o("owner"),decisions:o("decision"),ports:i}}function Ae(e,t,n){let o=O(e.artifact,t,n);return o?{id:e.id,provider:e.provider,artifact:o,...e.pointer?{pointer:P(e.pointer,t,n)}:{},...e.line!==void 0?{line:e.line}:{},derivation:e.derivation,trust:e.trust,confidence:e.confidence,freshness:e.freshness}:null}async function Ee(e,t,n){let o=[],i=await E(d.join(e,".workspai","reports","INDEX.json"));if(Array.isArray(i?.blockers))for(let s of i.blockers)typeof s=="string"&&(s.startsWith(`${n}:`)||s.includes(`project:${n}`)||s.includes(`project ${n}`))&&o.push({source:"workspace-report-index",severity:"error",message:P(s,e,t)});let c=await E(d.join(e,".workspai","reports","doctor-project-last-run.json"));if(c?.projectName===n)for(let s of c$1({project:c.project}))o.push({source:"doctor-project",severity:s.status==="blocking"?"error":"warning",message:P(s.message,e,t),...s.id?{code:s.id}:{}});return [...new Map(o.map(s=>[`${s.source}:${s.code??""}:${s.message}`,s])).values()].slice(0,32)}function U(e,t=[]){return typeof e=="string"?/^[A-Za-z]:[\\/]/.test(e)||/(?:^|[\s("'`])[A-Za-z]:[\\/]/.test(e)||/(?:^|[\s("'`])\/(?:Users|home|private|var|opt|srv|mnt|Volumes|tmp)\//.test(e)||t.some(n=>n.length>0&&(e.includes(n)||e.includes(n.replace(/\\/g,"/")))):Array.isArray(e)?e.some(n=>U(n,t)):e&&typeof e=="object"?Object.values(e).some(n=>U(n,t)):false}function Ce(e){return le.createHash("sha256").update(JSON.stringify(e)).digest("hex")}async function Re(e$1){let t$1=d.resolve(e$1.workspacePath),n=d.resolve(e$1.projectPath),o=t(n,"project.json").find(a=>H.existsSync(a)),i$1=o?await E(o):null,c=await E(d.join(t$1,".workspai","workspace.contract.json")),s=d.resolve(n),l=c?.projects?.find(a=>a.externalPath?d.resolve(a.externalPath)===s:!a.relativePath||a.relativePath.startsWith("external/")?false:d.resolve(t$1,a.relativePath)===s)??c?.projects?.find(a=>a.slug===e$1.projectName||a.slug===d.basename(n)),p=e$1.projectName??(typeof i$1?.name=="string"?i$1.name:void 0)??l?.slug??d.basename(n),u=l?.relativePath??(()=>{let a=x(d.relative(t$1,n));return !a||a.startsWith("..")?`external/${p}`:a})(),f=await E(d.join(t$1,e.model)),w=await E(d.join(t$1,e.knowledgeGraph)),y=f?d$1(f):void 0,b$1=!!(y&&w?.source.hash===y),m=we({model:f,projectName:p,relativePath:u}),g=Pe(b$1?w:null,p),v=await Ee(t$1,n,p),C=g.proofs.map(a=>a.freshness),R=w?!b$1||C.includes("stale")?"stale":C.includes("unknown")?"unknown":"fresh":"missing",S=f?f.factFreshness?.status??"unknown":"missing",j=[...f?[]:[{code:"project.context.model-missing",severity:"warning",message:"The canonical Workspace Model has not been generated yet. Refresh workspace intelligence before relying on project topology."}],...f&&!m?[{code:"project.context.project-not-materialized",severity:"warning",message:"The project is registered in the workspace contract but is not present in the current Workspace Model."}]:[],...w?[]:[{code:"project.context.graph-missing",severity:"warning",message:"The Workspace Knowledge Graph has not been generated yet. Run the workspace intelligence loop to build proof-backed relationships."}],...w&&!b$1?[{code:"project.context.graph-model-mismatch",severity:"warning",message:"The persisted Knowledge Graph does not match the current Workspace Model and was excluded from this project lens."}]:[]],_=ge(i$1,e$1.relationship??l?.relationship??"managed"),W={schemaVersion:ke,generatedAt:(e$1.now??new Date).toISOString(),workspace:{name:c?.workspace?.name??f?.workspace.name??d.basename(t$1),...c?.workspace?.profile||f?.workspace.profile?{profile:c?.workspace?.profile??f?.workspace.profile}:{},relationship:_,contract:`workspace:${i.workspaceContract}`,index:`workspace:${e.agentIndex}`,context:`workspace:${e.agentContext}`,skillsIndex:`workspace:${e.skillsIndex}`,boundedGraphSearch:`workspai workspace graph search <task-query> --scope project:${p} --limit 12 --json`,access:{localBinding:i.projectWorkspaceLink,canonicalEvidenceAvailableAtGeneration:true,identityIsFilesystemPath:false,resolverCommand:"workspai project workspace status --json",portableUriScheme:"workspace:",resolvedPathPolicy:"runtime-private-never-persist"}},project:{name:p,relativePath:u,...m?.kind?{kind:m.kind}:{},...m?.runtime||l?.runtime?{runtime:m?.runtime??l?.runtime}:{},...m?.runtimeCandidates?.length?{runtimeCandidates:[...m.runtimeCandidates].sort()}:{},...m?.framework||l?.framework?{framework:m?.framework??l?.framework}:{},...m?.kit||l?.kit?{kit:m?.kit??l?.kit}:{},...m?.supportTier?{supportTier:m.supportTier}:{},commands:{supported:[...m?.commands.supported??[]].sort(),unsupported:[...m?.commands.unsupported??[]].sort(),fleetStages:[...m?.commands.fleetStages??[]].sort()},importantFiles:[...new Set((m?.importantFiles??[]).map(a=>O(a,t$1,n)).filter(a=>a!==null))].sort()},intelligence:{...f?.generatedAt?{modelGeneratedAt:f.generatedAt}:{},...w?.generatedAt?{graphGeneratedAt:w.generatedAt}:{},...w?.source.hash?{graphModelHash:w.source.hash}:{},entityCount:g.entityCount,relationCount:g.relationCount,proofCount:g.proofCount,entitiesByKind:g.entitiesByKind,relationsByKind:g.relationsByKind,languages:g.languages,semantic:g.semantic,relatedProjects:g.relatedProjects,freshness:{model:S,graph:R,graphMatchesModel:b$1},topology:{...g.topology,dependencies:g.topology.dependencies.map(a=>({...a,evidence:a.evidence.map(h=>O(h,t$1,n)).filter(h=>h!==null)})),dependents:g.topology.dependents.map(a=>({...a,evidence:a.evidence.map(h=>O(h,t$1,n)).filter(h=>h!==null)}))},surfaces:ve(g.entities,t$1,n),diagnostics:[...j,...g.diagnostics].map(a=>({...a,message:P(a.message,t$1,n),...a.recommendation?{recommendation:P(a.recommendation,t$1,n)}:{}}))},evidence:{readOrder:[b,".workspai/PROJECT-GROUNDING.md",i.projectContextAgent,"AGENTS.md","workspace:.workspai/goals/index.json",`workspace:${i.goalPackLastRun}`,"workspace:.workspai/reports/INDEX.json","workspace:.workspai/reports/workspace-context-agent.json","workspace:.workspai/reports/workspace-skills-index.json",`command:workspai workspace graph search <task-query> --scope project:${p} --limit 12 --json`],projectProofArtifacts:[...new Set(g.proofArtifacts.map(a=>O(a,t$1,n)).filter(a=>a!==null))],relations:g.relations.map(a=>({id:a.id,from:a.from,to:a.to,kind:a.kind,derivation:a.derivation,trust:a.trust,confidence:a.confidence,proofIds:[...a.proofIds].sort()})),proofs:g.proofs.map(a=>Ae(a,t$1,n)).filter(a=>a!==null)},blockers:v,agentRouting:{enforcement:"required",mandatoryPreflight:{command:"workspai agent bootstrap --for-agent generic --strict --json",successCondition:"ready"},workspaceLocator:{command:"workspai project workspace status --json",successCondition:"resolved",outputClassification:"machine-local",persistence:"forbidden",disclosure:"forbidden",portableUriScheme:"workspace:"},workspaceEvidenceRequiredFor:["repository-analysis","architecture-analysis","change-impact","cross-project-change","contract-change","infrastructure-change","release-readiness"],requiredReadOrder:[b,"command:workspai agent bootstrap --for-agent generic --strict --json","command:workspai project workspace status --json",i.projectContextAgent,"workspace:.workspai/reports/INDEX.json","workspace:.workspai/reports/workspace-context-agent.json","workspace:.workspai/reports/workspace-skills-index.json",`command:workspai workspace graph search ${JSON.stringify(p)} --scope ${JSON.stringify(`project:${p}`)} --limit 12 --json`],degradedMode:{allowCompleteArchitectureClaims:false,requireDisclosure:true}},commands:{refresh:"workspai workspace intelligence run --for-agent generic --strict --json",verify:"workspai workspace verify --strict --json",graphSearch:`workspai workspace graph search ${JSON.stringify(p)} --scope ${JSON.stringify(`project:${p}`)} --limit 12 --json`,doctor:"workspai doctor project --json",workspaceStatus:"workspai project workspace status --json"}};if(U(W,[t$1,n]))throw new Error("Project context lens rejected a non-portable absolute path.");let r={...W,integrity:{algorithm:"sha256",...y?{modelHash:y}:{},payloadHash:Ce(W),portable:true,absolutePathsEmitted:false}};return a(r,"contracts/workspace-intelligence/project-context-agent.v1.json","Project context agent"),r}function Te(e){let t=e.intelligence.relatedProjects.length>0?e.intelligence.relatedProjects.map(i=>`\`${i}\``).join(", "):"No proven cross-project relation is currently available.",n=e.intelligence.diagnostics.length>0?e.intelligence.diagnostics.slice(0,8).map(i=>`- **${i.severity} \xB7 ${i.code}:** ${i.message}`).join(`
2
- `):"- No project-scoped graph diagnostic is currently recorded.",o=e.blockers.length>0?e.blockers.slice(0,12).map(i=>`- **${i.severity}${i.code?` \xB7 ${i.code}`:""}:** ${i.message}`).join(`
3
- `):"- No current project-scoped blocker is recorded.";return `# Workspai project grounding
4
-
5
- This project is adopted into the **${e.workspace.name}** Workspai workspace.
6
- That value is the canonical workspace identity, not its filesystem path. Workspai
7
- commands launched here resolve the machine-local workspace automatically.
8
-
9
- ## Mandatory first contact
10
-
11
- Do not begin broad repository discovery, architecture claims, planning, or mutation
12
- until this sequence is complete:
13
-
14
- 1. Read \`.workspai/agent-entry.v1.json\` to discover the portable protocol.
15
- 2. Run \`workspai agent bootstrap --for-agent generic --strict --json\`.
16
- 3. Follow the receipt's \`requiredReadOrder\` exactly.
17
- 4. Read \`.workspai/reports/project-context-agent.json\`.
18
- 5. If the receipt reports an active Goal, read its immutable Goal Pack and agent
19
- handoff before choosing or expanding work.
20
- 6. Read the compact workspace Skills index and load only a matching playbook.
21
- 7. Query the bounded Workspace Graph with the user's actual task before opening broad
22
- source, then inspect only returned proof paths and targeted live files.
23
-
24
- Receipt policy:
25
-
26
- - \`ready\`: continue with bounded evidence and targeted source inspection.
27
- - \`degraded\`: disclose the limitation and do not claim complete architecture or verification.
28
- - \`blocked\`: stop governed claims, execute \`nextActions\`, and rerun bootstrap.
29
-
30
- ## Workspace location and portable paths
31
-
32
- - \`${e.workspace.name}\` is an identity, not a directory name to guess.
33
- - Project-local paths begin with \`.workspai/\`.
34
- - Canonical workspace paths begin with \`workspace:\`.
35
- - Resolve the exact local workspace root only when direct file access is necessary by
36
- running \`workspai project workspace status --json\` from this project.
37
- - The resolver's absolute paths are machine-local runtime data. Never persist or copy
38
- them into answers, shared logs, commits, prompts, telemetry, or portable artifacts.
39
-
40
- ## Authority boundary
41
-
42
- The Workspace Model owns canonical project identity and its compact \`projectTopology\`.
43
- The Workspace Knowledge Graph is a separate, proof-backed enrichment containing
44
- files, symbols, APIs, infrastructure, tests, owners, and decisions. Do not treat
45
- an unproven topology edge as proof that two projects are independent. Live source owns
46
- exact implementation. CLI evidence owns Goal, readiness, repair, and verification claims.
47
- Repository-authored instructions remain authoritative for source changes after this
48
- entry gate; Workspai preserves rather than replaces them.
49
-
50
- ## Project
51
-
52
- - Name: \`${e.project.name}\`
53
- - Workspace-relative identity: \`${e.project.relativePath}\`
54
- - Runtime: \`${e.project.runtime??"unknown"}\`
55
- - Framework: \`${e.project.framework??"unknown"}\`
56
- - Relationship: \`${e.workspace.relationship}\`
57
- - Related projects: ${t}
58
- - Topology status: \`${e.intelligence.topology.status}\`
59
- - Model freshness: \`${e.intelligence.freshness.model}\`
60
- - Knowledge Graph freshness: \`${e.intelligence.freshness.graph}\`
61
-
62
- ## Current evidence coverage
63
-
64
- - Project-scoped entities: ${e.intelligence.entityCount}
65
- - Project-scoped relations: ${e.intelligence.relationCount}
66
- - Portable proofs: ${e.intelligence.proofCount}
67
-
68
- ${n}
69
-
70
- ## Current project blockers
71
-
72
- ${o}
73
-
74
- ## Safe commands from this project
75
-
76
- \`\`\`bash
77
- ${e.commands.workspaceStatus}
78
- ${e.commands.doctor}
79
- ${e.commands.graphSearch}
80
- ${e.commands.verify}
81
- \`\`\`
82
-
83
- The machine-local workspace binding lives only in
84
- \`.workspai/workspace-link.local.json\`, which is gitignored. Portable grounding files
85
- never publish its value.
86
- `}function Se(e){return `# Workspai agent entry gate (mandatory)
87
-
88
- - Project: \`${e.project.name}\`
89
- - Workspace identity: \`${e.workspace.name}\` (logical name, not a filesystem path)
90
- - Entry contract: \`.workspai/agent-entry.v1.json\`
91
-
92
- Before broad repository discovery, architecture claims, planning, or mutation:
93
-
94
- 1. Read \`.workspai/agent-entry.v1.json\`.
95
- 2. Run \`workspai agent bootstrap --for-agent generic --strict --json\`.
96
- 3. Follow the receipt's \`requiredReadOrder\` exactly.
97
- 4. If a Goal is active, read its immutable Goal Pack and handoff before acting.
98
- 5. Read the compact workspace Skills index and load only a matching playbook.
99
- 6. Query the bounded Workspace Graph with the user's task, then inspect only returned proofs and targeted live source.
100
-
101
- Receipt policy: \`ready\` may proceed; \`degraded\` must disclose limitations and may not claim complete architecture or verification; \`blocked\` must stop governed claims, execute \`nextActions\`, and rerun bootstrap.
102
-
103
- \`workspace:\` paths belong to the canonical workspace, not this project's \`.workspai\` directory. Resolve their machine-local root at runtime with \`workspai project workspace status --json\`. That output is machine-local: never copy it into answers, shared logs, commits, or portable artifacts.
104
-
105
- Authority: Workspai evidence owns identity, topology, goals, readiness, and verification. Live source and repository-authored rules own exact implementation and source conventions.`}function se(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function q(e,t){return new RegExp(`${se(e)}[\\s\\S]*?${se(t)}`,"m")}function me(e){let t=e.replace(q(de,pe),"");return d$3(t)?.includes("# Workspai project boundary")&&(t=t.replace(q(a$1,b$1),"")),t.replace(/\n{3,}/g,`
106
-
107
- `).trim()}function Ne(e,t){let n=me(e),o=`${de}
108
- ${t.trim()}
109
- ${pe}`;return n?`${o}
110
-
111
- ${n}
112
- `:`${o}
113
- `}async function G(e,t){await k.mkdir(d.dirname(e),{recursive:true});let n=`${e}.${process.pid}.${le.randomUUID()}.tmp`;try{await k.writeFile(n,t,"utf8");try{await k.rename(n,e);}catch(o){let i=o.code;if(i!=="EEXIST"&&i!=="EPERM")throw o;await he.move(n,e,{overwrite:true});}}finally{await k.rm(n,{force:true}).catch(()=>{});}}async function fe(e,t){let n;try{n=await execa("git",["rev-parse","--show-toplevel"],{cwd:e,reject:false});}catch{return false}if(n?.exitCode!==0)return false;let o=n.stdout.trim();if(!o)return false;let i,c;try{[i,c]=await Promise.all([k.realpath(d.resolve(o)),k.realpath(e)]);}catch{return false}let s=d.resolve(c,t),l=d.relative(i,s).replace(/\\/g,"/");if(!l||d.isAbsolute(l)||l===".."||l.startsWith("../"))return false;let p;try{p=await execa("git",["cat-file","-e",`HEAD:${l}`],{cwd:i,reject:false});}catch{return false}if(p?.exitCode!==0)return false;let u;try{u=await execa("git",["ls-files","--deleted","--error-unmatch","--",`:(top)${l}`],{cwd:i,reject:false});}catch{return false}return u?.exitCode===0}async function ae(e,t){let n=d.join(e,".gitignore"),o=await k.readFile(n,"utf8").catch(l=>{if(l.code==="ENOENT")return "";throw l}),i=[g$1,h$1,b],c=o.split(/\r?\n/).filter(l=>l.trim()!=="# Workspai local project grounding"&&!i.includes(l.trim()));for(;c.length>0&&c[c.length-1]==="";)c.pop();t==="local"&&(c.length>0&&c.push(""),c.push("# Workspai local project grounding",...i));let s=c.length>0?`${c.join(`
114
- `)}
115
- `:"";s!==o&&await G(n,s);}var L=[{host:"claude",relativePath:"CLAUDE.md",importFromAgents:"@AGENTS.md",importFromGrounding:"@.workspai/PROJECT-GROUNDING.md"},{host:"gemini",relativePath:"GEMINI.md",importFromAgents:"@./AGENTS.md",importFromGrounding:"@./.workspai/PROJECT-GROUNDING.md"},{host:"qwen",relativePath:"QWEN.md",importFromAgents:"@AGENTS.md",importFromGrounding:"@.workspai/PROJECT-GROUNDING.md"},{host:"amazon-q",relativePath:".amazonq/rules/workspai-agent-entry.md",importFromAgents:"",importFromGrounding:""}];if(L.length!==g.length||L.some((e,t)=>e.relativePath!==g[t]))throw new Error("Project agent adapter paths must match the portable entry contract.");async function Ie(e,t){let n=t.split("/").slice(0,-1),o=e;for(let i of n){o=d.join(o,i);let c=await k.lstat(o).catch(s=>{if(s.code==="ENOENT")return null;throw s});if(!c)return null;if(c.isSymbolicLink()||!c.isDirectory())return d.relative(e,o).split(d.sep).join("/")}return null}function xe(e){let t=e.agentsAvailable?e.adapter.importFromAgents:e.adapter.importFromGrounding;return t?`${t}
116
-
117
- # Workspai host binding \xB7 ${e.adapter.host}
118
-
119
- The imported Workspai entry gate is mandatory. Validate this host with
120
- \`workspai agent bootstrap --for-agent ${e.adapter.host} --strict --json\`, then follow
121
- the receipt's \`requiredReadOrder\`, Goal handoff, bounded Graph queries, proof paths,
122
- status policy, workspace locator privacy policy, and authority boundary. Do not repeat
123
- the imported instructions or replace repository-authored source rules.`:`# Workspai entry for ${e.adapter.host}
124
-
125
- Before broad repository discovery, architecture claims, planning, or mutation:
126
-
127
- 1. Read \`.workspai/agent-entry.v1.json\`.
128
- 2. Run \`workspai agent bootstrap --for-agent ${e.adapter.host} --strict --json\`.
129
- 3. Follow \`requiredReadOrder\`, any active Goal handoff, bounded Graph queries, and returned proof paths.
130
-
131
- Receipt policy: \`ready\` may proceed; \`degraded\` must disclose limitations; \`blocked\` must execute \`nextActions\` and rerun bootstrap before governed claims.
132
-
133
- The workspace name is a logical identity, not a path. Resolve \`workspace:\` URIs at runtime with \`workspai project workspace status --json\`; its absolute paths are machine-local and must never be copied into shared output or portable artifacts. Live source owns exact implementation; Workspai evidence owns identity, topology, goals, readiness, and verification. Repository-authored rules remain authoritative for source changes after this entry gate.`}async function ie(e){let t=await Ie(e.projectPath,e.adapter.relativePath);if(t)return {reason:`${e.adapter.relativePath} has an unsafe repository-authored parent at ${t}.`};let n=d.join(e.projectPath,e.adapter.relativePath),o=await k.lstat(n).catch(u=>{if(u.code==="ENOENT")return null;throw u});if(o?.isSymbolicLink())return {reason:`${e.adapter.relativePath} is a repository-authored symbolic link.`};let i=o?.isFile()===true,c=await k.readFile(n,"utf8").catch(u=>{if(u.code==="ENOENT")return "";throw u});if(e.mode==="managed"&&!i&&await fe(e.projectPath,e.adapter.relativePath))return {reason:`${e.adapter.relativePath} has an authored tracked deletion.`};let s=c.replace(q(d$2,e$1),"").replace(/\n{3,}/g,`
134
-
135
- `).trim(),l=e.mode==="managed"?[s,`${d$2}
136
- ${xe(e).trim()}
137
- ${e$1}`].filter(Boolean).join(`
138
-
139
- `):s;if(!l)return i&&await k.rm(n,{force:true}),{};let p=`${l.trimEnd()}
140
- `;return p!==c&&await G(n,p),e.mode==="managed"?{path:e.adapter.relativePath}:{}}function Ge(e){let t={id:"generic",discovery:"portable-fallback",entryFiles:[g$1],status:"ready",managed:e.mode==="managed"},o=["codex","kimi","grok","copilot","cursor","windsurf"].map(s=>({id:s,discovery:"native",entryFiles:["AGENTS.md"],status:e.agentsAvailable?"ready":"blocked",managed:e.mode==="managed"&&e.agentsAvailable,...e.agentsAvailable?{}:{reason:"AGENTS.md could not be managed without overriding authored repository state."}})),i=L.map(s=>{let l=e.adapters.get(s.host);return {id:s.host,discovery:"adapter",entryFiles:[s.relativePath],status:l?.path?"ready":e.mode==="managed"?"blocked":"degraded",managed:!!l?.path,...l?.path?{}:{reason:l?.reason??"Provider adapter generation is disabled by the project grounding policy."}}}),c=[t,...o,...i];return f.map(s=>c.find(l=>l.id===s))}async function ce(e,t,n){let o=d.join(e,"AGENTS.md"),i=await k.lstat(o).catch(u=>{if(u.code==="ENOENT")return null;throw u});if(i?.isSymbolicLink())return;let c=i?.isFile()===true,s=await k.readFile(o,"utf8").catch(u=>{if(u.code==="ENOENT")return "";throw u});if(t==="managed"&&!n)throw new Error("Managed project grounding requires a project context.");if(t==="managed"&&!c&&await fe(e,"AGENTS.md"))return;let l=t==="managed"&&n?Ne(s,Se(n)):me(s);if(!l){c&&await k.rm(o,{force:true});return}let p=`${l.trimEnd()}
141
- `;return p!==s&&await G(o,p),t==="managed"?o:void 0}async function We(e){let t$1=e.mode??"managed",n=d.resolve(e.workspacePath),o=d.resolve(e.projectPath);if(t$1==="off"){let g=t(o,"project.json").find(j=>H.existsSync(j)),v=g?await E(g):null,C=e.projectName??(typeof v?.name=="string"?v.name:void 0)??d.basename(o),R=ge(v,e.relationship??"managed"),S=await c({workspacePath:n,projectPath:o,projectName:C,relationship:R,now:e.now});return await ae(o,t$1),await ce(o,t$1),await Promise.all(L.map(j=>ie({projectPath:o,adapter:j,mode:t$1,agentsAvailable:false}))),await Promise.all([k.rm(d.join(o,h$1),{force:true}),k.rm(d.join(o,g$1),{force:true}),k.rm(d.join(o,b),{force:true})]),{mode:t$1,projectPath:o,linkPath:S.linkPath,writtenFiles:[i.projectWorkspaceLink]}}let i$2=await Re(e),c$1=i$2.workspace.relationship,s=await c({workspacePath:n,projectPath:o,projectName:i$2.project.name,relationship:c$1,workspaceName:i$2.workspace.name,relativePath:i$2.project.relativePath,now:e.now});await ae(o,t$1);let l=await ce(o,t$1,i$2),p=new Map;for(let g of L)p.set(g.host,await ie({projectPath:o,adapter:g,mode:t$1,agentsAvailable:!!l}));let u=Ge({mode:t$1,agentsAvailable:!!l,adapters:p}),f=d.join(o,h$1),w=d.join(o,g$1),y=d.join(o,b),b$1=i$1({context:i$2,hosts:u});await G(f,`${JSON.stringify(i$2,null,2)}
142
- `),await G(w,`${Te(i$2).trimEnd()}
143
- `),await G(y,`${JSON.stringify(b$1,null,2)}
144
- `);let m=[i.projectWorkspaceLink,h$1,g$1,b];l&&m.push("AGENTS.md");for(let g of p.values())g.path&&m.push(g.path);return {mode:t$1,projectPath:o,linkPath:s.linkPath,groundingPath:w,contextPath:f,agentEntryPath:y,agentsPath:l,hostCoverage:u,writtenFiles:m}}async function et(e){let t=d.resolve(e.workspacePath),n=e.mode??"managed",o=await $e(t),i=[],c=[];for(let s of o.resolved)try{i.push(await We({workspacePath:t,projectPath:s.projectPath,projectName:s.name,relationship:s.relationship,mode:n,now:e.now}));}catch(l){c.push({name:s.name,reason:l instanceof Error?l.message:String(l)});}return {workspacePath:t,mode:n,projects:i,skipped:[...o.skipped,...c]}}async function $e(e){let t=d.resolve(e),n=await E(d.join(t,".workspai","workspace.contract.json")),o=[],i=[];for(let c of n?.projects??[]){let s=c.slug??c.relativePath??"unknown-project",l=typeof c.externalPath=="string"?d.resolve(c.externalPath):typeof c.relativePath=="string"&&!c.relativePath.startsWith("external/")?d.resolve(t,c.relativePath):null;if(!l||!H.existsSync(l)){i.push({name:s,reason:"project path is unavailable on this machine"});continue}o.push({name:s,projectPath:l,relationship:c.relationship??"managed"});}return {resolved:o,skipped:i}}export{ke as a,Ze as b,de as c,pe as d,Re as e,We as f,et as g,$e as h};
@@ -1 +0,0 @@
1
- import {a as a$1}from'./chunk-LPCWROQ3.js';import {f as f$1,e as e$1,g as g$1,i}from'./chunk-NZ3WZYD5.js';var g=f$1.repairTransaction,v=e$1.repairTransaction,b=g$1.repairTransaction;var k="workspai.workspace-repair-proposal.v1",x="contracts/workspace-intelligence/workspace-repair-proposal.v1.json";var m="workspai.workspace-repair-capabilities.v1",y="workspai.workspace-repair-consumer-protocol.v1",w=[{id:"node",ecosystem:"JavaScript / TypeScript",manifests:["package.json"],lockfiles:["package-lock.json","npm-shrinkwrap.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb"],packageManagers:["npm","pnpm","yarn","bun"],support:"full",stages:{reconcile:"native",audit:"native",test:"declared",build:"declared"},requiredToolFamilies:["selected package manager"]},{id:"python",ecosystem:"Python",manifests:["pyproject.toml","requirements.txt"],lockfiles:["uv.lock","poetry.lock","requirements.txt"],packageManagers:["uv","poetry","pip"],support:"conditional",stages:{reconcile:"conditional",audit:"conditional",test:"conditional",build:"declared"},requiredToolFamilies:["isolated Python","selected environment manager","pip-audit or governed Doctor audit"],limitation:"A bounded isolated environment and an installed audit surface are required."},{id:"go",ecosystem:"Go",manifests:["go.mod"],lockfiles:["go.sum"],packageManagers:["go modules"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"native",build:"native"},requiredToolFamilies:["go","govulncheck"],limitation:"govulncheck must be installed; the engine never fetches an unreviewed tool."},{id:"rust",ecosystem:"Rust",manifests:["Cargo.toml"],lockfiles:["Cargo.lock"],packageManagers:["cargo"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"native",build:"native"},requiredToolFamilies:["cargo","cargo-audit"],limitation:"The cargo-audit subcommand must already be installed."},{id:"php-composer",ecosystem:"PHP",manifests:["composer.json"],lockfiles:["composer.lock"],packageManagers:["composer"],support:"full",stages:{reconcile:"native",audit:"native",test:"declared",build:"declared"},requiredToolFamilies:["composer"]},{id:"ruby-bundler",ecosystem:"Ruby",manifests:["Gemfile"],lockfiles:["Gemfile.lock"],packageManagers:["bundler"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"declared",build:"declared"},requiredToolFamilies:["bundle","bundle-audit"],limitation:"bundle-audit and the declared Rake tasks must already exist."},{id:"elixir-mix",ecosystem:"Elixir",manifests:["mix.exs"],lockfiles:["mix.lock"],packageManagers:["mix"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"native",build:"native"},requiredToolFamilies:["mix","Hex audit task"],limitation:"The project must expose the Hex audit task used by its dependency policy."},{id:"deno",ecosystem:"Deno",manifests:["deno.json","deno.jsonc"],lockfiles:["deno.lock"],packageManagers:["deno"],support:"full",stages:{reconcile:"native",audit:"native",test:"declared",build:"declared"},requiredToolFamilies:["deno"]},{id:"dotnet",ecosystem:".NET",manifests:["*.sln","*.csproj","*.fsproj","*.vbproj"],lockfiles:["Directory.Packages.props","packages.lock.json"],packageManagers:["NuGet / dotnet"],support:"full",stages:{reconcile:"native",audit:"native",test:"native",build:"native"},requiredToolFamilies:["dotnet"]},{id:"jvm-maven",ecosystem:"JVM / Maven",manifests:["pom.xml"],lockfiles:[],packageManagers:["Maven Wrapper","Maven"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"native",build:"native"},requiredToolFamilies:["mvnw or mvn","governed Doctor audit"],limitation:"A project-specific dependency audit command must be declared by Doctor evidence."},{id:"jvm-gradle",ecosystem:"JVM / Gradle",manifests:["build.gradle.kts","build.gradle"],lockfiles:["gradle.lockfile","gradle/libs.versions.toml"],packageManagers:["Gradle Wrapper","Gradle"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"native",build:"native"},requiredToolFamilies:["gradlew or gradle","governed Doctor audit"],limitation:"A project-specific dependency audit command must be declared by Doctor evidence."},{id:"clojure",ecosystem:"Clojure",manifests:["deps.edn","project.clj"],lockfiles:[],packageManagers:["Clojure CLI","Leiningen"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"conditional",build:"conditional"},requiredToolFamilies:["clojure or lein","governed project audit"],limitation:"Tests and builds run only when the selected Clojure project surface declares a deterministic entrypoint."},{id:"scala-sbt",ecosystem:"Scala / sbt",manifests:["build.sbt"],lockfiles:[],packageManagers:["sbt"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"native",build:"native"},requiredToolFamilies:["sbt","governed project audit"],limitation:"A project-specific dependency audit command must be declared by Doctor evidence."}];function T(){return {schemaVersion:m,owner:"Workspai CLI",workflow:["plan","preconditions","approval","target-precondition","checkpoint","execute","reconcile","audit","test","build","target-producer-verify","canonical-verify","close-or-rollback-or-decision"],invariants:{multiAdapterProjects:true,missingTools:"decision-required",unsupportedEcosystems:"decision-required",silentFallbackToModelExecution:false,mutationAuthority:"cli-only",targetClosure:"selected-causal-action-set",changeReceipt:"checkpoint-hash-delta",consumerTimeline:"durable-transaction-events",typedDecisionCauses:true,registeredLinkedProjectMutationBoundary:true,sourceProposalIntegrity:"project-bound-hash-pinned",completionAuthority:"cli-verification-receipt",goalSourceTransition:"closed-integrity-bound-v1",goalAttemptBudget:"durable-serialized-v1",consumerHandshakeRequired:true,ephemeralProposalsAreEvidence:false,approvalBoundToPlanHash:true,canonicalVerificationRequired:true,rollbackConflictDetection:true},consumerProtocol:{protocolVersion:y,versionProbe:{args:["--version","--json"],schemaVersion:"rapidkit-version-v1"},capabilityProbe:{args:["workspace","repair","capabilities","--json"],schemaVersion:m},invocation:{command:"workspace repair",workspaceResolution:["process-cwd","--workspace"],actions:["capabilities","plan","propose","approve","decide","execute","resume","status","list","rollback","cancel"]},contracts:{operationResult:a$1,proposal:k,transaction:g},transientPaths:[".workspai/repair/inbox/*.json",".workspai/repair/engine.lock"]},adapters:w}}var N="workspai.studio-card-repair-capabilities.v1",f="npx workspai workspace verify --json",r=e$1,a=i;function e(R,n,c,o={}){return {cardId:R,scope:o.scope??"workspace",producerCommand:n,producerArtifact:c,verifyCommand:n,verifyArtifact:c,aggregateVerifyCommand:f,targetClosure:"exact-producer-and-causal-action-set",aggregateRepair:"sequential-causal-queue",transactionScope:"one-causal-finding-family",workspacePosture:"reported-separately",repairPolicy:o.repairPolicy??"refresh-producer",remediationArtifacts:o.remediationArtifacts??[]}}var M=[e("doctor","npx workspai doctor workspace --json",r.doctor,{repairPolicy:"diagnose-and-repair",remediationArtifacts:[a.doctorRemediationPlan,a.artifactRemediationPlan]}),e("projectDoctor","npx workspai doctor project --json",a.doctorProject,{scope:"project",repairPolicy:"diagnose-and-repair",remediationArtifacts:[a.doctorRemediationPlan,a.artifactRemediationPlan]}),e("pipeline","npx workspai pipeline --json --strict",a.pipelineLastRun,{repairPolicy:"source-repair-then-produce",remediationArtifacts:[a.artifactRemediationPlan]}),e("analyze","npx workspai analyze --json",r.analyze,{repairPolicy:"source-repair-then-produce",remediationArtifacts:[a.artifactRemediationPlan]}),e("readiness","npx workspai readiness --json",r.readiness,{repairPolicy:"source-repair-then-produce",remediationArtifacts:[a.artifactRemediationPlan]}),e("bootstrap","npx workspai bootstrap --ci --json",a.bootstrapCompliance,{repairPolicy:"source-repair-then-produce",remediationArtifacts:[a.artifactRemediationPlan]}),e("workspaceSync","npx workspai workspace sync --json",a.workspaceRegistry),e("foundation","npx workspai workspace foundation ensure --json",".workspai/workspace.json"),e("contract","npx workspai workspace contract verify --strict --json",r.contractVerify,{repairPolicy:"source-repair-then-produce"}),e("autopilot","npx workspai autopilot release --json",a.autopilotReleaseLastRun,{repairPolicy:"source-repair-then-produce"}),e("workspaceRun","npx workspai workspace run test --json",a.workspaceRunLast,{repairPolicy:"source-repair-then-produce",remediationArtifacts:[a.artifactRemediationPlan]}),e("setup","npx workspai setup --json",".workspai/toolchain.lock",{repairPolicy:"source-repair-then-produce"}),e("importReadiness","npx workspai doctor project --json",a.doctorProject,{scope:"project",repairPolicy:"diagnose-and-repair",remediationArtifacts:[a.artifactRemediationPlan]}),e("snapshot","npx workspai snapshot create --json",".workspai/reports/snapshot-last-run.json"),e("workspaceModel","npx workspai workspace model --json --write",r.model),e("intelligenceSnapshot","npx workspai workspace snapshot --json",r.snapshot),e("workspaceDiff",`npx workspai workspace diff --from ${r.snapshot} --json`,r.diff),e("workspaceImpact",`npx workspai workspace impact --from ${r.diff} --json`,r.impact),e("workspaceIntelligenceRun","npx workspai workspace intelligence run --for-agent generic --strict --json",r.intelligenceRun,{repairPolicy:"source-repair-then-produce"}),e("workspaceVerify",f,r.verify,{repairPolicy:"source-repair-then-produce",remediationArtifacts:[a.artifactRemediationPlan]}),e("workspaceExplain","npx workspai workspace explain release-blocked --json --write",r.explain),e("workspaceWhy","npx workspai workspace why release-blocked --json --write",a.workspaceWhy),e("workspaceTrace",`npx workspai workspace trace --from ${r.diff} --json --write`,a.workspaceTrace),e("workspaceWatch","npx workspai workspace watch --once --json",r.model),e("workspaceContextAgent","npx workspai workspace context --for-agent --json --write",r.agentContext),e("agentGrounding","npx workspai workspace agent-sync --write --refresh-context --json --preset enterprise --target vscode",r.agentCustomizationPack),e("share",`npx workspai workspace share --output ${a.workspaceShareBundle} --json`,a.workspaceShareBundle),e("archive","npx workspai workspace export --output team-workspace.workspai-archive.zip --json",".workspai/archive-manifest.json"),e("mirror","npx workspai mirror status --json",a.mirrorOps),e("cache","npx workspai cache status --json",".workspai/cache-config.yml"),e("policy","npx workspai workspace policy show --json",".workspai/policies.yml",{repairPolicy:"source-repair-then-produce"}),e("infra","npx workspai infra plan --json",a.infraPlan,{repairPolicy:"source-repair-then-produce"})];export{g as a,v as b,b as c,k as d,x as e,m as f,w as g,T as h,N as i,M as j};