rapidkit 0.31.0 → 0.32.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import {b as b$1,c as c$1}from'./chunk-U7XJZHU6.js';import {b}from'./chunk-AC6KIKII.js';import {promises}from'fs';import c from'path';import n from'chalk';import R from'ora';import {execa}from'execa';var y="21",$="3.5.0",j="2.8.9";function u(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,".").replace(/^\.+|\.+$/g,"").replace(/\.{2,}/g,".").split(".").map(p=>p.replace(/^[^a-z]+/,"").replace(/[^a-z0-9]/g,"")).filter(Boolean).join(".")}function _(e,t){return e.replace(/[\r\n\t]+/g," ").trim()||t}function x(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-")}function M(e,t){let s=u(e)||"com.rapidkit.apps",p=u(t)||"service";return `${s}.${p}`}function E(e){return e.replace(/\./g,"/")}function T(){return JSON.stringify({engine:"npm",runtime:"java"},null,2)}function A(e,t){return JSON.stringify({kit_name:"springboot.standard",runtime:"java",module_support:false,project_name:e.project_name,artifact_id:e.artifact_id,group_id:e.group_id,package_name:e.package_name,app_version:e.app_version,created_by:"rapidkit-npm",rapidkit_version:t,created_at:new Date().toISOString()},null,2)}function P(e){return `<?xml version="1.0" encoding="UTF-8"?>
1
+ import {b as b$1,c}from'./chunk-3Q7264EJ.js';import {b}from'./chunk-AC6KIKII.js';import {promises}from'fs';import g from'path';import r from'chalk';import R from'ora';import {execa}from'execa';var y="21",$="3.5.0",j="2.8.9";function u(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,".").replace(/^\.+|\.+$/g,"").replace(/\.{2,}/g,".").split(".").map(p=>p.replace(/^[^a-z]+/,"").replace(/[^a-z0-9]/g,"")).filter(Boolean).join(".")}function _(e,t){return e.replace(/[\r\n\t]+/g," ").trim()||t}function x(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-")}function M(e,t){let s=u(e)||"com.rapidkit.apps",p=u(t)||"service";return `${s}.${p}`}function E(e){return e.replace(/\./g,"/")}function T(){return JSON.stringify({engine:"npm",runtime:"java"},null,2)}function A(e,t){return JSON.stringify({kit_name:"springboot.standard",runtime:"java",module_support:false,project_name:e.project_name,artifact_id:e.artifact_id,group_id:e.group_id,package_name:e.package_name,app_version:e.app_version,created_by:"rapidkit-npm",rapidkit_version:t,created_at:new Date().toISOString()},null,2)}function P(e){return `<?xml version="1.0" encoding="UTF-8"?>
2
2
  <project xmlns="http://maven.apache.org/POM/4.0.0"
3
3
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
4
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
@@ -687,11 +687,11 @@ class ServiceRuntimeE2ETest {
687
687
  assertThat(response.getBody()).containsEntry("status", "UP");
688
688
  }
689
689
  }
690
- `}async function re(e){try{await execa("mvn",["-N","wrapper:wrapper","-Dmaven=3.9.9"],{cwd:e,timeout:12e4});let t=c.join(e,"mvnw");return await promises.stat(t).then(()=>true).catch(()=>false)&&await promises.chmod(t,493),true}catch{return false}}async function ue(e,t){let s=x(t.artifact_id||t.project_name)||"service",p=u(t.group_id||"com.rapidkit.apps")||"com.rapidkit.apps",h=u(t.package_name||M(p,s))||"com.rapidkit.apps.service",r={project_name:t.project_name,artifact_id:s,group_id:p,package_name:h,author:_(t.author||"","RapidKit User"),description:_(t.description||"",`Spring Boot service generated with RapidKit - ${t.project_name}`),java_version:t.java_version||y,spring_boot_version:t.spring_boot_version||$,springdoc_version:t.springdoc_version||j,app_version:t.app_version||"0.1.0",port:t.port||"8080",skipGit:t.skipGit??false},I=b(),d=`${b$1(r.project_name)}Application`,a=E(r.package_name);try{await execa("mvn",["-version"],{timeout:3e3});}catch{console.log(n.yellow(`
691
- \u26A0 Maven not found in PATH - project will be scaffolded, but init/build commands require Maven 3.9+`)),console.log(n.gray(` Install: https://maven.apache.org/install.html
692
- `));}let m=R(`Generating Spring Boot project: ${r.project_name}...`).start();try{let i=(l,f)=>c$1(c.join(e,l),f),S=c.join(e,"rapidkit"),b=c.join(e,"rapidkit.cmd");await Promise.all([i("pom.xml",P(r)),i(".gitignore",F()),i(".editorconfig",z()),i(".env.example",W(r)),i(".dockerignore",H()),i("Dockerfile",U()),i("docker-compose.yml",G(r)),i(".github/workflows/ci.yml",K(r)),i("README.md",Y(r)),i("src/main/resources/application.yml",N(r)),i("src/test/resources/application.yml",J()),i(`src/main/java/${a}/${d}.java`,C(r,d)),i(`src/main/java/${a}/config/ApplicationInfoProperties.java`,D(r)),i(`src/main/java/${a}/config/OpenApiConfiguration.java`,B(r)),i(`src/main/java/${a}/application/SystemInfoService.java`,O(r)),i(`src/main/java/${a}/api/http/dto/SystemInfoResponse.java`,V(r)),i(`src/main/java/${a}/api/http/SystemInfoController.java`,L(r)),i(`src/main/java/${a}/api/http/ApiExceptionHandler.java`,q(r)),i(`src/test/java/${a}/${d}Tests.java`,ee(r,d)),i(`src/test/java/${a}/api/http/SystemInfoControllerTest.java`,te(r)),i(`src/test/java/${a}/ServiceRuntimeE2ETest.java`,ie(r)),i("scripts/perf-smoke.sh",X(r)),i(".rapidkit/project.json",A(r,I)),i(".rapidkit/context.json",T()),i("rapidkit",Q(r)),i("rapidkit.cmd",Z())]),await promises.chmod(S,493),await promises.chmod(b,493),await promises.chmod(c.join(e,"scripts","perf-smoke.sh"),493),await re(e)||console.log(n.yellow("\u26A0 Maven Wrapper could not be generated automatically. Run `mvn -N wrapper:wrapper -Dmaven=3.9.9` inside the project.")),m.succeed(n.green(`Project created at ${e}`));try{m.start("Resolving Maven dependencies...");let l=c.join(e,process.platform==="win32"?"mvnw.cmd":"mvnw"),f=await promises.stat(l).then(()=>l).catch(()=>"mvn");await execa(f,["-B","-q","-DskipTests","dependency:go-offline"],{cwd:e,timeout:18e4}),m.succeed(n.gray("\u2713 maven dependency warm-up completed"));}catch{m.warn(n.yellow("\u26A0 Maven dependency warm-up failed - run manually: mvn -B -DskipTests dependency:go-offline"));}if(!r.skipGit)try{await execa("git",["init"],{cwd:e}),await execa("git",["add","-A"],{cwd:e}),await execa("git",["commit","-m","chore: initial scaffold (rapidkit springboot.standard)"],{cwd:e});}catch{console.log(n.yellow("\u26A0 Git initialization failed - continuing without initial commit"));}console.log(n.green(`
690
+ `}async function ne(e){try{await execa("mvn",["-N","wrapper:wrapper","-Dmaven=3.9.9"],{cwd:e,timeout:12e4});let t=g.join(e,"mvnw");return await promises.stat(t).then(()=>true).catch(()=>false)&&await promises.chmod(t,493),true}catch{return false}}async function le(e,t){let s=x(t.artifact_id||t.project_name)||"service",p=u(t.group_id||"com.rapidkit.apps")||"com.rapidkit.apps",I=u(t.package_name||M(p,s))||"com.rapidkit.apps.service",n={project_name:t.project_name,artifact_id:s,group_id:p,package_name:I,author:_(t.author||"","RapidKit User"),description:_(t.description||"",`Spring Boot service generated with RapidKit - ${t.project_name}`),java_version:t.java_version||y,spring_boot_version:t.spring_boot_version||$,springdoc_version:t.springdoc_version||j,app_version:t.app_version||"0.1.0",port:t.port||"8080",skipGit:t.skipGit??false,skipInstall:t.skipInstall??false},h=b(),l=`${b$1(n.project_name)}Application`,a=E(n.package_name);try{await execa("mvn",["-version"],{timeout:3e3});}catch{console.log(r.yellow(`
691
+ \u26A0 Maven not found in PATH - project will be scaffolded, but init/build commands require Maven 3.9+`)),console.log(r.gray(` Install: https://maven.apache.org/install.html
692
+ `));}let c$1=R(`Generating Spring Boot project: ${n.project_name}...`).start();try{let i=(d,f)=>c(g.join(e,d),f),S=g.join(e,"rapidkit"),b=g.join(e,"rapidkit.cmd");if(await Promise.all([i("pom.xml",P(n)),i(".gitignore",F()),i(".editorconfig",z()),i(".env.example",W(n)),i(".dockerignore",H()),i("Dockerfile",U()),i("docker-compose.yml",G(n)),i(".github/workflows/ci.yml",K(n)),i("README.md",Y(n)),i("src/main/resources/application.yml",N(n)),i("src/test/resources/application.yml",J()),i(`src/main/java/${a}/${l}.java`,C(n,l)),i(`src/main/java/${a}/config/ApplicationInfoProperties.java`,D(n)),i(`src/main/java/${a}/config/OpenApiConfiguration.java`,B(n)),i(`src/main/java/${a}/application/SystemInfoService.java`,O(n)),i(`src/main/java/${a}/api/http/dto/SystemInfoResponse.java`,V(n)),i(`src/main/java/${a}/api/http/SystemInfoController.java`,L(n)),i(`src/main/java/${a}/api/http/ApiExceptionHandler.java`,q(n)),i(`src/test/java/${a}/${l}Tests.java`,ee(n,l)),i(`src/test/java/${a}/api/http/SystemInfoControllerTest.java`,te(n)),i(`src/test/java/${a}/ServiceRuntimeE2ETest.java`,ie(n)),i("scripts/perf-smoke.sh",X(n)),i(".rapidkit/project.json",A(n,h)),i(".rapidkit/context.json",T()),i("rapidkit",Q(n)),i("rapidkit.cmd",Z())]),await promises.chmod(S,493),await promises.chmod(b,493),await promises.chmod(g.join(e,"scripts","perf-smoke.sh"),493),n.skipInstall||await ne(e)||console.log(r.yellow("\u26A0 Maven Wrapper could not be generated automatically. Run `mvn -N wrapper:wrapper -Dmaven=3.9.9` inside the project.")),c$1.succeed(r.green(`Project created at ${e}`)),n.skipInstall)c$1.info(r.gray("Skipped Maven dependency warm-up (--skip-install)."));else try{c$1.start("Resolving Maven dependencies...");let d=g.join(e,process.platform==="win32"?"mvnw.cmd":"mvnw"),f=await promises.stat(d).then(()=>d).catch(()=>"mvn");await execa(f,["-B","-q","-DskipTests","dependency:go-offline"],{cwd:e,timeout:18e4}),c$1.succeed(r.gray("\u2713 maven dependency warm-up completed"));}catch{c$1.warn(r.yellow("\u26A0 Maven dependency warm-up failed - run manually: mvn -B -DskipTests dependency:go-offline"));}if(!n.skipGit)try{await execa("git",["init"],{cwd:e}),await execa("git",["add","-A"],{cwd:e}),await execa("git",["commit","-m","chore: initial scaffold (rapidkit springboot.standard)"],{cwd:e});}catch{console.log(r.yellow("\u26A0 Git initialization failed - continuing without initial commit"));}console.log(r.green(`
693
693
  \u2728 Spring Boot project created successfully!
694
- `)),console.log(n.cyan("\u{1F4C2} Location:"),n.white(e)),console.log(n.cyan(`
694
+ `)),console.log(r.cyan("\u{1F4C2} Location:"),r.white(e)),console.log(r.cyan(`
695
695
  \u{1F680} Get started:
696
- `)),console.log(n.white(` cd ${r.project_name}`)),console.log(n.white(" ./rapidkit init")),console.log(n.white(` ./rapidkit dev
697
- `)),console.log(n.gray("Endpoints: /actuator/health, /api/v1/system/info, /docs"));}catch(i){m.fail("Failed to create Spring Boot project");try{await promises.rm(e,{recursive:true,force:true});}catch{}throw i}}export{y as DEFAULT_JAVA_VERSION,j as DEFAULT_SPRINGDOC_VERSION,$ as DEFAULT_SPRING_BOOT_VERSION,ue as generateSpringBootKit};
696
+ `)),console.log(r.white(` cd ${n.project_name}`)),console.log(r.white(" ./rapidkit init")),console.log(r.white(` ./rapidkit dev
697
+ `)),console.log(r.gray("Endpoints: /actuator/health, /api/v1/system/info, /docs"));}catch(i){c$1.fail("Failed to create Spring Boot project");try{await promises.rm(e,{recursive:true,force:true});}catch{}throw i}}export{y as DEFAULT_JAVA_VERSION,j as DEFAULT_SPRINGDOC_VERSION,$ as DEFAULT_SPRING_BOOT_VERSION,le as generateSpringBootKit};
@@ -1,6 +1,6 @@
1
1
  import {a}from'./chunk-VKLL63TL.js';import {c}from'./chunk-NFUXULIF.js';import {j}from'./chunk-Z5LKRG57.js';import {b}from'./chunk-AC6KIKII.js';import {promises}from'fs';import o from'path';import i from'chalk';import S from'ora';import {execa}from'execa';function _(e){let t=o.resolve(e);return process.platform==="win32"?t.toLowerCase():t}function O(e){let t=_(e.path),r=Array.isArray(e.projects)?e.projects:[],a=[],c=new Set;for(let s of r){if(!s||typeof s.name!="string"||typeof s.path!="string")continue;let n=_(s.path);c.has(n)||(c.add(n),a.push({name:s.name,path:n}));}return {name:e.name,path:t,mode:e.mode,projects:a}}function P(e){let t=[],r=new Set;for(let a of e.workspaces||[]){if(!a||typeof a.name!="string"||typeof a.path!="string")continue;let c=O(a);r.has(c.path)||(r.add(c.path),t.push(c));}return {workspaces:t}}async function B(e,t){try{let r=_(e),a=j(),c=o.join(a,"workspaces.json");await promises.mkdir(a,{recursive:true});let s={workspaces:[]};try{let p=await promises.readFile(c,"utf8"),d=JSON.parse(p);d&&Array.isArray(d.workspaces)&&(s=P(d));}catch{}s.workspaces.some(p=>p.path===r)||(s.workspaces.push({name:t,path:r,mode:"full",projects:[]}),await promises.writeFile(c,JSON.stringify(s,null,2)));}catch{console.warn(i.gray("Note: Could not register workspace in shared registry"));}}async function ae(e,t=false){try{let r=_(e),a=j(),c=o.join(a,"workspaces.json"),s={workspaces:[]};try{let m=await promises.readFile(c,"utf8"),y=JSON.parse(m);y&&Array.isArray(y.workspaces)&&(s=P(y));}catch{t||console.log("\u26A0\uFE0F Workspace registry not found");return}let n=s.workspaces.find(m=>m.path===r);if(!n){t||console.log("\u26A0\uFE0F Workspace not registered in registry");return}Array.isArray(n.projects)||(n.projects=[]);let p=0,d=0,u=[e],g=new Set;for(;u.length>0;){let m=u.shift();if(!m||g.has(m))continue;g.add(m);let y=await promises.readdir(m,{withFileTypes:true});for(let w of y){if(!w.isDirectory()||w.name.startsWith(".")||["node_modules","dist","build","target","coverage","htmlcov"].includes(w.name))continue;let h=o.join(m,w.name),f=_(h),R=o.join(f,".rapidkit","context.json"),k=o.join(f,".rapidkit","project.json");try{let $=false;try{await promises.access(R),$=true;}catch{await promises.access(k),$=true;}if($){let x=o.basename(f);n.projects.some(j=>j.path===f||j.name===x)?d++:(n.projects.push({name:x,path:f}),p++,t||console.log(`\u2714 Added: ${o.relative(e,f)}`));continue}}catch{}u.push(h);}}p>0?(await promises.writeFile(c,JSON.stringify(s,null,2)),t||console.log(`
2
2
  \u2705 Synced ${p} project(s) to registry`)):t||console.log(`
3
- \u2705 All projects already registered (${d} found)`);}catch(r){t||console.error("\u274C Failed to sync projects:",r.message);}}async function oe(e,t,r){try{let a=_(e),c=_(r),s=j(),n=o.join(s,"workspaces.json"),p={workspaces:[]};try{let g=await promises.readFile(n,"utf8"),m=JSON.parse(g);m&&Array.isArray(m.workspaces)&&(p=P(m));}catch{return}let d=p.workspaces.find(g=>g.path===a);if(!d)return;Array.isArray(d.projects)||(d.projects=[]),d.projects.some(g=>g.path===c||g.name===t)||(d.projects.push({name:t,path:c}),await promises.writeFile(n,JSON.stringify(p,null,2)));}catch{}}async function ne(e,t){let r=S("Creating RapidKit workspace...").start();try{await promises.mkdir(e,{recursive:true}),await promises.mkdir(o.join(e,".rapidkit"),{recursive:true});let a={workspace_name:t.name,author:t.author,rapidkit_version:b(),created_at:new Date().toISOString(),type:"workspace"};await promises.writeFile(o.join(e,".rapidkit","config.json"),JSON.stringify(a,null,2));let{syncWorkspaceFoundationFiles:c}=await import('./create-KZYI3QRI.js');await c(e,{workspaceName:t.name,installMethod:"venv",writeMarker:true,writeGitignore:false,onlyIfMissing:true});let s=T();await promises.writeFile(o.join(e,"rapidkit"),s),await promises.chmod(o.join(e,"rapidkit"),493);let n=z();await promises.writeFile(o.join(e,"rapidkit.cmd"),n);let p=U(t.name);if(await promises.writeFile(o.join(e,"README.md"),p),await promises.writeFile(o.join(e,".gitignore"),`# RapidKit workspace
3
+ \u2705 All projects already registered (${d} found)`);}catch(r){t||console.error("\u274C Failed to sync projects:",r.message);}}async function oe(e,t,r){try{let a=_(e),c=_(r),s=j(),n=o.join(s,"workspaces.json"),p={workspaces:[]};try{let g=await promises.readFile(n,"utf8"),m=JSON.parse(g);m&&Array.isArray(m.workspaces)&&(p=P(m));}catch{return}let d=p.workspaces.find(g=>g.path===a);if(!d)return;Array.isArray(d.projects)||(d.projects=[]),d.projects.some(g=>g.path===c||g.name===t)||(d.projects.push({name:t,path:c}),await promises.writeFile(n,JSON.stringify(p,null,2)));}catch{}}async function ne(e,t){let r=S("Creating RapidKit workspace...").start();try{await promises.mkdir(e,{recursive:true}),await promises.mkdir(o.join(e,".rapidkit"),{recursive:true});let a={workspace_name:t.name,author:t.author,rapidkit_version:b(),created_at:new Date().toISOString(),type:"workspace"};await promises.writeFile(o.join(e,".rapidkit","config.json"),JSON.stringify(a,null,2));let{syncWorkspaceFoundationFiles:c}=await import('./create-6AMYKNEG.js');await c(e,{workspaceName:t.name,installMethod:"venv",writeMarker:true,writeGitignore:false,onlyIfMissing:true});let s=T();await promises.writeFile(o.join(e,"rapidkit"),s),await promises.chmod(o.join(e,"rapidkit"),493);let n=z();await promises.writeFile(o.join(e,"rapidkit.cmd"),n);let p=U(t.name);if(await promises.writeFile(o.join(e,"README.md"),p),await promises.writeFile(o.join(e,".gitignore"),`# RapidKit workspace
4
4
  .env
5
5
  .env.*
6
6
  !.env.example
@@ -1,3 +1,3 @@
1
- import _ from'crypto';import O from'os';import l from'path';import F from'zlib';import u from'fs-extra';var y=".rapidkit/archive-manifest.json",z="workspai.workspace.archive",L=new Set(["__pycache__",".venv","venv","node_modules",".git","dist","build","target",".pytest_cache",".mypy_cache",".ruff_cache","htmlcov",".next",".turbo",".cache"]),M=new Set([".DS_Store","Thumbs.db",".coverage","npm-debug.log","yarn-error.log","pnpm-debug.log"]),N=[/^\.env$/i,/^\.env\.(?!example$|sample$|template$).+/i,/^.*\.pem$/i,/^.*\.key$/i,/^id_rsa$/i,/^id_ed25519$/i];function A(e){return e.replace(/\\/g,"/")}function B(e){return e.replace(/\.rapidkit-archive\.zip$/i,"").replace(/\.zip$/i,"").trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/-+/g,"-").replace(/^[-_.]+|[-_.]+$/g,"").slice(0,64)||"imported-workspace"}function j(e){let t=A(e).trim();if(!t||t.startsWith("/")||t.startsWith("~")||/^[a-zA-Z]:\//.test(t)||t.includes("\0"))return false;let r=t.split("/").filter(Boolean);return r.length>0&&!r.some(a=>a===".."||a===".")}function I(e){if(!j(e))throw new Error(`Archive contains an unsafe path: ${e}`)}function Z(e,t){let r=l.relative(t,e);return r===""||!!r&&!r.startsWith("..")&&!l.isAbsolute(r)}function H(e,t){let a=A(e).split("/").filter(Boolean);if(a.some(n=>L.has(n)))return true;let i=a[a.length-1]||"";return M.has(i)||!t?.includeEnv&&N.some(n=>n.test(i))?true:i.endsWith(".pyc")||i.endsWith(".log")}function R(e){return _.createHash("sha256").update(e).digest("hex")}var T=new Uint32Array(256).map((e,t)=>{let r=t;for(let a=0;a<8;a+=1)r=r&1?3988292384^r>>>1:r>>>1;return r>>>0});function b(e){let t=4294967295;for(let r of e)t=T[(t^r)&255]^t>>>8;return (t^4294967295)>>>0}function h(e){let t=Buffer.allocUnsafe(2);return t.writeUInt16LE(e,0),t}function m(e){let t=Buffer.allocUnsafe(4);return t.writeUInt32LE(e>>>0,0),t}function V(e){let t=Math.max(e.getFullYear(),1980),r=e.getHours()<<11|e.getMinutes()<<5|Math.floor(e.getSeconds()/2),a=t-1980<<9|e.getMonth()+1<<5|e.getDate();return {time:r,date:a}}async function C(e,t,r,a){let i=await u.readdir(t,{withFileTypes:true});for(let n of i){let s=l.join(t,n.name),o=A(l.relative(e,s));if(!(!o||H(o,a))){if(n.isDirectory()){await C(e,s,r,a);continue}n.isFile()&&r.push({relativePath:o,fullPath:s});}}}async function K(e){let t=l.join(e,".rapidkit","workspace.json");try{let r=await u.readJson(t);if(typeof r.workspace_name=="string"&&r.workspace_name.trim())return r.workspace_name.trim();if(typeof r.name=="string"&&r.name.trim())return r.name.trim()}catch{}return l.basename(l.resolve(e))}async function q(e,t,r){let a=[];await C(e,e,a,r);let i=[];for(let s of a.sort((o,p)=>o.relativePath.localeCompare(p.relativePath))){let o=await u.readFile(s.fullPath);if(o.length>=4294967295)throw new Error(`File is too large for portable workspace archive: ${s.relativePath}`);t.files.push({path:s.relativePath,size:o.length,sha256:R(o)}),i.push({name:s.relativePath,data:o,crc32:b(o),size:o.length,offset:0});}let n=Buffer.from(`${JSON.stringify(t,null,2)}
2
- `,"utf-8");return i.push({name:y,data:n,crc32:b(n),size:n.length,offset:0}),i}function J(e,t=new Date){let r=[],a=[],i=0,n=V(t);for(let f of e){let d=Buffer.from(f.name,"utf-8");f.offset=i;let w=Buffer.concat([m(67324752),h(20),h(2048),h(0),h(n.time),h(n.date),m(f.crc32),m(f.size),m(f.size),h(d.length),h(0),d]);r.push(w,f.data),i+=w.length+f.data.length;}let s=i;for(let f of e){let d=Buffer.from(f.name,"utf-8"),w=Buffer.concat([m(33639248),h(20),h(20),h(2048),h(0),h(n.time),h(n.date),m(f.crc32),m(f.size),m(f.size),h(d.length),h(0),h(0),h(0),h(0),m(0),m(f.offset),d]);a.push(w),i+=w.length;}let o=i-s,p=Buffer.concat([m(101010256),h(0),h(0),h(e.length),h(e.length),m(o),m(s),h(0)]);return Buffer.concat([...r,...a,p])}async function he(e){let t=l.resolve(e.workspacePath);if(!await u.pathExists(l.join(t,".rapidkit-workspace")))throw new Error("Workspace export requires a RapidKit workspace root with .rapidkit-workspace.");let r=await K(t),a=l.resolve(e.outputPath||`${B(r)}.rapidkit-archive.zip`),i={version:1,kind:z,workspaceName:r,exportedAt:(e.now??new Date).toISOString(),exportedBy:"rapidkit-npm",archiveFormat:"zip-store",security:{envFilesIncluded:e.includeEnv===true,excludedByDefault:[".git","node_modules",".venv","dist","build","target",".env","*.pem","*.key","*.log"]},files:[]},n=await q(t,i,{includeEnv:e.includeEnv===true}),s=J(n,e.now??new Date);return await u.ensureDir(l.dirname(a)),await u.writeFile(a,s),{archivePath:a,manifest:i,bytesWritten:s.length}}function X(e){let t=Math.max(0,e.length-65535-22);for(let r=e.length-22;r>=t;r-=1)if(e.readUInt32LE(r)===101010256)return r;throw new Error("Invalid ZIP archive: end of central directory not found.")}function G(e){let t=X(e),r=e.readUInt16LE(t+10),a=e.readUInt32LE(t+16),i=[],n=a;for(let s=0;s<r;s+=1){if(e.readUInt32LE(n)!==33639248)throw new Error("Invalid ZIP archive: central directory is corrupted.");let o=e.readUInt16LE(n+10);if(o!==0&&o!==8)throw new Error("Unsupported ZIP archive: only stored/deflated entries are supported by RapidKit npm.");let p=e.readUInt32LE(n+20),f=e.readUInt32LE(n+24),d=e.readUInt16LE(n+28),w=e.readUInt16LE(n+30),c=e.readUInt16LE(n+32),v=e.readUInt32LE(n+42),g=e.subarray(n+46,n+46+d).toString("utf-8");I(g);let D=g.endsWith("/");if(e.readUInt32LE(v)!==67324752)throw new Error(`Invalid ZIP archive: local header missing for ${g}.`);let S=e.readUInt16LE(v+26),$=e.readUInt16LE(v+28),x=v+30+S+$,k=e.subarray(x,x+p);if(k.length!==p)throw new Error(`Invalid ZIP archive: size mismatch for ${g}.`);if(D){if(p!==0||f!==0)throw new Error(`Invalid ZIP archive: directory entry contains data for ${g}.`);n+=46+d+w+c;continue}let W=o===8?F.inflateRawSync(k):k;if(W.length!==f)throw new Error(`Invalid ZIP archive: inflated size mismatch for ${g}.`);i.push({name:g,data:W,size:f}),n+=46+d+w+c;}return i}async function Y(e){if(/^https?:\/\//i.test(e)){let t=await fetch(e);if(!t.ok)throw new Error(`Failed to download workspace archive: HTTP ${t.status}`);let r=Buffer.from(await t.arrayBuffer()),a=await u.mkdtemp(l.join(O.tmpdir(),"rapidkit-workspace-archive-")),i=l.join(a,"workspace.rapidkit-archive.zip");return await u.writeFile(i,r),{archivePath:i,cleanup:a}}return {archivePath:l.resolve(e)}}function Q(e){let t=e.find(a=>a.name===y);if(!t)return null;let r=JSON.parse(t.data.toString("utf-8"));if(r.kind!==z)throw new Error("Archive manifest kind is not a RapidKit/Workspai workspace archive.");return r}async function E(e){let t=await Y(e);try{let r=await u.readFile(t.archivePath),a=G(r),i=Q(a);if(!i)throw new Error("Workspace archive is missing .rapidkit/archive-manifest.json.");return {archivePath:t.archivePath,entries:a,manifest:i,cleanup:t.cleanup}}catch(r){throw t.cleanup&&await u.remove(t.cleanup).catch(()=>{}),r}}async function P(e){e.cleanup&&await u.remove(e.cleanup).catch(()=>{});}async function ee(e){let t=await E(e.archivePathOrUrl);try{let r=new Map(t.entries.filter(i=>i.name!==y).map(i=>[i.name,i])),a=t.manifest.files.map(i=>({path:i.path,size:r.get(i.path)?.size??i.size,hasChecksum:typeof i.sha256=="string"&&i.sha256.length>0}));return {archivePath:t.archivePath,manifest:t.manifest,fileCount:a.length,totalBytes:a.reduce((i,n)=>i+n.size,0),entries:a}}finally{await P(t);}}async function U(e){let t=await E(e.archivePathOrUrl);try{let r=new Map(t.entries.filter(c=>c.name!==y).map(c=>[c.name,c])),a=new Set(t.manifest.files.map(c=>c.path)),i=[...r.keys()].filter(c=>!a.has(c)).sort(),n=[],s=[],o=[],p=0;for(let c of t.manifest.files){I(c.path);let v=r.get(c.path);if(!v){n.push(c.path);continue}let g={size:v.size,sha256:R(v.data)};if(v.size!==c.size){o.push({path:c.path,expected:{size:c.size,sha256:c.sha256},actual:g});continue}if(!c.sha256){s.push(c.path);continue}if(g.sha256!==c.sha256){o.push({path:c.path,expected:{size:c.size,sha256:c.sha256},actual:g});continue}p+=1;}let f=e.requireChecksums===true&&s.length>0,d=n.length>0||o.length>0||f||i.length>0,w=s.length>0;return {archivePath:t.archivePath,manifest:t.manifest,status:d?"failed":w?"warning":"passed",fileCount:t.manifest.files.length,totalBytes:t.manifest.files.reduce((c,v)=>c+v.size,0),verifiedFiles:p,missingChecksumFiles:s,missingArchiveEntries:n,extraArchiveEntries:i,mismatches:o}}finally{await P(t);}}async function fe(e){let t=await ee({archivePathOrUrl:e.archivePathOrUrl}),r=await U({archivePathOrUrl:e.archivePathOrUrl,requireChecksums:e.strict===true}),a=[],i=[];a.push({id:"manifest-present",status:"passed",message:`Archive manifest found for workspace "${t.manifest.workspaceName}".`}),a.push({id:"integrity",status:r.status,message:r.status==="passed"?`Verified ${r.verifiedFiles}/${r.fileCount} files.`:"Archive integrity verification did not fully pass."});let n=t.manifest.security?.envFilesIncluded===true;a.push({id:"secrets-policy",status:n?"warning":"passed",message:n?"Archive manifest says environment/private files were intentionally included.":"Archive manifest excludes environment/private files by default."}),n&&i.push("Share this archive only through trusted internal channels."),r.missingChecksumFiles.length>0&&i.push("Re-export the archive with the latest RapidKit/Workspai tooling."),r.mismatches.length>0&&i.push("Reject this archive and request a fresh export from the owner."),(r.extraArchiveEntries.length>0||r.missingArchiveEntries.length>0)&&i.push("Regenerate the archive so ZIP entries and manifest entries match."),e.strict===true&&r.status!=="passed"&&i.push("Do not hydrate this archive in strict or production workflows.");let s=a.some(p=>p.status==="failed"),o=a.some(p=>p.status==="warning");return {archivePath:t.archivePath,status:s?"failed":o?"warning":"passed",workspaceName:t.manifest.workspaceName,fileCount:t.fileCount,totalBytes:t.totalBytes,checks:a,recommendedActions:i}}async function te(e,t,r){if(!await u.pathExists(e)){r||await u.ensureDir(e);return}if((await u.readdir(e)).length>0&&!t)throw new Error(`Output directory is not empty: ${e}. Use --force to overwrite.`);r||await u.emptyDir(e);}async function le(e){let t=await E(e.archivePathOrUrl);try{let r=await U({archivePathOrUrl:t.archivePath,requireChecksums:e.strict===true});if(r.status==="failed"){let s=[r.missingArchiveEntries.length?`missing entries: ${r.missingArchiveEntries.join(", ")}`:"",r.extraArchiveEntries.length?`unexpected entries: ${r.extraArchiveEntries.join(", ")}`:"",r.mismatches.length?`checksum/size mismatches: ${r.mismatches.map(o=>o.path).join(", ")}`:"",r.missingChecksumFiles.length&&e.strict===true?`missing checksums: ${r.missingChecksumFiles.join(", ")}`:""].filter(Boolean).join("; ");throw new Error(`Workspace archive verification failed${s?` (${s})`:""}.`)}if(r.status==="warning"&&e.strict===true)throw new Error(`Workspace archive verification requires checksums for every file: ${r.missingChecksumFiles.join(", ")}`);let a=t.entries,i=t.manifest,n=l.resolve(e.outputPath||B(i.workspaceName||"imported-workspace"));await te(n,e.force===true,e.dryRun===true);for(let s of a){if(s.name===y)continue;let o=l.resolve(n,s.name);if(!Z(o,n))throw new Error(`Archive entry escapes output directory: ${s.name}`);e.dryRun||(await u.ensureDir(l.dirname(o)),await u.writeFile(o,s.data));}return {archivePath:t.archivePath,outputPath:n,dryRun:e.dryRun===true,manifest:i,files:a.filter(s=>s.name!==y).map(s=>({path:s.name,size:s.size}))}}finally{await P(t);}}
1
+ import _ from'crypto';import O from'os';import l from'path';import F from'zlib';import u from'fs-extra';var y=".rapidkit/archive-manifest.json",z="workspai.workspace.archive",L=new Set(["__pycache__",".venv","venv","node_modules",".git","dist","build","target",".pytest_cache",".mypy_cache",".ruff_cache","htmlcov",".next",".turbo",".cache"]),M=new Set([".DS_Store","Thumbs.db",".coverage","npm-debug.log","yarn-error.log","pnpm-debug.log"]),N=[/^\.env$/i,/^\.env\.(?!example$|sample$|template$).+/i,/^.*\.pem$/i,/^.*\.key$/i,/^id_rsa$/i,/^id_ed25519$/i];function A(e){return e.replace(/\\/g,"/")}function B(e){return e.replace(/\.rapidkit-archive\.zip$/i,"").replace(/\.zip$/i,"").trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/-+/g,"-").replace(/^[-_.]+|[-_.]+$/g,"").slice(0,64)||"imported-workspace"}function j(e){let t=A(e).trim();if(!t||t.startsWith("/")||t.startsWith("~")||/^[a-zA-Z]:\//.test(t)||t.includes("\0"))return false;let r=t.split("/").filter(Boolean);return r.length>0&&!r.some(a=>a===".."||a===".")}function I(e){if(!j(e))throw new Error(`Archive contains an unsafe path: ${e}`)}function Z(e,t){let r=l.relative(t,e);return r===""||!!r&&!r.startsWith("..")&&!l.isAbsolute(r)}function H(e,t){let a=A(e).split("/").filter(Boolean);if(a[0]===".rapidkit"&&["cache","reports"].includes(a[1]||"")||a.some(n=>L.has(n)))return true;let i=a[a.length-1]||"";return M.has(i)||!t?.includeEnv&&N.some(n=>n.test(i))?true:i.endsWith(".pyc")||i.endsWith(".log")}function R(e){return _.createHash("sha256").update(e).digest("hex")}var T=new Uint32Array(256).map((e,t)=>{let r=t;for(let a=0;a<8;a+=1)r=r&1?3988292384^r>>>1:r>>>1;return r>>>0});function b(e){let t=4294967295;for(let r of e)t=T[(t^r)&255]^t>>>8;return (t^4294967295)>>>0}function h(e){let t=Buffer.allocUnsafe(2);return t.writeUInt16LE(e,0),t}function m(e){let t=Buffer.allocUnsafe(4);return t.writeUInt32LE(e>>>0,0),t}function V(e){let t=Math.max(e.getFullYear(),1980),r=e.getHours()<<11|e.getMinutes()<<5|Math.floor(e.getSeconds()/2),a=t-1980<<9|e.getMonth()+1<<5|e.getDate();return {time:r,date:a}}async function C(e,t,r,a){let i=await u.readdir(t,{withFileTypes:true});for(let n of i){let s=l.join(t,n.name),c=A(l.relative(e,s));if(!(!c||H(c,a))){if(n.isDirectory()){await C(e,s,r,a);continue}n.isFile()&&r.push({relativePath:c,fullPath:s});}}}async function K(e){let t=l.join(e,".rapidkit","workspace.json");try{let r=await u.readJson(t);if(typeof r.workspace_name=="string"&&r.workspace_name.trim())return r.workspace_name.trim();if(typeof r.name=="string"&&r.name.trim())return r.name.trim()}catch{}return l.basename(l.resolve(e))}async function q(e,t,r){let a=[];await C(e,e,a,r);let i=[];for(let s of a.sort((c,p)=>c.relativePath.localeCompare(p.relativePath))){let c=await u.readFile(s.fullPath);if(c.length>=4294967295)throw new Error(`File is too large for portable workspace archive: ${s.relativePath}`);t.files.push({path:s.relativePath,size:c.length,sha256:R(c)}),i.push({name:s.relativePath,data:c,crc32:b(c),size:c.length,offset:0});}let n=Buffer.from(`${JSON.stringify(t,null,2)}
2
+ `,"utf-8");return i.push({name:y,data:n,crc32:b(n),size:n.length,offset:0}),i}function J(e,t=new Date){let r=[],a=[],i=0,n=V(t);for(let f of e){let d=Buffer.from(f.name,"utf-8");f.offset=i;let w=Buffer.concat([m(67324752),h(20),h(2048),h(0),h(n.time),h(n.date),m(f.crc32),m(f.size),m(f.size),h(d.length),h(0),d]);r.push(w,f.data),i+=w.length+f.data.length;}let s=i;for(let f of e){let d=Buffer.from(f.name,"utf-8"),w=Buffer.concat([m(33639248),h(20),h(20),h(2048),h(0),h(n.time),h(n.date),m(f.crc32),m(f.size),m(f.size),h(d.length),h(0),h(0),h(0),h(0),m(0),m(f.offset),d]);a.push(w),i+=w.length;}let c=i-s,p=Buffer.concat([m(101010256),h(0),h(0),h(e.length),h(e.length),m(c),m(s),h(0)]);return Buffer.concat([...r,...a,p])}async function he(e){let t=l.resolve(e.workspacePath);if(!await u.pathExists(l.join(t,".rapidkit-workspace")))throw new Error("Workspace export requires a RapidKit workspace root with .rapidkit-workspace.");let r=await K(t),a=l.resolve(e.outputPath||`${B(r)}.rapidkit-archive.zip`),i={version:1,kind:z,workspaceName:r,exportedAt:(e.now??new Date).toISOString(),exportedBy:"rapidkit-npm",archiveFormat:"zip-store",security:{envFilesIncluded:e.includeEnv===true,excludedByDefault:[".git","node_modules",".venv","dist","build","target",".env","*.pem","*.key","*.log"]},files:[]},n=await q(t,i,{includeEnv:e.includeEnv===true}),s=J(n,e.now??new Date);return await u.ensureDir(l.dirname(a)),await u.writeFile(a,s),{archivePath:a,manifest:i,bytesWritten:s.length}}function X(e){let t=Math.max(0,e.length-65535-22);for(let r=e.length-22;r>=t;r-=1)if(e.readUInt32LE(r)===101010256)return r;throw new Error("Invalid ZIP archive: end of central directory not found.")}function G(e){let t=X(e),r=e.readUInt16LE(t+10),a=e.readUInt32LE(t+16),i=[],n=a;for(let s=0;s<r;s+=1){if(e.readUInt32LE(n)!==33639248)throw new Error("Invalid ZIP archive: central directory is corrupted.");let c=e.readUInt16LE(n+10);if(c!==0&&c!==8)throw new Error("Unsupported ZIP archive: only stored/deflated entries are supported by RapidKit npm.");let p=e.readUInt32LE(n+20),f=e.readUInt32LE(n+24),d=e.readUInt16LE(n+28),w=e.readUInt16LE(n+30),o=e.readUInt16LE(n+32),v=e.readUInt32LE(n+42),g=e.subarray(n+46,n+46+d).toString("utf-8");I(g);let D=g.endsWith("/");if(e.readUInt32LE(v)!==67324752)throw new Error(`Invalid ZIP archive: local header missing for ${g}.`);let S=e.readUInt16LE(v+26),$=e.readUInt16LE(v+28),x=v+30+S+$,k=e.subarray(x,x+p);if(k.length!==p)throw new Error(`Invalid ZIP archive: size mismatch for ${g}.`);if(D){if(p!==0||f!==0)throw new Error(`Invalid ZIP archive: directory entry contains data for ${g}.`);n+=46+d+w+o;continue}let W=c===8?F.inflateRawSync(k):k;if(W.length!==f)throw new Error(`Invalid ZIP archive: inflated size mismatch for ${g}.`);i.push({name:g,data:W,size:f}),n+=46+d+w+o;}return i}async function Y(e){if(/^https?:\/\//i.test(e)){let t=await fetch(e);if(!t.ok)throw new Error(`Failed to download workspace archive: HTTP ${t.status}`);let r=Buffer.from(await t.arrayBuffer()),a=await u.mkdtemp(l.join(O.tmpdir(),"rapidkit-workspace-archive-")),i=l.join(a,"workspace.rapidkit-archive.zip");return await u.writeFile(i,r),{archivePath:i,cleanup:a}}return {archivePath:l.resolve(e)}}function Q(e){let t=e.find(a=>a.name===y);if(!t)return null;let r=JSON.parse(t.data.toString("utf-8"));if(r.kind!==z)throw new Error("Archive manifest kind is not a RapidKit/Workspai workspace archive.");return r}async function E(e){let t=await Y(e);try{let r=await u.readFile(t.archivePath),a=G(r),i=Q(a);if(!i)throw new Error("Workspace archive is missing .rapidkit/archive-manifest.json.");return {archivePath:t.archivePath,entries:a,manifest:i,cleanup:t.cleanup}}catch(r){throw t.cleanup&&await u.remove(t.cleanup).catch(()=>{}),r}}async function P(e){e.cleanup&&await u.remove(e.cleanup).catch(()=>{});}async function ee(e){let t=await E(e.archivePathOrUrl);try{let r=new Map(t.entries.filter(i=>i.name!==y).map(i=>[i.name,i])),a=t.manifest.files.map(i=>({path:i.path,size:r.get(i.path)?.size??i.size,hasChecksum:typeof i.sha256=="string"&&i.sha256.length>0}));return {archivePath:t.archivePath,manifest:t.manifest,fileCount:a.length,totalBytes:a.reduce((i,n)=>i+n.size,0),entries:a}}finally{await P(t);}}async function U(e){let t=await E(e.archivePathOrUrl);try{let r=new Map(t.entries.filter(o=>o.name!==y).map(o=>[o.name,o])),a=new Set(t.manifest.files.map(o=>o.path)),i=[...r.keys()].filter(o=>!a.has(o)).sort(),n=[],s=[],c=[],p=0;for(let o of t.manifest.files){I(o.path);let v=r.get(o.path);if(!v){n.push(o.path);continue}let g={size:v.size,sha256:R(v.data)};if(v.size!==o.size){c.push({path:o.path,expected:{size:o.size,sha256:o.sha256},actual:g});continue}if(!o.sha256){s.push(o.path);continue}if(g.sha256!==o.sha256){c.push({path:o.path,expected:{size:o.size,sha256:o.sha256},actual:g});continue}p+=1;}let f=e.requireChecksums===true&&s.length>0,d=n.length>0||c.length>0||f||i.length>0,w=s.length>0;return {archivePath:t.archivePath,manifest:t.manifest,status:d?"failed":w?"warning":"passed",fileCount:t.manifest.files.length,totalBytes:t.manifest.files.reduce((o,v)=>o+v.size,0),verifiedFiles:p,missingChecksumFiles:s,missingArchiveEntries:n,extraArchiveEntries:i,mismatches:c}}finally{await P(t);}}async function fe(e){let t=await ee({archivePathOrUrl:e.archivePathOrUrl}),r=await U({archivePathOrUrl:e.archivePathOrUrl,requireChecksums:e.strict===true}),a=[],i=[];a.push({id:"manifest-present",status:"passed",message:`Archive manifest found for workspace "${t.manifest.workspaceName}".`}),a.push({id:"integrity",status:r.status,message:r.status==="passed"?`Verified ${r.verifiedFiles}/${r.fileCount} files.`:"Archive integrity verification did not fully pass."});let n=t.manifest.security?.envFilesIncluded===true;a.push({id:"secrets-policy",status:n?"warning":"passed",message:n?"Archive manifest says environment/private files were intentionally included.":"Archive manifest excludes environment/private files by default."}),n&&i.push("Share this archive only through trusted internal channels."),r.missingChecksumFiles.length>0&&i.push("Re-export the archive with the latest RapidKit/Workspai tooling."),r.mismatches.length>0&&i.push("Reject this archive and request a fresh export from the owner."),(r.extraArchiveEntries.length>0||r.missingArchiveEntries.length>0)&&i.push("Regenerate the archive so ZIP entries and manifest entries match."),e.strict===true&&r.status!=="passed"&&i.push("Do not hydrate this archive in strict or production workflows.");let s=a.some(p=>p.status==="failed"),c=a.some(p=>p.status==="warning");return {archivePath:t.archivePath,status:s?"failed":c?"warning":"passed",workspaceName:t.manifest.workspaceName,fileCount:t.fileCount,totalBytes:t.totalBytes,checks:a,recommendedActions:i}}async function te(e,t,r){if(!await u.pathExists(e)){r||await u.ensureDir(e);return}if((await u.readdir(e)).length>0&&!t)throw new Error(`Output directory is not empty: ${e}. Use --force to overwrite.`);r||await u.emptyDir(e);}async function le(e){let t=await E(e.archivePathOrUrl);try{let r=await U({archivePathOrUrl:t.archivePath,requireChecksums:e.strict===true});if(r.status==="failed"){let s=[r.missingArchiveEntries.length?`missing entries: ${r.missingArchiveEntries.join(", ")}`:"",r.extraArchiveEntries.length?`unexpected entries: ${r.extraArchiveEntries.join(", ")}`:"",r.mismatches.length?`checksum/size mismatches: ${r.mismatches.map(c=>c.path).join(", ")}`:"",r.missingChecksumFiles.length&&e.strict===true?`missing checksums: ${r.missingChecksumFiles.join(", ")}`:""].filter(Boolean).join("; ");throw new Error(`Workspace archive verification failed${s?` (${s})`:""}.`)}if(r.status==="warning"&&e.strict===true)throw new Error(`Workspace archive verification requires checksums for every file: ${r.missingChecksumFiles.join(", ")}`);let a=t.entries,i=t.manifest,n=l.resolve(e.outputPath||B(i.workspaceName||"imported-workspace"));await te(n,e.force===true,e.dryRun===true);for(let s of a){if(s.name===y)continue;let c=l.resolve(n,s.name);if(!Z(c,n))throw new Error(`Archive entry escapes output directory: ${s.name}`);e.dryRun||(await u.ensureDir(l.dirname(c)),await u.writeFile(c,s.data));}return {archivePath:t.archivePath,outputPath:n,dryRun:e.dryRun===true,manifest:i,files:a.filter(s=>s.name!==y).map(s=>({path:s.name,size:s.size}))}}finally{await P(t);}}
3
3
  export{z as WORKSPACE_ARCHIVE_KIND,y as WORKSPACE_ARCHIVE_MANIFEST_PATH,fe as doctorWorkspaceArchive,he as exportWorkspaceArchive,le as hydrateWorkspaceArchive,ee as inspectWorkspaceArchive,j as isSafeArchiveEntryName,B as sanitizeWorkspaceArchiveName,H as shouldExcludeWorkspaceArchivePath,U as verifyWorkspaceArchive};
@@ -0,0 +1 @@
1
+ export{a as runWorkspaceStage}from'./chunk-LSFRHYMD.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rapidkit",
3
- "version": "0.31.0",
3
+ "version": "0.32.1",
4
4
  "type": "module",
5
5
  "description": "Official CLI for RapidKit, an open-source workspace platform that standardizes how teams build, scale, and deploy backend services.",
6
6
  "keywords": [
@@ -70,6 +70,8 @@
70
70
  "test:scenarios": "bash scripts/scenario-matrix-local.sh",
71
71
  "test:scenarios:full": "RAPIDKIT_SCENARIO_FULL_BOOTSTRAP=1 bash scripts/scenario-matrix-local.sh",
72
72
  "test:scenarios:docker": "bash scripts/scenario-matrix.sh",
73
+ "test:runtime-matrix": "node scripts/runtime-acceptance-matrix.mjs",
74
+ "test:runtime-matrix:full": "node scripts/runtime-acceptance-matrix.mjs --full",
73
75
  "lint": "eslint src --ext .ts",
74
76
  "lint:fix": "eslint src --ext .ts --fix",
75
77
  "format": "prettier --write \"src/**/*.ts\"",
@@ -1,4 +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",supportTier:"extended",importStack:"dotnet",aliases:["dotnet","asp.net","aspnet","asp.net core","csharp","c#"]},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:"first-class",importStack:"unknown",aliases:["rust"]},phoenix:{key:"phoenix",runtime:"elixir",displayName:"Phoenix",supportTier:"first-class",importStack:"unknown",aliases:["phoenix"]},elixir:{key:"elixir",runtime:"elixir",displayName:"Elixir",supportTier:"extended",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"]}},l=new Map;for(let e of Object.values(c))for(let n of e.aliases)l.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 p(e){return e.trim().toLowerCase().replace(/[_\s]+/g,"-")}function u(e){try{return a.existsSync(e)?a.readFileSync(e,"utf8").toLowerCase():""}catch{return ""}}function y(e){try{return a.existsSync(e)?JSON.parse(a.readFileSync(e,"utf8")):null}catch{return null}}function f(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 d=o.join(e,s.name);s.isDirectory()?t.push(...f(d,n-1)):t.push(d);}return t}function k(e,n,t=2){return f(e,t).some(r=>r.toLowerCase().endsWith(n.toLowerCase()))}function g(e){let n=p(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 m(e){return e?l.get(p(e))??"unknown":"unknown"}function D(e){return m(e)}function E(e){let n=m(e);return n!=="unknown"?c[n].runtime:"unknown"}function w(e){let n=g(e.kitName);if(n!=="unknown")return i(n,"high","kit");let t=m(e.framework);if(t!=="unknown")return i(t,"high","framework");let r=m(e.runtime);return r!=="unknown"?i(r,"medium","runtime"):i("unknown","low","unknown")}function x(e){let n=y(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(d=>typeof d=="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 b(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 S(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 h(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 j(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 B(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 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 F(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 T(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 L(e,n){let t=w({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=T(e);if(r.includes("node")){let s=x(e);if(s.key!=="unknown")return s}if(r.includes("python")){let s=b(e);if(s.key!=="unknown")return s}if(r.includes("go")){let s=S(e);if(s.key!=="unknown")return s}if(r.includes("java")){let s=h(e);if(s.key!=="unknown")return s}if(r.includes("php")){let s=j(e);if(s.key!=="unknown")return s}if(r.includes("ruby")){let s=B(e);if(s.key!=="unknown")return s}if(r.includes("rust")){let s=N(e);if(s.key!=="unknown")return s}if(r.includes("elixir")){let s=F(e);if(s.key!=="unknown")return s}return r.includes("dotnet")?i("dotnet","medium","marker"):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(m(r[0]),"medium","runtime"):i("unknown","low","unknown")}export{D as a,E as b,w as c,T as d,L as e};
@@ -1,50 +0,0 @@
1
- import {e}from'./chunk-TYC54P7X.js';import {c as c$1,a as a$2,b as b$1}from'./chunk-NFUXULIF.js';import {b,f,d,a as a$4,k,g,i as i$1}from'./chunk-Z5LKRG57.js';import {a}from'./chunk-VM2TOHNX.js';import {a as a$3}from'./chunk-2FIX2MDC.js';import c from'chalk';import {execa}from'execa';import a$1 from'fs-extra';import i from'path';import Ye from'inquirer';function Ze(e){return [...new Set(e.filter(s=>s&&s.trim().length>0))]}function et(){let e=k().map(t=>i.join(t,a$4()?"poetry.exe":"poetry")),s=a$4()?[i.join(process.env.APPDATA||"","Python","Scripts","poetry.exe"),i.join(process.env.USERPROFILE||"","AppData","Roaming","Python","Scripts","poetry.exe")]:[],r=a$4()?[]:["/usr/local/bin/poetry","/usr/bin/poetry"];return Ze([...e,...s,...r])}function tt(e){let s=k().map(u=>({location:"Global (user-local)",path:i.join(u,a$4()?"rapidkit.exe":"rapidkit")})),r=[{location:"Global (pipx)",path:i.join(e,".local","bin","rapidkit")},{location:"Global (pipx)",path:i.join(e,"AppData","Roaming","Python","Scripts","rapidkit.exe")},{location:"Global (pyenv)",path:i.join(e,".pyenv","shims","rapidkit")},{location:"Global (system)",path:"/usr/local/bin/rapidkit"},{location:"Global (system)",path:"/usr/bin/rapidkit"}],t=g(i.join(process.cwd(),".venv")),l=i$1(process.cwd()),o=[{location:"Workspace (.venv)",path:t},...l.map(u=>({location:"Workspace (launcher)",path:u}))],n=[...s,...r,...o],d=new Set;return n.filter(u=>d.has(u.path)?false:(d.add(u.path),true))}function st(e){let s=new Map([["Workspace (.venv)",0],["Global (user-local)",1],["Global (pipx)",2],["Global (pyenv)",3],["Global (system)",4]]);return [...e].sort((r,t)=>{let l=s.get(r.location)??Number.MAX_SAFE_INTEGER,o=s.get(t.location)??Number.MAX_SAFE_INTEGER;return l!==o?l-o:r.path.localeCompare(t.path)})}function Y(e){let s=0,r=e.issues.some(t=>t.toLowerCase().includes("environment file missing"));return e.hasEnvFile===false&&!r&&(s+=1),typeof e.vulnerabilities=="number"&&e.vulnerabilities>0&&(s+=1),s}function ge(e){return e.filter(s=>Y(s)>0).length}function ke(e){return e.reduce((s,r)=>s+Y(r),0)}var nt="doctor-project-scan-v2",Ie="doctor-workspace-cache-v1",ot=Object.freeze({version:"doctor-evidence-v1",scoringPolicyVersion:"doctor-score-policy-v1",generatedBy:"rapidkit-npm",deterministicScoreBreakdown:true,scopeModel:"workspace-aggregate-or-project-scoped"});function ce(){return {...ot}}function le(e){return !e||e.total<=0?null:Math.round(e.passed/e.total*100)}function He(e){return typeof e=="number"?e:Array.isArray(e)?e.length:0}async function Ne(e,s){try{if(!await a$1.pathExists(e))return null;let r=await a$1.readJSON(e);return c$1(r,s)?r:null}catch{return null}}function Me(e,s){if(!e?.system)return [];let r=[{id:"python",current:s.python},{id:"poetry",current:s.poetry},{id:"pipx",current:s.pipx},{id:"go",current:s.go},{id:"rapidkitCore",current:s.rapidkitCore}],t=[];for(let l of r){let o=e.system?.[l.id]?.status;!o||o===l.current.status||t.push({id:l.id,from:o,to:l.current.status});}return t}function it(e,s){let r=new Map;for(let p of s.projects)r.set(p.path||p.name,p.issues.length);if(!e)return {baselineAvailable:false,newIssueCount:0,resolvedIssueCount:0,netIssueDelta:0,scoreDeltaPercent:null,systemStatusChanges:[],regressedProjects:[],improvedProjects:[]};let t=Array.isArray(e.projects)?e.projects:[],l=new Map;for(let p of t){let h=p.path||p.name;h&&l.set(h,He(p.issues));}let o=0,n=0,d=new Set,u=new Set,m=new Set([...Array.from(l.keys()),...Array.from(r.keys())]);for(let p of m){let h=l.get(p)??0,v=r.get(p)??0;v>h?(o+=v-h,d.add(p)):v<h&&(n+=h-v,u.add(p));}let f=le(e.healthScore),g=le(s.healthScore);return {baselineAvailable:true,previousGeneratedAt:e.generatedAt,newIssueCount:o,resolvedIssueCount:n,netIssueDelta:o-n,scoreDeltaPercent:f===null||g===null?null:g-f,systemStatusChanges:Me(e,{python:s.python,poetry:s.poetry,pipx:s.pipx,go:s.go,rapidkitCore:s.rapidkitCore}),regressedProjects:Array.from(d).sort(),improvedProjects:Array.from(u).sort()}}function at(e,s){if(!e)return {baselineAvailable:false,newIssueCount:0,resolvedIssueCount:0,netIssueDelta:0,scoreDeltaPercent:null,systemStatusChanges:[],regressedProjects:[],improvedProjects:[]};let r=He(e.project?.issues),t=s.project.issues.length,l=Math.max(t-r,0),o=Math.max(r-t,0),n=le(e.healthScore),d=le(s.healthScore),u=s.project.path||s.project.name;return {baselineAvailable:true,previousGeneratedAt:e.generatedAt,newIssueCount:l,resolvedIssueCount:o,netIssueDelta:l-o,scoreDeltaPercent:n===null||d===null?null:d-n,systemStatusChanges:Me(e,{python:s.python,poetry:s.poetry,pipx:s.pipx,go:s.go,rapidkitCore:s.rapidkitCore}),regressedProjects:l>0?[u]:[],improvedProjects:o>0?[u]:[]}}function Ge(e){let s=e??[],r=0,t=0;for(let n of s){if(n.scope==="project-scoped"){r+=1;continue}(n.scope==="workspace-aggregate"||n.scope==="host-system")&&(t+=1);}let l=r>0&&t>0?1:0,o=l>0?"mixed":r>0?"scoped":t>0?"aggregated":"unknown";return {scopedCount:r,aggregatedCount:t,mixedCount:l,dominantScope:o}}function P(e,s){return a$4()?`cd "${e}"; ${s}`:`cd ${e} && ${s}`}function L(e){return a$4()?P(e,"Copy-Item .env.example .env"):P(e,"cp .env.example .env")}function rt(e){return e==="FastAPI"||e==="NestJS"||e==="Go/Fiber"||e==="Go/Gin"||e==="Spring Boot"||e==="Rust"||e==="Phoenix"?"first-class":e==="Django"||e==="Flask"||e==="Express"||e==="Fastify"||e==="Koa"||e==="Elixir"||e==="Clojure"||e==="Scala"||e==="Kotlin"||e==="Deno"||e==="Bun"||e==="PHP"||e==="Laravel"||e==="Ruby"||e==="Ruby on Rails"||e==="ASP.NET"?"extended":"observed"}function ct(e){return e==="Next.js"||e==="Nuxt"||e==="React"||e==="Vue"||e==="Angular"||e==="SvelteKit"?"frontend":e==="Unknown"||e==="Node.js"||e==="Python"?"generic":"backend"}function lt(e){return e==="NestJS"||e==="Next.js"||e==="Nuxt"||e==="React"||e==="Vue"||e==="Angular"||e==="SvelteKit"||e==="Bun"||e==="Express"||e==="Fastify"||e==="Koa"||e==="Node.js"?"node":e==="FastAPI"||e==="Django"||e==="Flask"||e==="Python"?"python":e==="Go/Fiber"||e==="Go/Gin"?"go":e==="Spring Boot"?"java":e==="Rust"?"rust":e==="Elixir"||e==="Phoenix"?"elixir":e==="Clojure"?"clojure":e==="Deno"?"deno":e==="Laravel"||e==="PHP"?"php":e==="Ruby on Rails"||e==="Ruby"?"ruby":e==="ASP.NET"?"dotnet":"unknown"}function re(e,s,r){e.framework=s,e.frameworkConfidence=r,e.supportTier=rt(s),e.projectKind=ct(s),e.runtimeFamily=lt(s);}function dt(e){return e==="python"?"python":e==="node"||e==="bun"?"node":e==="go"?"go":e==="java"?"java":e==="rust"?"rust":e==="elixir"?"elixir":e==="clojure"?"clojure":e==="deno"?"deno":e==="php"?"php":e==="ruby"?"ruby":e==="dotnet"?"dotnet":"unknown"}function We(e){switch(e.key){case "fastapi":return "FastAPI";case "django":return "Django";case "flask":return "Flask";case "python":return "Python";case "nestjs":return "NestJS";case "express":return "Express";case "fastify":return "Fastify";case "koa":return "Koa";case "node":return "Node.js";case "gofiber":return "Go/Fiber";case "gogin":return "Go/Gin";case "echo":return "Echo";case "go":return "Go";case "springboot":return "Spring Boot";case "java":return "Java";case "laravel":return "Laravel";case "php":return "PHP";case "rails":return "Ruby on Rails";case "ruby":return "Ruby";case "dotnet":return "ASP.NET";case "phoenix":return "Phoenix";case "elixir":return "Elixir";case "clojure":return "Clojure";case "scala":return "Scala";case "kotlin":return "Kotlin";case "deno":return "Deno";case "bun":return "Bun";case "actix":case "axum":case "rocket":case "rust":return "Rust";case "sinatra":case "symfony":case "unknown":return "Unknown";default:return "Unknown"}}function ut(e){return e.key==="python"||e.key==="node"||e.key==="go"||e.key==="java"||e.key==="php"||e.key==="ruby"||e.key==="dotnet"||e.key==="rust"||e.key==="elixir"||e.key==="clojure"||e.key==="scala"||e.key==="kotlin"||e.key==="deno"||e.key==="bun"||e.key==="unknown"}function _(e,s){e.framework=We(s),e.frameworkKey=s.key,e.importStack=s.importStack,e.frameworkConfidence=s.confidence,e.supportTier=s.supportTier,e.projectKind=ut(s)?"generic":"backend",e.runtimeFamily=dt(s.runtime);}function pt(e){let s=e.dependencies,r=e.scripts??{},t=(e.kitName??"").toLowerCase(),l=n=>!!s[n],o=Object.values(r).filter(n=>typeof n=="string").join(" ").toLowerCase();return l("next")||o.includes("next ")?{framework:"Next.js",confidence:"high"}:l("nuxt")||o.includes("nuxt ")?{framework:"Nuxt",confidence:"high"}:l("@nestjs/core")||t.startsWith("nestjs.")?{framework:"NestJS",confidence:"high"}:l("express")?{framework:"Express",confidence:"high"}:l("fastify")?{framework:"Fastify",confidence:"high"}:l("koa")?{framework:"Koa",confidence:"high"}:l("@angular/core")?{framework:"Angular",confidence:"high"}:l("@sveltejs/kit")||o.includes("svelte-kit")?{framework:"SvelteKit",confidence:"high"}:l("vue")?{framework:"Vue",confidence:"medium"}:l("react")&&l("react-dom")?{framework:"React",confidence:"medium"}:{framework:"Node.js",confidence:"low"}}async function mt(e$1){let s=e(e$1);return s.runtime!=="python"?{framework:"Python",confidence:"low"}:{framework:We(s),confidence:s.confidence}}async function Re(e){try{let s=await a$1.stat(e);return `${i.basename(e)}:${s.isDirectory()?"d":"f"}:${s.size}:${s.mtimeMs}`}catch{return `${i.basename(e)}:missing`}}async function ft(e){try{let s=new Set([".git",".venv","node_modules",".rapidkit","dist","build","coverage","__pycache__"]),r=new Set;await de(e)&&r.add(e);let t=async(l,o)=>{if(o<0)return;let n=await Be(l);for(let d of n){if(Ke(d,s))continue;let u=i.join(l,d);if(await de(u)){r.add(u);continue}o>0&&await t(u,o-1);}};return await t(e,1),r.size===0&&(await Pt(e,3,s)).forEach(o=>r.add(o)),Array.from(r).sort((l,o)=>l.localeCompare(o))}catch{return []}}async function gt(e,s){let r=[i.join(e,".rapidkit-workspace"),i.join(e,".rapidkit","workspace.json"),i.join(e,".rapidkit","policies.yml"),i.join(e,".rapidkit","toolchain.lock"),i.join(e,".rapidkit","cache-config.yml")],t=[".rapidkit/project.json",".rapidkit/context.json",".rapidkit/file-hashes.json","package.json","pyproject.toml","composer.json","Gemfile","Gemfile.lock","go.mod","go.sum","pom.xml","requirements.txt","Dockerfile","Makefile",".env",".env.example","src","modules","tests","test",".venv","node_modules"],l=await Promise.all(r.map(Re)),o=await Promise.all(s.map(async n=>{let d=await Promise.all(t.map(u=>Re(i.join(n,u))));return `${n}::${d.join("|")}`}));return [nt,...l,...o].join("||")}async function ht(e,s){try{if(!await a$1.pathExists(e))return null;let r=await a$1.readJSON(e);return !r||r.signature!==s||!Array.isArray(r.projects)||typeof r.schemaVersion=="string"&&r.schemaVersion!==Ie?null:r}catch{return null}}async function yt(e,s){try{await a$1.ensureDir(i.dirname(e)),await a$1.writeJSON(e,s,{spaces:2});}catch{}}async function kt(e,s,r){let t=i.join(e,".rapidkit","reports","doctor-last-run.json");try{return await a$1.ensureDir(i.dirname(t)),await a$1.writeJSON(t,{schemaVersion:a$2,evidenceType:"workspace",generatedAt:new Date().toISOString(),contract:ce(),workspacePath:e,workspaceName:s.workspaceName,projectScanCached:s.projectScanCached??false,projectScanSignature:s.projectScanSignature,cachePath:r,healthScore:s.healthScore,system:{python:s.python,poetry:s.poetry,pipx:s.pipx,go:s.go,rapidkitCore:s.rapidkitCore,versions:{core:s.coreVersion,npm:s.npmVersion}},projects:s.projects,summary:{totalProjects:s.projects.length,totalIssues:s.projects.reduce((l,o)=>l+o.issues.length,0),projectAdvisoryWarningProjects:ge(s.projects),projectAdvisoryWarnings:ke(s.projects),hasSystemErrors:[s.python,s.rapidkitCore].some(l=>l.status==="error"),scopeProvenance:s.scopeProvenance},driftDelta:s.driftDelta,scoreBreakdown:s.scoreBreakdown??[]},{spaces:2}),t}catch{return}}async function we(){let[e,s,r,t,l]=await Promise.all([wt(),vt(),xt(),bt(),jt()]);return {python:e,poetry:s,pipx:r,go:t,rapidkitCore:l}}async function wt(){let e=d();for(let s of e)try{let{stdout:r}=await execa(s,["--version"],{timeout:3e3}),t=r.match(/Python (\d+\.\d+\.\d+)/);if(t){let l=t[1],[o,n]=l.split(".").map(Number);return o<3||o===3&&n<10?{status:"warn",message:`Python ${l} (requires 3.10+)`,details:`${s} found but version is below minimum requirement`}:{status:"ok",message:`Python ${l}`,details:`Using ${s}`}}}catch{continue}return {status:"error",message:"Python not found",details:"Install Python 3.10+ and ensure it's in PATH"}}async function vt(){try{let{stdout:e}=await execa("poetry",["--version"],{timeout:3e3}),s=e.match(/Poetry .*version ([\d.]+)/);return s?{status:"ok",message:`Poetry ${s[1]}`,details:"Available for dependency management"}:{status:"warn",message:"Poetry version unknown"}}catch{let e=d().map(s=>({cmd:s,args:s==="py"?["-3","-m","poetry","--version"]:["-m","poetry","--version"]}));for(let s of e)try{let{stdout:r}=await execa(s.cmd,s.args,{timeout:3e3,shell:b()}),t=r.match(/Poetry .*version ([\d.]+)/)||r.match(/([\d.]+)/);return {status:"ok",message:t?.[1]?`Poetry ${t[1]}`:"Poetry detected",details:`Available via ${s.cmd} ${s.args.join(" ")}`}}catch{continue}for(let s of et())try{if(!await a$1.pathExists(s))continue;let{stdout:r}=await execa(s,["--version"],{timeout:3e3,shell:b()}),t=r.match(/Poetry .*version ([\d.]+)/)||r.match(/([\d.]+)/);return {status:"ok",message:t?.[1]?`Poetry ${t[1]}`:"Poetry detected",details:`Available at ${s}`}}catch{continue}return {status:"warn",message:"Poetry not installed",details:"Optional: Install for better dependency management"}}}async function xt(){try{let{stdout:e}=await execa("pipx",["--version"],{timeout:3e3});return {status:"ok",message:`pipx ${e.trim()}`,details:"Available for global tool installation"}}catch{let e=d();for(let s of e)try{let r=s==="py"?["-3","-m","pipx","--version"]:["-m","pipx","--version"],{stdout:t}=await execa(s,r,{timeout:3e3,shell:b()});return {status:"ok",message:`pipx ${t.trim()}`,details:`Available via ${s} ${r.join(" ")}`}}catch{continue}return {status:"warn",message:"pipx not installed",details:"Optional: Install for isolated Python tools"}}}async function bt(){try{let{stdout:e}=await execa("go",["version"],{timeout:3e3}),s=e.match(/go version go(\d+\.\d+(?:\.\d+)?)/);return s?{status:"ok",message:`Go ${s[1]}`,details:"Available for Go/Fiber and Go/Gin projects"}:{status:"ok",message:"Go (version unknown)",details:"go found in PATH"}}catch{return {status:"warn",message:"Go not installed",details:"Optional: Required only for gofiber.standard / gogin.standard projects \u2014 https://go.dev/dl/"}}}async function jt(){let e=process.env.HOME||process.env.USERPROFILE||"",s=[],r=tt(e);for(let{location:l,path:o}of r)try{if(await a$1.pathExists(o)){let{stdout:n,exitCode:d}=await execa(o,["--version"],{timeout:3e3,reject:false});if(d===0&&(n.includes("RapidKit Version")||n.includes("RapidKit"))){let u=n.match(/v?([\d.]+(?:rc\d+)?(?:a\d+)?(?:b\d+)?)/);u&&s.push({location:l,path:o,version:u[1]});}}}catch{continue}if(s.length>0){let l=s.filter(n=>n.location!=="Workspace (launcher)");if(l.length>0){let n=st(l),d=n[0].version,u=n.some(g=>g.location==="Workspace (.venv)"),m=n.some(g=>g.location.startsWith("Global (")),f=!u&&m?"Workspace (.venv): not installed (optional). For best project-level performance and isolation, run npx rapidkit workspace run init inside this workspace.":void 0;return {status:"ok",message:`RapidKit Core ${d}`,details:f,paths:n.map(g=>({location:g.location,path:g.path,version:g.version}))}}return {status:"ok",message:`RapidKit Core ${s[0].version}`,details:"Detected via workspace launcher"}}try{let{stdout:l,exitCode:o}=await execa("rapidkit",["--version"],{timeout:3e3,reject:false});if(o===0&&(l.includes("RapidKit Version")||l.includes("RapidKit"))){let n=l.match(/v?([\d.]+(?:rc\d+)?(?:a\d+)?(?:b\d+)?)/);if(n)return {status:"ok",message:`RapidKit Core ${n[1]}`,details:"Available via PATH"}}}catch{}try{let{stdout:l,exitCode:o}=await execa("poetry",["run","rapidkit","--version"],{timeout:3e3,reject:false});if(o===0&&(l.includes("RapidKit Version")||l.includes("RapidKit"))){let n=l.match(/v?([\d.]+(?:rc\d+)?(?:a\d+)?(?:b\d+)?)/);if(n)return {status:"ok",message:`RapidKit Core ${n[1]}`,details:"Available via Poetry"}}}catch{}let t=d();for(let l of t)try{let{stdout:o,exitCode:n}=await execa(l,["-c","import rapidkit_core; print(rapidkit_core.__version__)"],{timeout:3e3,reject:false});if(n===0&&o&&!o.includes("Traceback")&&!o.includes("ModuleNotFoundError")){let d=o.trim();if(d)return {status:"ok",message:`RapidKit Core ${d}`,details:`Available in ${l} environment`}}}catch{continue}return {status:"error",message:"RapidKit Core not installed",details:"Install with: pipx install rapidkit-core"}}async function D(e,s){let r=i.join(e,"Dockerfile");s.hasDocker=await a$1.pathExists(r);let t=i.join(e,"tests"),l=i.join(e,"test"),o=i.join(e,"src","test"),n=await a$1.pathExists(t)||await a$1.pathExists(l)||await a$1.pathExists(o),d=false;if(s.framework==="Go/Fiber"||s.framework==="Go/Gin")try{let u=[{dir:e,depth:0}],m=4,f=new Set([".git",".venv","node_modules","dist","build","vendor"]);for(;u.length>0&&!d;){let g=u.shift();if(!g)break;let p=[];try{p=await a$1.readdir(g.dir);}catch{continue}for(let h of p){let v=i.join(g.dir,h),y;try{y=await a$1.stat(v);}catch{continue}if(y.isFile()&&h.endsWith("_test.go")){d=true;break}y.isDirectory()&&g.depth<m&&!f.has(h)&&!h.startsWith(".")&&u.push({dir:v,depth:g.depth+1});}}}catch{}if(s.hasTests=n||d,s.runtimeFamily==="node"){let u=i.join(e,".eslintrc.js"),m=i.join(e,".eslintrc.json");s.hasCodeQuality=await a$1.pathExists(u)||await a$1.pathExists(m);}else if(s.framework==="Go/Fiber"||s.framework==="Go/Gin"){let u=i.join(e,".golangci.yml"),m=i.join(e,".golangci.yaml"),f=i.join(e,"Makefile"),g=await a$1.pathExists(f)&&(await a$1.readFile(f,"utf8")).includes("golangci-lint");s.hasCodeQuality=await a$1.pathExists(u)||await a$1.pathExists(m)||g;}else if(s.runtimeFamily==="python"){let u=i.join(e,"ruff.toml"),m=i.join(e,"pyproject.toml");if(await a$1.pathExists(m))try{let f=await a$1.readFile(m,"utf8");s.hasCodeQuality=f.includes("[tool.ruff]")||await a$1.pathExists(u);}catch{s.hasCodeQuality=await a$1.pathExists(u);}}else if(s.framework==="Spring Boot"){let u=i.join(e,"pom.xml");if(await a$1.pathExists(u))try{let m=await a$1.readFile(u,"utf8");s.hasCodeQuality=m.includes("spotless")||m.includes("checkstyle")||m.includes("pmd")||m.includes("maven-enforcer-plugin");}catch{s.hasCodeQuality=false;}}try{if(s.runtimeFamily==="node"){let{stdout:u}=await execa("npm",["audit","--json"],{cwd:e,reject:false});if(u)try{let f=JSON.parse(u).metadata?.vulnerabilities;f&&(s.vulnerabilities=(f.high||0)+(f.critical||0)+(f.moderate||0));}catch{}}else if(s.runtimeFamily==="python"){let u=i.join(e,".venv"),m=f(u);if(await a$1.pathExists(m))try{let{stdout:f}=await execa(m,["-m","pip","list","--format=json"],{timeout:5e3,reject:false});if(f){JSON.parse(f);s.vulnerabilities=0;}}catch{}}}catch{}}function A(e,s){e.probes||(e.probes=[]),e.probes.push(s);}async function Ct(e,s){let r=s.runtimeFamily||"unknown";if(s.projectKind==="backend"||s.projectKind==="generic"){if(r==="node"){let l=await a$1.pathExists(i.join(e,"package-lock.json"))||await a$1.pathExists(i.join(e,"pnpm-lock.yaml"))||await a$1.pathExists(i.join(e,"yarn.lock"));A(s,{id:"adapter-node-lockfile-integrity",label:"Node adapter lockfile integrity",status:l?"pass":"warn",severity:"warn",scope:"project-scoped",reason:l?"Node lockfile detected for deterministic dependency restore.":"No Node lockfile detected (package-lock/yarn.lock/pnpm-lock.yaml).",recommendation:l?void 0:"Commit a lockfile for deterministic installs and CI parity."});let o=await a$1.pathExists(i.join(e,"src/main.ts"))||await a$1.pathExists(i.join(e,"src/main.js"))||await a$1.pathExists(i.join(e,"src/server.ts"))||await a$1.pathExists(i.join(e,"src/server.js"));A(s,{id:"adapter-node-boot-entrypoint",label:"Node adapter boot entrypoint",status:o?"pass":"warn",severity:"warn",scope:"project-scoped",reason:o?"Boot entrypoint markers detected for service startup path.":"No canonical Node boot entrypoint markers detected.",recommendation:o?void 0:"Define and document service bootstrap entrypoint (main/server)."});return}if(r==="python"){let l=await a$1.pathExists(i.join(e,"poetry.lock"))||await a$1.pathExists(i.join(e,"requirements.txt"))||await a$1.pathExists(i.join(e,"uv.lock"));A(s,{id:"adapter-python-lockfile-integrity",label:"Python adapter dependency integrity",status:l?"pass":"warn",severity:"warn",scope:"project-scoped",reason:l?"Python dependency contract file detected.":"No Python dependency contract file detected (poetry.lock/requirements/uv.lock).",recommendation:l?void 0:"Pin dependency contract for deterministic setup and reproducible CI."});let o=await a$1.pathExists(i.join(e,"app/main.py"))||await a$1.pathExists(i.join(e,"main.py"))||await a$1.pathExists(i.join(e,"manage.py"));A(s,{id:"adapter-python-boot-entrypoint",label:"Python adapter boot entrypoint",status:o?"pass":"warn",severity:"warn",scope:"project-scoped",reason:o?"Python application entrypoint markers detected.":"No Python application entrypoint markers detected.",recommendation:o?void 0:"Expose explicit app/main entrypoint for deterministic boot probes."});return}if(r==="java"){let l=await a$1.pathExists(i.join(e,"mvnw"))||await a$1.pathExists(i.join(e,"gradlew"));A(s,{id:"adapter-java-build-wrapper",label:"Java adapter build wrapper",status:l?"pass":"warn",severity:"warn",scope:"project-scoped",reason:l?"Build wrapper detected (mvnw/gradlew).":"No Java build wrapper detected.",recommendation:l?void 0:"Commit mvnw or gradlew for reproducible enterprise pipelines."});return}if(r==="go"){let l=await a$1.pathExists(i.join(e,"go.sum"));A(s,{id:"adapter-go-module-integrity",label:"Go adapter module integrity",status:l?"pass":"warn",severity:"warn",scope:"project-scoped",reason:l?"go.sum detected for deterministic module verification.":"go.sum missing; module integrity baseline is incomplete.",recommendation:l?void 0:"Generate and commit go.sum in the repository baseline."});}}}async function Et(e,s){let r=[i.join(e,".rapidkit","doctor.adapters.json"),i.join(e,"doctor.adapters.json")];for(let t of r)if(await a$1.pathExists(t))try{let l=await a$1.readJSON(t),o=Array.isArray(l?.checks)?l.checks:[];for(let n=0;n<o.length;n+=1){let d=o[n]||{},u=Array.isArray(d.runtimes)?d.runtimes:[];if(u.length>0&&!u.includes(s.runtimeFamily||"unknown"))continue;let m=typeof d.id=="string"&&d.id.trim().length>0?d.id.trim():`adapter-check-${n+1}`,f=typeof d.label=="string"&&d.label.trim().length>0?d.label.trim():m,g=d.severity||"warn",p=Array.isArray(d.anyOfPaths)?d.anyOfPaths.filter(Boolean):[],h=Array.isArray(d.allOfPaths)?d.allOfPaths.filter(Boolean):[],v=p.length===0;for(let T of p)if(await a$1.pathExists(i.join(e,T))){v=true;break}let y=true;for(let T of h)if(!await a$1.pathExists(i.join(e,T))){y=false;break}let x=v&&y;A(s,{id:m,label:f,status:x?"pass":g==="error"?"fail":"warn",severity:g,scope:"project-scoped",reason:x?d.passReason||"Custom adapter contract satisfied.":d.failReason||`Custom adapter check failed from ${i.basename(t)}.`,recommendation:d.recommendation});}}catch{A(s,{id:"custom-adapter-config",label:"Custom doctor adapter configuration",status:"warn",severity:"warn",scope:"project-scoped",reason:`Failed to parse ${i.basename(t)}.`,recommendation:"Fix JSON syntax in doctor.adapters.json to re-enable adapter checks."});}}async function M(e,s){if(!(s.projectKind==="backend"||s.projectKind==="generic"))return;let t=i.join(e,".env"),l=i.join(e,".env.example"),o=await a$1.pathExists(t)||await a$1.pathExists(l)||await a$1.pathExists(i.join(e,"config"));A(s,{id:"config-surface",label:"Configuration contract surface",status:o?"pass":"warn",severity:"warn",scope:"project-scoped",reason:o?"Configuration artifacts detected (.env/.env.example/config).":"No explicit configuration contract artifacts detected.",recommendation:o?void 0:"Add .env.example or explicit config contract documentation for deterministic setup."});let n={python:["alembic.ini","migrations","versions"],node:["prisma/schema.prisma","migrations","typeorm.config.ts","typeorm.config.js"],go:["migrations","db/migrations"],java:["src/main/resources/db/migration","src/main/resources/liquibase"],rust:["migrations","sqlx-data.json"],elixir:["priv/repo/migrations"],clojure:["resources/migrations","migrations"],deno:["migrations"],php:["database/migrations","migrations"],ruby:["db/migrate"],dotnet:["Migrations","Data/Migrations"],unknown:["migrations"]},d=s.runtimeFamily||"unknown",u=n[d]||n.unknown,m=false;for(let p of u)if(await a$1.pathExists(i.join(e,p))){m=true;break}A(s,{id:"migration-surface",label:"Migration/readiness surface",status:m?"pass":"warn",severity:"warn",scope:"project-scoped",reason:m?"Migration or schema evolution markers detected.":"No migration markers detected for this backend runtime.",recommendation:m?void 0:"Add migration tooling baseline (migrations dir or runtime-native migration config)."});let f=["src/health","src/healthcheck","src/main/resources/application.yml","src/main/resources/application.properties","app/health.py","routes/health.ts","routes/health.js"],g=false;for(let p of f)if(await a$1.pathExists(i.join(e,p))){g=true;break}A(s,{id:"runtime-health-surface",label:"Runtime health probe surface",status:g?"pass":"warn",severity:"warn",scope:"project-scoped",reason:g?"Health endpoint/config markers detected.":"No explicit runtime health endpoint markers detected.",recommendation:g?void 0:"Expose a deterministic health endpoint and keep it covered in verify pack."}),await Ct(e,s);}async function G(e,s){let r=[i.join(e,".rapidkit","doctor.probes.json"),i.join(e,"doctor.probes.json")];for(let t of r)if(await a$1.pathExists(t))try{let l=await a$1.readJSON(t),o=Array.isArray(l?.probes)?l.probes:[];for(let n=0;n<o.length;n+=1){let d=o[n]||{},u=typeof d.id=="string"&&d.id.trim().length>0?d.id.trim():`custom-probe-${n+1}`,m=typeof d.label=="string"&&d.label.trim().length>0?d.label.trim():u,f=d.severity||"warn",g=Array.isArray(d.anyOfPaths)?d.anyOfPaths.filter(Boolean):[],p=Array.isArray(d.allOfPaths)?d.allOfPaths.filter(Boolean):[],h=g.length===0;for(let x of g)if(await a$1.pathExists(i.join(e,x))){h=true;break}let v=true;for(let x of p)if(!await a$1.pathExists(i.join(e,x))){v=false;break}let y=h&&v;A(s,{id:u,label:m,status:y?"pass":f==="error"?"fail":"warn",severity:f,scope:"project-scoped",reason:y?"Custom probe contract satisfied.":`Custom probe failed from ${i.basename(t)}.`,recommendation:d.recommendation});}}catch{A(s,{id:"custom-probe-config",label:"Custom doctor probe configuration",status:"warn",severity:"warn",scope:"project-scoped",reason:`Failed to parse ${i.basename(t)}.`,recommendation:"Fix JSON syntax in doctor.probes.json to re-enable custom probes."});}await Et(e,s);}async function ve(e$1,s={}){let t={name:i.basename(e$1),path:e$1,venvActive:false,depsInstalled:false,coreInstalled:false,issues:[],fixCommands:[]},l=s.allowNonRapidkit===true,o=i.join(e$1,".rapidkit");if(!await a$1.pathExists(o)){if(!l)return t.issues.push("Not a valid RapidKit project (missing .rapidkit directory)"),t;t.issues.push("Not a RapidKit-managed project (running generic backend diagnostics)");}try{let k=i.join(e$1,"registry.json");if(await a$1.pathExists(k)){let w=await a$1.readJson(k);w.installed_modules&&(t.stats={modules:w.installed_modules.length});}}catch{}let n=null;try{let k=i.join(o,"project.json");if(await a$1.pathExists(k)){n=await a$1.readJson(k);let w=n?.kit_name||n?.kit;w&&(t.kit=w);}}catch{}try{let k=i.join(e$1,".git");if(await a$1.pathExists(k)){let{stdout:w}=await execa("git",["log","-1","--format=%cr"],{cwd:e$1,reject:false});w&&(t.lastModified=w.trim());}else {let w=await a$1.stat(e$1),I=Date.now()-w.mtime.getTime(),H=Math.floor(I/(1e3*60*60*24));t.lastModified=H===0?"today":`${H} day${H>1?"s":""} ago`;}}catch{}let d=i.join(e$1,"package.json"),u=i.join(e$1,"pyproject.toml"),m=i.join(e$1,"requirements.txt"),f$1=i.join(e$1,"go.mod"),g=i.join(e$1,"pom.xml"),p=i.join(e$1,"build.sbt"),h=i.join(e$1,"Cargo.toml"),v=i.join(e$1,"mix.exs"),y=i.join(e$1,"deps.edn"),x=i.join(e$1,"project.clj"),T=i.join(e$1,"deno.json"),W=i.join(e$1,"deno.jsonc"),J=i.join(e$1,"bun.lockb"),q=i.join(e$1,"bun.lock"),O=i.join(e$1,"composer.json"),se=i.join(e$1,"Gemfile"),U=await a$1.pathExists(d),B=await a$1.pathExists(u)||await a$1.pathExists(m),R=await a$1.pathExists(O),ee=await a$1.pathExists(se),ne=await a$1.pathExists(h),Je=await a$1.pathExists(v),qe=await a$1.pathExists(y)||await a$1.pathExists(x),Ue=await a$1.pathExists(p),ze=await a$1.pathExists(T)||await a$1.pathExists(W),ue=false;try{ue=(await a$1.readdir(e$1)).some(w=>w.endsWith(".csproj")||w.endsWith(".sln"));}catch{ue=false;}let Qe=await a$1.pathExists(f$1)||n?.runtime==="go"||typeof n?.kit_name=="string"&&(n.kit_name.startsWith("gofiber")||n.kit_name.startsWith("gogin")),xe=U&&(await a$1.pathExists(J)||await a$1.pathExists(q)||typeof n?.packageManager=="string"&&(n?.packageManager).toLowerCase().startsWith("bun@"));if(Qe){_(t,e(e$1,n??null)),t.isGoProject=true,t.venvActive=true,t.coreInstalled=false;try{await execa("go",["version"],{timeout:3e3});}catch{t.issues.push("Go toolchain not found \u2014 install from https://go.dev/dl/"),t.fixCommands?.push("https://go.dev/dl/");}let k=i.join(e$1,"go.sum");return await a$1.pathExists(k)?t.depsInstalled=true:(t.depsInstalled=false,t.issues.push("Go dependencies not downloaded (go.sum missing)"),t.fixCommands?.push(P(e$1,"go mod tidy"))),await D(e$1,t),await M(e$1,t),await G(e$1,t),t}if(await a$1.pathExists(g)||n?.runtime==="java"||typeof n?.kit_name=="string"&&n.kit_name.startsWith("springboot")){_(t,e(e$1,n??null)),t.venvActive=true,t.coreInstalled=false;let k=await a$1.pathExists(g),w=await a$1.pathExists(i.join(e$1,"build.gradle"))||await a$1.pathExists(i.join(e$1,"build.gradle.kts")),j=await a$1.pathExists(i.join(e$1,"mvnw"))||await a$1.pathExists(i.join(e$1,"mvnw.cmd")),I=await a$1.pathExists(i.join(e$1,"gradlew"))||await a$1.pathExists(i.join(e$1,"gradlew.bat"));try{await execa("java",["-version"],{timeout:3e3,reject:false});}catch{t.issues.push("Java runtime not found \u2014 install JDK 21+ and ensure java is on PATH"),t.fixCommands?.push("https://adoptium.net/");}if(k){if(!j)try{await execa("mvn",["-version"],{timeout:3e3,reject:false});}catch{t.issues.push("Maven not found \u2014 install Maven 3.9+ or add Maven Wrapper"),t.fixCommands?.push("https://maven.apache.org/install.html");}}else if(w&&!I)try{await execa("gradle",["--version"],{timeout:3e3,reject:false});}catch{t.issues.push("Gradle not found \u2014 install Gradle 8+ or add Gradle Wrapper"),t.fixCommands?.push("https://gradle.org/install/");}let H=i.join(e$1,"target"),S=i.join(e$1,"build","libs"),$=i.join(e$1,".rapidkit","cache","java","m2"),C=i.join(e$1,".rapidkit","cache","java","gradle");t.depsInstalled=await a$1.pathExists(H)||await a$1.pathExists(S)||await a$1.pathExists($)||await a$1.pathExists(C),t.depsInstalled||(t.issues.push("Java dependencies are not warmed or built yet"),t.fixCommands?.push(P(e$1,"rapidkit init")));let N=i.join(e$1,".env");if(t.hasEnvFile=await a$1.pathExists(N),!t.hasEnvFile){let z=i.join(e$1,".env.example");await a$1.pathExists(z)&&(t.issues.push("Environment file missing (found .env.example)"),t.fixCommands?.push(L(e$1)));}let V=i.join(e$1,"src","main","resources","application.yml");if(await a$1.pathExists(V))try{let z=await a$1.readFile(V,"utf-8");/include:\s*[^\n]*health/i.test(z)||/management:\s*[\s\S]*endpoint:\s*[\s\S]*health:/i.test(z)||(t.issues.push("Actuator health endpoint exposure is not clearly configured in application.yml"),t.fixCommands?.push(P(e$1,"Ensure management.endpoints.web.exposure.include contains health in src/main/resources/application.yml")));}catch{t.issues.push("Unable to read application.yml for Spring Actuator health checks");}return await D(e$1,t),await M(e$1,t),await G(e$1,t),t}if(ne){_(t,e(e$1,n??null)),t.venvActive=true,t.coreInstalled=false;let k=i.join(e$1,"Cargo.lock"),w=i.join(e$1,"target");t.depsInstalled=await a$1.pathExists(k)||await a$1.pathExists(w),t.depsInstalled||(t.issues.push("Rust dependencies are not resolved yet (Cargo.lock/target missing)"),t.fixCommands?.push(P(e$1,"cargo fetch")));let j=i.join(e$1,".env");if(t.hasEnvFile=await a$1.pathExists(j),!t.hasEnvFile){let I=i.join(e$1,".env.example");await a$1.pathExists(I)&&(t.issues.push("Environment file missing (found .env.example)"),t.fixCommands?.push(L(e$1)));}return await D(e$1,t),await M(e$1,t),await G(e$1,t),t}if(Je){_(t,e(e$1,n??null)),t.venvActive=true,t.coreInstalled=false;let k=i.join(e$1,"mix.lock"),w=i.join(e$1,"deps");t.depsInstalled=await a$1.pathExists(k)||await a$1.pathExists(w),t.depsInstalled||(t.issues.push("Elixir dependencies not installed (mix.lock/deps missing)"),t.fixCommands?.push(P(e$1,"mix deps.get")));let j=i.join(e$1,".env");if(t.hasEnvFile=await a$1.pathExists(j),!t.hasEnvFile){let I=i.join(e$1,".env.example");await a$1.pathExists(I)&&(t.issues.push("Environment file missing (found .env.example)"),t.fixCommands?.push(L(e$1)));}return await D(e$1,t),await M(e$1,t),await G(e$1,t),t}if(qe){_(t,e(e$1,n??null)),t.venvActive=true,t.coreInstalled=false;let k=i.join(e$1,".cpcache"),w=i.join(e$1,"target"),j=await a$1.pathExists(y)||await a$1.pathExists(x);return t.depsInstalled=await a$1.pathExists(k)||await a$1.pathExists(w)||j,t.depsInstalled||(t.issues.push("Clojure dependency cache not initialized"),t.fixCommands?.push(P(e$1,"clojure -P"))),await D(e$1,t),await M(e$1,t),await G(e$1,t),t}if(Ue){_(t,e(e$1,n??null)),t.venvActive=true,t.coreInstalled=false;let k=i.join(e$1,"target");t.depsInstalled=await a$1.pathExists(k),t.depsInstalled||(t.issues.push("Scala build artifacts missing (run dependency/build warmup)"),t.fixCommands?.push(P(e$1,"sbt compile")));let w=i.join(e$1,".env");if(t.hasEnvFile=await a$1.pathExists(w),!t.hasEnvFile){let j=i.join(e$1,".env.example");await a$1.pathExists(j)&&(t.issues.push("Environment file missing (found .env.example)"),t.fixCommands?.push(L(e$1)));}return await D(e$1,t),await M(e$1,t),await G(e$1,t),t}if(ze){_(t,e(e$1,n??null)),t.venvActive=true,t.coreInstalled=false,t.depsInstalled=true;let k=i.join(e$1,".env");if(t.hasEnvFile=await a$1.pathExists(k),!t.hasEnvFile){let w=i.join(e$1,".env.example");await a$1.pathExists(w)&&(t.issues.push("Environment file missing (found .env.example)"),t.fixCommands?.push(L(e$1)));}return await D(e$1,t),await M(e$1,t),await G(e$1,t),t}if(U){let k=null;try{k=await a$1.readJson(d);}catch{k=null;}let w={...k?.dependencies??{},...k?.devDependencies??{}},j=k?.scripts??{},I=typeof n?.kit_name=="string"?n.kit_name.toLowerCase():typeof n?.kit=="string"?n.kit.toLowerCase():"",H=pt({dependencies:w,scripts:j,kitName:I});if(xe)re(t,"Bun","high");else {let C=e(e$1,n??null);C.key==="nestjs"||C.key==="express"||C.key==="fastify"||C.key==="koa"?_(t,C):re(t,H.framework,H.confidence);}t.venvActive=true;let S=i.join(e$1,"node_modules");if(await a$1.pathExists(S))try{let N=(await a$1.readdir(S)).filter(V=>!V.startsWith(".")&&!V.startsWith("_"));t.depsInstalled=N.length>0;}catch{t.depsInstalled=false;}if(t.depsInstalled||(t.issues.push("Dependencies not installed (node_modules empty or missing)"),t.fixCommands?.push(P(e$1,xe?"bun install":"rapidkit init"))),t.coreInstalled=false,t.projectKind==="frontend"){let C=[".env",".env.local",".env.development",".env.development.local",".env.production",".env.production.local"];if((await Promise.all(C.map(V=>a$1.pathExists(i.join(e$1,V))))).some(Boolean))t.hasEnvFile=true;else {let V=i.join(e$1,".env.example");await a$1.pathExists(V)&&(t.hasEnvFile=false,t.issues.push("Environment file missing (found .env.example)"),t.fixCommands?.push(L(e$1)));}}else {let C=i.join(e$1,".env");if(t.hasEnvFile=await a$1.pathExists(C),!t.hasEnvFile){let N=i.join(e$1,".env.example");await a$1.pathExists(N)&&(t.issues.push("Environment file missing (found .env.example)"),t.fixCommands?.push(L(e$1)));}}let $=i.join(e$1,"src");if(t.modulesHealthy=true,t.missingModules=[],await a$1.pathExists($))try{let C=await a$1.readdir($);t.modulesHealthy=C.length>0;}catch{t.modulesHealthy=false;}return await D(e$1,t),await M(e$1,t),await G(e$1,t),t}if(B){let k=await mt(e$1);re(t,k.framework,k.confidence);let w=i.join(e$1,".venv");if(await a$1.pathExists(w)){t.venvActive=true;let S=f(w);if(await a$1.pathExists(S)){try{let{stdout:N}=await execa(S,["-c","import rapidkit_core; print(rapidkit_core.__version__)"],{timeout:2e3});t.coreInstalled=true,t.coreVersion=N.trim();}catch{t.coreInstalled=false;}let $="fastapi";t.framework==="Django"?$="django":t.framework==="Flask"?$="flask":t.framework==="Python"&&($="");let C=true;if($)try{await execa(S,["-c",`import ${$}`],{timeout:2e3}),t.depsInstalled=true,C=false;}catch{C=true;}if(C)try{let N=i.join(w,"lib");if(await a$1.pathExists(N)){let z=(await a$1.readdir(N)).find(oe=>oe.startsWith("python"));if(z){let oe=i.join(N,z,"site-packages");if(await a$1.pathExists(oe)){let Xe=(await a$1.readdir(oe)).filter(pe=>!pe.startsWith("_")&&!pe.includes("dist-info")&&!["pip","setuptools","wheel","pkg_resources"].includes(pe));t.depsInstalled=Xe.length>0;}}}t.depsInstalled||(t.issues.push("Dependencies not installed"),t.fixCommands?.push(P(e$1,"rapidkit init")));}catch{t.issues.push("Could not verify dependency installation");}}else t.issues.push("Virtual environment exists but Python executable not found");}else t.issues.push("Virtual environment not created"),t.fixCommands?.push(P(e$1,"rapidkit init"));let j=i.join(e$1,".env");if(t.hasEnvFile=await a$1.pathExists(j),!t.hasEnvFile){let S=i.join(e$1,".env.example");await a$1.pathExists(S)&&(t.issues.push("Environment file missing (found .env.example)"),t.fixCommands?.push(L(e$1)));}let I=i.join(e$1,"src"),H=i.join(e$1,"modules");if(t.modulesHealthy=true,t.missingModules=[],await a$1.pathExists(I)){let S=i.join(I,"__init__.py");await a$1.pathExists(S)||(t.modulesHealthy=false,t.missingModules.push("src/__init__.py"));}if(await a$1.pathExists(H))try{let S=await Be(H);for(let $ of S){let C=i.join(H,$,"__init__.py");await a$1.pathExists(C)||(t.modulesHealthy=false,t.missingModules.push(`modules/${$}/__init__.py`));}}catch{}return !t.modulesHealthy&&t.missingModules.length>0&&t.issues.push(`Missing module init files: ${t.missingModules.join(", ")}`),await D(e$1,t),await M(e$1,t),await G(e$1,t),t}if(R){_(t,e(e$1,n??null)),t.venvActive=true,t.coreInstalled=false;let k=i.join(e$1,"vendor");t.depsInstalled=await a$1.pathExists(k),t.depsInstalled||(t.issues.push("PHP dependencies not installed (vendor missing)"),t.fixCommands?.push(P(e$1,"composer install")));let w=i.join(e$1,".env");if(t.hasEnvFile=await a$1.pathExists(w),!t.hasEnvFile){let j=i.join(e$1,".env.example");await a$1.pathExists(j)&&(t.issues.push("Environment file missing (found .env.example)"),t.fixCommands?.push(L(e$1)));}return await D(e$1,t),await M(e$1,t),await G(e$1,t),t}if(ee){_(t,e(e$1,n??null)),t.venvActive=true,t.coreInstalled=false;let k=await a$1.pathExists(i.join(e$1,"Gemfile.lock")),w=await a$1.pathExists(i.join(e$1,"vendor","bundle"));t.depsInstalled=k||w,t.depsInstalled||(t.issues.push("Ruby dependencies not installed (Gemfile.lock/vendor missing)"),t.fixCommands?.push(P(e$1,"bundle install")));let j=i.join(e$1,".env");return t.hasEnvFile=await a$1.pathExists(j),await D(e$1,t),await M(e$1,t),await G(e$1,t),t}if(ue){_(t,e(e$1,n??null)),t.venvActive=true,t.coreInstalled=false;let k=i.join(e$1,"obj"),w=i.join(e$1,"packages.lock.json");t.depsInstalled=await a$1.pathExists(k)||await a$1.pathExists(w),t.depsInstalled||(t.issues.push(".NET restore/build artifacts not found"),t.fixCommands?.push(P(e$1,"dotnet restore")));let j=i.join(e$1,".env");return t.hasEnvFile=await a$1.pathExists(j),await D(e$1,t),t}return re(t,"Unknown","low"),t.issues.push("Unknown project type (no recognized runtime marker files)"),await D(e$1,t),await M(e$1,t),await G(e$1,t),t}async function Be(e){try{return (await a$1.readdir(e,{withFileTypes:true})).filter(r=>r.isDirectory()).map(r=>r.name)}catch{try{let s=await a$1.readdir(e),r=[];for(let t of s)try{(await a$1.stat(i.join(e,t))).isDirectory()&&r.push(t);}catch{continue}return r}catch{return []}}}async function de(e){let s=i.join(e,".rapidkit");if(!await a$1.pathExists(s))return false;let r=["project.json","context.json","file-hashes.json"];for(let t of r)if(await a$1.pathExists(i.join(s,t)))return true;return false}function Ke(e,s){if(s.has(e))return true;let r=e.toLowerCase();return !!(r==="dist"||r.startsWith("dist-")||r.startsWith("dist_")||r==="build"||r.startsWith("build-")||r.startsWith("build_"))}async function Pt(e,s,r){let t=new Set,l=[{dir:e,depth:0}];for(;l.length>0;){let o=l.shift();if(!o)break;try{let n=await a$1.readdir(o.dir);for(let d of n){if(Ke(d,r))continue;let u=i.join(o.dir,d),m;try{m=await a$1.stat(u);}catch{continue}if(m.isDirectory()){if(await de(u)){t.add(u);continue}o.depth<s&&l.push({dir:u,depth:o.depth+1});}}}catch{continue}}return Array.from(t)}async function ae(e){let s=i.resolve(e),r=i.parse(s).root;for(;;){if(await $t(s))return s;if(s===r)break;s=i.dirname(s);}return null}async function St(e){let s=i.resolve(e),r=await ae(s),t=r??i.parse(s).root;for(;;){if(await de(s)||await Rt(s)&&(!r||s!==r))return s;if(s===t)break;s=i.dirname(s);}return null}function $e(e){let s=i.resolve(e);return process.platform==="darwin"?s.replace(/^\/private(?=\/var\/)/,""):s}async function Rt(e){let s=["package.json","pyproject.toml","requirements.txt","go.mod","pom.xml","build.sbt","Cargo.toml","mix.exs","deps.edn","project.clj","deno.json","deno.jsonc","composer.json","Gemfile"];for(let r of s)if(await a$1.pathExists(i.join(e,r)))return true;return false}async function $t(e){let s=[i.join(e,".rapidkit-workspace"),i.join(e,".rapidkit","workspace-marker.json"),i.join(e,".rapidkit","config.json")];return Promise.all(s.map(r=>a$1.pathExists(r))).then(r=>r.some(Boolean))}function _e(e,s){let r=0,t=0,l=0;return e.forEach(n=>{n.status==="ok"?r++:n.status==="warn"?t++:n.status==="error"&&l++;}),s.forEach(n=>{let d=Y(n),u=n.isGoProject?n.issues.length===0&&n.depsInstalled:n.issues.length===0&&n.venvActive&&n.depsInstalled;if(n.issues.length>0||d>0||!u){t++;return}r++;}),{total:r+t+l,passed:r,warnings:t,errors:l}}function Te(e,s,r={}){let t=[];for(let o of e)t.push({id:o.id,label:o.label,status:o.result.status,scope:"host-system",policyRuleId:"system-status-derived",reason:o.result.details||o.result.message});let l=[...s].sort((o,n)=>{let d=`${o.path||""}|${o.name||""}`.toLowerCase(),u=`${n.path||""}|${n.name||""}`.toLowerCase();return d.localeCompare(u)});for(let o of l){let n=o.issues.length>0,d=Y(o),u=n||d>0?"warn":"ok",m=n?`${o.issues.length} blocking issue(s)`:d>0?`${d} advisory warning(s)`:"Project checks passed";t.push({id:`project:${o.name}`,label:`Project ${o.name}`,status:u,scope:"project-scoped",policyRuleId:n?"project-blocking-issues":d>0?"project-advisory-warnings":"project-checks-passed",reason:m});}if(r.includeWorkspaceAggregateRules){let o=s.reduce((u,m)=>u+m.issues.length,0),n=ke(s),d=e.filter(u=>u.result.status==="error").length;t.push({id:"workspace:projects-discovered",label:"Workspace projects discovered",status:s.length>0?"ok":"warn",scope:"workspace-aggregate",policyRuleId:"workspace-project-discovery",reason:s.length>0?`${s.length} project(s) discovered for workspace analysis.`:"No projects discovered for workspace analysis."}),t.push({id:"workspace:system-error-gate",label:"Workspace system error gate",status:d>0?"error":"ok",scope:"workspace-aggregate",policyRuleId:"workspace-system-error-gate",reason:d>0?`${d} system requirement gate(s) failed.`:"All system requirement gates passed."}),t.push({id:"workspace:blocking-issues-gate",label:"Workspace blocking issues gate",status:o>0?"warn":"ok",scope:"workspace-aggregate",policyRuleId:"workspace-blocking-issues-gate",reason:o>0?`${o} blocking project issue(s) detected.`:"No blocking project issues detected."}),t.push({id:"workspace:advisory-warnings-gate",label:"Workspace advisory warnings gate",status:n>0?"warn":"ok",scope:"workspace-aggregate",policyRuleId:"workspace-advisory-warning-gate",reason:n>0?`${n} advisory warning(s) detected.`:"No advisory warnings detected."});}return t}async function Fe(e,s=true){let r=i.basename(e);try{let p=i.join(e,".rapidkit-workspace");await a$1.pathExists(p)&&(r=(await a$1.readJSON(p)).name||r);}catch{try{let p=i.join(e,".rapidkit","config.json");r=(await a$1.readJSON(p)).workspace_name||r;}catch{}}let[t,l]=await Promise.all([we(),ft(e)]),o={workspacePath:e,workspaceName:r,python:t.python,poetry:t.poetry,pipx:t.pipx,go:t.go,rapidkitCore:t.rapidkitCore,projects:[]};a.debug(`Workspace scan found ${l.length} project(s)`);let n=await gt(e,l),d=i.join(e,".rapidkit","reports","doctor-workspace-cache.json"),u=s?await ht(d,n):null;if(u)o.projects=u.projects,o.projectScanCached=true,a.debug(`Workspace project health cache hit: ${d}`);else try{let p=await Promise.all(l.map(h=>ve(h)));o.projects=p,o.projectScanCached=false,await yt(d,{schemaVersion:Ie,signature:n,generatedAt:new Date().toISOString(),projects:p}),a.debug(`Workspace project health cache refreshed: ${d}`);}catch(p){a.debug(`Failed to scan workspace projects: ${p}`);}o.projectScanSignature=n,o.projectScanCachePath=d;let m=[o.python,o.poetry,o.pipx,o.go,o.rapidkitCore];if(o.healthScore=_e(m,o.projects),o.scoreBreakdown=Te([{id:"system-python",label:"Python",result:o.python},{id:"system-poetry",label:"Poetry",result:o.poetry},{id:"system-pipx",label:"pipx",result:o.pipx},{id:"system-go",label:"Go",result:o.go},{id:"system-rapidkit-core",label:"RapidKit Core",result:o.rapidkitCore}],o.projects,{includeWorkspaceAggregateRules:true}),o.scopeProvenance=Ge(o.scoreBreakdown),o.rapidkitCore.status==="ok"){let p=o.rapidkitCore.message.match(/([\d.]+(?:rc\d+)?(?:a\d+)?(?:b\d+)?)/);p&&(o.coreVersion=p[1]);}let f=i.join(e,".rapidkit","reports","doctor-last-run.json"),g=await Ne(f,"workspace");return o.driftDelta=it(g,o),o.evidencePath=await kt(e,o,u?d:null),o}async function Ft(e,s){let r=e||s.projectPath,t=i.join(r,".rapidkit","reports","doctor-project-last-run.json");try{return await a$1.ensureDir(i.dirname(t)),await a$1.writeJSON(t,{schemaVersion:b$1,evidenceType:"project",generatedAt:new Date().toISOString(),contract:ce(),workspacePath:e||null,projectPath:s.projectPath,projectName:s.projectName,healthScore:s.healthScore,system:{python:s.python,poetry:s.poetry,pipx:s.pipx,go:s.go,rapidkitCore:s.rapidkitCore},project:s.project,driftDelta:s.driftDelta,summary:{scopeProvenance:s.scopeProvenance},scoreBreakdown:s.scoreBreakdown??[]},{spaces:2}),t}catch{return}}async function Dt(e){let s=await ae(e),r=await we(),t=await ve(e,{allowNonRapidkit:true}),l=_e([r.python,r.poetry,r.pipx,r.go,r.rapidkitCore],[t]),o={workspacePath:s||void 0,projectPath:e,projectName:i.basename(e),python:r.python,poetry:r.poetry,pipx:r.pipx,go:r.go,rapidkitCore:r.rapidkitCore,project:t,healthScore:l};o.scoreBreakdown=Te([{id:"system-python",label:"Python",result:o.python},{id:"system-poetry",label:"Poetry",result:o.poetry},{id:"system-pipx",label:"pipx",result:o.pipx},{id:"system-go",label:"Go",result:o.go},{id:"system-rapidkit-core",label:"RapidKit Core",result:o.rapidkitCore}],[o.project]),o.scopeProvenance=Ge(o.scoreBreakdown);let n=s||e,d=i.join(n,".rapidkit","reports","doctor-project-last-run.json"),u=await Ne(d,"project");return o.driftDelta=at(u,o),o.evidencePath=await Ft(s||void 0,o),o}function E(e,s){let r=e.status==="ok"?"\u2705":e.status==="warn"?"\u26A0\uFE0F":"\u274C",t=e.status==="ok"?c.green:e.status==="warn"?c.yellow:c.red;console.log(`${r} ${c.bold(s)}: ${t(e.message)}`),e.paths&&e.paths.length>0&&e.paths.forEach(l=>{let o=l.version?c.cyan(` -> ${l.version}`):"";console.log(` ${c.cyan("\u2022")} ${c.gray(l.location)}: ${c.dim(l.path)}${o}`);}),e.details&&console.log(` ${c.gray(e.details)}`);}function De(e){let s=e.issues.length>0,r=s?"\u26A0\uFE0F":"\u2705",t=s?c.yellow:c.green;if(console.log(`
2
- ${r} ${c.bold("Project")}: ${t(e.name)}`),e.framework){let n=e.framework==="FastAPI"||e.framework==="Django"||e.framework==="Flask"?"\u{1F40D}":e.framework==="NestJS"?"\u{1F985}":e.framework==="Next.js"||e.framework==="Nuxt"?"\u25B2":e.framework==="React"?"\u269B\uFE0F":e.framework==="Vue"?"\u{1F7E2}":e.framework==="Angular"?"\u{1F170}\uFE0F":e.framework==="SvelteKit"?"\u{1F9E1}":e.framework==="Spring Boot"?"\u2615":e.framework==="Rust"?"\u{1F980}":e.framework==="Elixir"||e.framework==="Phoenix"?"\u{1F9EA}":e.framework==="Clojure"?"\u2699\uFE0F":e.framework==="Scala"?"\u{1F53A}":e.framework==="Kotlin"?"\u{1F7E3}":e.framework==="Deno"?"\u{1F995}":e.framework==="Bun"?"\u{1F956}":e.framework==="Go/Fiber"||e.framework==="Go/Gin"?"\u{1F439}":e.framework==="Laravel"||e.framework==="PHP"?"\u{1F418}":e.framework==="Ruby on Rails"||e.framework==="Ruby"?"\u{1F48E}":e.framework==="ASP.NET"?"\u{1F537}":"\u{1F4E6}";console.log(` ${n} Framework: ${c.cyan(e.framework)}${e.kit?c.gray(` (${e.kit})`):""}`);let d=[];e.runtimeFamily&&d.push(`runtime: ${e.runtimeFamily}`),e.projectKind&&d.push(`kind: ${e.projectKind}`),e.supportTier&&d.push(`support: ${e.supportTier}`),e.frameworkConfidence&&d.push(`confidence: ${e.frameworkConfidence}`),d.length>0&&console.log(` ${c.dim("\u21B3")} ${c.gray(d.join(" \u2022 "))}`);}if(console.log(` ${c.gray(`Path: ${e.path}`)}`),e.runtimeFamily==="python"&&(e.venvActive?console.log(` \u2705 Virtual environment: ${c.green("Active")}`):console.log(` \u274C Virtual environment: ${c.red("Not found")}`),e.coreInstalled?console.log(` ${c.dim("\u2139")} RapidKit Core: ${c.gray(e.coreVersion||"In venv")} ${c.dim("(optional)")}`):console.log(` ${c.dim("\u2139")} RapidKit Core: ${c.gray("Using global installation")} ${c.dim("(recommended)")}`)),e.depsInstalled?console.log(` \u2705 Dependencies: ${c.green("Installed")}`):console.log(` \u26A0\uFE0F Dependencies: ${c.yellow("Not installed")}`),e.hasEnvFile!==void 0&&(e.hasEnvFile?console.log(` \u2705 Environment: ${c.green(".env configured")}`):console.log(` \u26A0\uFE0F Environment: ${c.yellow(".env missing")}`)),e.modulesHealthy!==void 0&&(e.modulesHealthy?console.log(` \u2705 Modules: ${c.green("Healthy")}`):e.missingModules&&e.missingModules.length>0&&console.log(` \u26A0\uFE0F Modules: ${c.yellow(`Missing ${e.missingModules.length} init file(s)`)}`)),e.stats){let n=[];e.stats.modules!==void 0&&n.push(`${e.stats.modules} module${e.stats.modules!==1?"s":""}`),n.length>0&&console.log(` \u{1F4CA} Stats: ${c.cyan(n.join(" \u2022 "))}`);}e.lastModified&&console.log(` \u{1F552} Last Modified: ${c.gray(e.lastModified)}`);let o=[];if(e.hasTests!==void 0&&o.push(e.hasTests?"\u2705 Tests":c.dim("\u2298 No tests")),e.hasDocker!==void 0&&o.push(e.hasDocker?"\u2705 Docker":c.dim("\u2298 No Docker")),e.hasCodeQuality!==void 0){let n=e.runtimeFamily==="node"?"ESLint":e.runtimeFamily==="rust"?"clippy":e.runtimeFamily==="elixir"?"Credo":e.runtimeFamily==="clojure"?"clj-kondo":e.runtimeFamily==="deno"?"deno lint":e.framework==="Spring Boot"?"Static analysis":e.framework==="Go/Fiber"||e.framework==="Go/Gin"?"golangci-lint":e.runtimeFamily==="python"?"Ruff":"Lint";o.push(e.hasCodeQuality?`\u2705 ${n}`:c.dim(`\u2298 No ${n}`));}if(o.length>0&&console.log(` ${o.join(" \u2022 ")}`),e.vulnerabilities!==void 0&&e.vulnerabilities>0&&console.log(` \u26A0\uFE0F Security: ${c.yellow(`${e.vulnerabilities} vulnerability(ies) found`)}`),e.issues.length>0&&(console.log(` ${c.bold("Issues:")}`),e.issues.forEach(n=>{console.log(` \u2022 ${c.yellow(n)}`);}),e.fixCommands&&e.fixCommands.length>0&&(console.log(`
3
- ${c.bold.cyan("\u{1F527} Quick Fix:")}`),e.fixCommands.forEach(n=>{console.log(` ${c.cyan("$")} ${c.white(n)}`);}))),e.probes&&e.probes.length>0){console.log(` ${c.bold("Probe checks:")}`);for(let n of e.probes){let d=n.status==="pass"?"\u2705":n.status==="warn"?"\u26A0\uFE0F":"\u274C";console.log(` ${d} ${n.label}: ${c.gray(n.reason)}`),n.recommendation&&console.log(` ${c.dim("\u21B3")} ${c.gray(n.recommendation)}`);}}}async function Oe(){try{return (await execa("go",["version"],{timeout:a$3(),reject:false})).exitCode===0}catch{return false}}function Z(e,s){let r=[new RegExp(`^cd\\s+"([^"]+)"\\s*(?:&&|;)\\s*${s}\\s*$`,"i"),new RegExp(`^cd\\s+'([^']+)'\\s*(?:&&|;)\\s*${s}\\s*$`,"i"),new RegExp(`^cd\\s+(.+?)\\s*(?:&&|;)\\s*${s}\\s*$`,"i")];for(let t of r){let l=e.match(t);if(l?.[1])return {projectPath:l[1].trim()}}return null}function Ve(e){return Z(e,"cp\\s+\\.env\\.example\\s+\\.env")||Z(e,"copy-item\\s+\\.env\\.example\\s+\\.env")}function Le(e){let s=[{pattern:"npm\\s+install",command:"npm",args:["install"]},{pattern:"npm\\s+ci",command:"npm",args:["ci"]},{pattern:"pnpm\\s+install",command:"pnpm",args:["install"]},{pattern:"yarn\\s+install",command:"yarn",args:["install"]},{pattern:"poetry\\s+install",command:"poetry",args:["install"]},{pattern:"pip\\s+install\\s+-r\\s+requirements\\.txt",command:"pip",args:["install","-r","requirements.txt"]},{pattern:"composer\\s+install",command:"composer",args:["install"]},{pattern:"bundle\\s+install",command:"bundle",args:["install"]},{pattern:"dotnet\\s+restore",command:"dotnet",args:["restore"]},{pattern:"cargo\\s+fetch",command:"cargo",args:["fetch"]},{pattern:"mix\\s+deps\\.get",command:"mix",args:["deps.get"]},{pattern:"clojure\\s+-P",command:"clojure",args:["-P"]},{pattern:"sbt\\s+compile",command:"sbt",args:["compile"]}];for(let r of s){let t=Z(e,r.pattern);if(t)return {projectPath:t.projectPath,command:r.command,args:r.args}}return null}function he(e,s){return /^https?:\/\//i.test(s.trim())?{projectName:e.name,projectPath:e.path,originalCommand:s,kind:"manual-url",risk:"safe",executable:false,reason:"Manual guidance URL"}:Ve(s)?{projectName:e.name,projectPath:e.path,originalCommand:s,kind:"env-copy",risk:"safe",executable:true,reason:"Environment seed copy"}:Z(s,"rapidkit\\s+init")?{projectName:e.name,projectPath:e.path,originalCommand:s,kind:"rapidkit-init",risk:"guarded",executable:true,reason:"RapidKit initializer may mutate dependencies and configs"}:Z(s,"go\\s+mod\\s+tidy")?{projectName:e.name,projectPath:e.path,originalCommand:s,kind:"go-mod-tidy",risk:"guarded",executable:true,reason:"Go module graph reconciliation"}:Le(s)?{projectName:e.name,projectPath:e.path,originalCommand:s,kind:"dependency-sync",risk:"guarded",executable:true,reason:"Dependency synchronization command"}:{projectName:e.name,projectPath:e.path,originalCommand:s,kind:"shell",risk:"invasive",executable:true,reason:"Generic shell command"}}async function ye(e){let s=e.filter(m=>m.fixCommands&&m.fixCommands.length>0),r=s.flatMap(m=>(m.fixCommands??[]).map(f=>he(m,f))),t=null,l=[],o=0,n=0,d=0,u=0;for(let m of r){let f=m.executable,g;m.kind==="go-mod-tidy"&&(t===null&&(t=await Oe()),t||(f=false,g="Go toolchain not available")),f&&(o+=1,m.risk==="safe"&&(n+=1),m.risk==="guarded"&&(d+=1),m.risk==="invasive"&&(u+=1)),l.push({...m,executableInCurrentEnvironment:f,blockedReason:g});}return {generatedAt:new Date().toISOString(),fixableProjects:s.length,totalSteps:l.length,executableSteps:o,risk:{safe:n,guarded:d,invasive:u},steps:l}}function Ae(e){let s=e instanceof Error?e.message:String(e),r=["ETIMEDOUT","ECONNRESET","ECONNREFUSED","EAI_AGAIN","ENOTFOUND","network","503","504"],t=s.toLowerCase();return r.some(l=>t.includes(l.toLowerCase()))}async function At(e,s){let r=e.get(s);if(r)return r;let t=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,l=i.basename(s).replace(/[^a-zA-Z0-9._-]/g,"_"),o=i.join(s,".rapidkit","reports","fix-snapshots",`${l}-${t}`);await a$1.ensureDir(o);let n=[".env","package-lock.json","pnpm-lock.yaml","yarn.lock","poetry.lock","requirements.txt","go.mod","go.sum","Cargo.lock","composer.lock","Gemfile.lock","pom.xml","build.gradle","build.gradle.kts","gradle.lockfile"],d=new Map;for(let m of n){let f=i.join(s,m);if(!await a$1.pathExists(f))continue;let g=i.join(o,m);await a$1.ensureDir(i.dirname(g)),await a$1.copy(f,g,{overwrite:true}),d.set(f,g);}let u={snapshotRoot:o,files:d};return e.set(s,u),u}async function It(e){for(let[s,r]of e.files.entries())await a$1.pathExists(r)&&(await a$1.ensureDir(i.dirname(s)),await a$1.copy(r,s,{overwrite:true}));}async function Ht(e){let s=await ve(e,{allowNonRapidkit:true});return {issues:s.issues.length,healthy:s.issues.length===0}}async function te(e,s=false,r={}){let t=await ye(e),l=e.filter(h=>h.fixCommands&&h.fixCommands.length>0),o=null,n=t.steps.some(h=>h.kind==="go-mod-tidy"&&!h.executableInCurrentEnvironment),d=new Map;if(l.length===0){console.log(c.green(`
4
- \u2705 No fixes needed - all projects are healthy!`));return}console.log(c.bold.cyan(`
5
- \u{1F527} Available Fixes:
6
- `));for(let h of l){let v=h.fixCommands??[];console.log(c.bold(`Project: ${c.yellow(h.name)}`)),v.forEach((y,x)=>{console.log(` ${x+1}. ${c.cyan(y)}`);}),console.log();}if(r.planOnly){if(r.json){console.log(JSON.stringify(t,null,2));return}console.log(c.bold(`
7
- \u{1F9ED} Remediation Plan
8
- `)),console.log(c.gray(`Executable steps: ${t.executableSteps}/${t.totalSteps} | risk: safe=${t.risk.safe}, guarded=${t.risk.guarded}, invasive=${t.risk.invasive}`));for(let h of t.steps){let v=h.executableInCurrentEnvironment?c.green("ready"):c.yellow(`blocked${h.blockedReason?` (${h.blockedReason})`:""}`);console.log(` - ${c.cyan(h.projectName)} [${h.risk}] ${h.originalCommand} ${c.gray(`=> ${v}`)}`);}console.log(c.gray(`
9
- Use --apply to execute this plan non-interactively, or --fix for interactive confirmation.`));return}let u=t.executableSteps,m=t.risk.safe,f=t.risk.guarded,g=t.risk.invasive;if(u===0){console.log(c.gray("\u{1F4A1} No automatic fixes can be applied right now.")),n&&console.log(c.gray(" Install Go to enable go mod tidy fixes, then rerun `rapidkit doctor workspace --fix`."));return}if(!s){console.log(c.gray('\u{1F4A1} Run "npx rapidkit doctor workspace --fix" to apply fixes automatically'));return}if(console.log(c.gray(`Risk policy: safe=${m}, guarded=${f}, invasive=${g}. Guarded/invasive fixes use snapshot + rollback.`)),!r.skipConfirmation){let{confirm:h}=await Ye.prompt([{type:"confirm",name:"confirm",message:`Apply ${l.reduce((v,y)=>v+(y.fixCommands?.length??0),0)} fix(es)?`,default:false}]);if(!h){console.log(c.yellow(`
10
- \u26A0\uFE0F Fixes cancelled by user`));return}}console.log(c.bold.cyan(`
11
- \u{1F680} Applying fixes...
12
- `));let p=new Set;for(let h of l){let v=h.fixCommands??[];console.log(c.bold(`Fixing ${c.cyan(h.name)}...`));for(let y of v){let x=he(h,y),T=`${h.path}::${y}`;if(!p.has(T)){p.add(T);try{if(console.log(c.gray(` $ ${y}`)),x.kind==="manual-url"){console.log(c.yellow(` \u2139 Manual action required: open ${y}`)),console.log(c.green(` \u2705 Recorded as guidance
13
- `));continue}if(!x.executable){console.log(c.yellow(" \u26A0 Step is non-executable by policy")),console.log(c.green(` \u2705 Recorded as guidance
14
- `));continue}x.risk!=="safe"&&await At(d,x.projectPath);let W=Ve(y);if(W){let B=i.join(W.projectPath,".env.example"),R=i.join(W.projectPath,".env");if(!await a$1.pathExists(B))throw new Error(`.env.example not found at ${B}`);if(await a$1.pathExists(R)){console.log(c.green(` \u2705 .env already exists
15
- `));continue}await a$1.copy(B,R,{overwrite:false,errorOnExist:false}),console.log(c.green(` \u2705 Success
16
- `));continue}let J=Z(y,"rapidkit\\s+init");if(J){await execa("rapidkit",["init"],{cwd:J.projectPath,shell:b(),stdio:"inherit"}),console.log(c.green(` \u2705 Success
17
- `));continue}let q=Z(y,"go\\s+mod\\s+tidy");if(q){if(o===null&&(o=await Oe()),!o){console.log(c.yellow(" \u26A0 Go toolchain is not installed \u2014 skipping go mod tidy; install Go to apply this fix.")),console.log(c.green(` \u2705 Recorded as guidance
18
- `));continue}await execa("go",["mod","tidy"],{cwd:q.projectPath,shell:b(),stdio:"inherit"}),console.log(c.green(` \u2705 Success
19
- `));continue}let O=Le(y);if(O){let R;for(let ee=1;ee<=2;ee+=1)try{await execa(O.command,O.args,{cwd:O.projectPath,shell:b(),stdio:"inherit"}),R=null;break}catch(ne){if(R=ne,ee<2&&Ae(ne)){console.log(c.yellow(` \u26A0 Retrying dependency sync (${ee}/1)...`));continue}throw ne}if(R)throw R;console.log(c.green(` \u2705 Success
20
- `));continue}let se=x.kind==="shell"?2:1,U;for(let B=1;B<=se;B+=1)try{await execa(y,{shell:true,stdio:"inherit"}),U=null;break}catch(R){if(U=R,B<se&&Ae(R)){console.log(c.yellow(` \u26A0 Retrying command (${B}/${se-1})...`));continue}throw R}if(U)throw U;console.log(c.green(` \u2705 Success
21
- `));}catch(W){let J=he(h,y);if(J.risk!=="safe"){let q=d.get(J.projectPath);if(q)try{await It(q),console.log(c.yellow(" \u21A9 Rolled back snapshot after failed fix"));}catch(O){console.log(c.red(` \u274C Rollback failed: ${O instanceof Error?O.message:String(O)}`));}}console.log(c.red(` \u274C Failed: ${W instanceof Error?W.message:String(W)}
22
- `));}}}try{let y=await Ht(h.path);console.log(y.healthy?c.green(` \u2705 Post-fix verification passed for ${h.name}`):c.yellow(` \u26A0 Post-fix verification: ${y.issues} issue(s) remain for ${h.name}`));}catch(y){console.log(c.yellow(` \u26A0 Post-fix verification skipped: ${y instanceof Error?y.message:String(y)}`));}}console.log(c.bold.green(`
23
- \u2705 Fix process completed!`));}async function zt(e={}){let s=!!(e.fix||e.plan||e.apply),r=!e.workspace&&!e.project&&s?await ae(process.cwd()):null,t=e.workspace||!!r,l=!!e.project&&!t;if(e.json||console.log(c.bold.cyan(`
24
- \u{1FA7A} RapidKit Health Check
25
- `)),t){let o=r??await ae(process.cwd());o||(a.error("No RapidKit workspace found in current directory or parents"),a.info('Run this command from within a workspace, or use "rapidkit doctor" for system check'),process.exit(1)),e.json||(r&&console.log(c.gray("\u2139\uFE0F Detected workspace context; enabling workspace checks for --fix")),console.log(c.bold(`Workspace: ${c.cyan(i.basename(o))}`)),console.log(c.gray(`Path: ${o}`)));let n=await Fe(o);if(e.json||(n.projectScanCached&&console.log(c.gray(`\u2139\uFE0F Reused cached project scan${n.projectScanCachePath?` (${i.basename(n.projectScanCachePath)})`:""}`)),n.evidencePath&&console.log(c.gray(`\u2139\uFE0F Evidence saved: ${n.evidencePath}`))),e.json){let f=e.plan?await ye(n.projects):void 0,g={contract:ce(),workspace:{name:i.basename(o),path:o},cache:{projectScan:n.projectScanCached??false,projectScanPath:n.projectScanCachePath,evidencePath:n.evidencePath},healthScore:n.healthScore,system:{python:n.python,poetry:n.poetry,pipx:n.pipx,rapidkitCore:n.rapidkitCore,versions:{core:n.coreVersion,npm:n.npmVersion}},projects:n.projects.map(p=>({name:p.name,path:p.path,framework:p.framework,frameworkKey:p.frameworkKey,importStack:p.importStack,runtimeFamily:p.runtimeFamily,projectKind:p.projectKind,supportTier:p.supportTier,frameworkConfidence:p.frameworkConfidence,venvActive:p.venvActive,depsInstalled:p.depsInstalled,hasEnvFile:p.hasEnvFile,vulnerabilities:p.vulnerabilities,coreInstalled:p.coreInstalled,coreVersion:p.coreVersion,issues:p.issues,fixCommands:p.fixCommands,probes:p.probes})),summary:{totalProjects:n.projects.length,totalIssues:n.projects.reduce((p,h)=>p+h.issues.length,0),projectAdvisoryWarningProjects:ge(n.projects),projectAdvisoryWarnings:ke(n.projects),hasSystemErrors:[n.python,n.rapidkitCore].some(p=>p.status==="error"),scopeProvenance:n.scopeProvenance},driftDelta:n.driftDelta,scoreBreakdown:n.scoreBreakdown??[],...f?{remediationPlan:f}:{}};console.log(JSON.stringify(g,null,2));return}if(n.healthScore){let f=n.healthScore,g=Math.round(f.passed/f.total*100),p=g>=80?c.green:g>=50?c.yellow:c.red,h="\u2588".repeat(Math.floor(g/5))+"\u2591".repeat(20-Math.floor(g/5));console.log(c.bold(`
26
- \u{1F4CA} Health Score:`)),console.log(` ${p(`${g}%`)} ${c.gray(h)}`),console.log(` ${c.green(`\u2705 ${f.passed} passed`)} ${c.gray("|")} ${c.yellow(`\u26A0\uFE0F ${f.warnings} warnings`)} ${c.gray("|")} ${c.red(`\u274C ${f.errors} errors`)}`);}if(console.log(c.bold(`
27
-
28
- System Tools:
29
- `)),E(n.python,"Python"),E(n.poetry,"Poetry"),E(n.pipx,"pipx"),E(n.go,"Go"),E(n.rapidkitCore,"RapidKit Core"),n.coreVersion&&n.npmVersion){let f=n.coreVersion.split(".")[1],g=n.npmVersion.split(".")[1];f!==g&&(console.log(c.yellow(`
30
- \u26A0\uFE0F Version mismatch: Core ${n.coreVersion} / CLI ${n.npmVersion}`)),console.log(c.gray(" Consider updating to matching versions for best compatibility")));}n.projects.length>0?(console.log(c.bold(`
31
- \u{1F4E6} Projects (${n.projects.length}):`)),n.projects.forEach(f=>De(f))):(console.log(c.bold(`
32
- \u{1F4E6} Projects:`)),console.log(c.gray(" No RapidKit projects found in workspace")));let d=n.projects.reduce((f,g)=>f+g.issues.length,0),u=ge(n.projects),m=[n.python,n.rapidkitCore].some(f=>f.status==="error");if(m||d>0||u>0){let f=u>0?` and ${u} advisory warning project(s)`:"";if(console.log(c.bold.yellow(`
33
- \u26A0\uFE0F Found ${d} project issue(s)${f}`)),m&&console.log(c.bold.red("\u274C System requirements not met")),e.plan)await te(n.projects,false,{planOnly:true,json:e.json});else if(e.fix||e.apply){if(await te(n.projects,true,{skipConfirmation:e.apply===true}),!e.json){let g=await Fe(o,false),p=g.projects.reduce((v,y)=>v+y.issues.length,0),h=[g.python,g.rapidkitCore].some(v=>v.status==="error");h||p>0?(console.log(c.bold.yellow(`
34
- \u26A0\uFE0F Post-fix verification found ${p} remaining issue(s)`)),h&&console.log(c.bold.red("\u274C System requirements still not met"))):console.log(c.bold.green(`
35
- \u2705 Post-fix verification passed. Workspace is healthy.`)),g.projectScanCached&&console.log(c.gray(`\u2139\uFE0F Reused cached project scan${g.projectScanCachePath?` (${i.basename(g.projectScanCachePath)})`:""}`)),g.evidencePath&&console.log(c.gray(`\u2139\uFE0F Evidence refreshed: ${g.evidencePath}`));}}else d>0&&await te(n.projects,false);}else console.log(c.bold.green(`
36
- \u2705 All checks passed! Workspace is healthy.`));}else if(l){let o=await St(process.cwd());o||(await ae(process.cwd())?(a.error("No backend project found in current directory within this workspace"),a.info("Run this command from inside a project directory in the workspace")):a.error("No RapidKit project found in current directory or parents"),a.info('Run this command from within a project, or use "rapidkit doctor workspace" for workspace checks'),process.exit(1));let n=await Dt(o),d=n.workspacePath?$e(n.workspacePath):null,u=$e(n.project.path);if(e.json){let x=e.plan?await ye([n.project]):void 0,T={contract:ce(),scope:"project",workspace:d?{name:i.basename(d),path:d}:null,project:{name:n.project.name,path:u,framework:n.project.framework,frameworkKey:n.project.frameworkKey,importStack:n.project.importStack,runtimeFamily:n.project.runtimeFamily,projectKind:n.project.projectKind,supportTier:n.project.supportTier,frameworkConfidence:n.project.frameworkConfidence,venvActive:n.project.venvActive,depsInstalled:n.project.depsInstalled,hasEnvFile:n.project.hasEnvFile,vulnerabilities:n.project.vulnerabilities,coreInstalled:n.project.coreInstalled,coreVersion:n.project.coreVersion,issues:n.project.issues,fixCommands:n.project.fixCommands,probes:n.project.probes},evidencePath:n.evidencePath,healthScore:n.healthScore,system:{python:n.python,poetry:n.poetry,pipx:n.pipx,go:n.go,rapidkitCore:n.rapidkitCore},summary:{totalProjects:1,totalIssues:n.project.issues.length,projectAdvisoryWarningProjects:Y(n.project)>0?1:0,projectAdvisoryWarnings:Y(n.project),hasSystemErrors:[n.python,n.rapidkitCore].some(W=>W.status==="error"),scopeProvenance:n.scopeProvenance},driftDelta:n.driftDelta,scoreBreakdown:n.scoreBreakdown??[],...x?{remediationPlan:x}:{}};console.log(JSON.stringify(T,null,2));return}console.log(c.bold(`Project: ${c.cyan(i.basename(o))}`)),console.log(c.gray(`Path: ${o}`)),n.workspacePath&&console.log(c.gray(`Workspace: ${i.basename(n.workspacePath)}`)),n.evidencePath&&console.log(c.gray(`\u2139\uFE0F Evidence saved: ${n.evidencePath}`));let m=n.healthScore,f=m.total>0?Math.round(m.passed/m.total*100):0,g=f>=80?c.green:f>=50?c.yellow:c.red,p="\u2588".repeat(Math.floor(f/5))+"\u2591".repeat(20-Math.floor(f/5));console.log(c.bold(`
37
- \u{1F4CA} Health Score:`)),console.log(` ${g(`${f}%`)} ${c.gray(p)}`),console.log(` ${c.green(`\u2705 ${m.passed} passed`)} ${c.gray("|")} ${c.yellow(`\u26A0\uFE0F ${m.warnings} warnings`)} ${c.gray("|")} ${c.red(`\u274C ${m.errors} errors`)}`),console.log(c.bold(`
38
-
39
- System Tools:
40
- `)),E(n.python,"Python"),E(n.poetry,"Poetry"),E(n.pipx,"pipx"),E(n.go,"Go"),E(n.rapidkitCore,"RapidKit Core"),console.log(c.bold(`
41
- \u{1F4E6} Project (1):`)),De(n.project);let h=[n.python,n.rapidkitCore].some(x=>x.status==="error"),v=n.project.issues.length,y=Y(n.project);if(h||v>0||y>0){let x=y>0?` and ${y} advisory warning(s)`:"";console.log(c.bold.yellow(`
42
- \u26A0\uFE0F Found ${v} project issue(s)${x}`)),h&&console.log(c.bold.red("\u274C System requirements not met")),e.plan?await te([n.project],false,{planOnly:true,json:e.json}):e.fix||e.apply?await te([n.project],true,{skipConfirmation:e.apply===true}):v>0&&await te([n.project],false);}else console.log(c.bold.green(`
43
- \u2705 All checks passed! Project is healthy.`));}else {console.log(c.bold(`System Tools:
44
- `));let o=await we(),n=o.python,d=o.poetry,u=o.pipx,m=o.go,f=o.rapidkitCore;E(n,"Python"),E(d,"Poetry"),E(u,"pipx"),E(m,"Go"),E(f,"RapidKit Core"),[n,f].some(p=>p.status==="error")?(console.log(c.bold.red(`
45
- \u274C Some required tools are missing`)),(e.fix||e.apply)&&console.log(c.gray(`
46
- Tip: Project auto-fix runs in workspace mode. Run from a workspace and use "rapidkit doctor workspace --fix"`)),console.log(c.gray(`
47
- Tip: Run "rapidkit doctor workspace" for workspace-wide checks, or "rapidkit doctor project" for the current project`))):(console.log(c.bold.green(`
48
- \u2705 All required tools are installed!`)),(e.fix||e.apply)&&console.log(c.gray(`
49
- Tip: Project auto-fix runs in workspace mode. Run from a workspace and use "rapidkit doctor workspace --fix"`)),console.log(c.gray(`
50
- Tip: Run "rapidkit doctor workspace" for workspace-wide checks, or "rapidkit doctor project" for the current project`)));}console.log("");}export{zt as runDoctor};
@@ -1 +0,0 @@
1
- export{a as runWorkspaceStage}from'./chunk-CQXWD2ZG.js';