workspai 0.43.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.
- package/LICENSE +21 -0
- package/README.md +624 -0
- package/contracts/agent-customization-pack.v1.json +229 -0
- package/contracts/analyze-last-run.v1.json +106 -0
- package/contracts/artifact-remediation-plan.v1.json +163 -0
- package/contracts/backend-import-stack-parity.snapshot.json +37 -0
- package/contracts/cli-log-event.v1.json +51 -0
- package/contracts/create-planner-capabilities.v1.json +251 -0
- package/contracts/doctor-project-evidence.v1.json +304 -0
- package/contracts/doctor-remediation-plan.v1.json +496 -0
- package/contracts/doctor-workspace-evidence.v1.json +315 -0
- package/contracts/extension-cli-compatibility.v1.json +26 -0
- package/contracts/infra-stack.v1.json +305 -0
- package/contracts/module-layout.v1.json +34 -0
- package/contracts/module-support.v1.json +20 -0
- package/contracts/pipeline-last-run.v1.json +80 -0
- package/contracts/release-readiness.v1.json +60 -0
- package/contracts/runtime-command-surface.v1.json +364 -0
- package/contracts/workspace-intelligence/agent-action-outcome.v1.json +38 -0
- package/contracts/workspace-intelligence/blocker-resolution.v1.json +65 -0
- package/contracts/workspace-intelligence/doctor-fix-result.v1.json +44 -0
- package/contracts/workspace-intelligence/fact-freshness.v1.json +58 -0
- package/contracts/workspace-intelligence/studio-blocker-handoff.v1.json +115 -0
- package/contracts/workspace-intelligence/workspace-context.v1.json +142 -0
- package/contracts/workspace-intelligence/workspace-contract-verify.v1.json +51 -0
- package/contracts/workspace-intelligence/workspace-dependency-graph.v1.json +152 -0
- package/contracts/workspace-intelligence/workspace-explain.v1.json +31 -0
- package/contracts/workspace-intelligence/workspace-impact.v1.json +114 -0
- package/contracts/workspace-intelligence/workspace-intelligence-history.v1.json +40 -0
- package/contracts/workspace-intelligence/workspace-model-diff.v1.json +105 -0
- package/contracts/workspace-intelligence/workspace-model-snapshot.v1.json +36 -0
- package/contracts/workspace-intelligence/workspace-model.v1.json +135 -0
- package/contracts/workspace-intelligence/workspace-operational-skill.v1.json +37 -0
- package/contracts/workspace-intelligence/workspace-skills-index.v1.json +27 -0
- package/contracts/workspace-intelligence/workspace-verify.v1.json +213 -0
- package/contracts/workspace-registry.v1.json +83 -0
- package/contracts/workspace-run-last.v1.json +112 -0
- package/data/modules-embeddings.json +16953 -0
- package/dist/analyze-5BU4QIPK.js +1 -0
- package/dist/artifact-remediation-plan-5GJWPPRS.js +3 -0
- package/dist/autopilot-release-QYUOVB26.js +1 -0
- package/dist/chunk-22DT744Z.js +1 -0
- package/dist/chunk-2E6WGUN6.js +1 -0
- package/dist/chunk-2FIX2MDC.js +1 -0
- package/dist/chunk-3KXW53QI.js +1 -0
- package/dist/chunk-3ZK2GU7C.js +1 -0
- package/dist/chunk-4KUIFXHM.js +5 -0
- package/dist/chunk-54XJNLYC.js +13 -0
- package/dist/chunk-5SWNSJGW.js +1 -0
- package/dist/chunk-5XATWNME.js +1 -0
- package/dist/chunk-753LOKFZ.js +2 -0
- package/dist/chunk-7YHK5NM3.js +2 -0
- package/dist/chunk-A5FBGRJA.js +1 -0
- package/dist/chunk-AAKUNWPR.js +78 -0
- package/dist/chunk-AFSZHLQT.js +1 -0
- package/dist/chunk-AQ4XZZC6.js +1 -0
- package/dist/chunk-CVTCPPEF.js +1 -0
- package/dist/chunk-DNAY5ALC.js +1 -0
- package/dist/chunk-EWYYLJQY.js +2 -0
- package/dist/chunk-GSWPGELT.js +2 -0
- package/dist/chunk-GZTYAEWX.js +1 -0
- package/dist/chunk-HTYMXMQM.js +1 -0
- package/dist/chunk-IBJEQHJR.js +205 -0
- package/dist/chunk-ICGWHIMK.js +1 -0
- package/dist/chunk-JEI6BTZI.js +3 -0
- package/dist/chunk-JHC6SCJC.js +1 -0
- package/dist/chunk-LO4C4VXR.js +4 -0
- package/dist/chunk-LPZFK3Y6.js +920 -0
- package/dist/chunk-LUP4U6EE.js +1 -0
- package/dist/chunk-LYC6AIF2.js +2 -0
- package/dist/chunk-LZQNVH7D.js +1 -0
- package/dist/chunk-NAAQMSO3.js +1 -0
- package/dist/chunk-NFUXULIF.js +1 -0
- package/dist/chunk-OCGZNSOE.js +1 -0
- package/dist/chunk-OJEWQO3Z.js +33 -0
- package/dist/chunk-OL64GWQC.js +9 -0
- package/dist/chunk-PI5KUXDA.js +7 -0
- package/dist/chunk-PYCJWW4B.js +1 -0
- package/dist/chunk-RE773WOX.js +13 -0
- package/dist/chunk-RO73VVHW.js +2 -0
- package/dist/chunk-S5KTATOU.js +1 -0
- package/dist/chunk-SI3AQKIP.js +1 -0
- package/dist/chunk-T3GJ7YVG.js +1 -0
- package/dist/chunk-T6OR6YOI.js +2 -0
- package/dist/chunk-VRDF2J46.js +653 -0
- package/dist/chunk-VZKSNUEE.js +2 -0
- package/dist/chunk-WU4ZRRA5.js +4 -0
- package/dist/chunk-XEJD4KCV.js +33 -0
- package/dist/chunk-XZGVNGRB.js +1 -0
- package/dist/chunk-Y45WZR5N.js +5 -0
- package/dist/create-WRZO4HK2.js +1 -0
- package/dist/demo-kit-AJ5LIM5G.js +149 -0
- package/dist/doctor-MF3M3FS3.js +1 -0
- package/dist/dotnet-webapi-clean-IPY3MCGQ.js +425 -0
- package/dist/gofiber-standard-N5N3QGH3.js +1397 -0
- package/dist/gogin-standard-LAWQTBWL.js +1459 -0
- package/dist/imported-projects-registry-FOIE27WT.js +1 -0
- package/dist/index.d.ts +141 -0
- package/dist/index.js +454 -0
- package/dist/managed-agent-markers-AXUM75OE.js +8 -0
- package/dist/module-layout-NZ43RSC5.js +1 -0
- package/dist/pipeline-QCUHFWDY.js +5 -0
- package/dist/platform-capabilities-XAVU4HSM.js +1 -0
- package/dist/pythonRapidkitExec-3L3XJBSY.js +1 -0
- package/dist/springboot-standard-OZYF7ZM7.js +697 -0
- package/dist/workspace-PR6VZRBG.js +1 -0
- package/dist/workspace-agent-sync-KTYF3HQR.js +1 -0
- package/dist/workspace-archive-GCZNI44O.js +3 -0
- package/dist/workspace-context-QUTOP2XV.js +1 -0
- package/dist/workspace-contract-XUGMCUSQ.js +1 -0
- package/dist/workspace-explain-JEONEGZZ.js +1 -0
- package/dist/workspace-explain-contract-DNS2YEL7.js +1 -0
- package/dist/workspace-feedback-R6H4UFZB.js +1 -0
- package/dist/workspace-foundation-KGSV4E6D.js +1 -0
- package/dist/workspace-graph-2A5THUCI.js +1 -0
- package/dist/workspace-history-CGCK2DJI.js +1 -0
- package/dist/workspace-intelligence-QJGVL37U.js +1 -0
- package/dist/workspace-marker-SMBC3Z2Q.js +1 -0
- package/dist/workspace-mcp-serve-AK4MYEHQ.js +3 -0
- package/dist/workspace-model-PNXXOGPO.js +1 -0
- package/dist/workspace-python-engine-state-MTWIIZPY.js +2 -0
- package/dist/workspace-registry-summary-RUJE6RPH.js +1 -0
- package/dist/workspace-run-Y7YMUIHX.js +1 -0
- package/dist/workspace-verify-WSDUUTR5.js +1 -0
- package/dist/workspace-watch-AGPOJ74Q.js +1 -0
- package/docs/AI_DYNAMIC_INTEGRATION.md +440 -0
- package/docs/AI_EXAMPLES.md +419 -0
- package/docs/AI_FEATURES.md +460 -0
- package/docs/AI_QUICKSTART.md +245 -0
- package/docs/DEVELOPMENT.md +90 -0
- package/docs/From Code to Shared Understanding.png +0 -0
- package/docs/OPEN_SOURCE_USER_SCENARIOS.md +170 -0
- package/docs/OPTIMIZATION_GUIDE.md +504 -0
- package/docs/PACKAGE_MANAGER_POLICY.md +25 -0
- package/docs/README.md +125 -0
- package/docs/SECURITY.md +63 -0
- package/docs/SETUP.md +107 -0
- package/docs/UTILITIES.md +221 -0
- package/docs/WORKSPACE_MARKER_SPEC.md +276 -0
- package/docs/ci-workflows.md +59 -0
- package/docs/commands-reference.md +172 -0
- package/docs/config-file-guide.md +299 -0
- package/docs/contracts/ARTIFACT_CATALOG.md +333 -0
- package/docs/contracts/CLI_LOG_EVENT_STREAM.md +123 -0
- package/docs/contracts/COMMAND_OWNERSHIP_MATRIX.md +138 -0
- package/docs/contracts/NAMING_AND_COEXISTENCE.md +60 -0
- package/docs/contracts/README.md +86 -0
- package/docs/contracts/RUNTIME_ACCEPTANCE_MATRIX.md +98 -0
- package/docs/contracts/RUNTIME_SUPPORT_MATRIX.md +75 -0
- package/docs/contracts/rapidkit-cli-contracts.json +239 -0
- package/docs/create-planner-capabilities.md +81 -0
- package/docs/doctor-command.md +467 -0
- package/docs/examples/ci-agent-grounding.yml +65 -0
- package/docs/from-code-to-shared-understanding.md +45 -0
- package/docs/governance-policy.enterprise.example.json +40 -0
- package/docs/mirror-config.enterprise.example.json +60 -0
- package/docs/policies.workspace.example.yml +23 -0
- package/docs/workspace-operations.md +160 -0
- package/docs/workspace-run.md +104 -0
- package/package.json +179 -0
- package/rapidkit.config.example.cjs +62 -0
- package/scripts/check-agent-customization-drift.mjs +78 -0
- package/scripts/check-cli-resolution.cjs +72 -0
- package/scripts/enforce-package-manager.cjs +10 -0
- package/scripts/enterprise-package-smoke.mjs +463 -0
- package/scripts/prepack-enterprise.mjs +43 -0
- package/templates/generator.js +179 -0
- package/templates/kits/fastapi-ddd/README.md.j2 +117 -0
- package/templates/kits/fastapi-ddd/common/env.example.j2 +10 -0
- package/templates/kits/fastapi-ddd/env.example.j2 +1 -0
- package/templates/kits/fastapi-ddd/pyproject.toml.j2 +64 -0
- package/templates/kits/fastapi-ddd/src/__init__.py.j2 +3 -0
- package/templates/kits/fastapi-ddd/src/app/__init__.py.j2 +11 -0
- package/templates/kits/fastapi-ddd/src/app/application/__init__.py.j2 +5 -0
- package/templates/kits/fastapi-ddd/src/app/application/interfaces.py.j2 +43 -0
- package/templates/kits/fastapi-ddd/src/app/application/use_cases/__init__.py.j2 +6 -0
- package/templates/kits/fastapi-ddd/src/app/application/use_cases/health.py.j2 +14 -0
- package/templates/kits/fastapi-ddd/src/app/application/use_cases/notes.py.j2 +24 -0
- package/templates/kits/fastapi-ddd/src/app/config/__init__.py.j2 +16 -0
- package/templates/kits/fastapi-ddd/src/app/domain/__init__.py.j2 +3 -0
- package/templates/kits/fastapi-ddd/src/app/domain/models/__init__.py.j2 +6 -0
- package/templates/kits/fastapi-ddd/src/app/domain/models/health.py.j2 +16 -0
- package/templates/kits/fastapi-ddd/src/app/domain/models/note.py.j2 +27 -0
- package/templates/kits/fastapi-ddd/src/app/infrastructure/__init__.py.j2 +5 -0
- package/templates/kits/fastapi-ddd/src/app/infrastructure/repositories/__init__.py.j2 +6 -0
- package/templates/kits/fastapi-ddd/src/app/infrastructure/repositories/health.py.j2 +17 -0
- package/templates/kits/fastapi-ddd/src/app/infrastructure/repositories/notes.py.j2 +28 -0
- package/templates/kits/fastapi-ddd/src/app/main.py.j2 +61 -0
- package/templates/kits/fastapi-ddd/src/app/presentation/__init__.py.j2 +3 -0
- package/templates/kits/fastapi-ddd/src/app/presentation/api/__init__.py.j2 +5 -0
- package/templates/kits/fastapi-ddd/src/app/presentation/api/dependencies/__init__.py.j2 +19 -0
- package/templates/kits/fastapi-ddd/src/app/presentation/api/router.py.j2 +10 -0
- package/templates/kits/fastapi-ddd/src/app/presentation/api/routes/__init__.py.j2 +5 -0
- package/templates/kits/fastapi-ddd/src/app/presentation/api/routes/health.py.j2 +27 -0
- package/templates/kits/fastapi-ddd/src/app/presentation/api/routes/notes.py.j2 +50 -0
- package/templates/kits/fastapi-ddd/src/app/shared/__init__.py.j2 +5 -0
- package/templates/kits/fastapi-ddd/src/app/shared/result.py.j2 +28 -0
- package/templates/kits/fastapi-ddd/src/cli.py.j2 +170 -0
- package/templates/kits/fastapi-ddd/src/main.py.j2 +35 -0
- package/templates/kits/fastapi-ddd/src/modules/__init__.py.j2 +3 -0
- package/templates/kits/fastapi-ddd/src/routing/__init__.py.j2 +13 -0
- package/templates/kits/fastapi-ddd/src/routing/health.py.j2 +7 -0
- package/templates/kits/fastapi-ddd/src/routing/notes.py.j2 +7 -0
- package/templates/kits/fastapi-ddd/tests/__init__.py.j2 +1 -0
- package/templates/kits/fastapi-ddd/tests/test_app_factory.py.j2 +22 -0
- package/templates/kits/fastapi-ddd/tests/test_health.py.j2 +17 -0
- package/templates/kits/fastapi-ddd/tests/test_notes.py.j2 +27 -0
- package/templates/kits/fastapi-standard/README.md.j2 +140 -0
- package/templates/kits/fastapi-standard/common/env.example.j2 +10 -0
- package/templates/kits/fastapi-standard/env.example.j2 +1 -0
- package/templates/kits/fastapi-standard/pyproject.toml.j2 +64 -0
- package/templates/kits/fastapi-standard/src/__init__.py.j2 +3 -0
- package/templates/kits/fastapi-standard/src/cli.py.j2 +171 -0
- package/templates/kits/fastapi-standard/src/main.py.j2 +66 -0
- package/templates/kits/fastapi-standard/src/modules/__init__.py.j2 +3 -0
- package/templates/kits/fastapi-standard/src/routing/__init__.py.j2 +16 -0
- package/templates/kits/fastapi-standard/src/routing/examples.py.j2 +71 -0
- package/templates/kits/fastapi-standard/src/routing/health.py.j2 +22 -0
- package/templates/kits/fastapi-standard/tests/__init__.py.j2 +1 -0
- package/templates/kits/fastapi-standard/tests/test_examples.py.j2 +29 -0
- package/templates/kits/fastapi-standard/tests/test_health.py.j2 +17 -0
- package/templates/kits/nestjs-standard/Dockerfile.j2 +41 -0
- package/templates/kits/nestjs-standard/README.md.j2 +134 -0
- package/templates/kits/nestjs-standard/docker-compose.yml.j2 +94 -0
- package/templates/kits/nestjs-standard/docs/README.md.j2 +15 -0
- package/templates/kits/nestjs-standard/env.example.j2 +18 -0
- package/templates/kits/nestjs-standard/eslint.config.cjs.j2 +9 -0
- package/templates/kits/nestjs-standard/jest.config.ts.j2 +28 -0
- package/templates/kits/nestjs-standard/nest-cli.json.j2 +10 -0
- package/templates/kits/nestjs-standard/package.json.j2 +101 -0
- package/templates/kits/nestjs-standard/src/app.controller.ts.j2 +14 -0
- package/templates/kits/nestjs-standard/src/app.module.ts.j2 +26 -0
- package/templates/kits/nestjs-standard/src/app.service.ts.j2 +16 -0
- package/templates/kits/nestjs-standard/src/auth/auth.controller.ts.j2 +20 -0
- package/templates/kits/nestjs-standard/src/auth/auth.module.ts.j2 +13 -0
- package/templates/kits/nestjs-standard/src/auth/auth.service.ts.j2 +6 -0
- package/templates/kits/nestjs-standard/src/auth/entities/token.entity.ts.j2 +3 -0
- package/templates/kits/nestjs-standard/src/auth/entities/user.entity.ts.j2 +3 -0
- package/templates/kits/nestjs-standard/src/auth/entities/webauthn.entity.ts.j2 +3 -0
- package/templates/kits/nestjs-standard/src/config/configuration.ts.j2 +85 -0
- package/templates/kits/nestjs-standard/src/config/index.ts.j2 +2 -0
- package/templates/kits/nestjs-standard/src/config/validation.ts.j2 +21 -0
- package/templates/kits/nestjs-standard/src/examples/dto/create-note.dto.ts.j2 +11 -0
- package/templates/kits/nestjs-standard/src/examples/examples.controller.ts.j2 +24 -0
- package/templates/kits/nestjs-standard/src/examples/examples.module.ts.j2 +10 -0
- package/templates/kits/nestjs-standard/src/examples/examples.service.ts.j2 +33 -0
- package/templates/kits/nestjs-standard/src/main.ts.j2 +53 -0
- package/templates/kits/nestjs-standard/src/modules/index.ts.j2 +25 -0
- package/templates/kits/nestjs-standard/test/app.controller.spec.ts.j2 +24 -0
- package/templates/kits/nestjs-standard/test/app.e2e-spec.ts.j2 +60 -0
- package/templates/kits/nestjs-standard/test/examples.controller.spec.ts.j2 +28 -0
- package/templates/kits/nestjs-standard/test/jest-e2e.json.j2 +15 -0
- package/templates/kits/nestjs-standard/tsconfig.build.json.j2 +12 -0
- package/templates/kits/nestjs-standard/tsconfig.json.j2 +26 -0
- package/workspai.config.example.cjs +62 -0
|
@@ -0,0 +1,653 @@
|
|
|
1
|
+
import {c as c$1}from'./chunk-NFUXULIF.js';import {a}from'./chunk-A5FBGRJA.js';import {a as a$2}from'./chunk-GZTYAEWX.js';import {c}from'./chunk-Y45WZR5N.js';import {p,r}from'./chunk-LZQNVH7D.js';import {p as p$1,o}from'./chunk-5XATWNME.js';import {promises}from'fs';import n from'path';import a$1 from'chalk';import N from'ora';import {execa}from'execa';function M(e){let r=a(e.path),t=Array.isArray(e.projects)?e.projects:[],i=[],o=new Set;for(let l of t){if(!l||typeof l.name!="string"||typeof l.path!="string")continue;let c=a(l.path);o.has(c)||(o.add(c),i.push({name:l.name,path:c}));}return {name:e.name,path:r,mode:e.mode,projects:i}}function z(e){let r=[],t=new Set;for(let i of e.workspaces||[]){if(!i||typeof i.name!="string"||typeof i.path!="string")continue;let o=M(i);t.has(o.path)||(t.add(o.path),r.push(o));}return {workspaces:r}}async function J(e){try{let r=await promises.readFile(e,"utf8"),t=JSON.parse(r);if(t&&Array.isArray(t.workspaces))return z(t)}catch{}return {workspaces:[]}}async function L(){let e={workspaces:[]},r$1=new Set;for(let t of r()){let i=await J(t);for(let o of i.workspaces)r$1.has(o.path)||(r$1.add(o.path),e.workspaces.push(o));}return e}async function Y(e,r){try{let t=a(e),i=p(),o=n.join(i,"workspaces.json");await promises.mkdir(i,{recursive:true});let l={name:r,path:t,mode:"full",projects:[]};for(let c=0;c<3;c+=1){let s=await L();if(s.workspaces.some(u=>u.path===t)||(s.workspaces.push(l),await promises.writeFile(o,JSON.stringify(s,null,2)),(await J(o)).workspaces.some(u=>u.path===t)))return}console.warn(a$1.gray("Note: Could not register workspace in shared registry"));}catch{console.warn(a$1.gray("Note: Could not register workspace in shared registry"));}}async function ke(e,r=false){let t=a(e),i={workspacePath:t,workspaceFound:false,added:[],skipped:0};try{let o=p(),l=n.join(o,"workspaces.json"),c=await L();if(c.workspaces.length===0)return r||console.log("\u26A0\uFE0F Workspace registry not found"),i;let s=c.workspaces.find(f=>f.path===t);if(!s)return r||console.log("\u26A0\uFE0F Workspace not registered in registry"),i;Array.isArray(s.projects)||(s.projects=[]);let p$2=0,u=0,k=[],m=[e],$=new Set;for(;m.length>0;){let f=m.shift();if(!f||$.has(f))continue;$.add(f);let w=await promises.readdir(f,{withFileTypes:true});for(let y of w){if(!y.isDirectory()||y.name.startsWith(".")||["node_modules","dist","build","target","coverage","htmlcov"].includes(y.name))continue;let b=n.join(f,y.name),g=a(b);try{let h=false;for(let j of [...p$1(g,"context.json"),...p$1(g,"project.json")])try{await promises.access(j),h=true;break}catch{}if(h){let j=n.basename(g);s.projects.some(C=>C.path===g||C.name===j)?u++:(s.projects.push({name:j,path:g}),p$2++,k.push(g),r||console.log(`\u2714 Added: ${n.relative(e,g)}`));continue}}catch{}m.push(b);}}return p$2>0?(await promises.writeFile(l,JSON.stringify(c,null,2)),r||console.log(`
|
|
2
|
+
\u2705 Synced ${p$2} project(s) to registry`)):r||console.log(`
|
|
3
|
+
\u2705 All projects already registered (${u} found)`),{workspacePath:t,workspaceFound:true,added:k,skipped:u}}catch(o){return r||console.error("\u274C Failed to sync projects:",o.message),i}}async function fe(e,r,t){try{let i=a(e),o=a(t),l=p(),c=n.join(l,"workspaces.json"),s=await L();if(s.workspaces.length===0)return;let p$1=s.workspaces.find(m=>m.path===i);if(!p$1)return;Array.isArray(p$1.projects)||(p$1.projects=[]);let u=p$1.projects.findIndex(m=>m.path===o||m.name===r),k={name:r,path:o};if(u>=0){let m=p$1.projects[u];(m.name!==k.name||m.path!==k.path)&&(p$1.projects[u]=k,await promises.writeFile(c,JSON.stringify(s,null,2)));}else p$1.projects.push({name:r,path:o}),await promises.writeFile(c,JSON.stringify(s,null,2));}catch{}}async function we(e,r){let t=N("Creating Workspai workspace...").start();try{await promises.mkdir(e,{recursive:true}),await promises.mkdir(n.join(e,".workspai"),{recursive:true});let i={workspace_name:r.name,author:r.author,rapidkit_version:c(),created_at:new Date().toISOString(),type:"workspace"};await promises.writeFile(n.join(e,".workspai","config.json"),JSON.stringify(i,null,2));let{syncWorkspaceFoundationFiles:o}=await import('./create-WRZO4HK2.js');await o(e,{workspaceName:r.name,installMethod:"venv",writeMarker:true,writeGitignore:false,onlyIfMissing:true});let{publishWorkspaceRegistrySummary:l}=await import('./workspace-registry-summary-RUJE6RPH.js');await l(e);let c$1=H();await promises.writeFile(n.join(e,"rapidkit"),c$1),await promises.chmod(n.join(e,"rapidkit"),493);let s=q();await promises.writeFile(n.join(e,"rapidkit.cmd"),s);let p=K(r.name);if(await promises.writeFile(n.join(e,"README.md"),p),await promises.writeFile(n.join(e,".gitignore"),`# Workspai workspace
|
|
4
|
+
.env
|
|
5
|
+
.env.*
|
|
6
|
+
!.env.example
|
|
7
|
+
|
|
8
|
+
# OS
|
|
9
|
+
.DS_Store
|
|
10
|
+
Thumbs.db
|
|
11
|
+
|
|
12
|
+
# IDEs
|
|
13
|
+
.vscode/
|
|
14
|
+
.idea/
|
|
15
|
+
|
|
16
|
+
# Logs
|
|
17
|
+
*.log
|
|
18
|
+
`),await promises.writeFile(n.join(e,".workspai-workspace"),JSON.stringify({signature:"WORKSPAI_WORKSPACE",createdBy:"workspai-cli",version:c(),createdAt:new Date().toISOString(),name:r.name},null,2)),await Q(e),t.succeed("Workspace created!"),!r.skipGit){let k=N("Initializing git repository...").start();try{await execa("git",["init"],{cwd:e}),await execa("git",["add","."],{cwd:e}),await execa("git",["commit","-m","Initial commit: Workspai workspace"],{cwd:e}),k.succeed("Git repository initialized");}catch{k.warn("Could not initialize git repository");}}await Y(e,r.name),console.log(`
|
|
19
|
+
${a$1.green("\u2728 Workspai workspace created successfully!")}
|
|
20
|
+
|
|
21
|
+
${a$1.bold("\u{1F4C2} Workspace structure:")}
|
|
22
|
+
${e}/
|
|
23
|
+
\u251C\u2500\u2500 rapidkit # Local CLI wrapper
|
|
24
|
+
\u251C\u2500\u2500 rapidkit.cmd # Windows local CLI wrapper
|
|
25
|
+
\u251C\u2500\u2500 .workspai/ # Workspace configuration
|
|
26
|
+
\u2502 \u251C\u2500\u2500 workspace.json # Workspace manifest
|
|
27
|
+
\u2502 \u251C\u2500\u2500 toolchain.lock # Runtime pinning
|
|
28
|
+
\u2502 \u251C\u2500\u2500 policies.yml # Enforcement policy
|
|
29
|
+
\u2502 \u251C\u2500\u2500 cache-config.yml# Cache policy
|
|
30
|
+
\u2502 \u2514\u2500\u2500 config.json # Workspai workspace config
|
|
31
|
+
\u2514\u2500\u2500 README.md
|
|
32
|
+
|
|
33
|
+
${a$1.bold("\u{1F680} Get started:")}
|
|
34
|
+
${a$1.cyan(`cd ${r.name}`)}
|
|
35
|
+
${a$1.cyan("npx workspai create project fastapi.standard my-api --yes")}
|
|
36
|
+
${a$1.cyan("cd my-api")}
|
|
37
|
+
${a$1.cyan("npx workspai init")}
|
|
38
|
+
${a$1.cyan("npx workspai dev")}
|
|
39
|
+
|
|
40
|
+
${a$1.bold("\u{1F4E6} Available templates:")}
|
|
41
|
+
fastapi - FastAPI + Python
|
|
42
|
+
nestjs - NestJS + TypeScript
|
|
43
|
+
springboot - Spring Boot + Java
|
|
44
|
+
gofiber - Go Fiber
|
|
45
|
+
gogin - Go Gin
|
|
46
|
+
|
|
47
|
+
${a$1.bold("\u{1F4DA} Commands:")}
|
|
48
|
+
npx workspai create project <kit> <name> Create a new project
|
|
49
|
+
npx workspai init Install dependencies
|
|
50
|
+
npx workspai dev Start dev server
|
|
51
|
+
npx workspai help Show all commands
|
|
52
|
+
|
|
53
|
+
${a$1.gray("Alternative: npx workspai dev, make dev")}
|
|
54
|
+
${a$1.gray("\u{1F4A1} Tip: Install globally (npm i -g workspai) to use without npx")}
|
|
55
|
+
`);}catch(i){throw t.fail("Failed to create workspace"),i}}function H(){return `#!/usr/bin/env bash
|
|
56
|
+
#
|
|
57
|
+
# Workspai CLI - local workspace commands
|
|
58
|
+
# This script provides legacy ./rapidkit commands within the workspace
|
|
59
|
+
#
|
|
60
|
+
|
|
61
|
+
set -e
|
|
62
|
+
|
|
63
|
+
# Find workspace root (where this script lives)
|
|
64
|
+
SCRIPT_DIR="$(cd "$(dirname "\${BASH_SOURCE[0]}")" && pwd)"
|
|
65
|
+
|
|
66
|
+
# Check if we're in a project directory (modern metadata first, legacy fallback)
|
|
67
|
+
find_project_root() {
|
|
68
|
+
local dir="$PWD"
|
|
69
|
+
while [[ "$dir" != "/" ]]; do
|
|
70
|
+
if [[ -f "$dir/.workspai/project.json" || -f "$dir/.rapidkit/project.json" ]]; then
|
|
71
|
+
echo "$dir"
|
|
72
|
+
return 0
|
|
73
|
+
fi
|
|
74
|
+
dir="$(dirname "$dir")"
|
|
75
|
+
done
|
|
76
|
+
return 1
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
# Check if we're in a workspace (modern marker first, legacy config fallback)
|
|
80
|
+
find_workspace_root() {
|
|
81
|
+
local dir="$PWD"
|
|
82
|
+
while [[ "$dir" != "/" ]]; do
|
|
83
|
+
if [[ -f "$dir/.workspai-workspace" || -f "$dir/.rapidkit-workspace" ]]; then
|
|
84
|
+
echo "$dir"
|
|
85
|
+
return 0
|
|
86
|
+
fi
|
|
87
|
+
if [[ -f "$dir/.workspai/config.json" ]]; then
|
|
88
|
+
if grep -q '"type": "workspace"' "$dir/.workspai/config.json" 2>/dev/null; then
|
|
89
|
+
echo "$dir"
|
|
90
|
+
return 0
|
|
91
|
+
fi
|
|
92
|
+
fi
|
|
93
|
+
if [[ -f "$dir/.rapidkit/config.json" ]]; then
|
|
94
|
+
if grep -q '"type": "workspace"' "$dir/.rapidkit/config.json" 2>/dev/null; then
|
|
95
|
+
echo "$dir"
|
|
96
|
+
return 0
|
|
97
|
+
fi
|
|
98
|
+
fi
|
|
99
|
+
dir="$(dirname "$dir")"
|
|
100
|
+
done
|
|
101
|
+
return 1
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
# Colors
|
|
105
|
+
RED='\\033[0;31m'
|
|
106
|
+
GREEN='\\033[0;32m'
|
|
107
|
+
YELLOW='\\033[0;33m'
|
|
108
|
+
BLUE='\\033[0;34m'
|
|
109
|
+
CYAN='\\033[0;36m'
|
|
110
|
+
NC='\\033[0m' # No Color
|
|
111
|
+
BOLD='\\033[1m'
|
|
112
|
+
|
|
113
|
+
print_banner() {
|
|
114
|
+
echo -e "\${BLUE}\${BOLD}\u{1F680} Workspai CLI\${NC}"
|
|
115
|
+
echo ""
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
print_help() {
|
|
119
|
+
print_banner
|
|
120
|
+
echo -e "\${BOLD}Usage:\${NC} rapidkit <command> [options]"
|
|
121
|
+
echo ""
|
|
122
|
+
echo -e "\${BOLD}\u{1F3D7}\uFE0F Workspace Commands:\${NC}"
|
|
123
|
+
echo " create <name> Create a new project from template"
|
|
124
|
+
echo " create --help Show create command options"
|
|
125
|
+
echo ""
|
|
126
|
+
echo -e "\${BOLD}\u{1F680} Project Commands\${NC} (run inside a project):"
|
|
127
|
+
echo " init Install project dependencies"
|
|
128
|
+
echo " dev Start development server"
|
|
129
|
+
echo " start Start production server"
|
|
130
|
+
echo " build Build for production"
|
|
131
|
+
echo " test Run tests"
|
|
132
|
+
echo " lint Run linting"
|
|
133
|
+
echo " format Format code"
|
|
134
|
+
echo ""
|
|
135
|
+
echo -e "\${BOLD}\u{1F4DA} Other Commands:\${NC}"
|
|
136
|
+
echo " help Show this help message"
|
|
137
|
+
echo " version Show version"
|
|
138
|
+
echo ""
|
|
139
|
+
echo -e "\${BOLD}Examples:\${NC}"
|
|
140
|
+
echo -e " \${CYAN}workspai create project fastapi.standard my-api --yes\${NC}"
|
|
141
|
+
echo -e " \${CYAN}workspai create project nestjs.standard my-app --yes\${NC}"
|
|
142
|
+
echo -e " \${CYAN}cd my-api && workspai dev\${NC}"
|
|
143
|
+
echo ""
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
print_create_help() {
|
|
147
|
+
print_banner
|
|
148
|
+
echo -e "\${BOLD}Usage:\${NC} workspai create project <kit> <project-name> [options]"
|
|
149
|
+
echo ""
|
|
150
|
+
echo -e "\${BOLD}Options:\${NC}"
|
|
151
|
+
echo " -t, --template <name> Legacy template alias (fastapi, nestjs, springboot, gofiber, gogin)"
|
|
152
|
+
echo " -y, --yes Skip prompts, use defaults"
|
|
153
|
+
echo " --skip-git Skip git initialization"
|
|
154
|
+
echo " --skip-install Skip dependency installation"
|
|
155
|
+
echo ""
|
|
156
|
+
echo -e "\${BOLD}Templates:\${NC}"
|
|
157
|
+
echo " fastapi FastAPI + Python (default)"
|
|
158
|
+
echo " nestjs NestJS + TypeScript"
|
|
159
|
+
echo " springboot Spring Boot + Java"
|
|
160
|
+
echo " gofiber Go Fiber"
|
|
161
|
+
echo " gogin Go Gin"
|
|
162
|
+
echo ""
|
|
163
|
+
echo -e "\${BOLD}Examples:\${NC}"
|
|
164
|
+
echo -e " \${CYAN}workspai create project fastapi.standard my-api --yes\${NC}"
|
|
165
|
+
echo -e " \${CYAN}workspai create project nestjs.standard my-app --yes\${NC}"
|
|
166
|
+
echo -e " \${CYAN}workspai create my-api --template fastapi\${NC} \${YELLOW}(legacy-compatible)\${NC}"
|
|
167
|
+
echo ""
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
# Create project command
|
|
171
|
+
cmd_create() {
|
|
172
|
+
local project_name=""
|
|
173
|
+
local template="fastapi"
|
|
174
|
+
local yes_flag=""
|
|
175
|
+
local skip_git=""
|
|
176
|
+
local skip_install=""
|
|
177
|
+
|
|
178
|
+
# Canonical Workspai syntax: create project <kit> <name>
|
|
179
|
+
if [[ "\${1:-}" == "project" ]]; then
|
|
180
|
+
shift
|
|
181
|
+
template="\${1:-fastapi.standard}"
|
|
182
|
+
if [[ $# -gt 0 ]]; then
|
|
183
|
+
shift
|
|
184
|
+
fi
|
|
185
|
+
project_name="\${1:-}"
|
|
186
|
+
if [[ $# -gt 0 ]]; then
|
|
187
|
+
shift
|
|
188
|
+
fi
|
|
189
|
+
fi
|
|
190
|
+
|
|
191
|
+
# Parse arguments
|
|
192
|
+
while [[ $# -gt 0 ]]; do
|
|
193
|
+
case "$1" in
|
|
194
|
+
-h|--help)
|
|
195
|
+
print_create_help
|
|
196
|
+
exit 0
|
|
197
|
+
;;
|
|
198
|
+
-t|--template)
|
|
199
|
+
template="$2"
|
|
200
|
+
shift 2
|
|
201
|
+
;;
|
|
202
|
+
-y|--yes)
|
|
203
|
+
yes_flag="--yes"
|
|
204
|
+
shift
|
|
205
|
+
;;
|
|
206
|
+
--skip-git)
|
|
207
|
+
skip_git="--skip-git"
|
|
208
|
+
shift
|
|
209
|
+
;;
|
|
210
|
+
--skip-install)
|
|
211
|
+
skip_install="--skip-install"
|
|
212
|
+
shift
|
|
213
|
+
;;
|
|
214
|
+
-*)
|
|
215
|
+
echo -e "\${RED}\u274C Unknown option: $1\${NC}"
|
|
216
|
+
print_create_help
|
|
217
|
+
exit 1
|
|
218
|
+
;;
|
|
219
|
+
*)
|
|
220
|
+
if [[ -z "$project_name" ]]; then
|
|
221
|
+
project_name="$1"
|
|
222
|
+
fi
|
|
223
|
+
shift
|
|
224
|
+
;;
|
|
225
|
+
esac
|
|
226
|
+
done
|
|
227
|
+
|
|
228
|
+
# Validate template
|
|
229
|
+
if [[ "$template" != "fastapi" && "$template" != "fastapi.standard" && "$template" != "nestjs" && "$template" != "nestjs.standard" && "$template" != "springboot" && "$template" != "springboot.standard" && "$template" != "spring" && "$template" != "gofiber" && "$template" != "gofiber.standard" && "$template" != "gogin" && "$template" != "gogin.standard" && "$template" != "go" && "$template" != "fiber" && "$template" != "gin" && "$template" != "java" ]]; then
|
|
230
|
+
echo -e "\${RED}\u274C Invalid template: $template\${NC}"
|
|
231
|
+
echo -e "Available templates: fastapi.standard, nestjs.standard, springboot.standard, gofiber.standard, gogin.standard"
|
|
232
|
+
exit 1
|
|
233
|
+
fi
|
|
234
|
+
|
|
235
|
+
# If no project name, prompt for it or show help
|
|
236
|
+
if [[ -z "$project_name" ]]; then
|
|
237
|
+
if [[ -n "$yes_flag" ]]; then
|
|
238
|
+
project_name="my-\${template}-project"
|
|
239
|
+
else
|
|
240
|
+
echo -e "\${YELLOW}Project name required\${NC}"
|
|
241
|
+
echo ""
|
|
242
|
+
print_create_help
|
|
243
|
+
exit 1
|
|
244
|
+
fi
|
|
245
|
+
fi
|
|
246
|
+
|
|
247
|
+
# Find workspace root
|
|
248
|
+
local workspace_root
|
|
249
|
+
workspace_root=$(find_workspace_root) || {
|
|
250
|
+
echo -e "\${RED}\u274C Not in a Workspai workspace\${NC}"
|
|
251
|
+
echo -e "Run this command from within a Workspai workspace."
|
|
252
|
+
exit 1
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
local project_path="$PWD/$project_name"
|
|
256
|
+
|
|
257
|
+
# Check if project already exists
|
|
258
|
+
if [[ -d "$project_path" ]]; then
|
|
259
|
+
echo -e "\${RED}\u274C Directory '$project_name' already exists\${NC}"
|
|
260
|
+
exit 1
|
|
261
|
+
fi
|
|
262
|
+
|
|
263
|
+
echo -e "\${BLUE}\${BOLD}\u{1F680} Creating $template project: $project_name\${NC}"
|
|
264
|
+
echo ""
|
|
265
|
+
|
|
266
|
+
local normalized_template="$template"
|
|
267
|
+
case "$template" in
|
|
268
|
+
fastapi) normalized_template="fastapi.standard" ;;
|
|
269
|
+
nestjs) normalized_template="nestjs.standard" ;;
|
|
270
|
+
spring|springboot|java) normalized_template="springboot.standard" ;;
|
|
271
|
+
go|fiber|gofiber) normalized_template="gofiber.standard" ;;
|
|
272
|
+
gin|gogin) normalized_template="gogin.standard" ;;
|
|
273
|
+
esac
|
|
274
|
+
|
|
275
|
+
if command -v workspai >/dev/null 2>&1; then
|
|
276
|
+
workspai create project "$normalized_template" "$project_name" $yes_flag $skip_git $skip_install
|
|
277
|
+
else
|
|
278
|
+
npx workspai create project "$normalized_template" "$project_name" $yes_flag $skip_git $skip_install
|
|
279
|
+
fi
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
# Project commands (dev, build, test, etc.)
|
|
283
|
+
cmd_project() {
|
|
284
|
+
local cmd="$1"
|
|
285
|
+
shift
|
|
286
|
+
|
|
287
|
+
# Find project root
|
|
288
|
+
local project_root
|
|
289
|
+
project_root=$(find_project_root) || {
|
|
290
|
+
echo -e "\${RED}\u274C Not in a Workspai project\${NC}"
|
|
291
|
+
echo -e "Run this command from within a project directory."
|
|
292
|
+
echo -e "Use \${CYAN}workspai create project fastapi.standard my-api --yes\${NC} to create a new project."
|
|
293
|
+
exit 1
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
# Read project type from project.json
|
|
297
|
+
local project_json="$project_root/.workspai/project.json"
|
|
298
|
+
if [[ ! -f "$project_json" ]]; then
|
|
299
|
+
project_json="$project_root/.rapidkit/project.json"
|
|
300
|
+
fi
|
|
301
|
+
local kit_name
|
|
302
|
+
kit_name=$(grep -o '"kit_name": *"[^"]*"' "$project_json" | cut -d'"' -f4)
|
|
303
|
+
|
|
304
|
+
cd "$project_root"
|
|
305
|
+
|
|
306
|
+
case "$kit_name" in
|
|
307
|
+
fastapi.standard|fastapi.ddd|python)
|
|
308
|
+
# Python/FastAPI project
|
|
309
|
+
case "$cmd" in
|
|
310
|
+
init)
|
|
311
|
+
echo -e "\${BLUE}\u{1F4E6} Installing dependencies...\${NC}"
|
|
312
|
+
|
|
313
|
+
# Source activate script first to ensure Poetry is available
|
|
314
|
+
if [[ -f ".workspai/activate" ]]; then
|
|
315
|
+
source .workspai/activate
|
|
316
|
+
elif [[ -f ".rapidkit/activate" ]]; then
|
|
317
|
+
source .rapidkit/activate
|
|
318
|
+
fi
|
|
319
|
+
|
|
320
|
+
poetry install
|
|
321
|
+
echo -e "\${GREEN}\u2705 Dependencies installed!\${NC}"
|
|
322
|
+
;;
|
|
323
|
+
dev)
|
|
324
|
+
echo -e "\${BLUE}\u{1F680} Starting development server...\${NC}"
|
|
325
|
+
poetry run dev "$@"
|
|
326
|
+
;;
|
|
327
|
+
start)
|
|
328
|
+
echo -e "\${BLUE}\u26A1 Starting production server...\${NC}"
|
|
329
|
+
poetry run start "$@"
|
|
330
|
+
;;
|
|
331
|
+
build)
|
|
332
|
+
echo -e "\${BLUE}\u{1F4E6} Building project...\${NC}"
|
|
333
|
+
poetry run build
|
|
334
|
+
;;
|
|
335
|
+
test)
|
|
336
|
+
echo -e "\${BLUE}\u{1F9EA} Running tests...\${NC}"
|
|
337
|
+
poetry run test
|
|
338
|
+
;;
|
|
339
|
+
lint)
|
|
340
|
+
echo -e "\${BLUE}\u{1F527} Running linter...\${NC}"
|
|
341
|
+
poetry run lint
|
|
342
|
+
;;
|
|
343
|
+
format)
|
|
344
|
+
echo -e "\${BLUE}\u2728 Formatting code...\${NC}"
|
|
345
|
+
poetry run format
|
|
346
|
+
;;
|
|
347
|
+
*)
|
|
348
|
+
echo -e "\${RED}\u274C Unknown command: $cmd\${NC}"
|
|
349
|
+
exit 1
|
|
350
|
+
;;
|
|
351
|
+
esac
|
|
352
|
+
;;
|
|
353
|
+
nestjs.standard|node)
|
|
354
|
+
# Node/NestJS project
|
|
355
|
+
local pm="npm"
|
|
356
|
+
if command -v pnpm &>/dev/null && [[ -f "pnpm-lock.yaml" ]]; then
|
|
357
|
+
pm="pnpm"
|
|
358
|
+
elif command -v yarn &>/dev/null && [[ -f "yarn.lock" ]]; then
|
|
359
|
+
pm="yarn"
|
|
360
|
+
fi
|
|
361
|
+
|
|
362
|
+
case "$cmd" in
|
|
363
|
+
init)
|
|
364
|
+
echo -e "\${BLUE}\u{1F4E6} Installing dependencies...\${NC}"
|
|
365
|
+
|
|
366
|
+
# Source activate script first to ensure environment is ready
|
|
367
|
+
if [[ -f ".workspai/activate" ]]; then
|
|
368
|
+
source .workspai/activate
|
|
369
|
+
elif [[ -f ".rapidkit/activate" ]]; then
|
|
370
|
+
source .rapidkit/activate
|
|
371
|
+
fi
|
|
372
|
+
|
|
373
|
+
$pm install
|
|
374
|
+
echo -e "\${GREEN}\u2705 Dependencies installed!\${NC}"
|
|
375
|
+
;;
|
|
376
|
+
dev)
|
|
377
|
+
echo -e "\${BLUE}\u{1F680} Starting development server...\${NC}"
|
|
378
|
+
$pm run dev
|
|
379
|
+
;;
|
|
380
|
+
start)
|
|
381
|
+
echo -e "\${BLUE}\u26A1 Starting production server...\${NC}"
|
|
382
|
+
$pm run start
|
|
383
|
+
;;
|
|
384
|
+
build)
|
|
385
|
+
echo -e "\${BLUE}\u{1F4E6} Building project...\${NC}"
|
|
386
|
+
$pm run build
|
|
387
|
+
;;
|
|
388
|
+
test)
|
|
389
|
+
echo -e "\${BLUE}\u{1F9EA} Running tests...\${NC}"
|
|
390
|
+
$pm run test
|
|
391
|
+
;;
|
|
392
|
+
lint)
|
|
393
|
+
echo -e "\${BLUE}\u{1F527} Running linter...\${NC}"
|
|
394
|
+
$pm run lint
|
|
395
|
+
;;
|
|
396
|
+
format)
|
|
397
|
+
echo -e "\${BLUE}\u2728 Formatting code...\${NC}"
|
|
398
|
+
$pm run format
|
|
399
|
+
;;
|
|
400
|
+
*)
|
|
401
|
+
echo -e "\${RED}\u274C Unknown command: $cmd\${NC}"
|
|
402
|
+
exit 1
|
|
403
|
+
;;
|
|
404
|
+
esac
|
|
405
|
+
;;
|
|
406
|
+
*)
|
|
407
|
+
echo -e "\${RED}\u274C Unknown project type: $kit_name\${NC}"
|
|
408
|
+
exit 1
|
|
409
|
+
;;
|
|
410
|
+
esac
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
# Main command handler
|
|
414
|
+
main() {
|
|
415
|
+
local cmd="\${1:-help}"
|
|
416
|
+
shift || true
|
|
417
|
+
|
|
418
|
+
case "$cmd" in
|
|
419
|
+
create)
|
|
420
|
+
cmd_create "$@"
|
|
421
|
+
;;
|
|
422
|
+
init|dev|start|build|test|lint|format)
|
|
423
|
+
cmd_project "$cmd" "$@"
|
|
424
|
+
;;
|
|
425
|
+
help|-h|--help)
|
|
426
|
+
print_help
|
|
427
|
+
;;
|
|
428
|
+
version|-v|--version)
|
|
429
|
+
echo "Workspai CLI (legacy ./rapidkit launcher) v${c()}"
|
|
430
|
+
;;
|
|
431
|
+
*)
|
|
432
|
+
echo -e "\${RED}\u274C Unknown command: $cmd\${NC}"
|
|
433
|
+
echo ""
|
|
434
|
+
print_help
|
|
435
|
+
exit 1
|
|
436
|
+
;;
|
|
437
|
+
esac
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
main "$@"
|
|
441
|
+
`}function q(){return `@echo off
|
|
442
|
+
setlocal enabledelayedexpansion
|
|
443
|
+
|
|
444
|
+
set "SCRIPT_DIR=%~dp0"
|
|
445
|
+
|
|
446
|
+
where sh >nul 2>nul
|
|
447
|
+
if %ERRORLEVEL%==0 (
|
|
448
|
+
sh "%SCRIPT_DIR%rapidkit" %*
|
|
449
|
+
exit /b %ERRORLEVEL%
|
|
450
|
+
)
|
|
451
|
+
|
|
452
|
+
where bash >nul 2>nul
|
|
453
|
+
if %ERRORLEVEL%==0 (
|
|
454
|
+
bash "%SCRIPT_DIR%rapidkit" %*
|
|
455
|
+
exit /b %ERRORLEVEL%
|
|
456
|
+
)
|
|
457
|
+
|
|
458
|
+
echo [Workspai] No sh/bash found. Falling back to npx workspai.
|
|
459
|
+
npx workspai %*
|
|
460
|
+
exit /b %ERRORLEVEL%
|
|
461
|
+
`}function K(e){return `# ${e}
|
|
462
|
+
|
|
463
|
+
Workspai workspace for building API projects.
|
|
464
|
+
|
|
465
|
+
## Quick Start
|
|
466
|
+
|
|
467
|
+
\`\`\`bash
|
|
468
|
+
# Optional: add the local legacy launcher to PATH (or use ./rapidkit)
|
|
469
|
+
export PATH="$PWD:$PATH"
|
|
470
|
+
|
|
471
|
+
# Create a FastAPI project
|
|
472
|
+
npx workspai create project fastapi.standard my-api --yes
|
|
473
|
+
|
|
474
|
+
# Or create a NestJS project
|
|
475
|
+
npx workspai create project nestjs.standard my-app --yes
|
|
476
|
+
|
|
477
|
+
# Enter project and start development
|
|
478
|
+
cd my-api
|
|
479
|
+
npx workspai init # Install dependencies
|
|
480
|
+
npx workspai dev # Start dev server
|
|
481
|
+
\`\`\`
|
|
482
|
+
|
|
483
|
+
## Available Templates
|
|
484
|
+
|
|
485
|
+
| Template | Stack | Description |
|
|
486
|
+
|----------|-------|-------------|
|
|
487
|
+
| \`fastapi\` | Python + FastAPI | High-performance Python API |
|
|
488
|
+
| \`nestjs\` | TypeScript + NestJS | Enterprise Node.js framework |
|
|
489
|
+
|
|
490
|
+
## Commands
|
|
491
|
+
|
|
492
|
+
| Command | Description |
|
|
493
|
+
|---------|-------------|
|
|
494
|
+
| \`npx workspai create project <kit> <name>\` | Create a new project |
|
|
495
|
+
| \`npx workspai init\` | Install dependencies |
|
|
496
|
+
| \`npx workspai dev\` | Start development server |
|
|
497
|
+
| \`npx workspai start\` | Start production server |
|
|
498
|
+
| \`npx workspai build\` | Build for production |
|
|
499
|
+
| \`npx workspai test\` | Run tests |
|
|
500
|
+
| \`npx workspai lint\` | Run linting |
|
|
501
|
+
| \`npx workspai format\` | Format code |
|
|
502
|
+
|
|
503
|
+
## Learn More
|
|
504
|
+
|
|
505
|
+
- [Workspai Documentation](https://workspai.dev)
|
|
506
|
+
- [GitHub Repository](https://github.com/rapidkitlabs/workspai)
|
|
507
|
+
`}async function Q(e){let{fileURLToPath:r}=await import('url'),t=r(import.meta.url),i=n.dirname(t),o=n.resolve(i,".."),l=n.join(o,"templates","kits"),c=n.join(e,".workspai","templates"),{default:s}=await import('fs-extra');await s.copy(l,c);let p=n.join(o,"templates","generator.js"),u=n.join(e,".workspai","generator.js");await s.copy(p,u);}async function he(e,r){let t=r.template==="fastapi",i=t?"FastAPI":"NestJS",o=N(`Creating ${i} project...`).start();try{let{fileURLToPath:l}=await import('url'),c$1=l(import.meta.url),s=n.dirname(c$1),p=n.resolve(s,".."),u=t?"fastapi-standard":"nestjs-standard",k=n.join(p,"templates","kits",u);await promises.mkdir(e,{recursive:true});let m={project_name:t?r.name.replace(/-/g,"_").toLowerCase():r.name.replace(/_/g,"-").toLowerCase(),author:r.author,description:r.description||`${i} application generated with Workspai`,app_version:"0.1.0",license:"MIT",package_manager:r.package_manager||"npm",created_at:new Date().toISOString(),rapidkit_version:c()};await U(k,e,m);let $=t?`# Python
|
|
508
|
+
__pycache__/
|
|
509
|
+
*.py[cod]
|
|
510
|
+
*$py.class
|
|
511
|
+
*.so
|
|
512
|
+
.Python
|
|
513
|
+
build/
|
|
514
|
+
develop-eggs/
|
|
515
|
+
dist/
|
|
516
|
+
downloads/
|
|
517
|
+
eggs/
|
|
518
|
+
.eggs/
|
|
519
|
+
lib/
|
|
520
|
+
lib64/
|
|
521
|
+
parts/
|
|
522
|
+
sdist/
|
|
523
|
+
var/
|
|
524
|
+
wheels/
|
|
525
|
+
*.egg-info/
|
|
526
|
+
.installed.cfg
|
|
527
|
+
*.egg
|
|
528
|
+
|
|
529
|
+
# Virtual environments
|
|
530
|
+
.venv/
|
|
531
|
+
venv/
|
|
532
|
+
ENV/
|
|
533
|
+
env/
|
|
534
|
+
|
|
535
|
+
# IDEs
|
|
536
|
+
.vscode/
|
|
537
|
+
.idea/
|
|
538
|
+
*.swp
|
|
539
|
+
*.swo
|
|
540
|
+
*~
|
|
541
|
+
|
|
542
|
+
# OS
|
|
543
|
+
.DS_Store
|
|
544
|
+
Thumbs.db
|
|
545
|
+
|
|
546
|
+
# Project specific
|
|
547
|
+
.env
|
|
548
|
+
.env.local
|
|
549
|
+
`:`# Node artifacts
|
|
550
|
+
node_modules/
|
|
551
|
+
dist/
|
|
552
|
+
.tmp/
|
|
553
|
+
.env
|
|
554
|
+
.env.*
|
|
555
|
+
!.env.example
|
|
556
|
+
|
|
557
|
+
# Logs
|
|
558
|
+
logs/
|
|
559
|
+
*.log
|
|
560
|
+
npm-debug.log*
|
|
561
|
+
yarn-debug.log*
|
|
562
|
+
yarn-error.log*
|
|
563
|
+
pnpm-debug.log*
|
|
564
|
+
|
|
565
|
+
# OS
|
|
566
|
+
.DS_Store
|
|
567
|
+
Thumbs.db
|
|
568
|
+
|
|
569
|
+
# IDEs
|
|
570
|
+
.idea/
|
|
571
|
+
.vscode/
|
|
572
|
+
|
|
573
|
+
# Coverage
|
|
574
|
+
coverage/
|
|
575
|
+
`;if(await promises.writeFile(n.join(e,".gitignore"),$),o.succeed(`${i} project created!`),!r.skipGit){let w=N("Initializing git repository...").start();try{await execa("git",["init"],{cwd:e}),await execa("git",["add","."],{cwd:e}),await execa("git",["commit","-m",`Initial commit: ${i} project via Workspai`],{cwd:e}),w.succeed("Git repository initialized");}catch{w.warn("Could not initialize git repository");}}if(!r.skipInstall&&!t){let w=r.package_manager||"npm",y=N(`Installing dependencies with ${w}...`).start();try{await execa(w,["install"],{cwd:e}),y.succeed("Dependencies installed");}catch{y.warn(`Could not install dependencies. Run '${w} install' manually.`);}}let f=n.basename(e);console.log(t?`
|
|
576
|
+
${a$1.green("\u2728 FastAPI project created successfully!")}
|
|
577
|
+
|
|
578
|
+
${a$1.bold("\u{1F4C2} Project structure:")}
|
|
579
|
+
${e}/
|
|
580
|
+
\u251C\u2500\u2500 .workspai/ # Project metadata
|
|
581
|
+
\u251C\u2500\u2500 src/
|
|
582
|
+
\u2502 \u251C\u2500\u2500 main.py # FastAPI application
|
|
583
|
+
\u2502 \u251C\u2500\u2500 cli.py # CLI commands
|
|
584
|
+
\u2502 \u251C\u2500\u2500 routing/ # API routes
|
|
585
|
+
\u2502 \u2514\u2500\u2500 modules/ # Module system
|
|
586
|
+
\u251C\u2500\u2500 tests/ # Test suite
|
|
587
|
+
\u251C\u2500\u2500 pyproject.toml # Poetry configuration
|
|
588
|
+
\u2514\u2500\u2500 README.md
|
|
589
|
+
|
|
590
|
+
${a$1.bold("\u{1F680} Get started:")}
|
|
591
|
+
${a$1.cyan(`cd ${f}`)}
|
|
592
|
+
${a$1.cyan("npx workspai init")} ${a$1.gray("# Install dependencies")}
|
|
593
|
+
${a$1.cyan("npx workspai dev")} ${a$1.gray("# Start dev server")}
|
|
594
|
+
|
|
595
|
+
${a$1.bold("\u{1F4DA} Available commands:")}
|
|
596
|
+
npx workspai init # Install dependencies (poetry install)
|
|
597
|
+
npx workspai dev # Start dev server with hot reload
|
|
598
|
+
npx workspai start # Start production server
|
|
599
|
+
npx workspai test # Run tests
|
|
600
|
+
npx workspai lint # Lint code
|
|
601
|
+
npx workspai format # Format code
|
|
602
|
+
|
|
603
|
+
${a$1.gray("Alternative: make dev, npx workspai dev, poetry run dev")}
|
|
604
|
+
${a$1.gray("\u{1F4A1} Tip: Install globally (npm i -g workspai) to use without npx")}
|
|
605
|
+
`:`
|
|
606
|
+
${a$1.green("\u2728 NestJS project created successfully!")}
|
|
607
|
+
|
|
608
|
+
${a$1.bold("\u{1F4C2} Project structure:")}
|
|
609
|
+
${e}/
|
|
610
|
+
\u251C\u2500\u2500 .workspai/ # Project metadata
|
|
611
|
+
\u251C\u2500\u2500 src/
|
|
612
|
+
\u2502 \u251C\u2500\u2500 main.ts # Application entry point
|
|
613
|
+
\u2502 \u251C\u2500\u2500 app.module.ts # Root module
|
|
614
|
+
\u2502 \u251C\u2500\u2500 config/ # Configuration
|
|
615
|
+
\u2502 \u2514\u2500\u2500 examples/ # Example module
|
|
616
|
+
\u251C\u2500\u2500 test/ # Test files
|
|
617
|
+
\u251C\u2500\u2500 package.json # Dependencies
|
|
618
|
+
\u2514\u2500\u2500 README.md
|
|
619
|
+
|
|
620
|
+
${a$1.bold("\u{1F680} Get started:")}
|
|
621
|
+
${a$1.cyan(`cd ${f}`)}
|
|
622
|
+
${r.skipInstall?a$1.cyan("npx workspai init")+a$1.gray(" # npm install")+`
|
|
623
|
+
`:""}${a$1.cyan("cp .env.example .env")}
|
|
624
|
+
${a$1.cyan("npx workspai dev")} ${a$1.gray("# Start dev server")}
|
|
625
|
+
|
|
626
|
+
${a$1.bold("\u{1F4DA} Available commands:")}
|
|
627
|
+
npx workspai init # Install dependencies
|
|
628
|
+
npx workspai dev # Start dev server with hot reload
|
|
629
|
+
npx workspai start # Start production server
|
|
630
|
+
npx workspai build # Build for production
|
|
631
|
+
npx workspai test # Run tests
|
|
632
|
+
npx workspai lint # Lint code
|
|
633
|
+
npx workspai format # Format code
|
|
634
|
+
|
|
635
|
+
${a$1.bold("\u{1F310} API endpoints:")}
|
|
636
|
+
http://localhost:8000/health # Health check
|
|
637
|
+
http://localhost:8000/docs # Swagger docs
|
|
638
|
+
http://localhost:8000/examples/notes # Example API
|
|
639
|
+
|
|
640
|
+
${a$1.gray("\u{1F4A1} Tip: Install globally (npm i -g workspai) to use without npx")}
|
|
641
|
+
`);}catch(l){throw o.fail(`Failed to create ${i} project`),l}}async function U(e,r,t){let i=await promises.readdir(e,{withFileTypes:true});for(let o of i){let l=n.join(e,o.name),c=o.name.replace(/\.j2$/,""),s=n.join(r,c);if(o.isDirectory())await promises.mkdir(s,{recursive:true}),await U(l,s,t);else {let p=await promises.readFile(l,"utf-8");o.name.endsWith(".j2")&&(p=X(p,t)),await promises.writeFile(s,p),(c==="rapidkit"||c==="activate"||c.endsWith(".py")&&(s.includes(".workspai")||s.includes(".rapidkit")))&&await promises.chmod(s,493);}}}function X(e,r){let t=e;for(let[i,o]of Object.entries(r)){let l=new RegExp(`\\{\\{\\s*${i}\\s*\\}\\}`,"g");t=t.replace(l,String(o));let c=new RegExp(`\\{\\{\\s*${i}\\s*\\|\\s*replace\\s*\\(\\s*['"]([^'"]+)['"]\\s*,\\s*['"]([^'"]*)['"]\\s*\\)\\s*\\}\\}`,"g");t=t.replace(c,(u,k,m)=>String(o).replace(new RegExp(k,"g"),m));let s=new RegExp(`\\{\\{\\s*${i}\\s*\\|\\s*lower\\s*\\}\\}`,"g");t=t.replace(s,String(o).toLowerCase());let p=new RegExp(`\\{\\{\\s*${i}\\s*\\|\\s*replace\\s*\\(\\s*['"]([^'"]+)['"]\\s*,\\s*['"]([^'"]*)['"]\\s*\\)\\s*\\|\\s*lower\\s*\\}\\}`,"g");t=t.replace(p,(u,k,m)=>String(o).replace(new RegExp(k,"g"),m).toLowerCase());}return t}async function ye(e={}){let r=p(),t=n.join(r,"workspaces.json"),i=await L();if(i.workspaces.length===0){if(e.json){console.log(JSON.stringify({schemaVersion:"rapidkit-workspace-list-v1",registryPath:t,workspaces:[],summary:{total:0,missing:0,registryExists:false}},null,2));return}console.log(a$1.yellow(`
|
|
642
|
+
\u26A0\uFE0F No workspaces registered yet.
|
|
643
|
+
`)),console.log(a$1.gray(`Create a workspace with: npx workspai <workspace-name>
|
|
644
|
+
`));return}try{let o=i;if(!o||typeof o!="object"||!Array.isArray(o.workspaces)){if(e.json){console.log(JSON.stringify({schemaVersion:"rapidkit-workspace-list-v1",registryPath:t,workspaces:[],summary:{total:0,missing:0,registryExists:true,registryValid:false},error:{code:"workspace.registry.invalid",message:"Workspace registry is invalid."}},null,2));return}console.log(a$1.yellow(`
|
|
645
|
+
\u26A0\uFE0F Workspace registry is invalid; resetting to empty state.
|
|
646
|
+
`)),await promises.writeFile(t,JSON.stringify({workspaces:[]},null,2));return}let l=z(o),c=[],s=0;for(let m of l.workspaces)await promises.stat(m.path).catch(()=>null)?c.push(m):s+=1;let p={workspaces:c},u=JSON.stringify(o),k=JSON.stringify(p);if(!e.json&&u!==k&&await promises.writeFile(t,JSON.stringify(p,null,2)),!p.workspaces||p.workspaces.length===0){if(e.json){console.log(JSON.stringify({schemaVersion:"rapidkit-workspace-list-v1",registryPath:t,workspaces:[],summary:{total:0,missing:s,registryExists:true,registryValid:true,cleanupApplied:false}},null,2));return}console.log(a$1.yellow(`
|
|
647
|
+
\u26A0\uFE0F No workspaces registered yet.
|
|
648
|
+
`)),s>0&&console.log(a$1.gray(`Cleaned ${s} stale workspace entr${s===1?"y":"ies"}.
|
|
649
|
+
`));return}if(e.json){console.log(JSON.stringify({schemaVersion:"rapidkit-workspace-list-v1",registryPath:t,workspaces:p.workspaces,summary:{total:p.workspaces.length,missing:s,registryExists:true,registryValid:true,cleanupApplied:false}},null,2));return}console.log(a$1.bold(`
|
|
650
|
+
\u{1F4E6} Registered Workspai Workspaces:
|
|
651
|
+
`));for(let m of p.workspaces)console.log(a$1.cyan(` ${m.name}`)),console.log(a$1.gray(` Path: ${m.path}`)),console.log(a$1.gray(` Projects: ${m.projects?.length||0}`)),console.log();s>0&&console.log(a$1.gray(`Cleaned ${s} stale workspace entr${s===1?"y":"ies"}.`)),console.log(a$1.gray(`Total: ${p.workspaces.length} workspace(s)
|
|
652
|
+
`));}catch(o){if(e.json){console.log(JSON.stringify({schemaVersion:"rapidkit-workspace-list-v1",registryPath:t,workspaces:[],summary:{total:0,missing:0,registryExists:true,registryValid:false},error:{code:"workspace.registry.read_failed",message:o.message}},null,2));return}console.error(a$1.red(`
|
|
653
|
+
\u274C Failed to read workspace registry`)),console.error(a$1.gray(String(o)));}}async function Z(e){try{let r=await promises.readFile(e,"utf8");return JSON.parse(r)}catch{return null}}async function D(e){for(let r of e){let t=await Z(r);if(t!==null)return t}return null}function ee(e){return c$1(e)}async function te(e){return a$2(e,{skipDirs:new Set(["node_modules","dist","build","target","coverage","htmlcov"]),includeHiddenDirs:false,descendIntoMatchedProjects:true})}async function I(e){try{return (await promises.readdir(e,{withFileTypes:true})).filter(t=>t.isFile()&&t.name.toLowerCase().endsWith(".json")).map(t=>t.name).sort((t,i)=>t.localeCompare(i))}catch{return []}}async function $e(e,r){let t=r?.includePaths===true,i=r?.includeDoctorEvidence!==false,o$1=r?.includeBlueprint!==false,l=n.resolve(e),c=await D(o(l,"workspace.json")),s=typeof c?.workspace_name=="string"&&c.workspace_name.trim()||n.basename(l),p=typeof c?.profile=="string"?c.profile:void 0,u=typeof c?.rapidkit_version=="string"?c.rapidkit_version:void 0,k=await te(l),m=[];for(let g of k){let h=await D(p$1(g,"project.json")),j=n.relative(l,g)||".",F=n.dirname(p$1(g,n.join("reports","placeholder"))[0]),C=n.dirname(p$1(g,n.join("reports","placeholder"))[1]),P={name:n.basename(g),relative_path:j,runtime:typeof h?.runtime=="string"?h.runtime:void 0,kit_name:typeof h?.kit_name=="string"?h.kit_name:void 0,modules:Array.isArray(h?.modules)?h.modules.filter(x=>typeof x=="string"):void 0};if(t&&(P.absolute_path=g),i){let x=await D([n.join(F,"doctor-last-run.json"),n.join(C,"doctor-last-run.json")]);ee(x)&&(P.doctor_report=x);}let O=[...await I(F),...await I(C)].filter((x,G,V)=>V.indexOf(x)===G);O.length>0&&(P.reports=O),m.push(P);}let $=o(l,"reports"),f=[...await I($[0]),...await I($[1])].filter((g,h,j)=>j.indexOf(g)===h),w=await D(o(l,"workspace.contract.json")),y={schema_version:"1.1",generated_at:new Date().toISOString(),generated_by:"workspai",workspace:{name:s,relative_root:".",profile:p,rapidkit_version:u,...t?{absolute_root:l}:{}},summary:{project_count:m.length,doctor_evidence_included:i,contract_included:!!w},reports:{workspace:f},projects:m,...w?{contract:w}:{}};o$1&&(y.blueprint={schema_version:"rapidkit.workspace-blueprint.v1",purpose:"portable-reproducibility",workspace:{name:s,profile:p},projects:m.map(g=>({name:g.name,relative_path:g.relative_path,runtime:g.runtime,kit_name:g.kit_name,modules:g.modules??[],recreate_commands:[...g.kit_name?[`npx workspai create project ${g.kit_name} ${g.name} --yes --skip-install`]:[],`cd ${g.relative_path}`,"npx workspai init","npx workspai test"]})),recommended_commands:["npx workspai workspace contract verify --strict","npx workspai doctor workspace","npx workspai workspace run init --json","npx workspai workspace run test --strict --json","npx workspai readiness --strict --json"]});let b=r?.outputPath?n.resolve(r.outputPath):n.join($[0],"share-bundle.json");return await promises.mkdir(n.dirname(b),{recursive:true}),await promises.writeFile(b,JSON.stringify(y,null,2),"utf8"),b}export{Y as a,ke as b,fe as c,we as d,he as e,ye as f,$e as g};
|