rapidkit 0.38.0 → 0.40.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 (80) hide show
  1. package/README.md +96 -31
  2. package/contracts/agent-customization-pack.v1.json +159 -0
  3. package/contracts/extension-cli-compatibility.v1.json +10 -0
  4. package/contracts/runtime-command-surface.v1.json +33 -0
  5. package/contracts/workspace-intelligence/workspace-dependency-graph.v1.json +92 -0
  6. package/contracts/workspace-intelligence/workspace-impact.v1.json +32 -2
  7. package/contracts/workspace-intelligence/workspace-model.v1.json +5 -0
  8. package/contracts/workspace-intelligence/workspace-verify.v1.json +103 -1
  9. package/dist/analyze-RHQM4AB2.js +1 -0
  10. package/dist/autopilot-release-S32GYUAQ.js +1 -0
  11. package/dist/chunk-3YLMCP3V.js +1 -0
  12. package/dist/chunk-4FJQWL7P.js +4 -0
  13. package/dist/chunk-4Q2ZZKGB.js +1 -0
  14. package/dist/chunk-6G2KSHP6.js +2 -0
  15. package/dist/{chunk-PPQYTYQG.js → chunk-6KD5F6LX.js} +4 -4
  16. package/dist/{chunk-NKNMGWAZ.js → chunk-CY2WXWYQ.js} +1 -1
  17. package/dist/{chunk-TVIOAZ6E.js → chunk-ERCD6NFF.js} +15 -15
  18. package/dist/chunk-G76C74EV.js +1 -0
  19. package/dist/chunk-GOM3RFB3.js +2 -0
  20. package/dist/chunk-HTYMXMQM.js +1 -0
  21. package/dist/chunk-KYH364KQ.js +1 -0
  22. package/dist/chunk-NAMOYGLS.js +2 -0
  23. package/dist/chunk-OWNGSAO3.js +2 -0
  24. package/dist/chunk-PYCJWW4B.js +1 -0
  25. package/dist/chunk-QPEBI6AB.js +2 -0
  26. package/dist/{chunk-5NBYSXOZ.js → chunk-RXWM5DSC.js} +2 -2
  27. package/dist/chunk-S5KTATOU.js +1 -0
  28. package/dist/chunk-TYZPPUBH.js +1 -0
  29. package/dist/chunk-VQMZC5TC.js +9 -0
  30. package/dist/{chunk-JBDQADHY.js → chunk-WHCON2VN.js} +11 -11
  31. package/dist/chunk-X7PWDIQW.js +1 -0
  32. package/dist/{chunk-7XW2I6MP.js → chunk-ZWKLRZE5.js} +2 -2
  33. package/dist/{create-Y3XJOKL5.js → create-XVDDQA42.js} +1 -1
  34. package/dist/{demo-kit-3VTLJBP7.js → demo-kit-RWGOEDW4.js} +1 -1
  35. package/dist/{doctor-QC662YLH.js → doctor-UOLOGJ2Z.js} +1 -1
  36. package/dist/{dotnet-webapi-clean-FX533F5U.js → dotnet-webapi-clean-RTBRPDPL.js} +1 -1
  37. package/dist/{gofiber-standard-35CJZ7S3.js → gofiber-standard-UGIRKPKL.js} +1 -1
  38. package/dist/{gogin-standard-SAX6C4ZK.js → gogin-standard-HJ7SPFNT.js} +1 -1
  39. package/dist/index.d.ts +32 -1
  40. package/dist/index.js +154 -154
  41. package/dist/pipeline-M52LR5FJ.js +5 -0
  42. package/dist/{springboot-standard-SFMSLTX4.js → springboot-standard-IWJSVDLZ.js} +1 -1
  43. package/dist/{workspace-WBKFXH4Z.js → workspace-L4ITCKMM.js} +1 -1
  44. package/dist/workspace-agent-sync-G7JU77IK.js +25 -0
  45. package/dist/{workspace-context-V4UGIHSC.js → workspace-context-NMMQMHNU.js} +1 -1
  46. package/dist/{workspace-foundation-T45HAWKL.js → workspace-foundation-HNIRAIBF.js} +1 -1
  47. package/dist/workspace-graph-ICB7OVAZ.js +3 -0
  48. package/dist/workspace-history-LHUTLE3S.js +1 -0
  49. package/dist/{workspace-intelligence-MGL3Z25K.js → workspace-intelligence-64IWAYHS.js} +1 -1
  50. package/dist/workspace-model-SDHH5RBC.js +1 -0
  51. package/dist/workspace-run-A26PEGQT.js +1 -0
  52. package/dist/workspace-verify-6Q6MGRG6.js +1 -0
  53. package/dist/workspace-watch-JDXVGW4H.js +1 -0
  54. package/docs/ci-workflows.md +21 -18
  55. package/docs/commands-reference.md +1 -1
  56. package/docs/contracts/ARTIFACT_CATALOG.md +194 -32
  57. package/docs/contracts/CLI_LOG_EVENT_STREAM.md +123 -0
  58. package/docs/contracts/README.md +9 -7
  59. package/docs/examples/ci-agent-grounding.yml +5 -2
  60. package/package.json +11 -6
  61. package/scripts/check-agent-customization-drift.mjs +75 -0
  62. package/dist/analyze-6RFG7C7Z.js +0 -1
  63. package/dist/autopilot-release-SBPGNGAB.js +0 -1
  64. package/dist/chunk-2ED6SPXP.js +0 -1
  65. package/dist/chunk-3R7UJAX5.js +0 -1
  66. package/dist/chunk-6E5TBB2C.js +0 -2
  67. package/dist/chunk-6P5DCHBQ.js +0 -4
  68. package/dist/chunk-ABPDGFVD.js +0 -2
  69. package/dist/chunk-B2KOIORF.js +0 -1
  70. package/dist/chunk-C7WILE56.js +0 -1
  71. package/dist/chunk-HEG6DIGW.js +0 -2
  72. package/dist/chunk-IW3KLQXE.js +0 -2
  73. package/dist/chunk-RELR4O5E.js +0 -2
  74. package/dist/chunk-T5LN7EO5.js +0 -9
  75. package/dist/chunk-XESEBTPE.js +0 -1
  76. package/dist/pipeline-C4UCLETO.js +0 -5
  77. package/dist/workspace-agent-sync-3FFFJYKF.js +0 -17
  78. package/dist/workspace-model-IKMGY2BX.js +0 -1
  79. package/dist/workspace-run-HOR56FON.js +0 -1
  80. package/dist/workspace-verify-A3J6D7T2.js +0 -1
@@ -1 +0,0 @@
1
- import {c,a as a$4}from'./chunk-2ED6SPXP.js';import {a}from'./chunk-RV6HBTFC.js';import {a as a$3,q as q$1,k as k$1}from'./chunk-YBS2HGO3.js';import {i,h}from'./chunk-UZW5QFRW.js';import {a as a$2}from'./chunk-VKLL63TL.js';import {a as a$1}from'./chunk-HHJAANUC.js';import l from'path';import f from'fs-extra';var K="workspace-model.v1",L=".rapidkit/reports/workspace-model.json",q=["package.json","pyproject.toml","requirements.txt","go.mod","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","composer.json","Gemfile","mix.exs","deno.json","deno.jsonc","bun.lock","bun.lockb","deps.edn","project.clj","build.sbt","docker-compose.yml","docker-compose.yaml","terraform.tf"],z=new Set([".git",".hg",".svn",".rapidkit",".venv","node_modules","dist","build","target","coverage","htmlcov",".next",".turbo"]);function N(t,e){return (l.relative(t,e)||".").split(l.sep).join("/")}async function $(t){try{if(!await f.pathExists(t))return null;let e=await f.readJSON(t);return e&&typeof e=="object"?e:null}catch{return null}}async function H(t,e){for(let r of e)if(await f.pathExists(l.join(t,r)))return true;return false}function J(t){let e=Number.parseInt(process.env.RAPIDKIT_WORKSPACE_MODEL_SCAN_DEPTH??"",10),r=typeof t=="number"&&Number.isFinite(t)?t:Number.isFinite(e)?e:4;return Math.min(12,Math.max(1,Math.trunc(r)))}async function G(t,e){let r=l.resolve(t),n=[{dirPath:r,depth:0}],s=new Set,o=new Set;for(;n.length>0;){let i=n.shift();if(!i)continue;let a=l.resolve(i.dirPath);if(o.has(a))continue;if(o.add(a),a!==r&&await H(a,q)){s.add(a);continue}if(i.depth>=e)continue;let g=[];try{g=await f.readdir(a,{withFileTypes:true});}catch{continue}for(let m of g)!m.isDirectory()||z.has(m.name)||m.name.startsWith(".")&&m.name!==".config"||n.push({dirPath:l.join(a,m.name),depth:i.depth+1});}return Array.from(s).sort((i,a)=>i.localeCompare(a))}function U(t){let e=new Set,r=[];for(let n of t){let s=l.resolve(n);e.has(s)||(e.add(s),r.push(s));}return r.sort((n,s)=>n.localeCompare(s))}function _(t,e){let r=t?.[e];return typeof r=="string"&&r.trim()?r.trim():void 0}function Q(t,e){return t?.[e]===true}function X(t,e,r){let n=t?.frontend&&typeof t.frontend=="object"&&!Array.isArray(t.frontend)?t.frontend:void 0,s=_(n,"generator"),o=_(n,"command_display"),i=typeof e=="string"&&e.startsWith("frontend.");if(!(!s&&!i))return {...s?{id:s}:{},...e?{kit:e}:{},displayName:r,source:Q(n,"official_generator")?"official-generator":"metadata",...o?{commandDisplay:o}:{}}}async function Y(t){let e=[".rapidkit/project.json",".rapidkit/context.json","package.json","pyproject.toml","requirements.txt","go.mod","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","composer.json","Gemfile","mix.exs","deno.json","Dockerfile","docker-compose.yml","README.md"],r=[];for(let n of e)await f.pathExists(l.join(t,n))&&r.push(n);return r}async function k(t,e,r){let n=l.join(t,e),s=await f.pathExists(n),o={path:e.split(l.sep).join("/"),exists:s};if(s&&r){let i=await $(n);typeof i?.generatedAt=="string"&&(o.generatedAt=i.generatedAt);let a=i?.status??i?.result??i?.verdict;typeof a=="string"&&(o.status=a);}return o}async function Z(t,e,r){let s=`${N(t,e)}/.rapidkit/reports`,o=await k(t,`${s}/doctor-project-last-run.json`,r);return {doctor:o?.exists===true?o:await k(t,`${s}/doctor-last-run.json`,r),analyze:await k(t,`${s}/analyze-last-run.json`,r),readiness:await k(t,`${s}/release-readiness-last-run.json`,r)}}async function ee(t,e,r){let n=a$3(e),s=i(e,n),o=q$1(e),i$1=k$1(s.runtime),a=await c(e,n),g=typeof n?.name=="string"&&n.name.trim()?n.name.trim():l.basename(e),m=typeof n?.kit_name=="string"?n.kit_name:typeof n?.kit=="string"?n.kit:void 0,y=typeof n?.engine=="string"?n.engine:o.engine!=="unknown"?o.engine:void 0,c$1=X(n,m,s.displayName),p=a$4({kitId:m,framework:s.key,runtime:s.runtime});return {name:g,path:N(t,e),...r.includeAbsolutePaths?{absolutePath:e}:{},kind:a,runtime:s.runtime,runtimeCandidates:h(e),framework:s.key,frameworkDisplayName:s.displayName,confidence:s.confidence,detectionSource:s.source,supportTier:s.supportTier,runtimeSupportTier:i$1.tier,runtimeDoctorSupport:i$1.doctorSupport,moduleSupport:o.moduleSupport,...m?{kit:m}:{},...y?{engine:y}:{},...c$1?{generator:c$1}:{},createCapability:p,commands:{supported:o.supportedCommands,unsupported:o.unsupportedCommands,global:o.globalCommands,fleetStages:o.fleetStages,localOnly:o.localOnlyCommands,map:o.commandMap},importantFiles:await Y(e),evidence:await Z(t,e,r.includeEvidence),provenance:{path:"filesystem discovery",runtime:s.source,framework:s.source,commands:"project command capability matrix",createCapability:"create planner capability contract",evidence:"project .rapidkit/reports"}}}async function te(t){return $(l.join(t,".rapidkit","workspace.json"))}function oe(t){return t.some(e=>e.kind==="frontend")&&t.length>1?"full-stack-workspace":t.some(e=>e.kind==="frontend")?"frontend-workspace":t.length>1?"backend-platform":"backend-workspace"}function re(t){let e=new Set;for(let r of t){let n=`${r.name} ${r.path}`.toLowerCase();for(let s of ["auth","billing","payment","notification","order","admin","report","search","analytics"])n.includes(s)&&e.add(s);}return Array.from(e).sort()}function u(t,e,r,n){return {severity:t,code:e,message:r,target:n}}function B(t){let e=[];t.workspace.name.trim()||e.push(u("error","workspace.name.missing","Workspace name could not be resolved.","workspace")),t.workspace.type==="observed-workspace"&&e.push(u("warning","workspace.marker.missing","Workspace marker is missing; model is based on filesystem observation.","workspace.marker")),t.summary.projectCount===0&&e.push(u("warning","workspace.projects.empty","No project roots were detected in this workspace.","projects")),t.contracts.exists||e.push(u("warning","workspace.contract.missing","Workspace contract is missing; dependency and API edges may be incomplete.",t.contracts.workspaceContractPath));let r=new Map;for(let o of t.projects){let i=o.name.toLowerCase(),a=r.get(i)??[];a.push(o),r.set(i,a),o.importantFiles.length||e.push(u("warning","project.markers.missing",`Project ${o.name} has no important manifest files recorded.`,o.path)),o.runtime==="unknown"&&e.push(u("warning","project.runtime.unknown",`Project ${o.name} runtime could not be confidently detected.`,o.path));let g=["test","build"];for(let c of g)o.commands.supported.includes(c)&&o.commands.unsupported.includes(c)&&e.push(u("error","project.commands.conflict",`Project ${o.name} marks ${c} as both supported and unsupported.`,o.path));let m=new Set(o.commands.fleetStages),y=new Set(o.commands.localOnly);for(let c of o.commands.fleetStages){y.has(c)&&e.push(u("error","project.commands.scope-conflict",`Project ${o.name} marks ${c} as both fleet and local-only.`,o.path));let p=o.commands.map[c];(!p||p.status!=="supported"||p.fleetEligible!==true||p.executionScope!=="fleet")&&e.push(u("error","project.commands.fleet-stage-invalid",`Project ${o.name} advertises ${c} as a fleet stage without a supported fleet capability.`,o.path));}for(let c of o.commands.localOnly){let p=o.commands.map[c];(!p||p.status!=="supported"||p.executionScope!=="local-only"||p.fleetEligible===true)&&e.push(u("error","project.commands.local-only-invalid",`Project ${o.name} advertises ${c} as local-only without a matching local-only capability.`,o.path));}for(let c of Object.values(o.commands.map))c.status==="supported"&&(c.fleetEligible===true&&!m.has(c.command)&&e.push(u("error","project.commands.fleet-stage-missing",`Project ${o.name} capability ${c.command} is fleet-eligible but missing from fleetStages.`,o.path)),c.executionScope==="local-only"&&c.fleetEligible!==true&&!y.has(c.command)&&e.push(u("error","project.commands.local-only-missing",`Project ${o.name} capability ${c.command} is local-only but missing from localOnly commands.`,o.path)));}for(let[o,i]of r.entries())i.length>1&&e.push(u("error","project.name.duplicate",`Project name "${o}" is ambiguous across ${i.length} project roots.`,i.map(a=>a.path).join(", ")));let n=e.filter(o=>o.severity==="error").length,s=e.filter(o=>o.severity==="warning").length;return {status:n>0?"failed":s>0?"warning":"passed",errors:n,warnings:s,issues:e}}function ye(t){return B(t)}async function be(t){let e=l.resolve(t.workspacePath),r=t.includeAbsolutePaths===true,n=t.includeEvidence===true,s=J(t.observableScanDepth),o=t.now??new Date,[i,a$3,g,m,y]=await Promise.all([a(e),te(e),a$1(e),a$2(e,{descendIntoMatchedProjects:false}),G(e,s)]),c=U([...m,...y,...g.map(d=>l.isAbsolute(d.path)?d.path:l.join(e,d.path))]),p=await Promise.all(c.map(d=>ee(e,d,{includeAbsolutePaths:r,includeEvidence:n}))),F=typeof a$3?.workspace_name=="string"?a$3.workspace_name:typeof a$3?.name=="string"?a$3.name:i?.name||l.basename(e),b=typeof a$3?.profile=="string"?a$3.profile:typeof a$3?.mode=="string"?a$3.mode:void 0,I=Array.from(new Set(p.map(d=>d.kind))).sort(),w=Array.from(new Set(p.map(d=>d.runtime))).sort(),T=Array.from(new Set(p.map(d=>d.framework))).sort(),h=[".rapidkit/policies.yml",".rapidkit/policies.yaml"].find(d=>f.existsSync(l.join(e,d))),j=".rapidkit/workspace.contract.json",v=await f.pathExists(l.join(e,j)),P={schemaVersion:K,generatedAt:o.toISOString(),workspace:{name:F,root:e,...b?{profile:b}:{},type:i?"rapidkit-workspace":"observed-workspace",...i?{marker:{createdBy:i.createdBy,version:i.version,createdAt:i.createdAt}}:{}},identity:{workspaceType:oe(p),surfaces:I,runtimeFamilies:w,businessCapabilities:re(p)},discovery:{observableScanDepth:s},projects:p,policies:{mode:typeof a$3?.policy_mode=="string"?a$3.policy_mode:typeof a$3?.policyMode=="string"?a$3.policyMode:"warn",source:h??null,exists:!!h},contracts:{workspaceContractPath:j,exists:v,status:v?"known":"missing"},evidence:{doctor:await k(e,".rapidkit/reports/doctor-last-run.json",n),analyze:await k(e,".rapidkit/reports/analyze-last-run.json",n),readiness:await k(e,".rapidkit/reports/release-readiness-last-run.json",n),pipeline:await k(e,".rapidkit/reports/pipeline-last-run.json",n)},summary:{projectCount:p.length,runtimes:w,frameworks:T,firstClassProjects:p.filter(d=>d.supportTier==="first-class").length,observedProjects:p.filter(d=>d.supportTier==="observed").length}},V=B(P);return {...P,validation:V}}async function we(t,e){let r=l.join(e,L);return await f.ensureDir(l.dirname(r)),await f.writeJSON(r,t,{spaces:2}),r}export{K as a,L as b,ye as c,be as d,we as e};
@@ -1,5 +0,0 @@
1
- import {c}from'./chunk-NKNMGWAZ.js';import {b}from'./chunk-JBDQADHY.js';import {b as b$1}from'./chunk-5NBYSXOZ.js';import {a as a$1}from'./chunk-T5LN7EO5.js';import {a as a$2}from'./chunk-6P5DCHBQ.js';import {a}from'./chunk-KMUWWZRT.js';import {e,d}from'./chunk-B2KOIORF.js';import c$1 from'chalk';import D from'fs-extra';import u from'path';function C(t){return t===0?"pass":t===2?"warn":"fail"}function M(t){return t.some(s=>s.status==="fail")?"blocked":t.some(s=>s.status==="warn")?"needs-attention":"ready"}function F(t,s){if(s)return 3;let a=t.some(i=>i.status==="fail"),r=t.some(i=>i.status==="warn");return a?1:r?2:0}async function j(t){let s=await b$1(t,true),a=false;try{let{syncWorkspaceContract:r}=await import('./workspace-contract-D5O4OZD5.js');await r({workspacePath:t}),a=true;}catch{a=false;}return {sync:s,contractSynced:a}}async function G(t={}){let s=u.resolve(t.workspacePath??process.cwd()),a$3=a(s);if(!a$3)throw new Error("No RapidKit workspace found in current directory or parents");let r=[],i=[],l=false,p,y,m,f=Date.now();try{let{sync:e,contractSynced:n}=await j(a$3),o=e.workspaceFound&&(e.added.length>0||e.skipped>=0)||e.workspaceFound?"pass":"warn";r.push({name:"sync",status:o,durationMs:Date.now()-f,summary:e.workspaceFound?`registry sync complete (${e.added.length} added, ${e.skipped} existing)${n?", 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,r.push({name:"sync",status:"fail",durationMs:Date.now()-f,summary:`sync failed: ${e instanceof Error?e.message:String(e)}`}),i.push("workspace sync stage failed");}let w=Date.now();try{let e=await b({workspace:true,json:true,quiet:true,strict:t.strict===true,ci:t.strict!==true}),n=C(e),o=u.join(a$3,".rapidkit","reports","doctor-last-run.json");r.push({name:"doctor",status:n,durationMs:Date.now()-w,summary:n==="pass"?"doctor workspace passed":n==="warn"?"doctor workspace reported warnings":"doctor workspace reported errors",exitCode:e,evidencePath:o}),n==="fail"?i.push("doctor workspace gate failed"):n==="warn"&&i.push("doctor workspace reported warnings");}catch(e){l=true,r.push({name:"doctor",status:"fail",durationMs:Date.now()-w,summary:`doctor failed: ${e instanceof Error?e.message:String(e)}`}),i.push("doctor workspace stage failed");}if(t.skipAnalyze)r.push({name:"analyze",status:"skipped",durationMs:0,summary:"analyze stage skipped"});else {let e=Date.now();try{let n=await a$1({workspacePath:a$3,json:true,strict:t.strict===true});p=u.join(a$3,".rapidkit","reports","analyze-last-run.json");let o=n.summary.verdict==="blocked"?"fail":n.summary.verdict==="needs-attention"?"warn":"pass";r.push({name:"analyze",status:o,durationMs:Date.now()-e,summary:`analyze verdict: ${n.summary.verdict} (score ${n.summary.score}/100)`,evidencePath:p}),o==="fail"?i.push("analyze reported blocked verdict"):o==="warn"&&i.push("analyze reported needs-attention verdict");}catch(n){l=true,r.push({name:"analyze",status:"fail",durationMs:Date.now()-e,summary:`analyze failed: ${n instanceof Error?n.message:String(n)}`}),i.push("analyze stage failed");}}let h=Date.now();try{let e=await a$2({startPath:a$3,writeReport:true,skipVerify:t.skipVerify===true});y=e.evidencePath;let n=e.overallStatus==="pass"?"pass":e.overallStatus==="warn"?"warn":"fail";r.push({name:"readiness",status:n,durationMs:Date.now()-h,summary:`readiness overall: ${e.overallStatus}`,evidencePath:e.evidencePath}),n==="fail"?i.push(...e.blockingReasons.map(o=>`readiness: ${o}`)):n==="warn"&&i.push(...e.gates.filter(o=>o.status==="warn").map(o=>`readiness warn: ${o.gate}: ${o.summary}`));}catch(e){l=true,r.push({name:"readiness",status:"fail",durationMs:Date.now()-h,summary:`readiness failed: ${e instanceof Error?e.message:String(e)}`}),i.push("readiness stage failed");}if(t.skipAutopilot)r.push({name:"autopilot",status:"skipped",durationMs:0,summary:"autopilot stage skipped"});else {let e=Date.now(),n=t.autopilotMode??"audit";try{let o=await c({workspacePath:a$3,mode:n,json:true,skipPipelineStages:true});m=o.artifacts.reportPath;let P=o.summary.verdict==="approved"?"pass":o.summary.verdict==="partial"?"warn":"fail";r.push({name:"autopilot",status:P,durationMs:Date.now()-e,summary:`autopilot ${n}: ${o.summary.verdict}`,exitCode:o.summary.exitCode,evidencePath:m}),P!=="pass"&&i.push(...o.blockingReasons.slice(0,5));}catch(o){l=true,r.push({name:"autopilot",status:"fail",durationMs:Date.now()-e,summary:`autopilot failed: ${o instanceof Error?o.message:String(o)}`}),i.push("autopilot release stage failed");}}let z=M(r),k=F(r,l),g=u.join(a$3,".rapidkit","reports","pipeline-last-run.json"),d$1={schemaVersion:"rapidkit-pipeline-v1",generatedAt:new Date().toISOString(),workspacePath:a$3,summary:{verdict:z,exitCode:k,stagesPassed:r.filter(e=>e.status==="pass").length,stagesWarn:r.filter(e=>e.status==="warn").length,stagesFailed:r.filter(e=>e.status==="fail").length},stages:r,blockingReasons:[...new Set(i)],artifacts:{reportPath:g,analyzeEvidencePath:p,readinessEvidencePath:y,autopilotEvidencePath:m}};if(t.writeReport!==false){await D.ensureDir(u.dirname(g));let e$1=e(d$1,{commandId:"workspacePipeline",exitCode:k,generatedAt:d$1.generatedAt,blockers:d$1.blockingReasons,runId:d()});await D.writeJSON(g,e$1,{spaces:2});}if(t.writeReport!==false&&t.noAgentSync!==true&&process.env.RAPIDKIT_NO_AGENT_SYNC!=="1"&&t.agentSync!==false)try{let{syncWorkspaceAgentGrounding:e}=await import('./workspace-agent-sync-3FFFJYKF.js'),n=await e({workspacePath:a$3,write:true,refreshContext:true,strict:false});d$1.agentGrounding={indexPath:n.indexPath,writtenFiles:n.writtenFiles,blockers:n.blockers};}catch{}return d$1}async function X(t){let s;try{s=await G(t);}catch(a){let r=a instanceof Error?a.message:String(a);t.json?console.log(JSON.stringify({schemaVersion:"rapidkit-pipeline-error-v1",ok:false,error:{message:r}},null,2)):console.log(c$1.red(`Pipeline failed: ${r}`)),process.exit(1);}if(t.json)console.log(JSON.stringify(s,null,2));else {console.log(c$1.bold.cyan(`
2
- \u{1F517} RapidKit Governance Pipeline
3
- `)),console.log(c$1.bold(`Workspace: ${c$1.cyan(u.basename(s.workspacePath))}`)),console.log(c$1.gray(`Path: ${s.workspacePath}`)),console.log(c$1.white(`Verdict: ${s.summary.verdict} Exit: ${s.summary.exitCode} (${s.summary.stagesPassed} pass / ${s.summary.stagesWarn} warn / ${s.summary.stagesFailed} fail)`));for(let a of s.stages){let r=a.status==="pass"?c$1.green("PASS"):a.status==="warn"?c$1.yellow("WARN"):a.status==="skipped"?c$1.gray("SKIP"):c$1.red("FAIL");console.log(` - ${a.name}: ${r} ${a.summary}`);}if(s.blockingReasons.length>0){console.log(c$1.bold(`
4
- Blocking reasons:`));for(let a of s.blockingReasons.slice(0,8))console.log(c$1.gray(` \u2022 ${a}`));}console.log(c$1.gray(`
5
- Evidence: ${s.artifacts.reportPath}`)),s.agentGrounding?.writtenFiles.length&&console.log(c$1.gray(`Agent grounding: ${s.agentGrounding.writtenFiles.length} file(s) synced (INDEX + AGENTS.md + Copilot/Cursor/Claude hooks)`));}s.summary.exitCode!==0&&process.exit(s.summary.exitCode);}export{G as runPipeline,X as runPipelineCommand};
@@ -1,17 +0,0 @@
1
- import {b,c,d}from'./chunk-IW3KLQXE.js';import i from'path';import c$1 from'fs-extra';var O="rapidkit-agent-reports-index.v1",E=".rapidkit/reports/INDEX.json",G=".rapidkit/AGENT-GROUNDING.md",S=[{relativePath:b,label:"Agent context pack",required:true},{relativePath:".rapidkit/reports/workspace-model.json",label:"Workspace model graph",required:false},{relativePath:".rapidkit/reports/doctor-last-run.json",label:"Workspace doctor",required:false},{relativePath:".rapidkit/reports/analyze-last-run.json",label:"Workspace analyze",required:false},{relativePath:".rapidkit/reports/pipeline-last-run.json",label:"Governance pipeline",required:false},{relativePath:".rapidkit/reports/release-readiness-last-run.json",label:"Release readiness",required:false},{relativePath:".rapidkit/reports/workspace-impact-last-run.json",label:"Workspace impact",required:false},{relativePath:".rapidkit/reports/workspace-verify-last-run.json",label:"Workspace verify",required:false}];function k(e){return `npx rapidkit ${e}`.trim()}function I(e){return e&&typeof e=="object"?e:null}function j(e,t=12){return Array.isArray(e)?e.filter(r=>typeof r=="string"&&r.trim().length>0).slice(0,t):[]}function q(e){let t=j(e.blockers,12);if(t.length>0)return t;let r=j(e.blockingReasons,12);if(r.length>0)return r;let n=I(e.summary);return n&&Array.isArray(n.blockingReasons)?j(n.blockingReasons,12):[]}function _(e){for(let t of ["generatedAt","timestamp"]){let r=e[t];if(typeof r=="string"&&r.trim())return r.trim()}}function $(e,t,r){if(!e)return true;let n=Date.parse(e);return Number.isFinite(n)?r.getTime()-n>t*60*60*1e3:true}function K(e){let t=e&&e.length>0?e:["all"];return t.includes("all")?new Set(["all","agents","copilot","cursor","claude","codex","orca"]):new Set(t)}function u(e,t){return e.has("all")||e.has(t)}async function X(e){try{if(!await c$1.pathExists(e))return null;let t=await c$1.readJson(e);return I(t)}catch{return null}}async function F(e){let t=e.now??new Date,r=e.staleAfterHours??24,n=[],d=[];for(let l of S){let h=i.join(e.workspacePath,l.relativePath),a=await X(h),p=a!==null;p&&a&&d.push(...q(a)),n.push({path:l.relativePath,label:l.label,required:l.required,exists:p,generatedAt:a?_(a):void 0,commandId:typeof a?.commandId=="string"?a.commandId:void 0,exitCode:typeof a?.exitCode=="number"?a.exitCode:void 0});}let s=[...new Set(d.map(l=>l.trim()).filter(Boolean))].slice(0,16);return {schemaVersion:O,generatedAt:t.toISOString(),workspaceRoot:e.workspacePath,readOrder:S.map(l=>l.relativePath),blockers:s,staleAfterHours:r,reports:n,refreshCommand:k("workspace agent-sync --write --refresh-context")}}function N(e){let t=["# RapidKit agent grounding","","Cross-tool instructions for Copilot, Cursor, Claude Code, Codex, Grok, and other agents.","","## Read order (mandatory before workspace diagnosis)","","1. `.rapidkit/reports/INDEX.json` \u2014 latest blockers, timestamps, and report paths","2. `.rapidkit/reports/workspace-context-agent.json` \u2014 canonical agent context pack","3. Evidence artifacts listed in the index (doctor, analyze, pipeline, readiness, impact, verify)","","Do **not** full-repo scan until these reports are read or regenerated.","","## Regenerate intelligence","","```bash",k("workspace agent-sync --write --refresh-context"),k("workspace context --for-agent --json --write"),k("pipeline --json --write"),"```",""];if(e.index.blockers.length>0){t.push("## Current blockers","");for(let r of e.index.blockers.slice(0,12))t.push(`- ${r}`);t.push("");}if(e.context?.safeCommands?.length){t.push("## Safe commands (prefer these)","");for(let r of e.context.safeCommands.slice(0,10))t.push(`- \`${r.display}\` \u2014 ${r.description}`);t.push("");}return t.push("## Rules","","- Treat `.rapidkit/reports/*` as the source of truth for health, gates, and release posture.","- Prefer deterministic RapidKit CLI commands over heuristic framework guesses.","- If evidence is missing or stale, run the refresh commands above before proposing fixes.","- Keep project-scoped advice aligned with the active project named in the context pack.",""),t.join(`
2
- `)}function B(e){return ["# RapidKit agent grounding","",`Generated: ${e.generatedAt}`,"","This file is tool-agnostic. Synced agents should read it together with `.rapidkit/reports/INDEX.json`.","","## Mandatory read order","",...e.readOrder.map((t,r)=>`${r+1}. \`${t}\``),"",e.blockers.length>0?"## Blockers":"",...e.blockers.length>0?e.blockers.map(t=>`- ${t}`):[],"","## Refresh","","```bash",e.refreshCommand,"```",""].filter(t=>t!=="").join(`
3
- `)}function H(){return ["# RapidKit workspace grounding","","Before answering workspace, release, or architecture questions:","","1. Read `AGENTS.md` (managed RapidKit section).","2. Read `.rapidkit/reports/INDEX.json` and `.rapidkit/reports/workspace-context-agent.json`.","3. Use evidence reports before scanning the full repository.","","Regenerate stale intelligence:","","```bash",k("workspace agent-sync --write --refresh-context"),"```",""].join(`
4
- `)}function L(){return ["## Claude Code","","- Load `.rapidkit/reports/INDEX.json` before diagnosing blockers.","- Use `.claude/rules/rapidkit-evidence.md` when editing files under `.rapidkit/`.","- Refresh grounding with `npx rapidkit workspace agent-sync --write`.",""].join(`
5
- `)}function M(){return ["---","description: RapidKit workspace evidence and intelligence grounding","globs: []","alwaysApply: true","---","","Before proposing fixes in this workspace:","","1. Read `AGENTS.md` and `.rapidkit/reports/INDEX.json`.","2. Read `.rapidkit/reports/workspace-context-agent.json`.","3. Prefer evidence in `.rapidkit/reports/*` over full-repo exploration.","","Refresh when stale:","","```bash",k("workspace agent-sync --write --refresh-context"),"```",""].join(`
6
- `)}function U(){return ["---",'applyTo: ".rapidkit/**,**/.rapidkit/**"',"description: RapidKit evidence and intelligence artifacts","---","","When working under `.rapidkit/`:","","- Treat JSON reports as canonical gate and health evidence.","- Start from `reports/INDEX.json` for read order and blockers.","- Do not invent pass/fail state \u2014 cite `exitCode`, `blockers`, and `generatedAt` fields.",""].join(`
7
- `)}function z(){return ["# RapidKit evidence","","Applies when reading or editing `.rapidkit/reports/*`.","","- Start from `INDEX.json`, then `workspace-context-agent.json`.","- Use report blockers as the primary fix target.","- Regenerate with `npx rapidkit workspace agent-sync --write`.",""].join(`
8
- `)}function J(){return ["---","description: Diagnose RapidKit workspace blockers from evidence reports","---","","Diagnose this workspace using RapidKit evidence only.","","Read:","","- `.rapidkit/reports/INDEX.json`","- `.rapidkit/reports/workspace-context-agent.json`","- Any fail/warn reports referenced in the index","","Return:","","1. Root cause grounded in report blockers","2. Smallest safe fix path (commands + file edits)","3. One verification command to prove recovery",""].join(`
9
- `)}function V(){return ["---","name: rapidkit-grounding","description: Load RapidKit workspace intelligence reports before diagnosing or changing code","---","","# RapidKit grounding","","Use when the user asks about workspace health, release gates, doctor/pipeline failures, or project structure.","","## Workflow","","1. Read `.rapidkit/reports/INDEX.json`","2. Read `.rapidkit/reports/workspace-context-agent.json`","3. Read fail/warn evidence artifacts listed in the index","4. Propose the smallest safe fix with explicit verification commands","","## Refresh stale evidence","","```bash",k("workspace agent-sync --write --refresh-context"),"```",""].join(`
10
- `)}async function f(e,t,r){return r?(await c$1.ensureDir(i.dirname(e)),await c$1.writeFile(e,t,"utf8"),"written"):"skipped"}async function T(e){if(!e.write)return "skipped";let t=await c$1.pathExists(e.absolutePath)?await c$1.readFile(e.absolutePath,"utf8"):null,{upsertManagedAgentSection:r}=await import('./managed-agent-markers-AXUM75OE.js'),n=r(t,e.generatedBody),d=e.preamble?`${e.preamble.trimEnd()}
11
-
12
- ${n}`:n;return await c$1.ensureDir(i.dirname(e.absolutePath)),await c$1.writeFile(e.absolutePath,d,"utf8"),"written"}function re(e){if(!e?.trim())return;let t=new Set(["all","agents","copilot","cursor","claude","codex","orca"]),r=e.split(",").map(n=>n.trim().toLowerCase()).filter(n=>t.has(n));return r.length>0?r:void 0}async function ne(e){let t=i.resolve(e.workspacePath),r=new Date,n=e.staleAfterHours??24,d$1=K(e.targets),s=e.write===true,l=e.strict===true,h,a=null;e.refreshContext&&(a=await c({workspacePath:t,agent:e.agent??"generic",scope:e.scope,includeEvidence:true}),s&&(h=await d(a,t)));let p=await F({workspacePath:t,staleAfterHours:n,now:r}),w=p.reports.filter(o=>o.required&&!o.exists).map(o=>o.path),b=p.reports.filter(o=>o.exists&&$(o.generatedAt,n,r)).map(o=>o.path),A=[];l&&(w.length>0&&A.push(`Missing required reports: ${w.join(", ")}`),b.length>0&&A.push(`Stale reports (>${n}h): ${b.join(", ")}`));let x=[],R=[],g=(o,m)=>{o==="written"?x.push(m):R.push(m);};if(g(await f(i.join(t,E),`${JSON.stringify(p,null,2)}
13
- `,s),E),g(await f(i.join(t,G),`${B(p)}
14
- `,s),G),u(d$1,"agents")&&g(await T({absolutePath:i.join(t,"AGENTS.md"),generatedBody:N({index:p,context:a}),write:s}),"AGENTS.md"),u(d$1,"claude")){let o=i.join(t,"CLAUDE.md");if(s){let{upsertManagedAgentSection:m}=await import('./managed-agent-markers-AXUM75OE.js'),D=await c$1.pathExists(o)?await c$1.readFile(o,"utf8"):"",y=m(D,L()),W=y.includes("@AGENTS.md")?y:`@AGENTS.md
15
-
16
- ${y}`;await c$1.ensureDir(i.dirname(o)),await c$1.writeFile(o,W,"utf8"),x.push("CLAUDE.md");}else R.push("CLAUDE.md");g(await f(i.join(t,".claude/rules/rapidkit-evidence.md"),`${z()}
17
- `,s),".claude/rules/rapidkit-evidence.md");}return u(d$1,"cursor")&&g(await f(i.join(t,".cursor/rules/rapidkit-grounding.mdc"),M(),s),".cursor/rules/rapidkit-grounding.mdc"),u(d$1,"copilot")&&(g(await T({absolutePath:i.join(t,".github/copilot-instructions.md"),generatedBody:H(),write:s}),".github/copilot-instructions.md"),g(await f(i.join(t,".github/instructions/rapidkit-evidence.instructions.md"),U(),s),".github/instructions/rapidkit-evidence.instructions.md"),g(await f(i.join(t,".github/prompts/rapidkit-diagnose.prompt.md"),J(),s),".github/prompts/rapidkit-diagnose.prompt.md"),g(await f(i.join(t,".github/skills/rapidkit-grounding/SKILL.md"),V(),s),".github/skills/rapidkit-grounding/SKILL.md")),(u(d$1,"codex")||u(d$1,"orca"))&&(u(d$1,"agents")||g(await T({absolutePath:i.join(t,"AGENTS.md"),generatedBody:N({index:p,context:a}),write:s}),"AGENTS.md")),{workspacePath:t,indexPath:i.join(t,E),contextPath:h,writtenFiles:x,skippedFiles:R,blockers:p.blockers,missingRequired:w,staleReports:b,strictViolations:A}}export{G as AGENT_GROUNDING_DOC_PATH,E as AGENT_REPORTS_INDEX_PATH,O as AGENT_REPORTS_INDEX_SCHEMA,S as AGENT_REPORT_CATALOG,F as buildWorkspaceAgentReportsIndex,re as parseAgentGroundingTargets,ne as syncWorkspaceAgentGrounding};
@@ -1 +0,0 @@
1
- export{b as WORKSPACE_MODEL_REPORT_PATH,a as WORKSPACE_MODEL_SCHEMA_VERSION,d as buildWorkspaceModel,c as validateWorkspaceModelStrict,e as writeWorkspaceModel}from'./chunk-XESEBTPE.js';
@@ -1 +0,0 @@
1
- export{a as runWorkspaceStage}from'./chunk-6E5TBB2C.js';export{a as WORKSPACE_RUN_LAST_REPORT_FILENAME}from'./chunk-FV5A3N3I.js';
@@ -1 +0,0 @@
1
- import {m,f as f$1,c,n,e}from'./chunk-ABPDGFVD.js';import {d}from'./chunk-XESEBTPE.js';import {c as c$1}from'./chunk-FV5A3N3I.js';import p from'path';import g from'fs-extra';var R="workspace-verify.v1",S=".rapidkit/reports/workspace-verify-last-run.json";function C(e,s){return p.isAbsolute(s)?s:p.join(e,s)}async function P(e$1){let s=await g.readJson(e$1);if(!s||typeof s!="object"||Array.isArray(s))throw new Error(`Workspace impact input is not a JSON object: ${e$1}`);let r=s;if(r.schemaVersion!==e)throw new Error(`Unsupported workspace impact schema: ${String(r.schemaVersion)}`);return r}function I(e){let s=new Set,r=[];for(let a of e){let i=`${a.scope}:${a.project??""}:${a.display}`;s.has(i)||(s.add(i),r.push(a));}return r}function V(e,s){if(!e||e==="workspace")return true;let r=(e.startsWith("project:")?e.slice(8):e).trim().toLowerCase();return s.scope==="workspace"?true:(s.project??"").trim().toLowerCase()===r}function A(e,s){if(e.id==="workspace.doctor")return p.join(s,".rapidkit","reports","doctor-last-run.json");if(e.id==="workspace.contract.verify")return p.join(s,".rapidkit","reports","workspace-contract-verify-last-run.json");if(e.id==="workspace.readiness")return p.join(s,".rapidkit","reports","release-readiness-last-run.json");if(e.id==="workspace.analyze")return p.join(s,".rapidkit","reports","analyze-last-run.json");if(e.id==="workspace.pipeline")return p.join(s,".rapidkit","reports","pipeline-last-run.json");if(e.id.startsWith("project.")&&(e.id.endsWith(".test")||e.id.endsWith(".build")))return p.join(s,".rapidkit","reports","workspace-run-last.json")}function k(e){return !e||typeof e!="object"||Array.isArray(e)?null:e}function $(e){let s=k(e.healthScore),r=typeof s?.errors=="number"?s.errors:0,a=typeof s?.percent=="number"?s.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 M(e){let s=typeof e.overallStatus=="string"?e.overallStatus:"unknown";return s==="fail"?{status:"fail",message:"Release readiness evidence reports blocking failures."}:s==="warn"?{status:"warn",message:"Release readiness evidence reports warnings."}:s==="pass"?{status:"pass",message:"Release readiness evidence passed."}:{status:"warn",message:`Release readiness evidence status is ${s}.`}}function O(e){let s=typeof e.status=="string"?e.status:"unknown";return s==="failed"||s==="fail"?{status:"fail",message:"Workspace contract verify evidence failed."}:s==="passed"||s==="pass"?{status:"pass",message:"Workspace contract verify evidence passed."}:{status:"warn",message:`Workspace contract verify evidence status is ${s}.`}}function x(e){let s=k(e.summary);if(s?.blocking===true||e.blocking===true)return {status:"fail",message:"Analyze evidence reports blocking findings."};let a=typeof s?.status=="string"?s.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 s=k(e.summary),r=typeof s?.verdict=="string"?s.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 D(e,s,r){let a=s.id.endsWith(".build")?"build":s.id.endsWith(".test")?"test":null,i=c$1(e,a);if(!i)return {status:"missing",message:"Workspace run evidence is missing or unreadable."};let u=i.stage;if(a&&u!==a)return {status:"missing",message:`Workspace run evidence is for stage "${u}", expected "${a}".`};let c=Array.isArray(i.projects)?i.projects:[],o=s.project?.toLowerCase();if(!o)return {status:"missing",message:"Project-scoped workspace run evidence is missing a project identifier."};let n=c.find(d=>{let t=k(d);if(!t)return false;let m=typeof t.projectName=="string"?t.projectName.toLowerCase():"",E=["projectPath","relativePath","path"].map(l=>t[l]).filter(l=>typeof l=="string"&&l.trim().length>0).map(l=>l.replace(/\\/g,"/").toLowerCase());return m===o||E.some(l=>l.endsWith(`/${o}`)||l===o)});if(n){let d=f(i.generatedAt,r,`Workspace run evidence for ${s.project??s.id}`);if(d)return {status:"fail",message:d};let t=k(n),m=typeof t?.status=="string"?t.status:"unknown";return m==="failed"?{status:"fail",message:`Workspace run evidence failed for ${s.project}.`}:m==="passed"?{status:"pass",message:`Workspace run evidence passed for ${s.project}.`}:m==="skipped"?{status:"warn",message:`Workspace run evidence skipped for ${s.project}.`}:{status:"warn",message:`Workspace run evidence status is ${m} for ${s.project}.`}}return {status:"missing",message:`Workspace run evidence does not include project ${s.project}.`}}function f(e,s,r){if(typeof e!="string"||!s)return null;let a=Date.parse(e),i=Date.parse(s);return !Number.isFinite(a)||!Number.isFinite(i)?null:a<i?`${r} is stale: generated at ${e}, before impact ${s}.`:null}async function F(e,s,r,a){let i=A(e,s),u=i?p.relative(s,i).split(p.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(!i||!await g.pathExists(i))return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"missing",required:e.required,evidencePath:u,message:u?`Missing evidence report: ${u}`:"No evidence mapping exists for this command."};let c=k(await g.readJson(i));if(!c)return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"fail",required:e.required,evidencePath:u,message:"Evidence report is not a JSON object."};let o;if(e.id==="workspace.doctor"){let n=f(c.generatedAt,a,"Doctor evidence");n?o={status:"fail",message:n}:o=$(c);}else if(e.id==="workspace.readiness"){let n=f(c.generatedAt,a,"Release readiness evidence");n?o={status:"fail",message:n}:o=M(c);}else if(e.id==="workspace.contract.verify"){let n=f(c.generatedAt,a,"Workspace contract verify evidence");n?o={status:"fail",message:n}:o=O(c);}else if(e.id==="workspace.analyze"){let n=f(c.generatedAt,a,"Analyze evidence");n?o={status:"fail",message:n}:o=x(c);}else if(e.id==="workspace.pipeline"){let n=f(c.generatedAt,a,"Pipeline evidence");n?o={status:"fail",message:n}:o=_(c);}else if(e.id.startsWith("project."))o=D(c,e,a);else {let n=f(c.generatedAt,a,"Evidence report");n?o={status:"fail",message:n}:o={status:"pass",message:"Evidence report is present."};}return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:o.status,required:e.required,evidencePath:u,message:o.message}}function q(e){let s=e.filter(t=>t.status==="pass").length,r=e.filter(t=>t.status==="warn").length,a=e.filter(t=>t.status==="fail").length,i=e.filter(t=>t.status==="missing").length,u=e.filter(t=>t.status==="skipped").length,c=e.filter(t=>t.required&&(t.status==="fail"||t.status==="missing")).map(t=>`${t.id}: ${t.message}`),o=e.filter(t=>t.required&&t.status==="missing").length,n="ready",d=0;return c.length>0?(n="blocked",d=2):(r>0||o>0)&&(n="needs-attention",d=1),{verdict:n,exitCode:d,stepsPassed:s,stepsWarn:r,stepsFailed:a,stepsMissing:i,stepsSkipped:u}}async function N(e$1){let s=p.resolve(e$1.workspacePath);if(e$1.fromImpactPath){let u=C(s,e$1.fromImpactPath);return {impact:await P(u),fromImpactRef:p.relative(s,u).split(p.sep).join("/")}}let r=p.join(s,f$1);if(await g.pathExists(r))return {impact:await P(r),fromImpactRef:f$1};let a=p.join(s,c);if(await g.pathExists(a))return {impact:await n({workspacePath:s,fromPath:c,scope:e$1.scope,includeAbsolutePaths:e$1.includeAbsolutePaths,includeEvidence:e$1.includeEvidence,observableScanDepth:e$1.observableScanDepth,now:e$1.now}),fromImpactRef:c};let i=await d({workspacePath:s,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 Y(e){let s=p.resolve(e.workspacePath),{impact:r,fromImpactRef:a}=await N(e),i=r.diff.currentModel,u=I([...m(),...r.verificationPlan]).filter(t=>V(e.scope,t)),c=[];for(let t of u)c.push(await F(t,s,i.contracts.exists===true,r.generatedAt));let o=q(c),n=c.filter(t=>t.status==="missing"&&t.evidencePath).map(t=>t.evidencePath),d=c.filter(t=>t.required&&(t.status==="fail"||t.status==="missing")).map(t=>`${t.id}: ${t.message}`);return {schemaVersion:R,generatedAt:(e.now??new Date).toISOString(),workspacePath:s,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:o,steps:c,missingEvidence:n,blockingReasons:d,verificationPlan:u}}async function U(e,s){let r=p.join(s,S);return await g.ensureDir(p.dirname(r)),await g.writeJson(r,e,{spaces:2}),r}function Q(e,s){return e.summary.verdict==="blocked"?2:s?.strict&&e.summary.verdict!=="ready"?1:e.summary.exitCode}export{S as WORKSPACE_VERIFY_REPORT_PATH,R as WORKSPACE_VERIFY_SCHEMA_VERSION,Y as buildWorkspaceVerify,Q as workspaceVerifyExitCode,U as writeWorkspaceVerify};