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,2 @@
|
|
|
1
|
+
import {a as a$1,d,c}from'./chunk-NAAQMSO3.js';import {l}from'./chunk-OCGZNSOE.js';import {e}from'./chunk-RO73VVHW.js';import {a}from'./chunk-XZGVNGRB.js';import {p,o}from'./chunk-5XATWNME.js';import u from'path';import h from'fs-extra';var D="unknown-run";function O(e$1){let r=e();return !r||r===D?e$1:{...e$1,runId:r}}var m=".workspai/workspace.contract.json",M=".workspai/reports/workspace-contract-verify-last-run.json",w=1,F="workspace-contract-verify.v1";function _(e){return e.replace(/\\/g,"/")}function E(e){let r=_(e).trim();return !r||r.startsWith("/")||r.startsWith("~")||/^[a-zA-Z]:\//.test(r)||r.includes("\0")?false:!r.split("/").filter(Boolean).some(o=>o===".."||o===".")}function G(e,r){return e.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/-+/g,"-").replace(/^[-_.]+|[-_.]+$/g,"").slice(0,80)||r}function K(e){return Array.isArray(e)?e.filter(r=>typeof r=="string"&&r.trim().length>0):[]}async function W(e){for(let r of e)if(await h.pathExists(r))return r;return null}async function z(e){for(let r of o(e,"workspace.json"))try{let o=await h.readJson(r);return {name:typeof o.workspace_name=="string"&&o.workspace_name.trim()||typeof o.name=="string"&&o.name.trim()||u.basename(e),profile:typeof o.profile=="string"?o.profile:void 0}}catch{}return {name:u.basename(e)}}async function H(e){let r=[],o=[e],n=new Set,c=new Set([".git","node_modules",".venv","venv","dist","build","target",".next",".turbo",".cache"]);for(;o.length>0;){let a=o.shift();if(!a||n.has(a))continue;n.add(a);let i=await W(p(a,"project.json")),l=await W(p(a,"context.json"));if(i||l){r.push(i??l??"");continue}let t;try{t=await h.readdir(a,{withFileTypes:true});}catch{continue}for(let s of t)!s.isDirectory()||c.has(s.name)||o.push(u.join(a,s.name));}return r.sort()}function L(e){let r=(e||"").toLowerCase();if(r.includes("fastapi"))return "fastapi";if(r.includes("nestjs"))return "nestjs";if(r.includes("springboot"))return "springboot";if(r.includes("gofiber"))return "fiber";if(r.includes("gogin"))return "gin"}function B(e,r){let o=(e||"").toLowerCase(),n=(r||"").toLowerCase();return o.includes("fastapi")?8e3:o.includes("nestjs")?3e3:o.includes("springboot")?8080:o.includes("gofiber")?3e3:o.includes("gogin")?8080:n==="node"?3e3:n==="python"?8e3:n==="java"||n==="go"?8080:null}function U(e,r){let o=e;for(;r.has(o)&&o<65535;)o+=1;return o}function A(e,r,o){let n=B(r.kit,r.runtime),c=e?.ports||[],a=c.length>0?c:n?[{name:"http",port:U(n,o),protocol:"http"}]:[];for(let t of a)o.add(t.port);let i={...r,...e,slug:e?.slug||r.slug,relativePath:e?.relativePath&&E(e.relativePath)?e.relativePath:r.relativePath,source:e?.source||r.source,relationship:e?.relationship||r.relationship,externalPath:e?.externalPath||r.externalPath,runtime:e?.runtime||r.runtime,framework:e?.framework||r.framework,kit:e?.kit||r.kit,modules:e?.modules?.length?e.modules:r.modules,ports:a,contracts:{owns:e?.contracts?.owns||[],apis:e?.contracts?.apis||[],publishes:e?.contracts?.publishes||[],consumes:e?.contracts?.consumes||[],dependsOn:e?.contracts?.dependsOn||[],env:e?.contracts?.env||[]}},l=JSON.stringify(e||null)!==JSON.stringify(i);return {project:i,changed:l}}async function V(e){let r=u.resolve(e.workspacePath),o=await z(r),n=await H(r),c=await a(r),a$1=[];for(let t of c){let s=u.resolve(t.path),p$1=await W(p(s,"project.json"))??await W(p(s,"context.json"));!p$1||n.some(g=>u.resolve(g)===u.resolve(p$1))||a$1.push({projectJsonPath:p$1,registryEntry:t});}let i=[],l=[...n.map(t=>({projectJsonPath:t})),...a$1];for(let{projectJsonPath:t,registryEntry:s}of l){let p=u.dirname(u.dirname(t)),g=_(u.relative(r,p)),C=s!==void 0&&!E(g),y=G(s?.name||u.basename(p),u.basename(p)),d=C?`external/${y}`:g||y,f=await h.readJson(t),k=typeof f.kit_name=="string"&&f.kit_name||typeof f.kit=="string"&&f.kit||void 0,I=typeof f.framework=="string"&&f.framework||L(k);i.push({slug:s?.name||d||u.basename(p),relativePath:d,source:s?.source??"workspace",relationship:s?.relationship,externalPath:C?p:void 0,runtime:typeof f.runtime=="string"?f.runtime:void 0,framework:I,kit:k,modules:K(f.modules),ports:[],contracts:{owns:[],apis:[],publishes:[],consumes:[],dependsOn:[],env:[]}});}return {schemaVersion:w,kind:"rapidkit.workspace.contract",generatedAt:(e.now??new Date).toISOString(),workspace:o,projects:i}}async function at(e){let r=u.resolve(e.outputPath||a$1(e.workspacePath,m));if(await h.pathExists(r)&&e.force!==true)throw new Error(`Workspace contract already exists: ${r}. Use --force to overwrite.`);let o=await V({workspacePath:e.workspacePath,now:e.now}),n=new Set,c={...o,projects:o.projects.map(i=>A(void 0,i,n).project)};e.outputPath?(await h.ensureDir(u.dirname(r)),await h.writeJson(r,c,{spaces:2})):await d(e.workspacePath,m,c);let{publishWorkspaceRegistrySummary:a}=await import('./workspace-registry-summary-RUJE6RPH.js');return await a(e.workspacePath,{now:e.now}),{contractPath:r,contract:c}}async function ct(e){let r=u.resolve(e.workspacePath),o=a$1(r,m),n=await c(r,m)??o,c$1=await V({workspacePath:r,now:e.now}),a=await h.pathExists(n)?await h.readJson(n):null,i=new Map((a?.projects||[]).map(d=>[d.slug,d])),l=new Set,t=[],s=[],p=[];for(let d of c$1.projects){let f=i.get(d.slug),k=A(f,d,l);f?k.changed&&s.push(d.slug):t.push(d.slug),p.push(k.project),i.delete(d.slug);}for(let d of i.values()){let f=A(d,d,l);p.push(f.project);}let g={schemaVersion:w,kind:"rapidkit.workspace.contract",generatedAt:(e.now??new Date).toISOString(),workspace:{...c$1.workspace,...a?.workspace||{},name:a?.workspace?.name||c$1.workspace.name},projects:p.sort((d,f)=>d.slug.localeCompare(f.slug))};await d(r,m,g);let C=await Y({workspacePath:r}),{publishWorkspaceRegistrySummary:y}=await import('./workspace-registry-summary-RUJE6RPH.js');return await y(r,{now:e.now}),{contractPath:o,contract:g,addedProjects:t,updatedProjects:s,verification:C}}async function N(e){let r=e.contractPath??(await c(e.workspacePath,m)||a$1(e.workspacePath,m)),o=await h.readJson(r);return {contractPath:r,contract:o}}async function it(e){let{contractPath:r,contract:o}=await N(e),n=o.projects.map(t=>({id:t.slug,label:t.slug,relativePath:t.relativePath,source:t.source,relationship:t.relationship,externalPath:t.externalPath,runtime:t.runtime,framework:t.framework,kit:t.kit,modules:t.modules,ports:t.ports,apis:t.contracts.apis,owns:t.contracts.owns,env:t.contracts.env})),c=new Set(n.map(t=>t.id)),a=new Map,i=[];for(let t of o.projects){for(let s of t.contracts.dependsOn||[])c.has(s)&&i.push({from:s,to:t.slug,type:"dependency",label:"dependsOn"});for(let s of t.contracts.publishes||[])a.has(s)||a.set(s,new Set),a.get(s)?.add(t.slug);}for(let t of o.projects)for(let s of t.contracts.consumes||[]){let p=a.get(s);if(p)for(let g of p)g!==t.slug&&i.push({from:g,to:t.slug,type:"event",label:s});}let l={schemaVersion:1,kind:"rapidkit.workspace.contract.graph",workspace:o.workspace,generatedAt:new Date().toISOString(),nodes:n.sort((t,s)=>t.id.localeCompare(s.id)),edges:i.sort((t,s)=>`${t.from}:${t.to}:${t.type}:${t.label}`.localeCompare(`${s.from}:${s.to}:${s.type}:${s.label}`)),summary:{projectCount:n.length,dependencyEdges:i.filter(t=>t.type==="dependency").length,eventEdges:i.filter(t=>t.type==="event").length,portCount:n.reduce((t,s)=>t+s.ports.length,0),apiCount:n.reduce((t,s)=>t+s.apis.length,0)}};return {contractPath:r,graph:l}}async function Y(e){let{contractPath:r,contract:o}=await N(e),n=[],c=[];o.kind!=="rapidkit.workspace.contract"&&n.push("Contract kind must be rapidkit.workspace.contract."),o.schemaVersion!==w&&n.push(`Contract schemaVersion must be ${w}.`),o.workspace?.name||n.push("Contract workspace.name is required."),Array.isArray(o.projects)||n.push("Contract projects must be an array.");let a=new Set,i=new Map;for(let t of o.projects||[]){if(!t.slug){n.push("Every project must declare slug.");continue}a.has(t.slug)&&n.push(`Duplicate project slug: ${t.slug}.`),a.add(t.slug),t.relativePath?E(t.relativePath)||n.push(`Project ${t.slug} declares unsafe relativePath: ${t.relativePath}.`):n.push(`Project ${t.slug} must declare relativePath.`),t.externalPath&&(t.relationship==="adopted"||t.source==="adopted-local"||t.source==="local-folder"||t.source==="git-url"||n.push(`Project ${t.slug} declares externalPath without imported/adopted provenance.`),u.isAbsolute(t.externalPath)||n.push(`Project ${t.slug} declares non-absolute externalPath.`));for(let s of t.ports||[]){(!Number.isInteger(s.port)||s.port<1||s.port>65535)&&n.push(`Project ${t.slug} declares invalid port: ${s.port}.`);let p=i.get(s.port);p&&n.push(`Port ${s.port} is claimed by both ${p} and ${t.slug}.`),i.set(s.port,t.slug);}for(let s of t.contracts?.apis||[])(!s.name?.trim()||!s.basePath?.startsWith("/"))&&n.push(`Project ${t.slug} declares invalid API contract.`);for(let s of [...t.contracts?.publishes||[],...t.contracts?.consumes||[]])s.trim()||n.push(`Project ${t.slug} declares an empty event contract.`);for(let s of t.contracts?.env||[])/^[A-Z_][A-Z0-9_]*$/.test(s)||n.push(`Project ${t.slug} declares invalid env contract: ${s}.`);for(let s of t.contracts?.dependsOn||[])a.has(s);}for(let t of o.projects||[])for(let s of t.contracts?.dependsOn||[])a.has(s)||n.push(`Project ${t.slug} depends on unknown project: ${s}.`);c.push({id:"schema",status:o.kind==="rapidkit.workspace.contract"&&o.schemaVersion===w?"passed":"failed",message:"Contract schema and kind are valid."}),c.push({id:"projects",status:Array.isArray(o.projects)?"passed":"failed",message:`Contract declares ${Array.isArray(o.projects)?o.projects.length:0} project(s).`}),c.push({id:"ports",status:n.some(t=>t.toLowerCase().includes("port"))?"failed":"passed",message:"Project port declarations are valid and collision-free."}),c.push({id:"dependencies",status:n.some(t=>t.includes("depends on unknown project"))?"failed":"passed",message:"Project dependencies point to known project slugs."}),c.push({id:"contracts",status:n.some(t=>t.includes("unsafe relativePath")||t.includes("invalid API contract")||t.includes("event contract")||t.includes("env contract"))?"failed":"passed",message:"Project path, API, event, and env contracts are valid."});let l$1=await l(e.workspacePath);if(l$1.moduleCount>0){for(let t of l$1.issues)n.push(`${u.basename(t.projectRoot)}: ${t.message} (slug=${t.slug})`);c.push({id:"module-paths",status:l$1.status,message:l$1.status==="passed"?`All ${l$1.moduleCount} registered module(s) resolve under canonical paths.`:`${l$1.issues.length} registered module(s) missing canonical install paths.`});}else e.strict&&c.push({id:"module-paths",status:"passed",message:"No registry-backed modules declared in workspace projects."});return {status:n.length>0?"failed":"passed",contractPath:r,projectCount:Array.isArray(o.projects)?o.projects.length:0,checks:c,violations:n}}async function pt(e){let r=u.resolve(e.workspacePath),o={schemaVersion:F,generatedAt:e.generatedAt??new Date().toISOString(),status:e.result.status,contractPath:e.result.contractPath,projectCount:e.result.projectCount,checks:e.result.checks,violations:e.result.violations};return d(r,M,O(o))}
|
|
2
|
+
export{O as a,m as b,M as c,w as d,F as e,H as f,V as g,at as h,ct as i,N as j,it as k,Y as l,pt as m};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import {d,b as b$1,e}from'./chunk-753LOKFZ.js';import {j,q as q$1,n}from'./chunk-T6OR6YOI.js';import {h,i,f,e as e$1}from'./chunk-4KUIFXHM.js';import {d as d$1}from'./chunk-S5KTATOU.js';import {c}from'./chunk-NAAQMSO3.js';import {a}from'./chunk-GZTYAEWX.js';import {e as e$2,g}from'./chunk-LZQNVH7D.js';import {p,l,o}from'./chunk-5XATWNME.js';import _ from'fs';import b from'path';import E from'chalk';import {execa}from'execa';function je(e){return _.existsSync(b.join(e,"bun.lock"))||_.existsSync(b.join(e,"bunfig.toml"))?"bun":_.existsSync(b.join(e,"pnpm-lock.yaml"))?"pnpm":_.existsSync(b.join(e,"yarn.lock"))?"yarn":(_.existsSync(b.join(e,"package-lock.json")),"npm")}function Se(e,t,r=je(e)){return r==="npm"?`npm run ${t}`:`${r} run ${t}`}function Ee(e,t=je(e)){return `${t} install`}var _e={"python-fastapi":{runtime:"python",framework:"FastAPI",markers:["pyproject.toml","fastapi"],commands:{init:"python -m pip install -e .",test:"pytest",build:"python -m build",start:"uvicorn main:app --reload"},errorPatterns:{setup:["ModuleNotFoundError","No module named","pip: command not found"],"test-failure":["FAILED","ERROR","test session started"],dependency:["ImportError","missing.*dependency"],runtime:["TypeError","AttributeError","ValueError"],timeout:["timeout","Timeout","timed out"],unknown:[]},healthCheck:{stage:"start",type:"http",value:"http://localhost:8000/docs"},validation:{command:"python -m pip list | grep fastapi",error:"FastAPI not installed"}},"python-django":{runtime:"python",framework:"Django",markers:["manage.py","django"],commands:{init:"python manage.py migrate",test:"python manage.py test",build:"python manage.py collectstatic --noinput",start:"python manage.py runserver 0.0.0.0:8000"},errorPatterns:{setup:["ModuleNotFoundError","ProgrammingError.*migrate"],"test-failure":["FAILED","ERROR","Ran.*test"],dependency:["ImportError","missing.*dependency"],runtime:["DatabaseError","ImproperlyConfigured"],timeout:["timeout","Timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:8e3},dependencies:["init"]},"node-nestjs":{runtime:"node",framework:"NestJS",markers:["package.json","@nestjs/core"],commands:{init:"npm install",test:"npm run test",build:"npm run build",start:"npm run start"},errorPatterns:{setup:["npm ERR!","ENOENT","not found"],"test-failure":["Tests.*failed","FAIL","fail.*test"],dependency:["Cannot find module","ERR_MODULE_NOT_FOUND"],runtime:["TypeError","Error: ","ReferenceError"],timeout:["timeout","TIMEOUT"],unknown:[]},healthCheck:{stage:"start",type:"port",value:3e3}},"node-express":{runtime:"node",framework:"Express",markers:["package.json","express"],commands:{init:"npm install",test:"npm run test",build:"npm run build",start:"npm start"},errorPatterns:{setup:["npm ERR!","ENOENT"],"test-failure":["failed","FAIL"],dependency:["Cannot find module"],runtime:["Error","TypeError"],timeout:["timeout"],unknown:[]}},"go-fiber":{runtime:"go",framework:"Fiber",markers:["go.mod","fiber"],commands:{init:"go mod download && go mod tidy",test:"go test ./...",build:"go build -o app .",start:"./app"},errorPatterns:{setup:["go: .*not found","cannot find","go mod tidy"],"test-failure":["FAIL","--- FAIL"],dependency:["missing.*module"],runtime:["panic","fatal","Error"],timeout:["timeout","context deadline"],unknown:[]},dependencies:["init"]},"go-gin":{runtime:"go",framework:"Gin",markers:["go.mod","gin-gonic"],commands:{init:"go mod download && go mod tidy",test:"go test ./...",build:"go build -o app .",start:"./app"},errorPatterns:{setup:["go: .*not found"],"test-failure":["FAIL"],dependency:["missing.*module"],runtime:["panic"],timeout:["timeout"],unknown:[]}},"java-springboot":{runtime:"java",framework:"Spring Boot",markers:["pom.xml","build.gradle","spring-boot"],commands:{init:"mvn dependency:go-offline",test:"mvn test",build:"mvn package -DskipTests",start:"mvn spring-boot:run"},errorPatterns:{setup:["\\[ERROR\\]","BUILD FAILURE","missing dependencies"],"test-failure":["\\[ERROR\\] Tests run:","BUILD FAILURE"],dependency:["missing.*dependency"],runtime:["Exception","Error","NullPointerException"],timeout:["timeout","Timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:8080}},"php-laravel":{runtime:"php",framework:"Laravel",markers:["composer.json","artisan","app/Models"],commands:{init:"composer install && php artisan migrate:fresh --seed",test:"php artisan test",build:"php artisan config:cache && php artisan route:cache && php artisan view:cache",start:"php artisan serve --host=0.0.0.0 --port=8000"},errorPatterns:{setup:["Composer.*lock","Fatal error","Class.*not found"],"test-failure":["FAILED","Tests.*failed"],dependency:["Class.*not found","require.*failed"],runtime:["Fatal error","Exception","Error"],timeout:["timeout","Timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:8e3},dependencies:["init"]},"php-symfony":{runtime:"php",framework:"Symfony",markers:["composer.json","symfony.lock","bin/console"],commands:{init:"composer install && php bin/console doctrine:database:create",test:"php bin/phpunit",build:"php bin/console cache:clear --env=prod",start:"symfony serve --no-tls"},errorPatterns:{setup:["Composer.*error","Fatal error"],"test-failure":["FAILED","failure"],dependency:["Class.*not found"],runtime:["Fatal error","Exception"],timeout:["timeout"],unknown:[]},dependencies:["init"]},"rust-actix":{runtime:"rust",framework:"Actix-web",markers:["Cargo.toml","actix"],commands:{init:"cargo fetch",test:"cargo test",build:"cargo build --release",start:"cargo run --release"},errorPatterns:{setup:["error: .*could not find","failed.*download"],"test-failure":["test result:","FAILED"],dependency:["can.t find.*crate"],runtime:["error\\[E","thread.*panicked"],timeout:["timeout"],unknown:[]},validation:{command:"cargo --version",error:"Rust/Cargo not installed"}},"rust-axum":{runtime:"rust",framework:"Axum",markers:["Cargo.toml","axum"],commands:{init:"cargo fetch",test:"cargo test",build:"cargo build --release",start:"cargo run --release"},errorPatterns:{setup:["error: .*could not find"],"test-failure":["test result:","FAILED"],dependency:["can.t find.*crate"],runtime:["error\\[E"],timeout:["timeout"],unknown:[]}},"rust-rocket":{runtime:"rust",framework:"Rocket",markers:["Cargo.toml","rocket"],commands:{init:"cargo fetch",test:"cargo test",build:"cargo build --release",start:"cargo run --release"},errorPatterns:{setup:["error: .*could not find"],"test-failure":["FAILED"],dependency:["can.t find"],runtime:["error\\[E"],timeout:["timeout"],unknown:[]}},"dotnet-aspnetcore":{runtime:"dotnet",framework:"ASP.NET Core",markers:[".csproj",".sln","Program.cs"],commands:{init:"dotnet restore",test:"dotnet test",build:"dotnet build -c Release",start:"dotnet run"},errorPatterns:{setup:["error CS","CSPROJ.*not found","NuGet.*restore"],"test-failure":["Failed:.*test","FAILED"],dependency:["error NU1101"],runtime:["error CS","Exception"],timeout:["timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:5e3}},"elixir-phoenix":{runtime:"elixir",framework:"Phoenix",markers:["mix.exs","phoenix"],commands:{init:"mix setup",test:"mix test",build:"mix compile --all-warnings",start:"mix phx.server"},errorPatterns:{setup:["\\*\\* \\(.*Error\\)","Mix.InstallError"],"test-failure":["\\d+\\sfailed","FAILED"],dependency:["dependencies are not available"],runtime:["\\*\\* \\(","RuntimeError"],timeout:["timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:4e3},dependencies:["init"]},"ruby-rails":{runtime:"ruby",framework:"Rails",markers:["Gemfile","config/application.rb","bin/rails"],commands:{init:"bundle install && rails db:prepare",test:"rails test",build:"rails assets:precompile",start:"rails server --binding=0.0.0.0 --port=3000"},errorPatterns:{setup:["Bundler::.*Error","Gem::.*Error"],"test-failure":["failures,","error,","FAILED"],dependency:["Could not find.*gem"],runtime:["Error","Exception","NoMethodError"],timeout:["timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:3e3},dependencies:["init"]},"ruby-sinatra":{runtime:"ruby",framework:"Sinatra",markers:["Gemfile","app.rb","sinatra"],commands:{init:"bundle install",test:"rspec",build:`echo "Sinatra apps don't require build"`,start:"ruby app.rb"},errorPatterns:{setup:["Bundler.*Error","Gem.*Error"],"test-failure":["failure","FAILED"],dependency:["Could not find.*gem"],runtime:["Error","NoMethodError"],timeout:["timeout"],unknown:[]}}},Ge={init:{python:["pip install -e .","poetry install","pip install -r requirements.txt"],node:["npm install","pnpm install","yarn install"],go:["go mod download && go mod tidy","go get ./..."],java:["mvn dependency:go-offline","gradle dependencies"],php:["composer install"],rust:["cargo fetch"],dotnet:["dotnet restore"],elixir:["mix deps.get"],ruby:["bundle install"],"jvm-generic":["mvn dependency:go-offline","gradle dependencies"],unknown:[]},test:{python:["pytest","python -m unittest","python -m pytest"],node:["npm test","npm run test"],go:["go test ./...","make test"],java:["mvn test","gradle test"],php:["php artisan test","phpunit","pest"],rust:["cargo test"],dotnet:["dotnet test"],elixir:["mix test"],ruby:["rspec","ruby -m minitest"],"jvm-generic":["mvn test","gradle test"],unknown:[]},build:{python:["python -m build","python setup.py build"],node:["npm run build"],go:["go build -o app .","go build ./..."],java:["mvn package -DskipTests","gradle build -x test"],php:['echo "PHP build: typically no build step"'],rust:["cargo build --release"],dotnet:["dotnet build -c Release"],elixir:["mix compile"],ruby:["gem build *.gemspec"],"jvm-generic":["mvn package -DskipTests","gradle build"],unknown:[]},start:{python:["python app.py","python main.py","uvicorn main:app --reload"],node:["npm start","node index.js","node src/index.js"],go:["./app","go run main.go","go run ./..."],java:["mvn spring-boot:run","gradle bootRun","java -jar target/*.jar"],php:["php -S 0.0.0.0:8000","php artisan serve"],rust:["cargo run --release","./target/release/app"],dotnet:["dotnet run"],elixir:["mix phx.server","iex -S mix"],ruby:["rails server","ruby app.rb","bundle exec puma"],"jvm-generic":["java -jar *.jar","gradle run"],unknown:[]}};function oe(e,t){if(t){let r=t.trim().toLowerCase().replace(/[_.\s]+/g,"-"),n=e$1(t),a=`${e}-${n==="gofiber"?"fiber":n==="gogin"?"gin":n==="dotnet"?"aspnetcore":n!=="unknown"?n:r==="fiber"?"fiber":r==="aspnetcore"||r==="asp-net-core"?"aspnetcore":r}`;return _e[a]}}function Ce(e,t,r){if(t){let n=oe(e,t);if(n&&n.commands[r])return n.commands[r]}if(["init","test","build","start"].includes(r)){let n=Ge[r]?.[e]??[];return n.length>0?n[0]:void 0}}var Be={test:"test",build:"build",start:"start"};function se(e){if(e.stage==="init")return e.runtime==="node"?Ee(e.projectPath):Ce(e.runtime,e.framework,e.stage);if(e.runtime==="node"){let t=Be[e.stage];if(t){let r=n(e.projectPath,t,{framework:e.framework});if(r)return Se(e.projectPath,r.scriptName)}}return Ce(e.runtime,e.framework,e.stage)}function ze(e){let t=h(e).map(r=>r==="python"?"python":r==="node"||r==="bun"?"node":r==="go"?"go":r==="java"?"java":r==="php"?"php":r==="rust"?"rust":r==="dotnet"?"dotnet":r==="elixir"?"elixir":r==="ruby"?"ruby":r==="clojure"||r==="scala"||r==="kotlin"?"jvm-generic":null).filter(r=>r!==null).filter((r,n,o)=>o.indexOf(r)===n);return {primary:t.length>0?t[0]:"unknown",secondary:t.slice(1)}}function Pe(e){return ze(e).primary}function ae(e,t){if(!e)return "unknown";t||(t={setup:["ModuleNotFoundError","npm ERR!","error:","not found"],"test-failure":["FAILED","FAIL","failed"],dependency:["cannot find module","import.*error"],runtime:["Exception","Error:","panic","TypeError"],timeout:["timeout","Timeout","deadline exceeded"],unknown:[]});for(let[r,n]of Object.entries(t))for(let o of n)if(new RegExp(o,"i").test(e))return r;return "unknown"}async function q(e){let t=e.split(/[&|;]\s*/)[0].trim().split(/\s+/)[0];if(["echo","cd","pwd","test","true","false","exit"].includes(t))return {valid:true};try{let n=process.platform==="win32"?"where":"which";if((await execa(n,[t],{reject:false})).exitCode===0)return {valid:true}}catch{}return {valid:false,reason:`Command '${t}' not found or not executable`}}function Fe(e,t,r){if(!t)return e;let n=typeof t=="object"&&!Array.isArray(t)&&("dev"in t||"staging"in t||"prod"in t||"default"in t)&&!Object.keys(t).some(o=>["init","test","build","start"].includes(o))?t:{};return r&&typeof n[r]=="string"?n[r]:typeof n.default=="string"?n.default:e}var Ae={init:"init",test:"test",build:"build",start:"start"};function Ke(e){return e in Ae?Ae[e]:null}function Ve(e,t){let n=j(e)?.contextJson?.commands;if(!n||typeof n!="object"||Array.isArray(n))return;let o=n[t];if(typeof o=="string"&&o.trim().length>0)return o.trim();if(o&&typeof o=="object"&&!Array.isArray(o)){let a=o,c=a.default??a.dev;if(typeof c=="string"&&c.trim().length>0)return c.trim()}}function De(e,t,r=q$1(e)){let n=Ke(t);if(!n)return Ve(e,t)?{supported:true}:{supported:false,reason:`Workspace stage "${t}" is not part of the Workspai fleet contract.`};if(!r.projectRoot)return {supported:false,reason:"No Workspai project metadata was detected for this target."};let o=r.commandMap[n];return !o||o.status!=="supported"?{supported:false,reason:o?.reason??`Command "${n}" is not supported for this project runtime/framework.`}:{supported:true}}var He=new Set(["init","test","build","start"]),Ue=new Set([".git","node_modules",".workspai",".rapidkit",".venv","dist","build","coverage","htmlcov"]);async function I(e){try{return await _.promises.access(e,_.constants.F_OK),true}catch{return false}}async function Je(e){for(let t of e)if(await I(t))return true;return false}async function qe(e,t,r){if(t==="python"){let o=[b.join(e,".workspai","cli.py"),b.join(e,".rapidkit","cli.py")];for(let a of o)if(await I(a))return {valid:true};return {valid:false,reason:"Project-local .workspai/cli.py is missing. Run `workspai init` in this project first."}}let n=r.trim().split(/\s+/)[0];if(n&&["npm","npx","pnpm","yarn"].includes(n)){let o=e$2(n);if((await execa(o.command,[...o.prefixArgs,"--version"],{reject:false,env:g()})).exitCode===0)return {valid:true}}return q(r)}async function ce(e){let t=await _.promises.readFile(e,"utf-8");return JSON.parse(t)}function D(e){return e.replace(/\\/g,"/")}function Ye(e){let t=e?.trim();return t?t.startsWith("project:")?t.slice(8).trim()||null:t:null}async function Qe(e){return a(e,{skipDirs:Ue,includeHiddenDirs:false,descendIntoMatchedProjects:false,isProjectDir:async(t,r)=>await Je([...p(t,"context.json"),...p(t,"project.json")])?true:b.resolve(t)===b.resolve(r)?false:h(t).length>0})}async function Xe(e){for(let t of [b.join(".workspai","project.json"),b.join(".workspai","context.json"),b.join(".rapidkit","project.json"),b.join(".rapidkit","context.json")]){let r=b.join(e,t);if(await I(r))try{let n=await ce(r),o=n.name??n.projectName??n.slug;if(typeof o=="string"&&o.trim())return o.trim()}catch{}}return null}async function Ze(e,t,r){let n=Ye(r);if(!n)return {projects:t,normalizedScope:null};let o=D(n).toLowerCase(),a=[];for(let c of t){let u=D(b.relative(e,c)),p=b.basename(c),m=await Xe(c);[u,p,m].filter(s=>typeof s=="string"&&s.length>0).map(s=>D(s).toLowerCase()).includes(o)&&a.push(c);}if(a.length===0)throw new Error(`Workspace run scope did not match any project: ${r}`);return {projects:a,normalizedScope:n}}async function et(e,t,r){let n=await execa("git",["diff","--name-only",`${r}...HEAD`],{cwd:e,reject:false});if(n.exitCode!==0)return new Set(t);let o=n.stdout.split(/\r?\n/).map(c=>c.trim()).filter(c=>c.length>0).map(c=>D(c));if(o.length===0)return new Set;let a=new Set;for(let c of t){let u=D(b.relative(e,c));if(!u||u===".")continue;let p=`${u}/`;o.some(m=>m===u||m.startsWith(p))&&a.add(c);}return a}async function tt(e,t,r){let n=await c(e,".workspai/workspace.contract.json")??l(e,"workspace.contract.json");if(await I(n))try{let g=await rt(e,t,r,n);if(g.graphStatus!=="missing")return g}catch{return {expanded:r,graphStatus:"invalid",expansionDepth:0}}let o=await c(e,".workspai/workspace-dependency-graph.json")??l(e,"workspace-dependency-graph.json");if(!await I(o))return {expanded:r,graphStatus:"missing",expansionDepth:0};let a;try{a=await ce(o);}catch{return {expanded:r,graphStatus:"invalid",expansionDepth:0}}let c$1=new Set(t.map(g=>b.resolve(g))),u=new Map;if(!a||typeof a!="object"||Array.isArray(a))return {expanded:r,graphStatus:"invalid",expansionDepth:0};let p=Array.isArray(a.projects)?a.projects:[];for(let g of p){if(!g||typeof g!="object"||Array.isArray(g))continue;let s=g,d=typeof s.path=="string"?s.path:"",y=b.resolve(e,d);if(!c$1.has(y))continue;let h=Array.isArray(s.dependsOn)?s.dependsOn.filter(w=>typeof w=="string"):[];for(let w of h){let x=b.resolve(e,w);c$1.has(x)&&(u.has(x)||u.set(x,new Set),u.get(x)?.add(y));}}let m=d$1(u,r);return {expanded:m.reached,graphStatus:"loaded",expansionDepth:m.added}}async function rt(e,t,r,n){let o=await ce(n);if(!o||typeof o!="object"||Array.isArray(o))return {expanded:r,graphStatus:"invalid",expansionDepth:0};let a=o,c=Array.isArray(a.projects)?a.projects:null;if(!c)return {expanded:r,graphStatus:"invalid",expansionDepth:0};let u=new Map,p=new Map;for(let y of t){let h=D(b.relative(e,y));p.set(h,b.resolve(y));}let m=new Map,g=new Map,s=new Map;for(let y of c){if(!y||typeof y!="object"||Array.isArray(y))continue;let h=y,w=typeof h.slug=="string"?h.slug:"",x=typeof h.relativePath=="string"?D(h.relativePath):w,R=p.get(x);!w||!R||u.set(w,R);}for(let y of c){if(!y||typeof y!="object"||Array.isArray(y))continue;let h=y,w=typeof h.slug=="string"?h.slug:"",x=u.get(w);if(!x)continue;let R=h.contracts&&typeof h.contracts=="object"&&!Array.isArray(h.contracts)?h.contracts:{},j=Array.isArray(R.dependsOn)?R.dependsOn.filter(v=>typeof v=="string"):[],N=Array.isArray(R.publishes)?R.publishes.filter(v=>typeof v=="string"):[],T=Array.isArray(R.consumes)?R.consumes.filter(v=>typeof v=="string"):[];for(let v of j){let S=u.get(v);S&&(s.has(S)||s.set(S,new Set),s.get(S)?.add(x));}for(let v of N)m.has(v)||m.set(v,new Set),m.get(v)?.add(x);for(let v of T)g.has(v)||g.set(v,new Set),g.get(v)?.add(x);}for(let[y,h]of m.entries()){let w=g.get(y);if(w)for(let x of h){s.has(x)||s.set(x,new Set);for(let R of w)R!==x&&s.get(x)?.add(R);}}let d=d$1(s,r);return {expanded:d.reached,graphStatus:"loaded",expansionDepth:d.added}}async function nt(e,t){if(typeof t=="boolean")return t;let r=o(e,"policies.yml").find(a=>_.existsSync(a))??l(e,"policies.yml");if(!await I(r))return true;let n="";try{n=await _.promises.readFile(r,"utf-8");}catch{return true}let o$1=n.match(/^[\t ]*rules\.enforce_workspace_run_gates:\s*(true|false)\s*(?:#.*)?$/m);return o$1?o$1[1]==="true":true}function ot(e){let t=process.env.RAPIDKIT_WORKSPACE_RUN_STAGE_TIMEOUT_MS;if(t){let r=Number.parseInt(t,10);if(Number.isFinite(r)&&r>0)return r}return e==="init"?12e4:9e4}async function ie(e,t,r){let n=process.argv[1];if(!n)return {exitCode:1,stdout:"",stderr:"RapidKit entrypoint is unavailable for nested workspace-run execution."};try{let o=await execa(process.execPath,[n,...e],{cwd:t,reject:false,timeout:r,env:{...process.env,RAPIDKIT_WORKSPACE_RUN_CHILD:"1"}});return {exitCode:Number(o.exitCode??1),stdout:o.stdout,stderr:o.stderr}}catch(o){return {exitCode:typeof o=="object"&&o!==null&&"timedOut"in o&&!!o.timedOut?124:1,stdout:typeof o=="object"&&o!==null&&"stdout"in o?String(o.stdout??""):"",stderr:typeof o=="object"&&o!==null&&"stderr"in o?String(o.stderr??""):o instanceof Error?o.message:String(o)}}}function st(e){return e==="node"||e==="go"||e==="java"||e==="python"||e==="dotnet"}function at(){return process.env.VITEST==="true"||process.env.VITEST==="1"||process.env.NODE_ENV==="test"}async function it(e){let t=process.cwd();try{process.chdir(e);let{handleInitCommand:r}=await import('./index.js');return {exitCode:await r(["init"]),stdout:"",stderr:""}}finally{process.chdir(t);}}async function ct(e){let t=s=>{let d=f(s);return d==="node"||d==="bun"?"node":d==="python"?"python":d==="go"?"go":d==="java"?"java":d==="php"?"php":d==="ruby"?"ruby":d==="rust"?"rust":d==="dotnet"?"dotnet":d==="elixir"?"elixir":d==="clojure"||d==="scala"||d==="kotlin"?"jvm-generic":Pe(e)},r=s=>{if(!s)return;let d=e$1(s);if(new Set(["fastapi","django","flask","nestjs","express","fastify","koa","gofiber","gogin","echo","springboot","laravel","symfony","rails","sinatra","dotnet","actix","axum","rocket","phoenix"]).has(d))return d},n=j(e),o=n?.detection??i(e,n?.projectJson??null),a=n?.contextJson,c=t(o.runtime),u=r(o.key),p={},m=new Set(["init","test","build","start"]);if(a?.commands&&typeof a.commands=="object")for(let[s,d]of Object.entries(a.commands))typeof d=="string"&&m.has(s)&&(p[s]=d);let g;if(a?.commandEnvironments&&typeof a.commandEnvironments=="object"){let s=a.commandEnvironments;g={dev:typeof s.dev=="string"?s.dev:void 0,staging:typeof s.staging=="string"?s.staging:void 0,prod:typeof s.prod=="string"?s.prod:void 0,default:typeof s.default=="string"?s.default:void 0};}return {runtime:c,framework:u,commandOverrides:Object.keys(p).length>0?p:void 0,environmentCommandVariants:g,environment:typeof a?.environment=="string"?a.environment:void 0}}async function ut(e,t,r,n,o,a,c){let u=!o?.[t]&&st(r),p;if(o&&o[t]?p=o[t]:u?p=`rapidkit ${t}`:p=se({projectPath:e,runtime:r,framework:n,stage:t}),!p)return {exitCode:127,command:`<stage not supported for ${r}>`,message:`No stage command found for runtime '${r}' and framework '${n||"unknown"}'`,errorCategory:"runtime"};let m=Fe(p,a,c);if(!m)return {exitCode:127,command:p,message:"Failed to resolve stage command",errorCategory:"runtime"};let g=se({projectPath:e,runtime:r,framework:n,stage:t});if(u){if(g){let f=u?await qe(e,r,g):await q(g);if(!f.valid)return {exitCode:127,command:m,message:f.reason||"Command not available",errorCategory:"setup"}}}else {let f=await q(m);if(!f.valid)return {exitCode:127,command:m,message:f.reason||"Command not available",errorCategory:"setup"}}let s=0,d="",y="",h,w=ot(t),x=Date.now();try{let f=u?t==="init"&&at()?await it(e):await ie([t],e,w):await execa(m,[],{cwd:e,reject:false,shell:true,timeout:w});if(s=Number(f.exitCode??0),d=f.stdout,y=f.stderr,s!==0){let C=`${d}
|
|
2
|
+
${y}`,z=Date.now()-x;h=s===124||ae(C)==="timeout"||s===143&&z>=Math.floor(w*.8)?"timeout":ae(C);}}catch(f){let C=typeof f=="object"&&f!==null&&"timedOut"in f&&!!f.timedOut;return {exitCode:C?124:1,command:m,message:C?`Stage timed out after ${w}ms`:f instanceof Error?f.message:"Command execution failed",errorCategory:C?"timeout":"runtime"}}let R,j=`${d}
|
|
3
|
+
${y}`.split(/\r?\n/).map(f=>f.trim()).filter(Boolean),N=j.slice(0,6).join(`
|
|
4
|
+
`),T=Date.now()-x,v=s===124||h==="timeout"||s===143&&T>=Math.floor(w*.8),S=s===0?void 0:v?"timeout":h,W=s===0||!S?void 0:{category:S,exitCode:s,command:m,timedOut:v,timeoutMs:w,...N?{outputExcerpt:N}:{}};return {exitCode:s,command:m,errorCategory:S,healthStatus:R,failureDiagnostic:W,message:v?`Stage timed out after ${w}ms`:s!==0?N?`Stage failed with exit code ${s}: ${j[0]}`:`Stage failed with exit code ${s}`:void 0}}function Ne(e){try{return JSON.parse(e)}catch{return null}}function dt(e){switch(e){case "dotnet":return "Install .NET 8+ SDK, then rerun `npx workspai setup dotnet` or `npx workspai init`.";case "go":return "Install Go 1.21+, then rerun `npx workspai setup go` or `npx workspai init`.";case "java":case "jvm-generic":return "Install Java 21+ and Maven/Gradle, then rerun `npx workspai setup java` or `npx workspai init`.";case "node":return "Install Node.js LTS and npm/pnpm/yarn, then rerun `npx workspai setup node` or `npx workspai init`.";case "python":return "Install Python 3.10+ and pip/Poetry, then rerun `npx workspai setup python` or `npx workspai init`.";default:return null}}async function lt(e){let t=[],r=await ie(["doctor","workspace","--json"],e);if(r.exitCode!==0)t.push({gate:"doctor-workspace",status:"fail",summary:"doctor workspace command failed"});else {let a=Ne(r.stdout)?.healthScore,c=Number(a?.errors??0);Number.isFinite(c)&&c>0?t.push({gate:"doctor-workspace",status:"fail",summary:`doctor workspace reports ${c} error(s)`}):t.push({gate:"doctor-workspace",status:"pass",summary:"doctor workspace passed"});}let n=await ie(["readiness","--json"],e);if(n.exitCode!==0)t.push({gate:"readiness",status:"fail",summary:"readiness command failed"});else {let o=Ne(n.stdout),a=String(o?.overallStatus??"").toLowerCase();a==="fail"?t.push({gate:"readiness",status:"fail",summary:"readiness overall status is fail"}):a==="warn"?t.push({gate:"readiness",status:"warn",summary:"readiness overall status is warn"}):t.push({gate:"readiness",status:"pass",summary:"readiness overall status is pass"});}return t}var pt=new Set(["dev","stop"]);function mt(e){let t=e.trim();return !t||pt.has(t.toLowerCase())?false:He.has(t)?true:/^[a-z][a-z0-9_-]*$/i.test(t)}function Oe(e,t,r){let n=D(b.relative(r,t));return (Array.isArray(e.projects)?e.projects:[]).some(a=>{if(!a||typeof a!="object")return false;let c=a,u=[c.relativePath,c.path].filter(p=>typeof p=="string"&&p.length>0).map(p=>D(p));return c.status==="passed"&&(u.includes(n)||u.some(p=>p.endsWith(`/${n}`)))})}function ft(e,t){return oe(e,t)?.dependencies??[]}function gt(e,t){let r=Math.max(1,Math.min(4,t)),n=Number(e??r);return Number.isFinite(n)?Math.max(1,Math.min(16,Math.trunc(n))):r}async function Yt(e$1){if(!mt(e$1.stage))throw new Error(`Unsupported workspace run stage: ${e$1.stage}`);let t=Date.now(),r=b.resolve(e$1.workspacePath),n=await d(r),o=await Qe(r),{projects:a,normalizedScope:c}=await Ze(r,o,e$1.scope),u=e$1.affected===true,p=e$1.blastRadius===true,m=e$1.since?.trim()||"HEAD~1",g=u?await et(r,a,m):new Set(a),s,d$1="not-applicable",y=0,h="all";if(u&&p){let l=await tt(r,o,g);s=l.expanded,d$1=l.graphStatus,y=l.expansionDepth,h="affected+blast-radius";}else u?(s=g,h="affected"):(s=g,h="all");let w=e$1.stage==="init"?false:await nt(r,e$1.enforceGates),x=w?await lt(r):[{gate:"doctor-workspace",status:"skipped",summary:"workspace run gates disabled"},{gate:"readiness",status:"skipped",summary:"workspace run gates disabled"}],R=x.find(l=>l.status==="fail"),j=a.filter(l=>s.has(l)),N=e$1.continueOnError===true||e$1.stage==="init",T=e$1.parallel===true,v=gt(e$1.maxWorkers,j.length),S=j.length,W=0;e$1.json||console.log(E.gray(`Workspace run (${e$1.stage}) started: ${S} target(s), ${T?`parallel x${v}`:"sequential"}`));let f=new Map;for(let l of o){let k=D(b.relative(r,l)),i=a.includes(l),F=i&&s.has(l);f.set(l,{path:l,relativePath:k,projectName:b.basename(k)||b.basename(l),selected:F,affected:F,status:"skipped",exitCode:null,durationMs:0,reason:F?void 0:i?"not affected":"outside scope",framework:void 0,runtimeDetected:void 0,executionCommand:void 0});}if(R)for(let l of j){let k=f.get(l);k&&(k.status="skipped",k.reason=`blocked by ${R.gate}`);}else {let l=async k=>{let i=f.get(k);if(!i)return;let F=D(b.relative(r,k));e$1.json||console.log(E.gray(`\u23F3 [${W}/${S}] ${e$1.stage} ${F}`)),i.selected=true,i.affected=true;let A=Date.now(),{runtime:P,framework:O,commandOverrides:Te,environmentCommandVariants:$e,environment:Ie}=await ct(k);i.runtimeDetected=P,i.framework=O;let pe=De(k,e$1.stage);if(!pe.supported){i.status="skipped",i.reason=pe.reason??`stage "${e$1.stage}" unsupported for project`,i.durationMs=Date.now()-A,i.exitCode=null,W+=1;return}if(e$1.reusePassed&&n){let $=n.stages[e$1.stage]??n.stages[e$1.stage];if($&&Oe($,k,r)){i.status="passed",i.reason="reused passed result from workspace-run-last.json",i.durationMs=Date.now()-A,i.exitCode=0,W+=1,e$1.json||console.log(E.gray(`\u21BA reused passed cache for ${F}`));return}}let me=ft(P,O);if(me.length>0&&n){let $=me.find(Q=>{let L=n.stages[Q];return !L||!Oe(L,k,r)});if($){i.status="skipped",i.reason=`dependency stage "${$}" not satisfied in workspace-run-last.json`,i.durationMs=Date.now()-A,i.exitCode=null,W+=1;return}}let M=await ut(k,e$1.stage,P,O,Te,$e,Ie);if(i.executionCommand=M.command,i.errorCategory=M.errorCategory,i.healthStatus=M.healthStatus,i.failureDiagnostic=M.failureDiagnostic,i.durationMs=Date.now()-A,i.exitCode=M.exitCode,M.exitCode===0?(i.status="passed",i.reason=void 0):(i.status="failed",i.reason=M.message||"stage command failed",i.errorMessage=M.message),W+=1,!e$1.json){let $=S>0?Math.round(W/S*100):100,Q=i.status==="passed"?E.green("\u2705"):E.red("\u274C");if(console.log(E.gray(`${Q} [${W}/${S}] (${$}%) ${F} ${i.durationMs}ms`)),i.status==="failed"){i.reason&&console.log(E.red(` Reason: ${i.reason}`)),i.executionCommand&&console.log(E.gray(` Command: ${i.executionCommand}`));let L=dt(i.runtimeDetected);L&&i.errorCategory==="setup"&&console.log(E.gray(` Hint: ${L}`));}}};if(T&&j.length>1){let k=0,i=false,F=new Array(v).fill(null).map(async()=>{for(;k<j.length;){if(i&&!N)return;let A=k;k+=1;let P=j[A];await l(P),f.get(P)?.status==="failed"&&(i=true);}});if(await Promise.all(F),!N&&i){let A=false;for(let P of j){let O=f.get(P);if(O){if(O.status==="failed"){A=true;continue}A&&O.status==="skipped"&&(O.reason=O.reason||"stopped after failure");}}}}else for(let k of j){await l(k);let i=f.get(k);if(!N&&i?.status==="failed"){let F=j.slice(j.indexOf(k)+1);for(let A of F){let P=f.get(A);P&&(P.status="skipped",P.reason="stopped after failure");}break}}}let C=[];for(let l of o){let k=f.get(l);k&&C.push(k);}let z=C.filter(l=>l.status==="passed").length,K=C.filter(l=>l.status==="failed").length,ue=C.filter(l=>l.status==="skipped").length,de=e$1.strict===true,We=K>0||de&&x.some(l=>l.status==="fail"||l.status==="warn")?1:0,le={schemaVersion:"1.0",workspacePath:r,stage:e$1.stage,generatedAt:new Date().toISOString(),durationMs:Date.now()-t,options:{affected:u,blastRadius:p,since:u?m:null,parallel:T,maxWorkers:v,continueOnError:N,strict:de,enforceGates:w,scope:c,reusePassed:e$1.reusePassed===true},selection:{mode:h,since:u?m:null,scope:c,graphStatus:d$1,expansionDepth:y},gates:{enforced:w,results:x,blocked:!!R,blockingGate:R?.gate},summary:{projectCount:o.length,selectedCount:j.length,passed:z,failed:K,skipped:ue,exitCode:We},projects:C,enterpriseControls:{jsonReady:true,evidencePath:b$1}},Me=b.join(r,b$1);return await e(r,le),e$1.json||(R&&(console.log(E.red(`\u274C Workspace run blocked by ${R.gate}`)),console.log(E.gray(` ${R.summary}`))),console.log(E.cyan(`Workspace run (${e$1.stage}) => passed: ${z}, failed: ${K}, skipped: ${ue}`)),console.log(E.gray(`Report: ${Me}`))),le}export{Yt as a};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {b,c as c$1,d}from'./chunk-EWYYLJQY.js';import {d as d$1}from'./chunk-CVTCPPEF.js';import {b as b$1,f,j as j$1,k as k$1,h,i,l as l$1,m,n as n$2,o,p,q,r,t,v,x,s,u,w as w$1,y,z as z$1,A,B as B$1,C,D,E as E$1,F as F$1,G,a,H,I}from'./chunk-DNAY5ALC.js';import {n as n$1,k as k$2,b as b$2,j as j$2}from'./chunk-5SWNSJGW.js';import {j}from'./chunk-VZKSNUEE.js';import {c}from'./chunk-NAAQMSO3.js';import n from'path';import k from'fs-extra';var U=["Scope","Evidence","Diagnosis","Fix Plan","Run","Verify","Assumptions"];var it="workspace-operational-skill.v1";function ct(e){if(typeof e!="string")return null;let t=e.trim();return !t||t.includes("/")||t.includes("..")?null:t}function Ge(e){let t=ct(e.skillId);if(!t)throw new Error(`Invalid skill id: ${e.skillId}`);return {schemaVersion:it,skillId:t,canonicalPath:H(t),title:e.title,triggers:[...e.triggers].sort((r,o)=>r.localeCompare(o)),requiredReports:[...e.requiredReports].sort((r,o)=>r.localeCompare(o)),scopedProjects:[...e.scopedProjects??[]].sort((r,o)=>r.localeCompare(o)),verificationCommands:[...e.verificationCommands],answerContractSections:[...U],...e.promptStem?{promptStem:e.promptStem}:{},markdown:e.markdown}}var pt="workspace-skills-index.v1";function He(e){let t=[...e.skills].sort((o,c)=>o.skillId.localeCompare(c.skillId)),r=e.inputsHash??b$2({skillIds:t.map(o=>o.skillId),paths:t.map(o=>o.canonicalPath)});return {schemaVersion:pt,generatedAt:e.generatedAt,inputsHash:r,skills:t.map(o=>({skillId:o.skillId,path:o.canonicalPath,schemaVersion:o.schemaVersion,title:o.title}))}}var Me=[".workspai/reports/INDEX.json",b,d$1],lt=[{skillId:"workspai-diagnose-api-failure",title:"Diagnose API failure",triggers:["api failure","500 error","integration test failed","service unreachable"],objective:"Investigate a failing API or service using Workspai evidence before editing application code.",steps:["Read `.workspai/reports/INDEX.json` and identify fail/warn reports for the scoped project.","Read `.workspai/reports/doctor-last-run.json`, `doctor-project-last-run.json`, and project-scoped run evidence if present.","If a fix was requested, read `artifact-remediation-plan-last-run.json` for cross-artifact next steps, then `doctor-remediation-plan-last-run.json` for Doctor-specific file edits.","Map the failure to workspace vs project scope; cite exit codes and blocker messages.","Propose the smallest safe fix (config, env, dependency) with explicit verification commands."]},{skillId:"workspai-release-readiness",title:"Release readiness",triggers:["release","ship","production","readiness gate"],objective:"Assess whether this workspace is release-ready using governed Workspai gates.",steps:["Read `.workspai/reports/release-readiness-last-run.json` and `pipeline-last-run.json`.","Read `.workspai/reports/workspace-verify-last-run.json` for verdict and blocking reasons.","Read `.workspai/reports/artifact-remediation-plan-last-run.json` when a Studio or agent repair path is needed.","List blocking gates first; never claim ready without cited report fields.","Provide one safe next command and a verification checklist."]},{skillId:"workspai-safe-schema-migration",title:"Safe schema migration",triggers:["migration","schema change","database migration","db migrate"],objective:"Plan and verify a schema migration with blast-radius awareness.",steps:["Identify affected projects from workspace model and dependency graph.","Run or review impact/verify evidence for transitive dependents.","Require project-scoped test/build commands before promoting the migration.","Document rollback and verification signals."]},{skillId:"workspai-dependency-upgrade",title:"Dependency upgrade",triggers:["upgrade dependency","bump package","security advisory","outdated deps"],objective:"Upgrade dependencies with graph-aware verification.",steps:["Scope the upgrade to the owning project from workspace model.","Check transitive dependents via workspace graph / impact reports.","Prefer workspace run test/build for affected projects.","Re-run `workspace verify` after evidence refresh."]},{skillId:"workspai-rename-contract",title:"Rename contract safely",triggers:["rename contract","rename event","breaking api","contract change"],objective:"Rename or change a shared contract with consumer awareness.",steps:["Read `.workspai/workspace.contract.json` for publishes/consumes/owns edges.","List all consumer projects before proposing renames.","Update contract file and regenerate workspace model.","Verify contract gate and integration tests for consumers."]}];function z(e){return `npx workspai ${e}`.trim()}function dt(e){let t=[`# ${e.template.title}`,"",`> Workspace: **${e.workspaceName}** \xB7 Skill: \`${e.template.skillId}\``,"","## Objective","",e.template.objective,"","## Triggers","",...e.template.triggers.map(r=>`- ${r}`),"","## Required evidence (read first)","",...Me.map(r=>`- \`${r}\``),"","## Procedure","",...e.template.steps.map((r,o)=>`${o+1}. ${r}`),""];if(e.scopedProjects.length>0&&t.push("## Scoped projects","",...e.scopedProjects.map(r=>`- ${r}`),""),e.contractSummary&&t.push("## Contract context","",e.contractSummary,""),e.verificationCommands.length>0){t.push("## Verification commands (this workspace)","");for(let r of e.verificationCommands)t.push(`- \`${r}\``);t.push("");}return t.push("## Answer contract","","Return: Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.","","## Refresh stale evidence","","```bash",z("workspace agent-sync --write --refresh-context"),"```",""),t.join(`
|
|
2
|
+
`)}function ut(e){return e?.safeCommands?.length?e.safeCommands.slice(0,8).map(t=>t.display):[z("workspace verify --json"),z("doctor workspace --json")]}function gt(e){return e?.projects?.length?e.projects.slice(0,12).map(r=>{let o=r.contracts.owns.join(", ")||"none",c=r.contracts.publishes.join(", ")||"none",d=r.contracts.consumes.join(", ")||"none";return `- **${r.slug}**: owns \`${o}\`; publishes \`${c}\`; consumes \`${d}\``}).join(`
|
|
3
|
+
`):void 0}function Ke(e){let t=e.model.workspace.name,r=e.model.projects.map(d=>d.name).sort(),o=ut(e.context??null),c=gt(e.contract??null);return lt.map(d=>{let p=dt({template:d,workspaceName:t,scopedProjects:r,verificationCommands:o,contractSummary:c});return Ge({skillId:d.skillId,title:d.title,triggers:d.triggers,requiredReports:[...Me],scopedProjects:r,verificationCommands:o,promptStem:I[d.skillId],markdown:p})})}async function qe(e){let t=n.resolve(e.workspacePath),r=[],o=b$2({skills:e.skills.map(d=>({id:d.skillId,path:d.canonicalPath,hash:b$2({markdown:d.markdown})}))}),c=He({generatedAt:e.generatedAt,skills:e.skills,inputsHash:o});if(e.write){for(let p of e.skills){let s=n.join(t,p.canonicalPath);await k.ensureDir(n.dirname(s)),await k.writeFile(s,p.markdown,"utf8"),r.push(p.canonicalPath);}let d=n.join(t,b$1);await k.ensureDir(n.dirname(d)),await k.writeJson(d,c,{spaces:2}),r.push(b$1);}return {skills:e.skills,index:c,writtenPaths:r}}function $e(e){return ["## Operational skills (canonical)","","Read workspace-native playbooks from `.workspai/skills/` before generic repo scans. Legacy `.rapidkit/skills/` playbooks are read only when already present from older workspaces:","",...e.skills.map(r=>`- \`${r.path}\` \u2014 ${r.title} (\`${r.skillId}\`)`),"","Regenerate:","","```bash",z("workspace agent-sync --write --refresh-context"),"```",""].join(`
|
|
4
|
+
`)}var kt={"workspai-diagnose-api-failure":p,"workspai-release-readiness":t},Ae="## Workspace verification (hydrated)";function mt(e){let t=[Ae,"","Verification commands for this workspace:","",...e.verificationCommands.length?e.verificationCommands.map(r=>`- \`${r}\``):["- `npx workspai workspace verify --json`"]];return e.scopedProjects.length>0&&t.push("","Scoped projects:","",...e.scopedProjects.map(r=>`- ${r}`)),t.push(""),t.join(`
|
|
5
|
+
`)}async function Ve(e){let t=n.resolve(e.workspacePath),r=[];for(let o of e.skills){let c=kt[o.skillId];if(!c)continue;let d=n.join(t,c);if(!await k.pathExists(d))continue;let p=await k.readFile(d,"utf8"),s=mt(o),m=p.includes(Ae)?p.replace(new RegExp(`${Ae}[\\s\\S]*$`),s.trimEnd()):`${p.trimEnd()}
|
|
6
|
+
|
|
7
|
+
${s}`;e.write&&await k.writeFile(d,`${m.trimEnd()}
|
|
8
|
+
`,"utf8"),r.push(c);}return r}var ft="rapidkit-agent-customization-pack.v1";function Ue(){return {schemaVersion:ft,presets:{minimal:{meaning:"Generate the portable grounding index, AGENTS.md, and provider-specific lightweight instructions.",requiredOutputs:[".workspai/reports/INDEX.json",".workspai/reports/agent-customization-pack.json","AGENTS.md"]},enterprise:{meaning:"Generate the full VS Code-native pack: instructions, prompts, skills, custom agents, and validation metadata.",requiredOutputs:[".workspai/reports/INDEX.json",".workspai/reports/agent-customization-pack.json","AGENTS.md",l$1,p,B$1,".github/agents/workspai-advisor.agent.md",D,b$1]}},targets:{all:{meaning:"Generate every supported customization surface.",outputFamilies:["portable","vscode","copilot","cursor","claude"]},vscode:{meaning:"Generate VS Code-native customizations for Copilot Chat and agent workflows.",outputFamilies:["instructions","prompts","skills","agents","hooks"]},agents:{meaning:"Generate portable AGENTS.md grounding for any agent.",outputFamilies:["portable"]},copilot:{meaning:"Generate GitHub Copilot instructions, prompts, and skills.",outputFamilies:["instructions","prompts","skills"]},cursor:{meaning:"Generate Cursor rules.",outputFamilies:["rules"]},claude:{meaning:"Generate Claude Code grounding files.",outputFamilies:["rules","portable"]},codex:{meaning:"Use AGENTS.md and the report index as the Codex grounding layer.",outputFamilies:["portable"]},orca:{meaning:"Use AGENTS.md and the report index as the Orca/Grok grounding layer.",outputFamilies:["portable"]}},standardAnswerContract:[...U],requiredReports:N.map(e=>({path:e.relativePath,label:e.label,required:e.required})),strictRules:["Required reports must exist.","Generated report paths must stay inside the workspace root.","Generated customization text must be English-only.","Agent answers must not claim pass, ready, or healthy without cited evidence.","Commands must distinguish display guidance from execution requests.","Agent hook files must be advisory and disabled by default unless the user explicitly enables them.","MCP design artifacts must stay read-mostly until write tools have explicit approval boundaries."],outputKinds:["report","grounding","instruction","prompt","skill","skill-resource","operational-skill","skills-index","explain-report","agent","rule","hook","mcp-design"],pathLayers:{l1CanonicalRoots:[".workspai/reports/",`${a}/`],l2PrefixedMirrorRoots:[".github/",".cursor/",".claude/"],l3SharedIndustryFiles:["AGENTS.md",".github/copilot-instructions.md","CLAUDE.md"]}}}var wt="rapidkit-agent-reports-index.v1",ht="rapidkit-agent-customization-pack.v1",Pe=".workspai/reports/INDEX.json",F=".workspai/reports/agent-customization-pack.json";var N=[{relativePath:b,label:"Agent context pack",required:true},{relativePath:b$1,label:"Operational skills index",required:true},{relativePath:".workspai/reports/workspace-model.json",label:"Workspace model graph",required:false},{relativePath:".workspai/reports/doctor-last-run.json",label:"Workspace doctor",required:false},{relativePath:".workspai/reports/doctor-project-last-run.json",label:"Project doctor",required:false},{relativePath:".workspai/reports/doctor-remediation-plan-last-run.json",label:"Doctor remediation plan",required:false},{relativePath:".workspai/reports/artifact-remediation-plan-last-run.json",label:"Artifact remediation plan",required:false},{relativePath:".workspai/reports/doctor-fix-result-last-run.json",label:"Doctor fix result",required:false},{relativePath:".workspai/reports/analyze-last-run.json",label:"Workspace analyze",required:false},{relativePath:".workspai/reports/pipeline-last-run.json",label:"Governance pipeline",required:false},{relativePath:".workspai/reports/release-readiness-last-run.json",label:"Release readiness",required:false},{relativePath:".workspai/reports/workspace-impact-last-run.json",label:"Workspace impact",required:false},{relativePath:".workspai/reports/workspace-verify-last-run.json",label:"Workspace verify",required:false},{relativePath:".workspai/reports/workspace-model-snapshot.json",label:"Workspace model snapshot",required:false},{relativePath:".workspai/reports/workspace-model-diff-last-run.json",label:"Workspace model diff",required:false},{relativePath:".workspai/reports/workspace-explain-last-run.json",label:"Workspace explain",required:false},{relativePath:".workspai/reports/workspace-contract-verify-last-run.json",label:"Workspace contract verify",required:false},{relativePath:".workspai/reports/workspace-intelligence-history.json",label:"Workspace intelligence history",required:false}];function w(e){return `npx workspai ${e}`.trim()}function ot(e){return e&&typeof e=="object"?e:null}function Re(e,t=12){return Array.isArray(e)?e.filter(r=>typeof r=="string"&&r.trim().length>0).slice(0,t):[]}function At(e){let t=Re(e.blockers,12);if(t.length>0)return t;let r=Re(e.blockingReasons,12);if(r.length>0)return r;let o=ot(e.summary);return o&&Array.isArray(o.blockingReasons)?Re(o.blockingReasons,12):[]}function Pt(e){for(let t of ["generatedAt","timestamp"]){let r=e[t];if(typeof r=="string"&&r.trim())return r.trim()}}function Rt(e,t,r){if(!e)return true;let o=Date.parse(e);return Number.isFinite(o)?r.getTime()-o>t*60*60*1e3:true}function St(e){let t=e&&e.length>0?e:["all"];return t.includes("all")?new Set(["all","vscode","agents","copilot","cursor","claude","codex","orca"]):new Set(t)}function P(e,t){return e.has("all")||e.has(t)}function Ot(e){return P(e,"copilot")||P(e,"vscode")}function yt(e){return e??"enterprise"}function Ct(e){return e===b$1?"skills-index":e.includes("workspace-explain-last-run.json")?"explain-report":(e.startsWith(`${a}/`)||e.startsWith(".rapidkit/skills/"))&&e.endsWith(".md")?"operational-skill":e.includes("hooks")||e===F$1||e===G?"hook":e.includes("mcp")||e===D||e===E$1?"mcp-design":e.endsWith(".json")?"report":e.includes("/instructions/")||e.endsWith("copilot-instructions.md")?"instruction":e.includes("/prompts/")?"prompt":e.includes("/skills/")&&e.endsWith("/SKILL.md")?"skill":e.includes("/skills/")?"skill-resource":e.includes("/agents/")?"agent":e.includes("/rules/")||e.endsWith(".mdc")?"rule":"grounding"}function xt(e){return e.startsWith(".github/")?["vscode","copilot"]:e.startsWith(".cursor/")?["cursor"]:e.startsWith(".claude/")||e==="CLAUDE.md"?["claude"]:e==="AGENTS.md"||e.startsWith(".rapidkit/")?["agents","codex","orca","vscode"]:e.startsWith(".vscode/")?["vscode"]:["agents"]}function Et(e,t){return Ue().presets[t].requiredOutputs.includes(e)}function It(e){return e.schemaVersion===j$2&&typeof e.generatedAt=="string"&&e.summary!=null&&typeof e.summary=="object"&&!Array.isArray(e.summary)&&Array.isArray(e.projects)}async function bt(e,t){if(t)return t;let r=await c(e,k$2)??n.join(e,k$2);if(await k.pathExists(r))try{let o=await k.readJson(r);if(It(o))return o}catch{}return n$1({workspacePath:e,includeEvidence:true})}function _t(e){return e.length>0&&!n.isAbsolute(e)&&!e.split(/[\\/]+/).includes("..")}function Tt(e){return Object.fromEntries(["all","vscode","agents","copilot","cursor","claude","codex","orca"].map(r=>[r,{enabled:e.targets.includes("all")||e.targets.includes(r),outputs:e.outputs.filter(o=>o.targets.includes(r)).map(o=>o.path).sort()}]))}async function jt(e){try{if(!await k.pathExists(e))return null;let t=await k.readJson(e);return ot(t)}catch{return null}}async function ze(e){let t=e.now??new Date,r=e.staleAfterHours??24,o=[],c$1=[];for(let p of N){let s=await c(e.workspacePath,p.relativePath)??n.join(e.workspacePath,p.relativePath),m=await jt(s),I=m!==null;I&&m&&c$1.push(...At(m)),o.push({path:p.relativePath,label:p.label,required:p.required,exists:I,generatedAt:m?Pt(m):void 0,commandId:typeof m?.commandId=="string"?m.commandId:void 0,exitCode:typeof m?.exitCode=="number"?m.exitCode:void 0});}let d=[...new Set(c$1.map(p=>p.trim()).filter(Boolean))].slice(0,16);return {schemaVersion:wt,generatedAt:t.toISOString(),workspaceRoot:e.workspacePath,readOrder:N.map(p=>p.relativePath),blockers:d,staleAfterHours:r,reports:o,refreshCommand:w("workspace agent-sync --write --refresh-context")}}function Fe(e){let t=["# Workspai agent grounding","","Cross-tool instructions for Copilot, Cursor, Claude Code, Codex, Grok, and other agents.","","## Read order (mandatory before workspace diagnosis)","","1. `.workspai/reports/INDEX.json` \u2014 latest blockers, timestamps, and report paths","2. `.workspai/reports/workspace-context-agent.json` \u2014 canonical agent context pack","3. Evidence artifacts listed in the index (doctor, analyze, pipeline, readiness, impact, verify)","","Do **not** full-repo scan until these reports are read or regenerated.","","## Regenerate intelligence","","```bash",w("workspace agent-sync --write --refresh-context"),w("workspace context --for-agent --json --write"),w("pipeline --json --write"),"```",""];if(e.index.blockers.length>0){t.push("## Current blockers","");for(let r of e.index.blockers.slice(0,12))t.push(`- ${r}`);t.push("");}if(e.context?.safeCommands?.length){t.push("## Safe commands (prefer these)","");for(let r of e.context.safeCommands.slice(0,10))t.push(`- \`${r.display}\` \u2014 ${r.description}`);t.push("");}return t.push("## Rules","","- Treat `.workspai/reports/*` as the source of truth for health, gates, and release posture.","- Prefer deterministic Workspai CLI commands over heuristic framework guesses.","- If evidence is missing or stale, run the refresh commands above before proposing fixes.","- Keep project-scoped advice aligned with the active project named in the context pack.",""),t.join(`
|
|
9
|
+
`)}function vt(e){return ["# Workspai agent grounding","",`Generated: ${e.generatedAt}`,"","This file is tool-agnostic. Synced agents should read it together with `.workspai/reports/INDEX.json`.","","## Mandatory read order","",...e.readOrder.map((t,r)=>`${r+1}. \`${t}\``),"",e.blockers.length>0?"## Blockers":"",...e.blockers.length>0?e.blockers.map(t=>`- ${t}`):[],"","## Refresh","","```bash",e.refreshCommand,"```",""].filter(t=>t!=="").join(`
|
|
10
|
+
`)}function Wt(){return ["# Workspai workspace grounding","","Before answering workspace, release, or architecture questions:","","1. Read `AGENTS.md` (managed Workspai section).","2. Read `.workspai/reports/INDEX.json` and `.workspai/reports/workspace-context-agent.json`.","3. Use evidence reports before scanning the full repository.","","Regenerate stale intelligence:","","```bash",w("workspace agent-sync --write --refresh-context"),"```",""].join(`
|
|
11
|
+
`)}function Nt(){return ["## Claude Code","","- Load `.workspai/reports/INDEX.json` before diagnosing blockers.","- Use `.claude/rules/workspai-evidence.md` for scoped Workspai evidence rules.","- Treat `.claude/rules/rapidkit-evidence.md` as a legacy compatibility mirror.","- Refresh grounding with `npx workspai workspace agent-sync --write`.",""].join(`
|
|
12
|
+
`)}function Xe(){return ["---","description: Workspai workspace evidence and intelligence grounding","globs: []","alwaysApply: true","---","","Before proposing fixes in this workspace:","","1. Read `AGENTS.md` and `.workspai/reports/INDEX.json`.","2. Read `.workspai/reports/workspace-context-agent.json`.","3. Prefer evidence in `.workspai/reports/*` over full-repo exploration.","","Refresh when stale:","","```bash",w("workspace agent-sync --write --refresh-context"),"```",""].join(`
|
|
13
|
+
`)}function Be(){return ["---",'applyTo: ".workspai/**,**/.workspai/**,.rapidkit/**,**/.rapidkit/**"',"description: Workspai evidence and intelligence artifacts","---","","When working under `.workspai/` or legacy `.rapidkit/`:","","- Treat `.workspai/reports/*` JSON reports as canonical gate and health evidence.","- Start from `.workspai/reports/INDEX.json` for read order and blockers.","- Do not invent pass/fail state \u2014 cite `exitCode`, `blockers`, and `generatedAt` fields.",""].join(`
|
|
14
|
+
`)}function Ye(){return ["---",'applyTo: "**"',"description: Workspai workspace scope, evidence, and command discipline","---","","# Workspai Workspace Intelligence","","Use Workspai reports as the workspace source of truth before giving architectural, repair, release, or project lifecycle advice.","","## Scope rules","","- Start from `.workspai/reports/INDEX.json` and `.workspai/reports/workspace-context-agent.json`.","- Distinguish workspace-level blockers from project-level blockers.","- When a project is active, cite its name, path, framework, and evidence source.","- Do not translate unsupported stack requests into unrelated native kits.","","## Answer contract","","Return answers with: Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.",""].join(`
|
|
15
|
+
`)}function Je(){return ["# Workspai evidence","","Applies when reading or editing `.workspai/reports/*`.","","- Start from `INDEX.json`, then `workspace-context-agent.json`.","- Use report blockers as the primary fix target.","- Regenerate with `npx workspai workspace agent-sync --write`.",""].join(`
|
|
16
|
+
`)}function Ze(){return ["---","description: Diagnose Workspai workspace blockers from evidence reports","---","","Diagnose this workspace using Workspai evidence only.","","Read:","","- `.workspai/reports/INDEX.json`","- `.workspai/reports/workspace-context-agent.json`","- Any fail/warn reports referenced in the index","","Return:","","1. Root cause grounded in report blockers","2. Smallest safe fix path (commands + file edits)","3. One verification command to prove recovery",""].join(`
|
|
17
|
+
`)}function X(e){return ["---",`description: ${e.description}`,"---","",e.objective,"","Read first:","","- `.workspai/reports/INDEX.json`","- `.workspai/reports/workspace-context-agent.json`","- Any report referenced by the current blocker or task","","Return:","",...e.expectedOutput.map((t,r)=>`${r+1}. ${t}`),"","Use the standard Workspai answer contract: Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.",""].join(`
|
|
18
|
+
`)}function E(e){return ["# "+e.title,"",...e.lines,""].join(`
|
|
19
|
+
`)}function Lt(){return E({title:"MCP Tool Design",lines:["Workspai MCP is a future read-mostly bridge. Use the CLI reports today; do not assume a running MCP server exists.","","Candidate read tools:","- `getWorkspaceModel` \u2014 read `.workspai/reports/workspace-model.json`.","- `getEvidenceIndex` \u2014 read `.workspai/reports/INDEX.json`.","- `getBlockers` \u2014 derive current blockers from INDEX and gate reports.","- `getSafeCommands` \u2014 read safe commands from `workspace-context-agent.json`.","- `getProjectContext` \u2014 return one project-scoped slice of the workspace model.","- `getArtifact` \u2014 read one explicit artifact path inside the workspace root.","- `listOperationalSkills` \u2014 read `.workspai/reports/workspace-skills-index.json`.","- `getWorkspaceExplain` \u2014 read/build workspace explain for release-blocked or project scope.","- `refreshWorkspaceIntelligence` \u2014 explicit user-approved refresh command only.","","Write or repair tools require explicit approval boundaries and are intentionally not part of the first read-mostly design."]})}function Qe(e){return `${JSON.stringify({schemaVersion:"workspai-mcp-design.v1",generatedAt:e.generatedAt,workspaceRoot:e.workspacePath,status:"design-only",mode:"read-mostly",safety:{writeToolsEnabled:false,approvalRequiredForRefresh:true,artifactReadsMustStayInsideWorkspace:true},candidateTools:[{name:"getWorkspaceModel",reads:[".workspai/reports/workspace-model.json"],mutates:false},{name:"getEvidenceIndex",reads:[".workspai/reports/INDEX.json"],mutates:false},{name:"getBlockers",reads:[".workspai/reports/INDEX.json",".workspai/reports/workspace-verify-last-run.json",".workspai/reports/pipeline-last-run.json"],mutates:false},{name:"getSafeCommands",reads:[".workspai/reports/workspace-context-agent.json"],mutates:false},{name:"getProjectContext",reads:[".workspai/reports/workspace-model.json",".workspai/reports/workspace-context-agent.json"],mutates:false},{name:"getArtifact",reads:["requested workspace-relative artifact path"],mutates:false},{name:"listOperationalSkills",reads:[".workspai/reports/workspace-skills-index.json"],mutates:false},{name:"getWorkspaceExplain",reads:[".workspai/reports/workspace-explain-last-run.json",".workspai/reports/workspace-verify-last-run.json",".workspai/reports/workspace-impact-last-run.json"],mutates:false},{name:"refreshWorkspaceIntelligence",command:w("workspace agent-sync --write --refresh-context"),mutates:true,approvalRequired:true}]},null,2)}
|
|
20
|
+
`}function et(e){return `${JSON.stringify({schemaVersion:"workspai-agent-hooks.v1",generatedAt:e.generatedAt,workspaceRoot:e.workspacePath,enabledByDefault:false,mode:"advisory",hooks:[{name:"workspai-pre-tool-use-workspace-boundary",event:"PreToolUse",purpose:"Block or warn on state-changing commands outside the active workspace root.",defaultAction:"warn",rules:["Allow read-only commands.","Warn before write/delete commands outside workspaceRoot.","Never run destructive commands without explicit user approval."]},{name:"workspai-post-tool-use-verify-suggestion",event:"PostToolUse",purpose:"Suggest non-destructive verification commands after edits.",defaultAction:"suggest",commands:[w("doctor workspace"),w("workspace verify --strict --json")]},{name:"workspai-user-prompt-submit-scope-hint",event:"UserPromptSubmit",purpose:"Inject lightweight workspace scope and evidence index hints.",defaultAction:"inject-context-hint",reads:[".workspai/reports/INDEX.json",".workspai/reports/workspace-context-agent.json"]}]},null,2)}
|
|
21
|
+
`}function tt(e){let t=["---","name: workspai-workspace-intelligence","description: Use Workspai workspace intelligence reports to answer, repair, verify, and release with evidence","---","","# Workspai Workspace Intelligence","","Use this skill for workspace architecture, project lifecycle, blocker repair, release readiness, agent grounding, and CI evidence questions.","","## Decision flow","","1. Load `resources/scope-model.md`.","2. Load `.workspai/reports/INDEX.json`.","3. Load `.workspai/reports/workspace-context-agent.json`.","4. Load `.workspai/reports/workspace-skills-index.json` when operational playbooks are needed.","5. Load the smallest evidence report required for the task.","6. Answer with Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.","","## Rules","","- Prefer Workspai reports over full-repo scans.","- Never claim a gate passed without a cited report.","- Separate display commands from execution requests.","- Keep project-scoped fixes inside the active project unless workspace evidence says otherwise.",""];return e?.trim()&&t.push(e.trim(),""),t.join(`
|
|
22
|
+
`)}function B(e){return ["---",`name: ${e.name}`,`description: ${e.description}`,`tools: [${e.tools.map(t=>`'${t}'`).join(", ")}]`,"---","",`You are the ${e.name} agent for Workspai Workspace Intelligence.`,"",`Mode: ${e.mode}.`,"","Start every task by reading `.workspai/reports/INDEX.json` and `.workspai/reports/workspace-context-agent.json`.","","Use this answer contract:","","- Scope","- Evidence","- Diagnosis","- Fix Plan","- Run","- Verify","- Assumptions","","Do not invent health, readiness, or policy status. Cite report paths and command outputs.",""].join(`
|
|
23
|
+
`)}function rt(){return ["---","name: workspai-grounding","description: Load Workspai workspace intelligence reports before diagnosing or changing code","---","","# Workspai grounding","","Use when the user asks about workspace health, release gates, doctor/pipeline failures, or project structure.","","## Workflow","","1. Read `.workspai/reports/INDEX.json`","2. Read `.workspai/reports/workspace-context-agent.json`","3. Read fail/warn evidence artifacts listed in the index","4. Propose the smallest safe fix with explicit verification commands","","## Refresh stale evidence","","```bash",w("workspace agent-sync --write --refresh-context"),"```",""].join(`
|
|
24
|
+
`)}async function l(e,t,r){return r?(await k.ensureDir(n.dirname(e)),await k.writeFile(e,t,"utf8"),"written"):"skipped"}async function Se(e){if(!e.write)return "skipped";let t=await k.pathExists(e.absolutePath)?await k.readFile(e.absolutePath,"utf8"):null,{upsertManagedAgentSection:r}=await import('./managed-agent-markers-AXUM75OE.js'),o=r(t,e.generatedBody),c=e.preamble?`${e.preamble.trimEnd()}
|
|
25
|
+
|
|
26
|
+
${o}`:o;return await k.ensureDir(n.dirname(e.absolutePath)),await k.writeFile(e.absolutePath,c,"utf8"),"written"}function Pr(e){if(!e?.trim())return;let t=new Set(["all","vscode","agents","copilot","cursor","claude","codex","orca"]),r=e.split(",").map(o=>o.trim().toLowerCase()).filter(o=>t.has(o));return r.length>0?r:void 0}function Dt(e){let t=[...e.outputs].sort((r,o)=>r.path.localeCompare(o.path));return {schemaVersion:ht,generatedAt:e.generatedAt,workspaceRoot:e.workspacePath,preset:e.preset,targets:[...e.targets].sort(),sourceReports:e.index.reports.filter(r=>r.exists).map(r=>r.path).sort(),outputInventory:t,capabilityMatrix:Tt({targets:e.targets,outputs:t}),drift:{missingRequired:e.missingRequired,staleReports:e.staleReports,strictViolations:e.strictViolations},answerContract:["Scope","Evidence","Diagnosis","Fix Plan","Run","Verify","Assumptions"],refreshCommand:w(`workspace agent-sync --write --refresh-context --preset ${e.preset}`),experimental:{hooksEnabled:e.experimentalHooks,mcpReady:t.some(r=>r.kind==="mcp-design")}}}async function Rr(e){let t$1=n.resolve(e.workspacePath),r$1=new Date,o$1=e.staleAfterHours??24,c=St(e.targets),d$1=[...c].sort(),p$1=yt(e.preset),s$1=e.write===true,m$1=e.strict===true,I,b=null,Y;e.refreshContext&&(Y=await n$1({workspacePath:t$1,includeEvidence:true}),b=await c$1({workspacePath:t$1,model:Y,agent:e.agent??"generic",scope:e.scope,includeEvidence:true}),s$1&&(I=await d(b,t$1)));let h$1=await ze({workspacePath:t$1,staleAfterHours:o$1,now:r$1}),_=[],J=[],Z=[],Q=[],a=(i,g)=>{i==="written"?J.push(g):Z.push(g),Q.push({path:g,kind:Ct(g),targets:xt(g),required:Et(g,p$1),status:i==="written"?"written":e.dryRun?"planned":"skipped"});};a(await l(n.join(t$1,Pe),`${JSON.stringify(h$1,null,2)}
|
|
27
|
+
`,s$1),Pe),a(await l(n.join(t$1,f),`${vt(h$1)}
|
|
28
|
+
`,s$1),f);let ee="",st=await bt(t$1,Y),te=null;try{te=(await j({workspacePath:t$1})).contract;}catch{te=null;}let nt=Ke({model:st,context:b,contract:te}),re=await qe({workspacePath:t$1,skills:nt,generatedAt:r$1.toISOString(),write:s$1});for(let i of re.skills)a(s$1?"written":"skipped",i.canonicalPath);if(a(s$1?"written":"skipped",b$1),ee=$e(re.index),(P(c,"agents")||P(c,"vscode"))&&a(await Se({absolutePath:n.join(t$1,"AGENTS.md"),generatedBody:Fe({index:h$1,context:b}),write:s$1}),"AGENTS.md"),P(c,"claude")){let i=n.join(t$1,"CLAUDE.md");if(s$1){let{upsertManagedAgentSection:g}=await import('./managed-agent-markers-AXUM75OE.js'),u=await k.pathExists(i)?await k.readFile(i,"utf8"):"",f=g(u,Nt()),R=f.includes("@AGENTS.md")?f:`@AGENTS.md
|
|
29
|
+
|
|
30
|
+
${f}`;await k.ensureDir(n.dirname(i)),await k.writeFile(i,R,"utf8"),J.push("CLAUDE.md");}else Z.push("CLAUDE.md");a(await l(n.join(t$1,j$1),`${Je()}
|
|
31
|
+
`,s$1),j$1),a(await l(n.join(t$1,k$1),`${Je()}
|
|
32
|
+
`,s$1),k$1);}if(P(c,"cursor")&&(a(await l(n.join(t$1,h),Xe(),s$1),h),a(await l(n.join(t$1,i),Xe(),s$1),i)),Ot(c)){if(a(await Se({absolutePath:n.join(t$1,".github/copilot-instructions.md"),generatedBody:Wt(),write:s$1}),".github/copilot-instructions.md"),a(await l(n.join(t$1,l$1),Ye(),s$1),l$1),a(await l(n.join(t$1,m),Ye(),s$1),m),a(await l(n.join(t$1,n$2),Be(),s$1),n$2),a(await l(n.join(t$1,o),Be(),s$1),o),a(await l(n.join(t$1,p),Ze(),s$1),p),a(await l(n.join(t$1,q),Ze(),s$1),q),p$1==="enterprise"){let i=[[r,X({description:"Repair Workspai blockers with evidence and verification",objective:"Plan the smallest safe repair for the current Workspai blocker.",expectedOutput:["Blocker and affected workspace/project scope","Evidence paths and exact failing signals","Minimal fix plan","Human-run commands","Verification command and expected success signal"]})],[t,X({description:"Assess Workspai release readiness from evidence",objective:"Assess whether this workspace is release-ready using Workspai gates.",expectedOutput:["Readiness verdict with cited reports","Blocking gates","Safe next command","Verification checklist"]})],[v,X({description:"Onboard a project into Workspai Workspace Intelligence",objective:"Guide project onboarding using workspace model and create planner capabilities.",expectedOutput:["Target project scope","Native create, external create-adopt, or adopt-only lane","Safe commands","Post-onboarding verification"]})],[x,X({description:"Adopt an existing project into Workspai governance",objective:"Adopt an existing project without changing its runtime behavior.",expectedOutput:["Detected stack and confidence","Adoption plan","Generated metadata expectations","Doctor and workspace model verification"]})]];for(let[u,f]of i)a(await l(n.join(t$1,u),f,s$1),u);let g=[[s,i[0][1]],[u,i[1][1]],[w$1,i[2][1]],[y,i[3][1]]];for(let[u,f]of g)a(await l(n.join(t$1,u),f,s$1),u);if(e.hydratePrompts===true)for(let u of await Ve({workspacePath:t$1,skills:re.skills,write:s$1}))a(s$1?"written":"skipped",u);}if(a(await l(n.join(t$1,z$1),rt(),s$1),z$1),a(await l(n.join(t$1,A),rt(),s$1),A),p$1==="enterprise"){a(await l(n.join(t$1,B$1),tt(ee),s$1),B$1),a(await l(n.join(t$1,C),tt(ee),s$1),C);let i=[["artifact-map.md",E({title:"Artifact Map",lines:N.map(u=>`- \`${u.relativePath}\` \u2014 ${u.label}`)})],["command-map.md",E({title:"Command Map",lines:["- `npx workspai workspace agent-sync --write --refresh-context` \u2014 refresh agent grounding.","- `npx workspai workspace model --json --write` \u2014 refresh workspace model.","- `npx workspai doctor workspace` \u2014 refresh health evidence.","- `npx workspai workspace verify --strict --json` \u2014 verify release gates."]})],["scope-model.md",E({title:"Scope Model",lines:["- Workspace scope is the default source of truth.","- Project scope is selected only when the active task targets a specific project.","- Always name the workspace and project when giving repair or lifecycle advice."]})],["runtime-support.md",E({title:"Runtime Support",lines:["- Native create is available only for Workspai-owned scaffold contracts.","- Unsupported stacks should use external-create-adopt when a stable ecosystem generator exists.","- Existing projects should use adopt-only when native create is unavailable."]})],["create-planner-capabilities.md",E({title:"Create Planner Capabilities",lines:["- Use `contracts/create-planner-capabilities.v1.json` to decide native-create, external-create-adopt, or adopt-only.","- Do not map PHP, WordPress, Laravel, Rails, or Symfony requests to unrelated native kits.","- Explain unsupported native create requests and guide users to adopt/import."]})],["mcp-tools.md",Lt()]];for(let[u,f]of i){let R=`${n.dirname(B$1)}/resources/${u}`;a(await l(n.join(t$1,R),f,s$1),R);let ye=`${n.dirname(C)}/resources/${u}`;a(await l(n.join(t$1,ye),f,s$1),ye);}let g=[["workspai-advisor.agent.md",B({name:"Workspai Advisor",description:"Read-only workspace and project guidance using Workspai evidence",mode:"read-only",tools:["search","read"]})],["workspai-repair.agent.md",B({name:"Workspai Repair",description:"Turn Workspai blockers into minimal fixes and verification steps",mode:"repair",tools:["search","read","edit"]})],["workspai-release.agent.md",B({name:"Workspai Release",description:"Assess readiness, governance gates, and release safety from evidence",mode:"release",tools:["search","read"]})],["workspai-project-onboarder.agent.md",B({name:"Workspai Project Onboarder",description:"Guide create, import, and adopt flows with Workspai contracts",mode:"onboard",tools:["search","read","edit"]})]];for(let[u,f]of g){let R=`.github/agents/${u}`;a(await l(n.join(t$1,R),f,s$1),R);}}}p$1==="enterprise"&&(a(await l(n.join(t$1,D),Qe({workspacePath:t$1,generatedAt:h$1.generatedAt}),s$1),D),a(await l(n.join(t$1,E$1),Qe({workspacePath:t$1,generatedAt:h$1.generatedAt}),s$1),E$1)),p$1==="enterprise"&&e.experimentalHooks===true&&(a(await l(n.join(t$1,F$1),et({workspacePath:t$1,generatedAt:h$1.generatedAt}),s$1),F$1),a(await l(n.join(t$1,G),et({workspacePath:t$1,generatedAt:h$1.generatedAt}),s$1),G)),(P(c,"codex")||P(c,"orca"))&&(P(c,"agents")||a(await Se({absolutePath:n.join(t$1,"AGENTS.md"),generatedBody:Fe({index:h$1,context:b}),write:s$1}),"AGENTS.md"));let oe=s$1?await ze({workspacePath:t$1,staleAfterHours:o$1,now:r$1}):h$1,L=oe.reports.filter(i=>i.required&&!i.exists).map(i=>i.path),D$1=oe.reports.filter(i=>i.exists&&Rt(i.generatedAt,o$1,r$1)).map(i=>i.path);if(m$1){L.length>0&&_.push(`Missing required reports: ${L.join(", ")}`),D$1.length>0&&_.push(`Stale reports (>${o$1}h): ${D$1.join(", ")}`);let i=Q.map(g=>g.path).filter(g=>!_t(g));i.length>0&&_.push(`Unsafe generated output paths: ${i.join(", ")}`);}let Oe=Dt({workspacePath:t$1,generatedAt:r$1.toISOString(),preset:p$1,targets:d$1,index:oe,outputs:[...Q,{path:F,kind:"report",targets:["agents","vscode","copilot","codex","orca"],required:true,status:s$1?"written":e.dryRun?"planned":"skipped"}],missingRequired:L,staleReports:D$1,strictViolations:_,experimentalHooks:e.experimentalHooks===true});return a(await l(n.join(t$1,F),`${JSON.stringify(Oe,null,2)}
|
|
33
|
+
`,s$1),F),{workspacePath:t$1,indexPath:n.join(t$1,Pe),packPath:n.join(t$1,F),pack:Oe,contextPath:I,writtenFiles:J,skippedFiles:Z,blockers:h$1.blockers,missingRequired:L,staleReports:D$1,strictViolations:_}}export{it as a,pt as b,wt as c,ht as d,Pe as e,F as f,N as g,ze as h,Pr as i,Rr as j,ft as k};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {o,l}from'./chunk-5XATWNME.js';import s from'fs-extra';import*as p from'path';function y(r){return l(r,"imported-projects.json")}async function f(r){let n=(await Promise.all(o(r,"imported-projects.json").map(async e=>await s.pathExists(e)?e:null))).find(e=>typeof e=="string");if(!n)return [];try{let e=await s.readJSON(n);return (Array.isArray(e?.projects)?e.projects:[]).filter(i=>{if(!i||typeof i!="object")return false;let o=i;return typeof o.name=="string"&&typeof o.path=="string"&&typeof o.stack=="string"&&typeof o.confidence=="string"&&typeof o.importedAt=="string"})}catch{return []}}async function k(r,n){if(n.length===0)return;let e=await f(r),a=new Map;for(let t of e)a.set(t.path,t);for(let t of n)a.set(t.path,t);let i=Array.from(a.values()).sort((t,g)=>t.name.localeCompare(g.name)).map(t=>({...t})),o={version:1,updatedAt:new Date().toISOString(),projects:i},c=y(r);await s.ensureDir(p.dirname(c)),await s.writeJSON(c,o,{spaces:2});}async function P(r,n){if(n.length===0)return;let e=await f(r),a=new Set(n.map(t=>p.resolve(t))),i=e.filter(t=>!a.has(p.resolve(t.path))),o={version:1,updatedAt:new Date().toISOString(),projects:i},c=y(r);await s.ensureDir(p.dirname(c)),await s.writeJSON(c,o,{spaces:2});}export{f as a,k as b,P as c};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import {f}from'./chunk-7YHK5NM3.js';import {b as b$1}from'./chunk-2FIX2MDC.js';import {execa}from'execa';import l from'chalk';import {createRequire}from'module';import {promises}from'fs';import p from'path';import k from'os';function g(r){let n=r.startsWith("WORKSPAI_")?r:`WORKSPAI_${r.replace(/^RAPIDKIT_/,"")}`,e=r.startsWith("RAPIDKIT_")?r:`RAPIDKIT_${r.replace(/^WORKSPAI_/,"")}`,t=process.env[n]?.trim();return t||process.env[e]?.trim()||void 0}var C="workspai",V=createRequire(import.meta.url),E=V("../package.json"),o=E?.version??"0.0.0";function b(r){let e=r.trim().match(/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/);if(!e)return null;let t=e[4]?e[4].split(".").map(i=>i.match(/^\d+$/)?Number(i):i):[];return {major:Number(e[1]),minor:Number(e[2]),patch:Number(e[3]),prerelease:t}}function w(r,n){let e=b(r),t=b(n);if(!e||!t)return 0;if(e.major!==t.major)return e.major>t.major?1:-1;if(e.minor!==t.minor)return e.minor>t.minor?1:-1;if(e.patch!==t.patch)return e.patch>t.patch?1:-1;if(e.prerelease.length===0&&t.prerelease.length===0)return 0;if(e.prerelease.length===0)return 1;if(t.prerelease.length===0)return -1;let i=Math.max(e.prerelease.length,t.prerelease.length);for(let u=0;u<i;u+=1){let a=e.prerelease[u],s=t.prerelease[u];if(a===void 0)return -1;if(s===void 0)return 1;if(a===s)continue;let d=typeof a=="number",f=typeof s=="number";return d&&f?a>s?1:-1:d?-1:f||String(a)>String(s)?1:-1}return 0}var I=14400*1e3;function y(){let r=g("CACHE_DIR")||(process.env.VITEST_WORKER_ID?p.join(k.homedir(),".workspai","cache",`vitest-${process.env.VITEST_WORKER_ID}`):p.join(k.homedir(),".workspai","cache"));return p.join(r,"update-check.json")}async function N(){try{let r=await promises.readFile(y(),"utf-8"),n=JSON.parse(r);return typeof n.latestVersion=="string"&&typeof n.checkedAt=="number"&&n.currentVersion===o&&Date.now()-n.checkedAt<I?n:null}catch{return null}}async function P(r){try{let n=y();await promises.mkdir(p.dirname(n),{recursive:true}),await promises.writeFile(n,JSON.stringify({latestVersion:r,checkedAt:Date.now(),currentVersion:o}),"utf-8");}catch{}}async function M(){try{f.debug("Checking for updates...");let r=await N();if(r){let t=Math.round((Date.now()-r.checkedAt)/6e4);f.debug(`Update check: cache hit (${t}m old)`),w(r.latestVersion,o)>0&&(console.log(l.yellow(`
|
|
2
|
+
\u26A0\uFE0F Update available: ${o} \u2192 ${r.latestVersion}`)),console.log(l.cyan(`Run: npm install -g workspai@latest
|
|
3
|
+
`)));return}let{stdout:n}=await execa("npm",["view",C,"version"],{timeout:b$1()}),e=n.trim();await P(e),e&&w(e,o)>0?(console.log(l.yellow(`
|
|
4
|
+
\u26A0\uFE0F Update available: ${o} \u2192 ${e}`)),console.log(l.cyan(`Run: npm install -g workspai@latest
|
|
5
|
+
`))):f.debug("You are using the latest version");}catch{f.debug("Could not check for updates");}}function J(){return o}export{g as a,M as b,J as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{c as PYTHON_FREE_WORKSPACE_PROFILES,a as buildWorkspaceManifest,f as createProject,g as registerWorkspaceAtPath,d as resolvePythonFreeFallbackProfile,b as syncWorkspaceFoundationFiles,e as writeWorkspaceLauncher}from'./chunk-LPZFK3Y6.js';
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import {c}from'./chunk-Y45WZR5N.js';import {promises}from'fs';import a from'path';import L from'nunjucks';import e from'chalk';import h from'ora';import {fileURLToPath}from'url';import {execa}from'execa';import W from'crypto';var N=fileURLToPath(import.meta.url),J=a.dirname(N);function M(t=32){let i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",v=W.randomBytes(t),o="";for(let p=0;p<t;p++)o+=i[v[p]%i.length];return o}async function X(t,i){let o=(i.template||"fastapi")==="fastapi",p=o?"FastAPI":"NestJS",d=i.kit_name||(o?"fastapi.standard":"nestjs.standard"),A=d.replace(".","/"),x=h(`Generating ${p} project...`).start();try{let k=a.resolve(J,".."),m;d==="fastapi.ddd"?m="fastapi-ddd":d.startsWith("fastapi")?m="fastapi-standard":m="nestjs-standard";let w=a.join(k,"templates","kits",m),$=L.configure(w,{autoescape:false,trimBlocks:true,lstripBlocks:true});$.addFilter("generate_secret",function(n,r=32){return M(r)});let D={project_name:i.project_name,author:i.author||"Workspai User",description:i.description||(o?"FastAPI service generated with Workspai":"NestJS application generated with Workspai"),app_version:i.app_version||"0.1.0",license:i.license||"MIT",package_manager:i.package_manager||"npm",node_version:i.node_version||"20.0.0",database_type:i.database_type||"postgresql",include_caching:i.include_caching||false,created_at:new Date().toISOString(),workspai_version:c(),rapidkit_version:c()},y;o?y=["src/main.py.j2","src/__init__.py.j2","src/cli.py.j2","src/routing/__init__.py.j2","src/routing/health.py.j2","src/routing/examples.py.j2","src/modules/__init__.py.j2","tests/__init__.py.j2","tests/test_health.py.j2","tests/test_examples.py.j2","README.md.j2","pyproject.toml.j2","Makefile.j2","env.example.j2","rapidkit.j2","rapidkit.cmd.j2"]:y=["src/main.ts.j2","src/app.module.ts.j2","src/app.controller.ts.j2","src/app.service.ts.j2","src/config/configuration.ts.j2","src/config/validation.ts.j2","src/config/index.ts.j2","src/modules/index.ts.j2","src/examples/examples.module.ts.j2","src/examples/examples.controller.ts.j2","src/examples/examples.service.ts.j2","src/examples/dto/create-note.dto.ts.j2","test/app.controller.spec.ts.j2","test/examples.controller.spec.ts.j2","test/app.e2e-spec.ts.j2","test/jest-e2e.json.j2","package.json.j2","tsconfig.json.j2","tsconfig.build.json.j2","nest-cli.json.j2","jest.config.ts.j2","eslint.config.cjs.j2","env.example.j2","docker-compose.yml.j2","Dockerfile.j2","README.md.j2","rapidkit.j2","rapidkit.cmd.j2"];for(let n of y){let r=a.join(w,n);try{await promises.access(r);}catch{continue}let j=await promises.readFile(r,"utf-8"),g;try{g=$.renderString(j,D);}catch(P){throw console.error(`Failed to render template: ${n}`),P}let c=n==="env.example.j2"?".env.example":n.replace(/\.j2$/,""),_=a.join(t,c);await promises.mkdir(a.dirname(_),{recursive:true}),await promises.writeFile(_,g),(c.endsWith(".workspai/rapidkit")||c.endsWith(".workspai/cli.py")||c.endsWith(".workspai/activate")||c.endsWith(".rapidkit/rapidkit")||c.endsWith(".rapidkit/cli.py")||c.endsWith(".rapidkit/activate")||c==="rapidkit")&&await promises.chmod(_,493);}if(o){let n=a.join(w,".rapidkit","context.json"),r=a.join(t,".workspai","context.json");try{await promises.mkdir(a.join(t,".workspai"),{recursive:true}),await promises.copyFile(n,r);}catch{await promises.mkdir(a.join(t,".workspai"),{recursive:true});let g=i.engine||"pip";await promises.writeFile(r,JSON.stringify({engine:g,created_by:"workspai-cli-fallback",legacyCreatedBy:"rapidkit-npm-fallback"},null,2));}}let S=a.join(t,".workspai");await promises.mkdir(S,{recursive:true});let F=a.join(S,"project.json"),E={kit_name:d,profile:A,created_at:new Date().toISOString(),created_by:"workspai-cli-fallback",workspai_version:c(),rapidkit_version:c(),runtime:o?"python":"node"},R=JSON.stringify(E,null,2);await promises.writeFile(F,R,"utf-8");let f=a.join(t,"rapidkit");await promises.access(f).then(()=>true).catch(()=>false)||(await promises.writeFile(f,`#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
SCRIPT_DIR="$(cd "$(dirname "\${BASH_SOURCE[0]}")" && pwd)"
|
|
4
|
+
cd "$SCRIPT_DIR"
|
|
5
|
+
RAPIDKIT_LOCAL_LAUNCHER_BYPASS=1 npx workspai "$@"
|
|
6
|
+
`),await promises.chmod(f,493));let I=a.join(t,"rapidkit.cmd");await promises.access(I).then(()=>true).catch(()=>false)||await promises.writeFile(I,`@echo off
|
|
7
|
+
set RAPIDKIT_LOCAL_LAUNCHER_BYPASS=1
|
|
8
|
+
npx workspai %*
|
|
9
|
+
`);let C=o?`# Python
|
|
10
|
+
__pycache__/
|
|
11
|
+
*.py[cod]
|
|
12
|
+
*$py.class
|
|
13
|
+
*.so
|
|
14
|
+
.Python
|
|
15
|
+
build/
|
|
16
|
+
develop-eggs/
|
|
17
|
+
dist/
|
|
18
|
+
downloads/
|
|
19
|
+
eggs/
|
|
20
|
+
.eggs/
|
|
21
|
+
lib/
|
|
22
|
+
lib64/
|
|
23
|
+
parts/
|
|
24
|
+
sdist/
|
|
25
|
+
var/
|
|
26
|
+
wheels/
|
|
27
|
+
*.egg-info/
|
|
28
|
+
.installed.cfg
|
|
29
|
+
*.egg
|
|
30
|
+
|
|
31
|
+
# Virtual environments
|
|
32
|
+
.venv/
|
|
33
|
+
venv/
|
|
34
|
+
ENV/
|
|
35
|
+
env/
|
|
36
|
+
|
|
37
|
+
# IDEs
|
|
38
|
+
.vscode/
|
|
39
|
+
.idea/
|
|
40
|
+
*.swp
|
|
41
|
+
*.swo
|
|
42
|
+
*~
|
|
43
|
+
|
|
44
|
+
# OS
|
|
45
|
+
.DS_Store
|
|
46
|
+
Thumbs.db
|
|
47
|
+
|
|
48
|
+
# Project specific
|
|
49
|
+
.env
|
|
50
|
+
.env.local
|
|
51
|
+
`:`# Node artifacts
|
|
52
|
+
node_modules/
|
|
53
|
+
dist/
|
|
54
|
+
.tmp/
|
|
55
|
+
.env
|
|
56
|
+
.env.*
|
|
57
|
+
!.env.example
|
|
58
|
+
|
|
59
|
+
# Logs
|
|
60
|
+
logs/
|
|
61
|
+
*.log
|
|
62
|
+
npm-debug.log*
|
|
63
|
+
yarn-debug.log*
|
|
64
|
+
yarn-error.log*
|
|
65
|
+
pnpm-debug.log*
|
|
66
|
+
|
|
67
|
+
# OS
|
|
68
|
+
.DS_Store
|
|
69
|
+
Thumbs.db
|
|
70
|
+
|
|
71
|
+
# IDEs
|
|
72
|
+
.idea/
|
|
73
|
+
.vscode/
|
|
74
|
+
|
|
75
|
+
# Coverage
|
|
76
|
+
coverage/
|
|
77
|
+
`;if(await promises.writeFile(a.join(t,".gitignore"),C),x.succeed(`${p} project generated!`),!i.skipGit){let n=h("Initializing git repository...").start();try{await execa("git",["init"],{cwd:t}),await execa("git",["add","."],{cwd:t}),await execa("git",["commit","-m",`Initial commit: ${p} project via Workspai`],{cwd:t}),n.succeed("Git repository initialized");}catch{n.warn("Could not initialize git repository");}}if(!o&&!i.skipInstall){let n=i.package_manager||"npm",r=h(`Installing dependencies with ${n}...`).start();try{await execa(n,n==="yarn"?["install"]:n==="pnpm"?["install"]:["install"],{cwd:t}),r.succeed("Dependencies installed");}catch{r.warn(`Could not install dependencies. Run '${n} install' manually.`);}}let b=a.basename(t);console.log(`
|
|
78
|
+
${e.yellow("\u26A0\uFE0F Limited offline mode:")} This project was created using basic templates.
|
|
79
|
+
${e.gray("For full kit features, install Python 3.10+ and rapidkit-core:")}
|
|
80
|
+
${e.cyan(" sudo apt install python3 python3-pip python3-venv")}
|
|
81
|
+
${e.cyan(" pip install rapidkit-core")}
|
|
82
|
+
`),console.log(o?`
|
|
83
|
+
${e.green("\u2728 FastAPI project created successfully!")}
|
|
84
|
+
|
|
85
|
+
${e.bold("\u{1F4C2} Project structure:")}
|
|
86
|
+
${t}/
|
|
87
|
+
\u251C\u2500\u2500 .workspai/ # Workspai metadata
|
|
88
|
+
\u251C\u2500\u2500 src/
|
|
89
|
+
\u2502 \u251C\u2500\u2500 main.py # FastAPI application
|
|
90
|
+
\u2502 \u251C\u2500\u2500 cli.py # CLI commands
|
|
91
|
+
\u2502 \u251C\u2500\u2500 routing/ # API routes
|
|
92
|
+
\u2502 \u2514\u2500\u2500 modules/ # Module system
|
|
93
|
+
\u251C\u2500\u2500 tests/ # Test suite
|
|
94
|
+
\u251C\u2500\u2500 pyproject.toml # Poetry configuration
|
|
95
|
+
\u2514\u2500\u2500 README.md
|
|
96
|
+
|
|
97
|
+
${e.bold("\u{1F680} Get started:")}
|
|
98
|
+
${e.cyan(`cd ${b}`)}
|
|
99
|
+
${e.cyan("npx workspai init")} ${e.gray("# Install dependencies")}
|
|
100
|
+
${e.cyan("npx workspai dev")} ${e.gray("# Start dev server")}
|
|
101
|
+
|
|
102
|
+
${e.bold("\u{1F4DA} Available commands:")}
|
|
103
|
+
npx workspai init # Install dependencies (poetry install)
|
|
104
|
+
npx workspai dev # Start dev server with hot reload
|
|
105
|
+
npx workspai start # Start production server
|
|
106
|
+
npx workspai test # Run tests
|
|
107
|
+
npx workspai lint # Lint code
|
|
108
|
+
npx workspai format # Format code
|
|
109
|
+
|
|
110
|
+
${e.gray("Alternative: make dev, npx workspai dev, poetry run dev")}
|
|
111
|
+
${e.gray("\u{1F4A1} Tip: Install globally (npm i -g workspai) to use without npx")}
|
|
112
|
+
`:`
|
|
113
|
+
${e.green("\u2728 NestJS project created successfully!")}
|
|
114
|
+
|
|
115
|
+
${e.bold("\u{1F4C2} Project structure:")}
|
|
116
|
+
${t}/
|
|
117
|
+
\u251C\u2500\u2500 .workspai/ # Workspai metadata
|
|
118
|
+
\u251C\u2500\u2500 src/
|
|
119
|
+
\u2502 \u251C\u2500\u2500 main.ts # Application entry point
|
|
120
|
+
\u2502 \u251C\u2500\u2500 app.module.ts # Root module
|
|
121
|
+
\u2502 \u251C\u2500\u2500 config/ # Configuration
|
|
122
|
+
\u2502 \u2514\u2500\u2500 examples/ # Example module
|
|
123
|
+
\u251C\u2500\u2500 test/ # Test files
|
|
124
|
+
\u251C\u2500\u2500 package.json # Dependencies
|
|
125
|
+
\u2514\u2500\u2500 README.md
|
|
126
|
+
|
|
127
|
+
${e.bold("\u{1F680} Get started:")}
|
|
128
|
+
${e.cyan(`cd ${b}`)}
|
|
129
|
+
${e.cyan("npx workspai init")} ${e.gray("# Install dependencies")}
|
|
130
|
+
${e.cyan("cp .env.example .env")}
|
|
131
|
+
${e.cyan("npx workspai dev")} ${e.gray("# Start dev server")}
|
|
132
|
+
|
|
133
|
+
${e.bold("\u{1F4DA} Available commands:")}
|
|
134
|
+
npx workspai init # Install dependencies
|
|
135
|
+
npx workspai dev # Start dev server with hot reload
|
|
136
|
+
npx workspai start # Start production server
|
|
137
|
+
npx workspai build # Build for production
|
|
138
|
+
npx workspai test # Run tests
|
|
139
|
+
npx workspai lint # Lint code
|
|
140
|
+
npx workspai format # Format code
|
|
141
|
+
|
|
142
|
+
${e.bold("\u{1F310} API endpoints:")}
|
|
143
|
+
http://localhost:8000/health # Health check
|
|
144
|
+
http://localhost:8000/docs # Swagger docs
|
|
145
|
+
http://localhost:8000/examples/notes # Example API
|
|
146
|
+
|
|
147
|
+
${e.gray("Alternative: npm run start:dev, npx workspai dev")}
|
|
148
|
+
${e.gray("\u{1F4A1} Tip: Install globally (npm i -g workspai) to use without npx")}
|
|
149
|
+
`);}catch(k){throw x.fail(`Failed to generate ${p} project`),k}}export{X as generateDemoKit};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{b as computeDoctorGateExitCode,a as resolveDoctorPolicyProfile,c as runDoctor}from'./chunk-AAKUNWPR.js';
|