rapidkit 0.34.0 → 0.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +137 -706
  2. package/contracts/backend-import-stack-parity.snapshot.json +36 -36
  3. package/contracts/infra-stack.v1.json +190 -47
  4. package/contracts/module-layout.v1.json +12 -3
  5. package/contracts/module-support.v1.json +20 -0
  6. package/contracts/runtime-command-surface.v1.json +139 -22
  7. package/contracts/workspace-intelligence/workspace-context.v1.json +59 -0
  8. package/contracts/workspace-intelligence/workspace-impact.v1.json +84 -0
  9. package/contracts/workspace-intelligence/workspace-model-diff.v1.json +105 -0
  10. package/contracts/workspace-intelligence/workspace-model-snapshot.v1.json +36 -0
  11. package/contracts/workspace-intelligence/workspace-model.v1.json +50 -0
  12. package/contracts/workspace-intelligence/workspace-verify.v1.json +111 -0
  13. package/dist/analyze-IIPDLLM2.js +1 -0
  14. package/dist/autopilot-release-EO7GQS4P.js +1 -0
  15. package/dist/chunk-5LLGW5TP.js +9 -0
  16. package/dist/{chunk-2PGMJSO5.js → chunk-752X3YI3.js} +84 -84
  17. package/dist/chunk-A5FBGRJA.js +1 -0
  18. package/dist/chunk-B7NCBH5B.js +2 -0
  19. package/dist/chunk-DKVWFHZO.js +4 -0
  20. package/dist/{chunk-3TBSWOTY.js → chunk-FNL34DKD.js} +13 -13
  21. package/dist/chunk-HHJAANUC.js +1 -0
  22. package/dist/chunk-KDUAZXEQ.js +3 -0
  23. package/dist/chunk-KMUWWZRT.js +1 -0
  24. package/dist/chunk-MCLLP6MW.js +2 -0
  25. package/dist/chunk-OCGZNSOE.js +1 -0
  26. package/dist/{chunk-RGXFDBYB.js → chunk-R4RPUW7I.js} +1 -1
  27. package/dist/chunk-TC2PSHT6.js +50 -0
  28. package/dist/chunk-UZW5QFRW.js +5 -0
  29. package/dist/chunk-VPNHGQIV.js +1 -0
  30. package/dist/chunk-YBS2HGO3.js +2 -0
  31. package/dist/chunk-YJ24EV3P.js +1 -0
  32. package/dist/create-LUXJGSNL.js +1 -0
  33. package/dist/{doctor-3SBEO7XU.js → doctor-DG3TBPZN.js} +1 -1
  34. package/dist/imported-projects-registry-ZOCHFWMK.js +1 -0
  35. package/dist/index.d.ts +29 -2
  36. package/dist/index.js +135 -129
  37. package/dist/module-layout-NZ43RSC5.js +1 -0
  38. package/dist/{pipeline-VUQ6AXKF.js → pipeline-7OTUIB6D.js} +1 -1
  39. package/dist/{workspace-AG2MQFTY.js → workspace-ZXWYIZOR.js} +1 -1
  40. package/dist/workspace-context-YFQQROOZ.js +2 -0
  41. package/dist/{workspace-contract-Z5VYUF3T.js → workspace-contract-A6QP7FPA.js} +1 -1
  42. package/dist/{workspace-foundation-G74V6K4U.js → workspace-foundation-TYLH5SAU.js} +1 -1
  43. package/dist/workspace-intelligence-NXIO55GJ.js +1 -0
  44. package/dist/workspace-model-OO4WOBJS.js +1 -0
  45. package/dist/workspace-run-AZ63D75J.js +1 -0
  46. package/dist/workspace-verify-K56NI3AI.js +1 -0
  47. package/package.json +14 -4
  48. package/dist/analyze-SVYRQNLO.js +0 -1
  49. package/dist/autopilot-release-LBKCP73F.js +0 -1
  50. package/dist/chunk-4E6ZGX6V.js +0 -1
  51. package/dist/chunk-ILY6QARY.js +0 -9
  52. package/dist/chunk-JIECGCLV.js +0 -4
  53. package/dist/chunk-KXTXQODI.js +0 -5
  54. package/dist/chunk-QCZGNOTH.js +0 -2
  55. package/dist/chunk-QUNCXYYK.js +0 -1
  56. package/dist/chunk-SAIWD6VM.js +0 -3
  57. package/dist/chunk-Y3UKTEZO.js +0 -2
  58. package/dist/chunk-YV7IQDBM.js +0 -50
  59. package/dist/create-BO2I3ESU.js +0 -1
  60. package/dist/module-layout-J56LHEGH.js +0 -1
  61. package/dist/workspace-run-EDM3SUPA.js +0 -1
@@ -0,0 +1,50 @@
1
+ import {q as q$1}from'./chunk-YBS2HGO3.js';import {i,d,b as b$2,a as a$6}from'./chunk-UZW5QFRW.js';import {c,a as a$3,b as b$1}from'./chunk-NFUXULIF.js';import {a}from'./chunk-VM2TOHNX.js';import {b,f,d as d$1,a as a$5,k,g,i as i$1}from'./chunk-Z5LKRG57.js';import {a as a$4}from'./chunk-2FIX2MDC.js';import {a as a$2}from'./chunk-HHJAANUC.js';import l from'chalk';import {execa}from'execa';import r from'fs-extra';import a$1 from'path';import Pt from'inquirer';var kt=[".eslintrc.js",".eslintrc.cjs",".eslintrc.json",".eslintrc.yaml",".eslintrc.yml","eslint.config.js","eslint.config.mjs","eslint.config.cjs"],wt=["tests","test","src/test","__tests__","e2e","playwright","cypress"],vt=["vitest.config.ts","vitest.config.js","vitest.config.mjs","jest.config.js","jest.config.ts","jest.config.mjs","playwright.config.ts","playwright.config.js","cypress.config.js","cypress.config.ts"],bt=["src","app","pages"],xt=["dev","build","test","lint"];function Ge(e){let n=e?.scripts;if(!n||typeof n!="object"||Array.isArray(n))return {};let i={};for(let[t,c]of Object.entries(n))typeof c=="string"&&c.trim().length>0&&(i[t]=c);return i}async function Ke(e,n){for(let c of kt)if(await r.pathExists(a$1.join(e,c)))return true;let i=n??(await r.pathExists(a$1.join(e,"package.json"))?await r.readJson(a$1.join(e,"package.json")):null);if(!i)return false;if(i.eslintConfig)return true;let t={...i.dependencies??{},...i.devDependencies??{}};return !!(t.eslint||t["@eslint/js"]||t["@eslint/eslintrc"])}async function We(e,n){for(let c of wt)if(await r.pathExists(a$1.join(e,c)))return true;for(let c of vt)if(await r.pathExists(a$1.join(e,c)))return true;let i=Ge(n);if(i.test||i["test:unit"]||i["test:e2e"]||i["test:ci"]||i["test:watch"])return true;let t={...n?.dependencies??{},...n?.devDependencies??{}};return t.vitest||t.jest||t["@playwright/test"]||t.cypress?true:await jt(e)}async function jt(e){let n=["src","app","pages","components"],i=/\.(test|spec)\.(tsx?|jsx?|vue|svelte)$/i,c=new Set(["node_modules",".git","dist","build",".next","coverage",".turbo"]);for(let o of n){let s=a$1.join(e,o);if(!await r.pathExists(s))continue;let d=[{dir:s,depth:0}];for(;d.length>0;){let u=d.shift();if(!u)break;let p=[];try{p=await r.readdir(u.dir);}catch{continue}for(let f of p){let m=a$1.join(u.dir,f);if(i.test(f))return true;if(!(u.depth>=3||c.has(f)||f.startsWith(".")))try{(await r.stat(m)).isDirectory()&&d.push({dir:m,depth:u.depth+1});}catch{continue}}}}return false}async function be(e){for(let n of bt){let i=a$1.join(e,n);if(await r.pathExists(i))try{if((await r.readdir(i)).some(c=>!c.startsWith(".")))return true}catch{continue}}return false}function Ct(e){let n=e.key;return b$2(n).key}function Et(e,n,i){return a$6(n,i).some(c=>!!e[c])}async function Oe(e){let{projectPath:n,detection:i,packageJsonData:t}=e,c=Ct(i),o=b$2(c),s=Ge(t),d=[],u=await r.pathExists(a$1.join(n,"package-lock.json"))||await r.pathExists(a$1.join(n,"pnpm-lock.yaml"))||await r.pathExists(a$1.join(n,"yarn.lock"))||await r.pathExists(a$1.join(n,"bun.lockb"));d.push({id:"frontend-lockfile-integrity",label:"Frontend lockfile integrity",status:u?"pass":"warn",severity:"warn",scope:"project-scoped",reason:u?"Node lockfile detected for deterministic dependency restore.":"No Node lockfile detected (package-lock/yarn.lock/pnpm-lock.yaml/bun.lockb).",recommendation:u?void 0:"Commit a lockfile for deterministic installs and CI parity."});let p=await r.pathExists(a$1.join(n,"tsconfig.json")),f=await r.pathExists(a$1.join(n,"jsconfig.json")),m=p||f;d.push({id:"frontend-typescript-surface",label:"TypeScript project surface",status:m?"pass":"warn",severity:"warn",scope:"project-scoped",reason:m?p?"tsconfig.json detected.":"jsconfig.json detected.":"No tsconfig.json or jsconfig.json detected.",recommendation:m?void 0:"Add tsconfig.json (or jsconfig.json) for typed frontend builds and IDE parity."});let g=o.fileHints.length>0&&o.fileHints.some(y=>r.pathExistsSync(a$1.join(n,y)));d.push({id:"frontend-framework-config",label:`${o.displayName} config surface`,status:g?"pass":"warn",severity:"warn",scope:"project-scoped",reason:g?`${o.displayName} configuration artifacts detected.`:`No ${o.displayName} config markers detected (${o.fileHints.join(", ")||"n/a"}).`,recommendation:g?void 0:"Keep framework config files in-repo for reproducible dev/build behavior."});for(let y of xt){let k=Et(s,c,y),b=y==="dev"||y==="build";d.push({id:`frontend-script-${y}`,label:`${y} script surface`,status:k?"pass":b?"fail":"warn",severity:b?"error":"warn",scope:"project-scoped",reason:k?`package.json exposes a ${y} script for ${o.displayName}.`:`No ${y} script detected for ${o.displayName}.`,recommendation:k?void 0:`Add a "${a$6(c,y)[0]??y}" script to package.json.`});}let h=await be(n);return d.push({id:"frontend-source-tree",label:"Frontend source tree",status:h?"pass":"warn",severity:"warn",scope:"project-scoped",reason:h?"Application source directories detected (src/app/pages).":"No frontend source directories detected under src/, app/, or pages/.",recommendation:h?void 0:"Ensure the scaffolded application tree exists before running lifecycle commands."}),d}function St(e){return [...new Set(e.filter(n=>n&&n.trim().length>0))]}function Rt(){let e=k().map(t=>a$1.join(t,a$5()?"poetry.exe":"poetry")),n=a$5()?[a$1.join(process.env.APPDATA||"","Python","Scripts","poetry.exe"),a$1.join(process.env.USERPROFILE||"","AppData","Roaming","Python","Scripts","poetry.exe")]:[],i=a$5()?[]:["/usr/local/bin/poetry","/usr/bin/poetry"];return St([...e,...n,...i])}function $t(e){let n=k().map(u=>({location:"Global (user-local)",path:a$1.join(u,a$5()?"rapidkit.exe":"rapidkit")})),i=[{location:"Global (pipx)",path:a$1.join(e,".local","bin","rapidkit")},{location:"Global (pipx)",path:a$1.join(e,"AppData","Roaming","Python","Scripts","rapidkit.exe")},{location:"Global (pyenv)",path:a$1.join(e,".pyenv","shims","rapidkit")},{location:"Global (system)",path:"/usr/local/bin/rapidkit"},{location:"Global (system)",path:"/usr/bin/rapidkit"}],t=g(a$1.join(process.cwd(),".venv")),c=i$1(process.cwd()),o=[{location:"Workspace (.venv)",path:t},...c.map(u=>({location:"Workspace (launcher)",path:u}))],s=[...n,...i,...o],d=new Set;return s.filter(u=>d.has(u.path)?false:(d.add(u.path),true))}function Ft(e){let n=new Map([["Workspace (.venv)",0],["Global (user-local)",1],["Global (pipx)",2],["Global (pyenv)",3],["Global (system)",4]]);return [...e].sort((i,t)=>{let c=n.get(i.location)??Number.MAX_SAFE_INTEGER,o=n.get(t.location)??Number.MAX_SAFE_INTEGER;return c!==o?c-o:i.path.localeCompare(t.path)})}function ee(e){let n=0,i=e.issues.some(t=>t.toLowerCase().includes("environment file missing"));return e.hasEnvFile===false&&!i&&(n+=1),typeof e.vulnerabilities=="number"&&e.vulnerabilities>0&&(n+=1),n}function xe(e){return e.filter(n=>ee(n)>0).length}function Pe(e){return e.reduce((n,i)=>n+ee(i),0)}var Dt="doctor-project-scan-v2",Xe="doctor-workspace-cache-v2",At=Object.freeze({version:"doctor-evidence-v1",scoringPolicyVersion:"doctor-score-policy-v1",generatedBy:"rapidkit-npm",deterministicScoreBreakdown:true,scopeModel:"workspace-aggregate-or-project-scoped"});function me(){return {...At}}function fe(e){return !e||e.total<=0?null:Math.round(e.passed/e.total*100)}function Ye(e){return typeof e=="number"?e:Array.isArray(e)?e.length:0}async function Ze(e,n){try{if(!await r.pathExists(e))return null;let i=await r.readJSON(e);return c(i,n)?i:null}catch{return null}}function et(e,n){if(!e?.system)return [];let i=[{id:"python",current:n.python},{id:"poetry",current:n.poetry},{id:"pipx",current:n.pipx},{id:"go",current:n.go},{id:"rapidkitCore",current:n.rapidkitCore}],t=[];for(let c of i){let o=e.system?.[c.id]?.status;!o||o===c.current.status||t.push({id:c.id,from:o,to:c.current.status});}return t}function It(e,n){let i=new Map;for(let g of n.projects)i.set(g.path||g.name,g.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:[],c=new Map;for(let g of t){let h=g.path||g.name;h&&c.set(h,Ye(g.issues));}let o=0,s=0,d=new Set,u=new Set,p=new Set([...Array.from(c.keys()),...Array.from(i.keys())]);for(let g of p){let h=c.get(g)??0,y=i.get(g)??0;y>h?(o+=y-h,d.add(g)):y<h&&(s+=h-y,u.add(g));}let f=fe(e.healthScore),m=fe(n.healthScore);return {baselineAvailable:true,previousGeneratedAt:e.generatedAt,newIssueCount:o,resolvedIssueCount:s,netIssueDelta:o-s,scoreDeltaPercent:f===null||m===null?null:m-f,systemStatusChanges:et(e,{python:n.python,poetry:n.poetry,pipx:n.pipx,go:n.go,rapidkitCore:n.rapidkitCore}),regressedProjects:Array.from(d).sort(),improvedProjects:Array.from(u).sort()}}function Nt(e,n){if(!e)return {baselineAvailable:false,newIssueCount:0,resolvedIssueCount:0,netIssueDelta:0,scoreDeltaPercent:null,systemStatusChanges:[],regressedProjects:[],improvedProjects:[]};let i=Ye(e.project?.issues),t=n.project.issues.length,c=Math.max(t-i,0),o=Math.max(i-t,0),s=fe(e.healthScore),d=fe(n.healthScore),u=n.project.path||n.project.name;return {baselineAvailable:true,previousGeneratedAt:e.generatedAt,newIssueCount:c,resolvedIssueCount:o,netIssueDelta:c-o,scoreDeltaPercent:s===null||d===null?null:d-s,systemStatusChanges:et(e,{python:n.python,poetry:n.poetry,pipx:n.pipx,go:n.go,rapidkitCore:n.rapidkitCore}),regressedProjects:c>0?[u]:[],improvedProjects:o>0?[u]:[]}}function tt(e){let n=e??[],i=0,t=0;for(let s of n){if(s.scope==="project-scoped"){i+=1;continue}(s.scope==="workspace-aggregate"||s.scope==="host-system")&&(t+=1);}let c=i>0&&t>0?1:0,o=c>0?"mixed":i>0?"scoped":t>0?"aggregated":"unknown";return {scopedCount:i,aggregatedCount:t,mixedCount:c,dominantScope:o}}function $(e,n){return a$5()?`cd "${e}"; ${n}`:`cd ${e} && ${n}`}function q(e){return a$5()?$(e,"Copy-Item .env.example .env"):$(e,"cp .env.example .env")}function Ht(e){return e==="FastAPI"||e==="NestJS"?"first-class":e==="Django"||e==="Flask"||e==="Express"||e==="Fastify"||e==="Koa"||e==="Go/Fiber"||e==="Go/Gin"||e==="Spring Boot"||e==="Rust"||e==="Phoenix"||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 Mt(e){return e==="Next.js"||e==="Remix"||e==="Nuxt"||e==="React"||e==="Vue"||e==="Angular"||e==="SvelteKit"||e==="Svelte"||e==="Vite"||e==="Astro"||e==="Solid"?"frontend":e==="Unknown"||e==="Node.js"||e==="Python"?"generic":"backend"}function Tt(e){return e==="NestJS"||e==="Next.js"||e==="Remix"||e==="Nuxt"||e==="React"||e==="Vue"||e==="Angular"||e==="SvelteKit"||e==="Svelte"||e==="Vite"||e==="Astro"||e==="Solid"||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 je(e,n){let i=q$1(n);e.commandCapabilities=i,e.supportTier=i.frameworkSupportTier;}function ue(e,n,i,t){e.framework=n,e.frameworkConfidence=i,e.supportTier=Ht(n),e.projectKind=Mt(n),e.runtimeFamily=Tt(n);}function nt(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 Se(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 "nextjs":return "Next.js";case "remix":return "Remix";case "nuxt":return "Nuxt";case "react":return "React";case "vite":return "Vite";case "vue":return "Vue";case "sveltekit":return "SvelteKit";case "svelte":return "Svelte";case "angular":return "Angular";case "astro":return "Astro";case "solid":return "Solid";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 Bt(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 _t(e,n){e.framework=Se(n),e.frameworkKey=n.key,e.importStack=n.importStack,e.frameworkConfidence=n.confidence,e.supportTier=n.supportTier,e.projectKind="frontend",e.runtimeFamily=nt(n.runtime);}function G(e,n){e.framework=Se(n),e.frameworkKey=n.key,e.importStack=n.importStack,e.frameworkConfidence=n.confidence,e.supportTier=n.supportTier,e.projectKind=Bt(n)?"generic":"backend",e.runtimeFamily=nt(n.runtime);}function Gt(e){let n=e.dependencies,i=e.scripts??{},t=(e.kitName??"").toLowerCase(),c=s=>!!n[s],o=Object.values(i).filter(s=>typeof s=="string").join(" ").toLowerCase();return c("next")||o.includes("next ")?{framework:"Next.js",confidence:"high"}:c("nuxt")||o.includes("nuxt ")?{framework:"Nuxt",confidence:"high"}:c("@nestjs/core")||t.startsWith("nestjs.")?{framework:"NestJS",confidence:"high"}:c("express")?{framework:"Express",confidence:"high"}:c("fastify")?{framework:"Fastify",confidence:"high"}:c("koa")?{framework:"Koa",confidence:"high"}:c("@angular/core")?{framework:"Angular",confidence:"high"}:c("@sveltejs/kit")||o.includes("svelte-kit")?{framework:"SvelteKit",confidence:"high"}:c("vue")?{framework:"Vue",confidence:"medium"}:c("react")&&c("react-dom")?{framework:"React",confidence:"medium"}:{framework:"Node.js",confidence:"low"}}async function Kt(e){let n=i(e);return n.runtime!=="python"?{framework:"Python",confidence:"low"}:{framework:Se(n),confidence:n.confidence}}async function Le(e){try{let n=await r.stat(e);return `${a$1.basename(e)}:${n.isDirectory()?"d":"f"}:${n.size}:${n.mtimeMs}`}catch{return `${a$1.basename(e)}:missing`}}async function Wt(e){try{let n=new Set([".git",".venv","node_modules",".rapidkit","dist","build","coverage","__pycache__"]),i=new Set;await ce(e)&&i.add(e);let t=await a$2(e);for(let o of t){let s=a$1.isAbsolute(o.path)?o.path:a$1.join(e,o.path);await ce(s)&&i.add(s);}let c=async(o,s)=>{if(s<0)return;let d=await st(o);for(let u of d){if(ot(u,n))continue;let p=a$1.join(o,u);if(await ce(p)){i.add(p);continue}s>0&&await c(p,s-1);}};return await c(e,1),i.size===0&&(await tn(e,3,n)).forEach(s=>i.add(s)),Array.from(i).sort((o,s)=>o.localeCompare(s))}catch{return []}}async function Ot(e,n){let i=[a$1.join(e,".rapidkit-workspace"),a$1.join(e,".rapidkit","workspace.json"),a$1.join(e,".rapidkit","imported-projects.json"),a$1.join(e,".rapidkit","policies.yml"),a$1.join(e,".rapidkit","toolchain.lock"),a$1.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"],c=await Promise.all(i.map(Le)),o=await Promise.all(n.map(async s=>{let d=await Promise.all(t.map(u=>Le(a$1.join(s,u))));return `${s}::${d.join("|")}`}));return [Dt,...c,...o].join("||")}async function Lt(e,n){try{if(!await r.pathExists(e))return null;let i=await r.readJSON(e);return !i||i.signature!==n||!Array.isArray(i.projects)||typeof i.schemaVersion=="string"&&i.schemaVersion!==Xe?null:i}catch{return null}}async function Vt(e,n){try{await r.ensureDir(a$1.dirname(e)),await r.writeJSON(e,n,{spaces:2});}catch{}}async function Jt(e,n,i){let t=a$1.join(e,".rapidkit","reports","doctor-last-run.json");try{return await r.ensureDir(a$1.dirname(t)),await r.writeJSON(t,{schemaVersion:a$3,evidenceType:"workspace",generatedAt:new Date().toISOString(),contract:me(),workspacePath:e,workspaceName:n.workspaceName,projectScanCached:n.projectScanCached??false,projectScanSignature:n.projectScanSignature,cachePath:i,healthScore:n.healthScore,system:{python:n.python,poetry:n.poetry,pipx:n.pipx,go:n.go,rapidkitCore:n.rapidkitCore,versions:{core:n.coreVersion,npm:n.npmVersion}},projects:n.projects,summary:{totalProjects:n.projects.length,totalIssues:n.projects.reduce((c,o)=>c+o.issues.length,0),projectAdvisoryWarningProjects:xe(n.projects),projectAdvisoryWarnings:Pe(n.projects),hasSystemErrors:[n.python,n.rapidkitCore].some(c=>c.status==="error"),scopeProvenance:n.scopeProvenance},driftDelta:n.driftDelta,scoreBreakdown:n.scoreBreakdown??[]},{spaces:2}),t}catch{return}}async function Re(){let[e,n,i,t,c]=await Promise.all([qt(),Ut(),zt(),Qt(),Xt()]);return {python:e,poetry:n,pipx:i,go:t,rapidkitCore:c}}async function qt(){let e=d$1();for(let n of e)try{let{stdout:i}=await execa(n,["--version"],{timeout:3e3}),t=i.match(/Python (\d+\.\d+\.\d+)/);if(t){let c=t[1],[o,s]=c.split(".").map(Number);return o<3||o===3&&s<10?{status:"warn",message:`Python ${c} (requires 3.10+)`,details:`${n} found but version is below minimum requirement`}:{status:"ok",message:`Python ${c}`,details:`Using ${n}`}}}catch{continue}return {status:"error",message:"Python not found",details:"Install Python 3.10+ and ensure it's in PATH"}}async function Ut(){try{let{stdout:e}=await execa("poetry",["--version"],{timeout:3e3}),n=e.match(/Poetry .*version ([\d.]+)/);return n?{status:"ok",message:`Poetry ${n[1]}`,details:"Available for dependency management"}:{status:"warn",message:"Poetry version unknown"}}catch{let e=d$1().map(n=>({cmd:n,args:n==="py"?["-3","-m","poetry","--version"]:["-m","poetry","--version"]}));for(let n of e)try{let{stdout:i}=await execa(n.cmd,n.args,{timeout:3e3,shell:b()}),t=i.match(/Poetry .*version ([\d.]+)/)||i.match(/([\d.]+)/);return {status:"ok",message:t?.[1]?`Poetry ${t[1]}`:"Poetry detected",details:`Available via ${n.cmd} ${n.args.join(" ")}`}}catch{continue}for(let n of Rt())try{if(!await r.pathExists(n))continue;let{stdout:i}=await execa(n,["--version"],{timeout:3e3,shell:b()}),t=i.match(/Poetry .*version ([\d.]+)/)||i.match(/([\d.]+)/);return {status:"ok",message:t?.[1]?`Poetry ${t[1]}`:"Poetry detected",details:`Available at ${n}`}}catch{continue}return {status:"warn",message:"Poetry not installed",details:"Optional: Install for better dependency management"}}}async function zt(){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$1();for(let n of e)try{let i=n==="py"?["-3","-m","pipx","--version"]:["-m","pipx","--version"],{stdout:t}=await execa(n,i,{timeout:3e3,shell:b()});return {status:"ok",message:`pipx ${t.trim()}`,details:`Available via ${n} ${i.join(" ")}`}}catch{continue}return {status:"warn",message:"pipx not installed",details:"Optional: Install for isolated Python tools"}}}async function Qt(){try{let{stdout:e}=await execa("go",["version"],{timeout:3e3}),n=e.match(/go version go(\d+\.\d+(?:\.\d+)?)/);return n?{status:"ok",message:`Go ${n[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 Xt(){let e=process.env.HOME||process.env.USERPROFILE||"",n=[],i=$t(e);for(let{location:c,path:o}of i)try{if(await r.pathExists(o)){let{stdout:s,exitCode:d}=await execa(o,["--version"],{timeout:3e3,reject:false});if(d===0&&(s.includes("RapidKit Version")||s.includes("RapidKit"))){let u=s.match(/v?([\d.]+(?:rc\d+)?(?:a\d+)?(?:b\d+)?)/);u&&n.push({location:c,path:o,version:u[1]});}}}catch{continue}if(n.length>0){let c=n.filter(s=>s.location!=="Workspace (launcher)");if(c.length>0){let s=Ft(c),d=s[0].version,u=s.some(m=>m.location==="Workspace (.venv)"),p=s.some(m=>m.location.startsWith("Global (")),f=!u&&p?"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:s.map(m=>({location:m.location,path:m.path,version:m.version}))}}return {status:"ok",message:`RapidKit Core ${n[0].version}`,details:"Detected via workspace launcher"}}try{let{stdout:c,exitCode:o}=await execa("rapidkit",["--version"],{timeout:3e3,reject:false});if(o===0&&(c.includes("RapidKit Version")||c.includes("RapidKit"))){let s=c.match(/v?([\d.]+(?:rc\d+)?(?:a\d+)?(?:b\d+)?)/);if(s)return {status:"ok",message:`RapidKit Core ${s[1]}`,details:"Available via PATH"}}}catch{}try{let{stdout:c,exitCode:o}=await execa("poetry",["run","rapidkit","--version"],{timeout:3e3,reject:false});if(o===0&&(c.includes("RapidKit Version")||c.includes("RapidKit"))){let s=c.match(/v?([\d.]+(?:rc\d+)?(?:a\d+)?(?:b\d+)?)/);if(s)return {status:"ok",message:`RapidKit Core ${s[1]}`,details:"Available via Poetry"}}}catch{}let t=d$1();for(let c of t)try{let{stdout:o,exitCode:s}=await execa(c,["-c","import rapidkit_core; print(rapidkit_core.__version__)"],{timeout:3e3,reject:false});if(s===0&&o&&!o.includes("Traceback")&&!o.includes("ModuleNotFoundError")){let d=o.trim();if(d)return {status:"ok",message:`RapidKit Core ${d}`,details:`Available in ${c} environment`}}}catch{continue}return {status:"error",message:"RapidKit Core not installed",details:"Install with: pipx install rapidkit-core"}}async function T(e,n,i){let t=a$1.join(e,"Dockerfile");n.hasDocker=await r.pathExists(t);let c=a$1.join(e,"tests"),o=a$1.join(e,"test"),s=a$1.join(e,"src","test"),d=await r.pathExists(c)||await r.pathExists(o)||await r.pathExists(s),u=false;if(n.framework==="Go/Fiber"||n.framework==="Go/Gin")try{let p=[{dir:e,depth:0}],f=4,m=new Set([".git",".venv","node_modules","dist","build","vendor"]);for(;p.length>0&&!u;){let g=p.shift();if(!g)break;let h=[];try{h=await r.readdir(g.dir);}catch{continue}for(let y of h){let k=a$1.join(g.dir,y),b;try{b=await r.stat(k);}catch{continue}if(b.isFile()&&y.endsWith("_test.go")){u=true;break}b.isDirectory()&&g.depth<f&&!m.has(y)&&!y.startsWith(".")&&p.push({dir:k,depth:g.depth+1});}}}catch{}if(n.hasTests=d||u,n.runtimeFamily==="node"&&!n.hasTests&&(n.hasTests=await We(e,i)),n.runtimeFamily==="node")n.hasCodeQuality=await Ke(e,i);else if(n.framework==="Go/Fiber"||n.framework==="Go/Gin"){let p=a$1.join(e,".golangci.yml"),f=a$1.join(e,".golangci.yaml"),m=a$1.join(e,"Makefile"),g=await r.pathExists(m)&&(await r.readFile(m,"utf8")).includes("golangci-lint");n.hasCodeQuality=await r.pathExists(p)||await r.pathExists(f)||g;}else if(n.runtimeFamily==="python"){let p=a$1.join(e,"ruff.toml"),f=a$1.join(e,"pyproject.toml");if(await r.pathExists(f))try{let m=await r.readFile(f,"utf8");n.hasCodeQuality=m.includes("[tool.ruff]")||await r.pathExists(p);}catch{n.hasCodeQuality=await r.pathExists(p);}}else if(n.framework==="Spring Boot"){let p=a$1.join(e,"pom.xml");if(await r.pathExists(p))try{let f=await r.readFile(p,"utf8");n.hasCodeQuality=f.includes("spotless")||f.includes("checkstyle")||f.includes("pmd")||f.includes("maven-enforcer-plugin");}catch{n.hasCodeQuality=false;}}try{if(n.runtimeFamily==="node"){let{stdout:p}=await execa("npm",["audit","--json"],{cwd:e,reject:false});if(p)try{let m=JSON.parse(p).metadata?.vulnerabilities;m&&(n.vulnerabilities=(m.high||0)+(m.critical||0)+(m.moderate||0));}catch{}}else if(n.runtimeFamily==="python"){let p=a$1.join(e,".venv"),f$1=f(p);if(await r.pathExists(f$1))try{let{stdout:m}=await execa(f$1,["-m","pip","list","--format=json"],{timeout:5e3,reject:false});if(m){JSON.parse(m);n.vulnerabilities=0;}}catch{}}}catch{}}function I(e,n){e.probes||(e.probes=[]),e.probes.push(n);}async function Yt(e,n){let i=n.runtimeFamily||"unknown";if(n.projectKind==="backend"||n.projectKind==="generic"){if(i==="node"){let c=await r.pathExists(a$1.join(e,"package-lock.json"))||await r.pathExists(a$1.join(e,"pnpm-lock.yaml"))||await r.pathExists(a$1.join(e,"yarn.lock"));I(n,{id:"adapter-node-lockfile-integrity",label:"Node adapter lockfile integrity",status:c?"pass":"warn",severity:"warn",scope:"project-scoped",reason:c?"Node lockfile detected for deterministic dependency restore.":"No Node lockfile detected (package-lock/yarn.lock/pnpm-lock.yaml).",recommendation:c?void 0:"Commit a lockfile for deterministic installs and CI parity."});let o=await r.pathExists(a$1.join(e,"src/main.ts"))||await r.pathExists(a$1.join(e,"src/main.js"))||await r.pathExists(a$1.join(e,"src/server.ts"))||await r.pathExists(a$1.join(e,"src/server.js"));I(n,{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(i==="python"){let c=await r.pathExists(a$1.join(e,"poetry.lock"))||await r.pathExists(a$1.join(e,"requirements.txt"))||await r.pathExists(a$1.join(e,"uv.lock"));I(n,{id:"adapter-python-lockfile-integrity",label:"Python adapter dependency integrity",status:c?"pass":"warn",severity:"warn",scope:"project-scoped",reason:c?"Python dependency contract file detected.":"No Python dependency contract file detected (poetry.lock/requirements/uv.lock).",recommendation:c?void 0:"Pin dependency contract for deterministic setup and reproducible CI."});let o=await r.pathExists(a$1.join(e,"app/main.py"))||await r.pathExists(a$1.join(e,"main.py"))||await r.pathExists(a$1.join(e,"manage.py"));I(n,{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(i==="java"){let c=await r.pathExists(a$1.join(e,"mvnw"))||await r.pathExists(a$1.join(e,"gradlew"));I(n,{id:"adapter-java-build-wrapper",label:"Java adapter build wrapper",status:c?"pass":"warn",severity:"warn",scope:"project-scoped",reason:c?"Build wrapper detected (mvnw/gradlew).":"No Java build wrapper detected.",recommendation:c?void 0:"Commit mvnw or gradlew for reproducible enterprise pipelines."});return}if(i==="go"){let c=await r.pathExists(a$1.join(e,"go.sum"));I(n,{id:"adapter-go-module-integrity",label:"Go adapter module integrity",status:c?"pass":"warn",severity:"warn",scope:"project-scoped",reason:c?"go.sum detected for deterministic module verification.":"go.sum missing; module integrity baseline is incomplete.",recommendation:c?void 0:"Generate and commit go.sum in the repository baseline."});}}}async function Zt(e,n){let i=[a$1.join(e,".rapidkit","doctor.adapters.json"),a$1.join(e,"doctor.adapters.json")];for(let t of i)if(await r.pathExists(t))try{let c=await r.readJSON(t),o=Array.isArray(c?.checks)?c.checks:[];for(let s=0;s<o.length;s+=1){let d=o[s]||{},u=Array.isArray(d.runtimes)?d.runtimes:[];if(u.length>0&&!u.includes(n.runtimeFamily||"unknown"))continue;let p=typeof d.id=="string"&&d.id.trim().length>0?d.id.trim():`adapter-check-${s+1}`,f=typeof d.label=="string"&&d.label.trim().length>0?d.label.trim():p,m=d.severity||"warn",g=Array.isArray(d.anyOfPaths)?d.anyOfPaths.filter(Boolean):[],h=Array.isArray(d.allOfPaths)?d.allOfPaths.filter(Boolean):[],y=g.length===0;for(let L of g)if(await r.pathExists(a$1.join(e,L))){y=true;break}let k=true;for(let L of h)if(!await r.pathExists(a$1.join(e,L))){k=false;break}let b=y&&k;I(n,{id:p,label:f,status:b?"pass":m==="error"?"fail":"warn",severity:m,scope:"project-scoped",reason:b?d.passReason||"Custom adapter contract satisfied.":d.failReason||`Custom adapter check failed from ${a$1.basename(t)}.`,recommendation:d.recommendation});}}catch{I(n,{id:"custom-adapter-config",label:"Custom doctor adapter configuration",status:"warn",severity:"warn",scope:"project-scoped",reason:`Failed to parse ${a$1.basename(t)}.`,recommendation:"Fix JSON syntax in doctor.adapters.json to re-enable adapter checks."});}}async function B(e,n){if(!(n.projectKind==="backend"||n.projectKind==="generic"))return;let t=a$1.join(e,".env"),c=a$1.join(e,".env.example"),o=await r.pathExists(t)||await r.pathExists(c)||await r.pathExists(a$1.join(e,"config"));I(n,{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 s={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=n.runtimeFamily||"unknown",u=s[d]||s.unknown,p=false;for(let g of u)if(await r.pathExists(a$1.join(e,g))){p=true;break}I(n,{id:"migration-surface",label:"Migration/readiness surface",status:p?"pass":"warn",severity:"warn",scope:"project-scoped",reason:p?"Migration or schema evolution markers detected.":"No migration markers detected for this backend runtime.",recommendation:p?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"],m=false;for(let g of f)if(await r.pathExists(a$1.join(e,g))){m=true;break}I(n,{id:"runtime-health-surface",label:"Runtime health probe surface",status:m?"pass":"warn",severity:"warn",scope:"project-scoped",reason:m?"Health endpoint/config markers detected.":"No explicit runtime health endpoint markers detected.",recommendation:m?void 0:"Expose a deterministic health endpoint and keep it covered in verify pack."}),await Yt(e,n);}async function en(e,n,i,t){let c=await Oe({projectPath:e,detection:t,packageJsonData:i});for(let o of c)I(n,o);}async function _(e,n){let i=[a$1.join(e,".rapidkit","doctor.probes.json"),a$1.join(e,"doctor.probes.json")];for(let t of i)if(await r.pathExists(t))try{let c=await r.readJSON(t),o=Array.isArray(c?.probes)?c.probes:[];for(let s=0;s<o.length;s+=1){let d=o[s]||{},u=typeof d.id=="string"&&d.id.trim().length>0?d.id.trim():`custom-probe-${s+1}`,p=typeof d.label=="string"&&d.label.trim().length>0?d.label.trim():u,f=d.severity||"warn",m=Array.isArray(d.anyOfPaths)?d.anyOfPaths.filter(Boolean):[],g=Array.isArray(d.allOfPaths)?d.allOfPaths.filter(Boolean):[],h=m.length===0;for(let b of m)if(await r.pathExists(a$1.join(e,b))){h=true;break}let y=true;for(let b of g)if(!await r.pathExists(a$1.join(e,b))){y=false;break}let k=h&&y;I(n,{id:u,label:p,status:k?"pass":f==="error"?"fail":"warn",severity:f,scope:"project-scoped",reason:k?"Custom probe contract satisfied.":`Custom probe failed from ${a$1.basename(t)}.`,recommendation:d.recommendation});}}catch{I(n,{id:"custom-probe-config",label:"Custom doctor probe configuration",status:"warn",severity:"warn",scope:"project-scoped",reason:`Failed to parse ${a$1.basename(t)}.`,recommendation:"Fix JSON syntax in doctor.probes.json to re-enable custom probes."});}await Zt(e,n);}async function $e(e,n={}){let t={name:a$1.basename(e),path:e,venvActive:false,depsInstalled:false,coreInstalled:false,issues:[],fixCommands:[]},c=n.allowNonRapidkit===true,o=a$1.join(e,".rapidkit");if(!await r.pathExists(o)){if(!c)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 w=a$1.join(e,"registry.json");if(await r.pathExists(w)){let v=await r.readJson(w);v.installed_modules&&(t.stats={modules:v.installed_modules.length});}}catch{}try{let{auditProjectModulePaths:w}=await import('./module-layout-NZ43RSC5.js'),v=await w(e);if(v.issues.length>0){for(let C of v.issues)t.issues.push(`${C.message} (${C.slug})`);t.fixCommands=t.fixCommands??[],t.fixCommands.push("npx rapidkit workspace contract verify --strict --json"),t.fixCommands.push("npx rapidkit add module <slug> # reinstall via Core-backed module install");}}catch{}let s=null;try{let w=a$1.join(o,"project.json");if(await r.pathExists(w)){s=await r.readJson(w);let v=s?.kit_name||s?.kit;v&&(t.kit=v);}}catch{}try{let w=a$1.join(e,".git");if(await r.pathExists(w)){let{stdout:v}=await execa("git",["log","-1","--format=%cr"],{cwd:e,reject:false});v&&(t.lastModified=v.trim());}else {let v=await r.stat(e),F=Date.now()-v.mtime.getTime(),D=Math.floor(F/(1e3*60*60*24));t.lastModified=D===0?"today":`${D} day${D>1?"s":""} ago`;}}catch{}let d$1=a$1.join(e,"package.json"),u=a$1.join(e,"pyproject.toml"),p=a$1.join(e,"requirements.txt"),f$1=a$1.join(e,"go.mod"),m=a$1.join(e,"pom.xml"),g=a$1.join(e,"build.sbt"),h=a$1.join(e,"Cargo.toml"),y=a$1.join(e,"mix.exs"),k=a$1.join(e,"deps.edn"),b=a$1.join(e,"project.clj"),L=a$1.join(e,"deno.json"),K=a$1.join(e,"deno.jsonc"),U=a$1.join(e,"bun.lockb"),z=a$1.join(e,"bun.lock"),V=a$1.join(e,"composer.json"),oe=a$1.join(e,"Gemfile"),Q=await r.pathExists(d$1),W=await r.pathExists(u)||await r.pathExists(p),N=await r.pathExists(V),ne=await r.pathExists(oe),ie=await r.pathExists(h),dt=await r.pathExists(y),ut=await r.pathExists(k)||await r.pathExists(b),pt=await r.pathExists(g),mt=await r.pathExists(L)||await r.pathExists(K),de=s?.runtime==="dotnet";try{de=de||await Ve(e,".csproj",3)||await Ve(e,".sln",2);}catch{de=s?.runtime==="dotnet";}let ft=await r.pathExists(f$1)||s?.runtime==="go"||typeof s?.kit_name=="string"&&(s.kit_name.startsWith("gofiber")||s.kit_name.startsWith("gogin")),Fe=Q&&(await r.pathExists(U)||await r.pathExists(z)||typeof s?.packageManager=="string"&&(s?.packageManager).toLowerCase().startsWith("bun@"));if(ft){G(t,i(e,s??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 w=a$1.join(e,"go.sum");return await r.pathExists(w)?t.depsInstalled=true:(t.depsInstalled=false,t.issues.push("Go dependencies not downloaded (go.sum missing)"),t.fixCommands?.push($(e,"go mod tidy"))),await T(e,t),await B(e,t),await _(e,t),t}if(await r.pathExists(m)||s?.runtime==="java"||typeof s?.kit_name=="string"&&s.kit_name.startsWith("springboot")){G(t,i(e,s??null)),t.venvActive=true,t.coreInstalled=false;let w=await r.pathExists(m),v=await r.pathExists(a$1.join(e,"build.gradle"))||await r.pathExists(a$1.join(e,"build.gradle.kts")),C=await r.pathExists(a$1.join(e,"mvnw"))||await r.pathExists(a$1.join(e,"mvnw.cmd")),F=await r.pathExists(a$1.join(e,"gradlew"))||await r.pathExists(a$1.join(e,"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(w){if(!C)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(v&&!F)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 D=a$1.join(e,"target"),A=a$1.join(e,"build","libs"),H=a$1.join(e,".rapidkit","cache","java","m2"),j=a$1.join(e,".rapidkit","cache","java","gradle");t.depsInstalled=await r.pathExists(D)||await r.pathExists(A)||await r.pathExists(H)||await r.pathExists(j),t.depsInstalled||(t.issues.push("Java dependencies are not warmed or built yet"),t.fixCommands?.push($(e,"rapidkit init")));let P=a$1.join(e,".env");if(t.hasEnvFile=await r.pathExists(P),!t.hasEnvFile){let X=a$1.join(e,".env.example");await r.pathExists(X)&&(t.issues.push("Environment file missing (found .env.example)"),t.fixCommands?.push(q(e)));}let J=a$1.join(e,"src","main","resources","application.yml");if(await r.pathExists(J))try{let X=await r.readFile(J,"utf-8");/include:\s*[^\n]*health/i.test(X)||/management:\s*[\s\S]*endpoint:\s*[\s\S]*health:/i.test(X)||(t.issues.push("Actuator health endpoint exposure is not clearly configured in application.yml"),t.fixCommands?.push($(e,"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 T(e,t),await B(e,t),await _(e,t),t}if(ie){G(t,i(e,s??null)),t.venvActive=true,t.coreInstalled=false;let w=a$1.join(e,"Cargo.lock"),v=a$1.join(e,"target");t.depsInstalled=await r.pathExists(w)||await r.pathExists(v),t.depsInstalled||(t.issues.push("Rust dependencies are not resolved yet (Cargo.lock/target missing)"),t.fixCommands?.push($(e,"cargo fetch")));let C=a$1.join(e,".env");if(t.hasEnvFile=await r.pathExists(C),!t.hasEnvFile){let F=a$1.join(e,".env.example");await r.pathExists(F)&&(t.issues.push("Environment file missing (found .env.example)"),t.fixCommands?.push(q(e)));}return await T(e,t),await B(e,t),await _(e,t),t}if(dt){G(t,i(e,s??null)),t.venvActive=true,t.coreInstalled=false;let w=a$1.join(e,"mix.lock"),v=a$1.join(e,"deps");t.depsInstalled=await r.pathExists(w)||await r.pathExists(v),t.depsInstalled||(t.issues.push("Elixir dependencies not installed (mix.lock/deps missing)"),t.fixCommands?.push($(e,"mix deps.get")));let C=a$1.join(e,".env");if(t.hasEnvFile=await r.pathExists(C),!t.hasEnvFile){let F=a$1.join(e,".env.example");await r.pathExists(F)&&(t.issues.push("Environment file missing (found .env.example)"),t.fixCommands?.push(q(e)));}return await T(e,t),await B(e,t),await _(e,t),t}if(ut){G(t,i(e,s??null)),t.venvActive=true,t.coreInstalled=false;let w=a$1.join(e,".cpcache"),v=a$1.join(e,"target"),C=await r.pathExists(k)||await r.pathExists(b);return t.depsInstalled=await r.pathExists(w)||await r.pathExists(v)||C,t.depsInstalled||(t.issues.push("Clojure dependency cache not initialized"),t.fixCommands?.push($(e,"clojure -P"))),await T(e,t),await B(e,t),await _(e,t),t}if(pt){G(t,i(e,s??null)),t.venvActive=true,t.coreInstalled=false;let w=a$1.join(e,"target");t.depsInstalled=await r.pathExists(w),t.depsInstalled||(t.issues.push("Scala build artifacts missing (run dependency/build warmup)"),t.fixCommands?.push($(e,"sbt compile")));let v=a$1.join(e,".env");if(t.hasEnvFile=await r.pathExists(v),!t.hasEnvFile){let C=a$1.join(e,".env.example");await r.pathExists(C)&&(t.issues.push("Environment file missing (found .env.example)"),t.fixCommands?.push(q(e)));}return await T(e,t),await B(e,t),await _(e,t),t}if(mt){G(t,i(e,s??null)),t.venvActive=true,t.coreInstalled=false,t.depsInstalled=true;let w=a$1.join(e,".env");if(t.hasEnvFile=await r.pathExists(w),!t.hasEnvFile){let v=a$1.join(e,".env.example");await r.pathExists(v)&&(t.issues.push("Environment file missing (found .env.example)"),t.fixCommands?.push(q(e)));}return await T(e,t),await B(e,t),await _(e,t),t}if(Q){let w=null;try{w=await r.readJson(d$1);}catch{w=null;}let v={...w?.dependencies??{},...w?.devDependencies??{}},C=w?.scripts??{},F=typeof s?.kit_name=="string"?s.kit_name.toLowerCase():typeof s?.kit=="string"?s.kit.toLowerCase():"",D=d(e,s),A=Gt({dependencies:v,scripts:C,kitName:F});if(Fe)ue(t,"Bun","high");else {let j=i(e,s??null);j.key==="nestjs"||j.key==="express"||j.key==="fastify"||j.key==="koa"?G(t,j):D.key!=="unknown"?_t(t,D):j.key!=="unknown"&&j.key!=="node"?G(t,j):ue(t,A.framework,A.confidence);}t.venvActive=true;let H=a$1.join(e,"node_modules");if(await r.pathExists(H))try{let P=(await r.readdir(H)).filter(J=>!J.startsWith(".")&&!J.startsWith("_"));t.depsInstalled=P.length>0;}catch{t.depsInstalled=false;}if(t.depsInstalled||(t.issues.push("Dependencies not installed (node_modules empty or missing)"),t.fixCommands?.push($(e,Fe?"bun install":"rapidkit init"))),t.coreInstalled=false,t.projectKind==="frontend"){let j=[".env",".env.local",".env.development",".env.development.local",".env.production",".env.production.local"];if((await Promise.all(j.map(J=>r.pathExists(a$1.join(e,J))))).some(Boolean))t.hasEnvFile=true;else {let J=a$1.join(e,".env.example");await r.pathExists(J)&&(t.hasEnvFile=false,t.issues.push("Environment file missing (found .env.example)"),t.fixCommands?.push(q(e)));}}else {let j=a$1.join(e,".env");if(t.hasEnvFile=await r.pathExists(j),!t.hasEnvFile){let P=a$1.join(e,".env.example");await r.pathExists(P)&&(t.issues.push("Environment file missing (found .env.example)"),t.fixCommands?.push(q(e)));}}if(t.projectKind==="frontend")t.modulesHealthy=await be(e),t.missingModules=[];else {let j=a$1.join(e,"src");if(t.modulesHealthy=true,t.missingModules=[],await r.pathExists(j))try{let P=await r.readdir(j);t.modulesHealthy=P.length>0;}catch{t.modulesHealthy=false;}}return await T(e,t,w),t.projectKind==="frontend"?await en(e,t,w,D.key!=="unknown"?D:d(e,s)):await B(e,t),await _(e,t),t}if(W){let w=await Kt(e);ue(t,w.framework,w.confidence);let v=a$1.join(e,".venv");if(await r.pathExists(v)){t.venvActive=true;let A=f(v);if(await r.pathExists(A)){try{let{stdout:P}=await execa(A,["-c","import rapidkit_core; print(rapidkit_core.__version__)"],{timeout:2e3});t.coreInstalled=true,t.coreVersion=P.trim();}catch{t.coreInstalled=false;}let H="fastapi";t.framework==="Django"?H="django":t.framework==="Flask"?H="flask":t.framework==="Python"&&(H="");let j=true;if(H)try{await execa(A,["-c",`import ${H}`],{timeout:2e3}),t.depsInstalled=true,j=false;}catch{j=true;}if(j)try{let P=a$1.join(v,"lib");if(await r.pathExists(P)){let X=(await r.readdir(P)).find(ae=>ae.startsWith("python"));if(X){let ae=a$1.join(P,X,"site-packages");if(await r.pathExists(ae)){let gt=(await r.readdir(ae)).filter(ge=>!ge.startsWith("_")&&!ge.includes("dist-info")&&!["pip","setuptools","wheel","pkg_resources"].includes(ge));t.depsInstalled=gt.length>0;}}}t.depsInstalled||(t.issues.push("Dependencies not installed"),t.fixCommands?.push($(e,"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($(e,"rapidkit init"));let C=a$1.join(e,".env");if(t.hasEnvFile=await r.pathExists(C),!t.hasEnvFile){let A=a$1.join(e,".env.example");await r.pathExists(A)&&(t.issues.push("Environment file missing (found .env.example)"),t.fixCommands?.push(q(e)));}let F=a$1.join(e,"src"),D=a$1.join(e,"modules");if(t.modulesHealthy=true,t.missingModules=[],await r.pathExists(F)){let A=a$1.join(F,"__init__.py");await r.pathExists(A)||(t.modulesHealthy=false,t.missingModules.push("src/__init__.py"));}if(await r.pathExists(D))try{let A=await st(D);for(let H of A){let j=a$1.join(D,H,"__init__.py");await r.pathExists(j)||(t.modulesHealthy=false,t.missingModules.push(`modules/${H}/__init__.py`));}}catch{}return !t.modulesHealthy&&t.missingModules.length>0&&t.issues.push(`Missing module init files: ${t.missingModules.join(", ")}`),await T(e,t),await B(e,t),await _(e,t),t}if(N){G(t,i(e,s??null)),t.venvActive=true,t.coreInstalled=false;let w=a$1.join(e,"vendor");t.depsInstalled=await r.pathExists(w),t.depsInstalled||(t.issues.push("PHP dependencies not installed (vendor missing)"),t.fixCommands?.push($(e,"composer install")));let v=a$1.join(e,".env");if(t.hasEnvFile=await r.pathExists(v),!t.hasEnvFile){let C=a$1.join(e,".env.example");await r.pathExists(C)&&(t.issues.push("Environment file missing (found .env.example)"),t.fixCommands?.push(q(e)));}return await T(e,t),await B(e,t),await _(e,t),t}if(ne){G(t,i(e,s??null)),t.venvActive=true,t.coreInstalled=false;let w=await r.pathExists(a$1.join(e,"Gemfile.lock")),v=await r.pathExists(a$1.join(e,"vendor","bundle"));t.depsInstalled=w||v,t.depsInstalled||(t.issues.push("Ruby dependencies not installed (Gemfile.lock/vendor missing)"),t.fixCommands?.push($(e,"bundle install")));let C=a$1.join(e,".env");return t.hasEnvFile=await r.pathExists(C),await T(e,t),await B(e,t),await _(e,t),t}if(de){G(t,i(e,s??null)),t.venvActive=true,t.coreInstalled=false;let w=a$1.join(e,"obj"),v=a$1.join(e,"src","obj"),C=a$1.join(e,"packages.lock.json");t.depsInstalled=await r.pathExists(w)||await r.pathExists(v)||await r.pathExists(C),t.depsInstalled||(t.issues.push(".NET restore/build artifacts not found"),t.fixCommands?.push($(e,"dotnet restore")));let F=a$1.join(e,".env");return t.hasEnvFile=await r.pathExists(F),await T(e,t),await B(e,t),await _(e,t),t}return ue(t,"Unknown","low"),t.issues.push("Unknown project type (no recognized runtime marker files)"),await T(e,t),await B(e,t),await _(e,t),t}async function st(e){try{return (await r.readdir(e,{withFileTypes:true})).filter(i=>i.isDirectory()).map(i=>i.name)}catch{try{let n=await r.readdir(e),i=[];for(let t of n)try{(await r.stat(a$1.join(e,t))).isDirectory()&&i.push(t);}catch{continue}return i}catch{return []}}}async function Ve(e,n,i){let t=[{dir:e,depth:0}],c=new Set([".git",".rapidkit","node_modules","bin","obj","target"]);for(;t.length>0;){let o=t.shift();if(!o||o.depth>i)continue;let s;try{s=await r.readdir(o.dir,{withFileTypes:true});}catch{continue}for(let d of s){if(d.isFile()&&d.name.toLowerCase().endsWith(n.toLowerCase()))return true;d.isDirectory()&&!c.has(d.name)&&t.push({dir:a$1.join(o.dir,d.name),depth:o.depth+1});}}return false}async function ce(e){let n=a$1.join(e,".rapidkit");if(!await r.pathExists(n))return false;let i=["project.json","context.json","file-hashes.json"];for(let t of i)if(await r.pathExists(a$1.join(n,t)))return true;return false}function ot(e,n){if(n.has(e))return true;let i=e.toLowerCase();return !!(i==="dist"||i.startsWith("dist-")||i.startsWith("dist_")||i==="build"||i.startsWith("build-")||i.startsWith("build_"))}async function tn(e,n,i){let t=new Set,c=[{dir:e,depth:0}];for(;c.length>0;){let o=c.shift();if(!o)break;try{let s=await r.readdir(o.dir);for(let d of s){if(ot(d,i))continue;let u=a$1.join(o.dir,d),p;try{p=await r.stat(u);}catch{continue}if(p.isDirectory()){if(await ce(u)){t.add(u);continue}o.depth<n&&c.push({dir:u,depth:o.depth+1});}}}catch{continue}}return Array.from(t)}async function le(e){let n=a$1.resolve(e),i=a$1.parse(n).root;for(;;){if(await on(n))return n;if(n===i)break;n=a$1.dirname(n);}return null}async function nn(e){let n=a$1.resolve(e),i=await le(n),t=i??a$1.parse(n).root;for(;;){if(await ce(n)||await sn(n)&&(!i||n!==i))return n;if(n===t)break;n=a$1.dirname(n);}return null}function Je(e){let n=a$1.resolve(e);return process.platform==="darwin"?n.replace(/^\/private(?=\/var\/)/,""):n}async function sn(e){let n=["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 i of n)if(await r.pathExists(a$1.join(e,i)))return true;return false}async function on(e){let n=[a$1.join(e,".rapidkit-workspace"),a$1.join(e,".rapidkit","workspace-marker.json"),a$1.join(e,".rapidkit","config.json")];return Promise.all(n.map(i=>r.pathExists(i))).then(i=>i.some(Boolean))}function it(e,n){let i=0,t=0,c=0;return e.forEach(s=>{s.status==="ok"?i++:s.status==="warn"?t++:s.status==="error"&&c++;}),n.forEach(s=>{let d=ee(s),u=s.isGoProject?s.issues.length===0&&s.depsInstalled:s.issues.length===0&&s.venvActive&&s.depsInstalled;if(s.issues.length>0||d>0||!u){t++;return}i++;}),{total:i+t+c,passed:i,warnings:t,errors:c}}function at(e,n,i={}){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 c=[...n].sort((o,s)=>{let d=`${o.path||""}|${o.name||""}`.toLowerCase(),u=`${s.path||""}|${s.name||""}`.toLowerCase();return d.localeCompare(u)});for(let o of c){let s=o.issues.length>0,d=ee(o),u=s||d>0?"warn":"ok",p=s?`${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:s?"project-blocking-issues":d>0?"project-advisory-warnings":"project-checks-passed",reason:p});}if(i.includeWorkspaceAggregateRules){let o=n.reduce((u,p)=>u+p.issues.length,0),s=Pe(n),d=e.filter(u=>u.result.status==="error").length;t.push({id:"workspace:projects-discovered",label:"Workspace projects discovered",status:n.length>0?"ok":"warn",scope:"workspace-aggregate",policyRuleId:"workspace-project-discovery",reason:n.length>0?`${n.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:s>0?"warn":"ok",scope:"workspace-aggregate",policyRuleId:"workspace-advisory-warning-gate",reason:s>0?`${s} advisory warning(s) detected.`:"No advisory warnings detected."});}return t}async function qe(e,n=true){let i=a$1.basename(e);try{let g=a$1.join(e,".rapidkit-workspace");await r.pathExists(g)&&(i=(await r.readJSON(g)).name||i);}catch{try{let g=a$1.join(e,".rapidkit","config.json");i=(await r.readJSON(g)).workspace_name||i;}catch{}}let[t,c]=await Promise.all([Re(),Wt(e)]),o={workspacePath:e,workspaceName:i,python:t.python,poetry:t.poetry,pipx:t.pipx,go:t.go,rapidkitCore:t.rapidkitCore,projects:[]};a.debug(`Workspace scan found ${c.length} project(s)`);let s=await Ot(e,c),d=a$1.join(e,".rapidkit","reports","doctor-workspace-cache.json"),u=n?await Lt(d,s):null;if(u){o.projects=u.projects;for(let g of o.projects)je(g,g.path);o.projectScanCached=true,a.debug(`Workspace project health cache hit: ${d}`);}else try{let g=await Promise.all(c.map(h=>$e(h)));for(let h of g)je(h,h.path);o.projects=g,o.projectScanCached=false,await Vt(d,{schemaVersion:Xe,signature:s,generatedAt:new Date().toISOString(),projects:g}),a.debug(`Workspace project health cache refreshed: ${d}`);}catch(g){a.debug(`Failed to scan workspace projects: ${g}`);}o.projectScanSignature=s,o.projectScanCachePath=d;let p=[o.python,o.poetry,o.pipx,o.go,o.rapidkitCore];if(o.healthScore=it(p,o.projects),o.scoreBreakdown=at([{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=tt(o.scoreBreakdown),o.rapidkitCore.status==="ok"){let g=o.rapidkitCore.message.match(/([\d.]+(?:rc\d+)?(?:a\d+)?(?:b\d+)?)/);g&&(o.coreVersion=g[1]);}let f=a$1.join(e,".rapidkit","reports","doctor-last-run.json"),m=await Ze(f,"workspace");return o.driftDelta=It(m,o),o.evidencePath=await Jt(e,o,u?d:null),o}function Ue(e){return {name:e.name,path:e.path,framework:e.framework,frameworkKey:e.frameworkKey,importStack:e.importStack,runtimeFamily:e.runtimeFamily,projectKind:e.projectKind,supportTier:e.supportTier,frameworkConfidence:e.frameworkConfidence,kit:e.kit,venvActive:e.venvActive,depsInstalled:e.depsInstalled,hasEnvFile:e.hasEnvFile,modulesHealthy:e.modulesHealthy,missingModules:e.missingModules,hasTests:e.hasTests,hasDocker:e.hasDocker,hasCodeQuality:e.hasCodeQuality,vulnerabilities:e.vulnerabilities,coreInstalled:e.coreInstalled,coreVersion:e.coreVersion,lastModified:e.lastModified,stats:e.stats,issues:e.issues,fixCommands:e.fixCommands,probes:e.probes,commandCapabilities:e.commandCapabilities}}async function an(e,n){let i=e||n.projectPath,t=a$1.join(i,".rapidkit","reports","doctor-project-last-run.json");try{return await r.ensureDir(a$1.dirname(t)),await r.writeJSON(t,{schemaVersion:b$1,evidenceType:"project",generatedAt:new Date().toISOString(),contract:me(),workspacePath:e||null,projectPath:n.projectPath,projectName:n.projectName,healthScore:n.healthScore,system:{python:n.python,poetry:n.poetry,pipx:n.pipx,go:n.go,rapidkitCore:n.rapidkitCore},project:n.project,driftDelta:n.driftDelta,summary:{scopeProvenance:n.scopeProvenance},scoreBreakdown:n.scoreBreakdown??[]},{spaces:2}),t}catch{return}}async function rn(e){let n=await le(e),i=await Re(),t=await $e(e,{allowNonRapidkit:true});je(t,e);let c=it([i.python,i.poetry,i.pipx,i.go,i.rapidkitCore],[t]),o={workspacePath:n||void 0,projectPath:e,projectName:a$1.basename(e),python:i.python,poetry:i.poetry,pipx:i.pipx,go:i.go,rapidkitCore:i.rapidkitCore,project:t,healthScore:c};o.scoreBreakdown=at([{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=tt(o.scoreBreakdown);let s=n||e,d=a$1.join(s,".rapidkit","reports","doctor-project-last-run.json"),u=await Ze(d,"project");return o.driftDelta=Nt(u,o),o.evidencePath=await an(n||void 0,o),o}function R(e,n){let i=e.status==="ok"?"\u2705":e.status==="warn"?"\u26A0\uFE0F":"\u274C",t=e.status==="ok"?l.green:e.status==="warn"?l.yellow:l.red;console.log(`${i} ${l.bold(n)}: ${t(e.message)}`),e.paths&&e.paths.length>0&&e.paths.forEach(c=>{let o=c.version?l.cyan(` -> ${c.version}`):"";console.log(` ${l.cyan("\u2022")} ${l.gray(c.location)}: ${l.dim(c.path)}${o}`);}),e.details&&console.log(` ${l.gray(e.details)}`);}function ze(e){let n=e.issues.length>0,i=n?"\u26A0\uFE0F":"\u2705",t=n?l.yellow:l.green;if(console.log(`
2
+ ${i} ${l.bold("Project")}: ${t(e.name)}`),e.framework){let s=e.framework==="FastAPI"||e.framework==="Django"||e.framework==="Flask"?"\u{1F40D}":e.framework==="NestJS"?"\u{1F985}":e.framework==="Next.js"||e.framework==="Nuxt"||e.framework==="Remix"?"\u25B2":e.framework==="React"||e.framework==="Vite"?"\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(` ${s} Framework: ${l.cyan(e.framework)}${e.kit?l.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(` ${l.dim("\u21B3")} ${l.gray(d.join(" \u2022 "))}`);}if(console.log(` ${l.gray(`Path: ${e.path}`)}`),e.runtimeFamily==="python"&&(e.venvActive?console.log(` \u2705 Virtual environment: ${l.green("Active")}`):console.log(` \u274C Virtual environment: ${l.red("Not found")}`),e.coreInstalled?console.log(` ${l.dim("\u2139")} RapidKit Core: ${l.gray(e.coreVersion||"In venv")} ${l.dim("(optional)")}`):console.log(` ${l.dim("\u2139")} RapidKit Core: ${l.gray("Using global installation")} ${l.dim("(recommended)")}`)),e.depsInstalled?console.log(` \u2705 Dependencies: ${l.green("Installed")}`):console.log(` \u26A0\uFE0F Dependencies: ${l.yellow("Not installed")}`),e.hasEnvFile!==void 0&&(e.hasEnvFile?console.log(` \u2705 Environment: ${l.green(".env configured")}`):console.log(` \u26A0\uFE0F Environment: ${l.yellow(".env missing")}`)),e.modulesHealthy!==void 0){let s=e.projectKind==="frontend"?"Source tree":"Modules";e.modulesHealthy?console.log(` \u2705 ${s}: ${l.green("Healthy")}`):e.missingModules&&e.missingModules.length>0?console.log(` \u26A0\uFE0F ${s}: ${l.yellow(`Missing ${e.missingModules.length} init file(s)`)}`):e.projectKind==="frontend"&&console.log(` \u26A0\uFE0F ${s}: ${l.yellow("No application directories detected")}`);}if(e.stats){let s=[];e.stats.modules!==void 0&&s.push(`${e.stats.modules} module${e.stats.modules!==1?"s":""}`),s.length>0&&console.log(` \u{1F4CA} Stats: ${l.cyan(s.join(" \u2022 "))}`);}e.lastModified&&console.log(` \u{1F552} Last Modified: ${l.gray(e.lastModified)}`);let o=[];if(e.hasTests!==void 0&&o.push(e.hasTests?"\u2705 Tests":l.dim("\u2298 No tests")),e.hasDocker!==void 0&&o.push(e.hasDocker?"\u2705 Docker":l.dim("\u2298 No Docker")),e.hasCodeQuality!==void 0){let s=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 ${s}`:l.dim(`\u2298 No ${s}`));}if(o.length>0&&console.log(` ${o.join(" \u2022 ")}`),e.vulnerabilities!==void 0&&e.vulnerabilities>0&&console.log(` \u26A0\uFE0F Security: ${l.yellow(`${e.vulnerabilities} vulnerability(ies) found`)}`),e.issues.length>0&&(console.log(` ${l.bold("Issues:")}`),e.issues.forEach(s=>{console.log(` \u2022 ${l.yellow(s)}`);}),e.fixCommands&&e.fixCommands.length>0&&(console.log(`
3
+ ${l.bold.cyan("\u{1F527} Quick Fix:")}`),e.fixCommands.forEach(s=>{console.log(` ${l.cyan("$")} ${l.white(s)}`);}))),e.probes&&e.probes.length>0){console.log(` ${l.bold("Probe checks:")}`);for(let s of e.probes){let d=s.status==="pass"?"\u2705":s.status==="warn"?"\u26A0\uFE0F":"\u274C";console.log(` ${d} ${s.label}: ${l.gray(s.reason)}`),s.recommendation&&console.log(` ${l.dim("\u21B3")} ${l.gray(s.recommendation)}`);}}if(e.commandCapabilities){let s=e.commandCapabilities;if(console.log(` ${l.bold("Command support:")}`),console.log(` ${l.green("supported")} ${s.supportedCommands.length} \u2022 ${l.yellow("unsupported")} ${s.unsupportedCommands.length} \u2022 ${l.gray("global")} ${s.globalCommands.length}`),s.unsupportedCommands.length>0){let d=s.unsupportedCommands.slice(0,8).join(", "),u=s.unsupportedCommands.length>8?", ...":"";console.log(` ${l.dim("\u21B3")} ${l.gray(`Unsupported here: ${d}${u}`)}`);}}}async function rt(){try{return (await execa("go",["version"],{timeout:a$4(),reject:false})).exitCode===0}catch{return false}}function te(e,n){let i=[new RegExp(`^cd\\s+"([^"]+)"\\s*(?:&&|;)\\s*${n}\\s*$`,"i"),new RegExp(`^cd\\s+'([^']+)'\\s*(?:&&|;)\\s*${n}\\s*$`,"i"),new RegExp(`^cd\\s+(.+?)\\s*(?:&&|;)\\s*${n}\\s*$`,"i")];for(let t of i){let c=e.match(t);if(c?.[1])return {projectPath:c[1].trim()}}return null}function ct(e){return te(e,"cp\\s+\\.env\\.example\\s+\\.env")||te(e,"copy-item\\s+\\.env\\.example\\s+\\.env")}function lt(e){let n=[{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 i of n){let t=te(e,i.pattern);if(t)return {projectPath:t.projectPath,command:i.command,args:i.args}}return null}function Ce(e,n){return /^https?:\/\//i.test(n.trim())?{projectName:e.name,projectPath:e.path,originalCommand:n,kind:"manual-url",risk:"safe",executable:false,reason:"Manual guidance URL"}:ct(n)?{projectName:e.name,projectPath:e.path,originalCommand:n,kind:"env-copy",risk:"safe",executable:true,reason:"Environment seed copy"}:te(n,"rapidkit\\s+init")?{projectName:e.name,projectPath:e.path,originalCommand:n,kind:"rapidkit-init",risk:"guarded",executable:true,reason:"RapidKit initializer may mutate dependencies and configs"}:te(n,"go\\s+mod\\s+tidy")?{projectName:e.name,projectPath:e.path,originalCommand:n,kind:"go-mod-tidy",risk:"guarded",executable:true,reason:"Go module graph reconciliation"}:lt(n)?{projectName:e.name,projectPath:e.path,originalCommand:n,kind:"dependency-sync",risk:"guarded",executable:true,reason:"Dependency synchronization command"}:{projectName:e.name,projectPath:e.path,originalCommand:n,kind:"shell",risk:"invasive",executable:true,reason:"Generic shell command"}}async function Ee(e){let n=e.filter(p=>p.fixCommands&&p.fixCommands.length>0),i=n.flatMap(p=>(p.fixCommands??[]).map(f=>Ce(p,f))),t=null,c=[],o=0,s=0,d=0,u=0;for(let p of i){let f=p.executable,m;p.kind==="go-mod-tidy"&&(t===null&&(t=await rt()),t||(f=false,m="Go toolchain not available")),f&&(o+=1,p.risk==="safe"&&(s+=1),p.risk==="guarded"&&(d+=1),p.risk==="invasive"&&(u+=1)),c.push({...p,executableInCurrentEnvironment:f,blockedReason:m});}return {generatedAt:new Date().toISOString(),fixableProjects:n.length,totalSteps:c.length,executableSteps:o,risk:{safe:s,guarded:d,invasive:u},steps:c}}function Qe(e){let n=e instanceof Error?e.message:String(e),i=["ETIMEDOUT","ECONNRESET","ECONNREFUSED","EAI_AGAIN","ENOTFOUND","network","503","504"],t=n.toLowerCase();return i.some(c=>t.includes(c.toLowerCase()))}async function cn(e,n){let i=e.get(n);if(i)return i;let t=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`,c=a$1.basename(n).replace(/[^a-zA-Z0-9._-]/g,"_"),o=a$1.join(n,".rapidkit","reports","fix-snapshots",`${c}-${t}`);await r.ensureDir(o);let s=[".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 p of s){let f=a$1.join(n,p);if(!await r.pathExists(f))continue;let m=a$1.join(o,p);await r.ensureDir(a$1.dirname(m)),await r.copy(f,m,{overwrite:true}),d.set(f,m);}let u={snapshotRoot:o,files:d};return e.set(n,u),u}async function ln(e){for(let[n,i]of e.files.entries())await r.pathExists(i)&&(await r.ensureDir(a$1.dirname(n)),await r.copy(i,n,{overwrite:true}));}async function dn(e){let n=await $e(e,{allowNonRapidkit:true});return {issues:n.issues.length,healthy:n.issues.length===0}}async function se(e,n=false,i={}){let t=await Ee(e),c=e.filter(h=>h.fixCommands&&h.fixCommands.length>0),o=null,s=t.steps.some(h=>h.kind==="go-mod-tidy"&&!h.executableInCurrentEnvironment),d=new Map;if(c.length===0){console.log(l.green(`
4
+ \u2705 No fixes needed - all projects are healthy!`));return}console.log(l.bold.cyan(`
5
+ \u{1F527} Available Fixes:
6
+ `));for(let h of c){let y=h.fixCommands??[];console.log(l.bold(`Project: ${l.yellow(h.name)}`)),y.forEach((k,b)=>{console.log(` ${b+1}. ${l.cyan(k)}`);}),console.log();}if(i.planOnly){if(i.json){console.log(JSON.stringify(t,null,2));return}console.log(l.bold(`
7
+ \u{1F9ED} Remediation Plan
8
+ `)),console.log(l.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 y=h.executableInCurrentEnvironment?l.green("ready"):l.yellow(`blocked${h.blockedReason?` (${h.blockedReason})`:""}`);console.log(` - ${l.cyan(h.projectName)} [${h.risk}] ${h.originalCommand} ${l.gray(`=> ${y}`)}`);}console.log(l.gray(`
9
+ Use --apply to execute this plan non-interactively, or --fix for interactive confirmation.`));return}let u=t.executableSteps,p=t.risk.safe,f=t.risk.guarded,m=t.risk.invasive;if(u===0){console.log(l.gray("\u{1F4A1} No automatic fixes can be applied right now.")),s&&console.log(l.gray(" Install Go to enable go mod tidy fixes, then rerun `rapidkit doctor workspace --fix`."));return}if(!n){console.log(l.gray('\u{1F4A1} Run "npx rapidkit doctor workspace --fix" to apply fixes automatically'));return}if(console.log(l.gray(`Risk policy: safe=${p}, guarded=${f}, invasive=${m}. Guarded/invasive fixes use snapshot + rollback.`)),!i.skipConfirmation){let{confirm:h}=await Pt.prompt([{type:"confirm",name:"confirm",message:`Apply ${c.reduce((y,k)=>y+(k.fixCommands?.length??0),0)} fix(es)?`,default:false}]);if(!h){console.log(l.yellow(`
10
+ \u26A0\uFE0F Fixes cancelled by user`));return}}console.log(l.bold.cyan(`
11
+ \u{1F680} Applying fixes...
12
+ `));let g=new Set;for(let h of c){let y=h.fixCommands??[];console.log(l.bold(`Fixing ${l.cyan(h.name)}...`));for(let k of y){let b$1=Ce(h,k),L=`${h.path}::${k}`;if(!g.has(L)){g.add(L);try{if(console.log(l.gray(` $ ${k}`)),b$1.kind==="manual-url"){console.log(l.yellow(` \u2139 Manual action required: open ${k}`)),console.log(l.green(` \u2705 Recorded as guidance
13
+ `));continue}if(!b$1.executable){console.log(l.yellow(" \u26A0 Step is non-executable by policy")),console.log(l.green(` \u2705 Recorded as guidance
14
+ `));continue}b$1.risk!=="safe"&&await cn(d,b$1.projectPath);let K=ct(k);if(K){let W=a$1.join(K.projectPath,".env.example"),N=a$1.join(K.projectPath,".env");if(!await r.pathExists(W))throw new Error(`.env.example not found at ${W}`);if(await r.pathExists(N)){console.log(l.green(` \u2705 .env already exists
15
+ `));continue}await r.copy(W,N,{overwrite:false,errorOnExist:false}),console.log(l.green(` \u2705 Success
16
+ `));continue}let U=te(k,"rapidkit\\s+init");if(U){await execa("rapidkit",["init"],{cwd:U.projectPath,shell:b(),stdio:"inherit"}),console.log(l.green(` \u2705 Success
17
+ `));continue}let z=te(k,"go\\s+mod\\s+tidy");if(z){if(o===null&&(o=await rt()),!o){console.log(l.yellow(" \u26A0 Go toolchain is not installed \u2014 skipping go mod tidy; install Go to apply this fix.")),console.log(l.green(` \u2705 Recorded as guidance
18
+ `));continue}await execa("go",["mod","tidy"],{cwd:z.projectPath,shell:b(),stdio:"inherit"}),console.log(l.green(` \u2705 Success
19
+ `));continue}let V=lt(k);if(V){let N;for(let ne=1;ne<=2;ne+=1)try{await execa(V.command,V.args,{cwd:V.projectPath,shell:b(),stdio:"inherit"}),N=null;break}catch(ie){if(N=ie,ne<2&&Qe(ie)){console.log(l.yellow(` \u26A0 Retrying dependency sync (${ne}/1)...`));continue}throw ie}if(N)throw N;console.log(l.green(` \u2705 Success
20
+ `));continue}let oe=b$1.kind==="shell"?2:1,Q;for(let W=1;W<=oe;W+=1)try{await execa(k,{shell:true,stdio:"inherit"}),Q=null;break}catch(N){if(Q=N,W<oe&&Qe(N)){console.log(l.yellow(` \u26A0 Retrying command (${W}/${oe-1})...`));continue}throw N}if(Q)throw Q;console.log(l.green(` \u2705 Success
21
+ `));}catch(K){let U=Ce(h,k);if(U.risk!=="safe"){let z=d.get(U.projectPath);if(z)try{await ln(z),console.log(l.yellow(" \u21A9 Rolled back snapshot after failed fix"));}catch(V){console.log(l.red(` \u274C Rollback failed: ${V instanceof Error?V.message:String(V)}`));}}console.log(l.red(` \u274C Failed: ${K instanceof Error?K.message:String(K)}
22
+ `));}}}try{let k=await dn(h.path);console.log(k.healthy?l.green(` \u2705 Post-fix verification passed for ${h.name}`):l.yellow(` \u26A0 Post-fix verification: ${k.issues} issue(s) remain for ${h.name}`));}catch(k){console.log(l.yellow(` \u26A0 Post-fix verification skipped: ${k instanceof Error?k.message:String(k)}`));}}console.log(l.bold.green(`
23
+ \u2705 Fix process completed!`));}function pe(e,n){if(!n.strict&&!n.ci)return 0;let i=Number(e?.errors??0),t=Number(e?.warnings??0);return i>0?1:n.ci&&t>0?2:n.strict&&t>0?1:0}async function In(e={}){let n=!!(e.fix||e.plan||e.apply),i=!e.workspace&&!e.project&&n?await le(process.cwd()):null,t=e.workspace||!!i,c=!!e.project&&!t;if(e.json||console.log(l.bold.cyan(`
24
+ \u{1FA7A} RapidKit Health Check
25
+ `)),t){let o=i??await le(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||(i&&console.log(l.gray("\u2139\uFE0F Detected workspace context; enabling workspace checks for --fix")),console.log(l.bold(`Workspace: ${l.cyan(a$1.basename(o))}`)),console.log(l.gray(`Path: ${o}`)));let s=await qe(o);if(e.json||(s.projectScanCached&&console.log(l.gray(`\u2139\uFE0F Reused cached project scan${s.projectScanCachePath?` (${a$1.basename(s.projectScanCachePath)})`:""}`)),s.evidencePath&&console.log(l.gray(`\u2139\uFE0F Evidence saved: ${s.evidencePath}`))),e.json){let f=e.plan?await Ee(s.projects):void 0,m={contract:me(),workspace:{name:a$1.basename(o),path:o},cache:{projectScan:s.projectScanCached??false,projectScanPath:s.projectScanCachePath,evidencePath:s.evidencePath},healthScore:s.healthScore,system:{python:s.python,poetry:s.poetry,pipx:s.pipx,rapidkitCore:s.rapidkitCore,versions:{core:s.coreVersion,npm:s.npmVersion}},projects:s.projects.map(g=>Ue(g)),summary:{totalProjects:s.projects.length,totalIssues:s.projects.reduce((g,h)=>g+h.issues.length,0),projectAdvisoryWarningProjects:xe(s.projects),projectAdvisoryWarnings:Pe(s.projects),hasSystemErrors:[s.python,s.rapidkitCore].some(g=>g.status==="error"),scopeProvenance:s.scopeProvenance},driftDelta:s.driftDelta,scoreBreakdown:s.scoreBreakdown??[],...f?{remediationPlan:f}:{}};return e.quiet||console.log(JSON.stringify(m,null,2)),pe(s.healthScore,e)}if(s.healthScore){let f=s.healthScore,m=Math.round(f.passed/f.total*100),g=m>=80?l.green:m>=50?l.yellow:l.red,h="\u2588".repeat(Math.floor(m/5))+"\u2591".repeat(20-Math.floor(m/5));console.log(l.bold(`
26
+ \u{1F4CA} Health Score:`)),console.log(` ${g(`${m}%`)} ${l.gray(h)}`),console.log(` ${l.green(`\u2705 ${f.passed} passed`)} ${l.gray("|")} ${l.yellow(`\u26A0\uFE0F ${f.warnings} warnings`)} ${l.gray("|")} ${l.red(`\u274C ${f.errors} errors`)}`);}if(console.log(l.bold(`
27
+
28
+ System Tools:
29
+ `)),R(s.python,"Python"),R(s.poetry,"Poetry"),R(s.pipx,"pipx"),R(s.go,"Go"),R(s.rapidkitCore,"RapidKit Core"),s.coreVersion&&s.npmVersion){let f=s.coreVersion.split(".")[1],m=s.npmVersion.split(".")[1];f!==m&&(console.log(l.yellow(`
30
+ \u26A0\uFE0F Version mismatch: Core ${s.coreVersion} / CLI ${s.npmVersion}`)),console.log(l.gray(" Consider updating to matching versions for best compatibility")));}s.projects.length>0?(console.log(l.bold(`
31
+ \u{1F4E6} Projects (${s.projects.length}):`)),s.projects.forEach(f=>ze(f))):(console.log(l.bold(`
32
+ \u{1F4E6} Projects:`)),console.log(l.gray(" No RapidKit projects found in workspace")));let d=s.projects.reduce((f,m)=>f+m.issues.length,0),u=xe(s.projects),p=[s.python,s.rapidkitCore].some(f=>f.status==="error");if(p||d>0||u>0){let f=u>0?` and ${u} advisory warning project(s)`:"";if(console.log(l.bold.yellow(`
33
+ \u26A0\uFE0F Found ${d} project issue(s)${f}`)),p&&console.log(l.bold.red("\u274C System requirements not met")),e.plan)await se(s.projects,false,{planOnly:true,json:e.json});else if(e.fix||e.apply){if(await se(s.projects,true,{skipConfirmation:e.apply===true}),!e.json){let m=await qe(o,false),g=m.projects.reduce((y,k)=>y+k.issues.length,0),h=[m.python,m.rapidkitCore].some(y=>y.status==="error");h||g>0?(console.log(l.bold.yellow(`
34
+ \u26A0\uFE0F Post-fix verification found ${g} remaining issue(s)`)),h&&console.log(l.bold.red("\u274C System requirements still not met"))):console.log(l.bold.green(`
35
+ \u2705 Post-fix verification passed. Workspace is healthy.`)),m.projectScanCached&&console.log(l.gray(`\u2139\uFE0F Reused cached project scan${m.projectScanCachePath?` (${a$1.basename(m.projectScanCachePath)})`:""}`)),m.evidencePath&&console.log(l.gray(`\u2139\uFE0F Evidence refreshed: ${m.evidencePath}`));}}else d>0&&await se(s.projects,false);}else console.log(l.bold.green(`
36
+ \u2705 All checks passed! Workspace is healthy.`));return pe(s.healthScore,e)}else if(c){let o=await nn(process.cwd());o||(await le(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 s=await rn(o),d=s.workspacePath?Je(s.workspacePath):null,u=Je(s.project.path);if(e.json){let b=e.plan?await Ee([s.project]):void 0,L={contract:me(),scope:"project",workspace:d?{name:a$1.basename(d),path:d}:null,project:{...Ue(s.project),path:u},evidencePath:s.evidencePath,healthScore:s.healthScore,system:{python:s.python,poetry:s.poetry,pipx:s.pipx,go:s.go,rapidkitCore:s.rapidkitCore},summary:{totalProjects:1,totalIssues:s.project.issues.length,projectAdvisoryWarningProjects:ee(s.project)>0?1:0,projectAdvisoryWarnings:ee(s.project),hasSystemErrors:[s.python,s.rapidkitCore].some(K=>K.status==="error"),scopeProvenance:s.scopeProvenance},driftDelta:s.driftDelta,scoreBreakdown:s.scoreBreakdown??[],...b?{remediationPlan:b}:{}};return e.quiet||console.log(JSON.stringify(L,null,2)),pe(s.healthScore,e)}console.log(l.bold(`Project: ${l.cyan(a$1.basename(o))}`)),console.log(l.gray(`Path: ${o}`)),s.workspacePath&&console.log(l.gray(`Workspace: ${a$1.basename(s.workspacePath)}`)),s.evidencePath&&console.log(l.gray(`\u2139\uFE0F Evidence saved: ${s.evidencePath}`));let p=s.healthScore,f=p.total>0?Math.round(p.passed/p.total*100):0,m=f>=80?l.green:f>=50?l.yellow:l.red,g="\u2588".repeat(Math.floor(f/5))+"\u2591".repeat(20-Math.floor(f/5));console.log(l.bold(`
37
+ \u{1F4CA} Health Score:`)),console.log(` ${m(`${f}%`)} ${l.gray(g)}`),console.log(` ${l.green(`\u2705 ${p.passed} passed`)} ${l.gray("|")} ${l.yellow(`\u26A0\uFE0F ${p.warnings} warnings`)} ${l.gray("|")} ${l.red(`\u274C ${p.errors} errors`)}`),console.log(l.bold(`
38
+
39
+ System Tools:
40
+ `)),R(s.python,"Python"),R(s.poetry,"Poetry"),R(s.pipx,"pipx"),R(s.go,"Go"),R(s.rapidkitCore,"RapidKit Core"),console.log(l.bold(`
41
+ \u{1F4E6} Project (1):`)),ze(s.project);let h=[s.python,s.rapidkitCore].some(b=>b.status==="error"),y=s.project.issues.length,k=ee(s.project);if(h||y>0||k>0){let b=k>0?` and ${k} advisory warning(s)`:"";console.log(l.bold.yellow(`
42
+ \u26A0\uFE0F Found ${y} project issue(s)${b}`)),h&&console.log(l.bold.red("\u274C System requirements not met")),e.plan?await se([s.project],false,{planOnly:true,json:e.json}):e.fix||e.apply?await se([s.project],true,{skipConfirmation:e.apply===true}):y>0&&await se([s.project],false);}else console.log(l.bold.green(`
43
+ \u2705 All checks passed! Project is healthy.`));return pe(s.healthScore,e)}else {console.log(l.bold(`System Tools:
44
+ `));let o=await Re(),s=o.python,d=o.poetry,u=o.pipx,p=o.go,f=o.rapidkitCore;R(s,"Python"),R(d,"Poetry"),R(u,"pipx"),R(p,"Go"),R(f,"RapidKit Core"),[s,f].some(h=>h.status==="error")?(console.log(l.bold.red(`
45
+ \u274C Some required tools are missing`)),(e.fix||e.apply)&&console.log(l.gray(`
46
+ Tip: Project auto-fix runs in workspace mode. Run from a workspace and use "rapidkit doctor workspace --fix"`)),console.log(l.gray(`
47
+ Tip: Run "rapidkit doctor workspace" for workspace-wide checks, or "rapidkit doctor project" for the current project`))):(console.log(l.bold.green(`
48
+ \u2705 All required tools are installed!`)),(e.fix||e.apply)&&console.log(l.gray(`
49
+ Tip: Project auto-fix runs in workspace mode. Run from a workspace and use "rapidkit doctor workspace --fix"`)),console.log(l.gray(`
50
+ Tip: Run "rapidkit doctor workspace" for workspace-wide checks, or "rapidkit doctor project" for the current project`))),console.log("");let g=[s,f].filter(h=>h.status==="error").length;return (e.strict||e.ci)&&g>0?1:0}}export{pe as a,In as b};
@@ -0,0 +1,5 @@
1
+ import a from'fs';import s from'path';var m={nextjs:{key:"nextjs",runtime:"node",displayName:"Next.js",supportTier:"extended",importStack:"nextjs",aliases:["next","nextjs","next.js"],dependencyHints:["next"],scriptHints:["next dev","next build","next start"],fileHints:["next.config.js","next.config.mjs","next.config.ts"]},remix:{key:"remix",runtime:"node",displayName:"Remix",supportTier:"extended",importStack:"remix",aliases:["remix"],dependencyHints:["@remix-run/react","@remix-run/node","@remix-run/dev"],scriptHints:["remix dev","remix vite:dev"],fileHints:["remix.config.js","remix.config.mjs"]},nuxt:{key:"nuxt",runtime:"node",displayName:"Nuxt",supportTier:"extended",importStack:"nuxt",aliases:["nuxt","nuxtjs","nuxt.js"],dependencyHints:["nuxt","nuxt3"],scriptHints:["nuxt dev","nuxt build","nuxi dev","nuxi build"],fileHints:["nuxt.config.js","nuxt.config.ts","nuxt.config.mjs"]},react:{key:"react",runtime:"node",displayName:"React",supportTier:"extended",importStack:"react",aliases:["react"],dependencyHints:["react","react-dom"],scriptHints:["react-scripts start","react-scripts build"],fileHints:[]},vite:{key:"vite",runtime:"node",displayName:"Vite",supportTier:"extended",importStack:"vite",aliases:["vite"],dependencyHints:["vite"],scriptHints:["vite","vite dev","vite build"],fileHints:["vite.config.js","vite.config.ts","vite.config.mjs"]},vue:{key:"vue",runtime:"node",displayName:"Vue",supportTier:"extended",importStack:"vue",aliases:["vue","vuejs","vue.js"],dependencyHints:["vue","@vue/cli-service"],scriptHints:["vue-cli-service serve","vue-cli-service build"],fileHints:["vue.config.js"]},sveltekit:{key:"sveltekit",runtime:"node",displayName:"SvelteKit",supportTier:"extended",importStack:"sveltekit",aliases:["sveltekit","svelte-kit"],dependencyHints:["@sveltejs/kit"],scriptHints:["svelte-kit dev","svelte-kit build"],fileHints:["svelte.config.js"]},svelte:{key:"svelte",runtime:"node",displayName:"Svelte",supportTier:"extended",importStack:"svelte",aliases:["svelte"],dependencyHints:["svelte"],scriptHints:["svelte"],fileHints:[]},angular:{key:"angular",runtime:"node",displayName:"Angular",supportTier:"extended",importStack:"angular",aliases:["angular","@angular/core"],dependencyHints:["@angular/core","@angular/cli"],scriptHints:["ng serve","ng build"],fileHints:["angular.json"]},astro:{key:"astro",runtime:"node",displayName:"Astro",supportTier:"extended",importStack:"astro",aliases:["astro"],dependencyHints:["astro"],scriptHints:["astro dev","astro build"],fileHints:["astro.config.js","astro.config.ts","astro.config.mjs"]},solid:{key:"solid",runtime:"node",displayName:"Solid",supportTier:"extended",importStack:"solid",aliases:["solid","solidjs","solid-js"],dependencyHints:["solid-js"],scriptHints:[],fileHints:[]},unknown:{key:"unknown",runtime:"unknown",displayName:"Unknown frontend",supportTier:"observed",importStack:"unknown",aliases:["unknown"],dependencyHints:[],scriptHints:[],fileHints:[]}},B={nextjs:{dev:["dev"],start:["start"],build:["build"],test:["test"],lint:["lint"],format:["format"]},remix:{dev:["dev"],start:["start"],build:["build"],test:["test"],lint:["lint"],format:["format"]},nuxt:{dev:["dev"],start:["start","preview"],build:["build"],test:["test"],lint:["lint"],format:["format"]},react:{dev:["dev","start"],start:["serve"],build:["build"],test:["test"],lint:["lint"],format:["format"]},vite:{dev:["dev"],start:["preview","start"],build:["build"],test:["test"],lint:["lint"],format:["format"]},vue:{dev:["dev","serve"],start:["preview","start"],build:["build"],test:["test"],lint:["lint"],format:["format"]},sveltekit:{dev:["dev"],start:["start","preview"],build:["build"],test:["test"],lint:["lint"],format:["format"]},svelte:{dev:["dev"],start:["preview","start"],build:["build"],test:["test"],lint:["lint"],format:["format"]},angular:{dev:["start","serve"],start:["serve"],build:["build"],test:["test"],lint:["lint"],format:["format"]},astro:{dev:["dev"],start:["start","preview"],build:["build"],test:["test"],lint:["lint"],format:["format"]},solid:{dev:["dev"],start:["preview","start"],build:["build"],test:["test"],lint:["lint"],format:["format"]}};function Y(e,n){let t=typeof e=="string"?S(e):e;return t==="unknown"?[]:B[t]?.[n]??[]}function R(e){try{return a.existsSync(e)?JSON.parse(a.readFileSync(e,"utf8")):null}catch{return null}}function H(e){let n=R(s.join(e,"package.json"));if(!n)return {dependencies:{},scriptText:""};let t={...n.dependencies??{},...n.devDependencies??{},...n.peerDependencies??{}},i=n.scripts??{},o=Object.values(i).filter(u=>typeof u=="string").join(" ").toLowerCase();return {dependencies:t,scriptText:o}}function C(e,n){return n.some(t=>a.existsSync(s.join(e,t)))}function w(e){return e.vite?e.react||e["react-dom"]||e["@vitejs/plugin-react"]?"react":e.vue||e["@vitejs/plugin-vue"]?"vue":e.svelte||e["@sveltejs/vite-plugin-svelte"]?"svelte":e["solid-js"]||e["vite-plugin-solid"]?"solid":null:null}function l(e,n,t){let i=m[e]??m.unknown;return {key:i.key,runtime:i.runtime,displayName:i.displayName,supportTier:i.supportTier,importStack:i.importStack,confidence:n,source:t}}function M(e){return m[e]??m.unknown}function S(e){let n=(e??"").trim().toLowerCase().replace(/[_\s]+/g,"-");if(!n)return "unknown";for(let t of Object.values(m))if(t.aliases.includes(n))return t.key;return "unknown"}function b(e,n){let t=S(typeof n?.framework=="string"?n.framework:typeof n?.kit_name=="string"?n.kit_name:typeof n?.kit=="string"?n.kit:void 0);if(t!=="unknown")return l(t,"high","framework");let{dependencies:i,scriptText:o}=H(e);for(let u of ["nextjs","remix","nuxt","sveltekit","angular","astro","vue","solid","vite","react","svelte"]){let f=m[u];if(f.dependencyHints.some(c=>i[c])){if(u==="vite"){let c=w(i);if(c)return l(c,"high","manifest")}return l(u,"high","manifest")}if(f.fileHints.length>0&&C(e,f.fileHints)){if(u==="vite"){let c=w(i);if(c)return l(c,"high","manifest")}return l(u,"high","manifest")}if(f.scriptHints.some(c=>o.includes(c)))return l(u,"medium","manifest")}return l("unknown","low","unknown")}var k={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"]},nextjs:{key:"nextjs",runtime:"node",displayName:"Next.js",supportTier:"extended",importStack:"nextjs",aliases:["nextjs","next.js","next"]},remix:{key:"remix",runtime:"node",displayName:"Remix",supportTier:"extended",importStack:"remix",aliases:["remix"]},nuxt:{key:"nuxt",runtime:"node",displayName:"Nuxt",supportTier:"extended",importStack:"nuxt",aliases:["nuxt","nuxtjs","nuxt.js"]},react:{key:"react",runtime:"node",displayName:"React",supportTier:"extended",importStack:"react",aliases:["react"]},vite:{key:"vite",runtime:"node",displayName:"Vite",supportTier:"extended",importStack:"vite",aliases:["vite"]},vue:{key:"vue",runtime:"node",displayName:"Vue",supportTier:"extended",importStack:"vue",aliases:["vue","vuejs","vue.js"]},sveltekit:{key:"sveltekit",runtime:"node",displayName:"SvelteKit",supportTier:"extended",importStack:"sveltekit",aliases:["sveltekit","svelte-kit"]},svelte:{key:"svelte",runtime:"node",displayName:"Svelte",supportTier:"extended",importStack:"svelte",aliases:["svelte"]},angular:{key:"angular",runtime:"node",displayName:"Angular",supportTier:"extended",importStack:"angular",aliases:["angular","@angular/core"]},astro:{key:"astro",runtime:"node",displayName:"Astro",supportTier:"extended",importStack:"astro",aliases:["astro"]},solid:{key:"solid",runtime:"node",displayName:"Solid",supportTier:"extended",importStack:"solid",aliases:["solid","solidjs","solid-js"]},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:"extended",importStack:"go",aliases:["gofiber","fiber","go-fiber","go/fiber"],kitPrefixes:["gofiber"]},gogin:{key:"gogin",runtime:"go",displayName:"Go/Gin",supportTier:"extended",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:"extended",importStack:"springboot",aliases:["springboot","spring","spring-boot"],kitPrefixes:["springboot"]},java:{key:"java",runtime:"java",displayName:"Java",supportTier:"observed",importStack:"unknown",aliases:["java"]},laravel:{key:"laravel",runtime:"php",displayName:"Laravel",supportTier:"extended",importStack:"unknown",aliases:["laravel"]},symfony:{key:"symfony",runtime:"php",displayName:"Symfony",supportTier:"extended",importStack:"unknown",aliases:["symfony"]},php:{key:"php",runtime:"php",displayName:"PHP",supportTier:"observed",importStack:"unknown",aliases:["php"]},rails:{key:"rails",runtime:"ruby",displayName:"Ruby on Rails",supportTier:"extended",importStack:"rails",aliases:["rails","ruby-on-rails","ruby on rails"]},sinatra:{key:"sinatra",runtime:"ruby",displayName:"Sinatra",supportTier:"extended",importStack:"unknown",aliases:["sinatra"]},ruby:{key:"ruby",runtime:"ruby",displayName:"Ruby",supportTier:"observed",importStack:"unknown",aliases:["ruby"]},dotnet:{key:"dotnet",runtime:"dotnet",displayName:"ASP.NET Core",supportTier:"extended",importStack:"dotnet",aliases:["dotnet","asp.net","aspnet","asp.net core","csharp","c#"],kitPrefixes:["dotnet","aspnet","aspnetcore"]},actix:{key:"actix",runtime:"rust",displayName:"Actix-web",supportTier:"extended",importStack:"unknown",aliases:["actix","actix-web"]},axum:{key:"axum",runtime:"rust",displayName:"Axum",supportTier:"extended",importStack:"unknown",aliases:["axum"]},rocket:{key:"rocket",runtime:"rust",displayName:"Rocket",supportTier:"extended",importStack:"unknown",aliases:["rocket"]},rust:{key:"rust",runtime:"rust",displayName:"Rust",supportTier:"observed",importStack:"unknown",aliases:["rust"]},phoenix:{key:"phoenix",runtime:"elixir",displayName:"Phoenix",supportTier:"extended",importStack:"unknown",aliases:["phoenix"]},elixir:{key:"elixir",runtime:"elixir",displayName:"Elixir",supportTier:"observed",importStack:"unknown",aliases:["elixir"]},clojure:{key:"clojure",runtime:"clojure",displayName:"Clojure",supportTier:"extended",importStack:"unknown",aliases:["clojure"]},scala:{key:"scala",runtime:"scala",displayName:"Scala",supportTier:"extended",importStack:"unknown",aliases:["scala"]},kotlin:{key:"kotlin",runtime:"kotlin",displayName:"Kotlin",supportTier:"extended",importStack:"unknown",aliases:["kotlin"]},deno:{key:"deno",runtime:"deno",displayName:"Deno",supportTier:"extended",importStack:"unknown",aliases:["deno"]},bun:{key:"bun",runtime:"bun",displayName:"Bun",supportTier:"extended",importStack:"unknown",aliases:["bun"]},unknown:{key:"unknown",runtime:"unknown",displayName:"Unknown",supportTier:"observed",importStack:"unknown",aliases:["unknown"]}},F=new Map;for(let e of Object.values(k))for(let n of e.aliases)F.set(n,e.key);function r(e,n,t){let i=k[e]??k.unknown;return {key:i.key,runtime:i.runtime,displayName:i.displayName,supportTier:i.supportTier,importStack:i.importStack,confidence:n,source:t}}function N(e){return e.trim().toLowerCase().replace(/[_\s]+/g,"-")}function d(e){try{return a.existsSync(e)?a.readFileSync(e,"utf8").toLowerCase():""}catch{return ""}}function K(e){try{return a.existsSync(e)?JSON.parse(a.readFileSync(e,"utf8")):null}catch{return null}}function x(e,n){if(n<0||!a.existsSync(e))return [];let t=[],i=[];try{i=a.readdirSync(e,{withFileTypes:true});}catch{return []}for(let o of i){let u=s.join(e,o.name);o.isDirectory()?t.push(...x(u,n-1)):t.push(u);}return t}function g(e,n,t=2){return x(e,t).some(i=>i.toLowerCase().endsWith(n.toLowerCase()))}function j(e,n,t=2){return x(e,t).filter(i=>i.toLowerCase().endsWith(n.toLowerCase()))}function D(e){let n=N(e??"");if(!n)return "unknown";for(let t of Object.values(k))if(t.kitPrefixes?.some(i=>n.startsWith(i)))return t.key;return "unknown"}function p(e){return e?F.get(N(e))??"unknown":"unknown"}function ee(e){return p(e)}function ne(e){let n=p(e);return n!=="unknown"?k[n].runtime:"unknown"}function L(e){let n=D(e.kitName);if(n!=="unknown")return r(n,"high","kit");let t=p(e.framework);if(t!=="unknown")return r(t,"high","framework");let i=p(e.runtime);return i!=="unknown"?r(i,"medium","runtime"):r("unknown","low","unknown")}function E(e){let n=K(s.join(e,"package.json"));if(!n)return r("unknown","low","unknown");let t={...n.dependencies??{},...n.devDependencies??{}},i=n.scripts??{},o=Object.values(i).filter(u=>typeof u=="string").join(" ").toLowerCase();return t["@nestjs/core"]||o.includes("nest start")?r("nestjs","high","manifest"):t.express?r("express","high","manifest"):t.fastify?r("fastify","high","manifest"):t.koa?r("koa","high","manifest"):r("node","medium","marker")}function A(e){let n=[d(s.join(e,"pyproject.toml")),d(s.join(e,"requirements.txt")),d(s.join(e,"requirements.in"))].join(`
2
+ `);return n.includes("fastapi")?r("fastapi","high","manifest"):n.includes("django")?r("django","high","manifest"):n.includes("flask")?r("flask","high","manifest"):n.trim()?r("python","medium","marker"):r("unknown","low","unknown")}function _(e){let n=[d(s.join(e,"go.mod")),d(s.join(e,"main.go"))].join(`
3
+ `);return n.includes("github.com/gofiber/fiber")?r("gofiber","high","manifest"):n.includes("github.com/gin-gonic/gin")?r("gogin","high","manifest"):n.includes("github.com/labstack/echo")?r("echo","high","manifest"):n.trim()?r("go","medium","marker"):r("unknown","low","unknown")}function I(e){let n=[d(s.join(e,"pom.xml")),d(s.join(e,"build.gradle")),d(s.join(e,"build.gradle.kts"))].join(`
4
+ `);return n.includes("spring-boot")||n.includes("org.springframework")?r("springboot","high","manifest"):n.trim()?r("java","medium","marker"):r("unknown","low","unknown")}function O(e){let n=d(s.join(e,"composer.json"));return n.includes("laravel/framework")?r("laravel","high","manifest"):n.includes("symfony/")?r("symfony","high","manifest"):n.trim()?r("php","medium","marker"):r("unknown","low","unknown")}function P(e){let n=d(s.join(e,"Gemfile"));return n.includes("gem 'rails'")||n.includes('gem "rails"')?r("rails","high","manifest"):n.includes("gem 'sinatra'")||n.includes('gem "sinatra"')?r("sinatra","high","manifest"):n.trim()?r("ruby","medium","marker"):r("unknown","low","unknown")}function z(e){let t=[...j(e,".csproj",3),...j(e,".sln",2)].map(i=>d(i)).join(`
5
+ `);return t.includes("microsoft.net.sdk.web")||t.includes("microsoft.aspnetcore")||t.includes("swashbuckle.aspnetcore")?r("dotnet","high","manifest"):t.trim()?r("dotnet","medium","marker"):r("unknown","low","unknown")}function G(e){let n=d(s.join(e,"Cargo.toml"));return n.includes("actix-web")?r("actix","high","manifest"):n.includes("axum")?r("axum","high","manifest"):n.includes("rocket")?r("rocket","high","manifest"):n.trim()?r("rust","medium","marker"):r("unknown","low","unknown")}function V(e){let n=d(s.join(e,"mix.exs"));return n.includes("phoenix")?r("phoenix","high","manifest"):n.trim()?r("elixir","medium","marker"):r("unknown","low","unknown")}function W(e){let n=[],t=i=>{n.includes(i)||n.push(i);};return a.existsSync(s.join(e,"go.mod"))&&t("go"),a.existsSync(s.join(e,"Cargo.toml"))&&t("rust"),(a.existsSync(s.join(e,"pom.xml"))||a.existsSync(s.join(e,"build.gradle"))||a.existsSync(s.join(e,"build.gradle.kts")))&&t("java"),a.existsSync(s.join(e,"mix.exs"))&&t("elixir"),a.existsSync(s.join(e,"composer.json"))&&t("php"),(g(e,".csproj")||g(e,".sln"))&&t("dotnet"),a.existsSync(s.join(e,"package.json"))&&t("node"),a.existsSync(s.join(e,"Gemfile"))&&t("ruby"),(a.existsSync(s.join(e,"pyproject.toml"))||a.existsSync(s.join(e,"setup.py"))||a.existsSync(s.join(e,"requirements.txt"))||a.existsSync(s.join(e,"requirements.in")))&&t("python"),(a.existsSync(s.join(e,"deps.edn"))||a.existsSync(s.join(e,"project.clj")))&&t("clojure"),a.existsSync(s.join(e,"build.sbt"))&&t("scala"),(a.existsSync(s.join(e,"deno.json"))||a.existsSync(s.join(e,"deno.jsonc")))&&t("deno"),(a.existsSync(s.join(e,"bun.lockb"))||a.existsSync(s.join(e,"bun.lock")))&&t("bun"),(a.existsSync(s.join(e,"settings.gradle.kts"))||g(s.join(e,"src"),".kt",3))&&t("kotlin"),n}function te(e,n){let t=L({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 i=W(e);if(i.includes("node")){let o=b(e,n);if(o.key!=="unknown")return o;let u=E(e);if(u.key!=="unknown")return u}if(i.includes("python")){let o=A(e);if(o.key!=="unknown")return o}if(i.includes("go")){let o=_(e);if(o.key!=="unknown")return o}if(i.includes("java")){let o=I(e);if(o.key!=="unknown")return o}if(i.includes("php")){let o=O(e);if(o.key!=="unknown")return o}if(i.includes("ruby")){let o=P(e);if(o.key!=="unknown")return o}if(i.includes("rust")){let o=G(e);if(o.key!=="unknown")return o}if(i.includes("elixir")){let o=V(e);if(o.key!=="unknown")return o}if(i.includes("dotnet")){let o=z(e);if(o.key!=="unknown")return o}return i.includes("clojure")?r("clojure","medium","marker"):i.includes("scala")?r("scala","medium","marker"):i.includes("kotlin")?r("kotlin","medium","marker"):i.includes("deno")?r("deno","high","marker"):i.includes("bun")?r("bun","high","marker"):i.length>0?r(p(i[0]),"medium","runtime"):r("unknown","low","unknown")}export{Y as a,M as b,S as c,b as d,ee as e,ne as f,L as g,W as h,te as i};
@@ -0,0 +1 @@
1
+ import {a as a$4}from'./chunk-YJ24EV3P.js';import {a as a$3,q as q$1,k as k$1}from'./chunk-YBS2HGO3.js';import {i,h}from'./chunk-UZW5QFRW.js';import {a}from'./chunk-RV6HBTFC.js';import {a as a$2}from'./chunk-VKLL63TL.js';import {a as a$1}from'./chunk-HHJAANUC.js';import p from'path';import f from'fs-extra';var V="workspace-model.v1",K=".rapidkit/reports/workspace-model.json",L=["package.json","pyproject.toml","requirements.txt","go.mod","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","composer.json","Gemfile","mix.exs","deno.json","deno.jsonc","bun.lock","bun.lockb","deps.edn","project.clj","build.sbt","docker-compose.yml","docker-compose.yaml","terraform.tf"],q=new Set([".git",".hg",".svn",".rapidkit",".venv","node_modules","dist","build","target","coverage","htmlcov",".next",".turbo"]);function _(t,e){return (p.relative(t,e)||".").split(p.sep).join("/")}async function N(t){try{if(!await f.pathExists(t))return null;let e=await f.readJSON(t);return e&&typeof e=="object"?e:null}catch{return null}}async function z(t,e){for(let r of e)if(await f.pathExists(p.join(t,r)))return true;return false}function H(t){let e=Number.parseInt(process.env.RAPIDKIT_WORKSPACE_MODEL_SCAN_DEPTH??"",10),r=typeof t=="number"&&Number.isFinite(t)?t:Number.isFinite(e)?e:4;return Math.min(12,Math.max(1,Math.trunc(r)))}async function J(t,e){let r=p.resolve(t),n=[{dirPath:r,depth:0}],s=new Set,o=new Set;for(;n.length>0;){let i=n.shift();if(!i)continue;let a=p.resolve(i.dirPath);if(o.has(a))continue;if(o.add(a),a!==r&&await z(a,L)){s.add(a);continue}if(i.depth>=e)continue;let g=[];try{g=await f.readdir(a,{withFileTypes:true});}catch{continue}for(let m of g)!m.isDirectory()||q.has(m.name)||m.name.startsWith(".")&&m.name!==".config"||n.push({dirPath:p.join(a,m.name),depth:i.depth+1});}return Array.from(s).sort((i,a)=>i.localeCompare(a))}function G(t){let e=new Set,r=[];for(let n of t){let s=p.resolve(n);e.has(s)||(e.add(s),r.push(s));}return r.sort((n,s)=>n.localeCompare(s))}function D(t,e){let r=t?.[e];return typeof r=="string"&&r.trim()?r.trim():void 0}function U(t,e){return t?.[e]===true}function Q(t,e,r){let n=t?.frontend&&typeof t.frontend=="object"&&!Array.isArray(t.frontend)?t.frontend:void 0,s=D(n,"generator"),o=D(n,"command_display"),i=typeof e=="string"&&e.startsWith("frontend.");if(!(!s&&!i))return {...s?{id:s}:{},...e?{kit:e}:{},displayName:r,source:U(n,"official_generator")?"official-generator":"metadata",...o?{commandDisplay:o}:{}}}async function X(t){let e=[".rapidkit/project.json",".rapidkit/context.json","package.json","pyproject.toml","requirements.txt","go.mod","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","composer.json","Gemfile","mix.exs","deno.json","Dockerfile","docker-compose.yml","README.md"],r=[];for(let n of e)await f.pathExists(p.join(t,n))&&r.push(n);return r}async function k(t,e,r){let n=p.join(t,e),s=await f.pathExists(n),o={path:e.split(p.sep).join("/"),exists:s};if(s&&r){let i=await N(n);typeof i?.generatedAt=="string"&&(o.generatedAt=i.generatedAt);let a=i?.status??i?.result??i?.verdict;typeof a=="string"&&(o.status=a);}return o}async function Y(t,e,r){let s=`${_(t,e)}/.rapidkit/reports`,o=await k(t,`${s}/doctor-project-last-run.json`,r);return {doctor:o?.exists===true?o:await k(t,`${s}/doctor-last-run.json`,r),analyze:await k(t,`${s}/analyze-last-run.json`,r),readiness:await k(t,`${s}/release-readiness-last-run.json`,r)}}async function Z(t,e,r){let n=a$3(e),s=i(e,n),o=q$1(e),i$1=k$1(s.runtime),a=await a$4(e,n),g=typeof n?.name=="string"&&n.name.trim()?n.name.trim():p.basename(e),m=typeof n?.kit_name=="string"?n.kit_name:typeof n?.kit=="string"?n.kit:void 0,y=typeof n?.engine=="string"?n.engine:o.engine!=="unknown"?o.engine:void 0,c=Q(n,m,s.displayName);return {name:g,path:_(t,e),...r.includeAbsolutePaths?{absolutePath:e}:{},kind:a,runtime:s.runtime,runtimeCandidates:h(e),framework:s.key,frameworkDisplayName:s.displayName,confidence:s.confidence,detectionSource:s.source,supportTier:s.supportTier,runtimeSupportTier:i$1.tier,runtimeDoctorSupport:i$1.doctorSupport,moduleSupport:o.moduleSupport,...m?{kit:m}:{},...y?{engine:y}:{},...c?{generator:c}:{},commands:{supported:o.supportedCommands,unsupported:o.unsupportedCommands,global:o.globalCommands,fleetStages:o.fleetStages,localOnly:o.localOnlyCommands,map:o.commandMap},importantFiles:await X(e),evidence:await Y(t,e,r.includeEvidence),provenance:{path:"filesystem discovery",runtime:s.source,framework:s.source,commands:"project command capability matrix",evidence:"project .rapidkit/reports"}}}async function ee(t){return N(p.join(t,".rapidkit","workspace.json"))}function te(t){return t.some(e=>e.kind==="frontend")&&t.length>1?"full-stack-workspace":t.some(e=>e.kind==="frontend")?"frontend-workspace":t.length>1?"backend-platform":"backend-workspace"}function oe(t){let e=new Set;for(let r of t){let n=`${r.name} ${r.path}`.toLowerCase();for(let s of ["auth","billing","payment","notification","order","admin","report","search","analytics"])n.includes(s)&&e.add(s);}return Array.from(e).sort()}function u(t,e,r,n){return {severity:t,code:e,message:r,target:n}}function $(t){let e=[];t.workspace.name.trim()||e.push(u("error","workspace.name.missing","Workspace name could not be resolved.","workspace")),t.workspace.type==="observed-workspace"&&e.push(u("warning","workspace.marker.missing","Workspace marker is missing; model is based on filesystem observation.","workspace.marker")),t.summary.projectCount===0&&e.push(u("warning","workspace.projects.empty","No project roots were detected in this workspace.","projects")),t.contracts.exists||e.push(u("warning","workspace.contract.missing","Workspace contract is missing; dependency and API edges may be incomplete.",t.contracts.workspaceContractPath));let r=new Map;for(let o of t.projects){let i=o.name.toLowerCase(),a=r.get(i)??[];a.push(o),r.set(i,a),o.importantFiles.length||e.push(u("warning","project.markers.missing",`Project ${o.name} has no important manifest files recorded.`,o.path)),o.runtime==="unknown"&&e.push(u("warning","project.runtime.unknown",`Project ${o.name} runtime could not be confidently detected.`,o.path));let g=["test","build"];for(let c of g)o.commands.supported.includes(c)&&o.commands.unsupported.includes(c)&&e.push(u("error","project.commands.conflict",`Project ${o.name} marks ${c} as both supported and unsupported.`,o.path));let m=new Set(o.commands.fleetStages),y=new Set(o.commands.localOnly);for(let c of o.commands.fleetStages){y.has(c)&&e.push(u("error","project.commands.scope-conflict",`Project ${o.name} marks ${c} as both fleet and local-only.`,o.path));let d=o.commands.map[c];(!d||d.status!=="supported"||d.fleetEligible!==true||d.executionScope!=="fleet")&&e.push(u("error","project.commands.fleet-stage-invalid",`Project ${o.name} advertises ${c} as a fleet stage without a supported fleet capability.`,o.path));}for(let c of o.commands.localOnly){let d=o.commands.map[c];(!d||d.status!=="supported"||d.executionScope!=="local-only"||d.fleetEligible===true)&&e.push(u("error","project.commands.local-only-invalid",`Project ${o.name} advertises ${c} as local-only without a matching local-only capability.`,o.path));}for(let c of Object.values(o.commands.map))c.status==="supported"&&(c.fleetEligible===true&&!m.has(c.command)&&e.push(u("error","project.commands.fleet-stage-missing",`Project ${o.name} capability ${c.command} is fleet-eligible but missing from fleetStages.`,o.path)),c.executionScope==="local-only"&&c.fleetEligible!==true&&!y.has(c.command)&&e.push(u("error","project.commands.local-only-missing",`Project ${o.name} capability ${c.command} is local-only but missing from localOnly commands.`,o.path)));}for(let[o,i]of r.entries())i.length>1&&e.push(u("error","project.name.duplicate",`Project name "${o}" is ambiguous across ${i.length} project roots.`,i.map(a=>a.path).join(", ")));let n=e.filter(o=>o.severity==="error").length,s=e.filter(o=>o.severity==="warning").length;return {status:n>0?"failed":s>0?"warning":"passed",errors:n,warnings:s,issues:e}}function ge(t){return $(t)}async function ke(t){let e=p.resolve(t.workspacePath),r=t.includeAbsolutePaths===true,n=t.includeEvidence===true,s=H(t.observableScanDepth),o=t.now??new Date,[i,a$3,g,m,y]=await Promise.all([a(e),ee(e),a$1(e),a$2(e,{descendIntoMatchedProjects:false}),J(e,s)]),c=G([...m,...y,...g.map(l=>p.isAbsolute(l.path)?l.path:p.join(e,l.path))]),d=await Promise.all(c.map(l=>Z(e,l,{includeAbsolutePaths:r,includeEvidence:n}))),B=typeof a$3?.workspace_name=="string"?a$3.workspace_name:typeof a$3?.name=="string"?a$3.name:i?.name||p.basename(e),b=typeof a$3?.profile=="string"?a$3.profile:typeof a$3?.mode=="string"?a$3.mode:void 0,F=Array.from(new Set(d.map(l=>l.kind))).sort(),w=Array.from(new Set(d.map(l=>l.runtime))).sort(),I=Array.from(new Set(d.map(l=>l.framework))).sort(),h=[".rapidkit/policies.yml",".rapidkit/policies.yaml"].find(l=>f.existsSync(p.join(e,l))),j=".rapidkit/workspace.contract.json",v=await f.pathExists(p.join(e,j)),P={schemaVersion:V,generatedAt:o.toISOString(),workspace:{name:B,root:e,...b?{profile:b}:{},type:i?"rapidkit-workspace":"observed-workspace",...i?{marker:{createdBy:i.createdBy,version:i.version,createdAt:i.createdAt}}:{}},identity:{workspaceType:te(d),surfaces:F,runtimeFamilies:w,businessCapabilities:oe(d)},discovery:{observableScanDepth:s},projects:d,policies:{mode:typeof a$3?.policy_mode=="string"?a$3.policy_mode:typeof a$3?.policyMode=="string"?a$3.policyMode:"warn",source:h??null,exists:!!h},contracts:{workspaceContractPath:j,exists:v,status:v?"known":"missing"},evidence:{doctor:await k(e,".rapidkit/reports/doctor-last-run.json",n),analyze:await k(e,".rapidkit/reports/analyze-last-run.json",n),readiness:await k(e,".rapidkit/reports/release-readiness-last-run.json",n),pipeline:await k(e,".rapidkit/reports/pipeline-last-run.json",n)},summary:{projectCount:d.length,runtimes:w,frameworks:I,firstClassProjects:d.filter(l=>l.supportTier==="first-class").length,observedProjects:d.filter(l=>l.supportTier==="observed").length}},T=$(P);return {...P,validation:T}}async function ye(t,e){let r=p.join(e,K);return await f.ensureDir(p.dirname(r)),await f.writeJSON(r,t,{spaces:2}),r}export{V as a,K as b,ge as c,ke as d,ye as e};
@@ -0,0 +1,2 @@
1
+ import {a as a$1,c,i,g as g$1,h}from'./chunk-UZW5QFRW.js';import E from'fs';import a from'path';function S(e,t){let n=g$1({runtime:typeof e?.runtime=="string"?e.runtime:void 0,framework:typeof e?.framework=="string"?e.framework:void 0,kitName:typeof e?.kit_name=="string"?e.kit_name:typeof e?.kit=="string"?e.kit:void 0});return n.runtime!=="unknown"?n.runtime:i(t,e).runtime}function q(e){let t=e;for(;;){let n=a.join(t,".rapidkit","project.json");if(E.existsSync(n))try{return JSON.parse(E.readFileSync(n,"utf8"))}catch{return null}let r=a.dirname(t);if(r===t)break;t=r;}return null}function Ke(e,t){return S(e,t)==="go"}function Ge(e,t){return S(e,t)==="node"}function Je(e,t){return S(e,t)==="java"}function $e(e,t){return S(e,t)==="dotnet"}function We(e,t){return S(e,t)==="python"}var ue={dev:["dev","start:dev"],start:["start","start:prod","preview"],build:["build"],test:["test","test:unit","test:ci"],lint:["lint"],format:["format","prettier"]},H={nestjs:{dev:["dev","start:dev"],start:["start","start:prod"],build:["build"],test:["test","test:e2e"],lint:["lint"],format:["format"]},express:{dev:["dev","start:dev"],start:["start"],build:["build"],test:["test"],lint:["lint"],format:["format"]},fastify:{dev:["dev","start:dev"],start:["start"],build:["build"],test:["test"],lint:["lint"],format:["format"]},koa:{dev:["dev","start:dev"],start:["start"],build:["build"],test:["test"],lint:["lint"],format:["format"]}};function ce(e){let t=a.join(e,"package.json");if(!E.existsSync(t))return {};try{let r=JSON.parse(E.readFileSync(t,"utf8")).scripts??{};return Object.fromEntries(Object.entries(r).filter(i=>typeof i[1]=="string"))}catch{return {}}}function le(e,t){let n=t?c(t):"unknown",r=n!=="unknown"?a$1(n,e):[],i=t?H[t]?.[e]??[]:[],m=ue[e]??[],f=[...r,...i,...m];return [...new Set(f)]}function V(e,t,n){let r=ce(e),i=new Set(Object.keys(r));if(i.has(t))return {scriptName:t,source:"package.json"};for(let m of le(t,n?.framework))if(i.has(m))return {scriptName:m,source:a$1(c(n?.framework??"unknown"),t).includes(m)||H[n?.framework??""]?.[t]?.includes(m)?"framework-candidate":"generic-candidate"};return null}function F(e){return E.existsSync(a.join(e,"package.json"))}var de=["build","dev","start","test","lint","format"],O=["init","test","build","start"],Ze=["lint","format","docs"];function et(e){return !!e&&de.includes(e)}var g=["init","dev","start","build","test","lint","format","help"],X={python:{runtime:"python",displayName:"Python",tier:"first-class",scaffoldSupport:true,importSupport:true,lifecycleCommands:g,moduleCommands:true,doctorSupport:"full",notes:["Core-backed Python projects support RapidKit modules and lifecycle commands."]},node:{runtime:"node",displayName:"Node.js",tier:"extended",scaffoldSupport:true,importSupport:true,lifecycleCommands:g,moduleCommands:true,doctorSupport:"full",notes:["Node projects support npm-owned lifecycle commands; NestJS is the first-class Node framework."]},go:{runtime:"go",displayName:"Go",tier:"extended",scaffoldSupport:true,importSupport:true,lifecycleCommands:g,moduleCommands:false,doctorSupport:"readiness",notes:["Go projects support workspace governance and lifecycle commands via Go tooling."]},java:{runtime:"java",displayName:"Java / Spring Boot",tier:"extended",scaffoldSupport:true,importSupport:true,lifecycleCommands:g,moduleCommands:false,doctorSupport:"readiness",notes:["Java projects support Maven/Gradle lifecycle commands and workspace governance."]},dotnet:{runtime:"dotnet",displayName:".NET / ASP.NET Core",tier:"extended",scaffoldSupport:true,importSupport:true,lifecycleCommands:g,moduleCommands:false,doctorSupport:"readiness",notes:[".NET projects support dotnet CLI lifecycle commands and workspace governance."]},php:{runtime:"php",displayName:"PHP",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["PHP projects are importable and governed as observed projects until a kit exists."]},ruby:{runtime:"ruby",displayName:"Ruby",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Ruby projects are importable and governed as observed projects until a kit exists."]},rust:{runtime:"rust",displayName:"Rust",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Rust projects are importable and governed as observed projects until a kit exists."]},elixir:{runtime:"elixir",displayName:"Elixir",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Elixir projects are importable and governed as observed projects until a kit exists."]},clojure:{runtime:"clojure",displayName:"Clojure",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Clojure projects are importable and governed as observed projects until a kit exists."]},scala:{runtime:"scala",displayName:"Scala",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Scala projects are importable and governed as observed projects until a kit exists."]},kotlin:{runtime:"kotlin",displayName:"Kotlin",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Kotlin projects are importable and governed as observed projects until a kit exists."]},deno:{runtime:"deno",displayName:"Deno",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Deno projects are importable and governed as observed projects until a kit exists."]},bun:{runtime:"bun",displayName:"Bun",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Bun projects are importable and governed as observed projects until a kit exists."]},unknown:{runtime:"unknown",displayName:"Unknown",tier:"observed",scaffoldSupport:false,importSupport:true,lifecycleCommands:["help"],moduleCommands:false,doctorSupport:"observed",notes:["Unknown projects are tracked safely but require manual command configuration."]}},pe=["fastapi","nestjs"],fe=["django","flask","nextjs","remix","nuxt","react","vite","vue","sveltekit","svelte","angular","astro","solid","express","fastify","koa","echo","gofiber","gogin","springboot","dotnet","laravel","symfony","rails","sinatra","actix","axum","rocket","phoenix","clojure","scala","kotlin","deno","bun"];function x(e){return X[e||"unknown"]??X.unknown}function z(e){return pe.includes(e)?"first-class":fe.includes(e)?"extended":"observed"}function Q(e){let t=x(e.runtime);return {lifecycleCommands:t.lifecycleCommands,moduleCommands:e.moduleSupport&&t.moduleCommands,unsupportedLifecycleCommands:g.filter(n=>!t.lifecycleCommands.includes(n))}}var ye=["python","node","go","java","dotnet"];function b(e){return !!e&&ye.includes(e)}function N(e,t){return t!=="lint"&&t!=="format"&&t!=="docs"?false:e==="python"}function Z(e){let t=x(e),n=b(t.runtime),r=Ce[t.runtime]??[],i=ge[t.runtime]??[];return {runtime:t.runtime,displayName:t.displayName,lifecycleCommands:t.lifecycleCommands,hasExecutor:n,packageManagers:r,primaryFiles:i,notes:t.notes}}var Ce={python:["poetry","pip","uv"],node:["npm","pnpm","yarn","bun"],go:["go"],java:["maven","gradle"],dotnet:["dotnet"],php:["composer"],ruby:["bundle"],rust:["cargo"],elixir:["mix"],kotlin:["gradle"],deno:["deno"],bun:["bun"]},ge={python:["pyproject.toml","requirements.txt","requirements.in"],node:["package.json"],go:["go.mod"],java:["pom.xml","build.gradle","build.gradle.kts"],dotnet:["*.csproj","*.sln"],php:["composer.json"],ruby:["Gemfile"],rust:["Cargo.toml"],elixir:["mix.exs"],kotlin:["settings.gradle.kts"],deno:["deno.json","deno.jsonc"],bun:["package.json","bunfig.toml"]};function be(e){let t=a.join(e,".rapidkit","context.json");if(!E.existsSync(t))return null;try{return JSON.parse(E.readFileSync(t,"utf8"))}catch{return null}}function ke(e){let t=e?.engine;return t==="npm"||t==="pip"||t==="python"?t:"unknown"}function Se(e,t,n){return e?.module_support===false||t?.module_support===false?false:e?.module_support===true||t?.module_support===true?true:!e&&t?false:n.runtime==="python"||n.runtime==="node"}function xe(e,t,n){let r=g$1({runtime:typeof t?.runtime=="string"?t.runtime:typeof n?.runtime=="string"?n.runtime:void 0,framework:typeof t?.framework=="string"?t.framework:typeof n?.framework=="string"?n.framework:void 0,kitName:typeof t?.kit_name=="string"?t.kit_name:typeof t?.kit=="string"?t.kit:typeof n?.kit=="string"?n.kit:void 0});return r.key!=="unknown"?r:i(e,t)}function ee(e){let t=a.resolve(e),n=a.join(t,".rapidkit","project.json"),r=a.join(t,".rapidkit","context.json");if(!E.existsSync(n)&&!E.existsSync(r))return null;let i=q(t),m=be(t),f=xe(t,i,m);return {projectRoot:t,projectJson:i,contextJson:m,detection:f,moduleSupport:Se(i,m,f),engine:ke(m)}}function te(e){let t=Z(e);return t.runtime==="unknown"&&e!=="unknown"?null:{runtime:t.runtime,displayName:t.displayName,supportedCommands:t.lifecycleCommands,packageManagers:t.packageManagers,primaryFiles:t.primaryFiles,notes:t.notes,hasExecutor:t.hasExecutor}}function s(e){try{return E.existsSync(e)}catch{return false}}function p(e){try{return s(e)?E.readFileSync(e,"utf8"):""}catch{return ""}}function u(e,t){let n=p(a.join(e,"Makefile"));return n?new RegExp(`^${t}\\s*:`).test(n):false}function je(e){let t=[e];for(;t.length>0;){let n=t.shift();if(!n)break;let r=[];try{r=E.readdirSync(n,{withFileTypes:true});}catch{continue}for(let i of r){if(i.name==="node_modules"||i.name===".git"||i.name==="dist")continue;let m=a.join(n,i.name);if(i.isFile()&&i.name.endsWith(".csproj"))return true;i.isDirectory()&&t.push(m);}}return false}function ne(e,t){let n=s(a.join(e,"pyproject.toml")),r=s(a.join(e,"requirements.txt"))||s(a.join(e,"requirements.in")),i=s(a.join(e,"manage.py"));switch(t){case "init":return n||r;case "dev":case "start":return n||i||r;case "test":return n||r||s(a.join(e,"tests"));case "build":return n||r;case "lint":case "format":return n||r||i||s(a.join(e,"setup.py"))||s(a.join(e,"setup.cfg"));default:return false}}function Re(e,t){if(!s(a.join(e,"go.mod")))return false;switch(t){case "init":return true;case "dev":return u(e,"run")||s(a.join(e,"main.go"));case "test":return true;case "build":return true;case "start":return u(e,"run")||s(a.join(e,"main.go"))||s(a.join(e,"cmd"));case "lint":return s(a.join(e,".golangci.yml"))||s(a.join(e,".golangci.yaml"))||u(e,"lint");case "format":return u(e,"fmt")||u(e,"format");default:return false}}function he(e,t){let n=s(a.join(e,"pom.xml")),r=s(a.join(e,"build.gradle"))||s(a.join(e,"build.gradle.kts"));if(!n&&!r)return false;switch(t){case "init":case "test":case "build":case "dev":case "start":return true;case "lint":return u(e,"lint")||p(a.join(e,"pom.xml")).includes("checkstyle")||p(a.join(e,"build.gradle")).includes("checkstyle")||p(a.join(e,"build.gradle.kts")).includes("checkstyle");case "format":return u(e,"format")||p(a.join(e,"build.gradle")).includes("spotless")||p(a.join(e,"build.gradle.kts")).includes("spotless");default:return false}}function Ne(e,t){if(!je(e))return false;switch(t){case "init":case "dev":case "test":case "build":case "start":return true;case "lint":return u(e,"lint")||p(a.join(e,"Directory.Build.props")).includes("EnforceCodeStyleInBuild");case "format":return u(e,"format")||s(a.join(e,".editorconfig"));default:return false}}function ve(e,t,n){return t==="init"?F(e):V(e,t,{framework:n})!==null}function Ee(e,t,n){switch(t){case "php":return n==="init"&&s(a.join(e,"composer.json"));case "ruby":return n==="init"&&s(a.join(e,"Gemfile"));case "rust":return s(a.join(e,"Cargo.toml"))?n==="init"||n==="test"||n==="build"||n==="start":false;case "elixir":return n==="init"&&s(a.join(e,"mix.exs"));case "deno":return s(a.join(e,"deno.json"))||s(a.join(e,"deno.jsonc"))?n==="init"||n==="dev"||n==="test"||n==="start":n==="init"&&s(a.join(e,"package.json"));case "bun":return s(a.join(e,"bunfig.toml"))||s(a.join(e,"bun.lock"))?n==="init"||n==="dev"||n==="test"||n==="build"||n==="start":n==="init"&&s(a.join(e,"package.json"));default:return false}}function P(e,t,n,r){if(N(t,n))return ne(e,n);if(!b(t))return Ee(e,t,n);switch(t){case "node":return ve(e,n,r);case "python":return ne(e,n);case "go":return Re(e,n);case "java":return he(e,n);case "dotnet":return Ne(e,n);default:return false}}function Pe(e,t,n){return ["init","dev","start","build","test","lint","format"].filter(i=>P(e,t,i,n))}function re(e){let t=Q({runtime:e.runtime,moduleSupport:e.moduleSupport});if(!e.projectPath)return t;let n=Pe(e.projectPath,e.runtime,e.framework),r=new Set(["help"]);for(let m of n)t.lifecycleCommands.includes(m)&&r.add(m);e.runtime==="node"&&F(e.projectPath)&&r.add("init");let i=[...r].sort();return {lifecycleCommands:i,moduleCommands:t.moduleCommands,unsupportedLifecycleCommands:t.lifecycleCommands.filter(m=>!i.includes(m)).sort()}}var T=["version","commands","doctor","project","help"],w=["init","dev","start","build","test","lint","format"],B=["add","modules","upgrade","diff","merge","reconcile","rollback","uninstall","checkpoint","snapshot","optimize"],I=["create","list","info","frameworks","license"];T.filter(e=>e!=="help");function we(e){let t=a.resolve(e);for(;;){let n=a.join(t,".rapidkit"),r=a.join(n,"project.json"),i=a.join(n,"context.json");if(E.existsSync(r)||E.existsSync(i))return t;let m=a.dirname(t);if(m===t)break;t=m;}return null}function j(e,t){return {command:e,...t}}var Me=new Set(["dev","lint","format"]),_e=new Set(O);function Ae(e,t){return t?_e.has(e)?{executionScope:"fleet",fleetEligible:true}:Me.has(e)?{executionScope:"local-only",fleetEligible:false}:{executionScope:"local-only",fleetEligible:false}:{executionScope:"local-only",fleetEligible:false}}function Le(e,t){return N(t.runtime,e)?"core":"runtime"}function Fe(e,t,n,r){return !e||!r.lifecycleCommands.includes(t)?false:P(e,n.runtime,t,n.key)}function Oe(e,t){let n=!!e&&(t.runtime==="python"||b(t.runtime)&&P(e,t.runtime,"build",t.key));return j("docs",{owner:t.runtime==="python"?"core":"runtime",status:n?"supported":"unsupported",reason:n?t.runtime==="python"?"Documentation generation is delegated to Python Core for this project.":"Project documentation commands are available through the npm wrapper for this runtime.":"Documentation commands require a supported Python or npm-executor project manifest."})}function De(e){let t=a.resolve(e),n=we(e);return n||(h(t).length>0?t:null)}function Te(e=process.cwd()){let t=De(e),n=t?ee(t):null,r=n?.detection??i(e,n?.projectJson??null),i$1=n?.moduleSupport??false,m=n?.engine??"unknown",f=te(r.runtime),U=x(r.runtime),ae=re({runtime:r.runtime,moduleSupport:i$1,projectPath:t??void 0,framework:r.key}),d={};for(let o of T)d[o]=j(o,{owner:o==="project"?"core":"npm",status:"supported",reason:o==="project"?"Project detection is a Core contract; workspace project lifecycle remains npm-owned.":o==="help"?"Help is available for every RapidKit project through the npm CLI.":"Universal command available across RapidKit project types."});for(let o of w){let y=Fe(t,o,r,ae),G=Le(o,r),M=Ae(o,y);d[o]=j(o,{owner:G,status:y?"supported":"unsupported",executionScope:M.executionScope,fleetEligible:M.fleetEligible,reason:y?G==="core"?`Delegated to Python Core for ${r.displayName} projects.`:M.fleetEligible?`Handled by runtime adapter and eligible for workspace fleet stages (${o}).`:o==="dev"?"Local development command only; workspace fleet excludes dev by design.":r.runtime==="node"?`Handled by npm/pnpm/yarn via the resolved ${o} script in package.json.`:`Handled by the ${f?.displayName??r.displayName} runtime adapter for local project execution.`:t?r.runtime==="node"?`No ${o} script was found in package.json for this ${r.displayName} project.`:b(r.runtime)?`The ${r.displayName} runtime is tracked, but ${o} is not available from detected project manifests.`:`${r.displayName} is tracked as an observed runtime; ${o} requires project manifests or explicit scripts.`:"No RapidKit project was detected."});}d.docs=Oe(t,r);for(let o of B)d[o]=j(o,{owner:i$1?"core":"none",status:i$1?"supported":"unsupported",reason:i$1?"Core module/template command supported for this project.":`Core module/template commands are not available for ${r.displayName} projects.`});for(let o of I)d[o]=j(o,{owner:o==="create"?"npm":"core",status:"global",reason:o==="create"?"Create is orchestrated by npm for multi-language workspace support.":"Engine catalog command; not specific to the selected project runtime."});let R=Object.values(d),K=R.filter(o=>w.includes(o.command)).filter(o=>o.status==="supported"),se=O.filter(o=>K.some(y=>y.fleetEligible===true&&y.command===o)),me=K.filter(o=>o.executionScope==="local-only").map(o=>o.command).sort();return {schemaVersion:1,scope:"project",projectRoot:t,engine:m,runtime:r.runtime,framework:r.key,frameworkDisplayName:r.displayName,frameworkConfidence:r.confidence,frameworkSupportTier:z(r.key),runtimeSupportTier:U.tier,runtimeDoctorSupport:U.doctorSupport,moduleSupport:i$1,fleetStages:se,localOnlyCommands:me,commandMap:d,supportedCommands:R.filter(o=>o.status==="supported").map(o=>o.command).sort(),unsupportedCommands:R.filter(o=>o.status==="unsupported").map(o=>o.command).sort(),globalCommands:R.filter(o=>o.status==="global").map(o=>o.command).sort()}}function It(e,t=process.cwd()){let n=e[0];return n?Te(t).commandMap[n]??null:null}function Ut(e){if(e[0]==="project"&&e[1]==="commands")return true;if(e[0]==="commands"&&e.includes("--scope")){let t=e.indexOf("--scope");return e[t+1]==="project"}return e.some(t=>t==="--scope=project")&&e[0]==="commands"}function Kt(e,t){return [`RapidKit command not supported for this project: ${e.command}`,"",`Project: ${t.projectRoot??"not detected"}`,`Runtime: ${t.runtime}`,`Framework: ${t.frameworkDisplayName}`,`Reason: ${e.reason??"Unsupported for this project type."}`,"","Run `rapidkit project commands` to inspect supported commands for this project."].join(`
2
+ `)}export{q as a,Ke as b,Ge as c,Je as d,$e as e,We as f,V as g,de as h,Ze as i,et as j,x as k,z as l,b as m,ee as n,re as o,we as p,Te as q,It as r,Ut as s,Kt as t};
@@ -0,0 +1 @@
1
+ import i from'path';import s from'fs-extra';var l=new Set(["service","frontend","worker","library","infra","docs","test-suite","unknown"]);async function d(n){try{if(!await s.pathExists(n))return null;let e=await s.readJSON(n);return e&&typeof e=="object"?e:null}catch{return null}}function u(n){if(typeof n!="string")return null;let e=n.trim().toLowerCase();return l.has(e)?e:null}async function m(n,e){let o=e??await d(i.join(n,".rapidkit","project.json")),a=u(o?.kind)??u(o?.type);if(a)return a;let t=await d(i.join(n,"package.json"));if(t){let r={...t.dependencies??{},...t.devDependencies??{}},f=t.scripts??{},c=Object.values(f).filter(p=>typeof p=="string").join(" ").toLowerCase();if(r.next||r.react||r.vue||r.svelte||r.vite||r["@angular/core"]||c.includes("next ")||c.includes("vite "))return "frontend";if(t.private===true&&!r.express&&!r["@nestjs/core"])return "library"}return await s.pathExists(i.join(n,"Dockerfile"))||await s.pathExists(i.join(n,"docker-compose.yml"))||await s.pathExists(i.join(n,"terraform.tf"))?"infra":"service"}export{m as a};
@@ -0,0 +1 @@
1
+ export{b as PYTHON_FREE_WORKSPACE_PROFILES,e as createProject,f as registerWorkspaceAtPath,c as resolvePythonFreeFallbackProfile,a as syncWorkspaceFoundationFiles,d as writeWorkspaceLauncher}from'./chunk-752X3YI3.js';
@@ -1 +1 @@
1
- export{a as computeDoctorGateExitCode,b as runDoctor}from'./chunk-YV7IQDBM.js';
1
+ export{a as computeDoctorGateExitCode,b as runDoctor}from'./chunk-TC2PSHT6.js';
@@ -0,0 +1 @@
1
+ export{a as readImportedProjectsRegistry,c as removeImportedProjectsRegistryEntries,b as upsertImportedProjectsRegistry}from'./chunk-HHJAANUC.js';
package/dist/index.d.ts CHANGED
@@ -1,9 +1,23 @@
1
1
  #!/usr/bin/env node
2
+ declare const PROJECT_COMMANDS_CORE_FALLBACK: readonly ["lint", "format", "docs"];
3
+
2
4
  declare function handleCreateOrFallback(args: string[]): Promise<number>;
3
- declare const NPM_ONLY_TOP_LEVEL_COMMANDS: readonly ["analyze", "readiness", "doctor", "autopilot", "pipeline", "import", "snapshot", "workspace", "bootstrap", "setup", "cache", "mirror", "ai", "config", "product", "infra", "shell", "commands"];
5
+ declare const NPM_ONLY_TOP_LEVEL_COMMANDS: readonly ["analyze", "readiness", "doctor", "autopilot", "pipeline", "import", "adopt", "snapshot", "workspace", "bootstrap", "setup", "cache", "mirror", "ai", "config", "product", "infra", "shell", "commands"];
4
6
  declare const NPM_ONLY_SCOPED_COMMANDS: readonly [readonly ["project", "commands"], readonly ["project", "archives"], readonly ["project", "archive"], readonly ["project", "restore"], readonly ["project", "delete"]];
5
7
  declare const WRAPPER_ORCHESTRATED_PROJECT_COMMANDS: readonly ["init"];
6
8
  declare function isNpmExecInvocation(env?: NodeJS.ProcessEnv): boolean;
9
+ declare function getGlobalCommandCapabilities(): {
10
+ scope: string;
11
+ cli: string;
12
+ version: string;
13
+ cwd: string;
14
+ commands: {
15
+ npmOwned: string[];
16
+ coreBacked: string[];
17
+ projectScoped: string[];
18
+ };
19
+ commandMap: any;
20
+ };
7
21
  interface DoctorWorkspaceShadowDiagnostic {
8
22
  detected: boolean;
9
23
  candidatePath?: string;
@@ -18,10 +32,23 @@ declare function handleImportCommand(source: string, options: {
18
32
  name?: string;
19
33
  git?: boolean;
20
34
  json?: boolean;
35
+ enableModules?: boolean;
21
36
  }, dependencies?: {
22
37
  syncWorkspaceProjects?: (workspacePath: string) => Promise<void>;
23
38
  rollbackImportedProjectImport?: (workspacePath: string, projectPath: string) => Promise<void>;
24
39
  }): Promise<number>;
40
+ declare function handleAdoptCommand(source: string | undefined, options: {
41
+ workspace?: string;
42
+ name?: string;
43
+ dryRun?: boolean;
44
+ json?: boolean;
45
+ enableModules?: boolean;
46
+ }, dependencies?: {
47
+ syncWorkspaceProjects?: (workspacePath: string) => Promise<void>;
48
+ registerWorkspace?: (workspacePath: string, workspaceName: string) => Promise<void>;
49
+ registerProjectInWorkspace?: (workspacePath: string, projectName: string, projectPath: string) => Promise<void>;
50
+ rollbackAdoptedProjectImport?: (workspacePath: string, projectPath: string, previousProjectJson: Record<string, unknown> | null) => Promise<void>;
51
+ }): Promise<number>;
25
52
  declare function installWorkspaceDependencies(workspacePath: string): Promise<number>;
26
53
  declare function handleBootstrapCommand(args: string[], initRunner?: (nextArgs: string[]) => Promise<number>): Promise<number>;
27
54
  declare function handleSetupCommand(args: string[]): Promise<number>;
@@ -30,4 +57,4 @@ declare function handleMirrorCommand(args: string[]): Promise<number>;
30
57
  declare function handleInitCommand(args: string[]): Promise<number>;
31
58
  declare function shouldForwardToCore(args: string[]): Promise<boolean>;
32
59
 
33
- export { type DoctorWorkspaceShadowDiagnostic, NPM_ONLY_SCOPED_COMMANDS, NPM_ONLY_TOP_LEVEL_COMMANDS, WRAPPER_ORCHESTRATED_PROJECT_COMMANDS, detectWindowsDoctorWorkspaceShadow, handleBootstrapCommand, handleCacheCommand, handleCreateOrFallback, handleImportCommand, handleInitCommand, handleMirrorCommand, handleSetupCommand, installWorkspaceDependencies, isNpmExecInvocation, shouldForwardToCore };
60
+ export { type DoctorWorkspaceShadowDiagnostic, NPM_ONLY_SCOPED_COMMANDS, NPM_ONLY_TOP_LEVEL_COMMANDS, PROJECT_COMMANDS_CORE_FALLBACK, WRAPPER_ORCHESTRATED_PROJECT_COMMANDS, detectWindowsDoctorWorkspaceShadow, getGlobalCommandCapabilities, handleAdoptCommand, handleBootstrapCommand, handleCacheCommand, handleCreateOrFallback, handleImportCommand, handleInitCommand, handleMirrorCommand, handleSetupCommand, installWorkspaceDependencies, isNpmExecInvocation, shouldForwardToCore };