workspai 0.43.0 → 0.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/README.md +26 -13
  2. package/contracts/agent-customization-pack.v1.json +1 -1
  3. package/contracts/autopilot-release.v1.json +204 -0
  4. package/contracts/cli-operation-result.v1.json +119 -0
  5. package/contracts/command-capabilities.v1.json +138 -0
  6. package/contracts/compatibility-matrix.v1.json +37 -0
  7. package/contracts/create-planner-capabilities.v1.json +156 -65
  8. package/contracts/doctor-project-scan.v2.json +60 -0
  9. package/contracts/doctor-remediation-plan.v1.json +19 -4
  10. package/contracts/doctor-remediation-plan.v2.json +7 -0
  11. package/contracts/doctor-workspace-cache.v2.json +82 -0
  12. package/contracts/extension-cli-compatibility.v1.json +47 -3
  13. package/contracts/infra-plan.v1.json +189 -0
  14. package/contracts/private-product-manifest.v1.json +155 -0
  15. package/contracts/product-factory-plan.v1.json +200 -0
  16. package/contracts/project-archive.v1.json +40 -0
  17. package/contracts/project-entry-capability.v1.json +127 -0
  18. package/contracts/published-contract-catalog.v1.json +334 -0
  19. package/contracts/runtime-command-surface.v1.json +239 -10
  20. package/contracts/version.v1.json +48 -0
  21. package/contracts/workspace-archive-capabilities.v1.json +90 -0
  22. package/contracts/workspace-archive-manifest.v1.json +107 -0
  23. package/contracts/workspace-archive-operation-result.v1.json +565 -0
  24. package/contracts/workspace-intelligence/agent-customization-pack-report.v1.json +98 -0
  25. package/contracts/workspace-intelligence/agent-hooks.v1.json +38 -0
  26. package/contracts/workspace-intelligence/agent-reports-index.v1.json +56 -0
  27. package/contracts/workspace-intelligence/mcp-design.v1.json +42 -0
  28. package/contracts/workspace-intelligence/workspace-context.v1.json +12 -0
  29. package/contracts/workspace-intelligence/workspace-explain.v1.json +1 -0
  30. package/contracts/workspace-intelligence-architecture.v1.json +723 -0
  31. package/contracts/workspace-intelligence-chain.v1.json +1194 -0
  32. package/contracts/workspace-list.v1.json +56 -0
  33. package/contracts/workspace-model-cache.v1.json +55 -0
  34. package/contracts/workspace-snapshot.v1.json +58 -0
  35. package/contracts/workspace-snapshot.v2.json +97 -0
  36. package/contracts/workspace-sync.v1.json +30 -0
  37. package/contracts/workspace-watch-event.v1.json +112 -0
  38. package/dist/analyze-6OCBM4ID.js +1 -0
  39. package/dist/{artifact-remediation-plan-5GJWPPRS.js → artifact-remediation-plan-Z7OCSME3.js} +3 -3
  40. package/dist/autopilot-release-LI2WJCEW.js +1 -0
  41. package/dist/{chunk-LZQNVH7D.js → chunk-2K3GYCPS.js} +1 -1
  42. package/dist/chunk-2QN6BMM7.js +2 -0
  43. package/dist/chunk-2QOWRBQD.js +1 -0
  44. package/dist/chunk-5AKYMAIL.js +1 -0
  45. package/dist/{chunk-RE773WOX.js → chunk-5PVEQ6CZ.js} +5 -5
  46. package/dist/{chunk-AFSZHLQT.js → chunk-7EIMPQR3.js} +1 -1
  47. package/dist/{chunk-3KXW53QI.js → chunk-7IHLTPZ6.js} +1 -1
  48. package/dist/chunk-7RIWU5TZ.js +1 -0
  49. package/dist/{chunk-T6OR6YOI.js → chunk-7UZVOYF5.js} +1 -1
  50. package/dist/chunk-B66A4TVP.js +1 -0
  51. package/dist/chunk-CL6TGI4Q.js +8 -0
  52. package/dist/chunk-FWJV7CCI.js +2 -0
  53. package/dist/chunk-J4AICQFB.js +1 -0
  54. package/dist/chunk-JICOD2GI.js +1 -0
  55. package/dist/{chunk-OJEWQO3Z.js → chunk-JP25YL3J.js} +17 -17
  56. package/dist/chunk-L2Q7B2OJ.js +1 -0
  57. package/dist/chunk-L3E6IRUQ.js +8 -0
  58. package/dist/chunk-LG6RFLPZ.js +1 -0
  59. package/dist/chunk-LGP6WXS2.js +4 -0
  60. package/dist/{chunk-VRDF2J46.js → chunk-M4VITK6X.js} +52 -50
  61. package/dist/chunk-NTXO7BMH.js +4 -0
  62. package/dist/{chunk-LPZFK3Y6.js → chunk-OW4UNG27.js} +65 -66
  63. package/dist/{chunk-LUP4U6EE.js → chunk-P424XYHP.js} +1 -1
  64. package/dist/chunk-P4SWTY5X.js +33 -0
  65. package/dist/chunk-TQEMLBAG.js +1 -0
  66. package/dist/chunk-TRMDODFM.js +13 -0
  67. package/dist/chunk-UNF72FTB.js +1 -0
  68. package/dist/chunk-V5JN4TDX.js +2 -0
  69. package/dist/chunk-VA5MRHKM.js +2 -0
  70. package/dist/chunk-XIVFLY6G.js +1 -0
  71. package/dist/chunk-YUX4YFGL.js +78 -0
  72. package/dist/{create-WRZO4HK2.js → create-DFAWAS5C.js} +1 -1
  73. package/dist/demo-kit-DZ7TPG7K.js +149 -0
  74. package/dist/doctor-PVSWDBJL.js +1 -0
  75. package/dist/{dotnet-webapi-clean-IPY3MCGQ.js → dotnet-webapi-clean-BYUUHX5Y.js} +20 -20
  76. package/dist/{gofiber-standard-N5N3QGH3.js → gofiber-standard-B6UK5GR7.js} +31 -31
  77. package/dist/{gogin-standard-LAWQTBWL.js → gogin-standard-BXU44VEM.js} +31 -31
  78. package/dist/index.d.ts +250 -24
  79. package/dist/index.js +218 -182
  80. package/dist/pipeline-ND734AJM.js +5 -0
  81. package/dist/{platform-capabilities-XAVU4HSM.js → platform-capabilities-YICBF4FA.js} +1 -1
  82. package/dist/{pythonRapidkitExec-3L3XJBSY.js → pythonRapidkitExec-UJYIB6FL.js} +1 -1
  83. package/dist/{springboot-standard-OZYF7ZM7.js → springboot-standard-PEHDKH2L.js} +27 -27
  84. package/dist/{workspace-PR6VZRBG.js → workspace-FQT3QIRS.js} +1 -1
  85. package/dist/workspace-agent-sync-ZYCPXTU3.js +1 -0
  86. package/dist/workspace-archive-EEGLHZDW.js +10 -0
  87. package/dist/workspace-context-WAGGJCDL.js +1 -0
  88. package/dist/{workspace-contract-XUGMCUSQ.js → workspace-contract-SEI4SNSG.js} +1 -1
  89. package/dist/workspace-explain-MVGGRCDN.js +1 -0
  90. package/dist/workspace-explain-contract-KT757JGQ.js +1 -0
  91. package/dist/{workspace-feedback-R6H4UFZB.js → workspace-feedback-RCB25NFO.js} +1 -1
  92. package/dist/{workspace-foundation-KGSV4E6D.js → workspace-foundation-KXDL6P6X.js} +1 -1
  93. package/dist/{workspace-history-CGCK2DJI.js → workspace-history-M4QQBIPB.js} +1 -1
  94. package/dist/workspace-intelligence-QOGD2TZS.js +1 -0
  95. package/dist/workspace-mcp-serve-CEFKEMYG.js +3 -0
  96. package/dist/{workspace-model-PNXXOGPO.js → workspace-model-GMSRBICO.js} +1 -1
  97. package/dist/workspace-registry-summary-S52SEJAG.js +1 -0
  98. package/dist/workspace-run-VC4OUPRF.js +1 -0
  99. package/dist/{workspace-verify-WSDUUTR5.js → workspace-verify-NP4GMFSV.js} +1 -1
  100. package/dist/workspace-watch-IIBH3Y25.js +1 -0
  101. package/docs/AI_FEATURES.md +67 -34
  102. package/docs/README.md +2 -1
  103. package/docs/commands-reference.md +26 -14
  104. package/docs/contracts/ARTIFACT_CATALOG.md +60 -36
  105. package/docs/contracts/README.md +3 -2
  106. package/docs/create-planner-capabilities.md +36 -18
  107. package/docs/workspace-operations.md +25 -0
  108. package/package.json +35 -13
  109. package/scripts/enterprise-package-smoke.mjs +40 -8
  110. package/scripts/prepack-enterprise.mjs +8 -0
  111. package/templates/kits/fastapi-ddd/.gitignore.j2 +11 -0
  112. package/templates/kits/fastapi-ddd/README.md.j2 +23 -18
  113. package/templates/kits/fastapi-ddd/common/env.example.j2 +2 -2
  114. package/templates/kits/fastapi-ddd/pyproject.toml.j2 +7 -7
  115. package/templates/kits/fastapi-ddd/src/app/config/__init__.py.j2 +1 -1
  116. package/templates/kits/fastapi-ddd/src/cli.py.j2 +6 -9
  117. package/templates/kits/fastapi-ddd/src/main.py.j2 +1 -1
  118. package/templates/kits/fastapi-standard/.gitignore.j2 +11 -0
  119. package/templates/kits/fastapi-standard/README.md.j2 +35 -30
  120. package/templates/kits/fastapi-standard/common/env.example.j2 +2 -2
  121. package/templates/kits/fastapi-standard/pyproject.toml.j2 +7 -7
  122. package/templates/kits/fastapi-standard/src/cli.py.j2 +7 -10
  123. package/templates/kits/fastapi-standard/src/main.py.j2 +1 -1
  124. package/templates/kits/fastapi-standard/src/routing/examples.py.j2 +1 -1
  125. package/templates/kits/fastapi-standard/tests/test_examples.py.j2 +1 -1
  126. package/templates/kits/nestjs-standard/.dockerignore.j2 +11 -0
  127. package/templates/kits/nestjs-standard/.eslintrc.js.j2 +25 -0
  128. package/templates/kits/nestjs-standard/.gitignore.j2 +22 -0
  129. package/templates/kits/nestjs-standard/.node-version.j2 +1 -0
  130. package/templates/kits/nestjs-standard/.nvmrc.j2 +1 -0
  131. package/templates/kits/nestjs-standard/.prettierrc.j2 +7 -0
  132. package/templates/kits/nestjs-standard/README.md.j2 +23 -18
  133. package/templates/kits/nestjs-standard/docs/README.md.j2 +2 -2
  134. package/templates/kits/nestjs-standard/jest.config.ts.j2 +1 -7
  135. package/templates/kits/nestjs-standard/package.json.j2 +1 -1
  136. package/templates/kits/nestjs-standard/src/config/configuration.ts.j2 +4 -4
  137. package/templates/kits/nestjs-standard/src/main.ts.j2 +1 -1
  138. package/templates/kits/nestjs-standard/src/modules/index.ts.j2 +1 -1
  139. package/templates/kits/nestjs-standard/tsconfig.build.json.j2 +1 -1
  140. package/templates/kits/nestjs-standard/tsconfig.json.j2 +1 -1
  141. package/dist/analyze-5BU4QIPK.js +0 -1
  142. package/dist/autopilot-release-QYUOVB26.js +0 -1
  143. package/dist/chunk-54XJNLYC.js +0 -13
  144. package/dist/chunk-5SWNSJGW.js +0 -1
  145. package/dist/chunk-753LOKFZ.js +0 -2
  146. package/dist/chunk-AAKUNWPR.js +0 -78
  147. package/dist/chunk-AQ4XZZC6.js +0 -1
  148. package/dist/chunk-CVTCPPEF.js +0 -1
  149. package/dist/chunk-DNAY5ALC.js +0 -1
  150. package/dist/chunk-EWYYLJQY.js +0 -2
  151. package/dist/chunk-LO4C4VXR.js +0 -4
  152. package/dist/chunk-LYC6AIF2.js +0 -2
  153. package/dist/chunk-NAAQMSO3.js +0 -1
  154. package/dist/chunk-NFUXULIF.js +0 -1
  155. package/dist/chunk-OL64GWQC.js +0 -9
  156. package/dist/chunk-PI5KUXDA.js +0 -7
  157. package/dist/chunk-SI3AQKIP.js +0 -1
  158. package/dist/chunk-VZKSNUEE.js +0 -2
  159. package/dist/chunk-WU4ZRRA5.js +0 -4
  160. package/dist/chunk-XEJD4KCV.js +0 -33
  161. package/dist/demo-kit-AJ5LIM5G.js +0 -149
  162. package/dist/doctor-MF3M3FS3.js +0 -1
  163. package/dist/pipeline-QCUHFWDY.js +0 -5
  164. package/dist/workspace-agent-sync-KTYF3HQR.js +0 -1
  165. package/dist/workspace-archive-GCZNI44O.js +0 -3
  166. package/dist/workspace-context-QUTOP2XV.js +0 -1
  167. package/dist/workspace-explain-JEONEGZZ.js +0 -1
  168. package/dist/workspace-explain-contract-DNS2YEL7.js +0 -1
  169. package/dist/workspace-intelligence-QJGVL37U.js +0 -1
  170. package/dist/workspace-mcp-serve-AK4MYEHQ.js +0 -3
  171. package/dist/workspace-registry-summary-RUJE6RPH.js +0 -1
  172. package/dist/workspace-run-Y7YMUIHX.js +0 -1
  173. package/dist/workspace-watch-AGPOJ74Q.js +0 -1
@@ -1,149 +0,0 @@
1
- import {c}from'./chunk-Y45WZR5N.js';import {promises}from'fs';import a from'path';import L from'nunjucks';import e from'chalk';import h from'ora';import {fileURLToPath}from'url';import {execa}from'execa';import W from'crypto';var N=fileURLToPath(import.meta.url),J=a.dirname(N);function M(t=32){let i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",v=W.randomBytes(t),o="";for(let p=0;p<t;p++)o+=i[v[p]%i.length];return o}async function X(t,i){let o=(i.template||"fastapi")==="fastapi",p=o?"FastAPI":"NestJS",d=i.kit_name||(o?"fastapi.standard":"nestjs.standard"),A=d.replace(".","/"),x=h(`Generating ${p} project...`).start();try{let k=a.resolve(J,".."),m;d==="fastapi.ddd"?m="fastapi-ddd":d.startsWith("fastapi")?m="fastapi-standard":m="nestjs-standard";let w=a.join(k,"templates","kits",m),$=L.configure(w,{autoescape:false,trimBlocks:true,lstripBlocks:true});$.addFilter("generate_secret",function(n,r=32){return M(r)});let D={project_name:i.project_name,author:i.author||"Workspai User",description:i.description||(o?"FastAPI service generated with Workspai":"NestJS application generated with Workspai"),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(),workspai_version:c(),rapidkit_version:c()},y;o?y=["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.j2","rapidkit.cmd.j2"]:y=["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.j2","rapidkit.cmd.j2"];for(let n of y){let r=a.join(w,n);try{await promises.access(r);}catch{continue}let j=await promises.readFile(r,"utf-8"),g;try{g=$.renderString(j,D);}catch(P){throw console.error(`Failed to render template: ${n}`),P}let c=n==="env.example.j2"?".env.example":n.replace(/\.j2$/,""),_=a.join(t,c);await promises.mkdir(a.dirname(_),{recursive:true}),await promises.writeFile(_,g),(c.endsWith(".workspai/rapidkit")||c.endsWith(".workspai/cli.py")||c.endsWith(".workspai/activate")||c.endsWith(".rapidkit/rapidkit")||c.endsWith(".rapidkit/cli.py")||c.endsWith(".rapidkit/activate")||c==="rapidkit")&&await promises.chmod(_,493);}if(o){let n=a.join(w,".rapidkit","context.json"),r=a.join(t,".workspai","context.json");try{await promises.mkdir(a.join(t,".workspai"),{recursive:true}),await promises.copyFile(n,r);}catch{await promises.mkdir(a.join(t,".workspai"),{recursive:true});let g=i.engine||"pip";await promises.writeFile(r,JSON.stringify({engine:g,created_by:"workspai-cli-fallback",legacyCreatedBy:"rapidkit-npm-fallback"},null,2));}}let S=a.join(t,".workspai");await promises.mkdir(S,{recursive:true});let F=a.join(S,"project.json"),E={kit_name:d,profile:A,created_at:new Date().toISOString(),created_by:"workspai-cli-fallback",workspai_version:c(),rapidkit_version:c(),runtime:o?"python":"node"},R=JSON.stringify(E,null,2);await promises.writeFile(F,R,"utf-8");let f=a.join(t,"rapidkit");await promises.access(f).then(()=>true).catch(()=>false)||(await promises.writeFile(f,`#!/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 workspai "$@"
6
- `),await promises.chmod(f,493));let I=a.join(t,"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 workspai %*
9
- `);let C=o?`# 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(a.join(t,".gitignore"),C),x.succeed(`${p} project generated!`),!i.skipGit){let n=h("Initializing git repository...").start();try{await execa("git",["init"],{cwd:t}),await execa("git",["add","."],{cwd:t}),await execa("git",["commit","-m",`Initial commit: ${p} project via Workspai`],{cwd:t}),n.succeed("Git repository initialized");}catch{n.warn("Could not initialize git repository");}}if(!o&&!i.skipInstall){let n=i.package_manager||"npm",r=h(`Installing dependencies with ${n}...`).start();try{await execa(n,n==="yarn"?["install"]:n==="pnpm"?["install"]:["install"],{cwd:t}),r.succeed("Dependencies installed");}catch{r.warn(`Could not install dependencies. Run '${n} install' manually.`);}}let b=a.basename(t);console.log(`
78
- ${e.yellow("\u26A0\uFE0F Limited offline mode:")} This project was created using basic templates.
79
- ${e.gray("For full kit features, install Python 3.10+ and rapidkit-core:")}
80
- ${e.cyan(" sudo apt install python3 python3-pip python3-venv")}
81
- ${e.cyan(" pip install rapidkit-core")}
82
- `),console.log(o?`
83
- ${e.green("\u2728 FastAPI project created successfully!")}
84
-
85
- ${e.bold("\u{1F4C2} Project structure:")}
86
- ${t}/
87
- \u251C\u2500\u2500 .workspai/ # Workspai metadata
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
- ${e.bold("\u{1F680} Get started:")}
98
- ${e.cyan(`cd ${b}`)}
99
- ${e.cyan("npx workspai init")} ${e.gray("# Install dependencies")}
100
- ${e.cyan("npx workspai dev")} ${e.gray("# Start dev server")}
101
-
102
- ${e.bold("\u{1F4DA} Available commands:")}
103
- npx workspai init # Install dependencies (poetry install)
104
- npx workspai dev # Start dev server with hot reload
105
- npx workspai start # Start production server
106
- npx workspai test # Run tests
107
- npx workspai lint # Lint code
108
- npx workspai format # Format code
109
-
110
- ${e.gray("Alternative: make dev, npx workspai dev, poetry run dev")}
111
- ${e.gray("\u{1F4A1} Tip: Install globally (npm i -g workspai) to use without npx")}
112
- `:`
113
- ${e.green("\u2728 NestJS project created successfully!")}
114
-
115
- ${e.bold("\u{1F4C2} Project structure:")}
116
- ${t}/
117
- \u251C\u2500\u2500 .workspai/ # Workspai metadata
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
- ${e.bold("\u{1F680} Get started:")}
128
- ${e.cyan(`cd ${b}`)}
129
- ${e.cyan("npx workspai init")} ${e.gray("# Install dependencies")}
130
- ${e.cyan("cp .env.example .env")}
131
- ${e.cyan("npx workspai dev")} ${e.gray("# Start dev server")}
132
-
133
- ${e.bold("\u{1F4DA} Available commands:")}
134
- npx workspai init # Install dependencies
135
- npx workspai dev # Start dev server with hot reload
136
- npx workspai start # Start production server
137
- npx workspai build # Build for production
138
- npx workspai test # Run tests
139
- npx workspai lint # Lint code
140
- npx workspai format # Format code
141
-
142
- ${e.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
- ${e.gray("Alternative: npm run start:dev, npx workspai dev")}
148
- ${e.gray("\u{1F4A1} Tip: Install globally (npm i -g workspai) to use without npx")}
149
- `);}catch(k){throw x.fail(`Failed to generate ${p} project`),k}}export{X as generateDemoKit};
@@ -1 +0,0 @@
1
- export{b as computeDoctorGateExitCode,a as resolveDoctorPolicyProfile,c as runDoctor}from'./chunk-AAKUNWPR.js';
@@ -1,5 +0,0 @@
1
- import {a as a$2}from'./chunk-OL64GWQC.js';import {c as c$2}from'./chunk-PI5KUXDA.js';import {c}from'./chunk-AAKUNWPR.js';import {b}from'./chunk-VRDF2J46.js';import {a as a$3}from'./chunk-LO4C4VXR.js';import {f,e}from'./chunk-T3GJ7YVG.js';import {a}from'./chunk-22DT744Z.js';import {c as c$1,a as a$1,d}from'./chunk-NAAQMSO3.js';import c$3 from'chalk';import p from'path';function W(s){return s===0?"pass":s===2?"warn":"fail"}function F(s){return s.some(r=>r.status==="fail")?"blocked":s.some(r=>r.status==="warn")?"needs-attention":"ready"}function j(s,r){if(r)return 3;let t=s.some(i=>i.status==="fail"),n=s.some(i=>i.status==="warn");return t?1:n?2:0}async function G(s){let r=await b(s,true),t=false;try{let{syncWorkspaceContract:n}=await import('./workspace-contract-XUGMCUSQ.js');await n({workspacePath:s}),t=true;}catch{t=false;}return {sync:r,contractSynced:t}}async function I(s={}){let r=p.resolve(s.workspacePath??process.cwd()),t=a(r);if(!t)throw new Error("No Workspai workspace found in current directory or parents");let n=[],i=[],l=false,d$1,m,g,f$1=Date.now();try{let{sync:e,contractSynced:a}=await G(t),o=e.workspaceFound&&(e.added.length>0||e.skipped>=0)||e.workspaceFound?"pass":"warn";n.push({name:"sync",status:o,durationMs:Date.now()-f$1,summary:e.workspaceFound?`registry sync complete (${e.added.length} added, ${e.skipped} existing)${a?", contract synced":""}`:"workspace not registered in global registry; contract sync attempted"}),e.workspaceFound||i.push("workspace registry entry missing \u2014 run workspai create workspace or register manually");}catch(e){l=true,n.push({name:"sync",status:"fail",durationMs:Date.now()-f$1,summary:`sync failed: ${e instanceof Error?e.message:String(e)}`}),i.push("workspace sync stage failed");}let y=Date.now();try{let e=await c({workspace:true,json:true,quiet:true,strict:s.strict===true,ci:s.strict!==true}),a=W(e),o=await c$1(t,".workspai/reports/doctor-last-run.json")??a$1(t,".workspai/reports/doctor-last-run.json");n.push({name:"doctor",status:a,durationMs:Date.now()-y,summary:a==="pass"?"doctor workspace passed":a==="warn"?"doctor workspace reported warnings":"doctor workspace did not pass",exitCode:e,evidencePath:o}),a==="fail"?i.push("doctor workspace gate failed"):a==="warn"&&i.push("doctor workspace reported warnings");}catch(e){l=true,n.push({name:"doctor",status:"fail",durationMs:Date.now()-y,summary:`doctor failed: ${e instanceof Error?e.message:String(e)}`}),i.push("doctor workspace stage failed");}if(s.skipAnalyze)n.push({name:"analyze",status:"skipped",durationMs:0,summary:"analyze stage skipped"});else {let e=Date.now();try{let a=await a$2({workspacePath:t,json:true,strict:s.strict===true});d$1=p.isAbsolute(a.enterpriseControls.evidencePath)?a.enterpriseControls.evidencePath:p.join(t,a.enterpriseControls.evidencePath);let o=a.summary.verdict==="blocked"?"fail":a.summary.verdict==="needs-attention"?"warn":"pass";n.push({name:"analyze",status:o,durationMs:Date.now()-e,summary:`analyze verdict: ${a.summary.verdict} (score ${a.summary.score}/100)`,evidencePath:d$1}),o==="fail"?i.push("analyze reported blocked verdict"):o==="warn"&&i.push("analyze reported needs-attention verdict");}catch(a){l=true,n.push({name:"analyze",status:"fail",durationMs:Date.now()-e,summary:`analyze failed: ${a instanceof Error?a.message:String(a)}`}),i.push("analyze stage failed");}}let w=Date.now();try{let e=await a$3({startPath:t,writeReport:true,skipVerify:s.skipVerify===true});m=e.evidencePath;let a=e.overallStatus==="pass"?"pass":e.overallStatus==="warn"?"warn":"fail";n.push({name:"readiness",status:a,durationMs:Date.now()-w,summary:`readiness overall: ${e.overallStatus}`,evidencePath:e.evidencePath}),a==="fail"?i.push(...e.blockingReasons.map(o=>`readiness: ${o}`)):a==="warn"&&i.push(...e.gates.filter(o=>o.status==="warn").map(o=>`readiness warn: ${o.gate}: ${o.summary}`));}catch(e){l=true,n.push({name:"readiness",status:"fail",durationMs:Date.now()-w,summary:`readiness failed: ${e instanceof Error?e.message:String(e)}`}),i.push("readiness stage failed");}if(s.skipAutopilot)n.push({name:"autopilot",status:"skipped",durationMs:0,summary:"autopilot stage skipped"});else {let e=Date.now(),a=s.autopilotMode??"audit";try{let o=await c$2({workspacePath:t,mode:a,json:true,skipPipelineStages:true});g=o.artifacts.reportPath;let k=o.summary.verdict==="approved"?"pass":o.summary.verdict==="partial"?"warn":"fail";n.push({name:"autopilot",status:k,durationMs:Date.now()-e,summary:`autopilot ${a}: ${o.summary.verdict}`,exitCode:o.summary.exitCode,evidencePath:g}),k!=="pass"&&i.push(...o.blockingReasons.slice(0,5));}catch(o){l=true,n.push({name:"autopilot",status:"fail",durationMs:Date.now()-e,summary:`autopilot failed: ${o instanceof Error?o.message:String(o)}`}),i.push("autopilot release stage failed");}}let z=F(n),h=j(n,l),M=p.join(t,".workspai","reports","pipeline-last-run.json"),u={schemaVersion:"rapidkit-pipeline-v1",generatedAt:new Date().toISOString(),workspacePath:t,summary:{verdict:z,exitCode:h,stagesPassed:n.filter(e=>e.status==="pass").length,stagesWarn:n.filter(e=>e.status==="warn").length,stagesFailed:n.filter(e=>e.status==="fail").length},stages:n,blockingReasons:[...new Set(i)],artifacts:{reportPath:M,analyzeEvidencePath:d$1,readinessEvidencePath:m,autopilotEvidencePath:g}};if(s.writeReport!==false){let e$1=f(u,{commandId:"workspacePipeline",exitCode:h,generatedAt:u.generatedAt,blockers:u.blockingReasons,runId:e()});await d(t,".workspai/reports/pipeline-last-run.json",e$1);}if(s.writeReport!==false&&s.noAgentSync!==true&&process.env.RAPIDKIT_NO_AGENT_SYNC!=="1"&&s.agentSync!==false)try{let{syncWorkspaceAgentGrounding:e}=await import('./workspace-agent-sync-KTYF3HQR.js'),a=await e({workspacePath:t,write:true,refreshContext:true,strict:false});u.agentGrounding={indexPath:a.indexPath,writtenFiles:a.writtenFiles,blockers:a.blockers};}catch{}return u}async function H(s){let r;try{r=await I(s);}catch(t){let n=t instanceof Error?t.message:String(t);s.json?console.log(JSON.stringify({schemaVersion:"rapidkit-pipeline-error-v1",ok:false,error:{message:n}},null,2)):console.log(c$3.red(`Pipeline failed: ${n}`)),process.exit(1);}if(s.json)console.log(JSON.stringify(r,null,2));else {console.log(c$3.bold.cyan(`
2
- \u{1F517} Workspai Governance Pipeline
3
- `)),console.log(c$3.bold(`Workspace: ${c$3.cyan(p.basename(r.workspacePath))}`)),console.log(c$3.gray(`Path: ${r.workspacePath}`)),console.log(c$3.white(`Verdict: ${r.summary.verdict} Exit: ${r.summary.exitCode} (${r.summary.stagesPassed} pass / ${r.summary.stagesWarn} warn / ${r.summary.stagesFailed} fail)`));for(let t of r.stages){let n=t.status==="pass"?c$3.green("PASS"):t.status==="warn"?c$3.yellow("WARN"):t.status==="skipped"?c$3.gray("SKIP"):c$3.red("FAIL");console.log(` - ${t.name}: ${n} ${t.summary}`);}if(r.blockingReasons.length>0){console.log(c$3.bold(`
4
- Blocking reasons:`));for(let t of r.blockingReasons.slice(0,8))console.log(c$3.gray(` \u2022 ${t}`));}console.log(c$3.gray(`
5
- Evidence: ${r.artifacts.reportPath}`)),r.agentGrounding?.writtenFiles.length&&console.log(c$3.gray(`Agent grounding: ${r.agentGrounding.writtenFiles.length} file(s) synced (INDEX + AGENTS.md + Copilot/Cursor/Claude hooks)`));}r.summary.exitCode!==0&&process.exit(r.summary.exitCode);}export{I as runPipeline,H as runPipelineCommand};
@@ -1 +0,0 @@
1
- export{f as AGENT_CUSTOMIZATION_PACK_REPORT_PATH,d as AGENT_CUSTOMIZATION_PACK_SCHEMA,e as AGENT_REPORTS_INDEX_PATH,c as AGENT_REPORTS_INDEX_SCHEMA,g as AGENT_REPORT_CATALOG,h as buildWorkspaceAgentReportsIndex,i as parseAgentGroundingTargets,j as syncWorkspaceAgentGrounding}from'./chunk-XEJD4KCV.js';export{f as AGENT_GROUNDING_DOC_PATH,g as LEGACY_AGENT_GROUNDING_DOC_PATH,A as LEGACY_COPILOT_GROUNDING_SKILL_PATH,m as LEGACY_COPILOT_WORKSPACE_INSTRUCTIONS_PATH,C as LEGACY_COPILOT_WORKSPACE_INTELLIGENCE_SKILL_PATH,i as LEGACY_CURSOR_GROUNDING_RULE_PATH,E as LEGACY_MCP_DESIGN_REPORT_PATH,G as LEGACY_VSCODE_AGENT_HOOKS_PATH,z as WORKSPAI_COPILOT_GROUNDING_SKILL_PATH,l as WORKSPAI_COPILOT_WORKSPACE_INSTRUCTIONS_PATH,B as WORKSPAI_COPILOT_WORKSPACE_INTELLIGENCE_SKILL_PATH,h as WORKSPAI_CURSOR_GROUNDING_RULE_PATH,D as WORKSPAI_MCP_DESIGN_REPORT_PATH,F as WORKSPAI_VSCODE_AGENT_HOOKS_PATH}from'./chunk-DNAY5ALC.js';
@@ -1,3 +0,0 @@
1
- import {f,o,l as l$1,r}from'./chunk-5XATWNME.js';import M from'crypto';import H from'os';import l from'path';import T from'zlib';import u from'fs-extra';var y=".workspai/archive-manifest.json",k=".rapidkit/archive-manifest.json",R="workspai.workspace.archive",Z=new Set(["__pycache__",".venv","venv","node_modules",".git","dist","build","target",".pytest_cache",".mypy_cache",".ruff_cache","htmlcov",".next",".turbo",".cache"]),j=new Set([".DS_Store","Thumbs.db",".coverage","npm-debug.log","yarn-error.log","pnpm-debug.log"]),V=[/^\.env$/i,/^\.env\.(?!example$|sample$|template$).+/i,/^.*\.pem$/i,/^.*\.key$/i,/^id_rsa$/i,/^id_ed25519$/i];function A(e){return e.replace(/\\/g,"/")}function $(e){return e.replace(/\.workspai-archive\.zip$/i,"").replace(/\.rapidkit-archive\.zip$/i,"").replace(/\.zip$/i,"").trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/-+/g,"-").replace(/^[-_.]+|[-_.]+$/g,"").slice(0,64)||"imported-workspace"}function q(e){let r=A(e).trim();if(!r||r.startsWith("/")||r.startsWith("~")||/^[a-zA-Z]:\//.test(r)||r.includes("\0"))return false;let t=r.split("/").filter(Boolean);return t.length>0&&!t.some(a=>a===".."||a===".")}function S(e){if(!q(e))throw new Error(`Archive contains an unsafe path: ${e}`)}function K(e,r){let t=l.relative(r,e);return t===""||!!t&&!t.startsWith("..")&&!l.isAbsolute(t)}function J(e,r){let a=A(e).split("/").filter(Boolean);if((a[0]===".workspai"||a[0]===".rapidkit")&&["cache","reports"].includes(a[1]||"")||a.some(n=>Z.has(n)))return true;let i=a[a.length-1]||"";return j.has(i)||!r?.includeEnv&&V.some(n=>n.test(i))?true:i.endsWith(".pyc")||i.endsWith(".log")}function U(e){return M.createHash("sha256").update(e).digest("hex")}var G=new Uint32Array(256).map((e,r)=>{let t=r;for(let a=0;a<8;a+=1)t=t&1?3988292384^t>>>1:t>>>1;return t>>>0});function N(e){let r=4294967295;for(let t of e)r=G[(r^t)&255]^r>>>8;return (r^4294967295)>>>0}function h(e){let r=Buffer.allocUnsafe(2);return r.writeUInt16LE(e,0),r}function p(e){let r=Buffer.allocUnsafe(4);return r.writeUInt32LE(e>>>0,0),r}function X(e){let r=Math.max(e.getFullYear(),1980),t=e.getHours()<<11|e.getMinutes()<<5|Math.floor(e.getSeconds()/2),a=r-1980<<9|e.getMonth()+1<<5|e.getDate();return {time:t,date:a}}async function _(e,r,t,a){let i=await u.readdir(r,{withFileTypes:true});for(let n of i){let s=l.join(r,n.name),o=A(l.relative(e,s));if(!(!o||J(o,a))){if(n.isDirectory()){await _(e,s,t,a);continue}n.isFile()&&t.push({relativePath:o,fullPath:s});}}}async function Y(e){for(let r of o(e,"workspace.json"))try{let t=await u.readJson(r);if(typeof t.workspace_name=="string"&&t.workspace_name.trim())return t.workspace_name.trim();if(typeof t.name=="string"&&t.name.trim())return t.name.trim()}catch{}return l.basename(l.resolve(e))}async function Q(e,r,t){let a=[];await _(e,e,a,t);let i=[];for(let s of a.sort((o,m)=>o.relativePath.localeCompare(m.relativePath))){let o=await u.readFile(s.fullPath);if(o.length>=4294967295)throw new Error(`File is too large for portable workspace archive: ${s.relativePath}`);r.files.push({path:s.relativePath,size:o.length,sha256:U(o)}),i.push({name:s.relativePath,data:o,crc32:N(o),size:o.length,offset:0});}let n=Buffer.from(`${JSON.stringify(r,null,2)}
2
- `,"utf-8");return i.push({name:y,data:n,crc32:N(n),size:n.length,offset:0}),i}function ee(e,r=new Date){let t=[],a=[],i=0,n=X(r);for(let f of e){let d=Buffer.from(f.name,"utf-8");f.offset=i;let w=Buffer.concat([p(67324752),h(20),h(2048),h(0),h(n.time),h(n.date),p(f.crc32),p(f.size),p(f.size),h(d.length),h(0),d]);t.push(w,f.data),i+=w.length+f.data.length;}let s=i;for(let f of e){let d=Buffer.from(f.name,"utf-8"),w=Buffer.concat([p(33639248),h(20),h(20),h(2048),h(0),h(n.time),h(n.date),p(f.crc32),p(f.size),p(f.size),h(d.length),h(0),h(0),h(0),h(0),p(0),p(f.offset),d]);a.push(w),i+=w.length;}let o=i-s,m=Buffer.concat([p(101010256),h(0),h(0),h(e.length),h(e.length),p(o),p(s),h(0)]);return Buffer.concat([...t,...a,m])}async function ge(e){let r=l.resolve(e.workspacePath);if(!f(r))throw new Error("Workspace export requires a Workspai workspace root with .workspai-workspace or a legacy .rapidkit-workspace marker.");let t=await Y(r),a=l.resolve(e.outputPath||`${$(t)}.workspai-archive.zip`),i={version:1,kind:R,workspaceName:t,exportedAt:(e.now??new Date).toISOString(),exportedBy:"workspai",archiveFormat:"zip-store",security:{envFilesIncluded:e.includeEnv===true,excludedByDefault:[".git","node_modules",".venv","dist","build","target",".env","*.pem","*.key","*.log"]},files:[]},n=await Q(r,i,{includeEnv:e.includeEnv===true}),s=ee(n,e.now??new Date);return await u.ensureDir(l.dirname(a)),await u.writeFile(a,s),{archivePath:a,manifest:i,bytesWritten:s.length}}function te(e){let r=Math.max(0,e.length-65535-22);for(let t=e.length-22;t>=r;t-=1)if(e.readUInt32LE(t)===101010256)return t;throw new Error("Invalid ZIP archive: end of central directory not found.")}function re(e){let r=te(e),t=e.readUInt16LE(r+10),a=e.readUInt32LE(r+16),i=[],n=a;for(let s=0;s<t;s+=1){if(e.readUInt32LE(n)!==33639248)throw new Error("Invalid ZIP archive: central directory is corrupted.");let o=e.readUInt16LE(n+10);if(o!==0&&o!==8)throw new Error("Unsupported ZIP archive: only stored/deflated entries are supported by Workspai.");let m=e.readUInt32LE(n+20),f=e.readUInt32LE(n+24),d=e.readUInt16LE(n+28),w=e.readUInt16LE(n+30),c=e.readUInt16LE(n+32),v=e.readUInt32LE(n+42),g=e.subarray(n+46,n+46+d).toString("utf-8");S(g);let O=g.endsWith("/");if(e.readUInt32LE(v)!==67324752)throw new Error(`Invalid ZIP archive: local header missing for ${g}.`);let F=e.readUInt16LE(v+26),L=e.readUInt16LE(v+28),W=v+30+F+L,E=e.subarray(W,W+m);if(E.length!==m)throw new Error(`Invalid ZIP archive: size mismatch for ${g}.`);if(O){if(m!==0||f!==0)throw new Error(`Invalid ZIP archive: directory entry contains data for ${g}.`);n+=46+d+w+c;continue}let z=o===8?T.inflateRawSync(E):E;if(z.length!==f)throw new Error(`Invalid ZIP archive: inflated size mismatch for ${g}.`);i.push({name:g,data:z,size:f}),n+=46+d+w+c;}return i}async function ae(e){if(/^https?:\/\//i.test(e)){let r=await fetch(e);if(!r.ok)throw new Error(`Failed to download workspace archive: HTTP ${r.status}`);let t=Buffer.from(await r.arrayBuffer()),a=await u.mkdtemp(l.join(H.tmpdir(),"workspai-workspace-archive-")),i=l.join(a,"workspace.workspai-archive.zip");return await u.writeFile(i,t),{archivePath:i,cleanup:a}}return {archivePath:l.resolve(e)}}function ie(e){let r=e.find(a=>a.name===y||a.name===k);if(!r)return null;let t=JSON.parse(r.data.toString("utf-8"));if(t.kind!==R)throw new Error("Archive manifest kind is not a RapidKit/Workspai workspace archive.");return t}function ne(e){return r(A(e))}function se(e){let r=new Map;for(let t of e){if(t.name===y||t.name===k)continue;let a=ne(t.name),i=r.get(a);if(!i){r.set(a,{sourceName:t.name,targetName:a,data:t.data,size:t.size});continue}let n=t.name===a,s=i.sourceName===i.targetName;if(n&&!s){r.set(a,{sourceName:t.name,targetName:a,data:t.data,size:t.size});continue}if(!i.data.equals(t.data)&&!s)throw new Error(`Workspace archive contains conflicting entries for ${a}: ${i.sourceName}, ${t.name}`)}return [...r.values()].sort((t,a)=>t.targetName.localeCompare(a.targetName))}async function P(e){let r=await ae(e);try{let t=await u.readFile(r.archivePath),a=re(t),i=ie(a);if(!i)throw new Error(`Workspace archive is missing ${l$1("","archive-manifest.json").replace(/^\//,"")}.`);return {archivePath:r.archivePath,entries:a,manifest:i,cleanup:r.cleanup}}catch(t){throw r.cleanup&&await u.remove(r.cleanup).catch(()=>{}),t}}async function x(e){e.cleanup&&await u.remove(e.cleanup).catch(()=>{});}async function oe(e){let r=await P(e.archivePathOrUrl);try{let t=new Map(r.entries.filter(i=>i.name!==y&&i.name!==k).map(i=>[i.name,i])),a=r.manifest.files.map(i=>({path:i.path,size:t.get(i.path)?.size??i.size,hasChecksum:typeof i.sha256=="string"&&i.sha256.length>0}));return {archivePath:r.archivePath,manifest:r.manifest,fileCount:a.length,totalBytes:a.reduce((i,n)=>i+n.size,0),entries:a}}finally{await x(r);}}async function D(e){let r=await P(e.archivePathOrUrl);try{let t=new Map(r.entries.filter(c=>c.name!==y&&c.name!==k).map(c=>[c.name,c])),a=new Set(r.manifest.files.map(c=>c.path)),i=[...t.keys()].filter(c=>!a.has(c)).sort(),n=[],s=[],o=[],m=0;for(let c of r.manifest.files){S(c.path);let v=t.get(c.path);if(!v){n.push(c.path);continue}let g={size:v.size,sha256:U(v.data)};if(v.size!==c.size){o.push({path:c.path,expected:{size:c.size,sha256:c.sha256},actual:g});continue}if(!c.sha256){s.push(c.path);continue}if(g.sha256!==c.sha256){o.push({path:c.path,expected:{size:c.size,sha256:c.sha256},actual:g});continue}m+=1;}let f=e.requireChecksums===true&&s.length>0,d=n.length>0||o.length>0||f||i.length>0,w=s.length>0;return {archivePath:r.archivePath,manifest:r.manifest,status:d?"failed":w?"warning":"passed",fileCount:r.manifest.files.length,totalBytes:r.manifest.files.reduce((c,v)=>c+v.size,0),verifiedFiles:m,missingChecksumFiles:s,missingArchiveEntries:n,extraArchiveEntries:i,mismatches:o}}finally{await x(r);}}async function we(e){let r=await oe({archivePathOrUrl:e.archivePathOrUrl}),t=await D({archivePathOrUrl:e.archivePathOrUrl,requireChecksums:e.strict===true}),a=[],i=[];a.push({id:"manifest-present",status:"passed",message:`Archive manifest found for workspace "${r.manifest.workspaceName}".`}),a.push({id:"integrity",status:t.status,message:t.status==="passed"?`Verified ${t.verifiedFiles}/${t.fileCount} files.`:"Archive integrity verification did not fully pass."});let n=r.manifest.security?.envFilesIncluded===true;a.push({id:"secrets-policy",status:n?"warning":"passed",message:n?"Archive manifest says environment/private files were intentionally included.":"Archive manifest excludes environment/private files by default."}),n&&i.push("Share this archive only through trusted internal channels."),t.missingChecksumFiles.length>0&&i.push("Re-export the archive with the latest RapidKit/Workspai tooling."),t.mismatches.length>0&&i.push("Reject this archive and request a fresh export from the owner."),(t.extraArchiveEntries.length>0||t.missingArchiveEntries.length>0)&&i.push("Regenerate the archive so ZIP entries and manifest entries match."),e.strict===true&&t.status!=="passed"&&i.push("Do not hydrate this archive in strict or production workflows.");let s=a.some(m=>m.status==="failed"),o=a.some(m=>m.status==="warning");return {archivePath:r.archivePath,status:s?"failed":o?"warning":"passed",workspaceName:r.manifest.workspaceName,fileCount:r.fileCount,totalBytes:r.totalBytes,checks:a,recommendedActions:i}}async function ce(e,r,t){if(!await u.pathExists(e)){t||await u.ensureDir(e);return}if((await u.readdir(e)).length>0&&!r)throw new Error(`Output directory is not empty: ${e}. Use --force to overwrite.`);t||await u.emptyDir(e);}async function ye(e){let r=await P(e.archivePathOrUrl);try{let t=await D({archivePathOrUrl:r.archivePath,requireChecksums:e.strict===true});if(t.status==="failed"){let s=[t.missingArchiveEntries.length?`missing entries: ${t.missingArchiveEntries.join(", ")}`:"",t.extraArchiveEntries.length?`unexpected entries: ${t.extraArchiveEntries.join(", ")}`:"",t.mismatches.length?`checksum/size mismatches: ${t.mismatches.map(o=>o.path).join(", ")}`:"",t.missingChecksumFiles.length&&e.strict===true?`missing checksums: ${t.missingChecksumFiles.join(", ")}`:""].filter(Boolean).join("; ");throw new Error(`Workspace archive verification failed${s?` (${s})`:""}.`)}if(t.status==="warning"&&e.strict===true)throw new Error(`Workspace archive verification requires checksums for every file: ${t.missingChecksumFiles.join(", ")}`);let a=se(r.entries),i=r.manifest,n=l.resolve(e.outputPath||$(i.workspaceName||"imported-workspace"));await ce(n,e.force===true,e.dryRun===true);for(let s of a){let o=l.resolve(n,s.targetName);if(!K(o,n))throw new Error(`Archive entry escapes output directory: ${s.targetName}`);e.dryRun||(await u.ensureDir(l.dirname(o)),await u.writeFile(o,s.data));}return {archivePath:r.archivePath,outputPath:n,dryRun:e.dryRun===true,manifest:i,files:a.map(s=>({path:s.targetName,size:s.size}))}}finally{await x(r);}}
3
- export{R as WORKSPACE_ARCHIVE_KIND,y as WORKSPACE_ARCHIVE_MANIFEST_PATH,we as doctorWorkspaceArchive,ge as exportWorkspaceArchive,ye as hydrateWorkspaceArchive,oe as inspectWorkspaceArchive,q as isSafeArchiveEntryName,$ as sanitizeWorkspaceArchiveName,J as shouldExcludeWorkspaceArchivePath,D as verifyWorkspaceArchive};
@@ -1 +0,0 @@
1
- export{b as WORKSPACE_CONTEXT_AGENT_REPORT_PATH,a as WORKSPACE_CONTEXT_SCHEMA_VERSION,c as buildWorkspaceAgentContext,d as writeWorkspaceAgentContext}from'./chunk-EWYYLJQY.js';
@@ -1 +0,0 @@
1
- export{b as buildWorkspaceExplain,a as resolveWorkspaceExplainArtifactPath,c as writeWorkspaceExplainReport}from'./chunk-54XJNLYC.js';export{d as WORKSPACE_MODEL_DIFF_REPORT_PATH}from'./chunk-LYC6AIF2.js';export{c as WORKSPACE_EXPLAIN_REPORT_PATH,e as WORKSPACE_TRACE_REPORT_PATH,d as WORKSPACE_WHY_REPORT_PATH}from'./chunk-DNAY5ALC.js';
@@ -1 +0,0 @@
1
- export{a as WORKSPACE_EXPLAIN_SCHEMA_VERSION,b as WORKSPACE_EXPLAIN_TARGETS,e as isWorkspaceExplainReport,c as parseWorkspaceExplainTarget,d as resolveWorkspaceTraceTarget}from'./chunk-AQ4XZZC6.js';export{c as WORKSPACE_EXPLAIN_REPORT_PATH,e as WORKSPACE_TRACE_REPORT_PATH,d as WORKSPACE_WHY_REPORT_PATH}from'./chunk-DNAY5ALC.js';
@@ -1 +0,0 @@
1
- export{f as WORKSPACE_IMPACT_REPORT_PATH,e as WORKSPACE_IMPACT_SCHEMA_VERSION,d as WORKSPACE_MODEL_DIFF_REPORT_PATH,b as WORKSPACE_MODEL_DIFF_SCHEMA_VERSION,c as WORKSPACE_MODEL_SNAPSHOT_REPORT_PATH,a as WORKSPACE_MODEL_SNAPSHOT_SCHEMA_VERSION,n as buildWorkspaceImpact,i as buildWorkspaceModelSnapshot,k as diffWorkspaceModel,g as isGitDiffSource,h as parseGitDiffRef,m as workspaceVerificationPlan,o as writeWorkspaceImpact,l as writeWorkspaceModelDiff,j as writeWorkspaceModelSnapshot}from'./chunk-LYC6AIF2.js';
@@ -1,3 +0,0 @@
1
- import {b}from'./chunk-54XJNLYC.js';import {b as b$1}from'./chunk-EWYYLJQY.js';import {d}from'./chunk-CVTCPPEF.js';import {c,e}from'./chunk-AQ4XZZC6.js';import {c as c$2,b as b$2}from'./chunk-DNAY5ALC.js';import {k}from'./chunk-5SWNSJGW.js';import {c as c$3}from'./chunk-VZKSNUEE.js';import {c as c$1}from'./chunk-NAAQMSO3.js';import u from'path';import P from'readline';import v from'fs-extra';var h=".workspai/reports/INDEX.json";function O(t,e){return t.kind!==e.kind?false:t.kind==="project"&&e.kind==="project"?t.project.toLowerCase()===e.project.toLowerCase():t.kind==="blocker"&&e.kind==="blocker"?t.blockerId===e.blockerId:t.kind==="trace"&&e.kind==="trace"?t.diffRef===e.diffRef:true}var C=[{name:"getWorkspaceModel",description:"Read workspace-model.json",inputSchema:{type:"object",properties:{}}},{name:"getEvidenceIndex",description:"Read agent reports INDEX.json",inputSchema:{type:"object",properties:{}}},{name:"getBlockers",description:"Aggregate blocking reasons from verify, explain, and contract-verify reports",inputSchema:{type:"object",properties:{}}},{name:"getSafeCommands",description:"Read safe commands from workspace-context-agent.json",inputSchema:{type:"object",properties:{}}},{name:"getProjectContext",description:"Read scoped project context from workspace-context-agent.json",inputSchema:{type:"object",properties:{project:{type:"string",description:"Optional project name; defaults to active scope"}}}},{name:"getArtifact",description:"Read one workspace-relative artifact path",inputSchema:{type:"object",properties:{relativePath:{type:"string"}},required:["relativePath"]}},{name:"listOperationalSkills",description:"Read workspace-skills-index.json",inputSchema:{type:"object",properties:{}}},{name:"getWorkspaceExplain",description:"Build or read workspace explain report",inputSchema:{type:"object",properties:{target:{type:"string",description:"release-blocked | project:<name> | blocker:<id> | trace:<diffRef> | <project>"}}}}];function _(t){let e=t.trim().replace(/\\/g,"/");return e.length>0&&!u.isAbsolute(e)&&!e.split("/").includes("..")&&(e.startsWith(".workspai/")||e.startsWith(".rapidkit/"))}async function l(t,e){if(!_(e))throw new Error(`Unsafe artifact path: ${e}`);let i=await c$1(t,e)??u.join(t,e);return await v.pathExists(i)?v.readJson(i):null}async function W(t){let e$1=[],i=new Set,s=((await l(t,d))?.blockingReasons??[]).filter(n=>typeof n=="string"&&n.trim().length>0);if(s.length>0){e$1.push({artifact:d,reasons:s});for(let n of s)i.add(n);}let a=await l(t,c$2);if(e(a)){let n=(a.blockingReasons??[]).filter(r=>typeof r=="string"&&r.trim().length>0);if(n.length>0){e$1.push({artifact:c$2,reasons:n});for(let r of n)i.add(r);}}let c=await l(t,c$3),p=(c?.violations??[]).filter(n=>typeof n=="string"&&n.trim().length>0);if(p.length>0||String(c?.status??"").toLowerCase()==="failed"){let n=p.length>0?p:["Workspace contract verification failed"];e$1.push({artifact:c$3,reasons:n});for(let r of n)i.add(r);}return {blockingReasons:[...i],sources:e$1}}async function A(t,e$1,i){switch(e$1){case "getWorkspaceModel":return l(t,k);case "getEvidenceIndex":return l(t,h);case "getBlockers":return W(t);case "getSafeCommands":return {safeCommands:(await l(t,b$1))?.safeCommands??[]};case "getProjectContext":{let o=await l(t,b$1);if(!o)return null;let s=String(i.project??"").trim(),a=o.scope?.activeProject??void 0,c=s||a,p=Array.isArray(o.projects)?o.projects:[],n=c&&p.find(r=>typeof r.name=="string"&&r.name.toLowerCase()===c.toLowerCase());return {workspace:o.workspace??null,scope:o.scope??null,validation:o.validation??null,project:n??null,safeCommands:o.safeCommands??[]}}case "getArtifact":{let o=String(i.relativePath??"").trim();return l(t,o)}case "listOperationalSkills":return l(t,b$2);case "getWorkspaceExplain":{let o=String(i.target??"release-blocked").trim(),s=c(o);if(!s)throw new Error(`Invalid explain target: ${o}`);let a=await l(t,c$2);return e(a)&&O(a.target,s)?a:b({workspacePath:t,target:s})}default:throw new Error(`Unknown tool: ${e$1}`)}}function R(t,e){process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:t??null,result:e})}
2
- `);}function w(t,e){process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:t??null,error:{code:-32e3,message:e}})}
3
- `);}async function z(t){let e=u.resolve(t.workspacePath),i=P.createInterface({input:process.stdin,terminal:false});for await(let o of i){let s=o.trim();if(!s)continue;let a;try{a=JSON.parse(s);}catch{w(null,"Invalid JSON-RPC request");continue}let{id:c,method:p,params:n}=a;try{if(p==="initialize"){R(c,{protocolVersion:"2024-11-05",capabilities:{tools:{}},serverInfo:{name:"workspai-workspace-mcp",version:"0.1.0"}});continue}if(p==="notifications/initialized")continue;if(p==="tools/list"){R(c,{tools:C.map(r=>({name:r.name,description:r.description,inputSchema:r.inputSchema}))});continue}if(p==="tools/call"){let r=String(n?.name??""),T=n?.arguments&&typeof n.arguments=="object"?n.arguments:{},E=await A(e,r,T);R(c,{content:[{type:"text",text:JSON.stringify(E,null,2)}],isError:E==null});continue}w(c,`Unsupported method: ${p??"unknown"}`);}catch(r){w(c,r instanceof Error?r.message:String(r));}}}async function U(t,e,i={}){return A(u.resolve(t),e,i)}export{C as WORKSPACE_MCP_READ_TOOLS,U as invokeMcpToolForTest,z as runWorkspaceMcpServe};
@@ -1 +0,0 @@
1
- import {a}from'./chunk-A5FBGRJA.js';import {b,j}from'./chunk-VZKSNUEE.js';import {c,d as d$1}from'./chunk-NAAQMSO3.js';import {p,r}from'./chunk-LZQNVH7D.js';import {o}from'./chunk-5XATWNME.js';import n from'path';import c$1 from'fs-extra';var k=".workspai/workspace-registry.v1.json",w="workspace-registry.v1";function d(r){return {slug:r.slug,relativePath:r.relativePath,framework:r.framework,kit:r.kit,source:r.source}}async function C(r){let t=o(r,"workspace.json").find(e=>c$1.pathExistsSync(e));if(!t)return {exists:false,legacyProjectCount:0};try{let e=await c$1.readJson(t),o=Array.isArray(e.projects)?e.projects.length:0,s=typeof e.workspace_name=="string"&&e.workspace_name.trim()||typeof e.name=="string"&&e.name.trim()||n.basename(r);return {exists:true,manifestPath:t,workspaceName:s,profile:typeof e.profile=="string"?e.profile:void 0,legacyProjectCount:o}}catch{return {exists:true,manifestPath:t,legacyProjectCount:0,workspaceName:n.basename(r)}}}async function A(r$1){let t=a(r$1);for(let e of r())if(await c$1.pathExists(e))try{let s=((await c$1.readJson(e)).workspaces||[]).find(a$1=>a(a$1.path)===t);if(s)return Array.isArray(s.projects)?s.projects.length:0}catch{continue}return 0}async function x(r){let t=n.resolve(r),e=await c(t,b),o=await C(t),s=await A(t),a=!!e,i=[];if(a)try{let{contract:S}=await j({workspacePath:t});i=S.projects||[];}catch{i=[];}let W={contract:{exists:a,projectCount:i.length,path:b},globalRegistry:{exists:s>0,projectCount:s,path:n.join(p(),"workspaces.json")},legacyWorkspaceJson:{exists:o.exists,projectCount:o.legacyProjectCount,path:o.manifestPath?n.relative(t,o.manifestPath):void 0}},p$1="none",m=[],g=0;return a?(p$1="workspace.contract.json",m=i.map(d),g=m.length):s>0?(p$1="global-registry",g=s):o.legacyProjectCount>0&&(p$1="legacy-workspace.json",g=o.legacyProjectCount),{contractExists:a,summary:{schemaVersion:w,kind:"rapidkit.workspace.registry",workspacePath:t,workspaceName:o.workspaceName||n.basename(t),profile:o.profile,projectCount:g,authority:p$1,contractPath:b,projects:m,sources:W}}}async function $(r){let t=await c(r,k);if(!t)return null;try{let e=await c$1.readJson(t);return e?.schemaVersion!==w?null:e}catch{return null}}async function G(r,t){let o={...(await x(r)).summary,generatedAt:(t?.now??new Date).toISOString(),registrySummaryPath:k};return await d$1(r,k,o),o}function J(r,t=""){return r.projectCount>0?r.authority==="workspace.contract.json"?`${r.projectCount} project(s) registered in workspace contract${t}.`:r.authority==="global-registry"?`${r.projectCount} project(s) registered in global workspace registry${t}.`:`${r.projectCount} project(s) registered in legacy workspace manifest${t}.`:`Workspace state exists, but no projects are registered yet${t}.`}export{k as WORKSPACE_REGISTRY_SUMMARY_RELATIVE_PATH,w as WORKSPACE_REGISTRY_SUMMARY_SCHEMA_VERSION,J as formatWorkspaceRegistrySyncSummary,G as publishWorkspaceRegistrySummary,$ as readWorkspaceRegistrySummary,x as resolveWorkspaceRegisteredProjects};
@@ -1 +0,0 @@
1
- export{a as runWorkspaceStage}from'./chunk-WU4ZRRA5.js';export{a as WORKSPACE_RUN_LAST_REPORT_FILENAME}from'./chunk-753LOKFZ.js';
@@ -1 +0,0 @@
1
- import {a}from'./chunk-3KXW53QI.js';import {b as b$1,p}from'./chunk-5SWNSJGW.js';import w from'fs';var M="workspace-watch-event.v1";function g(t){return `${t.from}\0${t.to}\0${t.kind}`}function f(t){return (t.graph?.edges??[]).map(r=>({from:r.from,to:r.to,kind:r.kind}))}function m(t){let o=[...a(t).entries()].sort((a,n)=>a[0].localeCompare(n[0])).map(([a,n])=>({id:a,hash:n})),c=f(t).map(g).sort((a,n)=>a.localeCompare(n));return b$1({projects:o,edges:c})}function b(t,r){let o=a(r),c=t?a(t):new Map,a$1=[],n=[];for(let[e,s]of o.entries())c.has(e)?c.get(e)!==s&&a$1.push(e):n.push(e);let d=[];for(let e of c.keys())o.has(e)||d.push(e);let i=new Map(t?f(t).map(e=>[g(e),e]):[]),l=new Map(f(r).map(e=>[g(e),e])),p=[];for(let[e,s]of l.entries())i.has(e)||p.push(s);let h=[];for(let[e,s]of i.entries())l.has(e)||h.push(s);let u=(e,s)=>g(e).localeCompare(g(s));return a$1.sort((e,s)=>e.localeCompare(s)),n.sort((e,s)=>e.localeCompare(s)),d.sort((e,s)=>e.localeCompare(s)),p.sort(u),h.sort(u),{changedProjects:a$1,addedProjects:n,removedProjects:d,edgesAdded:p,edgesRemoved:h}}var k=class{model=null;sequence=0;rebuild;now;constructor(r,o){this.rebuild=o?.rebuild??(()=>p({...r})),this.now=o?.now??(()=>new Date);}get currentModel(){return this.model}async start(){let r=Date.now(),{model:o}=await this.rebuild();return this.model=o,this.buildEvent("ready","initial",null,o,Date.now()-r)}async pulse(){let r=Date.now(),o=this.model,{model:c,mode:a}=await this.rebuild(),n=this.buildEvent(this.hasStructuralChange(o,c)?"changed":"unchanged",a,o,c,Date.now()-r);return this.model=c,n}hasStructuralChange(r,o){return r?m(r)!==m(o):true}buildEvent(r,o,c,a,n){let d=b(c,a),i=m(a),l=c?m(c)!==i:true;return {schemaVersion:M,kind:r,sequence:this.sequence++,timestamp:this.now().toISOString(),mode:o,modelHash:i,modelHashChanged:l,changedProjects:d.changedProjects,addedProjects:d.addedProjects,removedProjects:d.removedProjects,graph:{nodeCount:a.graph?.nodes.length??0,edgeCount:a.graph?.edges.length??0,edgesAdded:d.edgesAdded,edgesRemoved:d.edgesRemoved},durationMs:n}}},P=new Set([".git",".hg",".svn","node_modules",".venv","venv","dist","build","out","target","coverage","htmlcov",".next",".turbo",".cache"]),R=new Set(["reports","cache","tmp",".cache"]);function y(t){if(!t)return false;let r=t.split(/[\\/]/).filter(Boolean);if(r.some(o=>P.has(o)))return false;for(let o=0;o<r.length-1;o+=1)if((r[o]===".workspai"||r[o]===".rapidkit")&&R.has(r[o+1]))return false;return true}async function G(t){let r=new k(t.buildOptions,t.engineOptions),o=await r.start();if(t.emit(o),t.once)return;let c=t.debounceMs??250,a=t.selfWriteSuppressionMs??Math.max(400,c+150),n=null,d=false,i=false,l=0,p=async()=>{if(d){i=true;return}d=true;try{let e=await r.pulse();t.emit(e);}catch(e){t.emit({schemaVersion:M,kind:"error",sequence:-1,timestamp:new Date().toISOString(),mode:"full",modelHash:r.currentModel?m(r.currentModel):"",modelHashChanged:false,changedProjects:[],addedProjects:[],removedProjects:[],graph:{nodeCount:0,edgeCount:0,edgesAdded:[],edgesRemoved:[]},durationMs:0,error:e instanceof Error?e.message:String(e)});}finally{d=false,l=Date.now()+a,i&&(i=false,p());}},h=e=>{y(e)&&(d||Date.now()<l||(n&&clearTimeout(n),n=setTimeout(()=>{n=null,p();},c)));};t.onProgress?.(`Watching ${t.workspacePath} for changes (Ctrl+C to stop).`);let u=w.watch(t.workspacePath,{recursive:true},(e,s)=>{typeof s=="string"?h(s):s&&h(Buffer.from(s).toString("utf8"));});await new Promise(e=>{let s=()=>{n&&clearTimeout(n),u.close(),e();};if(t.signal){if(t.signal.aborted){s();return}t.signal.addEventListener("abort",s,{once:true});}u.on("error",()=>s());});}export{M as WORKSPACE_WATCH_EVENT_SCHEMA_VERSION,k as WorkspaceWatchEngine,m as computeWatchModelHash,b as diffWatchModels,y as isWatchRelevantPath,G as runWorkspaceWatch};