workspai 0.43.0 → 0.43.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/README.md +3 -3
  2. package/contracts/extension-cli-compatibility.v1.json +1 -1
  3. package/dist/{artifact-remediation-plan-5GJWPPRS.js → artifact-remediation-plan-244S5K6I.js} +3 -3
  4. package/dist/autopilot-release-45YVOBQO.js +1 -0
  5. package/dist/chunk-3QVTWKUI.js +4 -0
  6. package/dist/{chunk-T6OR6YOI.js → chunk-7UZVOYF5.js} +1 -1
  7. package/dist/{chunk-CVTCPPEF.js → chunk-AMDKXXLP.js} +1 -1
  8. package/dist/{chunk-EWYYLJQY.js → chunk-CDE4Q77U.js} +1 -1
  9. package/dist/{chunk-AFSZHLQT.js → chunk-DOCPUNWS.js} +1 -1
  10. package/dist/{chunk-OJEWQO3Z.js → chunk-EMTQ6OKI.js} +17 -17
  11. package/dist/{chunk-RE773WOX.js → chunk-FDDDQMJ2.js} +5 -5
  12. package/dist/{chunk-5SWNSJGW.js → chunk-FHSMY75W.js} +1 -1
  13. package/dist/chunk-FM7GMFZA.js +2 -0
  14. package/dist/{chunk-54XJNLYC.js → chunk-HV5ZFXAZ.js} +1 -1
  15. package/dist/{chunk-LO4C4VXR.js → chunk-LRW2SAGL.js} +1 -1
  16. package/dist/{chunk-PI5KUXDA.js → chunk-LTWYYP6E.js} +1 -1
  17. package/dist/{chunk-VRDF2J46.js → chunk-ONU457VN.js} +17 -17
  18. package/dist/{chunk-LUP4U6EE.js → chunk-P424XYHP.js} +1 -1
  19. package/dist/{chunk-LPZFK3Y6.js → chunk-PPHTYJ7G.js} +61 -61
  20. package/dist/{chunk-XEJD4KCV.js → chunk-TH5Y3EMA.js} +1 -1
  21. package/dist/chunk-TQEMLBAG.js +1 -0
  22. package/dist/{chunk-3KXW53QI.js → chunk-U6AXYUQY.js} +1 -1
  23. package/dist/{chunk-AAKUNWPR.js → chunk-UQKCCWUL.js} +43 -43
  24. package/dist/{chunk-VZKSNUEE.js → chunk-XNGANEXM.js} +1 -1
  25. package/dist/{create-WRZO4HK2.js → create-42RTNLH2.js} +1 -1
  26. package/dist/demo-kit-DZ7TPG7K.js +149 -0
  27. package/dist/doctor-DK4BON3N.js +1 -0
  28. package/dist/{dotnet-webapi-clean-IPY3MCGQ.js → dotnet-webapi-clean-BYUUHX5Y.js} +20 -20
  29. package/dist/{gofiber-standard-N5N3QGH3.js → gofiber-standard-B6UK5GR7.js} +31 -31
  30. package/dist/{gogin-standard-LAWQTBWL.js → gogin-standard-BXU44VEM.js} +31 -31
  31. package/dist/index.js +222 -185
  32. package/dist/pipeline-HQ57V6OZ.js +5 -0
  33. package/dist/{pythonRapidkitExec-3L3XJBSY.js → pythonRapidkitExec-GCQ3M46E.js} +1 -1
  34. package/dist/{springboot-standard-OZYF7ZM7.js → springboot-standard-PEHDKH2L.js} +27 -27
  35. package/dist/{workspace-PR6VZRBG.js → workspace-DZHWB7BV.js} +1 -1
  36. package/dist/{workspace-agent-sync-KTYF3HQR.js → workspace-agent-sync-5ADIQS7B.js} +1 -1
  37. package/dist/{workspace-context-QUTOP2XV.js → workspace-context-GEXDHA7A.js} +1 -1
  38. package/dist/{workspace-contract-XUGMCUSQ.js → workspace-contract-2TA27LGT.js} +1 -1
  39. package/dist/workspace-explain-D5NNL3NG.js +1 -0
  40. package/dist/{workspace-foundation-KGSV4E6D.js → workspace-foundation-FQWHPQGX.js} +1 -1
  41. package/dist/{workspace-intelligence-QJGVL37U.js → workspace-intelligence-BEM6WGCZ.js} +1 -1
  42. package/dist/{workspace-mcp-serve-AK4MYEHQ.js → workspace-mcp-serve-OMBA5V3C.js} +1 -1
  43. package/dist/{workspace-model-PNXXOGPO.js → workspace-model-F3B75TYT.js} +1 -1
  44. package/dist/workspace-registry-summary-6MFBRWDS.js +1 -0
  45. package/dist/workspace-run-3WJXIQKR.js +1 -0
  46. package/dist/{workspace-verify-WSDUUTR5.js → workspace-verify-OAATQV5T.js} +1 -1
  47. package/dist/{workspace-watch-AGPOJ74Q.js → workspace-watch-HU2OTQ52.js} +1 -1
  48. package/package.json +12 -2
  49. package/templates/kits/fastapi-ddd/.gitignore.j2 +11 -0
  50. package/templates/kits/fastapi-ddd/README.md.j2 +23 -18
  51. package/templates/kits/fastapi-ddd/common/env.example.j2 +2 -2
  52. package/templates/kits/fastapi-ddd/pyproject.toml.j2 +7 -7
  53. package/templates/kits/fastapi-ddd/src/app/config/__init__.py.j2 +1 -1
  54. package/templates/kits/fastapi-ddd/src/cli.py.j2 +6 -9
  55. package/templates/kits/fastapi-ddd/src/main.py.j2 +1 -1
  56. package/templates/kits/fastapi-standard/.gitignore.j2 +11 -0
  57. package/templates/kits/fastapi-standard/README.md.j2 +35 -30
  58. package/templates/kits/fastapi-standard/common/env.example.j2 +2 -2
  59. package/templates/kits/fastapi-standard/pyproject.toml.j2 +7 -7
  60. package/templates/kits/fastapi-standard/src/cli.py.j2 +7 -10
  61. package/templates/kits/fastapi-standard/src/main.py.j2 +1 -1
  62. package/templates/kits/fastapi-standard/src/routing/examples.py.j2 +1 -1
  63. package/templates/kits/fastapi-standard/tests/test_examples.py.j2 +1 -1
  64. package/templates/kits/nestjs-standard/.dockerignore.j2 +11 -0
  65. package/templates/kits/nestjs-standard/.eslintrc.js.j2 +25 -0
  66. package/templates/kits/nestjs-standard/.gitignore.j2 +22 -0
  67. package/templates/kits/nestjs-standard/.node-version.j2 +1 -0
  68. package/templates/kits/nestjs-standard/.nvmrc.j2 +1 -0
  69. package/templates/kits/nestjs-standard/.prettierrc.j2 +7 -0
  70. package/templates/kits/nestjs-standard/README.md.j2 +23 -18
  71. package/templates/kits/nestjs-standard/docs/README.md.j2 +2 -2
  72. package/templates/kits/nestjs-standard/jest.config.ts.j2 +1 -7
  73. package/templates/kits/nestjs-standard/package.json.j2 +1 -1
  74. package/templates/kits/nestjs-standard/src/config/configuration.ts.j2 +4 -4
  75. package/templates/kits/nestjs-standard/src/main.ts.j2 +1 -1
  76. package/templates/kits/nestjs-standard/src/modules/index.ts.j2 +1 -1
  77. package/templates/kits/nestjs-standard/tsconfig.build.json.j2 +1 -1
  78. package/templates/kits/nestjs-standard/tsconfig.json.j2 +1 -1
  79. package/dist/autopilot-release-QYUOVB26.js +0 -1
  80. package/dist/chunk-LYC6AIF2.js +0 -2
  81. package/dist/chunk-WU4ZRRA5.js +0 -4
  82. package/dist/demo-kit-AJ5LIM5G.js +0 -149
  83. package/dist/doctor-MF3M3FS3.js +0 -1
  84. package/dist/pipeline-QCUHFWDY.js +0 -5
  85. package/dist/workspace-explain-JEONEGZZ.js +0 -1
  86. package/dist/workspace-registry-summary-RUJE6RPH.js +0 -1
  87. package/dist/workspace-run-Y7YMUIHX.js +0 -1
@@ -1,2 +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))}
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-6MFBRWDS.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-6MFBRWDS.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
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};
@@ -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-LPZFK3Y6.js';
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-PPHTYJ7G.js';
@@ -0,0 +1,149 @@
1
+ import {c}from'./chunk-Y45WZR5N.js';import {b,a as a$1}from'./chunk-TQEMLBAG.js';import {promises}from'fs';import a from'path';import T from'nunjucks';import e from'chalk';import h from'ora';import {fileURLToPath}from'url';import {execa}from'execa';import G from'crypto';var J=fileURLToPath(import.meta.url),M=a.dirname(J);function O(t=32){let i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",x=G.randomBytes(t),o="";for(let p=0;p<t;p++)o+=i[x[p]%i.length];return o}async function te(t,i){let o=(i.template||"fastapi")==="fastapi",p=o?"FastAPI":"NestJS",d=i.kit_name||(o?"fastapi.standard":"nestjs.standard"),D=d.replace(".","/"),$=h(`Generating ${p} project...`).start();try{let w=a.resolve(M,".."),m;d==="fastapi.ddd"?m="fastapi-ddd":d.startsWith("fastapi")?m="fastapi-standard":m="nestjs-standard";let f=a.join(w,"templates","kits",m),S=T.configure(f,{autoescape:false,trimBlocks:true,lstripBlocks:true});S.addFilter("generate_secret",function(n,r=32){return O(r)});let F={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(f,n);try{await promises.access(r);}catch{continue}let _=await promises.readFile(r,"utf-8"),g;try{g=S.renderString(_,F);}catch(W){throw console.error(`Failed to render template: ${n}`),W}let c=n==="env.example.j2"?".env.example":n.replace(/\.j2$/,""),v=a.join(t,c);await promises.mkdir(a.dirname(v),{recursive:true}),await promises.writeFile(v,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(v,493);}if(o){let n=a.join(f,".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 I=a.join(t,".workspai");await promises.mkdir(I,{recursive:true});let R=a.join(I,"project.json"),C={kit_name:d,profile:D,created_at:new Date().toISOString(),created_by:"workspai-cli-fallback",workspai_version:c(),rapidkit_version:c(),runtime:o?"python":"node"},P=JSON.stringify(C,null,2);await promises.writeFile(R,P,"utf-8");let j=a.join(t,"rapidkit");await promises.access(j).then(()=>true).catch(()=>false)||(await promises.writeFile(j,`#!/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(j,493));let b$1=a.join(t,"rapidkit.cmd");await promises.access(b$1).then(()=>true).catch(()=>false)||await promises.writeFile(b$1,`@echo off
7
+ set RAPIDKIT_LOCAL_LAUNCHER_BYPASS=1
8
+ npx workspai %*
9
+ `);let L=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"),L),$.succeed(`${p} project generated!`),!i.skipGit){let n=h("Initializing git repository...").start();try{await b(t)?n.warn("Git initialization skipped because target is already inside a git worktree"):(await execa("git",["init"],{cwd:t,env:a$1()}),await execa("git",["add","."],{cwd:t,env:a$1()}),await execa("git",["commit","-m",`Initial commit: ${p} project via Workspai`],{cwd:t,env:a$1()}),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 A=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 ${A}`)}
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 ${A}`)}
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(w){throw $.fail(`Failed to generate ${p} project`),w}}export{te as generateDemoKit};
@@ -0,0 +1 @@
1
+ export{c as computeDoctorFixAwareExitCode,b as computeDoctorGateExitCode,a as resolveDoctorPolicyProfile,d as runDoctor}from'./chunk-UQKCCWUL.js';
@@ -1,4 +1,4 @@
1
- import {b,c}from'./chunk-IBJEQHJR.js';import {c as c$1}from'./chunk-Y45WZR5N.js';import {promises}from'fs';import n from'path';import i from'chalk';import b$1 from'ora';import {execa}from'execa';var C="net8.0",R="8080";function A(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-")}function j(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 S(e,r){return e.replace(/[\r\n\t]+/g," ").trim()||r}function y(e){return /^net\d+\.\d+$/.test(e.trim())}function _(){return JSON.stringify({engine:"npm",runtime:"dotnet"},null,2)}function E(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 D(e){return `<Project Sdk="Microsoft.NET.Sdk.Web">
1
+ import {b,c}from'./chunk-IBJEQHJR.js';import {c as c$1}from'./chunk-Y45WZR5N.js';import {b as b$1,a}from'./chunk-TQEMLBAG.js';import {promises}from'fs';import n from'path';import i from'chalk';import R from'ora';import {execa}from'execa';var A="net8.0",S="8080";function j(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-")}function y(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 E(e){return /^net\d+\.\d+$/.test(e.trim())}function D(){return JSON.stringify({engine:"npm",runtime:"dotnet"},null,2)}function $(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 I(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 $(e){return `<Project Sdk="Microsoft.NET.Sdk">
19
+ `}function P(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 I(e){return `using ${e.root_namespace}.Application;
39
+ `}function k(e){return `using ${e.root_namespace}.Application;
40
40
  using ${e.root_namespace}.Infrastructure;
41
41
  using ${e.root_namespace}.Presentation;
42
42
 
@@ -69,7 +69,7 @@ app.Run();
69
69
  public partial class Program
70
70
  {
71
71
  }
72
- `}function P(e){return `namespace ${e.root_namespace}.Application;
72
+ `}function w(e){return `namespace ${e.root_namespace}.Application;
73
73
 
74
74
  public sealed class ApplicationInfoOptions
75
75
  {
@@ -81,7 +81,7 @@ public sealed class ApplicationInfoOptions
81
81
 
82
82
  public string Description { get; init; } = "${e.description}";
83
83
  }
84
- `}function k(e){return `using Microsoft.Extensions.DependencyInjection;
84
+ `}function T(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 T(e){return `using Microsoft.Extensions.Options;
96
+ `}function x(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 w(e){return `using Microsoft.Extensions.DependencyInjection;
120
+ `}function v(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 x(e){return `using Microsoft.AspNetCore.Diagnostics;
131
+ `}function N(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 v(e){return `using ${e.root_namespace}.Application;
165
+ `}function h(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 d(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 N(e){return `FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
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 V(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 h(e){return `services:
200
+ `}function U(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 V(e){return `.PHONY: init dev start build test lint format docker-up docker-down
213
+ `}function O(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 U(e){return `#!/usr/bin/env sh
244
+ `}function W(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 O(e){return `@echo off
273
+ `}function M(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 W(e){return `name: CI
303
+ `}function G(e){return `name: CI
304
304
 
305
305
  on:
306
306
  push:
@@ -330,7 +330,7 @@ jobs:
330
330
  run: dotnet build src/${e.project_name}.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 M(e){return `using System.Net;
333
+ `}function F(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 G(e){return `
364
+ `}function L(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 F(e,r){if(!r)try{await execa("git",["init"],{cwd:e,stdio:"ignore"});}catch{console.log(i.gray("\u26A0 git init skipped (git not found or error)"));}}async function L(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 Q(e,r){let s=A(r.project_name)||"dotnet-api",c$2=j(r.root_namespace||`Workspai.${b(s)}`,"Workspai.App"),a=r.target_framework&&y(r.target_framework)?r.target_framework:C,g=r.port&&/^\d+$/.test(r.port)?r.port:R,o={project_name:s,root_namespace:c$2,description:S(r.description||"","Production-ready ASP.NET Core Web API scaffolded by Workspai."),target_framework:a,app_version:r.app_version||"0.1.0",port:g,skipGit:r.skipGit??false},f=b$1(`Creating ASP.NET Core Web API project ${s}`).start();await promises.mkdir(e,{recursive:true}),await c(n.join(e,`${s}.sln`),G(o)),await c(n.join(e,"src",`${s}.csproj`),D(o)),await c(n.join(e,"src","Program.cs"),I(o)),await c(n.join(e,"src","Application","ApplicationInfoOptions.cs"),P(o)),await c(n.join(e,"src","Application","ApplicationServiceRegistration.cs"),k(o)),await c(n.join(e,"src","Application","SystemInfoService.cs"),T(o)),await c(n.join(e,"src","Infrastructure","InfrastructureServiceRegistration.cs"),w(o)),await c(n.join(e,"src","Presentation","PresentationServiceRegistration.cs"),x(o)),await c(n.join(e,"src","Presentation","SystemEndpoints.cs"),v(o)),await c(n.join(e,"src","appsettings.json"),d(o)),await c(n.join(e,"src","appsettings.Development.json"),d(o)),await c(n.join(e,"tests",`${s}.Tests.csproj`),$(o)),await c(n.join(e,"tests","RuntimeSmokeTests.cs"),M(o)),await c(n.join(e,"Dockerfile"),N(o)),await c(n.join(e,"docker-compose.yml"),h(o)),await c(n.join(e,"Makefile"),V(o)),await c(n.join(e,"rapidkit"),U(o)),await c(n.join(e,"rapidkit.cmd"),O(o)),await c(n.join(e,".env.example"),`ASPNETCORE_ENVIRONMENT=Development
420
+ `.trimStart()}async function H(e,r){if(!r)try{if(await b$1(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 ne(e,r){let s=j(r.project_name)||"dotnet-api",c$2=y(r.root_namespace||`Workspai.${b(s)}`,"Workspai.App"),a=r.target_framework&&E(r.target_framework)?r.target_framework:A,b$1=r.port&&/^\d+$/.test(r.port)?r.port:S,o={project_name:s,root_namespace:c$2,description:_(r.description||"","Production-ready ASP.NET Core Web API scaffolded by Workspai."),target_framework:a,app_version:r.app_version||"0.1.0",port:b$1,skipGit:r.skipGit??false},C=R(`Creating ASP.NET Core Web API project ${s}`).start();await promises.mkdir(e,{recursive:true}),await c(n.join(e,`${s}.sln`),L(o)),await c(n.join(e,"src",`${s}.csproj`),I(o)),await c(n.join(e,"src","Program.cs"),k(o)),await c(n.join(e,"src","Application","ApplicationInfoOptions.cs"),w(o)),await c(n.join(e,"src","Application","ApplicationServiceRegistration.cs"),T(o)),await c(n.join(e,"src","Application","SystemInfoService.cs"),x(o)),await c(n.join(e,"src","Infrastructure","InfrastructureServiceRegistration.cs"),v(o)),await c(n.join(e,"src","Presentation","PresentationServiceRegistration.cs"),N(o)),await c(n.join(e,"src","Presentation","SystemEndpoints.cs"),h(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`),P(o)),await c(n.join(e,"tests","RuntimeSmokeTests.cs"),F(o)),await c(n.join(e,"Dockerfile"),V(o)),await c(n.join(e,"docker-compose.yml"),U(o)),await c(n.join(e,"Makefile"),O(o)),await c(n.join(e,"rapidkit"),W(o)),await c(n.join(e,"rapidkit.cmd"),M(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"),W(o)),await c(n.join(e,".workspai","context.json"),_()),await c(n.join(e,".workspai","project.json"),E(o,c$1())),process.platform!=="win32"&&await promises.chmod(n.join(e,"rapidkit"),493),await F(e,o.skipGit),f.succeed("ASP.NET Core Web API project ready"),await L(e),console.log(i.green(`
422
+ `),await c(n.join(e,".github","workflows","ci.yml"),G(o)),await c(n.join(e,".workspai","context.json"),D()),await c(n.join(e,".workspai","project.json"),$(o,c$1())),process.platform!=="win32"&&await promises.chmod(n.join(e,"rapidkit"),493),await H(e,o.skipGit),C.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{R as DEFAULT_DOTNET_PORT,C as DEFAULT_DOTNET_TARGET_FRAMEWORK,Q as generateDotnetWebApiCleanKit};
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{S as DEFAULT_DOTNET_PORT,A as DEFAULT_DOTNET_TARGET_FRAMEWORK,ne as generateDotnetWebApiCleanKit};