rapidkit 0.39.0 → 0.40.1
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.
- package/README.md +83 -53
- package/contracts/agent-customization-pack.v1.json +159 -0
- package/contracts/extension-cli-compatibility.v1.json +10 -0
- package/dist/autopilot-release-OJTLXPMX.js +1 -0
- package/dist/{chunk-GYNIVEYP.js → chunk-5VBRMLRU.js} +1 -1
- package/dist/index.js +150 -92
- package/dist/{pipeline-O5ANBQMK.js → pipeline-XK62WL4D.js} +1 -1
- package/dist/workspace-agent-sync-G7JU77IK.js +25 -0
- package/dist/workspace-run-SPP32MPV.js +1 -0
- package/docs/ci-workflows.md +21 -18
- package/docs/commands-reference.md +1 -1
- package/docs/contracts/ARTIFACT_CATALOG.md +59 -45
- package/docs/contracts/README.md +9 -7
- package/docs/examples/ci-agent-grounding.yml +5 -2
- package/package.json +4 -2
- package/scripts/check-agent-customization-drift.mjs +75 -0
- package/dist/autopilot-release-FWKOY2BD.js +0 -1
- package/dist/workspace-agent-sync-SALW6TVR.js +0 -17
- package/dist/workspace-run-EP7XGEM6.js +0 -1
- /package/dist/{chunk-UY4KRFNL.js → chunk-7VI4U7Q5.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {c}from'./chunk-
|
|
1
|
+
import {c}from'./chunk-5VBRMLRU.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-G7JU77IK.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
2
|
\u{1F517} RapidKit Governance Pipeline
|
|
3
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
4
|
Blocking reasons:`));for(let a of s.blockingReasons.slice(0,8))console.log(c$1.gray(` \u2022 ${a}`));}console.log(c$1.gray(`
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {b,c,d}from'./chunk-OWNGSAO3.js';import n from'path';import g from'fs-extra';var U="rapidkit-agent-reports-index.v1",H="rapidkit-agent-customization-pack.v1",S=".rapidkit/reports/INDEX.json",z=".rapidkit/AGENT-GROUNDING.md",y=".rapidkit/reports/agent-customization-pack.json",O=[{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 m(e){return `npx rapidkit ${e}`.trim()}function _(e){return e&&typeof e=="object"?e:null}function G(e,t=12){return Array.isArray(e)?e.filter(r=>typeof r=="string"&&r.trim().length>0).slice(0,t):[]}function X(e){let t=G(e.blockers,12);if(t.length>0)return t;let r=G(e.blockingReasons,12);if(r.length>0)return r;let i=_(e.summary);return i&&Array.isArray(i.blockingReasons)?G(i.blockingReasons,12):[]}function F(e){for(let t of ["generatedAt","timestamp"]){let r=e[t];if(typeof r=="string"&&r.trim())return r.trim()}}function V(e,t,r){if(!e)return true;let i=Date.parse(e);return Number.isFinite(i)?r.getTime()-i>t*60*60*1e3:true}function B(e){let t=e&&e.length>0?e:["all"];return t.includes("all")?new Set(["all","vscode","agents","copilot","cursor","claude","codex","orca"]):new Set(t)}function h(e,t){return e.has("all")||e.has(t)}function J(e){return h(e,"copilot")||h(e,"vscode")}function Z(e){return e??"enterprise"}function Y(e){return e.includes("hooks")||e.endsWith("rapidkit-agent-hooks.json")?"hook":e.includes("mcp")||e.endsWith("rapidkit-mcp-design.json")?"mcp-design":e.endsWith(".json")?"report":e.includes("/instructions/")||e.endsWith("copilot-instructions.md")?"instruction":e.includes("/prompts/")?"prompt":e.includes("/skills/")&&e.endsWith("/SKILL.md")?"skill":e.includes("/skills/")?"skill-resource":e.includes("/agents/")?"agent":e.includes("/rules/")||e.endsWith(".mdc")?"rule":"grounding"}function Q(e){return e.startsWith(".github/")?["vscode","copilot"]:e.startsWith(".cursor/")?["cursor"]:e.startsWith(".claude/")||e==="CLAUDE.md"?["claude"]:e==="AGENTS.md"||e.startsWith(".rapidkit/")?["agents","codex","orca","vscode"]:e.startsWith(".vscode/")?["vscode"]:["agents"]}function ee(e,t){return new Set([S,y,"AGENTS.md"]).has(e)?true:t==="minimal"?false:[".github/instructions/rapidkit-workspace.instructions.md",".github/prompts/rapidkit-diagnose.prompt.md",".github/skills/rapidkit-workspace-intelligence/SKILL.md",".github/agents/workspai-advisor.agent.md"].includes(e)}function te(e){return e.length>0&&!n.isAbsolute(e)&&!e.split(/[\\/]+/).includes("..")}function re(e){return Object.fromEntries(["all","vscode","agents","copilot","cursor","claude","codex","orca"].map(r=>[r,{enabled:e.targets.includes("all")||e.targets.includes(r),outputs:e.outputs.filter(i=>i.targets.includes(r)).map(i=>i.path).sort()}]))}async function ne(e){try{if(!await g.pathExists(e))return null;let t=await g.readJson(e);return _(t)}catch{return null}}async function ie(e){let t=e.now??new Date,r=e.staleAfterHours??24,i=[],l=[];for(let d of O){let s=n.join(e.workspacePath,d.relativePath),u=await ne(s),x=u!==null;x&&u&&l.push(...X(u)),i.push({path:d.relativePath,label:d.label,required:d.required,exists:x,generatedAt:u?F(u):void 0,commandId:typeof u?.commandId=="string"?u.commandId:void 0,exitCode:typeof u?.exitCode=="number"?u.exitCode:void 0});}let T=[...new Set(l.map(d=>d.trim()).filter(Boolean))].slice(0,16);return {schemaVersion:U,generatedAt:t.toISOString(),workspaceRoot:e.workspacePath,readOrder:O.map(d=>d.relativePath),blockers:T,staleAfterHours:r,reports:i,refreshCommand:m("workspace agent-sync --write --refresh-context")}}function L(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",m("workspace agent-sync --write --refresh-context"),m("workspace context --for-agent --json --write"),m("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 oe(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 se(){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",m("workspace agent-sync --write --refresh-context"),"```",""].join(`
|
|
4
|
+
`)}function ae(){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 ce(){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",m("workspace agent-sync --write --refresh-context"),"```",""].join(`
|
|
6
|
+
`)}function de(){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 pe(){return ["---",'applyTo: "**"',"description: RapidKit workspace scope, evidence, and command discipline","---","","# RapidKit Workspace Intelligence","","Use RapidKit reports as the workspace source of truth before giving architectural, repair, release, or project lifecycle advice.","","## Scope rules","","- Start from `.rapidkit/reports/INDEX.json` and `.rapidkit/reports/workspace-context-agent.json`.","- Distinguish workspace-level blockers from project-level blockers.","- When a project is active, cite its name, path, framework, and evidence source.","- Do not translate unsupported stack requests into unrelated native kits.","","## Answer contract","","Return answers with: Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.",""].join(`
|
|
8
|
+
`)}function le(){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(`
|
|
9
|
+
`)}function ue(){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(`
|
|
10
|
+
`)}function E(e){return ["---",`description: ${e.description}`,"---","",e.objective,"","Read first:","","- `.rapidkit/reports/INDEX.json`","- `.rapidkit/reports/workspace-context-agent.json`","- Any report referenced by the current blocker or task","","Return:","",...e.expectedOutput.map((t,r)=>`${r+1}. ${t}`),"","Use the standard RapidKit answer contract: Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.",""].join(`
|
|
11
|
+
`)}function A(e){return ["# "+e.title,"",...e.lines,""].join(`
|
|
12
|
+
`)}function ge(){return A({title:"MCP Tool Design",lines:["RapidKit MCP is a future read-mostly bridge. Use the CLI reports today; do not assume a running MCP server exists.","","Candidate read tools:","- `getWorkspaceModel` \u2014 read `.rapidkit/reports/workspace-model.json`.","- `getEvidenceIndex` \u2014 read `.rapidkit/reports/INDEX.json`.","- `getBlockers` \u2014 derive current blockers from INDEX and gate reports.","- `getSafeCommands` \u2014 read safe commands from `workspace-context-agent.json`.","- `getProjectContext` \u2014 return one project-scoped slice of the workspace model.","- `getArtifact` \u2014 read one explicit artifact path inside the workspace root.","- `refreshWorkspaceIntelligence` \u2014 explicit user-approved refresh command only.","","Write or repair tools require explicit approval boundaries and are intentionally not part of the first read-mostly design."]})}function me(e){return `${JSON.stringify({schemaVersion:"rapidkit-mcp-design.v1",generatedAt:e.generatedAt,workspaceRoot:e.workspacePath,status:"design-only",mode:"read-mostly",safety:{writeToolsEnabled:false,approvalRequiredForRefresh:true,artifactReadsMustStayInsideWorkspace:true},candidateTools:[{name:"getWorkspaceModel",reads:[".rapidkit/reports/workspace-model.json"],mutates:false},{name:"getEvidenceIndex",reads:[".rapidkit/reports/INDEX.json"],mutates:false},{name:"getBlockers",reads:[".rapidkit/reports/INDEX.json",".rapidkit/reports/workspace-verify-last-run.json",".rapidkit/reports/pipeline-last-run.json"],mutates:false},{name:"getSafeCommands",reads:[".rapidkit/reports/workspace-context-agent.json"],mutates:false},{name:"getProjectContext",reads:[".rapidkit/reports/workspace-model.json",".rapidkit/reports/workspace-context-agent.json"],mutates:false},{name:"getArtifact",reads:["requested workspace-relative artifact path"],mutates:false},{name:"refreshWorkspaceIntelligence",command:m("workspace agent-sync --write --refresh-context"),mutates:true,approvalRequired:true}]},null,2)}
|
|
13
|
+
`}function ke(e){return `${JSON.stringify({schemaVersion:"rapidkit-agent-hooks.v1",generatedAt:e.generatedAt,workspaceRoot:e.workspacePath,enabledByDefault:false,mode:"advisory",hooks:[{name:"rapidkit-pre-tool-use-workspace-boundary",event:"PreToolUse",purpose:"Block or warn on state-changing commands outside the active workspace root.",defaultAction:"warn",rules:["Allow read-only commands.","Warn before write/delete commands outside workspaceRoot.","Never run destructive commands without explicit user approval."]},{name:"rapidkit-post-tool-use-verify-suggestion",event:"PostToolUse",purpose:"Suggest non-destructive verification commands after edits.",defaultAction:"suggest",commands:[m("doctor workspace"),m("workspace verify --strict --json")]},{name:"rapidkit-user-prompt-submit-scope-hint",event:"UserPromptSubmit",purpose:"Inject lightweight workspace scope and evidence index hints.",defaultAction:"inject-context-hint",reads:[".rapidkit/reports/INDEX.json",".rapidkit/reports/workspace-context-agent.json"]}]},null,2)}
|
|
14
|
+
`}function fe(){return ["---","name: rapidkit-workspace-intelligence","description: Use RapidKit workspace intelligence reports to answer, repair, verify, and release with evidence","---","","# RapidKit Workspace Intelligence","","Use this skill for workspace architecture, project lifecycle, blocker repair, release readiness, agent grounding, and CI evidence questions.","","## Decision flow","","1. Load `resources/scope-model.md`.","2. Load `.rapidkit/reports/INDEX.json`.","3. Load `.rapidkit/reports/workspace-context-agent.json`.","4. Load the smallest evidence report required for the task.","5. Answer with Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.","","## Rules","","- Prefer RapidKit reports over full-repo scans.","- Never claim a gate passed without a cited report.","- Separate display commands from execution requests.","- Keep project-scoped fixes inside the active project unless workspace evidence says otherwise.",""].join(`
|
|
15
|
+
`)}function P(e){return ["---",`name: ${e.name}`,`description: ${e.description}`,`tools: [${e.tools.map(t=>`'${t}'`).join(", ")}]`,"---","",`You are the ${e.name} agent for RapidKit Workspace Intelligence.`,"",`Mode: ${e.mode}.`,"","Start every task by reading `.rapidkit/reports/INDEX.json` and `.rapidkit/reports/workspace-context-agent.json`.","","Use this answer contract:","","- Scope","- Evidence","- Diagnosis","- Fix Plan","- Run","- Verify","- Assumptions","","Do not invent health, readiness, or policy status. Cite report paths and command outputs.",""].join(`
|
|
16
|
+
`)}function he(){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",m("workspace agent-sync --write --refresh-context"),"```",""].join(`
|
|
17
|
+
`)}async function p(e,t,r){return r?(await g.ensureDir(n.dirname(e)),await g.writeFile(e,t,"utf8"),"written"):"skipped"}async function W(e){if(!e.write)return "skipped";let t=await g.pathExists(e.absolutePath)?await g.readFile(e.absolutePath,"utf8"):null,{upsertManagedAgentSection:r}=await import('./managed-agent-markers-AXUM75OE.js'),i=r(t,e.generatedBody),l=e.preamble?`${e.preamble.trimEnd()}
|
|
18
|
+
|
|
19
|
+
${i}`:i;return await g.ensureDir(n.dirname(e.absolutePath)),await g.writeFile(e.absolutePath,l,"utf8"),"written"}function je(e){if(!e?.trim())return;let t=new Set(["all","vscode","agents","copilot","cursor","claude","codex","orca"]),r=e.split(",").map(i=>i.trim().toLowerCase()).filter(i=>t.has(i));return r.length>0?r:void 0}function we(e){let t=[...e.outputs].sort((r,i)=>r.path.localeCompare(i.path));return {schemaVersion:H,generatedAt:e.generatedAt,workspaceRoot:e.workspacePath,preset:e.preset,targets:[...e.targets].sort(),sourceReports:e.index.reports.filter(r=>r.exists).map(r=>r.path).sort(),outputInventory:t,capabilityMatrix:re({targets:e.targets,outputs:t}),drift:{missingRequired:e.missingRequired,staleReports:e.staleReports,strictViolations:e.strictViolations},answerContract:["Scope","Evidence","Diagnosis","Fix Plan","Run","Verify","Assumptions"],refreshCommand:m(`workspace agent-sync --write --refresh-context --preset ${e.preset}`),experimental:{hooksEnabled:e.experimentalHooks,mcpReady:t.some(r=>r.kind==="mcp-design")}}}async function ve(e){let t=n.resolve(e.workspacePath),r=new Date,i=e.staleAfterHours??24,l=B(e.targets),T=[...l].sort(),d$1=Z(e.preset),s=e.write===true,u=e.strict===true,x,j=null;e.refreshContext&&(j=await c({workspacePath:t,agent:e.agent??"generic",scope:e.scope,includeEvidence:true}),s&&(x=await d(j,t)));let k=await ie({workspacePath:t,staleAfterHours:i,now:r}),v=k.reports.filter(o=>o.required&&!o.exists).map(o=>o.path),C=k.reports.filter(o=>o.exists&&V(o.generatedAt,i,r)).map(o=>o.path),R=[];u&&(v.length>0&&R.push(`Missing required reports: ${v.join(", ")}`),C.length>0&&R.push(`Stale reports (>${i}h): ${C.join(", ")}`));let I=[],N=[],D=[],a=(o,c)=>{o==="written"?I.push(c):N.push(c),D.push({path:c,kind:Y(c),targets:Q(c),required:ee(c,d$1),status:o==="written"?"written":e.dryRun?"planned":"skipped"});};if(a(await p(n.join(t,S),`${JSON.stringify(k,null,2)}
|
|
20
|
+
`,s),S),a(await p(n.join(t,z),`${oe(k)}
|
|
21
|
+
`,s),z),(h(l,"agents")||h(l,"vscode"))&&a(await W({absolutePath:n.join(t,"AGENTS.md"),generatedBody:L({index:k,context:j}),write:s}),"AGENTS.md"),h(l,"claude")){let o=n.join(t,"CLAUDE.md");if(s){let{upsertManagedAgentSection:c}=await import('./managed-agent-markers-AXUM75OE.js'),f=await g.pathExists(o)?await g.readFile(o,"utf8"):"",w=c(f,ae()),b=w.includes("@AGENTS.md")?w:`@AGENTS.md
|
|
22
|
+
|
|
23
|
+
${w}`;await g.ensureDir(n.dirname(o)),await g.writeFile(o,b,"utf8"),I.push("CLAUDE.md");}else N.push("CLAUDE.md");a(await p(n.join(t,".claude/rules/rapidkit-evidence.md"),`${le()}
|
|
24
|
+
`,s),".claude/rules/rapidkit-evidence.md");}if(h(l,"cursor")&&a(await p(n.join(t,".cursor/rules/rapidkit-grounding.mdc"),ce(),s),".cursor/rules/rapidkit-grounding.mdc"),J(l)){if(a(await W({absolutePath:n.join(t,".github/copilot-instructions.md"),generatedBody:se(),write:s}),".github/copilot-instructions.md"),a(await p(n.join(t,".github/instructions/rapidkit-workspace.instructions.md"),pe(),s),".github/instructions/rapidkit-workspace.instructions.md"),a(await p(n.join(t,".github/instructions/rapidkit-evidence.instructions.md"),de(),s),".github/instructions/rapidkit-evidence.instructions.md"),a(await p(n.join(t,".github/prompts/rapidkit-diagnose.prompt.md"),ue(),s),".github/prompts/rapidkit-diagnose.prompt.md"),d$1==="enterprise"){let o=[[".github/prompts/rapidkit-repair.prompt.md",E({description:"Repair RapidKit blockers with evidence and verification",objective:"Plan the smallest safe repair for the current RapidKit blocker.",expectedOutput:["Blocker and affected workspace/project scope","Evidence paths and exact failing signals","Minimal fix plan","Human-run commands","Verification command and expected success signal"]})],[".github/prompts/rapidkit-release-readiness.prompt.md",E({description:"Assess RapidKit release readiness from evidence",objective:"Assess whether this workspace is release-ready using RapidKit gates.",expectedOutput:["Readiness verdict with cited reports","Blocking gates","Safe next command","Verification checklist"]})],[".github/prompts/rapidkit-project-onboard.prompt.md",E({description:"Onboard a project into RapidKit Workspace Intelligence",objective:"Guide project onboarding using workspace model and create planner capabilities.",expectedOutput:["Target project scope","Native create, external create-adopt, or adopt-only lane","Safe commands","Post-onboarding verification"]})],[".github/prompts/rapidkit-adopt-project.prompt.md",E({description:"Adopt an existing project into RapidKit governance",objective:"Adopt an existing project without changing its runtime behavior.",expectedOutput:["Detected stack and confidence","Adoption plan","Generated metadata expectations","Doctor and workspace model verification"]})]];for(let[c,f]of o)a(await p(n.join(t,c),f,s),c);}if(a(await p(n.join(t,".github/skills/rapidkit-grounding/SKILL.md"),he(),s),".github/skills/rapidkit-grounding/SKILL.md"),d$1==="enterprise"){a(await p(n.join(t,".github/skills/rapidkit-workspace-intelligence/SKILL.md"),fe(),s),".github/skills/rapidkit-workspace-intelligence/SKILL.md");let o=[["artifact-map.md",A({title:"Artifact Map",lines:O.map(f=>`- \`${f.relativePath}\` \u2014 ${f.label}`)})],["command-map.md",A({title:"Command Map",lines:["- `npx rapidkit workspace agent-sync --write --refresh-context` \u2014 refresh agent grounding.","- `npx rapidkit workspace model --json --write` \u2014 refresh workspace model.","- `npx rapidkit doctor workspace` \u2014 refresh health evidence.","- `npx rapidkit workspace verify --strict --json` \u2014 verify release gates."]})],["scope-model.md",A({title:"Scope Model",lines:["- Workspace scope is the default source of truth.","- Project scope is selected only when the active task targets a specific project.","- Always name the workspace and project when giving repair or lifecycle advice."]})],["runtime-support.md",A({title:"Runtime Support",lines:["- Native create is available only for RapidKit-owned scaffold contracts.","- Unsupported stacks should use external-create-adopt when a stable ecosystem generator exists.","- Existing projects should use adopt-only when native create is unavailable."]})],["create-planner-capabilities.md",A({title:"Create Planner Capabilities",lines:["- Use `contracts/create-planner-capabilities.v1.json` to decide native-create, external-create-adopt, or adopt-only.","- Do not map PHP, WordPress, Laravel, Rails, or Symfony requests to unrelated native kits.","- Explain unsupported native create requests and guide users to adopt/import."]})],["mcp-tools.md",ge()]];for(let[f,w]of o){let b=`.github/skills/rapidkit-workspace-intelligence/resources/${f}`;a(await p(n.join(t,b),w,s),b);}let c=[["workspai-advisor.agent.md",P({name:"Workspai Advisor",description:"Read-only workspace and project guidance using RapidKit evidence",mode:"read-only",tools:["search","read"]})],["workspai-repair.agent.md",P({name:"Workspai Repair",description:"Turn RapidKit blockers into minimal fixes and verification steps",mode:"repair",tools:["search","read","edit"]})],["workspai-release.agent.md",P({name:"Workspai Release",description:"Assess readiness, governance gates, and release safety from evidence",mode:"release",tools:["search","read"]})],["workspai-project-onboarder.agent.md",P({name:"Workspai Project Onboarder",description:"Guide create, import, and adopt flows with RapidKit contracts",mode:"onboard",tools:["search","read","edit"]})]];for(let[f,w]of c){let b=`.github/agents/${f}`;a(await p(n.join(t,b),w,s),b);}}}if(d$1==="enterprise"&&a(await p(n.join(t,".rapidkit/reports/rapidkit-mcp-design.json"),me({workspacePath:t,generatedAt:k.generatedAt}),s),".rapidkit/reports/rapidkit-mcp-design.json"),d$1==="enterprise"&&e.experimentalHooks===true&&a(await p(n.join(t,".vscode/rapidkit-agent-hooks.json"),ke({workspacePath:t,generatedAt:k.generatedAt}),s),".vscode/rapidkit-agent-hooks.json"),(h(l,"codex")||h(l,"orca"))&&(h(l,"agents")||a(await W({absolutePath:n.join(t,"AGENTS.md"),generatedBody:L({index:k,context:j}),write:s}),"AGENTS.md")),u){let o=D.map(c=>c.path).filter(c=>!te(c));o.length>0&&R.push(`Unsafe generated output paths: ${o.join(", ")}`);}let K=we({workspacePath:t,generatedAt:r.toISOString(),preset:d$1,targets:T,index:k,outputs:[...D,{path:y,kind:"report",targets:["agents","vscode","copilot","codex","orca"],required:true,status:s?"written":e.dryRun?"planned":"skipped"}],missingRequired:v,staleReports:C,strictViolations:R,experimentalHooks:e.experimentalHooks===true});return a(await p(n.join(t,y),`${JSON.stringify(K,null,2)}
|
|
25
|
+
`,s),y),{workspacePath:t,indexPath:n.join(t,S),packPath:n.join(t,y),pack:K,contextPath:x,writtenFiles:I,skippedFiles:N,blockers:k.blockers,missingRequired:v,staleReports:C,strictViolations:R}}export{y as AGENT_CUSTOMIZATION_PACK_REPORT_PATH,H as AGENT_CUSTOMIZATION_PACK_SCHEMA,z as AGENT_GROUNDING_DOC_PATH,S as AGENT_REPORTS_INDEX_PATH,U as AGENT_REPORTS_INDEX_SCHEMA,O as AGENT_REPORT_CATALOG,ie as buildWorkspaceAgentReportsIndex,je as parseAgentGroundingTargets,ve as syncWorkspaceAgentGrounding};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as runWorkspaceStage}from'./chunk-7VI4U7Q5.js';export{a as WORKSPACE_RUN_LAST_REPORT_FILENAME}from'./chunk-FV5A3N3I.js';
|
package/docs/ci-workflows.md
CHANGED
|
@@ -4,14 +4,14 @@ Map of GitHub Actions workflows in this repository. Use this when editing CI to
|
|
|
4
4
|
|
|
5
5
|
## Workflows
|
|
6
6
|
|
|
7
|
-
| Workflow
|
|
8
|
-
|
|
|
9
|
-
| Build / test matrix
|
|
10
|
-
| Workspace E2E matrix
|
|
11
|
-
| Windows bridge E2E
|
|
12
|
-
| E2E smoke
|
|
13
|
-
| Frontend generator smoke | `.github/workflows/frontend-generator-smoke.yml` | Official frontend generator drift gate
|
|
14
|
-
| Security
|
|
7
|
+
| Workflow | Path | Purpose |
|
|
8
|
+
| ------------------------ | ------------------------------------------------ | ------------------------------------------------------------------------- |
|
|
9
|
+
| Build / test matrix | `.github/workflows/ci.yml` | Build, lint, typecheck, tests, coverage, contract gates |
|
|
10
|
+
| Workspace E2E matrix | `.github/workflows/workspace-e2e-matrix.yml` | Cross-OS workspace lifecycle smoke; setup `--warm-deps`; cache/mirror ops |
|
|
11
|
+
| Windows bridge E2E | `.github/workflows/windows-bridge-e2e.yml` | Native Windows bridge and lifecycle checks |
|
|
12
|
+
| E2E smoke | `.github/workflows/e2e-smoke.yml` | Focused bridge regression smoke |
|
|
13
|
+
| Frontend generator smoke | `.github/workflows/frontend-generator-smoke.yml` | Official frontend generator drift gate |
|
|
14
|
+
| Security | `.github/workflows/security.yml` | Security scanning and policy checks |
|
|
15
15
|
|
|
16
16
|
## Consumer workspace: agent grounding CI
|
|
17
17
|
|
|
@@ -23,21 +23,24 @@ Minimal job:
|
|
|
23
23
|
|
|
24
24
|
```yaml
|
|
25
25
|
- run: npx rapidkit pipeline --json --strict
|
|
26
|
-
- run: npx rapidkit workspace agent-sync --write --refresh-context --strict --json
|
|
26
|
+
- run: npx rapidkit workspace agent-sync --write --refresh-context --strict --json --preset enterprise
|
|
27
|
+
- run: node ./node_modules/rapidkit/scripts/check-agent-customization-drift.mjs --workspace .
|
|
27
28
|
```
|
|
28
29
|
|
|
29
|
-
`pipeline` writes governance evidence and **auto-syncs** agent
|
|
30
|
+
`pipeline` writes governance evidence and **auto-syncs** agent grounding (`AGENTS.md`, Copilot, Cursor, Claude) unless `RAPIDKIT_NO_AGENT_SYNC=1` or `--no-agent-sync`.
|
|
31
|
+
Run the drift check after `agent-sync --write` so CI fails when generated agent customization files are stale.
|
|
30
32
|
|
|
31
33
|
## Local validation scripts
|
|
32
34
|
|
|
33
|
-
| Script
|
|
34
|
-
|
|
|
35
|
-
| Runtime acceptance (default)
|
|
36
|
-
| Runtime acceptance (full)
|
|
37
|
-
| Frontend generators (dry-run) | `npm run smoke:frontend-generators`
|
|
38
|
-
| Frontend generators (network) | `npm run smoke:frontend-generators:network`
|
|
39
|
-
| Docs drift guard
|
|
40
|
-
| README command smoke
|
|
35
|
+
| Script | Command |
|
|
36
|
+
| ----------------------------- | ------------------------------------------------------------------------- |
|
|
37
|
+
| Runtime acceptance (default) | `npm run test:runtime-matrix` |
|
|
38
|
+
| Runtime acceptance (full) | `npm run test:runtime-matrix:full` |
|
|
39
|
+
| Frontend generators (dry-run) | `npm run smoke:frontend-generators` |
|
|
40
|
+
| Frontend generators (network) | `npm run smoke:frontend-generators:network` |
|
|
41
|
+
| Docs drift guard | `npm run check:docs-drift` |
|
|
42
|
+
| README command smoke | `npm run smoke:readme` |
|
|
43
|
+
| Agent customization drift | `npm run check:agent-customization-drift -- --workspace <workspace-root>` |
|
|
41
44
|
|
|
42
45
|
## Recommended pre-release checks
|
|
43
46
|
|
|
@@ -40,7 +40,7 @@ npx rapidkit workspace contract verify [--strict] [--json]
|
|
|
40
40
|
npx rapidkit workspace contract graph [--json]
|
|
41
41
|
npx rapidkit workspace model [--json] [--write] [--strict]
|
|
42
42
|
npx rapidkit workspace context --for-agent [codex|claude|cursor|orca] [--json] [--write] [--no-agent-sync]
|
|
43
|
-
npx rapidkit workspace agent-sync [--write] [--refresh-context] [--strict] [--json] [--target all|copilot,cursor,claude]
|
|
43
|
+
npx rapidkit workspace agent-sync [--write] [--refresh-context] [--strict] [--json] [--preset minimal|enterprise] [--target all|vscode|copilot,cursor,claude] [--experimental-hooks]
|
|
44
44
|
npx rapidkit workspace snapshot [--json]
|
|
45
45
|
npx rapidkit workspace diff --from <snapshot-or-report|git[:ref]> [--json]
|
|
46
46
|
npx rapidkit workspace impact --from <snapshot-or-report> [--scope project:<name>] [--json]
|
|
@@ -21,29 +21,29 @@ Canonical map of **on-disk artifacts** produced by `rapidkit-npm` commands. Dash
|
|
|
21
21
|
|
|
22
22
|
## Governance evidence loop
|
|
23
23
|
|
|
24
|
-
| Command | Primary artifact | Schema version
|
|
25
|
-
| ------------------- | --------------------------------------------------- |
|
|
26
|
-
| `doctor workspace` | `.rapidkit/reports/doctor-last-run.json` | `doctor-workspace-evidence-v1`
|
|
27
|
-
| `doctor project` | `.rapidkit/reports/doctor-project-last-run.json` | `doctor-project-evidence-v1`
|
|
28
|
-
| `analyze` | `.rapidkit/reports/analyze-last-run.json` | `rapidkit-analyze-v1`
|
|
29
|
-
| `readiness` | `.rapidkit/reports/release-readiness-last-run.json` | `release-readiness-v1`
|
|
30
|
-
| `pipeline` | `.rapidkit/reports/pipeline-last-run.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` | `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
|
|
39
|
-
| -------------------------------- |
|
|
40
|
-
| `workspace model --write` | `workspace-model.json`
|
|
41
|
-
| `workspace snapshot` | `workspace-model-snapshot.json`
|
|
42
|
-
| `workspace diff` | `workspace-model-diff-last-run.json`
|
|
43
|
-
| `workspace impact --from <diff>` | `workspace-impact-last-run.json`
|
|
44
|
-
| `workspace verify` | `workspace-verify-last-run.json`
|
|
45
|
-
| `workspace context --write` | `workspace-context-agent.json`
|
|
46
|
-
| `workspace agent-sync --write` | `reports/INDEX.json`, `AGENT-GROUNDING.md`, `AGENTS.md`, Copilot/Cursor/Claude
|
|
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`, `reports/agent-customization-pack.json`, `reports/rapidkit-mcp-design.json`, `AGENT-GROUNDING.md`, `AGENTS.md`, Copilot/Cursor/Claude/VS Code agent surfaces | `rapidkit-agent-customization-pack.v1` | `contracts/agent-customization-pack.v1.json` |
|
|
47
47
|
|
|
48
48
|
**CLI semantics:** `workspace diff --from` expects a **model or snapshot** baseline. `workspace impact --from` expects a **diff report**.
|
|
49
49
|
|
|
@@ -54,11 +54,11 @@ relationships out of `workspace run`'s private logic into one versioned source
|
|
|
54
54
|
of truth consumed by `impact` (transitive blast radius), `verify`
|
|
55
55
|
(subgraph-scoped gating), `run --blast-radius`, and risk weighting.
|
|
56
56
|
|
|
57
|
-
| Field
|
|
58
|
-
|
|
|
59
|
-
| `nodes` | Projects in the workspace (`id`, workspace-relative `path`).
|
|
57
|
+
| Field | Meaning |
|
|
58
|
+
| ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
59
|
+
| `nodes` | Projects in the workspace (`id`, workspace-relative `path`). |
|
|
60
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.
|
|
61
|
+
| `stats` | Counts (`nodeCount`, `edgeCount`, per-source edge counts) and `hasCycle` for the integrity gate. |
|
|
62
62
|
|
|
63
63
|
Edge `kind` ∈ `code-import`, `package-dep`, `event-pub-sub`, `service-dependsOn`,
|
|
64
64
|
`shared-resource`. Edge `source` ∈ `inferred`, `contract`, `manual` (`manual`/`contract`
|
|
@@ -160,10 +160,10 @@ Intelligence reports carry a shared freshness envelope so any consumer (CLI
|
|
|
160
160
|
`workspace verify`, Workspai, CI) can detect staleness **without** re-running the
|
|
161
161
|
whole chain:
|
|
162
162
|
|
|
163
|
-
| Field
|
|
164
|
-
|
|
|
165
|
-
| `generatedAt` | ISO-8601 timestamp the report was produced.
|
|
166
|
-
| `inputsHash`
|
|
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
167
|
|
|
168
168
|
Canonical source: `src/contracts/freshness-metadata-contract.ts`
|
|
169
169
|
(`computeInputsHash`, `buildFreshnessMetadata`, `assessFreshness`). Verdicts:
|
|
@@ -209,8 +209,8 @@ Separate from the on-disk artifacts above, `rapidkit-npm` emits a structured
|
|
|
209
209
|
**NDJSON log stream on stderr** when `--log-format json` (or `RAPIDKIT_LOG_FORMAT=json`)
|
|
210
210
|
is set. This is the deterministic progress/outcome channel for IDEs and CI.
|
|
211
211
|
|
|
212
|
-
| Stream
|
|
213
|
-
|
|
|
212
|
+
| Stream | Schema version | Contract file | Doc |
|
|
213
|
+
| ----------------------- | ------------------ | --------------------------------- | ---------------------------------------------------- |
|
|
214
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
215
|
|
|
216
216
|
**Channel rule:** command **results** go to stdout (`--json`); **progress/lifecycle**
|
|
@@ -233,23 +233,37 @@ Under `{project}/.rapidkit/reports/` when commands run at project scope (e.g. pr
|
|
|
233
233
|
2. **Release gates:** follow chain doctor → analyze → readiness → verify → autopilot; use `pipeline-last-run.json` for orchestration summary.
|
|
234
234
|
3. **Do not** use `workspace.json.projects` (removed in schema 1.0).
|
|
235
235
|
4. Prefer `schemaVersion` constants in each artifact; legacy `v1` on readiness is accepted when reading old reports.
|
|
236
|
-
5. **Agent
|
|
237
|
-
|
|
238
|
-
## Agent
|
|
239
|
-
|
|
240
|
-
Written by `workspace agent-sync --write` (and by default after `workspace context --for-agent --write`):
|
|
241
|
-
|
|
242
|
-
| Path
|
|
243
|
-
|
|
|
244
|
-
| `AGENTS.md`
|
|
245
|
-
| `.github/copilot-instructions.md`
|
|
246
|
-
| `.github/instructions/rapidkit-
|
|
247
|
-
| `.github/
|
|
248
|
-
| `.github/
|
|
249
|
-
| `.
|
|
250
|
-
|
|
|
251
|
-
| `.
|
|
252
|
-
| `.rapidkit
|
|
236
|
+
5. **Agent customization:** read `.rapidkit/reports/agent-customization-pack.json` first for generated surfaces, then `.rapidkit/reports/INDEX.json` and `workspace-context-agent.json`; regenerate with `workspace agent-sync --write --refresh-context --preset enterprise`.
|
|
237
|
+
|
|
238
|
+
## Agent customization files (repo hooks)
|
|
239
|
+
|
|
240
|
+
Written by `workspace agent-sync --write --refresh-context --preset enterprise` (and by default after `workspace context --for-agent --write`):
|
|
241
|
+
|
|
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-workspace.instructions.md` | Copilot workspace scope and command discipline |
|
|
247
|
+
| `.github/instructions/rapidkit-evidence.instructions.md` | Copilot scoped `.rapidkit/**` rules |
|
|
248
|
+
| `.github/prompts/rapidkit-diagnose.prompt.md` | Copilot prompt library |
|
|
249
|
+
| `.github/prompts/rapidkit-repair.prompt.md` | Copilot repair workflow prompt |
|
|
250
|
+
| `.github/prompts/rapidkit-release-readiness.prompt.md` | Copilot release readiness workflow prompt |
|
|
251
|
+
| `.github/prompts/rapidkit-project-onboard.prompt.md` | Copilot project onboarding workflow prompt |
|
|
252
|
+
| `.github/prompts/rapidkit-adopt-project.prompt.md` | Copilot adopt/import workflow prompt |
|
|
253
|
+
| `.github/skills/rapidkit-grounding/SKILL.md` | Copilot skills |
|
|
254
|
+
| `.github/skills/rapidkit-workspace-intelligence/SKILL.md` | Enterprise Workspace Intelligence skill |
|
|
255
|
+
| `.github/skills/rapidkit-workspace-intelligence/resources/mcp-tools.md` | Future MCP tool design reference |
|
|
256
|
+
| `.github/agents/workspai-advisor.agent.md` | Read-only workspace advisor agent |
|
|
257
|
+
| `.github/agents/workspai-repair.agent.md` | Blocker repair agent |
|
|
258
|
+
| `.github/agents/workspai-release.agent.md` | Release safety agent |
|
|
259
|
+
| `.github/agents/workspai-project-onboarder.agent.md` | Project onboarding agent |
|
|
260
|
+
| `.cursor/rules/rapidkit-grounding.mdc` | Cursor always-on rule |
|
|
261
|
+
| `CLAUDE.md` | Claude Code (imports `@AGENTS.md`) |
|
|
262
|
+
| `.claude/rules/rapidkit-evidence.md` | Claude Code scoped evidence rule |
|
|
263
|
+
| `.rapidkit/AGENT-GROUNDING.md` | Tool-agnostic operator doc |
|
|
264
|
+
| `.rapidkit/reports/agent-customization-pack.json` | Versioned output inventory, target matrix, drift state |
|
|
265
|
+
| `.rapidkit/reports/rapidkit-mcp-design.json` | Read-mostly MCP-ready design manifest |
|
|
266
|
+
| `.vscode/rapidkit-agent-hooks.json` | Optional advisory VS Code agent hooks (`--experimental-hooks`) |
|
|
253
267
|
|
|
254
268
|
## See also
|
|
255
269
|
|
package/docs/contracts/README.md
CHANGED
|
@@ -6,13 +6,14 @@ Contract documentation for JSON payloads, support matrices, and cross-repo parit
|
|
|
6
6
|
|
|
7
7
|
Canonical JSON lives in **`../contracts/`** (npm package root, published in the tarball).
|
|
8
8
|
|
|
9
|
-
| Script
|
|
10
|
-
|
|
|
11
|
-
| `npm run generate:contracts`
|
|
12
|
-
| `npm run check:generated-contracts`
|
|
13
|
-
| `npm run sync:parity-snapshot`
|
|
14
|
-
| `npm run check:parity-snapshot`
|
|
15
|
-
| `npm run validate:contracts`
|
|
9
|
+
| Script | Purpose |
|
|
10
|
+
| ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
|
|
11
|
+
| `npm run generate:contracts` | Regenerate runtime surface, create planner, agent customization pack, import-stack parity, module-layout, infra-stack |
|
|
12
|
+
| `npm run check:generated-contracts` | Verify committed JSON matches generators |
|
|
13
|
+
| `npm run sync:parity-snapshot` | Copy canonical → vscode `contracts/` mirror |
|
|
14
|
+
| `npm run check:parity-snapshot` | Verify mirrors match canonical |
|
|
15
|
+
| `npm run validate:contracts` | Generate check + mirror check + contract tests |
|
|
16
|
+
| `npm run check:agent-customization-drift` | Verify generated agent customization files are committed in a consumer workspace |
|
|
16
17
|
|
|
17
18
|
Workflow: change code → `npm run generate:contracts` → `npm run sync:parity-snapshot` → commit npm + vscode `contracts/`.
|
|
18
19
|
|
|
@@ -37,6 +38,7 @@ Published under `../contracts/` (not duplicated in this folder):
|
|
|
37
38
|
- `analyze-last-run.v1.json` — analyze evidence
|
|
38
39
|
- `pipeline-last-run.v1.json` — governance pipeline orchestration
|
|
39
40
|
- `create-planner-capabilities.v1.json` — native-create, external-create-adopt, and adopt-only capability lanes
|
|
41
|
+
- `agent-customization-pack.v1.json` — generated instructions, prompts, skills, agents, optional hooks, MCP-ready design metadata, target matrix, and drift state for AI agent surfaces
|
|
40
42
|
|
|
41
43
|
Workspace intelligence (`../contracts/workspace-intelligence/`):
|
|
42
44
|
|
|
@@ -32,7 +32,7 @@ jobs:
|
|
|
32
32
|
node-version: '20'
|
|
33
33
|
|
|
34
34
|
- name: Install RapidKit CLI
|
|
35
|
-
run: npm install -
|
|
35
|
+
run: npm install --no-save rapidkit@latest
|
|
36
36
|
|
|
37
37
|
- name: Run governance pipeline
|
|
38
38
|
run: npx rapidkit pipeline --json --strict
|
|
@@ -41,7 +41,8 @@ jobs:
|
|
|
41
41
|
|
|
42
42
|
- name: Sync and verify agent grounding
|
|
43
43
|
run: |
|
|
44
|
-
npx rapidkit workspace agent-sync --write --refresh-context --strict --json
|
|
44
|
+
npx rapidkit workspace agent-sync --write --refresh-context --strict --json --preset enterprise
|
|
45
|
+
node ./node_modules/rapidkit/scripts/check-agent-customization-drift.mjs --workspace .
|
|
45
46
|
env:
|
|
46
47
|
RAPIDKIT_NO_AGENT_SYNC: '0'
|
|
47
48
|
|
|
@@ -53,6 +54,8 @@ jobs:
|
|
|
53
54
|
path: |
|
|
54
55
|
.rapidkit/reports/INDEX.json
|
|
55
56
|
.rapidkit/reports/workspace-context-agent.json
|
|
57
|
+
.rapidkit/reports/agent-customization-pack.json
|
|
58
|
+
.rapidkit/reports/rapidkit-mcp-design.json
|
|
56
59
|
.rapidkit/reports/pipeline-last-run.json
|
|
57
60
|
AGENTS.md
|
|
58
61
|
if-no-files-found: ignore
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rapidkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Open-source workspace intelligence CLI for software systems: create, adopt, govern, verify, and align polyglot workspaces for humans, CI, IDEs, and AI agents.",
|
|
6
6
|
"keywords": [
|
|
@@ -43,7 +43,8 @@
|
|
|
43
43
|
"docs",
|
|
44
44
|
"data/modules-embeddings.json",
|
|
45
45
|
"scripts/enforce-package-manager.cjs",
|
|
46
|
-
"scripts/check-cli-resolution.cjs"
|
|
46
|
+
"scripts/check-cli-resolution.cjs",
|
|
47
|
+
"scripts/check-agent-customization-drift.mjs"
|
|
47
48
|
],
|
|
48
49
|
"publishConfig": {
|
|
49
50
|
"registry": "https://registry.npmjs.org",
|
|
@@ -71,6 +72,7 @@
|
|
|
71
72
|
"check:parity-snapshot": "node scripts/sync-shared-contracts.mjs --check",
|
|
72
73
|
"generate:contracts": "node scripts/generate-shared-contracts.mjs",
|
|
73
74
|
"check:generated-contracts": "node scripts/generate-shared-contracts.mjs --check",
|
|
75
|
+
"check:agent-customization-drift": "node scripts/check-agent-customization-drift.mjs",
|
|
74
76
|
"validate:contracts": "npm run check:shared-contracts && vitest run src/__tests__/contracts/",
|
|
75
77
|
"test:parity-contract": "npm run check:shared-contracts && vitest run src/__tests__/contracts/import-stack-parity.snapshot.test.ts",
|
|
76
78
|
"test:watch": "vitest",
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
|
|
5
|
+
const GENERATED_AGENT_PATHS = [
|
|
6
|
+
'.rapidkit/reports/INDEX.json',
|
|
7
|
+
'.rapidkit/reports/agent-customization-pack.json',
|
|
8
|
+
'.rapidkit/reports/rapidkit-mcp-design.json',
|
|
9
|
+
'.rapidkit/reports/workspace-context-agent.json',
|
|
10
|
+
'.rapidkit/AGENT-GROUNDING.md',
|
|
11
|
+
'AGENTS.md',
|
|
12
|
+
'CLAUDE.md',
|
|
13
|
+
'.github/copilot-instructions.md',
|
|
14
|
+
'.github/instructions',
|
|
15
|
+
'.github/prompts',
|
|
16
|
+
'.github/skills/rapidkit-grounding',
|
|
17
|
+
'.github/skills/rapidkit-workspace-intelligence',
|
|
18
|
+
'.github/agents',
|
|
19
|
+
'.cursor/rules/rapidkit-grounding.mdc',
|
|
20
|
+
'.claude/rules/rapidkit-evidence.md',
|
|
21
|
+
'.vscode/rapidkit-agent-hooks.json',
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
function parseWorkspaceArg(argv) {
|
|
25
|
+
const workspaceIndex = argv.indexOf('--workspace');
|
|
26
|
+
if (workspaceIndex >= 0 && argv[workspaceIndex + 1]) {
|
|
27
|
+
return argv[workspaceIndex + 1];
|
|
28
|
+
}
|
|
29
|
+
const inline = argv.find((arg) => arg.startsWith('--workspace='));
|
|
30
|
+
if (inline) {
|
|
31
|
+
return inline.slice('--workspace='.length);
|
|
32
|
+
}
|
|
33
|
+
return process.cwd();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function runGit(workspacePath, args) {
|
|
37
|
+
return spawnSync('git', ['-C', workspacePath, ...args], {
|
|
38
|
+
encoding: 'utf8',
|
|
39
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const workspacePath = path.resolve(parseWorkspaceArg(process.argv.slice(2)));
|
|
44
|
+
const gitCheck = runGit(workspacePath, ['rev-parse', '--is-inside-work-tree']);
|
|
45
|
+
|
|
46
|
+
if (gitCheck.status !== 0 || gitCheck.stdout.trim() !== 'true') {
|
|
47
|
+
console.warn(
|
|
48
|
+
`[rapidkit] Agent customization drift check skipped: ${workspacePath} is not a git work tree.`
|
|
49
|
+
);
|
|
50
|
+
process.exit(0);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const status = runGit(workspacePath, ['status', '--porcelain', '--', ...GENERATED_AGENT_PATHS]);
|
|
54
|
+
|
|
55
|
+
if (status.status !== 0) {
|
|
56
|
+
console.error('[rapidkit] Failed to inspect generated agent customization drift.');
|
|
57
|
+
if (status.stderr.trim()) {
|
|
58
|
+
console.error(status.stderr.trim());
|
|
59
|
+
}
|
|
60
|
+
process.exit(status.status ?? 1);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const drift = status.stdout.trim();
|
|
64
|
+
|
|
65
|
+
if (drift.length > 0) {
|
|
66
|
+
console.error('[rapidkit] Agent customization drift detected.');
|
|
67
|
+
console.error(
|
|
68
|
+
'Run `npx rapidkit workspace agent-sync --write --refresh-context --preset enterprise`, review the generated files, and commit the changes.'
|
|
69
|
+
);
|
|
70
|
+
console.error('');
|
|
71
|
+
console.error(drift);
|
|
72
|
+
process.exit(1);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
console.log('[rapidkit] Agent customization files are in sync.');
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{b as AUTOPILOT_RELEASE_ALIAS_FILENAME,a as AUTOPILOT_RELEASE_LAST_RUN_FILENAME,c as runAutopilotRelease}from'./chunk-GYNIVEYP.js';
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
`)}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{a as runWorkspaceStage}from'./chunk-UY4KRFNL.js';export{a as WORKSPACE_RUN_LAST_REPORT_FILENAME}from'./chunk-FV5A3N3I.js';
|
|
File without changes
|