rapidkit 0.41.3 → 0.41.5

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 (50) hide show
  1. package/README.md +5 -0
  2. package/contracts/agent-customization-pack.v1.json +5 -0
  3. package/contracts/artifact-remediation-plan.v1.json +163 -0
  4. package/contracts/extension-cli-compatibility.v1.json +2 -1
  5. package/contracts/runtime-command-surface.v1.json +2 -0
  6. package/dist/analyze-JYHEGUSH.js +1 -0
  7. package/dist/artifact-remediation-plan-HRR3WH7T.js +3 -0
  8. package/dist/autopilot-release-ZADU63OD.js +1 -0
  9. package/dist/chunk-2E6WGUN6.js +1 -0
  10. package/dist/{chunk-O74N26AD.js → chunk-3VI4Y7LZ.js} +1 -1
  11. package/dist/{chunk-C4ASE2DV.js → chunk-FI4VMG2I.js} +1 -1
  12. package/dist/{chunk-KZLRUBQ5.js → chunk-GDWLW7GF.js} +1 -1
  13. package/dist/{chunk-3CYEVV6H.js → chunk-HCJV2ITA.js} +1 -1
  14. package/dist/chunk-LRF6PQOZ.js +1 -0
  15. package/dist/{chunk-42ARJBM7.js → chunk-P5NZE2RV.js} +1 -1
  16. package/dist/{chunk-AM5OJWXF.js → chunk-Q4HEXEDW.js} +1 -1
  17. package/dist/{chunk-DKNVDNT4.js → chunk-SO2SSVWN.js} +1 -1
  18. package/dist/{chunk-XY3SGMAJ.js → chunk-T5GS4BUP.js} +1 -1
  19. package/dist/chunk-T7B3GF3Q.js +1 -0
  20. package/dist/{chunk-6UBWN4EE.js → chunk-THSTNVE3.js} +1 -1
  21. package/dist/{chunk-XRGBKUJO.js → chunk-TXUBE6KV.js} +1 -1
  22. package/dist/{chunk-HT3G7HOV.js → chunk-U5IRABWC.js} +32 -32
  23. package/dist/{chunk-GD6VML5K.js → chunk-U7TS7W2V.js} +2 -2
  24. package/dist/{create-XTKHAYH7.js → create-P3USIH52.js} +1 -1
  25. package/dist/{doctor-4UQZIELO.js → doctor-KYNACWFC.js} +1 -1
  26. package/dist/index.d.ts +5 -2
  27. package/dist/index.js +119 -119
  28. package/dist/{pipeline-ZCJ6NVRC.js → pipeline-SU3FJUKI.js} +1 -1
  29. package/dist/{workspace-VKUBU4M4.js → workspace-5DKOA7TN.js} +1 -1
  30. package/dist/{workspace-agent-sync-QJWXK3RT.js → workspace-agent-sync-HZ4UBSZ2.js} +1 -1
  31. package/dist/{workspace-context-I5OXR6XB.js → workspace-context-R3XWWLFP.js} +1 -1
  32. package/dist/workspace-explain-5RDFGHUN.js +1 -0
  33. package/dist/{workspace-foundation-V6SLZRBY.js → workspace-foundation-H6IPS4MW.js} +1 -1
  34. package/dist/{workspace-intelligence-4SGJDZ6H.js → workspace-intelligence-5BBKUJAG.js} +1 -1
  35. package/dist/{workspace-mcp-serve-4QN7ZU6C.js → workspace-mcp-serve-TQTJ4HWI.js} +1 -1
  36. package/dist/{workspace-model-R6XYEQZO.js → workspace-model-YAC5BKLL.js} +1 -1
  37. package/dist/workspace-run-P5UOJSLQ.js +1 -0
  38. package/dist/{workspace-verify-TEQWZOXM.js → workspace-verify-5RZSDKGR.js} +1 -1
  39. package/dist/{workspace-watch-WERGZE5P.js → workspace-watch-P2PGSYDD.js} +1 -1
  40. package/docs/commands-reference.md +2 -1
  41. package/docs/contracts/ARTIFACT_CATALOG.md +11 -0
  42. package/docs/contracts/README.md +1 -0
  43. package/package.json +1 -1
  44. package/dist/analyze-UTB3PNKM.js +0 -1
  45. package/dist/autopilot-release-GBH7PIIZ.js +0 -1
  46. package/dist/chunk-JU3VNLTY.js +0 -1
  47. package/dist/chunk-TSUQQTHI.js +0 -1
  48. package/dist/workspace-explain-YFKDZRVX.js +0 -1
  49. package/dist/workspace-run-QRT3JJDB.js +0 -1
  50. /package/dist/{chunk-GH674HP5.js → chunk-DAPZJHMN.js} +0 -0
@@ -1,4 +1,4 @@
1
- import {a,b}from'./chunk-KMUWWZRT.js';import {f,e}from'./chunk-PCXSTKZ5.js';import {c as c$1}from'./chunk-NFUXULIF.js';import {a as a$1,b as b$1,d as d$1,c,f as f$1}from'./chunk-YBS2HGO3.js';import u from'chalk';import d from'fs';import h from'fs-extra';import l from'path';var $="release-readiness-v1";function I(t,e){let a=l.resolve(t);if(!b(a))return a;let s=l.join(e,".rapidkit","workspace.contract.json");if(d.existsSync(s))try{let i=JSON.parse(d.readFileSync(s,"utf-8")),n=Array.isArray(i.projects)?i.projects:[];for(let c of n){let f=p(c),g=typeof f.relativePath=="string"?f.relativePath.trim():"";if(g)return l.join(e,g)}}catch{}let r=x(e),o=Array.isArray(r.payload?.projects)?r.payload.projects:[];for(let i of o){let n=p(i),c=typeof n.path=="string"?n.path.trim():"";if(c)return l.resolve(c)}return a}function V(t){let e=a$1(t);return b$1(e,t)?"go":d$1(e,t)?"java":c(e,t)?"node":f$1(e,t)?"python":"unknown"}function O(t,e){if(!d.existsSync(t))return null;let a=d.readdirSync(t).filter(s=>s.endsWith(".json")&&e.some(r=>r.test(s))).map(s=>l.join(t,s));return a.length===0?null:(a.sort((s,r)=>d.statSync(r).mtimeMs-d.statSync(s).mtimeMs),a[0])}function p(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}async function z(t){let{readWorkspaceRegistrySummary:e,resolveWorkspaceRegisteredProjects:a}=await import('./workspace-registry-summary-X5WRUU3T.js'),s=await e(t);return s?s.projectCount:(await a(t)).summary.projectCount}function L(t,e,a){let s=l.join(t,".rapidkit","toolchain.lock");if(!d.existsSync(s))return {gate:"env",status:"fail",summary:"toolchain.lock is missing",details:["Run rapidkit bootstrap to pin runtime versions and generate a reproducible toolchain."],evidencePath:s};try{let r=JSON.parse(d.readFileSync(s,"utf-8")),o=p(r.runtime),n=["python","node","go","java"].filter(c=>{let f=p(o[c]);return typeof f.version=="string"&&f.version.trim().length>0});if(n.length===0)return {gate:"env",status:"fail",summary:"No runtime versions are pinned in toolchain.lock",details:["Pin at least one runtime version via rapidkit setup <runtime> and re-run bootstrap."],evidencePath:s};if(e!=="unknown"){let c=p(o[e]);if(typeof c.version!="string"||c.version.trim().length===0)return {gate:"env",status:"fail",summary:`${a?.hasRegisteredProjects?"Project runtime":"Workspace"} (${e}) is not pinned in toolchain.lock`,details:[`Run rapidkit setup ${e} and rapidkit bootstrap to lock ${e} for this workspace.`],evidencePath:s}}return {gate:"env",status:"pass",summary:`Pinned runtimes: ${n.join(", ")}`,details:[],evidencePath:s}}catch{return {gate:"env",status:"fail",summary:"toolchain.lock is invalid JSON",details:["Regenerate lockfile with rapidkit bootstrap."],evidencePath:s}}}function x(t){let e=l.join(t,".rapidkit","reports","doctor-last-run.json");if(!d.existsSync(e))return {payload:null,path:e};try{let a=JSON.parse(d.readFileSync(e,"utf-8"));return c$1(a,"workspace")?{payload:a,path:e}:{payload:null,path:e}}catch{return {payload:null,path:e}}}function D(t){let e=x(t);if(!e.payload)return {gate:{gate:"doctor",status:"fail",summary:"Doctor evidence is missing",details:["Run rapidkit doctor workspace --json before release readiness checks."],evidencePath:e.path},payload:null};let a=p(e.payload.summary),s=Number(a.totalIssues??0);return a.hasSystemErrors?{gate:{gate:"doctor",status:"fail",summary:"Doctor reported system errors",details:["Resolve system-level doctor errors before proceeding."],evidencePath:e.path},payload:e.payload}:s>0?{gate:{gate:"doctor",status:"warn",summary:`Doctor found ${s} issue(s)`,details:["Run rapidkit doctor workspace --fix and re-run readiness checks."],evidencePath:e.path},payload:e.payload}:{gate:{gate:"doctor",status:"pass",summary:"Doctor checks passed without issues",details:[],evidencePath:e.path},payload:e.payload}}function J(t){let e=l.join(t,".rapidkit","reports","analyze-last-run.json");if(!d.existsSync(e))return {gate:"analyze",status:"fail",summary:"Analyze evidence is missing",details:["Run rapidkit analyze --json before release readiness checks."],evidencePath:e};try{let a=JSON.parse(d.readFileSync(e,"utf-8")),s=p(a.summary),r=String(s.verdict??"").toLowerCase(),o=Number(s.score??0),i=p(s.findings),n=Number(i.fail??0);return r==="blocked"||n>0?{gate:"analyze",status:"fail",summary:`Analyze verdict is blocked (score ${o}/100)`,details:["Resolve analyze findings and regenerate analyze-last-run.json."],evidencePath:e}:r==="needs-attention"?{gate:"analyze",status:"warn",summary:`Analyze needs attention (score ${o}/100)`,details:["Review analyze warnings before release."],evidencePath:e}:{gate:"analyze",status:"pass",summary:`Analyze passed (score ${o}/100)`,details:[],evidencePath:e}}catch{return {gate:"analyze",status:"fail",summary:"Analyze evidence is invalid JSON",details:["Re-run rapidkit analyze --json to regenerate evidence."],evidencePath:e}}}function W(t){try{let e=JSON.parse(d.readFileSync(t,"utf-8")),a=String(e.status??"").toLowerCase(),s=p(e.summary),r=Number(s.failedChecks??0);return a==="fail"||r>0?{gate:"verify",status:"fail",summary:"Verify-pack contract reports failed checks",details:["Fix failed verify checks and regenerate verify-pack contract evidence."],evidencePath:t}:a==="pass"?{gate:"verify",status:"pass",summary:"Verify-pack contract passed",details:[],evidencePath:t}:{gate:"verify",status:"warn",summary:"Verify-pack contract status is not explicit",details:["Ensure contract status is pass/fail and keep schema aligned with v1 contract."],evidencePath:t}}catch{return {gate:"verify",status:"fail",summary:"Verify-pack contract is invalid JSON",details:["Regenerate verify-pack contract artifact."],evidencePath:t}}}async function F(t,e){if(e.skipVerify)return {gate:"verify",status:"pass",summary:"Verify gate skipped (--skip-verify)",details:["Verification was explicitly skipped for this readiness run."]};let a=l.join(t,".rapidkit","reports"),s=O(a,[/verify-pack-contract/i,/^verify.*\.json$/i]);if(s)return W(s);let r=l.join(a,"workspace-contract-verify-last-run.json"),o=O(a,[/workspace-contract-verify-last-run/i,/workspace-contract-verify/i]);if(o)try{let i=JSON.parse(d.readFileSync(o,"utf-8")),n=String(i.status??"").toLowerCase();if(n==="passed"||n==="pass")return {gate:"verify",status:"pass",summary:"Workspace contract verification passed (CLI cache)",details:[],evidencePath:o};if(n==="failed"||n==="fail")return {gate:"verify",status:"fail",summary:"Workspace contract verification failed (CLI cache)",details:(Array.isArray(i.violations)?i.violations:[]).slice(0,5),evidencePath:o}}catch{}try{let{verifyWorkspaceContract:i}=await import('./workspace-contract-OO4GMENV.js'),n=await i({workspacePath:t}),c={schemaVersion:"v1",source:"cli",generatedAt:new Date().toISOString(),status:n.status,contractPath:n.contractPath,projectCount:n.projectCount,checks:n.checks,violations:n.violations};return await h.ensureDir(a),await h.writeJSON(r,c,{spaces:2}),n.status==="failed"?{gate:"verify",status:"fail",summary:"Workspace contract verification failed (CLI)",details:n.violations.slice(0,5),evidencePath:r}:{gate:"verify",status:"pass",summary:"Workspace contract verification passed (CLI)",details:[],evidencePath:r}}catch(i){return {gate:"verify",status:"fail",summary:"No verify evidence and workspace contract verification unavailable",details:["Run rapidkit workspace contract verify --json or export verify-pack contract from CI.",i instanceof Error?i.message:String(i)],evidencePath:l.join(a,"*verify*.json")}}}function M(t,e){let a=l.join(e,".rapidkit","reports","doctor-last-run.json");if(!t)return {gate:"dependency",status:"warn",summary:"Dependency risk check skipped (doctor evidence missing)",details:["Run rapidkit doctor workspace --json to include dependency findings."],evidencePath:a};let s=Array.isArray(t.projects)?t.projects:[],r=s.reduce((i,n)=>{let c=Number(n.vulnerabilities??0);return Number.isFinite(c)?i+Math.max(0,c):i},0),o=s.filter(i=>i.depsInstalled===false).length;return r>0?{gate:"dependency",status:"fail",summary:`${r} dependency vulnerability(ies) reported`,details:["Resolve vulnerabilities (npm/pip/go audit pipelines) before release."],evidencePath:a}:o>0?{gate:"dependency",status:"warn",summary:`${o} project(s) report missing dependencies`,details:["Run project init/bootstrap and regenerate doctor evidence."],evidencePath:a}:{gate:"dependency",status:"pass",summary:"No dependency vulnerabilities reported",details:[],evidencePath:a}}function _(t){return t.some(e=>e.status==="fail")?"fail":t.some(e=>e.status==="warn")?"warn":"pass"}async function K(t,e){let a=l.join(t,".rapidkit","reports","release-readiness-last-run.json");return await h.ensureDir(l.dirname(a)),await h.writeJSON(a,e,{spaces:2}),a}async function H(t={}){let e$1=l.resolve(t.startPath??process.cwd()),a$1=a(e$1)??e$1,s=await z(a$1)>0,r=s&&b(e$1)?a$1:I(e$1,a$1),o=r===a$1?"unknown":V(r),n=L(a$1,s?o:"unknown",{hasRegisteredProjects:s}),c=D(a$1),f$1=J(a$1),g=await F(a$1,{skipVerify:t.skipVerify}),G=M(c.payload,a$1),k=[n,c.gate,f$1,g,G],v=_(k),m={schemaVersion:$,generatedAt:new Date().toISOString(),workspacePath:a$1,projectPath:r,action:t.action,overallStatus:v,blocking:v==="fail",blockingReasons:k.filter(y=>y.status==="fail").map(y=>`${y.gate}: ${y.summary}`),gates:k};if(t.writeReport!==false){let y=f(m,{commandId:"workspaceReadiness",exitCode:v==="fail"?2:v==="warn"?1:0,generatedAt:m.generatedAt,blockers:m.blockingReasons,runId:e()});m.evidencePath=await K(a$1,y);}return m}function B(t){return t==="pass"?u.green("PASS"):t==="warn"?u.yellow("WARN"):u.red("FAIL")}function U(t){return t==="pass"?u.green("PASS"):t==="warn"?u.yellow("WARN"):u.red("FAIL")}async function ne(t){let e=await H({writeReport:true,skipVerify:t.skipVerify===true});if(t.json)console.log(JSON.stringify(e,null,2));else {console.log(u.bold.cyan(`
1
+ import {f,e}from'./chunk-PCXSTKZ5.js';import {a,b}from'./chunk-KMUWWZRT.js';import {c as c$1}from'./chunk-NFUXULIF.js';import {a as a$1,b as b$1,d as d$1,c,f as f$1}from'./chunk-YBS2HGO3.js';import u from'chalk';import d from'fs';import h from'fs-extra';import l from'path';var $="release-readiness-v1";function I(t,e){let a=l.resolve(t);if(!b(a))return a;let s=l.join(e,".rapidkit","workspace.contract.json");if(d.existsSync(s))try{let i=JSON.parse(d.readFileSync(s,"utf-8")),n=Array.isArray(i.projects)?i.projects:[];for(let c of n){let f=p(c),g=typeof f.relativePath=="string"?f.relativePath.trim():"";if(g)return l.join(e,g)}}catch{}let r=x(e),o=Array.isArray(r.payload?.projects)?r.payload.projects:[];for(let i of o){let n=p(i),c=typeof n.path=="string"?n.path.trim():"";if(c)return l.resolve(c)}return a}function V(t){let e=a$1(t);return b$1(e,t)?"go":d$1(e,t)?"java":c(e,t)?"node":f$1(e,t)?"python":"unknown"}function O(t,e){if(!d.existsSync(t))return null;let a=d.readdirSync(t).filter(s=>s.endsWith(".json")&&e.some(r=>r.test(s))).map(s=>l.join(t,s));return a.length===0?null:(a.sort((s,r)=>d.statSync(r).mtimeMs-d.statSync(s).mtimeMs),a[0])}function p(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}async function z(t){let{readWorkspaceRegistrySummary:e,resolveWorkspaceRegisteredProjects:a}=await import('./workspace-registry-summary-X5WRUU3T.js'),s=await e(t);return s?s.projectCount:(await a(t)).summary.projectCount}function L(t,e,a){let s=l.join(t,".rapidkit","toolchain.lock");if(!d.existsSync(s))return {gate:"env",status:"fail",summary:"toolchain.lock is missing",details:["Run rapidkit bootstrap to pin runtime versions and generate a reproducible toolchain."],evidencePath:s};try{let r=JSON.parse(d.readFileSync(s,"utf-8")),o=p(r.runtime),n=["python","node","go","java"].filter(c=>{let f=p(o[c]);return typeof f.version=="string"&&f.version.trim().length>0});if(n.length===0)return {gate:"env",status:"fail",summary:"No runtime versions are pinned in toolchain.lock",details:["Pin at least one runtime version via rapidkit setup <runtime> and re-run bootstrap."],evidencePath:s};if(e!=="unknown"){let c=p(o[e]);if(typeof c.version!="string"||c.version.trim().length===0)return {gate:"env",status:"fail",summary:`${a?.hasRegisteredProjects?"Project runtime":"Workspace"} (${e}) is not pinned in toolchain.lock`,details:[`Run rapidkit setup ${e} and rapidkit bootstrap to lock ${e} for this workspace.`],evidencePath:s}}return {gate:"env",status:"pass",summary:`Pinned runtimes: ${n.join(", ")}`,details:[],evidencePath:s}}catch{return {gate:"env",status:"fail",summary:"toolchain.lock is invalid JSON",details:["Regenerate lockfile with rapidkit bootstrap."],evidencePath:s}}}function x(t){let e=l.join(t,".rapidkit","reports","doctor-last-run.json");if(!d.existsSync(e))return {payload:null,path:e};try{let a=JSON.parse(d.readFileSync(e,"utf-8"));return c$1(a,"workspace")?{payload:a,path:e}:{payload:null,path:e}}catch{return {payload:null,path:e}}}function D(t){let e=x(t);if(!e.payload)return {gate:{gate:"doctor",status:"fail",summary:"Doctor evidence is missing",details:["Run rapidkit doctor workspace --json before release readiness checks."],evidencePath:e.path},payload:null};let a=p(e.payload.summary),s=Number(a.totalIssues??0);return a.hasSystemErrors?{gate:{gate:"doctor",status:"fail",summary:"Doctor reported system errors",details:["Resolve system-level doctor errors before proceeding."],evidencePath:e.path},payload:e.payload}:s>0?{gate:{gate:"doctor",status:"warn",summary:`Doctor found ${s} issue(s)`,details:["Run rapidkit doctor workspace --fix and re-run readiness checks."],evidencePath:e.path},payload:e.payload}:{gate:{gate:"doctor",status:"pass",summary:"Doctor checks passed without issues",details:[],evidencePath:e.path},payload:e.payload}}function J(t){let e=l.join(t,".rapidkit","reports","analyze-last-run.json");if(!d.existsSync(e))return {gate:"analyze",status:"fail",summary:"Analyze evidence is missing",details:["Run rapidkit analyze --json before release readiness checks."],evidencePath:e};try{let a=JSON.parse(d.readFileSync(e,"utf-8")),s=p(a.summary),r=String(s.verdict??"").toLowerCase(),o=Number(s.score??0),i=p(s.findings),n=Number(i.fail??0);return r==="blocked"||n>0?{gate:"analyze",status:"fail",summary:`Analyze verdict is blocked (score ${o}/100)`,details:["Resolve analyze findings and regenerate analyze-last-run.json."],evidencePath:e}:r==="needs-attention"?{gate:"analyze",status:"warn",summary:`Analyze needs attention (score ${o}/100)`,details:["Review analyze warnings before release."],evidencePath:e}:{gate:"analyze",status:"pass",summary:`Analyze passed (score ${o}/100)`,details:[],evidencePath:e}}catch{return {gate:"analyze",status:"fail",summary:"Analyze evidence is invalid JSON",details:["Re-run rapidkit analyze --json to regenerate evidence."],evidencePath:e}}}function W(t){try{let e=JSON.parse(d.readFileSync(t,"utf-8")),a=String(e.status??"").toLowerCase(),s=p(e.summary),r=Number(s.failedChecks??0);return a==="fail"||r>0?{gate:"verify",status:"fail",summary:"Verify-pack contract reports failed checks",details:["Fix failed verify checks and regenerate verify-pack contract evidence."],evidencePath:t}:a==="pass"?{gate:"verify",status:"pass",summary:"Verify-pack contract passed",details:[],evidencePath:t}:{gate:"verify",status:"warn",summary:"Verify-pack contract status is not explicit",details:["Ensure contract status is pass/fail and keep schema aligned with v1 contract."],evidencePath:t}}catch{return {gate:"verify",status:"fail",summary:"Verify-pack contract is invalid JSON",details:["Regenerate verify-pack contract artifact."],evidencePath:t}}}async function F(t,e){if(e.skipVerify)return {gate:"verify",status:"pass",summary:"Verify gate skipped (--skip-verify)",details:["Verification was explicitly skipped for this readiness run."]};let a=l.join(t,".rapidkit","reports"),s=O(a,[/verify-pack-contract/i,/^verify.*\.json$/i]);if(s)return W(s);let r=l.join(a,"workspace-contract-verify-last-run.json"),o=O(a,[/workspace-contract-verify-last-run/i,/workspace-contract-verify/i]);if(o)try{let i=JSON.parse(d.readFileSync(o,"utf-8")),n=String(i.status??"").toLowerCase();if(n==="passed"||n==="pass")return {gate:"verify",status:"pass",summary:"Workspace contract verification passed (CLI cache)",details:[],evidencePath:o};if(n==="failed"||n==="fail")return {gate:"verify",status:"fail",summary:"Workspace contract verification failed (CLI cache)",details:(Array.isArray(i.violations)?i.violations:[]).slice(0,5),evidencePath:o}}catch{}try{let{verifyWorkspaceContract:i}=await import('./workspace-contract-OO4GMENV.js'),n=await i({workspacePath:t}),c={schemaVersion:"v1",source:"cli",generatedAt:new Date().toISOString(),status:n.status,contractPath:n.contractPath,projectCount:n.projectCount,checks:n.checks,violations:n.violations};return await h.ensureDir(a),await h.writeJSON(r,c,{spaces:2}),n.status==="failed"?{gate:"verify",status:"fail",summary:"Workspace contract verification failed (CLI)",details:n.violations.slice(0,5),evidencePath:r}:{gate:"verify",status:"pass",summary:"Workspace contract verification passed (CLI)",details:[],evidencePath:r}}catch(i){return {gate:"verify",status:"fail",summary:"No verify evidence and workspace contract verification unavailable",details:["Run rapidkit workspace contract verify --json or export verify-pack contract from CI.",i instanceof Error?i.message:String(i)],evidencePath:l.join(a,"*verify*.json")}}}function M(t,e){let a=l.join(e,".rapidkit","reports","doctor-last-run.json");if(!t)return {gate:"dependency",status:"warn",summary:"Dependency risk check skipped (doctor evidence missing)",details:["Run rapidkit doctor workspace --json to include dependency findings."],evidencePath:a};let s=Array.isArray(t.projects)?t.projects:[],r=s.reduce((i,n)=>{let c=Number(n.vulnerabilities??0);return Number.isFinite(c)?i+Math.max(0,c):i},0),o=s.filter(i=>i.depsInstalled===false).length;return r>0?{gate:"dependency",status:"fail",summary:`${r} dependency vulnerability(ies) reported`,details:["Resolve vulnerabilities (npm/pip/go audit pipelines) before release."],evidencePath:a}:o>0?{gate:"dependency",status:"warn",summary:`${o} project(s) report missing dependencies`,details:["Run project init/bootstrap and regenerate doctor evidence."],evidencePath:a}:{gate:"dependency",status:"pass",summary:"No dependency vulnerabilities reported",details:[],evidencePath:a}}function _(t){return t.some(e=>e.status==="fail")?"fail":t.some(e=>e.status==="warn")?"warn":"pass"}async function K(t,e){let a=l.join(t,".rapidkit","reports","release-readiness-last-run.json");return await h.ensureDir(l.dirname(a)),await h.writeJSON(a,e,{spaces:2}),a}async function H(t={}){let e$1=l.resolve(t.startPath??process.cwd()),a$1=a(e$1)??e$1,s=await z(a$1)>0,r=s&&b(e$1)?a$1:I(e$1,a$1),o=r===a$1?"unknown":V(r),n=L(a$1,s?o:"unknown",{hasRegisteredProjects:s}),c=D(a$1),f$1=J(a$1),g=await F(a$1,{skipVerify:t.skipVerify}),G=M(c.payload,a$1),k=[n,c.gate,f$1,g,G],v=_(k),m={schemaVersion:$,generatedAt:new Date().toISOString(),workspacePath:a$1,projectPath:r,action:t.action,overallStatus:v,blocking:v==="fail",blockingReasons:k.filter(y=>y.status==="fail").map(y=>`${y.gate}: ${y.summary}`),gates:k};if(t.writeReport!==false){let y=f(m,{commandId:"workspaceReadiness",exitCode:v==="fail"?2:v==="warn"?1:0,generatedAt:m.generatedAt,blockers:m.blockingReasons,runId:e()});m.evidencePath=await K(a$1,y);}return m}function B(t){return t==="pass"?u.green("PASS"):t==="warn"?u.yellow("WARN"):u.red("FAIL")}function U(t){return t==="pass"?u.green("PASS"):t==="warn"?u.yellow("WARN"):u.red("FAIL")}async function ne(t){let e=await H({writeReport:true,skipVerify:t.skipVerify===true});if(t.json)console.log(JSON.stringify(e,null,2));else {console.log(u.bold.cyan(`
2
2
  \u{1F6A6} RapidKit Release Readiness
3
3
  `)),console.log(u.bold(`Workspace: ${u.cyan(l.basename(e.workspacePath))}`)),console.log(u.gray(`Path: ${e.workspacePath}`)),console.log(`Overall: ${U(e.overallStatus)}`);for(let a of e.gates){console.log(` - ${a.gate}: ${B(a.status)} ${a.summary}`);for(let s of a.details)console.log(u.gray(` ${s}`));a.evidencePath&&console.log(u.gray(` evidence: ${a.evidencePath}`));}e.evidencePath&&console.log(u.gray(`
4
4
  Evidence saved: ${e.evidencePath}`));}t.strict&&e.overallStatus!=="pass"&&process.exit(1);}export{H as a,ne as b};
@@ -1,4 +1,4 @@
1
- import {a,b}from'./chunk-KMUWWZRT.js';import {f as f$1,e}from'./chunk-PCXSTKZ5.js';import {h,i}from'./chunk-UZW5QFRW.js';import {a as a$1}from'./chunk-TDSIF42O.js';import y from'fs';import o from'path';import s from'chalk';var T=new Set([".git",".rapidkit",".venv","node_modules","dist","build","target","coverage","htmlcov",".next"]);async function k(e){try{return await y.promises.access(e,y.constants.F_OK),true}catch{return false}}async function z(e){try{let n=JSON.parse(await y.promises.readFile(e,"utf-8"));return n&&typeof n=="object"&&!Array.isArray(n)?n:null}catch{return null}}async function N(e){try{return await y.promises.readFile(e,"utf-8")}catch{return ""}}function O(e){return a(e)}async function K(e,n){return await k(o.join(e,".rapidkit","project.json"))||await k(o.join(e,".rapidkit","context.json"))?true:b(e)?false:o.resolve(e)===o.resolve(n)?h(e).length>0:h(e).length>0}async function M(e){let n=await a$1(e,{skipDirs:T,includeHiddenDirs:false,descendIntoMatchedProjects:false,isProjectDir:K});return n.length>0?n:b(e)?[]:h(e).length>0?[e]:[]}function _(e,n){return o.relative(e,n).replace(/\\/g,"/")||"."}async function A(e,n){for(let t of n)if(await k(o.join(e,t)))return true;return false}async function J(e){return A(e,["health","health.ts","health.js","health.py","health.go","health.kt","health.rb","health.php","healthcheck","health-check","src/health.ts","src/health.js","src/health.py","src/health.go","src/health.kt","src/health.rb","src/health.php","src/healthcheck.ts","src/healthcheck.js","src/liveness.ts","src/readiness.ts","src/ping.ts"])}async function W(e){if(await A(e,["tests","test","__tests__","src/__tests__","pytest.ini","vitest.config.ts","jest.config.ts"]))return true;let t=await z(o.join(e,"package.json")),i=t?.scripts&&typeof t.scripts=="object"?t.scripts:{};return typeof i.test=="string"&&i.test.trim().length>0}async function H(e){let n=await z(o.join(e,"package.json")),t=n?.scripts&&typeof n.scripts=="object"?n.scripts:{};return Object.keys(t).sort()}function f(e,n,t,i,r,d){return {id:e,severity:n,target:t,title:i,detail:r,remediation:d}}function B(e){let n=e.reduce((t,i)=>i.severity==="fail"?t+28:i.severity==="warn"?t+12:t+3,0);return Math.max(0,100-n)}async function U(e,n){let t=await z(o.join(n,".rapidkit","project.json")),i$1=i(n,t),r=h(n),d=i$1.runtime==="unknown"?r[0]||"unknown":i$1.runtime,a=_(e,n),p=a,g=await H(n),u=await k(o.join(n,".rapidkit","project.json"))||await k(o.join(n,".rapidkit","context.json")),l=await W(n),h$1=await A(n,["Dockerfile","dockerfile"]),w=await A(n,[".env.example","env.example","config/env.example"]),P=await A(n,[".github/workflows/ci.yml",".github/workflows/ci.yaml",".github/workflows/main.yml",".github/workflows/build.yml",".github/workflows/test.yml",".github/workflows/deploy.yml",".gitlab-ci.yml",".circleci/config.yml","azure-pipelines.yml","bitbucket-pipelines.yml","cloudbuild.yaml"]),R=await J(n),m=[];return i$1.key==="unknown"&&m.push(f("project.stack.unknown","fail",p,"Project stack is unknown","RapidKit cannot confidently classify this backend project.","Add .rapidkit/project.json metadata or import the project with `rapidkit import`.")),u||m.push(f("project.marker.missing","warn",p,"RapidKit marker is missing","The project can be detected by files, but it is not registered with RapidKit metadata.","Run `rapidkit import <path>` from a workspace or create the project through RapidKit.")),l||m.push(f("project.tests.missing","warn",p,"Test entrypoint is missing","No common test folder, config, or package test script was found.","Add a test command so `rapidkit workspace run test --affected` can gate changes.")),w||m.push(f("project.env.example.missing","info",p,"Environment example is missing","No .env.example or env.example file was found.","Add an env example for onboarding and CI secret documentation.")),P||m.push(f("project.ci.missing","warn",p,"Continuous integration is missing","No recognized CI/CD configuration file was detected for this project.","Add CI configuration so tests and checks run automatically for every change.")),R||m.push(f("project.health.missing","info",p,"Health or readiness probe is missing","The project has no obvious health or readiness endpoint to support automated deployment and runtime checks.","Add a simple health endpoint and document it for readiness gates and observability.")),h$1||m.push(f("project.container.missing","info",p,"Container recipe is missing","No Dockerfile was found for this project.","Add a Dockerfile when the service is intended for containerized deployment.")),{name:o.basename(n),path:n,relativePath:a,runtime:d,framework:i$1.key,confidence:i$1.confidence,supportTier:i$1.supportTier,hasRapidKitMarker:u,hasTests:l,hasDockerfile:h$1,hasEnvExample:w,hasCiConfig:P,hasHealthEndpoint:R,scripts:g,findings:m,score:B(m)}}function V(e){return e.name.toLowerCase()}async function L(e){let n=new Map(e.map(r=>[V(r),r])),t=[];for(let r of e){let d=await z(o.join(r.path,"package.json")),a={...d?.dependencies??{},...d?.devDependencies??{},...d?.peerDependencies??{}};for(let g of Object.keys(a)){let u=g.replace(/^@[^/]+\//,"").toLowerCase(),l=n.get(u);l&&l.relativePath!==r.relativePath&&t.push({from:r.relativePath,to:l.relativePath,kind:"package"});}let p=await N(o.join(r.path,"pyproject.toml"));for(let g of e)g.relativePath!==r.relativePath&&p.includes(g.name)&&t.push({from:r.relativePath,to:g.relativePath,kind:"workspace-reference"});}let i=new Set;return t.filter(r=>{let d=`${r.from}\0${r.to}\0${r.kind}`;return i.has(d)?false:(i.add(d),true)})}function q(e,n){let t=new Map;for(let i of e)t.set(i.relativePath,{project:i.relativePath,directDependents:0,directDependencies:0});for(let i of n){let r=t.get(i.from),d=t.get(i.to);r&&(r.directDependencies+=1),d&&(d.directDependents+=1);}return Array.from(t.values()).sort((i,r)=>r.directDependents-i.directDependents||r.directDependencies-i.directDependencies)}async function Q(e){let n=await z(o.join(e,".rapidkit","workspace.json"));return typeof n?.profile=="string"?n.profile:null}function X(e){return {fail:e.filter(n=>n.severity==="fail").length,warn:e.filter(n=>n.severity==="warn").length,info:e.filter(n=>n.severity==="info").length}}function Y(e){if(e.projectCount===0)return e.workspaceDetected?["Add your first project: npx rapidkit create project <name> --kit <kit>","Import an existing service: npx rapidkit import <path>"]:["Create a RapidKit workspace: npx rapidkit create workspace my-workspace --profile polyglot","Import an existing service: npx rapidkit import ../service"];let n=[];return e.findings.some(t=>t.id==="workspace.marker.missing")&&n.push("Initialize workspace metadata with `rapidkit bootstrap --profile polyglot`."),e.findings.some(t=>t.id==="project.marker.missing")&&n.push("Register detected projects with `rapidkit import <path>` or recreate them via `rapidkit create project`."),e.findings.some(t=>t.id==="project.tests.missing")&&n.push("Add test entrypoints, then gate changes with `rapidkit workspace run test --affected --strict`."),e.findings.some(t=>t.id==="project.ci.missing")&&n.push("Add CI/CD configuration to catch regressions early and make workspace health checks actionable."),e.findings.some(t=>t.id==="project.health.missing")&&n.push("Add a health/readiness endpoint so runtime probes and deployment checks can verify service health."),e.hasGraph||n.push("Create `.rapidkit/workspace-dependency-graph.json` or use analyze output as the first graph seed."),n.push("Run `rapidkit autopilot release --mode audit --json` before release."),Array.from(new Set(n))}async function ce(e$1={}){let n=o.resolve(e$1.workspacePath||process.cwd());if(!await k(n))throw new Error(`Workspace path does not exist: ${n}`);let t=O(n)??n,i=await k(o.join(t,".rapidkit-workspace"))||await k(o.join(t,".rapidkit","workspace.json")),r=await Q(t),d=await M(t),a=await Promise.all(d.map(c=>U(t,c))),p=await L(a),g=q(a,p),u=[];i||u.push(f("workspace.marker.missing","warn",".","Workspace metadata is missing","The directory can be analyzed, but it is not a registered RapidKit workspace.","Run `rapidkit create workspace` or `rapidkit bootstrap --profile polyglot` in a workspace root.")),a.length===0&&u.push(f("workspace.projects.missing","warn",".","No backend projects detected","RapidKit did not find runtime markers or project metadata under this root.","Create a project with `rapidkit create project` or import one with `rapidkit import <path>`."));let l=[...u,...a.flatMap(c=>c.findings)],h=X(l),w={};for(let c of a)w[c.runtime]=(w[c.runtime]||0)+1;let P=a.length>0?Math.round(a.reduce((c,v)=>c+v.score,0)/a.length):0,R=u.reduce((c,v)=>c+(v.severity==="fail"?20:v.severity==="warn"?8:2),0),m=Math.max(0,P-R),E=a.length===0&&h.fail===0&&l.length>0&&l.every(c=>c.id==="workspace.projects.missing"&&c.severity==="warn"),S=h.fail>0||e$1.strict&&h.warn>0&&!E?"blocked":h.warn>0?"needs-attention":"ready",j={schemaVersion:"rapidkit-analyze-v1",generatedAt:new Date().toISOString(),workspacePath:t,workspaceDetected:i,profile:r,summary:{score:m,verdict:S,projectCount:a.length,runtimeCount:Object.keys(w).length,findings:h},runtimes:w,projects:a,dependencyGraph:{status:p.length>0?"generated":"empty",edges:p,topImpactedProjects:g.slice(0,5)},findings:l,nextActions:Y({findings:l,projectCount:a.length,hasGraph:p.length>0,workspaceDetected:i}),enterpriseControls:{jsonReady:true,ciGateCommand:"rapidkit analyze --json --strict",releaseGateCommand:"rapidkit autopilot release --mode enforce --json",evidencePath:".rapidkit/reports/analyze-last-run.json"}};if(e$1.output&&(await y.promises.mkdir(o.dirname(o.resolve(e$1.output)),{recursive:true}),await y.promises.writeFile(o.resolve(e$1.output),`${JSON.stringify(j,null,2)}
1
+ import {f as f$1,e}from'./chunk-PCXSTKZ5.js';import {a,b}from'./chunk-KMUWWZRT.js';import {h,i}from'./chunk-UZW5QFRW.js';import {a as a$1}from'./chunk-TDSIF42O.js';import y from'fs';import o from'path';import s from'chalk';var T=new Set([".git",".rapidkit",".venv","node_modules","dist","build","target","coverage","htmlcov",".next"]);async function k(e){try{return await y.promises.access(e,y.constants.F_OK),true}catch{return false}}async function z(e){try{let n=JSON.parse(await y.promises.readFile(e,"utf-8"));return n&&typeof n=="object"&&!Array.isArray(n)?n:null}catch{return null}}async function N(e){try{return await y.promises.readFile(e,"utf-8")}catch{return ""}}function O(e){return a(e)}async function K(e,n){return await k(o.join(e,".rapidkit","project.json"))||await k(o.join(e,".rapidkit","context.json"))?true:b(e)?false:o.resolve(e)===o.resolve(n)?h(e).length>0:h(e).length>0}async function M(e){let n=await a$1(e,{skipDirs:T,includeHiddenDirs:false,descendIntoMatchedProjects:false,isProjectDir:K});return n.length>0?n:b(e)?[]:h(e).length>0?[e]:[]}function _(e,n){return o.relative(e,n).replace(/\\/g,"/")||"."}async function A(e,n){for(let t of n)if(await k(o.join(e,t)))return true;return false}async function J(e){return A(e,["health","health.ts","health.js","health.py","health.go","health.kt","health.rb","health.php","healthcheck","health-check","src/health.ts","src/health.js","src/health.py","src/health.go","src/health.kt","src/health.rb","src/health.php","src/healthcheck.ts","src/healthcheck.js","src/liveness.ts","src/readiness.ts","src/ping.ts"])}async function W(e){if(await A(e,["tests","test","__tests__","src/__tests__","pytest.ini","vitest.config.ts","jest.config.ts"]))return true;let t=await z(o.join(e,"package.json")),i=t?.scripts&&typeof t.scripts=="object"?t.scripts:{};return typeof i.test=="string"&&i.test.trim().length>0}async function H(e){let n=await z(o.join(e,"package.json")),t=n?.scripts&&typeof n.scripts=="object"?n.scripts:{};return Object.keys(t).sort()}function f(e,n,t,i,r,d){return {id:e,severity:n,target:t,title:i,detail:r,remediation:d}}function B(e){let n=e.reduce((t,i)=>i.severity==="fail"?t+28:i.severity==="warn"?t+12:t+3,0);return Math.max(0,100-n)}async function U(e,n){let t=await z(o.join(n,".rapidkit","project.json")),i$1=i(n,t),r=h(n),d=i$1.runtime==="unknown"?r[0]||"unknown":i$1.runtime,a=_(e,n),p=a,g=await H(n),u=await k(o.join(n,".rapidkit","project.json"))||await k(o.join(n,".rapidkit","context.json")),l=await W(n),h$1=await A(n,["Dockerfile","dockerfile"]),w=await A(n,[".env.example","env.example","config/env.example"]),P=await A(n,[".github/workflows/ci.yml",".github/workflows/ci.yaml",".github/workflows/main.yml",".github/workflows/build.yml",".github/workflows/test.yml",".github/workflows/deploy.yml",".gitlab-ci.yml",".circleci/config.yml","azure-pipelines.yml","bitbucket-pipelines.yml","cloudbuild.yaml"]),R=await J(n),m=[];return i$1.key==="unknown"&&m.push(f("project.stack.unknown","fail",p,"Project stack is unknown","RapidKit cannot confidently classify this backend project.","Add .rapidkit/project.json metadata or import the project with `rapidkit import`.")),u||m.push(f("project.marker.missing","warn",p,"RapidKit marker is missing","The project can be detected by files, but it is not registered with RapidKit metadata.","Run `rapidkit import <path>` from a workspace or create the project through RapidKit.")),l||m.push(f("project.tests.missing","warn",p,"Test entrypoint is missing","No common test folder, config, or package test script was found.","Add a test command so `rapidkit workspace run test --affected` can gate changes.")),w||m.push(f("project.env.example.missing","info",p,"Environment example is missing","No .env.example or env.example file was found.","Add an env example for onboarding and CI secret documentation.")),P||m.push(f("project.ci.missing","warn",p,"Continuous integration is missing","No recognized CI/CD configuration file was detected for this project.","Add CI configuration so tests and checks run automatically for every change.")),R||m.push(f("project.health.missing","info",p,"Health or readiness probe is missing","The project has no obvious health or readiness endpoint to support automated deployment and runtime checks.","Add a simple health endpoint and document it for readiness gates and observability.")),h$1||m.push(f("project.container.missing","info",p,"Container recipe is missing","No Dockerfile was found for this project.","Add a Dockerfile when the service is intended for containerized deployment.")),{name:o.basename(n),path:n,relativePath:a,runtime:d,framework:i$1.key,confidence:i$1.confidence,supportTier:i$1.supportTier,hasRapidKitMarker:u,hasTests:l,hasDockerfile:h$1,hasEnvExample:w,hasCiConfig:P,hasHealthEndpoint:R,scripts:g,findings:m,score:B(m)}}function V(e){return e.name.toLowerCase()}async function L(e){let n=new Map(e.map(r=>[V(r),r])),t=[];for(let r of e){let d=await z(o.join(r.path,"package.json")),a={...d?.dependencies??{},...d?.devDependencies??{},...d?.peerDependencies??{}};for(let g of Object.keys(a)){let u=g.replace(/^@[^/]+\//,"").toLowerCase(),l=n.get(u);l&&l.relativePath!==r.relativePath&&t.push({from:r.relativePath,to:l.relativePath,kind:"package"});}let p=await N(o.join(r.path,"pyproject.toml"));for(let g of e)g.relativePath!==r.relativePath&&p.includes(g.name)&&t.push({from:r.relativePath,to:g.relativePath,kind:"workspace-reference"});}let i=new Set;return t.filter(r=>{let d=`${r.from}\0${r.to}\0${r.kind}`;return i.has(d)?false:(i.add(d),true)})}function q(e,n){let t=new Map;for(let i of e)t.set(i.relativePath,{project:i.relativePath,directDependents:0,directDependencies:0});for(let i of n){let r=t.get(i.from),d=t.get(i.to);r&&(r.directDependencies+=1),d&&(d.directDependents+=1);}return Array.from(t.values()).sort((i,r)=>r.directDependents-i.directDependents||r.directDependencies-i.directDependencies)}async function Q(e){let n=await z(o.join(e,".rapidkit","workspace.json"));return typeof n?.profile=="string"?n.profile:null}function X(e){return {fail:e.filter(n=>n.severity==="fail").length,warn:e.filter(n=>n.severity==="warn").length,info:e.filter(n=>n.severity==="info").length}}function Y(e){if(e.projectCount===0)return e.workspaceDetected?["Add your first project: npx rapidkit create project <name> --kit <kit>","Import an existing service: npx rapidkit import <path>"]:["Create a RapidKit workspace: npx rapidkit create workspace my-workspace --profile polyglot","Import an existing service: npx rapidkit import ../service"];let n=[];return e.findings.some(t=>t.id==="workspace.marker.missing")&&n.push("Initialize workspace metadata with `rapidkit bootstrap --profile polyglot`."),e.findings.some(t=>t.id==="project.marker.missing")&&n.push("Register detected projects with `rapidkit import <path>` or recreate them via `rapidkit create project`."),e.findings.some(t=>t.id==="project.tests.missing")&&n.push("Add test entrypoints, then gate changes with `rapidkit workspace run test --affected --strict`."),e.findings.some(t=>t.id==="project.ci.missing")&&n.push("Add CI/CD configuration to catch regressions early and make workspace health checks actionable."),e.findings.some(t=>t.id==="project.health.missing")&&n.push("Add a health/readiness endpoint so runtime probes and deployment checks can verify service health."),e.hasGraph||n.push("Create `.rapidkit/workspace-dependency-graph.json` or use analyze output as the first graph seed."),n.push("Run `rapidkit autopilot release --mode audit --json` before release."),Array.from(new Set(n))}async function ce(e$1={}){let n=o.resolve(e$1.workspacePath||process.cwd());if(!await k(n))throw new Error(`Workspace path does not exist: ${n}`);let t=O(n)??n,i=await k(o.join(t,".rapidkit-workspace"))||await k(o.join(t,".rapidkit","workspace.json")),r=await Q(t),d=await M(t),a=await Promise.all(d.map(c=>U(t,c))),p=await L(a),g=q(a,p),u=[];i||u.push(f("workspace.marker.missing","warn",".","Workspace metadata is missing","The directory can be analyzed, but it is not a registered RapidKit workspace.","Run `rapidkit create workspace` or `rapidkit bootstrap --profile polyglot` in a workspace root.")),a.length===0&&u.push(f("workspace.projects.missing","warn",".","No backend projects detected","RapidKit did not find runtime markers or project metadata under this root.","Create a project with `rapidkit create project` or import one with `rapidkit import <path>`."));let l=[...u,...a.flatMap(c=>c.findings)],h=X(l),w={};for(let c of a)w[c.runtime]=(w[c.runtime]||0)+1;let P=a.length>0?Math.round(a.reduce((c,v)=>c+v.score,0)/a.length):0,R=u.reduce((c,v)=>c+(v.severity==="fail"?20:v.severity==="warn"?8:2),0),m=Math.max(0,P-R),E=a.length===0&&h.fail===0&&l.length>0&&l.every(c=>c.id==="workspace.projects.missing"&&c.severity==="warn"),S=h.fail>0||e$1.strict&&h.warn>0&&!E?"blocked":h.warn>0?"needs-attention":"ready",j={schemaVersion:"rapidkit-analyze-v1",generatedAt:new Date().toISOString(),workspacePath:t,workspaceDetected:i,profile:r,summary:{score:m,verdict:S,projectCount:a.length,runtimeCount:Object.keys(w).length,findings:h},runtimes:w,projects:a,dependencyGraph:{status:p.length>0?"generated":"empty",edges:p,topImpactedProjects:g.slice(0,5)},findings:l,nextActions:Y({findings:l,projectCount:a.length,hasGraph:p.length>0,workspaceDetected:i}),enterpriseControls:{jsonReady:true,ciGateCommand:"rapidkit analyze --json --strict",releaseGateCommand:"rapidkit autopilot release --mode enforce --json",evidencePath:".rapidkit/reports/analyze-last-run.json"}};if(e$1.output&&(await y.promises.mkdir(o.dirname(o.resolve(e$1.output)),{recursive:true}),await y.promises.writeFile(o.resolve(e$1.output),`${JSON.stringify(j,null,2)}
2
2
  `)),!e$1.output&&i){let c=o.join(t,".rapidkit","reports","analyze-last-run.json");await y.promises.mkdir(o.dirname(c),{recursive:true});let v=f$1(j,{commandId:"workspaceAnalyze",exitCode:j.summary.verdict==="blocked"?2:j.summary.verdict==="needs-attention"?1:0,generatedAt:j.generatedAt,blockers:j.findings.filter(x=>x.severity==="fail").map(x=>x.title).slice(0,12),runId:e()});await y.promises.writeFile(c,`${JSON.stringify(v,null,2)}
3
3
  `);}return j}function de(e){let n=e.summary.verdict==="ready"?s.green:e.summary.verdict==="needs-attention"?s.yellow:s.red;if(console.log(s.bold(`
4
4
  RapidKit Workspace Analysis
@@ -1,2 +1,2 @@
1
- import {n,d,e}from'./chunk-TSUQQTHI.js';import {a}from'./chunk-3PTJID76.js';import u from'path';import v from'fs-extra';var $="workspace-context.v1",M=".rapidkit/reports/workspace-context-agent.json";function F(e){if(typeof e!="string"||!e.trim()||e==="true")return "generic";let t=e.trim().toLowerCase();return t==="codex"||t==="claude"||t==="cursor"||t==="orca"?t:"generic"}function x(e){return `npx --yes --package rapidkit rapidkit ${e}`.trim()}function C(e){return `npx rapidkit ${e}`.trim()}function i(e){return {id:e.id,scope:e.scope,display:C(e.args),execute:x(e.args),description:e.description,...e.project?{project:e.project}:{},freshness:d({id:`command.${e.id}`,label:`${e.id} command`,scope:"command",value:{display:C(e.args),execute:x(e.args)},...e.project?{project:e.project}:{},freshness:{kind:"derived",category:"structure",generatedAt:e.generatedAt,now:e.now,sourceArtifact:".rapidkit/reports/workspace-model.json",sourcePath:`safeCommands.${e.id}`,reason:"Safe command surfaces are derived from workspace model command capabilities."}}).freshness}}function W(e,t){return `workspace run ${t} --scope project:${e.name}`}function R(e){return (e.startsWith("project:")?e.slice(8):e).trim().toLowerCase()}function E(e){return [e.name,e.path,u.basename(e.path),e.absolutePath].filter(t=>typeof t=="string"&&t.trim().length>0).map(t=>t.trim().toLowerCase())}function T(e,t,o){let r={generatedAt:e.generatedAt,now:o},a=[i({id:"workspace.model",scope:"workspace",args:"workspace model --json",description:"Read the canonical workspace intelligence model.",...r}),i({id:"workspace.doctor",scope:"workspace",args:"doctor workspace --json",description:"Check workspace health before claiming verification.",...r}),i({id:"workspace.pipeline",scope:"workspace",args:"pipeline --json",description:"Run the governed sync, doctor, analyze, readiness, and autopilot loop.",...r}),i({id:"workspace.contract.verify",scope:"workspace",args:"workspace contract verify --json",description:"Verify workspace contract and dependency edges.",...r}),i({id:"workspace.verify",scope:"workspace",args:"workspace verify --json",description:"Evaluate evidence freshness and verification gates before release decisions.",...r})],c=t?[t]:e.projects;for(let n of c)n.commands.fleetStages.includes("test")&&a.push(i({id:`project.${n.name}.test`,scope:"project",project:n.name,args:W(n,"test"),description:`Run tests for ${n.name} through workspace orchestration.`,...r})),n.commands.fleetStages.includes("build")&&a.push(i({id:`project.${n.name}.build`,scope:"project",project:n.name,args:W(n,"build"),description:`Build ${n.name} through workspace orchestration.`,...r}));return a}function O(e){return e.commands.fleetStages.filter(t=>t==="test"||t==="build").map(t=>`workspace run ${t}`)}function D(e,t){if(!t?.startsWith("project:"))return;let o=R(t);if(o)return e.projects.find(r=>E(r).includes(o))}function V(e,t,o){let r=[...e.validation?.issues??[]];t?.startsWith("project:")&&!o&&r.push({severity:"error",code:"context.scope.project.missing",message:`Requested project scope was not found: ${t}`,target:t});let a=r.filter(n=>n.severity==="error").length,c=r.filter(n=>n.severity==="warning").length;return {status:a>0?"failed":c>0?"warning":"passed",errors:a,warnings:c,issues:r}}function I(e){let t=[],o=[];for(let[r,a]of Object.entries(e.evidence))a?.exists?t.push(`${r}: ${a.path}`):o.push(r);return {available:t.sort(),missing:o.sort()}}function N(e){let t=e.summary.projectCount,o=e.summary.runtimes.length?e.summary.runtimes.join(", "):"no runtime",r=e.identity.surfaces.length?e.identity.surfaces.join(", "):"no detected surfaces";return `${e.workspace.name} is a ${e.identity.workspaceType} with ${t} project${t===1?"":"s"}, ${o} runtime coverage, and ${r}.`}function _(e){let t=["Do not claim a command passed unless a report or command output proves it.","Do not infer secrets or environment values from file names.","Do not change project scope without checking the selected project."];return e.contracts.exists||t.push("Workspace contract is missing; dependency and API edges may be incomplete."),e.summary.observedProjects>0&&t.push("Some projects are observed rather than first-class; command support may be partial."),t}async function L(e$1){let t=e$1.model??await n({workspacePath:e$1.workspacePath,includeEvidence:e$1.includeEvidence===true,observableScanDepth:e$1.observableScanDepth,now:e$1.now}),o=F(e$1.agent),r=D(t,e$1.scope),a=V(t,e$1.scope,r);if(e$1.strict===true&&a.status!=="passed"){let s=a.issues.map(p=>`${p.severity}:${p.code}:${p.target}`).join(", ");throw new Error(`Workspace context strict validation failed: ${s}`)}let c=e$1.now??new Date,n$1=t.facts??[],b=new Set((r?[r]:t.projects).map(s=>s.name)),g=n$1.filter(s=>s.project?b.has(s.project):true),S=(r?[r]:t.projects).map(s=>{let p=g.filter(P=>P.project===s.name);return {name:s.name,path:s.path,kind:s.kind,runtime:s.runtime,framework:s.frameworkDisplayName,...s.generator?{generator:s.generator}:{},createCapability:s.createCapability,supportTier:s.supportTier,safeCommands:O(s),importantFiles:s.importantFiles,facts:p}}),d$1=I(t),f=N(t),k=T(t,r,c),A=k.map(s=>d({id:`context.command.${s.id}`,label:`${s.id} safe command`,scope:"command",value:{display:s.display,execute:s.execute,scope:s.scope},...s.project?{project:s.project}:{},freshness:{kind:"derived",category:"structure",generatedAt:t.generatedAt,now:c,sourceArtifact:".rapidkit/reports/workspace-context-agent.json",sourcePath:`safeCommands.${s.id}`,reason:"Context safe commands are derived from workspace model command capabilities."}})),h=[...g,...A],m=e({facts:h,generatedAt:c.toISOString(),now:c});return {schemaVersion:$,generatedAt:c.toISOString(),agent:o,workspaceSummary:f,modelRef:".rapidkit/reports/workspace-model.json",workspace:{name:t.workspace.name,root:t.workspace.root,type:t.identity.workspaceType,...t.workspace.profile?{profile:t.workspace.profile}:{}},scope:{requested:e$1.scope??"workspace",...r?{activeProject:r.name}:{}},projects:S,safeCommands:k,facts:h,factFreshness:m,evidence:d$1,policies:{mode:t.policies.mode,source:t.policies.source},contracts:{exists:t.contracts.exists,path:t.contracts.workspaceContractPath},validation:a,agentInstructions:["Read `.rapidkit/reports/INDEX.json` first, then this context pack and linked evidence reports.","Use this context as the workspace source of truth before inspecting random files.","Prefer workspace-level evidence over generic framework assumptions.","Use `display` commands when explaining steps to a human.","Use `execute` commands when launching commands from automation or tooling.","Treat `facts[].freshness.verifyBeforeUse` as a hard refresh requirement before using that fact in advice, fixes, or release decisions.","Do not carry extracted facts beyond their freshness contract; re-read or regenerate evidence when the contract says stale, unknown, live, or verify-before-use.","Keep project-scoped advice tied to the active project scope.","Regenerate stale grounding with `npx rapidkit workspace agent-sync --write --refresh-context`."],unsafeAssumptions:[..._(t),...m.verifyBeforeUseFacts>0?[`${m.verifyBeforeUseFacts} fact(s) require verification before use; do not treat them as durable workspace structure.`]:[]],humanSummary:[f,`Evidence available: ${d$1.available.length}. Missing evidence groups: ${d$1.missing.join(", ")||"none"}.`,r?`Active project scope: ${r.name} (${r.frameworkDisplayName}).`:"Scope: whole workspace."].join(`
1
+ import {n,d,e}from'./chunk-LRF6PQOZ.js';import {a}from'./chunk-3PTJID76.js';import u from'path';import v from'fs-extra';var $="workspace-context.v1",M=".rapidkit/reports/workspace-context-agent.json";function F(e){if(typeof e!="string"||!e.trim()||e==="true")return "generic";let t=e.trim().toLowerCase();return t==="codex"||t==="claude"||t==="cursor"||t==="orca"?t:"generic"}function x(e){return `npx --yes --package rapidkit rapidkit ${e}`.trim()}function C(e){return `npx rapidkit ${e}`.trim()}function i(e){return {id:e.id,scope:e.scope,display:C(e.args),execute:x(e.args),description:e.description,...e.project?{project:e.project}:{},freshness:d({id:`command.${e.id}`,label:`${e.id} command`,scope:"command",value:{display:C(e.args),execute:x(e.args)},...e.project?{project:e.project}:{},freshness:{kind:"derived",category:"structure",generatedAt:e.generatedAt,now:e.now,sourceArtifact:".rapidkit/reports/workspace-model.json",sourcePath:`safeCommands.${e.id}`,reason:"Safe command surfaces are derived from workspace model command capabilities."}}).freshness}}function W(e,t){return `workspace run ${t} --scope project:${e.name}`}function R(e){return (e.startsWith("project:")?e.slice(8):e).trim().toLowerCase()}function E(e){return [e.name,e.path,u.basename(e.path),e.absolutePath].filter(t=>typeof t=="string"&&t.trim().length>0).map(t=>t.trim().toLowerCase())}function T(e,t,o){let r={generatedAt:e.generatedAt,now:o},a=[i({id:"workspace.model",scope:"workspace",args:"workspace model --json",description:"Read the canonical workspace intelligence model.",...r}),i({id:"workspace.doctor",scope:"workspace",args:"doctor workspace --json",description:"Check workspace health before claiming verification.",...r}),i({id:"workspace.pipeline",scope:"workspace",args:"pipeline --json",description:"Run the governed sync, doctor, analyze, readiness, and autopilot loop.",...r}),i({id:"workspace.contract.verify",scope:"workspace",args:"workspace contract verify --json",description:"Verify workspace contract and dependency edges.",...r}),i({id:"workspace.verify",scope:"workspace",args:"workspace verify --json",description:"Evaluate evidence freshness and verification gates before release decisions.",...r})],c=t?[t]:e.projects;for(let n of c)n.commands.fleetStages.includes("test")&&a.push(i({id:`project.${n.name}.test`,scope:"project",project:n.name,args:W(n,"test"),description:`Run tests for ${n.name} through workspace orchestration.`,...r})),n.commands.fleetStages.includes("build")&&a.push(i({id:`project.${n.name}.build`,scope:"project",project:n.name,args:W(n,"build"),description:`Build ${n.name} through workspace orchestration.`,...r}));return a}function O(e){return e.commands.fleetStages.filter(t=>t==="test"||t==="build").map(t=>`workspace run ${t}`)}function D(e,t){if(!t?.startsWith("project:"))return;let o=R(t);if(o)return e.projects.find(r=>E(r).includes(o))}function V(e,t,o){let r=[...e.validation?.issues??[]];t?.startsWith("project:")&&!o&&r.push({severity:"error",code:"context.scope.project.missing",message:`Requested project scope was not found: ${t}`,target:t});let a=r.filter(n=>n.severity==="error").length,c=r.filter(n=>n.severity==="warning").length;return {status:a>0?"failed":c>0?"warning":"passed",errors:a,warnings:c,issues:r}}function I(e){let t=[],o=[];for(let[r,a]of Object.entries(e.evidence))a?.exists?t.push(`${r}: ${a.path}`):o.push(r);return {available:t.sort(),missing:o.sort()}}function N(e){let t=e.summary.projectCount,o=e.summary.runtimes.length?e.summary.runtimes.join(", "):"no runtime",r=e.identity.surfaces.length?e.identity.surfaces.join(", "):"no detected surfaces";return `${e.workspace.name} is a ${e.identity.workspaceType} with ${t} project${t===1?"":"s"}, ${o} runtime coverage, and ${r}.`}function _(e){let t=["Do not claim a command passed unless a report or command output proves it.","Do not infer secrets or environment values from file names.","Do not change project scope without checking the selected project."];return e.contracts.exists||t.push("Workspace contract is missing; dependency and API edges may be incomplete."),e.summary.observedProjects>0&&t.push("Some projects are observed rather than first-class; command support may be partial."),t}async function L(e$1){let t=e$1.model??await n({workspacePath:e$1.workspacePath,includeEvidence:e$1.includeEvidence===true,observableScanDepth:e$1.observableScanDepth,now:e$1.now}),o=F(e$1.agent),r=D(t,e$1.scope),a=V(t,e$1.scope,r);if(e$1.strict===true&&a.status!=="passed"){let s=a.issues.map(p=>`${p.severity}:${p.code}:${p.target}`).join(", ");throw new Error(`Workspace context strict validation failed: ${s}`)}let c=e$1.now??new Date,n$1=t.facts??[],b=new Set((r?[r]:t.projects).map(s=>s.name)),g=n$1.filter(s=>s.project?b.has(s.project):true),S=(r?[r]:t.projects).map(s=>{let p=g.filter(P=>P.project===s.name);return {name:s.name,path:s.path,kind:s.kind,runtime:s.runtime,framework:s.frameworkDisplayName,...s.generator?{generator:s.generator}:{},createCapability:s.createCapability,supportTier:s.supportTier,safeCommands:O(s),importantFiles:s.importantFiles,facts:p}}),d$1=I(t),f=N(t),k=T(t,r,c),A=k.map(s=>d({id:`context.command.${s.id}`,label:`${s.id} safe command`,scope:"command",value:{display:s.display,execute:s.execute,scope:s.scope},...s.project?{project:s.project}:{},freshness:{kind:"derived",category:"structure",generatedAt:t.generatedAt,now:c,sourceArtifact:".rapidkit/reports/workspace-context-agent.json",sourcePath:`safeCommands.${s.id}`,reason:"Context safe commands are derived from workspace model command capabilities."}})),h=[...g,...A],m=e({facts:h,generatedAt:c.toISOString(),now:c});return {schemaVersion:$,generatedAt:c.toISOString(),agent:o,workspaceSummary:f,modelRef:".rapidkit/reports/workspace-model.json",workspace:{name:t.workspace.name,root:t.workspace.root,type:t.identity.workspaceType,...t.workspace.profile?{profile:t.workspace.profile}:{}},scope:{requested:e$1.scope??"workspace",...r?{activeProject:r.name}:{}},projects:S,safeCommands:k,facts:h,factFreshness:m,evidence:d$1,policies:{mode:t.policies.mode,source:t.policies.source},contracts:{exists:t.contracts.exists,path:t.contracts.workspaceContractPath},validation:a,agentInstructions:["Read `.rapidkit/reports/INDEX.json` first, then this context pack and linked evidence reports.","Use this context as the workspace source of truth before inspecting random files.","Prefer workspace-level evidence over generic framework assumptions.","Use `display` commands when explaining steps to a human.","Use `execute` commands when launching commands from automation or tooling.","Treat `facts[].freshness.verifyBeforeUse` as a hard refresh requirement before using that fact in advice, fixes, or release decisions.","Do not carry extracted facts beyond their freshness contract; re-read or regenerate evidence when the contract says stale, unknown, live, or verify-before-use.","Keep project-scoped advice tied to the active project scope.","Regenerate stale grounding with `npx rapidkit workspace agent-sync --write --refresh-context`."],unsafeAssumptions:[..._(t),...m.verifyBeforeUseFacts>0?[`${m.verifyBeforeUseFacts} fact(s) require verification before use; do not treat them as durable workspace structure.`]:[]],humanSummary:[f,`Evidence available: ${d$1.available.length}. Missing evidence groups: ${d$1.missing.join(", ")||"none"}.`,r?`Active project scope: ${r.name} (${r.frameworkDisplayName}).`:"Scope: whole workspace."].join(`
2
2
  `)}}async function G(e,t){let o=u.join(t,M);return await v.ensureDir(u.dirname(o)),await v.writeJSON(o,a(e),{spaces:2}),o}export{$ as a,M as b,L as c,G as d};
@@ -0,0 +1 @@
1
+ import {b as b$1}from'./chunk-CDCYRBAY.js';import {r,j}from'./chunk-E5ZVQL3C.js';import {f}from'./chunk-OLDPVVSV.js';import {b}from'./chunk-MIWDCR6I.js';import f$1,{promises}from'fs';import i from'path';import j$1,{homedir}from'os';import {pathToFileURL}from'url';import l from'process';function R(t){let r=t.label.indexOf(" \u2014 ");return r>=0?t.label.slice(r+3).trim():t.label.trim()}function E(){let t=r().map(r=>({value:r.id,label:R(r),hint:r.description,name:r.label})),e=j().map(r=>({value:r.kitId,label:r.displayName,hint:r.commandDisplay("my-app"),name:`${r.displayName} \u2014 ${r.framework}`}));return [...t,...e]}var _=".rapidkitrc.json",F=["rapidkit.config.js","rapidkit.config.mjs","rapidkit.config.cjs"];async function yt(){let t=i.join(j$1.homedir(),_);try{let e=await promises.readFile(t,"utf-8"),r=JSON.parse(e);return f.debug(`Loaded config from ${t}`),r}catch{return f.debug("No user config found, using defaults"),{}}}async function vt(t=process.cwd()){let e=t,r=i.parse(e).root;for(;e!==r;){for(let n of F){let o=i.join(e,n);try{await promises.access(o),f.debug(`Found config file: ${o}`);let m=await import(pathToFileURL(o).href),P=m.default||m;return f.debug(`Loaded RapidKit config from ${n}`),P}catch{continue}}e=i.dirname(e);}return f.debug("No RapidKit config file found, using defaults"),{}}function bt(t,e,r){return {author:r.author||e.workspace?.defaultAuthor||t.author,pythonVersion:r.pythonVersion||e.workspace?.pythonVersion||t.pythonVersion,defaultInstallMethod:r.defaultInstallMethod||e.workspace?.installMethod||t.defaultInstallMethod,defaultKit:r.defaultKit||e.projects?.defaultKit||t.defaultKit,skipGit:r.skipGit??e.projects?.skipGit??t.skipGit,license:r.license||t.license,testRapidKitPath:r.testRapidKitPath||t.testRapidKitPath}}function wt(t){return process.env.RAPIDKIT_DEV_PATH||t.testRapidKitPath||void 0}var x="workspai",Rt="Workspai";function L(t){return f$1.existsSync(i.join(t,".rapidkit-workspace"))||f$1.existsSync(i.join(t,".rapidkit","workspace.json"))}function g(t=homedir()){return i.join(t,"rapidkit","workspaces")}function K(t=homedir()){return i.join(t,"Workspai","rapidkits")}function y(t,e=homedir()){return i.join(g(e),t)}function U(t,e=homedir()){return [y(t,e),i.join(K(e),t)]}function D(t,e={}){let r=e.homeDir??homedir();return e.outputDir?i.resolve(e.outputDir,t):y(t,r)}function Et(t,e=homedir()){for(let r of U(t,e))if(f$1.existsSync(r))return r}function jt(t,e="my-workspace"){let r=1;for(;;){let n=r===1?e:`${e}-${r}`,o=i.join(t,n);if(!f$1.existsSync(o))return {name:n,targetPath:o};r+=1;}}function S(t=homedir()){return [i.join(g(t),x),i.join(K(t),x)]}function Mt(t=homedir()){for(let e of S(t))if(L(e))return e;return y(x,t)}function T(t,e){let r=t.indexOf(e);if(r>=0&&r+1<t.length)return t[r+1];let n=t.find(o=>o.startsWith(`${e}=`));if(n)return n.slice(e.length+1)}function N(t){return t.includes("--here")}function W(t,e=l.cwd()){if(N(t))return i.resolve(e);let r=T(t,"--output");if(r)return i.resolve(r)}function $t(t,e=l.cwd()){let r=i.resolve(t),n=i.resolve(e),o=i.relative(n,r);return o.length>0&&!o.startsWith("..")&&!i.isAbsolute(o)?`cd ${o}`:`cd ${r}`}function Gt(t,e={}){let r=e.argv??[],n=e.outputParent??W(r,l.cwd());return D(t.trim(),{homeDir:e.homeDir,outputDir:n})}function Ot(t,e,r={}){return t?i.resolve(t)===i.resolve(e)?true:r.outputParent===void 0:false}async function Vt(t,e={}){let r=e.cwd??l.cwd(),n=e.homeDir??homedir(),o=W(t,r);if(o!==void 0)return o;let h=e.hasYes??(t.includes("--yes")||t.includes("-y"));if(!(e.interactive??(!h&&!!l.stdin.isTTY&&!b())))return;let P=g(n),{location:A}=await b$1([{type:"rawlist",name:"location",message:"Where should the workspace be created?",choices:[{value:"managed",label:"Managed home",hint:P},{value:"here",label:"Current directory",hint:r}],default:0}]);if(A==="here")return i.resolve(r)}export{E as a,yt as b,vt as c,bt as d,wt as e,Rt as f,g,Et as h,jt as i,Mt as j,$t as k,Gt as l,Ot as m,Vt as n};
@@ -1,2 +1,2 @@
1
- import {n,k as k$1,j}from'./chunk-TSUQQTHI.js';import {a as a$1}from'./chunk-HTYMXMQM.js';import {c}from'./chunk-S5KTATOU.js';import {a}from'./chunk-3PTJID76.js';import de from'crypto';import m from'path';import y from'fs-extra';import {spawnSync}from'child_process';function F(e,t){let r=spawnSync("git",t,{cwd:e,encoding:"utf8",stdio:["ignore","pipe","ignore"]});return r.status!==0?{ok:false,stdout:""}:{ok:true,stdout:(r.stdout??"").trim()}}function pe(e){let t=[],r=[],n=[];for(let c of e.split(`
1
+ import {n,k as k$1,j}from'./chunk-LRF6PQOZ.js';import {a as a$1}from'./chunk-HTYMXMQM.js';import {c}from'./chunk-S5KTATOU.js';import {a}from'./chunk-3PTJID76.js';import de from'crypto';import m from'path';import y from'fs-extra';import {spawnSync}from'child_process';function F(e,t){let r=spawnSync("git",t,{cwd:e,encoding:"utf8",stdio:["ignore","pipe","ignore"]});return r.status!==0?{ok:false,stdout:""}:{ok:true,stdout:(r.stdout??"").trim()}}function pe(e){let t=[],r=[],n=[];for(let c of e.split(`
2
2
  `)){if(!c.trim())continue;let a=c.slice(0,2),i=c.slice(3).trim();if(i){if(a==="??"){r.push(i);continue}a.includes("D")&&n.push(i),t.push(i);}}return {changedFiles:[...new Set(t)].sort(),untrackedFiles:[...new Set(r)].sort(),deletedFiles:[...new Set(n)].sort()}}function L(e,t){let r={available:false,dirty:false,changedFiles:[],untrackedFiles:[],deletedFiles:[]},n=F(e,["rev-parse","--is-inside-work-tree"]);if(!n.ok||n.stdout!=="true")return r;let c=F(e,["rev-parse","--abbrev-ref","HEAD"]),a=F(e,["rev-parse","HEAD"]),i=F(e,["status","--porcelain=v1","--untracked-files=all"]),p=pe(i.stdout),f=p.changedFiles.length>0||p.untrackedFiles.length>0||p.deletedFiles.length>0;return {available:true,branch:c.ok?c.stdout:void 0,commit:a.ok?a.stdout:void 0,ref:t?.ref,dirty:f,changedFiles:p.changedFiles,untrackedFiles:p.untrackedFiles,deletedFiles:p.deletedFiles}}var X="workspace-model-snapshot.v1",V="workspace-model-diff.v1",$=".rapidkit/reports/workspace-model-snapshot.json",Z=".rapidkit/reports/workspace-model-diff-last-run.json",le="workspace-impact.v1",fe=".rapidkit/reports/workspace-impact-last-run.json";function ee(e){let t=e.trim().toLowerCase();return t==="git"||t.startsWith("git:")}function me(e){let t=e.trim();return t.toLowerCase()==="git"?"HEAD":t.toLowerCase().startsWith("git:")&&t.slice(4).trim()||"HEAD"}function _(e){if(Array.isArray(e))return e.map(t=>_(t));if(e&&typeof e=="object"){let t={};for(let r of Object.keys(e).sort())t[r]=_(e[r]);return t}return e}function k(e){return JSON.stringify(_(e))}function ue(e){return e.facts?.map(t=>({...t,freshness:{schemaVersion:t.freshness.schemaVersion,kind:t.freshness.kind,category:t.freshness.category,ttlSeconds:t.freshness.ttlSeconds,verifyBeforeUse:t.freshness.verifyBeforeUse,sourceArtifact:t.freshness.sourceArtifact,sourcePath:t.freshness.sourcePath,inputsHash:t.freshness.inputsHash,reason:t.freshness.reason}}))}function E(e){let{runId:t,...r}=e,n={...r,generatedAt:"<ignored>",graph:e.graph?{...e.graph,generatedAt:"<ignored>"}:void 0,facts:ue(e),factFreshness:e.factFreshness?{schemaVersion:e.factFreshness.schemaVersion,totalFacts:e.factFreshness.totalFacts,liveFacts:e.factFreshness.liveFacts,verifyBeforeUseFacts:e.factFreshness.verifyBeforeUseFacts,byKind:e.factFreshness.byKind,byCategory:e.factFreshness.byCategory}:void 0,validation:e.validation?{...e.validation,issues:e.validation.issues.map(c=>({...c})).sort((c,a)=>{let i=`${c.severity}:${c.code}:${c.target}:${c.message}`,p=`${a.severity}:${a.code}:${a.target}:${a.message}`;return i.localeCompare(p)})}:void 0};return de.createHash("sha256").update(k(n)).digest("hex")}function te(e,t){return m.isAbsolute(t)?t:m.join(e,t)}async function ge(e){let t=await y.readJson(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Workspace model input is not a JSON object: ${e}`);let r=t;if(r.schemaVersion===X){let n=r;if(!n.model||n.model.schemaVersion!==j)throw new Error(`Invalid workspace model snapshot: ${e}`);return {model:n.model,hash:n.modelHash||E(n.model)}}if(r.schemaVersion===j){let n=r;return {model:n,hash:E(n)}}throw r.schemaVersion===V?new Error(`workspace diff --from received a diff report (${m.basename(e)}). Use a workspace model snapshot or model report as baseline, e.g. ${$}. To analyze an existing diff report, run: npx rapidkit workspace impact --from ${m.basename(e)} --json`):new Error(`Unsupported workspace model input schema: ${String(r.schemaVersion)}`)}async function ke(e){let t=await y.readJson(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Workspace diff input is not a JSON object: ${e}`);let r=t;if(r.schemaVersion!==V)return null;let n=r;if(!n.currentModel||n.currentModel.schemaVersion!==j||!n.summary||!Array.isArray(n.changes))throw new Error(`Invalid workspace model diff report: ${e}`);return n}async function Ne(e){let t=e.model??await n({workspacePath:e.workspacePath,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,observableScanDepth:e.observableScanDepth,now:e.now});return {schemaVersion:X,generatedAt:(e.now??new Date).toISOString(),modelHash:E(t),modelRef:k$1,model:t}}async function Be(e,t){let r=m.join(t,$);return await y.ensureDir(m.dirname(r)),await y.writeJson(r,a(e),{spaces:2}),r}function A(e){return {name:e.name,path:e.path,kind:e.kind,runtime:e.runtime,framework:e.framework,generator:e.generator,supportTier:e.supportTier,commands:e.commands,importantFiles:e.importantFiles}}function h(e,t){e.push(t);}function he(e,t){let r=[],n=["name","profile","type"],c=["workspaceType","surfaces","runtimeFamilies","businessCapabilities"];for(let a of n){let i=e.workspace[a],p=t.workspace[a];k(i)!==k(p)&&h(r,{type:"workspace.changed",severity:"info",target:`workspace.${a}`,message:`Workspace metadata field changed: ${String(a)}`,before:i,after:p});}for(let a of c){let i=e.identity[a],p=t.identity[a];k(i)!==k(p)&&h(r,{type:"workspace.changed",severity:"info",target:`identity.${a}`,message:`Workspace identity field changed: ${String(a)}`,before:i,after:p});}return k(e.policies)!==k(t.policies)&&h(r,{type:"workspace.changed",severity:"warning",target:"policies",message:"Workspace policy summary changed.",before:e.policies,after:t.policies}),k(e.evidence)!==k(t.evidence)&&h(r,{type:"workspace.changed",severity:"info",target:"evidence",message:"Workspace evidence summary changed.",before:e.evidence,after:t.evidence}),k(e.discovery)!==k(t.discovery)&&h(r,{type:"workspace.changed",severity:"info",target:"discovery",message:"Workspace discovery settings changed.",before:e.discovery,after:t.discovery}),e.contracts.exists!==t.contracts.exists&&h(r,{type:"workspace.changed",severity:t.contracts.exists?"info":"warning",target:t.contracts.workspaceContractPath,message:"Workspace contract presence changed.",before:e.contracts.exists,after:t.contracts.exists}),r}function we(e,t){let r=e.validation??null,n=t.validation??null;return k(r)===k(n)?[]:[{type:"validation.changed",severity:n?.status==="failed"?"critical":"warning",target:"validation",message:"Workspace model validation changed.",before:r,after:n}]}function ye(e,t){let r=[],n=new Map(e.projects.map(a=>[a.path,a])),c=new Map(t.projects.map(a=>[a.path,a]));for(let[a,i]of c.entries()){let p=n.get(a);if(!p){h(r,{type:"project.added",severity:"info",target:a,message:`Project added: ${i.name}`,after:A(i)});continue}let f=A(p),l=A(i);if(k(f)!==k(l)){let g=p.runtime!==i.runtime||p.framework!==i.framework;h(r,{type:"project.changed",severity:g?"warning":"info",target:a,message:`Project changed: ${i.name}`,before:f,after:l});}}for(let[a,i]of n.entries())c.has(a)||h(r,{type:"project.removed",severity:"warning",target:a,message:`Project removed: ${i.name}`,before:A(i)});return r.sort((a,i)=>`${a.type}:${a.target}`.localeCompare(`${i.type}:${i.target}`))}async function We(e){let t=m.resolve(e.workspacePath),r=ee(e.fromPath),n$1=r?me(e.fromPath):void 0,c=e.fromPath;if(r){let u=m.join(t,$);if(!await y.pathExists(u))throw new Error("Git-aware workspace diff requires an existing snapshot at .rapidkit/reports/workspace-model-snapshot.json. Run: npx rapidkit workspace snapshot --json");c=$;}let a=te(t,c),i=await ge(a),p=e.model??await n({workspacePath:t,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,observableScanDepth:e.observableScanDepth,now:e.now}),f=E(p),l=[...he(i.model,p),...ye(i.model,p),...we(i.model,p)],g;e.includeGitObservation!==false&&(g=e.gitObservation??L(t,{ref:n$1}),g.available&&Me(l,g,p));let b=l.filter(u=>u.type.startsWith("git.")).length,C=i.hash!==f,W=r?`git:${n$1??"HEAD"}`:m.relative(t,a).split(m.sep).join("/");return {schemaVersion:V,generatedAt:(e.now??new Date).toISOString(),fromRef:W,toRef:k$1,fromHash:i.hash,toHash:f,summary:{changed:C||b>0,addedProjects:l.filter(u=>u.type==="project.added").length,removedProjects:l.filter(u=>u.type==="project.removed").length,changedProjects:l.filter(u=>u.type==="project.changed").length,workspaceChanges:l.filter(u=>u.type==="workspace.changed").length,validationChanges:l.filter(u=>u.type==="validation.changed").length,gitChangedFiles:b},git:g?.available?Pe(g,n$1):{available:false,dirty:false,changedFiles:0,untrackedFiles:0,deletedFiles:0},changes:l,currentModel:p}}async function Ke(e,t){let r=m.join(t,Z);return await y.ensureDir(m.dirname(r)),await y.writeJson(r,a(e),{spaces:2}),r}function P(e){return {none:0,low:1,medium:2,high:3,critical:4}[e]}function J(e){return e.reduce((t,r)=>P(r)>P(t)?r:t,"none")}var T=["none","low","medium","high","critical"];function ve(e){let t=Math.max(1,P(e)-1);return T[t]}function be(e){let t=Math.min(T.length-1,P(e)+1);return T[t]}function U(e){return e.join(" ")}function w(e,t,r,n){return {id:e,label:t,scope:n.scope,project:n.project,display:U(["npx","rapidkit",...r]),execute:U(["npx","--yes","--package","rapidkit","rapidkit",...r]),required:n.required!==false}}function Y(e){let t=`project:${e.name}`,r=e.commands.fleetStages;return [w(`project.${e.name}.init`,`Run init for ${e.name}`,["workspace","run","init","--scope",t,"--json"],{scope:"project",project:e.name,required:r.includes("init")}),w(`project.${e.name}.test`,`Run tests for ${e.name}`,["workspace","run","test","--scope",t,"--json"],{scope:"project",project:e.name,required:r.includes("test")}),w(`project.${e.name}.build`,`Run build for ${e.name}`,["workspace","run","build","--scope",t,"--json"],{scope:"project",project:e.name,required:r.includes("build")}),w(`project.${e.name}.start`,`Run start for ${e.name}`,["workspace","run","start","--scope",t,"--json"],{scope:"project",project:e.name,required:r.includes("start")})]}function D(){return [w("workspace.doctor","Run workspace doctor",["doctor","workspace","--json"],{scope:"workspace"}),w("workspace.contract.verify","Verify workspace contract",["workspace","contract","verify","--json"],{scope:"workspace"}),w("workspace.readiness","Run release readiness",["readiness","--json"],{scope:"workspace"}),w("workspace.analyze","Run workspace analyze",["analyze","--json"],{scope:"workspace",required:false}),w("workspace.pipeline","Run governance pipeline",["pipeline","--json"],{scope:"workspace",required:false}),w("workspace.doctor-fix","Verify doctor fix result",["doctor","workspace","--fix","--json"],{scope:"workspace",required:false})]}function je(e,t){let r=t.split(m.sep).join("/");return e.projects.filter(c=>{let a=c.path.split(m.sep).join("/");return r===a||r.startsWith(`${a}/`)}).sort((c,a)=>a.path.length-c.path.length)[0]}function Me(e,t,r){let n=new Set(e.map(a=>a.target)),c=(a,i)=>{let p=i.split(m.sep).join("/"),f=`git:${p}`;if(n.has(f))return;let l=je(r,p),g=l?`${l.name} (${l.path})`:"workspace";h(e,{type:a,severity:a==="git.deleted"?"warning":"info",target:f,message:`Git ${a==="git.untracked"?"untracked":a==="git.deleted"?"deleted":"changed"} file affects ${g}: ${p}`,after:{path:p,project:l?.name,projectPath:l?.path}}),n.add(f);};for(let a of t.changedFiles)c("git.file.changed",a);for(let a of t.untrackedFiles)c("git.untracked",a);for(let a of t.deletedFiles)c("git.deleted",a);}function Pe(e,t){return {available:true,ref:t??e.ref,branch:e.branch,commit:e.commit,dirty:e.dirty,changedFiles:e.changedFiles.length,untrackedFiles:e.untrackedFiles.length,deletedFiles:e.deletedFiles.length}}function Ie(e){let t=new Set,r=[];for(let n of e){let c=`${n.scope}:${n.project??""}:${n.display}`;t.has(c)||(t.add(c),r.push(n));}return r}function Ce(e){return e.type==="project.removed"?"high":e.severity==="critical"?"critical":e.severity==="warning"?"high":("medium")}function Re(e,t){return e.severity==="critical"?"critical":e.target==="policies"||e.target.includes("contract")?"high":e.type==="validation.changed"?(t?.projectCount??0)===0?"low":"high":e.target==="evidence"?"low":e.severity==="warning"?"medium":"low"}function Oe(e){return e.affectedProjects>0||e.projectCount>0||!e.changes.every(r=>r.severity==="critical"?false:r.type.startsWith("git.")||r.type==="validation.changed")?e.risk:P(e.risk)>=P("high")||e.risk==="medium"?"low":e.risk}function Q(e,t){if(!e||e==="workspace")return true;let r=(e.startsWith("project:")?e.slice(8):e).trim().toLowerCase();return [t.name,t.path,m.basename(t.path),t.absolutePath].filter(n=>typeof n=="string"&&n.trim().length>0).map(n=>n.trim().toLowerCase()).includes(r)}function Se(e){if(!e.changed)return {headline:"No workspace model impact detected.",bullets:["The current workspace model matches the provided snapshot/report."],unsafeAssumptions:["Do not claim runtime verification passed unless a report exists."]};let t=e.affectedProjects.map(r=>r.project?.name??r.target);return {headline:`Workspace impact risk: ${e.risk}.`,bullets:[`Affected projects: ${t.length?t.join(", "):"none"}.`,`Workspace-level items: ${e.workspaceImpact.length}.`,"Use the verification plan before recommending apply, rollback, or release actions."],unsafeAssumptions:["Do not infer test/build success from impact alone.","Do not apply fixes without project scope and verification evidence.","Use display commands for users and execute commands for automation."]}}async function qe(e){let t=m.resolve(e.workspacePath),r=ee(e.fromPath),n=e.diff;if(!n&&!r){let s=te(t,e.fromPath);n=await ke(s)??void 0;}n||(n=await We({workspacePath:t,fromPath:e.fromPath,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,includeGitObservation:e.includeGitObservation,gitObservation:e.gitObservation,now:e.now,model:e.model}));let c$1=new Map(n.currentModel.projects.map(s=>[s.path,s])),a=new Map(n.currentModel.projects.map(s=>[s.name,s])),i=n.changes.filter(s=>s.type.startsWith("project.")),p=new Map;for(let s of i){let d=(c$1.get(s.target)??(typeof s.before?.name=="string"?a.get(s.before.name):void 0))?.path??s.target,v=p.get(d)??[];v.push(s),p.set(d,v);}let f=[];for(let[s,o]of p.entries()){let d=c$1.get(s);if(d&&!Q(e.scope,d))continue;let v=J(o.map(Ce)),R=d?.name??(typeof o[0]?.before?.name=="string"?String(o[0].before.name):s);f.push({id:`project:${R}`,scope:"project",target:s,title:`Project impact: ${R}`,summary:o.map(j=>j.message).join(" "),risk:v,reasons:o.map(j=>`${j.type}: ${j.message}`),project:d?{name:d.name,path:d.path,kind:d.kind,runtime:d.runtime,framework:d.framework,supportTier:d.supportTier,...d.generator?{generator:d.generator}:{}}:void 0,verification:d?Y(d):D()});}let l=n.currentModel.graph,g=l?a$1(l):void 0,b=new Set(f.map(s=>s.project?.name).filter(s=>typeof s=="string")),C=new Map;for(let s of f)if(s.project?.name){let o=g?.byId.get(s.project.name);o&&(s.centrality={fanIn:o.fanIn,fanOut:o.fanOut,reach:o.reach,betweenness:o.betweenness,isHotspot:o.isHotspot},o.isHotspot&&(s.risk=be(s.risk),s.reasons=[...s.reasons,`graph.hotspot: critical-path project with ${o.reach} transitive dependent(s); risk escalated.`])),s.origin="direct",s.distance=0,C.set(s.project.name,s.risk);}let W=[],u=0;if(l&&b.size>0){let s=c(l,b);for(let o of s.values()){if(o.distance===0||b.has(o.id))continue;let d=a.get(o.id);if(d&&!Q(e.scope,d))continue;let v=o.path[0],R=o.path[o.path.length-2]??v,j=C.get(v)??"medium",ae=ve(j),M=g?.byId.get(o.id);u=Math.max(u,o.distance),W.push({id:`transitive:${o.id}`,scope:"project",target:d?.path??o.id,title:`Transitive impact: ${o.id}`,summary:`Depends on changed project ${v}${o.via?` via ${o.via}`:""} (distance ${o.distance}).`,risk:ae,reasons:[`graph.dependent: depends on ${R}${o.via?` via ${o.via}`:""} (path ${o.path.join(" -> ")})`],project:d?{name:d.name,path:d.path,kind:d.kind,runtime:d.runtime,framework:d.framework,supportTier:d.supportTier,...d.generator?{generator:d.generator}:{}}:void 0,verification:d?Y(d):D(),origin:"transitive",distance:o.distance,path:o.path,via:o.via,...M?{centrality:{fanIn:M.fanIn,fanOut:M.fanOut,reach:M.reach,betweenness:M.betweenness,isHotspot:M.isHotspot}}:{}});}}W.sort((s,o)=>s.target.localeCompare(o.target));let re=g?g.hotspots.flatMap(s=>{let o=g.byId.get(s);return o?[{project:s,fanIn:o.fanIn,fanOut:o.fanOut,reach:o.reach,betweenness:o.betweenness}]:[]}):[],ne=n.changes.filter(s=>!s.type.startsWith("project.")),G=n.currentModel.summary?.projectCount??n.currentModel.projects.length,I=ne.map(s=>({id:`workspace:${s.target}`,scope:"workspace",target:s.target,title:`Workspace impact: ${s.target}`,summary:s.message,risk:Re(s,{projectCount:G}),reasons:[`${s.type}: ${s.message}`],verification:D()})),N=Ie([...f.flatMap(s=>s.verification),...W.flatMap(s=>s.verification),...I.flatMap(s=>s.verification),...n.summary.changed?D():[]]).filter(s=>s.required),se=J([...f.map(s=>s.risk),...W.map(s=>s.risk),...I.map(s=>s.risk)]),B=Oe({risk:se,affectedProjects:f.length,projectCount:G,changes:n.changes}),K={changed:n.summary.changed,risk:B,affectedProjects:f.length,workspaceItems:I.length,recommendedCommands:N.length,blastRadius:{directlyAffected:f.length,transitivelyAffected:W.length,maxDistance:u,graphEdges:l?.edges.length??0}};return {schemaVersion:le,generatedAt:(e.now??new Date).toISOString(),fromRef:n.fromRef,diffRef:Z,workspace:{name:n.currentModel.workspace.name,profile:n.currentModel.workspace.profile,type:n.currentModel.workspace.type},summary:K,affectedProjects:f.sort((s,o)=>s.target.localeCompare(o.target)),transitiveImpact:W,criticalPathHotspots:re,workspaceImpact:I.sort((s,o)=>s.target.localeCompare(o.target)),verificationPlan:N,agentBrief:Se({changed:K.changed,risk:B,affectedProjects:f,workspaceImpact:I}),diff:n}}async function ze(e,t){let r=m.join(t,fe);return await y.ensureDir(m.dirname(r)),await y.writeJson(r,a(e),{spaces:2}),r}export{X as a,V as b,$ as c,Z as d,le as e,fe as f,ee as g,me as h,Ne as i,Be as j,We as k,Ke as l,D as m,qe as n,ze as o};
@@ -1,4 +1,4 @@
1
- import {a as a$1}from'./chunk-JEI6BTZI.js';import {d as d$1,b}from'./chunk-O74N26AD.js';import {f}from'./chunk-6UBWN4EE.js';import {a}from'./chunk-AQ4XZZC6.js';import {c,e,d}from'./chunk-GBJBQ43T.js';import {n}from'./chunk-TSUQQTHI.js';import {j,a as a$2}from'./chunk-3PTJID76.js';import y from'path';import $ from'fs-extra';function B(e$1){switch(e$1){case "why":return d;case "trace":return e;default:return c}}async function C(e){try{return await $.pathExists(e)?await $.readJson(e):null}catch{return null}}function M(e,o){if(!e)return null;let s=o.trim().toLowerCase();return e.projects.find(r=>r.slug.toLowerCase()===s||r.relativePath.toLowerCase()===s)??null}function F(e,o,s){let r=s.trim().toLowerCase(),t=(e.graph?.nodes.map(i=>i.id)??e.projects.map(i=>i.name)).find(i=>i.toLowerCase()===r);if(t)return t;let d=e.projects.find(i=>[i.name,i.path,y.basename(i.path)].filter(u=>u.trim().length>0).some(u=>u.toLowerCase()===r));if(d)return d.name;let p=M(o,s);if(p){let i=e.projects.find(u=>u.path===p.relativePath||u.path.endsWith(`/${p.relativePath}`));if(i)return i.name}return s}function z(e,o){if(!e)return [];let s=o.trim().toLowerCase(),r=new Set;for(let a of e.projects){a.contracts.dependsOn?.some(t=>t.toLowerCase()===s)&&r.add(a.slug);for(let t of a.contracts.consumes??[])for(let d of e.projects)d.contracts.publishes?.includes(t)&&d.slug===s&&r.add(a.slug);}return [...r].sort()}function G(e,o){if(!e)return [];let s=o.trim().toLowerCase();return e.steps.filter(r=>r.scope==="project"&&r.project?.toLowerCase()===s&&r.command?.display).map(r=>r.command.display).slice(0,8)}function l(e,o,s){return {id:e,title:o,body:s.trim()}}async function ae(e){let o=y.resolve(e.workspacePath),s=(e.now??new Date).toISOString(),r=e.model??await n({workspacePath:o,includeEvidence:true}),a$2=e.contract;if(a$2===void 0)try{a$2=(await j({workspacePath:o})).contract;}catch{a$2=null;}let t=e.verify;t===void 0&&(t=await C(y.join(o,d$1)));let d=e.impact;if(d===void 0&&(d=await C(y.join(o,f))),e.target.kind==="release-blocked"){let n=t?.blockingReasons??[],c=(r.summary?.projectCount??r.projects.length)===0,g=[l("verdict",c?"Workspace scaffold posture":"Release verdict",t?c?`Scaffold posture: **${t.summary.verdict}** (exit ${t.summary.exitCode}). Freshness: **${t.freshness.verdict}**. No registered projects yet \u2014 release gates apply after the first project is added.`:`Verdict: **${t.summary.verdict}** (exit ${t.summary.exitCode}). Risk: **${t.impact.risk}**. Freshness: **${t.freshness.verdict}**.`:"No workspace verify report found. Run `npx rapidkit workspace verify --json --write` first."),l("blockers",c?"Pre-project signals":"Blocking reasons",n.length?n.map(k=>`- ${k}`).join(`
1
+ import {a as a$1}from'./chunk-JEI6BTZI.js';import {d as d$1,b}from'./chunk-3VI4Y7LZ.js';import {f}from'./chunk-THSTNVE3.js';import {a}from'./chunk-AQ4XZZC6.js';import {c,e,d}from'./chunk-GBJBQ43T.js';import {n}from'./chunk-LRF6PQOZ.js';import {j,a as a$2}from'./chunk-3PTJID76.js';import y from'path';import $ from'fs-extra';function B(e$1){switch(e$1){case "why":return d;case "trace":return e;default:return c}}async function C(e){try{return await $.pathExists(e)?await $.readJson(e):null}catch{return null}}function M(e,o){if(!e)return null;let s=o.trim().toLowerCase();return e.projects.find(r=>r.slug.toLowerCase()===s||r.relativePath.toLowerCase()===s)??null}function F(e,o,s){let r=s.trim().toLowerCase(),t=(e.graph?.nodes.map(i=>i.id)??e.projects.map(i=>i.name)).find(i=>i.toLowerCase()===r);if(t)return t;let d=e.projects.find(i=>[i.name,i.path,y.basename(i.path)].filter(u=>u.trim().length>0).some(u=>u.toLowerCase()===r));if(d)return d.name;let p=M(o,s);if(p){let i=e.projects.find(u=>u.path===p.relativePath||u.path.endsWith(`/${p.relativePath}`));if(i)return i.name}return s}function z(e,o){if(!e)return [];let s=o.trim().toLowerCase(),r=new Set;for(let a of e.projects){a.contracts.dependsOn?.some(t=>t.toLowerCase()===s)&&r.add(a.slug);for(let t of a.contracts.consumes??[])for(let d of e.projects)d.contracts.publishes?.includes(t)&&d.slug===s&&r.add(a.slug);}return [...r].sort()}function G(e,o){if(!e)return [];let s=o.trim().toLowerCase();return e.steps.filter(r=>r.scope==="project"&&r.project?.toLowerCase()===s&&r.command?.display).map(r=>r.command.display).slice(0,8)}function l(e,o,s){return {id:e,title:o,body:s.trim()}}async function ae(e){let o=y.resolve(e.workspacePath),s=(e.now??new Date).toISOString(),r=e.model??await n({workspacePath:o,includeEvidence:true}),a$2=e.contract;if(a$2===void 0)try{a$2=(await j({workspacePath:o})).contract;}catch{a$2=null;}let t=e.verify;t===void 0&&(t=await C(y.join(o,d$1)));let d=e.impact;if(d===void 0&&(d=await C(y.join(o,f))),e.target.kind==="release-blocked"){let n=t?.blockingReasons??[],c=(r.summary?.projectCount??r.projects.length)===0,g=[l("verdict",c?"Workspace scaffold posture":"Release verdict",t?c?`Scaffold posture: **${t.summary.verdict}** (exit ${t.summary.exitCode}). Freshness: **${t.freshness.verdict}**. No registered projects yet \u2014 release gates apply after the first project is added.`:`Verdict: **${t.summary.verdict}** (exit ${t.summary.exitCode}). Risk: **${t.impact.risk}**. Freshness: **${t.freshness.verdict}**.`:"No workspace verify report found. Run `npx rapidkit workspace verify --json --write` first."),l("blockers",c?"Pre-project signals":"Blocking reasons",n.length?n.map(k=>`- ${k}`).join(`
2
2
  `):c?"No pre-project signals in the latest verify report.":"No blocking reasons in the latest verify report.")];return t?.resolutionHints?.length&&g.push(l("resolution","Resolution hints",t.resolutionHints.map(k=>`- **${k.blockerId}** (${k.resolutionClass}): ${k.commandRetryHint??k.fixHints[0]?.detail??"See fix hints"}`).join(`
3
3
  `))),{schemaVersion:a,generatedAt:s,workspacePath:o,target:e.target,summary:t?c?b(n.length,t.summary.verdict):`Release blocked: ${t.summary.verdict} with ${n.length} blocking reason(s).`:"Release posture unknown \u2014 verify report missing.",sections:g,releaseRisk:t?.impact.risk,blockingReasons:n,resolutionHints:t?.resolutionHints}}if(e.target.kind==="blocker"){let n=e.target,m=t?.resolutionHints?.find(g=>g.blockerId===n.blockerId),c=t?.blockingReasons.find(g=>g.includes(n.blockerId))??t?.blockingReasons[0];return {schemaVersion:a,generatedAt:s,workspacePath:o,target:n,summary:m?`Blocker ${n.blockerId}: ${m.resolutionClass}`:`Blocker ${n.blockerId} (no structured hint)`,sections:[l("reason","Blocking signal",c??"No matching blocking reason in verify."),l("hint","Resolution class",m?`${m.resolutionClass}
4
4