rapidkit 0.41.1 → 0.41.3
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 +132 -58
- package/contracts/agent-customization-pack.v1.json +15 -0
- package/contracts/doctor-project-evidence.v1.json +260 -2
- package/contracts/doctor-remediation-plan.v1.json +496 -0
- package/contracts/doctor-workspace-evidence.v1.json +260 -2
- package/contracts/extension-cli-compatibility.v1.json +5 -2
- package/contracts/runtime-command-surface.v1.json +3 -1
- package/contracts/workspace-intelligence/doctor-fix-result.v1.json +11 -1
- package/contracts/workspace-intelligence/fact-freshness.v1.json +58 -0
- package/contracts/workspace-intelligence/studio-blocker-handoff.v1.json +24 -0
- package/contracts/workspace-intelligence/workspace-context.v1.json +84 -1
- package/contracts/workspace-intelligence/workspace-intelligence-history.v1.json +6 -2
- package/contracts/workspace-intelligence/workspace-model.v1.json +80 -0
- package/dist/analyze-UTB3PNKM.js +1 -0
- package/dist/autopilot-release-GBH7PIIZ.js +1 -0
- package/dist/{chunk-CKXJR3YT.js → chunk-3CYEVV6H.js} +1 -1
- package/dist/{chunk-RSYUNEH7.js → chunk-42ARJBM7.js} +1 -1
- package/dist/chunk-6UBWN4EE.js +2 -0
- package/dist/chunk-7BEZH5LE.js +2 -0
- package/dist/{chunk-ITJ6RKUW.js → chunk-AM5OJWXF.js} +1 -1
- package/dist/{chunk-KIUSCFHF.js → chunk-C4ASE2DV.js} +1 -1
- package/dist/chunk-COBMOVUK.js +1 -0
- package/dist/{chunk-ELU3G6DQ.js → chunk-DKNVDNT4.js} +1 -1
- package/dist/chunk-GD6VML5K.js +32 -0
- package/dist/chunk-GH674HP5.js +4 -0
- package/dist/chunk-HT3G7HOV.js +78 -0
- package/dist/{chunk-BFEBZABL.js → chunk-KZLRUBQ5.js} +19 -19
- package/dist/chunk-O74N26AD.js +1 -0
- package/dist/chunk-TDSIF42O.js +1 -0
- package/dist/chunk-TSUQQTHI.js +1 -0
- package/dist/chunk-ULIVVMT6.js +1 -0
- package/dist/{chunk-CDPR2YKL.js → chunk-XRGBKUJO.js} +1 -1
- package/dist/chunk-XY3SGMAJ.js +2 -0
- package/dist/{create-RNP5ACQL.js → create-XTKHAYH7.js} +1 -1
- package/dist/doctor-4UQZIELO.js +1 -0
- package/dist/index.d.ts +11 -2
- package/dist/index.js +165 -140
- package/dist/pipeline-ZCJ6NVRC.js +5 -0
- package/dist/{workspace-E554C5SM.js → workspace-VKUBU4M4.js} +1 -1
- package/dist/{workspace-agent-sync-2HRPM5ZD.js → workspace-agent-sync-QJWXK3RT.js} +1 -1
- package/dist/{workspace-context-VJTXW3K4.js → workspace-context-I5OXR6XB.js} +1 -1
- package/dist/workspace-explain-YFKDZRVX.js +1 -0
- package/dist/{workspace-feedback-65NR3EZH.js → workspace-feedback-KCDFF7YS.js} +1 -1
- package/dist/{workspace-foundation-LISDH53T.js → workspace-foundation-V6SLZRBY.js} +1 -1
- package/dist/workspace-history-DSCH7PQZ.js +1 -0
- package/dist/{workspace-intelligence-E3KXEZCM.js → workspace-intelligence-4SGJDZ6H.js} +1 -1
- package/dist/{workspace-marker-IOPQ42A7.js → workspace-marker-HAC7BMEG.js} +1 -1
- package/dist/workspace-mcp-serve-4QN7ZU6C.js +3 -0
- package/dist/workspace-model-R6XYEQZO.js +1 -0
- package/dist/workspace-run-QRT3JJDB.js +1 -0
- package/dist/{workspace-verify-NRYH7RNB.js → workspace-verify-TEQWZOXM.js} +1 -1
- package/dist/{workspace-watch-H2AETGFI.js → workspace-watch-WERGZE5P.js} +1 -1
- package/docs/contracts/ARTIFACT_CATALOG.md +59 -20
- package/docs/contracts/NAMING_AND_COEXISTENCE.md +3 -2
- package/docs/contracts/README.md +12 -0
- package/docs/doctor-command.md +217 -13
- package/package.json +1 -1
- package/scripts/enterprise-package-smoke.mjs +50 -45
- package/dist/analyze-QYHMGLSG.js +0 -1
- package/dist/autopilot-release-AHMQEUFH.js +0 -1
- package/dist/chunk-33LR2QEM.js +0 -2
- package/dist/chunk-46AGNYI7.js +0 -50
- package/dist/chunk-EN6YCX36.js +0 -1
- package/dist/chunk-JW2FSKT3.js +0 -2
- package/dist/chunk-LKX3L7TE.js +0 -2
- package/dist/chunk-RV6HBTFC.js +0 -2
- package/dist/chunk-TJN7G2MA.js +0 -1
- package/dist/chunk-UQR6G7KH.js +0 -32
- package/dist/chunk-VKLL63TL.js +0 -1
- package/dist/chunk-VMJA36WD.js +0 -1
- package/dist/doctor-XM6QDTDC.js +0 -1
- package/dist/pipeline-DH6Z47O4.js +0 -5
- package/dist/workspace-explain-3WSJLIJ6.js +0 -1
- package/dist/workspace-history-VPDADQKG.js +0 -1
- package/dist/workspace-mcp-serve-RFYDCA2L.js +0 -3
- package/dist/workspace-model-YL7W3573.js +0 -1
- package/dist/workspace-run-GCIQD73R.js +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import {a as a$1}from'./chunk-DKNVDNT4.js';import {c as c$1}from'./chunk-3CYEVV6H.js';import {c}from'./chunk-HT3G7HOV.js';import {b}from'./chunk-KZLRUBQ5.js';import {a as a$2}from'./chunk-AM5OJWXF.js';import {a}from'./chunk-KMUWWZRT.js';import {f,e}from'./chunk-PCXSTKZ5.js';import c$2 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(t,true),a=false;try{let{syncWorkspaceContract:r}=await import('./workspace-contract-OO4GMENV.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 c({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 did not pass",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$1({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-QJWXK3RT.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$2.red(`Pipeline failed: ${r}`)),process.exit(1);}if(t.json)console.log(JSON.stringify(s,null,2));else {console.log(c$2.bold.cyan(`
|
|
2
|
+
\u{1F517} RapidKit Governance Pipeline
|
|
3
|
+
`)),console.log(c$2.bold(`Workspace: ${c$2.cyan(u.basename(s.workspacePath))}`)),console.log(c$2.gray(`Path: ${s.workspacePath}`)),console.log(c$2.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$2.green("PASS"):a.status==="warn"?c$2.yellow("WARN"):a.status==="skipped"?c$2.gray("SKIP"):c$2.red("FAIL");console.log(` - ${a.name}: ${r} ${a.summary}`);}if(s.blockingReasons.length>0){console.log(c$2.bold(`
|
|
4
|
+
Blocking reasons:`));for(let a of s.blockingReasons.slice(0,8))console.log(c$2.gray(` \u2022 ${a}`));}console.log(c$2.gray(`
|
|
5
|
+
Evidence: ${s.artifacts.reportPath}`)),s.agentGrounding?.writtenFiles.length&&console.log(c$2.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 +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-
|
|
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-KZLRUBQ5.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{g as AGENT_CUSTOMIZATION_PACK_REPORT_PATH,d as AGENT_CUSTOMIZATION_PACK_SCHEMA,f as AGENT_GROUNDING_DOC_PATH,e as AGENT_REPORTS_INDEX_PATH,c as AGENT_REPORTS_INDEX_SCHEMA,h as AGENT_REPORT_CATALOG,i as buildWorkspaceAgentReportsIndex,j as parseAgentGroundingTargets,k as syncWorkspaceAgentGrounding}from'./chunk-
|
|
1
|
+
export{g as AGENT_CUSTOMIZATION_PACK_REPORT_PATH,d as AGENT_CUSTOMIZATION_PACK_SCHEMA,f as AGENT_GROUNDING_DOC_PATH,e as AGENT_REPORTS_INDEX_PATH,c as AGENT_REPORTS_INDEX_SCHEMA,h as AGENT_REPORT_CATALOG,i as buildWorkspaceAgentReportsIndex,j as parseAgentGroundingTargets,k as syncWorkspaceAgentGrounding}from'./chunk-GD6VML5K.js';
|
|
@@ -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-
|
|
1
|
+
export{b as WORKSPACE_CONTEXT_AGENT_REPORT_PATH,a as WORKSPACE_CONTEXT_SCHEMA_VERSION,c as buildWorkspaceAgentContext,d as writeWorkspaceAgentContext}from'./chunk-XY3SGMAJ.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{b as buildWorkspaceExplain,a as resolveWorkspaceExplainArtifactPath,c as writeWorkspaceExplainReport}from'./chunk-XRGBKUJO.js';export{d as WORKSPACE_MODEL_DIFF_REPORT_PATH}from'./chunk-6UBWN4EE.js';export{c as WORKSPACE_EXPLAIN_REPORT_PATH,e as WORKSPACE_TRACE_REPORT_PATH,d as WORKSPACE_WHY_REPORT_PATH}from'./chunk-GBJBQ43T.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b}from'./chunk-ICGWHIMK.js';import {b as b$1,f,
|
|
1
|
+
import {b}from'./chunk-ICGWHIMK.js';import {b as b$1,f,j}from'./chunk-COBMOVUK.js';import o from'path';async function m(r){let t=o.resolve(r.workspacePath),n=b(r.payload);if(!n)return {ok:false,error:"Invalid agent-action-outcome payload",historyPath:o.join(t,b$1)};let c=f(n),p=o.join(t,b$1);return await j(t,c,{retention:r.retention}),{ok:true,entry:c,historyPath:p}}function l(r){let t=r.trim();if(!t)return null;try{return JSON.parse(t)}catch{return null}}async function h(){let r=[];for await(let t of process.stdin)r.push(typeof t=="string"?Buffer.from(t):t);return Buffer.concat(r).toString("utf8")}export{l as parseFeedbackStdinPayload,h as readStdinAll,m as recordWorkspaceFeedback};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b}from'./chunk-
|
|
1
|
+
import {b}from'./chunk-42ARJBM7.js';import {a}from'./chunk-7BEZH5LE.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-X5WRUU3T.js');return await y(t),{workspacePath:t,created:s,status:s.length>0?"passed":"skipped"}}export{W as ensureWorkspaceFoundation};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{c as DEFAULT_HISTORY_RETENTION,b as WORKSPACE_HISTORY_PATH,a as WORKSPACE_HISTORY_SCHEMA_VERSION,i as appendHistoryEntry,f as historyEntryFromAgentAction,g as historyEntryFromDoctorFixResult,e as historyEntryFromVerify,d as normalizeHistoryEntry,h as readWorkspaceHistory,j as recordWorkspaceHistory}from'./chunk-COBMOVUK.js';
|
|
@@ -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-
|
|
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-6UBWN4EE.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{d as createNpmWorkspaceMarker,e as isValidWorkspaceMarker,a as readWorkspaceMarker,c as updateWorkspaceMetadata,b as writeWorkspaceMarker}from'./chunk-
|
|
1
|
+
export{d as createNpmWorkspaceMarker,e as isValidWorkspaceMarker,a as readWorkspaceMarker,c as updateWorkspaceMetadata,b as writeWorkspaceMarker}from'./chunk-7BEZH5LE.js';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import {b}from'./chunk-XRGBKUJO.js';import {b as b$2}from'./chunk-XY3SGMAJ.js';import {d}from'./chunk-O74N26AD.js';import {c,e}from'./chunk-AQ4XZZC6.js';import {c as c$1,b as b$3}from'./chunk-GBJBQ43T.js';import {k}from'./chunk-TSUQQTHI.js';import {c as c$2}from'./chunk-3PTJID76.js';import f from'path';import T from'readline';import b$1 from'fs-extra';var P=".rapidkit/reports/INDEX.json";function h(t,e){return t.kind!==e.kind?false:t.kind==="project"&&e.kind==="project"?t.project.toLowerCase()===e.project.toLowerCase():t.kind==="blocker"&&e.kind==="blocker"?t.blockerId===e.blockerId:t.kind==="trace"&&e.kind==="trace"?t.diffRef===e.diffRef:true}var O=[{name:"getWorkspaceModel",description:"Read workspace-model.json",inputSchema:{type:"object",properties:{}}},{name:"getEvidenceIndex",description:"Read agent reports INDEX.json",inputSchema:{type:"object",properties:{}}},{name:"getBlockers",description:"Aggregate blocking reasons from verify, explain, and contract-verify reports",inputSchema:{type:"object",properties:{}}},{name:"getSafeCommands",description:"Read safe commands from workspace-context-agent.json",inputSchema:{type:"object",properties:{}}},{name:"getProjectContext",description:"Read scoped project context from workspace-context-agent.json",inputSchema:{type:"object",properties:{project:{type:"string",description:"Optional project name; defaults to active scope"}}}},{name:"getArtifact",description:"Read one workspace-relative artifact path",inputSchema:{type:"object",properties:{relativePath:{type:"string"}},required:["relativePath"]}},{name:"listOperationalSkills",description:"Read workspace-skills-index.json",inputSchema:{type:"object",properties:{}}},{name:"getWorkspaceExplain",description:"Build or read workspace explain report",inputSchema:{type:"object",properties:{target:{type:"string",description:"release-blocked | project:<name> | blocker:<id> | trace:<diffRef> | <project>"}}}}];function C(t){let e=t.trim().replace(/\\/g,"/");return e.length>0&&!f.isAbsolute(e)&&!e.split("/").includes("..")&&e.startsWith(".rapidkit/")}async function l(t,e){if(!C(e))throw new Error(`Unsafe artifact path: ${e}`);let i=f.join(t,e);return await b$1.pathExists(i)?b$1.readJson(i):null}async function _(t){let e$1=[],i=new Set,s=((await l(t,d))?.blockingReasons??[]).filter(n=>typeof n=="string"&&n.trim().length>0);if(s.length>0){e$1.push({artifact:d,reasons:s});for(let n of s)i.add(n);}let a=await l(t,c$1);if(e(a)){let n=(a.blockingReasons??[]).filter(r=>typeof r=="string"&&r.trim().length>0);if(n.length>0){e$1.push({artifact:c$1,reasons:n});for(let r of n)i.add(r);}}let c=await l(t,c$2),p=(c?.violations??[]).filter(n=>typeof n=="string"&&n.trim().length>0);if(p.length>0||String(c?.status??"").toLowerCase()==="failed"){let n=p.length>0?p:["Workspace contract verification failed"];e$1.push({artifact:c$2,reasons:n});for(let r of n)i.add(r);}return {blockingReasons:[...i],sources:e$1}}async function x(t,e$1,i){switch(e$1){case "getWorkspaceModel":return l(t,k);case "getEvidenceIndex":return l(t,P);case "getBlockers":return _(t);case "getSafeCommands":return {safeCommands:(await l(t,b$2))?.safeCommands??[]};case "getProjectContext":{let o=await l(t,b$2);if(!o)return null;let s=String(i.project??"").trim(),a=o.scope?.activeProject??void 0,c=s||a,p=Array.isArray(o.projects)?o.projects:[],n=c&&p.find(r=>typeof r.name=="string"&&r.name.toLowerCase()===c.toLowerCase());return {workspace:o.workspace??null,scope:o.scope??null,validation:o.validation??null,project:n??null,safeCommands:o.safeCommands??[]}}case "getArtifact":{let o=String(i.relativePath??"").trim();return l(t,o)}case "listOperationalSkills":return l(t,b$3);case "getWorkspaceExplain":{let o=String(i.target??"release-blocked").trim(),s=c(o);if(!s)throw new Error(`Invalid explain target: ${o}`);let a=await l(t,c$1);return e(a)&&h(a.target,s)?a:b({workspacePath:t,target:s})}default:throw new Error(`Unknown tool: ${e$1}`)}}function R(t,e){process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:t??null,result:e})}
|
|
2
|
+
`);}function w(t,e){process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:t??null,error:{code:-32e3,message:e}})}
|
|
3
|
+
`);}async function B(t){let e=f.resolve(t.workspacePath),i=T.createInterface({input:process.stdin,terminal:false});for await(let o of i){let s=o.trim();if(!s)continue;let a;try{a=JSON.parse(s);}catch{w(null,"Invalid JSON-RPC request");continue}let{id:c,method:p,params:n}=a;try{if(p==="initialize"){R(c,{protocolVersion:"2024-11-05",capabilities:{tools:{}},serverInfo:{name:"rapidkit-workspace-mcp",version:"0.1.0"}});continue}if(p==="notifications/initialized")continue;if(p==="tools/list"){R(c,{tools:O.map(r=>({name:r.name,description:r.description,inputSchema:r.inputSchema}))});continue}if(p==="tools/call"){let r=String(n?.name??""),A=n?.arguments&&typeof n.arguments=="object"?n.arguments:{},E=await x(e,r,A);R(c,{content:[{type:"text",text:JSON.stringify(E,null,2)}],isError:E==null});continue}w(c,`Unsupported method: ${p??"unknown"}`);}catch(r){w(c,r instanceof Error?r.message:String(r));}}}async function F(t,e,i={}){return x(f.resolve(t),e,i)}export{O as WORKSPACE_MCP_READ_TOOLS,F as invokeMcpToolForTest,B as runWorkspaceMcpServe};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{k as WORKSPACE_MODEL_REPORT_PATH,j as WORKSPACE_MODEL_SCHEMA_VERSION,n as buildWorkspaceModel,o as buildWorkspaceModelCached,m as buildWorkspaceModelFacts,p as buildWorkspaceModelIncremental,l as validateWorkspaceModelStrict,q as writeWorkspaceModel}from'./chunk-TSUQQTHI.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{a as runWorkspaceStage}from'./chunk-GH674HP5.js';export{a as WORKSPACE_RUN_LAST_REPORT_FILENAME}from'./chunk-64RTZBHU.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{d as WORKSPACE_VERIFY_REPORT_PATH,c as WORKSPACE_VERIFY_SCHEMA_VERSION,f as buildWorkspaceVerify,e as computeAffectedSubgraphGate,h as evaluateWorkspaceVerifyGate,i as workspaceVerifyExitCode,g as writeWorkspaceVerify}from'./chunk-
|
|
1
|
+
export{d as WORKSPACE_VERIFY_REPORT_PATH,c as WORKSPACE_VERIFY_SCHEMA_VERSION,f as buildWorkspaceVerify,e as computeAffectedSubgraphGate,h as evaluateWorkspaceVerifyGate,i as workspaceVerifyExitCode,g as writeWorkspaceVerify}from'./chunk-O74N26AD.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'./chunk-
|
|
1
|
+
import {a}from'./chunk-C4ASE2DV.js';import {b,p}from'./chunk-TSUQQTHI.js';import b$1 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 b({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??(()=>p({...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$1.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};
|
|
@@ -21,31 +21,48 @@ Canonical map of **on-disk artifacts** produced by `rapidkit-npm` commands. Dash
|
|
|
21
21
|
|
|
22
22
|
## Governance evidence loop
|
|
23
23
|
|
|
24
|
-
| Command
|
|
25
|
-
|
|
|
26
|
-
| `doctor workspace`
|
|
27
|
-
| `doctor project`
|
|
28
|
-
| `
|
|
29
|
-
| `
|
|
30
|
-
| `
|
|
31
|
-
| `
|
|
32
|
-
|
|
|
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
|
+
| `doctor * --plan` | `.rapidkit/reports/doctor-remediation-plan-last-run.json` | `doctor-remediation-plan-v2` | `contracts/doctor-remediation-plan.v1.json` |
|
|
29
|
+
| `doctor * --fix/--apply` | `.rapidkit/reports/doctor-fix-result-last-run.json` | `rapidkit-doctor-fix-result-v1` | `contracts/workspace-intelligence/doctor-fix-result.v1.json` |
|
|
30
|
+
| `analyze` | `.rapidkit/reports/analyze-last-run.json` | `rapidkit-analyze-v1` | `contracts/analyze-last-run.v1.json` |
|
|
31
|
+
| `readiness` | `.rapidkit/reports/release-readiness-last-run.json` | `release-readiness-v1` | `contracts/release-readiness.v1.json` |
|
|
32
|
+
| `pipeline` | `.rapidkit/reports/pipeline-last-run.json` | `rapidkit-pipeline-v1` | `contracts/pipeline-last-run.v1.json` |
|
|
33
|
+
| `autopilot release` | `.rapidkit/reports/autopilot-release-last-run.json` | `autopilot-release-v1` | — |
|
|
34
|
+
| | `.rapidkit/reports/autopilot-release.json` | (alias, same payload) | — |
|
|
33
35
|
|
|
34
36
|
Side/cache (not gates): `.rapidkit/reports/doctor-workspace-cache.json` (`doctor-workspace-cache-v2`).
|
|
35
37
|
|
|
38
|
+
Doctor Studio handoff:
|
|
39
|
+
`doctor-remediation-plan-v2` (`contracts/doctor-remediation-plan.v1.json`) is emitted in JSON
|
|
40
|
+
responses and persisted to `.rapidkit/reports/doctor-remediation-plan-last-run.json` by
|
|
41
|
+
`doctor workspace|project --plan`, `--fix`, and `--apply` so IDEs can render approved commands,
|
|
42
|
+
typed file edits, diff previews, ordered phases, step dependencies, rollback, and verification
|
|
43
|
+
steps without inferring them. `doctor-fix-result-last-run.json` records the approved execution
|
|
44
|
+
outcome, and fix/apply runs append a `kind: doctor-fix` entry to
|
|
45
|
+
`workspace-intelligence-history.json`.
|
|
46
|
+
|
|
47
|
+
When `doctor project` runs inside a workspace, the workspace report remains the canonical
|
|
48
|
+
governance artifact and Doctor mirrors `doctor-project-last-run.json`,
|
|
49
|
+
`doctor-remediation-plan-last-run.json`, and `doctor-fix-result-last-run.json` into the scoped
|
|
50
|
+
project's `.rapidkit/reports/` directory. This keeps Studio, agents, and project-local operators on
|
|
51
|
+
the same evidence without losing the workspace source of truth.
|
|
52
|
+
|
|
36
53
|
## Workspace intelligence
|
|
37
54
|
|
|
38
|
-
| Command
|
|
39
|
-
|
|
|
40
|
-
| `workspace model --write`
|
|
41
|
-
| `workspace snapshot`
|
|
42
|
-
| `workspace diff`
|
|
43
|
-
| `workspace impact --from <diff>`
|
|
44
|
-
| `workspace verify`
|
|
45
|
-
| `workspace context --write`
|
|
46
|
-
| `workspace agent-sync --write`
|
|
47
|
-
| `workspace explain --write`
|
|
48
|
-
| `workspace feedback record`
|
|
55
|
+
| Command | Artifact | Schema | Contract file |
|
|
56
|
+
| ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------- | ------------------------------------------------------------------------- |
|
|
57
|
+
| `workspace model --write` | `workspace-model.json` | `workspace-model.v1` | `contracts/workspace-intelligence/workspace-model.v1.json` |
|
|
58
|
+
| `workspace snapshot` | `workspace-model-snapshot.json` | `workspace-model-snapshot.v1` | `workspace-model-snapshot.v1.json` |
|
|
59
|
+
| `workspace diff` | `workspace-model-diff-last-run.json` | `workspace-model-diff.v1` | `workspace-model-diff.v1.json` |
|
|
60
|
+
| `workspace impact --from <diff>` | `workspace-impact-last-run.json` | `workspace-impact.v1` | `workspace-impact.v1.json` |
|
|
61
|
+
| `workspace verify` | `workspace-verify-last-run.json` | `workspace-verify.v1` | `workspace-verify.v1.json` |
|
|
62
|
+
| `workspace context --write` | `workspace-context-agent.json` | `workspace-context.v1` | `workspace-context.v1.json` |
|
|
63
|
+
| `workspace agent-sync --write` | `reports/INDEX.json`, `reports/agent-customization-pack.json`, `reports/rapidkit-mcp-design.json`, `reports/workspace-skills-index.json`, `.rapidkit/skills/*.md`, `.rapidkit/AGENT-GROUNDING.md`, `AGENTS.md`, Copilot/Cursor/Claude/VS Code agent surfaces | `rapidkit-agent-customization-pack.v1` | `contracts/agent-customization-pack.v1.json` |
|
|
64
|
+
| `workspace explain --write` | `workspace-explain-last-run.json` | `workspace-explain.v1` | `contracts/workspace-intelligence/workspace-explain.v1.json` |
|
|
65
|
+
| `workspace feedback record` / `doctor * --fix` | `workspace-intelligence-history.json` (`kind: agent-action`, `doctor-fix`) | `workspace-intelligence-history.v1` | `contracts/workspace-intelligence/workspace-intelligence-history.v1.json` |
|
|
49
66
|
|
|
50
67
|
**CLI semantics:** `workspace diff --from` expects a **model or snapshot** baseline. `workspace impact --from` expects a **diff report**.
|
|
51
68
|
|
|
@@ -172,6 +189,28 @@ Canonical source: `src/contracts/freshness-metadata-contract.ts`
|
|
|
172
189
|
`fresh` (hashes match), `stale` (hashes differ), `unknown` (either side missing,
|
|
173
190
|
e.g. legacy reports).
|
|
174
191
|
|
|
192
|
+
### Fact freshness (`rapidkit-fact-freshness-v1`)
|
|
193
|
+
|
|
194
|
+
Artifact-level freshness answers "is this report still valid?" Fact-level freshness answers
|
|
195
|
+
"may an agent safely remember this specific claim?" `workspace model` and
|
|
196
|
+
`workspace context --for-agent --write` now emit `facts[]` plus a `factFreshness` summary so
|
|
197
|
+
agents, Workspai, and CI can distinguish durable structure from perishable evidence.
|
|
198
|
+
|
|
199
|
+
| Kind | Meaning |
|
|
200
|
+
| ------------------- | ------------------------------------------------------------------------ |
|
|
201
|
+
| `durable` | Structural configuration such as workspace identity or policy mode |
|
|
202
|
+
| `derived` | Inferred structure such as project count, runtime, framework, commands |
|
|
203
|
+
| `evidence-backed` | A fact backed by a report that can expire or become stale |
|
|
204
|
+
| `live` | Runtime state that must be re-observed quickly |
|
|
205
|
+
| `verify-before-use` | Missing, stale, or release-sensitive fact that must be regenerated first |
|
|
206
|
+
|
|
207
|
+
Every fact carries `category` (`structure`, `verification`, `state`), `generatedAt`,
|
|
208
|
+
`ttlSeconds`, `status`, `verifyBeforeUse`, `sourceArtifact`, optional `sourcePath`, and a
|
|
209
|
+
stable `inputsHash` for the fact value. Consumers must treat `verifyBeforeUse: true` as a hard
|
|
210
|
+
refresh boundary before advice, edits, or release decisions. Canonical source:
|
|
211
|
+
`src/contracts/fact-freshness-contract.ts`; JSON Schema:
|
|
212
|
+
`contracts/workspace-intelligence/fact-freshness.v1.json`.
|
|
213
|
+
|
|
175
214
|
### Run correlation (`runId`)
|
|
176
215
|
|
|
177
216
|
When a command runs through the CLI with the structured log stream active, the
|
|
@@ -10,7 +10,7 @@ Rules for **operational intelligence** artifacts so npm CLI, VS Code extension,
|
|
|
10
10
|
| Skills index | `.rapidkit/reports/workspace-skills-index.json` | — |
|
|
11
11
|
| Copilot skill umbrella | — | `.github/skills/rapidkit-workspace-intelligence/SKILL.md` |
|
|
12
12
|
| Explain report | `.rapidkit/reports/workspace-explain-last-run.json` | — |
|
|
13
|
-
| Action feedback | `.rapidkit/reports/workspace-intelligence-history.json` (`kind: agent-action`) | — |
|
|
13
|
+
| Action / repair feedback | `.rapidkit/reports/workspace-intelligence-history.json` (`kind: agent-action`, `doctor-fix`) | — |
|
|
14
14
|
|
|
15
15
|
**Rule:** Never add a standalone `workspace skills generate` command. Operational skills are produced only by `workspace agent-sync --write` (extend the Agent Customization Pack).
|
|
16
16
|
|
|
@@ -34,7 +34,8 @@ Paths are derived from id via `operationalSkillPath()` in `src/contracts/workspa
|
|
|
34
34
|
| Shorthand alias | `workspace why …` | Same parser as `explain` |
|
|
35
35
|
| Diff → blast radius → gates | `workspace trace --from <diff>` | Slice of explain (`kind: trace`) |
|
|
36
36
|
| Graph node centrality | `workspace graph explain <project>` | Graph-topology slice; see **Graph explain coexistence** below |
|
|
37
|
-
| Record agent outcome | `workspace feedback record --json` | Appends to history, no separate feedback file |
|
|
37
|
+
| Record agent outcome | `workspace feedback record --json` | Appends `kind: agent-action` to history, no separate feedback file |
|
|
38
|
+
| Record Doctor repair outcome | `doctor workspace|project --fix --json` | Writes `doctor-fix-result-last-run.json` and appends `kind: doctor-fix` to history |
|
|
38
39
|
| MCP read bridge | `workspace mcp serve` | Read-mostly stdio JSON-RPC; maps Phase 4 explain + skills tools |
|
|
39
40
|
|
|
40
41
|
## Graph explain coexistence (4.11)
|
package/docs/contracts/README.md
CHANGED
|
@@ -23,6 +23,7 @@ Workflow: change code → `npm run generate:contracts` → `npm run sync:parity-
|
|
|
23
23
|
| -------------------------------------------------------------- | ----------------------------------------------------------- |
|
|
24
24
|
| [ARTIFACT_CATALOG.md](./ARTIFACT_CATALOG.md) | On-disk artifact paths, schema versions, and consumer rules |
|
|
25
25
|
| [COMMAND_OWNERSHIP_MATRIX.md](./COMMAND_OWNERSHIP_MATRIX.md) | Which commands the npm wrapper owns vs Python Core |
|
|
26
|
+
| [NAMING_AND_COEXISTENCE.md](./NAMING_AND_COEXISTENCE.md) | Workspace Intelligence command naming and generated surface rules |
|
|
26
27
|
| [RUNTIME_SUPPORT_MATRIX.md](./RUNTIME_SUPPORT_MATRIX.md) | Scaffold, import, lifecycle, and module support tiers |
|
|
27
28
|
| [RUNTIME_ACCEPTANCE_MATRIX.md](./RUNTIME_ACCEPTANCE_MATRIX.md) | Runtime acceptance matrix expectations |
|
|
28
29
|
| [rapidkit-cli-contracts.json](./rapidkit-cli-contracts.json) | Core CLI JSON schema fragments |
|
|
@@ -35,6 +36,7 @@ Published under `../contracts/` (not duplicated in this folder):
|
|
|
35
36
|
- `release-readiness.v1.json` — release readiness gate evidence
|
|
36
37
|
- `workspace-run-last.v1.json` — multi-stage workspace run evidence
|
|
37
38
|
- `doctor-workspace-evidence.v1.json` / `doctor-project-evidence.v1.json` — doctor evidence
|
|
39
|
+
- `doctor-remediation-plan.v1.json` — persisted Doctor fix/plan Studio handoff contract
|
|
38
40
|
- `analyze-last-run.v1.json` — analyze evidence
|
|
39
41
|
- `pipeline-last-run.v1.json` — governance pipeline orchestration
|
|
40
42
|
- `create-planner-capabilities.v1.json` — native-create, external-create-adopt, and adopt-only capability lanes
|
|
@@ -44,10 +46,20 @@ Workspace intelligence (`../contracts/workspace-intelligence/`):
|
|
|
44
46
|
|
|
45
47
|
- `workspace-model.v1.json`
|
|
46
48
|
- `workspace-context.v1.json`
|
|
49
|
+
- `workspace-dependency-graph.v1.json`
|
|
47
50
|
- `workspace-model-snapshot.v1.json`
|
|
48
51
|
- `workspace-model-diff.v1.json`
|
|
49
52
|
- `workspace-impact.v1.json`
|
|
50
53
|
- `workspace-verify.v1.json`
|
|
54
|
+
- `workspace-explain.v1.json`
|
|
55
|
+
- `workspace-intelligence-history.v1.json`
|
|
56
|
+
- `workspace-operational-skill.v1.json`
|
|
57
|
+
- `workspace-skills-index.v1.json`
|
|
58
|
+
- `workspace-contract-verify.v1.json`
|
|
59
|
+
- `agent-action-outcome.v1.json`
|
|
60
|
+
- `blocker-resolution.v1.json`
|
|
61
|
+
- `doctor-fix-result.v1.json`
|
|
62
|
+
- `studio-blocker-handoff.v1.json`
|
|
51
63
|
|
|
52
64
|
CLI commands: see [commands-reference.md](../commands-reference.md) and [../README.md](../README.md#workspace-intelligence).
|
|
53
65
|
|
package/docs/doctor-command.md
CHANGED
|
@@ -13,6 +13,7 @@ npx rapidkit doctor
|
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
Checks host prerequisites:
|
|
16
|
+
|
|
16
17
|
- Python
|
|
17
18
|
- Poetry (optional)
|
|
18
19
|
- pipx (optional)
|
|
@@ -27,6 +28,7 @@ npx rapidkit doctor workspace
|
|
|
27
28
|
```
|
|
28
29
|
|
|
29
30
|
Checks:
|
|
31
|
+
|
|
30
32
|
- all system checks
|
|
31
33
|
- workspace marker resolution
|
|
32
34
|
- project discovery and per-project health
|
|
@@ -42,6 +44,7 @@ npx rapidkit doctor project
|
|
|
42
44
|
```
|
|
43
45
|
|
|
44
46
|
Checks:
|
|
47
|
+
|
|
45
48
|
- all system checks
|
|
46
49
|
- nearest project resolution (current folder or parent with project markers)
|
|
47
50
|
- project-specific framework/runtime health
|
|
@@ -74,19 +77,219 @@ npx rapidkit doctor project --fix
|
|
|
74
77
|
|
|
75
78
|
# JSON output with audit-ready breakdown + probes
|
|
76
79
|
npx rapidkit doctor project --json
|
|
80
|
+
|
|
81
|
+
# Release-grade policy profile
|
|
82
|
+
npx rapidkit doctor workspace --profile enterprise-strict --json
|
|
77
83
|
```
|
|
78
84
|
|
|
79
85
|
## Enterprise Fix Pipeline
|
|
80
86
|
|
|
87
|
+
Doctor supports policy profiles so the same evidence can be interpreted correctly in local,
|
|
88
|
+
CI, release, and enterprise gates:
|
|
89
|
+
|
|
90
|
+
| Profile | Use when | Warning behavior |
|
|
91
|
+
| ------------------- | -------------------------------- | ---------------------------------------- |
|
|
92
|
+
| `local` | Developer diagnostics | Report warnings, do not block |
|
|
93
|
+
| `ci` | CI feedback loop | Exit `2` on warnings, `1` on errors |
|
|
94
|
+
| `release` | Release readiness gate | Exit `1` on warnings or errors |
|
|
95
|
+
| `enterprise-strict` | Enterprise/studio repair workflow | Exit `1`; every warning needs evidence or repair guidance |
|
|
96
|
+
|
|
97
|
+
`--strict` maps to the `release` profile and `--ci` maps to the `ci` profile for backward
|
|
98
|
+
compatibility. JSON evidence includes `policyProfile` so Workspai and CI can explain why a
|
|
99
|
+
card is advisory locally but blocking for release.
|
|
100
|
+
|
|
101
|
+
Doctor also attaches a **freshness contract** to evidence so tools do not treat live state as
|
|
102
|
+
durable structure:
|
|
103
|
+
|
|
104
|
+
| Freshness category | Meaning | Default TTL |
|
|
105
|
+
| ------------------ | -------------------------------------------- | ----------- |
|
|
106
|
+
| `structure` | Durable project/workspace shape and markers | 7 days |
|
|
107
|
+
| `verification` | Test, script, lint, quality, and probe checks | 24 hours |
|
|
108
|
+
| `state` | Live dependency/security state | 5 minutes |
|
|
109
|
+
|
|
110
|
+
Each probe can include `freshness`, and each JSON artifact includes `evidenceFreshness`.
|
|
111
|
+
Workspai and CI should refresh stale or `verifyBeforeUse` evidence before claiming a project is
|
|
112
|
+
ready, repaired, or release-safe.
|
|
113
|
+
|
|
114
|
+
Doctor probes also include an **issue taxonomy** and **repair intent** for Studio-driven repair:
|
|
115
|
+
|
|
116
|
+
| Field | Purpose |
|
|
117
|
+
| ------------------- | ----------------------------------------------------------------------- |
|
|
118
|
+
| `issueClass` | Stable category such as `security`, `test`, `container`, or `dependency` |
|
|
119
|
+
| `operationalImpact` | Product impact such as `ci-risk`, `release-risk`, or `security-risk` |
|
|
120
|
+
| `repairIntent.mode` | Studio action mode: `edit-file`, `run-command`, `review-required`, `verify-before-fix`, or `refresh-evidence` |
|
|
121
|
+
|
|
122
|
+
This lets Workspai distinguish "show guidance" from "apply an approved file edit", "run a command",
|
|
123
|
+
or "refresh stale/live evidence first".
|
|
124
|
+
|
|
81
125
|
When `--fix` is enabled, Doctor now runs a staged treatment pipeline:
|
|
82
126
|
|
|
83
127
|
1. Fix policy engine assigns risk for each fix step (`safe`, `guarded`, `invasive`).
|
|
84
|
-
2. Transaction snapshots are created for guarded/invasive steps.
|
|
85
|
-
3.
|
|
86
|
-
4.
|
|
87
|
-
5.
|
|
128
|
+
2. Transaction snapshots are created for guarded/invasive steps and project-scoped file edits.
|
|
129
|
+
3. Repair capabilities from probes can promote safe, typed fixes into the plan.
|
|
130
|
+
4. Dependency orchestrator executes known dependency commands via structured adapters.
|
|
131
|
+
5. Post-fix verification re-runs project diagnostics.
|
|
132
|
+
6. Retry policy re-attempts transient network failures once before failing.
|
|
133
|
+
|
|
134
|
+
If a guarded/invasive step or file edit fails, Doctor attempts rollback from snapshot and records
|
|
135
|
+
the failure. Newly-created files are tracked and removed during rollback if the fix cannot finish.
|
|
136
|
+
|
|
137
|
+
`--plan --json`, `--fix --json`, and `--apply --json` include a remediation plan with
|
|
138
|
+
`schemaVersion: doctor-remediation-plan-v2`. This plan is the Studio handoff contract: every step
|
|
139
|
+
has a stable `id`, `phase`, `order`, `dependsOn`, `issueId`, `issueClass`, `operationalImpact`,
|
|
140
|
+
`repairIntent`, affected `files`, typed `operation` when Doctor can edit safely, a human-readable
|
|
141
|
+
`preview`, deterministic `diffPreview`, `verifyCommand`, `refreshCommands`, rollback strategy, and
|
|
142
|
+
`studioStatus`.
|
|
143
|
+
|
|
144
|
+
The same plan is persisted to:
|
|
145
|
+
|
|
146
|
+
```text
|
|
147
|
+
.rapidkit/reports/doctor-remediation-plan-last-run.json
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
After `--fix` or `--apply`, Doctor also persists the execution result:
|
|
151
|
+
|
|
152
|
+
```text
|
|
153
|
+
.rapidkit/reports/doctor-fix-result-last-run.json
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
and appends a `kind: doctor-fix` entry to
|
|
157
|
+
`.rapidkit/reports/workspace-intelligence-history.json`. This gives Workspai a closed repair loop:
|
|
158
|
+
plan -> approved command/edit -> execution result -> refreshed evidence -> history.
|
|
88
159
|
|
|
89
|
-
|
|
160
|
+
For `doctor project` inside a workspace, the canonical governance copy stays under the workspace
|
|
161
|
+
`.rapidkit/reports/` directory and Doctor mirrors the project evidence, remediation plan, and fix
|
|
162
|
+
result into the scoped project's `.rapidkit/reports/` directory. Project-local tools can inspect the
|
|
163
|
+
same repair evidence without guessing the workspace root.
|
|
164
|
+
|
|
165
|
+
The remediation plan is intentionally ordered for Studio execution:
|
|
166
|
+
|
|
167
|
+
| Phase | Purpose |
|
|
168
|
+
| --- | --- |
|
|
169
|
+
| `dependency-baseline` | Restore package/runtime dependency baselines before other fixes |
|
|
170
|
+
| `local-environment` | Seed local env files without overwriting operator-owned values |
|
|
171
|
+
| `source-hygiene` | Apply safe project-scoped hygiene files such as `.dockerignore` or `.gitignore` rules |
|
|
172
|
+
| `command-contract` | Add missing test, quality, audit, or runtime command contracts |
|
|
173
|
+
| `runtime-governance` | Run RapidKit/workspace initializers that may touch multiple project surfaces |
|
|
174
|
+
| `manual-review` | Surface guidance that requires a human decision |
|
|
175
|
+
| `generic-execution` | Last-resort shell remediation when no typed operation exists |
|
|
176
|
+
|
|
177
|
+
`dependsOn` lets Workspai avoid false loops: for example, a missing test script repair can depend on
|
|
178
|
+
the project dependency baseline step, so Studio can run or ask for approval in the same order Doctor
|
|
179
|
+
would use.
|
|
180
|
+
|
|
181
|
+
Workspai should use this contract to offer two clear actions for a blocked card:
|
|
182
|
+
|
|
183
|
+
1. Run the exact diagnostic or remediation command when the safest path is command execution.
|
|
184
|
+
2. Apply the approved file edit when Doctor exposes a typed, project-scoped operation.
|
|
185
|
+
|
|
186
|
+
After either path, Studio should run the step `verifyCommand` when present, then refresh the card
|
|
187
|
+
with `refreshCommands` before claiming the issue is resolved.
|
|
188
|
+
|
|
189
|
+
In `enterprise-strict`, guarded and invasive fixes are exposed as `review-required` even when they
|
|
190
|
+
are executable. That keeps Studio honest: it can preview and propose the change, but the operator
|
|
191
|
+
must approve before Doctor mutates project files or runs a dependency command.
|
|
192
|
+
|
|
193
|
+
The Doctor test suite includes a multi-stack remediation canary matrix for Node/Next.js,
|
|
194
|
+
Python/Poetry, Go, Rust, PHP/Composer, Ruby/Bundler, and .NET. The canary validates both
|
|
195
|
+
`doctor project --plan --json` and workspace-level dashboard aggregation so new runtime support
|
|
196
|
+
cannot silently regress the Studio handoff contract.
|
|
197
|
+
|
|
198
|
+
Repair-capable probes include a `repairCapability` object in JSON/evidence output. This is the
|
|
199
|
+
contract IDEs and Workspai use to distinguish an explanatory warning from an approved repair path:
|
|
200
|
+
|
|
201
|
+
```json
|
|
202
|
+
{
|
|
203
|
+
"id": "frontend-script-test",
|
|
204
|
+
"status": "warn",
|
|
205
|
+
"repairCapability": {
|
|
206
|
+
"issueId": "frontend-script-test",
|
|
207
|
+
"fixKind": "package-json-script",
|
|
208
|
+
"canAutoFix": true,
|
|
209
|
+
"canEditFiles": true,
|
|
210
|
+
"requiresApproval": true,
|
|
211
|
+
"files": ["package.json"],
|
|
212
|
+
"operation": {
|
|
213
|
+
"type": "package-json-script",
|
|
214
|
+
"path": "package.json",
|
|
215
|
+
"scriptName": "test",
|
|
216
|
+
"scriptValue": "npm run lint"
|
|
217
|
+
},
|
|
218
|
+
"verifyCommand": "npx rapidkit doctor project --json"
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
For example, a frontend project with `lint` or `build` but no `test` script can receive a guarded
|
|
224
|
+
`package.json` repair. `doctor workspace --fix --json` applies the package script update through
|
|
225
|
+
Doctor's structured executor instead of falling back to an opaque shell command. Structured
|
|
226
|
+
operations include file create/append/copy, package script creation, JSON pointer edits, env key
|
|
227
|
+
additions, and Makefile target additions.
|
|
228
|
+
|
|
229
|
+
File hygiene repairs use the same contract. A Dockerfile without `.dockerignore` can produce a
|
|
230
|
+
safe `file-create` operation, and a `.gitignore` missing env-file rules can produce a safe
|
|
231
|
+
`file-append` operation. Workspai can render those operations as reviewable file edits before the
|
|
232
|
+
operator approves the fix.
|
|
233
|
+
|
|
234
|
+
Local environment seeding is also typed. When `.env.example` exists and `.env` is missing, Doctor
|
|
235
|
+
emits a safe `file-copy` operation instead of an opaque shell copy command. The target is never
|
|
236
|
+
overwritten.
|
|
237
|
+
|
|
238
|
+
For Node projects without a security audit script, Doctor can emit a guarded
|
|
239
|
+
`package-json-script` operation for `scripts.audit="npm audit --audit-level=moderate"`, giving CI,
|
|
240
|
+
Studio, and humans the same deterministic security check.
|
|
241
|
+
|
|
242
|
+
For projects with dependency manifests but no deterministic baseline, Doctor emits guarded
|
|
243
|
+
`dependency-sync` repairs when the runtime has a safe native command:
|
|
244
|
+
|
|
245
|
+
- Node: `npm install`, `pnpm install`, `yarn install`, or `bun install`
|
|
246
|
+
- Go: `go mod tidy`
|
|
247
|
+
- Rust: `cargo fetch`
|
|
248
|
+
- PHP: `composer install`
|
|
249
|
+
- Ruby: `bundle install`
|
|
250
|
+
- .NET: `dotnet restore`
|
|
251
|
+
- Python: `poetry lock` or `uv lock` when the project metadata identifies the tool
|
|
252
|
+
|
|
253
|
+
When the runtime does not expose a safe deterministic repair path, Doctor keeps the issue as
|
|
254
|
+
review-required guidance instead of guessing.
|
|
255
|
+
|
|
256
|
+
Doctor can also create **runtime command contracts** for missing test, quality, and security
|
|
257
|
+
surfaces. For Node, safe contracts are written as `package.json` scripts when a deterministic
|
|
258
|
+
fallback exists. For backend runtimes such as Go, Python, Rust, PHP, Ruby, .NET, and Java, Doctor
|
|
259
|
+
uses guarded `Makefile` target repairs (`test`, `quality`, `security`) so Studio can preview and
|
|
260
|
+
apply the file edit without executing an unprovisioned toolchain immediately.
|
|
261
|
+
|
|
262
|
+
## Enterprise Surface Probes
|
|
263
|
+
|
|
264
|
+
Doctor also emits language-agnostic product-readiness probes for every detected project. These
|
|
265
|
+
probes do not replace runtime-specific checks; they add a common enterprise baseline that Workspai,
|
|
266
|
+
CI, and agents can reason about consistently across frontend and backend stacks:
|
|
267
|
+
|
|
268
|
+
| Surface | Probe examples |
|
|
269
|
+
| ----------- | ---------------------------------------------------------------------------------- |
|
|
270
|
+
| Dependency | Runtime manifest plus deterministic lock/baseline (`package-lock`, `go.sum`, etc.) |
|
|
271
|
+
| Environment | `.env.example`, config schema, or environment documentation |
|
|
272
|
+
| Container | Dockerfile / compose presence and `.dockerignore` hygiene |
|
|
273
|
+
| Deployment | Kubernetes/Helm/Kustomize surface plus readiness probes and resource controls |
|
|
274
|
+
| Security | Vulnerability evidence, `.gitignore` hygiene, audit-script guidance |
|
|
275
|
+
| Tests | Runtime/framework test scripts, configs, directories, or test files |
|
|
276
|
+
| Formatting | Node formatter command surface for CI parity |
|
|
277
|
+
|
|
278
|
+
These probes are intentionally evidence-first. Missing optional surfaces are surfaced as warnings
|
|
279
|
+
or manual repair capabilities, while deterministic repairs are promoted into `--fix` only when the
|
|
280
|
+
change is safe enough for Doctor to apply with approval and post-fix verification.
|
|
281
|
+
|
|
282
|
+
Runtime-native probes add a second layer on top of the generic surface checks:
|
|
283
|
+
|
|
284
|
+
| Runtime family | Native signals sampled by Doctor |
|
|
285
|
+
| -------------- | --------------------------------------------------------------------- |
|
|
286
|
+
| Node/Bun/Deno | test runners, ESLint/Prettier/Biome markers, audit script/tooling |
|
|
287
|
+
| Python | pytest/tox/nox, Ruff/Black/Mypy, pip-audit/Safety/Bandit markers |
|
|
288
|
+
| Go | `*_test.go`, golangci-lint/Makefile quality, govulncheck/gosec hints |
|
|
289
|
+
| Java | Maven/Gradle tests, Checkstyle/Spotless/PMD, OWASP dependency checks |
|
|
290
|
+
| .NET | test projects, `.editorconfig`, NuGet audit and vulnerable checks |
|
|
291
|
+
| Rust | test/Cargo markers, rustfmt/clippy, cargo-audit hints |
|
|
292
|
+
| PHP/Ruby/etc. | PHPUnit/Pint/PHPStan, RSpec/RuboCop/Bundler-audit and ecosystem hints |
|
|
90
293
|
|
|
91
294
|
## CI Example
|
|
92
295
|
|
|
@@ -108,10 +311,10 @@ jobs:
|
|
|
108
311
|
|
|
109
312
|
## Exit Codes
|
|
110
313
|
|
|
111
|
-
| Code | Meaning
|
|
112
|
-
|
|
|
113
|
-
| `0`
|
|
114
|
-
| `1`
|
|
314
|
+
| Code | Meaning |
|
|
315
|
+
| ---- | ------------------------------ |
|
|
316
|
+
| `0` | checks passed or warnings only |
|
|
317
|
+
| `1` | blocking issues found |
|
|
115
318
|
|
|
116
319
|
## Enterprise Probe Extensions
|
|
117
320
|
|
|
@@ -221,14 +424,15 @@ These fields are designed for release gates and extension timeline cards that mu
|
|
|
221
424
|
## Workspace fix behavior
|
|
222
425
|
|
|
223
426
|
- Reuses cached project scans when valid; refreshes `.rapidkit/reports/doctor-last-run.json`.
|
|
224
|
-
- `--fix` runs interactive remediation; `--plan` prints plan only; `--apply` applies non-interactively.
|
|
427
|
+
- `--fix` runs interactive remediation; `--plan` prints remediation plan only; `--apply` applies non-interactively.
|
|
225
428
|
- `--plan` cannot be combined with `--fix` or `--apply`.
|
|
429
|
+
- JSON fix/apply output includes the same `doctor-remediation-plan-v2` contract used by Studio.
|
|
226
430
|
- Advisory warnings do not automatically become shell fix commands.
|
|
227
431
|
- Go `go mod tidy` fixes are skipped when the Go toolchain is unavailable.
|
|
228
432
|
|
|
229
433
|
## Workspace JSON fields (AI/automation)
|
|
230
434
|
|
|
231
|
-
`npx rapidkit doctor workspace --json` includes per-project metadata: `framework`, `frameworkKey`, `importStack`, `runtimeFamily`, `projectKind`, `supportTier`, `frameworkConfidence`.
|
|
435
|
+
`npx rapidkit doctor workspace --json` includes per-project metadata: `framework`, `frameworkKey`, `importStack`, `runtimeFamily`, `projectKind`, `supportTier`, `frameworkConfidence`, `probes`, and `repairCapabilities`.
|
|
232
436
|
|
|
233
437
|
## Project scope behavior
|
|
234
438
|
|
|
@@ -239,13 +443,13 @@ These fields are designed for release gates and extension timeline cards that mu
|
|
|
239
443
|
|
|
240
444
|
## Project JSON fields (AI/automation)
|
|
241
445
|
|
|
242
|
-
`npx rapidkit doctor project --json` includes `scope`, `contract`, `project`, `summary.scopeProvenance`, `driftDelta`, and `scoreBreakdown`.
|
|
446
|
+
`npx rapidkit doctor project --json` includes `scope`, `contract`, `project`, `summary.scopeProvenance`, `driftDelta`, and `scoreBreakdown`. The `project` payload includes probe-level `repairCapability` entries and a flattened `repairCapabilities` list when deterministic repairs are available.
|
|
243
447
|
|
|
244
448
|
## Evidence schema compatibility
|
|
245
449
|
|
|
246
450
|
- Workspace evidence: `doctor-workspace-evidence-v1`
|
|
247
451
|
- Project evidence: `doctor-project-evidence-v1`
|
|
248
|
-
- Workspace scan cache: `doctor-workspace-cache-
|
|
452
|
+
- Workspace scan cache: `doctor-workspace-cache-v2`
|
|
249
453
|
|
|
250
454
|
Legacy evidence without `schemaVersion` is still accepted. Unknown versions are treated as invalid evidence. `readiness` and `workspace share` share the same validation path.
|
|
251
455
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rapidkit",
|
|
3
|
-
"version": "0.41.
|
|
3
|
+
"version": "0.41.3",
|
|
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": [
|