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
package/dist/chunk-LKX3L7TE.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {j,h as h$1,g}from'./chunk-EN6YCX36.js';import {a as a$1}from'./chunk-HTYMXMQM.js';import {c}from'./chunk-S5KTATOU.js';import {a}from'./chunk-3PTJID76.js';import pe from'crypto';import u from'path';import y from'fs-extra';import {spawnSync}from'child_process';function S(e,t){let r=spawnSync("git",t,{cwd:e,encoding:"utf8",stdio:["ignore","pipe","ignore"]});return r.status!==0?{ok:false,stdout:""}:{ok:true,stdout:(r.stdout??"").trim()}}function ce(e){let t=[],r=[],n=[];for(let c of e.split(`
|
|
2
|
-
`)){if(!c.trim())continue;let a=c.slice(0,2),i=c.slice(3).trim();if(i){if(a==="??"){r.push(i);continue}a.includes("D")&&n.push(i),t.push(i);}}return {changedFiles:[...new Set(t)].sort(),untrackedFiles:[...new Set(r)].sort(),deletedFiles:[...new Set(n)].sort()}}function L(e,t){let r={available:false,dirty:false,changedFiles:[],untrackedFiles:[],deletedFiles:[]},n=S(e,["rev-parse","--is-inside-work-tree"]);if(!n.ok||n.stdout!=="true")return r;let c=S(e,["rev-parse","--abbrev-ref","HEAD"]),a=S(e,["rev-parse","HEAD"]),i=S(e,["status","--porcelain=v1","--untracked-files=all"]),p=ce(i.stdout),m=p.changedFiles.length>0||p.untrackedFiles.length>0||p.deletedFiles.length>0;return {available:true,branch:c.ok?c.stdout:void 0,commit:a.ok?a.stdout:void 0,ref:t?.ref,dirty:m,changedFiles:p.changedFiles,untrackedFiles:p.untrackedFiles,deletedFiles:p.deletedFiles}}var Q="workspace-model-snapshot.v1",T="workspace-model-diff.v1",$=".rapidkit/reports/workspace-model-snapshot.json",X=".rapidkit/reports/workspace-model-diff-last-run.json",de="workspace-impact.v1",le=".rapidkit/reports/workspace-impact-last-run.json";function Z(e){let t=e.trim().toLowerCase();return t==="git"||t.startsWith("git:")}function me(e){let t=e.trim();return t.toLowerCase()==="git"?"HEAD":t.toLowerCase().startsWith("git:")&&t.slice(4).trim()||"HEAD"}function _(e){if(Array.isArray(e))return e.map(t=>_(t));if(e&&typeof e=="object"){let t={};for(let r of Object.keys(e).sort())t[r]=_(e[r]);return t}return e}function k(e){return JSON.stringify(_(e))}function E(e){let{runId:t,...r}=e,n={...r,generatedAt:"<ignored>",graph:e.graph?{...e.graph,generatedAt:"<ignored>"}:void 0,validation:e.validation?{...e.validation,issues:e.validation.issues.map(c=>({...c})).sort((c,a)=>{let i=`${c.severity}:${c.code}:${c.target}:${c.message}`,p=`${a.severity}:${a.code}:${a.target}:${a.message}`;return i.localeCompare(p)})}:void 0};return pe.createHash("sha256").update(k(n)).digest("hex")}function ee(e,t){return u.isAbsolute(t)?t:u.join(e,t)}async function fe(e){let t=await y.readJson(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Workspace model input is not a JSON object: ${e}`);let r=t;if(r.schemaVersion===Q){let n=r;if(!n.model||n.model.schemaVersion!==g)throw new Error(`Invalid workspace model snapshot: ${e}`);return {model:n.model,hash:n.modelHash||E(n.model)}}if(r.schemaVersion===g){let n=r;return {model:n,hash:E(n)}}throw r.schemaVersion===T?new Error(`workspace diff --from received a diff report (${u.basename(e)}). Use a workspace model snapshot or model report as baseline, e.g. ${$}. To analyze an existing diff report, run: npx rapidkit workspace impact --from ${u.basename(e)} --json`):new Error(`Unsupported workspace model input schema: ${String(r.schemaVersion)}`)}async function ue(e){let t=await y.readJson(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Workspace diff input is not a JSON object: ${e}`);let r=t;if(r.schemaVersion!==T)return null;let n=r;if(!n.currentModel||n.currentModel.schemaVersion!==g||!n.summary||!Array.isArray(n.changes))throw new Error(`Invalid workspace model diff report: ${e}`);return n}async function Ve(e){let t=e.model??await j({workspacePath:e.workspacePath,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,observableScanDepth:e.observableScanDepth,now:e.now});return {schemaVersion:Q,generatedAt:(e.now??new Date).toISOString(),modelHash:E(t),modelRef:h$1,model:t}}async function Ge(e,t){let r=u.join(t,$);return await y.ensureDir(u.dirname(r)),await y.writeJson(r,a(e),{spaces:2}),r}function A(e){return {name:e.name,path:e.path,kind:e.kind,runtime:e.runtime,framework:e.framework,generator:e.generator,supportTier:e.supportTier,commands:e.commands,importantFiles:e.importantFiles}}function h(e,t){e.push(t);}function ge(e,t){let r=[],n=["name","profile","type"],c=["workspaceType","surfaces","runtimeFamilies","businessCapabilities"];for(let a of n){let i=e.workspace[a],p=t.workspace[a];k(i)!==k(p)&&h(r,{type:"workspace.changed",severity:"info",target:`workspace.${a}`,message:`Workspace metadata field changed: ${String(a)}`,before:i,after:p});}for(let a of c){let i=e.identity[a],p=t.identity[a];k(i)!==k(p)&&h(r,{type:"workspace.changed",severity:"info",target:`identity.${a}`,message:`Workspace identity field changed: ${String(a)}`,before:i,after:p});}return k(e.policies)!==k(t.policies)&&h(r,{type:"workspace.changed",severity:"warning",target:"policies",message:"Workspace policy summary changed.",before:e.policies,after:t.policies}),k(e.evidence)!==k(t.evidence)&&h(r,{type:"workspace.changed",severity:"info",target:"evidence",message:"Workspace evidence summary changed.",before:e.evidence,after:t.evidence}),k(e.discovery)!==k(t.discovery)&&h(r,{type:"workspace.changed",severity:"info",target:"discovery",message:"Workspace discovery settings changed.",before:e.discovery,after:t.discovery}),e.contracts.exists!==t.contracts.exists&&h(r,{type:"workspace.changed",severity:t.contracts.exists?"info":"warning",target:t.contracts.workspaceContractPath,message:"Workspace contract presence changed.",before:e.contracts.exists,after:t.contracts.exists}),r}function ke(e,t){let r=e.validation??null,n=t.validation??null;return k(r)===k(n)?[]:[{type:"validation.changed",severity:n?.status==="failed"?"critical":"warning",target:"validation",message:"Workspace model validation changed.",before:r,after:n}]}function he(e,t){let r=[],n=new Map(e.projects.map(a=>[a.path,a])),c=new Map(t.projects.map(a=>[a.path,a]));for(let[a,i]of c.entries()){let p=n.get(a);if(!p){h(r,{type:"project.added",severity:"info",target:a,message:`Project added: ${i.name}`,after:A(i)});continue}let m=A(p),l=A(i);if(k(m)!==k(l)){let f=p.runtime!==i.runtime||p.framework!==i.framework;h(r,{type:"project.changed",severity:f?"warning":"info",target:a,message:`Project changed: ${i.name}`,before:m,after:l});}}for(let[a,i]of n.entries())c.has(a)||h(r,{type:"project.removed",severity:"warning",target:a,message:`Project removed: ${i.name}`,before:A(i)});return r.sort((a,i)=>`${a.type}:${a.target}`.localeCompare(`${i.type}:${i.target}`))}async function we(e){let t=u.resolve(e.workspacePath),r=Z(e.fromPath),n=r?me(e.fromPath):void 0,c=e.fromPath;if(r){let g=u.join(t,$);if(!await y.pathExists(g))throw new Error("Git-aware workspace diff requires an existing snapshot at .rapidkit/reports/workspace-model-snapshot.json. Run: npx rapidkit workspace snapshot --json");c=$;}let a=ee(t,c),i=await fe(a),p=e.model??await j({workspacePath:t,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,observableScanDepth:e.observableScanDepth,now:e.now}),m=E(p),l=[...ge(i.model,p),...he(i.model,p),...ke(i.model,p)],f;e.includeGitObservation!==false&&(f=e.gitObservation??L(t,{ref:n}),f.available&&ve(l,f,p));let v=l.filter(g=>g.type.startsWith("git.")).length,I=i.hash!==m,W=r?`git:${n??"HEAD"}`:u.relative(t,a).split(u.sep).join("/");return {schemaVersion:T,generatedAt:(e.now??new Date).toISOString(),fromRef:W,toRef:h$1,fromHash:i.hash,toHash:m,summary:{changed:I||v>0,addedProjects:l.filter(g=>g.type==="project.added").length,removedProjects:l.filter(g=>g.type==="project.removed").length,changedProjects:l.filter(g=>g.type==="project.changed").length,workspaceChanges:l.filter(g=>g.type==="workspace.changed").length,validationChanges:l.filter(g=>g.type==="validation.changed").length,gitChangedFiles:v},git:f?.available?je(f,n):{available:false,dirty:false,changedFiles:0,untrackedFiles:0,deletedFiles:0},changes:l,currentModel:p}}async function Ne(e,t){let r=u.join(t,X);return await y.ensureDir(u.dirname(r)),await y.writeJson(r,a(e),{spaces:2}),r}function M(e){return {none:0,low:1,medium:2,high:3,critical:4}[e]}function z(e){return e.reduce((t,r)=>M(r)>M(t)?r:t,"none")}var H=["none","low","medium","high","critical"];function ye(e){let t=Math.max(1,M(e)-1);return H[t]}function We(e){let t=Math.min(H.length-1,M(e)+1);return H[t]}function J(e){return e.join(" ")}function w(e,t,r,n){return {id:e,label:t,scope:n.scope,project:n.project,display:J(["npx","rapidkit",...r]),execute:J(["npx","--yes","--package","rapidkit","rapidkit",...r]),required:n.required!==false}}function U(e){let t=`project:${e.name}`,r=e.commands.fleetStages;return [w(`project.${e.name}.init`,`Run init for ${e.name}`,["workspace","run","init","--scope",t,"--json"],{scope:"project",project:e.name,required:r.includes("init")}),w(`project.${e.name}.test`,`Run tests for ${e.name}`,["workspace","run","test","--scope",t,"--json"],{scope:"project",project:e.name,required:r.includes("test")}),w(`project.${e.name}.build`,`Run build for ${e.name}`,["workspace","run","build","--scope",t,"--json"],{scope:"project",project:e.name,required:r.includes("build")}),w(`project.${e.name}.start`,`Run start for ${e.name}`,["workspace","run","start","--scope",t,"--json"],{scope:"project",project:e.name,required:r.includes("start")})]}function D(){return [w("workspace.doctor","Run workspace doctor",["doctor","workspace","--json"],{scope:"workspace"}),w("workspace.contract.verify","Verify workspace contract",["workspace","contract","verify","--json"],{scope:"workspace"}),w("workspace.readiness","Run release readiness",["readiness","--json"],{scope:"workspace"}),w("workspace.analyze","Run workspace analyze",["analyze","--json"],{scope:"workspace",required:false}),w("workspace.pipeline","Run governance pipeline",["pipeline","--json"],{scope:"workspace",required:false}),w("workspace.doctor-fix","Verify doctor fix result",["doctor","workspace","--fix","--json"],{scope:"workspace",required:false})]}function be(e,t){let r=t.split(u.sep).join("/");return e.projects.filter(c=>{let a=c.path.split(u.sep).join("/");return r===a||r.startsWith(`${a}/`)}).sort((c,a)=>a.path.length-c.path.length)[0]}function ve(e,t,r){let n=new Set(e.map(a=>a.target)),c=(a,i)=>{let p=i.split(u.sep).join("/"),m=`git:${p}`;if(n.has(m))return;let l=be(r,p),f=l?`${l.name} (${l.path})`:"workspace";h(e,{type:a,severity:a==="git.deleted"?"warning":"info",target:m,message:`Git ${a==="git.untracked"?"untracked":a==="git.deleted"?"deleted":"changed"} file affects ${f}: ${p}`,after:{path:p,project:l?.name,projectPath:l?.path}}),n.add(m);};for(let a of t.changedFiles)c("git.file.changed",a);for(let a of t.untrackedFiles)c("git.untracked",a);for(let a of t.deletedFiles)c("git.deleted",a);}function je(e,t){return {available:true,ref:t??e.ref,branch:e.branch,commit:e.commit,dirty:e.dirty,changedFiles:e.changedFiles.length,untrackedFiles:e.untrackedFiles.length,deletedFiles:e.deletedFiles.length}}function Me(e){let t=new Set,r=[];for(let n of e){let c=`${n.scope}:${n.project??""}:${n.display}`;t.has(c)||(t.add(c),r.push(n));}return r}function Pe(e){return e.type==="project.removed"?"high":e.severity==="critical"?"critical":e.severity==="warning"?"high":("medium")}function Ie(e,t){return e.severity==="critical"?"critical":e.target==="policies"||e.target.includes("contract")?"high":e.type==="validation.changed"?(t?.projectCount??0)===0?"low":"high":e.target==="evidence"?"low":e.severity==="warning"?"medium":"low"}function Re(e){return e.affectedProjects>0||e.projectCount>0||!e.changes.every(r=>r.severity==="critical"?false:r.type.startsWith("git.")||r.type==="validation.changed")?e.risk:M(e.risk)>=M("high")||e.risk==="medium"?"low":e.risk}function Y(e,t){if(!e||e==="workspace")return true;let r=(e.startsWith("project:")?e.slice(8):e).trim().toLowerCase();return [t.name,t.path,u.basename(t.path),t.absolutePath].filter(n=>typeof n=="string"&&n.trim().length>0).map(n=>n.trim().toLowerCase()).includes(r)}function Ce(e){if(!e.changed)return {headline:"No workspace model impact detected.",bullets:["The current workspace model matches the provided snapshot/report."],unsafeAssumptions:["Do not claim runtime verification passed unless a report exists."]};let t=e.affectedProjects.map(r=>r.project?.name??r.target);return {headline:`Workspace impact risk: ${e.risk}.`,bullets:[`Affected projects: ${t.length?t.join(", "):"none"}.`,`Workspace-level items: ${e.workspaceImpact.length}.`,"Use the verification plan before recommending apply, rollback, or release actions."],unsafeAssumptions:["Do not infer test/build success from impact alone.","Do not apply fixes without project scope and verification evidence.","Use display commands for users and execute commands for automation."]}}async function Be(e){let t=u.resolve(e.workspacePath),r=Z(e.fromPath),n=e.diff;if(!n&&!r){let o=ee(t,e.fromPath);n=await ue(o)??void 0;}n||(n=await we({workspacePath:t,fromPath:e.fromPath,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,includeGitObservation:e.includeGitObservation,gitObservation:e.gitObservation,now:e.now,model:e.model}));let c$1=new Map(n.currentModel.projects.map(o=>[o.path,o])),a=new Map(n.currentModel.projects.map(o=>[o.name,o])),i=n.changes.filter(o=>o.type.startsWith("project.")),p=new Map;for(let o of i){let d=(c$1.get(o.target)??(typeof o.before?.name=="string"?a.get(o.before.name):void 0))?.path??o.target,b=p.get(d)??[];b.push(o),p.set(d,b);}let m=[];for(let[o,s]of p.entries()){let d=c$1.get(o);if(d&&!Y(e.scope,d))continue;let b=z(s.map(Pe)),R=d?.name??(typeof s[0]?.before?.name=="string"?String(s[0].before.name):o);m.push({id:`project:${R}`,scope:"project",target:o,title:`Project impact: ${R}`,summary:s.map(j=>j.message).join(" "),risk:b,reasons:s.map(j=>`${j.type}: ${j.message}`),project:d?{name:d.name,path:d.path,kind:d.kind,runtime:d.runtime,framework:d.framework,supportTier:d.supportTier,...d.generator?{generator:d.generator}:{}}:void 0,verification:d?U(d):D()});}let l=n.currentModel.graph,f=l?a$1(l):void 0,v=new Set(m.map(o=>o.project?.name).filter(o=>typeof o=="string")),I=new Map;for(let o of m)if(o.project?.name){let s=f?.byId.get(o.project.name);s&&(o.centrality={fanIn:s.fanIn,fanOut:s.fanOut,reach:s.reach,betweenness:s.betweenness,isHotspot:s.isHotspot},s.isHotspot&&(o.risk=We(o.risk),o.reasons=[...o.reasons,`graph.hotspot: critical-path project with ${s.reach} transitive dependent(s); risk escalated.`])),o.origin="direct",o.distance=0,I.set(o.project.name,o.risk);}let W=[],g=0;if(l&&v.size>0){let o=c(l,v);for(let s of o.values()){if(s.distance===0||v.has(s.id))continue;let d=a.get(s.id);if(d&&!Y(e.scope,d))continue;let b=s.path[0],R=s.path[s.path.length-2]??b,j=I.get(b)??"medium",oe=ye(j);g=Math.max(g,s.distance),W.push({id:`transitive:${s.id}`,scope:"project",target:d?.path??s.id,title:`Transitive impact: ${s.id}`,summary:`Depends on changed project ${b}${s.via?` via ${s.via}`:""} (distance ${s.distance}).`,risk:oe,reasons:[`graph.dependent: depends on ${R}${s.via?` via ${s.via}`:""} (path ${s.path.join(" -> ")})`],project:d?{name:d.name,path:d.path,kind:d.kind,runtime:d.runtime,framework:d.framework,supportTier:d.supportTier,...d.generator?{generator:d.generator}:{}}:void 0,verification:d?U(d):D(),origin:"transitive",distance:s.distance,path:s.path,via:s.via,...f?.byId.get(s.id)?{centrality:{fanIn:f.byId.get(s.id).fanIn,fanOut:f.byId.get(s.id).fanOut,reach:f.byId.get(s.id).reach,betweenness:f.byId.get(s.id).betweenness,isHotspot:f.byId.get(s.id).isHotspot}}:{}});}}W.sort((o,s)=>o.target.localeCompare(s.target));let te=f?f.hotspots.map(o=>{let s=f.byId.get(o);return {project:o,fanIn:s.fanIn,fanOut:s.fanOut,reach:s.reach,betweenness:s.betweenness}}):[],re=n.changes.filter(o=>!o.type.startsWith("project.")),V=n.currentModel.summary?.projectCount??n.currentModel.projects.length,P=re.map(o=>({id:`workspace:${o.target}`,scope:"workspace",target:o.target,title:`Workspace impact: ${o.target}`,summary:o.message,risk:Ie(o,{projectCount:V}),reasons:[`${o.type}: ${o.message}`],verification:D()})),G=Me([...m.flatMap(o=>o.verification),...W.flatMap(o=>o.verification),...P.flatMap(o=>o.verification),...n.summary.changed?D():[]]).filter(o=>o.required),ne=z([...m.map(o=>o.risk),...W.map(o=>o.risk),...P.map(o=>o.risk)]),N=Re({risk:ne,affectedProjects:m.length,projectCount:V,changes:n.changes}),B={changed:n.summary.changed,risk:N,affectedProjects:m.length,workspaceItems:P.length,recommendedCommands:G.length,blastRadius:{directlyAffected:m.length,transitivelyAffected:W.length,maxDistance:g,graphEdges:l?.edges.length??0}};return {schemaVersion:de,generatedAt:(e.now??new Date).toISOString(),fromRef:n.fromRef,diffRef:X,workspace:{name:n.currentModel.workspace.name,profile:n.currentModel.workspace.profile,type:n.currentModel.workspace.type},summary:B,affectedProjects:m.sort((o,s)=>o.target.localeCompare(s.target)),transitiveImpact:W,criticalPathHotspots:te,workspaceImpact:P.sort((o,s)=>o.target.localeCompare(s.target)),verificationPlan:G,agentBrief:Ce({changed:B.changed,risk:N,affectedProjects:m,workspaceImpact:P}),diff:n}}async function qe(e,t){let r=u.join(t,le);return await y.ensureDir(u.dirname(r)),await y.writeJson(r,a(e),{spaces:2}),r}export{Q as a,T as b,$ as c,X as d,de as e,le as f,Z as g,me as h,Ve as i,Ge as j,we as k,Ne as l,D as m,Be as n,qe as o};
|
package/dist/chunk-RV6HBTFC.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import*as r from'fs-extra';import o from'path';async function i(a){let t=o.join(a,".rapidkit-workspace");try{if(await r.pathExists(t))return await r.readJson(t)}catch{return null}return null}async function s(a,t){let e=o.join(a,".rapidkit-workspace"),n=await i(a);n?.metadata&&(t.metadata={...n.metadata,...t.metadata}),await r.outputFile(e,JSON.stringify(t,null,2)+`
|
|
2
|
-
`,"utf-8");}async function k(a,t){let e=await i(a);return e?(e.metadata={...e.metadata,...t,vscode:t.vscode?{...e.metadata?.vscode,...t.vscode}:e.metadata?.vscode,npm:t.npm?{...e.metadata?.npm,...t.npm}:e.metadata?.npm,python:t.python?{...e.metadata?.python,...t.python}:e.metadata?.python},await s(a,e),true):false}function m(a,t,e){return {signature:"RAPIDKIT_WORKSPACE",createdBy:"rapidkit-npm",version:t,createdAt:new Date().toISOString(),name:a,metadata:{npm:{packageVersion:t,installMethod:e,lastUsedAt:new Date().toISOString()}}}}function u(a){if(!a||typeof a!="object")return false;let t=a;return t.signature==="RAPIDKIT_WORKSPACE"&&typeof t.createdBy=="string"&&typeof t.version=="string"&&typeof t.createdAt=="string"&&typeof t.name=="string"}export{i as a,s as b,k as c,m as d,u as e};
|
package/dist/chunk-TJN7G2MA.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a,b as b$1}from'./chunk-PYCJWW4B.js';import {b,c,d}from'./chunk-KIUSCFHF.js';import {m,f,c as c$1,n,e}from'./chunk-LKX3L7TE.js';import {c as c$2}from'./chunk-64RTZBHU.js';import {j,b as b$2}from'./chunk-EN6YCX36.js';import {a as a$1}from'./chunk-3PTJID76.js';import p from'path';import y from'fs-extra';var K="rapidkit-blocker-resolution-v1";function J(e){let t=e.blockers.map(r=>r.trim()).filter(Boolean).slice(0,12),s=e.stderrTail?.trim().slice(-400)??"";return b$2({blockers:t,exitCode:e.exitCode??null,stderrTail:s})}function te(e){let t=e.trim().toLowerCase();return t?t.includes("missing evidence")||t.includes(": missing")||t.includes("artifact missing")||t.includes("not found on disk")?"artifact-missing":t.includes("policy.")||t.includes("contract")?"config-fixable":t.includes("impact")||t.includes("untracked")||t.includes("grounding")?"semantic-attention":t.includes("failed")||t.includes("blocked")||t.includes(": fail")?"command-failed-repeat":"config-fixable":"unresolvable-without-human"}function se(e){let t=te(e.reason),s=J({blockers:[e.reason]}),r=t==="artifact-missing"?[{actionKind:"run-once",detail:e.sourceCommand?`Run the source command once: ${e.sourceCommand}`:"Run the mapped workspace intelligence command once to generate the missing artifact.",studioActionId:"run-analyze"}]:t==="semantic-attention"?[{actionKind:"commit-files",detail:"Review workspace-level grounding files (AGENTS.md, agent-sync outputs) and commit or refresh the impact baseline."},{actionKind:"refresh-baseline",detail:"Refresh snapshot + diff + impact before re-running verify."}]:[{actionKind:"edit-file",detail:"Apply the smallest safe file or policy fix for this blocker before re-running verification.",studioActionId:"fix-lens"}];return {schemaVersion:K,blockerId:e.blockerId,sourceCommand:e.sourceCommand,sourceArtifact:e.sourceArtifact,resolutionClass:t,blockerSignature:s,commandRetryHint:t==="artifact-missing"?"Run the source command once, then verify.":"Do not re-run the same failing command; fix the source issue first, then verify.",fixHints:r,verifyCommand:e.verifyCommand,verifyArtifact:e.verifyArtifact}}function U(e){return Array.from(new Set(e.blockingReasons.map(s=>s.trim()).filter(Boolean))).slice(0,12).map((s,r)=>se({reason:s,blockerId:`blocker-${r+1}`,sourceCommand:e.sourceCommand,sourceArtifact:e.sourceArtifact,verifyCommand:e.verifyCommand,verifyArtifact:e.verifyArtifact}))}function re(e){let t=e.toLowerCase();return t.includes("stale")||t.includes("missing evidence")||t.includes("no projects")||t.includes("projects.empty")||t.includes("projects discovered")||t.includes("projects.missing")||t.includes("not yet run")||t.includes("doctor-last-run")||t.includes("pipeline-last-run")||t.includes("release-readiness")||t.includes("analyze-last-run")||t.includes("analyze reported")||t.includes("analyze verdict")||t.includes("analyze needs attention")||t.includes("toolchain.lock")||t.includes("not pinned")||t.includes("readiness:")||t.includes("env:")||t.includes("workspace-run-last")||t.includes("pre-project")||t.includes("before adding projects")||t.includes("workspace.projects.missing")||t.includes("no backend projects")||t.includes("index.json")||t.includes("workspace-intelligence-history")||t.includes("validation warning")||t.includes("workspace model validation")||t.includes("workspace.marker")||t.includes("no project roots")||t.includes("no infrastructure services")||t.includes("infra/overrides")||t.includes("infra dependencies")||t.includes("contract verify")||t.includes("contract inspect")||t.includes("publish verify evidence")}function ne(e){return e.length===0||e.every(t=>re(t))}function G(e){return e.projectCount>0||e.policyErrorCount>0?{verdict:e.verdict,exitCode:e.exitCode}:e.verdict==="blocked"&&ne(e.blockingReasons)?{verdict:"needs-attention",exitCode:1}:{verdict:e.verdict,exitCode:e.exitCode}}function $e(e,t){let s=t&&t!=="ready"?` (${t.replace(/-/g," ")})`:"";return e===0?`Workspace scaffold ready${s} \u2014 add your first project to continue.`:`Workspace scaffold${s}: ${e} pre-project signal(s) \u2014 add your first project to continue.`}var X="workspace-verify.v1",I=".rapidkit/reports/workspace-verify-last-run.json";function ie(e,t){return p.isAbsolute(t)?t:p.join(e,t)}async function Y(e$1){let t=await y.readJson(e$1);if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Workspace impact input is not a JSON object: ${e$1}`);let s=t;if(s.schemaVersion!==e)throw new Error(`Unsupported workspace impact schema: ${String(s.schemaVersion)}`);return s}function oe(e){let t=new Set,s=[];for(let r of e){let n=`${r.scope}:${r.project??""}:${r.display}`;t.has(n)||(t.add(n),s.push(r));}return s}function ae(e,t){if(!e||e==="workspace")return true;let s=(e.startsWith("project:")?e.slice(8):e).trim().toLowerCase();return t.scope==="workspace"?true:(t.project??"").trim().toLowerCase()===s}function ce(e,t){if(e.id==="workspace.doctor")return p.join(t,".rapidkit","reports","doctor-last-run.json");if(e.id==="workspace.contract.verify")return p.join(t,".rapidkit","reports","workspace-contract-verify-last-run.json");if(e.id==="workspace.readiness")return p.join(t,".rapidkit","reports","release-readiness-last-run.json");if(e.id==="workspace.analyze")return p.join(t,".rapidkit","reports","analyze-last-run.json");if(e.id==="workspace.pipeline")return p.join(t,".rapidkit","reports","pipeline-last-run.json");if(e.id==="workspace.doctor-fix")return p.join(t,".rapidkit","reports","doctor-last-run.json");if(e.id.startsWith("project.")&&e.id.includes("."))return p.join(t,".rapidkit","reports","workspace-run-last.json")}function w(e){return !e||typeof e!="object"||Array.isArray(e)?null:e}function le(e){let t=w(e.healthScore),s=typeof t?.errors=="number"?t.errors:0,r=typeof t?.percent=="number"?t.percent:void 0;return s>0?{status:"fail",message:`Doctor evidence reports ${s} error(s).`}:typeof r=="number"&&r<70?{status:"warn",message:`Doctor health score is ${r}%.`}:{status:"pass",message:"Doctor evidence is present and healthy."}}function de(e){let t=typeof e.overallStatus=="string"?e.overallStatus:"unknown";return t==="fail"?{status:"fail",message:"Release readiness evidence reports blocking failures."}:t==="warn"?{status:"warn",message:"Release readiness evidence reports warnings."}:t==="pass"?{status:"pass",message:"Release readiness evidence passed."}:{status:"warn",message:`Release readiness evidence status is ${t}.`}}function ue(e){let t=typeof e.status=="string"?e.status:"unknown";return t==="failed"||t==="fail"?{status:"fail",message:"Workspace contract verify evidence failed."}:t==="passed"||t==="pass"?{status:"pass",message:"Workspace contract verify evidence passed."}:{status:"warn",message:`Workspace contract verify evidence status is ${t}.`}}function pe(e){let t=w(e.summary);if(t?.blocking===true||e.blocking===true)return {status:"fail",message:"Analyze evidence reports blocking findings."};let r=typeof t?.status=="string"?t.status:void 0;return r==="warn"||r==="warning"?{status:"warn",message:"Analyze evidence reports warnings."}:{status:"pass",message:"Analyze evidence is present."}}function fe(e){let t=e.fixResult;if(!t||typeof t!="object"||Array.isArray(t))return {status:"skipped",message:"Doctor fix result not present; run doctor workspace --fix --json to record fixes."};let s=t,r=Array.isArray(s.remainingBlockers)?s.remainingBlockers:[];if(r.length>0)return {status:"fail",message:`Doctor fix result reports ${r.length} remaining blocker(s).`};let n=Array.isArray(s.appliedFixes)?s.appliedFixes:[];return n.length===0?{status:"pass",message:"Doctor fix result recorded with no remaining blockers."}:{status:"pass",message:`Doctor fix result recorded ${n.length} applied fix(es) with no remaining blockers.`}}function ge(e){return e.id.endsWith(".init")?"init":e.id.endsWith(".test")?"test":e.id.endsWith(".build")?"build":e.id.endsWith(".start")?"start":null}function me(e){let t=w(e.summary),s=typeof t?.verdict=="string"?t.verdict:void 0;return s==="blocked"?{status:"fail",message:"Pipeline evidence is blocked."}:s==="needs-attention"?{status:"warn",message:"Pipeline evidence needs attention."}:s==="ready"?{status:"pass",message:"Pipeline evidence is ready."}:{status:"warn",message:"Pipeline evidence status is unknown."}}function ke(e,t,s){let r=ge(t),n=c$2(e,r??void 0);if(!n)return {status:"missing",message:"Workspace run evidence is missing or unreadable."};let i=n.stage;if(r&&i!==r)return {status:"missing",message:`Workspace run evidence is for stage "${i}", expected "${r}".`};let d=Array.isArray(n.projects)?n.projects:[],l=t.project?.toLowerCase();if(!l)return {status:"missing",message:"Project-scoped workspace run evidence is missing a project identifier."};let a=d.find(g=>{let m=w(g);if(!m)return false;let c=typeof m.projectName=="string"?m.projectName.toLowerCase():"",o=["projectPath","relativePath","path"].map(u=>m[u]).filter(u=>typeof u=="string"&&u.trim().length>0).map(u=>u.replace(/\\/g,"/").toLowerCase());return c===l||o.some(u=>u.endsWith(`/${l}`)||u===l)});if(a){let g=v(n.generatedAt,s,`Workspace run evidence for ${t.project??t.id}`);if(g)return {status:"fail",message:g};let m=w(a),c=typeof m?.status=="string"?m.status:"unknown";return c==="failed"?{status:"fail",message:`Workspace run evidence failed for ${t.project}.`}:c==="passed"?{status:"pass",message:`Workspace run evidence passed for ${t.project}.`}:c==="skipped"?{status:"warn",message:`Workspace run evidence skipped for ${t.project}.`}:{status:"warn",message:`Workspace run evidence status is ${c} for ${t.project}.`}}return {status:"missing",message:`Workspace run evidence does not include project ${t.project}.`}}function v(e,t,s){if(!t)return null;if(typeof e!="string"||e.trim().length===0)return `${s} is stale: missing generatedAt timestamp (required after impact ${t}).`;let r=Date.parse(e),n=Date.parse(t);return Number.isFinite(r)?Number.isFinite(n)&&r<n?`${s} is stale: generated at ${e}, before impact ${t}.`:null:`${s} is stale: invalid generatedAt timestamp (required after impact ${t}).`}async function ye(e,t,s,r){let n=ce(e,t),i=n?p.relative(t,n).split(p.sep).join("/"):void 0;if(e.id==="workspace.contract.verify"&&!s)return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"skipped",required:e.required,message:"Workspace contract is not present; contract verify skipped."};if(!n||!await y.pathExists(n))return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"missing",required:e.required,evidencePath:i,message:i?`Missing evidence report: ${i}`:"No evidence mapping exists for this command."};let d=w(await y.readJson(n));if(!d)return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"fail",required:e.required,evidencePath:i,message:"Evidence report is not a JSON object."};let l;if(e.id==="workspace.doctor"){let a=v(d.generatedAt,r,"Doctor evidence");a?l={status:"fail",message:a}:l=le(d);}else if(e.id==="workspace.readiness"){let a=v(d.generatedAt,r,"Release readiness evidence");a?l={status:"fail",message:a}:l=de(d);}else if(e.id==="workspace.contract.verify"){let a=v(d.generatedAt,r,"Workspace contract verify evidence");a?l={status:"fail",message:a}:l=ue(d);}else if(e.id==="workspace.analyze"){let a=v(d.generatedAt,r,"Analyze evidence");a?l={status:"fail",message:a}:l=pe(d);}else if(e.id==="workspace.pipeline"){let a=v(d.generatedAt,r,"Pipeline evidence");a?l={status:"fail",message:a}:l=me(d);}else if(e.id==="workspace.doctor-fix")l=fe(d);else if(e.id.startsWith("project."))l=ke(d,e,r);else {let a=v(d.generatedAt,r,"Evidence report");a?l={status:"fail",message:a}:l={status:"pass",message:"Evidence report is present."};}return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:l.status,required:e.required,evidencePath:i,message:l.message}}function he(e,t={blockingReasons:[],needsAttention:false}){let s=e.filter(c=>c.status==="pass").length,r=e.filter(c=>c.status==="warn").length,n=e.filter(c=>c.status==="fail").length,i=e.filter(c=>c.status==="missing").length,d=e.filter(c=>c.status==="skipped").length,l=e.filter(c=>c.required&&(c.status==="fail"||c.status==="missing")).map(c=>`${c.id}: ${c.message}`),a=e.filter(c=>c.required&&c.status==="missing").length,g="ready",m=0;return l.length>0||t.blockingReasons.length>0?(g="blocked",m=2):(r>0||a>0||t.needsAttention)&&(g="needs-attention",m=1),{verdict:g,exitCode:m,stepsPassed:s,stepsWarn:r,stepsFailed:n,stepsMissing:i,stepsSkipped:d}}function ve(e,t){let s=W(e.affectedProjects.map(o=>o.project?.name).filter(o=>typeof o=="string")),r=new Set(s.map(o=>o.toLowerCase())),n=W(e.transitiveImpact.map(o=>o.project?.name).filter(o=>typeof o=="string").filter(o=>!r.has(o.toLowerCase()))),i=new Map;for(let o of t){if(o.scope!=="project"||!o.project)continue;let u=o.project.toLowerCase(),h=i.get(u)??[];h.push(o),i.set(u,h);}let d=[],l=[],a=[],g=[],m=false,c=(o,u)=>{let h=i.get(o.toLowerCase())??[];if(h.length===0){a.push(o);return}let R=h.filter(f=>f.status==="fail"),C=h.filter(f=>f.status==="missing"),b=C.filter(f=>f.required),j=h.some(f=>f.status==="pass"||f.status==="warn");if(R.length>0){l.push(o),g.push(`graph.subgraph.${o}: ${u} has failed verification evidence (${R.map(f=>f.id).join(", ")}).`);return}if(b.length>0){l.push(o),g.push(`graph.subgraph.${o}: ${u} has missing required verification evidence (${b.map(f=>f.id).join(", ")}).`);return}if(C.length>0){l.push(o),m=true;return}if(j){d.push(o);return}a.push(o);};for(let o of s)c(o,"directly-changed");for(let o of n)c(o,"transitive dependent");return {subgraph:{totalProjects:s.length+n.length,directlyChanged:s,transitiveDependents:n,covered:W(d),uncovered:W(l),unverifiable:W(a)},blockingReasons:g,needsAttention:m}}function W(e){return [...new Set(e)].sort((t,s)=>t.localeCompare(s))}async function be(e$1){let t=p.resolve(e$1.workspacePath);if(e$1.fromImpactPath){let i=ie(t,e$1.fromImpactPath);return {impact:await Y(i),fromImpactRef:p.relative(t,i).split(p.sep).join("/"),impactFromDisk:true}}let s=p.join(t,f);if(await y.pathExists(s))return {impact:await Y(s),fromImpactRef:f,impactFromDisk:true};let r=p.join(t,c$1);if(await y.pathExists(r))return {impact:await n({workspacePath:t,fromPath:c$1,scope:e$1.scope,includeAbsolutePaths:e$1.includeAbsolutePaths,includeEvidence:e$1.includeEvidence,observableScanDepth:e$1.observableScanDepth,now:e$1.now}),fromImpactRef:c$1,impactFromDisk:false};let n$1=await j({workspacePath:t,includeAbsolutePaths:e$1.includeAbsolutePaths,includeEvidence:e$1.includeEvidence,observableScanDepth:e$1.observableScanDepth,now:e$1.now});return {impact:{schemaVersion:e,generatedAt:(e$1.now??new Date).toISOString(),fromRef:"baseline",diffRef:".rapidkit/reports/workspace-model-diff-last-run.json",workspace:{name:n$1.workspace.name,profile:n$1.workspace.profile,type:n$1.workspace.type},summary:{changed:false,risk:"none",affectedProjects:0,workspaceItems:0,recommendedCommands:0,blastRadius:{directlyAffected:0,transitivelyAffected:0,maxDistance:0,graphEdges:n$1.graph?.edges.length??0}},affectedProjects:[],transitiveImpact:[],criticalPathHotspots:[],workspaceImpact:[],verificationPlan:[],agentBrief:{headline:"Baseline workspace verify run.",bullets:["No impact report or snapshot was available; baseline gates were evaluated."],unsafeAssumptions:["Do not claim runtime verification passed unless evidence exists."]},diff:{schemaVersion:"workspace-model-diff.v1",generatedAt:(e$1.now??new Date).toISOString(),fromRef:"baseline",toRef:".rapidkit/reports/workspace-model.json",fromHash:"baseline",toHash:"baseline",summary:{changed:false,addedProjects:0,removedProjects:0,changedProjects:0,workspaceChanges:0,validationChanges:0,gitChangedFiles:0},git:{available:false,dirty:false,changedFiles:0,untrackedFiles:0,deletedFiles:0},changes:[],currentModel:n$1}},impactFromDisk:false}}function we(e,t){if(t)return e.generatedAt;let s=e.diff?.generatedAt;if(typeof s=="string"&&s.trim().length>0)return s}async function Ke(e){let t=p.resolve(e.workspacePath),{impact:s,fromImpactRef:r,impactFromDisk:n}=await be(e),i=s.diff.currentModel,d$1=we(s,n),l=oe([...m(),...s.verificationPlan]).filter(k=>ae(e.scope,k)),a$1=[];for(let k of l)a$1.push(await ye(k,t,i.contracts.exists===true,d$1));let g=ve(s,a$1),m$1=a(i.graph??{nodes:[],edges:[]}),c$1=b(i),o=await je(t),u=c(c$1,o?.freshness?.projectHashes),h={verdict:u.verdict,baseline:u.baseline,changed:u.changed,added:u.added,removed:u.removed,projectHashes:d(c$1)},R=b$1(m$1),C=i.policies?.mode??"warn",b$2=await Re(i,t),j=Ce(C,b$2),f=he(a$1,{blockingReasons:[...g.blockingReasons,...R,...j.blockingReasons],needsAttention:g.needsAttention||j.needsAttention}),Q=a$1.filter(k=>k.status==="missing"&&k.evidencePath).map(k=>k.evidencePath),x=[...a$1.filter(k=>k.required&&(k.status==="fail"||k.status==="missing")).map(k=>`${k.id}: ${k.message}`),...g.blockingReasons,...R,...j.blockingReasons],Z=b$2.filter(k=>k.severity==="error").length,ee=i.summary?.projectCount??i.projects.length,$=G({projectCount:ee,verdict:f.verdict,exitCode:f.exitCode,blockingReasons:x,policyErrorCount:Z});f.verdict=$.verdict,f.exitCode=$.exitCode;let B=x.length>0?U({blockingReasons:x,verifyCommand:"npx rapidkit workspace verify --from-impact .rapidkit/reports/workspace-impact-last-run.json --json",verifyArtifact:I}):[];return {schemaVersion:X,generatedAt:(e.now??new Date).toISOString(),workspacePath:t,mode:"evidence",fromImpactRef:r,scope:e.scope,impact:{changed:s.summary.changed,risk:s.summary.risk,affectedProjects:s.summary.affectedProjects,recommendedCommands:s.summary.recommendedCommands},summary:f,steps:a$1,missingEvidence:Q,blockingReasons:x,...B.length>0?{resolutionHints:B}:{},verificationPlan:l,affectedSubgraph:g.subgraph,graphIntegrity:m$1,freshness:h,policyMode:C,policyViolations:b$2}}async function Re(e,t){let s=[];for(let n of e.validation?.issues??[])s.push({source:"model",severity:n.severity,code:n.code,message:n.message,target:n.target});let r=p.join(t,".rapidkit","reports","workspace-contract-verify-last-run.json");try{if(await y.pathExists(r)){let n=await y.readJson(r);if(Array.isArray(n.violations))for(let i of n.violations)typeof i=="string"&&i.trim().length>0&&s.push({source:"contract",severity:"error",code:"contract.violation",message:i});}}catch{}return s.sort((n,i)=>n.source!==i.source?n.source.localeCompare(i.source):n.code!==i.code?n.code.localeCompare(i.code):n.message.localeCompare(i.message))}function Ce(e,t){let s=t.filter(r=>r.severity==="error");return e==="enforce"&&s.length>0?{blockingReasons:s.map(r=>`policy.${r.code}: ${r.message}`),needsAttention:false}:{blockingReasons:[],needsAttention:s.length>0}}async function je(e){let t=p.join(e,I);try{if(!await y.pathExists(t))return null;let s=await y.readJson(t);return s&&s.schemaVersion===X?s:null}catch{return null}}async function Je(e,t){let s=p.join(t,I);return await y.ensureDir(p.dirname(s)),await y.writeJson(s,a$1(e),{spaces:2}),s}function We(e,t){let s=t?.strict?"strict":"default",r=[];if(e.summary.verdict==="blocked")return r.push(...e.blockingReasons),r.length===0&&r.push("verify verdict is blocked."),{passed:false,mode:s,exitCode:2,reasons:r};if(s==="strict"){if(e.summary.verdict!=="ready"&&r.push(`verify verdict is ${e.summary.verdict} (strict requires ready).`),e.freshness.verdict==="stale"){let n=[...e.freshness.changed,...e.freshness.added].slice(0,5);r.push(`freshness is stale${n.length>0?`: ${n.join(", ")}`:""} (strict requires fresh).`);}if(r.length>0)return {passed:false,mode:s,exitCode:1,reasons:r}}return {passed:true,mode:s,exitCode:e.summary.exitCode===2?0:e.summary.exitCode,reasons:r}}function Ue(e,t){let s=We(e,t);return s.passed?e.summary.verdict==="blocked"?2:t?.strict&&e.summary.verdict!=="ready"?1:e.summary.exitCode:s.exitCode}export{K as a,$e as b,X as c,I as d,ve as e,Ke as f,Je as g,We as h,Ue as i};
|
package/dist/chunk-UQR6G7KH.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import {b,c,d}from'./chunk-33LR2QEM.js';import {d as d$1}from'./chunk-TJN7G2MA.js';import {b as b$1,f,a,g as g$1}from'./chunk-GBJBQ43T.js';import {j,h,b as b$2,g}from'./chunk-EN6YCX36.js';import {j as j$1}from'./chunk-3PTJID76.js';import s from'path';import m from'fs-extra';var _=["Scope","Evidence","Diagnosis","Fix Plan","Run","Verify","Assumptions"];var xe="workspace-operational-skill.v1";function ye(e){if(typeof e!="string")return null;let t=e.trim();return !t||t.includes("/")||t.includes("..")?null:t}function ce(e){let t=ye(e.skillId);if(!t)throw new Error(`Invalid skill id: ${e.skillId}`);return {schemaVersion:xe,skillId:t,canonicalPath:f(t),title:e.title,triggers:[...e.triggers].sort((r,i)=>r.localeCompare(i)),requiredReports:[...e.requiredReports].sort((r,i)=>r.localeCompare(i)),scopedProjects:[...e.scopedProjects??[]].sort((r,i)=>r.localeCompare(i)),verificationCommands:[...e.verificationCommands],answerContractSections:[..._],...e.promptStem?{promptStem:e.promptStem}:{},markdown:e.markdown}}var Se="workspace-skills-index.v1";function pe(e){let t=[...e.skills].sort((i,o)=>i.skillId.localeCompare(o.skillId)),r=e.inputsHash??b$2({skillIds:t.map(i=>i.skillId),paths:t.map(i=>i.canonicalPath)});return {schemaVersion:Se,generatedAt:e.generatedAt,inputsHash:r,skills:t.map(i=>({skillId:i.skillId,path:i.canonicalPath,schemaVersion:i.schemaVersion,title:i.title}))}}var de=[".rapidkit/reports/INDEX.json",b,d$1],je=[{skillId:"rapidkit-diagnose-api-failure",title:"Diagnose API failure",triggers:["api failure","500 error","integration test failed","service unreachable"],objective:"Investigate a failing API or service using RapidKit evidence before editing application code.",steps:["Read `.rapidkit/reports/INDEX.json` and identify fail/warn reports for the scoped project.","Read `.rapidkit/reports/doctor-last-run.json` and project-scoped run evidence if present.","Map the failure to workspace vs project scope; cite exit codes and blocker messages.","Propose the smallest safe fix (config, env, dependency) with explicit verification commands."]},{skillId:"rapidkit-release-readiness",title:"Release readiness",triggers:["release","ship","production","readiness gate"],objective:"Assess whether this workspace is release-ready using governed RapidKit gates.",steps:["Read `.rapidkit/reports/release-readiness-last-run.json` and `pipeline-last-run.json`.","Read `.rapidkit/reports/workspace-verify-last-run.json` for verdict and blocking reasons.","List blocking gates first; never claim ready without cited report fields.","Provide one safe next command and a verification checklist."]},{skillId:"rapidkit-safe-schema-migration",title:"Safe schema migration",triggers:["migration","schema change","database migration","db migrate"],objective:"Plan and verify a schema migration with blast-radius awareness.",steps:["Identify affected projects from workspace model and dependency graph.","Run or review impact/verify evidence for transitive dependents.","Require project-scoped test/build commands before promoting the migration.","Document rollback and verification signals."]},{skillId:"rapidkit-dependency-upgrade",title:"Dependency upgrade",triggers:["upgrade dependency","bump package","security advisory","outdated deps"],objective:"Upgrade dependencies with graph-aware verification.",steps:["Scope the upgrade to the owning project from workspace model.","Check transitive dependents via workspace graph / impact reports.","Prefer workspace run test/build for affected projects.","Re-run `workspace verify` after evidence refresh."]},{skillId:"rapidkit-rename-contract",title:"Rename contract safely",triggers:["rename contract","rename event","breaking api","contract change"],objective:"Rename or change a shared contract with consumer awareness.",steps:["Read `.rapidkit/workspace.contract.json` for publishes/consumes/owns edges.","List all consumer projects before proposing renames.","Update contract file and regenerate workspace model.","Verify contract gate and integration tests for consumers."]}];function D(e){return `npx rapidkit ${e}`.trim()}function ve(e){let t=[`# ${e.template.title}`,"",`> Workspace: **${e.workspaceName}** \xB7 Skill: \`${e.template.skillId}\``,"","## Objective","",e.template.objective,"","## Triggers","",...e.template.triggers.map(r=>`- ${r}`),"","## Required evidence (read first)","",...de.map(r=>`- \`${r}\``),"","## Procedure","",...e.template.steps.map((r,i)=>`${i+1}. ${r}`),""];if(e.scopedProjects.length>0&&t.push("## Scoped projects","",...e.scopedProjects.map(r=>`- ${r}`),""),e.contractSummary&&t.push("## Contract context","",e.contractSummary,""),e.verificationCommands.length>0){t.push("## Verification commands (this workspace)","");for(let r of e.verificationCommands)t.push(`- \`${r}\``);t.push("");}return t.push("## Answer contract","","Return: Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.","","## Refresh stale evidence","","```bash",D("workspace agent-sync --write --refresh-context"),"```",""),t.join(`
|
|
2
|
-
`)}function Ce(e){return e?.safeCommands?.length?e.safeCommands.slice(0,8).map(t=>t.display):[D("workspace verify --json"),D("doctor workspace --json")]}function Pe(e){return e?.projects?.length?e.projects.slice(0,12).map(r=>{let i=r.contracts.owns.join(", ")||"none",o=r.contracts.publishes.join(", ")||"none",p=r.contracts.consumes.join(", ")||"none";return `- **${r.slug}**: owns \`${i}\`; publishes \`${o}\`; consumes \`${p}\``}).join(`
|
|
3
|
-
`):void 0}function le(e){let t=e.model.workspace.name,r=e.model.projects.map(p=>p.name).sort(),i=Ce(e.context??null),o=Pe(e.contract??null);return je.map(p=>{let c=ve({template:p,workspaceName:t,scopedProjects:r,verificationCommands:i,contractSummary:o});return ce({skillId:p.skillId,title:p.title,triggers:p.triggers,requiredReports:[...de],scopedProjects:r,verificationCommands:i,promptStem:g$1[p.skillId],markdown:c})})}async function ue(e){let t=s.resolve(e.workspacePath),r=[],i=b$2({skills:e.skills.map(p=>({id:p.skillId,path:p.canonicalPath,hash:b$2({markdown:p.markdown})}))}),o=pe({generatedAt:e.generatedAt,skills:e.skills,inputsHash:i});if(e.write){for(let c of e.skills){let n=s.join(t,c.canonicalPath);await m.ensureDir(s.dirname(n)),await m.writeFile(n,c.markdown,"utf8"),r.push(c.canonicalPath);}let p=s.join(t,b$1);await m.ensureDir(s.dirname(p)),await m.writeJson(p,o,{spaces:2}),r.push(b$1);}return {skills:e.skills,index:o,writtenPaths:r}}function ge(e){return ["## Operational skills (canonical)","","Read workspace-native playbooks from `.rapidkit/skills/` before generic repo scans:","",...e.skills.map(r=>`- \`${r.path}\` \u2014 ${r.title} (\`${r.skillId}\`)`),"","Regenerate:","","```bash",D("workspace agent-sync --write --refresh-context"),"```",""].join(`
|
|
4
|
-
`)}var Ee={"rapidkit-diagnose-api-failure":".github/prompts/rapidkit-diagnose.prompt.md","rapidkit-release-readiness":".github/prompts/rapidkit-release-readiness.prompt.md"},X="## Workspace verification (hydrated)";function Ie(e){let t=[X,"","Verification commands for this workspace:","",...e.verificationCommands.length?e.verificationCommands.map(r=>`- \`${r}\``):["- `npx rapidkit workspace verify --json`"]];return e.scopedProjects.length>0&&t.push("","Scoped projects:","",...e.scopedProjects.map(r=>`- ${r}`)),t.push(""),t.join(`
|
|
5
|
-
`)}async function me(e){let t=s.resolve(e.workspacePath),r=[];for(let i of e.skills){let o=Ee[i.skillId];if(!o)continue;let p=s.join(t,o);if(!await m.pathExists(p))continue;let c=await m.readFile(p,"utf8"),n=Ie(i),g=c.includes(X)?c.replace(new RegExp(`${X}[\\s\\S]*$`),n.trimEnd()):`${c.trimEnd()}
|
|
6
|
-
|
|
7
|
-
${n}`;e.write&&await m.writeFile(p,`${g.trimEnd()}
|
|
8
|
-
`,"utf8"),r.push(o);}return r}var Oe="rapidkit-agent-customization-pack.v1";function ke(){return {schemaVersion:Oe,presets:{minimal:{meaning:"Generate the portable grounding index, AGENTS.md, and provider-specific lightweight instructions.",requiredOutputs:[".rapidkit/reports/INDEX.json",".rapidkit/reports/agent-customization-pack.json","AGENTS.md"]},enterprise:{meaning:"Generate the full VS Code-native pack: instructions, prompts, skills, custom agents, and validation metadata.",requiredOutputs:[".rapidkit/reports/INDEX.json",".rapidkit/reports/agent-customization-pack.json","AGENTS.md",".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",".rapidkit/reports/rapidkit-mcp-design.json",b$1]}},targets:{all:{meaning:"Generate every supported customization surface.",outputFamilies:["portable","vscode","copilot","cursor","claude"]},vscode:{meaning:"Generate VS Code-native customizations for Copilot Chat and agent workflows.",outputFamilies:["instructions","prompts","skills","agents","hooks"]},agents:{meaning:"Generate portable AGENTS.md grounding for any agent.",outputFamilies:["portable"]},copilot:{meaning:"Generate GitHub Copilot instructions, prompts, and skills.",outputFamilies:["instructions","prompts","skills"]},cursor:{meaning:"Generate Cursor rules.",outputFamilies:["rules"]},claude:{meaning:"Generate Claude Code grounding files.",outputFamilies:["rules","portable"]},codex:{meaning:"Use AGENTS.md and the report index as the Codex grounding layer.",outputFamilies:["portable"]},orca:{meaning:"Use AGENTS.md and the report index as the Orca/Grok grounding layer.",outputFamilies:["portable"]}},standardAnswerContract:[..._],requiredReports:O.map(e=>({path:e.relativePath,label:e.label,required:e.required})),strictRules:["Required reports must exist.","Generated report paths must stay inside the workspace root.","Generated customization text must be English-only.","Agent answers must not claim pass, ready, or healthy without cited evidence.","Commands must distinguish display guidance from execution requests.","Agent hook files must be advisory and disabled by default unless the user explicitly enables them.","MCP design artifacts must stay read-mostly until write tools have explicit approval boundaries."],outputKinds:["report","grounding","instruction","prompt","skill","skill-resource","operational-skill","skills-index","explain-report","agent","rule","hook","mcp-design"],pathLayers:{l1CanonicalRoots:[".rapidkit/reports/",`${a}/`],l2PrefixedMirrorRoots:[".github/",".cursor/",".claude/"],l3SharedIndustryFiles:["AGENTS.md",".github/copilot-instructions.md","CLAUDE.md"]}}}var Te="rapidkit-agent-reports-index.v1",We="rapidkit-agent-customization-pack.v1",B=".rapidkit/reports/INDEX.json",fe=".rapidkit/AGENT-GROUNDING.md",G=".rapidkit/reports/agent-customization-pack.json",O=[{relativePath:b,label:"Agent context pack",required:true},{relativePath:b$1,label:"Operational skills index",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},{relativePath:".rapidkit/reports/workspace-model-snapshot.json",label:"Workspace model snapshot",required:false},{relativePath:".rapidkit/reports/workspace-model-diff-last-run.json",label:"Workspace model diff",required:false},{relativePath:".rapidkit/reports/workspace-explain-last-run.json",label:"Workspace explain",required:false},{relativePath:".rapidkit/reports/workspace-contract-verify-last-run.json",label:"Workspace contract verify",required:false},{relativePath:".rapidkit/reports/workspace-intelligence-history.json",label:"Workspace intelligence history",required:false}];function k(e){return `npx rapidkit ${e}`.trim()}function we(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 Ne(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 i=we(e.summary);return i&&Array.isArray(i.blockingReasons)?J(i.blockingReasons,12):[]}function _e(e){for(let t of ["generatedAt","timestamp"]){let r=e[t];if(typeof r=="string"&&r.trim())return r.trim()}}function De(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 Ge(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 A(e,t){return e.has("all")||e.has(t)}function Ke(e){return A(e,"copilot")||A(e,"vscode")}function Le(e){return e??"enterprise"}function Me(e){return e===b$1?"skills-index":e.includes("workspace-explain-last-run.json")?"explain-report":e.startsWith(".rapidkit/skills/")&&e.endsWith(".md")?"operational-skill":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 qe(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 $e(e,t){return ke().presets[t].requiredOutputs.includes(e)}function He(e){return e.schemaVersion===g&&typeof e.generatedAt=="string"&&e.summary!=null&&typeof e.summary=="object"&&!Array.isArray(e.summary)&&Array.isArray(e.projects)}async function Ve(e,t){if(t)return t;let r=s.join(e,h);if(await m.pathExists(r))try{let i=await m.readJson(r);if(He(i))return i}catch{}return j({workspacePath:e,includeEvidence:true})}function ze(e){return e.length>0&&!s.isAbsolute(e)&&!e.split(/[\\/]+/).includes("..")}function Fe(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 Ue(e){try{if(!await m.pathExists(e))return null;let t=await m.readJson(e);return we(t)}catch{return null}}async function Xe(e){let t=e.now??new Date,r=e.staleAfterHours??24,i=[],o=[];for(let c of O){let n=s.join(e.workspacePath,c.relativePath),g=await Ue(n),j=g!==null;j&&g&&o.push(...Ne(g)),i.push({path:c.relativePath,label:c.label,required:c.required,exists:j,generatedAt:g?_e(g):void 0,commandId:typeof g?.commandId=="string"?g.commandId:void 0,exitCode:typeof g?.exitCode=="number"?g.exitCode:void 0});}let p=[...new Set(o.map(c=>c.trim()).filter(Boolean))].slice(0,16);return {schemaVersion:Te,generatedAt:t.toISOString(),workspaceRoot:e.workspacePath,readOrder:O.map(c=>c.relativePath),blockers:p,staleAfterHours:r,reports:i,refreshCommand:k("workspace agent-sync --write --refresh-context")}}function he(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(`
|
|
9
|
-
`)}function Be(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(`
|
|
10
|
-
`)}function Je(){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(`
|
|
11
|
-
`)}function Ze(){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(`
|
|
12
|
-
`)}function Ye(){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(`
|
|
13
|
-
`)}function Qe(){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(`
|
|
14
|
-
`)}function et(){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(`
|
|
15
|
-
`)}function tt(){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(`
|
|
16
|
-
`)}function rt(){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(`
|
|
17
|
-
`)}function K(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(`
|
|
18
|
-
`)}function S(e){return ["# "+e.title,"",...e.lines,""].join(`
|
|
19
|
-
`)}function it(){return S({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.","- `listOperationalSkills` \u2014 read `.rapidkit/reports/workspace-skills-index.json`.","- `getWorkspaceExplain` \u2014 read/build workspace explain for release-blocked or project scope.","- `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 nt(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:"listOperationalSkills",reads:[".rapidkit/reports/workspace-skills-index.json"],mutates:false},{name:"getWorkspaceExplain",reads:[".rapidkit/reports/workspace-explain-last-run.json",".rapidkit/reports/workspace-verify-last-run.json",".rapidkit/reports/workspace-impact-last-run.json"],mutates:false},{name:"refreshWorkspaceIntelligence",command:k("workspace agent-sync --write --refresh-context"),mutates:true,approvalRequired:true}]},null,2)}
|
|
20
|
-
`}function st(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:[k("doctor workspace"),k("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)}
|
|
21
|
-
`}function ot(e){let t=["---","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 `.rapidkit/reports/workspace-skills-index.json` when operational playbooks are needed.","5. Load the smallest evidence report required for the task.","6. 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.",""];return e?.trim()&&t.push(e.trim(),""),t.join(`
|
|
22
|
-
`)}function L(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(`
|
|
23
|
-
`)}function at(){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(`
|
|
24
|
-
`)}async function u(e,t,r){return r?(await m.ensureDir(s.dirname(e)),await m.writeFile(e,t,"utf8"),"written"):"skipped"}async function Z(e){if(!e.write)return "skipped";let t=await m.pathExists(e.absolutePath)?await m.readFile(e.absolutePath,"utf8"):null,{upsertManagedAgentSection:r}=await import('./managed-agent-markers-AXUM75OE.js'),i=r(t,e.generatedBody),o=e.preamble?`${e.preamble.trimEnd()}
|
|
25
|
-
|
|
26
|
-
${i}`:i;return await m.ensureDir(s.dirname(e.absolutePath)),await m.writeFile(e.absolutePath,o,"utf8"),"written"}function Ht(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 ct(e){let t=[...e.outputs].sort((r,i)=>r.path.localeCompare(i.path));return {schemaVersion:We,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:Fe({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:k(`workspace agent-sync --write --refresh-context --preset ${e.preset}`),experimental:{hooksEnabled:e.experimentalHooks,mcpReady:t.some(r=>r.kind==="mcp-design")}}}async function Vt(e){let t=s.resolve(e.workspacePath),r=new Date,i=e.staleAfterHours??24,o=Ge(e.targets),p=[...o].sort(),c$1=Le(e.preset),n=e.write===true,g=e.strict===true,j$2,v=null,M;e.refreshContext&&(M=await j({workspacePath:t,includeEvidence:true}),v=await c({workspacePath:t,model:M,agent:e.agent??"generic",scope:e.scope,includeEvidence:true}),n&&(j$2=await d(v,t)));let f=await Xe({workspacePath:t,staleAfterHours:i,now:r}),T=f.reports.filter(a=>a.required&&!a.exists).map(a=>a.path),W=f.reports.filter(a=>a.exists&&De(a.generatedAt,i,r)).map(a=>a.path),C=[];g&&(T.length>0&&C.push(`Missing required reports: ${T.join(", ")}`),W.length>0&&C.push(`Stale reports (>${i}h): ${W.join(", ")}`));let q=[],$=[],H=[],d$1=(a,l)=>{a==="written"?q.push(l):$.push(l),H.push({path:l,kind:Me(l),targets:qe(l),required:$e(l,c$1),status:a==="written"?"written":e.dryRun?"planned":"skipped"});};d$1(await u(s.join(t,B),`${JSON.stringify(f,null,2)}
|
|
27
|
-
`,n),B),d$1(await u(s.join(t,fe),`${Be(f)}
|
|
28
|
-
`,n),fe);let Y="",Ae=await Ve(t,M),V=null;try{V=(await j$1({workspacePath:t})).contract;}catch{V=null;}let Re=le({model:Ae,context:v,contract:V}),z=await ue({workspacePath:t,skills:Re,generatedAt:r.toISOString(),write:n});for(let a of z.skills)d$1(n?"written":"skipped",a.canonicalPath);if(d$1(n?"written":"skipped",b$1),Y=ge(z.index),(A(o,"agents")||A(o,"vscode"))&&d$1(await Z({absolutePath:s.join(t,"AGENTS.md"),generatedBody:he({index:f,context:v}),write:n}),"AGENTS.md"),A(o,"claude")){let a=s.join(t,"CLAUDE.md");if(n){let{upsertManagedAgentSection:l}=await import('./managed-agent-markers-AXUM75OE.js'),h=await m.pathExists(a)?await m.readFile(a,"utf8"):"",R=l(h,Ze()),b=R.includes("@AGENTS.md")?R:`@AGENTS.md
|
|
29
|
-
|
|
30
|
-
${R}`;await m.ensureDir(s.dirname(a)),await m.writeFile(a,b,"utf8"),q.push("CLAUDE.md");}else $.push("CLAUDE.md");d$1(await u(s.join(t,".claude/rules/rapidkit-evidence.md"),`${tt()}
|
|
31
|
-
`,n),".claude/rules/rapidkit-evidence.md");}if(A(o,"cursor")&&d$1(await u(s.join(t,".cursor/rules/rapidkit-grounding.mdc"),Ye(),n),".cursor/rules/rapidkit-grounding.mdc"),Ke(o)){if(d$1(await Z({absolutePath:s.join(t,".github/copilot-instructions.md"),generatedBody:Je(),write:n}),".github/copilot-instructions.md"),d$1(await u(s.join(t,".github/instructions/rapidkit-workspace.instructions.md"),et(),n),".github/instructions/rapidkit-workspace.instructions.md"),d$1(await u(s.join(t,".github/instructions/rapidkit-evidence.instructions.md"),Qe(),n),".github/instructions/rapidkit-evidence.instructions.md"),d$1(await u(s.join(t,".github/prompts/rapidkit-diagnose.prompt.md"),rt(),n),".github/prompts/rapidkit-diagnose.prompt.md"),c$1==="enterprise"){let a=[[".github/prompts/rapidkit-repair.prompt.md",K({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",K({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",K({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",K({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[l,h]of a)d$1(await u(s.join(t,l),h,n),l);if(e.hydratePrompts===true)for(let l of await me({workspacePath:t,skills:z.skills,write:n}))d$1(n?"written":"skipped",l);}if(d$1(await u(s.join(t,".github/skills/rapidkit-grounding/SKILL.md"),at(),n),".github/skills/rapidkit-grounding/SKILL.md"),c$1==="enterprise"){d$1(await u(s.join(t,".github/skills/rapidkit-workspace-intelligence/SKILL.md"),ot(Y),n),".github/skills/rapidkit-workspace-intelligence/SKILL.md");let a=[["artifact-map.md",S({title:"Artifact Map",lines:O.map(h=>`- \`${h.relativePath}\` \u2014 ${h.label}`)})],["command-map.md",S({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",S({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",S({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",S({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",it()]];for(let[h,R]of a){let b=`.github/skills/rapidkit-workspace-intelligence/resources/${h}`;d$1(await u(s.join(t,b),R,n),b);}let l=[["workspai-advisor.agent.md",L({name:"Workspai Advisor",description:"Read-only workspace and project guidance using RapidKit evidence",mode:"read-only",tools:["search","read"]})],["workspai-repair.agent.md",L({name:"Workspai Repair",description:"Turn RapidKit blockers into minimal fixes and verification steps",mode:"repair",tools:["search","read","edit"]})],["workspai-release.agent.md",L({name:"Workspai Release",description:"Assess readiness, governance gates, and release safety from evidence",mode:"release",tools:["search","read"]})],["workspai-project-onboarder.agent.md",L({name:"Workspai Project Onboarder",description:"Guide create, import, and adopt flows with RapidKit contracts",mode:"onboard",tools:["search","read","edit"]})]];for(let[h,R]of l){let b=`.github/agents/${h}`;d$1(await u(s.join(t,b),R,n),b);}}}if(c$1==="enterprise"&&d$1(await u(s.join(t,".rapidkit/reports/rapidkit-mcp-design.json"),nt({workspacePath:t,generatedAt:f.generatedAt}),n),".rapidkit/reports/rapidkit-mcp-design.json"),c$1==="enterprise"&&e.experimentalHooks===true&&d$1(await u(s.join(t,".vscode/rapidkit-agent-hooks.json"),st({workspacePath:t,generatedAt:f.generatedAt}),n),".vscode/rapidkit-agent-hooks.json"),(A(o,"codex")||A(o,"orca"))&&(A(o,"agents")||d$1(await Z({absolutePath:s.join(t,"AGENTS.md"),generatedBody:he({index:f,context:v}),write:n}),"AGENTS.md")),g){let a=H.map(l=>l.path).filter(l=>!ze(l));a.length>0&&C.push(`Unsafe generated output paths: ${a.join(", ")}`);}let Q=ct({workspacePath:t,generatedAt:r.toISOString(),preset:c$1,targets:p,index:f,outputs:[...H,{path:G,kind:"report",targets:["agents","vscode","copilot","codex","orca"],required:true,status:n?"written":e.dryRun?"planned":"skipped"}],missingRequired:T,staleReports:W,strictViolations:C,experimentalHooks:e.experimentalHooks===true});return d$1(await u(s.join(t,G),`${JSON.stringify(Q,null,2)}
|
|
32
|
-
`,n),G),{workspacePath:t,indexPath:s.join(t,B),packPath:s.join(t,G),pack:Q,contextPath:j$2,writtenFiles:q,skippedFiles:$,blockers:f.blockers,missingRequired:T,staleReports:W,strictViolations:C}}export{xe as a,Se as b,Te as c,We as d,B as e,fe as f,G as g,O as h,Xe as i,Ht as j,Vt as k,Oe as l};
|
package/dist/chunk-VKLL63TL.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {promises}from'fs';import r from'path';var D=new Set(["node_modules","dist","build","target","coverage","htmlcov",".rapidkit",".venv"]);async function d(e){try{return await promises.access(e),true}catch{return false}}async function P(e){return await d(r.join(e,".rapidkit","context.json"))?true:d(r.join(e,".rapidkit","project.json"))}async function k(e,i){let c=[],o=[r.resolve(e)],a=new Set,l=i?.skipDirs??D,h=i?.includeHiddenDirs===true,f=i?.descendIntoMatchedProjects!==false,p=i?.isProjectDir??P,m=r.resolve(e);for(;o.length>0;){let t=o.shift();if(!t||a.has(t)||(a.add(t),await p(t,m)&&(c.push(t),!f)))continue;let n=[];try{n=await promises.readdir(t,{withFileTypes:true});}catch{continue}for(let s of n)s.isDirectory()&&(!h&&s.name.startsWith(".")||l.has(s.name)||o.push(r.join(t,s.name)));}return c.sort((t,n)=>t.localeCompare(n))}export{k as a};
|
package/dist/chunk-VMJA36WD.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import a from'path';import s from'fs-extra';var c="workspace-intelligence-history.v1",p=".rapidkit/reports/workspace-intelligence-history.json",y=50;function d(t){if(!t||typeof t!="object"||Array.isArray(t))return null;let e=t;return typeof e.generatedAt!="string"?null:e.kind==="agent-action"?typeof e.actionId!="string"||typeof e.summary!="string"||e.outcome!=="ok"&&e.outcome!=="failed"?null:{kind:"agent-action",generatedAt:e.generatedAt,actionId:e.actionId,scope:typeof e.scope=="string"?e.scope:"workspace",summary:e.summary,outcome:e.outcome,...typeof e.evidenceSha256=="string"?{evidenceSha256:e.evidenceSha256}:{}}:typeof e.verdict!="string"||typeof e.risk!="string"||typeof e.gatePassed!="boolean"?null:{kind:"verify",generatedAt:e.generatedAt,verdict:e.verdict,risk:String(e.risk),affectedProjects:typeof e.affectedProjects=="number"?e.affectedProjects:0,freshness:e.freshness??"unknown",gatePassed:e.gatePassed,blockingReasons:typeof e.blockingReasons=="number"?e.blockingReasons:0,policyViolations:typeof e.policyViolations=="number"?e.policyViolations:0}}function A(t,e){return {kind:"verify",generatedAt:t.generatedAt,verdict:t.summary.verdict,risk:t.impact.risk,affectedProjects:t.impact.affectedProjects,freshness:t.freshness.verdict,gatePassed:e,blockingReasons:t.blockingReasons.length,policyViolations:t.policyViolations.length}}function h(t){return {kind:"agent-action",generatedAt:t.generatedAt,actionId:t.actionId,scope:t.scope,summary:t.summary,outcome:t.outcome,...t.evidenceSha256?{evidenceSha256:t.evidenceSha256}:{}}}async function f(t){let e=a.join(t,p);try{if(!await s.pathExists(e))return null;let r=await s.readJson(e);return r?.schemaVersion!==c||!Array.isArray(r.entries)?null:{schemaVersion:c,retention:typeof r.retention=="number"?r.retention:y,entries:r.entries.map(n=>d(n)).filter(n=>n!=null)}}catch{return null}}function l(t,e,r=y){let n=Math.max(1,Math.floor(r)),o=[...t?.entries??[],e],i=o.slice(Math.max(0,o.length-n));return {schemaVersion:c,retention:n,entries:i}}async function H(t,e,r){let n=await f(t),o=l(n,e,r?.retention??y),i=a.join(t,p);return await s.ensureDir(a.dirname(i)),await s.writeJson(i,o,{spaces:2}),o}export{c as a,p as b,y as c,d,A as e,h as f,f as g,l as h,H as i};
|
package/dist/doctor-XM6QDTDC.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as computeDoctorGateExitCode,b as runDoctor}from'./chunk-46AGNYI7.js';
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-ELU3G6DQ.js';import {c}from'./chunk-CKXJR3YT.js';import {b}from'./chunk-46AGNYI7.js';import {b as b$1}from'./chunk-BFEBZABL.js';import {a as a$2}from'./chunk-ITJ6RKUW.js';import {a}from'./chunk-KMUWWZRT.js';import {f,e}from'./chunk-PCXSTKZ5.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-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 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-2HRPM5ZD.js'),n=await e({workspacePath:a$3,write:true,refreshContext:true,strict:false});d.agentGrounding={indexPath:n.indexPath,writtenFiles:n.writtenFiles,blockers:n.blockers};}catch{}return d}async function X(t){let s;try{s=await G(t);}catch(a){let r=a instanceof Error?a.message:String(a);t.json?console.log(JSON.stringify({schemaVersion:"rapidkit-pipeline-error-v1",ok:false,error:{message:r}},null,2)):console.log(c$1.red(`Pipeline failed: ${r}`)),process.exit(1);}if(t.json)console.log(JSON.stringify(s,null,2));else {console.log(c$1.bold.cyan(`
|
|
2
|
-
\u{1F517} RapidKit Governance Pipeline
|
|
3
|
-
`)),console.log(c$1.bold(`Workspace: ${c$1.cyan(u.basename(s.workspacePath))}`)),console.log(c$1.gray(`Path: ${s.workspacePath}`)),console.log(c$1.white(`Verdict: ${s.summary.verdict} Exit: ${s.summary.exitCode} (${s.summary.stagesPassed} pass / ${s.summary.stagesWarn} warn / ${s.summary.stagesFailed} fail)`));for(let a of s.stages){let r=a.status==="pass"?c$1.green("PASS"):a.status==="warn"?c$1.yellow("WARN"):a.status==="skipped"?c$1.gray("SKIP"):c$1.red("FAIL");console.log(` - ${a.name}: ${r} ${a.summary}`);}if(s.blockingReasons.length>0){console.log(c$1.bold(`
|
|
4
|
-
Blocking reasons:`));for(let a of s.blockingReasons.slice(0,8))console.log(c$1.gray(` \u2022 ${a}`));}console.log(c$1.gray(`
|
|
5
|
-
Evidence: ${s.artifacts.reportPath}`)),s.agentGrounding?.writtenFiles.length&&console.log(c$1.gray(`Agent grounding: ${s.agentGrounding.writtenFiles.length} file(s) synced (INDEX + AGENTS.md + Copilot/Cursor/Claude hooks)`));}s.summary.exitCode!==0&&process.exit(s.summary.exitCode);}export{G as runPipeline,X as runPipelineCommand};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{b as buildWorkspaceExplain,a as resolveWorkspaceExplainArtifactPath,c as writeWorkspaceExplainReport}from'./chunk-CDPR2YKL.js';export{d as WORKSPACE_MODEL_DIFF_REPORT_PATH}from'./chunk-LKX3L7TE.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 +0,0 @@
|
|
|
1
|
-
export{c as DEFAULT_HISTORY_RETENTION,b as WORKSPACE_HISTORY_PATH,a as WORKSPACE_HISTORY_SCHEMA_VERSION,h as appendHistoryEntry,f as historyEntryFromAgentAction,e as historyEntryFromVerify,d as normalizeHistoryEntry,g as readWorkspaceHistory,i as recordWorkspaceHistory}from'./chunk-VMJA36WD.js';
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import {b}from'./chunk-CDPR2YKL.js';import {b as b$2}from'./chunk-33LR2QEM.js';import {d}from'./chunk-TJN7G2MA.js';import {c,e}from'./chunk-AQ4XZZC6.js';import {c as c$1,b as b$3}from'./chunk-GBJBQ43T.js';import {h as h$1}from'./chunk-EN6YCX36.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,h$1);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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{h as WORKSPACE_MODEL_REPORT_PATH,g as WORKSPACE_MODEL_SCHEMA_VERSION,j as buildWorkspaceModel,k as buildWorkspaceModelCached,l as buildWorkspaceModelIncremental,i as validateWorkspaceModelStrict,m as writeWorkspaceModel}from'./chunk-EN6YCX36.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as runWorkspaceStage}from'./chunk-JW2FSKT3.js';export{a as WORKSPACE_RUN_LAST_REPORT_FILENAME}from'./chunk-64RTZBHU.js';
|