rapidkit 0.34.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +137 -706
- package/contracts/backend-import-stack-parity.snapshot.json +36 -36
- package/contracts/infra-stack.v1.json +190 -47
- package/contracts/module-layout.v1.json +12 -3
- package/contracts/module-support.v1.json +20 -0
- package/contracts/runtime-command-surface.v1.json +139 -22
- package/contracts/workspace-intelligence/workspace-context.v1.json +59 -0
- package/contracts/workspace-intelligence/workspace-impact.v1.json +84 -0
- package/contracts/workspace-intelligence/workspace-model-diff.v1.json +105 -0
- package/contracts/workspace-intelligence/workspace-model-snapshot.v1.json +36 -0
- package/contracts/workspace-intelligence/workspace-model.v1.json +50 -0
- package/contracts/workspace-intelligence/workspace-verify.v1.json +111 -0
- package/dist/analyze-IIPDLLM2.js +1 -0
- package/dist/autopilot-release-EO7GQS4P.js +1 -0
- package/dist/chunk-5LLGW5TP.js +9 -0
- package/dist/{chunk-2PGMJSO5.js → chunk-752X3YI3.js} +84 -84
- package/dist/chunk-A5FBGRJA.js +1 -0
- package/dist/chunk-B7NCBH5B.js +2 -0
- package/dist/chunk-DKVWFHZO.js +4 -0
- package/dist/{chunk-3TBSWOTY.js → chunk-FNL34DKD.js} +13 -13
- package/dist/chunk-HHJAANUC.js +1 -0
- package/dist/chunk-KDUAZXEQ.js +3 -0
- package/dist/chunk-KMUWWZRT.js +1 -0
- package/dist/chunk-MCLLP6MW.js +2 -0
- package/dist/chunk-OCGZNSOE.js +1 -0
- package/dist/{chunk-RGXFDBYB.js → chunk-R4RPUW7I.js} +1 -1
- package/dist/chunk-TC2PSHT6.js +50 -0
- package/dist/chunk-UZW5QFRW.js +5 -0
- package/dist/chunk-VPNHGQIV.js +1 -0
- package/dist/chunk-YBS2HGO3.js +2 -0
- package/dist/chunk-YJ24EV3P.js +1 -0
- package/dist/create-LUXJGSNL.js +1 -0
- package/dist/{doctor-3SBEO7XU.js → doctor-DG3TBPZN.js} +1 -1
- package/dist/imported-projects-registry-ZOCHFWMK.js +1 -0
- package/dist/index.d.ts +29 -2
- package/dist/index.js +135 -129
- package/dist/module-layout-NZ43RSC5.js +1 -0
- package/dist/{pipeline-VUQ6AXKF.js → pipeline-7OTUIB6D.js} +1 -1
- package/dist/{workspace-AG2MQFTY.js → workspace-ZXWYIZOR.js} +1 -1
- package/dist/workspace-context-YFQQROOZ.js +2 -0
- package/dist/{workspace-contract-Z5VYUF3T.js → workspace-contract-A6QP7FPA.js} +1 -1
- package/dist/{workspace-foundation-G74V6K4U.js → workspace-foundation-TYLH5SAU.js} +1 -1
- package/dist/workspace-intelligence-NXIO55GJ.js +1 -0
- package/dist/workspace-model-OO4WOBJS.js +1 -0
- package/dist/workspace-run-AZ63D75J.js +1 -0
- package/dist/workspace-verify-K56NI3AI.js +1 -0
- package/package.json +14 -4
- package/dist/analyze-SVYRQNLO.js +0 -1
- package/dist/autopilot-release-LBKCP73F.js +0 -1
- package/dist/chunk-4E6ZGX6V.js +0 -1
- package/dist/chunk-ILY6QARY.js +0 -9
- package/dist/chunk-JIECGCLV.js +0 -4
- package/dist/chunk-KXTXQODI.js +0 -5
- package/dist/chunk-QCZGNOTH.js +0 -2
- package/dist/chunk-QUNCXYYK.js +0 -1
- package/dist/chunk-SAIWD6VM.js +0 -3
- package/dist/chunk-Y3UKTEZO.js +0 -2
- package/dist/chunk-YV7IQDBM.js +0 -50
- package/dist/create-BO2I3ESU.js +0 -1
- package/dist/module-layout-J56LHEGH.js +0 -1
- package/dist/workspace-run-EDM3SUPA.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{b as CANONICAL_MODULE_ROOT,f as MODULE_LAYOUT_FRAMEWORKS,a as MODULE_LAYOUT_SCHEMA_VERSION,c as MODULE_PATH_PATTERN,d as MODULE_SLUG_PATTERN,e as MODULE_SLUG_PREFIX,g as MODULE_UNSUPPORTED_MODULE_FRAMEWORKS,k as auditProjectModulePaths,l as auditWorkspaceModulePaths,h as isCanonicalModuleSlug,m as moduleLayoutContractSummary,i as resolveCanonicalModulePath,j as resolveCanonicalModuleRelativePath}from'./chunk-OCGZNSOE.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {b}from'./chunk-TC2PSHT6.js';import {a as a$1}from'./chunk-5LLGW5TP.js';import {a as a$3}from'./chunk-R4RPUW7I.js';import {a as a$2}from'./chunk-DKVWFHZO.js';import {a}from'./chunk-KMUWWZRT.js';import {b as b$1}from'./chunk-FNL34DKD.js';import c from'chalk';import x from'fs-extra';import u from'path';function D(s){return s===0?"pass":s===2?"warn":"fail"}function M(s){return s.some(r=>r.status==="fail")?"blocked":s.some(r=>r.status==="warn")?"needs-attention":"ready"}function j(s,r){if(r)return 3;let t=s.some(i=>i.status==="fail"),a=s.some(i=>i.status==="warn");return t?1:a?2:0}async function A(s){let r=await b$1(s,true),t=false;try{let{syncWorkspaceContract:a}=await import('./workspace-contract-A6QP7FPA.js');await a({workspacePath:s}),t=true;}catch{t=false;}return {sync:r,contractSynced:t}}async function C(s={}){let r=u.resolve(s.workspacePath??process.cwd()),t=a(r);if(!t)throw new Error("No RapidKit workspace found in current directory or parents");let a$4=[],i=[],l=false,p,f,d,g=Date.now();try{let{sync:e,contractSynced:o}=await A(t),n=e.workspaceFound&&(e.added.length>0||e.skipped>=0)||e.workspaceFound?"pass":"warn";a$4.push({name:"sync",status:n,durationMs:Date.now()-g,summary:e.workspaceFound?`registry sync complete (${e.added.length} added, ${e.skipped} existing)${o?", contract synced":""}`:"workspace not registered in global registry; contract sync attempted"}),e.workspaceFound||i.push("workspace registry entry missing \u2014 run rapidkit create workspace or register manually");}catch(e){l=true,a$4.push({name:"sync",status:"fail",durationMs:Date.now()-g,summary:`sync failed: ${e instanceof Error?e.message:String(e)}`}),i.push("workspace sync stage failed");}let y=Date.now();try{let e=await b({workspace:true,json:true,quiet:true,strict:s.strict===true,ci:s.strict!==true}),o=D(e),n=u.join(t,".rapidkit","reports","doctor-last-run.json");a$4.push({name:"doctor",status:o,durationMs:Date.now()-y,summary:o==="pass"?"doctor workspace passed":o==="warn"?"doctor workspace reported warnings":"doctor workspace reported errors",exitCode:e,evidencePath:n}),o==="fail"?i.push("doctor workspace gate failed"):o==="warn"&&i.push("doctor workspace reported warnings");}catch(e){l=true,a$4.push({name:"doctor",status:"fail",durationMs:Date.now()-y,summary:`doctor failed: ${e instanceof Error?e.message:String(e)}`}),i.push("doctor workspace stage failed");}if(s.skipAnalyze)a$4.push({name:"analyze",status:"skipped",durationMs:0,summary:"analyze stage skipped"});else {let e=Date.now();try{let o=await a$1({workspacePath:t,json:true,strict:s.strict===true});p=u.join(t,".rapidkit","reports","analyze-last-run.json");let n=o.summary.verdict==="blocked"?"fail":o.summary.verdict==="needs-attention"?"warn":"pass";a$4.push({name:"analyze",status:n,durationMs:Date.now()-e,summary:`analyze verdict: ${o.summary.verdict} (score ${o.summary.score}/100)`,evidencePath:p}),n==="fail"?i.push("analyze reported blocked verdict"):n==="warn"&&i.push("analyze reported needs-attention verdict");}catch(o){l=true,a$4.push({name:"analyze",status:"fail",durationMs:Date.now()-e,summary:`analyze failed: ${o instanceof Error?o.message:String(o)}`}),i.push("analyze stage failed");}}let w=Date.now();try{let e=await a$2({startPath:t,writeReport:true,skipVerify:s.skipVerify===true});f=e.evidencePath;let o=e.overallStatus==="pass"?"pass":e.overallStatus==="warn"?"warn":"fail";a$4.push({name:"readiness",status:o,durationMs:Date.now()-w,summary:`readiness overall: ${e.overallStatus}`,evidencePath:e.evidencePath}),o==="fail"?i.push(...e.blockingReasons.map(n=>`readiness: ${n}`)):o==="warn"&&i.push(...e.gates.filter(n=>n.status==="warn").map(n=>`readiness warn: ${n.gate}: ${n.summary}`));}catch(e){l=true,a$4.push({name:"readiness",status:"fail",durationMs:Date.now()-w,summary:`readiness failed: ${e instanceof Error?e.message:String(e)}`}),i.push("readiness stage failed");}if(s.skipAutopilot)a$4.push({name:"autopilot",status:"skipped",durationMs:0,summary:"autopilot stage skipped"});else {let e=Date.now(),o=s.autopilotMode??"audit";try{let n=await a$3({workspacePath:t,mode:o,json:true,skipPipelineStages:true});d=n.artifacts.reportPath;let k=n.summary.verdict==="approved"?"pass":n.summary.verdict==="partial"?"warn":"fail";a$4.push({name:"autopilot",status:k,durationMs:Date.now()-e,summary:`autopilot ${o}: ${n.summary.verdict}`,exitCode:n.summary.exitCode,evidencePath:d}),k!=="pass"&&i.push(...n.blockingReasons.slice(0,5));}catch(n){l=true,a$4.push({name:"autopilot",status:"fail",durationMs:Date.now()-e,summary:`autopilot failed: ${n instanceof Error?n.message:String(n)}`}),i.push("autopilot release stage failed");}}let E=M(a$4),z=j(a$4,l),m=u.join(t,".rapidkit","reports","pipeline-last-run.json"),h={schemaVersion:"rapidkit-pipeline-v1",generatedAt:new Date().toISOString(),workspacePath:t,summary:{verdict:E,exitCode:z,stagesPassed:a$4.filter(e=>e.status==="pass").length,stagesWarn:a$4.filter(e=>e.status==="warn").length,stagesFailed:a$4.filter(e=>e.status==="fail").length},stages:a$4,blockingReasons:[...new Set(i)],artifacts:{reportPath:m,analyzeEvidencePath:p,readinessEvidencePath:f,autopilotEvidencePath:d}};return s.writeReport!==false&&(await x.ensureDir(u.dirname(m)),await x.writeJSON(m,h,{spaces:2})),h}async function L(s){let r;try{r=await C(s);}catch(t){let a=t instanceof Error?t.message:String(t);s.json?console.log(JSON.stringify({schemaVersion:"rapidkit-pipeline-error-v1",ok:false,error:{message:a}},null,2)):console.log(c.red(`Pipeline failed: ${a}`)),process.exit(1);}if(s.json)console.log(JSON.stringify(r,null,2));else {console.log(c.bold.cyan(`
|
|
2
2
|
\u{1F517} RapidKit Governance Pipeline
|
|
3
3
|
`)),console.log(c.bold(`Workspace: ${c.cyan(u.basename(r.workspacePath))}`)),console.log(c.gray(`Path: ${r.workspacePath}`)),console.log(c.white(`Verdict: ${r.summary.verdict} Exit: ${r.summary.exitCode} (${r.summary.stagesPassed} pass / ${r.summary.stagesWarn} warn / ${r.summary.stagesFailed} fail)`));for(let t of r.stages){let a=t.status==="pass"?c.green("PASS"):t.status==="warn"?c.yellow("WARN"):t.status==="skipped"?c.gray("SKIP"):c.red("FAIL");console.log(` - ${t.name}: ${a} ${t.summary}`);}if(r.blockingReasons.length>0){console.log(c.bold(`
|
|
4
4
|
Blocking reasons:`));for(let t of r.blockingReasons.slice(0,8))console.log(c.gray(` \u2022 ${t}`));}console.log(c.gray(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{e as createProject,d as createWorkspace,g as createWorkspaceShareBundle,f as listWorkspaces,c as registerProjectInWorkspace,a as registerWorkspace,b as syncWorkspaceProjects}from'./chunk-
|
|
1
|
+
export{e as createProject,d as createWorkspace,g as createWorkspaceShareBundle,f as listWorkspaces,c as registerProjectInWorkspace,a as registerWorkspace,b as syncWorkspaceProjects}from'./chunk-FNL34DKD.js';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {d}from'./chunk-VPNHGQIV.js';import d$1 from'path';import l from'fs-extra';var k="workspace-context.v1",f=".rapidkit/reports/workspace-context-agent.json";function w(e){if(typeof e!="string"||!e.trim()||e==="true")return "generic";let t=e.trim().toLowerCase();return t==="codex"||t==="claude"||t==="cursor"||t==="orca"?t:"generic"}function h(e){return `npx --yes --package rapidkit rapidkit ${e}`.trim()}function y(e){return `npx rapidkit ${e}`.trim()}function i(e){return {id:e.id,scope:e.scope,display:y(e.args),execute:h(e.args),description:e.description,...e.project?{project:e.project}:{}}}function g(e,t){return `workspace run ${t} --scope project:${e.name}`}function j(e){return (e.startsWith("project:")?e.slice(8):e).trim().toLowerCase()}function x(e){return [e.name,e.path,d$1.basename(e.path),e.absolutePath].filter(t=>typeof t=="string"&&t.trim().length>0).map(t=>t.trim().toLowerCase())}function C(e,t){let s=[i({id:"workspace.model",scope:"workspace",args:"workspace model --json",description:"Read the canonical workspace intelligence model."}),i({id:"workspace.doctor",scope:"workspace",args:"doctor workspace --json",description:"Check workspace health before claiming verification."}),i({id:"workspace.pipeline",scope:"workspace",args:"pipeline --json",description:"Run the governed sync, doctor, analyze, readiness, and autopilot loop."}),i({id:"workspace.contract.verify",scope:"workspace",args:"workspace contract verify --json",description:"Verify workspace contract and dependency edges."})],o=t?[t]:e.projects;for(let r of o)r.commands.fleetStages.includes("test")&&s.push(i({id:`project.${r.name}.test`,scope:"project",project:r.name,args:g(r,"test"),description:`Run tests for ${r.name} through workspace orchestration.`})),r.commands.fleetStages.includes("build")&&s.push(i({id:`project.${r.name}.build`,scope:"project",project:r.name,args:g(r,"build"),description:`Build ${r.name} through workspace orchestration.`}));return s}function W(e){return e.commands.fleetStages.filter(t=>t==="test"||t==="build").map(t=>`workspace run ${t}`)}function v(e,t){if(!t?.startsWith("project:"))return;let s=j(t);if(s)return e.projects.find(o=>x(o).includes(s))}function b(e,t,s){let o=[...e.validation?.issues??[]];t?.startsWith("project:")&&!s&&o.push({severity:"error",code:"context.scope.project.missing",message:`Requested project scope was not found: ${t}`,target:t});let r=o.filter(a=>a.severity==="error").length,c=o.filter(a=>a.severity==="warning").length;return {status:r>0?"failed":c>0?"warning":"passed",errors:r,warnings:c,issues:o}}function S(e){let t=[],s=[];for(let[o,r]of Object.entries(e.evidence))r?.exists?t.push(`${o}: ${r.path}`):s.push(o);return {available:t.sort(),missing:s.sort()}}function P(e){let t=e.summary.projectCount,s=e.summary.runtimes.length?e.summary.runtimes.join(", "):"no runtime",o=e.identity.surfaces.length?e.identity.surfaces.join(", "):"no detected surfaces";return `${e.workspace.name} is a ${e.identity.workspaceType} with ${t} project${t===1?"":"s"}, ${s} runtime coverage, and ${o}.`}function A(e){let t=["Do not claim a command passed unless a report or command output proves it.","Do not infer secrets or environment values from file names.","Do not change project scope without checking the selected project."];return e.contracts.exists||t.push("Workspace contract is missing; dependency and API edges may be incomplete."),e.summary.observedProjects>0&&t.push("Some projects are observed rather than first-class; command support may be partial."),t}async function O(e){let t=e.model??await d({workspacePath:e.workspacePath,includeEvidence:e.includeEvidence===true,observableScanDepth:e.observableScanDepth,now:e.now}),s=w(e.agent),o=v(t,e.scope),r=b(t,e.scope,o);if(e.strict===true&&r.status!=="passed"){let n=r.issues.map(p=>`${p.severity}:${p.code}:${p.target}`).join(", ");throw new Error(`Workspace context strict validation failed: ${n}`)}let c=(o?[o]:t.projects).map(n=>({name:n.name,path:n.path,kind:n.kind,runtime:n.runtime,framework:n.frameworkDisplayName,...n.generator?{generator:n.generator}:{},supportTier:n.supportTier,safeCommands:W(n),importantFiles:n.importantFiles})),a=S(t),m=P(t);return {schemaVersion:k,generatedAt:(e.now??new Date).toISOString(),agent:s,workspaceSummary:m,modelRef:".rapidkit/reports/workspace-model.json",workspace:{name:t.workspace.name,root:t.workspace.root,type:t.identity.workspaceType,...t.workspace.profile?{profile:t.workspace.profile}:{}},scope:{requested:e.scope??"workspace",...o?{activeProject:o.name}:{}},projects:c,safeCommands:C(t,o),evidence:a,policies:{mode:t.policies.mode,source:t.policies.source},contracts:{exists:t.contracts.exists,path:t.contracts.workspaceContractPath},validation:r,agentInstructions:["Use this context as the workspace source of truth before inspecting random files.","Prefer workspace-level evidence over generic framework assumptions.","Use `display` commands when explaining steps to a human.","Use `execute` commands when launching commands from automation or tooling.","Keep project-scoped advice tied to the active project scope."],unsafeAssumptions:A(t),humanSummary:[m,`Evidence available: ${a.available.length}. Missing evidence groups: ${a.missing.join(", ")||"none"}.`,o?`Active project scope: ${o.name} (${o.frameworkDisplayName}).`:"Scope: whole workspace."].join(`
|
|
2
|
+
`)}}async function D(e,t){let s=d$1.join(t,f);return await l.ensureDir(d$1.dirname(s)),await l.writeJSON(s,e,{spaces:2}),s}export{f as WORKSPACE_CONTEXT_AGENT_REPORT_PATH,k as WORKSPACE_CONTEXT_SCHEMA_VERSION,O as buildWorkspaceAgentContext,D as writeWorkspaceAgentContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as WORKSPACE_CONTRACT_PATH,b as WORKSPACE_CONTRACT_SCHEMA_VERSION,d as buildWorkspaceContract,h as buildWorkspaceContractGraph,c as discoverProjectJsonFiles,g as readWorkspaceContract,f as syncWorkspaceContract,i as verifyWorkspaceContract,e as writeWorkspaceContract}from'./chunk-
|
|
1
|
+
export{a as WORKSPACE_CONTRACT_PATH,b as WORKSPACE_CONTRACT_SCHEMA_VERSION,d as buildWorkspaceContract,h as buildWorkspaceContractGraph,c as discoverProjectJsonFiles,g as readWorkspaceContract,f as syncWorkspaceContract,i as verifyWorkspaceContract,e as writeWorkspaceContract}from'./chunk-MCLLP6MW.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-
|
|
1
|
+
import {a as a$1}from'./chunk-752X3YI3.js';import {a}from'./chunk-RV6HBTFC.js';import c from'path';import d from'fs-extra';async function v(e,r){let o=await a(e),f=o?.name||c.basename(e),n,i=c.join(e,".python-version");if(await d.pathExists(i)){let a=(await d.readFile(i,"utf-8")).trim();a&&(n=a);}let t=r?.profile||"polyglot",u=t==="python-only"||t==="polyglot"||t==="enterprise",m=r?.installMethod||o?.metadata?.npm?.installMethod||(u?"poetry":"venv"),s=await a$1(e,{workspaceName:f,installMethod:m,pythonVersion:n,profile:t,writeMarker:true,writeGitignore:true,onlyIfMissing:!r?.force});return {workspacePath:e,created:s,status:s.length>0?"passed":"skipped"}}export{v as ensureWorkspaceFoundation};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{f as WORKSPACE_IMPACT_REPORT_PATH,e as WORKSPACE_IMPACT_SCHEMA_VERSION,d as WORKSPACE_MODEL_DIFF_REPORT_PATH,b as WORKSPACE_MODEL_DIFF_SCHEMA_VERSION,c as WORKSPACE_MODEL_SNAPSHOT_REPORT_PATH,a as WORKSPACE_MODEL_SNAPSHOT_SCHEMA_VERSION,n as buildWorkspaceImpact,i as buildWorkspaceModelSnapshot,k as diffWorkspaceModel,g as isGitDiffSource,h as parseGitDiffRef,m as workspaceVerificationPlan,o as writeWorkspaceImpact,l as writeWorkspaceModelDiff,j as writeWorkspaceModelSnapshot}from'./chunk-B7NCBH5B.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{b as WORKSPACE_MODEL_REPORT_PATH,a as WORKSPACE_MODEL_SCHEMA_VERSION,d as buildWorkspaceModel,c as validateWorkspaceModelStrict,e as writeWorkspaceModel}from'./chunk-VPNHGQIV.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as runWorkspaceStage}from'./chunk-KDUAZXEQ.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {m,f as f$1,c as c$1,n,e}from'./chunk-B7NCBH5B.js';import {d}from'./chunk-VPNHGQIV.js';import c from'path';import f from'fs-extra';var j="workspace-verify.v1",E=".rapidkit/reports/workspace-verify-last-run.json";function R(e,t){return c.isAbsolute(t)?t:c.join(e,t)}async function W(e$1){let t=await f.readJson(e$1);if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Workspace impact input is not a JSON object: ${e$1}`);let r=t;if(r.schemaVersion!==e)throw new Error(`Unsupported workspace impact schema: ${String(r.schemaVersion)}`);return r}function S(e){let t=new Set,r=[];for(let a of e){let i=`${a.scope}:${a.project??""}:${a.display}`;t.has(i)||(t.add(i),r.push(a));}return r}function C(e,t){if(!e||e==="workspace")return true;let r=(e.startsWith("project:")?e.slice(8):e).trim().toLowerCase();return t.scope==="workspace"?true:(t.project??"").trim().toLowerCase()===r}function I(e,t){if(e.id==="workspace.doctor")return c.join(t,".rapidkit","reports","doctor-last-run.json");if(e.id==="workspace.contract.verify")return c.join(t,".rapidkit","reports","workspace-contract-verify-last-run.json");if(e.id==="workspace.readiness")return c.join(t,".rapidkit","reports","release-readiness-last-run.json");if(e.id==="workspace.analyze")return c.join(t,".rapidkit","reports","analyze-last-run.json");if(e.id==="workspace.pipeline")return c.join(t,".rapidkit","reports","pipeline-last-run.json");if(e.id.startsWith("project.")&&(e.id.endsWith(".test")||e.id.endsWith(".build")))return c.join(t,".rapidkit","reports","workspace-run-last.json")}function l(e){return !e||typeof e!="object"||Array.isArray(e)?null:e}function V(e){let t=l(e.healthScore),r=typeof t?.errors=="number"?t.errors:0,a=typeof t?.percent=="number"?t.percent:void 0;return r>0?{status:"fail",message:`Doctor evidence reports ${r} error(s).`}:typeof a=="number"&&a<70?{status:"warn",message:`Doctor health score is ${a}%.`}:{status:"pass",message:"Doctor evidence is present and healthy."}}function A(e){let t=typeof e.overallStatus=="string"?e.overallStatus:"unknown";return t==="fail"?{status:"fail",message:"Release readiness evidence reports blocking failures."}:t==="warn"?{status:"warn",message:"Release readiness evidence reports warnings."}:t==="pass"?{status:"pass",message:"Release readiness evidence passed."}:{status:"warn",message:`Release readiness evidence status is ${t}.`}}function x(e){let t=typeof e.status=="string"?e.status:"unknown";return t==="failed"||t==="fail"?{status:"fail",message:"Workspace contract verify evidence failed."}:t==="passed"||t==="pass"?{status:"pass",message:"Workspace contract verify evidence passed."}:{status:"warn",message:`Workspace contract verify evidence status is ${t}.`}}function O(e){let t=l(e.summary);if(t?.blocking===true||e.blocking===true)return {status:"fail",message:"Analyze evidence reports blocking findings."};let a=typeof t?.status=="string"?t.status:void 0;return a==="warn"||a==="warning"?{status:"warn",message:"Analyze evidence reports warnings."}:{status:"pass",message:"Analyze evidence is present."}}function $(e){let t=l(e.summary),r=typeof t?.verdict=="string"?t.verdict:void 0;return r==="blocked"?{status:"fail",message:"Pipeline evidence is blocked."}:r==="needs-attention"?{status:"warn",message:"Pipeline evidence needs attention."}:r==="ready"?{status:"pass",message:"Pipeline evidence is ready."}:{status:"warn",message:"Pipeline evidence status is unknown."}}function _(e,t){let r=t.id.endsWith(".build")?"build":t.id.endsWith(".test")?"test":null,a=typeof e.stage=="string"?e.stage:void 0;if(r&&a&&a!==r)return {status:"missing",message:`Workspace run evidence is for stage "${a}", expected "${r}".`};let i=l(e.summary),o=typeof i?.failed=="number"?i.failed:0,n=typeof i?.exitCode=="number"?i.exitCode:0,m=Array.isArray(e.projects)?e.projects:[],p=t.project?.toLowerCase(),d=m.find(s=>{let u=l(s);if(!u||!p)return false;let P=typeof u.projectName=="string"?u.projectName.toLowerCase():"",y=typeof u.projectPath=="string"?u.projectPath.toLowerCase():"";return P===p||y.endsWith(`/${p}`)||y===p});if(d){let s=l(d),u=typeof s?.status=="string"?s.status:"unknown";if(u==="failed")return {status:"fail",message:`Workspace run evidence failed for ${t.project}.`};if(u==="passed")return {status:"pass",message:`Workspace run evidence passed for ${t.project}.`};if(u==="skipped")return {status:"warn",message:`Workspace run evidence skipped for ${t.project}.`}}return o>0||n!==0?{status:"fail",message:"Workspace run evidence reports failures."}:{status:"pass",message:"Workspace run evidence is present."}}async function M(e,t,r){let a=I(e,t),i=a?c.relative(t,a).split(c.sep).join("/"):void 0;if(e.id==="workspace.contract.verify"&&!r)return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"skipped",required:e.required,message:"Workspace contract is not present; contract verify skipped."};if(!a||!await f.pathExists(a))return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"missing",required:e.required,evidencePath:i,message:i?`Missing evidence report: ${i}`:"No evidence mapping exists for this command."};let o=l(await f.readJson(a));if(!o)return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"fail",required:e.required,evidencePath:i,message:"Evidence report is not a JSON object."};let n;return e.id==="workspace.doctor"?n=V(o):e.id==="workspace.readiness"?n=A(o):e.id==="workspace.contract.verify"?n=x(o):e.id==="workspace.analyze"?n=O(o):e.id==="workspace.pipeline"?n=$(o):e.id.startsWith("project.")?n=_(o,e):n={status:"pass",message:"Evidence report is present."},{id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:n.status,required:e.required,evidencePath:i,message:n.message}}function D(e){let t=e.filter(s=>s.status==="pass").length,r=e.filter(s=>s.status==="warn").length,a=e.filter(s=>s.status==="fail").length,i=e.filter(s=>s.status==="missing").length,o=e.filter(s=>s.status==="skipped").length,n=e.filter(s=>s.required&&(s.status==="fail"||s.status==="missing")).map(s=>`${s.id}: ${s.message}`),m=e.filter(s=>s.required&&s.status==="missing").length,p="ready",d=0;return n.length>0?(p="blocked",d=2):(r>0||m>0)&&(p="needs-attention",d=1),{verdict:p,exitCode:d,stepsPassed:t,stepsWarn:r,stepsFailed:a,stepsMissing:i,stepsSkipped:o}}async function q(e$1){let t=c.resolve(e$1.workspacePath);if(e$1.fromImpactPath){let o=R(t,e$1.fromImpactPath);return {impact:await W(o),fromImpactRef:c.relative(t,o).split(c.sep).join("/")}}let r=c.join(t,f$1);if(await f.pathExists(r))return {impact:await W(r),fromImpactRef:f$1};let a=c.join(t,c$1);if(await f.pathExists(a))return {impact:await n({workspacePath:t,fromPath:c$1,scope:e$1.scope,includeAbsolutePaths:e$1.includeAbsolutePaths,includeEvidence:e$1.includeEvidence,observableScanDepth:e$1.observableScanDepth,now:e$1.now}),fromImpactRef:c$1};let i=await d({workspacePath:t,includeAbsolutePaths:e$1.includeAbsolutePaths,includeEvidence:e$1.includeEvidence,observableScanDepth:e$1.observableScanDepth,now:e$1.now});return {impact:{schemaVersion:e,generatedAt:(e$1.now??new Date).toISOString(),fromRef:"baseline",diffRef:".rapidkit/reports/workspace-model-diff-last-run.json",workspace:{name:i.workspace.name,profile:i.workspace.profile,type:i.workspace.type},summary:{changed:false,risk:"none",affectedProjects:0,workspaceItems:0,recommendedCommands:0},affectedProjects:[],workspaceImpact:[],verificationPlan:[],agentBrief:{headline:"Baseline workspace verify run.",bullets:["No impact report or snapshot was available; baseline gates were evaluated."],unsafeAssumptions:["Do not claim runtime verification passed unless evidence exists."]},diff:{schemaVersion:"workspace-model-diff.v1",generatedAt:(e$1.now??new Date).toISOString(),fromRef:"baseline",toRef:".rapidkit/reports/workspace-model.json",fromHash:"baseline",toHash:"baseline",summary:{changed:false,addedProjects:0,removedProjects:0,changedProjects:0,workspaceChanges:0,validationChanges:0,gitChangedFiles:0},git:{available:false,dirty:false,changedFiles:0,untrackedFiles:0,deletedFiles:0},changes:[],currentModel:i}}}}async function K(e){let t=c.resolve(e.workspacePath),{impact:r,fromImpactRef:a}=await q(e),i=r.diff.currentModel,o=S([...m(),...r.verificationPlan]).filter(s=>C(e.scope,s)),n=[];for(let s of o)n.push(await M(s,t,i.contracts.exists===true));let m$1=D(n),p=n.filter(s=>s.status==="missing"&&s.evidencePath).map(s=>s.evidencePath),d=n.filter(s=>s.required&&(s.status==="fail"||s.status==="missing")).map(s=>`${s.id}: ${s.message}`);return {schemaVersion:j,generatedAt:(e.now??new Date).toISOString(),workspacePath:t,mode:"evidence",fromImpactRef:a,scope:e.scope,impact:{changed:r.summary.changed,risk:r.summary.risk,affectedProjects:r.summary.affectedProjects,recommendedCommands:r.summary.recommendedCommands},summary:m$1,steps:n,missingEvidence:p,blockingReasons:d,verificationPlan:o}}async function L(e,t){let r=c.join(t,E);return await f.ensureDir(c.dirname(r)),await f.writeJson(r,e,{spaces:2}),r}function J(e,t){return e.summary.verdict==="blocked"?2:t?.strict&&e.summary.verdict!=="ready"?1:e.summary.exitCode}export{E as WORKSPACE_VERIFY_REPORT_PATH,j as WORKSPACE_VERIFY_SCHEMA_VERSION,K as buildWorkspaceVerify,J as workspaceVerifyExitCode,L as writeWorkspaceVerify};
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rapidkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "Official CLI for RapidKit
|
|
5
|
+
"description": "Official CLI for RapidKit — workspace-first platform to create, adopt, govern, and operate polyglot projects (Python, Node, Go, Java, .NET, frontend) with shared evidence for CI, Workspai, and AI agents.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"rapidkit",
|
|
8
8
|
"workspai",
|
|
@@ -10,13 +10,18 @@
|
|
|
10
10
|
"cli",
|
|
11
11
|
"create",
|
|
12
12
|
"workspace",
|
|
13
|
+
"workspace-intelligence",
|
|
14
|
+
"governance",
|
|
15
|
+
"backend",
|
|
16
|
+
"frontend",
|
|
13
17
|
"fastapi",
|
|
14
18
|
"nestjs",
|
|
19
|
+
"nextjs",
|
|
20
|
+
"react",
|
|
15
21
|
"springboot",
|
|
16
22
|
"spring",
|
|
17
23
|
"gofiber",
|
|
18
24
|
"gogin",
|
|
19
|
-
"backend",
|
|
20
25
|
"microservices",
|
|
21
26
|
"api",
|
|
22
27
|
"generator",
|
|
@@ -60,7 +65,10 @@
|
|
|
60
65
|
"test:drift": "node scripts/run-drift-guard.mjs",
|
|
61
66
|
"sync:parity-snapshot": "node scripts/sync-import-stack-parity-snapshot.mjs",
|
|
62
67
|
"check:parity-snapshot": "node scripts/sync-import-stack-parity-snapshot.mjs --check",
|
|
63
|
-
"
|
|
68
|
+
"generate:contracts": "node scripts/generate-shared-contracts.mjs",
|
|
69
|
+
"check:generated-contracts": "node scripts/generate-shared-contracts.mjs --check",
|
|
70
|
+
"validate:contracts": "npm run check:generated-contracts && npm run check:parity-snapshot && vitest run src/__tests__/contracts/",
|
|
71
|
+
"test:parity-contract": "npm run check:parity-snapshot && vitest run src/__tests__/contracts/import-stack-parity.snapshot.test.ts",
|
|
64
72
|
"test:watch": "vitest",
|
|
65
73
|
"test:coverage": "vitest run --coverage",
|
|
66
74
|
"test:prepare-embeddings": "node scripts/prepare-mock-embeddings.mjs",
|
|
@@ -87,6 +95,8 @@
|
|
|
87
95
|
"check:docs-drift": "node scripts/docs-drift-guard.mjs",
|
|
88
96
|
"smoke:readme": "node scripts/smoke-readme-commands.mjs",
|
|
89
97
|
"validate:docs": "npm run check:markdown-links && npm run check:docs-drift && npm run validate:docs-examples && npm run smoke:readme",
|
|
98
|
+
"smoke:frontend-generators": "node ./node_modules/tsup/dist/cli-default.js && node scripts/smoke-frontend-generators.mjs",
|
|
99
|
+
"smoke:frontend-generators:network": "node ./node_modules/tsup/dist/cli-default.js && node scripts/smoke-frontend-generators.mjs --execute",
|
|
90
100
|
"sync:contracts": "node scripts/sync-contracts.mjs",
|
|
91
101
|
"check:contracts": "node scripts/sync-contracts.mjs --check",
|
|
92
102
|
"bundle-size": "npm run build && node scripts/report-dist-size.mjs",
|
package/dist/analyze-SVYRQNLO.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{b as printAnalyzeReport,a as runAnalyze}from'./chunk-ILY6QARY.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as runAutopilotRelease}from'./chunk-RGXFDBYB.js';
|
package/dist/chunk-4E6ZGX6V.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import i from'path';import a from'fs-extra';var h="rapidkit.module-layout.v1",c="src/modules/free",f="src/modules/free/{category}/{module}",m="free/{category}/{module}",d="free/";function p(t){return t.replace(/\\/g,"/")}function g(t){return typeof t=="string"&&t.startsWith(d)}function P(t,s){if(!g(s))throw new Error(`Module slug must start with ${d}: ${s}`);let e=i.join(c,...s.split("/").slice(1));return i.join(t,e)}function R(t){if(!g(t))throw new Error(`Module slug must start with ${d}: ${t}`);return p(i.join(c,...t.split("/").slice(1)))}async function y(t){return await a.pathExists(t)?(await a.stat(t)).isDirectory():false}async function M(t){let s=i.join(t,"registry.json"),e=[],r=0;if(!await a.pathExists(s))return {status:"passed",projectCount:1,moduleCount:0,issues:e};let n=await a.readJson(s);for(let l of n.installed_modules||[]){let u=l?.slug;if(!g(u))continue;r+=1;let o=P(t,u);await y(o)||e.push({projectRoot:t,registryPath:s,slug:u,expectedPath:o,message:`Missing canonical module directory: ${p(i.relative(t,o))}`});}return {status:e.length>0?"failed":"passed",projectCount:1,moduleCount:r,issues:e}}async function A(t){let s=await x(t),e=[],r=[],n=0;for(let l of s){let u=i.dirname(l),o=await M(u);n+=o.moduleCount,r.push(...o.issues),e.push({projectRoot:u,moduleCount:o.moduleCount,issueCount:o.issues.length,status:o.status});}return {workspacePath:t,status:r.length>0?"failed":"passed",projectCount:e.length,moduleCount:n,issues:r,projects:e}}async function x(t){let s=await a.readdir(t,{withFileTypes:true}),e=[];for(let r of s){if(!r.isDirectory())continue;let n=i.join(t,r.name,"registry.json");await a.pathExists(n)&&e.push(n);}return e.sort()}function _(){return {schemaVersion:h,canonicalModuleRoot:c,pathPattern:f,slugPattern:m}}export{h as a,c as b,f as c,m as d,d as e,g as f,P as g,R as h,M as i,A as j,_ as k};
|
package/dist/chunk-ILY6QARY.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import {a}from'./chunk-QUNCXYYK.js';import {d,e}from'./chunk-KXTXQODI.js';import {a as a$1}from'./chunk-VKLL63TL.js';import h from'fs';import o from'path';import s from'chalk';var F=new Set([".git",".rapidkit",".venv","node_modules","dist","build","target","coverage","htmlcov",".next"]);async function y(e){try{return await h.promises.access(e,h.constants.F_OK),true}catch{return false}}async function v(e){try{let n=JSON.parse(await h.promises.readFile(e,"utf-8"));return n&&typeof n=="object"&&!Array.isArray(n)?n:null}catch{return null}}async function I(e){try{return await h.promises.readFile(e,"utf-8")}catch{return ""}}function G(e){return a(e)}async function E(e,n){return await y(o.join(e,".rapidkit","project.json"))||await y(o.join(e,".rapidkit","context.json"))?true:o.resolve(e)===o.resolve(n)?d(e).length>0:d(e).length>0}async function S(e){let n=await a$1(e,{skipDirs:F,includeHiddenDirs:false,descendIntoMatchedProjects:false,isProjectDir:E});return n.length>0?n:d(e).length>0?[e]:[]}function T(e,n){return o.relative(e,n).replace(/\\/g,"/")||"."}async function b(e,n){for(let t of n)if(await y(o.join(e,t)))return true;return false}async function N(e){return b(e,["health","health.ts","health.js","health.py","health.go","health.kt","health.rb","health.php","healthcheck","health-check","src/health.ts","src/health.js","src/health.py","src/health.go","src/health.kt","src/health.rb","src/health.php","src/healthcheck.ts","src/healthcheck.js","src/liveness.ts","src/readiness.ts","src/ping.ts"])}async function K(e){if(await b(e,["tests","test","__tests__","src/__tests__","pytest.ini","vitest.config.ts","jest.config.ts"]))return true;let t=await v(o.join(e,"package.json")),i=t?.scripts&&typeof t.scripts=="object"?t.scripts:{};return typeof i.test=="string"&&i.test.trim().length>0}async function O(e){let n=await v(o.join(e,"package.json")),t=n?.scripts&&typeof n.scripts=="object"?n.scripts:{};return Object.keys(t).sort()}function f(e,n,t,i,r,c){return {id:e,severity:n,target:t,title:i,detail:r,remediation:c}}function _(e){let n=e.reduce((t,i)=>i.severity==="fail"?t+28:i.severity==="warn"?t+12:t+3,0);return Math.max(0,100-n)}async function J(e$1,n){let t=await v(o.join(n,".rapidkit","project.json")),i=e(n,t),r=d(n),c=i.runtime==="unknown"?r[0]||"unknown":i.runtime,a=T(e$1,n),d$1=a,m=await O(n),u=await y(o.join(n,".rapidkit","project.json"))||await y(o.join(n,".rapidkit","context.json")),g=await K(n),k=await b(n,["Dockerfile","dockerfile"]),w=await b(n,[".env.example","env.example","config/env.example"]),A=await b(n,[".github/workflows/ci.yml",".github/workflows/ci.yaml",".github/workflows/main.yml",".github/workflows/build.yml",".github/workflows/test.yml",".github/workflows/deploy.yml",".gitlab-ci.yml",".circleci/config.yml","azure-pipelines.yml","bitbucket-pipelines.yml","cloudbuild.yaml"]),z=await N(n),l=[];return i.key==="unknown"&&l.push(f("project.stack.unknown","fail",d$1,"Project stack is unknown","RapidKit cannot confidently classify this backend project.","Add .rapidkit/project.json metadata or import the project with `rapidkit import`.")),u||l.push(f("project.marker.missing","warn",d$1,"RapidKit marker is missing","The project can be detected by files, but it is not registered with RapidKit metadata.","Run `rapidkit import <path>` from a workspace or create the project through RapidKit.")),g||l.push(f("project.tests.missing","warn",d$1,"Test entrypoint is missing","No common test folder, config, or package test script was found.","Add a test command so `rapidkit workspace run test --affected` can gate changes.")),w||l.push(f("project.env.example.missing","info",d$1,"Environment example is missing","No .env.example or env.example file was found.","Add an env example for onboarding and CI secret documentation.")),A||l.push(f("project.ci.missing","warn",d$1,"Continuous integration is missing","No recognized CI/CD configuration file was detected for this project.","Add CI configuration so tests and checks run automatically for every change.")),z||l.push(f("project.health.missing","info",d$1,"Health or readiness probe is missing","The project has no obvious health or readiness endpoint to support automated deployment and runtime checks.","Add a simple health endpoint and document it for readiness gates and observability.")),k||l.push(f("project.container.missing","info",d$1,"Container recipe is missing","No Dockerfile was found for this project.","Add a Dockerfile when the service is intended for containerized deployment.")),{name:o.basename(n),path:n,relativePath:a,runtime:c,framework:i.key,confidence:i.confidence,supportTier:i.supportTier,hasRapidKitMarker:u,hasTests:g,hasDockerfile:k,hasEnvExample:w,hasCiConfig:A,hasHealthEndpoint:z,scripts:m,findings:l,score:_(l)}}function M(e){return e.name.toLowerCase()}async function W(e){let n=new Map(e.map(r=>[M(r),r])),t=[];for(let r of e){let c=await v(o.join(r.path,"package.json")),a={...c?.dependencies??{},...c?.devDependencies??{},...c?.peerDependencies??{}};for(let m of Object.keys(a)){let u=m.replace(/^@[^/]+\//,"").toLowerCase(),g=n.get(u);g&&g.relativePath!==r.relativePath&&t.push({from:r.relativePath,to:g.relativePath,kind:"package"});}let d=await I(o.join(r.path,"pyproject.toml"));for(let m of e)m.relativePath!==r.relativePath&&d.includes(m.name)&&t.push({from:r.relativePath,to:m.relativePath,kind:"workspace-reference"});}let i=new Set;return t.filter(r=>{let c=`${r.from}\0${r.to}\0${r.kind}`;return i.has(c)?false:(i.add(c),true)})}function H(e,n){let t=new Map;for(let i of e)t.set(i.relativePath,{project:i.relativePath,directDependents:0,directDependencies:0});for(let i of n){let r=t.get(i.from),c=t.get(i.to);r&&(r.directDependencies+=1),c&&(c.directDependents+=1);}return Array.from(t.values()).sort((i,r)=>r.directDependents-i.directDependents||r.directDependencies-i.directDependencies)}async function B(e){let n=await v(o.join(e,".rapidkit","workspace.json"));return typeof n?.profile=="string"?n.profile:null}function U(e){return {fail:e.filter(n=>n.severity==="fail").length,warn:e.filter(n=>n.severity==="warn").length,info:e.filter(n=>n.severity==="info").length}}function V(e){if(e.projectCount===0)return ["Create a RapidKit workspace: npx rapidkit create workspace my-workspace --profile polyglot","Import an existing service: npx rapidkit import ../service"];let n=[];return e.findings.some(t=>t.id==="workspace.marker.missing")&&n.push("Initialize workspace metadata with `rapidkit bootstrap --profile polyglot`."),e.findings.some(t=>t.id==="project.marker.missing")&&n.push("Register detected projects with `rapidkit import <path>` or recreate them via `rapidkit create project`."),e.findings.some(t=>t.id==="project.tests.missing")&&n.push("Add test entrypoints, then gate changes with `rapidkit workspace run test --affected --strict`."),e.findings.some(t=>t.id==="project.ci.missing")&&n.push("Add CI/CD configuration to catch regressions early and make workspace health checks actionable."),e.findings.some(t=>t.id==="project.health.missing")&&n.push("Add a health/readiness endpoint so runtime probes and deployment checks can verify service health."),e.hasGraph||n.push("Create `.rapidkit/workspace-dependency-graph.json` or use analyze output as the first graph seed."),n.push("Run `rapidkit autopilot release --mode audit --json` before release."),Array.from(new Set(n))}async function te(e={}){let n=o.resolve(e.workspacePath||process.cwd());if(!await y(n))throw new Error(`Workspace path does not exist: ${n}`);let t=G(n)??n,i=await y(o.join(t,".rapidkit-workspace"))||await y(o.join(t,".rapidkit","workspace.json")),r=await B(t),c=await S(t),a=await Promise.all(c.map(p=>J(t,p))),d=await W(a),m=H(a,d),u=[];i||u.push(f("workspace.marker.missing","warn",".","Workspace metadata is missing","The directory can be analyzed, but it is not a registered RapidKit workspace.","Run `rapidkit create workspace` or `rapidkit bootstrap --profile polyglot` in a workspace root.")),a.length===0&&u.push(f("workspace.projects.missing","fail",".","No backend projects detected","RapidKit did not find runtime markers or project metadata under this root.","Create a project with `rapidkit create project` or import one with `rapidkit import <path>`."));let g=[...u,...a.flatMap(p=>p.findings)],k=U(g),w={};for(let p of a)w[p.runtime]=(w[p.runtime]||0)+1;let A=a.length>0?Math.round(a.reduce((p,P)=>p+P.score,0)/a.length):0,z=u.reduce((p,P)=>p+(P.severity==="fail"?20:P.severity==="warn"?8:2),0),l=Math.max(0,A-z),$=k.fail>0||e.strict&&k.warn>0?"blocked":k.warn>0?"needs-attention":"ready",C={schemaVersion:"rapidkit-analyze-v1",generatedAt:new Date().toISOString(),workspacePath:t,workspaceDetected:i,profile:r,summary:{score:l,verdict:$,projectCount:a.length,runtimeCount:Object.keys(w).length,findings:k},runtimes:w,projects:a,dependencyGraph:{status:d.length>0?"generated":"empty",edges:d,topImpactedProjects:m.slice(0,5)},findings:g,nextActions:V({findings:g,projectCount:a.length,hasGraph:d.length>0}),enterpriseControls:{jsonReady:true,ciGateCommand:"rapidkit analyze --json --strict",releaseGateCommand:"rapidkit autopilot release --mode enforce --json",evidencePath:".rapidkit/reports/analyze-last-run.json"}};if(e.output&&(await h.promises.mkdir(o.dirname(o.resolve(e.output)),{recursive:true}),await h.promises.writeFile(o.resolve(e.output),`${JSON.stringify(C,null,2)}
|
|
2
|
-
`)),!e.output&&i){let p=o.join(t,".rapidkit","reports","analyze-last-run.json");await h.promises.mkdir(o.dirname(p),{recursive:true}),await h.promises.writeFile(p,`${JSON.stringify(C,null,2)}
|
|
3
|
-
`);}return C}function ie(e){let n=e.summary.verdict==="ready"?s.green:e.summary.verdict==="needs-attention"?s.yellow:s.red;if(console.log(s.bold(`
|
|
4
|
-
RapidKit Workspace Analysis
|
|
5
|
-
`)),console.log(s.cyan("Workspace:"),e.workspacePath),console.log(s.cyan("Profile:"),e.profile||"not configured"),console.log(s.cyan("Score:"),`${e.summary.score}/100`),console.log(s.cyan("Verdict:"),n(e.summary.verdict)),console.log(s.gray(`Projects: ${e.summary.projectCount}, runtimes: ${e.summary.runtimeCount}, findings: ${e.summary.findings.fail} fail / ${e.summary.findings.warn} warn / ${e.summary.findings.info} info`)),e.projects.length>0){console.log(s.bold(`
|
|
6
|
-
Projects`));for(let t of e.projects){let i=t.score>=85?s.green("pass"):t.score>=65?s.yellow("watch"):s.red("risk");console.log(` ${t.relativePath} ${s.gray(`${t.runtime}/${t.framework}`)} ${i} ${t.score}/100`);}}if(e.dependencyGraph.status==="generated"&&(console.log(s.bold(`
|
|
7
|
-
Dependency Graph`)),console.log(s.gray(` edges: ${e.dependencyGraph.edges.length}`)),e.dependencyGraph.topImpactedProjects.length>0)){console.log(s.gray(" Top impacted projects:"));for(let t of e.dependencyGraph.topImpactedProjects.slice(0,3))console.log(` ${t.project} (${t.directDependents} dependents, ${t.directDependencies} dependencies)`);}if(e.findings.length>0){console.log(s.bold(`
|
|
8
|
-
Top Findings`));for(let t of e.findings.slice(0,8)){let i=t.severity==="fail"?s.red:t.severity==="warn"?s.yellow:s.gray;console.log(` ${i(t.severity.toUpperCase())} ${t.target}: ${t.title}`),console.log(s.gray(` ${t.remediation}`));}}console.log(s.bold(`
|
|
9
|
-
Next Actions`));for(let t of e.nextActions.slice(0,5))console.log(s.gray(` - ${t}`));console.log();}export{te as a,ie as b};
|
package/dist/chunk-JIECGCLV.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import {a}from'./chunk-QUNCXYYK.js';import {a as a$1,b,d as d$1,c as c$1,f}from'./chunk-QCZGNOTH.js';import {c as c$2}from'./chunk-NFUXULIF.js';import c from'chalk';import l from'fs';import y from'fs-extra';import d from'path';function A(t){let e=a$1(t);return b(e,t)?"go":d$1(e,t)?"java":c$1(e,t)?"node":f(e,t)?"python":"unknown"}function j(t,e){if(!l.existsSync(t))return null;let a=l.readdirSync(t).filter(s=>s.endsWith(".json")&&e.some(r=>r.test(s))).map(s=>d.join(t,s));return a.length===0?null:(a.sort((s,r)=>l.statSync(r).mtimeMs-l.statSync(s).mtimeMs),a[0])}function p(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function O(t,e){let a=d.join(t,".rapidkit","toolchain.lock");if(!l.existsSync(a))return {gate:"env",status:"fail",summary:"toolchain.lock is missing",details:["Run rapidkit bootstrap to pin runtime versions and generate a reproducible toolchain."],evidencePath:a};try{let s=JSON.parse(l.readFileSync(a,"utf-8")),r=p(s.runtime),i=["python","node","go","java"].filter(n=>{let u=p(r[n]);return typeof u.version=="string"&&u.version.trim().length>0});if(i.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:a};if(e!=="unknown"){let n=p(r[e]);if(typeof n.version!="string"||n.version.trim().length===0)return {gate:"env",status:"fail",summary:`Project runtime (${e}) is not pinned in toolchain.lock`,details:[`Run rapidkit setup ${e} and rapidkit bootstrap to lock ${e} for this workspace.`],evidencePath:a}}return {gate:"env",status:"pass",summary:`Pinned runtimes: ${i.join(", ")}`,details:[],evidencePath:a}}catch{return {gate:"env",status:"fail",summary:"toolchain.lock is invalid JSON",details:["Regenerate lockfile with rapidkit bootstrap."],evidencePath:a}}}function C(t){let e=d.join(t,".rapidkit","reports","doctor-last-run.json");if(!l.existsSync(e))return {payload:null,path:e};try{let a=JSON.parse(l.readFileSync(e,"utf-8"));return c$2(a,"workspace")?{payload:a,path:e}:{payload:null,path:e}}catch{return {payload:null,path:e}}}function G(t){let e=C(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 N(t){let e=d.join(t,".rapidkit","reports","analyze-last-run.json");if(!l.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(l.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 $(t){try{let e=JSON.parse(l.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 x(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=d.join(t,".rapidkit","reports"),s=j(a,[/verify-pack-contract/i,/^verify.*\.json$/i]);if(s)return $(s);let r=d.join(a,"workspace-contract-verify-last-run.json"),o=j(a,[/workspace-contract-verify-last-run/i,/workspace-contract-verify/i]);if(o)try{let i=JSON.parse(l.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-Z5VYUF3T.js'),n=await i({workspacePath:t}),u={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 y.ensureDir(a),await y.writeJSON(r,u,{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:d.join(a,"*verify*.json")}}}function z(t,e){let a=d.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 u=Number(n.vulnerabilities??0);return Number.isFinite(u)?i+Math.max(0,u):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 V(t){return t.some(e=>e.status==="fail")?"fail":t.some(e=>e.status==="warn")?"warn":"pass"}async function E(t,e){let a=d.join(t,".rapidkit","reports","release-readiness-last-run.json");return await y.ensureDir(d.dirname(a)),await y.writeJSON(a,e,{spaces:2}),a}async function I(t={}){let e=d.resolve(t.startPath??process.cwd()),a$1=a(e)??e,s=A(e),r=O(a$1,s),o=G(a$1),i=N(a$1),n=await x(a$1,{skipVerify:t.skipVerify}),u=z(o.payload,a$1),m=[r,o.gate,i,n,u],g=V(m),v={schemaVersion:"v1",generatedAt:new Date().toISOString(),workspacePath:a$1,projectPath:e,action:t.action,overallStatus:g,blocking:g==="fail",blockingReasons:m.filter(f=>f.status==="fail").map(f=>`${f.gate}: ${f.summary}`),gates:m};return t.writeReport!==false&&(v.evidencePath=await E(a$1,v)),v}function J(t){return t==="pass"?c.green("PASS"):t==="warn"?c.yellow("WARN"):c.red("FAIL")}function D(t){return t==="pass"?c.green("PASS"):t==="warn"?c.yellow("WARN"):c.red("FAIL")}async function Q(t){let e=await I({writeReport:true,skipVerify:t.skipVerify===true});if(t.json)console.log(JSON.stringify(e,null,2));else {console.log(c.bold.cyan(`
|
|
2
|
-
\u{1F6A6} RapidKit Release Readiness
|
|
3
|
-
`)),console.log(c.bold(`Workspace: ${c.cyan(d.basename(e.workspacePath))}`)),console.log(c.gray(`Path: ${e.workspacePath}`)),console.log(`Overall: ${D(e.overallStatus)}`);for(let a of e.gates){console.log(` - ${a.gate}: ${J(a.status)} ${a.summary}`);for(let s of a.details)console.log(c.gray(` ${s}`));a.evidencePath&&console.log(c.gray(` evidence: ${a.evidencePath}`));}e.evidencePath&&console.log(c.gray(`
|
|
4
|
-
Evidence saved: ${e.evidencePath}`));}t.strict&&e.overallStatus!=="pass"&&process.exit(1);}export{I as a,Q as b};
|
package/dist/chunk-KXTXQODI.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import a from'fs';import o from'path';var c={fastapi:{key:"fastapi",runtime:"python",displayName:"FastAPI",supportTier:"first-class",importStack:"fastapi",aliases:["fastapi"],kitPrefixes:["fastapi"]},django:{key:"django",runtime:"python",displayName:"Django",supportTier:"extended",importStack:"django",aliases:["django"]},flask:{key:"flask",runtime:"python",displayName:"Flask",supportTier:"extended",importStack:"flask",aliases:["flask"]},python:{key:"python",runtime:"python",displayName:"Python",supportTier:"observed",importStack:"unknown",aliases:["python"]},nestjs:{key:"nestjs",runtime:"node",displayName:"NestJS",supportTier:"first-class",importStack:"nestjs",aliases:["nestjs","nest"],kitPrefixes:["nestjs"]},express:{key:"express",runtime:"node",displayName:"Express",supportTier:"extended",importStack:"express",aliases:["express"]},fastify:{key:"fastify",runtime:"node",displayName:"Fastify",supportTier:"extended",importStack:"unknown",aliases:["fastify"]},koa:{key:"koa",runtime:"node",displayName:"Koa",supportTier:"extended",importStack:"koa",aliases:["koa"]},node:{key:"node",runtime:"node",displayName:"Node.js",supportTier:"observed",importStack:"unknown",aliases:["node","nodejs","typescript","javascript"]},gofiber:{key:"gofiber",runtime:"go",displayName:"Go/Fiber",supportTier:"first-class",importStack:"go",aliases:["gofiber","fiber","go-fiber","go/fiber"],kitPrefixes:["gofiber"]},gogin:{key:"gogin",runtime:"go",displayName:"Go/Gin",supportTier:"first-class",importStack:"go",aliases:["gogin","gin","go-gin","go/gin"],kitPrefixes:["gogin"]},echo:{key:"echo",runtime:"go",displayName:"Echo",supportTier:"extended",importStack:"go",aliases:["echo"]},go:{key:"go",runtime:"go",displayName:"Go",supportTier:"observed",importStack:"go",aliases:["go","golang"],kitPrefixes:["go"]},springboot:{key:"springboot",runtime:"java",displayName:"Spring Boot",supportTier:"first-class",importStack:"springboot",aliases:["springboot","spring","spring-boot"],kitPrefixes:["springboot"]},java:{key:"java",runtime:"java",displayName:"Java",supportTier:"observed",importStack:"unknown",aliases:["java"]},laravel:{key:"laravel",runtime:"php",displayName:"Laravel",supportTier:"extended",importStack:"unknown",aliases:["laravel"]},symfony:{key:"symfony",runtime:"php",displayName:"Symfony",supportTier:"extended",importStack:"unknown",aliases:["symfony"]},php:{key:"php",runtime:"php",displayName:"PHP",supportTier:"observed",importStack:"unknown",aliases:["php"]},rails:{key:"rails",runtime:"ruby",displayName:"Ruby on Rails",supportTier:"extended",importStack:"rails",aliases:["rails","ruby-on-rails","ruby on rails"]},sinatra:{key:"sinatra",runtime:"ruby",displayName:"Sinatra",supportTier:"extended",importStack:"unknown",aliases:["sinatra"]},ruby:{key:"ruby",runtime:"ruby",displayName:"Ruby",supportTier:"observed",importStack:"unknown",aliases:["ruby"]},dotnet:{key:"dotnet",runtime:"dotnet",displayName:"ASP.NET Core",supportTier:"extended",importStack:"dotnet",aliases:["dotnet","asp.net","aspnet","asp.net core","csharp","c#"],kitPrefixes:["dotnet","aspnet","aspnetcore"]},actix:{key:"actix",runtime:"rust",displayName:"Actix-web",supportTier:"extended",importStack:"unknown",aliases:["actix","actix-web"]},axum:{key:"axum",runtime:"rust",displayName:"Axum",supportTier:"extended",importStack:"unknown",aliases:["axum"]},rocket:{key:"rocket",runtime:"rust",displayName:"Rocket",supportTier:"extended",importStack:"unknown",aliases:["rocket"]},rust:{key:"rust",runtime:"rust",displayName:"Rust",supportTier:"observed",importStack:"unknown",aliases:["rust"]},phoenix:{key:"phoenix",runtime:"elixir",displayName:"Phoenix",supportTier:"extended",importStack:"unknown",aliases:["phoenix"]},elixir:{key:"elixir",runtime:"elixir",displayName:"Elixir",supportTier:"observed",importStack:"unknown",aliases:["elixir"]},clojure:{key:"clojure",runtime:"clojure",displayName:"Clojure",supportTier:"extended",importStack:"unknown",aliases:["clojure"]},scala:{key:"scala",runtime:"scala",displayName:"Scala",supportTier:"extended",importStack:"unknown",aliases:["scala"]},kotlin:{key:"kotlin",runtime:"kotlin",displayName:"Kotlin",supportTier:"extended",importStack:"unknown",aliases:["kotlin"]},deno:{key:"deno",runtime:"deno",displayName:"Deno",supportTier:"extended",importStack:"unknown",aliases:["deno"]},bun:{key:"bun",runtime:"bun",displayName:"Bun",supportTier:"extended",importStack:"unknown",aliases:["bun"]},unknown:{key:"unknown",runtime:"unknown",displayName:"Unknown",supportTier:"observed",importStack:"unknown",aliases:["unknown"]}},f=new Map;for(let e of Object.values(c))for(let n of e.aliases)f.set(n,e.key);function i(e,n,t){let r=c[e]??c.unknown;return {key:r.key,runtime:r.runtime,displayName:r.displayName,supportTier:r.supportTier,importStack:r.importStack,confidence:n,source:t}}function y(e){return e.trim().toLowerCase().replace(/[_\s]+/g,"-")}function u(e){try{return a.existsSync(e)?a.readFileSync(e,"utf8").toLowerCase():""}catch{return ""}}function g(e){try{return a.existsSync(e)?JSON.parse(a.readFileSync(e,"utf8")):null}catch{return null}}function l(e,n){if(n<0||!a.existsSync(e))return [];let t=[],r=[];try{r=a.readdirSync(e,{withFileTypes:true});}catch{return []}for(let s of r){let m=o.join(e,s.name);s.isDirectory()?t.push(...l(m,n-1)):t.push(m);}return t}function k(e,n,t=2){return l(e,t).some(r=>r.toLowerCase().endsWith(n.toLowerCase()))}function p(e,n,t=2){return l(e,t).filter(r=>r.toLowerCase().endsWith(n.toLowerCase()))}function w(e){let n=y(e??"");if(!n)return "unknown";for(let t of Object.values(c))if(t.kitPrefixes?.some(r=>n.startsWith(r)))return t.key;return "unknown"}function d(e){return e?f.get(y(e))??"unknown":"unknown"}function E(e){return d(e)}function A(e){let n=d(e);return n!=="unknown"?c[n].runtime:"unknown"}function x(e){let n=w(e.kitName);if(n!=="unknown")return i(n,"high","kit");let t=d(e.framework);if(t!=="unknown")return i(t,"high","framework");let r=d(e.runtime);return r!=="unknown"?i(r,"medium","runtime"):i("unknown","low","unknown")}function b(e){let n=g(o.join(e,"package.json"));if(!n)return i("unknown","low","unknown");let t={...n.dependencies??{},...n.devDependencies??{}},r=n.scripts??{},s=Object.values(r).filter(m=>typeof m=="string").join(" ").toLowerCase();return t["@nestjs/core"]||s.includes("nest start")?i("nestjs","high","manifest"):t.express?i("express","high","manifest"):t.fastify?i("fastify","high","manifest"):t.koa?i("koa","high","manifest"):i("node","medium","marker")}function S(e){let n=[u(o.join(e,"pyproject.toml")),u(o.join(e,"requirements.txt")),u(o.join(e,"requirements.in"))].join(`
|
|
2
|
-
`);return n.includes("fastapi")?i("fastapi","high","manifest"):n.includes("django")?i("django","high","manifest"):n.includes("flask")?i("flask","high","manifest"):n.trim()?i("python","medium","marker"):i("unknown","low","unknown")}function h(e){let n=[u(o.join(e,"go.mod")),u(o.join(e,"main.go"))].join(`
|
|
3
|
-
`);return n.includes("github.com/gofiber/fiber")?i("gofiber","high","manifest"):n.includes("github.com/gin-gonic/gin")?i("gogin","high","manifest"):n.includes("github.com/labstack/echo")?i("echo","high","manifest"):n.trim()?i("go","medium","marker"):i("unknown","low","unknown")}function j(e){let n=[u(o.join(e,"pom.xml")),u(o.join(e,"build.gradle")),u(o.join(e,"build.gradle.kts"))].join(`
|
|
4
|
-
`);return n.includes("spring-boot")||n.includes("org.springframework")?i("springboot","high","manifest"):n.trim()?i("java","medium","marker"):i("unknown","low","unknown")}function B(e){let n=u(o.join(e,"composer.json"));return n.includes("laravel/framework")?i("laravel","high","manifest"):n.includes("symfony/")?i("symfony","high","manifest"):n.trim()?i("php","medium","marker"):i("unknown","low","unknown")}function F(e){let n=u(o.join(e,"Gemfile"));return n.includes("gem 'rails'")||n.includes('gem "rails"')?i("rails","high","manifest"):n.includes("gem 'sinatra'")||n.includes('gem "sinatra"')?i("sinatra","high","manifest"):n.trim()?i("ruby","medium","marker"):i("unknown","low","unknown")}function N(e){let t=[...p(e,".csproj",3),...p(e,".sln",2)].map(r=>u(r)).join(`
|
|
5
|
-
`);return t.includes("microsoft.net.sdk.web")||t.includes("microsoft.aspnetcore")||t.includes("swashbuckle.aspnetcore")?i("dotnet","high","manifest"):t.trim()?i("dotnet","medium","marker"):i("unknown","low","unknown")}function T(e){let n=u(o.join(e,"Cargo.toml"));return n.includes("actix-web")?i("actix","high","manifest"):n.includes("axum")?i("axum","high","manifest"):n.includes("rocket")?i("rocket","high","manifest"):n.trim()?i("rust","medium","marker"):i("unknown","low","unknown")}function v(e){let n=u(o.join(e,"mix.exs"));return n.includes("phoenix")?i("phoenix","high","manifest"):n.trim()?i("elixir","medium","marker"):i("unknown","low","unknown")}function C(e){let n=[],t=r=>{n.includes(r)||n.push(r);};return a.existsSync(o.join(e,"go.mod"))&&t("go"),a.existsSync(o.join(e,"Cargo.toml"))&&t("rust"),(a.existsSync(o.join(e,"pom.xml"))||a.existsSync(o.join(e,"build.gradle"))||a.existsSync(o.join(e,"build.gradle.kts")))&&t("java"),a.existsSync(o.join(e,"mix.exs"))&&t("elixir"),a.existsSync(o.join(e,"composer.json"))&&t("php"),(k(e,".csproj")||k(e,".sln"))&&t("dotnet"),a.existsSync(o.join(e,"package.json"))&&t("node"),a.existsSync(o.join(e,"Gemfile"))&&t("ruby"),(a.existsSync(o.join(e,"pyproject.toml"))||a.existsSync(o.join(e,"setup.py"))||a.existsSync(o.join(e,"requirements.txt"))||a.existsSync(o.join(e,"requirements.in")))&&t("python"),(a.existsSync(o.join(e,"deps.edn"))||a.existsSync(o.join(e,"project.clj")))&&t("clojure"),a.existsSync(o.join(e,"build.sbt"))&&t("scala"),(a.existsSync(o.join(e,"deno.json"))||a.existsSync(o.join(e,"deno.jsonc")))&&t("deno"),(a.existsSync(o.join(e,"bun.lockb"))||a.existsSync(o.join(e,"bun.lock")))&&t("bun"),(a.existsSync(o.join(e,"settings.gradle.kts"))||k(o.join(e,"src"),".kt",3))&&t("kotlin"),n}function G(e,n){let t=x({framework:typeof n?.framework=="string"?n.framework:void 0,runtime:typeof n?.runtime=="string"?n.runtime:void 0,kitName:typeof n?.kit_name=="string"?n.kit_name:typeof n?.kit=="string"?n.kit:void 0});if(t.key!=="unknown")return t;let r=C(e);if(r.includes("node")){let s=b(e);if(s.key!=="unknown")return s}if(r.includes("python")){let s=S(e);if(s.key!=="unknown")return s}if(r.includes("go")){let s=h(e);if(s.key!=="unknown")return s}if(r.includes("java")){let s=j(e);if(s.key!=="unknown")return s}if(r.includes("php")){let s=B(e);if(s.key!=="unknown")return s}if(r.includes("ruby")){let s=F(e);if(s.key!=="unknown")return s}if(r.includes("rust")){let s=T(e);if(s.key!=="unknown")return s}if(r.includes("elixir")){let s=v(e);if(s.key!=="unknown")return s}if(r.includes("dotnet")){let s=N(e);if(s.key!=="unknown")return s}return r.includes("clojure")?i("clojure","medium","marker"):r.includes("scala")?i("scala","medium","marker"):r.includes("kotlin")?i("kotlin","medium","marker"):r.includes("deno")?i("deno","high","marker"):r.includes("bun")?i("bun","high","marker"):r.length>0?i(d(r[0]),"medium","runtime"):i("unknown","low","unknown")}export{E as a,A as b,x as c,C as d,G as e};
|
package/dist/chunk-QCZGNOTH.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {e,c as c$1}from'./chunk-KXTXQODI.js';import b from'fs';import f from'path';function d(e$1,t){let n=c$1({runtime:typeof e$1?.runtime=="string"?e$1.runtime:void 0,framework:typeof e$1?.framework=="string"?e$1.framework:void 0,kitName:typeof e$1?.kit_name=="string"?e$1.kit_name:typeof e$1?.kit=="string"?e$1.kit:void 0});return n.runtime!=="unknown"?n.runtime:e(t,e$1).runtime}function x(e){let t=e;for(;;){let n=f.join(t,".rapidkit","project.json");if(b.existsSync(n))try{return JSON.parse(b.readFileSync(n,"utf8"))}catch{return null}let r=f.dirname(t);if(r===t)break;t=r;}return null}function H(e,t){return d(e,t)==="go"}function q(e,t){return d(e,t)==="node"}function V(e,t){return d(e,t)==="java"}function W(e,t){return d(e,t)==="dotnet"}function X(e,t){return d(e,t)==="python"}var a=["init","dev","start","build","test","lint","format","help"],B={python:{runtime:"python",displayName:"Python",supportedCommands:a,packageManagers:["poetry","pip","uv"],primaryFiles:["pyproject.toml","requirements.txt","requirements.in"],notes:["Core-backed projects can use RapidKit modules and template operations."]},node:{runtime:"node",displayName:"Node.js",supportedCommands:a,packageManagers:["npm","pnpm","yarn","bun"],primaryFiles:["package.json"],notes:["Node projects run through package-manager scripts when available."]},go:{runtime:"go",displayName:"Go",supportedCommands:a,packageManagers:["go"],primaryFiles:["go.mod"],notes:["Go projects use local launchers, Makefile targets, and go tooling."]},java:{runtime:"java",displayName:"Java",supportedCommands:a,packageManagers:["maven","gradle"],primaryFiles:["pom.xml","build.gradle","build.gradle.kts"],notes:["Java projects use Maven/Gradle wrappers when generated or detected."]},dotnet:{runtime:"dotnet",displayName:".NET",supportedCommands:a,packageManagers:["dotnet"],primaryFiles:["*.csproj","*.sln"],notes:[".NET projects use the dotnet CLI and generated RapidKit launchers."]},php:{runtime:"php",displayName:"PHP",supportedCommands:a,packageManagers:["composer"],primaryFiles:["composer.json"],notes:["Imported PHP projects are managed as observed runtime projects until a kit exists."]},ruby:{runtime:"ruby",displayName:"Ruby",supportedCommands:a,packageManagers:["bundle"],primaryFiles:["Gemfile"],notes:["Imported Ruby projects are managed as observed runtime projects until a kit exists."]},rust:{runtime:"rust",displayName:"Rust",supportedCommands:a,packageManagers:["cargo"],primaryFiles:["Cargo.toml"],notes:["Rust projects use cargo commands and generated RapidKit launchers when available."]},elixir:{runtime:"elixir",displayName:"Elixir",supportedCommands:a,packageManagers:["mix"],primaryFiles:["mix.exs"],notes:["Elixir projects are detected and governed as observed runtime projects."]},kotlin:{runtime:"kotlin",displayName:"Kotlin",supportedCommands:a,packageManagers:["gradle"],primaryFiles:["settings.gradle.kts","*.kt"],notes:["Kotlin projects are detected and governed as observed runtime projects."]}};function h(e){return B[e]??null}var s=["init","dev","start","build","test","lint","format","help"],N={python:{runtime:"python",displayName:"Python",tier:"first-class",scaffoldSupport:true,importSupport:true,lifecycleCommands:s,moduleCommands:true,doctorSupport:"full",notes:["Core-backed Python projects support RapidKit modules and lifecycle commands."]},node:{runtime:"node",displayName:"Node.js",tier:"first-class",scaffoldSupport:true,importSupport:true,lifecycleCommands:s,moduleCommands:true,doctorSupport:"full",notes:["Node/NestJS projects support npm-owned lifecycle commands and module workflows."]},go:{runtime:"go",displayName:"Go",tier:"extended",scaffoldSupport:true,importSupport:true,lifecycleCommands:s,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:s,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:s,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."]}},O=["fastapi","nestjs","gofiber","gogin","springboot"],D=["django","flask","express","fastify","koa","echo","dotnet","laravel","symfony","rails","sinatra","actix","axum","rocket","phoenix","clojure","scala","kotlin","deno","bun"];function c(e){return N[e||"unknown"]??N.unknown}function w(e){return O.includes(e)?"first-class":D.includes(e)?"extended":"observed"}function P(e){let t=c(e.runtime);return {lifecycleCommands:t.lifecycleCommands,moduleCommands:e.moduleSupport&&t.moduleCommands,unsupportedLifecycleCommands:s.filter(n=>!t.lifecycleCommands.includes(n))}}var M=["version","commands","doctor","project"],F=["init","dev","start","build","test","lint","format","help"],E=["add","modules","upgrade","diff","merge","reconcile","rollback","uninstall","checkpoint","snapshot","optimize"],T=["create","list","info","frameworks","license"];function _(e){let t=f.resolve(e);for(;;){let n=f.join(t,".rapidkit","project.json");if(b.existsSync(n))return t;let r=f.dirname(t);if(r===t)break;t=r;}return null}function I(e){let t=f.join(e,".rapidkit","context.json");if(!b.existsSync(t))return "unknown";try{let r=JSON.parse(b.readFileSync(t,"utf8")).engine;if(r==="npm"||r==="pip"||r==="python")return r}catch{}return "unknown"}function L(e,t){return e?.module_support===false?false:c(t.runtime).moduleCommands}function l(e,t){return {command:e,...t}}function J(e$1=process.cwd()){let t=_(e$1),n=t?x(t):null,r=t?e(t,n):e(e$1,n),p=t?L(n,r):false,A=t?I(t):"unknown",u=h(r.runtime),y=c(r.runtime),K=P({runtime:r.runtime,moduleSupport:p}),i={};for(let o of M)i[o]=l(o,{owner:o==="project"?"core":"npm",status:"supported",reason:o==="project"?"Project detection is a Core contract; workspace project lifecycle remains npm-owned.":"Universal command available across RapidKit project types."});for(let o of F){let j=o==="help"||!!t&&!!u&&u.supportedCommands.includes(o)&&K.lifecycleCommands.includes(o);i[o]=l(o,{owner:"runtime",status:j?"supported":"unsupported",reason:j?o==="help"?"Help is available for every RapidKit project through the npm CLI.":`Handled by the ${u?.displayName} runtime adapter or project-local launcher.`:t?u?`The ${r.displayName} runtime is tracked, but ${o} is not supported at the ${y.tier} support tier.`:`No runtime adapter is available for ${r.displayName} projects yet.`:"No RapidKit project was detected."});}for(let o of E)i[o]=l(o,{owner:p?"core":"none",status:p?"supported":"unsupported",reason:p?"Core module/template command supported for this project.":`Core module/template commands are not available for ${r.displayName} projects.`});for(let o of T)i[o]=l(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 g=Object.values(i);return {schemaVersion:1,scope:"project",projectRoot:t,engine:A,runtime:r.runtime,framework:r.key,frameworkDisplayName:r.displayName,frameworkConfidence:r.confidence,frameworkSupportTier:w(r.key),runtimeSupportTier:y.tier,runtimeDoctorSupport:y.doctorSupport,moduleSupport:p,commandMap:i,supportedCommands:g.filter(o=>o.status==="supported").map(o=>o.command).sort(),unsupportedCommands:g.filter(o=>o.status==="unsupported").map(o=>o.command).sort(),globalCommands:g.filter(o=>o.status==="global").map(o=>o.command).sort()}}function me(e,t=process.cwd()){let n=e[0];return n?J(t).commandMap[n]??null:null}function de(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 ue(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{x as a,H as b,q as c,V as d,W as e,X as f,c as g,P as h,J as i,me as j,de as k,ue as l};
|
package/dist/chunk-QUNCXYYK.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import n from'fs';import t from'path';function c(e){let r=t.resolve(e);for(;;){if(n.existsSync(t.join(r,".rapidkit-workspace"))||n.existsSync(t.join(r,".rapidkit","workspace.json")))return r;let i=t.dirname(r);if(i===r)return null;r=i;}}export{c as a};
|
package/dist/chunk-SAIWD6VM.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import {d,e,a as a$1,b}from'./chunk-KXTXQODI.js';import {a}from'./chunk-VKLL63TL.js';import D from'fs';import w from'path';import S from'chalk';import {execa}from'execa';var le={"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:[]}}},pe={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 Y(e,r,t){if(r){let s=r.trim().toLowerCase().replace(/[_.\s]+/g,"-"),u=a$1(r),a=`${e}-${u==="gofiber"?"fiber":u==="gogin"?"gin":u==="dotnet"?"aspnetcore":u!=="unknown"?u:s==="fiber"?"fiber":s==="aspnetcore"||s==="asp-net-core"?"aspnetcore":s}`,n=le[a];if(n&&n.commands[t])return n.commands[t]}let o=pe[t]?.[e]??[];return o.length>0?o[0]:void 0}function me(e){let r=d(e).map(t=>t==="python"?"python":t==="node"||t==="bun"?"node":t==="go"?"go":t==="java"?"java":t==="php"?"php":t==="rust"?"rust":t==="dotnet"?"dotnet":t==="elixir"?"elixir":t==="ruby"?"ruby":t==="clojure"||t==="scala"||t==="kotlin"?"jvm-generic":null).filter(t=>t!==null).filter((t,o,s)=>s.indexOf(t)===o);return {primary:r.length>0?r[0]:"unknown",secondary:r.slice(1)}}function Q(e){return me(e).primary}function X(e,r){if(!e)return "unknown";r||(r={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[t,o]of Object.entries(r))for(let s of o)if(new RegExp(s,"i").test(e))return t;return "unknown"}async function Z(e){let r=e.split(/[&|;]\s*/)[0].trim().split(/\s+/)[0];if(["echo","cd","pwd","test","true","false","exit"].includes(r))return {valid:true};try{let o=process.platform==="win32"?"where":"which";if((await execa(o,[r],{reject:false})).exitCode===0)return {valid:true}}catch{}return {valid:false,reason:`Command '${r}' not found or not executable`}}function ee(e,r,t){return r?t&&typeof r[t]=="string"?r[t]:typeof r.default=="string"?r.default:e:e}var ge=new Set(["init","test","build","start"]),fe=new Set([".git","node_modules",".rapidkit",".venv","dist","build","coverage","htmlcov"]);async function N(e){try{return await D.promises.access(e,D.constants.F_OK),true}catch{return false}}async function re(e){let r=await D.promises.readFile(e,"utf-8");return JSON.parse(r)}async function ye(e,r){await D.promises.mkdir(w.dirname(e),{recursive:true}),await D.promises.writeFile(e,`${JSON.stringify(r,null,2)}
|
|
2
|
-
`,"utf-8");}function O(e){return e.replace(/\\/g,"/")}async function he(e){return a(e,{skipDirs:fe,includeHiddenDirs:false,descendIntoMatchedProjects:false,isProjectDir:async(r,t)=>await N(w.join(r,".rapidkit","context.json"))||await N(w.join(r,".rapidkit","project.json"))?true:w.resolve(r)===w.resolve(t)?false:d(r).length>0})}async function ke(e,r,t){let o=await execa("git",["diff","--name-only",`${t}...HEAD`],{cwd:e,reject:false});if(o.exitCode!==0)return new Set(r);let s=o.stdout.split(/\r?\n/).map(c=>c.trim()).filter(c=>c.length>0).map(c=>O(c));if(s.length===0)return new Set;let u=new Set;for(let c of r){let a=O(w.relative(e,c));if(!a||a===".")continue;let n=`${a}/`;s.some(m=>m===a||m.startsWith(n))&&u.add(c);}return u}async function we(e,r,t){let o=w.join(e,".rapidkit","workspace.contract.json");if(await N(o))try{let f=await be(e,r,t,o);if(f.graphStatus!=="missing")return f}catch{return {expanded:t,graphStatus:"invalid",expansionDepth:0}}let s=w.join(e,".rapidkit","workspace-dependency-graph.json");if(!await N(s))return {expanded:t,graphStatus:"missing",expansionDepth:0};let u;try{u=await re(s);}catch{return {expanded:t,graphStatus:"invalid",expansionDepth:0}}let c=new Set(r.map(f=>w.resolve(f))),a=new Map;if(!u||typeof u!="object"||Array.isArray(u))return {expanded:t,graphStatus:"invalid",expansionDepth:0};let n=Array.isArray(u.projects)?u.projects:[];for(let f of n){if(!f||typeof f!="object"||Array.isArray(f))continue;let E=f,p=typeof E.path=="string"?E.path:"",i=w.resolve(e,p);if(!c.has(i))continue;let g=Array.isArray(E.dependsOn)?E.dependsOn.filter(y=>typeof y=="string"):[];for(let y of g){let h=w.resolve(e,y);c.has(h)&&(a.has(h)||a.set(h,new Set),a.get(h)?.add(i));}}let m=new Set(t),v=[...m],b=0;for(;v.length>0;){let f=v.shift();if(!f)continue;let E=a.get(f);if(E)for(let p of E)m.has(p)||(m.add(p),v.push(p),b+=1);}return {expanded:m,graphStatus:"loaded",expansionDepth:b}}async function be(e,r,t,o){let s=await re(o);if(!s||typeof s!="object"||Array.isArray(s))return {expanded:t,graphStatus:"invalid",expansionDepth:0};let u=s,c=Array.isArray(u.projects)?u.projects:null;if(!c)return {expanded:t,graphStatus:"invalid",expansionDepth:0};let a=new Map,n=new Map;for(let i of r){let g=O(w.relative(e,i));n.set(g,w.resolve(i));}let m=new Map,v=new Map,b=new Map;for(let i of c){if(!i||typeof i!="object"||Array.isArray(i))continue;let g=i,y=typeof g.slug=="string"?g.slug:"",h=typeof g.relativePath=="string"?O(g.relativePath):y,x=n.get(h);!y||!x||a.set(y,x);}for(let i of c){if(!i||typeof i!="object"||Array.isArray(i))continue;let g=i,y=typeof g.slug=="string"?g.slug:"",h=a.get(y);if(!h)continue;let x=g.contracts&&typeof g.contracts=="object"&&!Array.isArray(g.contracts)?g.contracts:{},$=Array.isArray(x.dependsOn)?x.dependsOn.filter(R=>typeof R=="string"):[],C=Array.isArray(x.publishes)?x.publishes.filter(R=>typeof R=="string"):[],I=Array.isArray(x.consumes)?x.consumes.filter(R=>typeof R=="string"):[];for(let R of $){let F=a.get(R);F&&(b.has(F)||b.set(F,new Set),b.get(F)?.add(h));}for(let R of C)m.has(R)||m.set(R,new Set),m.get(R)?.add(h);for(let R of I)v.has(R)||v.set(R,new Set),v.get(R)?.add(h);}for(let[i,g]of m.entries()){let y=v.get(i);if(y)for(let h of g){b.has(h)||b.set(h,new Set);for(let x of y)x!==h&&b.get(h)?.add(x);}}let f=new Set(t),E=[...f],p=0;for(;E.length>0;){let i=E.shift();if(!i)continue;let g=b.get(i);if(g)for(let y of g)f.has(y)||(f.add(y),E.push(y),p+=1);}return {expanded:f,graphStatus:"loaded",expansionDepth:p}}async function xe(e,r){if(typeof r=="boolean")return r;let t=w.join(e,".rapidkit","policies.yml");if(!await N(t))return true;let o="";try{o=await D.promises.readFile(t,"utf-8");}catch{return true}let s=o.match(/^[\t ]*rules\.enforce_workspace_run_gates:\s*(true|false)\s*(?:#.*)?$/m);return s?s[1]==="true":true}async function G(e,r){let t=process.argv[1];if(!t)return {exitCode:1,stdout:"",stderr:"RapidKit entrypoint is unavailable for nested workspace-run execution."};let o=await execa(process.execPath,[t,...e],{cwd:r,reject:false,env:{...process.env,RAPIDKIT_WORKSPACE_RUN_CHILD:"1"}});return {exitCode:Number(o.exitCode??1),stdout:o.stdout,stderr:o.stderr}}function Re(e){return e==="node"||e==="go"||e==="java"||e==="python"}function ve(){return process.env.VITEST==="true"||process.env.VITEST==="1"||process.env.NODE_ENV==="test"}async function Ee(e){let r=process.cwd();try{process.chdir(e);let{handleInitCommand:t}=await import('./index.js');return {exitCode:await t(["init"]),stdout:"",stderr:""}}finally{process.chdir(r);}}async function Se(e$1){let r=a=>{let n=b(a);return n==="node"||n==="bun"?"node":n==="python"?"python":n==="go"?"go":n==="java"?"java":n==="php"?"php":n==="ruby"?"ruby":n==="rust"?"rust":n==="dotnet"?"dotnet":n==="elixir"?"elixir":n==="clojure"||n==="scala"||n==="kotlin"?"jvm-generic":Q(e$1)},t=a=>{if(!a)return;let n=a$1(a);if(new Set(["fastapi","django","flask","nestjs","express","fastify","koa","gofiber","gogin","echo","springboot","laravel","symfony","rails","sinatra","dotnet","actix","axum","rocket","phoenix"]).has(n))return n},o=w.join(e$1,".rapidkit","context.json");if(D.existsSync(o))try{let a=JSON.parse(D.readFileSync(o,"utf-8"));if(typeof a.runtime=="string"){let n={};if(a.commands&&typeof a.commands=="object")for(let[m,v]of Object.entries(a.commands))typeof v=="string"&&(n[m]=v);return {runtime:r(a.runtime),framework:t(typeof a.framework=="string"?a.framework:void 0),commandOverrides:Object.keys(n).length>0?n:void 0,environment:typeof a.environment=="string"?a.environment:void 0}}}catch{}let s=e(e$1),u=r(s.runtime),c=t(s.key);return {runtime:u,framework:c}}async function je(e,r,t,o,s,u){let c=!s?.[r]&&Re(t),a;if(s&&s[r]?a=s[r]:c?a=`rapidkit ${r}`:a=Y(t,o,r),!a)return {exitCode:127,command:`<stage not supported for ${t}>`,message:`No stage command found for runtime '${t}' and framework '${o||"unknown"}'`,errorCategory:"runtime"};let n=ee(a,s,u);if(!n)return {exitCode:127,command:a,message:"Failed to resolve stage command",errorCategory:"runtime"};if(!c){let p=await Z(n);if(!p.valid)return {exitCode:127,command:n,message:p.reason||"Command not available",errorCategory:"setup"}}let m=0,v="",b="",f;try{let p=c?r==="init"&&ve()?await Ee(e):await G([r],e):await execa(n,[],{cwd:e,reject:false,shell:true});if(m=Number(p.exitCode??0),v=p.stdout,b=p.stderr,m!==0){let i=`${v}
|
|
3
|
-
${b}`;f=X(i);}}catch(p){return {exitCode:1,command:n,message:p instanceof Error?p.message:"Command execution failed",errorCategory:"runtime"}}return {exitCode:m,command:n,errorCategory:f,healthStatus:void 0,message:m!==0?`Stage failed with exit code ${m}`:void 0}}function te(e){try{return JSON.parse(e)}catch{return null}}function Ce(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 Pe(e){let r=[],t=await G(["doctor","workspace","--json"],e);if(t.exitCode!==0)r.push({gate:"doctor-workspace",status:"fail",summary:"doctor workspace command failed"});else {let u=te(t.stdout)?.healthScore,c=Number(u?.errors??0);Number.isFinite(c)&&c>0?r.push({gate:"doctor-workspace",status:"fail",summary:`doctor workspace reports ${c} error(s)`}):r.push({gate:"doctor-workspace",status:"pass",summary:"doctor workspace passed"});}let o=await G(["readiness","--json"],e);if(o.exitCode!==0)r.push({gate:"readiness",status:"fail",summary:"readiness command failed"});else {let s=te(o.stdout),u=String(s?.overallStatus??"").toLowerCase();u==="fail"?r.push({gate:"readiness",status:"fail",summary:"readiness overall status is fail"}):u==="warn"?r.push({gate:"readiness",status:"warn",summary:"readiness overall status is warn"}):r.push({gate:"readiness",status:"pass",summary:"readiness overall status is pass"});}return r}function Fe(e){return ge.has(e)}function Ae(e,r){let t=Math.max(1,Math.min(4,r)),o=Number(e??t);return Number.isFinite(o)?Math.max(1,Math.min(16,Math.trunc(o))):t}async function Ke(e){if(!Fe(e.stage))throw new Error(`Unsupported workspace run stage: ${e.stage}`);let r=Date.now(),t=w.resolve(e.workspacePath),o=await he(t),s=e.affected===true,u=e.blastRadius===true,c=e.since?.trim()||"HEAD~1",a=s?await ke(t,o,c):new Set(o),n,m="not-applicable",v=0,b="all";if(s&&u){let d=await we(t,o,a);n=d.expanded,m=d.graphStatus,v=d.expansionDepth,b="affected+blast-radius";}else s?(n=a,b="affected"):(n=a,b="all");let f=e.stage==="init"?false:await xe(t,e.enforceGates),E=f?await Pe(t):[{gate:"doctor-workspace",status:"skipped",summary:"workspace run gates disabled"},{gate:"readiness",status:"skipped",summary:"workspace run gates disabled"}],p=E.find(d=>d.status==="fail"),i=o.filter(d=>n.has(d)),g=e.continueOnError===true||e.stage==="init",y=e.parallel===true,h=Ae(e.maxWorkers,i.length),x=i.length,$=0;e.json||console.log(S.gray(`Workspace run (${e.stage}) started: ${x} target(s), ${y?`parallel x${h}`:"sequential"}`));let C=new Map;for(let d of o)C.set(d,{path:d,relativePath:O(w.relative(t,d)),selected:n.has(d),affected:n.has(d),status:(n.has(d),"skipped"),exitCode:null,durationMs:0,reason:n.has(d)?void 0:"not affected",framework:void 0,runtimeDetected:void 0,executionCommand:void 0});if(p)for(let d of i){let k=C.get(d);k&&(k.status="skipped",k.reason=`blocked by ${p.gate}`);}else {let d=async k=>{let l=C.get(k);if(!l)return;let M=O(w.relative(t,k));e.json||console.log(S.gray(`\u23F3 [${$}/${x}] ${e.stage} ${M}`)),l.selected=true,l.affected=true;let A=Date.now(),{runtime:j,framework:P,commandOverrides:oe,environment:se}=await Se(k);l.runtimeDetected=j,l.framework=P;let T=await je(k,e.stage,j,P,oe,se);if(l.executionCommand=T.command,l.errorCategory=T.errorCategory,l.healthStatus=T.healthStatus,l.durationMs=Date.now()-A,l.exitCode=T.exitCode,T.exitCode===0?(l.status="passed",l.reason=void 0):(l.status="failed",l.reason=T.message||"stage command failed",l.errorMessage=T.message),$+=1,!e.json){let ae=x>0?Math.round($/x*100):100,ie=l.status==="passed"?S.green("\u2705"):S.red("\u274C");if(console.log(S.gray(`${ie} [${$}/${x}] (${ae}%) ${M} ${l.durationMs}ms`)),l.status==="failed"){l.reason&&console.log(S.red(` Reason: ${l.reason}`)),l.executionCommand&&console.log(S.gray(` Command: ${l.executionCommand}`));let K=Ce(l.runtimeDetected);K&&l.errorCategory==="setup"&&console.log(S.gray(` Hint: ${K}`));}}};if(y&&i.length>1){let k=0,l=false,M=new Array(h).fill(null).map(async()=>{for(;k<i.length;){if(l&&!g)return;let A=k;k+=1;let j=i[A];await d(j),C.get(j)?.status==="failed"&&(l=true);}});if(await Promise.all(M),!g&&l){let A=false;for(let j of i){let P=C.get(j);if(P){if(P.status==="failed"){A=true;continue}A&&P.status==="skipped"&&(P.reason=P.reason||"stopped after failure");}}}}else for(let k of i){await d(k);let l=C.get(k);if(!g&&l?.status==="failed"){let M=i.slice(i.indexOf(k)+1);for(let A of M){let j=C.get(A);j&&(j.status="skipped",j.reason="stopped after failure");}break}}}let I=[];for(let d of o){let k=C.get(d);k&&I.push(k);}let R=I.filter(d=>d.status==="passed").length,F=I.filter(d=>d.status==="failed").length,_=I.filter(d=>d.status==="skipped").length,H=e.strict===true,ne=F>0||H&&E.some(d=>d.status!=="pass")?1:0,J={schemaVersion:"1.0",workspacePath:t,stage:e.stage,generatedAt:new Date().toISOString(),durationMs:Date.now()-r,options:{affected:s,blastRadius:u,since:s?c:null,parallel:y,maxWorkers:h,continueOnError:g,strict:H,enforceGates:f},selection:{mode:b,since:s?c:null,graphStatus:m,expansionDepth:v},gates:{enforced:f,results:E,blocked:!!p,blockingGate:p?.gate},summary:{projectCount:o.length,selectedCount:i.length,passed:R,failed:F,skipped:_,exitCode:ne},projects:I},V=w.join(t,".rapidkit","reports","workspace-run-last.json");return await ye(V,J),e.json||(p&&(console.log(S.red(`\u274C Workspace run blocked by ${p.gate}`)),console.log(S.gray(` ${p.summary}`))),console.log(S.cyan(`Workspace run (${e.stage}) => passed: ${R}, failed: ${F}, skipped: ${_}`)),console.log(S.gray(`Report: ${V}`))),J}export{Ke as a};
|
package/dist/chunk-Y3UKTEZO.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {j as j$1}from'./chunk-4E6ZGX6V.js';import u from'path';import l from'fs-extra';var w=".rapidkit/workspace.contract.json",h=1;function j(r){return r.replace(/\\/g,"/")}function b(r){let s=j(r).trim();return !s||s.startsWith("/")||s.startsWith("~")||/^[a-zA-Z]:\//.test(s)||s.includes("\0")?false:!s.split("/").filter(Boolean).some(e=>e===".."||e===".")}function W(r){return Array.isArray(r)?r.filter(s=>typeof s=="string"&&s.trim().length>0):[]}async function A(r){let s=u.join(r,".rapidkit","workspace.json");try{let e=await l.readJson(s);return {name:typeof e.workspace_name=="string"&&e.workspace_name.trim()||typeof e.name=="string"&&e.name.trim()||u.basename(r),profile:typeof e.profile=="string"?e.profile:void 0}}catch{return {name:u.basename(r)}}}async function $(r){let s=[],e=[r],n=new Set,c=new Set([".git","node_modules",".venv","venv","dist","build","target",".next",".turbo",".cache"]);for(;e.length>0;){let a=e.shift();if(!a||n.has(a))continue;n.add(a);let i=u.join(a,".rapidkit","project.json");if(await l.pathExists(i)){s.push(i);continue}let p;try{p=await l.readdir(a,{withFileTypes:true});}catch{continue}for(let t of p)!t.isDirectory()||c.has(t.name)||e.push(u.join(a,t.name));}return s.sort()}function S(r){let s=(r||"").toLowerCase();if(s.includes("fastapi"))return "fastapi";if(s.includes("nestjs"))return "nestjs";if(s.includes("springboot"))return "springboot";if(s.includes("gofiber"))return "fiber";if(s.includes("gogin"))return "gin"}function E(r,s){let e=(r||"").toLowerCase(),n=(s||"").toLowerCase();return e.includes("fastapi")?8e3:e.includes("nestjs")?3e3:e.includes("springboot")?8080:e.includes("gofiber")?3e3:e.includes("gogin")?8080:n==="node"?3e3:n==="python"?8e3:n==="java"||n==="go"?8080:null}function O(r,s){let e=r;for(;s.has(e)&&e<65535;)e+=1;return e}function k(r,s,e){let n=E(s.kit,s.runtime),c=r?.ports||[],a=c.length>0?c:n?[{name:"http",port:O(n,e),protocol:"http"}]:[];for(let t of a)e.add(t.port);let i={...s,...r,slug:r?.slug||s.slug,relativePath:r?.relativePath||s.relativePath,runtime:r?.runtime||s.runtime,framework:r?.framework||s.framework,kit:r?.kit||s.kit,modules:r?.modules?.length?r.modules:s.modules,ports:a,contracts:{owns:r?.contracts?.owns||[],apis:r?.contracts?.apis||[],publishes:r?.contracts?.publishes||[],consumes:r?.contracts?.consumes||[],dependsOn:r?.contracts?.dependsOn||[],env:r?.contracts?.env||[]}},p=JSON.stringify(r||null)!==JSON.stringify(i);return {project:i,changed:p}}async function y(r){let s=u.resolve(r.workspacePath),e=await A(s),n=await $(s),c=[];for(let a of n){let i=u.dirname(u.dirname(a)),p=j(u.relative(s,i)),t=await l.readJson(a),o=typeof t.kit_name=="string"&&t.kit_name||typeof t.kit=="string"&&t.kit||void 0,f=typeof t.framework=="string"&&t.framework||S(o);c.push({slug:p||u.basename(i),relativePath:p,runtime:typeof t.runtime=="string"?t.runtime:void 0,framework:f,kit:o,modules:W(t.modules),ports:[],contracts:{owns:[],apis:[],publishes:[],consumes:[],dependsOn:[],env:[]}});}return {schemaVersion:h,kind:"rapidkit.workspace.contract",generatedAt:(r.now??new Date).toISOString(),workspace:e,projects:c}}async function D(r){let s=u.resolve(r.outputPath||u.join(r.workspacePath,w));if(await l.pathExists(s)&&r.force!==true)throw new Error(`Workspace contract already exists: ${s}. Use --force to overwrite.`);let e=await y({workspacePath:r.workspacePath,now:r.now}),n=new Set,c={...e,projects:e.projects.map(a=>k(void 0,a,n).project)};return await l.ensureDir(u.dirname(s)),await l.writeJson(s,c,{spaces:2}),{contractPath:s,contract:c}}async function G(r){let s=u.resolve(r.workspacePath),e=u.join(s,w),n=await y({workspacePath:s,now:r.now}),c=await l.pathExists(e)?await l.readJson(e):null,a=new Map((c?.projects||[]).map(d=>[d.slug,d])),i=new Set,p=[],t=[],o=[];for(let d of n.projects){let g=a.get(d.slug),P=k(g,d,i);g?P.changed&&t.push(d.slug):p.push(d.slug),o.push(P.project),a.delete(d.slug);}for(let d of a.values()){let g=k(d,d,i);o.push(g.project);}let f={schemaVersion:h,kind:"rapidkit.workspace.contract",generatedAt:(r.now??new Date).toISOString(),workspace:{...n.workspace,...c?.workspace||{},name:c?.workspace?.name||n.workspace.name},projects:o.sort((d,g)=>d.slug.localeCompare(g.slug))};await l.ensureDir(u.dirname(e)),await l.writeJson(e,f,{spaces:2});let m=await R({workspacePath:s});return {contractPath:e,contract:f,addedProjects:p,updatedProjects:t,verification:m}}async function v(r){let s=u.resolve(r.contractPath||u.join(r.workspacePath,w)),e=await l.readJson(s);return {contractPath:s,contract:e}}async function I(r){let{contractPath:s,contract:e}=await v(r),n=e.projects.map(t=>({id:t.slug,label:t.slug,relativePath:t.relativePath,runtime:t.runtime,framework:t.framework,kit:t.kit,modules:t.modules,ports:t.ports,apis:t.contracts.apis,owns:t.contracts.owns,env:t.contracts.env})),c=new Set(n.map(t=>t.id)),a=new Map,i=[];for(let t of e.projects){for(let o of t.contracts.dependsOn||[])c.has(o)&&i.push({from:o,to:t.slug,type:"dependency",label:"dependsOn"});for(let o of t.contracts.publishes||[])a.has(o)||a.set(o,new Set),a.get(o)?.add(t.slug);}for(let t of e.projects)for(let o of t.contracts.consumes||[]){let f=a.get(o);if(f)for(let m of f)m!==t.slug&&i.push({from:m,to:t.slug,type:"event",label:o});}let p={schemaVersion:1,kind:"rapidkit.workspace.contract.graph",workspace:e.workspace,generatedAt:new Date().toISOString(),nodes:n.sort((t,o)=>t.id.localeCompare(o.id)),edges:i.sort((t,o)=>`${t.from}:${t.to}:${t.type}:${t.label}`.localeCompare(`${o.from}:${o.to}:${o.type}:${o.label}`)),summary:{projectCount:n.length,dependencyEdges:i.filter(t=>t.type==="dependency").length,eventEdges:i.filter(t=>t.type==="event").length,portCount:n.reduce((t,o)=>t+o.ports.length,0),apiCount:n.reduce((t,o)=>t+o.apis.length,0)}};return {contractPath:s,graph:p}}async function R(r){let{contractPath:s,contract:e}=await v(r),n=[],c=[];e.kind!=="rapidkit.workspace.contract"&&n.push("Contract kind must be rapidkit.workspace.contract."),e.schemaVersion!==h&&n.push(`Contract schemaVersion must be ${h}.`),e.workspace?.name||n.push("Contract workspace.name is required."),Array.isArray(e.projects)||n.push("Contract projects must be an array.");let a=new Set,i=new Map;for(let t of e.projects||[]){if(!t.slug){n.push("Every project must declare slug.");continue}a.has(t.slug)&&n.push(`Duplicate project slug: ${t.slug}.`),a.add(t.slug),t.relativePath?b(t.relativePath)||n.push(`Project ${t.slug} declares unsafe relativePath: ${t.relativePath}.`):n.push(`Project ${t.slug} must declare relativePath.`);for(let o of t.ports||[]){(!Number.isInteger(o.port)||o.port<1||o.port>65535)&&n.push(`Project ${t.slug} declares invalid port: ${o.port}.`);let f=i.get(o.port);f&&n.push(`Port ${o.port} is claimed by both ${f} and ${t.slug}.`),i.set(o.port,t.slug);}for(let o of t.contracts?.apis||[])(!o.name?.trim()||!o.basePath?.startsWith("/"))&&n.push(`Project ${t.slug} declares invalid API contract.`);for(let o of [...t.contracts?.publishes||[],...t.contracts?.consumes||[]])o.trim()||n.push(`Project ${t.slug} declares an empty event contract.`);for(let o of t.contracts?.env||[])/^[A-Z_][A-Z0-9_]*$/.test(o)||n.push(`Project ${t.slug} declares invalid env contract: ${o}.`);for(let o of t.contracts?.dependsOn||[])a.has(o);}for(let t of e.projects||[])for(let o of t.contracts?.dependsOn||[])a.has(o)||n.push(`Project ${t.slug} depends on unknown project: ${o}.`);c.push({id:"schema",status:e.kind==="rapidkit.workspace.contract"&&e.schemaVersion===h?"passed":"failed",message:"Contract schema and kind are valid."}),c.push({id:"projects",status:Array.isArray(e.projects)?"passed":"failed",message:`Contract declares ${Array.isArray(e.projects)?e.projects.length:0} project(s).`}),c.push({id:"ports",status:n.some(t=>t.toLowerCase().includes("port"))?"failed":"passed",message:"Project port declarations are valid and collision-free."}),c.push({id:"dependencies",status:n.some(t=>t.includes("depends on unknown project"))?"failed":"passed",message:"Project dependencies point to known project slugs."}),c.push({id:"contracts",status:n.some(t=>t.includes("unsafe relativePath")||t.includes("invalid API contract")||t.includes("event contract")||t.includes("env contract"))?"failed":"passed",message:"Project path, API, event, and env contracts are valid."});let p=await j$1(r.workspacePath);if(p.moduleCount>0){for(let t of p.issues)n.push(`${u.basename(t.projectRoot)}: ${t.message} (slug=${t.slug})`);c.push({id:"module-paths",status:p.status,message:p.status==="passed"?`All ${p.moduleCount} registered module(s) resolve under canonical paths.`:`${p.issues.length} registered module(s) missing canonical install paths.`});}else r.strict&&c.push({id:"module-paths",status:"passed",message:"No registry-backed modules declared in workspace projects."});return {status:n.length>0?"failed":"passed",contractPath:s,projectCount:Array.isArray(e.projects)?e.projects.length:0,checks:c,violations:n}}
|
|
2
|
-
export{w as a,h as b,$ as c,y as d,D as e,G as f,v as g,I as h,R as i};
|