workspai 0.65.0 → 0.67.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 (211) hide show
  1. package/README.md +28 -23
  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 +6 -0
  6. package/contracts/published-contract-catalog.v1.json +30 -0
  7. package/contracts/runtime-command-surface.v1.json +100 -2
  8. package/contracts/workspace-activity-board.v1.json +114 -0
  9. package/contracts/workspace-activity-event.v1.json +132 -0
  10. package/contracts/workspace-activity-monitor-fleet.v1.json +18 -0
  11. package/contracts/workspace-activity-monitor-snapshot.v1.json +161 -0
  12. package/contracts/workspace-intelligence/agent-bootstrap-receipt.v1.json +17 -0
  13. package/contracts/workspace-intelligence/mcp-design.v1.json +49 -2
  14. package/contracts/workspace-intelligence/project-agent-entry.v1.json +3 -0
  15. package/contracts/workspace-intelligence/project-context-agent.v1.json +49 -7
  16. package/contracts/workspace-intelligence/project-knowledge-graph-reference.v1.json +51 -0
  17. package/contracts/workspace-intelligence/workspace-intelligence-benchmark.v1.json +196 -0
  18. package/contracts/workspace-intelligence/workspace-knowledge-graph.v1.json +97 -2
  19. package/contracts/workspace-intelligence/workspace-skills-index.v1.json +34 -0
  20. package/contracts/workspace-intelligence-architecture.v1.json +17 -0
  21. package/contracts/workspace-intelligence-chain.v1.json +17 -0
  22. package/dist/analyze-IC2KRVCG.js +1 -0
  23. package/dist/{artifact-remediation-plan-XIQNI35L.js → artifact-remediation-plan-GFFHC2ZU.js} +1 -1
  24. package/dist/autopilot-release-RECEZAZI.js +1 -0
  25. package/dist/capabilities-command-X4WZIJNR.js +1 -0
  26. package/dist/chunk-2LIVMG5C.js +2 -0
  27. package/dist/chunk-2M62CU3O.js +2 -0
  28. package/dist/chunk-2MTJWPQ4.js +1 -0
  29. package/dist/chunk-2MVIRJJR.js +1 -0
  30. package/dist/chunk-2RPFCBS4.js +1 -0
  31. package/dist/chunk-3O7LZPKA.js +4 -0
  32. package/dist/chunk-3OGPTLI2.js +1 -0
  33. package/dist/{chunk-6TBTMWNA.js → chunk-4RV4JVGR.js} +1 -1
  34. package/dist/{chunk-YYQEWAES.js → chunk-4WVOAX2V.js} +1 -1
  35. package/dist/{chunk-N4QQADXX.js → chunk-5EVDW7JM.js} +1 -1
  36. package/dist/{chunk-J3X56S7L.js → chunk-5ME4W4LN.js} +1 -1
  37. package/dist/chunk-5OA33JH2.js +2 -0
  38. package/dist/chunk-5TY74LLW.js +2 -0
  39. package/dist/chunk-6254CWUY.js +49 -0
  40. package/dist/{chunk-D5YJOQYK.js → chunk-6E2Y3XGT.js} +1 -1
  41. package/dist/chunk-ARUFY5W3.js +1 -0
  42. package/dist/chunk-B4IVVTMQ.js +2 -0
  43. package/dist/{chunk-HDNATYW7.js → chunk-BHFRP7TV.js} +1 -1
  44. package/dist/{chunk-KTN2ARZJ.js → chunk-BHM6RHTA.js} +3 -3
  45. package/dist/chunk-BRYJTW6S.js +2 -0
  46. package/dist/{chunk-HCFWT42C.js → chunk-BUYLM6QV.js} +1 -1
  47. package/dist/chunk-CPR2CMOY.js +1 -0
  48. package/dist/{chunk-XGE2FDI4.js → chunk-CZVT7T2X.js} +1 -1
  49. package/dist/chunk-EHCKITR4.js +2 -0
  50. package/dist/chunk-ENZPM52J.js +1 -0
  51. package/dist/chunk-FPDH3N3A.js +7 -0
  52. package/dist/{chunk-PXWKMPPI.js → chunk-FX5J6JCK.js} +1 -1
  53. package/dist/chunk-FY4X2VOE.js +39 -0
  54. package/dist/chunk-GIQ4SDRJ.js +1 -0
  55. package/dist/chunk-H77ZNH5O.js +1 -0
  56. package/dist/{chunk-2RL6RRT2.js → chunk-HQLBO23O.js} +50 -50
  57. package/dist/chunk-HYE5UHPV.js +2 -0
  58. package/dist/{chunk-D65FCQIO.js → chunk-IKUFNK46.js} +1 -1
  59. package/dist/{chunk-WRQWVSBJ.js → chunk-IQQMFRWM.js} +1 -1
  60. package/dist/chunk-JCGSIDMC.js +2 -0
  61. package/dist/chunk-KENOAC2Q.js +13 -0
  62. package/dist/chunk-KQ2TMI26.js +97 -0
  63. package/dist/chunk-L5Q2S5GY.js +3 -0
  64. package/dist/chunk-LPCZHKD5.js +1 -0
  65. package/dist/chunk-N4QFNOAI.js +1 -0
  66. package/dist/chunk-NMXGSVMD.js +1 -0
  67. package/dist/{chunk-GQSRNUCU.js → chunk-NVND4727.js} +3 -3
  68. package/dist/{chunk-W6FHVXNL.js → chunk-OCNPOYMA.js} +1 -1
  69. package/dist/chunk-PSYQ6IJA.js +12 -0
  70. package/dist/{chunk-VRGEPPUB.js → chunk-QMQBX3RV.js} +1 -1
  71. package/dist/{chunk-YUGKQ44M.js → chunk-SLFOUSRW.js} +1 -1
  72. package/dist/chunk-SRLWHOLF.js +1 -0
  73. package/dist/chunk-SVYY55IS.js +157 -0
  74. package/dist/chunk-SX6A656X.js +1 -0
  75. package/dist/{chunk-X6TNBARH.js → chunk-TABXSDTR.js} +2 -2
  76. package/dist/chunk-THIG2YQP.js +681 -0
  77. package/dist/chunk-TP7VKEUF.js +1 -0
  78. package/dist/chunk-U5ENEDJA.js +7 -0
  79. package/dist/chunk-UTV4DTNM.js +1 -0
  80. package/dist/chunk-VI4ZRAY6.js +1 -0
  81. package/dist/chunk-VQZ5PI5J.js +1 -0
  82. package/dist/chunk-VWBMDGPY.js +9 -0
  83. package/dist/chunk-XDPTAV2T.js +2 -0
  84. package/dist/chunk-XWKGZRHN.js +1 -0
  85. package/dist/chunk-Y35VLVF6.js +5 -0
  86. package/dist/{chunk-VYDURWN7.js → chunk-Y4Z6CEII.js} +1 -1
  87. package/dist/chunk-YYY2WXOH.js +1 -0
  88. package/dist/chunk-ZGHJIQXL.js +1 -0
  89. package/dist/chunk-ZI2E7P6O.js +4 -0
  90. package/dist/{create-ALT2ME6H.js → create-72ITVZXV.js} +1 -1
  91. package/dist/{demo-kit-QHIDCSBI.js → demo-kit-5UQH2OXC.js} +1 -1
  92. package/dist/{doctor-RW4R3O5C.js → doctor-CVYUESRQ.js} +1 -1
  93. package/dist/{dotnet-webapi-clean-AVHPJG7Y.js → dotnet-webapi-clean-YEHYIGOT.js} +1 -1
  94. package/dist/{goal-lifecycle-VYOKS6E6.js → goal-lifecycle-H55AGFCB.js} +1 -1
  95. package/dist/goal-pack-6OBZOPCD.js +1 -0
  96. package/dist/{gofiber-standard-47S2GYAO.js → gofiber-standard-C44IIQYH.js} +1 -1
  97. package/dist/{gogin-standard-EWB4XNOI.js → gogin-standard-X7VKACVR.js} +1 -1
  98. package/dist/index.d.ts +20 -2
  99. package/dist/index.js +177 -177
  100. package/dist/live-command-5VXPR43F.js +15 -0
  101. package/dist/{pipeline-U4N2DVD7.js → pipeline-SKYOXWHW.js} +1 -1
  102. package/dist/{project-agent-entry-YAQCHIMP.js → project-agent-entry-5IUBEREI.js} +1 -1
  103. package/dist/project-intelligence-lens-LQCN65P2.js +1 -0
  104. package/dist/{project-test-coverage-4S7MEQ6T.js → project-test-coverage-KD4LLFGV.js} +1 -1
  105. package/dist/{pythonRapidkitExec-VAW5XE4Z.js → pythonRapidkitExec-44ORGQ4R.js} +1 -1
  106. package/dist/{rust-axum-M5X4ZC4Z.js → rust-axum-JKZTZDRZ.js} +1 -1
  107. package/dist/{springboot-standard-Y5ADLZMQ.js → springboot-standard-PI4FLTAN.js} +1 -1
  108. package/dist/verified-goal-HN7G532B.js +1 -0
  109. package/dist/{workspace-HGUZWNAB.js → workspace-5W7FYGDQ.js} +1 -1
  110. package/dist/{workspace-agent-sync-GEN3KBAX.js → workspace-agent-sync-OZCDQORK.js} +1 -1
  111. package/dist/{workspace-archive-ZBCKJHXS.js → workspace-archive-NOSGRKRZ.js} +1 -1
  112. package/dist/{workspace-context-4WIWFW26.js → workspace-context-L65BR5L6.js} +1 -1
  113. package/dist/{workspace-contract-7DXK4GF5.js → workspace-contract-JYHNEJPV.js} +1 -1
  114. package/dist/workspace-explain-SUBK6FLO.js +1 -0
  115. package/dist/workspace-explain-contract-WMREJWHF.js +1 -0
  116. package/dist/{workspace-feedback-RQ4TGJW6.js → workspace-feedback-MWGCT5R2.js} +1 -1
  117. package/dist/{workspace-foundation-J3NNRMI3.js → workspace-foundation-VIB3PXNH.js} +1 -1
  118. package/dist/{workspace-graph-stream-PQI7OGCE.js → workspace-graph-stream-45JHE4MG.js} +1 -1
  119. package/dist/workspace-graph-token-efficiency-NPECU6Y5.js +1 -0
  120. package/dist/{workspace-history-SYCDK7FO.js → workspace-history-JKW3VJO3.js} +1 -1
  121. package/dist/{workspace-intelligence-6FS26JOQ.js → workspace-intelligence-3C47PK4L.js} +1 -1
  122. package/dist/workspace-intelligence-benchmark-SRDIHX3X.js +1 -0
  123. package/dist/workspace-intelligence-evaluation-OJIQS5SN.js +1 -0
  124. package/dist/{workspace-intelligence-runner-XYUPCSLN.js → workspace-intelligence-runner-OWN5ZI6W.js} +1 -1
  125. package/dist/{workspace-intelligence-runtime-registry-IW6J53LO.js → workspace-intelligence-runtime-registry-UKFB3BI7.js} +1 -1
  126. package/dist/workspace-knowledge-graph-AKG5NUU6.js +1 -0
  127. package/dist/{workspace-knowledge-graph-contract-L3CLAM2M.js → workspace-knowledge-graph-contract-X52KXBXJ.js} +1 -1
  128. package/dist/{workspace-knowledge-graph-query-FZXSPWGK.js → workspace-knowledge-graph-query-DXA4CROE.js} +1 -1
  129. package/dist/workspace-knowledge-graph-snapshot-SNI5K2RL.js +1 -0
  130. package/dist/{workspace-marker-7NHMDIRL.js → workspace-marker-XGAWZZDX.js} +1 -1
  131. package/dist/workspace-mcp-serve-PK226GMV.js +3 -0
  132. package/dist/workspace-model-R4ISKDB2.js +1 -0
  133. package/dist/{workspace-onboarding-X3PWRIIS.js → workspace-onboarding-Y5RPEFUD.js} +1 -1
  134. package/dist/{workspace-python-engine-state-J4QKW55K.js → workspace-python-engine-state-BE4A3BL5.js} +1 -1
  135. package/dist/{workspace-readme-G7TZ3V5T.js → workspace-readme-PL5V3UDH.js} +2 -2
  136. package/dist/{workspace-registry-summary-LJN4WHIZ.js → workspace-registry-summary-STGUGROG.js} +1 -1
  137. package/dist/workspace-repair-engine-FNLL5ZDK.js +3 -0
  138. package/dist/workspace-run-GFBFGUFM.js +1 -0
  139. package/dist/{workspace-verify-USRRIM2F.js → workspace-verify-AXVX3PF3.js} +1 -1
  140. package/dist/{workspace-watch-43YZPLF7.js → workspace-watch-RLBEJKXE.js} +1 -1
  141. package/docs/DEVELOPMENT.md +19 -0
  142. package/docs/README.md +19 -16
  143. package/docs/SETUP.md +10 -0
  144. package/docs/agent-entry.md +22 -7
  145. package/docs/ci-workflows.md +1 -1
  146. package/docs/commands-reference.md +58 -8
  147. package/docs/contracts/ARTIFACT_CATALOG.md +64 -44
  148. package/docs/contracts/COMMAND_OWNERSHIP_MATRIX.md +1 -0
  149. package/docs/contracts/NAMING_AND_COEXISTENCE.md +20 -18
  150. package/docs/contracts/README.md +7 -3
  151. package/docs/real-world-qualification.md +19 -3
  152. package/docs/workspace-intelligence-benchmark.md +82 -0
  153. package/docs/workspace-knowledge-graph.md +95 -27
  154. package/docs/workspace-live-activity.md +209 -0
  155. package/docs/workspace-operations.md +32 -9
  156. package/package.json +4 -2
  157. package/dist/analyze-5PDVWECJ.js +0 -1
  158. package/dist/autopilot-release-JVIJCTKX.js +0 -1
  159. package/dist/capabilities-command-LHM3XIS6.js +0 -1
  160. package/dist/chunk-2647BYBC.js +0 -1
  161. package/dist/chunk-27UR373Z.js +0 -1
  162. package/dist/chunk-2C5ZBVBI.js +0 -2
  163. package/dist/chunk-6JWNDWOA.js +0 -1
  164. package/dist/chunk-CCDGHPEJ.js +0 -2
  165. package/dist/chunk-DFG33SBR.js +0 -2
  166. package/dist/chunk-FY4IIAIF.js +0 -1
  167. package/dist/chunk-HEZZ72V4.js +0 -94
  168. package/dist/chunk-HN7P4T3B.js +0 -681
  169. package/dist/chunk-ILIBOMYL.js +0 -1
  170. package/dist/chunk-J7QYANXK.js +0 -8
  171. package/dist/chunk-JD3A5QM6.js +0 -2
  172. package/dist/chunk-JQLJBK5N.js +0 -1
  173. package/dist/chunk-KLSSPJTV.js +0 -1
  174. package/dist/chunk-L22EABIC.js +0 -7
  175. package/dist/chunk-LNXIMF3O.js +0 -1
  176. package/dist/chunk-MDTI3UEB.js +0 -1
  177. package/dist/chunk-MOSXTVPU.js +0 -1
  178. package/dist/chunk-MYJQGGIU.js +0 -5
  179. package/dist/chunk-NOV6723U.js +0 -1
  180. package/dist/chunk-NYEAMMUL.js +0 -1
  181. package/dist/chunk-NZ3WZYD5.js +0 -1
  182. package/dist/chunk-O5B2L3R2.js +0 -1
  183. package/dist/chunk-OWB5KWSS.js +0 -13
  184. package/dist/chunk-P5PSZQPB.js +0 -2
  185. package/dist/chunk-QCKWQFCD.js +0 -1
  186. package/dist/chunk-QI3HG6IG.js +0 -144
  187. package/dist/chunk-SWGSFLTC.js +0 -1
  188. package/dist/chunk-THIOE2PB.js +0 -2
  189. package/dist/chunk-U5FCQTVL.js +0 -4
  190. package/dist/chunk-UXEO5QCF.js +0 -33
  191. package/dist/chunk-VR6XMUF3.js +0 -2
  192. package/dist/chunk-VVJK5NFY.js +0 -2
  193. package/dist/chunk-VXKWWX7S.js +0 -8
  194. package/dist/chunk-W322YDHS.js +0 -49
  195. package/dist/chunk-WPRLXKWC.js +0 -8
  196. package/dist/chunk-Y5YAP4F3.js +0 -2
  197. package/dist/chunk-YN5X2FTP.js +0 -1
  198. package/dist/chunk-YOCN7GF4.js +0 -1
  199. package/dist/goal-pack-YWPI43QL.js +0 -1
  200. package/dist/project-intelligence-lens-MRQR2LQW.js +0 -1
  201. package/dist/verified-goal-WM34TTGE.js +0 -1
  202. package/dist/workspace-explain-TE2LGOAV.js +0 -1
  203. package/dist/workspace-explain-contract-V2IVSROX.js +0 -1
  204. package/dist/workspace-graph-token-efficiency-2I4X374C.js +0 -1
  205. package/dist/workspace-intelligence-evaluation-CQDKOYZZ.js +0 -1
  206. package/dist/workspace-knowledge-graph-SWCKDTPF.js +0 -1
  207. package/dist/workspace-knowledge-graph-snapshot-M572JRB4.js +0 -1
  208. package/dist/workspace-mcp-serve-IBMTFQDY.js +0 -3
  209. package/dist/workspace-model-ZL6WCICX.js +0 -1
  210. package/dist/workspace-repair-engine-NX7I632M.js +0 -3
  211. package/dist/workspace-run-6GT5OBQ5.js +0 -1
@@ -1,2 +0,0 @@
1
- import {b as b$1}from'./chunk-B6FJ6RG6.js';import {k,q}from'./chunk-GQSRNUCU.js';import {a}from'./chunk-P5PSZQPB.js';import {c,q as q$1,m as m$1}from'./chunk-J7QYANXK.js';import {e,f as f$1}from'./chunk-X6TNBARH.js';import {b}from'./chunk-UJXE4UAX.js';import {l,s,j as j$1,t,k as k$2}from'./chunk-MOSXTVPU.js';import ce,{promises}from'fs';import c$1 from'path';import T,{homedir}from'os';import {pathToFileURL}from'url';import m from'process';import k$1 from'fs-extra';function z(o){let t=o.label.indexOf(" \u2014 ");return t>=0?o.label.slice(t+3).trim():o.label.trim()}function Q(){let o=c().map(n=>({value:n.id,label:`${K(n.category)} \xB7 ${z(n)}`,hint:`${n.runtime} \xB7 tested baseline`,name:n.label})),e=k().map(n=>({value:n.kitId,label:`Frontend \xB7 ${n.displayName}`,hint:"official \xB7 latest stable",name:`${n.displayName} \u2014 ${n.framework}`})),t=q().map(n=>({value:n.kitId,label:`${K(n.category)} \xB7 ${n.displayName}`,hint:`${n.runtimeCandidates.join(" + ")} \xB7 official latest stable`,name:`${n.displayName} \u2014 ${n.category}`})),i=[...o,...e,...t].sort((n,r)=>{let s=["Backend","Frontend","Desktop","Extension"],a=n.label?.split(" \xB7 ")[0]??"",l=r.label?.split(" \xB7 ")[0]??"";return s.indexOf(a)-s.indexOf(l)||(n.label??"").localeCompare(r.label??"")});return D(i),i}function K(o){return o.charAt(0).toUpperCase()+o.slice(1)}function D(o){let e=new Set,t=new Set;for(let i of o){let n=i.label??i.name??String(i.value),r=String(i.value);if(e.has(n))throw new Error(`Duplicate kit picker label: ${n}`);if(t.has(r))throw new Error(`Duplicate kit picker value: ${r}`);e.add(n),t.add(r);}}var Z=".workspairc.json",ee=".rapidkitrc.json",oe=["workspai.config.js","workspai.config.mjs","workspai.config.cjs","rapidkit.config.js","rapidkit.config.mjs","rapidkit.config.cjs"],te=["workspai.config.json","rapidkit.config.json"];function U(o){return typeof o=="object"&&o!==null&&"code"in o&&o.code==="ENOENT"}function R(o,e){let t=e instanceof Error?e.message:String(e),i=o.endsWith(".js")&&/module is not defined in ES module scope/i.test(t)?' CommonJS syntax in a .js config is not valid when the project package uses "type": "module"; rename the file to .cjs or use export default.':"";return `Failed to load Workspai config at ${o}.${i} Cause: ${t}`}async function Qe(){for(let o of [c$1.join(T.homedir(),Z),c$1.join(T.homedir(),ee)])try{let e$1=await promises.readFile(o,"utf-8"),t=JSON.parse(e$1);return e.debug(`Loaded config from ${o}`),t}catch{}return e.debug("No user config found, using defaults"),{}}async function Xe(o=process.cwd(),e$1={}){let t=o,i=c$1.parse(t).root;for(;t!==i;){for(let n of te){let r=c$1.join(t,n);try{let s=await promises.readFile(r,"utf-8"),a=JSON.parse(s);if(!a||typeof a!="object"||Array.isArray(a))throw new Error("configuration root must be a JSON object");return e.debug(`Loaded data-only Workspai config from ${n}`),a}catch(s){if(U(s))continue;throw new Error(R(r,s))}}for(let n of oe){let r=c$1.join(t,n);try{await promises.access(r);}catch(s){if(U(s))continue;throw new Error(R(r,s))}if(e.debug(`Found config file: ${r}`),!e$1.trustExecutableConfig)throw new Error(`Refusing to execute Workspai config at ${r} without explicit trust. Use a data-only workspai.config.json file, pass --trust-config, or set WORKSPAI_TRUST_CONFIG=1.`);try{let a=await import(pathToFileURL(r).href),l=a.default||a;return e.debug(`Loaded Workspai config from ${n}`),l}catch(s){throw new Error(R(r,s))}}t=c$1.dirname(t);}return e.debug("No Workspai config file found, using defaults"),{}}function Ze(o,e,t){return {author:t.author||e.workspace?.defaultAuthor||o.author,pythonVersion:t.pythonVersion||e.workspace?.pythonVersion||o.pythonVersion,defaultInstallMethod:t.defaultInstallMethod||e.workspace?.installMethod||o.defaultInstallMethod,defaultKit:t.defaultKit||e.projects?.defaultKit||o.defaultKit,skipGit:t.skipGit??e.projects?.skipGit??o.skipGit,license:t.license||o.license,testRapidKitPath:t.testRapidKitPath||o.testRapidKitPath}}function eo(o){return f$1("DEV_PATH")||o.testRapidKitPath||void 0}var x=class extends Error{constructor(t,i){super(["Workspai workspaces cannot be nested.",`Target: ${t}`,`Containing workspace: ${i}`,"Choose Managed home or pass --output <path> with a location outside the current workspace."].join(`
2
- `));this.targetPath=t;this.containingWorkspacePath=i;this.name="NestedWorkspaceCreationError";}targetPath;containingWorkspacePath;code="WORKSPACE_NESTING_NOT_SUPPORTED"};async function ie(o){try{return !!await k$1.stat(o)}catch{return false}}function re(o,e){let t=o.indexOf(e);if(t>=0&&t+1<o.length)return o[t+1];let i=o.find(n=>n.startsWith(`${e}=`));if(i)return i.slice(e.length+1)}function se(o){return o.includes("--here")}async function G(o){let e=c$1.resolve(o);for(;;){let t=[c$1.join(e,".workspai-workspace"),c$1.join(e,".rapidkit-workspace"),c$1.join(e,".workspai","workspace.json"),c$1.join(e,".rapidkit","workspace.json")];if((await Promise.all(t.map(ie))).some(Boolean))return e;let i=c$1.dirname(e);if(i===e)return;e=i;}}async function po(o){let e=c$1.resolve(o),t=await G(c$1.dirname(e));if(t)throw new x(e,t)}async function ae(o,e=homedir()){let i=[{value:"managed",label:"Managed home",hint:k$2(e)}];return await G(o)||i.push({value:"here",label:"Current directory",hint:o}),i}function J(o,e=m.cwd()){if(se(o))return c$1.resolve(e);let t=re(o,"--output");if(t)return c$1.resolve(t)}function uo(o,e=m.cwd()){let t=c$1.resolve(o),i=c$1.resolve(e),n=c$1.relative(i,t);return n.length>0&&!n.startsWith("..")&&!c$1.isAbsolute(n)?`cd ${n}`:`cd ${t}`}function mo(o,e={}){let t=e.argv??[],i=e.outputParent??J(t,m.cwd());return l(o.trim(),{homeDir:e.homeDir,outputDir:i})}function fo(o,e,t={}){return o?c$1.resolve(o)===c$1.resolve(e)?true:t.outputParent===void 0:false}async function go(o,e={}){let t=e.cwd??m.cwd(),i=e.homeDir??homedir(),n=J(o,t);if(n!==void 0)return n;let r=e.hasYes??(o.includes("--yes")||o.includes("-y"));if(!(e.interactive??(!r&&!!m.stdin.isTTY&&!b())))return;let a=await ae(t,i);if(a.length===1)return;let{location:l}=await b$1([{type:"rawlist",name:"location",message:"Where should the workspace be created?",choices:a,default:0}]);if(l==="here")return c$1.resolve(t)}var pe=["minimal","python-only","node-only","go-only","java-only","dotnet-only","polyglot","enterprise"],de=new Set(["minimal","node-only","go-only","java-only","dotnet-only"]),xo=new Set(["python-only","polyglot","enterprise"]);function ue(o){return typeof o=="string"&&pe.includes(o)}function jo(o){return ue(o)&&de.has(o)}var Y={"python-only":"python","node-only":"node","go-only":"go","java-only":"java","dotnet-only":"dotnet"},me={python:"Python",node:"Node",go:"Go",java:"Java",dotnet:".NET",php:"PHP",ruby:"Ruby",rust:"Rust",elixir:"Elixir",clojure:"Clojure",scala:"Scala",kotlin:"Kotlin",deno:"Deno",bun:"Bun",c:"C",cpp:"C++",unknown:"Unknown"},fe={python:"python-only",node:"node-only",go:"go-only",java:"java-only",dotnet:"dotnet-only"},V=["node","deno","bun","python","go","java","kotlin","scala","dotnet","php","ruby","rust","elixir","clojure","c","cpp","unknown"];function j(o){return o==="bun"||o==="deno"?"node":o==="kotlin"||o==="scala"?"java":o}function E(o){return typeof o!="string"||o.trim().length===0?"minimal":o.trim().toLowerCase()}function f(o){if(typeof o!="string")return "unknown";let e=o.trim().toLowerCase();return e==="python"||e==="node"||e==="go"||e==="java"||e==="dotnet"||e==="php"||e==="ruby"||e==="rust"||e==="elixir"||e==="clojure"||e==="scala"||e==="kotlin"||e==="deno"||e==="bun"||e==="c"||e==="cpp"?e:e==="c++"||e==="cplusplus"||e==="cc"||e==="clang++"||e==="g++"?"cpp":e==="clang"||e==="gcc"?"c":"unknown"}function P(o){let e=new Set;for(let t of o)e.add(f(t));return [...e].sort((t,i)=>V.indexOf(t)-V.indexOf(i))}function ge(o){let e=P(o).filter(t=>t!=="unknown");if(e.length!==0)return e.length===1?fe[e[0]]:"polyglot"}function H(o,e={}){return `npx workspai bootstrap --profile ${o}${e.ci?" --ci --json":""}`}function ke(o,e){return o?"none":e==="strict"?"error":"warning"}function g(o){let e=o.ok?void 0:ge(o.runtimes)??"polyglot";return {ok:o.ok,checkId:o.checkId,status:o.ok?"passed":"failed",profile:o.profile,runtimes:o.runtimes,message:o.message,recommendedProfile:e,recommendedCommand:e?H(e):void 0,ciRecommendedCommand:e?H(e,{ci:true}):void 0,severity:ke(o.ok,o.mode)}}function Eo(o){let e=E(o.profile),t=P(o.runtimes),i=o.mode??"warn",n=Y[e];if(n){let r=t.length===0||t.every(s=>j(s)===n);return g({ok:r,checkId:`profile.${e}`,profile:e,runtimes:t,message:r?`${e} profile validated for discovered projects.`:`${e} profile mismatch: detected runtimes [${t.join(", ")}].`,mode:i})}if(e==="minimal"){let r=t.filter(l=>l!=="unknown"),a=new Set(r.map(l=>j(l))).size<=1;return g({ok:a,checkId:"profile.minimal",profile:e,runtimes:t,message:a?"minimal profile is compatible with detected runtime mix.":`minimal profile mismatch: multiple runtimes detected [${r.join(", ")}].`,mode:i})}return g({ok:true,checkId:`profile.${e}`,profile:e,runtimes:t,message:`${e} profile accepts the detected runtime mix.`,mode:i})}function vo(o){let e=E(o.profile),t=f(o.runtime),i=o.mode??"warn",n=Y[e];if(!n||t==="unknown")return g({ok:true,checkId:`profile.${e}`,profile:e,runtimes:[t],message:t==="unknown"?`Project "${o.subjectLabel}" runtime is unknown; profile compatibility will be checked by workspace doctor.`:`${e} profile accepts project "${o.subjectLabel}".`,mode:i});let r=j(t)===n;return g({ok:r,checkId:`profile.${e}`,profile:e,runtimes:r?[t]:P([n,t]),message:r?`Project "${o.subjectLabel}" is compatible with workspace profile "${e}".`:`Project "${o.subjectLabel}" is ${me[t]}, but workspace profile is "${e}".`,mode:i})}async function Fo(o){let e=(await Promise.all(s(o,"policies.yml").map(async t=>await k$1.pathExists(t)?t:null))).find(t=>typeof t=="string");if(!e)return "warn";try{return (await k$1.readFile(e,"utf-8")).match(/^\s*mode:\s*(warn|strict)\s*(?:#.*)?$/m)?.[1]==="strict"?"strict":"warn"}catch{return "warn"}}async function Io(o){let e=(await Promise.all(s(o,"workspace.json").map(async t=>await k$1.pathExists(t)?t:null))).find(t=>typeof t=="string");if(!e)return "minimal";try{let t=await k$1.readJson(e);return E(t.profile)}catch{return "minimal"}}async function $o(o,e={}){let t$1=new Set,i=[],n=new Set,r=[o];for(;r.length>0;){let s=r.pop();if(!s||n.has(s))continue;n.add(s);let a=[];try{a=await ce.promises.readdir(s,{withFileTypes:true});}catch{continue}for(let l of a){if(!l.isDirectory()||l.name.startsWith(".")||["node_modules","dist","build","target","coverage","htmlcov"].includes(l.name))continue;let p=c$1.join(s,l.name);if(p!==o&&j$1(p))continue;if((await Promise.all([...t(p,"context.json"),...t(p,"project.json")].map(async q=>k$1.pathExists(q)))).some(Boolean)){i.push(p);continue}r.push(p);}}for(let s of i){let a=q$1(s);t$1.add(f(m$1(s,a).runtime));}for(let s of await a(o))t$1.add(f(s.runtime));for(let s of e.additionalRuntimes??[])t$1.add(f(s));return P(t$1)}function Ao(o,e={}){let t=e.ci?o.ciRecommendedCommand:o.recommendedCommand;return t?`Recommended: ${t}`:null}export{Q as a,Qe as b,Xe as c,Ze as d,eo as e,po as f,uo as g,mo as h,fo as i,go as j,xo as k,jo as l,Eo as m,vo as n,Fo as o,Io as p,$o as q,Ao as r};
@@ -1 +0,0 @@
1
- import {k,q}from'./chunk-GQSRNUCU.js';import {b as b$2,c as c$2,a as a$4}from'./chunk-SWGSFLTC.js';import {a as a$2}from'./chunk-27UR373Z.js';import {a as a$6}from'./chunk-HTYMXMQM.js';import {a as a$1,p,d,g,f as f$3,e as e$2}from'./chunk-P5PSZQPB.js';import {c,b as b$1,q as q$1,m,G,n,l,k as k$1}from'./chunk-J7QYANXK.js';import {a as a$3}from'./chunk-GR6442P7.js';import {f as f$2,d as d$2,a as a$5,e as e$1}from'./chunk-CCDGHPEJ.js';import {a}from'./chunk-Y5YAP4F3.js';import {d as d$1,c as c$1}from'./chunk-EWZZUQBR.js';import {f,e,i,h}from'./chunk-NZ3WZYD5.js';import {s}from'./chunk-MOSXTVPU.js';import f$1 from'path';import S from'fs-extra';import Rt from'crypto';import {createRequire}from'module';var Et=new Set(c().map(e=>e.id)),Wt=[...k().map(e=>({id:e.kitId,aliases:[...e.aliases],ecosystem:e.framework,plannerFramework:e.id,runtime:"node",runtimeCandidates:["node"],workspacePythonEngine:"none",status:"available",canExecuteCreate:true,versionPolicy:e.versionPolicy,officialCommands:[e.commandDisplay("<name>",{skipGit:false,skipInstall:false})],adoptAfterCreate:true,...e.minNodeVersion?{runtimeRequirements:{node:`>=${e.minNodeVersion}`}}:e.minNodeMajor?{runtimeRequirements:{node:`>=${e.minNodeMajor}`}}:{}})),...q().map(e=>({id:e.kitId,aliases:[...e.aliases],ecosystem:e.framework,plannerFramework:e.framework,runtime:e.runtime,runtimeCandidates:[...e.runtimeCandidates],workspacePythonEngine:"none",status:"available",canExecuteCreate:true,versionPolicy:e.versionPolicy,officialCommands:[e.commandDisplay("<name>",{skipGit:false,skipInstall:false})],adoptAfterCreate:true,...e.nodeSupport?{runtimeRequirements:{node:e.nodeSupport.requirement}}:{}})),{id:"wordpress-site",aliases:["wordpress","wordpress-site","wp","wp-site"],ecosystem:"wordpress",plannerFramework:"wordpress",runtime:"php",runtimeCandidates:["php"],workspacePythonEngine:"none",status:"planned",canExecuteCreate:false,versionPolicy:"planned",officialCommands:["wp core download","wp config create","wp db create","wp core install"],adoptAfterCreate:true},{id:"wordpress-block",aliases:["wordpress-block","wp-block","gutenberg-block"],ecosystem:"wordpress",plannerFramework:"wordpress",runtime:"node",runtimeCandidates:["node","php"],workspacePythonEngine:"none",status:"planned",canExecuteCreate:false,versionPolicy:"planned",officialCommands:["npx @wordpress/create-block@latest <slug>"],adoptAfterCreate:true},{id:"symfony",aliases:["symfony","php-symfony"],ecosystem:"php",plannerFramework:"symfony",runtime:"php",runtimeCandidates:["php"],workspacePythonEngine:"none",status:"planned",canExecuteCreate:false,versionPolicy:"planned",officialCommands:["composer create-project symfony/skeleton <name>"],adoptAfterCreate:true},{id:"rails",aliases:["rails","ruby-on-rails","ruby-rails"],ecosystem:"ruby",plannerFramework:"rails",runtime:"ruby",runtimeCandidates:["ruby"],workspacePythonEngine:"none",status:"planned",canExecuteCreate:false,versionPolicy:"planned",officialCommands:["rails new <name>"],adoptAfterCreate:true}],K=new Map;for(let e of Wt){K.set(e.id,e);for(let t of e.aliases)K.set(t,e);}var xt=new Set(["php","ruby","rust","elixir","clojure","scala","kotlin","unknown"]);function _(e){return e?.trim().toLowerCase()||void 0}function rt(e){let t=_(e.kitId)??_(e.framework)??_(e.runtime)??"unknown";if(e.projectExists)return {lane:"existing",status:"available",canExecuteCreate:false,requested:t,reason:"Existing projects enter Workspace Intelligence through adopt/import."};let r=e.kitId?b$1(e.kitId):void 0;if(r&&Et.has(r))return {lane:"native",status:"available",canExecuteCreate:true,requested:t,resolved:r,reason:"Workspai owns the create contract, project marker, registry, doctor, and workspace model path."};let s=K.get(t)??K.get(_(e.framework)??"")??K.get(_(e.runtime)??"");if(s)return {lane:"official",status:s.status,canExecuteCreate:s.canExecuteCreate,requested:t,resolved:s.id,officialCommands:s.officialCommands,fallbackLane:s.canExecuteCreate?void 0:"existing",reason:s.status==="available"?"Workspai runs the official ecosystem generator, then registers the project in Workspace Intelligence.":"Official generator support is planned but not enabled; use adopt/import until Workspai owns the post-create contract."};let o=_(e.runtime);return o&&xt.has(o)?{lane:"existing",status:"available",canExecuteCreate:false,requested:t,resolved:o,reason:"Runtime can be governed through Workspace Intelligence, but native create is not supported."}:{lane:"existing",status:"available",canExecuteCreate:false,requested:t,reason:"No native create contract is available; use adopt/import to enter Workspace Intelligence."}}function Er(e){return !e.canExecuteCreate&&(e.lane==="official"||e.lane==="existing"&&e.resolved!==void 0)}var Ar="rapidkit-freshness-metadata-v1";function he(e){if(Array.isArray(e))return e.map(t=>he(t));if(e&&typeof e=="object"){let t={};for(let r of Object.keys(e).sort())t[r]=he(e[r]);return t}return e}function At(e){return JSON.stringify(he(e))}function $(e){return Rt.createHash("sha256").update(At(e)).digest("hex")}var nt=".workspai/workspace-graph.overrides.json",Mt=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs"]),It=new Set([".git",".hg",".svn",".workspai",".rapidkit",".venv","node_modules","dist","build","out","target","coverage","htmlcov",".next",".turbo",".cache"]),st=600,at=5,Ft=256*1024,ot={inferred:1,contract:2,manual:3};function Dt(e){return e.split(f$1.sep).join("/")}function te(e,t){return Dt(f$1.relative(e,t)||".")}function it(e){let t=new Map;for(let r of e.projects)t.has(r.name)||t.set(r.name,{id:r.name,path:r.path,...r.runtime?{runtime:r.runtime}:{},...r.framework?{framework:r.framework}:{},...r.kind?{kind:r.kind}:{}});return [...t.values()].sort((r,s)=>r.id.localeCompare(s.id))}function ct(e,t){let r=new Map,s=new Map;for(let n of t.projects){if(r.has(n.name))continue;let i=n.absolutePath?f$1.resolve(n.absolutePath):f$1.resolve(e,n.path);r.set(n.name,i),s.has(i)||s.set(i,n.name);}let o=[...s.entries()].map(([n,i])=>({dir:n,id:i})).sort((n,i)=>i.dir.length-n.dir.length||n.dir.localeCompare(i.dir));return {idToDir:r,dirToId:s,sortedDirs:o}}function re(e,t){let r=f$1.resolve(t);for(let{dir:s,id:o}of e.sortedDirs)if(r===s||r.startsWith(`${s}${f$1.sep}`))return o;return null}async function we(e){try{if(!await S.pathExists(e))return null;let t=await S.readJSON(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:null}catch{return null}}async function be(e){try{return await S.pathExists(e)?await S.readFile(e,"utf8"):null}catch{return null}}async function dt(e,t){let r=[],s=new Map;for(let[o,n]of t.idToDir.entries()){let i=await we(f$1.join(n,"package.json")),a=typeof i?.name=="string"?i.name.trim():"";a&&!s.has(a)&&s.set(a,o);}for(let[o,n]of t.idToDir.entries()){let i=await we(f$1.join(n,"package.json"));if(i){let a=["dependencies","devDependencies","peerDependencies","optionalDependencies"],c=new Set;for(let d of a){let u=i[d];if(!(!u||typeof u!="object"||Array.isArray(u)))for(let p of Object.keys(u)){let l=s.get(p);!l||l===o||c.has(l)||(c.add(l),r.push({from:o,to:l,kind:"package-dep",source:"inferred",confidence:"high",evidence:[{file:te(e,f$1.join(n,"package.json")),detail:`declares dependency ${p}`}]}));}}}r.push(...await Ot(e,t,o,n)),r.push(...await Gt(e,t,o,n));}return r}async function Ot(e,t,r,s){let o=await be(f$1.join(s,"pyproject.toml"));if(!o)return [];let n=[],i=new Set,a=/path\s*=\s*["']([^"']+)["']/g,c;for(;(c=a.exec(o))!==null;){let d=re(t,f$1.resolve(s,c[1]));!d||d===r||i.has(d)||(i.add(d),n.push({from:r,to:d,kind:"package-dep",source:"inferred",confidence:"high",evidence:[{file:te(e,f$1.join(s,"pyproject.toml")),detail:`path dependency ${c[1]}`}]}));}return n}async function Gt(e,t,r,s){let o=await be(f$1.join(s,"go.mod"));if(!o)return [];let n=[],i=new Set,a=/replace\s+\S+\s+=>\s+(\.[^\s]+)/g,c;for(;(c=a.exec(o))!==null;){let d=re(t,f$1.resolve(s,c[1]));!d||d===r||i.has(d)||(i.add(d),n.push({from:r,to:d,kind:"package-dep",source:"inferred",confidence:"high",evidence:[{file:te(e,f$1.join(s,"go.mod")),detail:`go.mod replace ${c[1]}`}]}));}return n}async function _t(e,t){let r=[],s=[e];for(;s.length>0&&r.length<t;){let o=s.shift();if(!o)continue;let n=[];try{n=await S.readdir(o,{withFileTypes:true});}catch{continue}let i=[],a=[];for(let c of n)if(c.isDirectory()){if(It.has(c.name)||a$3(c.name)||c.name.startsWith("."))continue;i.push(f$1.join(o,c.name));}else c.isFile()&&Mt.has(f$1.extname(c.name))&&a.push(f$1.join(o,c.name));a.sort((c,d)=>c.localeCompare(d)),i.sort((c,d)=>c.localeCompare(d));for(let c of a){if(r.length>=t)break;r.push(c);}s.push(...i);}return r}var Tt=[/\bfrom\s+["']([^"']+)["']/g,/\bimport\s+["']([^"']+)["']/g,/\bimport\s*\(\s*["']([^"']+)["']\s*\)/g,/\brequire\s*\(\s*["']([^"']+)["']\s*\)/g];function Nt(e){let t=new Set;for(let r of Tt){r.lastIndex=0;let s;for(;(s=r.exec(e))!==null;){let o=s[1];o.startsWith(".")&&t.add(o);}}return [...t]}async function ve(e,t,r,s){let o=new Map;for(let[n,i]of t.idToDir.entries()){if(s&&!s.has(n))continue;let a=await _t(i,r);for(let c of a){let d=await S.stat(c).catch(()=>null);if(!d||d.size>Ft)continue;let u=await be(c);if(u)for(let p of Nt(u)){let l=f$1.resolve(f$1.dirname(c),p),m=re(t,l);if(!m||m===n)continue;let w=`${n}\0${m}`,h=o.get(w);h||(h={from:n,to:m,evidence:[]},o.set(w,h)),h.evidence.length<at&&h.evidence.push({file:te(e,c),detail:`imports ${p}`});}}}return [...o.values()].map(n=>({from:n.from,to:n.to,kind:"code-import",source:"inferred",confidence:"medium",evidence:n.evidence}))}function $t(e,t,r){let s=new Map;for(let o of r.projects){let n=Vt(e,t,o);n&&s.set(o.slug,n);}return s}function Vt(e,t,r){let s=[r.relativePath,r.externalPath].filter(o=>typeof o=="string"&&o.length>0);for(let o of s){let n=f$1.resolve(e,o),i=t.dirToId.get(n)??re(t,n);if(i)return i}return t.idToDir.has(r.slug)?r.slug:null}function pt(e,t,r){let s=[],o=$t(e,t,r),n=g,i=new Map,a=new Map;for(let c of r.projects){let d=o.get(c.slug);if(!d)continue;let u=c.contracts??{publishes:[],consumes:[],dependsOn:[]};for(let p of u.dependsOn??[]){let l=o.get(p);!l||l===d||s.push({from:d,to:l,kind:"service-dependsOn",source:"contract",confidence:"high",evidence:[{file:n,detail:`dependsOn ${p}`}]});}for(let p of u.publishes??[])i.has(p)||i.set(p,new Set),i.get(p)?.add(d);for(let p of u.consumes??[])a.has(p)||a.set(p,new Set),a.get(p)?.add(d);}for(let[c,d]of i.entries()){let u=a.get(c);if(u)for(let p of u)for(let l of d)p!==l&&s.push({from:p,to:l,kind:"event-pub-sub",source:"contract",confidence:"high",evidence:[{file:n,detail:`consumes event ${c}`}]});}return s.push(...Ht(r,o)),s}function ke(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function Ht(e,t){let r=[],s=e.projects.map(o=>({project:o,id:t.get(o.slug)})).filter(o=>!!o.id).filter(o=>ke(o.project.slug).length>=3);for(let o of e.projects){let n=t.get(o.slug);if(!n)continue;let i=o.contracts?.env??[];if(i.length===0)continue;let a=new Set;for(let c of i){let d=ke(c);for(let u of s)u.id===n||a.has(u.id)||!(d.includes(ke(u.project.slug))&&(u.project.ports?.length??0)>0)||(a.add(u.id),r.push({from:n,to:u.id,kind:"shared-resource",source:"inferred",confidence:"low",evidence:[{file:g,detail:`env ${c} references ${u.project.slug}`}]}));}}return r}async function lt(e,t){let r=await we(f$1.join(e,nt)),s=Array.isArray(r?.edges)?r?.edges:[],o=[],n=new Set(f$3);for(let i of s){if(!i||typeof i!="object"||Array.isArray(i))continue;let a=i,c=typeof a.from=="string"?a.from:"",d=typeof a.to=="string"?a.to:"",u=typeof a.kind=="string"?a.kind:"";if(!t.has(c)||!t.has(d)||c===d||!n.has(u))continue;let p=Array.isArray(a.evidence)?a.evidence.map(l=>l&&typeof l=="object"&&typeof l.file=="string"?{file:l.file,...typeof l.detail=="string"?{detail:l.detail}:{}}:null).filter(l=>!!l):[];o.push({from:c,to:d,kind:u,source:"manual",confidence:"high",evidence:p.length>0?p:[{file:nt,detail:"manual edge"}]});}return o}function Bt(e){return `${e.from}\0${e.to}\0${e.kind}`}function Kt(e){let t=new Set,r=[];for(let s of e){let o=`${s.file}\0${s.detail??""}`;t.has(o)||(t.add(o),r.push(s));}return r.sort((s,o)=>s.file.localeCompare(o.file)||(s.detail??"").localeCompare(o.detail??"")).slice(0,at)}function Lt(e){let t=new Map;for(let r of e){let s=Bt(r),o=t.get(s);if(!o){t.set(s,{...r,evidence:[...r.evidence]});continue}let n=ot[o.source],i=ot[r.source];i>n?t.set(s,{...r,evidence:[...r.evidence,...o.evidence]}):i===n&&o.evidence.push(...r.evidence);}return [...t.values()].map(r=>({from:r.from,to:r.to,kind:r.kind,source:r.source,confidence:r.confidence,evidence:Kt(r.evidence)})).sort((r,s)=>r.from.localeCompare(s.from)||r.to.localeCompare(s.to)||r.kind.localeCompare(s.kind)||r.source.localeCompare(s.source))}function ye(e){return Math.round(e*1e3)/1e3}function Ut(e){return Math.max(0,Math.min(100,Math.round(e)))}function zt(e){return e>=75?"critical":e>=50?"high":e>=20?"medium":"low"}function qt(e){return e==="critical"||e==="high"?"strict":e==="medium"?"elevated":"normal"}function Jt(e,t){let r=a$6({nodes:e,edges:t}),s=new Map;for(let o of e){let n=r.byId.get(o.id)??{fanIn:0,fanOut:0,reach:0,betweenness:0,isHotspot:false},i=t.filter(m=>m.from===o.id||m.to===o.id),a=i.filter(m=>m.source==="contract"||m.source==="manual").length,c=i.filter(m=>m.confidence==="low").length,d=[],u=n.reach*20+n.fanIn*14+n.fanOut*8+Math.min(20,n.betweenness*4)+a*8;n.isHotspot&&(u+=24,d.push("Critical-path hotspot in dependency graph")),n.reach>0&&d.push(`Change reaches ${n.reach} dependent project(s)`),n.fanIn>0&&d.push(`${n.fanIn} direct dependent project(s)`),n.fanOut>0&&d.push(`${n.fanOut} direct dependency project(s)`),a>0&&d.push(`${a} contract/manual edge(s)`),c>0&&d.push(`${c} low-confidence inferred edge(s) need review`),i.length===0&&d.push(e.length===1?"Single-project workspace; inter-project dependency edges are not applicable":"No dependency evidence connected to this project yet");let p=Ut(u),l=zt(p);s.set(o.id,{weight:l,score:p,verificationPriority:qt(l),reasons:d.slice(0,5),centrality:{fanIn:n.fanIn,fanOut:n.fanOut,reach:n.reach,betweenness:n.betweenness,isHotspot:n.isHotspot}});}return s}function Xt(e,t){let r=Jt(e,t);return e.map(s=>({...s,operationalProfile:r.get(s.id)}))}function Yt(e,t){let r=new Set;for(let c of t)r.add(c.from),r.add(c.to);let s=e.length,o=t.length,n=e.filter(c=>r.has(c.id)).length,i=Math.max(0,s-n),a=a$6({nodes:e,edges:t});return {nodeCount:s,edgeCount:o,inferredEdges:t.filter(c=>c.source==="inferred").length,contractEdges:t.filter(c=>c.source==="contract").length,manualEdges:t.filter(c=>c.source==="manual").length,authoritativeEdges:t.filter(c=>c.source==="contract"||c.source==="manual").length,lowConfidenceEdges:t.filter(c=>c.confidence==="low").length,orphanCount:i,connectedNodeCount:n,density:ye(s>1?o/(s*(s-1)):0),edgeCoverageRatio:ye(s>0?n/s:1),evidenceCoverageRatio:ye(o>0?t.filter(c=>c.evidence.length>0).length/o:1),hotspotCount:a.hotspots.length,hasCycle:Zt(e,t)}}function Qt(e,t,r){let s=[],o=e.filter(n=>!t.some(i=>i.from===n.id||i.to===n.id)).map(n=>n.id).sort((n,i)=>n.localeCompare(i));return r.nodeCount===0&&s.push({code:"graph.empty",severity:"info",message:"Workspace model has no projects, so dependency reasoning is unavailable.",recommendation:"Import, scaffold, or register projects before relying on graph-aware impact."}),r.nodeCount>1&&r.edgeCount===0?s.push({code:"graph.edges.missing",severity:"warning",message:"Projects were detected, but no inter-project dependency edges were found.",recommendation:"Run graph explain, add workspace contract relationships, or define manual graph overrides for operational dependencies that code imports cannot reveal.",nodeIds:o}):r.nodeCount>1&&r.orphanCount>0&&s.push({code:"graph.orphans.detected",severity:"warning",message:`${r.orphanCount} project(s) have no dependency evidence connected to the graph.`,recommendation:"Review isolated projects and add package, contract, or manual edges when they participate in release-critical flows.",nodeIds:o.slice(0,12)}),r.lowConfidenceEdges>0&&s.push({code:"graph.low_confidence_edges",severity:"info",message:`${r.lowConfidenceEdges} inferred edge(s) are low confidence.`,recommendation:"Promote important low-confidence relationships to workspace contract or manual overrides."}),r.edgeCount>0&&r.evidenceCoverageRatio<1&&s.push({code:"graph.evidence.partial",severity:"warning",message:"Some dependency edges do not include file-level evidence.",recommendation:"Attach evidence to manual overrides so agents can audit why a relationship exists."}),r.hasCycle&&s.push({code:"graph.cycle.detected",severity:"error",message:"The dependency graph contains at least one directed cycle.",recommendation:"Break the cycle or document the relationship explicitly before using graph-aware release gates."}),s.sort((n,i)=>{let a={error:0,warning:1,info:2};return a[n.severity]-a[i.severity]||n.code.localeCompare(i.code)})}function Zt(e,t){let r=new Map;for(let c of e)r.set(c.id,[]);for(let c of t)r.has(c.from)||r.set(c.from,[]),r.get(c.from)?.push(c.to);let s=0,o=1,n=2,i=new Map;for(let c of r.keys())i.set(c,s);let a=c=>{let d=[{id:c,index:0}];for(i.set(c,o);d.length>0;){let u=d[d.length-1],p=r.get(u.id)??[];if(u.index>=p.length){i.set(u.id,n),d.pop();continue}let l=p[u.index];u.index+=1;let m=i.get(l)??s;if(m===o)return true;m===s&&(i.set(l,o),d.push({id:l,index:0}));}return false};for(let c of [...r.keys()].sort())if(i.get(c)===s&&a(c))return true;return false}function ut(e,t,r,s){let o=Lt(r.filter(c=>t.has(c.from)&&t.has(c.to))),n=Xt(e,o),i=Yt(e,o),a=Qt(e,o,i);return {schemaVersion:e$2,generatedAt:(s??new Date).toISOString(),nodes:n,edges:o,stats:i,...a.length>0?{diagnostics:a}:{}}}async function mt(e){let t=f$1.resolve(e.workspacePath),r=e.maxImportFilesPerProject??st,s=it(e.model),o=new Set(s.map(a=>a.id)),n=ct(t,e.model),i=[];return i.push(...await dt(t,n)),i.push(...await ve(t,n,r)),e.contract&&i.push(...pt(t,n,e.contract)),i.push(...await lt(t,o)),ut(s,o,i,e.now)}async function ft(e){let t=f$1.resolve(e.workspacePath),r=e.maxImportFilesPerProject??st,s=it(e.model),o=new Set(s.map(a=>a.id)),n=ct(t,e.model),i=[];if(i.push(...await dt(t,n)),e.structuralChange)i.push(...await ve(t,n,r));else {i.push(...await ve(t,n,r,e.changedProjectIds));for(let a of e.previousGraph.edges)a.kind==="code-import"&&a.source==="inferred"&&!e.changedProjectIds.has(a.from)&&o.has(a.from)&&o.has(a.to)&&i.push({from:a.from,to:a.to,kind:"code-import",source:"inferred",confidence:a.confidence,evidence:a.evidence});}return e.contract&&i.push(...pt(t,n,e.contract)),i.push(...await lt(t,o)),ut(s,o,i,e.now)}var ne="workspace-model-producer.v3";var Pe=h.workspaceModelCache.schemaVersion,je=i.workspaceModelCache,gt=["package.json","pyproject.toml","requirements.txt","go.mod","go.sum","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","composer.json","Gemfile","workspai.project.json",".workspai/project.json",".workspai/context.json","rapidkit.project.json",".rapidkit/project.json",".rapidkit/context.json"],ht=[i.workspaceContract,".workspai/workspace.json","workspai.workspace.json",".workspai/policies.yml",".workspai/policies.yaml",".rapidkit/workspace.contract.json",".rapidkit/workspace.json","rapidkit.workspace.json",".rapidkit/policies.yml",".rapidkit/policies.yaml"],rr=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs"]),nr=new Set([".git",".workspai",".rapidkit","node_modules","dist","build","out","target","coverage",".next",".turbo",".cache",".venv"]),or=1500,L=null;function Ce(){if(L)return L;try{L=createRequire(import.meta.url)("../package.json")?.version??"0.0.0";}catch{L="0.0.0";}return L}async function oe(e){try{let t=await S.readFile(e);return Rt.createHash("sha256").update(t).digest("hex")}catch{return null}}async function sr(e){let t={};for(let o of gt){let n=await oe(f$1.join(e,o));n&&(t[o]=n);}let r=[],s=[e];for(;s.length>0&&r.length<or;){let o=s.shift();if(!o)continue;let n=[];try{n=await S.readdir(o,{withFileTypes:true});}catch{continue}let i=[];for(let a of n)if(a.isDirectory()){if(nr.has(a.name)||a$3(a.name)||a.name.startsWith("."))continue;i.push(f$1.join(o,a.name));}else if(a.isFile()&&rr.has(f$1.extname(a.name))){let c=f$1.join(o,a.name),d=await S.stat(c).catch(()=>null);if(d){let u=f$1.relative(e,c).split(f$1.sep).join("/");r.push(`${u}:${d.size}:${Math.round(d.mtimeMs)}`);}}i.sort((a,c)=>a.localeCompare(c)),s.push(...i);}return r.sort((o,n)=>o.localeCompare(n)),$({manifests:t,source:r})}async function se(e,t){let r=f$1.resolve(e),s={},o=[...new Set(t.map(n=>f$1.relative(r,f$1.resolve(n)).split(f$1.sep).join("/")))].sort((n,i)=>n.localeCompare(i));for(let n of o)s[n]=await sr(f$1.join(r,n));return s}async function ae(e){let t=f$1.resolve(e),r={};for(let s of ht){let o=await oe(f$1.join(t,s));o&&(r[s]=o);}return r}async function ie(e){let t=f$1.resolve(e.workspacePath),r=[...new Set(e.projectPaths.map(n=>f$1.relative(t,f$1.resolve(n)).split(f$1.sep).join("/")))].sort((n,i)=>n.localeCompare(i)),s=[];for(let n of r){let i={};for(let a of gt){let c=await oe(f$1.join(t,n,a));c&&(i[a]=c);}s.push({project:n,manifests:i});}let o={};for(let n of ht){let i=await oe(f$1.join(t,n));i&&(o[n]=i);}return $({cacheSchema:Pe,cliVersion:e.cliVersion,flags:e.flags,workspaceJson:e.workspaceJson??null,marker:e.marker??null,projects:s,workspaceFiles:o})}async function Se(e){let t=await d$2(e,je)??a$5(e,je);try{if(!await S.pathExists(t))return null;let r=await S.readJson(t);return !r||r.schemaVersion!==Pe||r.producerRevision!==ne||typeof r.inputsHash!="string"||typeof r.cliVersion!="string"||!r.model?null:r}catch{return null}}async function ce(e,t){let r={schemaVersion:Pe,producerRevision:ne,...t};return e$1(e,je,r)}var kt="rapidkit-fact-freshness-v1",z={durable:720*60*60,derived:10080*60,evidenceBacked:1440*60,live:300,verifyBeforeUse:1440*60};function ar(e){switch(e){case "durable":return z.durable;case "derived":return z.derived;case "evidence-backed":return z.evidenceBacked;case "live":return z.live;case "verify-before-use":return z.verifyBeforeUse}}function ir(e){if(e.status)return e.status;if(e.ttlSeconds===null)return "unknown";let t=Date.parse(e.generatedAt);if(!Number.isFinite(t))return "unknown";let r=t+e.ttlSeconds*1e3;return e.now.getTime()>r?"stale":"fresh"}function cr(e){let t=e.now??new Date,r=e.generatedAt??t.toISOString(),s=Date.parse(r),o=Number.isFinite(s),n=o?r:t.toISOString(),i=e.ttlSeconds===void 0?ar(e.kind):e.ttlSeconds,a=ir({generatedAt:n,ttlSeconds:i,status:e.status??(o?void 0:"unknown"),now:t}),c=Date.parse(n),d=i===null||!Number.isFinite(c)?void 0:new Date(c+i*1e3),u=e.verifyBeforeUse??(e.kind==="live"||e.kind==="verify-before-use"||e.category!=="structure"||a!=="fresh");return {schemaVersion:kt,kind:e.kind,category:e.category,generatedAt:n,ttlSeconds:i,...d?{expiresAt:d.toISOString()}:{},status:a,verifyBeforeUse:u,...e.sourceArtifact?{sourceArtifact:e.sourceArtifact}:{},...e.sourcePath?{sourcePath:e.sourcePath}:{},inputsHash:e.inputsHash??$(e.value??null),reason:e.reason}}function b(e){return {id:e.id,label:e.label,scope:e.scope,value:e.value,...e.project?{project:e.project}:{},freshness:cr({...e.freshness,value:e.value})}}function yt(e){let t=e.generatedAt??(e.now??new Date).toISOString(),r={durable:0,derived:0,"evidence-backed":0,live:0,"verify-before-use":0},s={structure:0,verification:0,state:0},o=0,n=0,i=0,a=0;for(let c of e.facts)r[c.freshness.kind]+=1,s[c.freshness.category]+=1,c.freshness.status==="stale"&&(o+=1),c.freshness.status==="unknown"&&(n+=1),c.freshness.kind==="live"&&(i+=1),c.freshness.verifyBeforeUse&&(a+=1);return {schemaVersion:kt,generatedAt:t,status:o>0?"stale":n>0?"unknown":"fresh",totalFacts:e.facts.length,staleFacts:o,unknownFacts:n,liveFacts:i,verifyBeforeUseFacts:a,byKind:r,byCategory:s}}var dr=f.model,de=e.model;function Ee(e){return e.projectTopology??e.graph}function vt(e){return !!(e.projectTopology&&e.graph&&c$1(e.projectTopology)===c$1(e.graph))}function xn(e){let t=e.engineStatus==="hit"||e.engineStatus==="unchanged"?"reused":e.engineStatus==="incremental"?"partially-reused":"rebuilt";return {schemaVersion:"workspace-model-build.v1",mode:e.mode,outcome:t,engineStatus:e.engineStatus}}var pr=["package.json","pyproject.toml","requirements.txt","go.mod","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","composer.json","Gemfile","mix.exs","deno.json","deno.jsonc","bun.lock","bun.lockb","bunfig.toml",".bunfig.toml","deps.edn","project.clj","build.sbt","docker-compose.yml","docker-compose.yaml","compose.yml","compose.yaml","terraform.tf"],lr=new Set([".git",".hg",".svn",".workspai",".rapidkit",".venv","node_modules","dist","build","target","coverage","htmlcov",".next",".turbo"]);function bt(e,t){return (f$1.relative(e,t)||".").split(f$1.sep).join("/")}async function jt(e){try{if(!await S.pathExists(e))return null;let t=await S.readJSON(e);return t&&typeof t=="object"?t:null}catch{return null}}async function ur(e,t){for(let r of t)if(await S.pathExists(f$1.join(e,r)))return true;return false}function We(e){let t=Number.parseInt(process.env.RAPIDKIT_WORKSPACE_MODEL_SCAN_DEPTH??"",10),r=typeof e=="number"&&Number.isFinite(e)?e:Number.isFinite(t)?t:4;return Math.min(12,Math.max(1,Math.trunc(r)))}async function xe(e,t){let r=f$1.resolve(e),s=[{dirPath:r,depth:0}],o=new Set,n=new Set;for(;s.length>0;){let i=s.shift();if(!i)continue;let a=f$1.resolve(i.dirPath);if(n.has(a))continue;if(n.add(a),a!==r&&await ur(a,pr)){o.add(a);continue}if(i.depth>=t)continue;let c=[];try{c=await S.readdir(a,{withFileTypes:true});}catch{continue}for(let d of c)!d.isDirectory()||lr.has(d.name)||a$3(d.name)||d.name.startsWith(".")&&d.name!==".config"||s.push({dirPath:f$1.join(a,d.name),depth:i.depth+1});}return Array.from(o).sort((i,a)=>i.localeCompare(a))}function Re(e){let t=new Set,r=[];for(let s of e){let o=f$1.resolve(s);t.has(o)||(t.add(o),r.push(o));}return r.sort((s,o)=>s.localeCompare(o))}function wt(e,t){let r=e?.[t];return typeof r=="string"&&r.trim()?r.trim():void 0}function mr(e,t){return e?.[t]===true}function fr(e,t,r){let s=e?.frontend&&typeof e.frontend=="object"&&!Array.isArray(e.frontend)?e.frontend:void 0,o=wt(s,"generator"),n=wt(s,"command_display"),i=typeof t=="string"&&t.startsWith("frontend.");if(!(!o&&!i))return {...o?{id:o}:{},...t?{kit:t}:{},displayName:r,source:mr(s,"official_generator")?"official-generator":"metadata",...n?{commandDisplay:n}:{}}}async function gr(e){let t=[".workspai/project.json",".workspai/context.json",".rapidkit/project.json",".rapidkit/context.json","package.json","product.json","tsconfig.json","pnpm-workspace.yaml","bunfig.toml",".bunfig.toml","nx.json","turbo.json","pyproject.toml","requirements.txt","go.mod","go.work","go.work.sum","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","rust-toolchain.toml","rust-toolchain","CMakeLists.txt","meson.build","Makefile","WORKSPACE","WORKSPACE.bazel","MODULE.bazel","BUILD","BUILD.bazel",".bazelrc","composer.json","Gemfile","mix.exs","deno.json","setup.py","setup.cfg","Dockerfile","docker-compose.yml","docker-compose.yaml","compose.yml","compose.yaml","README.md"],r=[];for(let o of t)await S.pathExists(f$1.join(e,o))&&r.push(o);let s=new Set(["package.json","pyproject.toml","go.mod","go.work","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","CMakeLists.txt","meson.build","composer.json","Gemfile","mix.exs","deno.json"]);if(!r.some(o=>s.has(o))){let o=[],n=new Set([".git",".workspai",".rapidkit",".venv","build","dist","node_modules","target","third_party","vendor"]),i=(p,l)=>{let m=p.toLowerCase();return ["package.json","pyproject.toml","go.mod","pom.xml","build.gradle","build.gradle.kts","cargo.toml","cmakelists.txt","meson.build","composer.json","gemfile","mix.exs","deno.json"].includes(m)||m.endsWith(".gemspec")||m==="description"&&l.toLowerCase()==="r"},a=async(p,l)=>{if(l>3||o.length>=512)return;let m=await S.readdir(p,{withFileTypes:true}).catch(()=>[]);for(let w of m.sort((h,E)=>h.name.localeCompare(E.name))){if(o.length>=512)return;w.isFile()&&i(w.name,f$1.basename(p))?o.push(f$1.relative(e,f$1.join(p,w.name)).split(f$1.sep).join("/")):w.isDirectory()&&!n.has(w.name)&&await a(f$1.join(p,w.name),l+1);}};await a(e,0);let c=new Map;for(let p of o){let l=p.split("/")[0],m=c.get(l)??[];m.push(p),c.set(l,m);}for(let p of c.values())p.sort((l,m)=>l.split("/").length-m.split("/").length||l.localeCompare(m));let d=[],u=[...c.keys()].sort();for(let p=0;d.length<16&&u.some(l=>p<(c.get(l)?.length??0));p+=1)for(let l of u){let m=c.get(l)?.[p];m&&d.length<16&&d.push(m);}r.push(...d.filter(p=>!r.includes(p)));}return r}async function x(e,t,r,s=t){let o=await d$2(e,t),n=o!==null,i={path:s.split(f$1.sep).join("/"),exists:n};if(o&&r){let a=await jt(o);typeof a?.generatedAt=="string"&&(i.generatedAt=a.generatedAt);let c=a?.status??a?.result??a?.verdict;typeof c=="string"&&(i.status=c);}return i}async function hr(e,t,r){let s=bt(e,t),o=".workspai/reports",n=c=>x(t,`${o}/${c}`,r,`${s}/${o}/${c}`),i=await n("doctor-project-last-run.json");return {doctor:i?.exists===true?i:await n("doctor-last-run.json"),remediationPlan:await n("doctor-remediation-plan-last-run.json"),fixResult:await n("doctor-fix-result-last-run.json"),analyze:await n("analyze-last-run.json"),readiness:await n("release-readiness-last-run.json")}}async function kr(e,t,r){let s=q$1(t),o=m(t,s),n$1=G(t),i=n(o.runtime),a=await b$2(t,s,{runtime:o.runtime,framework:o.key}),c=r.contractProject?.slug?r.contractProject.slug:typeof s?.name=="string"&&s.name.trim()?s.name.trim():f$1.basename(t),d=typeof s?.kit_name=="string"?s.kit_name:typeof s?.kit=="string"?s.kit:r.contractProject?.kit,u=typeof s?.engine=="string"?s.engine:n$1.engine!=="unknown"?n$1.engine:void 0,p=fr(s,d,o.displayName),l$1=rt({kitId:d,framework:o.key,runtime:o.runtime}),m$1=f$1.relative(e,t),h=m$1===".."||m$1.startsWith(`..${f$1.sep}`)?l(t):k$1(t),E=[o.runtime,...h.filter(A=>A!==o.runtime)],R=await c$2({projectPath:t,declaration:r.contractProject?.governance});return {name:c,path:bt(e,t),...r.includeAbsolutePaths?{absolutePath:t}:{},kind:a,category:a$4(a),runtime:o.runtime,runtimeCandidates:E,framework:o.key,frameworkDisplayName:o.displayName,confidence:o.confidence,detectionSource:o.source,supportTier:o.supportTier,runtimeSupportTier:i.tier,runtimeDoctorSupport:i.doctorSupport,moduleSupport:n$1.moduleSupport,...d?{kit:d}:{},...u?{engine:u}:{},...p?{generator:p}:{},createCapability:l$1,commands:{supported:n$1.supportedCommands,unsupported:n$1.unsupportedCommands,global:n$1.globalCommands,fleetStages:n$1.fleetStages,localOnly:n$1.localOnlyCommands,map:n$1.commandMap},importantFiles:await gr(t),governance:R,evidence:await hr(e,t,r.includeEvidence),provenance:{path:r.contractProject?"workspace contract declaration reconciled with filesystem discovery":"filesystem discovery",runtime:o.source,framework:o.source,commands:"project command capability matrix",createCapability:"create planner capability contract",governance:r.contractProject?.governance!==void 0?"workspace contract declaration reconciled with repository evidence":"repository and documented external governance discovery",evidence:"project .workspai/reports"}}}async function Ae(e){for(let t of s(e,"workspace.json")){let r=await jt(t);if(r)return r}return null}function yr(e){if(e.length===0)return "empty-workspace";let t=new Set(e.map(r=>r.category));return t.size>1?"polyglot-product-workspace":t.has("frontend")&&e.length>1?"full-stack-workspace":t.has("frontend")?"frontend-workspace":t.has("desktop")?"desktop-application-workspace":t.has("extension")?"extension-workspace":t.has("platform")?"platform-workspace":t.has("library")?"library-workspace":e.length>1?"backend-platform":"backend-workspace"}function wr(e){let t=new Set;for(let r of e){let s=`${r.name} ${r.path}`.toLowerCase();for(let o of ["auth","billing","payment","notification","order","admin","report","search","analytics"])s.includes(o)&&t.add(o);}return Array.from(t).sort()}function P(e,t,r,s){return {severity:e,code:t,message:r,target:s}}function Pt(e){let t=[];e.workspace.name.trim()||t.push(P("error","workspace.name.missing","Workspace name could not be resolved.","workspace")),e.workspace.type==="observed-workspace"&&t.push(P("warning","workspace.marker.missing","Workspace marker is missing; model is based on filesystem observation.","workspace.marker")),e.summary.projectCount===0&&t.push(P("warning","workspace.projects.empty","No project roots were detected in this workspace.","projects")),e.contracts.exists||t.push(P("warning","workspace.contract.missing","Workspace contract is missing; dependency and API edges may be incomplete.",e.contracts.workspaceContractPath));let r=new Map;for(let n of e.projects){let i=n.name.toLowerCase(),a=r.get(i)??[];a.push(n),r.set(i,a),n.importantFiles.length||t.push(P("warning","project.markers.missing",`Project ${n.name} has no important manifest files recorded.`,n.path));let c=f$1.isAbsolute(n.path)?n.path:f$1.resolve(e.workspace.root,n.path);S.existsSync(c)||t.push(P("warning","project.path.missing",`Registered project ${n.name} is not available at its declared path.`,n.path)),n.runtime==="unknown"&&t.push(P("warning","project.runtime.unknown",`Project ${n.name} runtime could not be confidently detected.`,n.path));let d=["test","build"];for(let l of d)n.commands.supported.includes(l)&&n.commands.unsupported.includes(l)&&t.push(P("error","project.commands.conflict",`Project ${n.name} marks ${l} as both supported and unsupported.`,n.path));let u=new Set(n.commands.fleetStages),p=new Set(n.commands.localOnly);for(let l of n.commands.fleetStages){p.has(l)&&t.push(P("error","project.commands.scope-conflict",`Project ${n.name} marks ${l} as both fleet and local-only.`,n.path));let m=n.commands.map[l];(!m||m.status!=="supported"||m.fleetEligible!==true||m.executionScope!=="fleet")&&t.push(P("error","project.commands.fleet-stage-invalid",`Project ${n.name} advertises ${l} as a fleet stage without a supported fleet capability.`,n.path));}for(let l of n.commands.localOnly){let m=n.commands.map[l];(!m||m.status!=="supported"||m.executionScope!=="local-only"||m.fleetEligible===true)&&t.push(P("error","project.commands.local-only-invalid",`Project ${n.name} advertises ${l} as local-only without a matching local-only capability.`,n.path));}for(let l of Object.values(n.commands.map))l.status==="supported"&&(l.fleetEligible===true&&!u.has(l.command)&&t.push(P("error","project.commands.fleet-stage-missing",`Project ${n.name} capability ${l.command} is fleet-eligible but missing from fleetStages.`,n.path)),l.executionScope==="local-only"&&l.fleetEligible!==true&&!p.has(l.command)&&t.push(P("error","project.commands.local-only-missing",`Project ${n.name} capability ${l.command} is local-only but missing from localOnly commands.`,n.path)));}for(let[n,i]of r.entries())i.length>1&&t.push(P("error","project.name.duplicate",`Project name "${n}" is ambiguous across ${i.length} project roots.`,i.map(a=>a.path).join(", ")));e.projectTopology&&e.graph&&c$1({...e.projectTopology,generatedAt:"<ignored>"})!==c$1({...e.graph,generatedAt:"<ignored>"})&&t.push(P("error","workspace.project-topology.alias-mismatch","Deprecated model.graph must remain structurally identical to canonical model.projectTopology during the v1 migration window.","projectTopology"));let s=t.filter(n=>n.severity==="error").length,o=t.filter(n=>n.severity==="warning").length;return {status:s>0?"failed":o>0?"warning":"passed",errors:s,warnings:o,issues:t}}function Rn(e){return Pt(e)}function j(e){return e.join(".")}function vr(e,t){let r=de,s=e.generatedAt,o=[b({id:"workspace.name",label:"Workspace name",scope:"workspace",value:e.workspace.name,freshness:{kind:"durable",category:"structure",generatedAt:s,now:t,sourceArtifact:r,sourcePath:j(["workspace","name"]),reason:"Workspace identity is structural metadata and changes through workspace setup."}}),b({id:"workspace.type",label:"Workspace type",scope:"workspace",value:e.identity.workspaceType,freshness:{kind:"derived",category:"structure",generatedAt:s,now:t,sourceArtifact:r,sourcePath:j(["identity","workspaceType"]),reason:"Workspace type is derived from the current project inventory."}}),b({id:"workspace.projectCount",label:"Project count",scope:"workspace",value:e.summary.projectCount,freshness:{kind:"derived",category:"structure",generatedAt:s,now:t,sourceArtifact:r,sourcePath:j(["summary","projectCount"]),reason:"Project count is derived from workspace discovery and should be refreshed after structural changes."}}),b({id:"workspace.runtimeFamilies",label:"Runtime families",scope:"workspace",value:e.identity.runtimeFamilies,freshness:{kind:"derived",category:"structure",generatedAt:s,now:t,sourceArtifact:r,sourcePath:j(["identity","runtimeFamilies"]),reason:"Runtime coverage is inferred from project surfaces."}}),b({id:"workspace.policyMode",label:"Workspace policy mode",scope:"policy",value:e.policies.mode,freshness:{kind:"durable",category:"structure",generatedAt:s,now:t,sourceArtifact:r,sourcePath:j(["policies","mode"]),reason:"Policy mode is configuration, not runtime state."}}),b({id:"workspace.contract.exists",label:"Workspace contract presence",scope:"contract",value:e.contracts.exists,freshness:{kind:"derived",category:"structure",generatedAt:s,now:t,sourceArtifact:r,sourcePath:j(["contracts","exists"]),reason:"Contract presence is derived from workspace files and should be refreshed before release gating."}})],n=Ee(e);n&&o.push(b({id:"graph.edgeCount",label:"Dependency graph edge count",scope:"graph",value:n.stats.edgeCount,freshness:{kind:"derived",category:"structure",generatedAt:n.generatedAt??s,now:t,sourceArtifact:r,sourcePath:j(["projectTopology","stats","edgeCount"]),reason:"Graph topology is derived from manifests, imports, and workspace contracts."}}),b({id:"graph.evidenceCoverageRatio",label:"Dependency graph evidence coverage",scope:"graph",value:n.stats.evidenceCoverageRatio,freshness:{kind:"derived",category:"structure",generatedAt:n.generatedAt??s,now:t,sourceArtifact:r,sourcePath:j(["projectTopology","stats","evidenceCoverageRatio"]),reason:"Graph evidence coverage changes when dependency evidence or contract edges change."}}));for(let[i,a]of e.projects.entries()){let c=`projects[${i}]`,d={kind:"derived",category:"structure",generatedAt:s,now:t,sourceArtifact:r,reason:"Project facts are derived from workspace discovery, project metadata, and framework probes."};o.push(b({id:`project.${a.name}.kind`,label:`${a.name} kind`,scope:"project",project:a.name,value:a.kind,freshness:{...d,sourcePath:j([c,"kind"])}}),b({id:`project.${a.name}.category`,label:`${a.name} category`,scope:"project",project:a.name,value:a.category,freshness:{...d,sourcePath:j([c,"category"])}}),b({id:`project.${a.name}.runtime`,label:`${a.name} runtime`,scope:"project",project:a.name,value:a.runtime,freshness:{...d,sourcePath:j([c,"runtime"])}}),b({id:`project.${a.name}.framework`,label:`${a.name} framework`,scope:"project",project:a.name,value:a.frameworkDisplayName,freshness:{...d,sourcePath:j([c,"frameworkDisplayName"])}}),b({id:`project.${a.name}.supportTier`,label:`${a.name} support tier`,scope:"project",project:a.name,value:a.supportTier,freshness:{...d,sourcePath:j([c,"supportTier"])}}),b({id:`project.${a.name}.safeFleetStages`,label:`${a.name} safe fleet stages`,scope:"command",project:a.name,value:a.commands.fleetStages,freshness:{...d,sourcePath:j([c,"commands","fleetStages"]),reason:"Safe command availability is derived from package and project command surfaces."}}),...["ci","release","ownership"].map(u=>b({id:`project.${a.name}.governance.${u}`,label:`${a.name} ${u} governance`,scope:"policy",project:a.name,value:a.governance?.[u]??{status:"unknown",provider:null,evidence:[],reference:null},freshness:{...d,sourcePath:j([c,"governance",u]),reason:"Governance truth is reconciled from repository surfaces and explicit workspace contract declarations."}})));for(let[u,p]of Object.entries(a.evidence))o.push(b({id:`project.${a.name}.evidence.${u}`,label:`${a.name} ${u} evidence`,scope:"evidence",project:a.name,value:p?{path:p.path,exists:p.exists,status:p.status??null}:{exists:false},freshness:{kind:p?.exists?"evidence-backed":"verify-before-use",category:"verification",generatedAt:p?.generatedAt??s,now:t,status:p?.exists?void 0:"unknown",sourceArtifact:p?.path??r,sourcePath:j([c,"evidence",u]),verifyBeforeUse:true,reason:p?.exists?"Evidence reports can expire or become stale after source changes.":"Missing evidence must be generated before this fact is used for verification."}}));}for(let[i,a]of Object.entries(e.evidence))o.push(b({id:`workspace.evidence.${i}`,label:`Workspace ${i} evidence`,scope:"evidence",value:a?{path:a.path,exists:a.exists,status:a.status??null}:null,freshness:{kind:a?.exists?"evidence-backed":"verify-before-use",category:"verification",generatedAt:a?.generatedAt??s,now:t,status:a?.exists?void 0:"unknown",sourceArtifact:a?.path??r,sourcePath:j(["evidence",i]),verifyBeforeUse:true,reason:a?.exists?"Workspace evidence can expire or become stale after project, dependency, or policy changes.":"Missing workspace evidence must be generated before release or repair decisions."}}));return o}async function pe(e$1){let t=f$1.resolve(e$1.workspacePath),r=e$1.includeAbsolutePaths===true,s$1=e$1.includeEvidence===true,o=We(e$1.observableScanDepth),n=e$1.now??new Date,[i$1,a$3,c,d,u,p]=await Promise.all([a(t),Ae(t),Me(t),a$1(t),a$2(t,{descendIntoMatchedProjects:false}),xe(t,o)]),l=new Map;for(let g of c?.projects??[]){let ue=g.externalPath?f$1.resolve(g.externalPath):f$1.resolve(t,g.relativePath);l.set(ue,g);}let m=Re([...u,...p,...l.keys(),...d.map(g=>f$1.isAbsolute(g.path)?g.path:f$1.join(t,g.path))]),w=e$1.reuseProjectModels,h=await Promise.all(m.map(g=>{if(w){let ue=f$1.relative(t,f$1.resolve(g)).split(f$1.sep).join("/"),Ie=w.get(ue);if(Ie)return Promise.resolve(Ie)}return kr(t,g,{includeAbsolutePaths:r,includeEvidence:s$1,contractProject:l.get(f$1.resolve(g))})})),E=typeof a$3?.workspace_name=="string"?a$3.workspace_name:typeof a$3?.name=="string"?a$3.name:i$1?.name||c?.workspace.name||f$1.basename(t),R=typeof a$3?.profile=="string"?a$3.profile:typeof a$3?.mode=="string"?a$3.mode:c?.workspace.profile,A=Array.from(new Set(h.map(g=>g.kind))).sort(),le=Array.from(new Set(h.map(g=>g.category))).sort(),H=Array.from(new Set(h.flatMap(g=>g.runtimeCandidates.length>0?g.runtimeCandidates:[g.runtime]))).sort(),q=Array.from(new Set(h.map(g=>g.framework))).sort(),D=[".workspai/policies.yml",".workspai/policies.yaml",".rapidkit/policies.yml",".rapidkit/policies.yaml"].find(g=>S.existsSync(f$1.join(t,g))),J=s(t,"workspace.contract.json").map(g=>f$1.relative(t,g).split(f$1.sep).join("/")).find(g=>S.existsSync(f$1.join(t,g)))??i.workspaceContract,M=await S.pathExists(f$1.join(t,J)),X={schemaVersion:dr,generatedAt:n.toISOString(),workspace:{name:E,root:t,...R?{profile:R}:{},type:i$1?"rapidkit-workspace":"observed-workspace",...i$1?{marker:{createdBy:i$1.createdBy,version:i$1.version,createdAt:i$1.createdAt}}:{}},identity:{workspaceType:yr(h),surfaces:A,categories:le,runtimeFamilies:H,businessCapabilities:wr(h)},discovery:{observableScanDepth:o},projects:h,policies:{mode:typeof a$3?.policy_mode=="string"?a$3.policy_mode:typeof a$3?.policyMode=="string"?a$3.policyMode:"warn",source:D??null,exists:!!D},contracts:{workspaceContractPath:J,exists:M,status:M?"known":"missing"},evidence:{doctor:await x(t,e.doctor,s$1),projectDoctor:await x(t,i.doctorProject,s$1),doctorRemediationPlan:await x(t,i.doctorRemediationPlan,s$1),artifactRemediationPlan:await x(t,i.artifactRemediationPlan,s$1),doctorFixResult:await x(t,i.doctorFixResult,s$1),analyze:await x(t,e.analyze,s$1),readiness:await x(t,e.readiness,s$1),pipeline:await x(t,i.pipelineLastRun,s$1)},summary:{projectCount:h.length,runtimes:H,frameworks:q,firstClassProjects:h.filter(g=>g.supportTier==="first-class").length,observedProjects:h.filter(g=>g.supportTier==="observed").length}},v=await Ct(t,X,{contractExists:M,now:n,incrementalGraph:e$1.incrementalGraph}),C={...X,projectTopology:v,graph:v},I=Pt(C),O=vr({...C},n),St=yt({facts:O,generatedAt:n.toISOString(),now:n});return {...C,facts:O,factFreshness:St,validation:I}}async function An(e){if(e.cache!==true)return {model:await pe(e),cache:"disabled"};let t=f$1.resolve(e.workspacePath),r=We(e.observableScanDepth),s=Ce(),[o,n,i,a$3,c]=await Promise.all([a(t),Ae(t),a$1(t),a$2(t,{descendIntoMatchedProjects:false}),xe(t,r)]),d=Re([...a$3,...c,...i.map(h=>f$1.isAbsolute(h.path)?h.path:f$1.join(t,h.path))]),u=await ie({workspacePath:t,cliVersion:s,flags:{includeAbsolutePaths:e.includeAbsolutePaths===true,includeEvidence:e.includeEvidence===true,observableScanDepth:r},projectPaths:d,workspaceJson:n,marker:o}),p=await Se(t);if(p&&p.cliVersion===s&&p.inputsHash===u&&vt(p.model))return {model:p.model,cache:"hit"};let l=await pe({...e}),[m,w]=await Promise.all([se(t,d),ae(t)]);return await ce(t,{cliVersion:s,inputsHash:u,generatedAt:(e.now??new Date).toISOString(),model:l,projectSignatures:m,workspaceFileSignatures:w}),{model:l,cache:"miss"}}function br(e,t){let r=new Set,s=new Set,o=new Set;for(let[n,i]of Object.entries(t))n in e?e[n]!==i&&r.add(n):s.add(n);for(let n of Object.keys(e))n in t||o.add(n);return {changed:r,added:s,removed:o}}function jr(e={},t={}){let r=new Set([...Object.keys(e),...Object.keys(t)]);for(let s of r)if(e[s]!==t[s])return false;return true}async function Mn(e){let t=f$1.resolve(e.workspacePath),r=We(e.observableScanDepth),s=Ce(),o=e.now??new Date,[n,i,a$3,c,d]=await Promise.all([a(t),Ae(t),a$1(t),a$2(t,{descendIntoMatchedProjects:false}),xe(t,r)]),u=Re([...c,...d,...a$3.map(v=>f$1.isAbsolute(v.path)?v.path:f$1.join(t,v.path))]),p=await Se(t),l=async()=>{let v=await pe({...e}),C=await ie({workspacePath:t,cliVersion:s,flags:{includeAbsolutePaths:e.includeAbsolutePaths===true,includeEvidence:e.includeEvidence===true,observableScanDepth:r},projectPaths:u,workspaceJson:i,marker:n}),[I,O]=await Promise.all([se(t,u),ae(t)]);return await ce(t,{cliVersion:s,inputsHash:C,generatedAt:o.toISOString(),model:v,projectSignatures:I,workspaceFileSignatures:O}),{model:v,mode:"full"}},m=p?Ee(p.model):void 0;if(!p||p.cliVersion!==s||!p.projectSignatures||!m||!vt(p.model))return l();let w=await ae(t);if(!jr(p.workspaceFileSignatures,w))return l();let h=await se(t,u),{changed:E,added:R,removed:A}=br(p.projectSignatures,h);if(E.size===0&&R.size===0&&A.size===0)return {model:p.model,mode:"unchanged"};let le=new Set([...E,...R]),H=new Map;for(let v of p.model.projects){let C=v.path.split(f$1.sep).join("/");!le.has(C)&&!A.has(C)&&H.set(C,v);}let q=new Set,D=false;for(let v of p.model.projects){let C=v.path.split(f$1.sep).join("/");E.has(C)&&q.add(v.name);}let J=R.size>0||A.size>0,M=await pe({...e,reuseProjectModels:H,incrementalGraph:{previousGraph:m,changedProjectIds:q,structuralChange:J||D}});for(let v of p.model.projects){let C=v.path.split(f$1.sep).join("/");if(!E.has(C))continue;let I=M.projects.find(O=>O.path.split(f$1.sep).join("/")===C);if(I&&I.name!==v.name){D=true;break}}if(D)return l();let X=await ie({workspacePath:t,cliVersion:s,flags:{includeAbsolutePaths:e.includeAbsolutePaths===true,includeEvidence:e.includeEvidence===true,observableScanDepth:r},projectPaths:u,workspaceJson:i,marker:n});return await ce(t,{cliVersion:s,inputsHash:X,generatedAt:o.toISOString(),model:M,projectSignatures:h,workspaceFileSignatures:w}),{model:M,mode:"incremental"}}async function Me(e){try{let{contract:t}=await p({workspacePath:e});return t&&typeof t=="object"?t:null}catch{return null}}async function Ct(e,t,r){let s=r.contractExists?await Me(e):null;try{return r.incrementalGraph?await ft({workspacePath:e,model:t,contract:s,now:r.now,previousGraph:r.incrementalGraph.previousGraph,changedProjectIds:r.incrementalGraph.changedProjectIds,structuralChange:r.incrementalGraph.structuralChange}):await mt({workspacePath:e,model:t,contract:s,now:r.now})}catch{let o=t.projects.map(n=>({id:n.name,path:n.path}));return {schemaVersion:"workspace-dependency-graph.v1",generatedAt:r.now.toISOString(),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?0:1,evidenceCoverageRatio:1,hotspotCount:0,hasCycle:false},diagnostics:o.length>1?[{code:"graph.inference.failed",severity:"warning",message:"Dependency graph inference failed; model contains projects but no dependency edges.",recommendation:"Run workspace model again after fixing graph inputs, or add workspace contract/manual graph overrides.",nodeIds:o.map(n=>n.id).sort((n,i)=>n.localeCompare(i))}]:void 0}}}async function In(e$1,t){let r=e$1.contracts.exists?await Me(t):null,{buildWorkspaceKnowledgeGraph:s}=await import('./workspace-knowledge-graph-SWCKDTPF.js'),o=d(e$1),n=await S.readJson(f$1.join(t,e.knowledgeGraph)).then(c=>c).catch(()=>null),i=await s({workspacePath:t,workspace:{name:e$1.workspace.name,...e$1.workspace.profile?{profile:e$1.workspace.profile}:{}},projects:e$1.projects.map(c=>({id:c.name,path:c.path,...c.absolutePath?{absolutePath:c.absolutePath}:{},runtime:c.runtime,runtimeCandidates:c.runtimeCandidates,framework:c.framework,kind:c.kind,category:c.category,...c.governance?{governance:c.governance}:{},...c.kit?{kit:c.kit}:{}})),projectTopology:Ee(e$1)??await Ct(t,e$1,{contractExists:e$1.contracts.exists,now:new Date(e$1.generatedAt)}),contract:r,now:new Date(e$1.generatedAt),source:{kind:"workspace-model",artifact:de,hashAlgorithm:"sha256",hash:d$1(o)},previousGraph:n}),[,a]=await f$2(t,de,[{relativePath:e.knowledgeGraph,payload:i},{relativePath:de,payload:o}]);return a}export{rt as a,Er as b,Ar as c,$ as d,kt as e,b as f,yt as g,dr as h,de as i,Ee as j,xn as k,Rn as l,vr as m,pe as n,An as o,Mn as p,In as q};