workspai 0.45.0 → 0.47.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 (177) hide show
  1. package/README.md +307 -532
  2. package/contracts/agent-customization-pack.v1.json +6 -1
  3. package/contracts/bootstrap-compliance.v1.json +14 -0
  4. package/contracts/cli-runtime-command-inventory.v1.snapshot.json +8 -0
  5. package/contracts/extension-cli-compatibility.v1.json +9 -2
  6. package/contracts/mirror-ops.v1.json +16 -0
  7. package/contracts/published-contract-catalog.v1.json +38 -1
  8. package/contracts/runtime-command-surface.v1.json +190 -7
  9. package/contracts/transparency-evidence.v1.json +13 -0
  10. package/contracts/workspace-archive-capabilities.v1.json +17 -6
  11. package/contracts/workspace-contract.v1.json +78 -0
  12. package/contracts/workspace-intelligence/studio-blocker-handoff.v1.json +4 -0
  13. package/contracts/workspace-intelligence/workspace-context.v1.json +20 -0
  14. package/contracts/workspace-intelligence/workspace-graph-token-efficiency.v1.json +72 -0
  15. package/contracts/workspace-intelligence/workspace-intelligence-run.v1.json +212 -0
  16. package/contracts/workspace-intelligence/workspace-knowledge-graph-change-overlay.v1.json +200 -0
  17. package/contracts/workspace-intelligence/workspace-knowledge-graph.v1.json +260 -0
  18. package/contracts/workspace-intelligence/workspace-knowledge-search.v1.json +60 -0
  19. package/contracts/workspace-intelligence-architecture.v1.json +7 -4
  20. package/contracts/workspace-intelligence-chain.v1.json +51 -4
  21. package/contracts/workspace-share-bundle.v1.json +16 -0
  22. package/dist/analyze-UVXPRGYZ.js +1 -0
  23. package/dist/artifact-remediation-plan-EPALZ2LC.js +3 -0
  24. package/dist/autopilot-release-5BQ6F5L2.js +1 -0
  25. package/dist/chunk-22NJ2ZMG.js +2 -0
  26. package/dist/{chunk-XIVFLY6G.js → chunk-2GHUZDYA.js} +1 -1
  27. package/dist/chunk-2TEDAKP6.js +2 -0
  28. package/dist/chunk-52PBRX7F.js +1 -0
  29. package/dist/chunk-6SWRNA47.js +4 -0
  30. package/dist/chunk-76YOPAOT.js +1 -0
  31. package/dist/chunk-7VLCK5JW.js +1 -0
  32. package/dist/{chunk-DXPU4DDV.js → chunk-BSRVO52Y.js} +92 -78
  33. package/dist/chunk-COARSXRC.js +1 -0
  34. package/dist/chunk-CV5HKU4P.js +1 -0
  35. package/dist/chunk-CW7PGBIQ.js +13 -0
  36. package/dist/{chunk-KU4S7RCM.js → chunk-DV6GJD4K.js} +1 -1
  37. package/dist/chunk-EYJ2CQSK.js +1 -0
  38. package/dist/chunk-FB7SCXAZ.js +1 -0
  39. package/dist/chunk-FPJNWPKU.js +1 -0
  40. package/dist/{chunk-JP25YL3J.js → chunk-FTY7GGXJ.js} +2 -2
  41. package/dist/chunk-FXQJX34Z.js +1 -0
  42. package/dist/{chunk-J4AICQFB.js → chunk-HSGFUKCN.js} +1 -1
  43. package/dist/{chunk-OOOPYUL2.js → chunk-ITCAMC2E.js} +1 -1
  44. package/dist/chunk-KB44JP4M.js +2 -0
  45. package/dist/{chunk-WANW4QA4.js → chunk-KZZ36CK5.js} +1 -1
  46. package/dist/chunk-LNRAB7UY.js +1 -0
  47. package/dist/chunk-MEMHNE7Y.js +80 -0
  48. package/dist/chunk-MER6ZBN2.js +13 -0
  49. package/dist/chunk-NOFM7MNA.js +2 -0
  50. package/dist/chunk-NRYS4CLR.js +2 -0
  51. package/dist/chunk-OA537ZQ5.js +1 -0
  52. package/dist/chunk-PBHP6JNY.js +8 -0
  53. package/dist/chunk-QDWYIRHR.js +8 -0
  54. package/dist/chunk-RWRLFSKW.js +2 -0
  55. package/dist/chunk-SK6XRKGG.js +1 -0
  56. package/dist/chunk-THIOE2PB.js +2 -0
  57. package/dist/chunk-TNQI5VCW.js +36 -0
  58. package/dist/chunk-TWNFECMN.js +2 -0
  59. package/dist/{chunk-2QOWRBQD.js → chunk-U5EZHZBX.js} +1 -1
  60. package/dist/{chunk-K63BSU56.js → chunk-VBSQ7MF6.js} +62 -51
  61. package/dist/chunk-WDKNMTJQ.js +1 -0
  62. package/dist/chunk-YCL3I2JO.js +2 -0
  63. package/dist/chunk-ZDN7RHXJ.js +1 -0
  64. package/dist/chunk-ZM5NQ5Z2.js +1 -0
  65. package/dist/{create-KFR6FLRT.js → create-7JKJDAQV.js} +1 -1
  66. package/dist/doctor-PGPNIS76.js +1 -0
  67. package/dist/{dotnet-webapi-clean-BYUUHX5Y.js → dotnet-webapi-clean-6TVFBTVI.js} +20 -20
  68. package/dist/{gofiber-standard-B6UK5GR7.js → gofiber-standard-2BL7GWZB.js} +1 -1
  69. package/dist/{gogin-standard-BXU44VEM.js → gogin-standard-XGP3KBXA.js} +1 -1
  70. package/dist/index.d.ts +112 -16
  71. package/dist/index.js +198 -195
  72. package/dist/pipeline-IB6ILJSV.js +5 -0
  73. package/dist/{platform-capabilities-YICBF4FA.js → platform-capabilities-2B4QMZXE.js} +1 -1
  74. package/dist/{pythonRapidkitExec-UJYIB6FL.js → pythonRapidkitExec-CVCIK225.js} +1 -1
  75. package/dist/{springboot-standard-PEHDKH2L.js → springboot-standard-JJNUID6M.js} +6 -6
  76. package/dist/workspace-H3QXBFGB.js +1 -0
  77. package/dist/{workspace-agent-sync-G5YVI3BJ.js → workspace-agent-sync-C7SG2Z5W.js} +1 -1
  78. package/dist/workspace-archive-P76EDIUG.js +10 -0
  79. package/dist/{workspace-context-E3UFWL5X.js → workspace-context-BKQBKA4C.js} +1 -1
  80. package/dist/workspace-contract-RPQQBQXR.js +1 -0
  81. package/dist/workspace-dependency-graph-23BI2HG7.js +1 -0
  82. package/dist/workspace-explain-WVN7JH3U.js +1 -0
  83. package/dist/workspace-explain-contract-SEFTVF6J.js +1 -0
  84. package/dist/{workspace-feedback-YY6WQPWQ.js → workspace-feedback-WAID3IOE.js} +1 -1
  85. package/dist/{workspace-foundation-3C2DLCVI.js → workspace-foundation-5OOJEO2D.js} +1 -1
  86. package/dist/workspace-graph-token-efficiency-CFGFCJ5V.js +1 -0
  87. package/dist/{workspace-history-VF3CHDYQ.js → workspace-history-C6OP3IAQ.js} +1 -1
  88. package/dist/workspace-intelligence-VKDL3H2J.js +1 -0
  89. package/dist/workspace-intelligence-runner-LVALAZY7.js +1 -0
  90. package/dist/workspace-knowledge-graph-FE2NTZKV.js +1 -0
  91. package/dist/workspace-knowledge-graph-change-overlay-XG6FC4IX.js +1 -0
  92. package/dist/workspace-knowledge-graph-query-VOSPPH4W.js +1 -0
  93. package/dist/workspace-mcp-serve-KT2I676Z.js +3 -0
  94. package/dist/workspace-model-S33CIB2R.js +1 -0
  95. package/dist/workspace-model-hash-MHXK5MEI.js +1 -0
  96. package/dist/workspace-python-engine-state-2MLKJYQG.js +2 -0
  97. package/dist/workspace-registry-summary-A3YDL63D.js +1 -0
  98. package/dist/workspace-run-M4LNJILC.js +1 -0
  99. package/dist/{workspace-verify-ZNT6JX7D.js → workspace-verify-ZGH3NXAH.js} +1 -1
  100. package/dist/workspace-watch-EVBJTMV7.js +1 -0
  101. package/docs/AI_DYNAMIC_INTEGRATION.md +73 -432
  102. package/docs/AI_EXAMPLES.md +37 -395
  103. package/docs/AI_FEATURES.md +76 -465
  104. package/docs/AI_QUICKSTART.md +49 -209
  105. package/docs/DEVELOPMENT.md +5 -5
  106. package/docs/From Code to Shared Understanding.png +0 -0
  107. package/docs/GLOSSARY.md +60 -0
  108. package/docs/OPEN_SOURCE_USER_SCENARIOS.md +91 -9
  109. package/docs/OPTIMIZATION_GUIDE.md +19 -51
  110. package/docs/PACKAGE_MANAGER_POLICY.md +4 -1
  111. package/docs/README.md +91 -42
  112. package/docs/SECURITY.md +13 -6
  113. package/docs/SETUP.md +6 -3
  114. package/docs/UTILITIES.md +8 -20
  115. package/docs/WORKSPACE_MARKER_SPEC.md +27 -20
  116. package/docs/ci-workflows.md +19 -5
  117. package/docs/commands-reference.md +88 -13
  118. package/docs/config-file-guide.md +67 -246
  119. package/docs/contracts/ARTIFACT_CATALOG.md +78 -36
  120. package/docs/contracts/CLI_LOG_EVENT_STREAM.md +1 -1
  121. package/docs/contracts/README.md +48 -9
  122. package/docs/contracts/RUNTIME_ACCEPTANCE_MATRIX.md +4 -4
  123. package/docs/contracts/RUNTIME_SUPPORT_MATRIX.md +14 -10
  124. package/docs/creating-workspaces-and-projects.md +649 -0
  125. package/docs/doctor-command.md +5 -4
  126. package/docs/examples/ci-agent-grounding.yml +16 -10
  127. package/docs/from-code-to-shared-understanding.md +69 -38
  128. package/docs/graph-benchmark-methodology.md +121 -0
  129. package/docs/workspace-intelligence-runner.md +186 -0
  130. package/docs/workspace-knowledge-graph.md +295 -0
  131. package/docs/workspace-operations.md +78 -11
  132. package/docs/workspace-run.md +4 -1
  133. package/package.json +10 -8
  134. package/rapidkit.config.example.cjs +5 -5
  135. package/scripts/enforce-package-manager.cjs +1 -1
  136. package/scripts/prepack-enterprise.mjs +4 -0
  137. package/workspai.config.example.cjs +12 -47
  138. package/dist/analyze-YLV7NVLF.js +0 -1
  139. package/dist/artifact-remediation-plan-WLZGROUU.js +0 -3
  140. package/dist/autopilot-release-YBN3SWAA.js +0 -1
  141. package/dist/chunk-2K3GYCPS.js +0 -1
  142. package/dist/chunk-42G2OK64.js +0 -1
  143. package/dist/chunk-5AKYMAIL.js +0 -1
  144. package/dist/chunk-5GNT4RJI.js +0 -8
  145. package/dist/chunk-5PVEQ6CZ.js +0 -13
  146. package/dist/chunk-6AA3WWQZ.js +0 -2
  147. package/dist/chunk-6ZENXBMG.js +0 -33
  148. package/dist/chunk-7RIWU5TZ.js +0 -1
  149. package/dist/chunk-7UZVOYF5.js +0 -2
  150. package/dist/chunk-BJLE5CH7.js +0 -4
  151. package/dist/chunk-G3H5R3RR.js +0 -1
  152. package/dist/chunk-HYJK7W3B.js +0 -1
  153. package/dist/chunk-IMUU5Q2V.js +0 -13
  154. package/dist/chunk-KPPGZCUW.js +0 -78
  155. package/dist/chunk-LCRROMRR.js +0 -2
  156. package/dist/chunk-LG6RFLPZ.js +0 -1
  157. package/dist/chunk-P424XYHP.js +0 -1
  158. package/dist/chunk-P7SCWJFG.js +0 -8
  159. package/dist/chunk-QWU2CZBG.js +0 -2
  160. package/dist/chunk-V2H2KRMZ.js +0 -1
  161. package/dist/chunk-XZGVNGRB.js +0 -1
  162. package/dist/chunk-ZWO6K24C.js +0 -2
  163. package/dist/doctor-YJDM5XBH.js +0 -1
  164. package/dist/imported-projects-registry-FOIE27WT.js +0 -1
  165. package/dist/pipeline-FEDYO3IA.js +0 -5
  166. package/dist/workspace-PLXOO6ST.js +0 -1
  167. package/dist/workspace-archive-EEGLHZDW.js +0 -10
  168. package/dist/workspace-contract-LQJDZV36.js +0 -1
  169. package/dist/workspace-explain-G74ZIF23.js +0 -1
  170. package/dist/workspace-explain-contract-KT757JGQ.js +0 -1
  171. package/dist/workspace-intelligence-3GG7GEDQ.js +0 -1
  172. package/dist/workspace-mcp-serve-MJMUV4RY.js +0 -3
  173. package/dist/workspace-model-NG45SRM5.js +0 -1
  174. package/dist/workspace-python-engine-state-MTWIIZPY.js +0 -2
  175. package/dist/workspace-registry-summary-JM2XY52C.js +0 -1
  176. package/dist/workspace-run-WEQYIERE.js +0 -1
  177. package/dist/workspace-watch-W47T4RX2.js +0 -1
@@ -1 +0,0 @@
1
- import {d,q,a as a$5}from'./chunk-7UZVOYF5.js';import {i,h}from'./chunk-4KUIFXHM.js';import {a as a$6}from'./chunk-HTYMXMQM.js';import {a as a$4,j as j$1,b as b$3}from'./chunk-QWU2CZBG.js';import {g,f as f$1,c as c$1}from'./chunk-6AA3WWQZ.js';import {j}from'./chunk-5PVEQ6CZ.js';import {c,b as b$2}from'./chunk-P424XYHP.js';import {a as a$1}from'./chunk-GSWPGELT.js';import {a as a$3}from'./chunk-GZTYAEWX.js';import {b as b$1,a}from'./chunk-5AKYMAIL.js';import {a as a$2}from'./chunk-XZGVNGRB.js';import {p,o}from'./chunk-5XATWNME.js';import f from'path';import P from'fs-extra';import yt from'crypto';import {createRequire}from'module';var ft=new Set(["service","frontend","worker","library","infra","docs","test-suite","unknown"]);async function He(e){try{if(!await P.pathExists(e))return null;let t=await P.readJSON(e);return t&&typeof t=="object"?t:null}catch{return null}}async function mt(e){for(let t of e){let r=await He(t);if(r)return r}return null}function Te(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return ft.has(t)?t:null}async function $e(e,t){let r=t??await mt(p(e,"project.json")),o=Te(r?.kind)??Te(r?.type);if(o)return o;let s=typeof r?.kit_name=="string"?r.kit_name:r?.kit,n=typeof r?.framework=="string"?r.framework:null,a=typeof r?.runtime=="string"?r.runtime:null,i=`${typeof s=="string"?s:""} ${n??""} ${a??""}`.trim().toLowerCase();if(/\b(frontend|nextjs|next\.js|react|vue|svelte|vite|angular|astro|remix|nuxt)\b/.test(i))return "frontend";if(/\b(fastapi|nestjs|springboot|spring boot|gofiber|gogin|dotnet|webapi|django|flask|express|fastify|python|node|java|go|rust|php|ruby|elixir)\b/.test(i))return "service";let c=await He(f.join(e,"package.json"));if(c){let d={...c.dependencies??{},...c.devDependencies??{}},l=c.scripts??{},p=Object.values(l).filter(u=>typeof u=="string").join(" ").toLowerCase();if(d.next||d.react||d.vue||d.svelte||d.vite||d["@angular/core"]||p.includes("next ")||p.includes("vite "))return "frontend";if(c.private===true&&!d.express&&!d["@nestjs/core"])return "library"}return await P.pathExists(f.join(e,"Dockerfile"))||await P.pathExists(f.join(e,"docker-compose.yml"))||await P.pathExists(f.join(e,"terraform.tf"))?"infra":"service"}var gt=new Set(c().map(e=>e.id)),ht=[...j().map(e=>({id:e.kitId,aliases:[...e.aliases],ecosystem:e.framework,status:"available",canExecuteCreate:true,officialCommands:[e.commandDisplay("<name>",{skipGit:false,skipInstall:false})],adoptAfterCreate:true})),{id:"wordpress-site",aliases:["wordpress","wordpress-site","wp","wp-site"],ecosystem:"wordpress",status:"planned",canExecuteCreate:false,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",status:"planned",canExecuteCreate:false,officialCommands:["npx @wordpress/create-block@latest <slug>"],adoptAfterCreate:true},{id:"laravel",aliases:["laravel","php-laravel"],ecosystem:"php",status:"planned",canExecuteCreate:false,officialCommands:["composer create-project laravel/laravel <name>"],adoptAfterCreate:true},{id:"symfony",aliases:["symfony","php-symfony"],ecosystem:"php",status:"planned",canExecuteCreate:false,officialCommands:["composer create-project symfony/skeleton <name>"],adoptAfterCreate:true},{id:"rails",aliases:["rails","ruby-on-rails","ruby-rails"],ecosystem:"ruby",status:"planned",canExecuteCreate:false,officialCommands:["rails new <name>"],adoptAfterCreate:true}],V=new Map;for(let e of ht){V.set(e.id,e);for(let t of e.aliases)V.set(t,e);}var kt=new Set(["php","ruby","rust","elixir","clojure","scala","kotlin","unknown"]);function F(e){return e?.trim().toLowerCase()||void 0}function Ve(e){let t=F(e.kitId)??F(e.framework)??F(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$2(e.kitId):void 0;if(r&&gt.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 o=V.get(t)??V.get(F(e.framework)??"")??V.get(F(e.runtime)??"");if(o)return {lane:"official",status:o.status,canExecuteCreate:o.canExecuteCreate,requested:t,resolved:o.id,officialCommands:o.officialCommands,fallbackLane:o.canExecuteCreate?void 0:"existing",reason:o.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 s=F(e.runtime);return s&&kt.has(s)?{lane:"existing",status:"available",canExecuteCreate:false,requested:t,resolved:s,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 br(e){return !e.canExecuteCreate&&(e.lane==="official"||e.lane==="existing"&&e.resolved!==void 0)}var Ke="workspace-dependency-graph.v1",Be=["code-import","package-dep","event-pub-sub","service-dependsOn","shared-resource"];var Wr="rapidkit-freshness-metadata-v1";function le(e){if(Array.isArray(e))return e.map(t=>le(t));if(e&&typeof e=="object"){let t={};for(let r of Object.keys(e).sort())t[r]=le(e[r]);return t}return e}function wt(e){return JSON.stringify(le(e))}function M(e){return yt.createHash("sha256").update(wt(e)).digest("hex")}var Le=".workspai/workspace-graph.overrides.json",vt=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs"]),bt=new Set([".git",".hg",".svn",".workspai",".rapidkit",".venv","node_modules","dist","build","out","target","coverage","htmlcov",".next",".turbo",".cache"]),Ue=600,Je=5,jt=256*1024,ze={inferred:1,contract:2,manual:3};function Ct(e){return e.split(f.sep).join("/")}function Z(e,t){return Ct(f.relative(e,t)||".")}function qe(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,o)=>r.id.localeCompare(o.id))}function Xe(e,t){let r=new Map,o=new Map;for(let n of t.projects){if(r.has(n.name))continue;let a=n.absolutePath?f.resolve(n.absolutePath):f.resolve(e,n.path);r.set(n.name,a),o.has(a)||o.set(a,n.name);}let s=[...o.entries()].map(([n,a])=>({dir:n,id:a})).sort((n,a)=>a.dir.length-n.dir.length||n.dir.localeCompare(a.dir));return {idToDir:r,dirToId:o,sortedDirs:s}}function ee(e,t){let r=f.resolve(t);for(let{dir:o,id:s}of e.sortedDirs)if(r===o||r.startsWith(`${o}${f.sep}`))return s;return null}async function me(e){try{if(!await P.pathExists(e))return null;let t=await P.readJSON(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:null}catch{return null}}async function he(e){try{return await P.pathExists(e)?await P.readFile(e,"utf8"):null}catch{return null}}async function Ye(e,t){let r=[],o=new Map;for(let[s,n]of t.idToDir.entries()){let a=await me(f.join(n,"package.json")),i=typeof a?.name=="string"?a.name.trim():"";i&&!o.has(i)&&o.set(i,s);}for(let[s,n]of t.idToDir.entries()){let a=await me(f.join(n,"package.json"));if(a){let i=["dependencies","devDependencies","peerDependencies","optionalDependencies"],c=new Set;for(let d of i){let l=a[d];if(!(!l||typeof l!="object"||Array.isArray(l)))for(let p of Object.keys(l)){let u=o.get(p);!u||u===s||c.has(u)||(c.add(u),r.push({from:s,to:u,kind:"package-dep",source:"inferred",confidence:"high",evidence:[{file:Z(e,f.join(n,"package.json")),detail:`declares dependency ${p}`}]}));}}}r.push(...await Et(e,t,s,n)),r.push(...await St(e,t,s,n));}return r}async function Et(e,t,r,o){let s=await he(f.join(o,"pyproject.toml"));if(!s)return [];let n=[],a=new Set,i=/path\s*=\s*["']([^"']+)["']/g,c;for(;(c=i.exec(s))!==null;){let d=ee(t,f.resolve(o,c[1]));!d||d===r||a.has(d)||(a.add(d),n.push({from:r,to:d,kind:"package-dep",source:"inferred",confidence:"high",evidence:[{file:Z(e,f.join(o,"pyproject.toml")),detail:`path dependency ${c[1]}`}]}));}return n}async function St(e,t,r,o){let s=await he(f.join(o,"go.mod"));if(!s)return [];let n=[],a=new Set,i=/replace\s+\S+\s+=>\s+(\.[^\s]+)/g,c;for(;(c=i.exec(s))!==null;){let d=ee(t,f.resolve(o,c[1]));!d||d===r||a.has(d)||(a.add(d),n.push({from:r,to:d,kind:"package-dep",source:"inferred",confidence:"high",evidence:[{file:Z(e,f.join(o,"go.mod")),detail:`go.mod replace ${c[1]}`}]}));}return n}async function Pt(e,t){let r=[],o=[e];for(;o.length>0&&r.length<t;){let s=o.shift();if(!s)continue;let n=[];try{n=await P.readdir(s,{withFileTypes:true});}catch{continue}let a=[],i=[];for(let c of n)if(c.isDirectory()){if(bt.has(c.name)||c.name.startsWith("."))continue;a.push(f.join(s,c.name));}else c.isFile()&&vt.has(f.extname(c.name))&&i.push(f.join(s,c.name));i.sort((c,d)=>c.localeCompare(d)),a.sort((c,d)=>c.localeCompare(d));for(let c of i){if(r.length>=t)break;r.push(c);}o.push(...a);}return r}var Wt=[/\bfrom\s+["']([^"']+)["']/g,/\bimport\s+["']([^"']+)["']/g,/\bimport\s*\(\s*["']([^"']+)["']\s*\)/g,/\brequire\s*\(\s*["']([^"']+)["']\s*\)/g];function xt(e){let t=new Set;for(let r of Wt){r.lastIndex=0;let o;for(;(o=r.exec(e))!==null;){let s=o[1];s.startsWith(".")&&t.add(s);}}return [...t]}async function ge(e,t,r,o){let s=new Map;for(let[n,a]of t.idToDir.entries()){if(o&&!o.has(n))continue;let i=await Pt(a,r);for(let c of i){let d=await P.stat(c).catch(()=>null);if(!d||d.size>jt)continue;let l=await he(c);if(l)for(let p of xt(l)){let u=f.resolve(f.dirname(c),p),m=ee(t,u);if(!m||m===n)continue;let E=`${n}\0${m}`,w=s.get(E);w||(w={from:n,to:m,evidence:[]},s.set(E,w)),w.evidence.length<Je&&w.evidence.push({file:Z(e,c),detail:`imports ${p}`});}}}return [...s.values()].map(n=>({from:n.from,to:n.to,kind:"code-import",source:"inferred",confidence:"medium",evidence:n.evidence}))}function Rt(e,t,r){let o=new Map;for(let s of r.projects){let n=At(e,t,s);n&&o.set(s.slug,n);}return o}function At(e,t,r){let o=[r.relativePath,r.externalPath].filter(s=>typeof s=="string"&&s.length>0);for(let s of o){let n=f.resolve(e,s),a=t.dirToId.get(n)??ee(t,n);if(a)return a}return t.idToDir.has(r.slug)?r.slug:null}function Qe(e,t,r){let o=[],s=Rt(e,t,r),n=b$3,a=new Map,i=new Map;for(let c of r.projects){let d=s.get(c.slug);if(!d)continue;let l=c.contracts??{publishes:[],consumes:[],dependsOn:[]};for(let p of l.dependsOn??[]){let u=s.get(p);!u||u===d||o.push({from:d,to:u,kind:"service-dependsOn",source:"contract",confidence:"high",evidence:[{file:n,detail:`dependsOn ${p}`}]});}for(let p of l.publishes??[])a.has(p)||a.set(p,new Set),a.get(p)?.add(d);for(let p of l.consumes??[])i.has(p)||i.set(p,new Set),i.get(p)?.add(d);}for(let[c,d]of a.entries()){let l=i.get(c);if(l)for(let p of l)for(let u of d)p!==u&&o.push({from:p,to:u,kind:"event-pub-sub",source:"contract",confidence:"high",evidence:[{file:n,detail:`consumes event ${c}`}]});}return o.push(...It(r,s)),o}function ue(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function It(e,t){let r=[],o=e.projects.map(s=>({project:s,id:t.get(s.slug)})).filter(s=>!!s.id).filter(s=>ue(s.project.slug).length>=3);for(let s of e.projects){let n=t.get(s.slug);if(!n)continue;let a=s.contracts?.env??[];if(a.length===0)continue;let i=new Set;for(let c of a){let d=ue(c);for(let l of o)l.id===n||i.has(l.id)||!(d.includes(ue(l.project.slug))&&(l.project.ports?.length??0)>0)||(i.add(l.id),r.push({from:n,to:l.id,kind:"shared-resource",source:"inferred",confidence:"low",evidence:[{file:b$3,detail:`env ${c} references ${l.project.slug}`}]}));}}return r}async function Ze(e,t){let r=await me(f.join(e,Le)),o=Array.isArray(r?.edges)?r?.edges:[],s=[],n=new Set(Be);for(let a of o){if(!a||typeof a!="object"||Array.isArray(a))continue;let i=a,c=typeof i.from=="string"?i.from:"",d=typeof i.to=="string"?i.to:"",l=typeof i.kind=="string"?i.kind:"";if(!t.has(c)||!t.has(d)||c===d||!n.has(l))continue;let p=Array.isArray(i.evidence)?i.evidence.map(u=>u&&typeof u=="object"&&typeof u.file=="string"?{file:u.file,...typeof u.detail=="string"?{detail:u.detail}:{}}:null).filter(u=>!!u):[];s.push({from:c,to:d,kind:l,source:"manual",confidence:"high",evidence:p.length>0?p:[{file:Le,detail:"manual edge"}]});}return s}function Ft(e){return `${e.from}\0${e.to}\0${e.kind}`}function Mt(e){let t=new Set,r=[];for(let o of e){let s=`${o.file}\0${o.detail??""}`;t.has(s)||(t.add(s),r.push(o));}return r.sort((o,s)=>o.file.localeCompare(s.file)||(o.detail??"").localeCompare(s.detail??"")).slice(0,Je)}function Dt(e){let t=new Map;for(let r of e){let o=Ft(r),s=t.get(o);if(!s){t.set(o,{...r,evidence:[...r.evidence]});continue}let n=ze[s.source],a=ze[r.source];a>n?t.set(o,{...r,evidence:[...r.evidence,...s.evidence]}):a===n&&s.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:Mt(r.evidence)})).sort((r,o)=>r.from.localeCompare(o.from)||r.to.localeCompare(o.to)||r.kind.localeCompare(o.kind)||r.source.localeCompare(o.source))}function fe(e){return Math.round(e*1e3)/1e3}function Gt(e){return Math.max(0,Math.min(100,Math.round(e)))}function Ot(e){return e>=75?"critical":e>=50?"high":e>=20?"medium":"low"}function _t(e){return e==="critical"||e==="high"?"strict":e==="medium"?"elevated":"normal"}function Nt(e,t){let r=a$6({nodes:e,edges:t}),o=new Map;for(let s of e){let n=r.byId.get(s.id)??{fanIn:0,fanOut:0,reach:0,betweenness:0,isHotspot:false},a=t.filter(m=>m.from===s.id||m.to===s.id),i=a.filter(m=>m.source==="contract"||m.source==="manual").length,c=a.filter(m=>m.confidence==="low").length,d=[],l=n.reach*20+n.fanIn*14+n.fanOut*8+Math.min(20,n.betweenness*4)+i*8;n.isHotspot&&(l+=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)`),i>0&&d.push(`${i} contract/manual edge(s)`),c>0&&d.push(`${c} low-confidence inferred edge(s) need review`),a.length===0&&d.push("No dependency evidence connected to this project yet");let p=Gt(l),u=Ot(p);o.set(s.id,{weight:u,score:p,verificationPriority:_t(u),reasons:d.slice(0,5),centrality:{fanIn:n.fanIn,fanOut:n.fanOut,reach:n.reach,betweenness:n.betweenness,isHotspot:n.isHotspot}});}return o}function Tt(e,t){let r=Nt(e,t);return e.map(o=>({...o,operationalProfile:r.get(o.id)}))}function Ht(e,t){let r=new Set;for(let c of t)r.add(c.from),r.add(c.to);let o=e.length,s=t.length,n=e.filter(c=>r.has(c.id)).length,a=Math.max(0,o-n),i=a$6({nodes:e,edges:t});return {nodeCount:o,edgeCount:s,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:a,connectedNodeCount:n,density:fe(o>1?s/(o*(o-1)):0),edgeCoverageRatio:fe(o>0?n/o:1),evidenceCoverageRatio:fe(s>0?t.filter(c=>c.evidence.length>0).length/s:1),hotspotCount:i.hotspots.length,hasCycle:Vt(e,t)}}function $t(e,t,r){let o=[],s=e.filter(n=>!t.some(a=>a.from===n.id||a.to===n.id)).map(n=>n.id).sort((n,a)=>n.localeCompare(a));return r.nodeCount===0&&o.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?o.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:s}):r.orphanCount>0&&o.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:s.slice(0,12)}),r.lowConfidenceEdges>0&&o.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&&o.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&&o.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."}),o.sort((n,a)=>{let i={error:0,warning:1,info:2};return i[n.severity]-i[a.severity]||n.code.localeCompare(a.code)})}function Vt(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 o=0,s=1,n=2,a=new Map;for(let c of r.keys())a.set(c,o);let i=c=>{let d=[{id:c,index:0}];for(a.set(c,s);d.length>0;){let l=d[d.length-1],p=r.get(l.id)??[];if(l.index>=p.length){a.set(l.id,n),d.pop();continue}let u=p[l.index];l.index+=1;let m=a.get(u)??o;if(m===s)return true;m===o&&(a.set(u,s),d.push({id:u,index:0}));}return false};for(let c of [...r.keys()].sort())if(a.get(c)===o&&i(c))return true;return false}function et(e,t,r,o){let s=Dt(r.filter(c=>t.has(c.from)&&t.has(c.to))),n=Tt(e,s),a=Ht(e,s),i=$t(e,s,a);return {schemaVersion:Ke,generatedAt:(o??new Date).toISOString(),nodes:n,edges:s,stats:a,...i.length>0?{diagnostics:i}:{}}}async function tt(e){let t=f.resolve(e.workspacePath),r=e.maxImportFilesPerProject??Ue,o=qe(e.model),s=new Set(o.map(i=>i.id)),n=Xe(t,e.model),a=[];return a.push(...await Ye(t,n)),a.push(...await ge(t,n,r)),e.contract&&a.push(...Qe(t,n,e.contract)),a.push(...await Ze(t,s)),et(o,s,a,e.now)}async function rt(e){let t=f.resolve(e.workspacePath),r=e.maxImportFilesPerProject??Ue,o=qe(e.model),s=new Set(o.map(i=>i.id)),n=Xe(t,e.model),a=[];if(a.push(...await Ye(t,n)),e.structuralChange)a.push(...await ge(t,n,r));else {a.push(...await ge(t,n,r,e.changedProjectIds));for(let i of e.previousGraph.edges)i.kind==="code-import"&&i.source==="inferred"&&!e.changedProjectIds.has(i.from)&&s.has(i.from)&&s.has(i.to)&&a.push({from:i.from,to:i.to,kind:"code-import",source:"inferred",confidence:i.confidence,evidence:i.evidence});}return e.contract&&a.push(...Qe(t,n,e.contract)),a.push(...await Ze(t,s)),et(o,s,a,e.now)}var ye="workspace-model-cache.v1",ke=".workspai/cache/workspace-model.v1.json",nt=["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"],ot=[".workspai/workspace.contract.json",".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"],Lt=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs"]),zt=new Set([".git",".workspai",".rapidkit","node_modules","dist","build","out","target","coverage",".next",".turbo",".cache",".venv"]),Ut=1500,K=null;function we(){if(K)return K;try{K=createRequire(import.meta.url)("../package.json")?.version??"0.0.0";}catch{K="0.0.0";}return K}async function te(e){try{let t=await P.readFile(e);return yt.createHash("sha256").update(t).digest("hex")}catch{return null}}async function Jt(e){let t={};for(let s of nt){let n=await te(f.join(e,s));n&&(t[s]=n);}let r=[],o=[e];for(;o.length>0&&r.length<Ut;){let s=o.shift();if(!s)continue;let n=[];try{n=await P.readdir(s,{withFileTypes:true});}catch{continue}let a=[];for(let i of n)if(i.isDirectory()){if(zt.has(i.name)||i.name.startsWith("."))continue;a.push(f.join(s,i.name));}else if(i.isFile()&&Lt.has(f.extname(i.name))){let c=f.join(s,i.name),d=await P.stat(c).catch(()=>null);if(d){let l=f.relative(e,c).split(f.sep).join("/");r.push(`${l}:${d.size}:${Math.round(d.mtimeMs)}`);}}a.sort((i,c)=>i.localeCompare(c)),o.push(...a);}return r.sort((s,n)=>s.localeCompare(n)),M({manifests:t,source:r})}async function re(e,t){let r=f.resolve(e),o={},s=[...new Set(t.map(n=>f.relative(r,f.resolve(n)).split(f.sep).join("/")))].sort((n,a)=>n.localeCompare(a));for(let n of s)o[n]=await Jt(f.join(r,n));return o}async function ne(e){let t=f.resolve(e),r={};for(let o of ot){let s=await te(f.join(t,o));s&&(r[o]=s);}return r}async function oe(e){let t=f.resolve(e.workspacePath),r=[...new Set(e.projectPaths.map(n=>f.relative(t,f.resolve(n)).split(f.sep).join("/")))].sort((n,a)=>n.localeCompare(a)),o=[];for(let n of r){let a={};for(let i of nt){let c=await te(f.join(t,n,i));c&&(a[i]=c);}o.push({project:n,manifests:a});}let s={};for(let n of ot){let a=await te(f.join(t,n));a&&(s[n]=a);}return M({cacheSchema:ye,cliVersion:e.cliVersion,flags:e.flags,workspaceJson:e.workspaceJson??null,marker:e.marker??null,projects:o,workspaceFiles:s})}async function ve(e){let t=await f$1(e,ke)??c$1(e,ke);try{if(!await P.pathExists(t))return null;let r=await P.readJson(t);return !r||r.schemaVersion!==ye||typeof r.inputsHash!="string"||typeof r.cliVersion!="string"||!r.model?null:r}catch{return null}}async function se(e,t){let r={schemaVersion:ye,...t};return g(e,ke,r)}var st="rapidkit-fact-freshness-v1",L={durable:720*60*60,derived:10080*60,evidenceBacked:1440*60,live:300,verifyBeforeUse:1440*60};function qt(e){switch(e){case "durable":return L.durable;case "derived":return L.derived;case "evidence-backed":return L.evidenceBacked;case "live":return L.live;case "verify-before-use":return L.verifyBeforeUse}}function Xt(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 Yt(e){let t=e.now??new Date,r=e.generatedAt??t.toISOString(),o=Date.parse(r),s=Number.isFinite(o),n=s?r:t.toISOString(),a=e.ttlSeconds===void 0?qt(e.kind):e.ttlSeconds,i=Xt({generatedAt:n,ttlSeconds:a,status:e.status??(s?void 0:"unknown"),now:t}),c=Date.parse(n),d=a===null||!Number.isFinite(c)?void 0:new Date(c+a*1e3),l=e.verifyBeforeUse??(e.kind==="live"||e.kind==="verify-before-use"||e.category!=="structure"||i!=="fresh");return {schemaVersion:st,kind:e.kind,category:e.category,generatedAt:n,ttlSeconds:a,...d?{expiresAt:d.toISOString()}:{},status:i,verifyBeforeUse:l,...e.sourceArtifact?{sourceArtifact:e.sourceArtifact}:{},...e.sourcePath?{sourcePath:e.sourcePath}:{},inputsHash:e.inputsHash??M(e.value??null),reason:e.reason}}function v(e){return {id:e.id,label:e.label,scope:e.scope,value:e.value,...e.project?{project:e.project}:{},freshness:Yt({...e.freshness,value:e.value})}}function at(e){let t=e.generatedAt??(e.now??new Date).toISOString(),r={durable:0,derived:0,"evidence-backed":0,live:0,"verify-before-use":0},o={structure:0,verification:0,state:0},s=0,n=0,a=0,i=0;for(let c of e.facts)r[c.freshness.kind]+=1,o[c.freshness.category]+=1,c.freshness.status==="stale"&&(s+=1),c.freshness.status==="unknown"&&(n+=1),c.freshness.kind==="live"&&(a+=1),c.freshness.verifyBeforeUse&&(i+=1);return {schemaVersion:st,generatedAt:t,status:s>0?"stale":n>0?"unknown":"fresh",totalFacts:e.facts.length,staleFacts:s,unknownFacts:n,liveFacts:a,verifyBeforeUseFacts:i,byKind:r,byCategory:o}}var Qt=b$1.model,ct=a.model,Zt=["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","deps.edn","project.clj","build.sbt","docker-compose.yml","docker-compose.yaml","terraform.tf"],er=new Set([".git",".hg",".svn",".workspai",".rapidkit",".venv","node_modules","dist","build","target","coverage","htmlcov",".next",".turbo"]);function dt(e,t){return (f.relative(e,t)||".").split(f.sep).join("/")}async function pt(e){try{if(!await P.pathExists(e))return null;let t=await P.readJSON(e);return t&&typeof t=="object"?t:null}catch{return null}}async function tr(e,t){for(let r of t)if(await P.pathExists(f.join(e,r)))return true;return false}function be(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 je(e,t){let r=f.resolve(e),o=[{dirPath:r,depth:0}],s=new Set,n=new Set;for(;o.length>0;){let a=o.shift();if(!a)continue;let i=f.resolve(a.dirPath);if(n.has(i))continue;if(n.add(i),i!==r&&await tr(i,Zt)){s.add(i);continue}if(a.depth>=t)continue;let c=[];try{c=await P.readdir(i,{withFileTypes:true});}catch{continue}for(let d of c)!d.isDirectory()||er.has(d.name)||d.name.startsWith(".")&&d.name!==".config"||o.push({dirPath:f.join(i,d.name),depth:a.depth+1});}return Array.from(s).sort((a,i)=>a.localeCompare(i))}function Ce(e){let t=new Set,r=[];for(let o of e){let s=f.resolve(o);t.has(s)||(t.add(s),r.push(s));}return r.sort((o,s)=>o.localeCompare(s))}function it(e,t){let r=e?.[t];return typeof r=="string"&&r.trim()?r.trim():void 0}function rr(e,t){return e?.[t]===true}function nr(e,t,r){let o=e?.frontend&&typeof e.frontend=="object"&&!Array.isArray(e.frontend)?e.frontend:void 0,s=it(o,"generator"),n=it(o,"command_display"),a=typeof t=="string"&&t.startsWith("frontend.");if(!(!s&&!a))return {...s?{id:s}:{},...t?{kit:t}:{},displayName:r,source:rr(o,"official_generator")?"official-generator":"metadata",...n?{commandDisplay:n}:{}}}async function or(e){let t=[".workspai/project.json",".workspai/context.json",".rapidkit/project.json",".rapidkit/context.json","package.json","pyproject.toml","requirements.txt","go.mod","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","composer.json","Gemfile","mix.exs","deno.json","Dockerfile","docker-compose.yml","README.md"],r=[];for(let o of t)await P.pathExists(f.join(e,o))&&r.push(o);return r}async function S(e,t,r,o=t){let s=await f$1(e,t),n=s!==null,a={path:o.split(f.sep).join("/"),exists:n};if(s&&r){let i=await pt(s);typeof i?.generatedAt=="string"&&(a.generatedAt=i.generatedAt);let c=i?.status??i?.result??i?.verdict;typeof c=="string"&&(a.status=c);}return a}async function sr(e,t,r){let o=dt(e,t),s=".workspai/reports",n=c=>S(t,`${s}/${c}`,r,`${o}/${s}/${c}`),a=await n("doctor-project-last-run.json");return {doctor:a?.exists===true?a: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 ar(e,t,r){let o=d(t),s=i(t,o),n=q(t),a=a$5(s.runtime),i$1=await $e(t,o),c=typeof o?.name=="string"&&o.name.trim()?o.name.trim():f.basename(t),d$1=typeof o?.kit_name=="string"?o.kit_name:typeof o?.kit=="string"?o.kit:void 0,l=typeof o?.engine=="string"?o.engine:n.engine!=="unknown"?n.engine:void 0,p=nr(o,d$1,s.displayName),u=Ve({kitId:d$1,framework:s.key,runtime:s.runtime});return {name:c,path:dt(e,t),...r.includeAbsolutePaths?{absolutePath:t}:{},kind:i$1,runtime:s.runtime,runtimeCandidates:h(t),framework:s.key,frameworkDisplayName:s.displayName,confidence:s.confidence,detectionSource:s.source,supportTier:s.supportTier,runtimeSupportTier:a.tier,runtimeDoctorSupport:a.doctorSupport,moduleSupport:n.moduleSupport,...d$1?{kit:d$1}:{},...l?{engine:l}:{},...p?{generator:p}:{},createCapability:u,commands:{supported:n.supportedCommands,unsupported:n.unsupportedCommands,global:n.globalCommands,fleetStages:n.fleetStages,localOnly:n.localOnlyCommands,map:n.commandMap},importantFiles:await or(t),evidence:await sr(e,t,r.includeEvidence),provenance:{path:"filesystem discovery",runtime:s.source,framework:s.source,commands:"project command capability matrix",createCapability:"create planner capability contract",evidence:"project .workspai/reports"}}}async function Ee(e){for(let t of o(e,"workspace.json")){let r=await pt(t);if(r)return r}return null}function ir(e){return e.length===0?"empty-workspace":e.some(t=>t.kind==="frontend")&&e.length>1?"full-stack-workspace":e.some(t=>t.kind==="frontend")?"frontend-workspace":e.length>1?"backend-platform":"backend-workspace"}function cr(e){let t=new Set;for(let r of e){let o=`${r.name} ${r.path}`.toLowerCase();for(let s of ["auth","billing","payment","notification","order","admin","report","search","analytics"])o.includes(s)&&t.add(s);}return Array.from(t).sort()}function C(e,t,r,o){return {severity:e,code:t,message:r,target:o}}function lt(e){let t=[];e.workspace.name.trim()||t.push(C("error","workspace.name.missing","Workspace name could not be resolved.","workspace")),e.workspace.type==="observed-workspace"&&t.push(C("warning","workspace.marker.missing","Workspace marker is missing; model is based on filesystem observation.","workspace.marker")),e.summary.projectCount===0&&t.push(C("warning","workspace.projects.empty","No project roots were detected in this workspace.","projects")),e.contracts.exists||t.push(C("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 a=n.name.toLowerCase(),i=r.get(a)??[];i.push(n),r.set(a,i),n.importantFiles.length||t.push(C("warning","project.markers.missing",`Project ${n.name} has no important manifest files recorded.`,n.path)),n.runtime==="unknown"&&t.push(C("warning","project.runtime.unknown",`Project ${n.name} runtime could not be confidently detected.`,n.path));let c=["test","build"];for(let p of c)n.commands.supported.includes(p)&&n.commands.unsupported.includes(p)&&t.push(C("error","project.commands.conflict",`Project ${n.name} marks ${p} as both supported and unsupported.`,n.path));let d=new Set(n.commands.fleetStages),l=new Set(n.commands.localOnly);for(let p of n.commands.fleetStages){l.has(p)&&t.push(C("error","project.commands.scope-conflict",`Project ${n.name} marks ${p} as both fleet and local-only.`,n.path));let u=n.commands.map[p];(!u||u.status!=="supported"||u.fleetEligible!==true||u.executionScope!=="fleet")&&t.push(C("error","project.commands.fleet-stage-invalid",`Project ${n.name} advertises ${p} as a fleet stage without a supported fleet capability.`,n.path));}for(let p of n.commands.localOnly){let u=n.commands.map[p];(!u||u.status!=="supported"||u.executionScope!=="local-only"||u.fleetEligible===true)&&t.push(C("error","project.commands.local-only-invalid",`Project ${n.name} advertises ${p} as local-only without a matching local-only capability.`,n.path));}for(let p of Object.values(n.commands.map))p.status==="supported"&&(p.fleetEligible===true&&!d.has(p.command)&&t.push(C("error","project.commands.fleet-stage-missing",`Project ${n.name} capability ${p.command} is fleet-eligible but missing from fleetStages.`,n.path)),p.executionScope==="local-only"&&p.fleetEligible!==true&&!l.has(p.command)&&t.push(C("error","project.commands.local-only-missing",`Project ${n.name} capability ${p.command} is local-only but missing from localOnly commands.`,n.path)));}for(let[n,a]of r.entries())a.length>1&&t.push(C("error","project.name.duplicate",`Project name "${n}" is ambiguous across ${a.length} project roots.`,a.map(i=>i.path).join(", ")));let o=t.filter(n=>n.severity==="error").length,s=t.filter(n=>n.severity==="warning").length;return {status:o>0?"failed":s>0?"warning":"passed",errors:o,warnings:s,issues:t}}function gn(e){return lt(e)}function b(e){return e.join(".")}function dr(e,t){let r=ct,o=e.generatedAt,s=[v({id:"workspace.name",label:"Workspace name",scope:"workspace",value:e.workspace.name,freshness:{kind:"durable",category:"structure",generatedAt:o,now:t,sourceArtifact:r,sourcePath:b(["workspace","name"]),reason:"Workspace identity is structural metadata and changes through workspace setup."}}),v({id:"workspace.type",label:"Workspace type",scope:"workspace",value:e.identity.workspaceType,freshness:{kind:"derived",category:"structure",generatedAt:o,now:t,sourceArtifact:r,sourcePath:b(["identity","workspaceType"]),reason:"Workspace type is derived from the current project inventory."}}),v({id:"workspace.projectCount",label:"Project count",scope:"workspace",value:e.summary.projectCount,freshness:{kind:"derived",category:"structure",generatedAt:o,now:t,sourceArtifact:r,sourcePath:b(["summary","projectCount"]),reason:"Project count is derived from workspace discovery and should be refreshed after structural changes."}}),v({id:"workspace.runtimeFamilies",label:"Runtime families",scope:"workspace",value:e.identity.runtimeFamilies,freshness:{kind:"derived",category:"structure",generatedAt:o,now:t,sourceArtifact:r,sourcePath:b(["identity","runtimeFamilies"]),reason:"Runtime coverage is inferred from project surfaces."}}),v({id:"workspace.policyMode",label:"Workspace policy mode",scope:"policy",value:e.policies.mode,freshness:{kind:"durable",category:"structure",generatedAt:o,now:t,sourceArtifact:r,sourcePath:b(["policies","mode"]),reason:"Policy mode is configuration, not runtime state."}}),v({id:"workspace.contract.exists",label:"Workspace contract presence",scope:"contract",value:e.contracts.exists,freshness:{kind:"derived",category:"structure",generatedAt:o,now:t,sourceArtifact:r,sourcePath:b(["contracts","exists"]),reason:"Contract presence is derived from workspace files and should be refreshed before release gating."}})];e.graph&&s.push(v({id:"graph.edgeCount",label:"Dependency graph edge count",scope:"graph",value:e.graph.stats.edgeCount,freshness:{kind:"derived",category:"structure",generatedAt:e.graph.generatedAt??o,now:t,sourceArtifact:r,sourcePath:b(["graph","stats","edgeCount"]),reason:"Graph topology is derived from manifests, imports, and workspace contracts."}}),v({id:"graph.evidenceCoverageRatio",label:"Dependency graph evidence coverage",scope:"graph",value:e.graph.stats.evidenceCoverageRatio,freshness:{kind:"derived",category:"structure",generatedAt:e.graph.generatedAt??o,now:t,sourceArtifact:r,sourcePath:b(["graph","stats","evidenceCoverageRatio"]),reason:"Graph evidence coverage changes when dependency evidence or contract edges change."}}));for(let[n,a]of e.projects.entries()){let i=`projects[${n}]`,c={kind:"derived",category:"structure",generatedAt:o,now:t,sourceArtifact:r,reason:"Project facts are derived from workspace discovery, project metadata, and framework probes."};s.push(v({id:`project.${a.name}.kind`,label:`${a.name} kind`,scope:"project",project:a.name,value:a.kind,freshness:{...c,sourcePath:b([i,"kind"])}}),v({id:`project.${a.name}.runtime`,label:`${a.name} runtime`,scope:"project",project:a.name,value:a.runtime,freshness:{...c,sourcePath:b([i,"runtime"])}}),v({id:`project.${a.name}.framework`,label:`${a.name} framework`,scope:"project",project:a.name,value:a.frameworkDisplayName,freshness:{...c,sourcePath:b([i,"frameworkDisplayName"])}}),v({id:`project.${a.name}.supportTier`,label:`${a.name} support tier`,scope:"project",project:a.name,value:a.supportTier,freshness:{...c,sourcePath:b([i,"supportTier"])}}),v({id:`project.${a.name}.safeFleetStages`,label:`${a.name} safe fleet stages`,scope:"command",project:a.name,value:a.commands.fleetStages,freshness:{...c,sourcePath:b([i,"commands","fleetStages"]),reason:"Safe command availability is derived from package and project command surfaces."}}));for(let[d,l]of Object.entries(a.evidence))s.push(v({id:`project.${a.name}.evidence.${d}`,label:`${a.name} ${d} evidence`,scope:"evidence",project:a.name,value:l?{path:l.path,exists:l.exists,status:l.status??null}:{exists:false},freshness:{kind:l?.exists?"evidence-backed":"verify-before-use",category:"verification",generatedAt:l?.generatedAt??o,now:t,status:l?.exists?void 0:"unknown",sourceArtifact:l?.path??r,sourcePath:b([i,"evidence",d]),verifyBeforeUse:true,reason:l?.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[n,a]of Object.entries(e.evidence))s.push(v({id:`workspace.evidence.${n}`,label:`Workspace ${n} 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??o,now:t,status:a?.exists?void 0:"unknown",sourceArtifact:a?.path??r,sourcePath:b(["evidence",n]),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 s}async function ae(e){let t=f.resolve(e.workspacePath),r=e.includeAbsolutePaths===true,o$1=e.includeEvidence===true,s=be(e.observableScanDepth),n=e.now??new Date,[a$4,i,c,d,l]=await Promise.all([a$1(t),Ee(t),a$2(t),a$3(t,{descendIntoMatchedProjects:false}),je(t,s)]),p=Ce([...d,...l,...c.map(g=>f.isAbsolute(g.path)?g.path:f.join(t,g.path))]),u=e.reuseProjectModels,m=await Promise.all(p.map(g=>{if(u){let ut=f.relative(t,f.resolve(g)).split(f.sep).join("/"),Se=u.get(ut);if(Se)return Promise.resolve(Se)}return ar(t,g,{includeAbsolutePaths:r,includeEvidence:o$1})})),E=typeof i?.workspace_name=="string"?i.workspace_name:typeof i?.name=="string"?i.name:a$4?.name||f.basename(t),w=typeof i?.profile=="string"?i.profile:typeof i?.mode=="string"?i.mode:void 0,G=Array.from(new Set(m.map(g=>g.kind))).sort(),A=Array.from(new Set(m.map(g=>g.runtime))).sort(),ie=Array.from(new Set(m.map(g=>g.framework))).sort(),O=[".workspai/policies.yml",".workspai/policies.yaml",".rapidkit/policies.yml",".rapidkit/policies.yaml"].find(g=>P.existsSync(f.join(t,g))),_=o(t,"workspace.contract.json").map(g=>f.relative(t,g).split(f.sep).join("/")).find(g=>P.existsSync(f.join(t,g)))??".workspai/workspace.contract.json",W=await P.pathExists(f.join(t,_)),z={schemaVersion:Qt,generatedAt:n.toISOString(),workspace:{name:E,root:t,...w?{profile:w}:{},type:a$4?"rapidkit-workspace":"observed-workspace",...a$4?{marker:{createdBy:a$4.createdBy,version:a$4.version,createdAt:a$4.createdAt}}:{}},identity:{workspaceType:ir(m),surfaces:G,runtimeFamilies:A,businessCapabilities:cr(m)},discovery:{observableScanDepth:s},projects:m,policies:{mode:typeof i?.policy_mode=="string"?i.policy_mode:typeof i?.policyMode=="string"?i.policyMode:"warn",source:O??null,exists:!!O},contracts:{workspaceContractPath:_,exists:W,status:W?"known":"missing"},evidence:{doctor:await S(t,a.doctor,o$1),projectDoctor:await S(t,".workspai/reports/doctor-project-last-run.json",o$1),doctorRemediationPlan:await S(t,".workspai/reports/doctor-remediation-plan-last-run.json",o$1),artifactRemediationPlan:await S(t,".workspai/reports/artifact-remediation-plan-last-run.json",o$1),doctorFixResult:await S(t,".workspai/reports/doctor-fix-result-last-run.json",o$1),analyze:await S(t,a.analyze,o$1),readiness:await S(t,a.readiness,o$1),pipeline:await S(t,".workspai/reports/pipeline-last-run.json",o$1)},summary:{projectCount:m.length,runtimes:A,frameworks:ie,firstClassProjects:m.filter(g=>g.supportTier==="first-class").length,observedProjects:m.filter(g=>g.supportTier==="observed").length}},N=await fr(t,z,{contractExists:W,now:n,incrementalGraph:e.incrementalGraph}),T={...z,graph:N},y=lt(T),j=dr({...T},n),I=at({facts:j,generatedAt:n.toISOString(),now:n});return {...T,facts:j,factFreshness:I,validation:y}}async function hn(e){if(e.cache!==true)return {model:await ae(e),cache:"disabled"};let t=f.resolve(e.workspacePath),r=be(e.observableScanDepth),o=we(),[s,n,a,i,c]=await Promise.all([a$1(t),Ee(t),a$2(t),a$3(t,{descendIntoMatchedProjects:false}),je(t,r)]),d=Ce([...i,...c,...a.map(w=>f.isAbsolute(w.path)?w.path:f.join(t,w.path))]),l=await oe({workspacePath:t,cliVersion:o,flags:{includeAbsolutePaths:e.includeAbsolutePaths===true,includeEvidence:e.includeEvidence===true,observableScanDepth:r},projectPaths:d,workspaceJson:n,marker:s}),p=await ve(t);if(p&&p.cliVersion===o&&p.inputsHash===l)return {model:p.model,cache:"hit"};let u=await ae({...e}),[m,E]=await Promise.all([re(t,d),ne(t)]);return await se(t,{cliVersion:o,inputsHash:l,generatedAt:(e.now??new Date).toISOString(),model:u,projectSignatures:m,workspaceFileSignatures:E}),{model:u,cache:"miss"}}function pr(e,t){let r=new Set,o=new Set,s=new Set;for(let[n,a]of Object.entries(t))n in e?e[n]!==a&&r.add(n):o.add(n);for(let n of Object.keys(e))n in t||s.add(n);return {changed:r,added:o,removed:s}}function lr(e={},t={}){let r=new Set([...Object.keys(e),...Object.keys(t)]);for(let o of r)if(e[o]!==t[o])return false;return true}async function kn(e){let t=f.resolve(e.workspacePath),r=be(e.observableScanDepth),o=we(),s=e.now??new Date,[n,a,i,c,d]=await Promise.all([a$1(t),Ee(t),a$2(t),a$3(t,{descendIntoMatchedProjects:false}),je(t,r)]),l=Ce([...c,...d,...i.map(y=>f.isAbsolute(y.path)?y.path:f.join(t,y.path))]),p=await ve(t),u=async()=>{let y=await ae({...e}),j=await oe({workspacePath:t,cliVersion:o,flags:{includeAbsolutePaths:e.includeAbsolutePaths===true,includeEvidence:e.includeEvidence===true,observableScanDepth:r},projectPaths:l,workspaceJson:a,marker:n}),[I,g]=await Promise.all([re(t,l),ne(t)]);return await se(t,{cliVersion:o,inputsHash:j,generatedAt:s.toISOString(),model:y,projectSignatures:I,workspaceFileSignatures:g}),{model:y,mode:"full"}};if(!p||p.cliVersion!==o||!p.projectSignatures||!p.model?.graph)return u();let m=await ne(t);if(!lr(p.workspaceFileSignatures,m))return u();let E=await re(t,l),{changed:w,added:G,removed:A}=pr(p.projectSignatures,E);if(w.size===0&&G.size===0&&A.size===0)return {model:p.model,mode:"unchanged"};let ie=new Set([...w,...G]),O=new Map;for(let y of p.model.projects){let j=y.path.split(f.sep).join("/");!ie.has(j)&&!A.has(j)&&O.set(j,y);}let _=new Set,W=false;for(let y of p.model.projects){let j=y.path.split(f.sep).join("/");w.has(j)&&_.add(y.name);}let z=G.size>0||A.size>0,N=await ae({...e,reuseProjectModels:O,incrementalGraph:{previousGraph:p.model.graph,changedProjectIds:_,structuralChange:z||W}});for(let y of p.model.projects){let j=y.path.split(f.sep).join("/");if(!w.has(j))continue;let I=N.projects.find(g=>g.path.split(f.sep).join("/")===j);if(I&&I.name!==y.name){W=true;break}}if(W)return u();let T=await oe({workspacePath:t,cliVersion:o,flags:{includeAbsolutePaths:e.includeAbsolutePaths===true,includeEvidence:e.includeEvidence===true,observableScanDepth:r},projectPaths:l,workspaceJson:a,marker:n});return await se(t,{cliVersion:o,inputsHash:T,generatedAt:s.toISOString(),model:N,projectSignatures:E,workspaceFileSignatures:m}),{model:N,mode:"incremental"}}async function ur(e){try{let{contract:t}=await j$1({workspacePath:e});return t&&typeof t=="object"?t:null}catch{return null}}async function fr(e,t,r){let o=r.contractExists?await ur(e):null;try{return r.incrementalGraph?await rt({workspacePath:e,model:t,contract:o,now:r.now,previousGraph:r.incrementalGraph.previousGraph,changedProjectIds:r.incrementalGraph.changedProjectIds,structuralChange:r.incrementalGraph.structuralChange}):await tt({workspacePath:e,model:t,contract:o,now:r.now})}catch{let s=t.projects.map(n=>({id:n.name,path:n.path}));return {schemaVersion:"workspace-dependency-graph.v1",generatedAt:r.now.toISOString(),nodes:s,edges:[],stats:{nodeCount:s.length,edgeCount:0,inferredEdges:0,contractEdges:0,manualEdges:0,authoritativeEdges:0,lowConfidenceEdges:0,orphanCount:s.length,connectedNodeCount:0,density:0,edgeCoverageRatio:s.length>0?0:1,evidenceCoverageRatio:1,hotspotCount:0,hasCycle:false},diagnostics:s.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:s.map(n=>n.id).sort((n,a)=>n.localeCompare(a))}]:void 0}}}async function yn(e,t){return g(t,ct,a$4(e))}export{Wr as a,M as b,st as c,v as d,at as e,Ve as f,br as g,$e as h,Ke as i,Qt as j,ct as k,gn as l,dr as m,ae as n,hn as o,kn as p,yn as q};
@@ -1,13 +0,0 @@
1
- import {a as a$1}from'./chunk-JEI6BTZI.js';import {d as d$1,b}from'./chunk-42G2OK64.js';import {g}from'./chunk-ZWO6K24C.js';import {a}from'./chunk-J4AICQFB.js';import {c,e,d}from'./chunk-XIVFLY6G.js';import {n}from'./chunk-HYJK7W3B.js';import {j as j$1,a as a$2}from'./chunk-QWU2CZBG.js';import {g as g$1,b as b$1}from'./chunk-6AA3WWQZ.js';import {a as a$3}from'./chunk-LG6RFLPZ.js';import j from'path';import W from'fs-extra';function G(e$1){switch(e$1){case "why":return d;case "trace":return e;default:return c}}async function P(e,n,o){try{if(!await W.pathExists(e))return null;let r=await W.readJson(e);return n?b$1(n,r,e):o&&a$3(r,o,e),r}catch(r){if((n||o)&&await W.pathExists(e))throw r;return null}}function z(e,n){if(!e)return null;let o=n.trim().toLowerCase();return e.projects.find(r=>r.slug.toLowerCase()===o||r.relativePath.toLowerCase()===o)??null}function J(e,n,o){let r=o.trim().toLowerCase(),t=(e.graph?.nodes.map(a=>a.id)??e.projects.map(a=>a.name)).find(a=>a.toLowerCase()===r);if(t)return t;let d=e.projects.find(a=>[a.name,a.path,j.basename(a.path)].filter(u=>u.trim().length>0).some(u=>u.toLowerCase()===r));if(d)return d.name;let c=z(n,o);if(c){let a=e.projects.find(u=>u.path===c.relativePath||u.path.endsWith(`/${c.relativePath}`));if(a)return a.name}return o}function X(e,n){if(!e)return [];let o=n.trim().toLowerCase(),r=new Set;for(let l of e.projects){l.contracts.dependsOn?.some(t=>t.toLowerCase()===o)&&r.add(l.slug);for(let t of l.contracts.consumes??[])for(let d of e.projects)d.contracts.publishes?.includes(t)&&d.slug===o&&r.add(l.slug);}return [...r].sort()}function Y(e,n){if(!e)return [];let o=n.trim().toLowerCase();return e.steps.filter(r=>r.scope==="project"&&r.project?.toLowerCase()===o&&r.command?.display).map(r=>r.command.display).slice(0,8)}function p(e,n,o){return {id:e,title:n,body:o.trim()}}async function me(e){let n$1=j.resolve(e.workspacePath),o=(e.now??new Date).toISOString(),r=e.model??await n({workspacePath:n$1,includeEvidence:true}),l=e.contract;if(l===void 0)try{l=(await j$1({workspacePath:n$1})).contract;}catch{l=null;}let t=e.verify;t===void 0&&(t=await P(j.join(n$1,d$1),d$1));let d=e.impact;if(d===void 0&&(d=await P(j.join(n$1,g),g)),e.target.kind==="release-blocked"){let s=t?.blockingReasons??[],i=(r.summary?.projectCount??r.projects.length)===0,g=[p("verdict",i?"Workspace scaffold posture":"Release verdict",t?i?`Scaffold posture: **${t.summary.verdict}** (exit ${t.summary.exitCode}). Freshness: **${t.freshness.verdict}**. No registered projects yet \u2014 release gates apply after the first project is added.`:`Verdict: **${t.summary.verdict}** (exit ${t.summary.exitCode}). Risk: **${t.impact.risk}**. Freshness: **${t.freshness.verdict}**.`:"No workspace verify report found. Run `npx workspai workspace verify --json --write` first."),p("blockers",i?"Pre-project signals":"Blocking reasons",s.length?s.map(h=>`- ${h}`).join(`
2
- `):i?"No pre-project signals in the latest verify report.":"No blocking reasons in the latest verify report.")];return t?.resolutionHints?.length&&g.push(p("resolution","Resolution hints",t.resolutionHints.map(h=>`- **${h.blockerId}** (${h.resolutionClass}): ${h.commandRetryHint??h.fixHints[0]?.detail??"See fix hints"}`).join(`
3
- `))),{schemaVersion:a,generatedAt:o,workspacePath:n$1,target:e.target,summary:t?i?b(s.length,t.summary.verdict):`Release blocked: ${t.summary.verdict} with ${s.length} blocking reason(s).`:"Release posture unknown \u2014 verify report missing.",sections:g,releaseRisk:t?.impact.risk,blockingReasons:s,resolutionHints:t?.resolutionHints}}if(e.target.kind==="blocker"){let s=e.target,m=t?.resolutionHints?.find(g=>g.blockerId===s.blockerId),i=t?.blockingReasons.find(g=>g.includes(s.blockerId))??t?.blockingReasons[0];return {schemaVersion:a,generatedAt:o,workspacePath:n$1,target:s,summary:m?`Blocker ${s.blockerId}: ${m.resolutionClass}`:`Blocker ${s.blockerId} (no structured hint)`,sections:[p("reason","Blocking signal",i??"No matching blocking reason in verify."),p("hint","Resolution class",m?`${m.resolutionClass}
4
-
5
- ${m.commandRetryHint??""}
6
-
7
- ${m.fixHints.map(g=>`- ${g.detail}`).join(`
8
- `)}`:"Run workspace verify to emit resolutionHints for this blocker.")],blockingReasons:i?[i]:[],resolutionHints:m?[m]:[]}}if(e.target.kind==="trace"){let s=j.isAbsolute(e.target.diffRef)?e.target.diffRef:j.join(n$1,e.target.diffRef),m=await P(s,void 0,"contracts/workspace-intelligence/workspace-model-diff.v1.json"),i=m?.summary?.changedProjects??[...new Set((m?.changes??[]).map(f=>f.project).filter(Boolean))],h=(r.summary?.projectCount??r.projects.length)===0,T=d?.transitiveImpact?.map(f=>`${f.project?.name??f.target} (d${f.distance??0}, via ${f.via??"\u2014"})`)??[],y=t?.affectedSubgraph;return {schemaVersion:a,generatedAt:o,workspacePath:n$1,target:e.target,summary:i?.length?`Trace from ${i.length} changed project(s) through blast radius to gate coverage.`:h?"Trace: workspace scaffold baseline \u2014 no project changes in the latest diff.":"Trace: diff baseline present with no project changes.",sections:[p("origin","Change origin",i?.length?i.map(f=>`- ${f}`).join(`
9
- `):"No changed projects in diff."),p("blast-radius","Transitive impact",T.length?T.map(f=>`- ${f}`).join(`
10
- `):"No transitive impact report."),p("gate","Subgraph gate",y?`Directly changed: ${y.directlyChanged}; transitive dependents: ${y.transitiveDependents}; covered: ${y.covered}; uncovered: ${y.uncovered}; unverifiable: ${y.unverifiable}.`:"No verify subgraph coverage available.")],releaseRisk:d?.summary?.risk??t?.impact.risk,blockingReasons:t?.blockingReasons}}let c=e.target.project,a$2=J(r,l,c),u=r.graph,k=u?a$1(u,a$2):{found:false,centrality:null,directDependents:[],transitiveDependents:[]},w=z(l,c),E=X(l,c),b$1=Y(t,c),v=r.projects.find(s=>s.name.toLowerCase()===c.toLowerCase()),x=[p("overview","Project overview",v?`${v.name} (${v.frameworkDisplayName}, ${v.runtime}) at \`${v.path}\`.`:`Project **${c}** ${k.found?"exists in graph":"not found in workspace model"}.`),p("consumers","Consumers / dependents",[`Direct dependents: ${k.directDependents.join(", ")||"none"}`,`Contract consumers: ${E.join(", ")||"none"}`,`Transitive dependents (blast radius): ${k.transitiveDependents.length}`].join(`
11
- `)),p("contracts","Critical contracts",w?[`Owns: ${w.contracts?.owns?.join(", ")||"none"}`,`Publishes: ${w.contracts.publishes.join(", ")||"none"}`,`Consumes: ${w.contracts.consumes.join(", ")||"none"}`,`APIs: ${w.contracts.apis.map(s=>s.name).join(", ")||"none"}`].join(`
12
- `):"No workspace.contract.json entry for this project."),p("verification","Required verification",b$1.length?b$1.map(s=>`- ${s}`).join(`
13
- `):"- `npx workspai workspace verify --json`\n- Project test/build via `workspace run` when configured")];k.centrality&&x.push(p("centrality","Graph centrality",`fanIn ${k.centrality.fanIn}, fanOut ${k.centrality.fanOut}, reach ${k.centrality.reach}, hotspot ${k.centrality.isHotspot?"yes":"no"}.`));let I=c.trim().toLowerCase(),A=s=>s.project?.name?.toLowerCase()===I||s.target.toLowerCase()===I,S=d?.affectedProjects?.find(A)?.risk??d?.transitiveImpact?.find(A)?.risk??t?.impact.risk??"unknown";return {schemaVersion:a,generatedAt:o,workspacePath:n$1,target:e.target,summary:`${c}: ${E.length} consumer(s), release risk **${S}**.`,sections:x,releaseRisk:String(S)}}async function fe(e,n,o="explain"){let r=G(o);return await g$1(n,r,a$2(e)),r}export{G as a,me as b,fe as c};