rapidkit 0.41.4 → 0.42.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/contracts/extension-cli-compatibility.v1.json +1 -1
- package/dist/analyze-XSPWKPA4.js +1 -0
- package/dist/autopilot-release-MVFRZMHD.js +1 -0
- package/dist/chunk-2LBPX5K3.js +2 -0
- package/dist/chunk-2ZLIVGO7.js +2 -0
- package/dist/{chunk-56GL3GG7.js → chunk-3HBNF2A3.js} +1 -1
- package/dist/{chunk-UZW5QFRW.js → chunk-4KUIFXHM.js} +3 -3
- package/dist/chunk-4ZSDU5OO.js +4 -0
- package/dist/{chunk-HT3G7HOV.js → chunk-5PFGOXBQ.js} +32 -32
- package/dist/chunk-5QAVZET2.js +1 -0
- package/dist/{chunk-ALCH4JAS.js → chunk-DZU4KPPW.js} +1 -1
- package/dist/chunk-F7GYXSBT.js +916 -0
- package/dist/{chunk-THSTNVE3.js → chunk-FB35IONI.js} +1 -1
- package/dist/chunk-FEA53XL6.js +4 -0
- package/dist/chunk-FSIZLBTL.js +1 -0
- package/dist/{chunk-4RJESJ23.js → chunk-IS2XUPMP.js} +1 -1
- package/dist/chunk-LANBSCGS.js +13 -0
- package/dist/{chunk-FI4VMG2I.js → chunk-M44C2P3R.js} +1 -1
- package/dist/{chunk-DKNVDNT4.js → chunk-MQGVCTUL.js} +1 -1
- package/dist/{chunk-KZLRUBQ5.js → chunk-QKVEWX4L.js} +1 -1
- package/dist/{chunk-L3R2AS2W.js → chunk-QOH5TIRZ.js} +1 -1
- package/dist/{chunk-T5GS4BUP.js → chunk-YM5Q3PV6.js} +1 -1
- package/dist/chunk-YWUWRSNO.js +1 -0
- package/dist/{create-XTKHAYH7.js → create-EAE2AJJL.js} +1 -1
- package/dist/{doctor-4UQZIELO.js → doctor-E6JE4Q3B.js} +1 -1
- package/dist/index.js +162 -161
- package/dist/{pipeline-UOGPOG7S.js → pipeline-TRA4MMZC.js} +1 -1
- package/dist/{workspace-VKUBU4M4.js → workspace-IBTKZX7T.js} +1 -1
- package/dist/{workspace-agent-sync-RWDOTSWV.js → workspace-agent-sync-LEYLJ42D.js} +1 -1
- package/dist/{workspace-context-R3XWWLFP.js → workspace-context-NTG3D4DI.js} +1 -1
- package/dist/workspace-explain-P2EBRNP6.js +1 -0
- package/dist/{workspace-foundation-V6SLZRBY.js → workspace-foundation-6AUEEJQQ.js} +1 -1
- package/dist/{workspace-intelligence-5BBKUJAG.js → workspace-intelligence-C6NT557E.js} +1 -1
- package/dist/{workspace-marker-HAC7BMEG.js → workspace-marker-5GAJSOFP.js} +1 -1
- package/dist/{workspace-mcp-serve-GPSSYKZK.js → workspace-mcp-serve-GM7A3IVM.js} +1 -1
- package/dist/{workspace-model-YAC5BKLL.js → workspace-model-AOTSEAVW.js} +1 -1
- package/dist/workspace-python-engine-state-AEEZ7QYB.js +2 -0
- package/dist/workspace-run-ATFFJCMK.js +1 -0
- package/dist/{workspace-verify-YDPCHWGQ.js → workspace-verify-7R3XBNKE.js} +1 -1
- package/dist/{workspace-watch-P2PGSYDD.js → workspace-watch-SGY2DEZ5.js} +1 -1
- package/docs/commands-reference.md +30 -3
- package/package.json +2 -2
- package/dist/analyze-UTB3PNKM.js +0 -1
- package/dist/autopilot-release-MSK4ELKR.js +0 -1
- package/dist/chunk-42ARJBM7.js +0 -883
- package/dist/chunk-7BEZH5LE.js +0 -2
- package/dist/chunk-AM5OJWXF.js +0 -4
- package/dist/chunk-E5ZVQL3C.js +0 -13
- package/dist/chunk-JU3VNLTY.js +0 -1
- package/dist/chunk-LRF6PQOZ.js +0 -1
- package/dist/chunk-WHQWVQJH.js +0 -4
- package/dist/chunk-YBS2HGO3.js +0 -2
- package/dist/workspace-explain-JIAM63TE.js +0 -1
- package/dist/workspace-run-MNVPNDUK.js +0 -1
package/dist/chunk-7BEZH5LE.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import r from'fs-extra';import o from'path';async function i(a){let t=o.join(a,".rapidkit-workspace");try{if(await r.pathExists(t))return await r.readJson(t)}catch{return null}return null}async function s(a,t){let e=o.join(a,".rapidkit-workspace"),n=await i(a);n?.metadata&&(t.metadata={...n.metadata,...t.metadata}),await r.outputFile(e,JSON.stringify(t,null,2)+`
|
|
2
|
-
`,"utf-8");}async function m(a,t){let e=await i(a);return e?(e.metadata={...e.metadata,...t,vscode:t.vscode?{...e.metadata?.vscode,...t.vscode}:e.metadata?.vscode,npm:t.npm?{...e.metadata?.npm,...t.npm}:e.metadata?.npm,python:t.python?{...e.metadata?.python,...t.python}:e.metadata?.python},await s(a,e),true):false}function u(a,t,e){return {signature:"RAPIDKIT_WORKSPACE",createdBy:"rapidkit-npm",version:t,createdAt:new Date().toISOString(),name:a,metadata:{npm:{packageVersion:t,installMethod:e,lastUsedAt:new Date().toISOString()}}}}function g(a){if(!a||typeof a!="object")return false;let t=a;return t.signature==="RAPIDKIT_WORKSPACE"&&typeof t.createdBy=="string"&&typeof t.version=="string"&&typeof t.createdAt=="string"&&typeof t.name=="string"}export{i as a,s as b,m as c,u as d,g as e};
|
package/dist/chunk-AM5OJWXF.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import {a,b}from'./chunk-KMUWWZRT.js';import {f,e}from'./chunk-PCXSTKZ5.js';import {c as c$1}from'./chunk-NFUXULIF.js';import {a as a$1,b as b$1,d as d$1,c,f as f$1}from'./chunk-YBS2HGO3.js';import u from'chalk';import d from'fs';import h from'fs-extra';import l from'path';var $="release-readiness-v1";function I(t,e){let a=l.resolve(t);if(!b(a))return a;let s=l.join(e,".rapidkit","workspace.contract.json");if(d.existsSync(s))try{let i=JSON.parse(d.readFileSync(s,"utf-8")),n=Array.isArray(i.projects)?i.projects:[];for(let c of n){let f=p(c),g=typeof f.relativePath=="string"?f.relativePath.trim():"";if(g)return l.join(e,g)}}catch{}let r=x(e),o=Array.isArray(r.payload?.projects)?r.payload.projects:[];for(let i of o){let n=p(i),c=typeof n.path=="string"?n.path.trim():"";if(c)return l.resolve(c)}return a}function V(t){let e=a$1(t);return b$1(e,t)?"go":d$1(e,t)?"java":c(e,t)?"node":f$1(e,t)?"python":"unknown"}function O(t,e){if(!d.existsSync(t))return null;let a=d.readdirSync(t).filter(s=>s.endsWith(".json")&&e.some(r=>r.test(s))).map(s=>l.join(t,s));return a.length===0?null:(a.sort((s,r)=>d.statSync(r).mtimeMs-d.statSync(s).mtimeMs),a[0])}function p(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}async function z(t){let{readWorkspaceRegistrySummary:e,resolveWorkspaceRegisteredProjects:a}=await import('./workspace-registry-summary-X5WRUU3T.js'),s=await e(t);return s?s.projectCount:(await a(t)).summary.projectCount}function L(t,e,a){let s=l.join(t,".rapidkit","toolchain.lock");if(!d.existsSync(s))return {gate:"env",status:"fail",summary:"toolchain.lock is missing",details:["Run rapidkit bootstrap to pin runtime versions and generate a reproducible toolchain."],evidencePath:s};try{let r=JSON.parse(d.readFileSync(s,"utf-8")),o=p(r.runtime),n=["python","node","go","java"].filter(c=>{let f=p(o[c]);return typeof f.version=="string"&&f.version.trim().length>0});if(n.length===0)return {gate:"env",status:"fail",summary:"No runtime versions are pinned in toolchain.lock",details:["Pin at least one runtime version via rapidkit setup <runtime> and re-run bootstrap."],evidencePath:s};if(e!=="unknown"){let c=p(o[e]);if(typeof c.version!="string"||c.version.trim().length===0)return {gate:"env",status:"fail",summary:`${a?.hasRegisteredProjects?"Project runtime":"Workspace"} (${e}) is not pinned in toolchain.lock`,details:[`Run rapidkit setup ${e} and rapidkit bootstrap to lock ${e} for this workspace.`],evidencePath:s}}return {gate:"env",status:"pass",summary:`Pinned runtimes: ${n.join(", ")}`,details:[],evidencePath:s}}catch{return {gate:"env",status:"fail",summary:"toolchain.lock is invalid JSON",details:["Regenerate lockfile with rapidkit bootstrap."],evidencePath:s}}}function x(t){let e=l.join(t,".rapidkit","reports","doctor-last-run.json");if(!d.existsSync(e))return {payload:null,path:e};try{let a=JSON.parse(d.readFileSync(e,"utf-8"));return c$1(a,"workspace")?{payload:a,path:e}:{payload:null,path:e}}catch{return {payload:null,path:e}}}function D(t){let e=x(t);if(!e.payload)return {gate:{gate:"doctor",status:"fail",summary:"Doctor evidence is missing",details:["Run rapidkit doctor workspace --json before release readiness checks."],evidencePath:e.path},payload:null};let a=p(e.payload.summary),s=Number(a.totalIssues??0);return a.hasSystemErrors?{gate:{gate:"doctor",status:"fail",summary:"Doctor reported system errors",details:["Resolve system-level doctor errors before proceeding."],evidencePath:e.path},payload:e.payload}:s>0?{gate:{gate:"doctor",status:"warn",summary:`Doctor found ${s} issue(s)`,details:["Run rapidkit doctor workspace --fix and re-run readiness checks."],evidencePath:e.path},payload:e.payload}:{gate:{gate:"doctor",status:"pass",summary:"Doctor checks passed without issues",details:[],evidencePath:e.path},payload:e.payload}}function J(t){let e=l.join(t,".rapidkit","reports","analyze-last-run.json");if(!d.existsSync(e))return {gate:"analyze",status:"fail",summary:"Analyze evidence is missing",details:["Run rapidkit analyze --json before release readiness checks."],evidencePath:e};try{let a=JSON.parse(d.readFileSync(e,"utf-8")),s=p(a.summary),r=String(s.verdict??"").toLowerCase(),o=Number(s.score??0),i=p(s.findings),n=Number(i.fail??0);return r==="blocked"||n>0?{gate:"analyze",status:"fail",summary:`Analyze verdict is blocked (score ${o}/100)`,details:["Resolve analyze findings and regenerate analyze-last-run.json."],evidencePath:e}:r==="needs-attention"?{gate:"analyze",status:"warn",summary:`Analyze needs attention (score ${o}/100)`,details:["Review analyze warnings before release."],evidencePath:e}:{gate:"analyze",status:"pass",summary:`Analyze passed (score ${o}/100)`,details:[],evidencePath:e}}catch{return {gate:"analyze",status:"fail",summary:"Analyze evidence is invalid JSON",details:["Re-run rapidkit analyze --json to regenerate evidence."],evidencePath:e}}}function W(t){try{let e=JSON.parse(d.readFileSync(t,"utf-8")),a=String(e.status??"").toLowerCase(),s=p(e.summary),r=Number(s.failedChecks??0);return a==="fail"||r>0?{gate:"verify",status:"fail",summary:"Verify-pack contract reports failed checks",details:["Fix failed verify checks and regenerate verify-pack contract evidence."],evidencePath:t}:a==="pass"?{gate:"verify",status:"pass",summary:"Verify-pack contract passed",details:[],evidencePath:t}:{gate:"verify",status:"warn",summary:"Verify-pack contract status is not explicit",details:["Ensure contract status is pass/fail and keep schema aligned with v1 contract."],evidencePath:t}}catch{return {gate:"verify",status:"fail",summary:"Verify-pack contract is invalid JSON",details:["Regenerate verify-pack contract artifact."],evidencePath:t}}}async function F(t,e){if(e.skipVerify)return {gate:"verify",status:"pass",summary:"Verify gate skipped (--skip-verify)",details:["Verification was explicitly skipped for this readiness run."]};let a=l.join(t,".rapidkit","reports"),s=O(a,[/verify-pack-contract/i,/^verify.*\.json$/i]);if(s)return W(s);let r=l.join(a,"workspace-contract-verify-last-run.json"),o=O(a,[/workspace-contract-verify-last-run/i,/workspace-contract-verify/i]);if(o)try{let i=JSON.parse(d.readFileSync(o,"utf-8")),n=String(i.status??"").toLowerCase();if(n==="passed"||n==="pass")return {gate:"verify",status:"pass",summary:"Workspace contract verification passed (CLI cache)",details:[],evidencePath:o};if(n==="failed"||n==="fail")return {gate:"verify",status:"fail",summary:"Workspace contract verification failed (CLI cache)",details:(Array.isArray(i.violations)?i.violations:[]).slice(0,5),evidencePath:o}}catch{}try{let{verifyWorkspaceContract:i}=await import('./workspace-contract-OO4GMENV.js'),n=await i({workspacePath:t}),c={schemaVersion:"v1",source:"cli",generatedAt:new Date().toISOString(),status:n.status,contractPath:n.contractPath,projectCount:n.projectCount,checks:n.checks,violations:n.violations};return await h.ensureDir(a),await h.writeJSON(r,c,{spaces:2}),n.status==="failed"?{gate:"verify",status:"fail",summary:"Workspace contract verification failed (CLI)",details:n.violations.slice(0,5),evidencePath:r}:{gate:"verify",status:"pass",summary:"Workspace contract verification passed (CLI)",details:[],evidencePath:r}}catch(i){return {gate:"verify",status:"fail",summary:"No verify evidence and workspace contract verification unavailable",details:["Run rapidkit workspace contract verify --json or export verify-pack contract from CI.",i instanceof Error?i.message:String(i)],evidencePath:l.join(a,"*verify*.json")}}}function M(t,e){let a=l.join(e,".rapidkit","reports","doctor-last-run.json");if(!t)return {gate:"dependency",status:"warn",summary:"Dependency risk check skipped (doctor evidence missing)",details:["Run rapidkit doctor workspace --json to include dependency findings."],evidencePath:a};let s=Array.isArray(t.projects)?t.projects:[],r=s.reduce((i,n)=>{let c=Number(n.vulnerabilities??0);return Number.isFinite(c)?i+Math.max(0,c):i},0),o=s.filter(i=>i.depsInstalled===false).length;return r>0?{gate:"dependency",status:"fail",summary:`${r} dependency vulnerability(ies) reported`,details:["Resolve vulnerabilities (npm/pip/go audit pipelines) before release."],evidencePath:a}:o>0?{gate:"dependency",status:"warn",summary:`${o} project(s) report missing dependencies`,details:["Run project init/bootstrap and regenerate doctor evidence."],evidencePath:a}:{gate:"dependency",status:"pass",summary:"No dependency vulnerabilities reported",details:[],evidencePath:a}}function _(t){return t.some(e=>e.status==="fail")?"fail":t.some(e=>e.status==="warn")?"warn":"pass"}async function K(t,e){let a=l.join(t,".rapidkit","reports","release-readiness-last-run.json");return await h.ensureDir(l.dirname(a)),await h.writeJSON(a,e,{spaces:2}),a}async function H(t={}){let e$1=l.resolve(t.startPath??process.cwd()),a$1=a(e$1)??e$1,s=await z(a$1)>0,r=s&&b(e$1)?a$1:I(e$1,a$1),o=r===a$1?"unknown":V(r),n=L(a$1,s?o:"unknown",{hasRegisteredProjects:s}),c=D(a$1),f$1=J(a$1),g=await F(a$1,{skipVerify:t.skipVerify}),G=M(c.payload,a$1),k=[n,c.gate,f$1,g,G],v=_(k),m={schemaVersion:$,generatedAt:new Date().toISOString(),workspacePath:a$1,projectPath:r,action:t.action,overallStatus:v,blocking:v==="fail",blockingReasons:k.filter(y=>y.status==="fail").map(y=>`${y.gate}: ${y.summary}`),gates:k};if(t.writeReport!==false){let y=f(m,{commandId:"workspaceReadiness",exitCode:v==="fail"?2:v==="warn"?1:0,generatedAt:m.generatedAt,blockers:m.blockingReasons,runId:e()});m.evidencePath=await K(a$1,y);}return m}function B(t){return t==="pass"?u.green("PASS"):t==="warn"?u.yellow("WARN"):u.red("FAIL")}function U(t){return t==="pass"?u.green("PASS"):t==="warn"?u.yellow("WARN"):u.red("FAIL")}async function ne(t){let e=await H({writeReport:true,skipVerify:t.skipVerify===true});if(t.json)console.log(JSON.stringify(e,null,2));else {console.log(u.bold.cyan(`
|
|
2
|
-
\u{1F6A6} RapidKit Release Readiness
|
|
3
|
-
`)),console.log(u.bold(`Workspace: ${u.cyan(l.basename(e.workspacePath))}`)),console.log(u.gray(`Path: ${e.workspacePath}`)),console.log(`Overall: ${U(e.overallStatus)}`);for(let a of e.gates){console.log(` - ${a.gate}: ${B(a.status)} ${a.summary}`);for(let s of a.details)console.log(u.gray(` ${s}`));a.evidencePath&&console.log(u.gray(` evidence: ${a.evidencePath}`));}e.evidencePath&&console.log(u.gray(`
|
|
4
|
-
Evidence saved: ${e.evidencePath}`));}t.strict&&e.overallStatus!=="pass"&&process.exit(1);}export{H as a,ne as b};
|
package/dist/chunk-E5ZVQL3C.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import {b as b$1}from'./chunk-Q2KZIBV4.js';import {e,g,c}from'./chunk-WRMCPKGA.js';import L from'validate-npm-package-name';import o from'path';import {spawn}from'child_process';import s from'chalk';import l from'fs-extra';var m=class extends Error{constructor(r,n,a){super(r);this.code=n;this.details=a;this.name="RapidKitError",Error.captureStackTrace(this,this.constructor);}code;details},D=class extends m{constructor(t,r){let n=r?`Python ${t}+ required, found ${r}`:`Python ${t}+ not found`;super(n,"PYTHON_NOT_FOUND","Please install Python from https://www.python.org/downloads/");}},$=class extends m{constructor(){super("Poetry is not installed","POETRY_NOT_FOUND","Install Poetry from https://python-poetry.org/docs/#installation");}},E=class extends m{constructor(){super("pipx is not installed","PIPX_NOT_FOUND","Install pipx from https://pypa.github.io/pipx/installation/");}},G=class extends m{constructor(t){super(`Directory "${t}" already exists`,"DIRECTORY_EXISTS","Please choose a different name or remove the existing directory");}},p=class extends m{constructor(t,r){super(`Invalid project name: "${t}"`,"INVALID_PROJECT_NAME",r);}},S=class extends m{constructor(t,r){let n=`Installation failed at: ${t}`,a=`${r.message}
|
|
2
|
-
|
|
3
|
-
Troubleshooting:
|
|
4
|
-
- Check your internet connection
|
|
5
|
-
- Verify Python/Poetry installation
|
|
6
|
-
- Try running with --debug flag for more details`;super(n,"INSTALLATION_ERROR",a);}},F=class extends m{constructor(){super("RapidKit Python package is not yet available on PyPI","RAPIDKIT_NOT_AVAILABLE",`Available options:
|
|
7
|
-
1. Install Python 3.10+ and retry the same command
|
|
8
|
-
2. Use the core workflow: npx rapidkit create workspace <name>
|
|
9
|
-
3. Offline fallback (limited): npx rapidkit create project fastapi.standard <name> --output .
|
|
10
|
-
|
|
11
|
-
Legacy: set RAPIDKIT_SHOW_LEGACY=1 to reveal template-mode flags in help.`);}};function R(e){let t=L(e);if(!t.validForNewPackages){let n=t.errors||[],a=t.warnings||[],i=[...n,...a];throw new p(e,`NPM validation failed: ${i.join(", ")}`)}if(!/^[a-z][a-z0-9_-]*$/.test(e))throw new p(e,"Must start with a lowercase letter and contain only lowercase letters, numbers, hyphens, and underscores");if(["test","tests","src","dist","build","lib","python","pip","poetry","node","npm","rapidkit","rapidkit"].includes(e.toLowerCase()))throw new p(e,`"${e}" is a reserved name. Please choose a different name.`);if(e.length<2)throw new p(e,"Name must be at least 2 characters long");if(e.length>214)throw new p(e,"Name must be less than 214 characters");return true}function pe(e){let t=U(e.workspacePath,e.result.projectPath)?"imported":"adopted";return {name:e.result.projectName,path:e.result.projectPath,relativePath:V(e.workspacePath,e.result.projectPath),relationship:t,stack:e.result.definition.framework,runtime:"node",framework:e.result.definition.framework,frameworkDisplayName:e.result.definition.displayName,supportTier:"extended",moduleSupport:false,confidence:"high",source:t==="adopted"?"adopted-local":"local-folder",importedAt:e.importedAt??new Date().toISOString()}}function U(e,t){let r=o.relative(o.resolve(e),o.resolve(t));return r===""||r.length>0&&!r.startsWith("..")&&!o.isAbsolute(r)}function V(e,t){return (o.relative(e,t)||".").split(o.sep).join("/")}var K=[{id:"nextjs",kitId:"frontend.nextjs",aliases:["frontend.nextjs","next","nextjs","next.js"],displayName:"Next.js",framework:"nextjs",defaultPort:3e3,commandDisplay:e=>`npx create-next-app@latest ${e}`,commandExec:(e,t)=>({command:"npx",args:["--yes","create-next-app@latest",e,"--yes",...t.skipGit?["--disable-git"]:[],...t.skipInstall?["--skip-install"]:[]]})},{id:"remix",kitId:"frontend.remix",aliases:["frontend.remix","remix","remix-run","react-router"],displayName:"React Router",framework:"remix",defaultPort:5173,commandDisplay:e=>`npx create-react-router@latest ${e}`,commandExec:(e,t)=>({command:"npx",args:["--yes","create-react-router@latest",e,"--yes",...t.skipInstall?["--no-install"]:["--install"],"--no-git-init"]})},{id:"vite-react",kitId:"frontend.vite-react",aliases:["frontend.vite-react","vite-react","react","vite.react"],displayName:"React + Vite",framework:"react",defaultPort:5173,commandDisplay:e=>`npm create vite@latest ${e} -- --template react-ts`,commandExec:e=>({command:"npm",args:["create","vite@latest",e,"--","--template","react-ts","--no-interactive"]})},{id:"vite-vue",kitId:"frontend.vite-vue",aliases:["frontend.vite-vue","vite-vue","vue","vite.vue"],displayName:"Vue + Vite",framework:"vue",defaultPort:5173,commandDisplay:e=>`npm create vite@latest ${e} -- --template vue-ts`,commandExec:e=>({command:"npm",args:["create","vite@latest",e,"--","--template","vue-ts","--no-interactive"]})},{id:"vite-svelte",kitId:"frontend.vite-svelte",aliases:["frontend.vite-svelte","vite-svelte","svelte","vite.svelte"],displayName:"Svelte + Vite",framework:"svelte",defaultPort:5173,commandDisplay:e=>`npm create vite@latest ${e} -- --template svelte-ts`,commandExec:e=>({command:"npm",args:["create","vite@latest",e,"--","--template","svelte-ts","--no-interactive"]})},{id:"vite-solid",kitId:"frontend.vite-solid",aliases:["frontend.vite-solid","vite-solid","solid","solidjs","vite.solid"],displayName:"Solid + Vite",framework:"solid",defaultPort:5173,commandDisplay:e=>`npm create vite@latest ${e} -- --template solid-ts`,commandExec:e=>({command:"npm",args:["create","vite@latest",e,"--","--template","solid-ts","--no-interactive"]})},{id:"vite-vanilla",kitId:"frontend.vite-vanilla",aliases:["frontend.vite-vanilla","vite","vanilla","vite-vanilla"],displayName:"Vite",framework:"vite",defaultPort:5173,commandDisplay:e=>`npm create vite@latest ${e} -- --template vanilla-ts`,commandExec:e=>({command:"npm",args:["create","vite@latest",e,"--","--template","vanilla-ts","--no-interactive"]})},{id:"nuxt",kitId:"frontend.nuxt",aliases:["frontend.nuxt","nuxt","nuxtjs","nuxt.js"],displayName:"Nuxt",framework:"nuxt",defaultPort:3e3,commandDisplay:(e,t)=>`npx create-nuxt@latest ${e} --template minimal --packageManager npm --gitInit ${t?.skipGit?"false":"true"}${t?.skipInstall?" --no-install":""}`,commandExec:(e,t)=>({command:"npx",args:["--yes","create-nuxt@latest",e,"--template","minimal","--packageManager","npm","--gitInit",t.skipGit?"false":"true",...t.skipInstall?["--no-install"]:[]]})},{id:"angular",kitId:"frontend.angular",aliases:["frontend.angular","angular","ng"],displayName:"Angular",framework:"angular",defaultPort:4200,minNodeMajor:18,minNodeMessage:"Angular scaffolding requires Node.js 18.19+ or 20.11+. Upgrade Node, or choose another frontend kit.",commandDisplay:e=>`npx @angular/cli@19 new ${e}`,commandExec:(e,t)=>({command:"npx",args:["--yes","@angular/cli@19","new",e,"--defaults","--skip-git",...t.skipInstall?["--skip-install"]:[]]})},{id:"astro",kitId:"frontend.astro",aliases:["frontend.astro","astro"],displayName:"Astro",framework:"astro",defaultPort:4321,commandDisplay:e=>`npm create astro@4 ${e}`,commandExec:(e,t)=>({command:"npm",args:["create","astro@4",e,"--","--yes",...t.skipInstall?["--no-install"]:[],...t.skipGit?["--no-git"]:[]]})},{id:"sveltekit",kitId:"frontend.sveltekit",aliases:["frontend.sveltekit","sveltekit","svelte-kit"],displayName:"SvelteKit",framework:"sveltekit",defaultPort:5173,commandDisplay:e=>`npx sv@latest create ${e}`,commandExec:(e,t)=>({command:"npx",args:["--yes","sv@latest","create",e,"--template","minimal","--types","ts","--no-add-ons",...t.skipInstall?["--no-install"]:["--install","npm"]]})}],v=new Map;for(let e of K){v.set(e.id,e),v.set(e.kitId,e);for(let t of e.aliases)v.set(t.toLowerCase(),e);}function ge(){return [...K]}function f(e){return e?v.get(e.trim().toLowerCase())??null:null}function fe(e){return !!f(e)}function ue(e){if(e[0]!=="create"||e[1]!=="frontend")return null;let t=e[2],r=e[3],n=e.slice(4),a=f(t);return a?["create","project",a.kitId,r??"",...n].filter(Boolean):["create","project",`frontend.${t??""}`,r??"",...n].filter(Boolean)}function A(e,t){return `rapidkit create project ${f(e)?.id??e.replace(/^frontend\./,"")} ${t}`}function C(e,t){return `npx ${A(e,t)}`}function J(e){let t=f(e);return t?`${A(t.id,"<name>")} [--output <dir>] [--skip-install] [--dry-run]`:"rapidkit create project <nextjs|remix|vite-react|vite-vue|vite-svelte|vite-solid|vite-vanilla|nuxt|angular|astro|sveltekit> <name> [--output <dir>] [--skip-install] [--dry-run]"}async function ke(e){let t=e.args;if(t[0]!=="create"||t[1]!=="project")throw new Error("Frontend create expects normalized args: create project <frontend.kit> <name>");let r=f(t[2]);if(!r)throw new Error(`Unknown frontend generator: ${t[2]??"(missing)"}`);let n=t[3];if(!n)throw new Error(`Usage: ${J(r.id)}`);R(n),q(r);let a=Q(t,"--output")||process.cwd(),i=o.resolve(a,n),g=e.dryRun===true||t.includes("--dry-run"),y=t.includes("--skip-install"),u=t.includes("--skip-git")||t.includes("--no-git"),c=r.commandExec(n,{skipGit:u,skipInstall:y}),k=r.commandDisplay(n,{skipGit:u,skipInstall:y});if(await l.pathExists(i))throw new Error(`Directory "${i}" already exists`);if(g)return Y({definition:r,projectName:n,projectPath:i,commandPlan:c}),{definition:r,projectName:n,projectPath:i,dryRun:g,commandDisplay:k,commandExec:[c.command,...c.args]};await l.ensureDir(o.dirname(i));let w=await O(c.command,c.args,o.dirname(i)),h=await H(i);if(w!==0&&!h)throw new Error(`Official ${r.displayName} generator failed with exit code ${w}`);return w!==0&&h&&console.log(s.yellow(`\u26A0\uFE0F Official ${r.displayName} generator exited with code ${w}, but the scaffold looks complete. Continuing RapidKit project setup...`)),u||await X(i),await W({definition:r,projectName:n,projectPath:i,commandDisplay:k,commandExec:[c.command,...c.args],skipGit:u,skipInstall:y}),console.log(s.green(`\u2705 ${r.displayName} project created at ${i}`)),console.log(s.gray(` Display command: ${C(r.id,n)}`)),console.log(s.gray(" Next: cd "+n+" && npx rapidkit dev")),{definition:r,projectName:n,projectPath:i,dryRun:g,commandDisplay:k,commandExec:[c.command,...c.args]}}async function W(e){let t=new Date().toISOString(),r=await b$1(),n={schema_version:"1.0",name:e.projectName,slug:e.projectName,kind:"frontend",project_type:"frontend",runtime:"node",framework:e.definition.framework,framework_display_name:e.definition.displayName,kit_name:e.definition.kitId,kit:e.definition.kitId,engine:"npm",support_tier:"extended",module_support:false,modules:[],rapidkit_version:r,generated_by:"rapidkit-npm",generated_at:t,frontend:{generator:e.definition.id,official_generator:true,default_port:e.definition.defaultPort,command_display:e.commandDisplay,command_exec:e.commandExec,skip_install:e.skipInstall,skip_git:e.skipGit},contracts:{owns:[],apis:[],publishes:[],consumes:[],dependsOn:[],env:[]}},a={project:e.projectName,runtime:"node",framework:e.definition.framework,kind:"frontend",source:"official-generator"},i={kind:"rapidkit.frontend_create",schema_version:"1.0",generated_at:t,project:{name:e.projectName,path:e.projectPath,kind:"frontend",runtime:"node",framework:e.definition.framework,framework_display_name:e.definition.displayName,kit_name:e.definition.kitId},generator:{id:e.definition.id,command_display:e.commandDisplay,command_exec:e.commandExec}};await l.ensureDir(o.join(e.projectPath,".rapidkit")),await l.writeJson(o.join(e.projectPath,".rapidkit","project.json"),n,{spaces:2}),await l.writeJson(o.join(e.projectPath,".rapidkit","context.json"),a,{spaces:2}),await l.writeJson(o.join(e.projectPath,".rapidkit","frontend-create.json"),i,{spaces:2});}function Y(e){console.log(s.bold(`
|
|
12
|
-
RapidKit frontend create plan: ${e.definition.displayName}`)),console.log(s.gray(`Project: ${e.projectName}`)),console.log(s.gray(`Target: ${e.projectPath}`)),console.log(s.gray(`Show: ${C(e.definition.id,e.projectName)}`)),console.log(s.gray(`Run: ${[e.commandPlan.command,...e.commandPlan.args].join(" ")}`)),console.log(s.gray(`Default: http://localhost:${e.definition.defaultPort}`));}function z(){let e=Number.parseInt(process.versions.node.split(".")[0]??"",10);return Number.isFinite(e)?e:0}function q(e){if(!(!e.minNodeMajor||z()>=e.minNodeMajor))throw new Error(e.minNodeMessage??`${e.displayName} requires Node.js ${e.minNodeMajor}+ (current: ${process.versions.node}).`)}async function H(e){if(!await l.pathExists(e))return false;let t=o.join(e,"package.json");return await l.pathExists(t)?true:(await l.readdir(e)).length>0}async function X(e){let t=o.join(e,".git");if(await l.pathExists(t))return;if(await O("git",["init"],e)===0){console.log(s.gray(" Git repository initialized."));return}console.log(s.yellow("\u26A0\uFE0F Git initialization was skipped or failed. You can run `git init` manually inside the project."));}async function O(e$1,t,r){let n=e(e$1);return await new Promise(a=>{let i=spawn(n.command,[...n.prefixArgs,...t],{cwd:r,stdio:"inherit",shell:c(),env:g()});i.on("close",g=>a(g??1)),i.on("error",()=>a(1));})}function Q(e,t){let r=e.indexOf(t);if(r>=0&&r+1<e.length)return e[r+1];let n=e.find(a=>a.startsWith(`${t}=`));return n?n.slice(t.length+1):void 0}var T=[{id:"fastapi.standard",aliases:["fastapi","fastapi.standard"],label:"fastapi \u2014 FastAPI Standard Kit",description:"Core-backed FastAPI service scaffold.",owner:"core",runtime:"python",framework:"fastapi",moduleSupport:true,stability:"stable"},{id:"fastapi.ddd",aliases:["fastapi.ddd","fastapi-ddd"],label:"fastapi \u2014 FastAPI DDD Kit",description:"Core-backed FastAPI DDD service scaffold.",owner:"core",runtime:"python",framework:"fastapi",moduleSupport:true,stability:"stable"},{id:"nestjs.standard",aliases:["nestjs","nest","nestjs.standard"],label:"nestjs \u2014 NestJS Standard Kit",description:"Core-backed NestJS service scaffold.",owner:"core",runtime:"node",framework:"nestjs",moduleSupport:true,stability:"stable"},{id:"springboot.standard",aliases:["spring","springboot","springboot.standard","java"],label:"spring \u2014 Spring Boot Standard Kit",description:"npm-backed Spring Boot service scaffold.",owner:"npm",runtime:"java",framework:"springboot",moduleSupport:false,stability:"stable",generator:"springboot",createUsage:"rapidkit create project springboot.standard <name> [--java-version <major>] [--spring-boot-version <semver>] [--group-id <com.example>] [--package-name <com.example.app>] [--port <number>]"},{id:"gofiber.standard",aliases:["go","go.standard","fiber","gofiber","gofiber.standard","go/fiber"],label:"go/fiber \u2014 Go Fiber Standard Kit",description:"npm-backed Go Fiber service scaffold.",owner:"npm",runtime:"go",framework:"gofiber",moduleSupport:false,stability:"stable",generator:"gofiber",createUsage:"rapidkit create project gofiber.standard <name> [--output <dir>]"},{id:"gogin.standard",aliases:["gin","gogin","gogin.standard","go/gin"],label:"go/gin \u2014 Go Gin Standard Kit",description:"npm-backed Go Gin service scaffold.",owner:"npm",runtime:"go",framework:"gogin",moduleSupport:false,stability:"stable",generator:"gogin",createUsage:"rapidkit create project gogin.standard <name> [--output <dir>]"},{id:"dotnet.webapi.clean",aliases:["dotnet","dotnet.webapi","dotnet.webapi.clean","aspnet","aspnetcore","asp.net","asp.net-core","csharp","c#"],label:"dotnet \u2014 ASP.NET Core Clean Web API",description:"npm-backed ASP.NET Core Web API with clean architecture boundaries.",owner:"npm",runtime:"dotnet",framework:"dotnet",moduleSupport:false,stability:"preview",generator:"dotnet-webapi-clean",createUsage:"rapidkit create project dotnet.webapi.clean <name> [--target-framework net8.0] [--root-namespace <Company.Product>] [--port <number>]"}],b=new Map;for(let e of T){b.set(e.id.toLowerCase(),e);for(let t of e.aliases)b.set(t.toLowerCase(),e);}function M(e){return e?b.get(e.trim().toLowerCase())??null:null}function ye(e){return M(e)?.id??e}function xe(){return T.filter(e=>e.owner==="core"||e.generator)}function je(e){return M(e)?.owner==="npm"}async function be(e,t){if(!e.generator)throw new Error(`Kit is not backed by an npm generator: ${e.id}`);if(e.generator==="gofiber"){let{generateGoFiberKit:r}=await import('./gofiber-standard-BQ4HCXL2.js');await r(t.projectPath,{project_name:t.projectName,module_path:t.projectName,skipGit:t.skipGit,skipInstall:t.skipInstall});return}if(e.generator==="gogin"){let{generateGoGinKit:r}=await import('./gogin-standard-PUBCYW3A.js');await r(t.projectPath,{project_name:t.projectName,module_path:t.projectName,skipGit:t.skipGit,skipInstall:t.skipInstall});return}if(e.generator==="springboot"){let{generateSpringBootKit:r}=await import('./springboot-standard-XFVQI37R.js');await r(t.projectPath,{project_name:t.projectName,artifact_id:t.projectName,java_version:d(t.args,"--java-version")?.trim(),spring_boot_version:d(t.args,"--spring-boot-version")?.trim(),springdoc_version:d(t.args,"--springdoc-version")?.trim(),group_id:d(t.args,"--group-id")?.trim(),package_name:d(t.args,"--package-name")?.trim(),description:d(t.args,"--description")?.trim(),port:d(t.args,"--port")?.trim(),skipGit:t.skipGit,skipInstall:t.skipInstall});return}if(e.generator==="dotnet-webapi-clean"){let{generateDotnetWebApiCleanKit:r}=await import('./dotnet-webapi-clean-K33C77EI.js');await r(t.projectPath,{project_name:t.projectName,target_framework:d(t.args,"--target-framework")?.trim(),root_namespace:d(t.args,"--root-namespace")?.trim(),description:d(t.args,"--description")?.trim(),port:d(t.args,"--port")?.trim(),skipGit:t.skipGit,skipInstall:t.skipInstall});return}throw new Error(`Unhandled npm kit generator: ${e.generator}`)}function d(e,t){let r=e.indexOf(t);if(r>=0&&r+1<e.length)return e[r+1];let n=e.find(a=>a.startsWith(`${t}=`));return n?n.slice(t.length+1):void 0}
|
|
13
|
-
export{m as a,D as b,$ as c,E as d,G as e,S as f,F as g,R as h,pe as i,ge as j,f as k,fe as l,ue as m,J as n,ke as o,M as p,ye as q,xe as r,je as s,be as t};
|
package/dist/chunk-JU3VNLTY.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {b as b$1}from'./chunk-CDCYRBAY.js';import {r,j as j$1}from'./chunk-E5ZVQL3C.js';import {f}from'./chunk-OLDPVVSV.js';import {b}from'./chunk-MIWDCR6I.js';import f$1,{promises}from'fs';import i from'path';import E,{homedir}from'os';import {pathToFileURL}from'url';import l from'process';function R(t){let r=t.label.indexOf(" \u2014 ");return r>=0?t.label.slice(r+3).trim():t.label.trim()}function j(){let t=r().map(r=>({value:r.id,label:R(r),hint:r.description,name:r.label})),e=j$1().map(r=>({value:r.kitId,label:r.displayName,hint:r.commandDisplay("my-app"),name:`${r.displayName} \u2014 ${r.framework}`}));return [...t,...e]}var _=".rapidkitrc.json",F=["rapidkit.config.js","rapidkit.config.mjs","rapidkit.config.cjs"];async function yt(){let t=i.join(E.homedir(),_);try{let e=await promises.readFile(t,"utf-8"),r=JSON.parse(e);return f.debug(`Loaded config from ${t}`),r}catch{return f.debug("No user config found, using defaults"),{}}}async function vt(t=process.cwd()){let e=t,r=i.parse(e).root;for(;e!==r;){for(let n of F){let o=i.join(e,n);try{await promises.access(o),f.debug(`Found config file: ${o}`);let m=await import(pathToFileURL(o).href),P=m.default||m;return f.debug(`Loaded RapidKit config from ${n}`),P}catch{continue}}e=i.dirname(e);}return f.debug("No RapidKit config file found, using defaults"),{}}function bt(t,e,r){return {author:r.author||e.workspace?.defaultAuthor||t.author,pythonVersion:r.pythonVersion||e.workspace?.pythonVersion||t.pythonVersion,defaultInstallMethod:r.defaultInstallMethod||e.workspace?.installMethod||t.defaultInstallMethod,defaultKit:r.defaultKit||e.projects?.defaultKit||t.defaultKit,skipGit:r.skipGit??e.projects?.skipGit??t.skipGit,license:r.license||t.license,testRapidKitPath:r.testRapidKitPath||t.testRapidKitPath}}function wt(t){return process.env.RAPIDKIT_DEV_PATH||t.testRapidKitPath||void 0}var x="workspai",Rt="Workspai";function L(t){return f$1.existsSync(i.join(t,".rapidkit-workspace"))||f$1.existsSync(i.join(t,".rapidkit","workspace.json"))}function g(t=homedir()){return i.join(t,"rapidkit","workspaces")}function K(t=homedir()){return i.join(t,"Workspai","rapidkits")}function y(t,e=homedir()){return i.join(g(e),t)}function U(t,e=homedir()){return [y(t,e),i.join(K(e),t)]}function D(t,e={}){let r=e.homeDir??homedir();return e.outputDir?i.resolve(e.outputDir,t):y(t,r)}function jt(t,e=homedir()){for(let r of U(t,e))if(f$1.existsSync(r))return r}function Et(t,e="my-workspace"){let r=1;for(;;){let n=r===1?e:`${e}-${r}`,o=i.join(t,n);if(!f$1.existsSync(o))return {name:n,targetPath:o};r+=1;}}function S(t=homedir()){return [i.join(g(t),x),i.join(K(t),x)]}function Mt(t=homedir()){for(let e of S(t))if(L(e))return e;return y(x,t)}function T(t,e){let r=t.indexOf(e);if(r>=0&&r+1<t.length)return t[r+1];let n=t.find(o=>o.startsWith(`${e}=`));if(n)return n.slice(e.length+1)}function N(t){return t.includes("--here")}function W(t,e=l.cwd()){if(N(t))return i.resolve(e);let r=T(t,"--output");if(r)return i.resolve(r)}function $t(t,e=l.cwd()){let r=i.resolve(t),n=i.resolve(e),o=i.relative(n,r);return o.length>0&&!o.startsWith("..")&&!i.isAbsolute(o)?`cd ${o}`:`cd ${r}`}function Gt(t,e={}){let r=e.argv??[],n=e.outputParent??W(r,l.cwd());return D(t.trim(),{homeDir:e.homeDir,outputDir:n})}async function Ot(t,e={}){let r=e.cwd??l.cwd(),n=e.homeDir??homedir(),o=W(t,r);if(o!==void 0)return o;let h=e.hasYes??(t.includes("--yes")||t.includes("-y"));if(!(e.interactive??(!h&&!!l.stdin.isTTY&&!b())))return;let P=g(n),{location:A}=await b$1([{type:"rawlist",name:"location",message:"Where should the workspace be created?",choices:[{value:"managed",label:"Managed home",hint:P},{value:"here",label:"Current directory",hint:r}],default:0}]);if(A==="here")return i.resolve(r)}export{j as a,yt as b,vt as c,bt as d,wt as e,Rt as f,g,jt as h,Et as i,Mt as j,$t as k,Gt as l,Ot as m};
|
package/dist/chunk-LRF6PQOZ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a as a$5}from'./chunk-HTYMXMQM.js';import {a as a$4,q as q$1,k}from'./chunk-YBS2HGO3.js';import {i,h}from'./chunk-UZW5QFRW.js';import {a as a$3,j as j$2,b as b$1}from'./chunk-3PTJID76.js';import {r,j as j$1,q}from'./chunk-E5ZVQL3C.js';import {a}from'./chunk-7BEZH5LE.js';import {a as a$2}from'./chunk-TDSIF42O.js';import {a as a$1}from'./chunk-HHJAANUC.js';import f from'path';import S from'fs-extra';import dt from'crypto';import {createRequire}from'module';var st=new Set(["service","frontend","worker","library","infra","docs","test-suite","unknown"]);async function Ie(e){try{if(!await S.pathExists(e))return null;let t=await S.readJSON(e);return t&&typeof t=="object"?t:null}catch{return null}}function Me(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return st.has(t)?t:null}async function De(e,t){let r=t??await Ie(f.join(e,".rapidkit","project.json")),o=Me(r?.kind)??Me(r?.type);if(o)return o;let s=typeof r?.kit_name=="string"?r.kit_name:r?.kit,n=typeof r?.framework=="string"?r.framework:null,a=typeof r?.runtime=="string"?r.runtime:null,i=`${typeof s=="string"?s:""} ${n??""} ${a??""}`.trim().toLowerCase();if(/\b(frontend|nextjs|next\.js|react|vue|svelte|vite|angular|astro|remix|nuxt)\b/.test(i))return "frontend";if(/\b(fastapi|nestjs|springboot|spring boot|gofiber|gogin|dotnet|webapi|django|flask|express|fastify|python|node|java|go|rust|php|ruby|elixir)\b/.test(i))return "service";let c=await Ie(f.join(e,"package.json"));if(c){let d={...c.dependencies??{},...c.devDependencies??{}},l=c.scripts??{},p=Object.values(l).filter(u=>typeof u=="string").join(" ").toLowerCase();if(d.next||d.react||d.vue||d.svelte||d.vite||d["@angular/core"]||p.includes("next ")||p.includes("vite "))return "frontend";if(c.private===true&&!d.express&&!d["@nestjs/core"])return "library"}return await S.pathExists(f.join(e,"Dockerfile"))||await S.pathExists(f.join(e,"docker-compose.yml"))||await S.pathExists(f.join(e,"terraform.tf"))?"infra":"service"}var at=new Set([...r().map(e=>e.id),...j$1().map(e=>e.kitId)]),it=[{id:"wordpress-site",aliases:["wordpress","wordpress-site","wp","wp-site"],ecosystem:"wordpress",status:"planned",officialCommands:["wp core download","wp config create","wp db create","wp core install"],adoptAfterCreate:true},{id:"wordpress-block",aliases:["wordpress-block","wp-block","gutenberg-block"],ecosystem:"wordpress",status:"planned",officialCommands:["npx @wordpress/create-block@latest <slug>"],adoptAfterCreate:true},{id:"laravel",aliases:["laravel","php-laravel"],ecosystem:"php",status:"planned",officialCommands:["composer create-project laravel/laravel <name>"],adoptAfterCreate:true},{id:"symfony",aliases:["symfony","php-symfony"],ecosystem:"php",status:"planned",officialCommands:["composer create-project symfony/skeleton <name>"],adoptAfterCreate:true},{id:"rails",aliases:["rails","ruby-on-rails","ruby-rails"],ecosystem:"ruby",status:"planned",officialCommands:["rails new <name>"],adoptAfterCreate:true}],K=new Map;for(let e of it){K.set(e.id,e);for(let t of e.aliases)K.set(t,e);}var ct=new Set(["php","ruby","rust","elixir","clojure","scala","kotlin","unknown"]);function D(e){return e?.trim().toLowerCase()||void 0}function Fe(e){let t=D(e.kitId)??D(e.framework)??D(e.runtime)??"unknown";if(e.projectExists)return {lane:"adopt-only",status:"available",canExecuteCreate:false,requested:t,reason:"Existing projects enter Workspace Intelligence through adopt/import."};let r=e.kitId?q(e.kitId):void 0;if(r&&at.has(r))return {lane:"native-create",status:"available",canExecuteCreate:true,requested:t,resolved:r,reason:"RapidKit owns the create contract, project marker, registry, doctor, and workspace model path."};let o=K.get(t)??K.get(D(e.framework)??"")??K.get(D(e.runtime)??"");if(o)return {lane:"external-create-adopt",status:o.status,canExecuteCreate:false,requested:t,resolved:o.id,officialCommands:o.officialCommands,fallbackLane:"adopt-only",reason:"External generator support is planned but not enabled; use adopt/import until RapidKit owns the post-create contract."};let s=D(e.runtime);return s&&ct.has(s)?{lane:"adopt-only",status:"available",canExecuteCreate:false,requested:t,resolved:s,reason:"Runtime can be governed through Workspace Intelligence, but native create is not supported."}:{lane:"adopt-only",status:"available",canExecuteCreate:false,requested:t,reason:"No native create contract is available; use adopt/import to enter Workspace Intelligence."}}function ur(e){return !e.canExecuteCreate&&(e.lane==="external-create-adopt"||e.lane==="adopt-only"&&e.resolved!==void 0)}var Oe="workspace-dependency-graph.v1",Ge=["code-import","package-dep","event-pub-sub","service-dependsOn","shared-resource"];var yr="rapidkit-freshness-metadata-v1";function ie(e){if(Array.isArray(e))return e.map(t=>ie(t));if(e&&typeof e=="object"){let t={};for(let r of Object.keys(e).sort())t[r]=ie(e[r]);return t}return e}function pt(e){return JSON.stringify(ie(e))}function F(e){return dt.createHash("sha256").update(pt(e)).digest("hex")}var _e=".rapidkit/workspace-graph.overrides.json",lt=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs"]),ut=new Set([".git",".hg",".svn",".rapidkit",".venv","node_modules","dist","build","out","target","coverage","htmlcov",".next",".turbo",".cache"]),Te=600,$e=5,ft=256*1024,Ne={inferred:1,contract:2,manual:3};function mt(e){return e.split(f.sep).join("/")}function X(e,t){return mt(f.relative(e,t)||".")}function He(e){let t=new Map;for(let r of e.projects)t.has(r.name)||t.set(r.name,{id:r.name,path:r.path,...r.runtime?{runtime:r.runtime}:{},...r.framework?{framework:r.framework}:{},...r.kind?{kind:r.kind}:{}});return [...t.values()].sort((r,o)=>r.id.localeCompare(o.id))}function Ve(e,t){let r=new Map,o=new Map;for(let n of t.projects){if(r.has(n.name))continue;let a=n.absolutePath?f.resolve(n.absolutePath):f.resolve(e,n.path);r.set(n.name,a),o.has(a)||o.set(a,n.name);}let s=[...o.entries()].map(([n,a])=>({dir:n,id:a})).sort((n,a)=>a.dir.length-n.dir.length||n.dir.localeCompare(a.dir));return {idToDir:r,dirToId:o,sortedDirs:s}}function Y(e,t){let r=f.resolve(t);for(let{dir:o,id:s}of e.sortedDirs)if(r===o||r.startsWith(`${o}${f.sep}`))return s;return null}async function pe(e){try{if(!await S.pathExists(e))return null;let t=await S.readJSON(e);return t&&typeof t=="object"&&!Array.isArray(t)?t:null}catch{return null}}async function ue(e){try{return await S.pathExists(e)?await S.readFile(e,"utf8"):null}catch{return null}}async function Ke(e,t){let r=[],o=new Map;for(let[s,n]of t.idToDir.entries()){let a=await pe(f.join(n,"package.json")),i=typeof a?.name=="string"?a.name.trim():"";i&&!o.has(i)&&o.set(i,s);}for(let[s,n]of t.idToDir.entries()){let a=await pe(f.join(n,"package.json"));if(a){let i=["dependencies","devDependencies","peerDependencies","optionalDependencies"],c=new Set;for(let d of i){let l=a[d];if(!(!l||typeof l!="object"||Array.isArray(l)))for(let p of Object.keys(l)){let u=o.get(p);!u||u===s||c.has(u)||(c.add(u),r.push({from:s,to:u,kind:"package-dep",source:"inferred",confidence:"high",evidence:[{file:X(e,f.join(n,"package.json")),detail:`declares dependency ${p}`}]}));}}}r.push(...await gt(e,t,s,n)),r.push(...await ht(e,t,s,n));}return r}async function gt(e,t,r,o){let s=await ue(f.join(o,"pyproject.toml"));if(!s)return [];let n=[],a=new Set,i=/path\s*=\s*["']([^"']+)["']/g,c;for(;(c=i.exec(s))!==null;){let d=Y(t,f.resolve(o,c[1]));!d||d===r||a.has(d)||(a.add(d),n.push({from:r,to:d,kind:"package-dep",source:"inferred",confidence:"high",evidence:[{file:X(e,f.join(o,"pyproject.toml")),detail:`path dependency ${c[1]}`}]}));}return n}async function ht(e,t,r,o){let s=await ue(f.join(o,"go.mod"));if(!s)return [];let n=[],a=new Set,i=/replace\s+\S+\s+=>\s+(\.[^\s]+)/g,c;for(;(c=i.exec(s))!==null;){let d=Y(t,f.resolve(o,c[1]));!d||d===r||a.has(d)||(a.add(d),n.push({from:r,to:d,kind:"package-dep",source:"inferred",confidence:"high",evidence:[{file:X(e,f.join(o,"go.mod")),detail:`go.mod replace ${c[1]}`}]}));}return n}async function kt(e,t){let r=[],o=[e];for(;o.length>0&&r.length<t;){let s=o.shift();if(!s)continue;let n=[];try{n=await S.readdir(s,{withFileTypes:true});}catch{continue}let a=[],i=[];for(let c of n)if(c.isDirectory()){if(ut.has(c.name)||c.name.startsWith("."))continue;a.push(f.join(s,c.name));}else c.isFile()&<.has(f.extname(c.name))&&i.push(f.join(s,c.name));i.sort((c,d)=>c.localeCompare(d)),a.sort((c,d)=>c.localeCompare(d));for(let c of i){if(r.length>=t)break;r.push(c);}o.push(...a);}return r}var yt=[/\bfrom\s+["']([^"']+)["']/g,/\bimport\s+["']([^"']+)["']/g,/\bimport\s*\(\s*["']([^"']+)["']\s*\)/g,/\brequire\s*\(\s*["']([^"']+)["']\s*\)/g];function wt(e){let t=new Set;for(let r of yt){r.lastIndex=0;let o;for(;(o=r.exec(e))!==null;){let s=o[1];s.startsWith(".")&&t.add(s);}}return [...t]}async function le(e,t,r,o){let s=new Map;for(let[n,a]of t.idToDir.entries()){if(o&&!o.has(n))continue;let i=await kt(a,r);for(let c of i){let d=await S.stat(c).catch(()=>null);if(!d||d.size>ft)continue;let l=await ue(c);if(l)for(let p of wt(l)){let u=f.resolve(f.dirname(c),p),m=Y(t,u);if(!m||m===n)continue;let P=`${n}\0${m}`,w=s.get(P);w||(w={from:n,to:m,evidence:[]},s.set(P,w)),w.evidence.length<$e&&w.evidence.push({file:X(e,c),detail:`imports ${p}`});}}}return [...s.values()].map(n=>({from:n.from,to:n.to,kind:"code-import",source:"inferred",confidence:"medium",evidence:n.evidence}))}function vt(e,t,r){let o=new Map;for(let s of r.projects){let n=bt(e,t,s);n&&o.set(s.slug,n);}return o}function bt(e,t,r){let o=[r.relativePath,r.externalPath].filter(s=>typeof s=="string"&&s.length>0);for(let s of o){let n=f.resolve(e,s),a=t.dirToId.get(n)??Y(t,n);if(a)return a}return t.idToDir.has(r.slug)?r.slug:null}function Be(e,t,r){let o=[],s=vt(e,t,r),n=b$1,a=new Map,i=new Map;for(let c of r.projects){let d=s.get(c.slug);if(!d)continue;let l=c.contracts??{publishes:[],consumes:[],dependsOn:[]};for(let p of l.dependsOn??[]){let u=s.get(p);!u||u===d||o.push({from:d,to:u,kind:"service-dependsOn",source:"contract",confidence:"high",evidence:[{file:n,detail:`dependsOn ${p}`}]});}for(let p of l.publishes??[])a.has(p)||a.set(p,new Set),a.get(p)?.add(d);for(let p of l.consumes??[])i.has(p)||i.set(p,new Set),i.get(p)?.add(d);}for(let[c,d]of a.entries()){let l=i.get(c);if(l)for(let p of l)for(let u of d)p!==u&&o.push({from:p,to:u,kind:"event-pub-sub",source:"contract",confidence:"high",evidence:[{file:n,detail:`consumes event ${c}`}]});}return o.push(...jt(r,s)),o}function ce(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function jt(e,t){let r=[],o=e.projects.map(s=>({project:s,id:t.get(s.slug)})).filter(s=>!!s.id).filter(s=>ce(s.project.slug).length>=3);for(let s of e.projects){let n=t.get(s.slug);if(!n)continue;let a=s.contracts?.env??[];if(a.length===0)continue;let i=new Set;for(let c of a){let d=ce(c);for(let l of o)l.id===n||i.has(l.id)||!(d.includes(ce(l.project.slug))&&(l.project.ports?.length??0)>0)||(i.add(l.id),r.push({from:n,to:l.id,kind:"shared-resource",source:"inferred",confidence:"low",evidence:[{file:b$1,detail:`env ${c} references ${l.project.slug}`}]}));}}return r}async function Le(e,t){let r=await pe(f.join(e,_e)),o=Array.isArray(r?.edges)?r?.edges:[],s=[],n=new Set(Ge);for(let a of o){if(!a||typeof a!="object"||Array.isArray(a))continue;let i=a,c=typeof i.from=="string"?i.from:"",d=typeof i.to=="string"?i.to:"",l=typeof i.kind=="string"?i.kind:"";if(!t.has(c)||!t.has(d)||c===d||!n.has(l))continue;let p=Array.isArray(i.evidence)?i.evidence.map(u=>u&&typeof u=="object"&&typeof u.file=="string"?{file:u.file,...typeof u.detail=="string"?{detail:u.detail}:{}}:null).filter(u=>!!u):[];s.push({from:c,to:d,kind:l,source:"manual",confidence:"high",evidence:p.length>0?p:[{file:_e,detail:"manual edge"}]});}return s}function Et(e){return `${e.from}\0${e.to}\0${e.kind}`}function Ct(e){let t=new Set,r=[];for(let o of e){let s=`${o.file}\0${o.detail??""}`;t.has(s)||(t.add(s),r.push(o));}return r.sort((o,s)=>o.file.localeCompare(s.file)||(o.detail??"").localeCompare(s.detail??"")).slice(0,$e)}function St(e){let t=new Map;for(let r of e){let o=Et(r),s=t.get(o);if(!s){t.set(o,{...r,evidence:[...r.evidence]});continue}let n=Ne[s.source],a=Ne[r.source];a>n?t.set(o,{...r,evidence:[...r.evidence,...s.evidence]}):a===n&&s.evidence.push(...r.evidence);}return [...t.values()].map(r=>({from:r.from,to:r.to,kind:r.kind,source:r.source,confidence:r.confidence,evidence:Ct(r.evidence)})).sort((r,o)=>r.from.localeCompare(o.from)||r.to.localeCompare(o.to)||r.kind.localeCompare(o.kind)||r.source.localeCompare(o.source))}function de(e){return Math.round(e*1e3)/1e3}function Pt(e){return Math.max(0,Math.min(100,Math.round(e)))}function Wt(e){return e>=75?"critical":e>=50?"high":e>=20?"medium":"low"}function xt(e){return e==="critical"||e==="high"?"strict":e==="medium"?"elevated":"normal"}function Rt(e,t){let r=a$5({nodes:e,edges:t}),o=new Map;for(let s of e){let n=r.byId.get(s.id)??{fanIn:0,fanOut:0,reach:0,betweenness:0,isHotspot:false},a=t.filter(m=>m.from===s.id||m.to===s.id),i=a.filter(m=>m.source==="contract"||m.source==="manual").length,c=a.filter(m=>m.confidence==="low").length,d=[],l=n.reach*20+n.fanIn*14+n.fanOut*8+Math.min(20,n.betweenness*4)+i*8;n.isHotspot&&(l+=24,d.push("Critical-path hotspot in dependency graph")),n.reach>0&&d.push(`Change reaches ${n.reach} dependent project(s)`),n.fanIn>0&&d.push(`${n.fanIn} direct dependent project(s)`),n.fanOut>0&&d.push(`${n.fanOut} direct dependency project(s)`),i>0&&d.push(`${i} contract/manual edge(s)`),c>0&&d.push(`${c} low-confidence inferred edge(s) need review`),a.length===0&&d.push("No dependency evidence connected to this project yet");let p=Pt(l),u=Wt(p);o.set(s.id,{weight:u,score:p,verificationPriority:xt(u),reasons:d.slice(0,5),centrality:{fanIn:n.fanIn,fanOut:n.fanOut,reach:n.reach,betweenness:n.betweenness,isHotspot:n.isHotspot}});}return o}function At(e,t){let r=Rt(e,t);return e.map(o=>({...o,operationalProfile:r.get(o.id)}))}function It(e,t){let r=new Set;for(let c of t)r.add(c.from),r.add(c.to);let o=e.length,s=t.length,n=e.filter(c=>r.has(c.id)).length,a=Math.max(0,o-n),i=a$5({nodes:e,edges:t});return {nodeCount:o,edgeCount:s,inferredEdges:t.filter(c=>c.source==="inferred").length,contractEdges:t.filter(c=>c.source==="contract").length,manualEdges:t.filter(c=>c.source==="manual").length,authoritativeEdges:t.filter(c=>c.source==="contract"||c.source==="manual").length,lowConfidenceEdges:t.filter(c=>c.confidence==="low").length,orphanCount:a,connectedNodeCount:n,density:de(o>1?s/(o*(o-1)):0),edgeCoverageRatio:de(o>0?n/o:1),evidenceCoverageRatio:de(s>0?t.filter(c=>c.evidence.length>0).length/s:1),hotspotCount:i.hotspots.length,hasCycle:Dt(e,t)}}function Mt(e,t,r){let o=[],s=e.filter(n=>!t.some(a=>a.from===n.id||a.to===n.id)).map(n=>n.id).sort((n,a)=>n.localeCompare(a));return r.nodeCount===0&&o.push({code:"graph.empty",severity:"info",message:"Workspace model has no projects, so dependency reasoning is unavailable.",recommendation:"Import, scaffold, or register projects before relying on graph-aware impact."}),r.nodeCount>1&&r.edgeCount===0?o.push({code:"graph.edges.missing",severity:"warning",message:"Projects were detected, but no inter-project dependency edges were found.",recommendation:"Run graph explain, add workspace contract relationships, or define manual graph overrides for operational dependencies that code imports cannot reveal.",nodeIds:s}):r.orphanCount>0&&o.push({code:"graph.orphans.detected",severity:"warning",message:`${r.orphanCount} project(s) have no dependency evidence connected to the graph.`,recommendation:"Review isolated projects and add package, contract, or manual edges when they participate in release-critical flows.",nodeIds:s.slice(0,12)}),r.lowConfidenceEdges>0&&o.push({code:"graph.low_confidence_edges",severity:"info",message:`${r.lowConfidenceEdges} inferred edge(s) are low confidence.`,recommendation:"Promote important low-confidence relationships to workspace contract or manual overrides."}),r.edgeCount>0&&r.evidenceCoverageRatio<1&&o.push({code:"graph.evidence.partial",severity:"warning",message:"Some dependency edges do not include file-level evidence.",recommendation:"Attach evidence to manual overrides so agents can audit why a relationship exists."}),r.hasCycle&&o.push({code:"graph.cycle.detected",severity:"error",message:"The dependency graph contains at least one directed cycle.",recommendation:"Break the cycle or document the relationship explicitly before using graph-aware release gates."}),o.sort((n,a)=>{let i={error:0,warning:1,info:2};return i[n.severity]-i[a.severity]||n.code.localeCompare(a.code)})}function Dt(e,t){let r=new Map;for(let c of e)r.set(c.id,[]);for(let c of t)r.has(c.from)||r.set(c.from,[]),r.get(c.from)?.push(c.to);let o=0,s=1,n=2,a=new Map;for(let c of r.keys())a.set(c,o);let i=c=>{let d=[{id:c,index:0}];for(a.set(c,s);d.length>0;){let l=d[d.length-1],p=r.get(l.id)??[];if(l.index>=p.length){a.set(l.id,n),d.pop();continue}let u=p[l.index];l.index+=1;let m=a.get(u)??o;if(m===s)return true;m===o&&(a.set(u,s),d.push({id:u,index:0}));}return false};for(let c of [...r.keys()].sort())if(a.get(c)===o&&i(c))return true;return false}function ze(e,t,r,o){let s=St(r.filter(c=>t.has(c.from)&&t.has(c.to))),n=At(e,s),a=It(e,s),i=Mt(e,s,a);return {schemaVersion:Oe,generatedAt:(o??new Date).toISOString(),nodes:n,edges:s,stats:a,...i.length>0?{diagnostics:i}:{}}}async function Ue(e){let t=f.resolve(e.workspacePath),r=e.maxImportFilesPerProject??Te,o=He(e.model),s=new Set(o.map(i=>i.id)),n=Ve(t,e.model),a=[];return a.push(...await Ke(t,n)),a.push(...await le(t,n,r)),e.contract&&a.push(...Be(t,n,e.contract)),a.push(...await Le(t,s)),ze(o,s,a,e.now)}async function Je(e){let t=f.resolve(e.workspacePath),r=e.maxImportFilesPerProject??Te,o=He(e.model),s=new Set(o.map(i=>i.id)),n=Ve(t,e.model),a=[];if(a.push(...await Ke(t,n)),e.structuralChange)a.push(...await le(t,n,r));else {a.push(...await le(t,n,r,e.changedProjectIds));for(let i of e.previousGraph.edges)i.kind==="code-import"&&i.source==="inferred"&&!e.changedProjectIds.has(i.from)&&s.has(i.from)&&s.has(i.to)&&a.push({from:i.from,to:i.to,kind:"code-import",source:"inferred",confidence:i.confidence,evidence:i.evidence});}return e.contract&&a.push(...Be(t,n,e.contract)),a.push(...await Le(t,s)),ze(o,s,a,e.now)}var fe="workspace-model-cache.v1",qe=".rapidkit/cache/workspace-model.v1.json",Xe=["package.json","pyproject.toml","requirements.txt","go.mod","go.sum","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","composer.json","Gemfile","rapidkit.project.json",".rapidkit/project.json"],Gt=[".rapidkit/workspace.contract.json",".rapidkit/workspace.json","rapidkit.workspace.json",".rapidkit/policies.yml",".rapidkit/policies.yaml"],_t=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs"]),Nt=new Set([".git",".rapidkit","node_modules","dist","build","out","target","coverage",".next",".turbo",".cache",".venv"]),Tt=1500,B=null;function me(){if(B)return B;try{B=createRequire(import.meta.url)("../package.json")?.version??"0.0.0";}catch{B="0.0.0";}return B}async function Q(e){try{let t=await S.readFile(e);return dt.createHash("sha256").update(t).digest("hex")}catch{return null}}async function $t(e){let t={};for(let s of Xe){let n=await Q(f.join(e,s));n&&(t[s]=n);}let r=[],o=[e];for(;o.length>0&&r.length<Tt;){let s=o.shift();if(!s)continue;let n=[];try{n=await S.readdir(s,{withFileTypes:true});}catch{continue}let a=[];for(let i of n)if(i.isDirectory()){if(Nt.has(i.name)||i.name.startsWith("."))continue;a.push(f.join(s,i.name));}else if(i.isFile()&&_t.has(f.extname(i.name))){let c=f.join(s,i.name),d=await S.stat(c).catch(()=>null);if(d){let l=f.relative(e,c).split(f.sep).join("/");r.push(`${l}:${d.size}:${Math.round(d.mtimeMs)}`);}}a.sort((i,c)=>i.localeCompare(c)),o.push(...a);}return r.sort((s,n)=>s.localeCompare(n)),F({manifests:t,source:r})}async function Z(e,t){let r=f.resolve(e),o={},s=[...new Set(t.map(n=>f.relative(r,f.resolve(n)).split(f.sep).join("/")))].sort((n,a)=>n.localeCompare(a));for(let n of s)o[n]=await $t(f.join(r,n));return o}async function ee(e){let t=f.resolve(e),r={};for(let o of Gt){let s=await Q(f.join(t,o));s&&(r[o]=s);}return r}async function te(e){let t=f.resolve(e.workspacePath),r=[...new Set(e.projectPaths.map(n=>f.relative(t,f.resolve(n)).split(f.sep).join("/")))].sort((n,a)=>n.localeCompare(a)),o=[];for(let n of r){let a={};for(let i of Xe){let c=await Q(f.join(t,n,i));c&&(a[i]=c);}o.push({project:n,manifests:a});}let s={};for(let n of [".rapidkit/workspace.contract.json",".rapidkit/workspace.json","rapidkit.workspace.json",".rapidkit/policies.yml",".rapidkit/policies.yaml"]){let a=await Q(f.join(t,n));a&&(s[n]=a);}return F({cacheSchema:fe,cliVersion:e.cliVersion,flags:e.flags,workspaceJson:e.workspaceJson??null,marker:e.marker??null,projects:o,workspaceFiles:s})}async function ge(e){let t=f.join(f.resolve(e),qe);try{if(!await S.pathExists(t))return null;let r=await S.readJson(t);return !r||r.schemaVersion!==fe||typeof r.inputsHash!="string"||typeof r.cliVersion!="string"||!r.model?null:r}catch{return null}}async function re(e,t){let r=f.join(f.resolve(e),qe);await S.ensureDir(f.dirname(r));let o={schemaVersion:fe,...t};return await S.writeJson(r,o,{spaces:2}),r}var Ye="rapidkit-fact-freshness-v1",L={durable:720*60*60,derived:10080*60,evidenceBacked:1440*60,live:300,verifyBeforeUse:1440*60};function Ht(e){switch(e){case "durable":return L.durable;case "derived":return L.derived;case "evidence-backed":return L.evidenceBacked;case "live":return L.live;case "verify-before-use":return L.verifyBeforeUse}}function Vt(e){if(e.status)return e.status;if(e.ttlSeconds===null)return "unknown";let t=Date.parse(e.generatedAt);if(!Number.isFinite(t))return "unknown";let r=t+e.ttlSeconds*1e3;return e.now.getTime()>r?"stale":"fresh"}function Kt(e){let t=e.now??new Date,r=e.generatedAt??t.toISOString(),o=e.ttlSeconds===void 0?Ht(e.kind):e.ttlSeconds,s=Vt({generatedAt:r,ttlSeconds:o,status:e.status,now:t}),n=o===null?void 0:new Date(Date.parse(r)+o*1e3),a=e.verifyBeforeUse??(e.kind==="live"||e.kind==="verify-before-use"||e.category!=="structure"||s!=="fresh");return {schemaVersion:Ye,kind:e.kind,category:e.category,generatedAt:r,ttlSeconds:o,...n?{expiresAt:n.toISOString()}:{},status:s,verifyBeforeUse:a,...e.sourceArtifact?{sourceArtifact:e.sourceArtifact}:{},...e.sourcePath?{sourcePath:e.sourcePath}:{},inputsHash:e.inputsHash??F(e.value??null),reason:e.reason}}function v(e){return {id:e.id,label:e.label,scope:e.scope,value:e.value,...e.project?{project:e.project}:{},freshness:Kt({...e.freshness,value:e.value})}}function Qe(e){let t=e.generatedAt??(e.now??new Date).toISOString(),r={durable:0,derived:0,"evidence-backed":0,live:0,"verify-before-use":0},o={structure:0,verification:0,state:0},s=0,n=0,a=0,i=0;for(let c of e.facts)r[c.freshness.kind]+=1,o[c.freshness.category]+=1,c.freshness.status==="stale"&&(s+=1),c.freshness.status==="unknown"&&(n+=1),c.freshness.kind==="live"&&(a+=1),c.freshness.verifyBeforeUse&&(i+=1);return {schemaVersion:Ye,generatedAt:t,status:s>0?"stale":n>0?"unknown":"fresh",totalFacts:e.facts.length,staleFacts:s,unknownFacts:n,liveFacts:a,verifyBeforeUseFacts:i,byKind:r,byCategory:o}}var Bt="workspace-model.v1",et=".rapidkit/reports/workspace-model.json",Lt=["package.json","pyproject.toml","requirements.txt","go.mod","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","composer.json","Gemfile","mix.exs","deno.json","deno.jsonc","bun.lock","bun.lockb","deps.edn","project.clj","build.sbt","docker-compose.yml","docker-compose.yaml","terraform.tf"],zt=new Set([".git",".hg",".svn",".rapidkit",".venv","node_modules","dist","build","target","coverage","htmlcov",".next",".turbo"]);function tt(e,t){return (f.relative(e,t)||".").split(f.sep).join("/")}async function rt(e){try{if(!await S.pathExists(e))return null;let t=await S.readJSON(e);return t&&typeof t=="object"?t:null}catch{return null}}async function Ut(e,t){for(let r of t)if(await S.pathExists(f.join(e,r)))return true;return false}function he(e){let t=Number.parseInt(process.env.RAPIDKIT_WORKSPACE_MODEL_SCAN_DEPTH??"",10),r=typeof e=="number"&&Number.isFinite(e)?e:Number.isFinite(t)?t:4;return Math.min(12,Math.max(1,Math.trunc(r)))}async function ke(e,t){let r=f.resolve(e),o=[{dirPath:r,depth:0}],s=new Set,n=new Set;for(;o.length>0;){let a=o.shift();if(!a)continue;let i=f.resolve(a.dirPath);if(n.has(i))continue;if(n.add(i),i!==r&&await Ut(i,Lt)){s.add(i);continue}if(a.depth>=t)continue;let c=[];try{c=await S.readdir(i,{withFileTypes:true});}catch{continue}for(let d of c)!d.isDirectory()||zt.has(d.name)||d.name.startsWith(".")&&d.name!==".config"||o.push({dirPath:f.join(i,d.name),depth:a.depth+1});}return Array.from(s).sort((a,i)=>a.localeCompare(i))}function ye(e){let t=new Set,r=[];for(let o of e){let s=f.resolve(o);t.has(s)||(t.add(s),r.push(s));}return r.sort((o,s)=>o.localeCompare(s))}function Ze(e,t){let r=e?.[t];return typeof r=="string"&&r.trim()?r.trim():void 0}function Jt(e,t){return e?.[t]===true}function qt(e,t,r){let o=e?.frontend&&typeof e.frontend=="object"&&!Array.isArray(e.frontend)?e.frontend:void 0,s=Ze(o,"generator"),n=Ze(o,"command_display"),a=typeof t=="string"&&t.startsWith("frontend.");if(!(!s&&!a))return {...s?{id:s}:{},...t?{kit:t}:{},displayName:r,source:Jt(o,"official_generator")?"official-generator":"metadata",...n?{commandDisplay:n}:{}}}async function Xt(e){let t=[".rapidkit/project.json",".rapidkit/context.json","package.json","pyproject.toml","requirements.txt","go.mod","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","composer.json","Gemfile","mix.exs","deno.json","Dockerfile","docker-compose.yml","README.md"],r=[];for(let o of t)await S.pathExists(f.join(e,o))&&r.push(o);return r}async function j(e,t,r){let o=f.join(e,t),s=await S.pathExists(o),n={path:t.split(f.sep).join("/"),exists:s};if(s&&r){let a=await rt(o);typeof a?.generatedAt=="string"&&(n.generatedAt=a.generatedAt);let i=a?.status??a?.result??a?.verdict;typeof i=="string"&&(n.status=i);}return n}async function Yt(e,t,r){let s=`${tt(e,t)}/.rapidkit/reports`,n=await j(e,`${s}/doctor-project-last-run.json`,r);return {doctor:n?.exists===true?n:await j(e,`${s}/doctor-last-run.json`,r),remediationPlan:await j(e,`${s}/doctor-remediation-plan-last-run.json`,r),fixResult:await j(e,`${s}/doctor-fix-result-last-run.json`,r),analyze:await j(e,`${s}/analyze-last-run.json`,r),readiness:await j(e,`${s}/release-readiness-last-run.json`,r)}}async function Qt(e,t,r){let o=a$4(t),s=i(t,o),n=q$1(t),a=k(s.runtime),i$1=await De(t,o),c=typeof o?.name=="string"&&o.name.trim()?o.name.trim():f.basename(t),d=typeof o?.kit_name=="string"?o.kit_name:typeof o?.kit=="string"?o.kit:void 0,l=typeof o?.engine=="string"?o.engine:n.engine!=="unknown"?n.engine:void 0,p=qt(o,d,s.displayName),u=Fe({kitId:d,framework:s.key,runtime:s.runtime});return {name:c,path:tt(e,t),...r.includeAbsolutePaths?{absolutePath:t}:{},kind:i$1,runtime:s.runtime,runtimeCandidates:h(t),framework:s.key,frameworkDisplayName:s.displayName,confidence:s.confidence,detectionSource:s.source,supportTier:s.supportTier,runtimeSupportTier:a.tier,runtimeDoctorSupport:a.doctorSupport,moduleSupport:n.moduleSupport,...d?{kit:d}:{},...l?{engine:l}:{},...p?{generator:p}:{},createCapability:u,commands:{supported:n.supportedCommands,unsupported:n.unsupportedCommands,global:n.globalCommands,fleetStages:n.fleetStages,localOnly:n.localOnlyCommands,map:n.commandMap},importantFiles:await Xt(t),evidence:await Yt(e,t,r.includeEvidence),provenance:{path:"filesystem discovery",runtime:s.source,framework:s.source,commands:"project command capability matrix",createCapability:"create planner capability contract",evidence:"project .rapidkit/reports"}}}async function we(e){return rt(f.join(e,".rapidkit","workspace.json"))}function Zt(e){return e.some(t=>t.kind==="frontend")&&e.length>1?"full-stack-workspace":e.some(t=>t.kind==="frontend")?"frontend-workspace":e.length>1?"backend-platform":"backend-workspace"}function er(e){let t=new Set;for(let r of e){let o=`${r.name} ${r.path}`.toLowerCase();for(let s of ["auth","billing","payment","notification","order","admin","report","search","analytics"])o.includes(s)&&t.add(s);}return Array.from(t).sort()}function C(e,t,r,o){return {severity:e,code:t,message:r,target:o}}function nt(e){let t=[];e.workspace.name.trim()||t.push(C("error","workspace.name.missing","Workspace name could not be resolved.","workspace")),e.workspace.type==="observed-workspace"&&t.push(C("warning","workspace.marker.missing","Workspace marker is missing; model is based on filesystem observation.","workspace.marker")),e.summary.projectCount===0&&t.push(C("warning","workspace.projects.empty","No project roots were detected in this workspace.","projects")),e.contracts.exists||t.push(C("warning","workspace.contract.missing","Workspace contract is missing; dependency and API edges may be incomplete.",e.contracts.workspaceContractPath));let r=new Map;for(let n of e.projects){let a=n.name.toLowerCase(),i=r.get(a)??[];i.push(n),r.set(a,i),n.importantFiles.length||t.push(C("warning","project.markers.missing",`Project ${n.name} has no important manifest files recorded.`,n.path)),n.runtime==="unknown"&&t.push(C("warning","project.runtime.unknown",`Project ${n.name} runtime could not be confidently detected.`,n.path));let c=["test","build"];for(let p of c)n.commands.supported.includes(p)&&n.commands.unsupported.includes(p)&&t.push(C("error","project.commands.conflict",`Project ${n.name} marks ${p} as both supported and unsupported.`,n.path));let d=new Set(n.commands.fleetStages),l=new Set(n.commands.localOnly);for(let p of n.commands.fleetStages){l.has(p)&&t.push(C("error","project.commands.scope-conflict",`Project ${n.name} marks ${p} as both fleet and local-only.`,n.path));let u=n.commands.map[p];(!u||u.status!=="supported"||u.fleetEligible!==true||u.executionScope!=="fleet")&&t.push(C("error","project.commands.fleet-stage-invalid",`Project ${n.name} advertises ${p} as a fleet stage without a supported fleet capability.`,n.path));}for(let p of n.commands.localOnly){let u=n.commands.map[p];(!u||u.status!=="supported"||u.executionScope!=="local-only"||u.fleetEligible===true)&&t.push(C("error","project.commands.local-only-invalid",`Project ${n.name} advertises ${p} as local-only without a matching local-only capability.`,n.path));}for(let p of Object.values(n.commands.map))p.status==="supported"&&(p.fleetEligible===true&&!d.has(p.command)&&t.push(C("error","project.commands.fleet-stage-missing",`Project ${n.name} capability ${p.command} is fleet-eligible but missing from fleetStages.`,n.path)),p.executionScope==="local-only"&&p.fleetEligible!==true&&!l.has(p.command)&&t.push(C("error","project.commands.local-only-missing",`Project ${n.name} capability ${p.command} is local-only but missing from localOnly commands.`,n.path)));}for(let[n,a]of r.entries())a.length>1&&t.push(C("error","project.name.duplicate",`Project name "${n}" is ambiguous across ${a.length} project roots.`,a.map(i=>i.path).join(", ")));let o=t.filter(n=>n.severity==="error").length,s=t.filter(n=>n.severity==="warning").length;return {status:o>0?"failed":s>0?"warning":"passed",errors:o,warnings:s,issues:t}}function tn(e){return nt(e)}function b(e){return e.join(".")}function tr(e,t){let r=et,o=e.generatedAt,s=[v({id:"workspace.name",label:"Workspace name",scope:"workspace",value:e.workspace.name,freshness:{kind:"durable",category:"structure",generatedAt:o,now:t,sourceArtifact:r,sourcePath:b(["workspace","name"]),reason:"Workspace identity is structural metadata and changes through workspace setup."}}),v({id:"workspace.type",label:"Workspace type",scope:"workspace",value:e.identity.workspaceType,freshness:{kind:"derived",category:"structure",generatedAt:o,now:t,sourceArtifact:r,sourcePath:b(["identity","workspaceType"]),reason:"Workspace type is derived from the current project inventory."}}),v({id:"workspace.projectCount",label:"Project count",scope:"workspace",value:e.summary.projectCount,freshness:{kind:"derived",category:"structure",generatedAt:o,now:t,sourceArtifact:r,sourcePath:b(["summary","projectCount"]),reason:"Project count is derived from workspace discovery and should be refreshed after structural changes."}}),v({id:"workspace.runtimeFamilies",label:"Runtime families",scope:"workspace",value:e.identity.runtimeFamilies,freshness:{kind:"derived",category:"structure",generatedAt:o,now:t,sourceArtifact:r,sourcePath:b(["identity","runtimeFamilies"]),reason:"Runtime coverage is inferred from project surfaces."}}),v({id:"workspace.policyMode",label:"Workspace policy mode",scope:"policy",value:e.policies.mode,freshness:{kind:"durable",category:"structure",generatedAt:o,now:t,sourceArtifact:r,sourcePath:b(["policies","mode"]),reason:"Policy mode is configuration, not runtime state."}}),v({id:"workspace.contract.exists",label:"Workspace contract presence",scope:"contract",value:e.contracts.exists,freshness:{kind:"derived",category:"structure",generatedAt:o,now:t,sourceArtifact:r,sourcePath:b(["contracts","exists"]),reason:"Contract presence is derived from workspace files and should be refreshed before release gating."}})];e.graph&&s.push(v({id:"graph.edgeCount",label:"Dependency graph edge count",scope:"graph",value:e.graph.stats.edgeCount,freshness:{kind:"derived",category:"structure",generatedAt:e.graph.generatedAt??o,now:t,sourceArtifact:r,sourcePath:b(["graph","stats","edgeCount"]),reason:"Graph topology is derived from manifests, imports, and workspace contracts."}}),v({id:"graph.evidenceCoverageRatio",label:"Dependency graph evidence coverage",scope:"graph",value:e.graph.stats.evidenceCoverageRatio,freshness:{kind:"derived",category:"structure",generatedAt:e.graph.generatedAt??o,now:t,sourceArtifact:r,sourcePath:b(["graph","stats","evidenceCoverageRatio"]),reason:"Graph evidence coverage changes when dependency evidence or contract edges change."}}));for(let[n,a]of e.projects.entries()){let i=`projects[${n}]`,c={kind:"derived",category:"structure",generatedAt:o,now:t,sourceArtifact:r,reason:"Project facts are derived from workspace discovery, project metadata, and framework probes."};s.push(v({id:`project.${a.name}.kind`,label:`${a.name} kind`,scope:"project",project:a.name,value:a.kind,freshness:{...c,sourcePath:b([i,"kind"])}}),v({id:`project.${a.name}.runtime`,label:`${a.name} runtime`,scope:"project",project:a.name,value:a.runtime,freshness:{...c,sourcePath:b([i,"runtime"])}}),v({id:`project.${a.name}.framework`,label:`${a.name} framework`,scope:"project",project:a.name,value:a.frameworkDisplayName,freshness:{...c,sourcePath:b([i,"frameworkDisplayName"])}}),v({id:`project.${a.name}.supportTier`,label:`${a.name} support tier`,scope:"project",project:a.name,value:a.supportTier,freshness:{...c,sourcePath:b([i,"supportTier"])}}),v({id:`project.${a.name}.safeFleetStages`,label:`${a.name} safe fleet stages`,scope:"command",project:a.name,value:a.commands.fleetStages,freshness:{...c,sourcePath:b([i,"commands","fleetStages"]),reason:"Safe command availability is derived from package and project command surfaces."}}));for(let[d,l]of Object.entries(a.evidence))s.push(v({id:`project.${a.name}.evidence.${d}`,label:`${a.name} ${d} evidence`,scope:"evidence",project:a.name,value:l?{path:l.path,exists:l.exists,status:l.status??null}:{exists:false},freshness:{kind:l?.exists?"evidence-backed":"verify-before-use",category:"verification",generatedAt:l?.generatedAt??o,now:t,sourceArtifact:l?.path??r,sourcePath:b([i,"evidence",d]),verifyBeforeUse:true,reason:l?.exists?"Evidence reports can expire or become stale after source changes.":"Missing evidence must be generated before this fact is used for verification."}}));}for(let[n,a]of Object.entries(e.evidence))s.push(v({id:`workspace.evidence.${n}`,label:`Workspace ${n} evidence`,scope:"evidence",value:a?{path:a.path,exists:a.exists,status:a.status??null}:null,freshness:{kind:a?.exists?"evidence-backed":"verify-before-use",category:"verification",generatedAt:a?.generatedAt??o,now:t,sourceArtifact:a?.path??r,sourcePath:b(["evidence",n]),verifyBeforeUse:true,reason:a?.exists?"Workspace evidence can expire or become stale after project, dependency, or policy changes.":"Missing workspace evidence must be generated before release or repair decisions."}}));return s}async function ne(e){let t=f.resolve(e.workspacePath),r=e.includeAbsolutePaths===true,o=e.includeEvidence===true,s=he(e.observableScanDepth),n=e.now??new Date,[a$3,i,c,d,l]=await Promise.all([a(t),we(t),a$1(t),a$2(t,{descendIntoMatchedProjects:false}),ke(t,s)]),p=ye([...d,...l,...c.map(k=>f.isAbsolute(k.path)?k.path:f.join(t,k.path))]),u=e.reuseProjectModels,m=await Promise.all(p.map(k=>{if(u){let ot=f.relative(t,f.resolve(k)).split(f.sep).join("/"),ve=u.get(ot);if(ve)return Promise.resolve(ve)}return Qt(t,k,{includeAbsolutePaths:r,includeEvidence:o})})),P=typeof i?.workspace_name=="string"?i.workspace_name:typeof i?.name=="string"?i.name:a$3?.name||f.basename(t),w=typeof i?.profile=="string"?i.profile:typeof i?.mode=="string"?i.mode:void 0,G=Array.from(new Set(m.map(k=>k.kind))).sort(),I=Array.from(new Set(m.map(k=>k.runtime))).sort(),oe=Array.from(new Set(m.map(k=>k.framework))).sort(),_=[".rapidkit/policies.yml",".rapidkit/policies.yaml"].find(k=>S.existsSync(f.join(t,k))),N=".rapidkit/workspace.contract.json",W=await S.pathExists(f.join(t,N)),z={schemaVersion:Bt,generatedAt:n.toISOString(),workspace:{name:P,root:t,...w?{profile:w}:{},type:a$3?"rapidkit-workspace":"observed-workspace",...a$3?{marker:{createdBy:a$3.createdBy,version:a$3.version,createdAt:a$3.createdAt}}:{}},identity:{workspaceType:Zt(m),surfaces:G,runtimeFamilies:I,businessCapabilities:er(m)},discovery:{observableScanDepth:s},projects:m,policies:{mode:typeof i?.policy_mode=="string"?i.policy_mode:typeof i?.policyMode=="string"?i.policyMode:"warn",source:_??null,exists:!!_},contracts:{workspaceContractPath:N,exists:W,status:W?"known":"missing"},evidence:{doctor:await j(t,".rapidkit/reports/doctor-last-run.json",o),projectDoctor:await j(t,".rapidkit/reports/doctor-project-last-run.json",o),doctorRemediationPlan:await j(t,".rapidkit/reports/doctor-remediation-plan-last-run.json",o),artifactRemediationPlan:await j(t,".rapidkit/reports/artifact-remediation-plan-last-run.json",o),doctorFixResult:await j(t,".rapidkit/reports/doctor-fix-result-last-run.json",o),analyze:await j(t,".rapidkit/reports/analyze-last-run.json",o),readiness:await j(t,".rapidkit/reports/release-readiness-last-run.json",o),pipeline:await j(t,".rapidkit/reports/pipeline-last-run.json",o)},summary:{projectCount:m.length,runtimes:I,frameworks:oe,firstClassProjects:m.filter(k=>k.supportTier==="first-class").length,observedProjects:m.filter(k=>k.supportTier==="observed").length}},T=await sr(t,z,{contractExists:W,now:n,incrementalGraph:e.incrementalGraph}),$={...z,graph:T},y=nt($),E=tr({...$},n),M=Qe({facts:E,generatedAt:n.toISOString(),now:n});return {...$,facts:E,factFreshness:M,validation:y}}async function rn(e){if(e.cache!==true)return {model:await ne(e),cache:"disabled"};let t=f.resolve(e.workspacePath),r=he(e.observableScanDepth),o=me(),[s,n,a$3,i,c]=await Promise.all([a(t),we(t),a$1(t),a$2(t,{descendIntoMatchedProjects:false}),ke(t,r)]),d=ye([...i,...c,...a$3.map(w=>f.isAbsolute(w.path)?w.path:f.join(t,w.path))]),l=await te({workspacePath:t,cliVersion:o,flags:{includeAbsolutePaths:e.includeAbsolutePaths===true,includeEvidence:e.includeEvidence===true,observableScanDepth:r},projectPaths:d,workspaceJson:n,marker:s}),p=await ge(t);if(p&&p.cliVersion===o&&p.inputsHash===l)return {model:p.model,cache:"hit"};let u=await ne({...e}),[m,P]=await Promise.all([Z(t,d),ee(t)]);return await re(t,{cliVersion:o,inputsHash:l,generatedAt:(e.now??new Date).toISOString(),model:u,projectSignatures:m,workspaceFileSignatures:P}),{model:u,cache:"miss"}}function rr(e,t){let r=new Set,o=new Set,s=new Set;for(let[n,a]of Object.entries(t))n in e?e[n]!==a&&r.add(n):o.add(n);for(let n of Object.keys(e))n in t||s.add(n);return {changed:r,added:o,removed:s}}function nr(e={},t={}){let r=new Set([...Object.keys(e),...Object.keys(t)]);for(let o of r)if(e[o]!==t[o])return false;return true}async function nn(e){let t=f.resolve(e.workspacePath),r=he(e.observableScanDepth),o=me(),s=e.now??new Date,[n,a$3,i,c,d]=await Promise.all([a(t),we(t),a$1(t),a$2(t,{descendIntoMatchedProjects:false}),ke(t,r)]),l=ye([...c,...d,...i.map(y=>f.isAbsolute(y.path)?y.path:f.join(t,y.path))]),p=await ge(t),u=async()=>{let y=await ne({...e}),E=await te({workspacePath:t,cliVersion:o,flags:{includeAbsolutePaths:e.includeAbsolutePaths===true,includeEvidence:e.includeEvidence===true,observableScanDepth:r},projectPaths:l,workspaceJson:a$3,marker:n}),[M,k]=await Promise.all([Z(t,l),ee(t)]);return await re(t,{cliVersion:o,inputsHash:E,generatedAt:s.toISOString(),model:y,projectSignatures:M,workspaceFileSignatures:k}),{model:y,mode:"full"}};if(!p||p.cliVersion!==o||!p.projectSignatures||!p.model?.graph)return u();let m=await ee(t);if(!nr(p.workspaceFileSignatures,m))return u();let P=await Z(t,l),{changed:w,added:G,removed:I}=rr(p.projectSignatures,P);if(w.size===0&&G.size===0&&I.size===0)return {model:p.model,mode:"unchanged"};let oe=new Set([...w,...G]),_=new Map;for(let y of p.model.projects){let E=y.path.split(f.sep).join("/");!oe.has(E)&&!I.has(E)&&_.set(E,y);}let N=new Set,W=false;for(let y of p.model.projects){let E=y.path.split(f.sep).join("/");w.has(E)&&N.add(y.name);}let z=G.size>0||I.size>0,T=await ne({...e,reuseProjectModels:_,incrementalGraph:{previousGraph:p.model.graph,changedProjectIds:N,structuralChange:z||W}});for(let y of p.model.projects){let E=y.path.split(f.sep).join("/");if(!w.has(E))continue;let M=T.projects.find(k=>k.path.split(f.sep).join("/")===E);if(M&&M.name!==y.name){W=true;break}}if(W)return u();let $=await te({workspacePath:t,cliVersion:o,flags:{includeAbsolutePaths:e.includeAbsolutePaths===true,includeEvidence:e.includeEvidence===true,observableScanDepth:r},projectPaths:l,workspaceJson:a$3,marker:n});return await re(t,{cliVersion:o,inputsHash:$,generatedAt:s.toISOString(),model:T,projectSignatures:P,workspaceFileSignatures:m}),{model:T,mode:"incremental"}}async function or(e){try{let{contract:t}=await j$2({workspacePath:e});return t&&typeof t=="object"?t:null}catch{return null}}async function sr(e,t,r){let o=r.contractExists?await or(e):null;try{return r.incrementalGraph?await Je({workspacePath:e,model:t,contract:o,now:r.now,previousGraph:r.incrementalGraph.previousGraph,changedProjectIds:r.incrementalGraph.changedProjectIds,structuralChange:r.incrementalGraph.structuralChange}):await Ue({workspacePath:e,model:t,contract:o,now:r.now})}catch{let s=t.projects.map(n=>({id:n.name,path:n.path}));return {schemaVersion:"workspace-dependency-graph.v1",generatedAt:r.now.toISOString(),nodes:s,edges:[],stats:{nodeCount:s.length,edgeCount:0,inferredEdges:0,contractEdges:0,manualEdges:0,authoritativeEdges:0,lowConfidenceEdges:0,orphanCount:s.length,connectedNodeCount:0,density:0,edgeCoverageRatio:s.length>0?0:1,evidenceCoverageRatio:1,hotspotCount:0,hasCycle:false},diagnostics:s.length>1?[{code:"graph.inference.failed",severity:"warning",message:"Dependency graph inference failed; model contains projects but no dependency edges.",recommendation:"Run workspace model again after fixing graph inputs, or add workspace contract/manual graph overrides.",nodeIds:s.map(n=>n.id).sort((n,a)=>n.localeCompare(a))}]:void 0}}}async function on(e,t){let r=f.join(t,et);return await S.ensureDir(f.dirname(r)),await S.writeJSON(r,a$3(e),{spaces:2}),r}export{yr as a,F as b,Ye as c,v as d,Qe as e,Fe as f,ur as g,De as h,Oe as i,Bt as j,et as k,tn as l,tr as m,ne as n,rn as o,nn as p,on as q};
|
package/dist/chunk-WHQWVQJH.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import {d,a,b,e}from'./chunk-64RTZBHU.js';import {n,q,g}from'./chunk-YBS2HGO3.js';import {h,i,f,e as e$1}from'./chunk-UZW5QFRW.js';import {d as d$1}from'./chunk-S5KTATOU.js';import {a as a$1}from'./chunk-TDSIF42O.js';import {e as e$2,g as g$1}from'./chunk-WRMCPKGA.js';import _ from'fs';import k from'path';import E from'chalk';import {execa}from'execa';function xe(e){return _.existsSync(k.join(e,"bun.lock"))||_.existsSync(k.join(e,"bunfig.toml"))?"bun":_.existsSync(k.join(e,"pnpm-lock.yaml"))?"pnpm":_.existsSync(k.join(e,"yarn.lock"))?"yarn":(_.existsSync(k.join(e,"package-lock.json")),"npm")}function Re(e,t,r=xe(e)){return r==="npm"?`npm run ${t}`:`${r} run ${t}`}function ve(e,t=xe(e)){return `${t} install`}var Me={"python-fastapi":{runtime:"python",framework:"FastAPI",markers:["pyproject.toml","fastapi"],commands:{init:"python -m pip install -e .",test:"pytest",build:"python -m build",start:"uvicorn main:app --reload"},errorPatterns:{setup:["ModuleNotFoundError","No module named","pip: command not found"],"test-failure":["FAILED","ERROR","test session started"],dependency:["ImportError","missing.*dependency"],runtime:["TypeError","AttributeError","ValueError"],timeout:["timeout","Timeout","timed out"],unknown:[]},healthCheck:{stage:"start",type:"http",value:"http://localhost:8000/docs"},validation:{command:"python -m pip list | grep fastapi",error:"FastAPI not installed"}},"python-django":{runtime:"python",framework:"Django",markers:["manage.py","django"],commands:{init:"python manage.py migrate",test:"python manage.py test",build:"python manage.py collectstatic --noinput",start:"python manage.py runserver 0.0.0.0:8000"},errorPatterns:{setup:["ModuleNotFoundError","ProgrammingError.*migrate"],"test-failure":["FAILED","ERROR","Ran.*test"],dependency:["ImportError","missing.*dependency"],runtime:["DatabaseError","ImproperlyConfigured"],timeout:["timeout","Timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:8e3},dependencies:["init"]},"node-nestjs":{runtime:"node",framework:"NestJS",markers:["package.json","@nestjs/core"],commands:{init:"npm install",test:"npm run test",build:"npm run build",start:"npm run start"},errorPatterns:{setup:["npm ERR!","ENOENT","not found"],"test-failure":["Tests.*failed","FAIL","fail.*test"],dependency:["Cannot find module","ERR_MODULE_NOT_FOUND"],runtime:["TypeError","Error: ","ReferenceError"],timeout:["timeout","TIMEOUT"],unknown:[]},healthCheck:{stage:"start",type:"port",value:3e3}},"node-express":{runtime:"node",framework:"Express",markers:["package.json","express"],commands:{init:"npm install",test:"npm run test",build:"npm run build",start:"npm start"},errorPatterns:{setup:["npm ERR!","ENOENT"],"test-failure":["failed","FAIL"],dependency:["Cannot find module"],runtime:["Error","TypeError"],timeout:["timeout"],unknown:[]}},"go-fiber":{runtime:"go",framework:"Fiber",markers:["go.mod","fiber"],commands:{init:"go mod download && go mod tidy",test:"go test ./...",build:"go build -o app .",start:"./app"},errorPatterns:{setup:["go: .*not found","cannot find","go mod tidy"],"test-failure":["FAIL","--- FAIL"],dependency:["missing.*module"],runtime:["panic","fatal","Error"],timeout:["timeout","context deadline"],unknown:[]},dependencies:["init"]},"go-gin":{runtime:"go",framework:"Gin",markers:["go.mod","gin-gonic"],commands:{init:"go mod download && go mod tidy",test:"go test ./...",build:"go build -o app .",start:"./app"},errorPatterns:{setup:["go: .*not found"],"test-failure":["FAIL"],dependency:["missing.*module"],runtime:["panic"],timeout:["timeout"],unknown:[]}},"java-springboot":{runtime:"java",framework:"Spring Boot",markers:["pom.xml","build.gradle","spring-boot"],commands:{init:"mvn dependency:go-offline",test:"mvn test",build:"mvn package -DskipTests",start:"mvn spring-boot:run"},errorPatterns:{setup:["\\[ERROR\\]","BUILD FAILURE","missing dependencies"],"test-failure":["\\[ERROR\\] Tests run:","BUILD FAILURE"],dependency:["missing.*dependency"],runtime:["Exception","Error","NullPointerException"],timeout:["timeout","Timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:8080}},"php-laravel":{runtime:"php",framework:"Laravel",markers:["composer.json","artisan","app/Models"],commands:{init:"composer install && php artisan migrate:fresh --seed",test:"php artisan test",build:"php artisan config:cache && php artisan route:cache && php artisan view:cache",start:"php artisan serve --host=0.0.0.0 --port=8000"},errorPatterns:{setup:["Composer.*lock","Fatal error","Class.*not found"],"test-failure":["FAILED","Tests.*failed"],dependency:["Class.*not found","require.*failed"],runtime:["Fatal error","Exception","Error"],timeout:["timeout","Timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:8e3},dependencies:["init"]},"php-symfony":{runtime:"php",framework:"Symfony",markers:["composer.json","symfony.lock","bin/console"],commands:{init:"composer install && php bin/console doctrine:database:create",test:"php bin/phpunit",build:"php bin/console cache:clear --env=prod",start:"symfony serve --no-tls"},errorPatterns:{setup:["Composer.*error","Fatal error"],"test-failure":["FAILED","failure"],dependency:["Class.*not found"],runtime:["Fatal error","Exception"],timeout:["timeout"],unknown:[]},dependencies:["init"]},"rust-actix":{runtime:"rust",framework:"Actix-web",markers:["Cargo.toml","actix"],commands:{init:"cargo fetch",test:"cargo test",build:"cargo build --release",start:"cargo run --release"},errorPatterns:{setup:["error: .*could not find","failed.*download"],"test-failure":["test result:","FAILED"],dependency:["can.t find.*crate"],runtime:["error\\[E","thread.*panicked"],timeout:["timeout"],unknown:[]},validation:{command:"cargo --version",error:"Rust/Cargo not installed"}},"rust-axum":{runtime:"rust",framework:"Axum",markers:["Cargo.toml","axum"],commands:{init:"cargo fetch",test:"cargo test",build:"cargo build --release",start:"cargo run --release"},errorPatterns:{setup:["error: .*could not find"],"test-failure":["test result:","FAILED"],dependency:["can.t find.*crate"],runtime:["error\\[E"],timeout:["timeout"],unknown:[]}},"rust-rocket":{runtime:"rust",framework:"Rocket",markers:["Cargo.toml","rocket"],commands:{init:"cargo fetch",test:"cargo test",build:"cargo build --release",start:"cargo run --release"},errorPatterns:{setup:["error: .*could not find"],"test-failure":["FAILED"],dependency:["can.t find"],runtime:["error\\[E"],timeout:["timeout"],unknown:[]}},"dotnet-aspnetcore":{runtime:"dotnet",framework:"ASP.NET Core",markers:[".csproj",".sln","Program.cs"],commands:{init:"dotnet restore",test:"dotnet test",build:"dotnet build -c Release",start:"dotnet run"},errorPatterns:{setup:["error CS","CSPROJ.*not found","NuGet.*restore"],"test-failure":["Failed:.*test","FAILED"],dependency:["error NU1101"],runtime:["error CS","Exception"],timeout:["timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:5e3}},"elixir-phoenix":{runtime:"elixir",framework:"Phoenix",markers:["mix.exs","phoenix"],commands:{init:"mix setup",test:"mix test",build:"mix compile --all-warnings",start:"mix phx.server"},errorPatterns:{setup:["\\*\\* \\(.*Error\\)","Mix.InstallError"],"test-failure":["\\d+\\sfailed","FAILED"],dependency:["dependencies are not available"],runtime:["\\*\\* \\(","RuntimeError"],timeout:["timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:4e3},dependencies:["init"]},"ruby-rails":{runtime:"ruby",framework:"Rails",markers:["Gemfile","config/application.rb","bin/rails"],commands:{init:"bundle install && rails db:prepare",test:"rails test",build:"rails assets:precompile",start:"rails server --binding=0.0.0.0 --port=3000"},errorPatterns:{setup:["Bundler::.*Error","Gem::.*Error"],"test-failure":["failures,","error,","FAILED"],dependency:["Could not find.*gem"],runtime:["Error","Exception","NoMethodError"],timeout:["timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:3e3},dependencies:["init"]},"ruby-sinatra":{runtime:"ruby",framework:"Sinatra",markers:["Gemfile","app.rb","sinatra"],commands:{init:"bundle install",test:"rspec",build:`echo "Sinatra apps don't require build"`,start:"ruby app.rb"},errorPatterns:{setup:["Bundler.*Error","Gem.*Error"],"test-failure":["failure","FAILED"],dependency:["Could not find.*gem"],runtime:["Error","NoMethodError"],timeout:["timeout"],unknown:[]}}},Ie={init:{python:["pip install -e .","poetry install","pip install -r requirements.txt"],node:["npm install","pnpm install","yarn install"],go:["go mod download && go mod tidy","go get ./..."],java:["mvn dependency:go-offline","gradle dependencies"],php:["composer install"],rust:["cargo fetch"],dotnet:["dotnet restore"],elixir:["mix deps.get"],ruby:["bundle install"],"jvm-generic":["mvn dependency:go-offline","gradle dependencies"],unknown:[]},test:{python:["pytest","python -m unittest","python -m pytest"],node:["npm test","npm run test"],go:["go test ./...","make test"],java:["mvn test","gradle test"],php:["php artisan test","phpunit","pest"],rust:["cargo test"],dotnet:["dotnet test"],elixir:["mix test"],ruby:["rspec","ruby -m minitest"],"jvm-generic":["mvn test","gradle test"],unknown:[]},build:{python:["python -m build","python setup.py build"],node:["npm run build"],go:["go build -o app .","go build ./..."],java:["mvn package -DskipTests","gradle build -x test"],php:['echo "PHP build: typically no build step"'],rust:["cargo build --release"],dotnet:["dotnet build -c Release"],elixir:["mix compile"],ruby:["gem build *.gemspec"],"jvm-generic":["mvn package -DskipTests","gradle build"],unknown:[]},start:{python:["python app.py","python main.py","uvicorn main:app --reload"],node:["npm start","node index.js","node src/index.js"],go:["./app","go run main.go","go run ./..."],java:["mvn spring-boot:run","gradle bootRun","java -jar target/*.jar"],php:["php -S 0.0.0.0:8000","php artisan serve"],rust:["cargo run --release","./target/release/app"],dotnet:["dotnet run"],elixir:["mix phx.server","iex -S mix"],ruby:["rails server","ruby app.rb","bundle exec puma"],"jvm-generic":["java -jar *.jar","gradle run"],unknown:[]}};function te(e,t){if(t){let r=t.trim().toLowerCase().replace(/[_.\s]+/g,"-"),n=e$1(t),a=`${e}-${n==="gofiber"?"fiber":n==="gogin"?"gin":n==="dotnet"?"aspnetcore":n!=="unknown"?n:r==="fiber"?"fiber":r==="aspnetcore"||r==="asp-net-core"?"aspnetcore":r}`;return Me[a]}}function Se(e,t,r){if(t){let n=te(e,t);if(n&&n.commands[r])return n.commands[r]}if(["init","test","build","start"].includes(r)){let n=Ie[r]?.[e]??[];return n.length>0?n[0]:void 0}}var Le={test:"test",build:"build",start:"start"};function re(e){if(e.stage==="init")return e.runtime==="node"?ve(e.projectPath):Se(e.runtime,e.framework,e.stage);if(e.runtime==="node"){let t=Le[e.stage];if(t){let r=g(e.projectPath,t,{framework:e.framework});if(r)return Re(e.projectPath,r.scriptName)}}return Se(e.runtime,e.framework,e.stage)}function _e(e){let t=h(e).map(r=>r==="python"?"python":r==="node"||r==="bun"?"node":r==="go"?"go":r==="java"?"java":r==="php"?"php":r==="rust"?"rust":r==="dotnet"?"dotnet":r==="elixir"?"elixir":r==="ruby"?"ruby":r==="clojure"||r==="scala"||r==="kotlin"?"jvm-generic":null).filter(r=>r!==null).filter((r,n,o)=>o.indexOf(r)===n);return {primary:t.length>0?t[0]:"unknown",secondary:t.slice(1)}}function je(e){return _e(e).primary}function ne(e,t){if(!e)return "unknown";t||(t={setup:["ModuleNotFoundError","npm ERR!","error:","not found"],"test-failure":["FAILED","FAIL","failed"],dependency:["cannot find module","import.*error"],runtime:["Exception","Error:","panic","TypeError"],timeout:["timeout","Timeout","deadline exceeded"],unknown:[]});for(let[r,n]of Object.entries(t))for(let o of n)if(new RegExp(o,"i").test(e))return r;return "unknown"}async function U(e){let t=e.split(/[&|;]\s*/)[0].trim().split(/\s+/)[0];if(["echo","cd","pwd","test","true","false","exit"].includes(t))return {valid:true};try{let n=process.platform==="win32"?"where":"which";if((await execa(n,[t],{reject:false})).exitCode===0)return {valid:true}}catch{}return {valid:false,reason:`Command '${t}' not found or not executable`}}function Ee(e,t,r){if(!t)return e;let n=typeof t=="object"&&!Array.isArray(t)&&("dev"in t||"staging"in t||"prod"in t||"default"in t)&&!Object.keys(t).some(o=>["init","test","build","start"].includes(o))?t:{};return r&&typeof n[r]=="string"?n[r]:typeof n.default=="string"?n.default:e}var Ce={init:"init",test:"test",build:"build",start:"start"};function Ge(e){return e in Ce?Ce[e]:null}function Be(e,t){let n$1=n(e)?.contextJson?.commands;if(!n$1||typeof n$1!="object"||Array.isArray(n$1))return;let o=n$1[t];if(typeof o=="string"&&o.trim().length>0)return o.trim();if(o&&typeof o=="object"&&!Array.isArray(o)){let a=o,c=a.default??a.dev;if(typeof c=="string"&&c.trim().length>0)return c.trim()}}function Pe(e,t,r=q(e)){let n=Ge(t);if(!n)return Be(e,t)?{supported:true}:{supported:false,reason:`Workspace stage "${t}" is not part of the RapidKit fleet contract.`};if(!r.projectRoot)return {supported:false,reason:"No RapidKit project metadata was detected for this target."};let o=r.commandMap[n];return !o||o.status!=="supported"?{supported:false,reason:o?.reason??`Command "${n}" is not supported for this project runtime/framework.`}:{supported:true}}var Ke=new Set(["init","test","build","start"]),ze=new Set([".git","node_modules",".rapidkit",".venv","dist","build","coverage","htmlcov"]);async function I(e){try{return await _.promises.access(e,_.constants.F_OK),true}catch{return false}}async function Ve(e,t,r){if(t==="python"){let o=k.join(e,".rapidkit","cli.py");return await I(o)?{valid:true}:{valid:false,reason:"Project-local .rapidkit/cli.py is missing. Run `rapidkit init` in this project first."}}let n=r.trim().split(/\s+/)[0];if(n&&["npm","npx","pnpm","yarn"].includes(n)){let o=e$2(n);if((await execa(o.command,[...o.prefixArgs,"--version"],{reject:false,env:g$1()})).exitCode===0)return {valid:true}}return U(r)}async function se(e){let t=await _.promises.readFile(e,"utf-8");return JSON.parse(t)}function N(e){return e.replace(/\\/g,"/")}function He(e){let t=e?.trim();return t?t.startsWith("project:")?t.slice(8).trim()||null:t:null}async function Ue(e){return a$1(e,{skipDirs:ze,includeHiddenDirs:false,descendIntoMatchedProjects:false,isProjectDir:async(t,r)=>await I(k.join(t,".rapidkit","context.json"))||await I(k.join(t,".rapidkit","project.json"))?true:k.resolve(t)===k.resolve(r)?false:h(t).length>0})}async function Je(e){for(let t of [k.join(".rapidkit","project.json"),k.join(".rapidkit","context.json")]){let r=k.join(e,t);if(await I(r))try{let n=await se(r),o=n.name??n.projectName??n.slug;if(typeof o=="string"&&o.trim())return o.trim()}catch{}}return null}async function qe(e,t,r){let n=He(r);if(!n)return {projects:t,normalizedScope:null};let o=N(n).toLowerCase(),a=[];for(let c of t){let u=N(k.relative(e,c)),p=k.basename(c),m=await Je(c);[u,p,m].filter(s=>typeof s=="string"&&s.length>0).map(s=>N(s).toLowerCase()).includes(o)&&a.push(c);}if(a.length===0)throw new Error(`Workspace run scope did not match any project: ${r}`);return {projects:a,normalizedScope:n}}async function Ye(e,t,r){let n=await execa("git",["diff","--name-only",`${r}...HEAD`],{cwd:e,reject:false});if(n.exitCode!==0)return new Set(t);let o=n.stdout.split(/\r?\n/).map(c=>c.trim()).filter(c=>c.length>0).map(c=>N(c));if(o.length===0)return new Set;let a=new Set;for(let c of t){let u=N(k.relative(e,c));if(!u||u===".")continue;let p=`${u}/`;o.some(m=>m===u||m.startsWith(p))&&a.add(c);}return a}async function Qe(e,t,r){let n=k.join(e,".rapidkit","workspace.contract.json");if(await I(n))try{let g=await Xe(e,t,r,n);if(g.graphStatus!=="missing")return g}catch{return {expanded:r,graphStatus:"invalid",expansionDepth:0}}let o=k.join(e,".rapidkit","workspace-dependency-graph.json");if(!await I(o))return {expanded:r,graphStatus:"missing",expansionDepth:0};let a;try{a=await se(o);}catch{return {expanded:r,graphStatus:"invalid",expansionDepth:0}}let c=new Set(t.map(g=>k.resolve(g))),u=new Map;if(!a||typeof a!="object"||Array.isArray(a))return {expanded:r,graphStatus:"invalid",expansionDepth:0};let p=Array.isArray(a.projects)?a.projects:[];for(let g of p){if(!g||typeof g!="object"||Array.isArray(g))continue;let s=g,d=typeof s.path=="string"?s.path:"",y=k.resolve(e,d);if(!c.has(y))continue;let h=Array.isArray(s.dependsOn)?s.dependsOn.filter(b=>typeof b=="string"):[];for(let b of h){let x=k.resolve(e,b);c.has(x)&&(u.has(x)||u.set(x,new Set),u.get(x)?.add(y));}}let m=d$1(u,r);return {expanded:m.reached,graphStatus:"loaded",expansionDepth:m.added}}async function Xe(e,t,r,n){let o=await se(n);if(!o||typeof o!="object"||Array.isArray(o))return {expanded:r,graphStatus:"invalid",expansionDepth:0};let a=o,c=Array.isArray(a.projects)?a.projects:null;if(!c)return {expanded:r,graphStatus:"invalid",expansionDepth:0};let u=new Map,p=new Map;for(let y of t){let h=N(k.relative(e,y));p.set(h,k.resolve(y));}let m=new Map,g=new Map,s=new Map;for(let y of c){if(!y||typeof y!="object"||Array.isArray(y))continue;let h=y,b=typeof h.slug=="string"?h.slug:"",x=typeof h.relativePath=="string"?N(h.relativePath):b,v=p.get(x);!b||!v||u.set(b,v);}for(let y of c){if(!y||typeof y!="object"||Array.isArray(y))continue;let h=y,b=typeof h.slug=="string"?h.slug:"",x=u.get(b);if(!x)continue;let v=h.contracts&&typeof h.contracts=="object"&&!Array.isArray(h.contracts)?h.contracts:{},S=Array.isArray(v.dependsOn)?v.dependsOn.filter(R=>typeof R=="string"):[],O=Array.isArray(v.publishes)?v.publishes.filter(R=>typeof R=="string"):[],$=Array.isArray(v.consumes)?v.consumes.filter(R=>typeof R=="string"):[];for(let R of S){let j=u.get(R);j&&(s.has(j)||s.set(j,new Set),s.get(j)?.add(x));}for(let R of O)m.has(R)||m.set(R,new Set),m.get(R)?.add(x);for(let R of $)g.has(R)||g.set(R,new Set),g.get(R)?.add(x);}for(let[y,h]of m.entries()){let b=g.get(y);if(b)for(let x of h){s.has(x)||s.set(x,new Set);for(let v of b)v!==x&&s.get(x)?.add(v);}}let d=d$1(s,r);return {expanded:d.reached,graphStatus:"loaded",expansionDepth:d.added}}async function Ze(e,t){if(typeof t=="boolean")return t;let r=k.join(e,".rapidkit","policies.yml");if(!await I(r))return true;let n="";try{n=await _.promises.readFile(r,"utf-8");}catch{return true}let o=n.match(/^[\t ]*rules\.enforce_workspace_run_gates:\s*(true|false)\s*(?:#.*)?$/m);return o?o[1]==="true":true}function et(e){let t=process.env.RAPIDKIT_WORKSPACE_RUN_STAGE_TIMEOUT_MS;if(t){let r=Number.parseInt(t,10);if(Number.isFinite(r)&&r>0)return r}return e==="init"?12e4:9e4}async function oe(e,t,r){let n=process.argv[1];if(!n)return {exitCode:1,stdout:"",stderr:"RapidKit entrypoint is unavailable for nested workspace-run execution."};try{let o=await execa(process.execPath,[n,...e],{cwd:t,reject:false,timeout:r,env:{...process.env,RAPIDKIT_WORKSPACE_RUN_CHILD:"1"}});return {exitCode:Number(o.exitCode??1),stdout:o.stdout,stderr:o.stderr}}catch(o){return {exitCode:typeof o=="object"&&o!==null&&"timedOut"in o&&!!o.timedOut?124:1,stdout:typeof o=="object"&&o!==null&&"stdout"in o?String(o.stdout??""):"",stderr:typeof o=="object"&&o!==null&&"stderr"in o?String(o.stderr??""):o instanceof Error?o.message:String(o)}}}function tt(e){return e==="node"||e==="go"||e==="java"||e==="python"||e==="dotnet"}function rt(){return process.env.VITEST==="true"||process.env.VITEST==="1"||process.env.NODE_ENV==="test"}async function nt(e){let t=process.cwd();try{process.chdir(e);let{handleInitCommand:r}=await import('./index.js');return {exitCode:await r(["init"]),stdout:"",stderr:""}}finally{process.chdir(t);}}async function ot(e){let t=s=>{let d=f(s);return d==="node"||d==="bun"?"node":d==="python"?"python":d==="go"?"go":d==="java"?"java":d==="php"?"php":d==="ruby"?"ruby":d==="rust"?"rust":d==="dotnet"?"dotnet":d==="elixir"?"elixir":d==="clojure"||d==="scala"||d==="kotlin"?"jvm-generic":je(e)},r=s=>{if(!s)return;let d=e$1(s);if(new Set(["fastapi","django","flask","nestjs","express","fastify","koa","gofiber","gogin","echo","springboot","laravel","symfony","rails","sinatra","dotnet","actix","axum","rocket","phoenix"]).has(d))return d},n$1=n(e),o=n$1?.detection??i(e,n$1?.projectJson??null),a=n$1?.contextJson,c=t(o.runtime),u=r(o.key),p={},m=new Set(["init","test","build","start"]);if(a?.commands&&typeof a.commands=="object")for(let[s,d]of Object.entries(a.commands))typeof d=="string"&&m.has(s)&&(p[s]=d);let g;if(a?.commandEnvironments&&typeof a.commandEnvironments=="object"){let s=a.commandEnvironments;g={dev:typeof s.dev=="string"?s.dev:void 0,staging:typeof s.staging=="string"?s.staging:void 0,prod:typeof s.prod=="string"?s.prod:void 0,default:typeof s.default=="string"?s.default:void 0};}return {runtime:c,framework:u,commandOverrides:Object.keys(p).length>0?p:void 0,environmentCommandVariants:g,environment:typeof a?.environment=="string"?a.environment:void 0}}async function st(e,t,r,n,o,a,c){let u=!o?.[t]&&tt(r),p;if(o&&o[t]?p=o[t]:u?p=`rapidkit ${t}`:p=re({projectPath:e,runtime:r,framework:n,stage:t}),!p)return {exitCode:127,command:`<stage not supported for ${r}>`,message:`No stage command found for runtime '${r}' and framework '${n||"unknown"}'`,errorCategory:"runtime"};let m=Ee(p,a,c);if(!m)return {exitCode:127,command:p,message:"Failed to resolve stage command",errorCategory:"runtime"};let g=re({projectPath:e,runtime:r,framework:n,stage:t});if(u){if(g){let f=u?await Ve(e,r,g):await U(g);if(!f.valid)return {exitCode:127,command:m,message:f.reason||"Command not available",errorCategory:"setup"}}}else {let f=await U(m);if(!f.valid)return {exitCode:127,command:m,message:f.reason||"Command not available",errorCategory:"setup"}}let s=0,d="",y="",h,b=et(t),x=Date.now();try{let f=u?t==="init"&&rt()?await nt(e):await oe([t],e,b):await execa(m,[],{cwd:e,reject:false,shell:true,timeout:b});if(s=Number(f.exitCode??0),d=f.stdout,y=f.stderr,s!==0){let C=`${d}
|
|
2
|
-
${y}`,B=Date.now()-x;h=s===124||ne(C)==="timeout"||s===143&&B>=Math.floor(b*.8)?"timeout":ne(C);}}catch(f){let C=typeof f=="object"&&f!==null&&"timedOut"in f&&!!f.timedOut;return {exitCode:C?124:1,command:m,message:C?`Stage timed out after ${b}ms`:f instanceof Error?f.message:"Command execution failed",errorCategory:C?"timeout":"runtime"}}let v,S=`${d}
|
|
3
|
-
${y}`.split(/\r?\n/).map(f=>f.trim()).filter(Boolean),O=S.slice(0,6).join(`
|
|
4
|
-
`),$=Date.now()-x,R=s===124||h==="timeout"||s===143&&$>=Math.floor(b*.8),j=s===0?void 0:R?"timeout":h,T=s===0||!j?void 0:{category:j,exitCode:s,command:m,timedOut:R,timeoutMs:b,...O?{outputExcerpt:O}:{}};return {exitCode:s,command:m,errorCategory:j,healthStatus:v,failureDiagnostic:T,message:R?`Stage timed out after ${b}ms`:s!==0?O?`Stage failed with exit code ${s}: ${S[0]}`:`Stage failed with exit code ${s}`:void 0}}function Fe(e){try{return JSON.parse(e)}catch{return null}}function at(e){switch(e){case "dotnet":return "Install .NET 8+ SDK, then rerun `npx rapidkit setup dotnet` or `npx rapidkit init`.";case "go":return "Install Go 1.21+, then rerun `npx rapidkit setup go` or `npx rapidkit init`.";case "java":case "jvm-generic":return "Install Java 21+ and Maven/Gradle, then rerun `npx rapidkit setup java` or `npx rapidkit init`.";case "node":return "Install Node.js LTS and npm/pnpm/yarn, then rerun `npx rapidkit setup node` or `npx rapidkit init`.";case "python":return "Install Python 3.10+ and pip/Poetry, then rerun `npx rapidkit setup python` or `npx rapidkit init`.";default:return null}}async function it(e){let t=[],r=await oe(["doctor","workspace","--json"],e);if(r.exitCode!==0)t.push({gate:"doctor-workspace",status:"fail",summary:"doctor workspace command failed"});else {let a=Fe(r.stdout)?.healthScore,c=Number(a?.errors??0);Number.isFinite(c)&&c>0?t.push({gate:"doctor-workspace",status:"fail",summary:`doctor workspace reports ${c} error(s)`}):t.push({gate:"doctor-workspace",status:"pass",summary:"doctor workspace passed"});}let n=await oe(["readiness","--json"],e);if(n.exitCode!==0)t.push({gate:"readiness",status:"fail",summary:"readiness command failed"});else {let o=Fe(n.stdout),a=String(o?.overallStatus??"").toLowerCase();a==="fail"?t.push({gate:"readiness",status:"fail",summary:"readiness overall status is fail"}):a==="warn"?t.push({gate:"readiness",status:"warn",summary:"readiness overall status is warn"}):t.push({gate:"readiness",status:"pass",summary:"readiness overall status is pass"});}return t}var ct=new Set(["dev","stop"]);function ut(e){let t=e.trim();return !t||ct.has(t.toLowerCase())?false:Ke.has(t)?true:/^[a-z][a-z0-9_-]*$/i.test(t)}function Ae(e,t,r){let n=N(k.relative(r,t));return (Array.isArray(e.projects)?e.projects:[]).some(a=>{if(!a||typeof a!="object")return false;let c=a,u=[c.relativePath,c.path].filter(p=>typeof p=="string"&&p.length>0).map(p=>N(p));return c.status==="passed"&&(u.includes(n)||u.some(p=>p.endsWith(`/${n}`)))})}function dt(e,t){return te(e,t)?.dependencies??[]}function lt(e,t){let r=Math.max(1,Math.min(4,t)),n=Number(e??r);return Number.isFinite(n)?Math.max(1,Math.min(16,Math.trunc(n))):r}async function Kt(e$1){if(!ut(e$1.stage))throw new Error(`Unsupported workspace run stage: ${e$1.stage}`);let t=Date.now(),r=k.resolve(e$1.workspacePath),n=await d(r),o=await Ue(r),{projects:a$1,normalizedScope:c}=await qe(r,o,e$1.scope),u=e$1.affected===true,p=e$1.blastRadius===true,m=e$1.since?.trim()||"HEAD~1",g=u?await Ye(r,a$1,m):new Set(a$1),s,d$1="not-applicable",y=0,h="all";if(u&&p){let l=await Qe(r,o,g);s=l.expanded,d$1=l.graphStatus,y=l.expansionDepth,h="affected+blast-radius";}else u?(s=g,h="affected"):(s=g,h="all");let b$1=e$1.stage==="init"?false:await Ze(r,e$1.enforceGates),x=b$1?await it(r):[{gate:"doctor-workspace",status:"skipped",summary:"workspace run gates disabled"},{gate:"readiness",status:"skipped",summary:"workspace run gates disabled"}],v=x.find(l=>l.status==="fail"),S=a$1.filter(l=>s.has(l)),O=e$1.continueOnError===true||e$1.stage==="init",$=e$1.parallel===true,R=lt(e$1.maxWorkers,S.length),j=S.length,T=0;e$1.json||console.log(E.gray(`Workspace run (${e$1.stage}) started: ${j} target(s), ${$?`parallel x${R}`:"sequential"}`));let f=new Map;for(let l of o){let w=N(k.relative(r,l)),i=a$1.includes(l),F=i&&s.has(l);f.set(l,{path:l,relativePath:w,projectName:k.basename(w)||k.basename(l),selected:F,affected:F,status:"skipped",exitCode:null,durationMs:0,reason:F?void 0:i?"not affected":"outside scope",framework:void 0,runtimeDetected:void 0,executionCommand:void 0});}if(v)for(let l of S){let w=f.get(l);w&&(w.status="skipped",w.reason=`blocked by ${v.gate}`);}else {let l=async w=>{let i=f.get(w);if(!i)return;let F=N(k.relative(r,w));e$1.json||console.log(E.gray(`\u23F3 [${T}/${j}] ${e$1.stage} ${F}`)),i.selected=true,i.affected=true;let A=Date.now(),{runtime:P,framework:D,commandOverrides:De,environmentCommandVariants:Te,environment:We}=await ot(w);i.runtimeDetected=P,i.framework=D;let ue=Pe(w,e$1.stage);if(!ue.supported){i.status="skipped",i.reason=ue.reason??`stage "${e$1.stage}" unsupported for project`,i.durationMs=Date.now()-A,i.exitCode=null,T+=1;return}if(e$1.reusePassed&&n){let M=n.stages[e$1.stage]??n.stages[e$1.stage];if(M&&Ae(M,w,r)){i.status="passed",i.reason="reused passed result from workspace-run-last.json",i.durationMs=Date.now()-A,i.exitCode=0,T+=1,e$1.json||console.log(E.gray(`\u21BA reused passed cache for ${F}`));return}}let de=dt(P,D);if(de.length>0&&n){let M=de.find(Y=>{let L=n.stages[Y];return !L||!Ae(L,w,r)});if(M){i.status="skipped",i.reason=`dependency stage "${M}" not satisfied in workspace-run-last.json`,i.durationMs=Date.now()-A,i.exitCode=null,T+=1;return}}let W=await st(w,e$1.stage,P,D,De,Te,We);if(i.executionCommand=W.command,i.errorCategory=W.errorCategory,i.healthStatus=W.healthStatus,i.failureDiagnostic=W.failureDiagnostic,i.durationMs=Date.now()-A,i.exitCode=W.exitCode,W.exitCode===0?(i.status="passed",i.reason=void 0):(i.status="failed",i.reason=W.message||"stage command failed",i.errorMessage=W.message),T+=1,!e$1.json){let M=j>0?Math.round(T/j*100):100,Y=i.status==="passed"?E.green("\u2705"):E.red("\u274C");if(console.log(E.gray(`${Y} [${T}/${j}] (${M}%) ${F} ${i.durationMs}ms`)),i.status==="failed"){i.reason&&console.log(E.red(` Reason: ${i.reason}`)),i.executionCommand&&console.log(E.gray(` Command: ${i.executionCommand}`));let L=at(i.runtimeDetected);L&&i.errorCategory==="setup"&&console.log(E.gray(` Hint: ${L}`));}}};if($&&S.length>1){let w=0,i=false,F=new Array(R).fill(null).map(async()=>{for(;w<S.length;){if(i&&!O)return;let A=w;w+=1;let P=S[A];await l(P),f.get(P)?.status==="failed"&&(i=true);}});if(await Promise.all(F),!O&&i){let A=false;for(let P of S){let D=f.get(P);if(D){if(D.status==="failed"){A=true;continue}A&&D.status==="skipped"&&(D.reason=D.reason||"stopped after failure");}}}}else for(let w of S){await l(w);let i=f.get(w);if(!O&&i?.status==="failed"){let F=S.slice(S.indexOf(w)+1);for(let A of F){let P=f.get(A);P&&(P.status="skipped",P.reason="stopped after failure");}break}}}let C=[];for(let l of o){let w=f.get(l);w&&C.push(w);}let B=C.filter(l=>l.status==="passed").length,K=C.filter(l=>l.status==="failed").length,ae=C.filter(l=>l.status==="skipped").length,ie=e$1.strict===true,Ne=K>0||ie&&x.some(l=>l.status==="fail"||l.status==="warn")?1:0,ce={schemaVersion:"1.0",workspacePath:r,stage:e$1.stage,generatedAt:new Date().toISOString(),durationMs:Date.now()-t,options:{affected:u,blastRadius:p,since:u?m:null,parallel:$,maxWorkers:R,continueOnError:O,strict:ie,enforceGates:b$1,scope:c,reusePassed:e$1.reusePassed===true},selection:{mode:h,since:u?m:null,scope:c,graphStatus:d$1,expansionDepth:y},gates:{enforced:b$1,results:x,blocked:!!v,blockingGate:v?.gate},summary:{projectCount:o.length,selectedCount:S.length,passed:B,failed:K,skipped:ae,exitCode:Ne},projects:C,enterpriseControls:{jsonReady:true,evidencePath:b}},Oe=k.join(r,".rapidkit","reports",a);return await e(r,ce),e$1.json||(v&&(console.log(E.red(`\u274C Workspace run blocked by ${v.gate}`)),console.log(E.gray(` ${v.summary}`))),console.log(E.cyan(`Workspace run (${e$1.stage}) => passed: ${B}, failed: ${K}, skipped: ${ae}`)),console.log(E.gray(`Report: ${Oe}`))),ce}export{Kt as a};
|
package/dist/chunk-YBS2HGO3.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {a as a$1,c,i,g as g$1,h}from'./chunk-UZW5QFRW.js';import E from'fs';import a from'path';function S(e,t){let n=g$1({runtime:typeof e?.runtime=="string"?e.runtime:void 0,framework:typeof e?.framework=="string"?e.framework:void 0,kitName:typeof e?.kit_name=="string"?e.kit_name:typeof e?.kit=="string"?e.kit:void 0});return n.runtime!=="unknown"?n.runtime:i(t,e).runtime}function q(e){let t=e;for(;;){let n=a.join(t,".rapidkit","project.json");if(E.existsSync(n))try{return JSON.parse(E.readFileSync(n,"utf8"))}catch{return null}let r=a.dirname(t);if(r===t)break;t=r;}return null}function Ke(e,t){return S(e,t)==="go"}function Ge(e,t){return S(e,t)==="node"}function Je(e,t){return S(e,t)==="java"}function $e(e,t){return S(e,t)==="dotnet"}function We(e,t){return S(e,t)==="python"}var ue={dev:["dev","start:dev"],start:["start","start:prod","preview"],build:["build"],test:["test","test:unit","test:ci"],lint:["lint"],format:["format","prettier"]},H={nestjs:{dev:["dev","start:dev"],start:["start","start:prod"],build:["build"],test:["test","test:e2e"],lint:["lint"],format:["format"]},express:{dev:["dev","start:dev"],start:["start"],build:["build"],test:["test"],lint:["lint"],format:["format"]},fastify:{dev:["dev","start:dev"],start:["start"],build:["build"],test:["test"],lint:["lint"],format:["format"]},koa:{dev:["dev","start:dev"],start:["start"],build:["build"],test:["test"],lint:["lint"],format:["format"]}};function ce(e){let t=a.join(e,"package.json");if(!E.existsSync(t))return {};try{let r=JSON.parse(E.readFileSync(t,"utf8")).scripts??{};return Object.fromEntries(Object.entries(r).filter(i=>typeof i[1]=="string"))}catch{return {}}}function le(e,t){let n=t?c(t):"unknown",r=n!=="unknown"?a$1(n,e):[],i=t?H[t]?.[e]??[]:[],m=ue[e]??[],f=[...r,...i,...m];return [...new Set(f)]}function V(e,t,n){let r=ce(e),i=new Set(Object.keys(r));if(i.has(t))return {scriptName:t,source:"package.json"};for(let m of le(t,n?.framework))if(i.has(m))return {scriptName:m,source:a$1(c(n?.framework??"unknown"),t).includes(m)||H[n?.framework??""]?.[t]?.includes(m)?"framework-candidate":"generic-candidate"};return null}function F(e){return E.existsSync(a.join(e,"package.json"))}var de=["build","dev","start","test","lint","format"],O=["init","test","build","start"],Ze=["lint","format","docs"];function et(e){return !!e&&de.includes(e)}var g=["init","dev","start","build","test","lint","format","help"],X={python:{runtime:"python",displayName:"Python",tier:"first-class",scaffoldSupport:true,importSupport:true,lifecycleCommands:g,moduleCommands:true,doctorSupport:"full",notes:["Core-backed Python projects support RapidKit modules and lifecycle commands."]},node:{runtime:"node",displayName:"Node.js",tier:"extended",scaffoldSupport:true,importSupport:true,lifecycleCommands:g,moduleCommands:true,doctorSupport:"full",notes:["Node projects support npm-owned lifecycle commands; NestJS is the first-class Node framework."]},go:{runtime:"go",displayName:"Go",tier:"extended",scaffoldSupport:true,importSupport:true,lifecycleCommands:g,moduleCommands:false,doctorSupport:"readiness",notes:["Go projects support workspace governance and lifecycle commands via Go tooling."]},java:{runtime:"java",displayName:"Java / Spring Boot",tier:"extended",scaffoldSupport:true,importSupport:true,lifecycleCommands:g,moduleCommands:false,doctorSupport:"readiness",notes:["Java projects support Maven/Gradle lifecycle commands and workspace governance."]},dotnet:{runtime:"dotnet",displayName:".NET / ASP.NET Core",tier:"extended",scaffoldSupport:true,importSupport:true,lifecycleCommands:g,moduleCommands:false,doctorSupport:"readiness",notes:[".NET projects support dotnet CLI lifecycle commands and workspace governance."]},php:{runtime:"php",displayName:"PHP",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["PHP projects are importable and governed as observed projects until a kit exists."]},ruby:{runtime:"ruby",displayName:"Ruby",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Ruby projects are importable and governed as observed projects until a kit exists."]},rust:{runtime:"rust",displayName:"Rust",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Rust projects are importable and governed as observed projects until a kit exists."]},elixir:{runtime:"elixir",displayName:"Elixir",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Elixir projects are importable and governed as observed projects until a kit exists."]},clojure:{runtime:"clojure",displayName:"Clojure",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Clojure projects are importable and governed as observed projects until a kit exists."]},scala:{runtime:"scala",displayName:"Scala",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Scala projects are importable and governed as observed projects until a kit exists."]},kotlin:{runtime:"kotlin",displayName:"Kotlin",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Kotlin projects are importable and governed as observed projects until a kit exists."]},deno:{runtime:"deno",displayName:"Deno",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Deno projects are importable and governed as observed projects until a kit exists."]},bun:{runtime:"bun",displayName:"Bun",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Bun projects are importable and governed as observed projects until a kit exists."]},unknown:{runtime:"unknown",displayName:"Unknown",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Unknown projects are tracked safely but require manual command configuration."]}},pe=["fastapi","nestjs"],fe=["django","flask","nextjs","remix","nuxt","react","vite","vue","sveltekit","svelte","angular","astro","solid","express","fastify","koa","echo","gofiber","gogin","springboot","dotnet","laravel","symfony","rails","sinatra","actix","axum","rocket","phoenix","clojure","scala","kotlin","deno","bun"];function x(e){return X[e||"unknown"]??X.unknown}function z(e){return pe.includes(e)?"first-class":fe.includes(e)?"extended":"observed"}function Q(e){let t=x(e.runtime);return {lifecycleCommands:t.lifecycleCommands,moduleCommands:e.moduleSupport&&t.moduleCommands,unsupportedLifecycleCommands:g.filter(n=>!t.lifecycleCommands.includes(n))}}var ye=["python","node","go","java","dotnet"];function b(e){return !!e&&ye.includes(e)}function N(e,t){return t!=="lint"&&t!=="format"&&t!=="docs"?false:e==="python"}function Z(e){let t=x(e),n=b(t.runtime),r=Ce[t.runtime]??[],i=ge[t.runtime]??[];return {runtime:t.runtime,displayName:t.displayName,lifecycleCommands:t.lifecycleCommands,hasExecutor:n,packageManagers:r,primaryFiles:i,notes:t.notes}}var Ce={python:["poetry","pip","uv"],node:["npm","pnpm","yarn","bun"],go:["go"],java:["maven","gradle"],dotnet:["dotnet"],php:["composer"],ruby:["bundle"],rust:["cargo"],elixir:["mix"],kotlin:["gradle"],deno:["deno"],bun:["bun"]},ge={python:["pyproject.toml","requirements.txt","requirements.in"],node:["package.json"],go:["go.mod"],java:["pom.xml","build.gradle","build.gradle.kts"],dotnet:["*.csproj","*.sln"],php:["composer.json"],ruby:["Gemfile"],rust:["Cargo.toml"],elixir:["mix.exs"],kotlin:["settings.gradle.kts"],deno:["deno.json","deno.jsonc"],bun:["package.json","bunfig.toml"]};function be(e){let t=a.join(e,".rapidkit","context.json");if(!E.existsSync(t))return null;try{return JSON.parse(E.readFileSync(t,"utf8"))}catch{return null}}function ke(e){let t=e?.engine;return t==="npm"||t==="pip"||t==="python"?t:"unknown"}function Se(e,t,n){return e?.module_support===false||t?.module_support===false?false:e?.module_support===true||t?.module_support===true?true:!e&&t?false:n.runtime==="python"||n.runtime==="node"}function xe(e,t,n){let r=g$1({runtime:typeof t?.runtime=="string"?t.runtime:typeof n?.runtime=="string"?n.runtime:void 0,framework:typeof t?.framework=="string"?t.framework:typeof n?.framework=="string"?n.framework:void 0,kitName:typeof t?.kit_name=="string"?t.kit_name:typeof t?.kit=="string"?t.kit:typeof n?.kit=="string"?n.kit:void 0});return r.key!=="unknown"?r:i(e,t)}function ee(e){let t=a.resolve(e),n=a.join(t,".rapidkit","project.json"),r=a.join(t,".rapidkit","context.json");if(!E.existsSync(n)&&!E.existsSync(r))return null;let i=q(t),m=be(t),f=xe(t,i,m);return {projectRoot:t,projectJson:i,contextJson:m,detection:f,moduleSupport:Se(i,m,f),engine:ke(m)}}function te(e){let t=Z(e);return t.runtime==="unknown"&&e!=="unknown"?null:{runtime:t.runtime,displayName:t.displayName,supportedCommands:t.lifecycleCommands,packageManagers:t.packageManagers,primaryFiles:t.primaryFiles,notes:t.notes,hasExecutor:t.hasExecutor}}function s(e){try{return E.existsSync(e)}catch{return false}}function p(e){try{return s(e)?E.readFileSync(e,"utf8"):""}catch{return ""}}function u(e,t){let n=p(a.join(e,"Makefile"));return n?new RegExp(`^${t}\\s*:`).test(n):false}function je(e){let t=[e];for(;t.length>0;){let n=t.shift();if(!n)break;let r=[];try{r=E.readdirSync(n,{withFileTypes:true});}catch{continue}for(let i of r){if(i.name==="node_modules"||i.name===".git"||i.name==="dist")continue;let m=a.join(n,i.name);if(i.isFile()&&i.name.endsWith(".csproj"))return true;i.isDirectory()&&t.push(m);}}return false}function ne(e,t){let n=s(a.join(e,"pyproject.toml")),r=s(a.join(e,"requirements.txt"))||s(a.join(e,"requirements.in")),i=s(a.join(e,"manage.py"));switch(t){case "init":return n||r;case "dev":case "start":return n||i||r;case "test":return n||r||s(a.join(e,"tests"));case "build":return n||r;case "lint":case "format":return n||r||i||s(a.join(e,"setup.py"))||s(a.join(e,"setup.cfg"));default:return false}}function Re(e,t){if(!s(a.join(e,"go.mod")))return false;switch(t){case "init":return true;case "dev":return u(e,"run")||s(a.join(e,"main.go"));case "test":return true;case "build":return true;case "start":return u(e,"run")||s(a.join(e,"main.go"))||s(a.join(e,"cmd"));case "lint":return s(a.join(e,".golangci.yml"))||s(a.join(e,".golangci.yaml"))||u(e,"lint");case "format":return u(e,"fmt")||u(e,"format");default:return false}}function he(e,t){let n=s(a.join(e,"pom.xml")),r=s(a.join(e,"build.gradle"))||s(a.join(e,"build.gradle.kts"));if(!n&&!r)return false;switch(t){case "init":case "test":case "build":case "dev":case "start":return true;case "lint":return u(e,"lint")||p(a.join(e,"pom.xml")).includes("checkstyle")||p(a.join(e,"build.gradle")).includes("checkstyle")||p(a.join(e,"build.gradle.kts")).includes("checkstyle");case "format":return u(e,"format")||p(a.join(e,"build.gradle")).includes("spotless")||p(a.join(e,"build.gradle.kts")).includes("spotless");default:return false}}function Ne(e,t){if(!je(e))return false;switch(t){case "init":case "dev":case "test":case "build":case "start":return true;case "lint":return u(e,"lint")||p(a.join(e,"Directory.Build.props")).includes("EnforceCodeStyleInBuild");case "format":return u(e,"format")||s(a.join(e,".editorconfig"));default:return false}}function ve(e,t,n){return t==="init"?F(e):V(e,t,{framework:n})!==null}function Ee(e,t,n){switch(t){case "php":return n==="init"&&s(a.join(e,"composer.json"));case "ruby":return n==="init"&&s(a.join(e,"Gemfile"));case "rust":return s(a.join(e,"Cargo.toml"))?n==="init"||n==="test"||n==="build"||n==="start":false;case "elixir":return n==="init"&&s(a.join(e,"mix.exs"));case "deno":return s(a.join(e,"deno.json"))||s(a.join(e,"deno.jsonc"))?n==="init"||n==="dev"||n==="test"||n==="start":n==="init"&&s(a.join(e,"package.json"));case "bun":return s(a.join(e,"bunfig.toml"))||s(a.join(e,"bun.lock"))?n==="init"||n==="dev"||n==="test"||n==="build"||n==="start":n==="init"&&s(a.join(e,"package.json"));default:return false}}function P(e,t,n,r){if(N(t,n))return ne(e,n);if(!b(t))return Ee(e,t,n);switch(t){case "node":return ve(e,n,r);case "python":return ne(e,n);case "go":return Re(e,n);case "java":return he(e,n);case "dotnet":return Ne(e,n);default:return false}}function Pe(e,t,n){return ["init","dev","start","build","test","lint","format"].filter(i=>P(e,t,i,n))}function re(e){let t=Q({runtime:e.runtime,moduleSupport:e.moduleSupport});if(!e.projectPath)return t;let n=Pe(e.projectPath,e.runtime,e.framework),r=new Set(["help"]);for(let m of n)t.lifecycleCommands.includes(m)&&r.add(m);e.runtime==="node"&&F(e.projectPath)&&r.add("init");let i=[...r].sort();return {lifecycleCommands:i,moduleCommands:t.moduleCommands,unsupportedLifecycleCommands:t.lifecycleCommands.filter(m=>!i.includes(m)).sort()}}var T=["version","commands","doctor","project","help"],w=["init","dev","start","build","test","lint","format"],B=["add","modules","upgrade","diff","merge","reconcile","rollback","uninstall","checkpoint","snapshot","optimize"],I=["create","list","info","frameworks","license"];T.filter(e=>e!=="help");function we(e){let t=a.resolve(e);for(;;){let n=a.join(t,".rapidkit"),r=a.join(n,"project.json"),i=a.join(n,"context.json");if(E.existsSync(r)||E.existsSync(i))return t;let m=a.dirname(t);if(m===t)break;t=m;}return null}function j(e,t){return {command:e,...t}}var Me=new Set(["dev","lint","format"]),_e=new Set(O);function Ae(e,t){return t?_e.has(e)?{executionScope:"fleet",fleetEligible:true}:Me.has(e)?{executionScope:"local-only",fleetEligible:false}:{executionScope:"local-only",fleetEligible:false}:{executionScope:"local-only",fleetEligible:false}}function Le(e,t){return N(t.runtime,e)?"core":"runtime"}function Fe(e,t,n,r){return !e||!r.lifecycleCommands.includes(t)?false:P(e,n.runtime,t,n.key)}function Oe(e,t){let n=!!e&&(t.runtime==="python"||b(t.runtime)&&P(e,t.runtime,"build",t.key));return j("docs",{owner:t.runtime==="python"?"core":"runtime",status:n?"supported":"unsupported",reason:n?t.runtime==="python"?"Documentation generation is delegated to Python Core for this project.":"Project documentation commands are available through the npm wrapper for this runtime.":"Documentation commands require a supported Python or npm-executor project manifest."})}function De(e){let t=a.resolve(e),n=we(e);return n||(h(t).length>0?t:null)}function Te(e=process.cwd()){let t=De(e),n=t?ee(t):null,r=n?.detection??i(e,n?.projectJson??null),i$1=n?.moduleSupport??false,m=n?.engine??"unknown",f=te(r.runtime),U=x(r.runtime),ae=re({runtime:r.runtime,moduleSupport:i$1,projectPath:t??void 0,framework:r.key}),d={};for(let o of T)d[o]=j(o,{owner:o==="project"?"core":"npm",status:"supported",reason:o==="project"?"Project detection is a Core contract; workspace project lifecycle remains npm-owned.":o==="help"?"Help is available for every RapidKit project through the npm CLI.":"Universal command available across RapidKit project types."});for(let o of w){let y=Fe(t,o,r,ae),G=Le(o,r),M=Ae(o,y);d[o]=j(o,{owner:G,status:y?"supported":"unsupported",executionScope:M.executionScope,fleetEligible:M.fleetEligible,reason:y?G==="core"?`Delegated to Python Core for ${r.displayName} projects.`:M.fleetEligible?`Handled by runtime adapter and eligible for workspace fleet stages (${o}).`:o==="dev"?"Local development command only; workspace fleet excludes dev by design.":r.runtime==="node"?`Handled by npm/pnpm/yarn via the resolved ${o} script in package.json.`:`Handled by the ${f?.displayName??r.displayName} runtime adapter for local project execution.`:t?r.runtime==="node"?`No ${o} script was found in package.json for this ${r.displayName} project.`:b(r.runtime)?`The ${r.displayName} runtime is tracked, but ${o} is not available from detected project manifests.`:`${r.displayName} is tracked as an observed runtime; ${o} requires project manifests or explicit scripts.`:"No RapidKit project was detected."});}d.docs=Oe(t,r);for(let o of B)d[o]=j(o,{owner:i$1?"core":"none",status:i$1?"supported":"unsupported",reason:i$1?"Core module/template command supported for this project.":`Core module/template commands are not available for ${r.displayName} projects.`});for(let o of I)d[o]=j(o,{owner:o==="create"?"npm":"core",status:"global",reason:o==="create"?"Create is orchestrated by npm for multi-language workspace support.":"Engine catalog command; not specific to the selected project runtime."});let R=Object.values(d),K=R.filter(o=>w.includes(o.command)).filter(o=>o.status==="supported"),se=O.filter(o=>K.some(y=>y.fleetEligible===true&&y.command===o)),me=K.filter(o=>o.executionScope==="local-only").map(o=>o.command).sort();return {schemaVersion:1,scope:"project",projectRoot:t,engine:m,runtime:r.runtime,framework:r.key,frameworkDisplayName:r.displayName,frameworkConfidence:r.confidence,frameworkSupportTier:z(r.key),runtimeSupportTier:U.tier,runtimeDoctorSupport:U.doctorSupport,moduleSupport:i$1,fleetStages:se,localOnlyCommands:me,commandMap:d,supportedCommands:R.filter(o=>o.status==="supported").map(o=>o.command).sort(),unsupportedCommands:R.filter(o=>o.status==="unsupported").map(o=>o.command).sort(),globalCommands:R.filter(o=>o.status==="global").map(o=>o.command).sort()}}function It(e,t=process.cwd()){let n=e[0];return n?Te(t).commandMap[n]??null:null}function Ut(e){if(e[0]==="project"&&e[1]==="commands")return true;if(e[0]==="commands"&&e.includes("--scope")){let t=e.indexOf("--scope");return e[t+1]==="project"}return e.some(t=>t==="--scope=project")&&e[0]==="commands"}function Kt(e,t){return [`RapidKit command not supported for this project: ${e.command}`,"",`Project: ${t.projectRoot??"not detected"}`,`Runtime: ${t.runtime}`,`Framework: ${t.frameworkDisplayName}`,`Reason: ${e.reason??"Unsupported for this project type."}`,"","Run `rapidkit project commands` to inspect supported commands for this project."].join(`
|
|
2
|
-
`)}export{q as a,Ke as b,Ge as c,Je as d,$e as e,We as f,V as g,de as h,Ze as i,et as j,x as k,z as l,b as m,ee as n,re as o,we as p,Te as q,It as r,Ut as s,Kt as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{b as buildWorkspaceExplain,a as resolveWorkspaceExplainArtifactPath,c as writeWorkspaceExplainReport}from'./chunk-4RJESJ23.js';export{d as WORKSPACE_MODEL_DIFF_REPORT_PATH}from'./chunk-THSTNVE3.js';export{c as WORKSPACE_EXPLAIN_REPORT_PATH,e as WORKSPACE_TRACE_REPORT_PATH,d as WORKSPACE_WHY_REPORT_PATH}from'./chunk-GBJBQ43T.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as runWorkspaceStage}from'./chunk-WHQWVQJH.js';export{a as WORKSPACE_RUN_LAST_REPORT_FILENAME}from'./chunk-64RTZBHU.js';
|