rapidkit 0.37.1 → 0.39.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 (76) hide show
  1. package/README.md +185 -118
  2. package/contracts/create-planner-capabilities.v1.json +251 -0
  3. package/contracts/runtime-command-surface.v1.json +85 -0
  4. package/contracts/workspace-intelligence/workspace-dependency-graph.v1.json +92 -0
  5. package/contracts/workspace-intelligence/workspace-impact.v1.json +32 -2
  6. package/contracts/workspace-intelligence/workspace-model.v1.json +5 -0
  7. package/contracts/workspace-intelligence/workspace-verify.v1.json +103 -1
  8. package/dist/analyze-RHQM4AB2.js +1 -0
  9. package/dist/autopilot-release-FWKOY2BD.js +1 -0
  10. package/dist/chunk-3YLMCP3V.js +1 -0
  11. package/dist/chunk-4FJQWL7P.js +4 -0
  12. package/dist/chunk-4Q2ZZKGB.js +1 -0
  13. package/dist/chunk-6G2KSHP6.js +2 -0
  14. package/dist/{chunk-PPQYTYQG.js → chunk-6KD5F6LX.js} +4 -4
  15. package/dist/{chunk-IOIWVHRO.js → chunk-ERCD6NFF.js} +22 -22
  16. package/dist/chunk-G76C74EV.js +1 -0
  17. package/dist/chunk-GOM3RFB3.js +2 -0
  18. package/dist/{chunk-7RBZGQ7T.js → chunk-GYNIVEYP.js} +1 -1
  19. package/dist/chunk-HTYMXMQM.js +1 -0
  20. package/dist/chunk-KYH364KQ.js +1 -0
  21. package/dist/chunk-OWNGSAO3.js +2 -0
  22. package/dist/chunk-PYCJWW4B.js +1 -0
  23. package/dist/chunk-QPEBI6AB.js +2 -0
  24. package/dist/{chunk-RUUDLAKJ.js → chunk-RXWM5DSC.js} +2 -2
  25. package/dist/chunk-S5KTATOU.js +1 -0
  26. package/dist/chunk-TYZPPUBH.js +1 -0
  27. package/dist/chunk-UY4KRFNL.js +2 -0
  28. package/dist/chunk-VQMZC5TC.js +9 -0
  29. package/dist/{chunk-JBDQADHY.js → chunk-WHCON2VN.js} +11 -11
  30. package/dist/chunk-X7PWDIQW.js +1 -0
  31. package/dist/chunk-ZWKLRZE5.js +13 -0
  32. package/dist/{create-HN5HOGQ4.js → create-XVDDQA42.js} +1 -1
  33. package/dist/{demo-kit-3VTLJBP7.js → demo-kit-RWGOEDW4.js} +1 -1
  34. package/dist/{doctor-QC662YLH.js → doctor-UOLOGJ2Z.js} +1 -1
  35. package/dist/{dotnet-webapi-clean-FX533F5U.js → dotnet-webapi-clean-RTBRPDPL.js} +1 -1
  36. package/dist/{gofiber-standard-35CJZ7S3.js → gofiber-standard-UGIRKPKL.js} +1 -1
  37. package/dist/{gogin-standard-SAX6C4ZK.js → gogin-standard-HJ7SPFNT.js} +1 -1
  38. package/dist/index.d.ts +32 -1
  39. package/dist/index.js +134 -128
  40. package/dist/pipeline-O5ANBQMK.js +5 -0
  41. package/dist/{springboot-standard-SFMSLTX4.js → springboot-standard-IWJSVDLZ.js} +1 -1
  42. package/dist/{workspace-2AL5C3QZ.js → workspace-L4ITCKMM.js} +1 -1
  43. package/dist/{workspace-agent-sync-4R7S3F6T.js → workspace-agent-sync-SALW6TVR.js} +1 -1
  44. package/dist/{workspace-context-CKACDTVE.js → workspace-context-NMMQMHNU.js} +1 -1
  45. package/dist/{workspace-foundation-L6ZBGMVE.js → workspace-foundation-HNIRAIBF.js} +1 -1
  46. package/dist/workspace-graph-ICB7OVAZ.js +3 -0
  47. package/dist/workspace-history-LHUTLE3S.js +1 -0
  48. package/dist/{workspace-intelligence-3TWXJQ7Y.js → workspace-intelligence-64IWAYHS.js} +1 -1
  49. package/dist/workspace-model-SDHH5RBC.js +1 -0
  50. package/dist/workspace-run-EP7XGEM6.js +1 -0
  51. package/dist/workspace-verify-6Q6MGRG6.js +1 -0
  52. package/dist/workspace-watch-JDXVGW4H.js +1 -0
  53. package/docs/README.md +1 -0
  54. package/docs/contracts/ARTIFACT_CATALOG.md +211 -56
  55. package/docs/contracts/CLI_LOG_EVENT_STREAM.md +123 -0
  56. package/docs/contracts/README.md +15 -14
  57. package/docs/create-planner-capabilities.md +81 -0
  58. package/package.json +8 -5
  59. package/dist/analyze-6RFG7C7Z.js +0 -1
  60. package/dist/autopilot-release-QNZ2IL7K.js +0 -1
  61. package/dist/chunk-3SWQKRXH.js +0 -2
  62. package/dist/chunk-6P5DCHBQ.js +0 -4
  63. package/dist/chunk-B2KOIORF.js +0 -1
  64. package/dist/chunk-C7OVQQXT.js +0 -1
  65. package/dist/chunk-C7WILE56.js +0 -1
  66. package/dist/chunk-HEG6DIGW.js +0 -2
  67. package/dist/chunk-RELR4O5E.js +0 -2
  68. package/dist/chunk-T5LN7EO5.js +0 -9
  69. package/dist/chunk-TRXYRHD7.js +0 -2
  70. package/dist/chunk-U6QUN6V2.js +0 -2
  71. package/dist/chunk-UXKB4KGZ.js +0 -13
  72. package/dist/chunk-YJ24EV3P.js +0 -1
  73. package/dist/pipeline-IMB3C3JY.js +0 -5
  74. package/dist/workspace-model-NQVZN5W4.js +0 -1
  75. package/dist/workspace-run-PNMZJNDC.js +0 -1
  76. package/dist/workspace-verify-EO435PS4.js +0 -1
@@ -0,0 +1,5 @@
1
+ import {c}from'./chunk-GYNIVEYP.js';import {b}from'./chunk-WHCON2VN.js';import {b as b$1}from'./chunk-RXWM5DSC.js';import {a as a$1}from'./chunk-VQMZC5TC.js';import {a as a$2}from'./chunk-4FJQWL7P.js';import {a}from'./chunk-KMUWWZRT.js';import {f,e}from'./chunk-4Q2ZZKGB.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$1=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$1,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$1,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={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=f(d,{commandId:"workspacePipeline",exitCode:k,generatedAt:d.generatedAt,blockers:d.blockingReasons,runId:e()});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-SALW6TVR.js'),n=await e({workspacePath:a$3,write:true,refreshContext:true,strict:false});d.agentGrounding={indexPath:n.indexPath,writtenFiles:n.writtenFiles,blockers:n.blockers};}catch{}return d}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,4 +1,4 @@
1
- import {b as b$1,c}from'./chunk-3Q7264EJ.js';import {b}from'./chunk-PPQYTYQG.js';import {promises}from'fs';import g from'path';import r from'chalk';import R from'ora';import {execa}from'execa';var y="21",$="3.5.0",j="2.8.9";function u(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,".").replace(/^\.+|\.+$/g,"").replace(/\.{2,}/g,".").split(".").map(p=>p.replace(/^[^a-z]+/,"").replace(/[^a-z0-9]/g,"")).filter(Boolean).join(".")}function _(e,t){return e.replace(/[\r\n\t]+/g," ").trim()||t}function x(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-")}function M(e,t){let s=u(e)||"com.rapidkit.apps",p=u(t)||"service";return `${s}.${p}`}function E(e){return e.replace(/\./g,"/")}function T(){return JSON.stringify({engine:"npm",runtime:"java"},null,2)}function A(e,t){return JSON.stringify({kit_name:"springboot.standard",runtime:"java",module_support:false,project_name:e.project_name,artifact_id:e.artifact_id,group_id:e.group_id,package_name:e.package_name,app_version:e.app_version,created_by:"rapidkit-npm",rapidkit_version:t,created_at:new Date().toISOString()},null,2)}function P(e){return `<?xml version="1.0" encoding="UTF-8"?>
1
+ import {b as b$1,c}from'./chunk-3Q7264EJ.js';import {b}from'./chunk-6KD5F6LX.js';import {promises}from'fs';import g from'path';import r from'chalk';import R from'ora';import {execa}from'execa';var y="21",$="3.5.0",j="2.8.9";function u(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,".").replace(/^\.+|\.+$/g,"").replace(/\.{2,}/g,".").split(".").map(p=>p.replace(/^[^a-z]+/,"").replace(/[^a-z0-9]/g,"")).filter(Boolean).join(".")}function _(e,t){return e.replace(/[\r\n\t]+/g," ").trim()||t}function x(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-")}function M(e,t){let s=u(e)||"com.rapidkit.apps",p=u(t)||"service";return `${s}.${p}`}function E(e){return e.replace(/\./g,"/")}function T(){return JSON.stringify({engine:"npm",runtime:"java"},null,2)}function A(e,t){return JSON.stringify({kit_name:"springboot.standard",runtime:"java",module_support:false,project_name:e.project_name,artifact_id:e.artifact_id,group_id:e.group_id,package_name:e.package_name,app_version:e.app_version,created_by:"rapidkit-npm",rapidkit_version:t,created_at:new Date().toISOString()},null,2)}function P(e){return `<?xml version="1.0" encoding="UTF-8"?>
2
2
  <project xmlns="http://maven.apache.org/POM/4.0.0"
3
3
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
4
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
@@ -1 +1 @@
1
- export{e as createProject,d as createWorkspace,g as createWorkspaceShareBundle,f as listWorkspaces,c as registerProjectInWorkspace,a as registerWorkspace,b as syncWorkspaceProjects}from'./chunk-RUUDLAKJ.js';
1
+ export{e as createProject,d as createWorkspace,g as createWorkspaceShareBundle,f as listWorkspaces,c as registerProjectInWorkspace,a as registerWorkspace,b as syncWorkspaceProjects}from'./chunk-RXWM5DSC.js';
@@ -1,4 +1,4 @@
1
- import {b,c,d}from'./chunk-3SWQKRXH.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(`
1
+ import {b,c,d}from'./chunk-OWNGSAO3.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
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
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
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(`
@@ -1 +1 @@
1
- export{b as WORKSPACE_CONTEXT_AGENT_REPORT_PATH,a as WORKSPACE_CONTEXT_SCHEMA_VERSION,c as buildWorkspaceAgentContext,d as writeWorkspaceAgentContext}from'./chunk-3SWQKRXH.js';
1
+ export{b as WORKSPACE_CONTEXT_AGENT_REPORT_PATH,a as WORKSPACE_CONTEXT_SCHEMA_VERSION,c as buildWorkspaceAgentContext,d as writeWorkspaceAgentContext}from'./chunk-OWNGSAO3.js';
@@ -1 +1 @@
1
- import {b}from'./chunk-IOIWVHRO.js';import {a}from'./chunk-RV6HBTFC.js';import c from'path';import u from'fs-extra';async function W(t,r){let o=await a(t),d=o?.name||c.basename(t),n,i=c.join(t,".python-version");if(await u.pathExists(i)){let a=(await u.readFile(i,"utf-8")).trim();a&&(n=a);}let e=r?.profile||"polyglot",m=e==="python-only"||e==="polyglot"||e==="enterprise",f=r?.installMethod||o?.metadata?.npm?.installMethod||(m?"poetry":"venv"),s=await b(t,{workspaceName:d,installMethod:f,pythonVersion:n,profile:e,writeMarker:true,writeGitignore:true,onlyIfMissing:!r?.force}),{publishWorkspaceRegistrySummary:y}=await import('./workspace-registry-summary-MIPHVB56.js');return await y(t),{workspacePath:t,created:s,status:s.length>0?"passed":"skipped"}}export{W as ensureWorkspaceFoundation};
1
+ import {b}from'./chunk-ERCD6NFF.js';import {a}from'./chunk-RV6HBTFC.js';import c from'path';import u from'fs-extra';async function W(t,r){let o=await a(t),d=o?.name||c.basename(t),n,i=c.join(t,".python-version");if(await u.pathExists(i)){let a=(await u.readFile(i,"utf-8")).trim();a&&(n=a);}let e=r?.profile||"polyglot",m=e==="python-only"||e==="polyglot"||e==="enterprise",f=r?.installMethod||o?.metadata?.npm?.installMethod||(m?"poetry":"venv"),s=await b(t,{workspaceName:d,installMethod:f,pythonVersion:n,profile:e,writeMarker:true,writeGitignore:true,onlyIfMissing:!r?.force}),{publishWorkspaceRegistrySummary:y}=await import('./workspace-registry-summary-MIPHVB56.js');return await y(t),{workspacePath:t,created:s,status:s.length>0?"passed":"skipped"}}export{W as ensureWorkspaceFoundation};
@@ -0,0 +1,3 @@
1
+ import {a as a$2}from'./chunk-PYCJWW4B.js';import {a as a$1}from'./chunk-HTYMXMQM.js';import {a,b}from'./chunk-S5KTATOU.js';function m(t,n){return [...t.values()].filter(r=>r.id!==n).map(r=>({id:r.id,distance:r.distance,path:r.path,via:r.via})).sort((r,s)=>r.distance-s.distance||r.id.localeCompare(s.id))}function x(t,n){let r=a(t);if(!r.nodeIds.has(n))return {project:n,found:false,centrality:null,directDependents:[],directDependencies:[],transitiveDependents:[],transitiveDependencies:[]};let e=a$1(t).byId.get(n)??null,o=b(r,[n],{direction:"dependents"}),u=b(r,[n],{direction:"dependencies"}),f=(r.reverse.get(n)??[]).slice().sort((d,i)=>d.localeCompare(i)),k=(r.forward.get(n)??[]).slice().sort((d,i)=>d.localeCompare(i));return {project:n,found:true,centrality:e,directDependents:f,directDependencies:k,transitiveDependents:m(o,n),transitiveDependencies:m(u,n)}}function c(t){return t.replace(/"/g,'\\"')}var G={"code-import":"solid","package-dep":"solid","event-pub-sub":"dashed","service-dependsOn":"bold","shared-resource":"dotted"};function C(t){let n=[...t.nodes].sort((e,o)=>e.id.localeCompare(o.id)),r=[...t.edges].sort((e,o)=>e.from.localeCompare(o.from)||e.to.localeCompare(o.to)||e.kind.localeCompare(o.kind)),s=["digraph workspace {"," rankdir=LR;"," node [shape=box];"];for(let e of n)s.push(` "${c(e.id)}";`);for(let e of r){let o=G[e.kind]??"solid";s.push(` "${c(e.from)}" -> "${c(e.to)}" [label="${e.kind}", style=${o}];`);}return s.push("}"),s.join(`
2
+ `)}function l(t){let n=t.replace(/[^A-Za-z0-9_]/g,"_");return /^[A-Za-z_]/.test(n)?n:`n_${n}`}function I(t){let n=[...t.nodes].sort((e,o)=>e.id.localeCompare(o.id)),r=[...t.edges].sort((e,o)=>e.from.localeCompare(o.from)||e.to.localeCompare(o.to)||e.kind.localeCompare(o.kind)),s=["flowchart LR"];for(let e of n)s.push(` ${l(e.id)}["${e.id}"]`);for(let e of r)s.push(` ${l(e.from)} -->|${e.kind}| ${l(e.to)}`);return s.join(`
3
+ `)}function $(t){return {graph:t,integrity:a$2(t),hotspots:a$1(t).hotspots}}export{$ as buildGraphEmit,x as explainGraphNode,C as renderGraphDot,I as renderGraphMermaid};
@@ -0,0 +1 @@
1
+ import a from'path';import i from'fs-extra';var c="workspace-intelligence-history.v1",y=".rapidkit/reports/workspace-intelligence-history.json",p=50;function H(e,t){return {generatedAt:e.generatedAt,kind:"verify",verdict:e.summary.verdict,risk:e.impact.risk,affectedProjects:e.impact.affectedProjects,freshness:e.freshness.verdict,gatePassed:t,blockingReasons:e.blockingReasons.length,policyViolations:e.policyViolations.length}}async function l(e){let t=a.join(e,y);try{if(!await i.pathExists(t))return null;let r=await i.readJson(t);return r?.schemaVersion!==c||!Array.isArray(r.entries)?null:{schemaVersion:c,retention:typeof r.retention=="number"?r.retention:p,entries:r.entries}}catch{return null}}function m(e,t,r=p){let o=Math.max(1,Math.floor(r)),s=[...e?.entries??[],t],n=s.slice(Math.max(0,s.length-o));return {schemaVersion:c,retention:o,entries:n}}async function h(e,t,r){let o=await l(e),s=m(o,t,r?.retention??p),n=a.join(e,y);return await i.ensureDir(a.dirname(n)),await i.writeJson(n,s,{spaces:2}),s}export{p as DEFAULT_HISTORY_RETENTION,y as WORKSPACE_HISTORY_PATH,c as WORKSPACE_HISTORY_SCHEMA_VERSION,m as appendHistoryEntry,H as historyEntryFromVerify,l as readWorkspaceHistory,h as recordWorkspaceHistory};
@@ -1 +1 @@
1
- export{f as WORKSPACE_IMPACT_REPORT_PATH,e as WORKSPACE_IMPACT_SCHEMA_VERSION,d as WORKSPACE_MODEL_DIFF_REPORT_PATH,b as WORKSPACE_MODEL_DIFF_SCHEMA_VERSION,c as WORKSPACE_MODEL_SNAPSHOT_REPORT_PATH,a as WORKSPACE_MODEL_SNAPSHOT_SCHEMA_VERSION,n as buildWorkspaceImpact,i as buildWorkspaceModelSnapshot,k as diffWorkspaceModel,g as isGitDiffSource,h as parseGitDiffRef,m as workspaceVerificationPlan,o as writeWorkspaceImpact,l as writeWorkspaceModelDiff,j as writeWorkspaceModelSnapshot}from'./chunk-U6QUN6V2.js';
1
+ export{f as WORKSPACE_IMPACT_REPORT_PATH,e as WORKSPACE_IMPACT_SCHEMA_VERSION,d as WORKSPACE_MODEL_DIFF_REPORT_PATH,b as WORKSPACE_MODEL_DIFF_SCHEMA_VERSION,c as WORKSPACE_MODEL_SNAPSHOT_REPORT_PATH,a as WORKSPACE_MODEL_SNAPSHOT_SCHEMA_VERSION,n as buildWorkspaceImpact,i as buildWorkspaceModelSnapshot,k as diffWorkspaceModel,g as isGitDiffSource,h as parseGitDiffRef,m as workspaceVerificationPlan,o as writeWorkspaceImpact,l as writeWorkspaceModelDiff,j as writeWorkspaceModelSnapshot}from'./chunk-QPEBI6AB.js';
@@ -0,0 +1 @@
1
+ export{c as WORKSPACE_MODEL_REPORT_PATH,b as WORKSPACE_MODEL_SCHEMA_VERSION,e as buildWorkspaceModel,f as buildWorkspaceModelCached,g as buildWorkspaceModelIncremental,d as validateWorkspaceModelStrict,h as writeWorkspaceModel}from'./chunk-TYZPPUBH.js';
@@ -0,0 +1 @@
1
+ export{a as runWorkspaceStage}from'./chunk-UY4KRFNL.js';export{a as WORKSPACE_RUN_LAST_REPORT_FILENAME}from'./chunk-FV5A3N3I.js';
@@ -0,0 +1 @@
1
+ import {a,b as b$2}from'./chunk-PYCJWW4B.js';import {b as b$1,c,d}from'./chunk-KYH364KQ.js';import {m,f,c as c$1,n,e as e$1}from'./chunk-QPEBI6AB.js';import {e}from'./chunk-TYZPPUBH.js';import {c as c$2}from'./chunk-FV5A3N3I.js';import u from'path';import h from'fs-extra';var _="workspace-verify.v1",H=".rapidkit/reports/workspace-verify-last-run.json";function T(e,s){return u.isAbsolute(s)?s:u.join(e,s)}async function q(e){let s=await h.readJson(e);if(!s||typeof s!="object"||Array.isArray(s))throw new Error(`Workspace impact input is not a JSON object: ${e}`);let t=s;if(t.schemaVersion!==e$1)throw new Error(`Unsupported workspace impact schema: ${String(t.schemaVersion)}`);return t}function z(e){let s=new Set,t=[];for(let r of e){let n=`${r.scope}:${r.project??""}:${r.display}`;s.has(n)||(s.add(n),t.push(r));}return t}function L(e,s){if(!e||e==="workspace")return true;let t=(e.startsWith("project:")?e.slice(8):e).trim().toLowerCase();return s.scope==="workspace"?true:(s.project??"").trim().toLowerCase()===t}function B(e,s){if(e.id==="workspace.doctor")return u.join(s,".rapidkit","reports","doctor-last-run.json");if(e.id==="workspace.contract.verify")return u.join(s,".rapidkit","reports","workspace-contract-verify-last-run.json");if(e.id==="workspace.readiness")return u.join(s,".rapidkit","reports","release-readiness-last-run.json");if(e.id==="workspace.analyze")return u.join(s,".rapidkit","reports","analyze-last-run.json");if(e.id==="workspace.pipeline")return u.join(s,".rapidkit","reports","pipeline-last-run.json");if(e.id.startsWith("project.")&&(e.id.endsWith(".test")||e.id.endsWith(".build")))return u.join(s,".rapidkit","reports","workspace-run-last.json")}function b(e){return !e||typeof e!="object"||Array.isArray(e)?null:e}function J(e){let s=b(e.healthScore),t=typeof s?.errors=="number"?s.errors:0,r=typeof s?.percent=="number"?s.percent:void 0;return t>0?{status:"fail",message:`Doctor evidence reports ${t} error(s).`}:typeof r=="number"&&r<70?{status:"warn",message:`Doctor health score is ${r}%.`}:{status:"pass",message:"Doctor evidence is present and healthy."}}function K(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 G(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 Y(e){let s=b(e.summary);if(s?.blocking===true||e.blocking===true)return {status:"fail",message:"Analyze evidence reports blocking findings."};let r=typeof s?.status=="string"?s.status:void 0;return r==="warn"||r==="warning"?{status:"warn",message:"Analyze evidence reports warnings."}:{status:"pass",message:"Analyze evidence is present."}}function U(e){let s=b(e.summary),t=typeof s?.verdict=="string"?s.verdict:void 0;return t==="blocked"?{status:"fail",message:"Pipeline evidence is blocked."}:t==="needs-attention"?{status:"warn",message:"Pipeline evidence needs attention."}:t==="ready"?{status:"pass",message:"Pipeline evidence is ready."}:{status:"warn",message:"Pipeline evidence status is unknown."}}function Q(e,s,t){let r=s.id.endsWith(".build")?"build":s.id.endsWith(".test")?"test":null,n=c$2(e,r);if(!n)return {status:"missing",message:"Workspace run evidence is missing or unreadable."};let c=n.stage;if(r&&c!==r)return {status:"missing",message:`Workspace run evidence is for stage "${c}", expected "${r}".`};let d=Array.isArray(n.projects)?n.projects:[],o=s.project?.toLowerCase();if(!o)return {status:"missing",message:"Project-scoped workspace run evidence is missing a project identifier."};let p=d.find(g=>{let f=b(g);if(!f)return false;let i=typeof f.projectName=="string"?f.projectName.toLowerCase():"",a=["projectPath","relativePath","path"].map(l=>f[l]).filter(l=>typeof l=="string"&&l.trim().length>0).map(l=>l.replace(/\\/g,"/").toLowerCase());return i===o||a.some(l=>l.endsWith(`/${o}`)||l===o)});if(p){let g=v(n.generatedAt,t,`Workspace run evidence for ${s.project??s.id}`);if(g)return {status:"fail",message:g};let f=b(p),i=typeof f?.status=="string"?f.status:"unknown";return i==="failed"?{status:"fail",message:`Workspace run evidence failed for ${s.project}.`}:i==="passed"?{status:"pass",message:`Workspace run evidence passed for ${s.project}.`}:i==="skipped"?{status:"warn",message:`Workspace run evidence skipped for ${s.project}.`}:{status:"warn",message:`Workspace run evidence status is ${i} for ${s.project}.`}}return {status:"missing",message:`Workspace run evidence does not include project ${s.project}.`}}function v(e,s,t){if(typeof e!="string"||!s)return null;let r=Date.parse(e),n=Date.parse(s);return !Number.isFinite(r)||!Number.isFinite(n)?null:r<n?`${t} is stale: generated at ${e}, before impact ${s}.`:null}async function X(e,s,t,r){let n=B(e,s),c=n?u.relative(s,n).split(u.sep).join("/"):void 0;if(e.id==="workspace.contract.verify"&&!t)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(!n||!await h.pathExists(n))return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"missing",required:e.required,evidencePath:c,message:c?`Missing evidence report: ${c}`:"No evidence mapping exists for this command."};let d=b(await h.readJson(n));if(!d)return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"fail",required:e.required,evidencePath:c,message:"Evidence report is not a JSON object."};let o;if(e.id==="workspace.doctor"){let p=v(d.generatedAt,r,"Doctor evidence");p?o={status:"fail",message:p}:o=J(d);}else if(e.id==="workspace.readiness"){let p=v(d.generatedAt,r,"Release readiness evidence");p?o={status:"fail",message:p}:o=K(d);}else if(e.id==="workspace.contract.verify"){let p=v(d.generatedAt,r,"Workspace contract verify evidence");p?o={status:"fail",message:p}:o=G(d);}else if(e.id==="workspace.analyze"){let p=v(d.generatedAt,r,"Analyze evidence");p?o={status:"fail",message:p}:o=Y(d);}else if(e.id==="workspace.pipeline"){let p=v(d.generatedAt,r,"Pipeline evidence");p?o={status:"fail",message:p}:o=U(d);}else if(e.id.startsWith("project."))o=Q(d,e,r);else {let p=v(d.generatedAt,r,"Evidence report");p?o={status:"fail",message:p}: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:c,message:o.message}}function Z(e,s={blockingReasons:[],needsAttention:false}){let t=e.filter(i=>i.status==="pass").length,r=e.filter(i=>i.status==="warn").length,n=e.filter(i=>i.status==="fail").length,c=e.filter(i=>i.status==="missing").length,d=e.filter(i=>i.status==="skipped").length,o=e.filter(i=>i.required&&(i.status==="fail"||i.status==="missing")).map(i=>`${i.id}: ${i.message}`),p=e.filter(i=>i.required&&i.status==="missing").length,g="ready",f=0;return o.length>0||s.blockingReasons.length>0?(g="blocked",f=2):(r>0||p>0||s.needsAttention)&&(g="needs-attention",f=1),{verdict:g,exitCode:f,stepsPassed:t,stepsWarn:r,stepsFailed:n,stepsMissing:c,stepsSkipped:d}}function ee(e,s){let t=j(e.affectedProjects.map(a=>a.project?.name).filter(a=>typeof a=="string")),r=new Set(t.map(a=>a.toLowerCase())),n=j(e.transitiveImpact.map(a=>a.project?.name).filter(a=>typeof a=="string").filter(a=>!r.has(a.toLowerCase()))),c=new Map;for(let a of s){if(a.scope!=="project"||!a.project)continue;let l=a.project.toLowerCase(),y=c.get(l)??[];y.push(a),c.set(l,y);}let d=[],o=[],p=[],g=[],f=false,i=(a,l)=>{let y=c.get(a.toLowerCase())??[];if(y.length===0){p.push(a);return}let W=y.filter(k=>k.status==="fail"),w=y.filter(k=>k.status==="missing"),P=w.filter(k=>k.required),V=y.some(k=>k.status==="pass"||k.status==="warn");if(W.length>0){o.push(a),g.push(`graph.subgraph.${a}: ${l} has failed verification evidence (${W.map(k=>k.id).join(", ")}).`);return}if(P.length>0){o.push(a),g.push(`graph.subgraph.${a}: ${l} has missing required verification evidence (${P.map(k=>k.id).join(", ")}).`);return}if(w.length>0){o.push(a),f=true;return}if(V){d.push(a);return}p.push(a);};for(let a of t)i(a,"directly-changed");for(let a of n)i(a,"transitive dependent");return {subgraph:{totalProjects:t.length+n.length,directlyChanged:t,transitiveDependents:n,covered:j(d),uncovered:j(o),unverifiable:j(p)},blockingReasons:g,needsAttention:f}}function j(e){return [...new Set(e)].sort((s,t)=>s.localeCompare(t))}async function se(e$2){let s=u.resolve(e$2.workspacePath);if(e$2.fromImpactPath){let c=T(s,e$2.fromImpactPath);return {impact:await q(c),fromImpactRef:u.relative(s,c).split(u.sep).join("/")}}let t=u.join(s,f);if(await h.pathExists(t))return {impact:await q(t),fromImpactRef:f};let r=u.join(s,c$1);if(await h.pathExists(r))return {impact:await n({workspacePath:s,fromPath:c$1,scope:e$2.scope,includeAbsolutePaths:e$2.includeAbsolutePaths,includeEvidence:e$2.includeEvidence,observableScanDepth:e$2.observableScanDepth,now:e$2.now}),fromImpactRef:c$1};let n$1=await e({workspacePath:s,includeAbsolutePaths:e$2.includeAbsolutePaths,includeEvidence:e$2.includeEvidence,observableScanDepth:e$2.observableScanDepth,now:e$2.now});return {impact:{schemaVersion:e$1,generatedAt:(e$2.now??new Date).toISOString(),fromRef:"baseline",diffRef:".rapidkit/reports/workspace-model-diff-last-run.json",workspace:{name:n$1.workspace.name,profile:n$1.workspace.profile,type:n$1.workspace.type},summary:{changed:false,risk:"none",affectedProjects:0,workspaceItems:0,recommendedCommands:0,blastRadius:{directlyAffected:0,transitivelyAffected:0,maxDistance:0,graphEdges:n$1.graph?.edges.length??0}},affectedProjects:[],transitiveImpact:[],criticalPathHotspots:[],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$2.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:n$1}}}}async function me(e){let s=u.resolve(e.workspacePath),{impact:t,fromImpactRef:r}=await se(e),n=t.diff.currentModel,c$1=z([...m(),...t.verificationPlan]).filter(m=>L(e.scope,m)),d$1=[];for(let m of c$1)d$1.push(await X(m,s,n.contracts.exists===true,t.generatedAt));let o=ee(t,d$1),p=a(n.graph??{nodes:[],edges:[]}),g=b$1(n),f=await ne(s),i=c(g,f?.freshness?.projectHashes),a$1={verdict:i.verdict,baseline:i.baseline,changed:i.changed,added:i.added,removed:i.removed,projectHashes:d(g)},l=b$2(p),y=n.policies?.mode??"warn",W=await te(n,s),w=re(y,W),P=Z(d$1,{blockingReasons:[...o.blockingReasons,...l,...w.blockingReasons],needsAttention:o.needsAttention||w.needsAttention}),V=d$1.filter(m=>m.status==="missing"&&m.evidencePath).map(m=>m.evidencePath),N=[...d$1.filter(m=>m.required&&(m.status==="fail"||m.status==="missing")).map(m=>`${m.id}: ${m.message}`),...o.blockingReasons,...l,...w.blockingReasons];return {schemaVersion:_,generatedAt:(e.now??new Date).toISOString(),workspacePath:s,mode:"evidence",fromImpactRef:r,scope:e.scope,impact:{changed:t.summary.changed,risk:t.summary.risk,affectedProjects:t.summary.affectedProjects,recommendedCommands:t.summary.recommendedCommands},summary:P,steps:d$1,missingEvidence:V,blockingReasons:N,verificationPlan:c$1,affectedSubgraph:o.subgraph,graphIntegrity:p,freshness:a$1,policyMode:y,policyViolations:W}}async function te(e,s){let t=[];for(let n of e.validation?.issues??[])t.push({source:"model",severity:n.severity,code:n.code,message:n.message,target:n.target});let r=u.join(s,".rapidkit","reports","workspace-contract-verify-last-run.json");try{if(await h.pathExists(r)){let n=await h.readJson(r);if(Array.isArray(n.violations))for(let c of n.violations)typeof c=="string"&&c.trim().length>0&&t.push({source:"contract",severity:"error",code:"contract.violation",message:c});}}catch{}return t.sort((n,c)=>n.source!==c.source?n.source.localeCompare(c.source):n.code!==c.code?n.code.localeCompare(c.code):n.message.localeCompare(c.message))}function re(e,s){let t=s.filter(r=>r.severity==="error");return e==="enforce"&&t.length>0?{blockingReasons:t.map(r=>`policy.${r.code}: ${r.message}`),needsAttention:false}:{blockingReasons:[],needsAttention:t.length>0}}async function ne(e){let s=u.join(e,H);try{if(!await h.pathExists(s))return null;let t=await h.readJson(s);return t&&t.schemaVersion===_?t:null}catch{return null}}async function ke(e,s){let t=u.join(s,H);return await h.ensureDir(u.dirname(t)),await h.writeJson(t,e,{spaces:2}),t}function ie(e,s){let t=s?.strict?"strict":"default",r=[];if(e.summary.verdict==="blocked")return r.push(...e.blockingReasons),r.length===0&&r.push("verify verdict is blocked."),{passed:false,mode:t,exitCode:2,reasons:r};if(t==="strict"){if(e.summary.verdict!=="ready"&&r.push(`verify verdict is ${e.summary.verdict} (strict requires ready).`),e.freshness.verdict==="stale"){let n=[...e.freshness.changed,...e.freshness.added].slice(0,5);r.push(`freshness is stale${n.length>0?`: ${n.join(", ")}`:""} (strict requires fresh).`);}if(r.length>0)return {passed:false,mode:t,exitCode:1,reasons:r}}return {passed:true,mode:t,exitCode:e.summary.exitCode===2?0:e.summary.exitCode,reasons:r}}function he(e,s){let t=ie(e,s);return t.passed?e.summary.verdict==="blocked"?2:s?.strict&&e.summary.verdict!=="ready"?1:e.summary.exitCode:t.exitCode}export{H as WORKSPACE_VERIFY_REPORT_PATH,_ as WORKSPACE_VERIFY_SCHEMA_VERSION,me as buildWorkspaceVerify,ee as computeAffectedSubgraphGate,ie as evaluateWorkspaceVerifyGate,he as workspaceVerifyExitCode,ke as writeWorkspaceVerify};
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-KYH364KQ.js';import {g as g$1}from'./chunk-TYZPPUBH.js';import {d}from'./chunk-X7PWDIQW.js';import b from'fs';var M="workspace-watch-event.v1";function g(t){return `${t.from}\0${t.to}\0${t.kind}`}function f(t){return (t.graph?.edges??[]).map(r=>({from:r.from,to:r.to,kind:r.kind}))}function m(t){let o=[...a(t).entries()].sort((a,n)=>a[0].localeCompare(n[0])).map(([a,n])=>({id:a,hash:n})),c=f(t).map(g).sort((a,n)=>a.localeCompare(n));return d({projects:o,edges:c})}function w(t,r){let o=a(r),c=t?a(t):new Map,a$1=[],n=[];for(let[e,s]of o.entries())c.has(e)?c.get(e)!==s&&a$1.push(e):n.push(e);let d=[];for(let e of c.keys())o.has(e)||d.push(e);let i=new Map(t?f(t).map(e=>[g(e),e]):[]),l=new Map(f(r).map(e=>[g(e),e])),p=[];for(let[e,s]of l.entries())i.has(e)||p.push(s);let h=[];for(let[e,s]of i.entries())l.has(e)||h.push(s);let u=(e,s)=>g(e).localeCompare(g(s));return a$1.sort((e,s)=>e.localeCompare(s)),n.sort((e,s)=>e.localeCompare(s)),d.sort((e,s)=>e.localeCompare(s)),p.sort(u),h.sort(u),{changedProjects:a$1,addedProjects:n,removedProjects:d,edgesAdded:p,edgesRemoved:h}}var k=class{model=null;sequence=0;rebuild;now;constructor(r,o){this.rebuild=o?.rebuild??(()=>g$1({...r})),this.now=o?.now??(()=>new Date);}get currentModel(){return this.model}async start(){let r=Date.now(),{model:o}=await this.rebuild();return this.model=o,this.buildEvent("ready","initial",null,o,Date.now()-r)}async pulse(){let r=Date.now(),o=this.model,{model:c,mode:a}=await this.rebuild(),n=this.buildEvent(this.hasStructuralChange(o,c)?"changed":"unchanged",a,o,c,Date.now()-r);return this.model=c,n}hasStructuralChange(r,o){return r?m(r)!==m(o):true}buildEvent(r,o,c,a,n){let d=w(c,a),i=m(a),l=c?m(c)!==i:true;return {schemaVersion:M,kind:r,sequence:this.sequence++,timestamp:this.now().toISOString(),mode:o,modelHash:i,modelHashChanged:l,changedProjects:d.changedProjects,addedProjects:d.addedProjects,removedProjects:d.removedProjects,graph:{nodeCount:a.graph?.nodes.length??0,edgeCount:a.graph?.edges.length??0,edgesAdded:d.edgesAdded,edgesRemoved:d.edgesRemoved},durationMs:n}}},P=new Set([".git",".hg",".svn","node_modules",".venv","venv","dist","build","out","target","coverage","htmlcov",".next",".turbo",".cache"]),R=new Set(["reports","cache","tmp",".cache"]);function y(t){if(!t)return false;let r=t.split(/[\\/]/).filter(Boolean);if(r.some(o=>P.has(o)))return false;for(let o=0;o<r.length-1;o+=1)if(r[o]===".rapidkit"&&R.has(r[o+1]))return false;return true}async function D(t){let r=new k(t.buildOptions,t.engineOptions),o=await r.start();if(t.emit(o),t.once)return;let c=t.debounceMs??250,a=t.selfWriteSuppressionMs??Math.max(400,c+150),n=null,d=false,i=false,l=0,p=async()=>{if(d){i=true;return}d=true;try{let e=await r.pulse();t.emit(e);}catch(e){t.emit({schemaVersion:M,kind:"error",sequence:-1,timestamp:new Date().toISOString(),mode:"full",modelHash:r.currentModel?m(r.currentModel):"",modelHashChanged:false,changedProjects:[],addedProjects:[],removedProjects:[],graph:{nodeCount:0,edgeCount:0,edgesAdded:[],edgesRemoved:[]},durationMs:0,error:e instanceof Error?e.message:String(e)});}finally{d=false,l=Date.now()+a,i&&(i=false,p());}},h=e=>{y(e)&&(d||Date.now()<l||(n&&clearTimeout(n),n=setTimeout(()=>{n=null,p();},c)));};t.onProgress?.(`Watching ${t.workspacePath} for changes (Ctrl+C to stop).`);let u=b.watch(t.workspacePath,{recursive:true},(e,s)=>{typeof s=="string"?h(s):s&&h(Buffer.from(s).toString("utf8"));});await new Promise(e=>{let s=()=>{n&&clearTimeout(n),u.close(),e();};if(t.signal){if(t.signal.aborted){s();return}t.signal.addEventListener("abort",s,{once:true});}u.on("error",()=>s());});}export{M as WORKSPACE_WATCH_EVENT_SCHEMA_VERSION,k as WorkspaceWatchEngine,m as computeWatchModelHash,w as diffWatchModels,y as isWatchRelevantPath,D as runWorkspaceWatch};
package/docs/README.md CHANGED
@@ -18,6 +18,7 @@ Hub for user and contributor documentation. Start with the [main README](../READ
18
18
  | [commands-reference.md](./commands-reference.md) | Full CLI syntax, profiles, and policy keys |
19
19
  | [workspace-operations.md](./workspace-operations.md) | Import, adopt, snapshots, archives, contracts, infra |
20
20
  | [workspace-run.md](./workspace-run.md) | Polyglot fleet orchestration (`workspace run`) |
21
+ | [create-planner-capabilities.md](./create-planner-capabilities.md) | Native create, external-create-adopt, and adopt-only lanes |
21
22
  | [from-code-to-shared-understanding.md](./from-code-to-shared-understanding.md) | GitHub-rendered Workspace Intelligence diagram |
22
23
  | [OPEN_SOURCE_USER_SCENARIOS.md](./OPEN_SOURCE_USER_SCENARIOS.md) | Role-based workflows (junior → enterprise) |
23
24
  | [doctor-command.md](./doctor-command.md) | Doctor scopes, CI exit codes, JSON evidence |
@@ -4,70 +4,224 @@ Canonical map of **on-disk artifacts** produced by `rapidkit-npm` commands. Dash
4
4
 
5
5
  ## Authority layers (identity)
6
6
 
7
- | Artifact | Path | Writer | Reader purpose |
8
- | --- | --- | --- | --- |
9
- | Workspace manifest | `.rapidkit/workspace.json` | `create workspace`, `foundation ensure`, `bootstrap` (profile) | Profile, engine, bootstrap metadata — **not** project list |
10
- | Workspace contract | `.rapidkit/workspace.contract.json` | `workspace sync`, `workspace contract *`, import/adopt | Operational project registry (ports, contracts) |
11
- | Registry summary | `.rapidkit/workspace-registry.v1.json` | `workspace sync`, contract sync, `registry status --refresh` | **Canonical** project count + authority for UI/CI |
12
- | Workspace marker | `.rapidkit-workspace` | `create workspace`, `foundation ensure` | Root detection |
7
+ | Artifact | Path | Writer | Reader purpose |
8
+ | ------------------ | -------------------------------------- | -------------------------------------------------------------- | ---------------------------------------------------------- |
9
+ | Workspace manifest | `.rapidkit/workspace.json` | `create workspace`, `foundation ensure`, `bootstrap` (profile) | Profile, engine, bootstrap metadata — **not** project list |
10
+ | Workspace contract | `.rapidkit/workspace.contract.json` | `workspace sync`, `workspace contract *`, import/adopt | Operational project registry (ports, contracts) |
11
+ | Registry summary | `.rapidkit/workspace-registry.v1.json` | `workspace sync`, contract sync, `registry status --refresh` | **Canonical** project count + authority for UI/CI |
12
+ | Workspace marker | `.rapidkit-workspace` | `create workspace`, `foundation ensure` | Root detection |
13
13
 
14
14
  ## Naming conventions
15
15
 
16
- | Pattern | Meaning | Examples |
17
- | --- | --- | --- |
18
- | `*-last-run.json` | Latest gate/run evidence | `doctor-last-run.json`, `pipeline-last-run.json` |
19
- | `*.latest.json` | Rolling alias + timestamped siblings | `bootstrap-compliance.latest.json`, `mirror-ops.latest.json` |
20
- | Static state | Current model/state (not a single run) | `workspace-model.json`, `workspace.contract.json` |
16
+ | Pattern | Meaning | Examples |
17
+ | ----------------- | -------------------------------------- | ------------------------------------------------------------ |
18
+ | `*-last-run.json` | Latest gate/run evidence | `doctor-last-run.json`, `pipeline-last-run.json` |
19
+ | `*.latest.json` | Rolling alias + timestamped siblings | `bootstrap-compliance.latest.json`, `mirror-ops.latest.json` |
20
+ | Static state | Current model/state (not a single run) | `workspace-model.json`, `workspace.contract.json` |
21
21
 
22
22
  ## Governance evidence loop
23
23
 
24
- | Command | Primary artifact | Schema version | JSON Schema |
25
- | --- | --- | --- | --- |
26
- | `doctor workspace` | `.rapidkit/reports/doctor-last-run.json` | `doctor-workspace-evidence-v1` | `contracts/doctor-workspace-evidence.v1.json` |
27
- | `doctor project` | `.rapidkit/reports/doctor-project-last-run.json` | `doctor-project-evidence-v1` | `contracts/doctor-project-evidence.v1.json` |
28
- | `analyze` | `.rapidkit/reports/analyze-last-run.json` | `rapidkit-analyze-v1` | `contracts/analyze-last-run.v1.json` |
29
- | `readiness` | `.rapidkit/reports/release-readiness-last-run.json` | `release-readiness-v1` | `contracts/release-readiness.v1.json` |
30
- | `pipeline` | `.rapidkit/reports/pipeline-last-run.json` | Also triggers agent grounding sync unless `--no-agent-sync` | `rapidkit-pipeline-v1` | `contracts/pipeline-last-run.v1.json` |
31
- | `autopilot release` | `.rapidkit/reports/autopilot-release-last-run.json` | `autopilot-release-v1` | — |
32
- | | `.rapidkit/reports/autopilot-release.json` | (alias, same payload) | — |
24
+ | Command | Primary artifact | Schema version | JSON Schema |
25
+ | ------------------- | --------------------------------------------------- | ----------------------------------------------------------- | --------------------------------------------- | ------------------------------------- |
26
+ | `doctor workspace` | `.rapidkit/reports/doctor-last-run.json` | `doctor-workspace-evidence-v1` | `contracts/doctor-workspace-evidence.v1.json` |
27
+ | `doctor project` | `.rapidkit/reports/doctor-project-last-run.json` | `doctor-project-evidence-v1` | `contracts/doctor-project-evidence.v1.json` |
28
+ | `analyze` | `.rapidkit/reports/analyze-last-run.json` | `rapidkit-analyze-v1` | `contracts/analyze-last-run.v1.json` |
29
+ | `readiness` | `.rapidkit/reports/release-readiness-last-run.json` | `release-readiness-v1` | `contracts/release-readiness.v1.json` |
30
+ | `pipeline` | `.rapidkit/reports/pipeline-last-run.json` | Also triggers agent grounding sync unless `--no-agent-sync` | `rapidkit-pipeline-v1` | `contracts/pipeline-last-run.v1.json` |
31
+ | `autopilot release` | `.rapidkit/reports/autopilot-release-last-run.json` | `autopilot-release-v1` | — |
32
+ | | `.rapidkit/reports/autopilot-release.json` | (alias, same payload) | — |
33
33
 
34
34
  Side/cache (not gates): `.rapidkit/reports/doctor-workspace-cache.json` (`doctor-workspace-cache-v2`).
35
35
 
36
36
  ## Workspace intelligence
37
37
 
38
- | Command | Artifact | Schema | Contract file |
39
- | --- | --- | --- | --- |
40
- | `workspace model --write` | `workspace-model.json` | `workspace-model.v1` | `contracts/workspace-intelligence/workspace-model.v1.json` |
41
- | `workspace snapshot` | `workspace-model-snapshot.json` | `workspace-model-snapshot.v1` | `workspace-model-snapshot.v1.json` |
42
- | `workspace diff` | `workspace-model-diff-last-run.json` | `workspace-model-diff.v1` | `workspace-model-diff.v1.json` |
43
- | `workspace impact --from <diff>` | `workspace-impact-last-run.json` | `workspace-impact.v1` | `workspace-impact.v1.json` |
44
- | `workspace verify` | `workspace-verify-last-run.json` | `workspace-verify.v1` | `workspace-verify.v1.json` |
45
- | `workspace context --write` | `workspace-context-agent.json` | `workspace-context.v1` | `workspace-context.v1.json` |
46
- | `workspace agent-sync --write` | `reports/INDEX.json`, `AGENT-GROUNDING.md`, `AGENTS.md`, Copilot/Cursor/Claude hooks | `rapidkit-agent-reports-index.v1` | — |
38
+ | Command | Artifact | Schema | Contract file |
39
+ | -------------------------------- | ------------------------------------------------------------------------------------ | --------------------------------- | ---------------------------------------------------------- |
40
+ | `workspace model --write` | `workspace-model.json` | `workspace-model.v1` | `contracts/workspace-intelligence/workspace-model.v1.json` |
41
+ | `workspace snapshot` | `workspace-model-snapshot.json` | `workspace-model-snapshot.v1` | `workspace-model-snapshot.v1.json` |
42
+ | `workspace diff` | `workspace-model-diff-last-run.json` | `workspace-model-diff.v1` | `workspace-model-diff.v1.json` |
43
+ | `workspace impact --from <diff>` | `workspace-impact-last-run.json` | `workspace-impact.v1` | `workspace-impact.v1.json` |
44
+ | `workspace verify` | `workspace-verify-last-run.json` | `workspace-verify.v1` | `workspace-verify.v1.json` |
45
+ | `workspace context --write` | `workspace-context-agent.json` | `workspace-context.v1` | `workspace-context.v1.json` |
46
+ | `workspace agent-sync --write` | `reports/INDEX.json`, `AGENT-GROUNDING.md`, `AGENTS.md`, Copilot/Cursor/Claude hooks | `rapidkit-agent-reports-index.v1` | — |
47
47
 
48
48
  **CLI semantics:** `workspace diff --from` expects a **model or snapshot** baseline. `workspace impact --from` expects a **diff report**.
49
49
 
50
+ ### Dependency graph (`workspace-dependency-graph.v1`)
51
+
52
+ The dependency graph is the first-class structure that promotes inter-project
53
+ relationships out of `workspace run`'s private logic into one versioned source
54
+ of truth consumed by `impact` (transitive blast radius), `verify`
55
+ (subgraph-scoped gating), `run --blast-radius`, and risk weighting.
56
+
57
+ | Field | Meaning |
58
+ | ----- | ------- |
59
+ | `nodes` | Projects in the workspace (`id`, workspace-relative `path`). |
60
+ | `edges` | Directed `from → to` relationships (`from` depends on `to`). Each edge carries a typed `kind`, a `source` (provenance), a `confidence` bucket, and `evidence` (the files that justify it). |
61
+ | `stats` | Counts (`nodeCount`, `edgeCount`, per-source edge counts) and `hasCycle` for the integrity gate. |
62
+
63
+ Edge `kind` ∈ `code-import`, `package-dep`, `event-pub-sub`, `service-dependsOn`,
64
+ `shared-resource`. Edge `source` ∈ `inferred`, `contract`, `manual` (`manual`/`contract`
65
+ are authoritative and override an `inferred` edge of the same kind between the same
66
+ nodes). Canonical source: `src/contracts/workspace-dependency-graph-contract.ts`;
67
+ JSON Schema: `contracts/workspace-intelligence/workspace-dependency-graph.v1.json`.
68
+
69
+ **Inference engine.** The graph is derived deterministically by
70
+ `src/workspace-dependency-graph.ts` (`inferWorkspaceDependencyGraph`) from multiple
71
+ sources: package manifests (`package.json` deps, `pyproject.toml` path deps, `go.mod`
72
+ replace → `package-dep`), cross-boundary JS/TS source imports (`code-import`), the
73
+ workspace contract (`dependsOn` → `service-dependsOn`, matched `publishes`/`consumes`
74
+ → `event-pub-sub`, env↔port references → `shared-resource`), and an optional manual
75
+ override file. Node/edge ordering and `hashDependencyGraph` are stable, so the graph is
76
+ embedded as a first-class field of `workspace-model.v1` (`model.graph`) on every
77
+ `buildWorkspaceModel` run; `hashModel` normalizes the embedded `graph.generatedAt` so the
78
+ structural graph participates in the model hash without causing timestamp drift.
79
+ (`model.graph` is additive/optional for pre-graph readers.)
80
+
81
+ **Manual overrides.** `.rapidkit/workspace-graph.overrides.json` (`{ "edges": [{ "from",
82
+ "to", "kind", "evidence" }] }`) declares authoritative edges that win over inference for
83
+ the same `(from, to, kind)`.
84
+
85
+ **Graph-aware impact.** `workspace impact` consumes the graph for a true transitive
86
+ blast radius: alongside `affectedProjects` (directly changed) it emits `transitiveImpact[]`
87
+ — projects reached only through the graph, each with `origin: 'transitive'`, `distance`,
88
+ the shortest dependency `path`, and `via` (edge kind). `summary.blastRadius`
89
+ (`directlyAffected`, `transitivelyAffected`, `maxDistance`, `graphEdges`) summarizes the
90
+ reach. Both arrays feed the `verificationPlan`.
91
+
92
+ **Graph-aware verify.** `workspace verify` gates the **whole affected subgraph**, not just
93
+ the changed node. `affectedSubgraph` (`directlyChanged`, `transitiveDependents`, `covered`,
94
+ `uncovered`, `unverifiable`) records coverage per project: a dependent with failed or
95
+ missing-required verification evidence becomes a `graph.subgraph.<project>` blocking reason;
96
+ missing non-required evidence escalates the verdict to `needs-attention`; a dependent with no
97
+ applicable verification command is `unverifiable` (informational, never blocking).
98
+
99
+ **Centrality-weighted risk.** `workspace impact` computes graph centrality
100
+ (`fanIn`/`fanOut`/`reach`/`betweenness`) per project; each impact item carries `centrality`,
101
+ a directly-changed critical-path hotspot escalates its risk one level, and the report lists
102
+ `criticalPathHotspots[]` (ranked by reach then betweenness). Canonical source:
103
+ `src/workspace-graph-centrality.ts` (`computeGraphCentrality`).
104
+
105
+ **Graph integrity gate.** `workspace verify` emits `graphIntegrity` (`ok`, `cycles`,
106
+ `danglingEdges`, `orphans`, `stats`). Cycles and dangling edges are blocking
107
+ (`graph.integrity.cycle` / `graph.integrity.dangling` reasons); orphans are informational.
108
+ Canonical source: `src/workspace-graph-integrity.ts` (`checkGraphIntegrity`).
109
+
110
+ **Watch / daemon mode.** `workspace watch [--json] [--once]` keeps the model + graph in
111
+ memory and streams `workspace-watch-event.v1` records (`ready`/`changed`/`unchanged`/`error`)
112
+ on each settled change, driven by graph-aware incremental rebuilds. Events carry changed/added/
113
+ removed projects, graph edge deltas, structural `modelHash`, and `mode`/`durationMs`. Canonical
114
+ source: `src/workspace-watch.ts`.
115
+
116
+ **Health/impact history.** Each `workspace verify` run appends a compact record to
117
+ `.rapidkit/reports/workspace-intelligence-history.json` (`workspace-intelligence-history.v1`),
118
+ a ring buffer capped at the 50 most-recent entries (verdict, risk, freshness, gate, counts).
119
+ Canonical source: `src/workspace-history.ts`.
120
+
121
+ **Verify gate + policy violations.** `workspace verify --json` emits a `gate`
122
+ object (`passed`, `mode`, `exitCode`, `reasons`) from `evaluateWorkspaceVerifyGate` — the
123
+ definitive pre-action gate (default fails on `blocked`; `--strict` also fails on
124
+ `needs-attention` and `stale` freshness). It also emits `policyMode` + `policyViolations[]`
125
+ (model validation issues + contract `violations`); in `enforce` mode error-severity violations
126
+ block, in `warn` mode they escalate to needs-attention.
127
+
128
+ **Graph-aware freshness.** `workspace verify` emits a `freshness` block
129
+ (`verdict: fresh|stale|unknown`, `changed`/`added`/`removed`, `projectHashes`). Each project's
130
+ `transitiveInputsHash` chains its own content hash with its transitive dependencies' hashes, so
131
+ a dependency change makes every dependent stale deterministically. The verdict compares against
132
+ the previously written verify report. Canonical source: `src/workspace-graph-freshness.ts`.
133
+
134
+ **Graph command surface.** `workspace graph` emits the graph plus integrity + hotspots;
135
+ `workspace graph explain <project>` returns centrality and direct/transitive relationships;
136
+ `workspace graph dot|mermaid` render deterministic visualizations. Canonical source:
137
+ `src/workspace-graph.ts`. The `graph` subcommand is part of `WORKSPACE_SUBCOMMANDS` and is
138
+ published via `runtime-command-surface.v1` for IDE/CI capability detection.
139
+
140
+ ### Model cache (`workspace-model-cache.v1`)
141
+
142
+ On-disk path: `.rapidkit/cache/workspace-model.v1.json`. Opt-in (`workspace model --cache`)
143
+ cache keyed by `inputsHash` — a deterministic fingerprint of the project set, per-project
144
+ manifest contents, workspace files (contract/workspace.json/policies), build flags, and CLI
145
+ version. On a hit the stored model is returned byte-for-byte; on a miss it is rebuilt and
146
+ rewritten. Canonical source: `src/workspace-model-cache.ts` (`computeModelInputsHash`,
147
+ `buildWorkspaceModelCached`). Granularity is manifest/project-set level, not per-source-file.
148
+
149
+ The envelope also stores per-project signatures (`computeProjectSignatures`: manifest hashes +
150
+ a source fingerprint of `path:size:mtime`) and workspace-file signatures, powering
151
+ `workspace model --incremental` (`buildWorkspaceModelIncremental`): unchanged project models are
152
+ reused and the dependency graph re-infers only edges incident to changed projects
153
+ (`inferWorkspaceDependencyGraphIncremental`). It falls back to a full rebuild on workspace-file
154
+ changes or project renames, and rescans code-imports fully when the node set changes. Reported
155
+ modes: `full` / `incremental` / `unchanged`.
156
+
157
+ ### Freshness metadata (`rapidkit-freshness-metadata-v1`)
158
+
159
+ Intelligence reports carry a shared freshness envelope so any consumer (CLI
160
+ `workspace verify`, Workspai, CI) can detect staleness **without** re-running the
161
+ whole chain:
162
+
163
+ | Field | Meaning |
164
+ | ----- | ------- |
165
+ | `generatedAt` | ISO-8601 timestamp the report was produced. |
166
+ | `inputsHash` | Stable sha256 of the inputs that produced the report. If a freshly recomputed inputs hash differs, the report is stale. |
167
+
168
+ Canonical source: `src/contracts/freshness-metadata-contract.ts`
169
+ (`computeInputsHash`, `buildFreshnessMetadata`, `assessFreshness`). Verdicts:
170
+ `fresh` (hashes match), `stale` (hashes differ), `unknown` (either side missing,
171
+ e.g. legacy reports).
172
+
173
+ ### Run correlation (`runId`)
174
+
175
+ When a command runs through the CLI with the structured log stream active, the
176
+ persisted intelligence artifacts (`workspace-model.json`, `workspace-model-snapshot.json`,
177
+ `workspace-model-diff-last-run.json`, `workspace-impact*.json`, `workspace-context-agent.json`)
178
+ carry a top-level `runId`. It matches the `runId` on the `cli-log-event.v1` stream
179
+ (`run.started`/`progress`/`run.completed`), so a consumer can tie an on-disk report
180
+ to the exact run that produced it. `runId` is added at write time only and is
181
+ ignored by `modelHash`/diff comparisons, so deterministic hashing is unaffected.
182
+ Canonical source: `src/observability/run-correlation.ts` (`attachRunCorrelation`).
183
+
50
184
  ## Operational / platform
51
185
 
52
- | Command | Artifact | Notes |
53
- | --- | --- | --- |
54
- | `workspace run` | `workspace-run-last.json` | `workspace-run-v1` (multi-stage: `stages.test`, `stages.build`, …) | `contracts/workspace-run-last.v1.json` |
55
- | `autopilot release` (run stages) | same `workspace-run-last.json` | Autopilot publishes test/build into aggregate (no separate `autopilot-workspace-run-*.json`) | — |
56
- | `bootstrap` | `bootstrap-compliance-{ts}.json`, `bootstrap-compliance.latest.json` | |
57
- | `mirror status` | `mirror-ops-{ts}.json`, `mirror-ops.latest.json` | |
58
- | `mirror` (transparency) | `transparency-evidence-{ts}.json`, `transparency-evidence.latest.json` | |
59
- | `infra plan` | `infra-plan.json` | `rapidkit.infra-plan.v1` |
60
- | `workspace archive` | `archive-manifest.json` | Root `.rapidkit/`, handoff |
61
- | `workspace share` | `reports/share-bundle.json` (default) | Aggregation bundle |
62
- | `import` / `adopt` | `{project}/.rapidkit/import-readiness.json` | Per project |
63
- | `workspace contract verify` | `workspace-contract-verify-last-run.json` | CLI verify cache |
186
+ | Command | Artifact | Notes |
187
+ | -------------------------------- | ---------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------- |
188
+ | `workspace run` | `workspace-run-last.json` | `workspace-run-v1` (multi-stage: `stages.test`, `stages.build`, …) | `contracts/workspace-run-last.v1.json` |
189
+ | `autopilot release` (run stages) | same `workspace-run-last.json` | Autopilot publishes test/build into aggregate (no separate `autopilot-workspace-run-*.json`) | — |
190
+ | `bootstrap` | `bootstrap-compliance-{ts}.json`, `bootstrap-compliance.latest.json` | |
191
+ | `mirror status` | `mirror-ops-{ts}.json`, `mirror-ops.latest.json` | |
192
+ | `mirror` (transparency) | `transparency-evidence-{ts}.json`, `transparency-evidence.latest.json` | |
193
+ | `infra plan` | `infra-plan.json` | `rapidkit.infra-plan.v1` |
194
+ | `workspace archive` | `archive-manifest.json` | Root `.rapidkit/`, handoff |
195
+ | `workspace share` | `reports/share-bundle.json` (default) | Aggregation bundle |
196
+ | `import` / `adopt` | `{project}/.rapidkit/import-readiness.json` | Per project |
197
+ | `workspace contract verify` | `workspace-contract-verify-last-run.json` | CLI verify cache |
198
+
199
+ ## Static capability contracts
200
+
201
+ | Contract | Schema version | Consumer purpose |
202
+ | ----------------------------------------------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------ |
203
+ | `contracts/runtime-command-surface.v1.json` | `rapidkit-runtime-command-surface-v1` | Runtime commands, scaffold kits, and create planner summary |
204
+ | `contracts/create-planner-capabilities.v1.json` | `rapidkit-create-planner-capabilities-v1` | Native create, external-create-adopt, and adopt-only lanes for CLI, CI, VS Code, and AI planners |
205
+
206
+ ## Observability stream (not on-disk)
207
+
208
+ Separate from the on-disk artifacts above, `rapidkit-npm` emits a structured
209
+ **NDJSON log stream on stderr** when `--log-format json` (or `RAPIDKIT_LOG_FORMAT=json`)
210
+ is set. This is the deterministic progress/outcome channel for IDEs and CI.
211
+
212
+ | Stream | Schema version | Contract file | Doc |
213
+ | ------ | -------------- | ------------- | --- |
214
+ | CLI log events (stderr) | `cli-log-event-v1` | `contracts/cli-log-event.v1.json` | [CLI_LOG_EVENT_STREAM.md](./CLI_LOG_EVENT_STREAM.md) |
215
+
216
+ **Channel rule:** command **results** go to stdout (`--json`); **progress/lifecycle**
217
+ events go to stderr (`--log-format json`). The two never mix.
64
218
 
65
219
  ## Registry commands
66
220
 
67
- | Command | Output |
68
- | --- | --- |
69
- | `workspace sync [--json]` | Updates contract + `workspace-registry.v1.json`; JSON includes `registrySummary` |
70
- | `workspace registry status [--refresh] [--json]` | Reads or publishes registry summary |
221
+ | Command | Output |
222
+ | ------------------------------------------------ | -------------------------------------------------------------------------------- |
223
+ | `workspace sync [--json]` | Updates contract + `workspace-registry.v1.json`; JSON includes `registrySummary` |
224
+ | `workspace registry status [--refresh] [--json]` | Reads or publishes registry summary |
71
225
 
72
226
  ## Project-scoped reports
73
227
 
@@ -85,20 +239,21 @@ Under `{project}/.rapidkit/reports/` when commands run at project scope (e.g. pr
85
239
 
86
240
  Written by `workspace agent-sync --write` (and by default after `workspace context --for-agent --write`):
87
241
 
88
- | Path | Consumer |
89
- | --- | --- |
90
- | `AGENTS.md` | Copilot, Cursor, Claude Code, Codex, Grok (open standard) |
91
- | `.github/copilot-instructions.md` | GitHub Copilot / VS Code Chat |
92
- | `.github/instructions/rapidkit-evidence.instructions.md` | Copilot scoped `.rapidkit/**` rules |
93
- | `.github/prompts/rapidkit-diagnose.prompt.md` | Copilot prompt library |
94
- | `.github/skills/rapidkit-grounding/SKILL.md` | Copilot skills |
95
- | `.cursor/rules/rapidkit-grounding.mdc` | Cursor always-on rule |
96
- | `CLAUDE.md` | Claude Code (imports `@AGENTS.md`) |
97
- | `.claude/rules/rapidkit-evidence.md` | Claude Code scoped evidence rule |
98
- | `.rapidkit/AGENT-GROUNDING.md` | Tool-agnostic operator doc |
242
+ | Path | Consumer |
243
+ | -------------------------------------------------------- | --------------------------------------------------------- |
244
+ | `AGENTS.md` | Copilot, Cursor, Claude Code, Codex, Grok (open standard) |
245
+ | `.github/copilot-instructions.md` | GitHub Copilot / VS Code Chat |
246
+ | `.github/instructions/rapidkit-evidence.instructions.md` | Copilot scoped `.rapidkit/**` rules |
247
+ | `.github/prompts/rapidkit-diagnose.prompt.md` | Copilot prompt library |
248
+ | `.github/skills/rapidkit-grounding/SKILL.md` | Copilot skills |
249
+ | `.cursor/rules/rapidkit-grounding.mdc` | Cursor always-on rule |
250
+ | `CLAUDE.md` | Claude Code (imports `@AGENTS.md`) |
251
+ | `.claude/rules/rapidkit-evidence.md` | Claude Code scoped evidence rule |
252
+ | `.rapidkit/AGENT-GROUNDING.md` | Tool-agnostic operator doc |
99
253
 
100
254
  ## See also
101
255
 
102
256
  - [README.md](./README.md)
103
257
  - [COMMAND_OWNERSHIP_MATRIX.md](./COMMAND_OWNERSHIP_MATRIX.md)
258
+ - [CLI_LOG_EVENT_STREAM.md](./CLI_LOG_EVENT_STREAM.md)
104
259
  - [commands-reference.md](../commands-reference.md)