workspai 0.44.0 → 0.46.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/README.md +243 -513
- package/contracts/cli-runtime-command-inventory.v1.snapshot.json +1372 -0
- package/contracts/command-capabilities.v1.json +166 -1
- package/contracts/extension-cli-compatibility.v1.json +4 -2
- package/contracts/published-contract-catalog.v1.json +12 -1
- package/contracts/runtime-command-surface.v1.json +1478 -3
- package/contracts/workspace-archive-capabilities.v1.json +17 -6
- package/contracts/workspace-intelligence/studio-blocker-handoff.v1.json +4 -0
- package/contracts/workspace-intelligence/workspace-intelligence-run.v1.json +207 -0
- package/contracts/workspace-intelligence-architecture.v1.json +1 -1
- package/contracts/workspace-intelligence-chain.v1.json +37 -1
- package/dist/analyze-BEBEZSZK.js +1 -0
- package/dist/{artifact-remediation-plan-Z7OCSME3.js → artifact-remediation-plan-FFQSESAM.js} +1 -1
- package/dist/autopilot-release-WUR4CQIT.js +1 -0
- package/dist/chunk-2G7FASAO.js +2 -0
- package/dist/{chunk-CL6TGI4Q.js → chunk-4EPHWD27.js} +1 -1
- package/dist/{chunk-J4AICQFB.js → chunk-4LGXSBCN.js} +1 -1
- package/dist/chunk-52PBRX7F.js +1 -0
- package/dist/{chunk-2QOWRBQD.js → chunk-6IIZJQLV.js} +1 -1
- package/dist/{chunk-JICOD2GI.js → chunk-CVHMUSRX.js} +1 -1
- package/dist/{chunk-7UZVOYF5.js → chunk-DIPD72H4.js} +1 -1
- package/dist/chunk-EFYHGCGX.js +2 -0
- package/dist/chunk-EYJ2CQSK.js +1 -0
- package/dist/chunk-FPJNWPKU.js +1 -0
- package/dist/{chunk-JP25YL3J.js → chunk-FTY7GGXJ.js} +2 -2
- package/dist/chunk-FWRXA435.js +2 -0
- package/dist/chunk-FXQJX34Z.js +1 -0
- package/dist/chunk-HDURFXW5.js +2 -0
- package/dist/chunk-HMUKBW2S.js +4 -0
- package/dist/{chunk-OW4UNG27.js → chunk-J5PIZCAU.js} +92 -78
- package/dist/{chunk-P4SWTY5X.js → chunk-K4WNYXKK.js} +7 -7
- package/dist/chunk-MER6ZBN2.js +13 -0
- package/dist/chunk-N7DV5L7C.js +1 -0
- package/dist/{chunk-JHC6SCJC.js → chunk-NHN4QXPP.js} +1 -1
- package/dist/{chunk-P424XYHP.js → chunk-PRBVYW3T.js} +1 -1
- package/dist/{chunk-NTXO7BMH.js → chunk-QA5BGEQW.js} +1 -1
- package/dist/chunk-QZLIURER.js +13 -0
- package/dist/{chunk-L3E6IRUQ.js → chunk-RIEF2DDX.js} +1 -1
- package/dist/{chunk-L2Q7B2OJ.js → chunk-SXMTSV5M.js} +1 -1
- package/dist/chunk-SXPY523X.js +1 -0
- package/dist/{chunk-XIVFLY6G.js → chunk-UQWOVV6V.js} +1 -1
- package/dist/chunk-V3LRQZ36.js +1 -0
- package/dist/chunk-VFDM65IE.js +80 -0
- package/dist/{chunk-B66A4TVP.js → chunk-WPEEC5BX.js} +1 -1
- package/dist/chunk-WYFPXTTS.js +2 -0
- package/dist/{chunk-M4VITK6X.js → chunk-YUATNVOT.js} +62 -51
- package/dist/{chunk-7IHLTPZ6.js → chunk-ZKAI3PJE.js} +1 -1
- package/dist/{create-DFAWAS5C.js → create-WCV3L6XH.js} +1 -1
- package/dist/doctor-5BWM2EMJ.js +1 -0
- package/dist/{dotnet-webapi-clean-BYUUHX5Y.js → dotnet-webapi-clean-6TVFBTVI.js} +20 -20
- package/dist/{gofiber-standard-B6UK5GR7.js → gofiber-standard-2BL7GWZB.js} +1 -1
- package/dist/{gogin-standard-BXU44VEM.js → gogin-standard-XGP3KBXA.js} +1 -1
- package/dist/index.d.ts +123 -15
- package/dist/index.js +337 -323
- package/dist/pipeline-ORIWVVYM.js +5 -0
- package/dist/{platform-capabilities-YICBF4FA.js → platform-capabilities-2B4QMZXE.js} +1 -1
- package/dist/{pythonRapidkitExec-UJYIB6FL.js → pythonRapidkitExec-CVCIK225.js} +1 -1
- package/dist/{springboot-standard-PEHDKH2L.js → springboot-standard-JJNUID6M.js} +6 -6
- package/dist/workspace-7OXW5YTJ.js +1 -0
- package/dist/{workspace-agent-sync-ZYCPXTU3.js → workspace-agent-sync-O4IA6VOA.js} +1 -1
- package/dist/workspace-archive-H74NBBNW.js +10 -0
- package/dist/{workspace-context-WAGGJCDL.js → workspace-context-R7IPUBPG.js} +1 -1
- package/dist/workspace-contract-HKCMOMFE.js +1 -0
- package/dist/workspace-explain-GOPQYTPQ.js +1 -0
- package/dist/workspace-explain-contract-SVFJAAEI.js +1 -0
- package/dist/{workspace-feedback-RCB25NFO.js → workspace-feedback-REOS36ZZ.js} +1 -1
- package/dist/{workspace-foundation-KXDL6P6X.js → workspace-foundation-KXT4QI5O.js} +1 -1
- package/dist/{workspace-history-M4QQBIPB.js → workspace-history-OGOVSKZG.js} +1 -1
- package/dist/{workspace-intelligence-QOGD2TZS.js → workspace-intelligence-7IESQSXY.js} +1 -1
- package/dist/workspace-intelligence-runner-6GJ5M4HB.js +1 -0
- package/dist/{workspace-mcp-serve-CEFKEMYG.js → workspace-mcp-serve-FRVWBO36.js} +1 -1
- package/dist/{workspace-model-GMSRBICO.js → workspace-model-PPYX7B4S.js} +1 -1
- package/dist/workspace-python-engine-state-2MLKJYQG.js +2 -0
- package/dist/workspace-registry-summary-SZ46R5PD.js +1 -0
- package/dist/workspace-run-V3KKHTVF.js +1 -0
- package/dist/{workspace-verify-NP4GMFSV.js → workspace-verify-MFQ7IXGD.js} +1 -1
- package/dist/{workspace-watch-IIBH3Y25.js → workspace-watch-SOPZHRWA.js} +1 -1
- package/docs/AI_DYNAMIC_INTEGRATION.md +29 -33
- package/docs/AI_FEATURES.md +18 -27
- package/docs/AI_QUICKSTART.md +7 -4
- package/docs/DEVELOPMENT.md +5 -5
- package/docs/From Code to Shared Understanding.png +0 -0
- package/docs/OPEN_SOURCE_USER_SCENARIOS.md +23 -2
- package/docs/OPTIMIZATION_GUIDE.md +19 -51
- package/docs/PACKAGE_MANAGER_POLICY.md +4 -1
- package/docs/README.md +30 -3
- package/docs/SECURITY.md +13 -6
- package/docs/SETUP.md +6 -3
- package/docs/UTILITIES.md +8 -20
- package/docs/WORKSPACE_MARKER_SPEC.md +27 -20
- package/docs/ci-workflows.md +19 -5
- package/docs/commands-reference.md +51 -10
- package/docs/config-file-guide.md +64 -247
- package/docs/contracts/ARTIFACT_CATALOG.md +14 -2
- package/docs/contracts/CLI_LOG_EVENT_STREAM.md +1 -1
- package/docs/contracts/COMMAND_OWNERSHIP_MATRIX.md +27 -6
- package/docs/contracts/README.md +5 -2
- package/docs/contracts/RUNTIME_ACCEPTANCE_MATRIX.md +4 -4
- package/docs/contracts/RUNTIME_SUPPORT_MATRIX.md +14 -10
- package/docs/creating-workspaces-and-projects.md +649 -0
- package/docs/doctor-command.md +5 -4
- package/docs/examples/ci-agent-grounding.yml +16 -10
- package/docs/from-code-to-shared-understanding.md +69 -38
- package/docs/workspace-intelligence-runner.md +186 -0
- package/docs/workspace-operations.md +29 -11
- package/docs/workspace-run.md +4 -1
- package/package.json +10 -8
- package/rapidkit.config.example.cjs +5 -5
- package/scripts/enforce-package-manager.cjs +1 -1
- package/scripts/prepack-enterprise.mjs +8 -0
- package/workspai.config.example.cjs +12 -47
- package/dist/analyze-6OCBM4ID.js +0 -1
- package/dist/autopilot-release-LI2WJCEW.js +0 -1
- package/dist/chunk-2K3GYCPS.js +0 -1
- package/dist/chunk-2QN6BMM7.js +0 -2
- package/dist/chunk-5AKYMAIL.js +0 -1
- package/dist/chunk-5PVEQ6CZ.js +0 -13
- package/dist/chunk-7EIMPQR3.js +0 -1
- package/dist/chunk-7RIWU5TZ.js +0 -1
- package/dist/chunk-FWJV7CCI.js +0 -2
- package/dist/chunk-LGP6WXS2.js +0 -4
- package/dist/chunk-TRMDODFM.js +0 -13
- package/dist/chunk-UNF72FTB.js +0 -1
- package/dist/chunk-V5JN4TDX.js +0 -2
- package/dist/chunk-VA5MRHKM.js +0 -2
- package/dist/chunk-XZGVNGRB.js +0 -1
- package/dist/chunk-YUX4YFGL.js +0 -78
- package/dist/doctor-PVSWDBJL.js +0 -1
- package/dist/imported-projects-registry-FOIE27WT.js +0 -1
- package/dist/pipeline-ND734AJM.js +0 -5
- package/dist/workspace-FQT3QIRS.js +0 -1
- package/dist/workspace-archive-EEGLHZDW.js +0 -10
- package/dist/workspace-contract-SEI4SNSG.js +0 -1
- package/dist/workspace-explain-MVGGRCDN.js +0 -1
- package/dist/workspace-explain-contract-KT757JGQ.js +0 -1
- package/dist/workspace-python-engine-state-MTWIIZPY.js +0 -2
- package/dist/workspace-registry-summary-S52SEJAG.js +0 -1
- package/dist/workspace-run-VC4OUPRF.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {a as a$1}from'./chunk-FXQJX34Z.js';import {c,f as f$1,b as b$1,e as e$1,g}from'./chunk-HDURFXW5.js';import {a,b}from'./chunk-N7DV5L7C.js';import {e}from'./chunk-RO73VVHW.js';import {p,o}from'./chunk-5XATWNME.js';import {l}from'./chunk-OCGZNSOE.js';import d from'path';import f from'fs-extra';var q="unknown-run";function J(t){let e$1=e();return !e$1||e$1===q?t:{...t,runId:e$1}}var P=".workspai/workspace.contract.json",Q=a.contractVerify,j=1,X=b.contractVerify,W=class extends Error{constructor(s){super(`Workspace contract verification failed: ${s.violations.join("; ")}`);this.verification=s;this.name="WorkspaceContractVerificationError";}verification};function D(t){return t.replace(/\\/g,"/")}function S(t){let e=D(t).trim();return !e||e.startsWith("/")||e.startsWith("~")||/^[a-zA-Z]:\//.test(e)||e.includes("\0")?false:!e.split("/").filter(Boolean).some(s=>s===".."||s===".")}function F(t,e){return t.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/-+/g,"-").replace(/^[-_.]+|[-_.]+$/g,"").slice(0,80)||e}function tt(t){return Array.isArray(t)?t.filter(e=>typeof e=="string"&&e.trim().length>0):[]}function et(t){let s=(Array.isArray(t.ports)?t.ports:[]).map(i=>{if(!i||typeof i!="object"||Array.isArray(i))return null;let p=i,u=Number(p.port);if(!Number.isInteger(u)||u<1||u>65535)return null;let o=p.protocol==="https"||p.protocol==="grpc"||p.protocol==="tcp"||p.protocol==="udp"?p.protocol:"http";return {name:typeof p.name=="string"&&p.name.trim()?p.name:"http",port:u,protocol:o}}).filter(i=>i!==null);if(s.length>0)return s;let c=t.frontend&&typeof t.frontend=="object"&&!Array.isArray(t.frontend)?t.frontend:void 0,a=Number(t.port??c?.default_port);return Number.isInteger(a)&&a>=1&&a<=65535?[{name:"http",port:a,protocol:"http"}]:[]}async function v(t){for(let e of t)if(await f.pathExists(e))return e;return null}async function rt(t){for(let e of o(t,"workspace.json"))try{let s=await f.readJson(e);return {name:typeof s.workspace_name=="string"&&s.workspace_name.trim()||typeof s.name=="string"&&s.name.trim()||d.basename(t),profile:typeof s.profile=="string"?s.profile:void 0}}catch{}return {name:d.basename(t)}}async function ot(t){let e=[],s=[t],c=new Set,a=new Set([".git",".workspai",".rapidkit","node_modules",".venv","venv","dist","build","target",".next",".turbo",".cache"]);for(;s.length>0;){let i=s.shift();if(!i||c.has(i))continue;c.add(i);let p$1=await v(p(i,"project.json")),u=await v(p(i,"context.json"));if(p$1||u){e.push(p$1??u??"");continue}let o;try{o=await f.readdir(i,{withFileTypes:true});}catch{continue}for(let l of o)!l.isDirectory()||a.has(l.name)||s.push(d.join(i,l.name));}return e.sort()}function st(t){let e=(t||"").toLowerCase();if(e.includes("fastapi"))return "fastapi";if(e.includes("nestjs"))return "nestjs";if(e.includes("springboot"))return "springboot";if(e.includes("gofiber"))return "fiber";if(e.includes("gogin"))return "gin"}function nt(t,e){let s=(t||"").toLowerCase(),c=(e||"").toLowerCase();return s.includes("fastapi")?8e3:s.includes("nestjs")?3e3:s.includes("springboot")?8080:s.includes("gofiber")?3e3:s.includes("gogin")?8080:c==="node"?3e3:c==="python"?8e3:c==="java"||c==="go"?8080:null}function K(t,e){let s=t;for(;e.has(s)&&s<65535;)s+=1;return s}function R(t,e,s){let c=t!==void 0&&t.source===void 0,a=nt(e.kit,e.runtime),i=t?.ports||[],p=e.ports||[],o=(i.length>0?i:p.length>0?p:a?[{name:"http",port:K(a,s),protocol:"http"}]:[]).map(n=>({...n,port:K(n.port,s)}));for(let n of o)s.add(n.port);let l={...e,...t,slug:t?.slug||e.slug,relativePath:c&&t?.relativePath&&S(t.relativePath)?t.relativePath:e.relativePath,source:c&&t?.source||e.source,relationship:c&&t?.relationship||e.relationship,externalPath:c&&t?.externalPath||e.externalPath,runtime:t?.runtime||e.runtime,framework:t?.framework||e.framework,kit:t?.kit||e.kit,modules:t?.modules?.length?t.modules:e.modules,ports:o,contracts:{owns:t?.contracts?.owns||[],apis:t?.contracts?.apis||[],publishes:t?.contracts?.publishes||[],consumes:t?.contracts?.consumes||[],dependsOn:t?.contracts?.dependsOn||[],env:t?.contracts?.env||[]}},r=JSON.stringify(t||null)!==JSON.stringify(l);return {project:l,changed:r}}async function L(t){let e=d.resolve(t.workspacePath),s=await rt(e),c=await ot(e),a=await a$1(e),i=[];for(let l of a){let r=d.resolve(l.path),n=await v(p(r,"project.json"))??await v(p(r,"context.json"));!n||c.some(g=>d.resolve(g)===d.resolve(n))||i.push({projectJsonPath:n,registryEntry:l});}let p$1=[],u=[...c.map(l=>({projectJsonPath:l})),...i];for(let{projectJsonPath:l,registryEntry:r}of u){let n=d.dirname(d.dirname(l)),g=D(d.relative(e,n)),h=r!==void 0&&!S(g),k=F(r?.name||d.basename(n),d.basename(n)),C=h?`external/${k}`:g||k,m=await f.readJson(l),x=typeof m.kit_name=="string"&&m.kit_name||typeof m.kit=="string"&&m.kit||void 0,Y=typeof m.framework=="string"&&m.framework||st(x);p$1.push({slug:r?.name||C||d.basename(n),relativePath:C,source:r?.source??"workspace",relationship:r?.relationship,externalPath:h?n:void 0,runtime:typeof m.runtime=="string"?m.runtime:void 0,framework:Y,kit:x,modules:tt(m.modules),ports:et(m),contracts:{owns:[],apis:[],publishes:[],consumes:[],dependsOn:[],env:[]}});}let o=new Map;for(let l of p$1){let r=F(l.slug,l.relativePath),n=o.get(r);(!n||n.source!=="workspace"&&l.source==="workspace")&&o.set(r,l);}return {schemaVersion:j,kind:"rapidkit.workspace.contract",generatedAt:(t.now??new Date).toISOString(),workspace:s,projects:[...o.values()]}}async function kt(t){let e=d.resolve(t.outputPath||c(t.workspacePath,P));if(await f.pathExists(e)&&t.force!==true)throw new Error(`Workspace contract already exists: ${e}. Use --force to overwrite.`);let s=await L({workspacePath:t.workspacePath,now:t.now}),c$1=new Set,a={...s,projects:s.projects.map(p=>R(void 0,p,c$1).project)},i=await B({workspacePath:t.workspacePath,contractPath:e,contract:a});if(t.strict&&i.status==="failed")throw new W(i);return await z({workspacePath:t.workspacePath,contractPath:e,contract:a,now:t.now}),{contractPath:e,contract:a}}async function wt(t){let e=d.resolve(t.workspacePath),s=c(e,P),c$1=await f$1(e,P)??s,a=await L({workspacePath:e,now:t.now}),i=await f.pathExists(c$1)?await f.readJson(c$1):null,p=new Map((i?.projects||[]).map(h=>[h.slug,h])),u=new Set,o=[],l=[],r=[];for(let h of a.projects){let k=p.get(h.slug),C=R(k,h,u);k?C.changed&&l.push(h.slug):o.push(h.slug),r.push(C.project),p.delete(h.slug);}for(let h of p.values()){if(h.source)continue;let k=R(h,h,u);r.push(k.project);}let n={schemaVersion:j,kind:"rapidkit.workspace.contract",generatedAt:(t.now??new Date).toISOString(),workspace:{...a.workspace,...i?.workspace||{},name:i?.workspace?.name||a.workspace.name},projects:r.sort((h,k)=>h.slug.localeCompare(k.slug))},g=await B({workspacePath:e,contractPath:s,contract:n});if(t.strict&&g.status==="failed")throw new W(g);return await z({workspacePath:e,contractPath:s,contract:n,now:t.now}),{contractPath:s,contract:n,addedProjects:o,updatedProjects:l,verification:g}}async function M(t){return await f.pathExists(t)?{exists:true,contents:await f.readFile(t)}:{exists:false}}async function G(t,e){if(!e.exists){await f.remove(t);return}await f.outputFile(t,e.contents);}async function z(t){let{buildWorkspaceRegistrySummary:e,WORKSPACE_REGISTRY_SUMMARY_RELATIVE_PATH:s}=await import('./workspace-registry-summary-SZ46R5PD.js'),c$1=await e(t.workspacePath,{now:t.now,contract:t.contract}),a=c(t.workspacePath,s),i=p=>{if(!p||typeof p!="object"||Array.isArray(p))return JSON.stringify(p);let{generatedAt:u,...o}=p;return JSON.stringify(o)};if(await f.pathExists(t.contractPath)&&await f.pathExists(a)){let[p,u]=await Promise.all([f.readJson(t.contractPath),f.readJson(a)]);if(i(p)===i(t.contract)&&i(u)===i(c$1))return}b$1(P,t.contract),b$1(s,c$1),await e$1(t.workspacePath,P,async()=>{let[p,u]=await Promise.all([M(t.contractPath),M(a)]);try{if(t.contractPath===c(t.workspacePath,P)?await g(t.workspacePath,P,t.contract):(await f.ensureDir(d.dirname(t.contractPath)),await f.writeJson(t.contractPath,t.contract,{spaces:2})),process.env.WORKSPAI_TEST_FAIL_WORKSPACE_REGISTRY_PUBLISH==="1")throw new Error("Injected workspace registry summary publication failure.");await g(t.workspacePath,s,c$1);}catch(o){let r=(await Promise.allSettled([G(t.contractPath,p),G(a,u)])).filter(n=>n.status==="rejected");throw r.length>0?new AggregateError([o,...r.map(n=>n.reason)],"Workspace contract publication failed and rollback was incomplete."):o}});}async function H(t){let e=t.contractPath??(await f$1(t.workspacePath,P)||c(t.workspacePath,P)),s=await f.readJson(e);return {contractPath:e,contract:s}}async function Ct(t){let{contractPath:e,contract:s}=await H(t),c=s.projects.map(o=>({id:o.slug,label:o.slug,relativePath:o.relativePath,source:o.source,relationship:o.relationship,externalPath:o.externalPath,runtime:o.runtime,framework:o.framework,kit:o.kit,modules:o.modules,ports:o.ports,apis:o.contracts.apis,owns:o.contracts.owns,env:o.contracts.env})),a=new Set(c.map(o=>o.id)),i=new Map,p=[];for(let o of s.projects){for(let l of o.contracts.dependsOn||[])a.has(l)&&p.push({from:l,to:o.slug,type:"dependency",label:"dependsOn"});for(let l of o.contracts.publishes||[])i.has(l)||i.set(l,new Set),i.get(l)?.add(o.slug);}for(let o of s.projects)for(let l of o.contracts.consumes||[]){let r=i.get(l);if(r)for(let n of r)n!==o.slug&&p.push({from:n,to:o.slug,type:"event",label:l});}let u={schemaVersion:1,kind:"rapidkit.workspace.contract.graph",workspace:s.workspace,generatedAt:new Date().toISOString(),nodes:c.sort((o,l)=>o.id.localeCompare(l.id)),edges:p.sort((o,l)=>`${o.from}:${o.to}:${o.type}:${o.label}`.localeCompare(`${l.from}:${l.to}:${l.type}:${l.label}`)),summary:{projectCount:c.length,dependencyEdges:p.filter(o=>o.type==="dependency").length,eventEdges:p.filter(o=>o.type==="event").length,portCount:c.reduce((o,l)=>o+l.ports.length,0),apiCount:c.reduce((o,l)=>o+l.apis.length,0)}};return {contractPath:e,graph:u}}async function B(t){let e=t.contract?{contractPath:t.contractPath??c(t.workspacePath,P),contract:t.contract}:await H(t),{contractPath:s,contract:c$1}=e,a=[],i=[];c$1.kind!=="rapidkit.workspace.contract"&&a.push("Contract kind must be rapidkit.workspace.contract."),c$1.schemaVersion!==j&&a.push(`Contract schemaVersion must be ${j}.`),c$1.workspace?.name||a.push("Contract workspace.name is required."),Array.isArray(c$1.projects)||a.push("Contract projects must be an array.");let p=new Set,u=new Map;for(let r of c$1.projects||[]){if(!r.slug){a.push("Every project must declare slug.");continue}p.has(r.slug)&&a.push(`Duplicate project slug: ${r.slug}.`),p.add(r.slug),r.relativePath?S(r.relativePath)||a.push(`Project ${r.slug} declares unsafe relativePath: ${r.relativePath}.`):a.push(`Project ${r.slug} must declare relativePath.`),r.externalPath&&(r.relationship==="adopted"||r.source==="adopted-local"||r.source==="local-folder"||r.source==="git-url"||a.push(`Project ${r.slug} declares externalPath without imported/adopted provenance.`),d.isAbsolute(r.externalPath)||a.push(`Project ${r.slug} declares non-absolute externalPath.`));for(let n of r.ports||[]){(!Number.isInteger(n.port)||n.port<1||n.port>65535)&&a.push(`Project ${r.slug} declares invalid port: ${n.port}.`);let g=u.get(n.port);g&&a.push(`Port ${n.port} is claimed by both ${g} and ${r.slug}.`),u.set(n.port,r.slug);}for(let n of r.contracts?.apis||[])(!n.name?.trim()||!n.basePath?.startsWith("/"))&&a.push(`Project ${r.slug} declares invalid API contract.`);for(let n of [...r.contracts?.publishes||[],...r.contracts?.consumes||[]])n.trim()||a.push(`Project ${r.slug} declares an empty event contract.`);for(let n of r.contracts?.env||[])/^[A-Z_][A-Z0-9_]*$/.test(n)||a.push(`Project ${r.slug} declares invalid env contract: ${n}.`);for(let n of r.contracts?.dependsOn||[])p.has(n);}for(let r of c$1.projects||[])for(let n of r.contracts?.dependsOn||[])p.has(n)||a.push(`Project ${r.slug} depends on unknown project: ${n}.`);i.push({id:"schema",status:c$1.kind==="rapidkit.workspace.contract"&&c$1.schemaVersion===j?"passed":"failed",message:"Contract schema and kind are valid."}),i.push({id:"projects",status:Array.isArray(c$1.projects)?"passed":"failed",message:`Contract declares ${Array.isArray(c$1.projects)?c$1.projects.length:0} project(s).`}),i.push({id:"ports",status:a.some(r=>r.toLowerCase().includes("port"))?"failed":"passed",message:"Project port declarations are valid and collision-free."}),i.push({id:"dependencies",status:a.some(r=>r.includes("depends on unknown project"))?"failed":"passed",message:"Project dependencies point to known project slugs."}),i.push({id:"contracts",status:a.some(r=>r.includes("unsafe relativePath")||r.includes("invalid API contract")||r.includes("event contract")||r.includes("env contract"))?"failed":"passed",message:"Project path, API, event, and env contracts are valid."});let o=await l(t.workspacePath);if(o.moduleCount>0){for(let r of o.issues)a.push(`${d.basename(r.projectRoot)}: ${r.message} (slug=${r.slug})`);i.push({id:"module-paths",status:o.status,message:o.status==="passed"?`All ${o.moduleCount} registered module(s) resolve under canonical paths.`:`${o.issues.length} registered module(s) missing canonical install paths.`});}else t.strict&&i.push({id:"module-paths",status:"passed",message:"No registry-backed modules declared in workspace projects."});return {status:a.length>0?"failed":"passed",contractPath:s,projectCount:Array.isArray(c$1.projects)?c$1.projects.length:0,checks:i,violations:a}}async function yt(t){let e=d.resolve(t.workspacePath),s={schemaVersion:X,generatedAt:t.generatedAt??new Date().toISOString(),status:t.result.status,contractPath:t.result.contractPath,projectCount:t.result.projectCount,checks:t.result.checks,violations:t.result.violations};return g(e,Q,J(s))}
|
|
2
|
+
export{J as a,P as b,Q as c,j as d,X as e,W as f,ot as g,L as h,kt as i,wt as j,H as k,Ct as l,B as m,yt as n};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {c as c$2}from'./chunk-
|
|
2
|
-
`);let
|
|
3
|
-
`),await
|
|
4
|
-
\u2705 Synced ${
|
|
5
|
-
\u2705 All projects already registered (${
|
|
1
|
+
import {c as c$2}from'./chunk-6IIZJQLV.js';import {a}from'./chunk-A5FBGRJA.js';import {a as a$2}from'./chunk-GZTYAEWX.js';import {c as c$1}from'./chunk-Y45WZR5N.js';import {a as a$1}from'./chunk-TQEMLBAG.js';import {p as p$1,o}from'./chunk-5XATWNME.js';import {p as p$2,r,q as q$1}from'./chunk-EYJ2CQSK.js';import {promises}from'fs';import {randomUUID}from'crypto';import p from'path';import c from'chalk';import oe from'fs-extra';import S from'ora';import {execa}from'execa';async function ae(e){try{let r=await execa("git",["rev-parse","--show-toplevel"],{cwd:e,env:a$1()});return r.stdout.trim()?p.resolve(e,r.stdout.trim()):null}catch{return null}}async function H(e,r,t){if(await ae(e)){r.warn("Git initialization skipped because target is already inside a git worktree");return}r.start("Initializing git repository...");try{await execa("git",["init"],{cwd:e,env:a$1()}),await execa("git",["add","."],{cwd:e,env:a$1()}),await execa("git",["-c","user.name=Workspai","-c","user.email=workspai@localhost","commit","-m",t],{cwd:e,env:a$1()}),r.succeed("Git repository initialized");}catch{r.warn("Could not initialize git repository");}}function q(e){let r=a(e.path),t=Array.isArray(e.projects)?e.projects:[],a$1=[],o=new Set;for(let s of t){if(!s||typeof s.name!="string"||typeof s.path!="string")continue;let i=a(s.path);o.has(i)||(o.add(i),a$1.push({name:s.name,path:i}));}return {name:e.name,path:r,mode:e.mode,projects:a$1}}function W(e){let r=[],t=new Set;for(let a of e.workspaces||[]){if(!a||typeof a.name!="string"||typeof a.path!="string")continue;let o=q(a);t.has(o.path)||(t.add(o.path),r.push(o));}return {workspaces:r}}async function ie(e){let r;try{r=await promises.readFile(e,"utf8");}catch(t){if(t.code==="ENOENT")return {workspaces:[]};throw t}try{let t=JSON.parse(r);if(!t||!Array.isArray(t.workspaces))throw new Error("missing workspaces array");return W(t)}catch(t){throw new Error(`Workspace registry is invalid: ${e}`,{cause:t})}}async function se(e){let r;try{r=await promises.readFile(e,"utf8");}catch(a){if(a.code==="ENOENT")return {workspaces:[]};throw a}let t;try{t=JSON.parse(r);}catch(a){throw new Error(`Workspace registry is invalid: ${e}`,{cause:a})}if(!t||typeof t!="object"||!Array.isArray(t.workspaces))throw new Error(`Workspace registry is invalid: ${e}`);for(let a of t.workspaces)if(!a||typeof a.name!="string"||typeof a.path!="string"||a.mode!==void 0&&typeof a.mode!="string"||a.projects!==void 0&&!Array.isArray(a.projects)||Array.isArray(a.projects)&&a.projects.some(o=>!o||typeof o.name!="string"||typeof o.path!="string"))throw new Error(`Workspace registry contains an invalid entry: ${e}`);return W(t)}async function B(){let e={workspaces:[]},r$1=new Set;for(let t of r()){let a=await ie(t);for(let o of a.workspaces)r$1.has(o.path)||(r$1.add(o.path),e.workspaces.push(o));}return e}async function ne(){let e={workspaces:[]},r$1=new Set;for(let t of r()){let a=await se(t);for(let o of a.workspaces)r$1.has(o.path)||(r$1.add(o.path),e.workspaces.push(o));}return e}function ce(e){let r=e?.code;return process.platform==="win32"&&(r==="EPERM"||r==="EINVAL"||r==="ENOSYS")}async function X(e){try{await e.sync();}catch(r){if(!ce(r))throw r}}async function M(e,r){let t=p.dirname(e);await promises.mkdir(t,{recursive:true});let a=`${p.basename(e)}.`,o=Date.now();for(let i of await promises.readdir(t)){if(!i.startsWith(a)||!i.endsWith(".tmp"))continue;let n=p.join(t,i),d=await promises.stat(n).catch(()=>null);d&&o-d.mtimeMs>3e4&&await promises.rm(n,{force:true}).catch(()=>{});}let s=await promises.readFile(e,"utf8").catch(()=>null);if(s!==null){let i=false;try{let n=JSON.parse(s);i=Array.isArray(n.workspaces);}catch{i=false;}if(!i){let n=`${e}.corrupt-${Date.now()}`;await promises.copyFile(e,n);}}await Q(e,`${JSON.stringify(W(r),null,2)}
|
|
2
|
+
`);}async function Q(e,r){let t=p.dirname(e);await promises.mkdir(t,{recursive:true});let a=`${e}.${process.pid}.${randomUUID()}.tmp`;try{await promises.writeFile(a,r);let o=await promises.open(a,"r");try{await X(o);}finally{await o.close();}try{await promises.rename(a,e);}catch(s){let i=s.code;if(i!=="EEXIST"&&i!=="EPERM")throw s;await oe.move(a,e,{overwrite:true});}}finally{await promises.rm(a,{force:true}).catch(()=>{});}}async function V(e){try{return {exists:true,content:await promises.readFile(e)}}catch(r){if(r.code==="ENOENT")return {exists:false};throw r}}async function Y(e,r){if(!r.exists){await promises.rm(e,{force:true});return}await Q(e,r.content);}async function pe(e){let r=p$2(),t=p.join(r,"workspaces.json.lock");await promises.mkdir(r,{recursive:true});let a=Date.now(),o;for(;!o;)try{o=await promises.open(t,"wx"),await o.writeFile(`${JSON.stringify({pid:process.pid,createdAt:new Date().toISOString()})}
|
|
3
|
+
`),await X(o);}catch(s){if(s.code!=="EEXIST")throw s;let i=await promises.stat(t).catch(()=>null);if(i&&Date.now()-i.mtimeMs>3e4){let n=await promises.readFile(t,"utf8").then(w=>JSON.parse(w)).catch(()=>null),d=Number(n?.pid),m=false;if(Number.isInteger(d)&&d>0)try{process.kill(d,0),m=true;}catch(w){m=w.code==="EPERM";}if(!m){await promises.rm(t,{force:true}).catch(()=>{});continue}}if(Date.now()-a>1e4)throw new Error(`Timed out waiting for workspace registry lock: ${t}`);await new Promise(n=>setTimeout(n,25));}try{return await e()}finally{await o.close().catch(()=>{}),await promises.rm(t,{force:true}).catch(()=>{});}}async function P(e){return pe(async()=>{let r=p.join(p$2(),"workspaces.json"),t=p.join(q$1(),"workspaces.json"),[a,o]=await Promise.all([V(r),V(t)]),s=await ne();await e(s);let i=W(s);try{await M(r,i),await M(t,i);}catch(n){let m=(await Promise.allSettled([Y(r,a),Y(t,o)])).filter(w=>w.status==="rejected").map(w=>w.reason);throw m.length>0?new AggregateError([n,...m],"Workspace registry transaction failed and could not be fully restored"):n}return i})}async function K(e,r){let t=a(e);await P(a=>{let o=a.workspaces.find(s=>s.path===t);if(o){o.name=r,o.mode=o.mode||"full",o.projects=Array.isArray(o.projects)?o.projects:[];return}a.workspaces.push({name:r,path:t,mode:"full",projects:[]});});}async function le(e,r){try{await K(e,r);}catch{console.warn(c.gray("Note: Could not register workspace in shared registry"));}}async function Le(e,r=false){let t=a(e),a$1={workspacePath:t,workspaceFound:false,added:[],skipped:0};try{let o=await B(),s=o.workspaces.find(u=>u.path===t);if(!s){if(await le(t,p.basename(p.resolve(e))),o=await B(),s=o.workspaces.find(u=>u.path===t),!s)return r||console.log("\u26A0\uFE0F Workspace could not be registered in registry"),a$1;r||console.log("\u2714 Registered workspace in shared registry");}Array.isArray(s.projects)||(s.projects=[]);let i=0,n=0,d=[],m=[],w=[e],g=new Set;for(;w.length>0;){let u=w.shift();if(!u||g.has(u))continue;g.add(u);let y=await promises.readdir(u,{withFileTypes:true});for(let h of y){if(!h.isDirectory()||h.name.startsWith(".")||["node_modules","dist","build","target","coverage","htmlcov"].includes(h.name))continue;let j=p.join(u,h.name),k=a(j);try{let f=false;for(let $ of [...p$1(k,"context.json"),...p$1(k,"project.json")])try{await promises.access($),f=true;break}catch{}if(f){let $=p.basename(k),E=s.projects.some(C=>C.path===k);m.push({name:$,path:k}),E?n++:(s.projects.push({name:$,path:k}),i++,d.push(k),r||console.log(`\u2714 Added: ${p.relative(e,k)}`));continue}}catch{}w.push(j);}}return await P(u=>{let y=u.workspaces.find(k=>k.path===t);if(!y)return;let h=`${t}${p.sep}`,j=(y.projects||[]).filter(k=>k.path!==t&&!k.path.startsWith(h));y.projects=q({...y,projects:[...j,...m]}).projects;}),i>0?r||console.log(`
|
|
4
|
+
\u2705 Synced ${i} project(s) to registry`):r||console.log(`
|
|
5
|
+
\u2705 All projects already registered (${n} found)`),{workspacePath:t,workspaceFound:true,added:d,skipped:n}}catch(o){return r||console.error("\u274C Failed to sync projects:",o.message),a$1}}async function de(e,r,t){let a$1=a(e),o=a(t);await P(s=>{let i=s.workspaces.find(m=>m.path===a$1);if(!i)throw new Error(`Workspace is not registered: ${a$1}`);i.projects=Array.isArray(i.projects)?i.projects:[];let n=i.projects.findIndex(m=>m.path===o||m.name===r),d={name:r,path:o};n>=0?i.projects[n]=d:i.projects.push(d);});}async function Oe(e,r,t){try{await de(e,r,t);}catch{}}async function Fe(e,r){let t=S("Creating Workspai workspace...").start();try{await promises.mkdir(e,{recursive:true}),await promises.mkdir(p.join(e,".workspai"),{recursive:true});let a={workspace_name:r.name,author:r.author,rapidkit_version:c$1(),created_at:new Date().toISOString(),type:"workspace"};await promises.writeFile(p.join(e,".workspai","config.json"),JSON.stringify(a,null,2));let{syncWorkspaceFoundationFiles:o}=await import('./create-WCV3L6XH.js');await o(e,{workspaceName:r.name,installMethod:"venv",writeMarker:true,writeGitignore:false,onlyIfMissing:true});let s=me();await promises.writeFile(p.join(e,"rapidkit"),s),await promises.chmod(p.join(e,"rapidkit"),493);let i=ge();await promises.writeFile(p.join(e,"rapidkit.cmd"),i);let n=ue(r.name);await promises.writeFile(p.join(e,"README.md"),n),await promises.writeFile(p.join(e,".gitignore"),`# Workspai workspace
|
|
6
6
|
.env
|
|
7
7
|
.env.*
|
|
8
8
|
!.env.example
|
|
@@ -17,10 +17,10 @@ Thumbs.db
|
|
|
17
17
|
|
|
18
18
|
# Logs
|
|
19
19
|
*.log
|
|
20
|
-
`),await
|
|
21
|
-
${
|
|
20
|
+
`),await we(e),t.succeed("Workspace created!"),r.skipGit||await H(e,S(),"Initial commit: Workspai workspace"),await K(e,r.name);let{publishWorkspaceRegistrySummary:m}=await import('./workspace-registry-summary-SZ46R5PD.js');await m(e),console.log(`
|
|
21
|
+
${c.green("\u2728 Workspai workspace created successfully!")}
|
|
22
22
|
|
|
23
|
-
${
|
|
23
|
+
${c.bold("\u{1F4C2} Workspace structure:")}
|
|
24
24
|
${e}/
|
|
25
25
|
\u251C\u2500\u2500 rapidkit # Local CLI wrapper
|
|
26
26
|
\u251C\u2500\u2500 rapidkit.cmd # Windows local CLI wrapper
|
|
@@ -32,29 +32,29 @@ ${e}/
|
|
|
32
32
|
\u2502 \u2514\u2500\u2500 config.json # Workspai workspace config
|
|
33
33
|
\u2514\u2500\u2500 README.md
|
|
34
34
|
|
|
35
|
-
${
|
|
36
|
-
${
|
|
37
|
-
${
|
|
38
|
-
${
|
|
39
|
-
${
|
|
40
|
-
${
|
|
35
|
+
${c.bold("\u{1F680} Get started:")}
|
|
36
|
+
${c.cyan(`cd ${r.name}`)}
|
|
37
|
+
${c.cyan("npx workspai create project fastapi.standard my-api --yes")}
|
|
38
|
+
${c.cyan("cd my-api")}
|
|
39
|
+
${c.cyan("npx workspai init")}
|
|
40
|
+
${c.cyan("npx workspai dev")}
|
|
41
41
|
|
|
42
|
-
${
|
|
42
|
+
${c.bold("\u{1F4E6} Available templates:")}
|
|
43
43
|
fastapi - FastAPI + Python
|
|
44
44
|
nestjs - NestJS + TypeScript
|
|
45
45
|
springboot - Spring Boot + Java
|
|
46
46
|
gofiber - Go Fiber
|
|
47
47
|
gogin - Go Gin
|
|
48
48
|
|
|
49
|
-
${
|
|
49
|
+
${c.bold("\u{1F4DA} Commands:")}
|
|
50
50
|
npx workspai create project <kit> <name> Create a new project
|
|
51
51
|
npx workspai init Install dependencies
|
|
52
52
|
npx workspai dev Start dev server
|
|
53
53
|
npx workspai help Show all commands
|
|
54
54
|
|
|
55
|
-
${
|
|
56
|
-
${
|
|
57
|
-
`);}catch(
|
|
55
|
+
${c.gray("Alternative: npx workspai dev, make dev")}
|
|
56
|
+
${c.gray("\u{1F4A1} Tip: Install globally (npm i -g workspai) to use without npx")}
|
|
57
|
+
`);}catch(a){throw t.fail("Failed to create workspace"),a}}function me(){return `#!/usr/bin/env bash
|
|
58
58
|
#
|
|
59
59
|
# Workspai CLI - local workspace commands
|
|
60
60
|
# This script provides legacy ./rapidkit commands within the workspace
|
|
@@ -440,7 +440,7 @@ main() {
|
|
|
440
440
|
}
|
|
441
441
|
|
|
442
442
|
main "$@"
|
|
443
|
-
`}function
|
|
443
|
+
`}function ge(){return `@echo off
|
|
444
444
|
setlocal enabledelayedexpansion
|
|
445
445
|
|
|
446
446
|
set "SCRIPT_DIR=%~dp0"
|
|
@@ -460,7 +460,7 @@ if %ERRORLEVEL%==0 (
|
|
|
460
460
|
echo [Workspai] No sh/bash found. Falling back to npx workspai.
|
|
461
461
|
npx workspai %*
|
|
462
462
|
exit /b %ERRORLEVEL%
|
|
463
|
-
`}function
|
|
463
|
+
`}function ue(e){return `# ${e}
|
|
464
464
|
|
|
465
465
|
Workspai workspace for building API projects.
|
|
466
466
|
|
|
@@ -502,11 +502,22 @@ npx workspai dev # Start dev server
|
|
|
502
502
|
| \`npx workspai lint\` | Run linting |
|
|
503
503
|
| \`npx workspai format\` | Format code |
|
|
504
504
|
|
|
505
|
+
## Workspace Intelligence
|
|
506
|
+
|
|
507
|
+
\`\`\`bash
|
|
508
|
+
npx workspai workspace model --json --write
|
|
509
|
+
npx workspai workspace context --for-agent --json --write
|
|
510
|
+
npx workspai pipeline --json --strict
|
|
511
|
+
\`\`\`
|
|
512
|
+
|
|
513
|
+
Durable evidence is written to \`.workspai/reports/\`; generated agent
|
|
514
|
+
instructions start at \`AGENTS.md\`.
|
|
515
|
+
|
|
505
516
|
## Learn More
|
|
506
517
|
|
|
507
518
|
- [Workspai Documentation](https://workspai.dev)
|
|
508
519
|
- [GitHub Repository](https://github.com/rapidkitlabs/workspai)
|
|
509
|
-
`}async function
|
|
520
|
+
`}async function we(e){let{fileURLToPath:r}=await import('url'),t=r(import.meta.url),a=p.dirname(t),o=p.resolve(a,".."),s=p.join(o,"templates","kits"),i=p.join(e,".workspai","templates"),{default:n}=await import('fs-extra');await n.copy(s,i);let d=p.join(o,"templates","generator.js"),m=p.join(e,".workspai","generator.js");await n.copy(d,m);}async function Be(e,r){let t=r.template==="fastapi",a=t?"FastAPI":"NestJS",o=S(`Creating ${a} project...`).start();try{let{fileURLToPath:s}=await import('url'),i=s(import.meta.url),n=p.dirname(i),d=p.resolve(n,".."),m=t?"fastapi-standard":"nestjs-standard",w=p.join(d,"templates","kits",m);await promises.mkdir(e,{recursive:true});let g={project_name:t?r.name.replace(/-/g,"_").toLowerCase():r.name.replace(/_/g,"-").toLowerCase(),author:r.author,description:r.description||`${a} application generated with Workspai`,app_version:"0.1.0",license:"MIT",package_manager:r.package_manager||"npm",created_at:new Date().toISOString(),rapidkit_version:c$1()};await Z(w,e,g);let u=t?`# Python
|
|
510
521
|
__pycache__/
|
|
511
522
|
*.py[cod]
|
|
512
523
|
*$py.class
|
|
@@ -574,10 +585,10 @@ Thumbs.db
|
|
|
574
585
|
|
|
575
586
|
# Coverage
|
|
576
587
|
coverage/
|
|
577
|
-
`;if(await promises.writeFile(
|
|
578
|
-
${
|
|
588
|
+
`;if(await promises.writeFile(p.join(e,".gitignore"),u),o.succeed(`${a} project created!`),r.skipGit||await H(e,S(),`Initial commit: ${a} project via Workspai`),!r.skipInstall&&!t){let h=r.package_manager||"npm",j=S(`Installing dependencies with ${h}...`).start();try{await execa(h,["install"],{cwd:e}),j.succeed("Dependencies installed");}catch{j.warn(`Could not install dependencies. Run '${h} install' manually.`);}}let y=p.basename(e);console.log(t?`
|
|
589
|
+
${c.green("\u2728 FastAPI project created successfully!")}
|
|
579
590
|
|
|
580
|
-
${
|
|
591
|
+
${c.bold("\u{1F4C2} Project structure:")}
|
|
581
592
|
${e}/
|
|
582
593
|
\u251C\u2500\u2500 .workspai/ # Project metadata
|
|
583
594
|
\u251C\u2500\u2500 src/
|
|
@@ -589,12 +600,12 @@ ${e}/
|
|
|
589
600
|
\u251C\u2500\u2500 pyproject.toml # Poetry configuration
|
|
590
601
|
\u2514\u2500\u2500 README.md
|
|
591
602
|
|
|
592
|
-
${
|
|
593
|
-
${
|
|
594
|
-
${
|
|
595
|
-
${
|
|
603
|
+
${c.bold("\u{1F680} Get started:")}
|
|
604
|
+
${c.cyan(`cd ${y}`)}
|
|
605
|
+
${c.cyan("npx workspai init")} ${c.gray("# Install dependencies")}
|
|
606
|
+
${c.cyan("npx workspai dev")} ${c.gray("# Start dev server")}
|
|
596
607
|
|
|
597
|
-
${
|
|
608
|
+
${c.bold("\u{1F4DA} Available commands:")}
|
|
598
609
|
npx workspai init # Install dependencies (poetry install)
|
|
599
610
|
npx workspai dev # Start dev server with hot reload
|
|
600
611
|
npx workspai start # Start production server
|
|
@@ -602,12 +613,12 @@ ${s.bold("\u{1F4DA} Available commands:")}
|
|
|
602
613
|
npx workspai lint # Lint code
|
|
603
614
|
npx workspai format # Format code
|
|
604
615
|
|
|
605
|
-
${
|
|
606
|
-
${
|
|
616
|
+
${c.gray("Alternative: make dev, npx workspai dev, poetry run dev")}
|
|
617
|
+
${c.gray("\u{1F4A1} Tip: Install globally (npm i -g workspai) to use without npx")}
|
|
607
618
|
`:`
|
|
608
|
-
${
|
|
619
|
+
${c.green("\u2728 NestJS project created successfully!")}
|
|
609
620
|
|
|
610
|
-
${
|
|
621
|
+
${c.bold("\u{1F4C2} Project structure:")}
|
|
611
622
|
${e}/
|
|
612
623
|
\u251C\u2500\u2500 .workspai/ # Project metadata
|
|
613
624
|
\u251C\u2500\u2500 src/
|
|
@@ -619,13 +630,13 @@ ${e}/
|
|
|
619
630
|
\u251C\u2500\u2500 package.json # Dependencies
|
|
620
631
|
\u2514\u2500\u2500 README.md
|
|
621
632
|
|
|
622
|
-
${
|
|
623
|
-
${
|
|
624
|
-
${r.skipInstall?
|
|
625
|
-
`:""}${
|
|
626
|
-
${
|
|
633
|
+
${c.bold("\u{1F680} Get started:")}
|
|
634
|
+
${c.cyan(`cd ${y}`)}
|
|
635
|
+
${r.skipInstall?c.cyan("npx workspai init")+c.gray(" # npm install")+`
|
|
636
|
+
`:""}${c.cyan("cp .env.example .env")}
|
|
637
|
+
${c.cyan("npx workspai dev")} ${c.gray("# Start dev server")}
|
|
627
638
|
|
|
628
|
-
${
|
|
639
|
+
${c.bold("\u{1F4DA} Available commands:")}
|
|
629
640
|
npx workspai init # Install dependencies
|
|
630
641
|
npx workspai dev # Start dev server with hot reload
|
|
631
642
|
npx workspai start # Start production server
|
|
@@ -634,22 +645,22 @@ ${s.bold("\u{1F4DA} Available commands:")}
|
|
|
634
645
|
npx workspai lint # Lint code
|
|
635
646
|
npx workspai format # Format code
|
|
636
647
|
|
|
637
|
-
${
|
|
648
|
+
${c.bold("\u{1F310} API endpoints:")}
|
|
638
649
|
http://localhost:8000/health # Health check
|
|
639
650
|
http://localhost:8000/docs # Swagger docs
|
|
640
651
|
http://localhost:8000/examples/notes # Example API
|
|
641
652
|
|
|
642
|
-
${
|
|
643
|
-
`);}catch(
|
|
653
|
+
${c.gray("\u{1F4A1} Tip: Install globally (npm i -g workspai) to use without npx")}
|
|
654
|
+
`);}catch(s){throw o.fail(`Failed to create ${a} project`),s}}async function Z(e,r,t){let a=await promises.readdir(e,{withFileTypes:true});for(let o of a){let s=p.join(e,o.name),i=o.name.replace(/\.j2$/,""),n=p.join(r,i);if(o.isDirectory())await promises.mkdir(n,{recursive:true}),await Z(s,n,t);else {let d=await promises.readFile(s,"utf-8");o.name.endsWith(".j2")&&(d=fe(d,t)),await promises.writeFile(n,d),(i==="rapidkit"||i==="activate"||i.endsWith(".py")&&(n.includes(".workspai")||n.includes(".rapidkit")))&&await promises.chmod(n,493);}}}function fe(e,r){let t=e;for(let[a,o]of Object.entries(r)){let s=new RegExp(`\\{\\{\\s*${a}\\s*\\}\\}`,"g");t=t.replace(s,String(o));let i=new RegExp(`\\{\\{\\s*${a}\\s*\\|\\s*replace\\s*\\(\\s*['"]([^'"]+)['"]\\s*,\\s*['"]([^'"]*)['"]\\s*\\)\\s*\\}\\}`,"g");t=t.replace(i,(m,w,g)=>String(o).replace(new RegExp(w,"g"),g));let n=new RegExp(`\\{\\{\\s*${a}\\s*\\|\\s*lower\\s*\\}\\}`,"g");t=t.replace(n,String(o).toLowerCase());let d=new RegExp(`\\{\\{\\s*${a}\\s*\\|\\s*replace\\s*\\(\\s*['"]([^'"]+)['"]\\s*,\\s*['"]([^'"]*)['"]\\s*\\)\\s*\\|\\s*lower\\s*\\}\\}`,"g");t=t.replace(d,(m,w,g)=>String(o).replace(new RegExp(w,"g"),g).toLowerCase());}return t}async function Te(e={}){let r=p$2(),t=p.join(r,"workspaces.json"),a=await B();if(a.workspaces.length===0){if(e.json){console.log(JSON.stringify({schemaVersion:"rapidkit-workspace-list-v1",registryPath:t,workspaces:[],summary:{total:0,missing:0,registryExists:false}},null,2));return}console.log(c.yellow(`
|
|
644
655
|
\u26A0\uFE0F No workspaces registered yet.
|
|
645
|
-
`)),console.log(
|
|
646
|
-
`));return}try{let a
|
|
656
|
+
`)),console.log(c.gray(`Create a workspace with: npx workspai <workspace-name>
|
|
657
|
+
`));return}try{let o=a;if(!o||typeof o!="object"||!Array.isArray(o.workspaces)){if(e.json){console.log(JSON.stringify({schemaVersion:"rapidkit-workspace-list-v1",registryPath:t,workspaces:[],summary:{total:0,missing:0,registryExists:true,registryValid:false},error:{code:"workspace.registry.invalid",message:"Workspace registry is invalid."}},null,2));return}console.log(c.yellow(`
|
|
647
658
|
\u26A0\uFE0F Workspace registry is invalid; resetting to empty state.
|
|
648
|
-
`)),await P(g=>{g.workspaces=[];});return}let
|
|
659
|
+
`)),await P(g=>{g.workspaces=[];});return}let s=W(o),i=[],n=0;for(let g of s.workspaces)await promises.stat(g.path).catch(()=>null)?i.push(g):n+=1;let d={workspaces:i},m=JSON.stringify(o),w=JSON.stringify(d);if(!e.json&&m!==w){let g=new Set(i.map(u=>u.path));await P(u=>{u.workspaces=u.workspaces.filter(y=>g.has(y.path));});}if(!d.workspaces||d.workspaces.length===0){if(e.json){console.log(JSON.stringify({schemaVersion:"rapidkit-workspace-list-v1",registryPath:t,workspaces:[],summary:{total:0,missing:n,registryExists:true,registryValid:true,cleanupApplied:false}},null,2));return}console.log(c.yellow(`
|
|
649
660
|
\u26A0\uFE0F No workspaces registered yet.
|
|
650
|
-
`)),
|
|
651
|
-
`));return}if(e.json){console.log(JSON.stringify({schemaVersion:"rapidkit-workspace-list-v1",registryPath:t,workspaces:
|
|
661
|
+
`)),n>0&&console.log(c.gray(`Cleaned ${n} stale workspace entr${n===1?"y":"ies"}.
|
|
662
|
+
`));return}if(e.json){console.log(JSON.stringify({schemaVersion:"rapidkit-workspace-list-v1",registryPath:t,workspaces:d.workspaces,summary:{total:d.workspaces.length,missing:n,registryExists:true,registryValid:true,cleanupApplied:false}},null,2));return}console.log(c.bold(`
|
|
652
663
|
\u{1F4E6} Registered Workspai Workspaces:
|
|
653
|
-
`));for(let g of
|
|
654
|
-
`));}catch(
|
|
655
|
-
\u274C Failed to read workspace registry`)),console.error(
|
|
664
|
+
`));for(let g of d.workspaces)console.log(c.cyan(` ${g.name}`)),console.log(c.gray(` Path: ${g.path}`)),console.log(c.gray(` Projects: ${g.projects?.length||0}`)),console.log();n>0&&console.log(c.gray(`Cleaned ${n} stale workspace entr${n===1?"y":"ies"}.`)),console.log(c.gray(`Total: ${d.workspaces.length} workspace(s)
|
|
665
|
+
`));}catch(o){if(e.json){console.log(JSON.stringify({schemaVersion:"rapidkit-workspace-list-v1",registryPath:t,workspaces:[],summary:{total:0,missing:0,registryExists:true,registryValid:false},error:{code:"workspace.registry.read_failed",message:o.message}},null,2));return}console.error(c.red(`
|
|
666
|
+
\u274C Failed to read workspace registry`)),console.error(c.gray(String(o)));}}async function ke(e){try{let r=await promises.readFile(e,"utf8");return JSON.parse(r)}catch{return null}}async function L(e){for(let r of e){let t=await ke(r);if(t!==null)return t}return null}function he(e){return c$2(e)}async function ye(e){return a$2(e,{skipDirs:new Set(["node_modules","dist","build","target","coverage","htmlcov"]),includeHiddenDirs:false,descendIntoMatchedProjects:true})}async function O(e){try{return (await promises.readdir(e,{withFileTypes:true})).filter(t=>t.isFile()&&t.name.toLowerCase().endsWith(".json")).map(t=>t.name).sort((t,a)=>t.localeCompare(a))}catch{return []}}async function Je(e,r){let t=r?.includePaths===true,a=r?.includeDoctorEvidence!==false,o$1=r?.includeBlueprint!==false,s=p.resolve(e),i=await L(o(s,"workspace.json")),n=typeof i?.workspace_name=="string"&&i.workspace_name.trim()||p.basename(s),d=typeof i?.profile=="string"?i.profile:void 0,m=typeof i?.rapidkit_version=="string"?i.rapidkit_version:void 0,w=await ye(s),g=[];for(let f of w){let $=await L(p$1(f,"project.json")),E=p.relative(s,f)||".",C=p.dirname(p$1(f,p.join("reports","placeholder"))[0]),T=p.dirname(p$1(f,p.join("reports","placeholder"))[1]),N={name:p.basename(f),relative_path:E,runtime:typeof $?.runtime=="string"?$.runtime:void 0,kit_name:typeof $?.kit_name=="string"?$.kit_name:void 0,modules:Array.isArray($?.modules)?$.modules.filter(_=>typeof _=="string"):void 0};if(t&&(N.absolute_path=f),a){let _=await L([p.join(C,"doctor-last-run.json"),p.join(T,"doctor-last-run.json")]);he(_)&&(N.doctor_report=_);}let J=[...await O(C),...await O(T)].filter((_,ee,te)=>te.indexOf(_)===ee);J.length>0&&(N.reports=J),g.push(N);}let u=o(s,"reports"),y=[...await O(u[0]),...await O(u[1])].filter((f,$,E)=>E.indexOf(f)===$),h=await L(o(s,"workspace.contract.json")),j={schema_version:"1.1",generated_at:new Date().toISOString(),generated_by:"workspai",workspace:{name:n,relative_root:".",profile:d,rapidkit_version:m,...t?{absolute_root:s}:{}},summary:{project_count:g.length,doctor_evidence_included:a,contract_included:!!h},reports:{workspace:y},projects:g,...h?{contract:h}:{}};o$1&&(j.blueprint={schema_version:"rapidkit.workspace-blueprint.v1",purpose:"portable-reproducibility",workspace:{name:n,profile:d},projects:g.map(f=>({name:f.name,relative_path:f.relative_path,runtime:f.runtime,kit_name:f.kit_name,modules:f.modules??[],recreate_commands:[...f.kit_name?[`npx workspai create project ${f.kit_name} ${f.name} --yes --skip-install`]:[],`cd ${f.relative_path}`,"npx workspai init","npx workspai test"]})),recommended_commands:["npx workspai workspace contract verify --strict","npx workspai doctor workspace","npx workspai workspace run init --json","npx workspai workspace run test --strict --json","npx workspai readiness --strict --json"]});let k=r?.outputPath?p.resolve(r.outputPath):p.join(u[0],"share-bundle.json");return await promises.mkdir(p.dirname(k),{recursive:true}),await promises.writeFile(k,JSON.stringify(j,null,2),"utf8"),k}export{q as a,K as b,le as c,Le as d,de as e,Oe as f,Fe as g,Be as h,Te as i,Je as j};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b}from'./chunk-
|
|
1
|
+
import {b}from'./chunk-CVHMUSRX.js';import {a,b as b$1}from'./chunk-S5KTATOU.js';function f(r){let s=new Map;for(let n of r.projects)s.has(n.name)||s.set(n.name,b(n));return s}function j(r){let s=f(r),n=r.graph??{nodes:r.projects.map(t=>({id:t.name,path:t.path})),edges:[]},a$1=a(n),o=new Map;for(let t of n.nodes){let e=s.get(t.id)??b({missing:t.id}),g=[...b$1(a$1,[t.id],{direction:"dependencies"}).keys()].filter(c=>c!==t.id).sort((c,l)=>c.localeCompare(l)).map(c=>({id:c,hash:s.get(c)??"<unknown>"}));o.set(t.id,{id:t.id,ownHash:e,transitiveInputsHash:b({own:e,dependencies:g})});}return o}function v(r,s){if(!s||Object.keys(s).length===0)return {verdict:"unknown",baseline:"none",changed:[],added:[],removed:[]};let n=[],a=[];for(let[e,i]of r.entries())e in s?s[e]!==i.transitiveInputsHash&&n.push(e):a.push(e);let o=[];for(let e of Object.keys(s))r.has(e)||o.push(e);return n.sort((e,i)=>e.localeCompare(i)),a.sort((e,i)=>e.localeCompare(i)),o.sort((e,i)=>e.localeCompare(i)),{verdict:n.length>0||a.length>0||o.length>0?"stale":"fresh",baseline:"recorded",changed:n,added:a,removed:o}}function w(r){let s={};for(let[n,a]of [...r.entries()].sort((o,t)=>o[0].localeCompare(t[0])))s[n]=a.transitiveInputsHash;return s}export{f as a,j as b,v as c,w as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{c as PYTHON_FREE_WORKSPACE_PROFILES,a as buildWorkspaceManifest,f as createProject,g as registerWorkspaceAtPath,d as resolvePythonFreeFallbackProfile,b as syncWorkspaceFoundationFiles,e as writeWorkspaceLauncher}from'./chunk-
|
|
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-J5PIZCAU.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as DOCTOR_WORKSPACE_REPORT_PATH,m as applyEnvKeyAddFix,i as applyFileAppendFix,j as applyFileCopyFix,h as applyFileCreateFix,l as applyJsonEditFix,n as applyMakefileTargetFix,g as applyPackageScriptFix,f as assertOperationPathInsideProject,e as buildRepairOperationIdentity,p as computeDoctorFixAwareExitCode,o as computeDoctorGateExitCode,k as decodeJsonPointerSegment,d as parseInternalRepairCommand,c as parsePackageScriptFix,b as resolveDoctorPolicyProfile,q as runDoctor}from'./chunk-VFDM65IE.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {b,c}from'./chunk-IBJEQHJR.js';import {c as c$1}from'./chunk-Y45WZR5N.js';import {b as b$
|
|
1
|
+
import {b as b$1,c}from'./chunk-IBJEQHJR.js';import {c as c$1}from'./chunk-Y45WZR5N.js';import {b as b$2,a}from'./chunk-TQEMLBAG.js';import {promises}from'fs';import n from'path';import i from'chalk';import S from'ora';import {execa}from'execa';var b="net8.0",j="8080";function y(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-")}function E(e,r){return e.trim().replace(/[^A-Za-z0-9_.]+/g,".").replace(/^\.+|\.+$/g,"").replace(/\.{2,}/g,".").split(".").map(a=>a.replace(/^[^A-Za-z_]+/,"").replace(/[^A-Za-z0-9_]/g,"")).filter(Boolean).join(".")||r}function _(e,r){return e.replace(/[\r\n\t]+/g," ").trim()||r}function D(e){return e.trim()===b}function $(){return JSON.stringify({engine:"npm",runtime:"dotnet"},null,2)}function I(e,r){return JSON.stringify({kit_name:"dotnet.webapi.clean",runtime:"dotnet",framework:"dotnet",module_support:false,project_name:e.project_name,root_namespace:e.root_namespace,target_framework:e.target_framework,app_version:e.app_version,created_by:"workspai",workspai_version:r,rapidkit_version:r,created_at:new Date().toISOString()},null,2)}function P(e){return `<Project Sdk="Microsoft.NET.Sdk.Web">
|
|
2
2
|
<PropertyGroup>
|
|
3
3
|
<TargetFramework>${e.target_framework}</TargetFramework>
|
|
4
4
|
<Nullable>enable</Nullable>
|
|
@@ -16,7 +16,7 @@ import {b,c}from'./chunk-IBJEQHJR.js';import {c as c$1}from'./chunk-Y45WZR5N.js'
|
|
|
16
16
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
|
|
17
17
|
</ItemGroup>
|
|
18
18
|
</Project>
|
|
19
|
-
`}function
|
|
19
|
+
`}function k(e){return `<Project Sdk="Microsoft.NET.Sdk">
|
|
20
20
|
<PropertyGroup>
|
|
21
21
|
<TargetFramework>${e.target_framework}</TargetFramework>
|
|
22
22
|
<ImplicitUsings>enable</ImplicitUsings>
|
|
@@ -36,7 +36,7 @@ import {b,c}from'./chunk-IBJEQHJR.js';import {c as c$1}from'./chunk-Y45WZR5N.js'
|
|
|
36
36
|
<ProjectReference Include="..\\src\\${e.project_name}.csproj" />
|
|
37
37
|
</ItemGroup>
|
|
38
38
|
</Project>
|
|
39
|
-
`}function
|
|
39
|
+
`}function T(e){return `using ${e.root_namespace}.Application;
|
|
40
40
|
using ${e.root_namespace}.Infrastructure;
|
|
41
41
|
using ${e.root_namespace}.Presentation;
|
|
42
42
|
|
|
@@ -81,7 +81,7 @@ public sealed class ApplicationInfoOptions
|
|
|
81
81
|
|
|
82
82
|
public string Description { get; init; } = "${e.description}";
|
|
83
83
|
}
|
|
84
|
-
`}function
|
|
84
|
+
`}function x(e){return `using Microsoft.Extensions.DependencyInjection;
|
|
85
85
|
|
|
86
86
|
namespace ${e.root_namespace}.Application;
|
|
87
87
|
|
|
@@ -93,7 +93,7 @@ public static class ApplicationServiceRegistration
|
|
|
93
93
|
return services;
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
`}function
|
|
96
|
+
`}function v(e){return `using Microsoft.Extensions.Options;
|
|
97
97
|
|
|
98
98
|
namespace ${e.root_namespace}.Application;
|
|
99
99
|
|
|
@@ -117,7 +117,7 @@ public sealed class SystemInfoService(IOptions<ApplicationInfoOptions> options)
|
|
|
117
117
|
DateTimeOffset.UtcNow);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
-
`}function
|
|
120
|
+
`}function N(e){return `using Microsoft.Extensions.DependencyInjection;
|
|
121
121
|
|
|
122
122
|
namespace ${e.root_namespace}.Infrastructure;
|
|
123
123
|
|
|
@@ -128,7 +128,7 @@ public static class InfrastructureServiceRegistration
|
|
|
128
128
|
return services;
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
`}function
|
|
131
|
+
`}function h(e){return `using Microsoft.AspNetCore.Diagnostics;
|
|
132
132
|
using Microsoft.AspNetCore.Http;
|
|
133
133
|
using Microsoft.Extensions.DependencyInjection;
|
|
134
134
|
|
|
@@ -162,7 +162,7 @@ internal sealed class GlobalExceptionHandler : IExceptionHandler
|
|
|
162
162
|
return true;
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
`}function
|
|
165
|
+
`}function V(e){return `using ${e.root_namespace}.Application;
|
|
166
166
|
|
|
167
167
|
namespace ${e.root_namespace}.Presentation;
|
|
168
168
|
|
|
@@ -180,7 +180,7 @@ public static class SystemEndpoints
|
|
|
180
180
|
return app;
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
-
`}function g(e){return JSON.stringify({Workspai:{Name:e.project_name,Version:e.app_version,Description:e.description},Logging:{LogLevel:{Default:"Information","Microsoft.AspNetCore":"Warning"}},AllowedHosts:"*",Kestrel:{Endpoints:{Http:{Url:`http://0.0.0.0:${e.port}`}}}},null,2)}function
|
|
183
|
+
`}function g(e){return JSON.stringify({Workspai:{Name:e.project_name,Version:e.app_version,Description:e.description},Logging:{LogLevel:{Default:"Information","Microsoft.AspNetCore":"Warning"}},AllowedHosts:"*",Kestrel:{Endpoints:{Http:{Url:`http://0.0.0.0:${e.port}`}}}},null,2)}function U(e){return `FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
|
184
184
|
WORKDIR /src
|
|
185
185
|
COPY src/*.csproj ./src/
|
|
186
186
|
COPY tests/*.csproj ./tests/
|
|
@@ -197,7 +197,7 @@ ENV ASPNETCORE_URLS=http://+:${e.port}
|
|
|
197
197
|
COPY --from=build /app/publish .
|
|
198
198
|
HEALTHCHECK --interval=30s --timeout=5s --retries=3 CMD curl -fsS http://localhost:${e.port}/health/live || exit 1
|
|
199
199
|
ENTRYPOINT ["dotnet", "${e.root_namespace}.dll"]
|
|
200
|
-
`}function
|
|
200
|
+
`}function O(e){return `services:
|
|
201
201
|
api:
|
|
202
202
|
build: .
|
|
203
203
|
ports:
|
|
@@ -210,7 +210,7 @@ ENTRYPOINT ["dotnet", "${e.root_namespace}.dll"]
|
|
|
210
210
|
interval: 30s
|
|
211
211
|
timeout: 5s
|
|
212
212
|
retries: 3
|
|
213
|
-
`}function
|
|
213
|
+
`}function W(e){return `.PHONY: init dev start build test lint format docker-up docker-down
|
|
214
214
|
|
|
215
215
|
init:
|
|
216
216
|
dotnet restore src/${e.project_name}.csproj
|
|
@@ -241,7 +241,7 @@ docker-up:
|
|
|
241
241
|
|
|
242
242
|
docker-down:
|
|
243
243
|
docker compose down
|
|
244
|
-
`}function
|
|
244
|
+
`}function M(e){return `#!/usr/bin/env sh
|
|
245
245
|
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
246
246
|
CMD="\${1:-help}"
|
|
247
247
|
shift 2>/dev/null || true
|
|
@@ -270,7 +270,7 @@ case "$CMD" in
|
|
|
270
270
|
;;
|
|
271
271
|
*) echo "rapidkit: unknown command: $CMD" >&2; exit 1 ;;
|
|
272
272
|
esac
|
|
273
|
-
`}function
|
|
273
|
+
`}function G(e){return `@echo off
|
|
274
274
|
set CMD=%1
|
|
275
275
|
if "%CMD%"=="" set CMD=help
|
|
276
276
|
shift
|
|
@@ -300,7 +300,7 @@ if "%CMD%"=="format" (
|
|
|
300
300
|
|
|
301
301
|
echo Available: init, dev, start, build, test, lint, format
|
|
302
302
|
exit /b 1
|
|
303
|
-
`}function
|
|
303
|
+
`}function F(e){return `name: CI
|
|
304
304
|
|
|
305
305
|
on:
|
|
306
306
|
push:
|
|
@@ -327,10 +327,10 @@ jobs:
|
|
|
327
327
|
dotnet format src/${e.project_name}.csproj --verify-no-changes
|
|
328
328
|
dotnet format tests/${e.project_name}.Tests.csproj --verify-no-changes
|
|
329
329
|
- name: Build
|
|
330
|
-
run: dotnet build
|
|
330
|
+
run: dotnet build tests/${e.project_name}.Tests.csproj -c Release --no-restore
|
|
331
331
|
- name: Test
|
|
332
332
|
run: dotnet test tests/${e.project_name}.Tests.csproj -c Release --no-build --collect:"XPlat Code Coverage"
|
|
333
|
-
`}function
|
|
333
|
+
`}function L(e){return `using System.Net;
|
|
334
334
|
using Microsoft.AspNetCore.Mvc.Testing;
|
|
335
335
|
using Xunit;
|
|
336
336
|
|
|
@@ -361,7 +361,7 @@ public sealed class RuntimeSmokeTests : IClassFixture<WebApplicationFactory<Prog
|
|
|
361
361
|
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
|
-
`}function
|
|
364
|
+
`}function H(e){return `
|
|
365
365
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
366
366
|
# Visual Studio Version 17
|
|
367
367
|
VisualStudioVersion = 17.0.31903.59
|
|
@@ -417,9 +417,9 @@ Global
|
|
|
417
417
|
{22222222-2222-2222-2222-222222222222} = {44444444-4444-4444-4444-444444444444}
|
|
418
418
|
EndGlobalSection
|
|
419
419
|
EndGlobal
|
|
420
|
-
`.trimStart()}async function
|
|
420
|
+
`.trimStart()}async function q(e,r){if(!r)try{if(await b$2(e)){console.log(i.gray("\u26A0 git init skipped (target is inside an existing git worktree)"));return}await execa("git",["init"],{cwd:e,stdio:"ignore",env:a()});}catch{console.log(i.gray("\u26A0 git init skipped (git not found or error)"));}}async function B(e){try{await execa("dotnet",["--version"],{cwd:e,timeout:3e3,stdio:"pipe"});}catch{console.log(i.yellow("\u26A0 .NET SDK not found in PATH - project scaffolded, but init/build need .NET 8+")),console.log(i.gray(" Install: https://dotnet.microsoft.com/download"));}}async function oe(e,r){let s=y(r.project_name)||"dotnet-api",c$2=E(r.root_namespace||`Workspai.${b$1(s)}`,"Workspai.App"),a=r.target_framework?.trim(),C=a&&D(a)?a:b,R=r.port&&/^\d+$/.test(r.port)?r.port:j,o={project_name:s,root_namespace:c$2,description:_(r.description||"","Production-ready ASP.NET Core Web API scaffolded by Workspai."),target_framework:C,app_version:r.app_version||"0.1.0",port:R,skipGit:r.skipGit??false},A=S(`Creating ASP.NET Core Web API project ${s}`).start();await promises.mkdir(e,{recursive:true}),await c(n.join(e,`${s}.sln`),H(o)),await c(n.join(e,"src",`${s}.csproj`),P(o)),await c(n.join(e,"src","Program.cs"),T(o)),await c(n.join(e,"src","Application","ApplicationInfoOptions.cs"),w(o)),await c(n.join(e,"src","Application","ApplicationServiceRegistration.cs"),x(o)),await c(n.join(e,"src","Application","SystemInfoService.cs"),v(o)),await c(n.join(e,"src","Infrastructure","InfrastructureServiceRegistration.cs"),N(o)),await c(n.join(e,"src","Presentation","PresentationServiceRegistration.cs"),h(o)),await c(n.join(e,"src","Presentation","SystemEndpoints.cs"),V(o)),await c(n.join(e,"src","appsettings.json"),g(o)),await c(n.join(e,"src","appsettings.Development.json"),g(o)),await c(n.join(e,"tests",`${s}.Tests.csproj`),k(o)),await c(n.join(e,"tests","RuntimeSmokeTests.cs"),L(o)),await c(n.join(e,"Dockerfile"),U(o)),await c(n.join(e,"docker-compose.yml"),O(o)),await c(n.join(e,"Makefile"),W(o)),await c(n.join(e,"rapidkit"),M(o)),await c(n.join(e,"rapidkit.cmd"),G(o)),await c(n.join(e,".env.example"),`ASPNETCORE_ENVIRONMENT=Development
|
|
421
421
|
PORT=${o.port}
|
|
422
|
-
`),await c(n.join(e,".github","workflows","ci.yml"),
|
|
422
|
+
`),await c(n.join(e,".github","workflows","ci.yml"),F(o)),await c(n.join(e,".workspai","context.json"),$()),await c(n.join(e,".workspai","project.json"),I(o,c$1())),process.platform!=="win32"&&await promises.chmod(n.join(e,"rapidkit"),493),await q(e,o.skipGit),A.succeed("ASP.NET Core Web API project ready"),await B(e),console.log(i.green(`
|
|
423
423
|
\u2705 ASP.NET Core project ready!
|
|
424
424
|
`)),console.log(i.gray("Next steps:")),console.log(i.white(` cd ${s}`)),console.log(i.white(" npx workspai init")),console.log(i.white(" npx workspai dev")),console.log(i.gray(`
|
|
425
|
-
Endpoints: /health/live, /health/ready, /api/v1/system/info, /docs`)),console.log(i.gray("\u2139 RapidKit Core modules are not available for .NET projects yet."));}export{
|
|
425
|
+
Endpoints: /health/live, /health/ready, /api/v1/system/info, /docs`)),console.log(i.gray("\u2139 RapidKit Core modules are not available for .NET projects yet."));}export{j as DEFAULT_DOTNET_PORT,b as DEFAULT_DOTNET_TARGET_FRAMEWORK,oe as generateDotnetWebApiCleanKit};
|