rapidkit 0.35.0 → 0.37.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 (65) hide show
  1. package/README.md +216 -24
  2. package/contracts/analyze-last-run.v1.json +106 -0
  3. package/contracts/cli-log-event.v1.json +51 -0
  4. package/contracts/doctor-project-evidence.v1.json +46 -0
  5. package/contracts/doctor-workspace-evidence.v1.json +57 -0
  6. package/contracts/release-readiness.v1.json +60 -0
  7. package/contracts/workspace-registry.v1.json +83 -0
  8. package/contracts/workspace-run-last.v1.json +112 -0
  9. package/dist/analyze-6RFG7C7Z.js +1 -0
  10. package/dist/autopilot-release-AUXP2ZIF.js +1 -0
  11. package/dist/chunk-6P5DCHBQ.js +4 -0
  12. package/dist/chunk-7VSYTOOG.js +7 -0
  13. package/dist/chunk-B2KOIORF.js +1 -0
  14. package/dist/{chunk-VPNHGQIV.js → chunk-C7OVQQXT.js} +1 -1
  15. package/dist/chunk-C7WILE56.js +1 -0
  16. package/dist/chunk-D23L2GFT.js +2 -0
  17. package/dist/{workspace-context-YFQQROOZ.js → chunk-EJGKBFV4.js} +2 -2
  18. package/dist/chunk-FV5A3N3I.js +2 -0
  19. package/dist/chunk-GDGATWR5.js +2 -0
  20. package/dist/chunk-HEG6DIGW.js +2 -0
  21. package/dist/{chunk-752X3YI3.js → chunk-IOIWVHRO.js} +81 -81
  22. package/dist/chunk-JBDQADHY.js +50 -0
  23. package/dist/{chunk-AC6KIKII.js → chunk-PPQYTYQG.js} +4 -4
  24. package/dist/chunk-RELR4O5E.js +2 -0
  25. package/dist/{chunk-FNL34DKD.js → chunk-RUUDLAKJ.js} +12 -12
  26. package/dist/chunk-T5LN7EO5.js +9 -0
  27. package/dist/chunk-U6QUN6V2.js +2 -0
  28. package/dist/chunk-UXKB4KGZ.js +13 -0
  29. package/dist/create-HN5HOGQ4.js +1 -0
  30. package/dist/{demo-kit-KTRITRWH.js → demo-kit-3VTLJBP7.js} +1 -1
  31. package/dist/{doctor-DG3TBPZN.js → doctor-QC662YLH.js} +1 -1
  32. package/dist/{dotnet-webapi-clean-TPQMNFSD.js → dotnet-webapi-clean-FX533F5U.js} +1 -1
  33. package/dist/{gofiber-standard-NDCBY6OM.js → gofiber-standard-35CJZ7S3.js} +1 -1
  34. package/dist/{gogin-standard-WUOMIHDR.js → gogin-standard-SAX6C4ZK.js} +1 -1
  35. package/dist/index.js +214 -213
  36. package/dist/managed-agent-markers-AXUM75OE.js +8 -0
  37. package/dist/pipeline-BOU4KETN.js +5 -0
  38. package/dist/{springboot-standard-WQWB5E24.js → springboot-standard-SFMSLTX4.js} +1 -1
  39. package/dist/{workspace-ZXWYIZOR.js → workspace-2AL5C3QZ.js} +1 -1
  40. package/dist/workspace-agent-sync-V2H6NTGD.js +17 -0
  41. package/dist/workspace-context-KCKNV5VQ.js +1 -0
  42. package/dist/{workspace-contract-A6QP7FPA.js → workspace-contract-D5O4OZD5.js} +1 -1
  43. package/dist/workspace-foundation-L6ZBGMVE.js +1 -0
  44. package/dist/{workspace-intelligence-NXIO55GJ.js → workspace-intelligence-3TWXJQ7Y.js} +1 -1
  45. package/dist/{workspace-model-OO4WOBJS.js → workspace-model-NQVZN5W4.js} +1 -1
  46. package/dist/workspace-registry-summary-MIPHVB56.js +1 -0
  47. package/dist/workspace-run-DEXI52KO.js +1 -0
  48. package/dist/workspace-verify-HBCQNNGU.js +1 -0
  49. package/package.json +2 -1
  50. package/dist/analyze-IIPDLLM2.js +0 -1
  51. package/dist/autopilot-release-EO7GQS4P.js +0 -1
  52. package/dist/chunk-5LLGW5TP.js +0 -9
  53. package/dist/chunk-B7NCBH5B.js +0 -2
  54. package/dist/chunk-DKVWFHZO.js +0 -4
  55. package/dist/chunk-IATULVMR.js +0 -11
  56. package/dist/chunk-KDUAZXEQ.js +0 -3
  57. package/dist/chunk-MCLLP6MW.js +0 -2
  58. package/dist/chunk-R4RPUW7I.js +0 -7
  59. package/dist/chunk-TC2PSHT6.js +0 -50
  60. package/dist/chunk-VM2TOHNX.js +0 -2
  61. package/dist/create-LUXJGSNL.js +0 -1
  62. package/dist/pipeline-7OTUIB6D.js +0 -5
  63. package/dist/workspace-foundation-TYLH5SAU.js +0 -1
  64. package/dist/workspace-run-AZ63D75J.js +0 -1
  65. package/dist/workspace-verify-K56NI3AI.js +0 -1
@@ -1,50 +0,0 @@
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};
@@ -1,2 +0,0 @@
1
- import o from'chalk';var s=class{debugEnabled=false;setDebug(n){this.debugEnabled=n;}debug(n,...e){this.debugEnabled&&console.log(o.gray(`[DEBUG] ${n}`),...e);}info(n,...e){console.log(o.blue(n),...e);}success(n,...e){console.log(o.green(n),...e);}warn(n,...e){console.log(o.yellow(n),...e);}error(n,...e){console.error(o.red(n),...e);}step(n,e,l){console.log(o.cyan(`
2
- [${n}/${e}]`),o.white(l));}},i=new s;export{i as a};
@@ -1 +0,0 @@
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,5 +0,0 @@
1
- import {b}from'./chunk-TC2PSHT6.js';import {a as a$1}from'./chunk-5LLGW5TP.js';import {a as a$3}from'./chunk-R4RPUW7I.js';import {a as a$2}from'./chunk-DKVWFHZO.js';import {a}from'./chunk-KMUWWZRT.js';import {b as b$1}from'./chunk-FNL34DKD.js';import c from'chalk';import x from'fs-extra';import u from'path';function D(s){return s===0?"pass":s===2?"warn":"fail"}function M(s){return s.some(r=>r.status==="fail")?"blocked":s.some(r=>r.status==="warn")?"needs-attention":"ready"}function j(s,r){if(r)return 3;let t=s.some(i=>i.status==="fail"),a=s.some(i=>i.status==="warn");return t?1:a?2:0}async function A(s){let r=await b$1(s,true),t=false;try{let{syncWorkspaceContract:a}=await import('./workspace-contract-A6QP7FPA.js');await a({workspacePath:s}),t=true;}catch{t=false;}return {sync:r,contractSynced:t}}async function C(s={}){let r=u.resolve(s.workspacePath??process.cwd()),t=a(r);if(!t)throw new Error("No RapidKit workspace found in current directory or parents");let a$4=[],i=[],l=false,p,f,d,g=Date.now();try{let{sync:e,contractSynced:o}=await A(t),n=e.workspaceFound&&(e.added.length>0||e.skipped>=0)||e.workspaceFound?"pass":"warn";a$4.push({name:"sync",status:n,durationMs:Date.now()-g,summary:e.workspaceFound?`registry sync complete (${e.added.length} added, ${e.skipped} existing)${o?", contract synced":""}`:"workspace not registered in global registry; contract sync attempted"}),e.workspaceFound||i.push("workspace registry entry missing \u2014 run rapidkit create workspace or register manually");}catch(e){l=true,a$4.push({name:"sync",status:"fail",durationMs:Date.now()-g,summary:`sync failed: ${e instanceof Error?e.message:String(e)}`}),i.push("workspace sync stage failed");}let y=Date.now();try{let e=await b({workspace:true,json:true,quiet:true,strict:s.strict===true,ci:s.strict!==true}),o=D(e),n=u.join(t,".rapidkit","reports","doctor-last-run.json");a$4.push({name:"doctor",status:o,durationMs:Date.now()-y,summary:o==="pass"?"doctor workspace passed":o==="warn"?"doctor workspace reported warnings":"doctor workspace reported errors",exitCode:e,evidencePath:n}),o==="fail"?i.push("doctor workspace gate failed"):o==="warn"&&i.push("doctor workspace reported warnings");}catch(e){l=true,a$4.push({name:"doctor",status:"fail",durationMs:Date.now()-y,summary:`doctor failed: ${e instanceof Error?e.message:String(e)}`}),i.push("doctor workspace stage failed");}if(s.skipAnalyze)a$4.push({name:"analyze",status:"skipped",durationMs:0,summary:"analyze stage skipped"});else {let e=Date.now();try{let o=await a$1({workspacePath:t,json:true,strict:s.strict===true});p=u.join(t,".rapidkit","reports","analyze-last-run.json");let n=o.summary.verdict==="blocked"?"fail":o.summary.verdict==="needs-attention"?"warn":"pass";a$4.push({name:"analyze",status:n,durationMs:Date.now()-e,summary:`analyze verdict: ${o.summary.verdict} (score ${o.summary.score}/100)`,evidencePath:p}),n==="fail"?i.push("analyze reported blocked verdict"):n==="warn"&&i.push("analyze reported needs-attention verdict");}catch(o){l=true,a$4.push({name:"analyze",status:"fail",durationMs:Date.now()-e,summary:`analyze failed: ${o instanceof Error?o.message:String(o)}`}),i.push("analyze stage failed");}}let w=Date.now();try{let e=await a$2({startPath:t,writeReport:true,skipVerify:s.skipVerify===true});f=e.evidencePath;let o=e.overallStatus==="pass"?"pass":e.overallStatus==="warn"?"warn":"fail";a$4.push({name:"readiness",status:o,durationMs:Date.now()-w,summary:`readiness overall: ${e.overallStatus}`,evidencePath:e.evidencePath}),o==="fail"?i.push(...e.blockingReasons.map(n=>`readiness: ${n}`)):o==="warn"&&i.push(...e.gates.filter(n=>n.status==="warn").map(n=>`readiness warn: ${n.gate}: ${n.summary}`));}catch(e){l=true,a$4.push({name:"readiness",status:"fail",durationMs:Date.now()-w,summary:`readiness failed: ${e instanceof Error?e.message:String(e)}`}),i.push("readiness stage failed");}if(s.skipAutopilot)a$4.push({name:"autopilot",status:"skipped",durationMs:0,summary:"autopilot stage skipped"});else {let e=Date.now(),o=s.autopilotMode??"audit";try{let n=await a$3({workspacePath:t,mode:o,json:true,skipPipelineStages:true});d=n.artifacts.reportPath;let k=n.summary.verdict==="approved"?"pass":n.summary.verdict==="partial"?"warn":"fail";a$4.push({name:"autopilot",status:k,durationMs:Date.now()-e,summary:`autopilot ${o}: ${n.summary.verdict}`,exitCode:n.summary.exitCode,evidencePath:d}),k!=="pass"&&i.push(...n.blockingReasons.slice(0,5));}catch(n){l=true,a$4.push({name:"autopilot",status:"fail",durationMs:Date.now()-e,summary:`autopilot failed: ${n instanceof Error?n.message:String(n)}`}),i.push("autopilot release stage failed");}}let E=M(a$4),z=j(a$4,l),m=u.join(t,".rapidkit","reports","pipeline-last-run.json"),h={schemaVersion:"rapidkit-pipeline-v1",generatedAt:new Date().toISOString(),workspacePath:t,summary:{verdict:E,exitCode:z,stagesPassed:a$4.filter(e=>e.status==="pass").length,stagesWarn:a$4.filter(e=>e.status==="warn").length,stagesFailed:a$4.filter(e=>e.status==="fail").length},stages:a$4,blockingReasons:[...new Set(i)],artifacts:{reportPath:m,analyzeEvidencePath:p,readinessEvidencePath:f,autopilotEvidencePath:d}};return s.writeReport!==false&&(await x.ensureDir(u.dirname(m)),await x.writeJSON(m,h,{spaces:2})),h}async function L(s){let r;try{r=await C(s);}catch(t){let a=t instanceof Error?t.message:String(t);s.json?console.log(JSON.stringify({schemaVersion:"rapidkit-pipeline-error-v1",ok:false,error:{message:a}},null,2)):console.log(c.red(`Pipeline failed: ${a}`)),process.exit(1);}if(s.json)console.log(JSON.stringify(r,null,2));else {console.log(c.bold.cyan(`
2
- \u{1F517} RapidKit Governance Pipeline
3
- `)),console.log(c.bold(`Workspace: ${c.cyan(u.basename(r.workspacePath))}`)),console.log(c.gray(`Path: ${r.workspacePath}`)),console.log(c.white(`Verdict: ${r.summary.verdict} Exit: ${r.summary.exitCode} (${r.summary.stagesPassed} pass / ${r.summary.stagesWarn} warn / ${r.summary.stagesFailed} fail)`));for(let t of r.stages){let a=t.status==="pass"?c.green("PASS"):t.status==="warn"?c.yellow("WARN"):t.status==="skipped"?c.gray("SKIP"):c.red("FAIL");console.log(` - ${t.name}: ${a} ${t.summary}`);}if(r.blockingReasons.length>0){console.log(c.bold(`
4
- Blocking reasons:`));for(let t of r.blockingReasons.slice(0,8))console.log(c.gray(` \u2022 ${t}`));}console.log(c.gray(`
5
- Evidence: ${r.artifacts.reportPath}`));}r.summary.exitCode!==0&&process.exit(r.summary.exitCode);}export{C as runPipeline,L as runPipelineCommand};
@@ -1 +0,0 @@
1
- import {a as a$1}from'./chunk-752X3YI3.js';import {a}from'./chunk-RV6HBTFC.js';import c from'path';import d from'fs-extra';async function v(e,r){let o=await a(e),f=o?.name||c.basename(e),n,i=c.join(e,".python-version");if(await d.pathExists(i)){let a=(await d.readFile(i,"utf-8")).trim();a&&(n=a);}let t=r?.profile||"polyglot",u=t==="python-only"||t==="polyglot"||t==="enterprise",m=r?.installMethod||o?.metadata?.npm?.installMethod||(u?"poetry":"venv"),s=await a$1(e,{workspaceName:f,installMethod:m,pythonVersion:n,profile:t,writeMarker:true,writeGitignore:true,onlyIfMissing:!r?.force});return {workspacePath:e,created:s,status:s.length>0?"passed":"skipped"}}export{v as ensureWorkspaceFoundation};
@@ -1 +0,0 @@
1
- export{a as runWorkspaceStage}from'./chunk-KDUAZXEQ.js';
@@ -1 +0,0 @@
1
- import {m,f as f$1,c as c$1,n,e}from'./chunk-B7NCBH5B.js';import {d}from'./chunk-VPNHGQIV.js';import c from'path';import f from'fs-extra';var j="workspace-verify.v1",E=".rapidkit/reports/workspace-verify-last-run.json";function R(e,t){return c.isAbsolute(t)?t:c.join(e,t)}async function W(e$1){let t=await f.readJson(e$1);if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Workspace impact input is not a JSON object: ${e$1}`);let r=t;if(r.schemaVersion!==e)throw new Error(`Unsupported workspace impact schema: ${String(r.schemaVersion)}`);return r}function S(e){let t=new Set,r=[];for(let a of e){let i=`${a.scope}:${a.project??""}:${a.display}`;t.has(i)||(t.add(i),r.push(a));}return r}function C(e,t){if(!e||e==="workspace")return true;let r=(e.startsWith("project:")?e.slice(8):e).trim().toLowerCase();return t.scope==="workspace"?true:(t.project??"").trim().toLowerCase()===r}function I(e,t){if(e.id==="workspace.doctor")return c.join(t,".rapidkit","reports","doctor-last-run.json");if(e.id==="workspace.contract.verify")return c.join(t,".rapidkit","reports","workspace-contract-verify-last-run.json");if(e.id==="workspace.readiness")return c.join(t,".rapidkit","reports","release-readiness-last-run.json");if(e.id==="workspace.analyze")return c.join(t,".rapidkit","reports","analyze-last-run.json");if(e.id==="workspace.pipeline")return c.join(t,".rapidkit","reports","pipeline-last-run.json");if(e.id.startsWith("project.")&&(e.id.endsWith(".test")||e.id.endsWith(".build")))return c.join(t,".rapidkit","reports","workspace-run-last.json")}function l(e){return !e||typeof e!="object"||Array.isArray(e)?null:e}function V(e){let t=l(e.healthScore),r=typeof t?.errors=="number"?t.errors:0,a=typeof t?.percent=="number"?t.percent:void 0;return r>0?{status:"fail",message:`Doctor evidence reports ${r} error(s).`}:typeof a=="number"&&a<70?{status:"warn",message:`Doctor health score is ${a}%.`}:{status:"pass",message:"Doctor evidence is present and healthy."}}function A(e){let t=typeof e.overallStatus=="string"?e.overallStatus:"unknown";return t==="fail"?{status:"fail",message:"Release readiness evidence reports blocking failures."}:t==="warn"?{status:"warn",message:"Release readiness evidence reports warnings."}:t==="pass"?{status:"pass",message:"Release readiness evidence passed."}:{status:"warn",message:`Release readiness evidence status is ${t}.`}}function x(e){let t=typeof e.status=="string"?e.status:"unknown";return t==="failed"||t==="fail"?{status:"fail",message:"Workspace contract verify evidence failed."}:t==="passed"||t==="pass"?{status:"pass",message:"Workspace contract verify evidence passed."}:{status:"warn",message:`Workspace contract verify evidence status is ${t}.`}}function O(e){let t=l(e.summary);if(t?.blocking===true||e.blocking===true)return {status:"fail",message:"Analyze evidence reports blocking findings."};let a=typeof t?.status=="string"?t.status:void 0;return a==="warn"||a==="warning"?{status:"warn",message:"Analyze evidence reports warnings."}:{status:"pass",message:"Analyze evidence is present."}}function $(e){let t=l(e.summary),r=typeof t?.verdict=="string"?t.verdict:void 0;return r==="blocked"?{status:"fail",message:"Pipeline evidence is blocked."}:r==="needs-attention"?{status:"warn",message:"Pipeline evidence needs attention."}:r==="ready"?{status:"pass",message:"Pipeline evidence is ready."}:{status:"warn",message:"Pipeline evidence status is unknown."}}function _(e,t){let r=t.id.endsWith(".build")?"build":t.id.endsWith(".test")?"test":null,a=typeof e.stage=="string"?e.stage:void 0;if(r&&a&&a!==r)return {status:"missing",message:`Workspace run evidence is for stage "${a}", expected "${r}".`};let i=l(e.summary),o=typeof i?.failed=="number"?i.failed:0,n=typeof i?.exitCode=="number"?i.exitCode:0,m=Array.isArray(e.projects)?e.projects:[],p=t.project?.toLowerCase(),d=m.find(s=>{let u=l(s);if(!u||!p)return false;let P=typeof u.projectName=="string"?u.projectName.toLowerCase():"",y=typeof u.projectPath=="string"?u.projectPath.toLowerCase():"";return P===p||y.endsWith(`/${p}`)||y===p});if(d){let s=l(d),u=typeof s?.status=="string"?s.status:"unknown";if(u==="failed")return {status:"fail",message:`Workspace run evidence failed for ${t.project}.`};if(u==="passed")return {status:"pass",message:`Workspace run evidence passed for ${t.project}.`};if(u==="skipped")return {status:"warn",message:`Workspace run evidence skipped for ${t.project}.`}}return o>0||n!==0?{status:"fail",message:"Workspace run evidence reports failures."}:{status:"pass",message:"Workspace run evidence is present."}}async function M(e,t,r){let a=I(e,t),i=a?c.relative(t,a).split(c.sep).join("/"):void 0;if(e.id==="workspace.contract.verify"&&!r)return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"skipped",required:e.required,message:"Workspace contract is not present; contract verify skipped."};if(!a||!await f.pathExists(a))return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"missing",required:e.required,evidencePath:i,message:i?`Missing evidence report: ${i}`:"No evidence mapping exists for this command."};let o=l(await f.readJson(a));if(!o)return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"fail",required:e.required,evidencePath:i,message:"Evidence report is not a JSON object."};let n;return e.id==="workspace.doctor"?n=V(o):e.id==="workspace.readiness"?n=A(o):e.id==="workspace.contract.verify"?n=x(o):e.id==="workspace.analyze"?n=O(o):e.id==="workspace.pipeline"?n=$(o):e.id.startsWith("project.")?n=_(o,e):n={status:"pass",message:"Evidence report is present."},{id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:n.status,required:e.required,evidencePath:i,message:n.message}}function D(e){let t=e.filter(s=>s.status==="pass").length,r=e.filter(s=>s.status==="warn").length,a=e.filter(s=>s.status==="fail").length,i=e.filter(s=>s.status==="missing").length,o=e.filter(s=>s.status==="skipped").length,n=e.filter(s=>s.required&&(s.status==="fail"||s.status==="missing")).map(s=>`${s.id}: ${s.message}`),m=e.filter(s=>s.required&&s.status==="missing").length,p="ready",d=0;return n.length>0?(p="blocked",d=2):(r>0||m>0)&&(p="needs-attention",d=1),{verdict:p,exitCode:d,stepsPassed:t,stepsWarn:r,stepsFailed:a,stepsMissing:i,stepsSkipped:o}}async function q(e$1){let t=c.resolve(e$1.workspacePath);if(e$1.fromImpactPath){let o=R(t,e$1.fromImpactPath);return {impact:await W(o),fromImpactRef:c.relative(t,o).split(c.sep).join("/")}}let r=c.join(t,f$1);if(await f.pathExists(r))return {impact:await W(r),fromImpactRef:f$1};let a=c.join(t,c$1);if(await f.pathExists(a))return {impact:await n({workspacePath:t,fromPath:c$1,scope:e$1.scope,includeAbsolutePaths:e$1.includeAbsolutePaths,includeEvidence:e$1.includeEvidence,observableScanDepth:e$1.observableScanDepth,now:e$1.now}),fromImpactRef:c$1};let i=await d({workspacePath:t,includeAbsolutePaths:e$1.includeAbsolutePaths,includeEvidence:e$1.includeEvidence,observableScanDepth:e$1.observableScanDepth,now:e$1.now});return {impact:{schemaVersion:e,generatedAt:(e$1.now??new Date).toISOString(),fromRef:"baseline",diffRef:".rapidkit/reports/workspace-model-diff-last-run.json",workspace:{name:i.workspace.name,profile:i.workspace.profile,type:i.workspace.type},summary:{changed:false,risk:"none",affectedProjects:0,workspaceItems:0,recommendedCommands:0},affectedProjects:[],workspaceImpact:[],verificationPlan:[],agentBrief:{headline:"Baseline workspace verify run.",bullets:["No impact report or snapshot was available; baseline gates were evaluated."],unsafeAssumptions:["Do not claim runtime verification passed unless evidence exists."]},diff:{schemaVersion:"workspace-model-diff.v1",generatedAt:(e$1.now??new Date).toISOString(),fromRef:"baseline",toRef:".rapidkit/reports/workspace-model.json",fromHash:"baseline",toHash:"baseline",summary:{changed:false,addedProjects:0,removedProjects:0,changedProjects:0,workspaceChanges:0,validationChanges:0,gitChangedFiles:0},git:{available:false,dirty:false,changedFiles:0,untrackedFiles:0,deletedFiles:0},changes:[],currentModel:i}}}}async function K(e){let t=c.resolve(e.workspacePath),{impact:r,fromImpactRef:a}=await q(e),i=r.diff.currentModel,o=S([...m(),...r.verificationPlan]).filter(s=>C(e.scope,s)),n=[];for(let s of o)n.push(await M(s,t,i.contracts.exists===true));let m$1=D(n),p=n.filter(s=>s.status==="missing"&&s.evidencePath).map(s=>s.evidencePath),d=n.filter(s=>s.required&&(s.status==="fail"||s.status==="missing")).map(s=>`${s.id}: ${s.message}`);return {schemaVersion:j,generatedAt:(e.now??new Date).toISOString(),workspacePath:t,mode:"evidence",fromImpactRef:a,scope:e.scope,impact:{changed:r.summary.changed,risk:r.summary.risk,affectedProjects:r.summary.affectedProjects,recommendedCommands:r.summary.recommendedCommands},summary:m$1,steps:n,missingEvidence:p,blockingReasons:d,verificationPlan:o}}async function L(e,t){let r=c.join(t,E);return await f.ensureDir(c.dirname(r)),await f.writeJson(r,e,{spaces:2}),r}function J(e,t){return e.summary.verdict==="blocked"?2:t?.strict&&e.summary.verdict!=="ready"?1:e.summary.exitCode}export{E as WORKSPACE_VERIFY_REPORT_PATH,j as WORKSPACE_VERIFY_SCHEMA_VERSION,K as buildWorkspaceVerify,J as workspaceVerifyExitCode,L as writeWorkspaceVerify};