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,920 @@
|
|
|
1
|
+
import {f as f$1,e as e$2}from'./chunk-AFSZHLQT.js';import {b as b$2}from'./chunk-JHC6SCJC.js';import {e,g,f as f$2,b as b$4,c as c$3,d as d$2}from'./chunk-RE773WOX.js';import {a as a$1,d,b as b$1}from'./chunk-GSWPGELT.js';import {c}from'./chunk-Y45WZR5N.js';import {f,c as c$2,e as e$3}from'./chunk-7YHK5NM3.js';import {b as b$3,j,i,l,h,s}from'./chunk-LZQNVH7D.js';import {b,a,c as c$1,d as d$1}from'./chunk-5XATWNME.js';import {promises}from'fs';import*as k from'fs-extra';import y from'path';import e$1 from'chalk';import {execa}from'execa';async function F(t,o={}){let n=y.resolve(t),s=o.workspaceName??y.basename(n);try{let{registerWorkspace:a}=await import('./workspace-PR6VZRBG.js');await a(n,s);}catch(a){o.silent||console.warn(e$1.gray(`Note: Could not register workspace in shared registry: ${a?.message??a}`));}try{let{syncWorkspaceContract:a}=await import('./workspace-contract-XUGMCUSQ.js'),l=await a({workspacePath:n});if(o.silent||console.log(e$1.gray(`\u2139\uFE0F Workspace intelligence synced (contract + registry summary, ${l.contract.projects.length} project(s)).`)),!o.silent&&l.verification.status!=="passed"){console.log(e$1.yellow("\u26A0\uFE0F Workspace contract verification reported issues."));for(let d of l.verification.violations)console.log(e$1.gray(` Violation: ${d}`));console.log(e$1.white(" Next: npx workspai workspace contract inspect"));}}catch(a){o.silent||console.warn(e$1.gray(`Note: Could not sync workspace intelligence layer: ${a?.message??a}`));}}function D(){return h()}async function q(t,o,n,s,a){let l=d(o,c(),n,a?.pythonEngine?{coreStatus:a.pythonEngine,...a.pythonEngineReason?{coreReason:a.pythonEngineReason}:{},...s?{pythonVersion:s}:{}}:void 0);s&&!a?.pythonEngine&&(l.metadata||(l.metadata={}),l.metadata.python={pythonVersion:s}),await b$1(t,l);}async function L(t){await k.outputFile(y.join(t,".gitignore"),`.venv/
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.pyc
|
|
4
|
+
.env
|
|
5
|
+
${c$1}
|
|
6
|
+
${d$1}
|
|
7
|
+
${b}/
|
|
8
|
+
|
|
9
|
+
`,"utf-8");}async function je(t,o){let n=o.replace(/[^a-z0-9-]/gi,"-").toLowerCase();await k.outputFile(y.join(t,"poetry.toml"),`[virtualenvs]
|
|
10
|
+
in-project = true
|
|
11
|
+
`,"utf-8"),await k.outputFile(y.join(t,"pyproject.toml"),`[tool.poetry]
|
|
12
|
+
name = "${n}"
|
|
13
|
+
version = "0.1.0"
|
|
14
|
+
description = "Workspai workspace"
|
|
15
|
+
authors = []
|
|
16
|
+
package-mode = false
|
|
17
|
+
|
|
18
|
+
[tool.poetry.dependencies]
|
|
19
|
+
python = "^3.10"
|
|
20
|
+
rapidkit-core = "*"
|
|
21
|
+
|
|
22
|
+
[build-system]
|
|
23
|
+
requires = ["poetry-core"]
|
|
24
|
+
build-backend = "poetry.core.masonry.api"
|
|
25
|
+
`,"utf-8");}function Ae(t,o,n,s,a){return JSON.stringify({schema_version:"1.0",workspace_name:t,workspai_version:c(),rapidkit_version:c(),created_at:new Date().toISOString(),created_by:"workspai",profile:s||"minimal",...a?.profileRequested?{profile_requested:a.profileRequested}:{},...a?.bootstrapNote?{bootstrap_note:a.bootstrapNote}:{},engine:{install_method:o,python_version:n||null,...a?.pythonEngine?{python_core:{status:a.pythonEngine,...a.pythonEngineReason?{reason:a.pythonEngineReason}:{}}}:{}}},null,2)}function $e(t,o,n,s,a,l){return JSON.stringify({schema_version:"1.0",generated_by:"workspai",generated_at:new Date().toISOString(),runtime:{python:{version:o||null,install_method:t,...l?.pythonEngine?{core:{status:l.pythonEngine,...l.pythonEngineReason?{reason:l.pythonEngineReason}:{}}}:{}},node:{version:n||process.version},go:{version:s||null},java:{version:null,build_tool:null,build_tool_version:null},dotnet:{version:a||null,sdk:a||null}}},null,2)}function Se(){return `version: "1.0"
|
|
26
|
+
mode: warn # "warn" or "strict"
|
|
27
|
+
dependency_sharing_mode: isolated # "isolated" or "shared-runtime-caches" or "shared-node-deps"
|
|
28
|
+
# change profile (recommended): npx workspai bootstrap --profile polyglot
|
|
29
|
+
# change mode/dependency manually: edit this file and rerun npx workspai init
|
|
30
|
+
rules:
|
|
31
|
+
enforce_workspace_marker: true
|
|
32
|
+
enforce_toolchain_lock: false
|
|
33
|
+
disallow_untrusted_tool_sources: false
|
|
34
|
+
`}function Me(){return `version: "1.0"
|
|
35
|
+
cache:
|
|
36
|
+
strategy: shared # "shared" or "on-demand"
|
|
37
|
+
prune_on_bootstrap: false
|
|
38
|
+
self_heal: true
|
|
39
|
+
verify_integrity: false
|
|
40
|
+
`}async function De(){try{let{stdout:t}=await execa("go",["version"],{timeout:3e3,stdio:"pipe"}),o=t.match(/go(\d+\.\d+(?:\.\d+)?)/i);return o?o[1]:void 0}catch{return}}async function Te(){try{let{stdout:t}=await execa("dotnet",["--version"],{timeout:3e3,stdio:"pipe"}),o=t.trim();return o.length>0?o:void 0}catch{return}}async function B(t,o,n,s,a$1,l){let[d,u]=await Promise.all([De(),Te()]),p=[{fileName:"workspace.json",content:Ae(o,n,s,a$1,l)},{fileName:"toolchain.lock",content:$e(n,s,process.version,d,u,l)},{fileName:"policies.yml",content:Se()},{fileName:"cache-config.yml",content:Me()}];for(let h of p)await k.outputFile(y.join(t,a,h.fileName),h.content,"utf-8");}async function Ct(t,o){let{workspaceName:n=y.basename(t),installMethod:s="venv",pythonVersion:a$2,profile:l,writeMarker:d$1=true,writeGitignore:u=true,onlyIfMissing:p=true}=o||{},h=[],[g,m]=await Promise.all([De(),Te()]),r=[{relPath:y.join(a,"workspace.json"),legacyRelPath:y.join(b,"workspace.json"),content:Ae(n,s,a$2,l)},{relPath:y.join(a,"toolchain.lock"),legacyRelPath:y.join(b,"toolchain.lock"),content:$e(s,a$2,process.version,g,m)},{relPath:y.join(a,"policies.yml"),legacyRelPath:y.join(b,"policies.yml"),content:Se()},{relPath:y.join(a,"cache-config.yml"),legacyRelPath:y.join(b,"cache-config.yml"),content:Me()}];for(let i of r){let P=y.join(t,i.relPath),w=y.join(t,i.legacyRelPath),$=await k.pathExists(P),E=await k.pathExists(w);p&&$||(p&&E?(await k.copy(w,P),h.push(i.relPath)):(await k.outputFile(P,i.content,"utf-8"),h.push(i.relPath)));}if(d$1&&(!!!await a$1(t)||!p)){let P=d(n,c(),s);a$2&&(P.metadata||(P.metadata={}),P.metadata.python={pythonVersion:a$2}),await b$1(t,P),h.push(c$1);}if(u){let i=y.join(t,".gitignore");(!p||!await k.pathExists(i))&&(await L(t),h.push(".gitignore"));}return h}var Ne=new Set(["go-only","java-only","dotnet-only","node-only","minimal"]),Ue={"python-only":"minimal",polyglot:"node-only",enterprise:"polyglot"};function Ye(t){let o=t,n=new Set;for(;!Ne.has(o);){if(n.has(o))return "minimal";n.add(o);let s=Ue[o];if(!s)return "minimal";o=s;}return o}var V="3.10",Ke=["3.10","3.11","3.12"];async function _e(t){try{let{stdout:o}=await execa(t,["--version"],{timeout:3e3}),n=o.match(/Python (\d+\.\d+\.\d+)/);if(n)return n[1]}catch{}return null}async function qe(t,o){try{await promises.writeFile(y.join(t,".python-version"),`${o}
|
|
41
|
+
`,"utf-8"),f.debug(`Created .python-version with ${o}`);}catch(n){f.warn(`Failed to create .python-version: ${n}`);}}function H(){let n=[...(process.env.PATH||"").split(y.delimiter).filter(Boolean)];for(let s$1 of s())n.includes(s$1)||n.unshift(s$1);process.env.PATH=n.join(y.delimiter);}async function ie(t,o){H(),t.start("Checking pipx installation");try{return await execa("pipx",["--version"]),t.succeed("pipx found"),{kind:"binary"}}catch{}let n=D();try{return await execa(n,["-m","pipx","--version"]),t.succeed("pipx found"),{kind:"python-module",pythonCmd:n}}catch{}if(o)throw new d$2;t.stop?.();let{installPipx:s}=await b$2([{type:"confirm",name:"installPipx",message:"pipx is not installed. Install it now (user install via python -m pip)?",default:true}]);if(!s)throw new d$2;t.start("Installing pipx (user install)");try{try{await execa(n,["-m","pip","install","--user","--upgrade","pip"]);}catch{}await execa(n,["-m","pip","install","--user","--upgrade","pipx"]);}catch(a){let l=a,d=String(l?.stderr||l?.shortMessage||l?.message||"");throw new f$2("Install pipx with python -m pip",a instanceof Error?a:new Error(d))}t.succeed("pipx installed"),H();try{return await execa(n,["-m","pipx","--version"]),{kind:"python-module",pythonCmd:n}}catch(a){let l=a,d=String(l?.stderr||l?.shortMessage||l?.message||"pipx not runnable after install");throw new f$2("Verify pipx after install",new Error(`${d}
|
|
42
|
+
|
|
43
|
+
Try reopening your terminal or run: ${n} -m pipx ensurepath`))}}async function G(t,o){return t.kind==="binary"?execa("pipx",o):execa(t.pythonCmd,["-m","pipx",...o])}function Be(t){let o=t.match(/^(\d+)\.(\d+)/);return o?`${o[1]}.${o[2]}`:null}function Ce(t){if(!t)return null;let o=t.match(/Python\s+(\d+)\.(\d+)(?:\.\d+)?/i);return o?`${o[1]}.${o[2]}`:null}function me(t,o){let[n,s]=t.split(".").map(d=>Number(d)),[a,l]=o.split(".").map(d=>Number(d));return n!==a?n-a:s-l}function J(t,o){return me(t,o)>=0}async function Je(t){let o=new Set,n=j(14,10);for(let m of n)try{let r=await execa(m.command,m.args,{timeout:2500}),i=Ce(`${r.stdout||""}
|
|
44
|
+
${r.stderr||""}`);i&&J(i,V)&&o.add(i);}catch{}let s=null;try{let m=await execa(D(),["--version"],{timeout:2500}),r=Ce(`${m.stdout||""}
|
|
45
|
+
${m.stderr||""}`);r&&J(r,V)&&(s=r,o.add(r));}catch{}let a=Ke.filter(m=>J(m,V)),l=new Set([...a,...o]),d=Array.from(l).sort((m,r)=>me(r,m)),u=t?Be(t):null,p=u&&J(u,V)?u:s||d[0]||V;return l.has(p)||l.add(p),{choices:Array.from(l).sort((m,r)=>me(r,m)).map(m=>{let r=[];return m===s&&r.push("current system"),m===V&&r.push("minimum supported"),o.has(m)&&m!==s&&r.push("detected"),{name:r.length>0?`${m} (${r.join(", ")})`:m,value:m}}),defaultValue:p}}async function Qe(){H();let t=false,o=false;try{await execa("poetry",["--version"],{timeout:2500}),t=true;}catch{t=false;}try{await execa("pipx",["--version"],{timeout:2500}),o=true;}catch{let n=h();try{await execa(n,["-m","pipx","--version"],{timeout:2500}),o=true;}catch{o=false;}}return {poetry:t,pipx:o}}async function Oe(){H();try{return await execa("poetry",["--version"],{timeout:2500}),true}catch{return false}}function Xe(t,o){return t==="poetry"&&o.poetry?"poetry":t==="pipx"&&o.pipx?"pipx":t==="venv"?"venv":o.poetry?"poetry":"venv"}async function Ze(t,o){H(),t.start("Checking Poetry installation");try{await execa("poetry",["--version"]),t.succeed("Poetry found");return}catch{}if(o)throw new c$3;let{installPoetry:n}=await b$2([{type:"confirm",name:"installPoetry",message:"Poetry is not installed. Install it now using pipx?",default:true}]);if(!n)throw new c$3;let s=await ie(t,o);t.start("Installing Poetry with pipx");try{await G(s,["install","poetry"]);}catch(a){let l=a,d=String(l?.stderr||l?.shortMessage||l?.message||"");if(/already\s+installed|already\s+seems\s+to\s+be\s+installed|exists/i.test(d))try{await G(s,["upgrade","poetry"]);}catch{}else throw new f$2("Install Poetry with pipx",a instanceof Error?a:new Error(d))}t.succeed("Poetry installed"),H();try{await execa("poetry",["--version"]);}catch(a){let l=a,d=String(l?.stderr||l?.shortMessage||l?.message||"Poetry not found on PATH");throw new f$2("Verify Poetry after pipx install",new Error(`${d}
|
|
46
|
+
|
|
47
|
+
Poetry may be installed but not on PATH yet. Try reopening your terminal or run: pipx ensurepath`))}}function et(t,o={}){let n=t==="poetry",s=o.pythonEngineSkipped?`echo "- Python engine installation was intentionally skipped for this workspace." 1>&2
|
|
48
|
+
echo "- For npm-owned workspace commands, run: npx workspai <command>" 1>&2
|
|
49
|
+
echo "- To install the local Python engine later, create a RapidKit Core module-enabled project, then run: npx workspai workspace run init" 1>&2
|
|
50
|
+
`:`echo "- If you used venv: ensure .venv exists (or re-run the installer)." 1>&2
|
|
51
|
+
`;return `#!/usr/bin/env sh
|
|
52
|
+
set -eu
|
|
53
|
+
|
|
54
|
+
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
55
|
+
|
|
56
|
+
VENV_RAPIDKIT="$SCRIPT_DIR/.venv/bin/rapidkit"
|
|
57
|
+
if [ -x "$VENV_RAPIDKIT" ]; then
|
|
58
|
+
exec "$VENV_RAPIDKIT" "$@"
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
${n?`if command -v poetry >/dev/null 2>&1 && [ -f "$SCRIPT_DIR/pyproject.toml" ]; then
|
|
62
|
+
exec poetry run rapidkit "$@"
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
`:""}if command -v rapidkit >/dev/null 2>&1; then
|
|
66
|
+
RAPIDKIT_CMD=$(command -v rapidkit)
|
|
67
|
+
if [ "$RAPIDKIT_CMD" != "$SCRIPT_DIR/rapidkit" ] && [ "$RAPIDKIT_CMD" != "$SCRIPT_DIR/.workspai/rapidkit" ] && [ "$RAPIDKIT_CMD" != "$SCRIPT_DIR/.rapidkit/rapidkit" ]; then
|
|
68
|
+
RAPIDKIT_LOCAL_LAUNCHER_BYPASS=1 exec "$RAPIDKIT_CMD" "$@"
|
|
69
|
+
fi
|
|
70
|
+
fi
|
|
71
|
+
|
|
72
|
+
for RAPIDKIT_CORE in "$HOME/.local/bin/rapidkit" "$HOME/Library/Python/3.14/bin/rapidkit" "$HOME/Library/Python/3.13/bin/rapidkit" "$HOME/Library/Python/3.12/bin/rapidkit" "$HOME/Library/Python/3.11/bin/rapidkit" "$HOME/Library/Python/3.10/bin/rapidkit"; do
|
|
73
|
+
if [ -x "$RAPIDKIT_CORE" ]; then
|
|
74
|
+
exec "$RAPIDKIT_CORE" "$@"
|
|
75
|
+
fi
|
|
76
|
+
done
|
|
77
|
+
|
|
78
|
+
echo "RapidKit launcher could not find a local Python CLI." 1>&2
|
|
79
|
+
${s}${o.pythonEngineSkipped?"":n?`echo "- If you used Poetry: run 'poetry install' and retry, or activate the env." 1>&2
|
|
80
|
+
`:""}${o.pythonEngineSkipped?`echo "Tip: use 'npx workspai workspace model --json' for Workspace Intelligence without the Python engine." 1>&2
|
|
81
|
+
`:`echo "Tip: you can also run: ./.venv/bin/rapidkit --help" 1>&2
|
|
82
|
+
`}exit 1
|
|
83
|
+
`}function tt(t,o={}){let n=t==="poetry",s=o.pythonEngineSkipped?`echo - Python engine installation was intentionally skipped for this workspace. 1>&2
|
|
84
|
+
echo - For npm-owned workspace commands, run: npx workspai ^<command^> 1>&2
|
|
85
|
+
echo - To install the local Python engine later, create a RapidKit Core module-enabled project, then run: npx workspai workspace run init 1>&2
|
|
86
|
+
`:`echo Tip: run .venv\\Scripts\\rapidkit.exe --help 1>&2
|
|
87
|
+
`;return `@echo off
|
|
88
|
+
setlocal
|
|
89
|
+
|
|
90
|
+
set "SCRIPT_DIR=%~dp0"
|
|
91
|
+
|
|
92
|
+
if exist "%SCRIPT_DIR%\\.venv\\Scripts\\rapidkit.exe" (
|
|
93
|
+
"%SCRIPT_DIR%\\.venv\\Scripts\\rapidkit.exe" %*
|
|
94
|
+
exit /b %ERRORLEVEL%
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
${n?`where poetry >nul 2>nul
|
|
98
|
+
if %ERRORLEVEL%==0 if exist "%SCRIPT_DIR%\\pyproject.toml" (
|
|
99
|
+
poetry run rapidkit %*
|
|
100
|
+
exit /b %ERRORLEVEL%
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
`:""}:rapidkit_npm_wrapper_fallback
|
|
104
|
+
for /f "delims=" %%R in ('where rapidkit.cmd 2^>nul') do (
|
|
105
|
+
if /I not "%%~fR"=="%SCRIPT_DIR%rapidkit.cmd" if /I not "%%~fR"=="%SCRIPT_DIR%.workspai\\rapidkit.cmd" if /I not "%%~fR"=="%SCRIPT_DIR%.rapidkit\\rapidkit.cmd" (
|
|
106
|
+
set "RAPIDKIT_LOCAL_LAUNCHER_BYPASS=1"
|
|
107
|
+
"%%~fR" %*
|
|
108
|
+
exit /b %ERRORLEVEL%
|
|
109
|
+
)
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
:rapidkit_core_fallback
|
|
113
|
+
for %%R in ("%USERPROFILE%\\.local\\bin\\rapidkit.exe" "%APPDATA%\\Python\\Scripts\\rapidkit.exe" "%LOCALAPPDATA%\\Programs\\Python\\Scripts\\rapidkit.exe") do (
|
|
114
|
+
if exist "%%~R" (
|
|
115
|
+
"%%~R" %*
|
|
116
|
+
exit /b %ERRORLEVEL%
|
|
117
|
+
)
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
echo RapidKit launcher could not find a local Python CLI. 1>&2
|
|
121
|
+
${s}echo Tip: for npm-owned workspace commands, run npx --yes --package workspai workspai %* from a shell where npm is on PATH. 1>&2
|
|
122
|
+
exit /b 1
|
|
123
|
+
`}async function he(t,o,n={}){await k.outputFile(y.join(t,"rapidkit"),et(o,n),{encoding:"utf-8",mode:493}),await k.outputFile(y.join(t,"rapidkit.cmd"),tt(o,n),"utf-8");}async function jt(t,o){let{skipGit:n=false,skipPythonEngine:s=false,testMode:a=false,demoMode:l=false,dryRun:d=false,yes:u=false,userConfig:p={},installMethod:h,profile:g,parentDirectory:m}=o,r=t||"rapidkit",i=m?y.resolve(m,r):y.resolve(process.cwd(),r);if(await k.pathExists(i))throw new e(r);if(d){let f=g||(u?"minimal":void 0),R=h||p.defaultInstallMethod||"poetry",x=p.pythonVersion||"3.10";await nt(i,r,l,p,f,R,x);return}if(l){await ot(i,r,n);return}let P=new Set(["python-only","polyglot","enterprise"]),w=g||"";if(!u&&!g){let{selectedProfile:f}=await b$2([{type:"rawlist",name:"selectedProfile",message:"Select workspace profile:",choices:[{name:"minimal \u2014 Foundation files only (fastest bootstrap, mixed projects)",value:"minimal"},{name:"java-only \u2014 Java runtime (Spring Boot services)",value:"java-only"},{name:"python-only \u2014 Python + Poetry (FastAPI, Django, ML pipelines)",value:"python-only"},{name:"node-only \u2014 Node.js runtime (NestJS, Express, Next.js)",value:"node-only"},{name:"go-only \u2014 Go runtime (Fiber, Gin, gRPC, microservices)",value:"go-only"},{name:"dotnet-only \u2014 .NET runtime (ASP.NET Core services)",value:"dotnet-only"},{name:"polyglot \u2014 Python + Node.js + Go + Java + .NET multi-runtime workspace",value:"polyglot"},{name:"enterprise \u2014 Polyglot + governance + Sigstore verification",value:"enterprise"}],default:1}]);w=f;}else w||(w="minimal");let $=!u&&P.has(w),E=P.has(w)&&s?"skip":$?(await b$2([{type:"confirm",name:"installPythonEngine",message:"Install the optional RapidKit Python engine now? (needed for Python-backed kits/modules)",default:true}])).installPythonEngine!==false?"install":"skip":"install",O=$&&E==="install",ae=typeof p.pythonVersion=="string"&&p.pythonVersion.trim().length>0?p.pythonVersion.trim():void 0,Ge=h||p.defaultInstallMethod||"poetry",re=O?await Qe():{poetry:true,pipx:true},fe=O?await Je(ae):{choices:Ke.map(f=>({name:f,value:f})),defaultValue:V},He=Xe(Ge,re),ze=[{name:re.poetry?"\u{1F3AF} Poetry (Recommended - includes virtual env + dependency mgmt)":"\u{1F3AF} Poetry (Recommended) \u2014 not detected (we can install it)",value:"poetry"},{name:"\u{1F4E6} pip with venv (Standard, zero extra tools)",value:"venv"},{name:re.pipx?"\u{1F527} pipx (Global isolated - RapidKit Core only, no local venv)":"\u{1F527} pipx (Global isolated) \u2014 not detected (we can install it)",value:"pipx"}],I=O?await b$2([{type:"rawlist",name:"pythonVersion",message:"Select Python version for RapidKit:",choices:fe.choices,default:fe.defaultValue},{type:"rawlist",name:"installMethod",message:"How would you like to manage the workspace environment?",choices:ze,default:He}]):await(async()=>{if(E==="skip")return {pythonVersion:p.pythonVersion||"3.10",installMethod:"venv"};let f$1=h||p.defaultInstallMethod||await(async()=>{try{return await execa("poetry",["--version"],{timeout:3e3}),"poetry"}catch{return f.warn("Poetry not found \u2014 auto-selecting venv. Pass --install-method poetry to override."),"venv"}})();return {pythonVersion:p.pythonVersion||"3.10",installMethod:f$1}})();O&&(console.log(e$1.gray(`
|
|
124
|
+
\u{1F4CC} Configuration notes:`)),I.pythonVersion==="3.10"?console.log(e$1.gray(" \u2022 Python 3.10: Latest stable with widespread compatibility")):I.pythonVersion==="3.11"?console.log(e$1.gray(" \u2022 Python 3.11: Newer, faster (3.10-3.11: ~10% speed improvement)")):I.pythonVersion==="3.12"&&console.log(e$1.gray(" \u2022 Python 3.12: Cutting edge, excellent for performance")),I.installMethod==="poetry"?console.log(e$1.gray(" \u2022 Poetry: Dependency management + virtual env (recommended for teams)")):I.installMethod==="venv"?console.log(e$1.gray(" \u2022 venv: Standard library approach, lightweight, zero dependencies")):console.log(e$1.gray(" \u2022 pipx: Global isolated, RapidKit Core only, no local venv")),console.log(""));let se=Ne;if(se.has(w)){let f=c$2("Creating workspace",{component:"create",phase:"workspace.python-free"});try{await k.ensureDir(i),f.succeed("Directory created"),await q(i,r,"venv",void 0),await B(i,r,"venv",void 0,w),await L(i);let R={"go-only":"Go-only","java-only":"Java-only","dotnet-only":".NET-only","node-only":"Node.js-only",minimal:"Minimal"};if(await k.outputFile(y.join(i,"README.md"),`# ${r}
|
|
125
|
+
|
|
126
|
+
Workspai **${R[w]}** workspace.
|
|
127
|
+
|
|
128
|
+
## Quick start
|
|
129
|
+
|
|
130
|
+
\`\`\`bash
|
|
131
|
+
`+(w==="go-only"?`npx workspai create project gofiber.standard my-api
|
|
132
|
+
cd my-api
|
|
133
|
+
npx workspai init
|
|
134
|
+
npx workspai dev
|
|
135
|
+
`:w==="java-only"?`npx workspai create project springboot.standard my-service
|
|
136
|
+
cd my-service
|
|
137
|
+
npx workspai init
|
|
138
|
+
npx workspai dev
|
|
139
|
+
`:w==="dotnet-only"?`npx workspai create project dotnet.webapi.clean my-api
|
|
140
|
+
cd my-api
|
|
141
|
+
npx workspai init
|
|
142
|
+
npx workspai dev
|
|
143
|
+
`:w==="node-only"?`npx workspai create project nestjs.standard my-app
|
|
144
|
+
cd my-app
|
|
145
|
+
npx workspai init
|
|
146
|
+
npx workspai dev
|
|
147
|
+
`:`npx workspai create project
|
|
148
|
+
cd <project-name>
|
|
149
|
+
npx workspai init
|
|
150
|
+
npx workspai dev
|
|
151
|
+
`)+"```\n","utf-8"),!n){f.start("Initializing git repository");try{await execa("git",["init"],{cwd:i}),await execa("git",["add","."],{cwd:i}),await execa("git",["commit","-m","Initial commit: Workspai workspace"],{cwd:i}),f.succeed("Git repository initialized");}catch{f.warn("Could not initialize git repository");}}if(await F(i,{workspaceName:r,silent:a}),console.log(e$1.green(`
|
|
152
|
+
\u2728 Workspace created!
|
|
153
|
+
`)),console.log(e$1.cyan("\u{1F4C2} Location:"),e$1.white(i)),console.log(e$1.cyan(`
|
|
154
|
+
\u{1F680} Get started:
|
|
155
|
+
`)),console.log(e$1.white(` ${f$1(i)}`)),w==="go-only"){console.log(e$1.white(" npx workspai create project gofiber.standard my-api")),console.log(e$1.white(" cd my-api")),console.log(e$1.white(" npx workspai init")),console.log(e$1.white(` npx workspai dev
|
|
156
|
+
`)),console.log(e$1.gray("\u{1F4A1} No Python required \u2014 Go kits run entirely through the npm package."));try{let{stdout:x}=await execa("go",["version"],{timeout:3e3}),v=x.match(/go version go(\d+\.\d+(?:\.\d+)?)/),T=v?v[1]:"unknown";console.log(e$1.gray(`\u{1F439} Go ${T} detected \u2014 ready for gofiber.standard / gogin.standard projects`));}catch{console.log(e$1.yellow(`
|
|
157
|
+
\u26A0\uFE0F Go is not installed \u2014 install it from https://go.dev/dl/`));}}else if(w==="java-only")console.log(e$1.white(" npx workspai create project springboot.standard my-service")),console.log(e$1.white(" cd my-service")),console.log(e$1.white(" npx workspai init")),console.log(e$1.white(` npx workspai dev
|
|
158
|
+
`)),console.log(e$1.gray("\u{1F4A1} No Python required \u2014 Spring Boot kit runs through the npm package with Java tooling."));else if(w==="dotnet-only"){console.log(e$1.white(" npx workspai create project dotnet.webapi.clean my-api")),console.log(e$1.white(" cd my-api")),console.log(e$1.white(" npx workspai init")),console.log(e$1.white(` npx workspai dev
|
|
159
|
+
`)),console.log(e$1.gray("\u{1F4A1} No Python required \u2014 ASP.NET Core kit runs through the npm package with .NET tooling."));try{let{stdout:x}=await execa("dotnet",["--version"],{timeout:3e3});console.log(e$1.gray(`\u2699\uFE0F .NET SDK ${x.trim()} detected \u2014 ready for ASP.NET Core projects`));}catch{console.log(e$1.yellow(`
|
|
160
|
+
\u26A0\uFE0F .NET SDK is not installed \u2014 install it from https://dotnet.microsoft.com/download`));}}else w==="node-only"?(console.log(e$1.white(" npx workspai create project nestjs.standard my-app")),console.log(e$1.white(" cd my-app")),console.log(e$1.white(" npx workspai init")),console.log(e$1.white(` npx workspai dev
|
|
161
|
+
`)),console.log(e$1.gray("\u{1F4A1} Node lifecycle commands run through Node tooling. RapidKit Core module commands for module-enabled kits can install the local Python engine later with workspace run init."))):(console.log(e$1.white(" npx workspai create project")),console.log(e$1.white(" cd <project-name>")),console.log(e$1.white(" npx workspai init")),console.log(e$1.white(` npx workspai dev
|
|
162
|
+
`)),console.log(e$1.gray("\u{1F4A1} Bootstrap a specific runtime: workspai bootstrap --profile java-only|python-only|node-only|go-only|dotnet-only|polyglot|enterprise")));console.log(e$1.cyan(`
|
|
163
|
+
\u{1F4DA} More info:`)),console.log(e$1.gray(" \u2022 Change profile anytime: workspai bootstrap --profile <profile>")),console.log(e$1.gray(" \u2022 View config: cat "+r+"/.workspai-workspace")),console.log(e$1.gray(" \u2022 Check health: workspai doctor")),console.log("");}catch(R){throw f.fail("Failed to create workspace"),console.error(e$1.red(`
|
|
164
|
+
\u274C Error:`),R),R}return}if(P.has(w)&&E==="skip"){let f=c$2("Creating workspace",{component:"create",phase:"workspace.python-engine-skipped"});try{await k.ensureDir(i),f.succeed("Directory created");let R={bootstrapNote:"python-engine-skipped",pythonEngine:"skipped",pythonEngineReason:"user-opted-out"};await q(i,r,"venv",void 0,R),await B(i,r,"venv",void 0,w,R),await L(i),await he(i,"venv",{pythonEngineSkipped:true});let x={"python-only":"Python-aware",polyglot:"Polyglot",enterprise:"Enterprise"};if(await k.outputFile(y.join(i,"README.md"),`# ${r}
|
|
165
|
+
|
|
166
|
+
Workspai **${x[w]??w}** workspace with Workspace Intelligence enabled and Python engine installation skipped.
|
|
167
|
+
|
|
168
|
+
## Quick start
|
|
169
|
+
|
|
170
|
+
\`\`\`bash
|
|
171
|
+
npx workspai workspace model --json
|
|
172
|
+
npx workspai adopt /path/to/project
|
|
173
|
+
npx workspai workspace verify --json
|
|
174
|
+
\`\`\`
|
|
175
|
+
|
|
176
|
+
## Add the Python engine later
|
|
177
|
+
|
|
178
|
+
\`\`\`bash
|
|
179
|
+
npx workspai create project fastapi.standard api --yes
|
|
180
|
+
npx workspai workspace run init
|
|
181
|
+
\`\`\`
|
|
182
|
+
`,"utf-8"),!n){f.start("Initializing git repository");try{await execa("git",["init"],{cwd:i}),await execa("git",["add","."],{cwd:i}),await execa("git",["commit","-m",`Initial commit: Workspai workspace (${w})`],{cwd:i}),f.succeed("Git repository initialized");}catch{f.warn("Could not initialize git repository");}}await F(i,{workspaceName:r,silent:a}),console.log(e$1.green(`
|
|
183
|
+
\u2728 Workspace created!
|
|
184
|
+
`)),console.log(e$1.cyan("\u{1F4C2} Location:"),e$1.white(i)),console.log(e$1.cyan("\u2699\uFE0F Configuration:")),console.log(e$1.gray(` \u2022 Profile: ${w}`)),console.log(e$1.gray(" \u2022 Python engine: skipped")),console.log(e$1.gray(" \u2022 Workspace Intelligence: enabled")),console.log(e$1.cyan(`
|
|
185
|
+
\u{1F680} Get started:
|
|
186
|
+
`)),console.log(e$1.white(` ${f$1(i)}`)),console.log(e$1.white(" npx workspai workspace model --json")),console.log(e$1.white(" npx workspai adopt /path/to/project")),console.log(e$1.white(` npx workspai workspace verify --json
|
|
187
|
+
`)),console.log(e$1.cyan(`\u{1F4A1} Add Python-backed kits/modules later:
|
|
188
|
+
`)),console.log(e$1.gray(" npx workspai create project fastapi.standard api --yes")),console.log(e$1.gray(` npx workspai workspace run init
|
|
189
|
+
`));return}catch(R){throw f.fail("Failed to create workspace"),console.error(e$1.red(`
|
|
190
|
+
\u274C Error:`),R),R}}{let f=D(),R=false;try{await execa(f,["--version"],{timeout:5e3}),R=true;}catch{try{await execa("python",["--version"],{timeout:5e3}),R=true;}catch{R=false;}}if(!R){let x=w,v=Ye(w);if($&&!u){console.log(e$1.yellow(`
|
|
191
|
+
\u26A0\uFE0F Python 3.10+ is not detected on this system.
|
|
192
|
+
`)),console.log(e$1.cyan(`You have 3 options:
|
|
193
|
+
`));let{pythonAction:j}=await b$2([{type:"rawlist",name:"pythonAction",message:"What would you like to do?",choices:[{name:"\u{1F4E5} Install Python now (I'll show you the command for your OS)",value:"install"},{name:`\u{1F504} Switch to "${v}" profile (no Python required)`,value:"fallback"},{name:"\u274C Cancel and install Python manually",value:"cancel"}]}]);if(j==="cancel"&&(console.log(e$1.cyan(`
|
|
194
|
+
\u{1F4A1} How to install Python:
|
|
195
|
+
`)),console.log(e$1.white(" Ubuntu / Debian: sudo apt install python3.10")),console.log(e$1.white(" macOS (Homebrew): brew install python@3.10")),console.log(e$1.white(` Windows: https://python.org/downloads
|
|
196
|
+
`)),console.log(e$1.gray(` After installing Python, run: npx workspai ${r}
|
|
197
|
+
`)),process.exit(1)),j==="install"){console.log(e$1.cyan(`
|
|
198
|
+
\u{1F4A1} Install Python on your system:
|
|
199
|
+
`));let A=process.platform;A==="linux"?console.log(e$1.white(` sudo apt update && sudo apt install python3.10 python3.10-venv
|
|
200
|
+
`)):A==="darwin"?console.log(e$1.white(` brew install python@3.10
|
|
201
|
+
`)):A==="win32"&&(console.log(e$1.white(` Download: https://python.org/downloads
|
|
202
|
+
`)),console.log(e$1.white(` Run the installer and check "Add Python to PATH"
|
|
203
|
+
`))),console.log(e$1.gray(` After installing, run: npx workspai ${r}
|
|
204
|
+
`)),process.exit(0);}if(j==="fallback"&&(console.log(e$1.green(`
|
|
205
|
+
\u2705 Switching to "${v}" profile (no Python required).
|
|
206
|
+
`)),w=v,se.has(v))){let A=c$2("Creating workspace",{component:"create",phase:"workspace.python-free"});try{await k.ensureDir(i),A.succeed("Directory created"),await q(i,r,"venv",void 0),await B(i,r,"venv",void 0,v,{profileRequested:x,bootstrapNote:"python-free-fallback"}),await L(i);let ee={"go-only":"Go-only","java-only":"Java-only","dotnet-only":".NET-only","node-only":"Node.js-only",minimal:"Minimal"};if(await k.outputFile(y.join(i,"README.md"),`# ${r}
|
|
207
|
+
|
|
208
|
+
Workspai **${ee[v]}** workspace (switched from ${x} due to missing Python).
|
|
209
|
+
|
|
210
|
+
## Quick start
|
|
211
|
+
|
|
212
|
+
\`\`\`bash
|
|
213
|
+
`+(v==="go-only"?`npx workspai create project gofiber.standard my-api
|
|
214
|
+
cd my-api
|
|
215
|
+
npx workspai init
|
|
216
|
+
npx workspai dev
|
|
217
|
+
`:v==="java-only"?`npx workspai create project springboot.standard my-service
|
|
218
|
+
cd my-service
|
|
219
|
+
npx workspai init
|
|
220
|
+
npx workspai dev
|
|
221
|
+
`:v==="dotnet-only"?`npx workspai create project dotnet.webapi.clean my-api
|
|
222
|
+
cd my-api
|
|
223
|
+
npx workspai init
|
|
224
|
+
npx workspai dev
|
|
225
|
+
`:v==="node-only"?`npx workspai create project nestjs.standard my-app
|
|
226
|
+
cd my-app
|
|
227
|
+
npx workspai init
|
|
228
|
+
npx workspai dev
|
|
229
|
+
`:`npx workspai create project
|
|
230
|
+
cd <project-name>
|
|
231
|
+
npx workspai init
|
|
232
|
+
npx workspai dev
|
|
233
|
+
`)+"```\n","utf-8"),!n){A.start("Initializing git repository");try{await execa("git",["init"],{cwd:i}),await execa("git",["add","."],{cwd:i}),await execa("git",["commit","-m",`Initial commit: Workspai workspace (${v} profile)`],{cwd:i}),A.succeed("Git repository initialized");}catch{A.warn("Could not initialize git repository");}}await F(i,{workspaceName:r,silent:a}),console.log(e$1.green(`
|
|
234
|
+
\u2728 Workspace created with fallback profile!
|
|
235
|
+
`)),console.log(e$1.cyan("\u{1F4C2} Location:"),e$1.white(i)),console.log(e$1.cyan(`
|
|
236
|
+
\u{1F680} Get started:
|
|
237
|
+
`)),console.log(e$1.white(` ${f$1(i)}`)),console.log(e$1.white(" npx workspai create project")),console.log(e$1.white(" cd <project-name>")),console.log(e$1.white(" npx workspai init")),console.log(e$1.white(` npx workspai dev
|
|
238
|
+
`)),console.log(e$1.cyan(`\u{1F4A1} To use Python later:
|
|
239
|
+
`)),console.log(e$1.gray(" 1. Install Python 3.10+")),console.log(e$1.gray(` 2. Run: workspai bootstrap --profile ${x}
|
|
240
|
+
`)),console.log("");return}catch(ee){throw A.fail("Failed to create workspace"),console.error(e$1.red(`
|
|
241
|
+
\u274C Error:`),ee),ee}}}else if(console.log(e$1.yellow(`
|
|
242
|
+
\u26A0\uFE0F Python not detected. Auto-switching to "${v}" profile (no Python required).
|
|
243
|
+
`)),w=v,se.has(v)){let j=c$2("Creating workspace",{component:"create",phase:"workspace.python-free"});try{if(await k.ensureDir(i),j.succeed("Directory created"),await q(i,r,"venv",void 0),await B(i,r,"venv",void 0,v,{profileRequested:x,bootstrapNote:"python-free-fallback"}),await L(i),!n){j.start("Initializing git repository");try{await execa("git",["init"],{cwd:i}),await execa("git",["add","."],{cwd:i}),await execa("git",["commit","-m",`Initial commit: Workspai workspace (${v})`],{cwd:i}),j.succeed("Git repository initialized");}catch{j.warn("Could not initialize git repository");}}await F(i,{workspaceName:r,silent:a}),console.log(e$1.green(`
|
|
244
|
+
\u2728 Workspace created (auto-fallback profile)!
|
|
245
|
+
`)),console.log(e$1.cyan("\u{1F4C2} Location:"),e$1.white(i)),console.log(e$1.cyan("\u{1F4E6} Profile:"),e$1.yellow(v)),console.log(e$1.cyan("\u{1F4A1} Reason:"),e$1.gray(`Python not detected; switched from ${x}`)),console.log(e$1.cyan(`
|
|
246
|
+
\u{1F680} Get started:
|
|
247
|
+
`)),console.log(e$1.white(` ${f$1(i)}`)),console.log(e$1.white(" npx workspai create project")),console.log(e$1.white(" cd <project-name>")),console.log(e$1.white(" npx workspai init")),console.log(e$1.white(` npx workspai dev
|
|
248
|
+
`)),console.log(e$1.cyan(`\u{1F4A1} Add Python later:
|
|
249
|
+
`)),console.log(e$1.gray(" 1. Install Python 3.10+")),console.log(e$1.gray(` 2. Run: ${f$1(i)} && workspai bootstrap --profile ${x}
|
|
250
|
+
`)),console.log("");return}catch(A){throw j.fail("Failed to create workspace"),console.error(e$1.red(`
|
|
251
|
+
\u274C Error:`),A),A}}}}f.step(1,3,"Setting up Workspai environment");let _=c$2("Creating directory",{component:"create",phase:"workspace.directory"});try{await k.ensureDir(i),_.succeed("Directory created"),_.start("Detecting Python version");let f$2=null,R=await We(I.pythonVersion);if(R)f$2=await _e(R),f$2?(f.info(` Detected Python ${f$2}`),_.succeed(`Python ${f$2} detected`)):_.warn("Could not detect exact Python version");else {let x=D();f$2=await _e(x),f$2?_.succeed(`Python ${f$2} detected`):_.warn("Could not detect Python version, proceeding with defaults");}if(I.installMethod==="poetry"&&!await Oe()&&(_.warn("Poetry not found \u2014 auto-fallback to pip + venv"),I.installMethod="venv"),await q(i,r,I.installMethod,f$2||void 0),f$2&&await qe(i,f$2),await B(i,r,I.installMethod,f$2||I.pythonVersion,w||g),await L(i),await je(i,r),I.installMethod==="poetry")try{await Fe(i,I.pythonVersion,_,a,p,u);}catch(x){let v=x?.details||x?.message||String(x);if(v.includes("pyenv")||v.includes("exit status 127")||v.includes("returned non-zero exit status 127")){_.warn("Poetry encountered Python discovery issues, trying venv method"),f.debug(`Poetry error (attempting venv fallback): ${v}`);try{await we(i,I.pythonVersion,_,a,p),I.installMethod="venv";}catch(j){throw j}}else throw x}else I.installMethod==="venv"?await we(i,I.pythonVersion,_,a,p):await Ve(i,_,a,p,u);if(await he(i,I.installMethod),await Le(i,I.installMethod),_.succeed("Workspai environment ready!"),!o.skipGit){_.start("Initializing git repository");try{await execa("git",["init"],{cwd:i}),await execa("git",["add","."],{cwd:i}),await execa("git",["commit","-m","Initial commit: Workspai environment"],{cwd:i}),_.succeed("Git repository initialized");}catch{_.warn("Could not initialize git repository");}}if(await F(i,{workspaceName:r,silent:a}),console.log(e$1.green(`
|
|
252
|
+
\u2728 Workspai environment created successfully!
|
|
253
|
+
`)),console.log(e$1.cyan("\u{1F4C2} Location:"),e$1.white(i)),console.log(e$1.cyan("\u2699\uFE0F Configuration:")),console.log(e$1.gray(` \u2022 Profile: ${w}`)),console.log(e$1.gray(` \u2022 Python: ${I.pythonVersion}`)),console.log(e$1.gray(` \u2022 Install method: ${I.installMethod}`)),console.log(e$1.cyan(`
|
|
254
|
+
\u{1F680} Get started:
|
|
255
|
+
`)),console.log(e$1.white(` ${f$1(i)}`)),I.installMethod==="poetry"){let x="source $(poetry env info --path)/bin/activate";try{H();let{stdout:v}=await execa("poetry",["--version"]),T=v.match(/Poetry.*?(\d+)\.(\d+)/);T&&(parseInt(T[1])>=2?x="source $(poetry env info --path)/bin/activate":x="poetry shell");}catch{}console.log(e$1.white(` ${x} # Or: poetry run rapidkit`)),console.log(e$1.white(" workspai create # Interactive mode")),console.log(e$1.white(" cd <project-name>")),console.log(e$1.white(" workspai init")),console.log(e$1.white(" workspai dev")),console.log(e$1.gray(`
|
|
256
|
+
\u{1F4E6} Why Poetry? Includes dependency management + virtual environment`));}else I.installMethod==="venv"?(console.log(e$1.white(" source .venv/bin/activate # On Windows: .venv\\Scripts\\activate")),console.log(e$1.white(" workspai create # Interactive mode")),console.log(e$1.white(" cd <project-name>")),console.log(e$1.white(" workspai init")),console.log(e$1.white(" workspai dev")),console.log(e$1.gray(`
|
|
257
|
+
\u{1F4E6} Why venv? Standard, zero extra tools, lightweight`))):(console.log(e$1.white(" workspai create # Interactive mode")),console.log(e$1.white(" cd <project-name>")),console.log(e$1.white(" workspai init")),console.log(e$1.white(" workspai dev")),console.log(e$1.gray(`
|
|
258
|
+
\u{1F4E6} Why pipx? Global isolated install, no local venv`)));console.log(e$1.cyan(`
|
|
259
|
+
\u{1F4DA} Next steps:`)),console.log(e$1.gray(" 1. Check README.md for workspace details")),console.log(e$1.gray(" 2. Create your first project: workspai create project")),console.log(e$1.gray(" 3. See all runtimes: workspai list # Shows: fastapi, nestjs, springboot, gofiber, gogin, dotnet")),console.log(e$1.cyan(`
|
|
260
|
+
\u{1F4A1} Profile management:`)),console.log(e$1.gray(" \u2022 Add Python? \u2192 workspai bootstrap --profile python-only|polyglot")),console.log(e$1.gray(" \u2022 Add Node.js? \u2192 workspai bootstrap --profile node-only|polyglot")),console.log(e$1.gray(" \u2022 Add Go? \u2192 workspai bootstrap --profile go-only|polyglot")),console.log(e$1.gray(" \u2022 Add .NET? \u2192 workspai bootstrap --profile dotnet-only|polyglot")),console.log(e$1.gray(" \u2022 Full setup? \u2192 workspai bootstrap --profile enterprise")),console.log(e$1.cyan(`
|
|
261
|
+
\u{1F4D6} Common commands:`)),console.log(e$1.white(" workspai create - Create a new project (interactive)")),console.log(e$1.white(" workspai list - List available kits")),console.log(e$1.white(" workspai modules - List available modules")),console.log(e$1.white(" workspai doctor - Check workspace health")),console.log(e$1.white(` workspai bootstrap --help - Advanced workspace configuration
|
|
262
|
+
`));try{let{stdout:x}=await execa("go",["version"],{timeout:3e3}),v=x.match(/go version go(\d+\.\d+(?:\.\d+)?)/),T=v?v[1]:"unknown";console.log(e$1.gray(`\u{1F439} Go ${T} detected \u2014 ready for gofiber.standard projects`));}catch{console.log(e$1.yellow("\u26A0\uFE0F Go not installed \u2014 needed for gofiber.standard/gogin.standard projects")),console.log(e$1.gray(" Install: https://go.dev/dl/"));}console.log("");}catch(f){_.fail("Failed to create Workspai environment"),console.error(e$1.red(`
|
|
263
|
+
\u274C Error:`),f);try{await k.remove(i);}catch{}throw f}}async function We(t){let o=[];if(!b$3())try{let{stdout:l}=await execa("pyenv",["which","python"]),d=l.trim();d&&o.push(d);}catch{}let n=Number(t.split(".")[1]),s=j(n,10).map(l=>l.command).filter(Boolean);o.push(`python${t}`,...s,...i());let a=[...new Set(o)];for(let l of a)try{let d=l==="py"?["-3","--version"]:["--version"],u=l==="py"?["-3","-c","import sys; sys.exit(0)"]:["-c","import sys; sys.exit(0)"],{stdout:p}=await execa(l,d,{timeout:2e3}),h=p.match(/Python (\d+\.\d+)/)?.[1];if(h&&J(h,t))return await execa(l,u,{timeout:2e3}),l}catch{continue}return null}async function Fe(t,o,n,s,a,l$1=false){await Ze(n,l$1),n.start("Finding Python interpreter");let d=await We(o);d?(f.debug(`Found working Python: ${d}`),n.succeed("Python found")):n.warn("Could not verify Python path, proceeding with default"),n.start("Initializing Poetry project");let u=y.join(t,"pyproject.toml"),h=(await k.pathExists(u)?await promises.readFile(u,"utf-8"):"").includes("rapidkit-core");if(h)n.succeed("Poetry project initialized");else {await execa("poetry",["init","--no-interaction","--python",`^${o}`],{cwd:t}),n.succeed("Poetry project initialized");let i=await promises.readFile(u,"utf-8");i.includes("[tool.poetry]")?i=i.replace("[tool.poetry]",`[tool.poetry]
|
|
264
|
+
package-mode = false`):i.includes("[project]")&&(i.includes("[build-system]")?i=i.replace("[build-system]",`
|
|
265
|
+
[tool.poetry]
|
|
266
|
+
package-mode = false
|
|
267
|
+
|
|
268
|
+
[build-system]`):i+=`
|
|
269
|
+
|
|
270
|
+
[tool.poetry]
|
|
271
|
+
package-mode = false
|
|
272
|
+
`),await promises.writeFile(u,i,"utf-8");}n.start("Configuring Poetry");try{await execa("poetry",["config","virtualenvs.in-project","true","--local"],{cwd:t}),n.succeed("Poetry configured");}catch{n.warn("Could not configure Poetry virtualenvs.in-project");}n.start("Creating virtualenv");let g$1=d||D(),m=l(y.join(t,".venv"));try{await execa(g$1,["-m","venv",".venv"],{cwd:t,timeout:6e4}),n.succeed("Virtualenv created");}catch(r){f.debug(`python -m venv failed: ${r}`),n.warn("Could not pre-create virtualenv, Poetry will try"),m=d||D();}try{await execa("poetry",["env","use",m||D()],{cwd:t}),f.debug(`Poetry env set to: ${m}`);}catch(r){f.debug(`Could not set Poetry env: ${r}`);}if(n.start("Installing RapidKit"),h&&!s){let r=e$2(a||{}),i=r?await k.pathExists(r):false,P=i&&r?r:"rapidkit-core";r&&!i&&f.warn(`WORKSPAI_DEV_PATH/RAPIDKIT_DEV_PATH points to a path that does not exist: ${r}. Falling back to PyPI.`),n.text=i?"Installing RapidKit from local path":"Installing RapidKit from PyPI";let w=false,$=null;for(let E=1;E<=3;E++)try{i||e$3({status:"started",message:"Installing RapidKit from PyPI",installMethod:"poetry",attempt:E,maxAttempts:3}),await execa(m,["-m","pip","install",P,"--quiet"],{cwd:t,timeout:18e4}),w=true,i||e$3({status:"succeeded",message:"RapidKit installed from PyPI",installMethod:"poetry",attempt:E,maxAttempts:3});break}catch(O){$=O,f.debug(`pip install rapidkit-core attempt ${E} failed: ${O}`),E<3&&(n.text=`Retrying installation (attempt ${E+1}/3)`,await new Promise(ae=>setTimeout(ae,2e3)));}if(!w){let E=$?.stderr||$?.message||"Unknown error";throw f.debug(`All pip install attempts failed. Last error: ${E}`),E.includes("Could not find")||E.includes("No matching distribution")?new g:new f$2("Install rapidkit-core with pip",new Error(`Failed to install rapidkit-core after 3 attempts.
|
|
273
|
+
Error: ${E}
|
|
274
|
+
|
|
275
|
+
Possible solutions:
|
|
276
|
+
1. Check your internet connection
|
|
277
|
+
2. Try installing manually: cd ${y.basename(t)} && poetry add rapidkit-core
|
|
278
|
+
3. Use venv method instead: npx workspai ${y.basename(t)} --install-method=venv`))}}else {n.text="Syncing Poetry environment";try{await execa("poetry",["install","--no-root"],{cwd:t,timeout:12e4}),n.succeed("Poetry environment synced");}catch(r){f.debug(`poetry install --no-root failed: ${r}`),n.warn("Could not sync Poetry environment, proceeding with add command");}if(n.start("Installing RapidKit"),s){let r=e$2(a||{});if(!r)throw new f$2("Test mode installation",new Error("No local RapidKit path configured. Set WORKSPAI_DEV_PATH (or legacy RAPIDKIT_DEV_PATH)."));f.debug(`Installing from local path: ${r}`),n.text="Installing RapidKit from local path (test mode)",await execa("poetry",["add",r],{cwd:t});}else {n.text="Installing RapidKit from PyPI";let r=false,i=null;for(let P=1;P<=3;P++)try{e$3({status:"started",message:"Installing RapidKit from PyPI",installMethod:"poetry",attempt:P,maxAttempts:3}),await execa("poetry",["add","rapidkit-core"],{cwd:t,timeout:6e4*P}),r=true,e$3({status:"succeeded",message:"RapidKit installed from PyPI",installMethod:"poetry",attempt:P,maxAttempts:3});break}catch(w){i=w,f.debug(`Poetry add attempt ${P} failed: ${w}`),P<3&&(n.text=`Retrying installation (attempt ${P+1}/3)`,await new Promise($=>setTimeout($,2e3)));}if(!r){let P=i?.stderr||i?.message||"Unknown error";throw f.debug(`All Poetry install attempts failed. Last error: ${P}`),P.includes("Could not find")||P.includes("No matching distribution")?new g:new f$2("Install rapidkit-core with Poetry",new Error(`Failed to install rapidkit-core after 3 attempts.
|
|
279
|
+
Error: ${P}
|
|
280
|
+
|
|
281
|
+
Possible solutions:
|
|
282
|
+
1. Check your internet connection
|
|
283
|
+
2. Try installing manually: cd ${y.basename(t)} && poetry add rapidkit-core
|
|
284
|
+
3. Use venv method instead: npx workspai ${y.basename(t)} --install-method=venv`))}}}n.succeed("RapidKit installed in project virtualenv");try{let{checkRapidkitCoreAvailable:r}=await import('./pythonRapidkitExec-3L3XJBSY.js');if(!await r()&&!s){n.start("Checking optional global pipx installation");let P=await ie(n,true);try{n.start("Installing RapidKit globally with pipx for CLI access"),await G(P,["install","rapidkit-core"]),n.succeed("RapidKit installed globally");}catch(w){n.warn("Could not install globally (non-fatal, project virtualenv has RapidKit)"),f.debug(`pipx install failed: ${w}`);}}}catch(r){n.succeed("Skipped optional global pipx installation"),f.debug(`Global install check skipped: ${r}`);}}async function we(t,o,n,s,a,l$1=false){n.start(`Checking Python ${o}`);let d=D();try{let{stdout:p}=await execa(d,["--version"]),h=p.match(/Python (\d+\.\d+)/)?.[1];if(h&&!J(h,o))throw new b$4(o,h);n.succeed(`Python ${h} found`);}catch(p){throw p instanceof b$4?p:new b$4(o)}n.start("Creating virtual environment");try{await execa(d,["-m","venv",".venv"],{cwd:t}),n.succeed("Virtual environment created");}catch(p){if(n.fail("Failed to create virtual environment"),(g=>typeof g=="object"&&g!==null&&"stdout"in g&&typeof g.stdout=="string")(p)&&p.stdout.includes("ensurepip is not")){let g=p.stdout.match(/apt install (python[\d.]+-venv)/),m=g?g[1]:"python3-venv";throw new f$2("Python venv module not available",new Error(`Virtual environment creation failed.
|
|
285
|
+
|
|
286
|
+
On Debian/Ubuntu systems, install the venv package:
|
|
287
|
+
sudo apt install ${m}
|
|
288
|
+
|
|
289
|
+
Or use Poetry instead (recommended):
|
|
290
|
+
npx workspai ${y.basename(t)} --yes`))}throw new f$2("Virtual environment creation",p instanceof Error?p:new Error(String(p)))}n.start("Installing RapidKit");let u=l(y.join(t,".venv"));if(await execa(u,["-m","pip","install","--upgrade","pip"],{cwd:t}),s){let p=e$2(a||{});if(!p)throw new f$2("Test mode installation",new Error("No local RapidKit path configured. Set WORKSPAI_DEV_PATH (or legacy RAPIDKIT_DEV_PATH)."));f.debug(`Installing from local path: ${p}`),n.text="Installing RapidKit from local path (test mode)",await execa(u,["-m","pip","install","-e",p],{cwd:t});}else {n.text="Installing RapidKit from PyPI";let p=false,h=null;for(let g=1;g<=3;g++)try{e$3({status:"started",message:"Installing RapidKit from PyPI",installMethod:"venv",attempt:g,maxAttempts:3}),await execa(u,["-m","pip","install","rapidkit-core"],{cwd:t,timeout:6e4*g}),p=true,e$3({status:"succeeded",message:"RapidKit installed from PyPI",installMethod:"venv",attempt:g,maxAttempts:3});break}catch(m){h=m,f.debug(`pip install attempt ${g} failed: ${m}`),g<3&&(n.text=`Retrying installation (attempt ${g+1}/3)`,await new Promise(r=>setTimeout(r,2e3)));}if(!p){let g$1=h?.stderr||h?.message||"Unknown error";throw f.debug(`All pip install attempts failed. Last error: ${g$1}`),g$1.includes("Could not find")||g$1.includes("No matching distribution")?new g:new f$2("Install rapidkit-core with pip",new Error(`Failed to install rapidkit-core after 3 attempts.
|
|
291
|
+
Error: ${g$1}
|
|
292
|
+
|
|
293
|
+
Possible solutions:
|
|
294
|
+
1. Check your internet connection
|
|
295
|
+
2. Try installing manually: cd ${y.basename(t)} && ${l(".venv")} -m pip install rapidkit-core
|
|
296
|
+
3. Use Poetry instead: npx workspai ${y.basename(t)} --install-method=poetry`))}}n.succeed("RapidKit installed in project virtualenv");try{let{checkRapidkitCoreAvailable:p}=await import('./pythonRapidkitExec-3L3XJBSY.js');if(!await p()&&!s){n.start("Checking optional global pipx installation");let g=await ie(n,true);try{n.start("Installing RapidKit globally with pipx for CLI access"),await G(g,["install","rapidkit-core"]),n.succeed("RapidKit installed globally");}catch(m){n.warn("Could not install globally (non-fatal, project virtualenv has RapidKit)"),f.debug(`pipx install failed: ${m}`);}}}catch(p){n.succeed("Skipped optional global pipx installation"),f.debug(`Global install check skipped: ${p}`);}}async function Ve(t,o,n,s,a=false){if(!n)try{let{checkRapidkitCoreVersionCompatible:d}=await import('./pythonRapidkitExec-3L3XJBSY.js'),u=await d();if(u.isCompatible){o.succeed(`RapidKit ${u.installedVersion??""} already compatible globally; skipping pipx installation`),await k.outputFile(y.join(t,".rapidkit-global"),`RapidKit already available globally (version ${u.installedVersion??"unknown"}) and satisfies expected constraint ${u.expectedConstraint??"n/a"}; workspace will reuse the existing installation
|
|
297
|
+
`,"utf-8");return}u.reason==="constraint-missing"?o.warn('Version-aware global reuse skipped: no explicit rapidkit-core version constraint found. Set RAPIDKIT_CORE_PYTHON_PACKAGE (example: RAPIDKIT_CORE_PYTHON_PACKAGE="rapidkit-core>=0.4.0,<0.9.0") to enable version-aware reuse. Proceeding with pipx install/upgrade.'):u.reason==="constraint-unsupported"&&o.warn('Version-aware global reuse skipped: RAPIDKIT_CORE_PYTHON_PACKAGE uses an unsupported spec (path/url/git). Use a version range instead (example: RAPIDKIT_CORE_PYTHON_PACKAGE="rapidkit-core==0.4.0" or "rapidkit-core>=0.4.0,<0.9.0"). Proceeding with pipx install/upgrade.'),f.debug(`Global RapidKit install is not reusable via version-aware policy (reason=${u.reason}, installed=${u.installedVersion??"unknown"}, expected=${u.expectedConstraint??"none"}). Proceeding with pipx install/upgrade.`);}catch(d){f.debug(`Global RapidKit version-aware check failed before pipx install: ${d}`);}let l=await ie(o,a);if(o.start("Installing RapidKit globally with pipx"),n){let d=e$2(s||{});if(!d)throw new f$2("Test mode installation",new Error("No local RapidKit path configured. Set WORKSPAI_DEV_PATH (or legacy RAPIDKIT_DEV_PATH)."));f.debug(`Installing from local path: ${d}`),o.text="Installing RapidKit from local path (test mode)",await G(l,["install","-e",d]);}else {o.text="Installing RapidKit from PyPI",e$3({status:"started",message:"Installing RapidKit from PyPI",installMethod:"pipx"});try{await G(l,["install","rapidkit-core"]),e$3({status:"succeeded",message:"RapidKit installed from PyPI",installMethod:"pipx"});}catch(d){try{o.text="RapidKit already installed globally, upgrading to match expected version",await G(l,["upgrade","rapidkit-core"]),e$3({status:"succeeded",message:"RapidKit upgraded from PyPI",installMethod:"pipx"});}catch(u){throw f.debug(`pipx install/upgrade failed: install=${d}, upgrade=${u}`),new g}}}o.succeed("RapidKit installed globally"),await k.outputFile(y.join(t,".rapidkit-global"),`RapidKit installed globally with pipx
|
|
298
|
+
`,"utf-8");}async function At(t,o){let{skipGit:n=false,testMode:s=false,userConfig:a={},yes:l=false,installMethod:d,pythonVersion:u="3.10"}=o||{},p=d||a.defaultInstallMethod||await(async()=>{try{return await execa("poetry",["--version"],{timeout:3e3}),"poetry"}catch{return f.warn("Poetry not found \u2014 auto-selecting venv. Pass --install-method poetry to override."),"venv"}})(),h=p==="poetry"&&!await Oe()?"venv":p;await q(t,y.basename(t),h),await L(t),await B(t,y.basename(t),h,u,o?.profile);let g=c$2("Registering workspace",{component:"create",phase:"workspace.register"});try{if(h==="poetry"?(await je(t,y.basename(t)),await Fe(t,u,g,s,a,l)):h==="venv"?await we(t,u,g,s,a):await Ve(t,g,s,a,l),await he(t,h),await Le(t,h),g.succeed("Workspace registered"),await F(t,{workspaceName:y.basename(t),silent:s}),!n){g.start("Initializing git repository");try{await execa("git",["init"],{cwd:t}),await execa("git",["add","."],{cwd:t}),await execa("git",["commit","-m","Initial commit: Workspai workspace"],{cwd:t}),g.succeed("Git repository initialized");}catch{g.warn("Could not initialize git repository");}}}catch(m){throw g.fail("Failed to register workspace"),m}}async function Le(t,o){let n=o==="poetry"?`source $(poetry env info --path)/bin/activate
|
|
299
|
+
# Or simply use: poetry run rapidkit <command>`:o==="venv"?"source .venv/bin/activate # On Windows: .venv\\Scripts\\activate":"N/A (globally installed)",s=o==="poetry"?`# No activation needed (recommended):
|
|
300
|
+
./rapidkit --help
|
|
301
|
+
# or:
|
|
302
|
+
poetry run rapidkit --help`:o==="venv"?`# No activation needed (recommended):
|
|
303
|
+
./rapidkit --help
|
|
304
|
+
# or direct:
|
|
305
|
+
./.venv/bin/rapidkit --help`:`# Optional: use the local launcher
|
|
306
|
+
./rapidkit --help
|
|
307
|
+
# (pipx installs may require Poetry/venv to be present in this folder)`,a=b$3()?"python --version (or: py -3 --version)":"python3 --version (or: python --version)",l=`# Workspai Workspace
|
|
308
|
+
|
|
309
|
+
This directory contains a Workspai development environment.
|
|
310
|
+
|
|
311
|
+
## Installation Method
|
|
312
|
+
|
|
313
|
+
**${o==="poetry"?"Poetry":o==="venv"?"Python venv + pip":"pipx (global)"}**
|
|
314
|
+
|
|
315
|
+
## Getting Started
|
|
316
|
+
|
|
317
|
+
### 0. Run Without Activation (Recommended)
|
|
318
|
+
|
|
319
|
+
This workspace includes a local launcher script so you can run the Python Core CLI without activating the environment:
|
|
320
|
+
|
|
321
|
+
\`\`\`bash
|
|
322
|
+
${s}
|
|
323
|
+
\`\`\`
|
|
324
|
+
|
|
325
|
+
### 1. Activate Environment
|
|
326
|
+
|
|
327
|
+
\`\`\`bash
|
|
328
|
+
${n}
|
|
329
|
+
\`\`\`
|
|
330
|
+
|
|
331
|
+
### 2. Create Your First Project
|
|
332
|
+
|
|
333
|
+
\`\`\`bash
|
|
334
|
+
# Interactive mode (recommended):
|
|
335
|
+
workspai create
|
|
336
|
+
# Follow the prompts to choose kit and project name
|
|
337
|
+
|
|
338
|
+
# Or specify directly:
|
|
339
|
+
workspai create project fastapi.standard my-project
|
|
340
|
+
|
|
341
|
+
# Advanced / Python Core only:
|
|
342
|
+
poetry run rapidkit --help
|
|
343
|
+
\`\`\`
|
|
344
|
+
|
|
345
|
+
Interactive mode will guide you through selecting a kit and configuring your project.
|
|
346
|
+
|
|
347
|
+
### 3. Navigate and Run
|
|
348
|
+
|
|
349
|
+
\`\`\`bash
|
|
350
|
+
cd my-project
|
|
351
|
+
# Install dependencies (preferred):
|
|
352
|
+
workspai init
|
|
353
|
+
|
|
354
|
+
# Run the server (project-aware):
|
|
355
|
+
workspai dev
|
|
356
|
+
|
|
357
|
+
# Direct Python Core entrypoint (advanced / only when rapidkit-core is installed in Poetry):
|
|
358
|
+
poetry run rapidkit dev
|
|
359
|
+
|
|
360
|
+
# Or manually:
|
|
361
|
+
uvicorn src.main:app --reload
|
|
362
|
+
\`\`\`
|
|
363
|
+
|
|
364
|
+
### 4. Add Modules (Optional)
|
|
365
|
+
|
|
366
|
+
\`\`\`bash
|
|
367
|
+
# Add common modules to your project:
|
|
368
|
+
workspai add module settings
|
|
369
|
+
workspai add module logging
|
|
370
|
+
workspai add module database
|
|
371
|
+
|
|
372
|
+
# List available modules:
|
|
373
|
+
workspai modules list
|
|
374
|
+
\`\`\`
|
|
375
|
+
|
|
376
|
+
## Available Commands
|
|
377
|
+
|
|
378
|
+
- \`workspai create\` - Create a new project (interactive)
|
|
379
|
+
- \`workspai create project <kit> <name>\` - Create project with specific kit
|
|
380
|
+
- \`workspai dev\` - Run development server
|
|
381
|
+
- \`workspai add module <name>\` - Add a module (e.g., \`workspai add module settings\`)
|
|
382
|
+
- \`workspai list\` - List available kits
|
|
383
|
+
- \`workspai modules\` - List available modules
|
|
384
|
+
- \`workspai upgrade\` - Upgrade project templates
|
|
385
|
+
- \`workspai doctor\` - Check system requirements
|
|
386
|
+
- \`workspai --help\` - Show all commands
|
|
387
|
+
|
|
388
|
+
## Workspai Documentation
|
|
389
|
+
|
|
390
|
+
For full documentation, visit: [Workspai Docs](https://workspai.dev/docs)
|
|
391
|
+
|
|
392
|
+
## Workspace Structure
|
|
393
|
+
|
|
394
|
+
\`\`\`
|
|
395
|
+
${o==="venv"?".venv/ # Python virtual environment":""}
|
|
396
|
+
${o==="poetry"?"pyproject.toml # Poetry configuration":""}
|
|
397
|
+
my-project/ # Your Workspai projects go here
|
|
398
|
+
README.md # This file
|
|
399
|
+
\`\`\`
|
|
400
|
+
|
|
401
|
+
## Troubleshooting
|
|
402
|
+
|
|
403
|
+
If you encounter issues:
|
|
404
|
+
|
|
405
|
+
1. Ensure Python 3.10+ is installed: \`${a}\`
|
|
406
|
+
2. Check Workspai installation: \`workspai --version\`
|
|
407
|
+
3. Run diagnostics: \`workspai doctor\`
|
|
408
|
+
4. Visit Workspai documentation or GitHub issues
|
|
409
|
+
`;await promises.writeFile(y.join(t,"README.md"),l,"utf-8");}async function ot(t,o,n){let s=c$2("Creating demo workspace",{component:"create",phase:"workspace.demo"});try{await k.ensureDir(t),s.succeed("Directory created"),s.start("Setting up demo kit generator");let a=JSON.stringify({name:`${o}-workspace`,version:"1.0.0",private:true,description:"Workspai demo workspace",scripts:{generate:"node generate-demo.js"}},null,2);await promises.writeFile(y.join(t,"package.json"),a,"utf-8"),await promises.writeFile(y.join(t,"generate-demo.js"),`#!/usr/bin/env node
|
|
410
|
+
/**
|
|
411
|
+
* Demo Kit Generator - Create FastAPI demo projects
|
|
412
|
+
*
|
|
413
|
+
* This workspace contains bundled Workspai templates that you can use
|
|
414
|
+
* to generate demo projects without installing Python RapidKit Core.
|
|
415
|
+
*
|
|
416
|
+
* Usage:
|
|
417
|
+
* npm run generate <project-name>
|
|
418
|
+
* node generate-demo.js <project-name>
|
|
419
|
+
*
|
|
420
|
+
* Example:
|
|
421
|
+
* npm run generate my-api
|
|
422
|
+
*/
|
|
423
|
+
|
|
424
|
+
const fs = require('fs');
|
|
425
|
+
const path = require('path');
|
|
426
|
+
const readline = require('readline');
|
|
427
|
+
|
|
428
|
+
const projectName = process.argv[2];
|
|
429
|
+
|
|
430
|
+
if (!projectName) {
|
|
431
|
+
console.error('\\n\u274C Please provide a project name');
|
|
432
|
+
console.log('\\nUsage: npm run generate <project-name>\\n');
|
|
433
|
+
console.log('Example: npm run generate my-api\\n');
|
|
434
|
+
process.exit(1);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
const rl = readline.createInterface({
|
|
438
|
+
input: process.stdin,
|
|
439
|
+
output: process.stdout
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
function ask(question, defaultValue) {
|
|
443
|
+
return new Promise((resolve) => {
|
|
444
|
+
rl.question(\`\${question} (\${defaultValue}): \`, (answer) => {
|
|
445
|
+
resolve(answer || defaultValue);
|
|
446
|
+
});
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
async function main() {
|
|
451
|
+
const targetPath = path.join(process.cwd(), projectName);
|
|
452
|
+
|
|
453
|
+
if (fs.existsSync(targetPath)) {
|
|
454
|
+
console.error(\`\\n\u274C Directory "\${projectName}" already exists\\n\`);
|
|
455
|
+
process.exit(1);
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
console.log(\`\\n\u{1F680} Creating FastAPI project: \${projectName}\\n\`);
|
|
459
|
+
|
|
460
|
+
const snakeName = projectName.replace(/-/g, '_').toLowerCase();
|
|
461
|
+
const project_name = await ask('Project name (snake_case)', snakeName);
|
|
462
|
+
const author = await ask('Author name', process.env.USER || 'Workspai User');
|
|
463
|
+
const description = await ask('Description', 'FastAPI service generated with Workspai');
|
|
464
|
+
|
|
465
|
+
rl.close();
|
|
466
|
+
|
|
467
|
+
// Create project structure
|
|
468
|
+
const dirs = [
|
|
469
|
+
'',
|
|
470
|
+
'src',
|
|
471
|
+
'src/routing',
|
|
472
|
+
'src/modules',
|
|
473
|
+
'tests',
|
|
474
|
+
'.workspai'
|
|
475
|
+
];
|
|
476
|
+
|
|
477
|
+
for (const dir of dirs) {
|
|
478
|
+
fs.mkdirSync(path.join(targetPath, dir), { recursive: true });
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
// Template files with content
|
|
482
|
+
const files = {
|
|
483
|
+
'src/__init__.py': '"""' + project_name + ' package."""\\n',
|
|
484
|
+
'src/modules/__init__.py': '"""Modules package."""\\n',
|
|
485
|
+
'tests/__init__.py': '"""Tests package."""\\n',
|
|
486
|
+
'src/main.py': \`"""\${project_name} application entrypoint."""
|
|
487
|
+
|
|
488
|
+
from __future__ import annotations
|
|
489
|
+
|
|
490
|
+
from contextlib import asynccontextmanager
|
|
491
|
+
from typing import AsyncIterator
|
|
492
|
+
|
|
493
|
+
from fastapi import FastAPI
|
|
494
|
+
from fastapi.middleware.cors import CORSMiddleware
|
|
495
|
+
|
|
496
|
+
from .routing import api_router
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
@asynccontextmanager
|
|
500
|
+
async def lifespan(app: FastAPI) -> AsyncIterator[None]:
|
|
501
|
+
"""Application lifespan context manager for startup/shutdown events."""
|
|
502
|
+
yield
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
app = FastAPI(
|
|
506
|
+
title="\${project_name}",
|
|
507
|
+
description="\${description}",
|
|
508
|
+
version="0.1.0",
|
|
509
|
+
docs_url="/docs",
|
|
510
|
+
redoc_url="/redoc",
|
|
511
|
+
lifespan=lifespan,
|
|
512
|
+
)
|
|
513
|
+
|
|
514
|
+
app.add_middleware(
|
|
515
|
+
CORSMiddleware,
|
|
516
|
+
allow_origins=["*"],
|
|
517
|
+
allow_credentials=True,
|
|
518
|
+
allow_methods=["*"],
|
|
519
|
+
allow_headers=["*"],
|
|
520
|
+
)
|
|
521
|
+
|
|
522
|
+
app.include_router(api_router, prefix="/api")
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
if __name__ == "__main__":
|
|
526
|
+
import uvicorn
|
|
527
|
+
uvicorn.run("src.main:app", host="0.0.0.0", port=8001, reload=True)
|
|
528
|
+
\`,
|
|
529
|
+
'src/routing/__init__.py': \`"""API routing configuration."""
|
|
530
|
+
|
|
531
|
+
from fastapi import APIRouter
|
|
532
|
+
|
|
533
|
+
from .health import router as health_router
|
|
534
|
+
|
|
535
|
+
api_router = APIRouter()
|
|
536
|
+
|
|
537
|
+
api_router.include_router(health_router)
|
|
538
|
+
\`,
|
|
539
|
+
'src/routing/health.py': \`"""Health check endpoints."""
|
|
540
|
+
|
|
541
|
+
from __future__ import annotations
|
|
542
|
+
|
|
543
|
+
from fastapi import APIRouter
|
|
544
|
+
|
|
545
|
+
router = APIRouter(prefix="/health", tags=["health"])
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
@router.get("/", summary="Health check")
|
|
549
|
+
async def heartbeat() -> dict[str, str]:
|
|
550
|
+
"""Return basic service heartbeat."""
|
|
551
|
+
return {"status": "ok"}
|
|
552
|
+
\`,
|
|
553
|
+
'src/cli.py': \`"""CLI commands for \${project_name}."""
|
|
554
|
+
|
|
555
|
+
import subprocess
|
|
556
|
+
import sys
|
|
557
|
+
from pathlib import Path
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
def dev():
|
|
561
|
+
"""Start development server with hot reload."""
|
|
562
|
+
print("\u{1F680} Starting development server...")
|
|
563
|
+
subprocess.run([
|
|
564
|
+
sys.executable, "-m", "uvicorn",
|
|
565
|
+
"src.main:app", "--reload",
|
|
566
|
+
"--host", "0.0.0.0", "--port", "8000"
|
|
567
|
+
])
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
def start():
|
|
571
|
+
"""Start production server."""
|
|
572
|
+
print("\u26A1 Starting production server...")
|
|
573
|
+
subprocess.run([
|
|
574
|
+
sys.executable, "-m", "uvicorn",
|
|
575
|
+
"src.main:app",
|
|
576
|
+
"--host", "0.0.0.0", "--port", "8000"
|
|
577
|
+
])
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
def test():
|
|
581
|
+
"""Run tests."""
|
|
582
|
+
print("\u{1F9EA} Running tests...")
|
|
583
|
+
subprocess.run([sys.executable, "-m", "pytest", "-q"])
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
if __name__ == "__main__":
|
|
587
|
+
if len(sys.argv) < 2:
|
|
588
|
+
print("Usage: python -m src.cli <command>")
|
|
589
|
+
print("Commands: dev, start, test")
|
|
590
|
+
sys.exit(1)
|
|
591
|
+
|
|
592
|
+
cmd = sys.argv[1]
|
|
593
|
+
if cmd == "dev":
|
|
594
|
+
dev()
|
|
595
|
+
elif cmd == "start":
|
|
596
|
+
start()
|
|
597
|
+
elif cmd == "test":
|
|
598
|
+
test()
|
|
599
|
+
else:
|
|
600
|
+
print(f"Unknown command: {cmd}")
|
|
601
|
+
sys.exit(1)
|
|
602
|
+
\`,
|
|
603
|
+
'pyproject.toml': \`[tool.poetry]
|
|
604
|
+
name = "\${project_name}"
|
|
605
|
+
version = "0.1.0"
|
|
606
|
+
description = "\${description}"
|
|
607
|
+
authors = ["\${author}"]
|
|
608
|
+
license = "MIT"
|
|
609
|
+
readme = "README.md"
|
|
610
|
+
package-mode = false
|
|
611
|
+
|
|
612
|
+
[tool.poetry.dependencies]
|
|
613
|
+
python = "^3.10"
|
|
614
|
+
fastapi = "^0.128.0"
|
|
615
|
+
uvicorn = {extras = ["standard"], version = "^0.40.0"}
|
|
616
|
+
pydantic = "^2.12.5"
|
|
617
|
+
pydantic-settings = "^2.12.0"
|
|
618
|
+
|
|
619
|
+
[tool.poetry.group.dev.dependencies]
|
|
620
|
+
pytest = "^9.0.2"
|
|
621
|
+
pytest-asyncio = "^1.3.0"
|
|
622
|
+
pytest-cov = "^7.0.0"
|
|
623
|
+
httpx = "^0.28.1"
|
|
624
|
+
black = "^25.12.0"
|
|
625
|
+
ruff = "^0.14.10"
|
|
626
|
+
mypy = "^1.19.1"
|
|
627
|
+
|
|
628
|
+
[tool.poetry.scripts]
|
|
629
|
+
dev = "src.cli:dev"
|
|
630
|
+
start = "src.cli:start"
|
|
631
|
+
test = "src.cli:test"
|
|
632
|
+
|
|
633
|
+
[build-system]
|
|
634
|
+
requires = ["poetry-core"]
|
|
635
|
+
build-backend = "poetry.core.masonry.api"
|
|
636
|
+
|
|
637
|
+
[tool.pytest.ini_options]
|
|
638
|
+
asyncio_mode = "auto"
|
|
639
|
+
testpaths = ["tests"]
|
|
640
|
+
|
|
641
|
+
[tool.ruff]
|
|
642
|
+
line-length = 100
|
|
643
|
+
target-version = "py311"
|
|
644
|
+
|
|
645
|
+
[tool.black]
|
|
646
|
+
line-length = 100
|
|
647
|
+
target-version = ["py311"]
|
|
648
|
+
\`,
|
|
649
|
+
'README.md': \`# \${project_name}
|
|
650
|
+
|
|
651
|
+
\${description}
|
|
652
|
+
|
|
653
|
+
## Quick start
|
|
654
|
+
|
|
655
|
+
\\\`\\\`\\\`bash
|
|
656
|
+
npx workspai init # Install dependencies
|
|
657
|
+
npx workspai dev # Start dev server
|
|
658
|
+
\\\`\\\`\\\`
|
|
659
|
+
|
|
660
|
+
## Available commands
|
|
661
|
+
|
|
662
|
+
\\\`\\\`\\\`bash
|
|
663
|
+
npx workspai init # \u{1F527} Install dependencies
|
|
664
|
+
npx workspai dev # \u{1F680} Start development server with hot reload
|
|
665
|
+
npx workspai start # \u26A1 Start production server
|
|
666
|
+
npx workspai test # \u{1F9EA} Run tests
|
|
667
|
+
npx workspai help # \u{1F4DA} Show available commands
|
|
668
|
+
\\\`\\\`\\\`
|
|
669
|
+
|
|
670
|
+
## Project layout
|
|
671
|
+
|
|
672
|
+
\\\`\\\`\\\`
|
|
673
|
+
\${project_name}/
|
|
674
|
+
\u251C\u2500\u2500 src/
|
|
675
|
+
\u2502 \u251C\u2500\u2500 main.py # FastAPI application
|
|
676
|
+
\u2502 \u251C\u2500\u2500 cli.py # CLI commands
|
|
677
|
+
\u2502 \u251C\u2500\u2500 routing/ # API routes
|
|
678
|
+
\u2502 \u2514\u2500\u2500 modules/ # Module system
|
|
679
|
+
\u251C\u2500\u2500 tests/ # Test suite
|
|
680
|
+
\u251C\u2500\u2500 pyproject.toml # Poetry configuration
|
|
681
|
+
\u2514\u2500\u2500 README.md
|
|
682
|
+
\\\`\\\`\\\`
|
|
683
|
+
\`,
|
|
684
|
+
'.workspai/project.json': JSON.stringify({
|
|
685
|
+
kit_name: "fastapi.standard",
|
|
686
|
+
profile: "fastapi/standard",
|
|
687
|
+
created_at: new Date().toISOString(),
|
|
688
|
+
created_by: "workspai-cli-fallback",
|
|
689
|
+
workspai_version: "npm-demo",
|
|
690
|
+
rapidkit_version: "npm-demo"
|
|
691
|
+
}, null, 2),
|
|
692
|
+
'.workspai/cli.py': \`#!/usr/bin/env python3
|
|
693
|
+
"""RapidKit Core wrapper for demo projects."""
|
|
694
|
+
|
|
695
|
+
import subprocess
|
|
696
|
+
import sys
|
|
697
|
+
from pathlib import Path
|
|
698
|
+
|
|
699
|
+
|
|
700
|
+
def dev(port=8000, host="0.0.0.0"):
|
|
701
|
+
"""Start development server."""
|
|
702
|
+
print("\u{1F680} Starting development server with hot reload...")
|
|
703
|
+
subprocess.run([
|
|
704
|
+
sys.executable, "-m", "uvicorn",
|
|
705
|
+
"src.main:app", "--reload",
|
|
706
|
+
"--host", host, "--port", str(port)
|
|
707
|
+
])
|
|
708
|
+
|
|
709
|
+
|
|
710
|
+
def start(port=8000, host="0.0.0.0"):
|
|
711
|
+
"""Start production server."""
|
|
712
|
+
print("\u26A1 Starting production server...")
|
|
713
|
+
subprocess.run([
|
|
714
|
+
sys.executable, "-m", "uvicorn",
|
|
715
|
+
"src.main:app",
|
|
716
|
+
"--host", host, "--port", str(port)
|
|
717
|
+
])
|
|
718
|
+
|
|
719
|
+
|
|
720
|
+
def init():
|
|
721
|
+
"""Install dependencies."""
|
|
722
|
+
print("\u{1F4E6} Installing dependencies...")
|
|
723
|
+
subprocess.run(["poetry", "install"])
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
def test():
|
|
727
|
+
"""Run tests."""
|
|
728
|
+
print("\u{1F9EA} Running tests...")
|
|
729
|
+
subprocess.run([sys.executable, "-m", "pytest", "-q"])
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
def help_cmd():
|
|
733
|
+
"""Show help."""
|
|
734
|
+
print("\u{1F4DA} Available commands:")
|
|
735
|
+
print(" init - Install dependencies")
|
|
736
|
+
print(" dev - Start dev server")
|
|
737
|
+
print(" start - Start production server")
|
|
738
|
+
print(" test - Run tests")
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
if __name__ == "__main__":
|
|
742
|
+
cmd = sys.argv[1] if len(sys.argv) > 1 else "help"
|
|
743
|
+
cmds = {"dev": dev, "start": start, "init": init, "test": test, "help": help_cmd}
|
|
744
|
+
cmds.get(cmd, help_cmd)()
|
|
745
|
+
\`,
|
|
746
|
+
'.workspai/rapidkit': '#!/usr/bin/env bash\\n# Local RapidKit Core launcher for demo projects\\nset -euo pipefail\\nSCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"\\nROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"\\ncd "$ROOT_DIR"\\n\\nif [ -f "pyproject.toml" ]; then\\n if command -v poetry >/dev/null 2>&1; then\\n exec poetry run python "$SCRIPT_DIR/cli.py" "$@"\\n fi\\nfi\\n\\necho "Poetry not found. Install with: pip install poetry"\\nexit 1\\n',
|
|
747
|
+
'.gitignore': \`# Python
|
|
748
|
+
__pycache__/
|
|
749
|
+
*.py[cod]
|
|
750
|
+
*.so
|
|
751
|
+
.Python
|
|
752
|
+
build/
|
|
753
|
+
dist/
|
|
754
|
+
*.egg-info/
|
|
755
|
+
|
|
756
|
+
# Virtual environments
|
|
757
|
+
.venv/
|
|
758
|
+
venv/
|
|
759
|
+
|
|
760
|
+
# IDEs
|
|
761
|
+
.vscode/
|
|
762
|
+
.idea/
|
|
763
|
+
|
|
764
|
+
# OS
|
|
765
|
+
.DS_Store
|
|
766
|
+
|
|
767
|
+
# Project
|
|
768
|
+
.env
|
|
769
|
+
.env.local
|
|
770
|
+
\`
|
|
771
|
+
};
|
|
772
|
+
|
|
773
|
+
for (const [filePath, content] of Object.entries(files)) {
|
|
774
|
+
fs.writeFileSync(path.join(targetPath, filePath), content);
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
// Make scripts executable
|
|
778
|
+
try {
|
|
779
|
+
fs.chmodSync(path.join(targetPath, '.workspai/cli.py'), 0o755);
|
|
780
|
+
fs.chmodSync(path.join(targetPath, '.workspai/rapidkit'), 0o755);
|
|
781
|
+
} catch (e) {
|
|
782
|
+
// Ignore on Windows
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
console.log(\`
|
|
786
|
+
\u2728 Demo project created successfully!
|
|
787
|
+
|
|
788
|
+
\u{1F4C2} Project: \${targetPath}
|
|
789
|
+
|
|
790
|
+
\u{1F680} Get started:
|
|
791
|
+
cd \${projectName}
|
|
792
|
+
npx workspai init # Install dependencies
|
|
793
|
+
npx workspai dev # Start dev server
|
|
794
|
+
|
|
795
|
+
\u{1F4DA} Available commands:
|
|
796
|
+
npx workspai init # \u{1F527} Install dependencies
|
|
797
|
+
npx workspai dev # \u{1F680} Start dev server with hot reload
|
|
798
|
+
npx workspai start # \u26A1 Start production server
|
|
799
|
+
npx workspai test # \u{1F9EA} Run tests
|
|
800
|
+
npx workspai help # \u{1F4DA} Show help
|
|
801
|
+
|
|
802
|
+
\u{1F4A1} For Python engine features: pipx install rapidkit
|
|
803
|
+
\`);
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
main().catch(console.error);
|
|
807
|
+
`,"utf-8");try{await execa("chmod",["+x",y.join(t,"generate-demo.js")]);}catch{}let d=`# Workspai Demo Workspace
|
|
808
|
+
|
|
809
|
+
Welcome to your Workspai demo workspace! This environment lets you generate FastAPI demo projects using bundled Workspai templates, without needing to install Python RapidKit Core.
|
|
810
|
+
|
|
811
|
+
## \u{1F680} Quick Start
|
|
812
|
+
|
|
813
|
+
### Generate Your First Demo Project
|
|
814
|
+
|
|
815
|
+
\`\`\`bash
|
|
816
|
+
# Generate a demo project:
|
|
817
|
+
node generate-demo.js my-api
|
|
818
|
+
|
|
819
|
+
# Navigate to the project:
|
|
820
|
+
cd my-api
|
|
821
|
+
|
|
822
|
+
# Install dependencies:
|
|
823
|
+
workspai init
|
|
824
|
+
|
|
825
|
+
# Run the development server:
|
|
826
|
+
workspai dev
|
|
827
|
+
\`\`\`
|
|
828
|
+
|
|
829
|
+
Your API will be available at \`http://localhost:8000\`
|
|
830
|
+
|
|
831
|
+
## \u{1F4E6} Generate Multiple Projects
|
|
832
|
+
|
|
833
|
+
You can create multiple demo projects in this workspace:
|
|
834
|
+
|
|
835
|
+
\`\`\`bash
|
|
836
|
+
node generate-demo.js api-service
|
|
837
|
+
node generate-demo.js auth-service
|
|
838
|
+
node generate-demo.js data-service
|
|
839
|
+
\`\`\`
|
|
840
|
+
|
|
841
|
+
Each project is independent and has its own dependencies.
|
|
842
|
+
|
|
843
|
+
## \u{1F3AF} What's Included
|
|
844
|
+
|
|
845
|
+
Each generated demo project contains:
|
|
846
|
+
|
|
847
|
+
- **FastAPI Application** - Modern async web framework
|
|
848
|
+
- **Routing System** - Organized API routes
|
|
849
|
+
- **Module System** - Extensible module architecture
|
|
850
|
+
- **CLI Commands** - Built-in command system
|
|
851
|
+
- **Testing Setup** - pytest configuration
|
|
852
|
+
- **Poetry Configuration** - Dependency management
|
|
853
|
+
|
|
854
|
+
## \u{1F4DA} Next Steps
|
|
855
|
+
|
|
856
|
+
1. **Explore the Generated Code** - Check out \`src/main.py\` and \`src/routing/\`
|
|
857
|
+
2. **Add Routes** - Create new endpoints in \`src/routing/\`
|
|
858
|
+
3. **Install RapidKit Core** - For Python engine features: \`pipx install rapidkit\`
|
|
859
|
+
4. **Read the Documentation** - Visit [Workspai Docs](https://workspai.dev/docs)
|
|
860
|
+
|
|
861
|
+
## \u26A0\uFE0F Demo Mode Limitations
|
|
862
|
+
|
|
863
|
+
This is a demo workspace with:
|
|
864
|
+
- \u2705 Pre-built FastAPI templates
|
|
865
|
+
- \u2705 Project generation without Python RapidKit Core
|
|
866
|
+
- \u274C No Python RapidKit Core module commands (\`rapidkit add module\`)
|
|
867
|
+
- \u274C No interactive module system
|
|
868
|
+
|
|
869
|
+
For Python engine features, install RapidKit Core:
|
|
870
|
+
|
|
871
|
+
\`\`\`bash
|
|
872
|
+
pipx install rapidkit
|
|
873
|
+
\`\`\`
|
|
874
|
+
|
|
875
|
+
## \u{1F6E0}\uFE0F Workspace Structure
|
|
876
|
+
|
|
877
|
+
\`\`\`
|
|
878
|
+
${o}/
|
|
879
|
+
\u251C\u2500\u2500 generate-demo.js # Demo project generator
|
|
880
|
+
\u251C\u2500\u2500 README.md # This file
|
|
881
|
+
\u2514\u2500\u2500 my-api/ # Your generated projects go here
|
|
882
|
+
\`\`\`
|
|
883
|
+
|
|
884
|
+
## \u{1F4A1} Tips
|
|
885
|
+
|
|
886
|
+
- Run \`node generate-demo.js --help\` for more options (coming soon)
|
|
887
|
+
- Each project can have different configurations
|
|
888
|
+
- Demo projects are production-ready FastAPI applications
|
|
889
|
+
- You can copy and modify templates as needed
|
|
890
|
+
|
|
891
|
+
---
|
|
892
|
+
|
|
893
|
+
**Generated with Workspai** | [GitHub](https://github.com/rapidkitlabs/workspai)
|
|
894
|
+
`;if(await promises.writeFile(y.join(t,"README.md"),d,"utf-8"),s.succeed("Demo workspace setup complete"),!n){s.start("Initializing git repository");try{await execa("git",["init"],{cwd:t}),await k.outputFile(y.join(t,".gitignore"),`# Dependencies
|
|
895
|
+
node_modules/
|
|
896
|
+
|
|
897
|
+
# Generated projects
|
|
898
|
+
*/
|
|
899
|
+
!generate-demo.js
|
|
900
|
+
!README.md
|
|
901
|
+
|
|
902
|
+
# Python
|
|
903
|
+
__pycache__/
|
|
904
|
+
*.pyc
|
|
905
|
+
.venv/
|
|
906
|
+
.env
|
|
907
|
+
`,"utf-8"),await execa("git",["add","."],{cwd:t}),await execa("git",["commit","-m","Initial commit: Demo workspace"],{cwd:t}),s.succeed("Git repository initialized");}catch{s.warn("Could not initialize git repository");}}console.log(e$1.green(`
|
|
908
|
+
\u2728 Demo workspace created successfully!
|
|
909
|
+
`)),console.log(e$1.cyan("\u{1F4C2} Location:"),e$1.white(t)),console.log(e$1.cyan(`\u{1F680} Get started:
|
|
910
|
+
`)),console.log(e$1.white(` ${f$1(t)}`)),console.log(e$1.white(" node generate-demo.js my-api")),console.log(e$1.white(" cd my-api")),console.log(e$1.white(" workspai init")),console.log(e$1.white(" workspai dev")),console.log(),console.log(e$1.yellow("\u{1F4A1} Note:"),"This is a demo workspace. For Python engine features:"),console.log(e$1.cyan(" pipx install rapidkit")),console.log();}catch(a){throw s.fail("Failed to create demo workspace"),a}}async function nt(t,o,n,s,a,l,d){if(console.log(e$1.cyan(`
|
|
911
|
+
\u{1F50D} Dry-run mode - what would be created:
|
|
912
|
+
`)),console.log(e$1.white("\u{1F4C2} Workspace path:"),t),console.log(e$1.white("\u{1F4DB} Name:"),e$1.cyan(o)),n)console.log(e$1.white("\u{1F4E6} Type:"),"Demo environment"),console.log(e$1.white(`
|
|
913
|
+
\u{1F4DD} Files to create:`)),console.log(e$1.gray(" - package.json")),console.log(e$1.gray(" - generate-demo.js (project generator)")),console.log(e$1.gray(" - README.md")),console.log(e$1.gray(" - .gitignore")),console.log(e$1.white(`
|
|
914
|
+
\u{1F3AF} Capabilities:`)),console.log(e$1.gray(" - Generate FastAPI/NestJS demo projects")),console.log(e$1.gray(" - No Python RapidKit installation required")),console.log(e$1.gray(" - Bundled templates"));else {let u=a||"minimal",p=l,h=d,m=new Set(["python-only","polyglot","enterprise"]).has(u);console.log(e$1.white("\u{1F4E6} Profile:"),e$1.cyan(u)),console.log(e$1.white("\u{1F4DD} Configuration:")),m?(console.log(e$1.gray(` - Python version: ${h}`)),console.log(e$1.gray(` - Install method: ${p}`)),console.log(e$1.gray(` - Git init: ${s.skipGit?"No":"Yes"}`))):(console.log(e$1.gray(" - Python-free profile (no Python needed)")),console.log(e$1.gray(` - Git init: ${s.skipGit?"No":"Yes"}`))),console.log(e$1.white(`
|
|
915
|
+
\u{1F4CB} Files to create:`)),console.log(e$1.gray(" - .workspai-workspace (workspace marker)")),console.log(e$1.gray(" - .workspai/ (workspace config directory)")),console.log(e$1.gray(" - README.md")),console.log(e$1.gray(" - .gitignore")),m&&console.log(e$1.gray(` - ${p==="poetry"?"pyproject.toml + poetry.lock":".venv/ (virtual environment)"}`)),console.log(e$1.white(`
|
|
916
|
+
\u2699\uFE0F Environment setup:`)),m&&console.log(p==="poetry"?e$1.gray(" - Poetry virtual environment created (recommended, includes dependency management)"):p==="venv"?e$1.gray(" - Python venv created in .venv/ (standard, zero extra tools)"):e$1.gray(" - Global pipx install (isolated, not local to workspace)")),console.log(e$1.white(`
|
|
917
|
+
\u{1F680} Next steps:`)),console.log(e$1.gray(` 1. ${f$1(t)}`)),console.log(e$1.gray(" 2. npx workspai create project")),console.log(e$1.gray(" 3. npx workspai init")),console.log(e$1.gray(" 4. npx workspai dev")),console.log(e$1.white(`
|
|
918
|
+
\u{1F4A1} Learn more:`)),console.log(e$1.gray(" \u2022 Change profile later: workspai bootstrap --profile <profile>")),console.log(e$1.gray(" \u2022 Profile options: minimal|java-only|python-only|node-only|go-only|dotnet-only|polyglot|enterprise")),console.log(e$1.gray(" \u2022 Help: npx workspai --help"));}console.log(e$1.white(`
|
|
919
|
+
\u2728 To proceed: remove --dry-run flag
|
|
920
|
+
`));}export{Ae as a,Ct as b,Ne as c,Ye as d,he as e,jt as f,At as g};
|