rapidkit 0.40.1 → 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 (199) hide show
  1. package/README.md +48 -7
  2. package/contracts/agent-customization-pack.v1.json +52 -2
  3. package/contracts/extension-cli-compatibility.v1.json +14 -2
  4. package/contracts/runtime-command-surface.v1.json +7 -1
  5. package/contracts/workspace-intelligence/agent-action-outcome.v1.json +38 -0
  6. package/contracts/workspace-intelligence/blocker-resolution.v1.json +65 -0
  7. package/contracts/workspace-intelligence/doctor-fix-result.v1.json +34 -0
  8. package/contracts/workspace-intelligence/studio-blocker-handoff.v1.json +91 -0
  9. package/contracts/workspace-intelligence/workspace-contract-verify.v1.json +51 -0
  10. package/contracts/workspace-intelligence/workspace-dependency-graph.v1.json +61 -1
  11. package/contracts/workspace-intelligence/workspace-explain.v1.json +31 -0
  12. package/contracts/workspace-intelligence/workspace-intelligence-history.v1.json +36 -0
  13. package/contracts/workspace-intelligence/workspace-operational-skill.v1.json +37 -0
  14. package/contracts/workspace-intelligence/workspace-skills-index.v1.json +27 -0
  15. package/dist/analyze-QYHMGLSG.js +1 -0
  16. package/dist/autopilot-release-AHMQEUFH.js +1 -0
  17. package/dist/chunk-33LR2QEM.js +2 -0
  18. package/dist/chunk-3PTJID76.js +2 -0
  19. package/dist/chunk-46AGNYI7.js +50 -0
  20. package/dist/chunk-64RTZBHU.js +2 -0
  21. package/dist/chunk-AQ4XZZC6.js +1 -0
  22. package/dist/{chunk-RXWM5DSC.js → chunk-BFEBZABL.js} +3 -3
  23. package/dist/{chunk-3YLMCP3V.js → chunk-CDCYRBAY.js} +1 -1
  24. package/dist/chunk-CDPR2YKL.js +13 -0
  25. package/dist/chunk-CKXJR3YT.js +7 -0
  26. package/dist/chunk-E5ZVQL3C.js +13 -0
  27. package/dist/chunk-ELU3G6DQ.js +9 -0
  28. package/dist/chunk-EN6YCX36.js +1 -0
  29. package/dist/chunk-FMBSON6H.js +33 -0
  30. package/dist/chunk-GBJBQ43T.js +1 -0
  31. package/dist/chunk-ICGWHIMK.js +1 -0
  32. package/dist/{chunk-4FJQWL7P.js → chunk-ITJ6RKUW.js} +3 -3
  33. package/dist/{workspace-graph-ICB7OVAZ.js → chunk-JEI6BTZI.js} +1 -1
  34. package/dist/{chunk-G76C74EV.js → chunk-JU3VNLTY.js} +1 -1
  35. package/dist/chunk-JW2FSKT3.js +2 -0
  36. package/dist/chunk-KIUSCFHF.js +1 -0
  37. package/dist/chunk-LKX3L7TE.js +2 -0
  38. package/dist/chunk-MIWDCR6I.js +2 -0
  39. package/dist/{chunk-6G2KSHP6.js → chunk-OLDPVVSV.js} +1 -1
  40. package/dist/{chunk-4Q2ZZKGB.js → chunk-PCXSTKZ5.js} +1 -1
  41. package/dist/{chunk-6KD5F6LX.js → chunk-Q2KZIBV4.js} +1 -1
  42. package/dist/{chunk-ERCD6NFF.js → chunk-RSYUNEH7.js} +13 -13
  43. package/dist/chunk-TJN7G2MA.js +1 -0
  44. package/dist/chunk-UQR6G7KH.js +32 -0
  45. package/dist/chunk-VMJA36WD.js +1 -0
  46. package/dist/chunk-WRMCPKGA.js +1 -0
  47. package/dist/{create-XVDDQA42.js → create-RNP5ACQL.js} +1 -1
  48. package/dist/demo-kit-N5U3NGAE.js +149 -0
  49. package/dist/{doctor-UOLOGJ2Z.js → doctor-XM6QDTDC.js} +1 -1
  50. package/dist/{dotnet-webapi-clean-RTBRPDPL.js → dotnet-webapi-clean-K33C77EI.js} +1 -1
  51. package/dist/{gofiber-standard-UGIRKPKL.js → gofiber-standard-BQ4HCXL2.js} +1 -1
  52. package/dist/{gogin-standard-HJ7SPFNT.js → gogin-standard-PUBCYW3A.js} +1 -1
  53. package/dist/index.d.ts +45 -7
  54. package/dist/index.js +145 -127
  55. package/dist/{pipeline-XK62WL4D.js → pipeline-DH6Z47O4.js} +1 -1
  56. package/dist/platform-capabilities-TSLK667K.js +1 -0
  57. package/dist/{pythonRapidkitExec-MNWRC4F2.js → pythonRapidkitExec-SGKW76XM.js} +1 -1
  58. package/dist/{springboot-standard-IWJSVDLZ.js → springboot-standard-XFVQI37R.js} +1 -1
  59. package/dist/{workspace-L4ITCKMM.js → workspace-E554C5SM.js} +1 -1
  60. package/dist/workspace-agent-sync-2HRPM5ZD.js +1 -0
  61. package/dist/{workspace-context-NMMQMHNU.js → workspace-context-VJTXW3K4.js} +1 -1
  62. package/dist/workspace-contract-OO4GMENV.js +1 -0
  63. package/dist/workspace-explain-3WSJLIJ6.js +1 -0
  64. package/dist/workspace-explain-contract-24RQ7KIW.js +1 -0
  65. package/dist/workspace-feedback-65NR3EZH.js +1 -0
  66. package/dist/{workspace-foundation-HNIRAIBF.js → workspace-foundation-LISDH53T.js} +1 -1
  67. package/dist/workspace-graph-2A5THUCI.js +1 -0
  68. package/dist/workspace-history-VPDADQKG.js +1 -0
  69. package/dist/{workspace-intelligence-64IWAYHS.js → workspace-intelligence-E3KXEZCM.js} +1 -1
  70. package/dist/workspace-mcp-serve-RFYDCA2L.js +3 -0
  71. package/dist/workspace-model-YL7W3573.js +1 -0
  72. package/dist/workspace-registry-summary-X5WRUU3T.js +1 -0
  73. package/dist/workspace-run-GCIQD73R.js +1 -0
  74. package/dist/workspace-verify-NRYH7RNB.js +1 -0
  75. package/dist/workspace-watch-H2AETGFI.js +1 -0
  76. package/docs/DEVELOPMENT.md +1 -1
  77. package/docs/OPEN_SOURCE_USER_SCENARIOS.md +1 -1
  78. package/docs/README.md +1 -1
  79. package/docs/commands-reference.md +10 -2
  80. package/docs/contracts/ARTIFACT_CATALOG.md +3 -1
  81. package/docs/contracts/NAMING_AND_COEXISTENCE.md +58 -0
  82. package/docs/workspace-run.md +25 -1
  83. package/package.json +7 -3
  84. package/scripts/enterprise-package-smoke.mjs +427 -0
  85. package/scripts/prepack-enterprise.mjs +40 -0
  86. package/templates/generator.js +175 -0
  87. package/templates/kits/fastapi-ddd/README.md.j2 +122 -0
  88. package/templates/kits/fastapi-ddd/common/env.example.j2 +10 -0
  89. package/templates/kits/fastapi-ddd/env.example.j2 +1 -0
  90. package/templates/kits/fastapi-ddd/pyproject.toml.j2 +64 -0
  91. package/templates/kits/fastapi-ddd/src/__init__.py.j2 +3 -0
  92. package/templates/kits/fastapi-ddd/src/app/__init__.py.j2 +11 -0
  93. package/templates/kits/fastapi-ddd/src/app/application/__init__.py.j2 +5 -0
  94. package/templates/kits/fastapi-ddd/src/app/application/interfaces.py.j2 +43 -0
  95. package/templates/kits/fastapi-ddd/src/app/application/use_cases/__init__.py.j2 +6 -0
  96. package/templates/kits/fastapi-ddd/src/app/application/use_cases/health.py.j2 +14 -0
  97. package/templates/kits/fastapi-ddd/src/app/application/use_cases/notes.py.j2 +24 -0
  98. package/templates/kits/fastapi-ddd/src/app/config/__init__.py.j2 +16 -0
  99. package/templates/kits/fastapi-ddd/src/app/domain/__init__.py.j2 +3 -0
  100. package/templates/kits/fastapi-ddd/src/app/domain/models/__init__.py.j2 +6 -0
  101. package/templates/kits/fastapi-ddd/src/app/domain/models/health.py.j2 +16 -0
  102. package/templates/kits/fastapi-ddd/src/app/domain/models/note.py.j2 +27 -0
  103. package/templates/kits/fastapi-ddd/src/app/infrastructure/__init__.py.j2 +5 -0
  104. package/templates/kits/fastapi-ddd/src/app/infrastructure/repositories/__init__.py.j2 +6 -0
  105. package/templates/kits/fastapi-ddd/src/app/infrastructure/repositories/health.py.j2 +17 -0
  106. package/templates/kits/fastapi-ddd/src/app/infrastructure/repositories/notes.py.j2 +28 -0
  107. package/templates/kits/fastapi-ddd/src/app/main.py.j2 +61 -0
  108. package/templates/kits/fastapi-ddd/src/app/presentation/__init__.py.j2 +3 -0
  109. package/templates/kits/fastapi-ddd/src/app/presentation/api/__init__.py.j2 +5 -0
  110. package/templates/kits/fastapi-ddd/src/app/presentation/api/dependencies/__init__.py.j2 +19 -0
  111. package/templates/kits/fastapi-ddd/src/app/presentation/api/router.py.j2 +10 -0
  112. package/templates/kits/fastapi-ddd/src/app/presentation/api/routes/__init__.py.j2 +5 -0
  113. package/templates/kits/fastapi-ddd/src/app/presentation/api/routes/health.py.j2 +27 -0
  114. package/templates/kits/fastapi-ddd/src/app/presentation/api/routes/notes.py.j2 +50 -0
  115. package/templates/kits/fastapi-ddd/src/app/shared/__init__.py.j2 +5 -0
  116. package/templates/kits/fastapi-ddd/src/app/shared/result.py.j2 +28 -0
  117. package/templates/kits/fastapi-ddd/src/cli.py.j2 +167 -0
  118. package/templates/kits/fastapi-ddd/src/main.py.j2 +35 -0
  119. package/templates/kits/fastapi-ddd/src/modules/__init__.py.j2 +3 -0
  120. package/templates/kits/fastapi-ddd/src/routing/__init__.py.j2 +13 -0
  121. package/templates/kits/fastapi-ddd/src/routing/health.py.j2 +7 -0
  122. package/templates/kits/fastapi-ddd/src/routing/notes.py.j2 +7 -0
  123. package/templates/kits/fastapi-ddd/tests/__init__.py.j2 +1 -0
  124. package/templates/kits/fastapi-ddd/tests/test_app_factory.py.j2 +22 -0
  125. package/templates/kits/fastapi-ddd/tests/test_health.py.j2 +17 -0
  126. package/templates/kits/fastapi-ddd/tests/test_notes.py.j2 +27 -0
  127. package/templates/kits/fastapi-standard/README.md.j2 +145 -0
  128. package/templates/kits/fastapi-standard/common/env.example.j2 +10 -0
  129. package/templates/kits/fastapi-standard/env.example.j2 +1 -0
  130. package/templates/kits/fastapi-standard/pyproject.toml.j2 +64 -0
  131. package/templates/kits/fastapi-standard/src/__init__.py.j2 +3 -0
  132. package/templates/kits/fastapi-standard/src/cli.py.j2 +168 -0
  133. package/templates/kits/fastapi-standard/src/main.py.j2 +66 -0
  134. package/templates/kits/fastapi-standard/src/modules/__init__.py.j2 +3 -0
  135. package/templates/kits/fastapi-standard/src/routing/__init__.py.j2 +16 -0
  136. package/templates/kits/fastapi-standard/src/routing/examples.py.j2 +71 -0
  137. package/templates/kits/fastapi-standard/src/routing/health.py.j2 +22 -0
  138. package/templates/kits/fastapi-standard/tests/__init__.py.j2 +1 -0
  139. package/templates/kits/fastapi-standard/tests/test_examples.py.j2 +29 -0
  140. package/templates/kits/fastapi-standard/tests/test_health.py.j2 +17 -0
  141. package/templates/kits/nestjs-standard/Dockerfile.j2 +41 -0
  142. package/templates/kits/nestjs-standard/README.md.j2 +139 -0
  143. package/templates/kits/nestjs-standard/docker-compose.yml.j2 +94 -0
  144. package/templates/kits/nestjs-standard/docs/README.md.j2 +15 -0
  145. package/templates/kits/nestjs-standard/env.example.j2 +18 -0
  146. package/templates/kits/nestjs-standard/eslint.config.cjs.j2 +9 -0
  147. package/templates/kits/nestjs-standard/jest.config.ts.j2 +22 -0
  148. package/templates/kits/nestjs-standard/nest-cli.json.j2 +10 -0
  149. package/templates/kits/nestjs-standard/package.json.j2 +101 -0
  150. package/templates/kits/nestjs-standard/src/app.controller.ts.j2 +14 -0
  151. package/templates/kits/nestjs-standard/src/app.module.ts.j2 +26 -0
  152. package/templates/kits/nestjs-standard/src/app.service.ts.j2 +16 -0
  153. package/templates/kits/nestjs-standard/src/auth/auth.controller.ts.j2 +20 -0
  154. package/templates/kits/nestjs-standard/src/auth/auth.module.ts.j2 +13 -0
  155. package/templates/kits/nestjs-standard/src/auth/auth.service.ts.j2 +6 -0
  156. package/templates/kits/nestjs-standard/src/auth/entities/token.entity.ts.j2 +3 -0
  157. package/templates/kits/nestjs-standard/src/auth/entities/user.entity.ts.j2 +3 -0
  158. package/templates/kits/nestjs-standard/src/auth/entities/webauthn.entity.ts.j2 +3 -0
  159. package/templates/kits/nestjs-standard/src/config/configuration.ts.j2 +85 -0
  160. package/templates/kits/nestjs-standard/src/config/index.ts.j2 +2 -0
  161. package/templates/kits/nestjs-standard/src/config/validation.ts.j2 +21 -0
  162. package/templates/kits/nestjs-standard/src/examples/dto/create-note.dto.ts.j2 +11 -0
  163. package/templates/kits/nestjs-standard/src/examples/examples.controller.ts.j2 +24 -0
  164. package/templates/kits/nestjs-standard/src/examples/examples.module.ts.j2 +10 -0
  165. package/templates/kits/nestjs-standard/src/examples/examples.service.ts.j2 +33 -0
  166. package/templates/kits/nestjs-standard/src/main.ts.j2 +53 -0
  167. package/templates/kits/nestjs-standard/src/modules/index.ts.j2 +25 -0
  168. package/templates/kits/nestjs-standard/test/app.controller.spec.ts.j2 +24 -0
  169. package/templates/kits/nestjs-standard/test/app.e2e-spec.ts.j2 +60 -0
  170. package/templates/kits/nestjs-standard/test/examples.controller.spec.ts.j2 +28 -0
  171. package/templates/kits/nestjs-standard/test/jest-e2e.json.j2 +15 -0
  172. package/templates/kits/nestjs-standard/tsconfig.build.json.j2 +12 -0
  173. package/templates/kits/nestjs-standard/tsconfig.json.j2 +26 -0
  174. package/dist/analyze-RHQM4AB2.js +0 -1
  175. package/dist/autopilot-release-OJTLXPMX.js +0 -1
  176. package/dist/chunk-5VBRMLRU.js +0 -7
  177. package/dist/chunk-7VI4U7Q5.js +0 -2
  178. package/dist/chunk-FV5A3N3I.js +0 -2
  179. package/dist/chunk-GDGATWR5.js +0 -2
  180. package/dist/chunk-GOM3RFB3.js +0 -2
  181. package/dist/chunk-GX7UU7LL.js +0 -33
  182. package/dist/chunk-KYH364KQ.js +0 -1
  183. package/dist/chunk-OWNGSAO3.js +0 -2
  184. package/dist/chunk-QPEBI6AB.js +0 -2
  185. package/dist/chunk-TYZPPUBH.js +0 -1
  186. package/dist/chunk-VQMZC5TC.js +0 -9
  187. package/dist/chunk-WHCON2VN.js +0 -50
  188. package/dist/chunk-X7PWDIQW.js +0 -1
  189. package/dist/chunk-Z5LKRG57.js +0 -1
  190. package/dist/chunk-ZWKLRZE5.js +0 -13
  191. package/dist/demo-kit-RWGOEDW4.js +0 -141
  192. package/dist/workspace-agent-sync-G7JU77IK.js +0 -25
  193. package/dist/workspace-contract-D5O4OZD5.js +0 -1
  194. package/dist/workspace-history-LHUTLE3S.js +0 -1
  195. package/dist/workspace-model-SDHH5RBC.js +0 -1
  196. package/dist/workspace-registry-summary-MIPHVB56.js +0 -1
  197. package/dist/workspace-run-SPP32MPV.js +0 -1
  198. package/dist/workspace-verify-6Q6MGRG6.js +0 -1
  199. package/dist/workspace-watch-JDXVGW4H.js +0 -1
@@ -1 +1 @@
1
- import {d,b,g as g$1,a,c}from'./chunk-GOM3RFB3.js';import {randomUUID}from'crypto';var i=null;function f(){return i}function V(t){let r=t.argv??process.argv,n=m(r.slice(2)),e={runId:randomUUID(),startedAt:new Date().toISOString(),command:n,cwd:t.cwd??process.cwd(),rapidkitVersion:t.rapidkitVersion,finalized:false};return i=e,d(e.runId),b(r)&&g$1(l(e,"run.started","info","CLI run started")),e}function E(t,r){if(!(!i||i.finalized)){if(i.finalized=true,!b()){i=null;return}t===0?g$1(l(i,"run.completed","info",r??"CLI run completed",{exitCode:t})):g$1(l(i,"run.failed","error",r??"CLI run failed",{exitCode:t})),i=null;}}function w(t=process.argv){a(t)==="json"&&(process.env.RAPIDKIT_LOG_FORMAT="json");let r=t.slice(0,2),n=m(t.slice(2));n.length!==t.length-2&&(process.argv=[...r,...n]);}function m(t){let r=[];for(let n=0;n<t.length;n+=1){let e=t[n];if(e!=="--log-json"){if(e==="--log-format"){n+=1;continue}e.startsWith("--log-format=")||r.push(e);}}return r}function l(t,r,n,e,o){return {schemaVersion:c,runId:t.runId,timestamp:new Date().toISOString(),level:n,event:r,component:"cli",message:e,command:t.command,metadata:{cwd:t.cwd,rapidkitVersion:t.rapidkitVersion,startedAt:t.startedAt,...o}}}var g=false;function L(t){if(g||!t?.force&&(process.env.VITEST==="true"||process.env.VITEST==="1"||process.env.NODE_ENV==="test"))return;g=true;let r=process.exit.bind(process);process.exit=(n=>{let e=typeof n=="number"?n:typeof n=="string"?Number.parseInt(n,10):0,o=Number.isFinite(e)?e:1;return E(o),r(n)});}function O(){return f()?.runId}function _(t,r){let{blockers:n,stderrTail:e,runId:o,generatedAt:p,...C}=r,x=p||(typeof t.generatedAt=="string"?t.generatedAt:void 0)||(typeof t.timestamp=="string"?t.timestamp:void 0)||new Date().toISOString();return {...t,...C,generatedAt:x,...n&&n.length>0?{blockers:n}:{},...e&&e.trim()?{stderrTail:e.trim()}:{},...o?{runId:o}:{}}}export{V as a,E as b,w as c,L as d,O as e,_ as f};
1
+ import {d,b,g as g$1,a,c}from'./chunk-MIWDCR6I.js';import {randomUUID}from'crypto';var i=null;function f(){return i}function V(t){let r=t.argv??process.argv,n=m(r.slice(2)),e={runId:randomUUID(),startedAt:new Date().toISOString(),command:n,cwd:t.cwd??process.cwd(),rapidkitVersion:t.rapidkitVersion,finalized:false};return i=e,d(e.runId),b(r)&&g$1(l(e,"run.started","info","CLI run started")),e}function E(t,r){if(!(!i||i.finalized)){if(i.finalized=true,!b()){i=null;return}t===0?g$1(l(i,"run.completed","info",r??"CLI run completed",{exitCode:t})):g$1(l(i,"run.failed","error",r??"CLI run failed",{exitCode:t})),i=null;}}function w(t=process.argv){a(t)==="json"&&(process.env.RAPIDKIT_LOG_FORMAT="json");let r=t.slice(0,2),n=m(t.slice(2));n.length!==t.length-2&&(process.argv=[...r,...n]);}function m(t){let r=[];for(let n=0;n<t.length;n+=1){let e=t[n];if(e!=="--log-json"){if(e==="--log-format"){n+=1;continue}e.startsWith("--log-format=")||r.push(e);}}return r}function l(t,r,n,e,o){return {schemaVersion:c,runId:t.runId,timestamp:new Date().toISOString(),level:n,event:r,component:"cli",message:e,command:t.command,metadata:{cwd:t.cwd,rapidkitVersion:t.rapidkitVersion,startedAt:t.startedAt,...o}}}var g=false;function L(t){if(g||!t?.force&&(process.env.VITEST==="true"||process.env.VITEST==="1"||process.env.NODE_ENV==="test"))return;g=true;let r=process.exit.bind(process);process.exit=(n=>{let e=typeof n=="number"?n:typeof n=="string"?Number.parseInt(n,10):0,o=Number.isFinite(e)?e:1;return E(o),r(n)});}function O(){return f()?.runId}function _(t,r){let{blockers:n,stderrTail:e,runId:o,generatedAt:p,...C}=r,x=p||(typeof t.generatedAt=="string"?t.generatedAt:void 0)||(typeof t.timestamp=="string"?t.timestamp:void 0)||new Date().toISOString();return {...t,...C,generatedAt:x,...n&&n.length>0?{blockers:n}:{},...e&&e.trim()?{stderrTail:e.trim()}:{},...o?{runId:o}:{}}}export{V as a,E as b,w as c,L as d,O as e,_ as f};
@@ -1,4 +1,4 @@
1
- import {f}from'./chunk-6G2KSHP6.js';import {b as b$1}from'./chunk-2FIX2MDC.js';import {execa}from'execa';import m from'chalk';import {createRequire}from'module';import {promises}from'fs';import l from'path';import g from'os';var v="rapidkit",A=createRequire(import.meta.url),C=A("../package.json"),i=C?.version??"0.0.0";function b(r){let e=r.trim().match(/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/);if(!e)return null;let t=e[4]?e[4].split(".").map(o=>o.match(/^\d+$/)?Number(o):o):[];return {major:Number(e[1]),minor:Number(e[2]),patch:Number(e[3]),prerelease:t}}function k(r,n){let e=b(r),t=b(n);if(!e||!t)return 0;if(e.major!==t.major)return e.major>t.major?1:-1;if(e.minor!==t.minor)return e.minor>t.minor?1:-1;if(e.patch!==t.patch)return e.patch>t.patch?1:-1;if(e.prerelease.length===0&&t.prerelease.length===0)return 0;if(e.prerelease.length===0)return 1;if(t.prerelease.length===0)return -1;let o=Math.max(e.prerelease.length,t.prerelease.length);for(let u=0;u<o;u+=1){let a=e.prerelease[u],s=t.prerelease[u];if(a===void 0)return -1;if(s===void 0)return 1;if(a===s)continue;let d=typeof a=="number",h=typeof s=="number";return d&&h?a>s?1:-1:d?-1:h||String(a)>String(s)?1:-1}return 0}var _=14400*1e3;function y(){let r=process.env.RAPIDKIT_CACHE_DIR?.trim()||(process.env.VITEST_WORKER_ID?l.join(g.homedir(),".rapidkit","cache",`vitest-${process.env.VITEST_WORKER_ID}`):l.join(g.homedir(),".rapidkit","cache"));return l.join(r,"update-check.json")}async function U(){try{let r=await promises.readFile(y(),"utf-8"),n=JSON.parse(r);return typeof n.latestVersion=="string"&&typeof n.checkedAt=="number"&&n.currentVersion===i&&Date.now()-n.checkedAt<_?n:null}catch{return null}}async function N(r){try{let n=y();await promises.mkdir(l.dirname(n),{recursive:true}),await promises.writeFile(n,JSON.stringify({latestVersion:r,checkedAt:Date.now(),currentVersion:i}),"utf-8");}catch{}}async function F(){try{f.debug("Checking for updates...");let r=await U();if(r){let t=Math.round((Date.now()-r.checkedAt)/6e4);f.debug(`Update check: cache hit (${t}m old)`),k(r.latestVersion,i)>0&&(console.log(m.yellow(`
1
+ import {f}from'./chunk-OLDPVVSV.js';import {b as b$1}from'./chunk-2FIX2MDC.js';import {execa}from'execa';import m from'chalk';import {createRequire}from'module';import {promises}from'fs';import l from'path';import g from'os';var v="rapidkit",A=createRequire(import.meta.url),C=A("../package.json"),i=C?.version??"0.0.0";function b(r){let e=r.trim().match(/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/);if(!e)return null;let t=e[4]?e[4].split(".").map(o=>o.match(/^\d+$/)?Number(o):o):[];return {major:Number(e[1]),minor:Number(e[2]),patch:Number(e[3]),prerelease:t}}function k(r,n){let e=b(r),t=b(n);if(!e||!t)return 0;if(e.major!==t.major)return e.major>t.major?1:-1;if(e.minor!==t.minor)return e.minor>t.minor?1:-1;if(e.patch!==t.patch)return e.patch>t.patch?1:-1;if(e.prerelease.length===0&&t.prerelease.length===0)return 0;if(e.prerelease.length===0)return 1;if(t.prerelease.length===0)return -1;let o=Math.max(e.prerelease.length,t.prerelease.length);for(let u=0;u<o;u+=1){let a=e.prerelease[u],s=t.prerelease[u];if(a===void 0)return -1;if(s===void 0)return 1;if(a===s)continue;let d=typeof a=="number",h=typeof s=="number";return d&&h?a>s?1:-1:d?-1:h||String(a)>String(s)?1:-1}return 0}var _=14400*1e3;function y(){let r=process.env.RAPIDKIT_CACHE_DIR?.trim()||(process.env.VITEST_WORKER_ID?l.join(g.homedir(),".rapidkit","cache",`vitest-${process.env.VITEST_WORKER_ID}`):l.join(g.homedir(),".rapidkit","cache"));return l.join(r,"update-check.json")}async function U(){try{let r=await promises.readFile(y(),"utf-8"),n=JSON.parse(r);return typeof n.latestVersion=="string"&&typeof n.checkedAt=="number"&&n.currentVersion===i&&Date.now()-n.checkedAt<_?n:null}catch{return null}}async function N(r){try{let n=y();await promises.mkdir(l.dirname(n),{recursive:true}),await promises.writeFile(n,JSON.stringify({latestVersion:r,checkedAt:Date.now(),currentVersion:i}),"utf-8");}catch{}}async function F(){try{f.debug("Checking for updates...");let r=await U();if(r){let t=Math.round((Date.now()-r.checkedAt)/6e4);f.debug(`Update check: cache hit (${t}m old)`),k(r.latestVersion,i)>0&&(console.log(m.yellow(`
2
2
  \u26A0\uFE0F Update available: ${i} \u2192 ${r.latestVersion}`)),console.log(m.cyan(`Run: npm install -g rapidkit@latest
3
3
  `)));return}let{stdout:n}=await execa("npm",["view",v,"version"],{timeout:b$1()}),e=n.trim();await N(e),e&&k(e,i)>0?(console.log(m.yellow(`
4
4
  \u26A0\uFE0F Update available: ${i} \u2192 ${e}`)),console.log(m.cyan(`Run: npm install -g rapidkit@latest
@@ -1,4 +1,4 @@
1
- import {k,e as e$2}from'./chunk-G76C74EV.js';import {b as b$2}from'./chunk-3YLMCP3V.js';import {e,g,f as f$2,b as b$3,c as c$2,d as d$2}from'./chunk-ZWKLRZE5.js';import {a,d,b as b$1}from'./chunk-RV6HBTFC.js';import {b}from'./chunk-6KD5F6LX.js';import {f,c,e as e$3}from'./chunk-6G2KSHP6.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-L4ITCKMM.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-D5O4OZD5.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};
@@ -0,0 +1,32 @@
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
+ `)}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){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
+ `)}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
+ `)}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
+
7
+ ${n}`;e.write&&await m.writeFile(p,`${g.trimEnd()}
8
+ `,"utf8"),r.push(o);}return r}var Oe="rapidkit-agent-customization-pack.v1";function ke(){return {schemaVersion:Oe,presets:{minimal:{meaning:"Generate the portable grounding index, AGENTS.md, and provider-specific lightweight instructions.",requiredOutputs:[".rapidkit/reports/INDEX.json",".rapidkit/reports/agent-customization-pack.json","AGENTS.md"]},enterprise:{meaning:"Generate the full VS Code-native pack: instructions, prompts, skills, custom agents, and validation metadata.",requiredOutputs:[".rapidkit/reports/INDEX.json",".rapidkit/reports/agent-customization-pack.json","AGENTS.md",".github/instructions/rapidkit-workspace.instructions.md",".github/prompts/rapidkit-diagnose.prompt.md",".github/skills/rapidkit-workspace-intelligence/SKILL.md",".github/agents/workspai-advisor.agent.md",".rapidkit/reports/rapidkit-mcp-design.json",b$1]}},targets:{all:{meaning:"Generate every supported customization surface.",outputFamilies:["portable","vscode","copilot","cursor","claude"]},vscode:{meaning:"Generate VS Code-native customizations for Copilot Chat and agent workflows.",outputFamilies:["instructions","prompts","skills","agents","hooks"]},agents:{meaning:"Generate portable AGENTS.md grounding for any agent.",outputFamilies:["portable"]},copilot:{meaning:"Generate GitHub Copilot instructions, prompts, and skills.",outputFamilies:["instructions","prompts","skills"]},cursor:{meaning:"Generate Cursor rules.",outputFamilies:["rules"]},claude:{meaning:"Generate Claude Code grounding files.",outputFamilies:["rules","portable"]},codex:{meaning:"Use AGENTS.md and the report index as the Codex grounding layer.",outputFamilies:["portable"]},orca:{meaning:"Use AGENTS.md and the report index as the Orca/Grok grounding layer.",outputFamilies:["portable"]}},standardAnswerContract:[..._],requiredReports:O.map(e=>({path:e.relativePath,label:e.label,required:e.required})),strictRules:["Required reports must exist.","Generated report paths must stay inside the workspace root.","Generated customization text must be English-only.","Agent answers must not claim pass, ready, or healthy without cited evidence.","Commands must distinguish display guidance from execution requests.","Agent hook files must be advisory and disabled by default unless the user explicitly enables them.","MCP design artifacts must stay read-mostly until write tools have explicit approval boundaries."],outputKinds:["report","grounding","instruction","prompt","skill","skill-resource","operational-skill","skills-index","explain-report","agent","rule","hook","mcp-design"],pathLayers:{l1CanonicalRoots:[".rapidkit/reports/",`${a}/`],l2PrefixedMirrorRoots:[".github/",".cursor/",".claude/"],l3SharedIndustryFiles:["AGENTS.md",".github/copilot-instructions.md","CLAUDE.md"]}}}var Te="rapidkit-agent-reports-index.v1",We="rapidkit-agent-customization-pack.v1",B=".rapidkit/reports/INDEX.json",fe=".rapidkit/AGENT-GROUNDING.md",G=".rapidkit/reports/agent-customization-pack.json",O=[{relativePath:b,label:"Agent context pack",required:true},{relativePath:b$1,label:"Operational skills index",required:true},{relativePath:".rapidkit/reports/workspace-model.json",label:"Workspace model graph",required:false},{relativePath:".rapidkit/reports/doctor-last-run.json",label:"Workspace doctor",required:false},{relativePath:".rapidkit/reports/analyze-last-run.json",label:"Workspace analyze",required:false},{relativePath:".rapidkit/reports/pipeline-last-run.json",label:"Governance pipeline",required:false},{relativePath:".rapidkit/reports/release-readiness-last-run.json",label:"Release readiness",required:false},{relativePath:".rapidkit/reports/workspace-impact-last-run.json",label:"Workspace impact",required:false},{relativePath:".rapidkit/reports/workspace-verify-last-run.json",label:"Workspace verify",required:false},{relativePath:".rapidkit/reports/workspace-model-snapshot.json",label:"Workspace model snapshot",required:false},{relativePath:".rapidkit/reports/workspace-model-diff-last-run.json",label:"Workspace model diff",required:false},{relativePath:".rapidkit/reports/workspace-explain-last-run.json",label:"Workspace explain",required:false},{relativePath:".rapidkit/reports/workspace-contract-verify-last-run.json",label:"Workspace contract verify",required:false},{relativePath:".rapidkit/reports/workspace-intelligence-history.json",label:"Workspace intelligence history",required:false}];function k(e){return `npx rapidkit ${e}`.trim()}function we(e){return e&&typeof e=="object"?e:null}function J(e,t=12){return Array.isArray(e)?e.filter(r=>typeof r=="string"&&r.trim().length>0).slice(0,t):[]}function Ne(e){let t=J(e.blockers,12);if(t.length>0)return t;let r=J(e.blockingReasons,12);if(r.length>0)return r;let i=we(e.summary);return i&&Array.isArray(i.blockingReasons)?J(i.blockingReasons,12):[]}function _e(e){for(let t of ["generatedAt","timestamp"]){let r=e[t];if(typeof r=="string"&&r.trim())return r.trim()}}function De(e,t,r){if(!e)return true;let i=Date.parse(e);return Number.isFinite(i)?r.getTime()-i>t*60*60*1e3:true}function Ge(e){let t=e&&e.length>0?e:["all"];return t.includes("all")?new Set(["all","vscode","agents","copilot","cursor","claude","codex","orca"]):new Set(t)}function A(e,t){return e.has("all")||e.has(t)}function Ke(e){return A(e,"copilot")||A(e,"vscode")}function Le(e){return e??"enterprise"}function Me(e){return e===b$1?"skills-index":e.includes("workspace-explain-last-run.json")?"explain-report":e.startsWith(".rapidkit/skills/")&&e.endsWith(".md")?"operational-skill":e.includes("hooks")||e.endsWith("rapidkit-agent-hooks.json")?"hook":e.includes("mcp")||e.endsWith("rapidkit-mcp-design.json")?"mcp-design":e.endsWith(".json")?"report":e.includes("/instructions/")||e.endsWith("copilot-instructions.md")?"instruction":e.includes("/prompts/")?"prompt":e.includes("/skills/")&&e.endsWith("/SKILL.md")?"skill":e.includes("/skills/")?"skill-resource":e.includes("/agents/")?"agent":e.includes("/rules/")||e.endsWith(".mdc")?"rule":"grounding"}function qe(e){return e.startsWith(".github/")?["vscode","copilot"]:e.startsWith(".cursor/")?["cursor"]:e.startsWith(".claude/")||e==="CLAUDE.md"?["claude"]:e==="AGENTS.md"||e.startsWith(".rapidkit/")?["agents","codex","orca","vscode"]:e.startsWith(".vscode/")?["vscode"]:["agents"]}function $e(e,t){return ke().presets[t].requiredOutputs.includes(e)}function He(e){return e.schemaVersion===g&&typeof e.generatedAt=="string"&&e.summary!=null&&typeof e.summary=="object"&&!Array.isArray(e.summary)&&Array.isArray(e.projects)}async function Ve(e,t){if(t)return t;let r=s.join(e,h);if(await m.pathExists(r))try{let i=await m.readJson(r);if(He(i))return i}catch{}return j({workspacePath:e,includeEvidence:true})}function ze(e){return e.length>0&&!s.isAbsolute(e)&&!e.split(/[\\/]+/).includes("..")}function Fe(e){return Object.fromEntries(["all","vscode","agents","copilot","cursor","claude","codex","orca"].map(r=>[r,{enabled:e.targets.includes("all")||e.targets.includes(r),outputs:e.outputs.filter(i=>i.targets.includes(r)).map(i=>i.path).sort()}]))}async function Ue(e){try{if(!await m.pathExists(e))return null;let t=await m.readJson(e);return we(t)}catch{return null}}async function Xe(e){let t=e.now??new Date,r=e.staleAfterHours??24,i=[],o=[];for(let c of O){let n=s.join(e.workspacePath,c.relativePath),g=await Ue(n),j=g!==null;j&&g&&o.push(...Ne(g)),i.push({path:c.relativePath,label:c.label,required:c.required,exists:j,generatedAt:g?_e(g):void 0,commandId:typeof g?.commandId=="string"?g.commandId:void 0,exitCode:typeof g?.exitCode=="number"?g.exitCode:void 0});}let p=[...new Set(o.map(c=>c.trim()).filter(Boolean))].slice(0,16);return {schemaVersion:Te,generatedAt:t.toISOString(),workspaceRoot:e.workspacePath,readOrder:O.map(c=>c.relativePath),blockers:p,staleAfterHours:r,reports:i,refreshCommand:k("workspace agent-sync --write --refresh-context")}}function he(e){let t=["# RapidKit agent grounding","","Cross-tool instructions for Copilot, Cursor, Claude Code, Codex, Grok, and other agents.","","## Read order (mandatory before workspace diagnosis)","","1. `.rapidkit/reports/INDEX.json` \u2014 latest blockers, timestamps, and report paths","2. `.rapidkit/reports/workspace-context-agent.json` \u2014 canonical agent context pack","3. Evidence artifacts listed in the index (doctor, analyze, pipeline, readiness, impact, verify)","","Do **not** full-repo scan until these reports are read or regenerated.","","## Regenerate intelligence","","```bash",k("workspace agent-sync --write --refresh-context"),k("workspace context --for-agent --json --write"),k("pipeline --json --write"),"```",""];if(e.index.blockers.length>0){t.push("## Current blockers","");for(let r of e.index.blockers.slice(0,12))t.push(`- ${r}`);t.push("");}if(e.context?.safeCommands?.length){t.push("## Safe commands (prefer these)","");for(let r of e.context.safeCommands.slice(0,10))t.push(`- \`${r.display}\` \u2014 ${r.description}`);t.push("");}return t.push("## Rules","","- Treat `.rapidkit/reports/*` as the source of truth for health, gates, and release posture.","- Prefer deterministic RapidKit CLI commands over heuristic framework guesses.","- If evidence is missing or stale, run the refresh commands above before proposing fixes.","- Keep project-scoped advice aligned with the active project named in the context pack.",""),t.join(`
9
+ `)}function Be(e){return ["# RapidKit agent grounding","",`Generated: ${e.generatedAt}`,"","This file is tool-agnostic. Synced agents should read it together with `.rapidkit/reports/INDEX.json`.","","## Mandatory read order","",...e.readOrder.map((t,r)=>`${r+1}. \`${t}\``),"",e.blockers.length>0?"## Blockers":"",...e.blockers.length>0?e.blockers.map(t=>`- ${t}`):[],"","## Refresh","","```bash",e.refreshCommand,"```",""].filter(t=>t!=="").join(`
10
+ `)}function Je(){return ["# RapidKit workspace grounding","","Before answering workspace, release, or architecture questions:","","1. Read `AGENTS.md` (managed RapidKit section).","2. Read `.rapidkit/reports/INDEX.json` and `.rapidkit/reports/workspace-context-agent.json`.","3. Use evidence reports before scanning the full repository.","","Regenerate stale intelligence:","","```bash",k("workspace agent-sync --write --refresh-context"),"```",""].join(`
11
+ `)}function Ze(){return ["## Claude Code","","- Load `.rapidkit/reports/INDEX.json` before diagnosing blockers.","- Use `.claude/rules/rapidkit-evidence.md` when editing files under `.rapidkit/`.","- Refresh grounding with `npx rapidkit workspace agent-sync --write`.",""].join(`
12
+ `)}function Ye(){return ["---","description: RapidKit workspace evidence and intelligence grounding","globs: []","alwaysApply: true","---","","Before proposing fixes in this workspace:","","1. Read `AGENTS.md` and `.rapidkit/reports/INDEX.json`.","2. Read `.rapidkit/reports/workspace-context-agent.json`.","3. Prefer evidence in `.rapidkit/reports/*` over full-repo exploration.","","Refresh when stale:","","```bash",k("workspace agent-sync --write --refresh-context"),"```",""].join(`
13
+ `)}function Qe(){return ["---",'applyTo: ".rapidkit/**,**/.rapidkit/**"',"description: RapidKit evidence and intelligence artifacts","---","","When working under `.rapidkit/`:","","- Treat JSON reports as canonical gate and health evidence.","- Start from `reports/INDEX.json` for read order and blockers.","- Do not invent pass/fail state \u2014 cite `exitCode`, `blockers`, and `generatedAt` fields.",""].join(`
14
+ `)}function et(){return ["---",'applyTo: "**"',"description: RapidKit workspace scope, evidence, and command discipline","---","","# RapidKit Workspace Intelligence","","Use RapidKit reports as the workspace source of truth before giving architectural, repair, release, or project lifecycle advice.","","## Scope rules","","- Start from `.rapidkit/reports/INDEX.json` and `.rapidkit/reports/workspace-context-agent.json`.","- Distinguish workspace-level blockers from project-level blockers.","- When a project is active, cite its name, path, framework, and evidence source.","- Do not translate unsupported stack requests into unrelated native kits.","","## Answer contract","","Return answers with: Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.",""].join(`
15
+ `)}function tt(){return ["# RapidKit evidence","","Applies when reading or editing `.rapidkit/reports/*`.","","- Start from `INDEX.json`, then `workspace-context-agent.json`.","- Use report blockers as the primary fix target.","- Regenerate with `npx rapidkit workspace agent-sync --write`.",""].join(`
16
+ `)}function rt(){return ["---","description: Diagnose RapidKit workspace blockers from evidence reports","---","","Diagnose this workspace using RapidKit evidence only.","","Read:","","- `.rapidkit/reports/INDEX.json`","- `.rapidkit/reports/workspace-context-agent.json`","- Any fail/warn reports referenced in the index","","Return:","","1. Root cause grounded in report blockers","2. Smallest safe fix path (commands + file edits)","3. One verification command to prove recovery",""].join(`
17
+ `)}function K(e){return ["---",`description: ${e.description}`,"---","",e.objective,"","Read first:","","- `.rapidkit/reports/INDEX.json`","- `.rapidkit/reports/workspace-context-agent.json`","- Any report referenced by the current blocker or task","","Return:","",...e.expectedOutput.map((t,r)=>`${r+1}. ${t}`),"","Use the standard RapidKit answer contract: Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.",""].join(`
18
+ `)}function S(e){return ["# "+e.title,"",...e.lines,""].join(`
19
+ `)}function it(){return S({title:"MCP Tool Design",lines:["RapidKit MCP is a future read-mostly bridge. Use the CLI reports today; do not assume a running MCP server exists.","","Candidate read tools:","- `getWorkspaceModel` \u2014 read `.rapidkit/reports/workspace-model.json`.","- `getEvidenceIndex` \u2014 read `.rapidkit/reports/INDEX.json`.","- `getBlockers` \u2014 derive current blockers from INDEX and gate reports.","- `getSafeCommands` \u2014 read safe commands from `workspace-context-agent.json`.","- `getProjectContext` \u2014 return one project-scoped slice of the workspace model.","- `getArtifact` \u2014 read one explicit artifact path inside the workspace root.","- `listOperationalSkills` \u2014 read `.rapidkit/reports/workspace-skills-index.json`.","- `getWorkspaceExplain` \u2014 read/build workspace explain for release-blocked or project scope.","- `refreshWorkspaceIntelligence` \u2014 explicit user-approved refresh command only.","","Write or repair tools require explicit approval boundaries and are intentionally not part of the first read-mostly design."]})}function nt(e){return `${JSON.stringify({schemaVersion:"rapidkit-mcp-design.v1",generatedAt:e.generatedAt,workspaceRoot:e.workspacePath,status:"design-only",mode:"read-mostly",safety:{writeToolsEnabled:false,approvalRequiredForRefresh:true,artifactReadsMustStayInsideWorkspace:true},candidateTools:[{name:"getWorkspaceModel",reads:[".rapidkit/reports/workspace-model.json"],mutates:false},{name:"getEvidenceIndex",reads:[".rapidkit/reports/INDEX.json"],mutates:false},{name:"getBlockers",reads:[".rapidkit/reports/INDEX.json",".rapidkit/reports/workspace-verify-last-run.json",".rapidkit/reports/pipeline-last-run.json"],mutates:false},{name:"getSafeCommands",reads:[".rapidkit/reports/workspace-context-agent.json"],mutates:false},{name:"getProjectContext",reads:[".rapidkit/reports/workspace-model.json",".rapidkit/reports/workspace-context-agent.json"],mutates:false},{name:"getArtifact",reads:["requested workspace-relative artifact path"],mutates:false},{name:"listOperationalSkills",reads:[".rapidkit/reports/workspace-skills-index.json"],mutates:false},{name:"getWorkspaceExplain",reads:[".rapidkit/reports/workspace-explain-last-run.json",".rapidkit/reports/workspace-verify-last-run.json",".rapidkit/reports/workspace-impact-last-run.json"],mutates:false},{name:"refreshWorkspaceIntelligence",command:k("workspace agent-sync --write --refresh-context"),mutates:true,approvalRequired:true}]},null,2)}
20
+ `}function st(e){return `${JSON.stringify({schemaVersion:"rapidkit-agent-hooks.v1",generatedAt:e.generatedAt,workspaceRoot:e.workspacePath,enabledByDefault:false,mode:"advisory",hooks:[{name:"rapidkit-pre-tool-use-workspace-boundary",event:"PreToolUse",purpose:"Block or warn on state-changing commands outside the active workspace root.",defaultAction:"warn",rules:["Allow read-only commands.","Warn before write/delete commands outside workspaceRoot.","Never run destructive commands without explicit user approval."]},{name:"rapidkit-post-tool-use-verify-suggestion",event:"PostToolUse",purpose:"Suggest non-destructive verification commands after edits.",defaultAction:"suggest",commands:[k("doctor workspace"),k("workspace verify --strict --json")]},{name:"rapidkit-user-prompt-submit-scope-hint",event:"UserPromptSubmit",purpose:"Inject lightweight workspace scope and evidence index hints.",defaultAction:"inject-context-hint",reads:[".rapidkit/reports/INDEX.json",".rapidkit/reports/workspace-context-agent.json"]}]},null,2)}
21
+ `}function ot(e){let t=["---","name: rapidkit-workspace-intelligence","description: Use RapidKit workspace intelligence reports to answer, repair, verify, and release with evidence","---","","# RapidKit Workspace Intelligence","","Use this skill for workspace architecture, project lifecycle, blocker repair, release readiness, agent grounding, and CI evidence questions.","","## Decision flow","","1. Load `resources/scope-model.md`.","2. Load `.rapidkit/reports/INDEX.json`.","3. Load `.rapidkit/reports/workspace-context-agent.json`.","4. Load `.rapidkit/reports/workspace-skills-index.json` when operational playbooks are needed.","5. Load the smallest evidence report required for the task.","6. Answer with Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.","","## Rules","","- Prefer RapidKit reports over full-repo scans.","- Never claim a gate passed without a cited report.","- Separate display commands from execution requests.","- Keep project-scoped fixes inside the active project unless workspace evidence says otherwise.",""];return e?.trim()&&t.push(e.trim(),""),t.join(`
22
+ `)}function L(e){return ["---",`name: ${e.name}`,`description: ${e.description}`,`tools: [${e.tools.map(t=>`'${t}'`).join(", ")}]`,"---","",`You are the ${e.name} agent for RapidKit Workspace Intelligence.`,"",`Mode: ${e.mode}.`,"","Start every task by reading `.rapidkit/reports/INDEX.json` and `.rapidkit/reports/workspace-context-agent.json`.","","Use this answer contract:","","- Scope","- Evidence","- Diagnosis","- Fix Plan","- Run","- Verify","- Assumptions","","Do not invent health, readiness, or policy status. Cite report paths and command outputs.",""].join(`
23
+ `)}function at(){return ["---","name: rapidkit-grounding","description: Load RapidKit workspace intelligence reports before diagnosing or changing code","---","","# RapidKit grounding","","Use when the user asks about workspace health, release gates, doctor/pipeline failures, or project structure.","","## Workflow","","1. Read `.rapidkit/reports/INDEX.json`","2. Read `.rapidkit/reports/workspace-context-agent.json`","3. Read fail/warn evidence artifacts listed in the index","4. Propose the smallest safe fix with explicit verification commands","","## Refresh stale evidence","","```bash",k("workspace agent-sync --write --refresh-context"),"```",""].join(`
24
+ `)}async function u(e,t,r){return r?(await m.ensureDir(s.dirname(e)),await m.writeFile(e,t,"utf8"),"written"):"skipped"}async function Z(e){if(!e.write)return "skipped";let t=await m.pathExists(e.absolutePath)?await m.readFile(e.absolutePath,"utf8"):null,{upsertManagedAgentSection:r}=await import('./managed-agent-markers-AXUM75OE.js'),i=r(t,e.generatedBody),o=e.preamble?`${e.preamble.trimEnd()}
25
+
26
+ ${i}`:i;return await m.ensureDir(s.dirname(e.absolutePath)),await m.writeFile(e.absolutePath,o,"utf8"),"written"}function Ht(e){if(!e?.trim())return;let t=new Set(["all","vscode","agents","copilot","cursor","claude","codex","orca"]),r=e.split(",").map(i=>i.trim().toLowerCase()).filter(i=>t.has(i));return r.length>0?r:void 0}function ct(e){let t=[...e.outputs].sort((r,i)=>r.path.localeCompare(i.path));return {schemaVersion:We,generatedAt:e.generatedAt,workspaceRoot:e.workspacePath,preset:e.preset,targets:[...e.targets].sort(),sourceReports:e.index.reports.filter(r=>r.exists).map(r=>r.path).sort(),outputInventory:t,capabilityMatrix:Fe({targets:e.targets,outputs:t}),drift:{missingRequired:e.missingRequired,staleReports:e.staleReports,strictViolations:e.strictViolations},answerContract:["Scope","Evidence","Diagnosis","Fix Plan","Run","Verify","Assumptions"],refreshCommand:k(`workspace agent-sync --write --refresh-context --preset ${e.preset}`),experimental:{hooksEnabled:e.experimentalHooks,mcpReady:t.some(r=>r.kind==="mcp-design")}}}async function Vt(e){let t=s.resolve(e.workspacePath),r=new Date,i=e.staleAfterHours??24,o=Ge(e.targets),p=[...o].sort(),c$1=Le(e.preset),n=e.write===true,g=e.strict===true,j$2,v=null,M;e.refreshContext&&(M=await j({workspacePath:t,includeEvidence:true}),v=await c({workspacePath:t,model:M,agent:e.agent??"generic",scope:e.scope,includeEvidence:true}),n&&(j$2=await d(v,t)));let f=await Xe({workspacePath:t,staleAfterHours:i,now:r}),T=f.reports.filter(a=>a.required&&!a.exists).map(a=>a.path),W=f.reports.filter(a=>a.exists&&De(a.generatedAt,i,r)).map(a=>a.path),C=[];g&&(T.length>0&&C.push(`Missing required reports: ${T.join(", ")}`),W.length>0&&C.push(`Stale reports (>${i}h): ${W.join(", ")}`));let q=[],$=[],H=[],d$1=(a,l)=>{a==="written"?q.push(l):$.push(l),H.push({path:l,kind:Me(l),targets:qe(l),required:$e(l,c$1),status:a==="written"?"written":e.dryRun?"planned":"skipped"});};d$1(await u(s.join(t,B),`${JSON.stringify(f,null,2)}
27
+ `,n),B),d$1(await u(s.join(t,fe),`${Be(f)}
28
+ `,n),fe);let Y="",Ae=await Ve(t,M),V=null;try{V=(await j$1({workspacePath:t})).contract;}catch{V=null;}let Re=le({model:Ae,context:v,contract:V}),z=await ue({workspacePath:t,skills:Re,generatedAt:r.toISOString(),write:n});for(let a of z.skills)d$1(n?"written":"skipped",a.canonicalPath);if(d$1(n?"written":"skipped",b$1),Y=ge(z.index),(A(o,"agents")||A(o,"vscode"))&&d$1(await Z({absolutePath:s.join(t,"AGENTS.md"),generatedBody:he({index:f,context:v}),write:n}),"AGENTS.md"),A(o,"claude")){let a=s.join(t,"CLAUDE.md");if(n){let{upsertManagedAgentSection:l}=await import('./managed-agent-markers-AXUM75OE.js'),h=await m.pathExists(a)?await m.readFile(a,"utf8"):"",R=l(h,Ze()),b=R.includes("@AGENTS.md")?R:`@AGENTS.md
29
+
30
+ ${R}`;await m.ensureDir(s.dirname(a)),await m.writeFile(a,b,"utf8"),q.push("CLAUDE.md");}else $.push("CLAUDE.md");d$1(await u(s.join(t,".claude/rules/rapidkit-evidence.md"),`${tt()}
31
+ `,n),".claude/rules/rapidkit-evidence.md");}if(A(o,"cursor")&&d$1(await u(s.join(t,".cursor/rules/rapidkit-grounding.mdc"),Ye(),n),".cursor/rules/rapidkit-grounding.mdc"),Ke(o)){if(d$1(await Z({absolutePath:s.join(t,".github/copilot-instructions.md"),generatedBody:Je(),write:n}),".github/copilot-instructions.md"),d$1(await u(s.join(t,".github/instructions/rapidkit-workspace.instructions.md"),et(),n),".github/instructions/rapidkit-workspace.instructions.md"),d$1(await u(s.join(t,".github/instructions/rapidkit-evidence.instructions.md"),Qe(),n),".github/instructions/rapidkit-evidence.instructions.md"),d$1(await u(s.join(t,".github/prompts/rapidkit-diagnose.prompt.md"),rt(),n),".github/prompts/rapidkit-diagnose.prompt.md"),c$1==="enterprise"){let a=[[".github/prompts/rapidkit-repair.prompt.md",K({description:"Repair RapidKit blockers with evidence and verification",objective:"Plan the smallest safe repair for the current RapidKit blocker.",expectedOutput:["Blocker and affected workspace/project scope","Evidence paths and exact failing signals","Minimal fix plan","Human-run commands","Verification command and expected success signal"]})],[".github/prompts/rapidkit-release-readiness.prompt.md",K({description:"Assess RapidKit release readiness from evidence",objective:"Assess whether this workspace is release-ready using RapidKit gates.",expectedOutput:["Readiness verdict with cited reports","Blocking gates","Safe next command","Verification checklist"]})],[".github/prompts/rapidkit-project-onboard.prompt.md",K({description:"Onboard a project into RapidKit Workspace Intelligence",objective:"Guide project onboarding using workspace model and create planner capabilities.",expectedOutput:["Target project scope","Native create, external create-adopt, or adopt-only lane","Safe commands","Post-onboarding verification"]})],[".github/prompts/rapidkit-adopt-project.prompt.md",K({description:"Adopt an existing project into RapidKit governance",objective:"Adopt an existing project without changing its runtime behavior.",expectedOutput:["Detected stack and confidence","Adoption plan","Generated metadata expectations","Doctor and workspace model verification"]})]];for(let[l,h]of a)d$1(await u(s.join(t,l),h,n),l);if(e.hydratePrompts===true)for(let l of await me({workspacePath:t,skills:z.skills,write:n}))d$1(n?"written":"skipped",l);}if(d$1(await u(s.join(t,".github/skills/rapidkit-grounding/SKILL.md"),at(),n),".github/skills/rapidkit-grounding/SKILL.md"),c$1==="enterprise"){d$1(await u(s.join(t,".github/skills/rapidkit-workspace-intelligence/SKILL.md"),ot(Y),n),".github/skills/rapidkit-workspace-intelligence/SKILL.md");let a=[["artifact-map.md",S({title:"Artifact Map",lines:O.map(h=>`- \`${h.relativePath}\` \u2014 ${h.label}`)})],["command-map.md",S({title:"Command Map",lines:["- `npx rapidkit workspace agent-sync --write --refresh-context` \u2014 refresh agent grounding.","- `npx rapidkit workspace model --json --write` \u2014 refresh workspace model.","- `npx rapidkit doctor workspace` \u2014 refresh health evidence.","- `npx rapidkit workspace verify --strict --json` \u2014 verify release gates."]})],["scope-model.md",S({title:"Scope Model",lines:["- Workspace scope is the default source of truth.","- Project scope is selected only when the active task targets a specific project.","- Always name the workspace and project when giving repair or lifecycle advice."]})],["runtime-support.md",S({title:"Runtime Support",lines:["- Native create is available only for RapidKit-owned scaffold contracts.","- Unsupported stacks should use external-create-adopt when a stable ecosystem generator exists.","- Existing projects should use adopt-only when native create is unavailable."]})],["create-planner-capabilities.md",S({title:"Create Planner Capabilities",lines:["- Use `contracts/create-planner-capabilities.v1.json` to decide native-create, external-create-adopt, or adopt-only.","- Do not map PHP, WordPress, Laravel, Rails, or Symfony requests to unrelated native kits.","- Explain unsupported native create requests and guide users to adopt/import."]})],["mcp-tools.md",it()]];for(let[h,R]of a){let b=`.github/skills/rapidkit-workspace-intelligence/resources/${h}`;d$1(await u(s.join(t,b),R,n),b);}let l=[["workspai-advisor.agent.md",L({name:"Workspai Advisor",description:"Read-only workspace and project guidance using RapidKit evidence",mode:"read-only",tools:["search","read"]})],["workspai-repair.agent.md",L({name:"Workspai Repair",description:"Turn RapidKit blockers into minimal fixes and verification steps",mode:"repair",tools:["search","read","edit"]})],["workspai-release.agent.md",L({name:"Workspai Release",description:"Assess readiness, governance gates, and release safety from evidence",mode:"release",tools:["search","read"]})],["workspai-project-onboarder.agent.md",L({name:"Workspai Project Onboarder",description:"Guide create, import, and adopt flows with RapidKit contracts",mode:"onboard",tools:["search","read","edit"]})]];for(let[h,R]of l){let b=`.github/agents/${h}`;d$1(await u(s.join(t,b),R,n),b);}}}if(c$1==="enterprise"&&d$1(await u(s.join(t,".rapidkit/reports/rapidkit-mcp-design.json"),nt({workspacePath:t,generatedAt:f.generatedAt}),n),".rapidkit/reports/rapidkit-mcp-design.json"),c$1==="enterprise"&&e.experimentalHooks===true&&d$1(await u(s.join(t,".vscode/rapidkit-agent-hooks.json"),st({workspacePath:t,generatedAt:f.generatedAt}),n),".vscode/rapidkit-agent-hooks.json"),(A(o,"codex")||A(o,"orca"))&&(A(o,"agents")||d$1(await Z({absolutePath:s.join(t,"AGENTS.md"),generatedBody:he({index:f,context:v}),write:n}),"AGENTS.md")),g){let a=H.map(l=>l.path).filter(l=>!ze(l));a.length>0&&C.push(`Unsafe generated output paths: ${a.join(", ")}`);}let Q=ct({workspacePath:t,generatedAt:r.toISOString(),preset:c$1,targets:p,index:f,outputs:[...H,{path:G,kind:"report",targets:["agents","vscode","copilot","codex","orca"],required:true,status:n?"written":e.dryRun?"planned":"skipped"}],missingRequired:T,staleReports:W,strictViolations:C,experimentalHooks:e.experimentalHooks===true});return d$1(await u(s.join(t,G),`${JSON.stringify(Q,null,2)}
32
+ `,n),G),{workspacePath:t,indexPath:s.join(t,B),packPath:s.join(t,G),pack:Q,contextPath:j$2,writtenFiles:q,skippedFiles:$,blockers:f.blockers,missingRequired:T,staleReports:W,strictViolations:C}}export{xe as a,Se as b,Te as c,We as d,B as e,fe as f,G as g,O as h,Xe as i,Ht as j,Vt as k,Oe as l};
@@ -0,0 +1 @@
1
+ import a from'path';import s from'fs-extra';var c="workspace-intelligence-history.v1",p=".rapidkit/reports/workspace-intelligence-history.json",y=50;function d(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t;return typeof e.generatedAt!="string"?null:e.kind==="agent-action"?typeof e.actionId!="string"||typeof e.summary!="string"||e.outcome!=="ok"&&e.outcome!=="failed"?null:{kind:"agent-action",generatedAt:e.generatedAt,actionId:e.actionId,scope:typeof e.scope=="string"?e.scope:"workspace",summary:e.summary,outcome:e.outcome,...typeof e.evidenceSha256=="string"?{evidenceSha256:e.evidenceSha256}:{}}:typeof e.verdict!="string"||typeof e.risk!="string"||typeof e.gatePassed!="boolean"?null:{kind:"verify",generatedAt:e.generatedAt,verdict:e.verdict,risk:String(e.risk),affectedProjects:typeof e.affectedProjects=="number"?e.affectedProjects:0,freshness:e.freshness??"unknown",gatePassed:e.gatePassed,blockingReasons:typeof e.blockingReasons=="number"?e.blockingReasons:0,policyViolations:typeof e.policyViolations=="number"?e.policyViolations:0}}function A(t,e){return {kind:"verify",generatedAt:t.generatedAt,verdict:t.summary.verdict,risk:t.impact.risk,affectedProjects:t.impact.affectedProjects,freshness:t.freshness.verdict,gatePassed:e,blockingReasons:t.blockingReasons.length,policyViolations:t.policyViolations.length}}function h(t){return {kind:"agent-action",generatedAt:t.generatedAt,actionId:t.actionId,scope:t.scope,summary:t.summary,outcome:t.outcome,...t.evidenceSha256?{evidenceSha256:t.evidenceSha256}:{}}}async function f(t){let e=a.join(t,p);try{if(!await s.pathExists(e))return null;let r=await s.readJson(e);return r?.schemaVersion!==c||!Array.isArray(r.entries)?null:{schemaVersion:c,retention:typeof r.retention=="number"?r.retention:y,entries:r.entries.map(n=>d(n)).filter(n=>n!=null)}}catch{return null}}function l(t,e,r=y){let n=Math.max(1,Math.floor(r)),o=[...t?.entries??[],e],i=o.slice(Math.max(0,o.length-n));return {schemaVersion:c,retention:n,entries:i}}async function H(t,e,r){let n=await f(t),o=l(n,e,r?.retention??y),i=a.join(t,p);return await s.ensureDir(a.dirname(i)),await s.writeJson(i,o,{spaces:2}),o}export{c as a,p as b,y as c,d,A as e,h as f,f as g,l as h,H as i};
@@ -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-ERCD6NFF.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-WHCON2VN.js';
1
+ export{a as computeDoctorGateExitCode,b as runDoctor}from'./chunk-46AGNYI7.js';
@@ -1,4 +1,4 @@
1
- import {b,c}from'./chunk-3Q7264EJ.js';import {b as b$2}from'./chunk-6KD5F6LX.js';import {promises}from'fs';import n from'path';import i from'chalk';import b$1 from'ora';import {execa}from'execa';var C="net8.0",R="8080";function A(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-")}function j(e,r){return e.trim().replace(/[^A-Za-z0-9_.]+/g,".").replace(/^\.+|\.+$/g,"").replace(/\.{2,}/g,".").split(".").map(a=>a.replace(/^[^A-Za-z_]+/,"").replace(/[^A-Za-z0-9_]/g,"")).filter(Boolean).join(".")||r}function S(e,r){return e.replace(/[\r\n\t]+/g," ").trim()||r}function y(e){return /^net\d+\.\d+$/.test(e.trim())}function _(){return JSON.stringify({engine:"npm",runtime:"dotnet"},null,2)}function E(e,r){return JSON.stringify({kit_name:"dotnet.webapi.clean",runtime:"dotnet",framework:"dotnet",module_support:false,project_name:e.project_name,root_namespace:e.root_namespace,target_framework:e.target_framework,app_version:e.app_version,created_by:"rapidkit-npm",rapidkit_version:r,created_at:new Date().toISOString()},null,2)}function D(e){return `<Project Sdk="Microsoft.NET.Sdk.Web">
1
+ import {b,c}from'./chunk-3Q7264EJ.js';import {b as b$2}from'./chunk-Q2KZIBV4.js';import {promises}from'fs';import n from'path';import i from'chalk';import b$1 from'ora';import {execa}from'execa';var C="net8.0",R="8080";function A(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-")}function j(e,r){return e.trim().replace(/[^A-Za-z0-9_.]+/g,".").replace(/^\.+|\.+$/g,"").replace(/\.{2,}/g,".").split(".").map(a=>a.replace(/^[^A-Za-z_]+/,"").replace(/[^A-Za-z0-9_]/g,"")).filter(Boolean).join(".")||r}function S(e,r){return e.replace(/[\r\n\t]+/g," ").trim()||r}function y(e){return /^net\d+\.\d+$/.test(e.trim())}function _(){return JSON.stringify({engine:"npm",runtime:"dotnet"},null,2)}function E(e,r){return JSON.stringify({kit_name:"dotnet.webapi.clean",runtime:"dotnet",framework:"dotnet",module_support:false,project_name:e.project_name,root_namespace:e.root_namespace,target_framework:e.target_framework,app_version:e.app_version,created_by:"rapidkit-npm",rapidkit_version:r,created_at:new Date().toISOString()},null,2)}function D(e){return `<Project Sdk="Microsoft.NET.Sdk.Web">
2
2
  <PropertyGroup>
3
3
  <TargetFramework>${e.target_framework}</TargetFramework>
4
4
  <Nullable>enable</Nullable>
@@ -1,4 +1,4 @@
1
- import {c,b as b$1,d as d$1,e,f,a}from'./chunk-3Q7264EJ.js';import {b}from'./chunk-6KD5F6LX.js';import {promises}from'fs';import d from'path';import o from'chalk';import S from'ora';import {execa}from'execa';function _(e){return `package main
1
+ import {c,b as b$1,d as d$1,e,f,a}from'./chunk-3Q7264EJ.js';import {b}from'./chunk-Q2KZIBV4.js';import {promises}from'fs';import d from'path';import o from'chalk';import S from'ora';import {execa}from'execa';function _(e){return `package main
2
2
 
3
3
  import (
4
4
  "fmt"