rapidkit 0.41.2 → 0.41.4
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 +61 -52
- package/contracts/agent-customization-pack.v1.json +20 -0
- package/contracts/artifact-remediation-plan.v1.json +163 -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 +6 -2
- package/contracts/runtime-command-surface.v1.json +2 -0
- 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/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/artifact-remediation-plan-HRR3WH7T.js +3 -0
- package/dist/autopilot-release-MSK4ELKR.js +1 -0
- package/dist/chunk-2E6WGUN6.js +1 -0
- package/dist/{chunk-RSYUNEH7.js → chunk-42ARJBM7.js} +1 -1
- package/dist/{chunk-WCICO7ZB.js → chunk-4RJESJ23.js} +1 -1
- package/dist/chunk-56GL3GG7.js +32 -0
- package/dist/chunk-7BEZH5LE.js +2 -0
- package/dist/{chunk-ZPXMZCYG.js → chunk-ALCH4JAS.js} +1 -1
- package/dist/{chunk-ITJ6RKUW.js → chunk-AM5OJWXF.js} +1 -1
- package/dist/chunk-COBMOVUK.js +1 -0
- package/dist/{chunk-ELU3G6DQ.js → chunk-DKNVDNT4.js} +1 -1
- package/dist/{chunk-KIUSCFHF.js → chunk-FI4VMG2I.js} +1 -1
- package/dist/chunk-HT3G7HOV.js +78 -0
- package/dist/{chunk-BFEBZABL.js → chunk-KZLRUBQ5.js} +19 -19
- package/dist/chunk-L3R2AS2W.js +1 -0
- package/dist/chunk-LRF6PQOZ.js +1 -0
- package/dist/chunk-T5GS4BUP.js +2 -0
- package/dist/chunk-TDSIF42O.js +1 -0
- package/dist/chunk-THSTNVE3.js +2 -0
- package/dist/chunk-ULIVVMT6.js +1 -0
- package/dist/chunk-WHQWVQJH.js +4 -0
- package/dist/{create-RNP5ACQL.js → create-XTKHAYH7.js} +1 -1
- package/dist/doctor-4UQZIELO.js +1 -0
- package/dist/index.d.ts +15 -3
- package/dist/index.js +165 -140
- package/dist/pipeline-UOGPOG7S.js +5 -0
- package/dist/{workspace-E554C5SM.js → workspace-VKUBU4M4.js} +1 -1
- package/dist/{workspace-agent-sync-BHE2V4KS.js → workspace-agent-sync-RWDOTSWV.js} +1 -1
- package/dist/{workspace-context-VJTXW3K4.js → workspace-context-R3XWWLFP.js} +1 -1
- package/dist/workspace-explain-JIAM63TE.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-EC63CRVF.js → workspace-intelligence-5BBKUJAG.js} +1 -1
- package/dist/{workspace-marker-IOPQ42A7.js → workspace-marker-HAC7BMEG.js} +1 -1
- package/dist/workspace-mcp-serve-GPSSYKZK.js +3 -0
- package/dist/workspace-model-YAC5BKLL.js +1 -0
- package/dist/workspace-run-MNVPNDUK.js +1 -0
- package/dist/{workspace-verify-IAUHP6Y6.js → workspace-verify-YDPCHWGQ.js} +1 -1
- package/dist/{workspace-watch-H2AETGFI.js → workspace-watch-P2PGSYDD.js} +1 -1
- package/docs/commands-reference.md +1 -0
- package/docs/contracts/ARTIFACT_CATALOG.md +70 -20
- package/docs/contracts/NAMING_AND_COEXISTENCE.md +3 -2
- package/docs/contracts/README.md +2 -0
- package/docs/doctor-command.md +217 -13
- package/package.json +1 -1
- package/scripts/enterprise-package-smoke.mjs +35 -36
- package/dist/analyze-QYHMGLSG.js +0 -1
- package/dist/autopilot-release-YDEUKRW6.js +0 -1
- package/dist/chunk-33LR2QEM.js +0 -2
- package/dist/chunk-46AGNYI7.js +0 -50
- package/dist/chunk-DWXRVGOY.js +0 -2
- package/dist/chunk-EN6YCX36.js +0 -1
- package/dist/chunk-HYAT2EG7.js +0 -1
- package/dist/chunk-JNXT6KJV.js +0 -32
- package/dist/chunk-RV6HBTFC.js +0 -2
- package/dist/chunk-VDTAPIHB.js +0 -2
- package/dist/chunk-VKLL63TL.js +0 -1
- package/dist/chunk-VMJA36WD.js +0 -1
- package/dist/doctor-XM6QDTDC.js +0 -1
- package/dist/pipeline-YD2DO7XY.js +0 -5
- package/dist/workspace-explain-XJ22ZXJY.js +0 -1
- package/dist/workspace-history-VPDADQKG.js +0 -1
- package/dist/workspace-mcp-serve-KOM2V35Q.js +0 -3
- package/dist/workspace-model-YL7W3573.js +0 -1
- package/dist/workspace-run-F5FADRY5.js +0 -1
package/dist/chunk-JNXT6KJV.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import {b,c,d}from'./chunk-33LR2QEM.js';import {d as d$1}from'./chunk-HYAT2EG7.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-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-VDTAPIHB.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {d,a,b,e}from'./chunk-64RTZBHU.js';import {n,q,g}from'./chunk-YBS2HGO3.js';import {h,i,f,e as e$1}from'./chunk-UZW5QFRW.js';import {d as d$1}from'./chunk-S5KTATOU.js';import {a as a$1}from'./chunk-VKLL63TL.js';import {e as e$2,g as g$1}from'./chunk-WRMCPKGA.js';import _ from'fs';import w from'path';import S from'chalk';import {execa}from'execa';function be(e){return _.existsSync(w.join(e,"bun.lock"))||_.existsSync(w.join(e,"bunfig.toml"))?"bun":_.existsSync(w.join(e,"pnpm-lock.yaml"))?"pnpm":_.existsSync(w.join(e,"yarn.lock"))?"yarn":(_.existsSync(w.join(e,"package-lock.json")),"npm")}function xe(e,r,t=be(e)){return t==="npm"?`npm run ${r}`:`${t} run ${r}`}function Re(e,r=be(e)){return `${r} install`}var Me={"python-fastapi":{runtime:"python",framework:"FastAPI",markers:["pyproject.toml","fastapi"],commands:{init:"python -m pip install -e .",test:"pytest",build:"python -m build",start:"uvicorn main:app --reload"},errorPatterns:{setup:["ModuleNotFoundError","No module named","pip: command not found"],"test-failure":["FAILED","ERROR","test session started"],dependency:["ImportError","missing.*dependency"],runtime:["TypeError","AttributeError","ValueError"],timeout:["timeout","Timeout","timed out"],unknown:[]},healthCheck:{stage:"start",type:"http",value:"http://localhost:8000/docs"},validation:{command:"python -m pip list | grep fastapi",error:"FastAPI not installed"}},"python-django":{runtime:"python",framework:"Django",markers:["manage.py","django"],commands:{init:"python manage.py migrate",test:"python manage.py test",build:"python manage.py collectstatic --noinput",start:"python manage.py runserver 0.0.0.0:8000"},errorPatterns:{setup:["ModuleNotFoundError","ProgrammingError.*migrate"],"test-failure":["FAILED","ERROR","Ran.*test"],dependency:["ImportError","missing.*dependency"],runtime:["DatabaseError","ImproperlyConfigured"],timeout:["timeout","Timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:8e3},dependencies:["init"]},"node-nestjs":{runtime:"node",framework:"NestJS",markers:["package.json","@nestjs/core"],commands:{init:"npm install",test:"npm run test",build:"npm run build",start:"npm run start"},errorPatterns:{setup:["npm ERR!","ENOENT","not found"],"test-failure":["Tests.*failed","FAIL","fail.*test"],dependency:["Cannot find module","ERR_MODULE_NOT_FOUND"],runtime:["TypeError","Error: ","ReferenceError"],timeout:["timeout","TIMEOUT"],unknown:[]},healthCheck:{stage:"start",type:"port",value:3e3}},"node-express":{runtime:"node",framework:"Express",markers:["package.json","express"],commands:{init:"npm install",test:"npm run test",build:"npm run build",start:"npm start"},errorPatterns:{setup:["npm ERR!","ENOENT"],"test-failure":["failed","FAIL"],dependency:["Cannot find module"],runtime:["Error","TypeError"],timeout:["timeout"],unknown:[]}},"go-fiber":{runtime:"go",framework:"Fiber",markers:["go.mod","fiber"],commands:{init:"go mod download && go mod tidy",test:"go test ./...",build:"go build -o app .",start:"./app"},errorPatterns:{setup:["go: .*not found","cannot find","go mod tidy"],"test-failure":["FAIL","--- FAIL"],dependency:["missing.*module"],runtime:["panic","fatal","Error"],timeout:["timeout","context deadline"],unknown:[]},dependencies:["init"]},"go-gin":{runtime:"go",framework:"Gin",markers:["go.mod","gin-gonic"],commands:{init:"go mod download && go mod tidy",test:"go test ./...",build:"go build -o app .",start:"./app"},errorPatterns:{setup:["go: .*not found"],"test-failure":["FAIL"],dependency:["missing.*module"],runtime:["panic"],timeout:["timeout"],unknown:[]}},"java-springboot":{runtime:"java",framework:"Spring Boot",markers:["pom.xml","build.gradle","spring-boot"],commands:{init:"mvn dependency:go-offline",test:"mvn test",build:"mvn package -DskipTests",start:"mvn spring-boot:run"},errorPatterns:{setup:["\\[ERROR\\]","BUILD FAILURE","missing dependencies"],"test-failure":["\\[ERROR\\] Tests run:","BUILD FAILURE"],dependency:["missing.*dependency"],runtime:["Exception","Error","NullPointerException"],timeout:["timeout","Timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:8080}},"php-laravel":{runtime:"php",framework:"Laravel",markers:["composer.json","artisan","app/Models"],commands:{init:"composer install && php artisan migrate:fresh --seed",test:"php artisan test",build:"php artisan config:cache && php artisan route:cache && php artisan view:cache",start:"php artisan serve --host=0.0.0.0 --port=8000"},errorPatterns:{setup:["Composer.*lock","Fatal error","Class.*not found"],"test-failure":["FAILED","Tests.*failed"],dependency:["Class.*not found","require.*failed"],runtime:["Fatal error","Exception","Error"],timeout:["timeout","Timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:8e3},dependencies:["init"]},"php-symfony":{runtime:"php",framework:"Symfony",markers:["composer.json","symfony.lock","bin/console"],commands:{init:"composer install && php bin/console doctrine:database:create",test:"php bin/phpunit",build:"php bin/console cache:clear --env=prod",start:"symfony serve --no-tls"},errorPatterns:{setup:["Composer.*error","Fatal error"],"test-failure":["FAILED","failure"],dependency:["Class.*not found"],runtime:["Fatal error","Exception"],timeout:["timeout"],unknown:[]},dependencies:["init"]},"rust-actix":{runtime:"rust",framework:"Actix-web",markers:["Cargo.toml","actix"],commands:{init:"cargo fetch",test:"cargo test",build:"cargo build --release",start:"cargo run --release"},errorPatterns:{setup:["error: .*could not find","failed.*download"],"test-failure":["test result:","FAILED"],dependency:["can.t find.*crate"],runtime:["error\\[E","thread.*panicked"],timeout:["timeout"],unknown:[]},validation:{command:"cargo --version",error:"Rust/Cargo not installed"}},"rust-axum":{runtime:"rust",framework:"Axum",markers:["Cargo.toml","axum"],commands:{init:"cargo fetch",test:"cargo test",build:"cargo build --release",start:"cargo run --release"},errorPatterns:{setup:["error: .*could not find"],"test-failure":["test result:","FAILED"],dependency:["can.t find.*crate"],runtime:["error\\[E"],timeout:["timeout"],unknown:[]}},"rust-rocket":{runtime:"rust",framework:"Rocket",markers:["Cargo.toml","rocket"],commands:{init:"cargo fetch",test:"cargo test",build:"cargo build --release",start:"cargo run --release"},errorPatterns:{setup:["error: .*could not find"],"test-failure":["FAILED"],dependency:["can.t find"],runtime:["error\\[E"],timeout:["timeout"],unknown:[]}},"dotnet-aspnetcore":{runtime:"dotnet",framework:"ASP.NET Core",markers:[".csproj",".sln","Program.cs"],commands:{init:"dotnet restore",test:"dotnet test",build:"dotnet build -c Release",start:"dotnet run"},errorPatterns:{setup:["error CS","CSPROJ.*not found","NuGet.*restore"],"test-failure":["Failed:.*test","FAILED"],dependency:["error NU1101"],runtime:["error CS","Exception"],timeout:["timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:5e3}},"elixir-phoenix":{runtime:"elixir",framework:"Phoenix",markers:["mix.exs","phoenix"],commands:{init:"mix setup",test:"mix test",build:"mix compile --all-warnings",start:"mix phx.server"},errorPatterns:{setup:["\\*\\* \\(.*Error\\)","Mix.InstallError"],"test-failure":["\\d+\\sfailed","FAILED"],dependency:["dependencies are not available"],runtime:["\\*\\* \\(","RuntimeError"],timeout:["timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:4e3},dependencies:["init"]},"ruby-rails":{runtime:"ruby",framework:"Rails",markers:["Gemfile","config/application.rb","bin/rails"],commands:{init:"bundle install && rails db:prepare",test:"rails test",build:"rails assets:precompile",start:"rails server --binding=0.0.0.0 --port=3000"},errorPatterns:{setup:["Bundler::.*Error","Gem::.*Error"],"test-failure":["failures,","error,","FAILED"],dependency:["Could not find.*gem"],runtime:["Error","Exception","NoMethodError"],timeout:["timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:3e3},dependencies:["init"]},"ruby-sinatra":{runtime:"ruby",framework:"Sinatra",markers:["Gemfile","app.rb","sinatra"],commands:{init:"bundle install",test:"rspec",build:`echo "Sinatra apps don't require build"`,start:"ruby app.rb"},errorPatterns:{setup:["Bundler.*Error","Gem.*Error"],"test-failure":["failure","FAILED"],dependency:["Could not find.*gem"],runtime:["Error","NoMethodError"],timeout:["timeout"],unknown:[]}}},Oe={init:{python:["pip install -e .","poetry install","pip install -r requirements.txt"],node:["npm install","pnpm install","yarn install"],go:["go mod download && go mod tidy","go get ./..."],java:["mvn dependency:go-offline","gradle dependencies"],php:["composer install"],rust:["cargo fetch"],dotnet:["dotnet restore"],elixir:["mix deps.get"],ruby:["bundle install"],"jvm-generic":["mvn dependency:go-offline","gradle dependencies"],unknown:[]},test:{python:["pytest","python -m unittest","python -m pytest"],node:["npm test","npm run test"],go:["go test ./...","make test"],java:["mvn test","gradle test"],php:["php artisan test","phpunit","pest"],rust:["cargo test"],dotnet:["dotnet test"],elixir:["mix test"],ruby:["rspec","ruby -m minitest"],"jvm-generic":["mvn test","gradle test"],unknown:[]},build:{python:["python -m build","python setup.py build"],node:["npm run build"],go:["go build -o app .","go build ./..."],java:["mvn package -DskipTests","gradle build -x test"],php:['echo "PHP build: typically no build step"'],rust:["cargo build --release"],dotnet:["dotnet build -c Release"],elixir:["mix compile"],ruby:["gem build *.gemspec"],"jvm-generic":["mvn package -DskipTests","gradle build"],unknown:[]},start:{python:["python app.py","python main.py","uvicorn main:app --reload"],node:["npm start","node index.js","node src/index.js"],go:["./app","go run main.go","go run ./..."],java:["mvn spring-boot:run","gradle bootRun","java -jar target/*.jar"],php:["php -S 0.0.0.0:8000","php artisan serve"],rust:["cargo run --release","./target/release/app"],dotnet:["dotnet run"],elixir:["mix phx.server","iex -S mix"],ruby:["rails server","ruby app.rb","bundle exec puma"],"jvm-generic":["java -jar *.jar","gradle run"],unknown:[]}};function ee(e,r){if(r){let t=r.trim().toLowerCase().replace(/[_.\s]+/g,"-"),n=e$1(r),s=`${e}-${n==="gofiber"?"fiber":n==="gogin"?"gin":n==="dotnet"?"aspnetcore":n!=="unknown"?n:t==="fiber"?"fiber":t==="aspnetcore"||t==="asp-net-core"?"aspnetcore":t}`;return Me[s]}}function ve(e,r,t){if(r){let n=ee(e,r);if(n&&n.commands[t])return n.commands[t]}if(["init","test","build","start"].includes(t)){let n=Oe[t]?.[e]??[];return n.length>0?n[0]:void 0}}var Le={test:"test",build:"build",start:"start"};function te(e){if(e.stage==="init")return e.runtime==="node"?Re(e.projectPath):ve(e.runtime,e.framework,e.stage);if(e.runtime==="node"){let r=Le[e.stage];if(r){let t=g(e.projectPath,r,{framework:e.framework});if(t)return xe(e.projectPath,t.scriptName)}}return ve(e.runtime,e.framework,e.stage)}function _e(e){let r=h(e).map(t=>t==="python"?"python":t==="node"||t==="bun"?"node":t==="go"?"go":t==="java"?"java":t==="php"?"php":t==="rust"?"rust":t==="dotnet"?"dotnet":t==="elixir"?"elixir":t==="ruby"?"ruby":t==="clojure"||t==="scala"||t==="kotlin"?"jvm-generic":null).filter(t=>t!==null).filter((t,n,o)=>o.indexOf(t)===n);return {primary:r.length>0?r[0]:"unknown",secondary:r.slice(1)}}function Se(e){return _e(e).primary}function je(e,r){if(!e)return "unknown";r||(r={setup:["ModuleNotFoundError","npm ERR!","error:","not found"],"test-failure":["FAILED","FAIL","failed"],dependency:["cannot find module","import.*error"],runtime:["Exception","Error:","panic","TypeError"],timeout:["timeout","Timeout","deadline exceeded"],unknown:[]});for(let[t,n]of Object.entries(r))for(let o of n)if(new RegExp(o,"i").test(e))return t;return "unknown"}async function z(e){let r=e.split(/[&|;]\s*/)[0].trim().split(/\s+/)[0];if(["echo","cd","pwd","test","true","false","exit"].includes(r))return {valid:true};try{let n=process.platform==="win32"?"where":"which";if((await execa(n,[r],{reject:false})).exitCode===0)return {valid:true}}catch{}return {valid:false,reason:`Command '${r}' not found or not executable`}}function Ee(e,r,t){if(!r)return e;let n=typeof r=="object"&&!Array.isArray(r)&&("dev"in r||"staging"in r||"prod"in r||"default"in r)&&!Object.keys(r).some(o=>["init","test","build","start"].includes(o))?r:{};return t&&typeof n[t]=="string"?n[t]:typeof n.default=="string"?n.default:e}var Ce={init:"init",test:"test",build:"build",start:"start"};function Ge(e){return e in Ce?Ce[e]:null}function Be(e,r){let n$1=n(e)?.contextJson?.commands;if(!n$1||typeof n$1!="object"||Array.isArray(n$1))return;let o=n$1[r];if(typeof o=="string"&&o.trim().length>0)return o.trim();if(o&&typeof o=="object"&&!Array.isArray(o)){let s=o,c=s.default??s.dev;if(typeof c=="string"&&c.trim().length>0)return c.trim()}}function Pe(e,r,t=q(e)){let n=Ge(r);if(!n)return Be(e,r)?{supported:true}:{supported:false,reason:`Workspace stage "${r}" is not part of the RapidKit fleet contract.`};if(!t.projectRoot)return {supported:false,reason:"No RapidKit project metadata was detected for this target."};let o=t.commandMap[n];return !o||o.status!=="supported"?{supported:false,reason:o?.reason??`Command "${n}" is not supported for this project runtime/framework.`}:{supported:true}}var Ke=new Set(["init","test","build","start"]),Ve=new Set([".git","node_modules",".rapidkit",".venv","dist","build","coverage","htmlcov"]);async function $(e){try{return await _.promises.access(e,_.constants.F_OK),true}catch{return false}}async function ze(e,r,t){if(r==="python"){let o=w.join(e,".rapidkit","cli.py");return await $(o)?{valid:true}:{valid:false,reason:"Project-local .rapidkit/cli.py is missing. Run `rapidkit init` in this project first."}}let n=t.trim().split(/\s+/)[0];if(n&&["npm","npx","pnpm","yarn"].includes(n)){let o=e$2(n);if((await execa(o.command,[...o.prefixArgs,"--version"],{reject:false,env:g$1()})).exitCode===0)return {valid:true}}return z(t)}async function ne(e){let r=await _.promises.readFile(e,"utf-8");return JSON.parse(r)}function C(e){return e.replace(/\\/g,"/")}function He(e){let r=e?.trim();return r?r.startsWith("project:")?r.slice(8).trim()||null:r:null}async function Ue(e){return a$1(e,{skipDirs:Ve,includeHiddenDirs:false,descendIntoMatchedProjects:false,isProjectDir:async(r,t)=>await $(w.join(r,".rapidkit","context.json"))||await $(w.join(r,".rapidkit","project.json"))?true:w.resolve(r)===w.resolve(t)?false:h(r).length>0})}async function Je(e){for(let r of [w.join(".rapidkit","project.json"),w.join(".rapidkit","context.json")]){let t=w.join(e,r);if(await $(t))try{let n=await ne(t),o=n.name??n.projectName??n.slug;if(typeof o=="string"&&o.trim())return o.trim()}catch{}}return null}async function qe(e,r,t){let n=He(t);if(!n)return {projects:r,normalizedScope:null};let o=C(n).toLowerCase(),s=[];for(let c of r){let d=C(w.relative(e,c)),p=w.basename(c),f=await Je(c);[d,p,f].filter(a=>typeof a=="string"&&a.length>0).map(a=>C(a).toLowerCase()).includes(o)&&s.push(c);}if(s.length===0)throw new Error(`Workspace run scope did not match any project: ${t}`);return {projects:s,normalizedScope:n}}async function Ye(e,r,t){let n=await execa("git",["diff","--name-only",`${t}...HEAD`],{cwd:e,reject:false});if(n.exitCode!==0)return new Set(r);let o=n.stdout.split(/\r?\n/).map(c=>c.trim()).filter(c=>c.length>0).map(c=>C(c));if(o.length===0)return new Set;let s=new Set;for(let c of r){let d=C(w.relative(e,c));if(!d||d===".")continue;let p=`${d}/`;o.some(f=>f===d||f.startsWith(p))&&s.add(c);}return s}async function Qe(e,r,t){let n=w.join(e,".rapidkit","workspace.contract.json");if(await $(n))try{let g=await Xe(e,r,t,n);if(g.graphStatus!=="missing")return g}catch{return {expanded:t,graphStatus:"invalid",expansionDepth:0}}let o=w.join(e,".rapidkit","workspace-dependency-graph.json");if(!await $(o))return {expanded:t,graphStatus:"missing",expansionDepth:0};let s;try{s=await ne(o);}catch{return {expanded:t,graphStatus:"invalid",expansionDepth:0}}let c=new Set(r.map(g=>w.resolve(g))),d=new Map;if(!s||typeof s!="object"||Array.isArray(s))return {expanded:t,graphStatus:"invalid",expansionDepth:0};let p=Array.isArray(s.projects)?s.projects:[];for(let g of p){if(!g||typeof g!="object"||Array.isArray(g))continue;let a=g,l=typeof a.path=="string"?a.path:"",y=w.resolve(e,l);if(!c.has(y))continue;let h=Array.isArray(a.dependsOn)?a.dependsOn.filter(R=>typeof R=="string"):[];for(let R of h){let u=w.resolve(e,R);c.has(u)&&(d.has(u)||d.set(u,new Set),d.get(u)?.add(y));}}let f=d$1(d,t);return {expanded:f.reached,graphStatus:"loaded",expansionDepth:f.added}}async function Xe(e,r,t,n){let o=await ne(n);if(!o||typeof o!="object"||Array.isArray(o))return {expanded:t,graphStatus:"invalid",expansionDepth:0};let s=o,c=Array.isArray(s.projects)?s.projects:null;if(!c)return {expanded:t,graphStatus:"invalid",expansionDepth:0};let d=new Map,p=new Map;for(let y of r){let h=C(w.relative(e,y));p.set(h,w.resolve(y));}let f=new Map,g=new Map,a=new Map;for(let y of c){if(!y||typeof y!="object"||Array.isArray(y))continue;let h=y,R=typeof h.slug=="string"?h.slug:"",u=typeof h.relativePath=="string"?C(h.relativePath):R,b=p.get(u);!R||!b||d.set(R,b);}for(let y of c){if(!y||typeof y!="object"||Array.isArray(y))continue;let h=y,R=typeof h.slug=="string"?h.slug:"",u=d.get(R);if(!u)continue;let b=h.contracts&&typeof h.contracts=="object"&&!Array.isArray(h.contracts)?h.contracts:{},v=Array.isArray(b.dependsOn)?b.dependsOn.filter(x=>typeof x=="string"):[],I=Array.isArray(b.publishes)?b.publishes.filter(x=>typeof x=="string"):[],M=Array.isArray(b.consumes)?b.consumes.filter(x=>typeof x=="string"):[];for(let x of v){let P=d.get(x);P&&(a.has(P)||a.set(P,new Set),a.get(P)?.add(u));}for(let x of I)f.has(x)||f.set(x,new Set),f.get(x)?.add(u);for(let x of M)g.has(x)||g.set(x,new Set),g.get(x)?.add(u);}for(let[y,h]of f.entries()){let R=g.get(y);if(R)for(let u of h){a.has(u)||a.set(u,new Set);for(let b of R)b!==u&&a.get(u)?.add(b);}}let l=d$1(a,t);return {expanded:l.reached,graphStatus:"loaded",expansionDepth:l.added}}async function Ze(e,r){if(typeof r=="boolean")return r;let t=w.join(e,".rapidkit","policies.yml");if(!await $(t))return true;let n="";try{n=await _.promises.readFile(t,"utf-8");}catch{return true}let o=n.match(/^[\t ]*rules\.enforce_workspace_run_gates:\s*(true|false)\s*(?:#.*)?$/m);return o?o[1]==="true":true}async function re(e,r){let t=process.argv[1];if(!t)return {exitCode:1,stdout:"",stderr:"RapidKit entrypoint is unavailable for nested workspace-run execution."};let n=await execa(process.execPath,[t,...e],{cwd:r,reject:false,env:{...process.env,RAPIDKIT_WORKSPACE_RUN_CHILD:"1"}});return {exitCode:Number(n.exitCode??1),stdout:n.stdout,stderr:n.stderr}}function et(e){return e==="node"||e==="go"||e==="java"||e==="python"||e==="dotnet"}function tt(){return process.env.VITEST==="true"||process.env.VITEST==="1"||process.env.NODE_ENV==="test"}async function rt(e){let r=process.cwd();try{process.chdir(e);let{handleInitCommand:t}=await import('./index.js');return {exitCode:await t(["init"]),stdout:"",stderr:""}}finally{process.chdir(r);}}async function nt(e){let r=a=>{let l=f(a);return l==="node"||l==="bun"?"node":l==="python"?"python":l==="go"?"go":l==="java"?"java":l==="php"?"php":l==="ruby"?"ruby":l==="rust"?"rust":l==="dotnet"?"dotnet":l==="elixir"?"elixir":l==="clojure"||l==="scala"||l==="kotlin"?"jvm-generic":Se(e)},t=a=>{if(!a)return;let l=e$1(a);if(new Set(["fastapi","django","flask","nestjs","express","fastify","koa","gofiber","gogin","echo","springboot","laravel","symfony","rails","sinatra","dotnet","actix","axum","rocket","phoenix"]).has(l))return l},n$1=n(e),o=n$1?.detection??i(e,n$1?.projectJson??null),s=n$1?.contextJson,c=r(o.runtime),d=t(o.key),p={},f$1=new Set(["init","test","build","start"]);if(s?.commands&&typeof s.commands=="object")for(let[a,l]of Object.entries(s.commands))typeof l=="string"&&f$1.has(a)&&(p[a]=l);let g;if(s?.commandEnvironments&&typeof s.commandEnvironments=="object"){let a=s.commandEnvironments;g={dev:typeof a.dev=="string"?a.dev:void 0,staging:typeof a.staging=="string"?a.staging:void 0,prod:typeof a.prod=="string"?a.prod:void 0,default:typeof a.default=="string"?a.default:void 0};}return {runtime:c,framework:d,commandOverrides:Object.keys(p).length>0?p:void 0,environmentCommandVariants:g,environment:typeof s?.environment=="string"?s.environment:void 0}}async function ot(e,r,t,n,o,s,c){let d=!o?.[r]&&et(t),p;if(o&&o[r]?p=o[r]:d?p=`rapidkit ${r}`:p=te({projectPath:e,runtime:t,framework:n,stage:r}),!p)return {exitCode:127,command:`<stage not supported for ${t}>`,message:`No stage command found for runtime '${t}' and framework '${n||"unknown"}'`,errorCategory:"runtime"};let f=Ee(p,s,c);if(!f)return {exitCode:127,command:p,message:"Failed to resolve stage command",errorCategory:"runtime"};let g=te({projectPath:e,runtime:t,framework:n,stage:r});if(d){if(g){let u=d?await ze(e,t,g):await z(g);if(!u.valid)return {exitCode:127,command:f,message:u.reason||"Command not available",errorCategory:"setup"}}}else {let u=await z(f);if(!u.valid)return {exitCode:127,command:f,message:u.reason||"Command not available",errorCategory:"setup"}}let a=0,l="",y="",h;try{let u=d?r==="init"&&tt()?await rt(e):await re([r],e):await execa(f,[],{cwd:e,reject:false,shell:true});if(a=Number(u.exitCode??0),l=u.stdout,y=u.stderr,a!==0){let b=`${l}
|
|
2
|
-
${y}`;h=je(b);}}catch(u){return {exitCode:1,command:f,message:u instanceof Error?u.message:"Command execution failed",errorCategory:"runtime"}}return {exitCode:a,command:f,errorCategory:h,healthStatus:void 0,message:a!==0?`Stage failed with exit code ${a}`:void 0}}function Fe(e){try{return JSON.parse(e)}catch{return null}}function st(e){switch(e){case "dotnet":return "Install .NET 8+ SDK, then rerun `npx rapidkit setup dotnet` or `npx rapidkit init`.";case "go":return "Install Go 1.21+, then rerun `npx rapidkit setup go` or `npx rapidkit init`.";case "java":case "jvm-generic":return "Install Java 21+ and Maven/Gradle, then rerun `npx rapidkit setup java` or `npx rapidkit init`.";case "node":return "Install Node.js LTS and npm/pnpm/yarn, then rerun `npx rapidkit setup node` or `npx rapidkit init`.";case "python":return "Install Python 3.10+ and pip/Poetry, then rerun `npx rapidkit setup python` or `npx rapidkit init`.";default:return null}}async function at(e){let r=[],t=await re(["doctor","workspace","--json"],e);if(t.exitCode!==0)r.push({gate:"doctor-workspace",status:"fail",summary:"doctor workspace command failed"});else {let s=Fe(t.stdout)?.healthScore,c=Number(s?.errors??0);Number.isFinite(c)&&c>0?r.push({gate:"doctor-workspace",status:"fail",summary:`doctor workspace reports ${c} error(s)`}):r.push({gate:"doctor-workspace",status:"pass",summary:"doctor workspace passed"});}let n=await re(["readiness","--json"],e);if(n.exitCode!==0)r.push({gate:"readiness",status:"fail",summary:"readiness command failed"});else {let o=Fe(n.stdout),s=String(o?.overallStatus??"").toLowerCase();s==="fail"?r.push({gate:"readiness",status:"fail",summary:"readiness overall status is fail"}):s==="warn"?r.push({gate:"readiness",status:"warn",summary:"readiness overall status is warn"}):r.push({gate:"readiness",status:"pass",summary:"readiness overall status is pass"});}return r}var it=new Set(["dev","stop"]);function ct(e){let r=e.trim();return !r||it.has(r.toLowerCase())?false:Ke.has(r)?true:/^[a-z][a-z0-9_-]*$/i.test(r)}function Ae(e,r,t){let n=C(w.relative(t,r));return (Array.isArray(e.projects)?e.projects:[]).some(s=>{if(!s||typeof s!="object")return false;let c=s,d=[c.relativePath,c.path].filter(p=>typeof p=="string"&&p.length>0).map(p=>C(p));return c.status==="passed"&&(d.includes(n)||d.some(p=>p.endsWith(`/${n}`)))})}function ut(e,r){return ee(e,r)?.dependencies??[]}function dt(e,r){let t=Math.max(1,Math.min(4,r)),n=Number(e??t);return Number.isFinite(n)?Math.max(1,Math.min(16,Math.trunc(n))):t}async function Bt(e$1){if(!ct(e$1.stage))throw new Error(`Unsupported workspace run stage: ${e$1.stage}`);let r=Date.now(),t=w.resolve(e$1.workspacePath),n=await d(t),o=await Ue(t),{projects:s,normalizedScope:c}=await qe(t,o,e$1.scope),d$1=e$1.affected===true,p=e$1.blastRadius===true,f=e$1.since?.trim()||"HEAD~1",g=d$1?await Ye(t,s,f):new Set(s),a$1,l="not-applicable",y=0,h="all";if(d$1&&p){let m=await Qe(t,o,g);a$1=m.expanded,l=m.graphStatus,y=m.expansionDepth,h="affected+blast-radius";}else d$1?(a$1=g,h="affected"):(a$1=g,h="all");let R=e$1.stage==="init"?false:await Ze(t,e$1.enforceGates),u=R?await at(t):[{gate:"doctor-workspace",status:"skipped",summary:"workspace run gates disabled"},{gate:"readiness",status:"skipped",summary:"workspace run gates disabled"}],b$1=u.find(m=>m.status==="fail"),v=s.filter(m=>a$1.has(m)),I=e$1.continueOnError===true||e$1.stage==="init",M=e$1.parallel===true,x=dt(e$1.maxWorkers,v.length),P=v.length,N=0;e$1.json||console.log(S.gray(`Workspace run (${e$1.stage}) started: ${P} target(s), ${M?`parallel x${x}`:"sequential"}`));let A=new Map;for(let m of o){let k=s.includes(m),i=k&&a$1.has(m);A.set(m,{path:m,relativePath:C(w.relative(t,m)),selected:i,affected:i,status:"skipped",exitCode:null,durationMs:0,reason:i?void 0:k?"not affected":"outside scope",framework:void 0,runtimeDetected:void 0,executionCommand:void 0});}if(b$1)for(let m of v){let k=A.get(m);k&&(k.status="skipped",k.reason=`blocked by ${b$1.gate}`);}else {let m=async k=>{let i=A.get(k);if(!i)return;let T=C(w.relative(t,k));e$1.json||console.log(S.gray(`\u23F3 [${N}/${P}] ${e$1.stage} ${T}`)),i.selected=true,i.affected=true;let E=Date.now(),{runtime:j,framework:F,commandOverrides:We,environmentCommandVariants:De,environment:$e}=await nt(k);i.runtimeDetected=j,i.framework=F;let ce=Pe(k,e$1.stage);if(!ce.supported){i.status="skipped",i.reason=ce.reason??`stage "${e$1.stage}" unsupported for project`,i.durationMs=Date.now()-E,i.exitCode=null,N+=1;return}if(e$1.reusePassed&&n){let D=n.stages[e$1.stage]??n.stages[e$1.stage];if(D&&Ae(D,k,t)){i.status="passed",i.reason="reused passed result from workspace-run-last.json",i.durationMs=Date.now()-E,i.exitCode=0,N+=1,e$1.json||console.log(S.gray(`\u21BA reused passed cache for ${T}`));return}}let ue=ut(j,F);if(ue.length>0&&n){let D=ue.find(q=>{let L=n.stages[q];return !L||!Ae(L,k,t)});if(D){i.status="skipped",i.reason=`dependency stage "${D}" not satisfied in workspace-run-last.json`,i.durationMs=Date.now()-E,i.exitCode=null,N+=1;return}}let W=await ot(k,e$1.stage,j,F,We,De,$e);if(i.executionCommand=W.command,i.errorCategory=W.errorCategory,i.healthStatus=W.healthStatus,i.durationMs=Date.now()-E,i.exitCode=W.exitCode,W.exitCode===0?(i.status="passed",i.reason=void 0):(i.status="failed",i.reason=W.message||"stage command failed",i.errorMessage=W.message),N+=1,!e$1.json){let D=P>0?Math.round(N/P*100):100,q=i.status==="passed"?S.green("\u2705"):S.red("\u274C");if(console.log(S.gray(`${q} [${N}/${P}] (${D}%) ${T} ${i.durationMs}ms`)),i.status==="failed"){i.reason&&console.log(S.red(` Reason: ${i.reason}`)),i.executionCommand&&console.log(S.gray(` Command: ${i.executionCommand}`));let L=st(i.runtimeDetected);L&&i.errorCategory==="setup"&&console.log(S.gray(` Hint: ${L}`));}}};if(M&&v.length>1){let k=0,i=false,T=new Array(x).fill(null).map(async()=>{for(;k<v.length;){if(i&&!I)return;let E=k;k+=1;let j=v[E];await m(j),A.get(j)?.status==="failed"&&(i=true);}});if(await Promise.all(T),!I&&i){let E=false;for(let j of v){let F=A.get(j);if(F){if(F.status==="failed"){E=true;continue}E&&F.status==="skipped"&&(F.reason=F.reason||"stopped after failure");}}}}else for(let k of v){await m(k);let i=A.get(k);if(!I&&i?.status==="failed"){let T=v.slice(v.indexOf(k)+1);for(let E of T){let j=A.get(E);j&&(j.status="skipped",j.reason="stopped after failure");}break}}}let O=[];for(let m of o){let k=A.get(m);k&&O.push(k);}let oe=O.filter(m=>m.status==="passed").length,J=O.filter(m=>m.status==="failed").length,se=O.filter(m=>m.status==="skipped").length,ae=e$1.strict===true,Ne=J>0||ae&&u.some(m=>m.status==="fail"||m.status==="warn")?1:0,ie={schemaVersion:"1.0",workspacePath:t,stage:e$1.stage,generatedAt:new Date().toISOString(),durationMs:Date.now()-r,options:{affected:d$1,blastRadius:p,since:d$1?f:null,parallel:M,maxWorkers:x,continueOnError:I,strict:ae,enforceGates:R,scope:c,reusePassed:e$1.reusePassed===true},selection:{mode:h,since:d$1?f:null,scope:c,graphStatus:l,expansionDepth:y},gates:{enforced:R,results:u,blocked:!!b$1,blockingGate:b$1?.gate},summary:{projectCount:o.length,selectedCount:v.length,passed:oe,failed:J,skipped:se,exitCode:Ne},projects:O,enterpriseControls:{jsonReady:true,evidencePath:b}},Te=w.join(t,".rapidkit","reports",a);return await e(t,ie),e$1.json||(b$1&&(console.log(S.red(`\u274C Workspace run blocked by ${b$1.gate}`)),console.log(S.gray(` ${b$1.summary}`))),console.log(S.cyan(`Workspace run (${e$1.stage}) => passed: ${oe}, failed: ${J}, skipped: ${se}`)),console.log(S.gray(`Report: ${Te}`))),ie}export{Bt as a};
|
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-ZPXMZCYG.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-BHE2V4KS.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-WCICO7ZB.js';export{d as WORKSPACE_MODEL_DIFF_REPORT_PATH}from'./chunk-DWXRVGOY.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-WCICO7ZB.js';import {b as b$2}from'./chunk-33LR2QEM.js';import {d}from'./chunk-HYAT2EG7.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-VDTAPIHB.js';export{a as WORKSPACE_RUN_LAST_REPORT_FILENAME}from'./chunk-64RTZBHU.js';
|