rapidkit 0.41.0 → 0.41.1

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 (163) hide show
  1. package/README.md +12 -5
  2. package/contracts/extension-cli-compatibility.v1.json +1 -1
  3. package/contracts/workspace-intelligence/agent-action-outcome.v1.json +17 -1
  4. package/contracts/workspace-intelligence/workspace-dependency-graph.v1.json +61 -1
  5. package/dist/analyze-QYHMGLSG.js +1 -0
  6. package/dist/autopilot-release-AHMQEUFH.js +1 -0
  7. package/dist/{chunk-WA6JYVJM.js → chunk-33LR2QEM.js} +1 -1
  8. package/dist/{chunk-DMUEGR36.js → chunk-3PTJID76.js} +1 -1
  9. package/dist/chunk-46AGNYI7.js +50 -0
  10. package/dist/chunk-AQ4XZZC6.js +1 -0
  11. package/dist/{chunk-MGUJWRZA.js → chunk-BFEBZABL.js} +3 -3
  12. package/dist/chunk-CDPR2YKL.js +13 -0
  13. package/dist/{chunk-73IS6RIM.js → chunk-CKXJR3YT.js} +1 -1
  14. package/dist/chunk-E5ZVQL3C.js +13 -0
  15. package/dist/chunk-ELU3G6DQ.js +9 -0
  16. package/dist/chunk-EN6YCX36.js +1 -0
  17. package/dist/chunk-FMBSON6H.js +33 -0
  18. package/dist/chunk-GBJBQ43T.js +1 -0
  19. package/dist/{chunk-FPUNOIAR.js → chunk-ITJ6RKUW.js} +3 -3
  20. package/dist/{chunk-XOVB2ZP5.js → chunk-JU3VNLTY.js} +1 -1
  21. package/dist/chunk-JW2FSKT3.js +2 -0
  22. package/dist/{chunk-44GSDNPQ.js → chunk-KIUSCFHF.js} +1 -1
  23. package/dist/{chunk-AT3EQ2S7.js → chunk-LKX3L7TE.js} +1 -1
  24. package/dist/{chunk-KTQZUWAM.js → chunk-RSYUNEH7.js} +13 -13
  25. package/dist/chunk-TJN7G2MA.js +1 -0
  26. package/dist/{chunk-Y2SCTWL4.js → chunk-UQR6G7KH.js} +2 -2
  27. package/dist/chunk-WRMCPKGA.js +1 -0
  28. package/dist/{create-UGXMC4CT.js → create-RNP5ACQL.js} +1 -1
  29. package/dist/demo-kit-N5U3NGAE.js +149 -0
  30. package/dist/{doctor-LCKG5S76.js → doctor-XM6QDTDC.js} +1 -1
  31. package/dist/index.js +118 -117
  32. package/dist/{pipeline-MKNYPNGD.js → pipeline-DH6Z47O4.js} +1 -1
  33. package/dist/platform-capabilities-TSLK667K.js +1 -0
  34. package/dist/{pythonRapidkitExec-MNWRC4F2.js → pythonRapidkitExec-SGKW76XM.js} +1 -1
  35. package/dist/{workspace-FDMJD5XI.js → workspace-E554C5SM.js} +1 -1
  36. package/dist/{workspace-agent-sync-WJIZCZX5.js → workspace-agent-sync-2HRPM5ZD.js} +1 -1
  37. package/dist/{workspace-context-RYOQYGOP.js → workspace-context-VJTXW3K4.js} +1 -1
  38. package/dist/{workspace-contract-ITFCJCHI.js → workspace-contract-OO4GMENV.js} +1 -1
  39. package/dist/workspace-explain-3WSJLIJ6.js +1 -0
  40. package/dist/workspace-explain-contract-24RQ7KIW.js +1 -0
  41. package/dist/{workspace-foundation-SILFUKL5.js → workspace-foundation-LISDH53T.js} +1 -1
  42. package/dist/{workspace-intelligence-YOZQBAK5.js → workspace-intelligence-E3KXEZCM.js} +1 -1
  43. package/dist/workspace-mcp-serve-RFYDCA2L.js +3 -0
  44. package/dist/{workspace-model-VMMLHJWI.js → workspace-model-YL7W3573.js} +1 -1
  45. package/dist/workspace-registry-summary-X5WRUU3T.js +1 -0
  46. package/dist/workspace-run-GCIQD73R.js +1 -0
  47. package/dist/workspace-verify-NRYH7RNB.js +1 -0
  48. package/dist/{workspace-watch-3MEZRSEE.js → workspace-watch-H2AETGFI.js} +1 -1
  49. package/docs/DEVELOPMENT.md +1 -1
  50. package/docs/OPEN_SOURCE_USER_SCENARIOS.md +1 -1
  51. package/docs/README.md +1 -1
  52. package/docs/commands-reference.md +10 -2
  53. package/package.json +7 -3
  54. package/scripts/enterprise-package-smoke.mjs +427 -0
  55. package/scripts/prepack-enterprise.mjs +40 -0
  56. package/templates/generator.js +175 -0
  57. package/templates/kits/fastapi-ddd/README.md.j2 +122 -0
  58. package/templates/kits/fastapi-ddd/common/env.example.j2 +10 -0
  59. package/templates/kits/fastapi-ddd/env.example.j2 +1 -0
  60. package/templates/kits/fastapi-ddd/pyproject.toml.j2 +64 -0
  61. package/templates/kits/fastapi-ddd/src/__init__.py.j2 +3 -0
  62. package/templates/kits/fastapi-ddd/src/app/__init__.py.j2 +11 -0
  63. package/templates/kits/fastapi-ddd/src/app/application/__init__.py.j2 +5 -0
  64. package/templates/kits/fastapi-ddd/src/app/application/interfaces.py.j2 +43 -0
  65. package/templates/kits/fastapi-ddd/src/app/application/use_cases/__init__.py.j2 +6 -0
  66. package/templates/kits/fastapi-ddd/src/app/application/use_cases/health.py.j2 +14 -0
  67. package/templates/kits/fastapi-ddd/src/app/application/use_cases/notes.py.j2 +24 -0
  68. package/templates/kits/fastapi-ddd/src/app/config/__init__.py.j2 +16 -0
  69. package/templates/kits/fastapi-ddd/src/app/domain/__init__.py.j2 +3 -0
  70. package/templates/kits/fastapi-ddd/src/app/domain/models/__init__.py.j2 +6 -0
  71. package/templates/kits/fastapi-ddd/src/app/domain/models/health.py.j2 +16 -0
  72. package/templates/kits/fastapi-ddd/src/app/domain/models/note.py.j2 +27 -0
  73. package/templates/kits/fastapi-ddd/src/app/infrastructure/__init__.py.j2 +5 -0
  74. package/templates/kits/fastapi-ddd/src/app/infrastructure/repositories/__init__.py.j2 +6 -0
  75. package/templates/kits/fastapi-ddd/src/app/infrastructure/repositories/health.py.j2 +17 -0
  76. package/templates/kits/fastapi-ddd/src/app/infrastructure/repositories/notes.py.j2 +28 -0
  77. package/templates/kits/fastapi-ddd/src/app/main.py.j2 +61 -0
  78. package/templates/kits/fastapi-ddd/src/app/presentation/__init__.py.j2 +3 -0
  79. package/templates/kits/fastapi-ddd/src/app/presentation/api/__init__.py.j2 +5 -0
  80. package/templates/kits/fastapi-ddd/src/app/presentation/api/dependencies/__init__.py.j2 +19 -0
  81. package/templates/kits/fastapi-ddd/src/app/presentation/api/router.py.j2 +10 -0
  82. package/templates/kits/fastapi-ddd/src/app/presentation/api/routes/__init__.py.j2 +5 -0
  83. package/templates/kits/fastapi-ddd/src/app/presentation/api/routes/health.py.j2 +27 -0
  84. package/templates/kits/fastapi-ddd/src/app/presentation/api/routes/notes.py.j2 +50 -0
  85. package/templates/kits/fastapi-ddd/src/app/shared/__init__.py.j2 +5 -0
  86. package/templates/kits/fastapi-ddd/src/app/shared/result.py.j2 +28 -0
  87. package/templates/kits/fastapi-ddd/src/cli.py.j2 +167 -0
  88. package/templates/kits/fastapi-ddd/src/main.py.j2 +35 -0
  89. package/templates/kits/fastapi-ddd/src/modules/__init__.py.j2 +3 -0
  90. package/templates/kits/fastapi-ddd/src/routing/__init__.py.j2 +13 -0
  91. package/templates/kits/fastapi-ddd/src/routing/health.py.j2 +7 -0
  92. package/templates/kits/fastapi-ddd/src/routing/notes.py.j2 +7 -0
  93. package/templates/kits/fastapi-ddd/tests/__init__.py.j2 +1 -0
  94. package/templates/kits/fastapi-ddd/tests/test_app_factory.py.j2 +22 -0
  95. package/templates/kits/fastapi-ddd/tests/test_health.py.j2 +17 -0
  96. package/templates/kits/fastapi-ddd/tests/test_notes.py.j2 +27 -0
  97. package/templates/kits/fastapi-standard/README.md.j2 +145 -0
  98. package/templates/kits/fastapi-standard/common/env.example.j2 +10 -0
  99. package/templates/kits/fastapi-standard/env.example.j2 +1 -0
  100. package/templates/kits/fastapi-standard/pyproject.toml.j2 +64 -0
  101. package/templates/kits/fastapi-standard/src/__init__.py.j2 +3 -0
  102. package/templates/kits/fastapi-standard/src/cli.py.j2 +168 -0
  103. package/templates/kits/fastapi-standard/src/main.py.j2 +66 -0
  104. package/templates/kits/fastapi-standard/src/modules/__init__.py.j2 +3 -0
  105. package/templates/kits/fastapi-standard/src/routing/__init__.py.j2 +16 -0
  106. package/templates/kits/fastapi-standard/src/routing/examples.py.j2 +71 -0
  107. package/templates/kits/fastapi-standard/src/routing/health.py.j2 +22 -0
  108. package/templates/kits/fastapi-standard/tests/__init__.py.j2 +1 -0
  109. package/templates/kits/fastapi-standard/tests/test_examples.py.j2 +29 -0
  110. package/templates/kits/fastapi-standard/tests/test_health.py.j2 +17 -0
  111. package/templates/kits/nestjs-standard/Dockerfile.j2 +41 -0
  112. package/templates/kits/nestjs-standard/README.md.j2 +139 -0
  113. package/templates/kits/nestjs-standard/docker-compose.yml.j2 +94 -0
  114. package/templates/kits/nestjs-standard/docs/README.md.j2 +15 -0
  115. package/templates/kits/nestjs-standard/env.example.j2 +18 -0
  116. package/templates/kits/nestjs-standard/eslint.config.cjs.j2 +9 -0
  117. package/templates/kits/nestjs-standard/jest.config.ts.j2 +22 -0
  118. package/templates/kits/nestjs-standard/nest-cli.json.j2 +10 -0
  119. package/templates/kits/nestjs-standard/package.json.j2 +101 -0
  120. package/templates/kits/nestjs-standard/src/app.controller.ts.j2 +14 -0
  121. package/templates/kits/nestjs-standard/src/app.module.ts.j2 +26 -0
  122. package/templates/kits/nestjs-standard/src/app.service.ts.j2 +16 -0
  123. package/templates/kits/nestjs-standard/src/auth/auth.controller.ts.j2 +20 -0
  124. package/templates/kits/nestjs-standard/src/auth/auth.module.ts.j2 +13 -0
  125. package/templates/kits/nestjs-standard/src/auth/auth.service.ts.j2 +6 -0
  126. package/templates/kits/nestjs-standard/src/auth/entities/token.entity.ts.j2 +3 -0
  127. package/templates/kits/nestjs-standard/src/auth/entities/user.entity.ts.j2 +3 -0
  128. package/templates/kits/nestjs-standard/src/auth/entities/webauthn.entity.ts.j2 +3 -0
  129. package/templates/kits/nestjs-standard/src/config/configuration.ts.j2 +85 -0
  130. package/templates/kits/nestjs-standard/src/config/index.ts.j2 +2 -0
  131. package/templates/kits/nestjs-standard/src/config/validation.ts.j2 +21 -0
  132. package/templates/kits/nestjs-standard/src/examples/dto/create-note.dto.ts.j2 +11 -0
  133. package/templates/kits/nestjs-standard/src/examples/examples.controller.ts.j2 +24 -0
  134. package/templates/kits/nestjs-standard/src/examples/examples.module.ts.j2 +10 -0
  135. package/templates/kits/nestjs-standard/src/examples/examples.service.ts.j2 +33 -0
  136. package/templates/kits/nestjs-standard/src/main.ts.j2 +53 -0
  137. package/templates/kits/nestjs-standard/src/modules/index.ts.j2 +25 -0
  138. package/templates/kits/nestjs-standard/test/app.controller.spec.ts.j2 +24 -0
  139. package/templates/kits/nestjs-standard/test/app.e2e-spec.ts.j2 +60 -0
  140. package/templates/kits/nestjs-standard/test/examples.controller.spec.ts.j2 +28 -0
  141. package/templates/kits/nestjs-standard/test/jest-e2e.json.j2 +15 -0
  142. package/templates/kits/nestjs-standard/tsconfig.build.json.j2 +12 -0
  143. package/templates/kits/nestjs-standard/tsconfig.json.j2 +26 -0
  144. package/dist/analyze-JVMUCQ22.js +0 -1
  145. package/dist/autopilot-release-GM5ALPWO.js +0 -1
  146. package/dist/chunk-424B73UF.js +0 -1
  147. package/dist/chunk-56RL5OB6.js +0 -2
  148. package/dist/chunk-AO6PG3K2.js +0 -9
  149. package/dist/chunk-FVCZGUVX.js +0 -1
  150. package/dist/chunk-GX7UU7LL.js +0 -33
  151. package/dist/chunk-P5ODFWB2.js +0 -13
  152. package/dist/chunk-QN2LPLHO.js +0 -1
  153. package/dist/chunk-RIZCWYRR.js +0 -1
  154. package/dist/chunk-YOQ2546V.js +0 -50
  155. package/dist/chunk-Z5LKRG57.js +0 -1
  156. package/dist/chunk-ZQRFVFKK.js +0 -13
  157. package/dist/demo-kit-2VI4H6OJ.js +0 -141
  158. package/dist/workspace-explain-VKSUKP3O.js +0 -1
  159. package/dist/workspace-explain-contract-CLHQ3XEH.js +0 -1
  160. package/dist/workspace-mcp-serve-OOLITFCK.js +0 -3
  161. package/dist/workspace-registry-summary-ZXGKL2NT.js +0 -1
  162. package/dist/workspace-run-IHB2TPMD.js +0 -1
  163. package/dist/workspace-verify-3CAKAZIL.js +0 -1
@@ -1,2 +1,2 @@
1
- import {a as a$1}from'./chunk-HTYMXMQM.js';import {c}from'./chunk-S5KTATOU.js';import {j,h as h$1,g}from'./chunk-QN2LPLHO.js';import {a}from'./chunk-DMUEGR36.js';import pe from'crypto';import u from'path';import y from'fs-extra';import {spawnSync}from'child_process';function S(e,t){let r=spawnSync("git",t,{cwd:e,encoding:"utf8",stdio:["ignore","pipe","ignore"]});return r.status!==0?{ok:false,stdout:""}:{ok:true,stdout:(r.stdout??"").trim()}}function ce(e){let t=[],r=[],n=[];for(let c of e.split(`
1
+ import {j,h as h$1,g}from'./chunk-EN6YCX36.js';import {a as a$1}from'./chunk-HTYMXMQM.js';import {c}from'./chunk-S5KTATOU.js';import {a}from'./chunk-3PTJID76.js';import pe from'crypto';import u from'path';import y from'fs-extra';import {spawnSync}from'child_process';function S(e,t){let r=spawnSync("git",t,{cwd:e,encoding:"utf8",stdio:["ignore","pipe","ignore"]});return r.status!==0?{ok:false,stdout:""}:{ok:true,stdout:(r.stdout??"").trim()}}function ce(e){let t=[],r=[],n=[];for(let c of e.split(`
2
2
  `)){if(!c.trim())continue;let a=c.slice(0,2),i=c.slice(3).trim();if(i){if(a==="??"){r.push(i);continue}a.includes("D")&&n.push(i),t.push(i);}}return {changedFiles:[...new Set(t)].sort(),untrackedFiles:[...new Set(r)].sort(),deletedFiles:[...new Set(n)].sort()}}function L(e,t){let r={available:false,dirty:false,changedFiles:[],untrackedFiles:[],deletedFiles:[]},n=S(e,["rev-parse","--is-inside-work-tree"]);if(!n.ok||n.stdout!=="true")return r;let c=S(e,["rev-parse","--abbrev-ref","HEAD"]),a=S(e,["rev-parse","HEAD"]),i=S(e,["status","--porcelain=v1","--untracked-files=all"]),p=ce(i.stdout),m=p.changedFiles.length>0||p.untrackedFiles.length>0||p.deletedFiles.length>0;return {available:true,branch:c.ok?c.stdout:void 0,commit:a.ok?a.stdout:void 0,ref:t?.ref,dirty:m,changedFiles:p.changedFiles,untrackedFiles:p.untrackedFiles,deletedFiles:p.deletedFiles}}var Q="workspace-model-snapshot.v1",T="workspace-model-diff.v1",$=".rapidkit/reports/workspace-model-snapshot.json",X=".rapidkit/reports/workspace-model-diff-last-run.json",de="workspace-impact.v1",le=".rapidkit/reports/workspace-impact-last-run.json";function Z(e){let t=e.trim().toLowerCase();return t==="git"||t.startsWith("git:")}function me(e){let t=e.trim();return t.toLowerCase()==="git"?"HEAD":t.toLowerCase().startsWith("git:")&&t.slice(4).trim()||"HEAD"}function _(e){if(Array.isArray(e))return e.map(t=>_(t));if(e&&typeof e=="object"){let t={};for(let r of Object.keys(e).sort())t[r]=_(e[r]);return t}return e}function k(e){return JSON.stringify(_(e))}function E(e){let{runId:t,...r}=e,n={...r,generatedAt:"<ignored>",graph:e.graph?{...e.graph,generatedAt:"<ignored>"}:void 0,validation:e.validation?{...e.validation,issues:e.validation.issues.map(c=>({...c})).sort((c,a)=>{let i=`${c.severity}:${c.code}:${c.target}:${c.message}`,p=`${a.severity}:${a.code}:${a.target}:${a.message}`;return i.localeCompare(p)})}:void 0};return pe.createHash("sha256").update(k(n)).digest("hex")}function ee(e,t){return u.isAbsolute(t)?t:u.join(e,t)}async function fe(e){let t=await y.readJson(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Workspace model input is not a JSON object: ${e}`);let r=t;if(r.schemaVersion===Q){let n=r;if(!n.model||n.model.schemaVersion!==g)throw new Error(`Invalid workspace model snapshot: ${e}`);return {model:n.model,hash:n.modelHash||E(n.model)}}if(r.schemaVersion===g){let n=r;return {model:n,hash:E(n)}}throw r.schemaVersion===T?new Error(`workspace diff --from received a diff report (${u.basename(e)}). Use a workspace model snapshot or model report as baseline, e.g. ${$}. To analyze an existing diff report, run: npx rapidkit workspace impact --from ${u.basename(e)} --json`):new Error(`Unsupported workspace model input schema: ${String(r.schemaVersion)}`)}async function ue(e){let t=await y.readJson(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Workspace diff input is not a JSON object: ${e}`);let r=t;if(r.schemaVersion!==T)return null;let n=r;if(!n.currentModel||n.currentModel.schemaVersion!==g||!n.summary||!Array.isArray(n.changes))throw new Error(`Invalid workspace model diff report: ${e}`);return n}async function Ve(e){let t=e.model??await j({workspacePath:e.workspacePath,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,observableScanDepth:e.observableScanDepth,now:e.now});return {schemaVersion:Q,generatedAt:(e.now??new Date).toISOString(),modelHash:E(t),modelRef:h$1,model:t}}async function Ge(e,t){let r=u.join(t,$);return await y.ensureDir(u.dirname(r)),await y.writeJson(r,a(e),{spaces:2}),r}function A(e){return {name:e.name,path:e.path,kind:e.kind,runtime:e.runtime,framework:e.framework,generator:e.generator,supportTier:e.supportTier,commands:e.commands,importantFiles:e.importantFiles}}function h(e,t){e.push(t);}function ge(e,t){let r=[],n=["name","profile","type"],c=["workspaceType","surfaces","runtimeFamilies","businessCapabilities"];for(let a of n){let i=e.workspace[a],p=t.workspace[a];k(i)!==k(p)&&h(r,{type:"workspace.changed",severity:"info",target:`workspace.${a}`,message:`Workspace metadata field changed: ${String(a)}`,before:i,after:p});}for(let a of c){let i=e.identity[a],p=t.identity[a];k(i)!==k(p)&&h(r,{type:"workspace.changed",severity:"info",target:`identity.${a}`,message:`Workspace identity field changed: ${String(a)}`,before:i,after:p});}return k(e.policies)!==k(t.policies)&&h(r,{type:"workspace.changed",severity:"warning",target:"policies",message:"Workspace policy summary changed.",before:e.policies,after:t.policies}),k(e.evidence)!==k(t.evidence)&&h(r,{type:"workspace.changed",severity:"info",target:"evidence",message:"Workspace evidence summary changed.",before:e.evidence,after:t.evidence}),k(e.discovery)!==k(t.discovery)&&h(r,{type:"workspace.changed",severity:"info",target:"discovery",message:"Workspace discovery settings changed.",before:e.discovery,after:t.discovery}),e.contracts.exists!==t.contracts.exists&&h(r,{type:"workspace.changed",severity:t.contracts.exists?"info":"warning",target:t.contracts.workspaceContractPath,message:"Workspace contract presence changed.",before:e.contracts.exists,after:t.contracts.exists}),r}function ke(e,t){let r=e.validation??null,n=t.validation??null;return k(r)===k(n)?[]:[{type:"validation.changed",severity:n?.status==="failed"?"critical":"warning",target:"validation",message:"Workspace model validation changed.",before:r,after:n}]}function he(e,t){let r=[],n=new Map(e.projects.map(a=>[a.path,a])),c=new Map(t.projects.map(a=>[a.path,a]));for(let[a,i]of c.entries()){let p=n.get(a);if(!p){h(r,{type:"project.added",severity:"info",target:a,message:`Project added: ${i.name}`,after:A(i)});continue}let m=A(p),l=A(i);if(k(m)!==k(l)){let f=p.runtime!==i.runtime||p.framework!==i.framework;h(r,{type:"project.changed",severity:f?"warning":"info",target:a,message:`Project changed: ${i.name}`,before:m,after:l});}}for(let[a,i]of n.entries())c.has(a)||h(r,{type:"project.removed",severity:"warning",target:a,message:`Project removed: ${i.name}`,before:A(i)});return r.sort((a,i)=>`${a.type}:${a.target}`.localeCompare(`${i.type}:${i.target}`))}async function we(e){let t=u.resolve(e.workspacePath),r=Z(e.fromPath),n=r?me(e.fromPath):void 0,c=e.fromPath;if(r){let g=u.join(t,$);if(!await y.pathExists(g))throw new Error("Git-aware workspace diff requires an existing snapshot at .rapidkit/reports/workspace-model-snapshot.json. Run: npx rapidkit workspace snapshot --json");c=$;}let a=ee(t,c),i=await fe(a),p=e.model??await j({workspacePath:t,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,observableScanDepth:e.observableScanDepth,now:e.now}),m=E(p),l=[...ge(i.model,p),...he(i.model,p),...ke(i.model,p)],f;e.includeGitObservation!==false&&(f=e.gitObservation??L(t,{ref:n}),f.available&&ve(l,f,p));let v=l.filter(g=>g.type.startsWith("git.")).length,I=i.hash!==m,W=r?`git:${n??"HEAD"}`:u.relative(t,a).split(u.sep).join("/");return {schemaVersion:T,generatedAt:(e.now??new Date).toISOString(),fromRef:W,toRef:h$1,fromHash:i.hash,toHash:m,summary:{changed:I||v>0,addedProjects:l.filter(g=>g.type==="project.added").length,removedProjects:l.filter(g=>g.type==="project.removed").length,changedProjects:l.filter(g=>g.type==="project.changed").length,workspaceChanges:l.filter(g=>g.type==="workspace.changed").length,validationChanges:l.filter(g=>g.type==="validation.changed").length,gitChangedFiles:v},git:f?.available?je(f,n):{available:false,dirty:false,changedFiles:0,untrackedFiles:0,deletedFiles:0},changes:l,currentModel:p}}async function Ne(e,t){let r=u.join(t,X);return await y.ensureDir(u.dirname(r)),await y.writeJson(r,a(e),{spaces:2}),r}function M(e){return {none:0,low:1,medium:2,high:3,critical:4}[e]}function z(e){return e.reduce((t,r)=>M(r)>M(t)?r:t,"none")}var H=["none","low","medium","high","critical"];function ye(e){let t=Math.max(1,M(e)-1);return H[t]}function We(e){let t=Math.min(H.length-1,M(e)+1);return H[t]}function J(e){return e.join(" ")}function w(e,t,r,n){return {id:e,label:t,scope:n.scope,project:n.project,display:J(["npx","rapidkit",...r]),execute:J(["npx","--yes","--package","rapidkit","rapidkit",...r]),required:n.required!==false}}function U(e){let t=`project:${e.name}`,r=e.commands.fleetStages;return [w(`project.${e.name}.init`,`Run init for ${e.name}`,["workspace","run","init","--scope",t,"--json"],{scope:"project",project:e.name,required:r.includes("init")}),w(`project.${e.name}.test`,`Run tests for ${e.name}`,["workspace","run","test","--scope",t,"--json"],{scope:"project",project:e.name,required:r.includes("test")}),w(`project.${e.name}.build`,`Run build for ${e.name}`,["workspace","run","build","--scope",t,"--json"],{scope:"project",project:e.name,required:r.includes("build")}),w(`project.${e.name}.start`,`Run start for ${e.name}`,["workspace","run","start","--scope",t,"--json"],{scope:"project",project:e.name,required:r.includes("start")})]}function D(){return [w("workspace.doctor","Run workspace doctor",["doctor","workspace","--json"],{scope:"workspace"}),w("workspace.contract.verify","Verify workspace contract",["workspace","contract","verify","--json"],{scope:"workspace"}),w("workspace.readiness","Run release readiness",["readiness","--json"],{scope:"workspace"}),w("workspace.analyze","Run workspace analyze",["analyze","--json"],{scope:"workspace",required:false}),w("workspace.pipeline","Run governance pipeline",["pipeline","--json"],{scope:"workspace",required:false}),w("workspace.doctor-fix","Verify doctor fix result",["doctor","workspace","--fix","--json"],{scope:"workspace",required:false})]}function be(e,t){let r=t.split(u.sep).join("/");return e.projects.filter(c=>{let a=c.path.split(u.sep).join("/");return r===a||r.startsWith(`${a}/`)}).sort((c,a)=>a.path.length-c.path.length)[0]}function ve(e,t,r){let n=new Set(e.map(a=>a.target)),c=(a,i)=>{let p=i.split(u.sep).join("/"),m=`git:${p}`;if(n.has(m))return;let l=be(r,p),f=l?`${l.name} (${l.path})`:"workspace";h(e,{type:a,severity:a==="git.deleted"?"warning":"info",target:m,message:`Git ${a==="git.untracked"?"untracked":a==="git.deleted"?"deleted":"changed"} file affects ${f}: ${p}`,after:{path:p,project:l?.name,projectPath:l?.path}}),n.add(m);};for(let a of t.changedFiles)c("git.file.changed",a);for(let a of t.untrackedFiles)c("git.untracked",a);for(let a of t.deletedFiles)c("git.deleted",a);}function je(e,t){return {available:true,ref:t??e.ref,branch:e.branch,commit:e.commit,dirty:e.dirty,changedFiles:e.changedFiles.length,untrackedFiles:e.untrackedFiles.length,deletedFiles:e.deletedFiles.length}}function Me(e){let t=new Set,r=[];for(let n of e){let c=`${n.scope}:${n.project??""}:${n.display}`;t.has(c)||(t.add(c),r.push(n));}return r}function Pe(e){return e.type==="project.removed"?"high":e.severity==="critical"?"critical":e.severity==="warning"?"high":("medium")}function Ie(e,t){return e.severity==="critical"?"critical":e.target==="policies"||e.target.includes("contract")?"high":e.type==="validation.changed"?(t?.projectCount??0)===0?"low":"high":e.target==="evidence"?"low":e.severity==="warning"?"medium":"low"}function Re(e){return e.affectedProjects>0||e.projectCount>0||!e.changes.every(r=>r.severity==="critical"?false:r.type.startsWith("git.")||r.type==="validation.changed")?e.risk:M(e.risk)>=M("high")||e.risk==="medium"?"low":e.risk}function Y(e,t){if(!e||e==="workspace")return true;let r=(e.startsWith("project:")?e.slice(8):e).trim().toLowerCase();return [t.name,t.path,u.basename(t.path),t.absolutePath].filter(n=>typeof n=="string"&&n.trim().length>0).map(n=>n.trim().toLowerCase()).includes(r)}function Ce(e){if(!e.changed)return {headline:"No workspace model impact detected.",bullets:["The current workspace model matches the provided snapshot/report."],unsafeAssumptions:["Do not claim runtime verification passed unless a report exists."]};let t=e.affectedProjects.map(r=>r.project?.name??r.target);return {headline:`Workspace impact risk: ${e.risk}.`,bullets:[`Affected projects: ${t.length?t.join(", "):"none"}.`,`Workspace-level items: ${e.workspaceImpact.length}.`,"Use the verification plan before recommending apply, rollback, or release actions."],unsafeAssumptions:["Do not infer test/build success from impact alone.","Do not apply fixes without project scope and verification evidence.","Use display commands for users and execute commands for automation."]}}async function Be(e){let t=u.resolve(e.workspacePath),r=Z(e.fromPath),n=e.diff;if(!n&&!r){let o=ee(t,e.fromPath);n=await ue(o)??void 0;}n||(n=await we({workspacePath:t,fromPath:e.fromPath,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,includeGitObservation:e.includeGitObservation,gitObservation:e.gitObservation,now:e.now,model:e.model}));let c$1=new Map(n.currentModel.projects.map(o=>[o.path,o])),a=new Map(n.currentModel.projects.map(o=>[o.name,o])),i=n.changes.filter(o=>o.type.startsWith("project.")),p=new Map;for(let o of i){let d=(c$1.get(o.target)??(typeof o.before?.name=="string"?a.get(o.before.name):void 0))?.path??o.target,b=p.get(d)??[];b.push(o),p.set(d,b);}let m=[];for(let[o,s]of p.entries()){let d=c$1.get(o);if(d&&!Y(e.scope,d))continue;let b=z(s.map(Pe)),R=d?.name??(typeof s[0]?.before?.name=="string"?String(s[0].before.name):o);m.push({id:`project:${R}`,scope:"project",target:o,title:`Project impact: ${R}`,summary:s.map(j=>j.message).join(" "),risk:b,reasons:s.map(j=>`${j.type}: ${j.message}`),project:d?{name:d.name,path:d.path,kind:d.kind,runtime:d.runtime,framework:d.framework,supportTier:d.supportTier,...d.generator?{generator:d.generator}:{}}:void 0,verification:d?U(d):D()});}let l=n.currentModel.graph,f=l?a$1(l):void 0,v=new Set(m.map(o=>o.project?.name).filter(o=>typeof o=="string")),I=new Map;for(let o of m)if(o.project?.name){let s=f?.byId.get(o.project.name);s&&(o.centrality={fanIn:s.fanIn,fanOut:s.fanOut,reach:s.reach,betweenness:s.betweenness,isHotspot:s.isHotspot},s.isHotspot&&(o.risk=We(o.risk),o.reasons=[...o.reasons,`graph.hotspot: critical-path project with ${s.reach} transitive dependent(s); risk escalated.`])),o.origin="direct",o.distance=0,I.set(o.project.name,o.risk);}let W=[],g=0;if(l&&v.size>0){let o=c(l,v);for(let s of o.values()){if(s.distance===0||v.has(s.id))continue;let d=a.get(s.id);if(d&&!Y(e.scope,d))continue;let b=s.path[0],R=s.path[s.path.length-2]??b,j=I.get(b)??"medium",oe=ye(j);g=Math.max(g,s.distance),W.push({id:`transitive:${s.id}`,scope:"project",target:d?.path??s.id,title:`Transitive impact: ${s.id}`,summary:`Depends on changed project ${b}${s.via?` via ${s.via}`:""} (distance ${s.distance}).`,risk:oe,reasons:[`graph.dependent: depends on ${R}${s.via?` via ${s.via}`:""} (path ${s.path.join(" -> ")})`],project:d?{name:d.name,path:d.path,kind:d.kind,runtime:d.runtime,framework:d.framework,supportTier:d.supportTier,...d.generator?{generator:d.generator}:{}}:void 0,verification:d?U(d):D(),origin:"transitive",distance:s.distance,path:s.path,via:s.via,...f?.byId.get(s.id)?{centrality:{fanIn:f.byId.get(s.id).fanIn,fanOut:f.byId.get(s.id).fanOut,reach:f.byId.get(s.id).reach,betweenness:f.byId.get(s.id).betweenness,isHotspot:f.byId.get(s.id).isHotspot}}:{}});}}W.sort((o,s)=>o.target.localeCompare(s.target));let te=f?f.hotspots.map(o=>{let s=f.byId.get(o);return {project:o,fanIn:s.fanIn,fanOut:s.fanOut,reach:s.reach,betweenness:s.betweenness}}):[],re=n.changes.filter(o=>!o.type.startsWith("project.")),V=n.currentModel.summary?.projectCount??n.currentModel.projects.length,P=re.map(o=>({id:`workspace:${o.target}`,scope:"workspace",target:o.target,title:`Workspace impact: ${o.target}`,summary:o.message,risk:Ie(o,{projectCount:V}),reasons:[`${o.type}: ${o.message}`],verification:D()})),G=Me([...m.flatMap(o=>o.verification),...W.flatMap(o=>o.verification),...P.flatMap(o=>o.verification),...n.summary.changed?D():[]]).filter(o=>o.required),ne=z([...m.map(o=>o.risk),...W.map(o=>o.risk),...P.map(o=>o.risk)]),N=Re({risk:ne,affectedProjects:m.length,projectCount:V,changes:n.changes}),B={changed:n.summary.changed,risk:N,affectedProjects:m.length,workspaceItems:P.length,recommendedCommands:G.length,blastRadius:{directlyAffected:m.length,transitivelyAffected:W.length,maxDistance:g,graphEdges:l?.edges.length??0}};return {schemaVersion:de,generatedAt:(e.now??new Date).toISOString(),fromRef:n.fromRef,diffRef:X,workspace:{name:n.currentModel.workspace.name,profile:n.currentModel.workspace.profile,type:n.currentModel.workspace.type},summary:B,affectedProjects:m.sort((o,s)=>o.target.localeCompare(s.target)),transitiveImpact:W,criticalPathHotspots:te,workspaceImpact:P.sort((o,s)=>o.target.localeCompare(s.target)),verificationPlan:G,agentBrief:Ce({changed:B.changed,risk:N,affectedProjects:m,workspaceImpact:P}),diff:n}}async function qe(e,t){let r=u.join(t,le);return await y.ensureDir(u.dirname(r)),await y.writeJson(r,a(e),{spaces:2}),r}export{Q as a,T as b,$ as c,X as d,de as e,le as f,Z as g,me as h,Ve as i,Ge as j,we as k,Ne as l,D as m,Be as n,qe as o};
@@ -1,4 +1,4 @@
1
- import {k,e as e$2}from'./chunk-XOVB2ZP5.js';import {b as b$2}from'./chunk-CDCYRBAY.js';import {e,g,f as f$2,b as b$3,c as c$2,d as d$2}from'./chunk-ZQRFVFKK.js';import {a,d,b as b$1}from'./chunk-RV6HBTFC.js';import {b}from'./chunk-Q2KZIBV4.js';import {f,c,e as e$3}from'./chunk-OLDPVVSV.js';import {a as a$1,e as e$1,d as d$1,f as f$1,c as c$1,k as k$1}from'./chunk-Z5LKRG57.js';import {promises}from'fs';import*as P from'fs-extra';import m from'path';import t from'chalk';import {execa}from'execa';async function H(e,o={}){let n=m.resolve(e),r=o.workspaceName??m.basename(n);try{let{registerWorkspace:a}=await import('./workspace-FDMJD5XI.js');await a(n,r);}catch(a){o.silent||console.warn(t.gray(`Note: Could not register workspace in shared registry: ${a?.message??a}`));}try{let{syncWorkspaceContract:a}=await import('./workspace-contract-ITFCJCHI.js'),c=await a({workspacePath:n});if(o.silent||console.log(t.gray(`\u2139\uFE0F Workspace intelligence synced (contract + registry summary, ${c.contract.projects.length} project(s)).`)),!o.silent&&c.verification.status!=="passed"){console.log(t.yellow("\u26A0\uFE0F Workspace contract verification reported issues."));for(let d of c.verification.violations)console.log(t.gray(` Violation: ${d}`));console.log(t.white(" Next: npx rapidkit workspace contract inspect"));}}catch(a){o.silent||console.warn(t.gray(`Note: Could not sync workspace intelligence layer: ${a?.message??a}`));}}function S(){return c$1()}async function B(e,o,n,r){let a=d(o,b(),n);r&&(a.metadata||(a.metadata={}),a.metadata.python={version:r}),await b$1(e,a);}async function z(e){await P.outputFile(m.join(e,".gitignore"),`.venv/
1
+ import {k,e as e$1}from'./chunk-JU3VNLTY.js';import {b as b$2}from'./chunk-CDCYRBAY.js';import {e,g,f as f$1,b as b$4,c as c$1,d as d$1}from'./chunk-E5ZVQL3C.js';import {a,d,b as b$1}from'./chunk-RV6HBTFC.js';import {b}from'./chunk-Q2KZIBV4.js';import {f,c,e as e$2}from'./chunk-OLDPVVSV.js';import {b as b$3,j,i,l,h,q}from'./chunk-WRMCPKGA.js';import {promises}from'fs';import*as P from'fs-extra';import m from'path';import t from'chalk';import {execa}from'execa';async function H(e,o={}){let n=m.resolve(e),r=o.workspaceName??m.basename(n);try{let{registerWorkspace:a}=await import('./workspace-E554C5SM.js');await a(n,r);}catch(a){o.silent||console.warn(t.gray(`Note: Could not register workspace in shared registry: ${a?.message??a}`));}try{let{syncWorkspaceContract:a}=await import('./workspace-contract-OO4GMENV.js'),c=await a({workspacePath:n});if(o.silent||console.log(t.gray(`\u2139\uFE0F Workspace intelligence synced (contract + registry summary, ${c.contract.projects.length} project(s)).`)),!o.silent&&c.verification.status!=="passed"){console.log(t.yellow("\u26A0\uFE0F Workspace contract verification reported issues."));for(let d of c.verification.violations)console.log(t.gray(` Violation: ${d}`));console.log(t.white(" Next: npx rapidkit workspace contract inspect"));}}catch(a){o.silent||console.warn(t.gray(`Note: Could not sync workspace intelligence layer: ${a?.message??a}`));}}function S(){return h()}async function B(e,o,n,r){let a=d(o,b(),n);r&&(a.metadata||(a.metadata={}),a.metadata.python={version:r}),await b$1(e,a);}async function z(e){await P.outputFile(m.join(e,".gitignore"),`.venv/
2
2
  __pycache__/
3
3
  *.pyc
4
4
  .env
@@ -36,11 +36,11 @@ cache:
36
36
  self_heal: true
37
37
  verify_integrity: false
38
38
  `}async function Et(){try{let{stdout:e}=await execa("go",["version"],{timeout:3e3,stdio:"pipe"}),o=e.match(/go(\d+\.\d+(?:\.\d+)?)/i);return o?o[1]:void 0}catch{return}}async function Ct(){try{let{stdout:e}=await execa("dotnet",["--version"],{timeout:3e3,stdio:"pipe"}),o=e.trim();return o.length>0?o:void 0}catch{return}}async function Q(e,o,n,r,a,c){let[d,p]=await Promise.all([Et(),Ct()]);await P.outputFile(m.join(e,".rapidkit","workspace.json"),xt(o,n,r,a,c),"utf-8"),await P.outputFile(m.join(e,".rapidkit","toolchain.lock"),It(n,r,process.version,d,p),"utf-8"),await P.outputFile(m.join(e,".rapidkit","policies.yml"),Rt(),"utf-8"),await P.outputFile(m.join(e,".rapidkit","cache-config.yml"),_t(),"utf-8");}async function ke(e,o){let{workspaceName:n=m.basename(e),installMethod:r="venv",pythonVersion:a$1,profile:c,writeMarker:d$1=true,writeGitignore:p=true,onlyIfMissing:y=true}=o||{},h=[],[g,s]=await Promise.all([Et(),Ct()]),i=[{relPath:m.join(".rapidkit","workspace.json"),content:xt(n,r,a$1,c)},{relPath:m.join(".rapidkit","toolchain.lock"),content:It(r,a$1,process.version,g,s)},{relPath:m.join(".rapidkit","policies.yml"),content:Rt()},{relPath:m.join(".rapidkit","cache-config.yml"),content:_t()}];for(let f of i){let u=m.join(e,f.relPath);y&&await P.pathExists(u)||(await P.outputFile(u,f.content,"utf-8"),h.push(f.relPath));}if(d$1&&(!!!await a(e)||!y)){let u=d(n,b(),r);a$1&&(u.metadata||(u.metadata={}),u.metadata.python={version:a$1}),await b$1(e,u),h.push(".rapidkit-workspace");}if(p){let f=m.join(e,".gitignore");(!y||!await P.pathExists(f))&&(await z(e),h.push(".gitignore"));}return h}var jt=new Set(["go-only","java-only","dotnet-only","node-only","minimal"]),Ot={"python-only":"minimal",polyglot:"node-only",enterprise:"polyglot"};function Vt(e){let o=e,n=new Set;for(;!jt.has(o);){if(n.has(o))return "minimal";n.add(o);let r=Ot[o];if(!r)return "minimal";o=r;}return o}var F="3.10",$t=["3.10","3.11","3.12"];async function Pt(e){try{let{stdout:o}=await execa(e,["--version"],{timeout:3e3}),n=o.match(/Python (\d+\.\d+\.\d+)/);if(n)return n[1]}catch{}return null}async function Lt(e,o){try{await promises.writeFile(m.join(e,".python-version"),`${o}
39
- `,"utf-8"),f.debug(`Created .python-version with ${o}`);}catch(n){f.warn(`Failed to create .python-version: ${n}`);}}function V(){let n=[...(process.env.PATH||"").split(m.delimiter).filter(Boolean)];for(let r of k$1())n.includes(r)||n.unshift(r);process.env.PATH=n.join(m.delimiter);}async function it(e,o){V(),e.start("Checking pipx installation");try{return await execa("pipx",["--version"]),e.succeed("pipx found"),{kind:"binary"}}catch{}let n=S();try{return await execa(n,["-m","pipx","--version"]),e.succeed("pipx found"),{kind:"python-module",pythonCmd:n}}catch{}if(o)throw new d$2;e.stop?.();let{installPipx:r}=await b$2([{type:"confirm",name:"installPipx",message:"pipx is not installed. Install it now (user install via python -m pip)?",default:true}]);if(!r)throw new d$2;e.start("Installing pipx (user install)");try{try{await execa(n,["-m","pip","install","--user","--upgrade","pip"]);}catch{}await execa(n,["-m","pip","install","--user","--upgrade","pipx"]);}catch(a){let c=a,d=String(c?.stderr||c?.shortMessage||c?.message||"");throw new f$2("Install pipx with python -m pip",a instanceof Error?a:new Error(d))}e.succeed("pipx installed"),V();try{return await execa(n,["-m","pipx","--version"]),{kind:"python-module",pythonCmd:n}}catch(a){let c=a,d=String(c?.stderr||c?.shortMessage||c?.message||"pipx not runnable after install");throw new f$2("Verify pipx after install",new Error(`${d}
39
+ `,"utf-8"),f.debug(`Created .python-version with ${o}`);}catch(n){f.warn(`Failed to create .python-version: ${n}`);}}function V(){let n=[...(process.env.PATH||"").split(m.delimiter).filter(Boolean)];for(let r of q())n.includes(r)||n.unshift(r);process.env.PATH=n.join(m.delimiter);}async function it(e,o){V(),e.start("Checking pipx installation");try{return await execa("pipx",["--version"]),e.succeed("pipx found"),{kind:"binary"}}catch{}let n=S();try{return await execa(n,["-m","pipx","--version"]),e.succeed("pipx found"),{kind:"python-module",pythonCmd:n}}catch{}if(o)throw new d$1;e.stop?.();let{installPipx:r}=await b$2([{type:"confirm",name:"installPipx",message:"pipx is not installed. Install it now (user install via python -m pip)?",default:true}]);if(!r)throw new d$1;e.start("Installing pipx (user install)");try{try{await execa(n,["-m","pip","install","--user","--upgrade","pip"]);}catch{}await execa(n,["-m","pip","install","--user","--upgrade","pipx"]);}catch(a){let c=a,d=String(c?.stderr||c?.shortMessage||c?.message||"");throw new f$1("Install pipx with python -m pip",a instanceof Error?a:new Error(d))}e.succeed("pipx installed"),V();try{return await execa(n,["-m","pipx","--version"]),{kind:"python-module",pythonCmd:n}}catch(a){let c=a,d=String(c?.stderr||c?.shortMessage||c?.message||"pipx not runnable after install");throw new f$1("Verify pipx after install",new Error(`${d}
40
40
 
41
- Try reopening your terminal or run: ${n} -m pipx ensurepath`))}}async function O(e,o){return e.kind==="binary"?execa("pipx",o):execa(e.pythonCmd,["-m","pipx",...o])}function Gt(e){let o=e.match(/^(\d+)\.(\d+)/);return o?`${o[1]}.${o[2]}`:null}function bt(e){if(!e)return null;let o=e.match(/Python\s+(\d+)\.(\d+)(?:\.\d+)?/i);return o?`${o[1]}.${o[2]}`:null}function ut(e,o){let[n,r]=e.split(".").map(d=>Number(d)),[a,c]=o.split(".").map(d=>Number(d));return n!==a?n-a:r-c}function U(e,o){return ut(e,o)>=0}async function Wt(e){let o=new Set,n=e$1(14,10);for(let s of n)try{let i=await execa(s.command,s.args,{timeout:2500}),f=bt(`${i.stdout||""}
41
+ Try reopening your terminal or run: ${n} -m pipx ensurepath`))}}async function O(e,o){return e.kind==="binary"?execa("pipx",o):execa(e.pythonCmd,["-m","pipx",...o])}function Gt(e){let o=e.match(/^(\d+)\.(\d+)/);return o?`${o[1]}.${o[2]}`:null}function bt(e){if(!e)return null;let o=e.match(/Python\s+(\d+)\.(\d+)(?:\.\d+)?/i);return o?`${o[1]}.${o[2]}`:null}function ut(e,o){let[n,r]=e.split(".").map(d=>Number(d)),[a,c]=o.split(".").map(d=>Number(d));return n!==a?n-a:r-c}function U(e,o){return ut(e,o)>=0}async function Wt(e){let o=new Set,n=j(14,10);for(let s of n)try{let i=await execa(s.command,s.args,{timeout:2500}),f=bt(`${i.stdout||""}
42
42
  ${i.stderr||""}`);f&&U(f,F)&&o.add(f);}catch{}let r=null;try{let s=await execa(S(),["--version"],{timeout:2500}),i=bt(`${s.stdout||""}
43
- ${s.stderr||""}`);i&&U(i,F)&&(r=i,o.add(i));}catch{}let a=$t.filter(s=>U(s,F)),c=new Set([...a,...o]),d=Array.from(c).sort((s,i)=>ut(i,s)),p=e?Gt(e):null,y=p&&U(p,F)?p:r||d[0]||F;return c.has(y)||c.add(y),{choices:Array.from(c).sort((s,i)=>ut(i,s)).map(s=>{let i=[];return s===r&&i.push("current system"),s===F&&i.push("minimum supported"),o.has(s)&&s!==r&&i.push("detected"),{name:i.length>0?`${s} (${i.join(", ")})`:s,value:s}}),defaultValue:y}}async function Ht(){V();let e=false,o=false;try{await execa("poetry",["--version"],{timeout:2500}),e=true;}catch{e=false;}try{await execa("pipx",["--version"],{timeout:2500}),o=true;}catch{let n=c$1();try{await execa(n,["-m","pipx","--version"],{timeout:2500}),o=true;}catch{o=false;}}return {poetry:e,pipx:o}}async function At(){V();try{return await execa("poetry",["--version"],{timeout:2500}),true}catch{return false}}function zt(e,o){return e==="poetry"&&o.poetry?"poetry":e==="pipx"&&o.pipx?"pipx":e==="venv"?"venv":o.poetry?"poetry":"venv"}async function Ut(e,o){V(),e.start("Checking Poetry installation");try{await execa("poetry",["--version"]),e.succeed("Poetry found");return}catch{}if(o)throw new c$2;let{installPoetry:n}=await b$2([{type:"confirm",name:"installPoetry",message:"Poetry is not installed. Install it now using pipx?",default:true}]);if(!n)throw new c$2;let r=await it(e,o);e.start("Installing Poetry with pipx");try{await O(r,["install","poetry"]);}catch(a){let c=a,d=String(c?.stderr||c?.shortMessage||c?.message||"");if(/already\s+installed|already\s+seems\s+to\s+be\s+installed|exists/i.test(d))try{await O(r,["upgrade","poetry"]);}catch{}else throw new f$2("Install Poetry with pipx",a instanceof Error?a:new Error(d))}e.succeed("Poetry installed"),V();try{await execa("poetry",["--version"]);}catch(a){let c=a,d=String(c?.stderr||c?.shortMessage||c?.message||"Poetry not found on PATH");throw new f$2("Verify Poetry after pipx install",new Error(`${d}
43
+ ${s.stderr||""}`);i&&U(i,F)&&(r=i,o.add(i));}catch{}let a=$t.filter(s=>U(s,F)),c=new Set([...a,...o]),d=Array.from(c).sort((s,i)=>ut(i,s)),p=e?Gt(e):null,y=p&&U(p,F)?p:r||d[0]||F;return c.has(y)||c.add(y),{choices:Array.from(c).sort((s,i)=>ut(i,s)).map(s=>{let i=[];return s===r&&i.push("current system"),s===F&&i.push("minimum supported"),o.has(s)&&s!==r&&i.push("detected"),{name:i.length>0?`${s} (${i.join(", ")})`:s,value:s}}),defaultValue:y}}async function Ht(){V();let e=false,o=false;try{await execa("poetry",["--version"],{timeout:2500}),e=true;}catch{e=false;}try{await execa("pipx",["--version"],{timeout:2500}),o=true;}catch{let n=h();try{await execa(n,["-m","pipx","--version"],{timeout:2500}),o=true;}catch{o=false;}}return {poetry:e,pipx:o}}async function At(){V();try{return await execa("poetry",["--version"],{timeout:2500}),true}catch{return false}}function zt(e,o){return e==="poetry"&&o.poetry?"poetry":e==="pipx"&&o.pipx?"pipx":e==="venv"?"venv":o.poetry?"poetry":"venv"}async function Ut(e,o){V(),e.start("Checking Poetry installation");try{await execa("poetry",["--version"]),e.succeed("Poetry found");return}catch{}if(o)throw new c$1;let{installPoetry:n}=await b$2([{type:"confirm",name:"installPoetry",message:"Poetry is not installed. Install it now using pipx?",default:true}]);if(!n)throw new c$1;let r=await it(e,o);e.start("Installing Poetry with pipx");try{await O(r,["install","poetry"]);}catch(a){let c=a,d=String(c?.stderr||c?.shortMessage||c?.message||"");if(/already\s+installed|already\s+seems\s+to\s+be\s+installed|exists/i.test(d))try{await O(r,["upgrade","poetry"]);}catch{}else throw new f$1("Install Poetry with pipx",a instanceof Error?a:new Error(d))}e.succeed("Poetry installed"),V();try{await execa("poetry",["--version"]);}catch(a){let c=a,d=String(c?.stderr||c?.shortMessage||c?.message||"Poetry not found on PATH");throw new f$1("Verify Poetry after pipx install",new Error(`${d}
44
44
 
45
45
  Poetry may be installed but not on PATH yet. Try reopening your terminal or run: pipx ensurepath`))}}function qt(e){let o=e==="poetry";return `#!/usr/bin/env sh
46
46
  set -eu
@@ -225,7 +225,7 @@ npx rapidkit dev
225
225
  \u{1F4A1} Profile management:`)),console.log(t.gray(" \u2022 Add Python? \u2192 rapidkit bootstrap --profile python-only|polyglot")),console.log(t.gray(" \u2022 Add Node.js? \u2192 rapidkit bootstrap --profile node-only|polyglot")),console.log(t.gray(" \u2022 Add Go? \u2192 rapidkit bootstrap --profile go-only|polyglot")),console.log(t.gray(" \u2022 Add .NET? \u2192 rapidkit bootstrap --profile dotnet-only|polyglot")),console.log(t.gray(" \u2022 Full setup? \u2192 rapidkit bootstrap --profile enterprise")),console.log(t.cyan(`
226
226
  \u{1F4D6} Common commands:`)),console.log(t.white(" rapidkit create - Create a new project (interactive)")),console.log(t.white(" rapidkit list - List available kits")),console.log(t.white(" rapidkit modules - List available modules")),console.log(t.white(" rapidkit doctor - Check workspace health")),console.log(t.white(` rapidkit bootstrap --help - Advanced workspace configuration
227
227
  `));try{let{stdout:b}=await execa("go",["version"],{timeout:3e3}),v=b.match(/go version go(\d+\.\d+(?:\.\d+)?)/),M=v?v[1]:"unknown";console.log(t.gray(`\u{1F439} Go ${M} detected \u2014 ready for gofiber.standard projects`));}catch{console.log(t.yellow("\u26A0\uFE0F Go not installed \u2014 needed for gofiber.standard/gogin.standard projects")),console.log(t.gray(" Install: https://go.dev/dl/"));}console.log("");}catch(w){I.fail("Failed to create RapidKit environment"),console.error(t.red(`
228
- \u274C Error:`),w);try{await P.remove(i);}catch{}throw w}}async function Mt(e){let o=[];if(!a$1())try{let{stdout:c}=await execa("pyenv",["which","python"]),d=c.trim();d&&o.push(d);}catch{}let n=Number(e.split(".")[1]),r=e$1(n,10).map(c=>c.command).filter(Boolean);o.push(`python${e}`,...r,...d$1());let a=[...new Set(o)];for(let c of a)try{let d=c==="py"?["-3","--version"]:["--version"],p=c==="py"?["-3","-c","import sys; sys.exit(0)"]:["-c","import sys; sys.exit(0)"],{stdout:y}=await execa(c,d,{timeout:2e3}),h=y.match(/Python (\d+\.\d+)/)?.[1];if(h&&U(h,e))return await execa(c,p,{timeout:2e3}),c}catch{continue}return null}async function Dt(e,o,n,r,a,c=false){await Ut(n,c),n.start("Finding Python interpreter");let d=await Mt(o);d?(f.debug(`Found working Python: ${d}`),n.succeed("Python found")):n.warn("Could not verify Python path, proceeding with default"),n.start("Initializing Poetry project");let p=m.join(e,"pyproject.toml"),h=(await P.pathExists(p)?await promises.readFile(p,"utf-8"):"").includes("rapidkit-core");if(h)n.succeed("Poetry project initialized");else {await execa("poetry",["init","--no-interaction","--python",`^${o}`],{cwd:e}),n.succeed("Poetry project initialized");let f=await promises.readFile(p,"utf-8");f.includes("[tool.poetry]")?f=f.replace("[tool.poetry]",`[tool.poetry]
228
+ \u274C Error:`),w);try{await P.remove(i);}catch{}throw w}}async function Mt(e){let o=[];if(!b$3())try{let{stdout:c}=await execa("pyenv",["which","python"]),d=c.trim();d&&o.push(d);}catch{}let n=Number(e.split(".")[1]),r=j(n,10).map(c=>c.command).filter(Boolean);o.push(`python${e}`,...r,...i());let a=[...new Set(o)];for(let c of a)try{let d=c==="py"?["-3","--version"]:["--version"],p=c==="py"?["-3","-c","import sys; sys.exit(0)"]:["-c","import sys; sys.exit(0)"],{stdout:y}=await execa(c,d,{timeout:2e3}),h=y.match(/Python (\d+\.\d+)/)?.[1];if(h&&U(h,e))return await execa(c,p,{timeout:2e3}),c}catch{continue}return null}async function Dt(e,o,n,r,a,c=false){await Ut(n,c),n.start("Finding Python interpreter");let d=await Mt(o);d?(f.debug(`Found working Python: ${d}`),n.succeed("Python found")):n.warn("Could not verify Python path, proceeding with default"),n.start("Initializing Poetry project");let p=m.join(e,"pyproject.toml"),h=(await P.pathExists(p)?await promises.readFile(p,"utf-8"):"").includes("rapidkit-core");if(h)n.succeed("Poetry project initialized");else {await execa("poetry",["init","--no-interaction","--python",`^${o}`],{cwd:e}),n.succeed("Poetry project initialized");let f=await promises.readFile(p,"utf-8");f.includes("[tool.poetry]")?f=f.replace("[tool.poetry]",`[tool.poetry]
229
229
  package-mode = false`):f.includes("[project]")&&(f.includes("[build-system]")?f=f.replace("[build-system]",`
230
230
  [tool.poetry]
231
231
  package-mode = false
@@ -234,32 +234,32 @@ package-mode = false
234
234
 
235
235
  [tool.poetry]
236
236
  package-mode = false
237
- `),await promises.writeFile(p,f,"utf-8");}n.start("Configuring Poetry");try{await execa("poetry",["config","virtualenvs.in-project","true","--local"],{cwd:e}),n.succeed("Poetry configured");}catch{n.warn("Could not configure Poetry virtualenvs.in-project");}n.start("Creating virtualenv");let g$1=d||S(),s=f$1(m.join(e,".venv"));try{await execa(g$1,["-m","venv",".venv"],{cwd:e,timeout:6e4}),n.succeed("Virtualenv created");}catch(i){f.debug(`python -m venv failed: ${i}`),n.warn("Could not pre-create virtualenv, Poetry will try"),s=d||S();}try{await execa("poetry",["env","use",s||S()],{cwd:e}),f.debug(`Poetry env set to: ${s}`);}catch(i){f.debug(`Could not set Poetry env: ${i}`);}if(n.start("Installing RapidKit"),h&&!r){let i=e$2(a||{}),f$1=i?await P.pathExists(i):false,u=f$1&&i?i:"rapidkit-core";i&&!f$1&&f.warn(`RAPIDKIT_DEV_PATH is set but path does not exist: ${i}. Falling back to PyPI.`),n.text=f$1?"Installing RapidKit from local path":"Installing RapidKit from PyPI";let E=false,T=null;for(let _=1;_<=3;_++)try{f$1||e$3({status:"started",message:"Installing RapidKit from PyPI",installMethod:"poetry",attempt:_,maxAttempts:3}),await execa(s,["-m","pip","install",u,"--quiet"],{cwd:e,timeout:18e4}),E=true,f$1||e$3({status:"succeeded",message:"RapidKit installed from PyPI",installMethod:"poetry",attempt:_,maxAttempts:3});break}catch(L){T=L,f.debug(`pip install rapidkit-core attempt ${_} failed: ${L}`),_<3&&(n.text=`Retrying installation (attempt ${_+1}/3)`,await new Promise(X=>setTimeout(X,2e3)));}if(!E){let _=T?.stderr||T?.message||"Unknown error";throw f.debug(`All pip install attempts failed. Last error: ${_}`),_.includes("Could not find")||_.includes("No matching distribution")?new g:new f$2("Install rapidkit-core with pip",new Error(`Failed to install rapidkit-core after 3 attempts.
237
+ `),await promises.writeFile(p,f,"utf-8");}n.start("Configuring Poetry");try{await execa("poetry",["config","virtualenvs.in-project","true","--local"],{cwd:e}),n.succeed("Poetry configured");}catch{n.warn("Could not configure Poetry virtualenvs.in-project");}n.start("Creating virtualenv");let g$1=d||S(),s=l(m.join(e,".venv"));try{await execa(g$1,["-m","venv",".venv"],{cwd:e,timeout:6e4}),n.succeed("Virtualenv created");}catch(i){f.debug(`python -m venv failed: ${i}`),n.warn("Could not pre-create virtualenv, Poetry will try"),s=d||S();}try{await execa("poetry",["env","use",s||S()],{cwd:e}),f.debug(`Poetry env set to: ${s}`);}catch(i){f.debug(`Could not set Poetry env: ${i}`);}if(n.start("Installing RapidKit"),h&&!r){let i=e$1(a||{}),f$2=i?await P.pathExists(i):false,u=f$2&&i?i:"rapidkit-core";i&&!f$2&&f.warn(`RAPIDKIT_DEV_PATH is set but path does not exist: ${i}. Falling back to PyPI.`),n.text=f$2?"Installing RapidKit from local path":"Installing RapidKit from PyPI";let E=false,T=null;for(let _=1;_<=3;_++)try{f$2||e$2({status:"started",message:"Installing RapidKit from PyPI",installMethod:"poetry",attempt:_,maxAttempts:3}),await execa(s,["-m","pip","install",u,"--quiet"],{cwd:e,timeout:18e4}),E=true,f$2||e$2({status:"succeeded",message:"RapidKit installed from PyPI",installMethod:"poetry",attempt:_,maxAttempts:3});break}catch(L){T=L,f.debug(`pip install rapidkit-core attempt ${_} failed: ${L}`),_<3&&(n.text=`Retrying installation (attempt ${_+1}/3)`,await new Promise(X=>setTimeout(X,2e3)));}if(!E){let _=T?.stderr||T?.message||"Unknown error";throw f.debug(`All pip install attempts failed. Last error: ${_}`),_.includes("Could not find")||_.includes("No matching distribution")?new g:new f$1("Install rapidkit-core with pip",new Error(`Failed to install rapidkit-core after 3 attempts.
238
238
  Error: ${_}
239
239
 
240
240
  Possible solutions:
241
241
  1. Check your internet connection
242
242
  2. Try installing manually: cd ${m.basename(e)} && poetry add rapidkit-core
243
- 3. Use venv method instead: npx rapidkit ${m.basename(e)} --install-method=venv`))}}else {n.text="Syncing Poetry environment";try{await execa("poetry",["install","--no-root"],{cwd:e,timeout:12e4}),n.succeed("Poetry environment synced");}catch(i){f.debug(`poetry install --no-root failed: ${i}`),n.warn("Could not sync Poetry environment, proceeding with add command");}if(n.start("Installing RapidKit"),r){let i=e$2(a||{});if(!i)throw new f$2("Test mode installation",new Error("No local RapidKit path configured. Set RAPIDKIT_DEV_PATH environment variable."));f.debug(`Installing from local path: ${i}`),n.text="Installing RapidKit from local path (test mode)",await execa("poetry",["add",i],{cwd:e});}else {n.text="Installing RapidKit from PyPI";let i=false,f$1=null;for(let u=1;u<=3;u++)try{e$3({status:"started",message:"Installing RapidKit from PyPI",installMethod:"poetry",attempt:u,maxAttempts:3}),await execa("poetry",["add","rapidkit-core"],{cwd:e,timeout:6e4*u}),i=true,e$3({status:"succeeded",message:"RapidKit installed from PyPI",installMethod:"poetry",attempt:u,maxAttempts:3});break}catch(E){f$1=E,f.debug(`Poetry add attempt ${u} failed: ${E}`),u<3&&(n.text=`Retrying installation (attempt ${u+1}/3)`,await new Promise(T=>setTimeout(T,2e3)));}if(!i){let u=f$1?.stderr||f$1?.message||"Unknown error";throw f.debug(`All Poetry install attempts failed. Last error: ${u}`),u.includes("Could not find")||u.includes("No matching distribution")?new g:new f$2("Install rapidkit-core with Poetry",new Error(`Failed to install rapidkit-core after 3 attempts.
243
+ 3. Use venv method instead: npx rapidkit ${m.basename(e)} --install-method=venv`))}}else {n.text="Syncing Poetry environment";try{await execa("poetry",["install","--no-root"],{cwd:e,timeout:12e4}),n.succeed("Poetry environment synced");}catch(i){f.debug(`poetry install --no-root failed: ${i}`),n.warn("Could not sync Poetry environment, proceeding with add command");}if(n.start("Installing RapidKit"),r){let i=e$1(a||{});if(!i)throw new f$1("Test mode installation",new Error("No local RapidKit path configured. Set RAPIDKIT_DEV_PATH environment variable."));f.debug(`Installing from local path: ${i}`),n.text="Installing RapidKit from local path (test mode)",await execa("poetry",["add",i],{cwd:e});}else {n.text="Installing RapidKit from PyPI";let i=false,f$2=null;for(let u=1;u<=3;u++)try{e$2({status:"started",message:"Installing RapidKit from PyPI",installMethod:"poetry",attempt:u,maxAttempts:3}),await execa("poetry",["add","rapidkit-core"],{cwd:e,timeout:6e4*u}),i=true,e$2({status:"succeeded",message:"RapidKit installed from PyPI",installMethod:"poetry",attempt:u,maxAttempts:3});break}catch(E){f$2=E,f.debug(`Poetry add attempt ${u} failed: ${E}`),u<3&&(n.text=`Retrying installation (attempt ${u+1}/3)`,await new Promise(T=>setTimeout(T,2e3)));}if(!i){let u=f$2?.stderr||f$2?.message||"Unknown error";throw f.debug(`All Poetry install attempts failed. Last error: ${u}`),u.includes("Could not find")||u.includes("No matching distribution")?new g:new f$1("Install rapidkit-core with Poetry",new Error(`Failed to install rapidkit-core after 3 attempts.
244
244
  Error: ${u}
245
245
 
246
246
  Possible solutions:
247
247
  1. Check your internet connection
248
248
  2. Try installing manually: cd ${m.basename(e)} && poetry add rapidkit-core
249
- 3. Use venv method instead: npx rapidkit ${m.basename(e)} --install-method=venv`))}}}n.succeed("RapidKit installed in project virtualenv");try{let{checkRapidkitCoreAvailable:i}=await import('./pythonRapidkitExec-MNWRC4F2.js');if(!await i()&&!r){n.start("Checking optional global pipx installation");let u=await it(n,true);try{n.start("Installing RapidKit globally with pipx for CLI access"),await O(u,["install","rapidkit-core"]),n.succeed("RapidKit installed globally");}catch(E){n.warn("Could not install globally (non-fatal, project virtualenv has RapidKit)"),f.debug(`pipx install failed: ${E}`);}}}catch(i){n.succeed("Skipped optional global pipx installation"),f.debug(`Global install check skipped: ${i}`);}}async function yt(e,o,n,r,a,c=false){n.start(`Checking Python ${o}`);let d=S();try{let{stdout:y}=await execa(d,["--version"]),h=y.match(/Python (\d+\.\d+)/)?.[1];if(h&&!U(h,o))throw new b$3(o,h);n.succeed(`Python ${h} found`);}catch(y){throw y instanceof b$3?y:new b$3(o)}n.start("Creating virtual environment");try{await execa(d,["-m","venv",".venv"],{cwd:e}),n.succeed("Virtual environment created");}catch(y){if(n.fail("Failed to create virtual environment"),(g=>typeof g=="object"&&g!==null&&"stdout"in g&&typeof g.stdout=="string")(y)&&y.stdout.includes("ensurepip is not")){let g=y.stdout.match(/apt install (python[\d.]+-venv)/),s=g?g[1]:"python3-venv";throw new f$2("Python venv module not available",new Error(`Virtual environment creation failed.
249
+ 3. Use venv method instead: npx rapidkit ${m.basename(e)} --install-method=venv`))}}}n.succeed("RapidKit installed in project virtualenv");try{let{checkRapidkitCoreAvailable:i}=await import('./pythonRapidkitExec-SGKW76XM.js');if(!await i()&&!r){n.start("Checking optional global pipx installation");let u=await it(n,true);try{n.start("Installing RapidKit globally with pipx for CLI access"),await O(u,["install","rapidkit-core"]),n.succeed("RapidKit installed globally");}catch(E){n.warn("Could not install globally (non-fatal, project virtualenv has RapidKit)"),f.debug(`pipx install failed: ${E}`);}}}catch(i){n.succeed("Skipped optional global pipx installation"),f.debug(`Global install check skipped: ${i}`);}}async function yt(e,o,n,r,a,c=false){n.start(`Checking Python ${o}`);let d=S();try{let{stdout:y}=await execa(d,["--version"]),h=y.match(/Python (\d+\.\d+)/)?.[1];if(h&&!U(h,o))throw new b$4(o,h);n.succeed(`Python ${h} found`);}catch(y){throw y instanceof b$4?y:new b$4(o)}n.start("Creating virtual environment");try{await execa(d,["-m","venv",".venv"],{cwd:e}),n.succeed("Virtual environment created");}catch(y){if(n.fail("Failed to create virtual environment"),(g=>typeof g=="object"&&g!==null&&"stdout"in g&&typeof g.stdout=="string")(y)&&y.stdout.includes("ensurepip is not")){let g=y.stdout.match(/apt install (python[\d.]+-venv)/),s=g?g[1]:"python3-venv";throw new f$1("Python venv module not available",new Error(`Virtual environment creation failed.
250
250
 
251
251
  On Debian/Ubuntu systems, install the venv package:
252
252
  sudo apt install ${s}
253
253
 
254
254
  Or use Poetry instead (recommended):
255
- npx rapidkit ${m.basename(e)} --yes`))}throw new f$2("Virtual environment creation",y instanceof Error?y:new Error(String(y)))}n.start("Installing RapidKit");let p=f$1(m.join(e,".venv"));if(await execa(p,["-m","pip","install","--upgrade","pip"],{cwd:e}),r){let y=e$2(a||{});if(!y)throw new f$2("Test mode installation",new Error("No local RapidKit path configured. Set RAPIDKIT_DEV_PATH environment variable."));f.debug(`Installing from local path: ${y}`),n.text="Installing RapidKit from local path (test mode)",await execa(p,["-m","pip","install","-e",y],{cwd:e});}else {n.text="Installing RapidKit from PyPI";let y=false,h=null;for(let g=1;g<=3;g++)try{e$3({status:"started",message:"Installing RapidKit from PyPI",installMethod:"venv",attempt:g,maxAttempts:3}),await execa(p,["-m","pip","install","rapidkit-core"],{cwd:e,timeout:6e4*g}),y=true,e$3({status:"succeeded",message:"RapidKit installed from PyPI",installMethod:"venv",attempt:g,maxAttempts:3});break}catch(s){h=s,f.debug(`pip install attempt ${g} failed: ${s}`),g<3&&(n.text=`Retrying installation (attempt ${g+1}/3)`,await new Promise(i=>setTimeout(i,2e3)));}if(!y){let g$1=h?.stderr||h?.message||"Unknown error";throw f.debug(`All pip install attempts failed. Last error: ${g$1}`),g$1.includes("Could not find")||g$1.includes("No matching distribution")?new g:new f$2("Install rapidkit-core with pip",new Error(`Failed to install rapidkit-core after 3 attempts.
255
+ npx rapidkit ${m.basename(e)} --yes`))}throw new f$1("Virtual environment creation",y instanceof Error?y:new Error(String(y)))}n.start("Installing RapidKit");let p=l(m.join(e,".venv"));if(await execa(p,["-m","pip","install","--upgrade","pip"],{cwd:e}),r){let y=e$1(a||{});if(!y)throw new f$1("Test mode installation",new Error("No local RapidKit path configured. Set RAPIDKIT_DEV_PATH environment variable."));f.debug(`Installing from local path: ${y}`),n.text="Installing RapidKit from local path (test mode)",await execa(p,["-m","pip","install","-e",y],{cwd:e});}else {n.text="Installing RapidKit from PyPI";let y=false,h=null;for(let g=1;g<=3;g++)try{e$2({status:"started",message:"Installing RapidKit from PyPI",installMethod:"venv",attempt:g,maxAttempts:3}),await execa(p,["-m","pip","install","rapidkit-core"],{cwd:e,timeout:6e4*g}),y=true,e$2({status:"succeeded",message:"RapidKit installed from PyPI",installMethod:"venv",attempt:g,maxAttempts:3});break}catch(s){h=s,f.debug(`pip install attempt ${g} failed: ${s}`),g<3&&(n.text=`Retrying installation (attempt ${g+1}/3)`,await new Promise(i=>setTimeout(i,2e3)));}if(!y){let g$1=h?.stderr||h?.message||"Unknown error";throw f.debug(`All pip install attempts failed. Last error: ${g$1}`),g$1.includes("Could not find")||g$1.includes("No matching distribution")?new g:new f$1("Install rapidkit-core with pip",new Error(`Failed to install rapidkit-core after 3 attempts.
256
256
  Error: ${g$1}
257
257
 
258
258
  Possible solutions:
259
259
  1. Check your internet connection
260
- 2. Try installing manually: cd ${m.basename(e)} && ${f$1(".venv")} -m pip install rapidkit-core
261
- 3. Use Poetry instead: npx rapidkit ${m.basename(e)} --install-method=poetry`))}}n.succeed("RapidKit installed in project virtualenv");try{let{checkRapidkitCoreAvailable:y}=await import('./pythonRapidkitExec-MNWRC4F2.js');if(!await y()&&!r){n.start("Checking optional global pipx installation");let g=await it(n,true);try{n.start("Installing RapidKit globally with pipx for CLI access"),await O(g,["install","rapidkit-core"]),n.succeed("RapidKit installed globally");}catch(s){n.warn("Could not install globally (non-fatal, project virtualenv has RapidKit)"),f.debug(`pipx install failed: ${s}`);}}}catch(y){n.succeed("Skipped optional global pipx installation"),f.debug(`Global install check skipped: ${y}`);}}async function Kt(e,o,n,r,a=false){if(!n)try{let{checkRapidkitCoreVersionCompatible:d}=await import('./pythonRapidkitExec-MNWRC4F2.js'),p=await d();if(p.isCompatible){o.succeed(`RapidKit ${p.installedVersion??""} already compatible globally; skipping pipx installation`),await P.outputFile(m.join(e,".rapidkit-global"),`RapidKit already available globally (version ${p.installedVersion??"unknown"}) and satisfies expected constraint ${p.expectedConstraint??"n/a"}; workspace will reuse the existing installation
262
- `,"utf-8");return}p.reason==="constraint-missing"?o.warn('Version-aware global reuse skipped: no explicit rapidkit-core version constraint found. Set RAPIDKIT_CORE_PYTHON_PACKAGE (example: RAPIDKIT_CORE_PYTHON_PACKAGE="rapidkit-core>=0.4.0,<0.9.0") to enable version-aware reuse. Proceeding with pipx install/upgrade.'):p.reason==="constraint-unsupported"&&o.warn('Version-aware global reuse skipped: RAPIDKIT_CORE_PYTHON_PACKAGE uses an unsupported spec (path/url/git). Use a version range instead (example: RAPIDKIT_CORE_PYTHON_PACKAGE="rapidkit-core==0.4.0" or "rapidkit-core>=0.4.0,<0.9.0"). Proceeding with pipx install/upgrade.'),f.debug(`Global RapidKit install is not reusable via version-aware policy (reason=${p.reason}, installed=${p.installedVersion??"unknown"}, expected=${p.expectedConstraint??"none"}). Proceeding with pipx install/upgrade.`);}catch(d){f.debug(`Global RapidKit version-aware check failed before pipx install: ${d}`);}let c=await it(o,a);if(o.start("Installing RapidKit globally with pipx"),n){let d=e$2(r||{});if(!d)throw new f$2("Test mode installation",new Error("No local RapidKit path configured. Set RAPIDKIT_DEV_PATH environment variable."));f.debug(`Installing from local path: ${d}`),o.text="Installing RapidKit from local path (test mode)",await O(c,["install","-e",d]);}else {o.text="Installing RapidKit from PyPI",e$3({status:"started",message:"Installing RapidKit from PyPI",installMethod:"pipx"});try{await O(c,["install","rapidkit-core"]),e$3({status:"succeeded",message:"RapidKit installed from PyPI",installMethod:"pipx"});}catch(d){try{o.text="RapidKit already installed globally, upgrading to match expected version",await O(c,["upgrade","rapidkit-core"]),e$3({status:"succeeded",message:"RapidKit upgraded from PyPI",installMethod:"pipx"});}catch(p){throw f.debug(`pipx install/upgrade failed: install=${d}, upgrade=${p}`),new g}}}o.succeed("RapidKit installed globally"),await P.outputFile(m.join(e,".rapidkit-global"),`RapidKit installed globally with pipx
260
+ 2. Try installing manually: cd ${m.basename(e)} && ${l(".venv")} -m pip install rapidkit-core
261
+ 3. Use Poetry instead: npx rapidkit ${m.basename(e)} --install-method=poetry`))}}n.succeed("RapidKit installed in project virtualenv");try{let{checkRapidkitCoreAvailable:y}=await import('./pythonRapidkitExec-SGKW76XM.js');if(!await y()&&!r){n.start("Checking optional global pipx installation");let g=await it(n,true);try{n.start("Installing RapidKit globally with pipx for CLI access"),await O(g,["install","rapidkit-core"]),n.succeed("RapidKit installed globally");}catch(s){n.warn("Could not install globally (non-fatal, project virtualenv has RapidKit)"),f.debug(`pipx install failed: ${s}`);}}}catch(y){n.succeed("Skipped optional global pipx installation"),f.debug(`Global install check skipped: ${y}`);}}async function Kt(e,o,n,r,a=false){if(!n)try{let{checkRapidkitCoreVersionCompatible:d}=await import('./pythonRapidkitExec-SGKW76XM.js'),p=await d();if(p.isCompatible){o.succeed(`RapidKit ${p.installedVersion??""} already compatible globally; skipping pipx installation`),await P.outputFile(m.join(e,".rapidkit-global"),`RapidKit already available globally (version ${p.installedVersion??"unknown"}) and satisfies expected constraint ${p.expectedConstraint??"n/a"}; workspace will reuse the existing installation
262
+ `,"utf-8");return}p.reason==="constraint-missing"?o.warn('Version-aware global reuse skipped: no explicit rapidkit-core version constraint found. Set RAPIDKIT_CORE_PYTHON_PACKAGE (example: RAPIDKIT_CORE_PYTHON_PACKAGE="rapidkit-core>=0.4.0,<0.9.0") to enable version-aware reuse. Proceeding with pipx install/upgrade.'):p.reason==="constraint-unsupported"&&o.warn('Version-aware global reuse skipped: RAPIDKIT_CORE_PYTHON_PACKAGE uses an unsupported spec (path/url/git). Use a version range instead (example: RAPIDKIT_CORE_PYTHON_PACKAGE="rapidkit-core==0.4.0" or "rapidkit-core>=0.4.0,<0.9.0"). Proceeding with pipx install/upgrade.'),f.debug(`Global RapidKit install is not reusable via version-aware policy (reason=${p.reason}, installed=${p.installedVersion??"unknown"}, expected=${p.expectedConstraint??"none"}). Proceeding with pipx install/upgrade.`);}catch(d){f.debug(`Global RapidKit version-aware check failed before pipx install: ${d}`);}let c=await it(o,a);if(o.start("Installing RapidKit globally with pipx"),n){let d=e$1(r||{});if(!d)throw new f$1("Test mode installation",new Error("No local RapidKit path configured. Set RAPIDKIT_DEV_PATH environment variable."));f.debug(`Installing from local path: ${d}`),o.text="Installing RapidKit from local path (test mode)",await O(c,["install","-e",d]);}else {o.text="Installing RapidKit from PyPI",e$2({status:"started",message:"Installing RapidKit from PyPI",installMethod:"pipx"});try{await O(c,["install","rapidkit-core"]),e$2({status:"succeeded",message:"RapidKit installed from PyPI",installMethod:"pipx"});}catch(d){try{o.text="RapidKit already installed globally, upgrading to match expected version",await O(c,["upgrade","rapidkit-core"]),e$2({status:"succeeded",message:"RapidKit upgraded from PyPI",installMethod:"pipx"});}catch(p){throw f.debug(`pipx install/upgrade failed: install=${d}, upgrade=${p}`),new g}}}o.succeed("RapidKit installed globally"),await P.outputFile(m.join(e,".rapidkit-global"),`RapidKit installed globally with pipx
263
263
  `,"utf-8");}async function be(e,o){let{skipGit:n=false,testMode:r=false,userConfig:a={},yes:c$1=false,installMethod:d,pythonVersion:p="3.10"}=o||{},y=d||a.defaultInstallMethod||await(async()=>{try{return await execa("poetry",["--version"],{timeout:3e3}),"poetry"}catch{return f.warn("Poetry not found \u2014 auto-selecting venv. Pass --install-method poetry to override."),"venv"}})(),h=y==="poetry"&&!await At()?"venv":y;await B(e,m.basename(e),h),await z(e),await Q(e,m.basename(e),h,p,o?.profile);let g=c("Registering workspace",{component:"create",phase:"workspace.register"});try{if(h==="poetry"?(await J(e,m.basename(e)),await Dt(e,p,g,r,a,c$1)):h==="venv"?await yt(e,p,g,r,a):await Kt(e,g,r,a,c$1),await St(e,h),await Tt(e,h),g.succeed("Workspace registered"),await H(e,{workspaceName:m.basename(e),silent:r}),!n){g.start("Initializing git repository");try{await execa("git",["init"],{cwd:e}),await execa("git",["add","."],{cwd:e}),await execa("git",["commit","-m","Initial commit: RapidKit workspace"],{cwd:e}),g.succeed("Git repository initialized");}catch{g.warn("Could not initialize git repository");}}}catch(s){throw g.fail("Failed to register workspace"),s}}async function Tt(e,o){let n=o==="poetry"?`source $(poetry env info --path)/bin/activate
264
264
  # Or simply use: poetry run rapidkit <command>`:o==="venv"?"source .venv/bin/activate # On Windows: .venv\\Scripts\\activate":"N/A (globally installed)",r=o==="poetry"?`# No activation needed (recommended):
265
265
  ./rapidkit --help
@@ -269,7 +269,7 @@ poetry run rapidkit --help`:o==="venv"?`# No activation needed (recommended):
269
269
  # or direct:
270
270
  ./.venv/bin/rapidkit --help`:`# Optional: use the local launcher
271
271
  ./rapidkit --help
272
- # (pipx installs may require Poetry/venv to be present in this folder)`,a=a$1()?"python --version (or: py -3 --version)":"python3 --version (or: python --version)",c=`# RapidKit Workspace
272
+ # (pipx installs may require Poetry/venv to be present in this folder)`,a=b$3()?"python --version (or: py -3 --version)":"python3 --version (or: python --version)",c=`# RapidKit Workspace
273
273
 
274
274
  This directory contains a RapidKit development environment.
275
275
 
@@ -0,0 +1 @@
1
+ import {a,b as b$1}from'./chunk-PYCJWW4B.js';import {b,c,d}from'./chunk-KIUSCFHF.js';import {m,f,c as c$1,n,e}from'./chunk-LKX3L7TE.js';import {c as c$2}from'./chunk-64RTZBHU.js';import {j,b as b$2}from'./chunk-EN6YCX36.js';import {a as a$1}from'./chunk-3PTJID76.js';import p from'path';import y from'fs-extra';var K="rapidkit-blocker-resolution-v1";function J(e){let t=e.blockers.map(r=>r.trim()).filter(Boolean).slice(0,12),s=e.stderrTail?.trim().slice(-400)??"";return b$2({blockers:t,exitCode:e.exitCode??null,stderrTail:s})}function te(e){let t=e.trim().toLowerCase();return t?t.includes("missing evidence")||t.includes(": missing")||t.includes("artifact missing")||t.includes("not found on disk")?"artifact-missing":t.includes("policy.")||t.includes("contract")?"config-fixable":t.includes("impact")||t.includes("untracked")||t.includes("grounding")?"semantic-attention":t.includes("failed")||t.includes("blocked")||t.includes(": fail")?"command-failed-repeat":"config-fixable":"unresolvable-without-human"}function se(e){let t=te(e.reason),s=J({blockers:[e.reason]}),r=t==="artifact-missing"?[{actionKind:"run-once",detail:e.sourceCommand?`Run the source command once: ${e.sourceCommand}`:"Run the mapped workspace intelligence command once to generate the missing artifact.",studioActionId:"run-analyze"}]:t==="semantic-attention"?[{actionKind:"commit-files",detail:"Review workspace-level grounding files (AGENTS.md, agent-sync outputs) and commit or refresh the impact baseline."},{actionKind:"refresh-baseline",detail:"Refresh snapshot + diff + impact before re-running verify."}]:[{actionKind:"edit-file",detail:"Apply the smallest safe file or policy fix for this blocker before re-running verification.",studioActionId:"fix-lens"}];return {schemaVersion:K,blockerId:e.blockerId,sourceCommand:e.sourceCommand,sourceArtifact:e.sourceArtifact,resolutionClass:t,blockerSignature:s,commandRetryHint:t==="artifact-missing"?"Run the source command once, then verify.":"Do not re-run the same failing command; fix the source issue first, then verify.",fixHints:r,verifyCommand:e.verifyCommand,verifyArtifact:e.verifyArtifact}}function U(e){return Array.from(new Set(e.blockingReasons.map(s=>s.trim()).filter(Boolean))).slice(0,12).map((s,r)=>se({reason:s,blockerId:`blocker-${r+1}`,sourceCommand:e.sourceCommand,sourceArtifact:e.sourceArtifact,verifyCommand:e.verifyCommand,verifyArtifact:e.verifyArtifact}))}function re(e){let t=e.toLowerCase();return t.includes("stale")||t.includes("missing evidence")||t.includes("no projects")||t.includes("projects.empty")||t.includes("projects discovered")||t.includes("projects.missing")||t.includes("not yet run")||t.includes("doctor-last-run")||t.includes("pipeline-last-run")||t.includes("release-readiness")||t.includes("analyze-last-run")||t.includes("analyze reported")||t.includes("analyze verdict")||t.includes("analyze needs attention")||t.includes("toolchain.lock")||t.includes("not pinned")||t.includes("readiness:")||t.includes("env:")||t.includes("workspace-run-last")||t.includes("pre-project")||t.includes("before adding projects")||t.includes("workspace.projects.missing")||t.includes("no backend projects")||t.includes("index.json")||t.includes("workspace-intelligence-history")||t.includes("validation warning")||t.includes("workspace model validation")||t.includes("workspace.marker")||t.includes("no project roots")||t.includes("no infrastructure services")||t.includes("infra/overrides")||t.includes("infra dependencies")||t.includes("contract verify")||t.includes("contract inspect")||t.includes("publish verify evidence")}function ne(e){return e.length===0||e.every(t=>re(t))}function G(e){return e.projectCount>0||e.policyErrorCount>0?{verdict:e.verdict,exitCode:e.exitCode}:e.verdict==="blocked"&&ne(e.blockingReasons)?{verdict:"needs-attention",exitCode:1}:{verdict:e.verdict,exitCode:e.exitCode}}function $e(e,t){let s=t&&t!=="ready"?` (${t.replace(/-/g," ")})`:"";return e===0?`Workspace scaffold ready${s} \u2014 add your first project to continue.`:`Workspace scaffold${s}: ${e} pre-project signal(s) \u2014 add your first project to continue.`}var X="workspace-verify.v1",I=".rapidkit/reports/workspace-verify-last-run.json";function ie(e,t){return p.isAbsolute(t)?t:p.join(e,t)}async function Y(e$1){let t=await y.readJson(e$1);if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Workspace impact input is not a JSON object: ${e$1}`);let s=t;if(s.schemaVersion!==e)throw new Error(`Unsupported workspace impact schema: ${String(s.schemaVersion)}`);return s}function oe(e){let t=new Set,s=[];for(let r of e){let n=`${r.scope}:${r.project??""}:${r.display}`;t.has(n)||(t.add(n),s.push(r));}return s}function ae(e,t){if(!e||e==="workspace")return true;let s=(e.startsWith("project:")?e.slice(8):e).trim().toLowerCase();return t.scope==="workspace"?true:(t.project??"").trim().toLowerCase()===s}function ce(e,t){if(e.id==="workspace.doctor")return p.join(t,".rapidkit","reports","doctor-last-run.json");if(e.id==="workspace.contract.verify")return p.join(t,".rapidkit","reports","workspace-contract-verify-last-run.json");if(e.id==="workspace.readiness")return p.join(t,".rapidkit","reports","release-readiness-last-run.json");if(e.id==="workspace.analyze")return p.join(t,".rapidkit","reports","analyze-last-run.json");if(e.id==="workspace.pipeline")return p.join(t,".rapidkit","reports","pipeline-last-run.json");if(e.id==="workspace.doctor-fix")return p.join(t,".rapidkit","reports","doctor-last-run.json");if(e.id.startsWith("project.")&&e.id.includes("."))return p.join(t,".rapidkit","reports","workspace-run-last.json")}function w(e){return !e||typeof e!="object"||Array.isArray(e)?null:e}function le(e){let t=w(e.healthScore),s=typeof t?.errors=="number"?t.errors:0,r=typeof t?.percent=="number"?t.percent:void 0;return s>0?{status:"fail",message:`Doctor evidence reports ${s} error(s).`}:typeof r=="number"&&r<70?{status:"warn",message:`Doctor health score is ${r}%.`}:{status:"pass",message:"Doctor evidence is present and healthy."}}function de(e){let t=typeof e.overallStatus=="string"?e.overallStatus:"unknown";return t==="fail"?{status:"fail",message:"Release readiness evidence reports blocking failures."}:t==="warn"?{status:"warn",message:"Release readiness evidence reports warnings."}:t==="pass"?{status:"pass",message:"Release readiness evidence passed."}:{status:"warn",message:`Release readiness evidence status is ${t}.`}}function ue(e){let t=typeof e.status=="string"?e.status:"unknown";return t==="failed"||t==="fail"?{status:"fail",message:"Workspace contract verify evidence failed."}:t==="passed"||t==="pass"?{status:"pass",message:"Workspace contract verify evidence passed."}:{status:"warn",message:`Workspace contract verify evidence status is ${t}.`}}function pe(e){let t=w(e.summary);if(t?.blocking===true||e.blocking===true)return {status:"fail",message:"Analyze evidence reports blocking findings."};let r=typeof t?.status=="string"?t.status:void 0;return r==="warn"||r==="warning"?{status:"warn",message:"Analyze evidence reports warnings."}:{status:"pass",message:"Analyze evidence is present."}}function fe(e){let t=e.fixResult;if(!t||typeof t!="object"||Array.isArray(t))return {status:"skipped",message:"Doctor fix result not present; run doctor workspace --fix --json to record fixes."};let s=t,r=Array.isArray(s.remainingBlockers)?s.remainingBlockers:[];if(r.length>0)return {status:"fail",message:`Doctor fix result reports ${r.length} remaining blocker(s).`};let n=Array.isArray(s.appliedFixes)?s.appliedFixes:[];return n.length===0?{status:"pass",message:"Doctor fix result recorded with no remaining blockers."}:{status:"pass",message:`Doctor fix result recorded ${n.length} applied fix(es) with no remaining blockers.`}}function ge(e){return e.id.endsWith(".init")?"init":e.id.endsWith(".test")?"test":e.id.endsWith(".build")?"build":e.id.endsWith(".start")?"start":null}function me(e){let t=w(e.summary),s=typeof t?.verdict=="string"?t.verdict:void 0;return s==="blocked"?{status:"fail",message:"Pipeline evidence is blocked."}:s==="needs-attention"?{status:"warn",message:"Pipeline evidence needs attention."}:s==="ready"?{status:"pass",message:"Pipeline evidence is ready."}:{status:"warn",message:"Pipeline evidence status is unknown."}}function ke(e,t,s){let r=ge(t),n=c$2(e,r??void 0);if(!n)return {status:"missing",message:"Workspace run evidence is missing or unreadable."};let i=n.stage;if(r&&i!==r)return {status:"missing",message:`Workspace run evidence is for stage "${i}", expected "${r}".`};let d=Array.isArray(n.projects)?n.projects:[],l=t.project?.toLowerCase();if(!l)return {status:"missing",message:"Project-scoped workspace run evidence is missing a project identifier."};let a=d.find(g=>{let m=w(g);if(!m)return false;let c=typeof m.projectName=="string"?m.projectName.toLowerCase():"",o=["projectPath","relativePath","path"].map(u=>m[u]).filter(u=>typeof u=="string"&&u.trim().length>0).map(u=>u.replace(/\\/g,"/").toLowerCase());return c===l||o.some(u=>u.endsWith(`/${l}`)||u===l)});if(a){let g=v(n.generatedAt,s,`Workspace run evidence for ${t.project??t.id}`);if(g)return {status:"fail",message:g};let m=w(a),c=typeof m?.status=="string"?m.status:"unknown";return c==="failed"?{status:"fail",message:`Workspace run evidence failed for ${t.project}.`}:c==="passed"?{status:"pass",message:`Workspace run evidence passed for ${t.project}.`}:c==="skipped"?{status:"warn",message:`Workspace run evidence skipped for ${t.project}.`}:{status:"warn",message:`Workspace run evidence status is ${c} for ${t.project}.`}}return {status:"missing",message:`Workspace run evidence does not include project ${t.project}.`}}function v(e,t,s){if(!t)return null;if(typeof e!="string"||e.trim().length===0)return `${s} is stale: missing generatedAt timestamp (required after impact ${t}).`;let r=Date.parse(e),n=Date.parse(t);return Number.isFinite(r)?Number.isFinite(n)&&r<n?`${s} is stale: generated at ${e}, before impact ${t}.`:null:`${s} is stale: invalid generatedAt timestamp (required after impact ${t}).`}async function ye(e,t,s,r){let n=ce(e,t),i=n?p.relative(t,n).split(p.sep).join("/"):void 0;if(e.id==="workspace.contract.verify"&&!s)return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"skipped",required:e.required,message:"Workspace contract is not present; contract verify skipped."};if(!n||!await y.pathExists(n))return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"missing",required:e.required,evidencePath:i,message:i?`Missing evidence report: ${i}`:"No evidence mapping exists for this command."};let d=w(await y.readJson(n));if(!d)return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"fail",required:e.required,evidencePath:i,message:"Evidence report is not a JSON object."};let l;if(e.id==="workspace.doctor"){let a=v(d.generatedAt,r,"Doctor evidence");a?l={status:"fail",message:a}:l=le(d);}else if(e.id==="workspace.readiness"){let a=v(d.generatedAt,r,"Release readiness evidence");a?l={status:"fail",message:a}:l=de(d);}else if(e.id==="workspace.contract.verify"){let a=v(d.generatedAt,r,"Workspace contract verify evidence");a?l={status:"fail",message:a}:l=ue(d);}else if(e.id==="workspace.analyze"){let a=v(d.generatedAt,r,"Analyze evidence");a?l={status:"fail",message:a}:l=pe(d);}else if(e.id==="workspace.pipeline"){let a=v(d.generatedAt,r,"Pipeline evidence");a?l={status:"fail",message:a}:l=me(d);}else if(e.id==="workspace.doctor-fix")l=fe(d);else if(e.id.startsWith("project."))l=ke(d,e,r);else {let a=v(d.generatedAt,r,"Evidence report");a?l={status:"fail",message:a}:l={status:"pass",message:"Evidence report is present."};}return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:l.status,required:e.required,evidencePath:i,message:l.message}}function he(e,t={blockingReasons:[],needsAttention:false}){let s=e.filter(c=>c.status==="pass").length,r=e.filter(c=>c.status==="warn").length,n=e.filter(c=>c.status==="fail").length,i=e.filter(c=>c.status==="missing").length,d=e.filter(c=>c.status==="skipped").length,l=e.filter(c=>c.required&&(c.status==="fail"||c.status==="missing")).map(c=>`${c.id}: ${c.message}`),a=e.filter(c=>c.required&&c.status==="missing").length,g="ready",m=0;return l.length>0||t.blockingReasons.length>0?(g="blocked",m=2):(r>0||a>0||t.needsAttention)&&(g="needs-attention",m=1),{verdict:g,exitCode:m,stepsPassed:s,stepsWarn:r,stepsFailed:n,stepsMissing:i,stepsSkipped:d}}function ve(e,t){let s=W(e.affectedProjects.map(o=>o.project?.name).filter(o=>typeof o=="string")),r=new Set(s.map(o=>o.toLowerCase())),n=W(e.transitiveImpact.map(o=>o.project?.name).filter(o=>typeof o=="string").filter(o=>!r.has(o.toLowerCase()))),i=new Map;for(let o of t){if(o.scope!=="project"||!o.project)continue;let u=o.project.toLowerCase(),h=i.get(u)??[];h.push(o),i.set(u,h);}let d=[],l=[],a=[],g=[],m=false,c=(o,u)=>{let h=i.get(o.toLowerCase())??[];if(h.length===0){a.push(o);return}let R=h.filter(f=>f.status==="fail"),C=h.filter(f=>f.status==="missing"),b=C.filter(f=>f.required),j=h.some(f=>f.status==="pass"||f.status==="warn");if(R.length>0){l.push(o),g.push(`graph.subgraph.${o}: ${u} has failed verification evidence (${R.map(f=>f.id).join(", ")}).`);return}if(b.length>0){l.push(o),g.push(`graph.subgraph.${o}: ${u} has missing required verification evidence (${b.map(f=>f.id).join(", ")}).`);return}if(C.length>0){l.push(o),m=true;return}if(j){d.push(o);return}a.push(o);};for(let o of s)c(o,"directly-changed");for(let o of n)c(o,"transitive dependent");return {subgraph:{totalProjects:s.length+n.length,directlyChanged:s,transitiveDependents:n,covered:W(d),uncovered:W(l),unverifiable:W(a)},blockingReasons:g,needsAttention:m}}function W(e){return [...new Set(e)].sort((t,s)=>t.localeCompare(s))}async function be(e$1){let t=p.resolve(e$1.workspacePath);if(e$1.fromImpactPath){let i=ie(t,e$1.fromImpactPath);return {impact:await Y(i),fromImpactRef:p.relative(t,i).split(p.sep).join("/"),impactFromDisk:true}}let s=p.join(t,f);if(await y.pathExists(s))return {impact:await Y(s),fromImpactRef:f,impactFromDisk:true};let r=p.join(t,c$1);if(await y.pathExists(r))return {impact:await n({workspacePath:t,fromPath:c$1,scope:e$1.scope,includeAbsolutePaths:e$1.includeAbsolutePaths,includeEvidence:e$1.includeEvidence,observableScanDepth:e$1.observableScanDepth,now:e$1.now}),fromImpactRef:c$1,impactFromDisk:false};let n$1=await j({workspacePath:t,includeAbsolutePaths:e$1.includeAbsolutePaths,includeEvidence:e$1.includeEvidence,observableScanDepth:e$1.observableScanDepth,now:e$1.now});return {impact:{schemaVersion:e,generatedAt:(e$1.now??new Date).toISOString(),fromRef:"baseline",diffRef:".rapidkit/reports/workspace-model-diff-last-run.json",workspace:{name:n$1.workspace.name,profile:n$1.workspace.profile,type:n$1.workspace.type},summary:{changed:false,risk:"none",affectedProjects:0,workspaceItems:0,recommendedCommands:0,blastRadius:{directlyAffected:0,transitivelyAffected:0,maxDistance:0,graphEdges:n$1.graph?.edges.length??0}},affectedProjects:[],transitiveImpact:[],criticalPathHotspots:[],workspaceImpact:[],verificationPlan:[],agentBrief:{headline:"Baseline workspace verify run.",bullets:["No impact report or snapshot was available; baseline gates were evaluated."],unsafeAssumptions:["Do not claim runtime verification passed unless evidence exists."]},diff:{schemaVersion:"workspace-model-diff.v1",generatedAt:(e$1.now??new Date).toISOString(),fromRef:"baseline",toRef:".rapidkit/reports/workspace-model.json",fromHash:"baseline",toHash:"baseline",summary:{changed:false,addedProjects:0,removedProjects:0,changedProjects:0,workspaceChanges:0,validationChanges:0,gitChangedFiles:0},git:{available:false,dirty:false,changedFiles:0,untrackedFiles:0,deletedFiles:0},changes:[],currentModel:n$1}},impactFromDisk:false}}function we(e,t){if(t)return e.generatedAt;let s=e.diff?.generatedAt;if(typeof s=="string"&&s.trim().length>0)return s}async function Ke(e){let t=p.resolve(e.workspacePath),{impact:s,fromImpactRef:r,impactFromDisk:n}=await be(e),i=s.diff.currentModel,d$1=we(s,n),l=oe([...m(),...s.verificationPlan]).filter(k=>ae(e.scope,k)),a$1=[];for(let k of l)a$1.push(await ye(k,t,i.contracts.exists===true,d$1));let g=ve(s,a$1),m$1=a(i.graph??{nodes:[],edges:[]}),c$1=b(i),o=await je(t),u=c(c$1,o?.freshness?.projectHashes),h={verdict:u.verdict,baseline:u.baseline,changed:u.changed,added:u.added,removed:u.removed,projectHashes:d(c$1)},R=b$1(m$1),C=i.policies?.mode??"warn",b$2=await Re(i,t),j=Ce(C,b$2),f=he(a$1,{blockingReasons:[...g.blockingReasons,...R,...j.blockingReasons],needsAttention:g.needsAttention||j.needsAttention}),Q=a$1.filter(k=>k.status==="missing"&&k.evidencePath).map(k=>k.evidencePath),x=[...a$1.filter(k=>k.required&&(k.status==="fail"||k.status==="missing")).map(k=>`${k.id}: ${k.message}`),...g.blockingReasons,...R,...j.blockingReasons],Z=b$2.filter(k=>k.severity==="error").length,ee=i.summary?.projectCount??i.projects.length,$=G({projectCount:ee,verdict:f.verdict,exitCode:f.exitCode,blockingReasons:x,policyErrorCount:Z});f.verdict=$.verdict,f.exitCode=$.exitCode;let B=x.length>0?U({blockingReasons:x,verifyCommand:"npx rapidkit workspace verify --from-impact .rapidkit/reports/workspace-impact-last-run.json --json",verifyArtifact:I}):[];return {schemaVersion:X,generatedAt:(e.now??new Date).toISOString(),workspacePath:t,mode:"evidence",fromImpactRef:r,scope:e.scope,impact:{changed:s.summary.changed,risk:s.summary.risk,affectedProjects:s.summary.affectedProjects,recommendedCommands:s.summary.recommendedCommands},summary:f,steps:a$1,missingEvidence:Q,blockingReasons:x,...B.length>0?{resolutionHints:B}:{},verificationPlan:l,affectedSubgraph:g.subgraph,graphIntegrity:m$1,freshness:h,policyMode:C,policyViolations:b$2}}async function Re(e,t){let s=[];for(let n of e.validation?.issues??[])s.push({source:"model",severity:n.severity,code:n.code,message:n.message,target:n.target});let r=p.join(t,".rapidkit","reports","workspace-contract-verify-last-run.json");try{if(await y.pathExists(r)){let n=await y.readJson(r);if(Array.isArray(n.violations))for(let i of n.violations)typeof i=="string"&&i.trim().length>0&&s.push({source:"contract",severity:"error",code:"contract.violation",message:i});}}catch{}return s.sort((n,i)=>n.source!==i.source?n.source.localeCompare(i.source):n.code!==i.code?n.code.localeCompare(i.code):n.message.localeCompare(i.message))}function Ce(e,t){let s=t.filter(r=>r.severity==="error");return e==="enforce"&&s.length>0?{blockingReasons:s.map(r=>`policy.${r.code}: ${r.message}`),needsAttention:false}:{blockingReasons:[],needsAttention:s.length>0}}async function je(e){let t=p.join(e,I);try{if(!await y.pathExists(t))return null;let s=await y.readJson(t);return s&&s.schemaVersion===X?s:null}catch{return null}}async function Je(e,t){let s=p.join(t,I);return await y.ensureDir(p.dirname(s)),await y.writeJson(s,a$1(e),{spaces:2}),s}function We(e,t){let s=t?.strict?"strict":"default",r=[];if(e.summary.verdict==="blocked")return r.push(...e.blockingReasons),r.length===0&&r.push("verify verdict is blocked."),{passed:false,mode:s,exitCode:2,reasons:r};if(s==="strict"){if(e.summary.verdict!=="ready"&&r.push(`verify verdict is ${e.summary.verdict} (strict requires ready).`),e.freshness.verdict==="stale"){let n=[...e.freshness.changed,...e.freshness.added].slice(0,5);r.push(`freshness is stale${n.length>0?`: ${n.join(", ")}`:""} (strict requires fresh).`);}if(r.length>0)return {passed:false,mode:s,exitCode:1,reasons:r}}return {passed:true,mode:s,exitCode:e.summary.exitCode===2?0:e.summary.exitCode,reasons:r}}function Ue(e,t){let s=We(e,t);return s.passed?e.summary.verdict==="blocked"?2:t?.strict&&e.summary.verdict!=="ready"?1:e.summary.exitCode:s.exitCode}export{K as a,$e as b,X as c,I as d,ve as e,Ke as f,Je as g,We as h,Ue as i};
@@ -1,6 +1,6 @@
1
- import {c as c$1}from'./chunk-FVCZGUVX.js';import {b as b$1,d as d$1,a,e}from'./chunk-RIZCWYRR.js';import {b,c,d}from'./chunk-WA6JYVJM.js';import {j,h,b as b$2,g}from'./chunk-QN2LPLHO.js';import {j as j$1}from'./chunk-DMUEGR36.js';import s from'path';import m from'fs-extra';var _=["Scope","Evidence","Diagnosis","Fix Plan","Run","Verify","Assumptions"];var xe="workspace-operational-skill.v1";function ye(e){if(typeof e!="string")return null;let t=e.trim();return !t||t.includes("/")||t.includes("..")?null:t}function ce(e){let t=ye(e.skillId);if(!t)throw new Error(`Invalid skill id: ${e.skillId}`);return {schemaVersion:xe,skillId:t,canonicalPath:d$1(t),title:e.title,triggers:[...e.triggers].sort((r,i)=>r.localeCompare(i)),requiredReports:[...e.requiredReports].sort((r,i)=>r.localeCompare(i)),scopedProjects:[...e.scopedProjects??[]].sort((r,i)=>r.localeCompare(i)),verificationCommands:[...e.verificationCommands],answerContractSections:[..._],...e.promptStem?{promptStem:e.promptStem}:{},markdown:e.markdown}}var Se="workspace-skills-index.v1";function pe(e){let t=[...e.skills].sort((i,o)=>i.skillId.localeCompare(o.skillId)),r=e.inputsHash??b$2({skillIds:t.map(i=>i.skillId),paths:t.map(i=>i.canonicalPath)});return {schemaVersion:Se,generatedAt:e.generatedAt,inputsHash:r,skills:t.map(i=>({skillId:i.skillId,path:i.canonicalPath,schemaVersion:i.schemaVersion,title:i.title}))}}var de=[".rapidkit/reports/INDEX.json",b,c$1],je=[{skillId:"rapidkit-diagnose-api-failure",title:"Diagnose API failure",triggers:["api failure","500 error","integration test failed","service unreachable"],objective:"Investigate a failing API or service using RapidKit evidence before editing application code.",steps:["Read `.rapidkit/reports/INDEX.json` and identify fail/warn reports for the scoped project.","Read `.rapidkit/reports/doctor-last-run.json` and project-scoped run evidence if present.","Map the failure to workspace vs project scope; cite exit codes and blocker messages.","Propose the smallest safe fix (config, env, dependency) with explicit verification commands."]},{skillId:"rapidkit-release-readiness",title:"Release readiness",triggers:["release","ship","production","readiness gate"],objective:"Assess whether this workspace is release-ready using governed RapidKit gates.",steps:["Read `.rapidkit/reports/release-readiness-last-run.json` and `pipeline-last-run.json`.","Read `.rapidkit/reports/workspace-verify-last-run.json` for verdict and blocking reasons.","List blocking gates first; never claim ready without cited report fields.","Provide one safe next command and a verification checklist."]},{skillId:"rapidkit-safe-schema-migration",title:"Safe schema migration",triggers:["migration","schema change","database migration","db migrate"],objective:"Plan and verify a schema migration with blast-radius awareness.",steps:["Identify affected projects from workspace model and dependency graph.","Run or review impact/verify evidence for transitive dependents.","Require project-scoped test/build commands before promoting the migration.","Document rollback and verification signals."]},{skillId:"rapidkit-dependency-upgrade",title:"Dependency upgrade",triggers:["upgrade dependency","bump package","security advisory","outdated deps"],objective:"Upgrade dependencies with graph-aware verification.",steps:["Scope the upgrade to the owning project from workspace model.","Check transitive dependents via workspace graph / impact reports.","Prefer workspace run test/build for affected projects.","Re-run `workspace verify` after evidence refresh."]},{skillId:"rapidkit-rename-contract",title:"Rename contract safely",triggers:["rename contract","rename event","breaking api","contract change"],objective:"Rename or change a shared contract with consumer awareness.",steps:["Read `.rapidkit/workspace.contract.json` for publishes/consumes/owns edges.","List all consumer projects before proposing renames.","Update contract file and regenerate workspace model.","Verify contract gate and integration tests for consumers."]}];function D(e){return `npx rapidkit ${e}`.trim()}function ve(e){let t=[`# ${e.template.title}`,"",`> Workspace: **${e.workspaceName}** \xB7 Skill: \`${e.template.skillId}\``,"","## Objective","",e.template.objective,"","## Triggers","",...e.template.triggers.map(r=>`- ${r}`),"","## Required evidence (read first)","",...de.map(r=>`- \`${r}\``),"","## Procedure","",...e.template.steps.map((r,i)=>`${i+1}. ${r}`),""];if(e.scopedProjects.length>0&&t.push("## Scoped projects","",...e.scopedProjects.map(r=>`- ${r}`),""),e.contractSummary&&t.push("## Contract context","",e.contractSummary,""),e.verificationCommands.length>0){t.push("## Verification commands (this workspace)","");for(let r of e.verificationCommands)t.push(`- \`${r}\``);t.push("");}return t.push("## Answer contract","","Return: Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.","","## Refresh stale evidence","","```bash",D("workspace agent-sync --write --refresh-context"),"```",""),t.join(`
1
+ import {b,c,d}from'./chunk-33LR2QEM.js';import {d as d$1}from'./chunk-TJN7G2MA.js';import {b as b$1,f,a,g as g$1}from'./chunk-GBJBQ43T.js';import {j,h,b as b$2,g}from'./chunk-EN6YCX36.js';import {j as j$1}from'./chunk-3PTJID76.js';import s from'path';import m from'fs-extra';var _=["Scope","Evidence","Diagnosis","Fix Plan","Run","Verify","Assumptions"];var xe="workspace-operational-skill.v1";function ye(e){if(typeof e!="string")return null;let t=e.trim();return !t||t.includes("/")||t.includes("..")?null:t}function ce(e){let t=ye(e.skillId);if(!t)throw new Error(`Invalid skill id: ${e.skillId}`);return {schemaVersion:xe,skillId:t,canonicalPath:f(t),title:e.title,triggers:[...e.triggers].sort((r,i)=>r.localeCompare(i)),requiredReports:[...e.requiredReports].sort((r,i)=>r.localeCompare(i)),scopedProjects:[...e.scopedProjects??[]].sort((r,i)=>r.localeCompare(i)),verificationCommands:[...e.verificationCommands],answerContractSections:[..._],...e.promptStem?{promptStem:e.promptStem}:{},markdown:e.markdown}}var Se="workspace-skills-index.v1";function pe(e){let t=[...e.skills].sort((i,o)=>i.skillId.localeCompare(o.skillId)),r=e.inputsHash??b$2({skillIds:t.map(i=>i.skillId),paths:t.map(i=>i.canonicalPath)});return {schemaVersion:Se,generatedAt:e.generatedAt,inputsHash:r,skills:t.map(i=>({skillId:i.skillId,path:i.canonicalPath,schemaVersion:i.schemaVersion,title:i.title}))}}var de=[".rapidkit/reports/INDEX.json",b,d$1],je=[{skillId:"rapidkit-diagnose-api-failure",title:"Diagnose API failure",triggers:["api failure","500 error","integration test failed","service unreachable"],objective:"Investigate a failing API or service using RapidKit evidence before editing application code.",steps:["Read `.rapidkit/reports/INDEX.json` and identify fail/warn reports for the scoped project.","Read `.rapidkit/reports/doctor-last-run.json` and project-scoped run evidence if present.","Map the failure to workspace vs project scope; cite exit codes and blocker messages.","Propose the smallest safe fix (config, env, dependency) with explicit verification commands."]},{skillId:"rapidkit-release-readiness",title:"Release readiness",triggers:["release","ship","production","readiness gate"],objective:"Assess whether this workspace is release-ready using governed RapidKit gates.",steps:["Read `.rapidkit/reports/release-readiness-last-run.json` and `pipeline-last-run.json`.","Read `.rapidkit/reports/workspace-verify-last-run.json` for verdict and blocking reasons.","List blocking gates first; never claim ready without cited report fields.","Provide one safe next command and a verification checklist."]},{skillId:"rapidkit-safe-schema-migration",title:"Safe schema migration",triggers:["migration","schema change","database migration","db migrate"],objective:"Plan and verify a schema migration with blast-radius awareness.",steps:["Identify affected projects from workspace model and dependency graph.","Run or review impact/verify evidence for transitive dependents.","Require project-scoped test/build commands before promoting the migration.","Document rollback and verification signals."]},{skillId:"rapidkit-dependency-upgrade",title:"Dependency upgrade",triggers:["upgrade dependency","bump package","security advisory","outdated deps"],objective:"Upgrade dependencies with graph-aware verification.",steps:["Scope the upgrade to the owning project from workspace model.","Check transitive dependents via workspace graph / impact reports.","Prefer workspace run test/build for affected projects.","Re-run `workspace verify` after evidence refresh."]},{skillId:"rapidkit-rename-contract",title:"Rename contract safely",triggers:["rename contract","rename event","breaking api","contract change"],objective:"Rename or change a shared contract with consumer awareness.",steps:["Read `.rapidkit/workspace.contract.json` for publishes/consumes/owns edges.","List all consumer projects before proposing renames.","Update contract file and regenerate workspace model.","Verify contract gate and integration tests for consumers."]}];function D(e){return `npx rapidkit ${e}`.trim()}function ve(e){let t=[`# ${e.template.title}`,"",`> Workspace: **${e.workspaceName}** \xB7 Skill: \`${e.template.skillId}\``,"","## Objective","",e.template.objective,"","## Triggers","",...e.template.triggers.map(r=>`- ${r}`),"","## Required evidence (read first)","",...de.map(r=>`- \`${r}\``),"","## Procedure","",...e.template.steps.map((r,i)=>`${i+1}. ${r}`),""];if(e.scopedProjects.length>0&&t.push("## Scoped projects","",...e.scopedProjects.map(r=>`- ${r}`),""),e.contractSummary&&t.push("## Contract context","",e.contractSummary,""),e.verificationCommands.length>0){t.push("## Verification commands (this workspace)","");for(let r of e.verificationCommands)t.push(`- \`${r}\``);t.push("");}return t.push("## Answer contract","","Return: Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.","","## Refresh stale evidence","","```bash",D("workspace agent-sync --write --refresh-context"),"```",""),t.join(`
2
2
  `)}function Ce(e){return e?.safeCommands?.length?e.safeCommands.slice(0,8).map(t=>t.display):[D("workspace verify --json"),D("doctor workspace --json")]}function Pe(e){return e?.projects?.length?e.projects.slice(0,12).map(r=>{let i=r.contracts.owns.join(", ")||"none",o=r.contracts.publishes.join(", ")||"none",p=r.contracts.consumes.join(", ")||"none";return `- **${r.slug}**: owns \`${i}\`; publishes \`${o}\`; consumes \`${p}\``}).join(`
3
- `):void 0}function le(e$1){let t=e$1.model.workspace.name,r=e$1.model.projects.map(p=>p.name).sort(),i=Ce(e$1.context??null),o=Pe(e$1.contract??null);return je.map(p=>{let c=ve({template:p,workspaceName:t,scopedProjects:r,verificationCommands:i,contractSummary:o});return ce({skillId:p.skillId,title:p.title,triggers:p.triggers,requiredReports:[...de],scopedProjects:r,verificationCommands:i,promptStem:e[p.skillId],markdown:c})})}async function ue(e){let t=s.resolve(e.workspacePath),r=[],i=b$2({skills:e.skills.map(p=>({id:p.skillId,path:p.canonicalPath,hash:b$2({markdown:p.markdown})}))}),o=pe({generatedAt:e.generatedAt,skills:e.skills,inputsHash:i});if(e.write){for(let c of e.skills){let n=s.join(t,c.canonicalPath);await m.ensureDir(s.dirname(n)),await m.writeFile(n,c.markdown,"utf8"),r.push(c.canonicalPath);}let p=s.join(t,b$1);await m.ensureDir(s.dirname(p)),await m.writeJson(p,o,{spaces:2}),r.push(b$1);}return {skills:e.skills,index:o,writtenPaths:r}}function ge(e){return ["## Operational skills (canonical)","","Read workspace-native playbooks from `.rapidkit/skills/` before generic repo scans:","",...e.skills.map(r=>`- \`${r.path}\` \u2014 ${r.title} (\`${r.skillId}\`)`),"","Regenerate:","","```bash",D("workspace agent-sync --write --refresh-context"),"```",""].join(`
3
+ `):void 0}function le(e){let t=e.model.workspace.name,r=e.model.projects.map(p=>p.name).sort(),i=Ce(e.context??null),o=Pe(e.contract??null);return je.map(p=>{let c=ve({template:p,workspaceName:t,scopedProjects:r,verificationCommands:i,contractSummary:o});return ce({skillId:p.skillId,title:p.title,triggers:p.triggers,requiredReports:[...de],scopedProjects:r,verificationCommands:i,promptStem:g$1[p.skillId],markdown:c})})}async function ue(e){let t=s.resolve(e.workspacePath),r=[],i=b$2({skills:e.skills.map(p=>({id:p.skillId,path:p.canonicalPath,hash:b$2({markdown:p.markdown})}))}),o=pe({generatedAt:e.generatedAt,skills:e.skills,inputsHash:i});if(e.write){for(let c of e.skills){let n=s.join(t,c.canonicalPath);await m.ensureDir(s.dirname(n)),await m.writeFile(n,c.markdown,"utf8"),r.push(c.canonicalPath);}let p=s.join(t,b$1);await m.ensureDir(s.dirname(p)),await m.writeJson(p,o,{spaces:2}),r.push(b$1);}return {skills:e.skills,index:o,writtenPaths:r}}function ge(e){return ["## Operational skills (canonical)","","Read workspace-native playbooks from `.rapidkit/skills/` before generic repo scans:","",...e.skills.map(r=>`- \`${r.path}\` \u2014 ${r.title} (\`${r.skillId}\`)`),"","Regenerate:","","```bash",D("workspace agent-sync --write --refresh-context"),"```",""].join(`
4
4
  `)}var Ee={"rapidkit-diagnose-api-failure":".github/prompts/rapidkit-diagnose.prompt.md","rapidkit-release-readiness":".github/prompts/rapidkit-release-readiness.prompt.md"},X="## Workspace verification (hydrated)";function Ie(e){let t=[X,"","Verification commands for this workspace:","",...e.verificationCommands.length?e.verificationCommands.map(r=>`- \`${r}\``):["- `npx rapidkit workspace verify --json`"]];return e.scopedProjects.length>0&&t.push("","Scoped projects:","",...e.scopedProjects.map(r=>`- ${r}`)),t.push(""),t.join(`
5
5
  `)}async function me(e){let t=s.resolve(e.workspacePath),r=[];for(let i of e.skills){let o=Ee[i.skillId];if(!o)continue;let p=s.join(t,o);if(!await m.pathExists(p))continue;let c=await m.readFile(p,"utf8"),n=Ie(i),g=c.includes(X)?c.replace(new RegExp(`${X}[\\s\\S]*$`),n.trimEnd()):`${c.trimEnd()}
6
6
 
@@ -0,0 +1 @@
1
+ import a from'os';import o from'path';import p from'fs-extra';function l(n=process.platform){return n==="win32"?"windows":n==="linux"?"linux":n==="darwin"?"macos":"other"}function s(n=process.platform){return l(n)==="windows"}function E(n=process.platform){return s(n)}var u=new Set(["npx","npm","yarn","pnpm"]);function P(n){return n==="npx"?"npx-cli.js":"npm-cli.js"}function g(n,r){let e=r.npm_execpath;if(!e)return null;let t=o.basename(e).toLowerCase();if(n==="npx"&&t!=="npx-cli.js"){let i=o.join(o.dirname(e),"npx-cli.js");return p.existsSync(i)?i:null}if(n==="npm"&&t==="npx-cli.js"){let i=o.join(o.dirname(e),"npm-cli.js");return p.existsSync(i)?i:null}return p.existsSync(e)?e:null}function x(n){if(n!=="npm"&&n!=="npx")return [];let r=P(n),e=o.dirname(process.execPath),t=o.dirname(e);return [o.join(t,"lib","node_modules","npm","bin",r),o.join(t,"lib64","node_modules","npm","bin",r),o.join("/usr","lib","node_modules","npm","bin",r),o.join("/usr","local","lib","node_modules","npm","bin",r),o.join("/usr","share","nodejs","npm","bin",r)]}function J(n,r=process.platform){return h(n,r).command}function h(n,r=process.platform,e=process.env){let t=n.trim();if(!u.has(t))return {command:t,prefixArgs:[]};let i=o.dirname(process.execPath),d=s(r)?".cmd":"",f=[o.join(i,`${t}${d}`),o.join(i,t)];for(let c of f)if(p.existsSync(c))return {command:c,prefixArgs:[]};let m=g(t,e);if(m)return {command:process.execPath,prefixArgs:[m]};for(let c of x(t))if(p.existsSync(c))return {command:process.execPath,prefixArgs:[c]};return t==="npm"?{command:"corepack",prefixArgs:["npm"]}:{command:t,prefixArgs:[]}}function S(n,r=process.platform){let e=s(r)?";":":",t=o.dirname(process.execPath),i=(n??process.env.PATH??"").split(e).filter(Boolean);return i.includes(t)||i.unshift(t),i.join(e)}var j=["npm_config_package","npm_config__package"];function C(n=process.env,r=process.platform){let e=o.join(a.tmpdir(),"rapidkit-corepack"),t={...n,PATH:S(n.PATH,r),COREPACK_HOME:n.COREPACK_HOME??e};for(let i of j)delete t[i];return t}function _(n=process.platform){return s(n)?"python":"python3"}function R(n=process.platform){return s(n)?["python","py","python3"]:["python3","python"]}function v(n=14,r=10,e=process.platform){let t=[];if(s(e)){for(let i=n;i>=r;i-=1)t.push({command:"py",args:[`-3.${i}`,"--version"]});return t.push({command:"py",args:["-3","--version"]}),t.push({command:"python",args:["--version"]}),t}for(let i=n;i>=r;i-=1)t.push({command:`python3.${i}`,args:["--version"]});return t.push({command:"python3",args:["--version"]}),t.push({command:"python",args:["--version"]}),t}function D(n,r=process.platform){return s(r)?o.join(n,"Scripts"):o.join(n,"bin")}function w(n,r=process.platform){return s(r)?o.join(n,"Scripts","python.exe"):o.join(n,"bin","python")}function O(n,r=process.platform){return s(r)?o.join(n,"Scripts","rapidkit.exe"):o.join(n,"bin","rapidkit")}function B(n,r=process.platform){return s(r)?o.join(n,"Scripts","activate"):o.join(n,"bin","activate")}function K(n,r=process.platform){return s(r)?[o.join(n,"rapidkit.cmd"),o.join(n,".rapidkit","rapidkit.cmd")]:[o.join(n,"rapidkit"),o.join(n,".rapidkit","rapidkit")]}function L(n=process.env,r=process.platform){let e=n.XDG_CONFIG_HOME||n.APPDATA||o.join(a.homedir(),".config");return s(r)?o.join(e,"rapidkit"):o.join(a.homedir(),".rapidkit")}function T(n=process.env,r=process.platform){let e=[];return s(r)?(n.USERPROFILE&&e.push(o.join(n.USERPROFILE,".local","bin")),n.APPDATA&&e.push(o.join(n.APPDATA,"Python","Scripts")),n.LOCALAPPDATA&&e.push(o.join(n.LOCALAPPDATA,"Programs","Python","Scripts"))):e.push(o.join(a.homedir(),".local","bin")),[...new Set(e.filter(Boolean))]}export{l as a,s as b,E as c,J as d,h as e,S as f,C as g,_ as h,R as i,v as j,D as k,w as l,O as m,B as n,K as o,L as p,T as q};
@@ -1 +1 @@
1
- export{c as PYTHON_FREE_WORKSPACE_PROFILES,a as buildWorkspaceManifest,f as createProject,g as registerWorkspaceAtPath,d as resolvePythonFreeFallbackProfile,b as syncWorkspaceFoundationFiles,e as writeWorkspaceLauncher}from'./chunk-KTQZUWAM.js';
1
+ export{c as PYTHON_FREE_WORKSPACE_PROFILES,a as buildWorkspaceManifest,f as createProject,g as registerWorkspaceAtPath,d as resolvePythonFreeFallbackProfile,b as syncWorkspaceFoundationFiles,e as writeWorkspaceLauncher}from'./chunk-RSYUNEH7.js';
@@ -0,0 +1,149 @@
1
+ import {b}from'./chunk-Q2KZIBV4.js';import {promises}from'fs';import s from'path';import L from'nunjucks';import t from'chalk';import h from'ora';import {fileURLToPath}from'url';import {execa}from'execa';import T from'crypto';var N=fileURLToPath(import.meta.url),K=s.dirname(N);function O(e=32){let i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",v=T.randomBytes(e),r="";for(let p=0;p<e;p++)r+=i[v[p]%i.length];return r}async function Q(e,i){let r=(i.template||"fastapi")==="fastapi",p=r?"FastAPI":"NestJS",d=i.kit_name||(r?"fastapi.standard":"nestjs.standard"),A=d.replace(".","/"),w=h(`Generating ${p} project...`).start();try{let u=s.resolve(K,".."),l;d==="fastapi.ddd"?l="fastapi-ddd":d.startsWith("fastapi")?l="fastapi-standard":l="nestjs-standard";let k=s.join(u,"templates","kits",l),x=L.configure(k,{autoescape:false,trimBlocks:true,lstripBlocks:true});x.addFilter("generate_secret",function(a,o=32){return O(o)});let R={project_name:i.project_name,author:i.author||"RapidKit User",description:i.description||(r?"FastAPI service generated with RapidKit":"NestJS application generated with RapidKit"),app_version:i.app_version||"0.1.0",license:i.license||"MIT",package_manager:i.package_manager||"npm",node_version:i.node_version||"20.0.0",database_type:i.database_type||"postgresql",include_caching:i.include_caching||false,created_at:new Date().toISOString(),rapidkit_version:b()},j;r?j=["src/main.py.j2","src/__init__.py.j2","src/cli.py.j2","src/routing/__init__.py.j2","src/routing/health.py.j2","src/routing/examples.py.j2","src/modules/__init__.py.j2","tests/__init__.py.j2","tests/test_health.py.j2","tests/test_examples.py.j2","README.md.j2","pyproject.toml.j2","Makefile.j2","env.example.j2",".rapidkit/__init__.py.j2",".rapidkit/project.json.j2",".rapidkit/cli.py.j2",".rapidkit/rapidkit.j2",".rapidkit/activate.j2","rapidkit.j2","rapidkit.cmd.j2"]:j=["src/main.ts.j2","src/app.module.ts.j2","src/app.controller.ts.j2","src/app.service.ts.j2","src/config/configuration.ts.j2","src/config/validation.ts.j2","src/config/index.ts.j2","src/modules/index.ts.j2","src/examples/examples.module.ts.j2","src/examples/examples.controller.ts.j2","src/examples/examples.service.ts.j2","src/examples/dto/create-note.dto.ts.j2","test/app.controller.spec.ts.j2","test/examples.controller.spec.ts.j2","test/app.e2e-spec.ts.j2","test/jest-e2e.json.j2","package.json.j2","tsconfig.json.j2","tsconfig.build.json.j2","nest-cli.json.j2","jest.config.ts.j2","eslint.config.cjs.j2","env.example.j2","docker-compose.yml.j2","Dockerfile.j2","README.md.j2",".rapidkit/project.json.j2",".rapidkit/rapidkit.j2",".rapidkit/rapidkit.cmd.j2",".rapidkit/activate.j2","rapidkit.j2","rapidkit.cmd.j2"];for(let a of j){let o=s.join(k,a);try{await promises.access(o);}catch{continue}let f=await promises.readFile(o,"utf-8"),m;try{m=x.renderString(f,R);}catch(C){throw console.error(`Failed to render template: ${a}`),C}let c=a==="env.example.j2"?".env.example":a.replace(/\.j2$/,""),_=s.join(e,c);await promises.mkdir(s.dirname(_),{recursive:true}),await promises.writeFile(_,m),(c.endsWith(".rapidkit/rapidkit")||c.endsWith(".rapidkit/cli.py")||c.endsWith(".rapidkit/activate")||c==="rapidkit")&&await promises.chmod(_,493);}if(r){let a=s.join(k,".rapidkit","context.json"),o=s.join(e,".rapidkit","context.json");try{await promises.mkdir(s.join(e,".rapidkit"),{recursive:true}),await promises.copyFile(a,o);}catch{await promises.mkdir(s.join(e,".rapidkit"),{recursive:true});let m=i.engine||"pip";await promises.writeFile(o,JSON.stringify({engine:m,created_by:"rapidkit-npm-fallback"},null,2));}}let $=s.join(e,".rapidkit");await promises.mkdir($,{recursive:true});let D=s.join($,"project.json"),F={kit_name:d,profile:A,created_at:new Date().toISOString(),created_by:"rapidkit-npm-fallback",runtime:r?"python":"node"};await promises.writeFile(D,JSON.stringify(F,null,2),"utf-8");let y=s.join(e,"rapidkit");await promises.access(y).then(()=>true).catch(()=>false)||(await promises.writeFile(y,`#!/usr/bin/env bash
2
+ set -euo pipefail
3
+ SCRIPT_DIR="$(cd "$(dirname "\${BASH_SOURCE[0]}")" && pwd)"
4
+ cd "$SCRIPT_DIR"
5
+ RAPIDKIT_LOCAL_LAUNCHER_BYPASS=1 npx rapidkit "$@"
6
+ `),await promises.chmod(y,493));let I=s.join(e,"rapidkit.cmd");await promises.access(I).then(()=>true).catch(()=>false)||await promises.writeFile(I,`@echo off
7
+ set RAPIDKIT_LOCAL_LAUNCHER_BYPASS=1
8
+ npx rapidkit %*
9
+ `);let E=r?`# Python
10
+ __pycache__/
11
+ *.py[cod]
12
+ *$py.class
13
+ *.so
14
+ .Python
15
+ build/
16
+ develop-eggs/
17
+ dist/
18
+ downloads/
19
+ eggs/
20
+ .eggs/
21
+ lib/
22
+ lib64/
23
+ parts/
24
+ sdist/
25
+ var/
26
+ wheels/
27
+ *.egg-info/
28
+ .installed.cfg
29
+ *.egg
30
+
31
+ # Virtual environments
32
+ .venv/
33
+ venv/
34
+ ENV/
35
+ env/
36
+
37
+ # IDEs
38
+ .vscode/
39
+ .idea/
40
+ *.swp
41
+ *.swo
42
+ *~
43
+
44
+ # OS
45
+ .DS_Store
46
+ Thumbs.db
47
+
48
+ # Project specific
49
+ .env
50
+ .env.local
51
+ `:`# Node artifacts
52
+ node_modules/
53
+ dist/
54
+ .tmp/
55
+ .env
56
+ .env.*
57
+ !.env.example
58
+
59
+ # Logs
60
+ logs/
61
+ *.log
62
+ npm-debug.log*
63
+ yarn-debug.log*
64
+ yarn-error.log*
65
+ pnpm-debug.log*
66
+
67
+ # OS
68
+ .DS_Store
69
+ Thumbs.db
70
+
71
+ # IDEs
72
+ .idea/
73
+ .vscode/
74
+
75
+ # Coverage
76
+ coverage/
77
+ `;if(await promises.writeFile(s.join(e,".gitignore"),E),w.succeed(`${p} project generated!`),!i.skipGit){let a=h("Initializing git repository...").start();try{await execa("git",["init"],{cwd:e}),await execa("git",["add","."],{cwd:e}),await execa("git",["commit","-m",`Initial commit: ${p} project via RapidKit`],{cwd:e}),a.succeed("Git repository initialized");}catch{a.warn("Could not initialize git repository");}}if(!r&&!i.skipInstall){let a=i.package_manager||"npm",o=h(`Installing dependencies with ${a}...`).start();try{await execa(a,a==="yarn"?["install"]:a==="pnpm"?["install"]:["install"],{cwd:e}),o.succeed("Dependencies installed");}catch{o.warn(`Could not install dependencies. Run '${a} install' manually.`);}}let S=s.basename(e);console.log(`
78
+ ${t.yellow("\u26A0\uFE0F Limited offline mode:")} This project was created using basic templates.
79
+ ${t.gray("For full kit features, install Python 3.10+ and rapidkit-core:")}
80
+ ${t.cyan(" sudo apt install python3 python3-pip python3-venv")}
81
+ ${t.cyan(" pip install rapidkit-core")}
82
+ `),console.log(r?`
83
+ ${t.green("\u2728 FastAPI project created successfully!")}
84
+
85
+ ${t.bold("\u{1F4C2} Project structure:")}
86
+ ${e}/
87
+ \u251C\u2500\u2500 .rapidkit/ # RapidKit CLI module
88
+ \u251C\u2500\u2500 src/
89
+ \u2502 \u251C\u2500\u2500 main.py # FastAPI application
90
+ \u2502 \u251C\u2500\u2500 cli.py # CLI commands
91
+ \u2502 \u251C\u2500\u2500 routing/ # API routes
92
+ \u2502 \u2514\u2500\u2500 modules/ # Module system
93
+ \u251C\u2500\u2500 tests/ # Test suite
94
+ \u251C\u2500\u2500 pyproject.toml # Poetry configuration
95
+ \u2514\u2500\u2500 README.md
96
+
97
+ ${t.bold("\u{1F680} Get started:")}
98
+ ${t.cyan(`cd ${S}`)}
99
+ ${t.cyan("npx rapidkit init")} ${t.gray("# Install dependencies")}
100
+ ${t.cyan("npx rapidkit dev")} ${t.gray("# Start dev server")}
101
+
102
+ ${t.bold("\u{1F4DA} Available commands:")}
103
+ npx rapidkit init # Install dependencies (poetry install)
104
+ npx rapidkit dev # Start dev server with hot reload
105
+ npx rapidkit start # Start production server
106
+ npx rapidkit test # Run tests
107
+ npx rapidkit lint # Lint code
108
+ npx rapidkit format # Format code
109
+
110
+ ${t.gray("Alternative: make dev, ./rapidkit dev, poetry run dev")}
111
+ ${t.gray("\u{1F4A1} Tip: Install globally (npm i -g rapidkit) to use without npx")}
112
+ `:`
113
+ ${t.green("\u2728 NestJS project created successfully!")}
114
+
115
+ ${t.bold("\u{1F4C2} Project structure:")}
116
+ ${e}/
117
+ \u251C\u2500\u2500 .rapidkit/ # RapidKit CLI module
118
+ \u251C\u2500\u2500 src/
119
+ \u2502 \u251C\u2500\u2500 main.ts # Application entry point
120
+ \u2502 \u251C\u2500\u2500 app.module.ts # Root module
121
+ \u2502 \u251C\u2500\u2500 config/ # Configuration
122
+ \u2502 \u2514\u2500\u2500 examples/ # Example module
123
+ \u251C\u2500\u2500 test/ # Test files
124
+ \u251C\u2500\u2500 package.json # Dependencies
125
+ \u2514\u2500\u2500 README.md
126
+
127
+ ${t.bold("\u{1F680} Get started:")}
128
+ ${t.cyan(`cd ${S}`)}
129
+ ${t.cyan("npx rapidkit init")} ${t.gray("# Install dependencies")}
130
+ ${t.cyan("cp .env.example .env")}
131
+ ${t.cyan("npx rapidkit dev")} ${t.gray("# Start dev server")}
132
+
133
+ ${t.bold("\u{1F4DA} Available commands:")}
134
+ npx rapidkit init # Install dependencies
135
+ npx rapidkit dev # Start dev server with hot reload
136
+ npx rapidkit start # Start production server
137
+ npx rapidkit build # Build for production
138
+ npx rapidkit test # Run tests
139
+ npx rapidkit lint # Lint code
140
+ npx rapidkit format # Format code
141
+
142
+ ${t.bold("\u{1F310} API endpoints:")}
143
+ http://localhost:8000/health # Health check
144
+ http://localhost:8000/docs # Swagger docs
145
+ http://localhost:8000/examples/notes # Example API
146
+
147
+ ${t.gray("Alternative: npm run start:dev, ./rapidkit dev")}
148
+ ${t.gray("\u{1F4A1} Tip: Install globally (npm i -g rapidkit) to use without npx")}
149
+ `);}catch(u){throw w.fail(`Failed to generate ${p} project`),u}}export{Q as generateDemoKit};
@@ -1 +1 @@
1
- export{a as computeDoctorGateExitCode,b as runDoctor}from'./chunk-YOQ2546V.js';
1
+ export{a as computeDoctorGateExitCode,b as runDoctor}from'./chunk-46AGNYI7.js';