workspai 0.74.0 → 0.75.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/contracts/agent-framework-capabilities.v1.json +454 -0
- package/contracts/cli-runtime-command-inventory.v1.snapshot.json +166 -0
- package/contracts/create-planner-capabilities.v1.json +24 -0
- package/contracts/extension-cli-compatibility.v1.json +6 -0
- package/contracts/published-contract-catalog.v1.json +30 -0
- package/contracts/runtime-command-surface.v1.json +71 -1
- package/contracts/workspace-intelligence/agent-framework-adapter-manifest.v1.json +2127 -0
- package/contracts/workspace-intelligence/agent-framework-admission-candidate.v1.json +193 -0
- package/contracts/workspace-intelligence/agent-framework-change-plan.v1.json +280 -0
- package/contracts/workspace-intelligence/agent-framework-conformance-report.v1.json +269 -0
- package/contracts/workspace-intelligence/agent-framework-ownership-receipt.v1.json +147 -0
- package/contracts/workspace-intelligence/workspace-model.v1.json +4 -0
- package/contracts/workspace-intelligence-architecture.v1.json +28 -2
- package/dist/analyze-Z3EZNJRI.js +1 -0
- package/dist/{artifact-remediation-plan-OVTQM7HN.js → artifact-remediation-plan-HD5K52UJ.js} +1 -1
- package/dist/autopilot-release-T6XFRWZT.js +1 -0
- package/dist/capabilities-command-VK3LQLP2.js +1 -0
- package/dist/{chunk-UHT2SW7O.js → chunk-25V5XMWB.js} +1 -1
- package/dist/chunk-2CT5SN2L.js +2 -0
- package/dist/chunk-2GWQ6NZV.js +1 -0
- package/dist/{chunk-KCIET26G.js → chunk-2OCJKLTW.js} +1 -1
- package/dist/{chunk-SAZXL36B.js → chunk-3WQ5TYCO.js} +1 -1
- package/dist/chunk-4VSQNSGH.js +9 -0
- package/dist/chunk-566NQQTJ.js +97 -0
- package/dist/chunk-5EEXLM45.js +1 -0
- package/dist/chunk-65AE7EC5.js +2 -0
- package/dist/{chunk-PKKSRXUS.js → chunk-6B7L4NZE.js} +1 -1
- package/dist/{chunk-BTJPTJLT.js → chunk-6KMR5PKQ.js} +3 -3
- package/dist/chunk-6NSJBKKK.js +4 -0
- package/dist/chunk-7NKM6EHE.js +7 -0
- package/dist/chunk-ABUSBLBH.js +1 -0
- package/dist/{chunk-TVSMNF5G.js → chunk-AICCXYY5.js} +4 -4
- package/dist/{chunk-FE5R6EUV.js → chunk-BLEIUQL6.js} +1 -1
- package/dist/{chunk-37SWTS2B.js → chunk-BR6QIYQS.js} +1 -1
- package/dist/chunk-CMLLERGG.js +418 -0
- package/dist/{chunk-MGL6DBOR.js → chunk-COOVCORC.js} +1 -1
- package/dist/chunk-DFREJHG7.js +1 -0
- package/dist/{chunk-C43NXRRE.js → chunk-DJH2CH42.js} +1 -1
- package/dist/chunk-FU6SQ2ND.js +1 -0
- package/dist/{chunk-IQFXLJIM.js → chunk-HDISUL3F.js} +1 -1
- package/dist/{chunk-JK6XEF7K.js → chunk-JKAAKE4Z.js} +1 -1
- package/dist/{chunk-G6ADWA2B.js → chunk-M6DVNC6X.js} +1 -1
- package/dist/chunk-NGZF4YJS.js +2 -0
- package/dist/{chunk-4JJDDL3X.js → chunk-NI5QWBZK.js} +1 -1
- package/dist/{chunk-3WHE7V4M.js → chunk-NLRZFIC6.js} +1 -1
- package/dist/{chunk-5Y4YRYZI.js → chunk-NRIMJMTF.js} +8 -8
- package/dist/{chunk-EBQS5T7Q.js → chunk-OA2YJN22.js} +1 -1
- package/dist/chunk-OH6LV5JP.js +6 -0
- package/dist/chunk-PTI743SC.js +7 -0
- package/dist/{chunk-TBOIXIQA.js → chunk-QBKOPXKC.js} +1 -1
- package/dist/chunk-RTD5D35M.js +13 -0
- package/dist/{chunk-XVTN5DDV.js → chunk-RU3UT7GJ.js} +1 -1
- package/dist/{chunk-DPC5DKH6.js → chunk-SCKEFXF5.js} +1 -1
- package/dist/chunk-UE7ART6X.js +1 -0
- package/dist/{chunk-FY4X2VOE.js → chunk-VHMDWRDG.js} +2 -2
- package/dist/chunk-VJQPIH2S.js +681 -0
- package/dist/{chunk-H333GKL4.js → chunk-W7I65IXY.js} +1 -1
- package/dist/{chunk-ZNKZ2KXR.js → chunk-WPPRUFJW.js} +1 -1
- package/dist/{chunk-HAZGSAKP.js → chunk-ZI54C2AO.js} +1 -1
- package/dist/{create-EKA2QG5R.js → create-P4XJVZCL.js} +1 -1
- package/dist/{demo-kit-RKTHTXHJ.js → demo-kit-ALW6OSQV.js} +1 -1
- package/dist/{doctor-BXSNADVR.js → doctor-PFN6KB6P.js} +1 -1
- package/dist/{dotnet-webapi-clean-VJX6SGGP.js → dotnet-webapi-clean-6Z4EXEJY.js} +1 -1
- package/dist/{goal-lifecycle-XXWNMIAD.js → goal-lifecycle-BDWTWS55.js} +1 -1
- package/dist/goal-pack-5JDNZFKV.js +1 -0
- package/dist/{gofiber-standard-I6ASLOEE.js → gofiber-standard-TDJQIVQZ.js} +1 -1
- package/dist/{gogin-standard-U2LSRLIP.js → gogin-standard-UEF3IHSJ.js} +1 -1
- package/dist/index.d.ts +18 -0
- package/dist/index.js +276 -251
- package/dist/{pipeline-JLOC2SUT.js → pipeline-OUYS4ZYV.js} +1 -1
- package/dist/{project-agent-entry-ZNUHGCVC.js → project-agent-entry-75WO3QWP.js} +1 -1
- package/dist/{project-intelligence-lens-W72OUEDW.js → project-intelligence-lens-JCHFOIA7.js} +1 -1
- package/dist/{project-test-coverage-5PXAHBYQ.js → project-test-coverage-3P5FH6E5.js} +1 -1
- package/dist/proof-carrying-change-LAYV4LTI.js +1 -0
- package/dist/{pythonRapidkitExec-44ORGQ4R.js → pythonRapidkitExec-UMFLDIYR.js} +1 -1
- package/dist/{rust-axum-JMV7UPO7.js → rust-axum-4TRVPFMB.js} +1 -1
- package/dist/{springboot-standard-OC2RS3KC.js → springboot-standard-COWL75GT.js} +1 -1
- package/dist/verified-goal-75KGBWTE.js +1 -0
- package/dist/{workspace-XTIGVLGH.js → workspace-CBQDOUSH.js} +1 -1
- package/dist/{workspace-agent-sync-TN6QDNBR.js → workspace-agent-sync-RTOTO3DY.js} +1 -1
- package/dist/{workspace-archive-OSMU3CK6.js → workspace-archive-3AURTMYA.js} +1 -1
- package/dist/{workspace-context-Y3TNY2XZ.js → workspace-context-STRZO2N3.js} +1 -1
- package/dist/{workspace-contract-GRZY7WRD.js → workspace-contract-PMHUUKFM.js} +1 -1
- package/dist/{workspace-explain-KUYHJFLY.js → workspace-explain-CATMJUMN.js} +1 -1
- package/dist/{workspace-feedback-D6HJLKBQ.js → workspace-feedback-FF34CSJE.js} +1 -1
- package/dist/{workspace-foundation-ZBUJTR56.js → workspace-foundation-OULCDCXG.js} +1 -1
- package/dist/{workspace-graph-stream-KC2XUAE4.js → workspace-graph-stream-Q55CI4K4.js} +1 -1
- package/dist/{workspace-history-WWPS4U7H.js → workspace-history-EQG5UBKW.js} +1 -1
- package/dist/{workspace-intelligence-26YT6KMN.js → workspace-intelligence-3RPZRWSF.js} +1 -1
- package/dist/{workspace-intelligence-benchmark-QFVTUBDO.js → workspace-intelligence-benchmark-R5MEGJQS.js} +1 -1
- package/dist/{workspace-intelligence-runner-HVYKHCTX.js → workspace-intelligence-runner-BNZUYUUN.js} +1 -1
- package/dist/{workspace-knowledge-graph-RL3I2FHY.js → workspace-knowledge-graph-VJLD35ES.js} +1 -1
- package/dist/workspace-knowledge-graph-snapshot-TQAKDDUA.js +1 -0
- package/dist/workspace-mcp-serve-67NTYD67.js +3 -0
- package/dist/workspace-model-6TKZMNEF.js +1 -0
- package/dist/{workspace-onboarding-BY6RUBBH.js → workspace-onboarding-7V7EH3RH.js} +1 -1
- package/dist/{workspace-readme-HA6XLDME.js → workspace-readme-4FCKAQME.js} +1 -1
- package/dist/{workspace-registry-summary-VKTJ7PHV.js → workspace-registry-summary-ILVO7DEU.js} +1 -1
- package/dist/{workspace-repair-engine-RBM7NCGI.js → workspace-repair-engine-2VGFB3DJ.js} +1 -1
- package/dist/workspace-run-X7KV6MIT.js +1 -0
- package/dist/{workspace-verify-NFJ7RKKT.js → workspace-verify-VQWYDAF2.js} +1 -1
- package/dist/workspace-watch-2Z636HWS.js +1 -0
- package/docs/README.md +4 -1
- package/docs/agent-framework-adapters.md +279 -0
- package/docs/ci-workflows.md +15 -8
- package/docs/commands-reference.md +22 -0
- package/docs/contracts/COMMAND_OWNERSHIP_MATRIX.md +5 -0
- package/docs/creating-workspaces-and-projects.md +18 -4
- package/docs/workspace-operations.md +12 -2
- package/package.json +7 -1
- package/scripts/enterprise-package-smoke.mjs +98 -0
- package/dist/analyze-IA33T6MY.js +0 -1
- package/dist/autopilot-release-T327V7QK.js +0 -1
- package/dist/capabilities-command-NFGX42CH.js +0 -1
- package/dist/chunk-46QH3ZVI.js +0 -105
- package/dist/chunk-5EVBOUYW.js +0 -3
- package/dist/chunk-773WUMFU.js +0 -681
- package/dist/chunk-D6BL7ARI.js +0 -2
- package/dist/chunk-DLLHUG2Q.js +0 -9
- package/dist/chunk-DTLLIA2C.js +0 -1
- package/dist/chunk-FYR4FD7K.js +0 -1
- package/dist/chunk-H5DRKXXC.js +0 -2
- package/dist/chunk-IUOMBLRR.js +0 -2
- package/dist/chunk-K3FXRBER.js +0 -4
- package/dist/chunk-LEEOZRWR.js +0 -7
- package/dist/chunk-NCZJUPG5.js +0 -97
- package/dist/chunk-ND5YAC4T.js +0 -1
- package/dist/chunk-SVGUAVMG.js +0 -1
- package/dist/chunk-TGDXD4CD.js +0 -1
- package/dist/chunk-VLKX5U4H.js +0 -13
- package/dist/chunk-YYELANJO.js +0 -7
- package/dist/goal-pack-NTHYLISY.js +0 -1
- package/dist/proof-carrying-change-WLUPMUO7.js +0 -1
- package/dist/verified-goal-6O2JZOOR.js +0 -1
- package/dist/workspace-knowledge-graph-snapshot-JEJMRQZL.js +0 -1
- package/dist/workspace-mcp-serve-2FGRXJG4.js +0 -3
- package/dist/workspace-model-2ODVOWDQ.js +0 -1
- package/dist/workspace-run-JCA5WPCR.js +0 -1
- package/dist/workspace-watch-3DBBB6IP.js +0 -1
- /package/dist/{chunk-K33JJVQZ.js → chunk-VN2MKTQO.js} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {m,a as a$1,l as l$1}from'./chunk-
|
|
1
|
+
import {m,a as a$1,l as l$1}from'./chunk-3WQ5TYCO.js';import {b as b$5,g as g$2}from'./chunk-SCKEFXF5.js';import {b as b$4,a}from'./chunk-D5LLTUTY.js';import {b as b$2,f as f$2,s as s$1,t as t$1,u,P as P$1,v,q as q$1,r as r$1,R,n,o,p as p$2,h as h$2,i,m as m$1,j,k,l,O,w,x,y,z as z$1,A,B as B$1,C,E,G,I,D as D$1,F,H,J as J$1,K,L,M,N,S,T,U,V,Y as Y$1,X as X$1,W,a as a$3,Q}from'./chunk-QYEQVNBF.js';import {b as b$1,c,d}from'./chunk-NGZF4YJS.js';import {b as b$3}from'./chunk-COICGD62.js';import {d as d$2}from'./chunk-5EEXLM45.js';import {b as b$7}from'./chunk-NRIMJMTF.js';import {r,m as m$2,d as d$1}from'./chunk-FU6SQ2ND.js';import {p as p$1}from'./chunk-M6DVNC6X.js';import {g}from'./chunk-BLEIUQL6.js';import {a as a$2,b as b$6}from'./chunk-VN2MKTQO.js';import {f as f$1,g as g$1,h}from'./chunk-VQZ5PI5J.js';import {q,p,t,s as s$2}from'./chunk-ODK4LCEL.js';import s from'path';import h$1 from'fs-extra';var pe=["Scope","Evidence","Diagnosis","Fix Plan","Run","Verify","Assumptions"];var Jt="workspace-operational-skill.v1";function Yt(e){if(typeof e!="string")return null;let t=e.trim();return !t||t.includes("/")||t.includes("..")?null:t}function Ot(e){let t=Yt(e.skillId);if(!t)throw new Error(`Invalid skill id: ${e.skillId}`);return {schemaVersion:Jt,skillId:t,canonicalPath:W(t),title:e.title,triggers:[...e.triggers].sort((r,n)=>r.localeCompare(n)),requiredReports:[...e.requiredReports].sort((r,n)=>r.localeCompare(n)),scopedProjects:[...e.scopedProjects??[]].sort((r,n)=>r.localeCompare(n)),verificationCommands:[...e.verificationCommands],answerContractSections:[...pe],...e.promptStem?{promptStem:e.promptStem}:{},markdown:e.markdown}}var Xt=q.skillsIndex;function Tt(e){let t=[...e.skills].sort((i,c)=>i.skillId.localeCompare(c.skillId)),r=e.inputsHash??d$1({skillIds:t.map(i=>i.skillId),paths:t.map(i=>i.canonicalPath),decisions:e.decisions??[]}),n=e.decisions?[...e.decisions].sort((i,c)=>i.skillId.localeCompare(c.skillId)):void 0;return {schemaVersion:Xt,generatedAt:e.generatedAt,inputsHash:r,skills:t.map(i=>({skillId:i.skillId,path:i.canonicalPath,schemaVersion:i.schemaVersion,title:i.title})),...n?{selection:{generatedCount:n.filter(i=>i.status==="generated").length,suppressedCount:n.filter(i=>i.status==="suppressed").length,decisions:n}}:{}}}var _t=[p.agentIndex,b$1,d$2],B="<!-- WORKSPAI:GENERATED-OPERATIONAL-SKILL -->",Qt=[{skillId:"workspai-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 Workspai evidence before editing application code.",steps:[`Read \`${p.agentIndex}\` and identify fail/warn reports for the scoped project.`,`Read \`${p.doctor}\`, \`doctor-project-last-run.json\`, and project-scoped run evidence if present.`,"If a fix was requested, read `artifact-remediation-plan-last-run.json` for cross-artifact next steps, then `doctor-remediation-plan-last-run.json` for Doctor-specific file edits.","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."],applicability:"api"},{skillId:"workspai-release-readiness",title:"Release readiness",triggers:["release","ship","production","readiness gate"],objective:"Assess whether this workspace is release-ready using governed Workspai gates.",steps:[`Read \`${p.readiness}\` and \`pipeline-last-run.json\`.`,`Read \`${p.verify}\` for verdict and blocking reasons.`,`Read \`${t.artifactRemediationPlan}\` when a Studio or agent repair path is needed.`,"List blocking gates first; never claim ready without cited report fields.","Provide one safe next command and a verification checklist."],applicability:"workspace"},{skillId:"workspai-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.","Run a registered project-scoped test/build command when available; otherwise resolve the repository-authored validation command from cited manifests before promoting the migration.","Document rollback and verification signals."],applicability:"schema"},{skillId:"workspai-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.","Use registered test/build commands for affected projects; when none are registered, resolve repository-authored commands from cited manifests instead of inventing one.","Re-run `workspace verify` after evidence refresh."],applicability:"dependency"},{skillId:"workspai-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 \`${t.workspaceContract}\` 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."],applicability:"contract"}];function z(e){return `npx workspai ${e}`.trim()}function Zt(e){let t=["---",`name: ${e.template.skillId}`,`description: ${e.template.objective}`,"---","",B,"",`# ${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)","",..._t.map(r=>`- \`${r}\``),"","## Why this skill exists here","",`Applicability: **${e.decision.confidence} confidence**.`,"",...e.decision.reasons.map(r=>`- ${r}`),...e.decision.signals.length>0?["","Evidence signals:","",...e.decision.signals.map(r=>`- \`${r}\``)]:[],"","## Project-aware execution boundary","",...e.projectEvidence,"",...e.retrievalCommands.length>0?["## Scoped retrieval commands","",...e.retrievalCommands.map(r=>`- \`${r}\``),""]:[],"## Procedure","",...e.template.steps.map((r,n)=>`${n+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",z("workspace agent-sync --write --refresh-context"),"```",""),t.join(`
|
|
2
2
|
`)}function er(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function tr(e){let t=new Map;for(let c of e.projects){let m=new Set([c.runtime,...c.runtimeCandidates??[]].map(er).filter(a=>a&&a!=="unknown"));for(let a of m){let k=t.get(a)??[];k.includes(c.name)||k.push(c.name),t.set(a,k);}}let r=[];for(let[c,m]of [...t.entries()].sort(([a],[k])=>a.localeCompare(k)))r.push({skillId:`workspai-${c}-runtime-validation`,title:`${c.toUpperCase()} runtime validation`,triggers:[`${c} build`,`${c} test`,`${c} runtime failure`],objective:`Validate ${c} changes against the detected runtime boundary, registered project commands, and canonical Workspai evidence.`,steps:["Read the scoped project lens and current fail/warn evidence before changing source.",`Use a registered ${c} command only when the project model identifies ${c} as the primary runtime; for a composite secondary boundary, inspect its manifest and Graph proofs instead of assuming the primary adapter covers it.`,"Run only the affected project validation first, then verify the workspace when the change crosses a contract boundary."],scopedProjects:[...m].sort(),applicability:"derived"});t.size>1&&r.push({skillId:"workspai-polyglot-change-validation",title:"Polyglot change validation",triggers:["cross-language change","polyglot change","binding change","multi-runtime validation"],objective:"Plan and verify a cross-runtime change without assuming that one runtime command proves the whole system.",steps:["Use the project topology and bounded Graph query to identify runtime and contract boundaries.","Validate each affected runtime with its registered project command.","Run workspace impact and canonical verification before declaring the change complete."],scopedProjects:Wt([...t.values()].flat()),applicability:"derived"});let n=e.projects.filter(c=>c.commands.supported.includes("test")).map(c=>c.name).sort();n.length>0&&r.push({skillId:"workspai-test-evidence-recovery",title:"Test evidence recovery",triggers:["test failure","coverage","regression","test evidence"],objective:"Repair a test or coverage blocker by proving changed behavior, not merely improving a metric.",steps:["Read the exact Analyze, Doctor, or Goal evidence that owns the test finding.","Inspect the behavior and relevant test boundary before proposing a source change.","Run the scoped test command, then the exact producer and canonical verification."],scopedProjects:n,applicability:"derived"});let i=e.projects.filter(c=>c.importantFiles.some(m=>/(?:^|\/)(?:Dockerfile|docker-compose|compose\.|Chart\.yaml|\.github\/workflows)/i.test(m))).map(c=>c.name).sort();return i.length>0&&r.push({skillId:"workspai-delivery-evidence",title:"Delivery evidence and CI recovery",triggers:["ci failure","workflow failure","container build","deployment evidence"],objective:"Diagnose delivery evidence with the owning project and CI/container artifacts before changing application source.",steps:["Identify whether the failing evidence is project-owned or workspace-owned.","Inspect the referenced workflow or delivery artifact and its bounded proof paths.","Validate the affected project first, then refresh the exact evidence producer and verify the workspace."],scopedProjects:i,applicability:"derived"}),r}function rr(e,t){if(!e?.safeCommands?.length)return [z("workspace verify --json"),z("doctor workspace --json")];let r=new Set(t);return e.safeCommands.filter(n=>n.scope==="workspace"||n.project&&r.has(n.project)).slice(0,8).map(n=>n.display)}function nr(e,t){if(!e?.projects?.length)return;let r=new Set(t),n=e.projects.filter(i=>r.has(i.slug)).filter(i=>(i.contracts?.owns?.length??0)>0||(i.contracts?.publishes?.length??0)>0||(i.contracts?.consumes?.length??0)>0||(i.contracts?.apis?.length??0)>0).slice(0,12).map(i=>{let c=i.contracts?.owns?.join(", ")||"none",m=i.contracts?.publishes?.join(", ")||"none",a=i.contracts?.consumes?.join(", ")||"none";return `- **${i.slug}**: owns \`${c}\`; publishes \`${m}\`; consumes \`${a}\``});return n.length>0?n.join(`
|
|
3
3
|
`):void 0}var ar=/(?:^|\/)(?:package(?:-lock)?\.json|pnpm-lock\.yaml|yarn\.lock|bun\.lockb?|pyproject\.toml|poetry\.lock|requirements[^/]*\.txt|Pipfile(?:\.lock)?|uv\.lock|Cargo\.toml|Cargo\.lock|go\.mod|go\.sum|pom\.xml|build\.gradle(?:\.kts)?|settings\.gradle(?:\.kts)?|Gemfile(?:\.lock)?|composer\.(?:json|lock)|mix\.exs|deps\.edn|project\.clj|[^/]+\.(?:csproj|fsproj|vbproj)|Directory\.Packages\.props)$/i,or=/(?:^|\/)(?:openapi|swagger|asyncapi)\.(?:json|ya?ml)$|(?:^|\/)(?:routes?|controllers?|endpoints?|proto)(?:\/|\.)/i,ir=/(?:^|\/)(?:migrations?|database|db|prisma)(?:\/|\.)|(?:^|\/)schema\.(?:sql|prisma)$/i;function sr(e){let t=e.attributes.artifact;return typeof t=="string"&&t.trim()?t.trim():null}function cr(e){let t=e.attributes.ports;return Array.isArray(t)&&t.length>0}function lr(e,t){return e?.entities.filter(r=>r.projectId===t)??[]}function ue(e,t=12){return [...new Set([...e].map(r=>r.trim()).filter(Boolean))].sort((r,n)=>r.localeCompare(n)).slice(0,t)}function Wt(e){return [...new Set([...e].map(t=>t.trim()).filter(Boolean))].sort((t,r)=>t.localeCompare(r))}function dr(e){if(e.template.scopedProjects)return {projects:[...e.template.scopedProjects].sort(),reasons:["The canonical workspace model directly derived this capability."],signals:ue(e.template.scopedProjects.map(i=>`model:project:${i}:${e.template.skillId}`)),confidence:"high",applicable:true};if(e.template.applicability==="workspace")return {projects:e.model.projects.map(i=>i.name).sort(),reasons:["Workspace-level release and verification gates are always available."],signals:["model:workspace",`model:project-count:${e.model.projects.length}`],confidence:"high",applicable:true};let t=[],r=[],n=new Set;for(let i of e.model.projects){let c=lr(e.graph,i.name),m=Wt([...i.importantFiles,...c.map(sr).filter(l=>!!l)]),a=e.contract?.projects.find(l=>l.slug===i.name),k=false;switch(e.template.applicability){case "dependency":{let l=m.filter(d=>ar.test(d)),p=c.filter(d=>d.kind==="package");k=l.length>0||p.length>0,r.push(...l.map(d=>`artifact:${d}`),...p.slice(0,4).map(d=>`graph:package:${d.label}`)),k&&n.add("Dependency manifests or package entities were observed.");break}case "api":{let l=c.filter(w=>w.kind==="api"||w.kind==="endpoint"||w.kind==="service"&&cr(w)),p=m.filter(w=>or.test(w)),d=a?.contracts?.apis??[],R=(a?.ports??[]).filter(w=>["http","https","grpc"].includes(w.protocol));k=l.length>0||p.length>0||d.length>0||R.length>0,r.push(...l.slice(0,4).map(w=>`graph:${w.kind}:${w.label}`),...p.map(w=>`artifact:${w}`),...d.map(w=>`contract:api:${w.name}:${w.basePath}`),...R.map(w=>`contract:port:${w.name}:${w.protocol}:${w.port}`)),k&&n.add("An API, endpoint, routed artifact, or network contract was observed.");break}case "schema":{let l=c.filter(d=>{if(d.kind==="database")return true;if(d.kind!=="schema")return false;let R=`${d.label} ${JSON.stringify(d.attributes)}`;return /database|migration|sql|prisma|orm/i.test(R)}),p=m.filter(d=>ir.test(d));k=l.length>0||p.length>0,r.push(...l.slice(0,4).map(d=>`graph:${d.kind}:${d.label}`),...p.map(d=>`artifact:${d}`)),k&&n.add("A database, schema, or migration artifact was observed.");break}case "contract":{let l=a?[...a.contracts?.owns??[],...a.contracts?.publishes??[],...a.contracts?.consumes??[],...(a.contracts?.apis??[]).map(d=>d.name)]:[],p=c.filter(d=>["api","protocol"].includes(d.kind));k=l.length>0||p.length>0,r.push(...l.map(d=>`contract:${i.name}:${d}`),...p.slice(0,6).map(d=>`graph:${d.kind}:${d.label}`)),k&&n.add("A shared API, protocol, schema, or authored contract edge was observed.");break}case "derived":k=true;break}k&&t.push(i.name);}return {projects:ue(t,e.model.projects.length),reasons:[...n],signals:ue(r),confidence:e.graph||e.contract?"high":"medium",applicable:t.length>0}}function pr(e,t,r){let n=[];for(let i of t){let c=e.projects.find(l=>l.name===i);if(!c)continue;let m=c.commands.supported.filter(l=>["build","test","lint","format"].includes(l)),a=c.commands.supported.filter(l=>["docs","doctor"].includes(l)),k=r.filter(l=>l.startsWith("artifact:")).map(l=>l.slice(9)).filter(l=>c.importantFiles.includes(l)||l.includes(c.name));n.push(`- **${c.name}** \u2014 runtime \`${c.runtime}\`, framework \`${c.framework}\`, confidence \`${c.confidence}\`.`),n.push(m.length>0?` Registered lifecycle commands: ${m.map(l=>`\`${l}\``).join(", ")}.`:" No project-native build/test command is registered; inspect repository-authored manifests and Graph proofs before running a command."),a.length>0&&n.push(` Registered evidence commands: ${a.map(l=>`\`${l}\``).join(", ")}.`),k.length>0&&n.push(` Relevant artifacts: ${ue(k,6).map(l=>`\`${l}\``).join(", ")}.`);}return n.length>0?n:["- No project boundary was proven; do not infer repository-specific commands or files."]}function ur(e,t){let r=e.applicability==="api"?"api endpoint route service failure":e.applicability==="schema"?"database schema migration persistence":e.applicability==="dependency"?"package dependency manifest lockfile":e.applicability==="contract"?"api protocol published consumed contract":e.applicability==="workspace"?"release pipeline deployment verification":`${e.title.toLowerCase()} manifest command test`;return t.slice(0,8).map(n=>z(`workspace graph search "${r}" --scope project:${n} --limit 12 --json`))}function jt(e){let t=e.model.workspace.name,r=[],n=[];for(let i of [...Qt,...tr(e.model)]){let c=dr({template:i,model:e.model,contract:e.contract??null,graph:e.graph??null}),m={skillId:i.skillId,title:i.title,status:c.applicable?"generated":"suppressed",confidence:c.confidence,reasons:c.reasons.length>0?c.reasons:["No authoritative workspace signal proves this capability is present."],signals:c.signals,scopedProjects:c.projects};if(n.push(m),m.status==="suppressed")continue;let a=m.scopedProjects,k=rr(e.context??null,a),l=nr(e.contract??null,a),p=Zt({template:i,workspaceName:t,scopedProjects:a,verificationCommands:k,contractSummary:l,decision:m,projectEvidence:pr(e.model,a,m.signals),retrievalCommands:ur(i,a)});r.push(Ot({skillId:i.skillId,title:i.title,triggers:i.triggers,requiredReports:[..._t],scopedProjects:a,verificationCommands:k,...X$1(i.skillId)?{promptStem:Y$1[i.skillId]}:{},markdown:p}));}return {skills:r,decisions:n}}async function Nt(e){let t=s.resolve(e.workspacePath),r=[],n=d$1({skills:e.skills.map(a=>({id:a.skillId,path:a.canonicalPath,hash:d$1({markdown:a.markdown})})),decisions:e.decisions??[]}),i=Tt({generatedAt:e.generatedAt,skills:e.skills,inputsHash:n,decisions:e.decisions}),c=new Set(e.skills.map(a=>a.skillId)),m=[];if(e.write){let a=s.join(t,".workspai","skills");if(await h$1.pathExists(a))for(let l of await h$1.readdir(a,{withFileTypes:true})){if(!l.isFile()||!l.name.endsWith(".md"))continue;let p=l.name.slice(0,-3);if(c.has(p))continue;let d=s.join(a,l.name);(await h$1.readFile(d,"utf8")).includes(B)&&(await h$1.remove(d),m.push(p));}for(let l of e.skills){let p=s.join(t,l.canonicalPath);await h$1.ensureDir(s.dirname(p)),await h$1.writeFile(p,l.markdown,"utf8"),r.push(l.canonicalPath);}let k=s.join(t,b$2);await h$1.ensureDir(s.dirname(k)),await h$1.writeJson(k,i,{spaces:2}),r.push(b$2);}return {skills:e.skills,index:i,writtenPaths:r,removedSkillIds:m.sort()}}function Lt(e){return ["## Operational skills (canonical)","","Read workspace-native playbooks from `.workspai/skills/` before generic repo scans. Legacy `.rapidkit/skills/` playbooks are read only when already present from older workspaces:","",...e.skills.map(r=>`- \`${r.path}\` \u2014 ${r.title} (\`${r.skillId}\`)`),"","Regenerate:","","```bash",z("workspace agent-sync --write --refresh-context"),"```",""].join(`
|
|
4
4
|
`)}var gr={"workspai-diagnose-api-failure":A,"workspai-release-readiness":E},Je="## Workspace verification (hydrated)";function mr(e){let t=[Je,"","Verification commands for this workspace:","",...e.verificationCommands.length?e.verificationCommands.map(r=>`- \`${r}\``):["- `npx workspai workspace verify --json`"]];return e.scopedProjects.length>0&&t.push("","Scoped projects:","",...e.scopedProjects.map(r=>`- ${r}`)),t.push(""),t.join(`
|
|
5
5
|
`)}async function Gt(e){let t=s.resolve(e.workspacePath),r=[];for(let n of e.skills){let i=gr[n.skillId];if(!i)continue;let c=s.join(t,i);if(!await h$1.pathExists(c))continue;let m=await h$1.readFile(c,"utf8"),a=mr(n),k=m.includes(Je)?m.replace(new RegExp(`${Je}[\\s\\S]*$`),a.trimEnd()):`${m.trimEnd()}
|
|
6
6
|
|
|
7
7
|
${a}`;e.write&&await h$1.writeFile(c,`${k.trimEnd()}
|
|
8
|
-
`,"utf8"),r.push(i);}return r}var fr="workspai-agent-customization-pack-capabilities.v1";function $t(){return {schemaVersion:fr,presets:{minimal:{meaning:"Generate the portable grounding index, AGENTS.md, and provider-specific lightweight instructions.",requiredOutputs:[p.agentIndex,p.agentCustomizationPack,p.agents]},enterprise:{meaning:"Generate the full VS Code-native pack: instructions, prompts, skills, custom agents, and validation metadata.",requiredOutputs:[p.agentIndex,p.agentCustomizationPack,p.agents,w,A,M,".github/agents/workspai-advisor.agent.md",S,b$2]}},targets:{all:{meaning:"Generate every supported customization surface.",outputFamilies:["portable","vscode","copilot","cursor","claude","gemini","qwen","kimi","grok","windsurf","amazon-q"]},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 and .agents/skills projections.",outputFamilies:["portable","skills"]},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"]},gemini:{meaning:"Generate Gemini CLI grounding through GEMINI.md and canonical AGENTS.md.",outputFamilies:["adapter","portable"]},qwen:{meaning:"Generate Qwen Code grounding through QWEN.md and canonical AGENTS.md.",outputFamilies:["adapter","portable"]},kimi:{meaning:"Use AGENTS.md and the report index as the Kimi Code grounding layer.",outputFamilies:["portable"]},grok:{meaning:"Use AGENTS.md and the report index as the xAI Grok grounding layer.",outputFamilies:["portable"]},windsurf:{meaning:"Use AGENTS.md and the report index as the Windsurf grounding layer.",outputFamilies:["portable"]},"amazon-q":{meaning:"Generate an Amazon Q project rule that routes agents to canonical evidence.",outputFamilies:["rules","portable"]},orca:{meaning:"Legacy compatibility alias for AGENTS.md consumers; prefer the grok target.",outputFamilies:["portable"]}},standardAnswerContract:[...pe],requiredReports:J.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:[".workspai/reports/",`${a$3}/`],l2PrefixedMirrorRoots:[".agents/",".github/",".cursor/",".claude/",".amazonq/"],l3SharedIndustryFiles:["AGENTS.md",".github/copilot-instructions.md","CLAUDE.md","GEMINI.md","QWEN.md"]}}}var kr=q.agentIndex,hr=q.agentCustomizationPack,X=p.agentIndex,Y=p.agentCustomizationPack;var J=[{relativePath:t.goalIndex,label:"Active Goal Pack index",required:false},{relativePath:t.goalPackLastRun,label:"Latest governed Goal Pack",required:false},{relativePath:b$1,label:"Agent context pack",required:true},{relativePath:b$2,label:"Operational skills index",required:true},{relativePath:p.model,label:"Workspace model",required:false},{relativePath:p.knowledgeGraph,label:"Workspace knowledge graph",required:false},{relativePath:p.evaluationLastRun,label:"Workspace Intelligence evaluation",required:false},{relativePath:p.doctor,label:"Workspace doctor",required:false},{relativePath:t.doctorProject,label:"Project doctor",required:false},{relativePath:t.doctorRemediationPlan,label:"Doctor remediation plan",required:false},{relativePath:t.artifactRemediationPlan,label:"Artifact remediation plan",required:false},{relativePath:t.doctorFixResult,label:"Doctor fix result",required:false},{relativePath:p.analyze,label:"Workspace analyze",required:false},{relativePath:t.pipelineLastRun,label:"Governance pipeline",required:false},{relativePath:p.readiness,label:"Release readiness",required:false},{relativePath:p.impact,label:"Workspace impact",required:false},{relativePath:p.verify,label:"Workspace verify",required:false},{relativePath:p.snapshot,label:"Workspace model snapshot",required:false},{relativePath:p.diff,label:"Workspace model diff",required:false},{relativePath:p.explain,label:"Workspace explain",required:false},{relativePath:p.contractVerify,label:"Workspace contract verify",required:false},{relativePath:p.history,label:"Workspace intelligence history",required:false}];function wr(){let e=J.map(r=>r.relativePath),t=b$3().consumers.agents.canonicalReadOrder;return [...new Set(t.filter(r=>r!==X&&e.includes(r)))]}async function Ar(e){try{let{contract:t}=await p$1({workspacePath:e});if(t?.workspace?.name)return `workspace:${t.workspace.name}`}catch{}for(let t of [".workspai/workspace.json",".rapidkit/workspace.json"])try{let r=await h$1.readJson(s.join(e,t)),n=typeof r.workspace_name=="string"?r.workspace_name:typeof r.name=="string"?r.name:null;if(n?.trim())return `workspace:${n.trim()}`}catch{}return `workspace:${s.basename(s.resolve(e))}`}function P(e){return `npx workspai ${e}`.trim()}function rt(e){return e&&typeof e=="object"?e:null}function Ye(e,t=12){return Array.isArray(e)?e.filter(r=>typeof r=="string"&&r.trim().length>0).slice(0,t):[]}function yr(e){let t=Ye(e.blockers,12);if(t.length>0)return t;let r=Ye(e.blockingReasons,12);if(r.length>0)return r;let n=rt(e.summary);return n&&Array.isArray(n.blockingReasons)?Ye(n.blockingReasons,12):[]}function Rr(e){let t=[...new Set(e.map(r=>r.trim()).filter(Boolean))];return t.filter(r=>{let n=r.toLowerCase();return !t.some(i=>{if(i===r||!i.includes(":"))return false;let c=i.toLowerCase();return c.length>n.length&&c.endsWith(n)})})}function br(e){for(let t of ["generatedAt","updatedAt","timestamp"]){let r=e[t];if(typeof r=="string"&&r.trim())return r.trim()}if(Array.isArray(e.entries)){let t=e.entries.map(r=>rt(r)?.generatedAt).filter(r=>typeof r=="string"&&r.trim().length>0).map(r=>r.trim()).filter(r=>Number.isFinite(Date.parse(r)));if(t.length>0)return t.reduce((r,n)=>Date.parse(n)>Date.parse(r)?n:r)}}function Pr(e,t,r){if(!e)return true;let n=Date.parse(e);return Number.isFinite(n)?r.getTime()-n>t*60*60*1e3:true}function vr(e,t,r){return e.path===p.snapshot?false:Pr(e.generatedAt,t,r)}function Sr(e){let t=e&&e.length>0?e:["all"];return t.includes("all")?new Set(["all","vscode","agents","copilot","cursor","claude","codex","gemini","qwen","kimi","grok","windsurf","amazon-q","orca"]):new Set(t)}function b(e,t){return e.has("all")||e.has(t)}function Ft(e){return b(e,"copilot")||b(e,"vscode")}function Xe(e){return b(e,"agents")||b(e,"codex")||b(e,"kimi")||b(e,"grok")||b(e,"orca")}function Er(e,t){return t==="generic"?b(e,"agents"):t==="copilot"?Ft(e):t==="grok"?b(e,"grok")||b(e,"orca"):b(e,t)}function Ir(e){return e??"enterprise"}function Cr(e){return e===b$2?"skills-index":e.includes("workspace-explain-last-run.json")?"explain-report":(e.startsWith(`${a$3}/`)||e.startsWith(".rapidkit/skills/"))&&e.endsWith(".md")?"operational-skill":e.includes("hooks")||e===U||e===V?"hook":e.includes("mcp")||e===S||e===T?"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 xr(e){return e.startsWith(".github/")?["vscode","copilot"]:e.startsWith(".cursor/")?["cursor"]:e.startsWith(".claude/")||e==="CLAUDE.md"?["claude"]:e==="GEMINI.md"?["gemini"]:e==="QWEN.md"?["qwen"]:e.startsWith(".amazonq/")?["amazon-q"]:e===".windsurfrules"||e.startsWith(".windsurf/")?["windsurf"]:e.startsWith(".grok/")?["grok"]:e.startsWith(".agents/")?["agents","codex","kimi","grok","orca"]:e==="AGENTS.md"||e.startsWith(".rapidkit/")?["agents","codex","kimi","grok","copilot","cursor","claude","gemini","qwen","amazon-q","windsurf","orca","vscode"]:e.startsWith(".vscode/")?["vscode"]:["agents"]}function Dt(e){return [{target:"agents",path:`.agents/skills/${e}/SKILL.md`},{target:"copilot",path:`.github/skills/${e}/SKILL.md`},{target:"claude",path:`.claude/skills/${e}/SKILL.md`},{target:"cursor",path:`.cursor/skills/${e}/SKILL.md`},{target:"grok",path:`.grok/skills/${e}/SKILL.md`}]}async function Or(e,t){let r=s.join(e,t);!await h$1.pathExists(r)||!(await h$1.readFile(r,"utf8")).includes(B)||await h$1.remove(r);}function Tr(e,t){return $t().presets[t].requiredOutputs.includes(e)}async function _r(e,t){if(t)return t;let r=await g(e,l$2)??s.join(e,l$2);if(await h$1.pathExists(r))try{let n=await h$1.readJson(r);return b$6(l$2,n,r),n}catch{}return q$1({workspacePath:e,includeEvidence:true})}async function Wr(e,t){let r=await g(e,p.knowledgeGraph);if(!r)return null;try{let n=await h$1.readJson(r);b$6(p.knowledgeGraph,n,r);let i=n;return i.proofs.some(c=>c.freshness==="stale")?null:(b$7(i,t),i)}catch{return null}}function jr(e){return e.length>0&&!s.isAbsolute(e)&&!e.split(/[\\/]+/).includes("..")}function Nr(e){return Object.fromEntries(["all","vscode","agents","copilot","cursor","claude","codex","gemini","qwen","kimi","grok","windsurf","amazon-q","orca"].map(r=>[r,{enabled:e.targets.includes("all")||e.targets.includes(r),outputs:e.outputs.filter(n=>n.targets.includes(r)).map(n=>n.path).sort()}]))}async function Lr(e,t){try{if(!await h$1.pathExists(e))return {payload:null,exists:false,validity:"missing"};let r=await h$1.readJson(e),n=rt(r);return n?a$2(t)?(b$6(t,n,e),{payload:n,exists:true,validity:"valid"}):{payload:n,exists:true,validity:"uncontracted"}:{payload:null,exists:true,validity:"invalid",validationError:"Artifact root must be a JSON object"}}catch(r){return {payload:null,exists:true,validity:"invalid",validationError:r instanceof Error?r.message:String(r)}}}async function Kt(e){let t=e.now??new Date,r=e.staleAfterHours??24,n=[],i=[];for(let a of J){let k=await g(e.workspacePath,a.relativePath)??s.join(e.workspacePath,a.relativePath),l=await Lr(k,a.relativePath),p=l.payload;l.validity==="invalid"?i.push(`Invalid evidence contract: ${a.relativePath}`):p&&i.push(...yr(p)),n.push({path:a.relativePath,label:a.label,required:a.required,exists:l.exists,validity:l.validity,validationError:l.validationError,generatedAt:p?br(p):void 0,commandId:typeof p?.commandId=="string"?p.commandId:void 0,exitCode:typeof p?.exitCode=="number"?p.exitCode:void 0});}let c=Rr(i).slice(0,16),m=b$3();return {schemaVersion:kr,generatedAt:t.toISOString(),workspaceRoot:await Ar(e.workspacePath),intelligenceChain:{schemaVersion:m.schemaVersion,contractPath:m.contractPath,currentStep:"agent-sync"},readOrder:wr(),blockers:c,staleAfterHours:r,reports:n,refreshCommand:P("workspace agent-sync --write --refresh-context")}}function Gr(e){let t$1=["# Workspai agent grounding","","Cross-tool instructions for Copilot, Cursor, Claude Code, Codex, Grok, and other agents.","","## Read order (mandatory before workspace diagnosis)","",`1. \`${p.agentIndex}\` \u2014 latest blockers, timestamps, and report paths`,`2. \`${t.goalIndex}\` \u2014 when present, read the active Goal Pack and its handoff before choosing work.`,`3. \`${p.agentContext}\` \u2014 read only task-relevant context`,`4. \`${p.skillsIndex}\` \u2014 select only the Skill that matches the task.`,"5. Read only the task-relevant evidence artifacts listed in the index.","6. Use the Goal Pack retrieval queries, `workspace graph search <query> --limit 12 --json`, or MCP `searchWorkspaceGraph` before loading the full graph.","","Do **not** full-repo scan or inject the complete graph when a bounded query can answer the task.","","## Proof-carrying mutations","","For source-changing work, use the active Goal Pack command `beginChange` before the first mutation.","Prediction is planning input, never proof. Execute only explicitly authorized effect classes, record typed effect receipts, then run `workspai change verify --change <id> --json`.","A task is not complete until its capsule is sealed or its remaining uncertainty is reported.","","## Regenerate intelligence","","```bash",P("workspace agent-sync --write --refresh-context"),P("workspace context --for-agent --json --write"),P("pipeline --json --write"),"```",""];if(e.index.blockers.length>0){t$1.push("## Current blockers","");for(let r of e.index.blockers.slice(0,12))t$1.push(`- ${r}`);t$1.push("");}if(e.context?.safeCommands?.length){t$1.push("## Safe commands (prefer these)","");for(let r of e.context.safeCommands.slice(0,10))t$1.push(`- \`${r.display}\` \u2014 ${r.description}`);t$1.push("");}return t$1.push("## Rules","","- Treat `.workspai/reports/*` as the source of truth for health, gates, and release posture.","- Prefer deterministic Workspai 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.","- Never claim that an active goal is satisfied until its CLI-owned verification lifecycle is `verified`.",""),t$1.join(`
|
|
8
|
+
`,"utf8"),r.push(i);}return r}var fr="workspai-agent-customization-pack-capabilities.v1";function $t(){return {schemaVersion:fr,presets:{minimal:{meaning:"Generate the portable grounding index, AGENTS.md, and provider-specific lightweight instructions.",requiredOutputs:[p.agentIndex,p.agentCustomizationPack,p.agents]},enterprise:{meaning:"Generate the full VS Code-native pack: instructions, prompts, skills, custom agents, and validation metadata.",requiredOutputs:[p.agentIndex,p.agentCustomizationPack,p.agents,w,A,M,".github/agents/workspai-advisor.agent.md",S,b$2]}},targets:{all:{meaning:"Generate every supported customization surface.",outputFamilies:["portable","vscode","copilot","cursor","claude","gemini","qwen","kimi","grok","windsurf","amazon-q"]},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 and .agents/skills projections.",outputFamilies:["portable","skills"]},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"]},gemini:{meaning:"Generate Gemini CLI grounding through GEMINI.md and canonical AGENTS.md.",outputFamilies:["adapter","portable"]},qwen:{meaning:"Generate Qwen Code grounding through QWEN.md and canonical AGENTS.md.",outputFamilies:["adapter","portable"]},kimi:{meaning:"Use AGENTS.md and the report index as the Kimi Code grounding layer.",outputFamilies:["portable"]},grok:{meaning:"Use AGENTS.md and the report index as the xAI Grok grounding layer.",outputFamilies:["portable"]},windsurf:{meaning:"Use AGENTS.md and the report index as the Windsurf grounding layer.",outputFamilies:["portable"]},"amazon-q":{meaning:"Generate an Amazon Q project rule that routes agents to canonical evidence.",outputFamilies:["rules","portable"]},orca:{meaning:"Legacy compatibility alias for AGENTS.md consumers; prefer the grok target.",outputFamilies:["portable"]}},standardAnswerContract:[...pe],requiredReports:J.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:[".workspai/reports/",`${a$3}/`],l2PrefixedMirrorRoots:[".agents/",".github/",".cursor/",".claude/",".amazonq/"],l3SharedIndustryFiles:["AGENTS.md",".github/copilot-instructions.md","CLAUDE.md","GEMINI.md","QWEN.md"]}}}var kr=q.agentIndex,hr=q.agentCustomizationPack,X=p.agentIndex,Y=p.agentCustomizationPack;var J=[{relativePath:t.goalIndex,label:"Active Goal Pack index",required:false},{relativePath:t.goalPackLastRun,label:"Latest governed Goal Pack",required:false},{relativePath:b$1,label:"Agent context pack",required:true},{relativePath:b$2,label:"Operational skills index",required:true},{relativePath:p.model,label:"Workspace model",required:false},{relativePath:p.knowledgeGraph,label:"Workspace knowledge graph",required:false},{relativePath:p.evaluationLastRun,label:"Workspace Intelligence evaluation",required:false},{relativePath:p.doctor,label:"Workspace doctor",required:false},{relativePath:t.doctorProject,label:"Project doctor",required:false},{relativePath:t.doctorRemediationPlan,label:"Doctor remediation plan",required:false},{relativePath:t.artifactRemediationPlan,label:"Artifact remediation plan",required:false},{relativePath:t.doctorFixResult,label:"Doctor fix result",required:false},{relativePath:p.analyze,label:"Workspace analyze",required:false},{relativePath:t.pipelineLastRun,label:"Governance pipeline",required:false},{relativePath:p.readiness,label:"Release readiness",required:false},{relativePath:p.impact,label:"Workspace impact",required:false},{relativePath:p.verify,label:"Workspace verify",required:false},{relativePath:p.snapshot,label:"Workspace model snapshot",required:false},{relativePath:p.diff,label:"Workspace model diff",required:false},{relativePath:p.explain,label:"Workspace explain",required:false},{relativePath:p.contractVerify,label:"Workspace contract verify",required:false},{relativePath:p.history,label:"Workspace intelligence history",required:false}];function wr(){let e=J.map(r=>r.relativePath),t=b$3().consumers.agents.canonicalReadOrder;return [...new Set(t.filter(r=>r!==X&&e.includes(r)))]}async function Ar(e){try{let{contract:t}=await p$1({workspacePath:e});if(t?.workspace?.name)return `workspace:${t.workspace.name}`}catch{}for(let t of [".workspai/workspace.json",".rapidkit/workspace.json"])try{let r=await h$1.readJson(s.join(e,t)),n=typeof r.workspace_name=="string"?r.workspace_name:typeof r.name=="string"?r.name:null;if(n?.trim())return `workspace:${n.trim()}`}catch{}return `workspace:${s.basename(s.resolve(e))}`}function P(e){return `npx workspai ${e}`.trim()}function rt(e){return e&&typeof e=="object"?e:null}function Ye(e,t=12){return Array.isArray(e)?e.filter(r=>typeof r=="string"&&r.trim().length>0).slice(0,t):[]}function yr(e){let t=Ye(e.blockers,12);if(t.length>0)return t;let r=Ye(e.blockingReasons,12);if(r.length>0)return r;let n=rt(e.summary);return n&&Array.isArray(n.blockingReasons)?Ye(n.blockingReasons,12):[]}function Rr(e){let t=[...new Set(e.map(r=>r.trim()).filter(Boolean))];return t.filter(r=>{let n=r.toLowerCase();return !t.some(i=>{if(i===r||!i.includes(":"))return false;let c=i.toLowerCase();return c.length>n.length&&c.endsWith(n)})})}function br(e){for(let t of ["generatedAt","updatedAt","timestamp"]){let r=e[t];if(typeof r=="string"&&r.trim())return r.trim()}if(Array.isArray(e.entries)){let t=e.entries.map(r=>rt(r)?.generatedAt).filter(r=>typeof r=="string"&&r.trim().length>0).map(r=>r.trim()).filter(r=>Number.isFinite(Date.parse(r)));if(t.length>0)return t.reduce((r,n)=>Date.parse(n)>Date.parse(r)?n:r)}}function Pr(e,t,r){if(!e)return true;let n=Date.parse(e);return Number.isFinite(n)?r.getTime()-n>t*60*60*1e3:true}function vr(e,t,r){return e.path===p.snapshot?false:Pr(e.generatedAt,t,r)}function Sr(e){let t=e&&e.length>0?e:["all"];return t.includes("all")?new Set(["all","vscode","agents","copilot","cursor","claude","codex","gemini","qwen","kimi","grok","windsurf","amazon-q","orca"]):new Set(t)}function b(e,t){return e.has("all")||e.has(t)}function Ft(e){return b(e,"copilot")||b(e,"vscode")}function Xe(e){return b(e,"agents")||b(e,"codex")||b(e,"kimi")||b(e,"grok")||b(e,"orca")}function Er(e,t){return t==="generic"?b(e,"agents"):t==="copilot"?Ft(e):t==="grok"?b(e,"grok")||b(e,"orca"):b(e,t)}function Ir(e){return e??"enterprise"}function Cr(e){return e===b$2?"skills-index":e.includes("workspace-explain-last-run.json")?"explain-report":(e.startsWith(`${a$3}/`)||e.startsWith(".rapidkit/skills/"))&&e.endsWith(".md")?"operational-skill":e.includes("hooks")||e===U||e===V?"hook":e.includes("mcp")||e===S||e===T?"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 xr(e){return e.startsWith(".github/")?["vscode","copilot"]:e.startsWith(".cursor/")?["cursor"]:e.startsWith(".claude/")||e==="CLAUDE.md"?["claude"]:e==="GEMINI.md"?["gemini"]:e==="QWEN.md"?["qwen"]:e.startsWith(".amazonq/")?["amazon-q"]:e===".windsurfrules"||e.startsWith(".windsurf/")?["windsurf"]:e.startsWith(".grok/")?["grok"]:e.startsWith(".agents/")?["agents","codex","kimi","grok","orca"]:e==="AGENTS.md"||e.startsWith(".rapidkit/")?["agents","codex","kimi","grok","copilot","cursor","claude","gemini","qwen","amazon-q","windsurf","orca","vscode"]:e.startsWith(".vscode/")?["vscode"]:["agents"]}function Dt(e){return [{target:"agents",path:`.agents/skills/${e}/SKILL.md`},{target:"copilot",path:`.github/skills/${e}/SKILL.md`},{target:"claude",path:`.claude/skills/${e}/SKILL.md`},{target:"cursor",path:`.cursor/skills/${e}/SKILL.md`},{target:"grok",path:`.grok/skills/${e}/SKILL.md`}]}async function Or(e,t){let r=s.join(e,t);!await h$1.pathExists(r)||!(await h$1.readFile(r,"utf8")).includes(B)||await h$1.remove(r);}function Tr(e,t){return $t().presets[t].requiredOutputs.includes(e)}async function _r(e,t){if(t)return t;let r$1=await g(e,m$2)??s.join(e,m$2);if(await h$1.pathExists(r$1))try{let n=await h$1.readJson(r$1);return b$6(m$2,n,r$1),n}catch{}return r({workspacePath:e,includeEvidence:true})}async function Wr(e,t){let r=await g(e,p.knowledgeGraph);if(!r)return null;try{let n=await h$1.readJson(r);b$6(p.knowledgeGraph,n,r);let i=n;return i.proofs.some(c=>c.freshness==="stale")?null:(b$7(i,t),i)}catch{return null}}function jr(e){return e.length>0&&!s.isAbsolute(e)&&!e.split(/[\\/]+/).includes("..")}function Nr(e){return Object.fromEntries(["all","vscode","agents","copilot","cursor","claude","codex","gemini","qwen","kimi","grok","windsurf","amazon-q","orca"].map(r=>[r,{enabled:e.targets.includes("all")||e.targets.includes(r),outputs:e.outputs.filter(n=>n.targets.includes(r)).map(n=>n.path).sort()}]))}async function Lr(e,t){try{if(!await h$1.pathExists(e))return {payload:null,exists:false,validity:"missing"};let r=await h$1.readJson(e),n=rt(r);return n?a$2(t)?(b$6(t,n,e),{payload:n,exists:true,validity:"valid"}):{payload:n,exists:true,validity:"uncontracted"}:{payload:null,exists:true,validity:"invalid",validationError:"Artifact root must be a JSON object"}}catch(r){return {payload:null,exists:true,validity:"invalid",validationError:r instanceof Error?r.message:String(r)}}}async function Kt(e){let t=e.now??new Date,r=e.staleAfterHours??24,n=[],i=[];for(let a of J){let k=await g(e.workspacePath,a.relativePath)??s.join(e.workspacePath,a.relativePath),l=await Lr(k,a.relativePath),p=l.payload;l.validity==="invalid"?i.push(`Invalid evidence contract: ${a.relativePath}`):p&&i.push(...yr(p)),n.push({path:a.relativePath,label:a.label,required:a.required,exists:l.exists,validity:l.validity,validationError:l.validationError,generatedAt:p?br(p):void 0,commandId:typeof p?.commandId=="string"?p.commandId:void 0,exitCode:typeof p?.exitCode=="number"?p.exitCode:void 0});}let c=Rr(i).slice(0,16),m=b$3();return {schemaVersion:kr,generatedAt:t.toISOString(),workspaceRoot:await Ar(e.workspacePath),intelligenceChain:{schemaVersion:m.schemaVersion,contractPath:m.contractPath,currentStep:"agent-sync"},readOrder:wr(),blockers:c,staleAfterHours:r,reports:n,refreshCommand:P("workspace agent-sync --write --refresh-context")}}function Gr(e){let t$1=["# Workspai agent grounding","","Cross-tool instructions for Copilot, Cursor, Claude Code, Codex, Grok, and other agents.","","## Read order (mandatory before workspace diagnosis)","",`1. \`${p.agentIndex}\` \u2014 latest blockers, timestamps, and report paths`,`2. \`${t.goalIndex}\` \u2014 when present, read the active Goal Pack and its handoff before choosing work.`,`3. \`${p.agentContext}\` \u2014 read only task-relevant context`,`4. \`${p.skillsIndex}\` \u2014 select only the Skill that matches the task.`,"5. Read only the task-relevant evidence artifacts listed in the index.","6. Use the Goal Pack retrieval queries, `workspace graph search <query> --limit 12 --json`, or MCP `searchWorkspaceGraph` before loading the full graph.","","Do **not** full-repo scan or inject the complete graph when a bounded query can answer the task.","","## Proof-carrying mutations","","For source-changing work, use the active Goal Pack command `beginChange` before the first mutation.","Prediction is planning input, never proof. Execute only explicitly authorized effect classes, record typed effect receipts, then run `workspai change verify --change <id> --json`.","A task is not complete until its capsule is sealed or its remaining uncertainty is reported.","","## Regenerate intelligence","","```bash",P("workspace agent-sync --write --refresh-context"),P("workspace context --for-agent --json --write"),P("pipeline --json --write"),"```",""];if(e.index.blockers.length>0){t$1.push("## Current blockers","");for(let r of e.index.blockers.slice(0,12))t$1.push(`- ${r}`);t$1.push("");}if(e.context?.safeCommands?.length){t$1.push("## Safe commands (prefer these)","");for(let r of e.context.safeCommands.slice(0,10))t$1.push(`- \`${r.display}\` \u2014 ${r.description}`);t$1.push("");}return t$1.push("## Rules","","- Treat `.workspai/reports/*` as the source of truth for health, gates, and release posture.","- Prefer deterministic Workspai 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.","- Never claim that an active goal is satisfied until its CLI-owned verification lifecycle is `verified`.",""),t$1.join(`
|
|
9
9
|
`)}function $r(e){return ["# Workspai agent grounding","",`Generated: ${e.generatedAt}`,"",`This file is tool-agnostic. Synced agents should read it together with \`${p.agentIndex}\`.`,"","## 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
10
|
`)}function Dr(){return ["# Workspai workspace grounding","","Before answering workspace, release, or architecture questions:","","1. Read `AGENTS.md` (managed Workspai section).",`2. Read \`${p.agentIndex}\` and only task-relevant context from \`${p.agentContext}\`.`,"3. Use bounded `workspace graph search` or MCP `searchWorkspaceGraph` before scanning the full repository.","","Regenerate stale intelligence:","","```bash",P("workspace agent-sync --write --refresh-context"),"```",""].join(`
|
|
11
11
|
`)}function Kr(){return ["## Claude Code","",`- Load \`${p.agentIndex}\` before diagnosing blockers.`,"- Use `.claude/rules/workspai-evidence.md` for scoped Workspai evidence rules.","- Treat `.claude/rules/rapidkit-evidence.md` as a legacy compatibility mirror.","- Refresh grounding with `npx workspai workspace agent-sync --write`.",""].join(`
|
|
@@ -38,12 +38,12 @@ ${a}`;e.write&&await h$1.writeFile(c,`${k.trimEnd()}
|
|
|
38
38
|
|
|
39
39
|
${n}`:n;return await h$1.ensureDir(s.dirname(e.absolutePath)),await h$1.writeFile(e.absolutePath,i,"utf8"),"written"}async function et(e){if(!e.write)return "skipped";await fe(e.workspacePath,e.absolutePath);let t=await h$1.pathExists(e.absolutePath)?await h$1.readFile(e.absolutePath,"utf8"):"",{upsertManagedAgentSection:r}=await import('./managed-agent-markers-COE5DJ3W.js'),n=r(t,e.generatedBody),i=n.includes(e.importLine)?n:`${e.importLine}
|
|
40
40
|
|
|
41
|
-
${n}`;return await h$1.ensureDir(s.dirname(e.absolutePath)),await h$1.writeFile(e.absolutePath,i,"utf8"),"written"}async function fe(e,t){let r=s.resolve(e),n=await h$1.realpath(r).catch(()=>r),i=s.resolve(t),c=s.relative(r,i);if(!c||c===".."||c.startsWith(`..${s.sep}`)||s.isAbsolute(c))throw new Error("Agent output path must remain inside the canonical workspace.");let m=c.split(s.sep),a=r;for(let[k,l]of m.entries()){a=s.join(a,l);let p=await h$1.lstat(a).catch(R=>{if(R.code==="ENOENT")return null;throw R});if(!p)return s.join(a,...m.slice(k+1));let d=k===m.length-1;if(p.isSymbolicLink()){if(d)throw new Error(`Agent output path is blocked by authored repository state: ${c}`);let R=await h$1.realpath(a),w=s.relative(n,R),I=w!==".."&&!w.startsWith(`..${s.sep}`)&&!s.isAbsolute(w),K=await h$1.stat(R);if(!I||!K.isDirectory())throw new Error(`Agent output path is blocked by authored repository state: ${c}`);a=R;continue}if(d?!p.isFile():!p.isDirectory())throw new Error(`Agent output path is blocked by authored repository state: ${c}`)}return a}function aa(e){if(!e?.trim())return;let t=new Set(["all","vscode","agents","copilot","cursor","claude","codex","gemini","qwen","kimi","grok","windsurf","amazon-q","orca"]),r=e.split(",").map(n=>n.trim().toLowerCase()).filter(n=>t.has(n));return r.length>0?r:void 0}function cn(e){let t=[...e.outputs].sort((n,i)=>n.path.localeCompare(i.path)),r=b$3();return {schemaVersion:hr,generatedAt:e.generatedAt,workspaceRoot:e.workspaceRef,preset:e.preset,targets:[...e.targets].sort(),sourceReports:e.index.reports.filter(n=>n.exists).map(n=>n.path).sort(),intelligenceChain:{schemaVersion:r.schemaVersion,contractPath:r.contractPath,currentStep:"agent-sync"},outputInventory:t,capabilityMatrix:Nr({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:P(`workspace agent-sync --write --refresh-context --preset ${e.preset}`),experimental:{hooksEnabled:e.experimentalHooks,mcpReady:t.some(n=>n.kind==="mcp-design")}}}async function tt(e){let t=s.resolve(e.workspacePath),r$
|
|
41
|
+
${n}`;return await h$1.ensureDir(s.dirname(e.absolutePath)),await h$1.writeFile(e.absolutePath,i,"utf8"),"written"}async function fe(e,t){let r=s.resolve(e),n=await h$1.realpath(r).catch(()=>r),i=s.resolve(t),c=s.relative(r,i);if(!c||c===".."||c.startsWith(`..${s.sep}`)||s.isAbsolute(c))throw new Error("Agent output path must remain inside the canonical workspace.");let m=c.split(s.sep),a=r;for(let[k,l]of m.entries()){a=s.join(a,l);let p=await h$1.lstat(a).catch(R=>{if(R.code==="ENOENT")return null;throw R});if(!p)return s.join(a,...m.slice(k+1));let d=k===m.length-1;if(p.isSymbolicLink()){if(d)throw new Error(`Agent output path is blocked by authored repository state: ${c}`);let R=await h$1.realpath(a),w=s.relative(n,R),I=w!==".."&&!w.startsWith(`..${s.sep}`)&&!s.isAbsolute(w),K=await h$1.stat(R);if(!I||!K.isDirectory())throw new Error(`Agent output path is blocked by authored repository state: ${c}`);a=R;continue}if(d?!p.isFile():!p.isDirectory())throw new Error(`Agent output path is blocked by authored repository state: ${c}`)}return a}function aa(e){if(!e?.trim())return;let t=new Set(["all","vscode","agents","copilot","cursor","claude","codex","gemini","qwen","kimi","grok","windsurf","amazon-q","orca"]),r=e.split(",").map(n=>n.trim().toLowerCase()).filter(n=>t.has(n));return r.length>0?r:void 0}function cn(e){let t=[...e.outputs].sort((n,i)=>n.path.localeCompare(i.path)),r=b$3();return {schemaVersion:hr,generatedAt:e.generatedAt,workspaceRoot:e.workspaceRef,preset:e.preset,targets:[...e.targets].sort(),sourceReports:e.index.reports.filter(n=>n.exists).map(n=>n.path).sort(),intelligenceChain:{schemaVersion:r.schemaVersion,contractPath:r.contractPath,currentStep:"agent-sync"},outputInventory:t,capabilityMatrix:Nr({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:P(`workspace agent-sync --write --refresh-context --preset ${e.preset}`),experimental:{hooksEnabled:e.experimentalHooks,mcpReady:t.some(n=>n.kind==="mcp-design")}}}async function tt(e){let t=s.resolve(e.workspacePath),r$2=e.now??new Date,n$1=e.staleAfterHours??24,i$1=Sr(e.targets),c$1=[...i$1].sort(),m=Ir(e.preset),a=e.write===true,k$1=e.strict===true,l$2,p=null,d$1=e.model;e.refreshContext&&(d$1??=await r({workspacePath:t,includeEvidence:true}),p=await c({workspacePath:t,model:d$1,agent:e.agent??"generic",scope:e.scope,includeEvidence:true}),a&&(l$2=await d(p,t)));let R$1=[],w$1=[],I$1=[],K$1=[],g=(u,A)=>{u==="written"?w$1.push(A):I$1.push(A),K$1.push({path:A,kind:Cr(A),targets:xr(A),required:Tr(A,m),status:u==="written"?"written":e.dryRun?"planned":"skipped"});},ke="",T$1=await _r(t,d$1),he=null;try{he=(await p$1({workspacePath:t})).contract;}catch{he=null;}let Vt=await Wr(t,T$1),at=jt({model:T$1,context:p,contract:he,graph:Vt}),zt=at.skills,Q$1=await Nt({workspacePath:t,skills:zt,generatedAt:r$2.toISOString(),write:a,decisions:at.decisions});for(let u of Q$1.skills){g(a?"written":"skipped",u.canonicalPath);for(let A of Dt(u.skillId))(A.target==="agents"?!Xe(i$1):!b(i$1,A.target))||g(await Ut({workspacePath:t,relativePath:A.path,content:u.markdown,write:a}),A.path);}for(let u of Q$1.removedSkillIds)for(let A of Dt(u))!(A.target==="agents"?Xe(i$1):b(i$1,A.target))||!a||await Or(t,A.path);g(a?"written":"skipped",b$2),ke=Lt(Q$1.index);let v$1=await Kt({workspacePath:t,staleAfterHours:n$1,now:r$2});if(g(await f(s.join(t,X),`${JSON.stringify(v$1,null,2)}
|
|
42
42
|
`,a),X),g(await f(s.join(t,f$2),`${$r(v$1)}
|
|
43
43
|
`,a),f$2),["agents","vscode","copilot","cursor","claude","codex","gemini","qwen","kimi","grok","windsurf","amazon-q","orca"].some(u=>b(i$1,u))&&g(await Ze({workspacePath:t,absolutePath:s.join(t,"AGENTS.md"),generatedBody:Gr({index:v$1,context:p}),write:a}),"AGENTS.md"),b(i$1,"claude")){let u$1=s.join(t,"CLAUDE.md");if(a){await fe(t,u$1);let{upsertManagedAgentSection:A}=await import('./managed-agent-markers-COE5DJ3W.js'),y=await h$1.pathExists(u$1)?await h$1.readFile(u$1,"utf8"):"",E=A(y,Kr()),_=E.includes("@AGENTS.md")?E:`@AGENTS.md
|
|
44
44
|
|
|
45
45
|
${E}`;await h$1.ensureDir(s.dirname(u$1)),await h$1.writeFile(u$1,_,"utf8"),w$1.push("CLAUDE.md");}else I$1.push("CLAUDE.md");g(await f(s.join(t,s$1),`${tn()}
|
|
46
46
|
`,a),s$1),g(await f(s.join(t,t$1),`${Qr()}
|
|
47
47
|
`,a),t$1),g(await f(s.join(t,u),`${rn()}
|
|
48
|
-
`,a),u),g(await f(s.join(t,P$1),$({index:v$1,context:p,model:T$1}),a),P$1);}if(b(i$1,"gemini")&&g(await et({workspacePath:t,absolutePath:s.join(t,"GEMINI.md"),importLine:"@./AGENTS.md",generatedBody:Qe("Gemini CLI"),write:a}),"GEMINI.md"),b(i$1,"qwen")&&g(await et({workspacePath:t,absolutePath:s.join(t,"QWEN.md"),importLine:"@AGENTS.md",generatedBody:Qe("Qwen Code"),write:a}),"QWEN.md"),b(i$1,"amazon-q")&&(g(await et({workspacePath:t,absolutePath:s.join(t,".amazonq/rules/workspai-agent-entry.md"),importLine:"@../../AGENTS.md",generatedBody:Qe("Amazon Q Developer"),write:a}),".amazonq/rules/workspai-agent-entry.md"),g(await f(s.join(t,v),Yr(),a),v)),b(i$1,"grok")&&(g(await f(s.join(t,q$
|
|
48
|
+
`,a),u),g(await f(s.join(t,P$1),$({index:v$1,context:p,model:T$1}),a),P$1);}if(b(i$1,"gemini")&&g(await et({workspacePath:t,absolutePath:s.join(t,"GEMINI.md"),importLine:"@./AGENTS.md",generatedBody:Qe("Gemini CLI"),write:a}),"GEMINI.md"),b(i$1,"qwen")&&g(await et({workspacePath:t,absolutePath:s.join(t,"QWEN.md"),importLine:"@AGENTS.md",generatedBody:Qe("Qwen Code"),write:a}),"QWEN.md"),b(i$1,"amazon-q")&&(g(await et({workspacePath:t,absolutePath:s.join(t,".amazonq/rules/workspai-agent-entry.md"),importLine:"@../../AGENTS.md",generatedBody:Qe("Amazon Q Developer"),write:a}),".amazonq/rules/workspai-agent-entry.md"),g(await f(s.join(t,v),Yr(),a),v)),b(i$1,"grok")&&(g(await f(s.join(t,q$1),Br(),a),q$1),g(await f(s.join(t,r$1),Jr(),a),r$1),g(await f(s.join(t,R),$({index:v$1,context:p,model:T$1}),a),R)),Xe(i$1)&&g(await Ut({workspacePath:t,relativePath:Q,content:$({index:v$1,context:p,model:T$1}),write:a}),Q),b(i$1,"windsurf")&&(g(await Ze({workspacePath:t,absolutePath:s.join(t,n),generatedBody:Xr(),write:a}),n),g(await f(s.join(t,o),Vr(),a),o),g(await f(s.join(t,p$2),zr(),a),p$2)),b(i$1,"cursor")&&(g(await f(s.join(t,h$2),qr(),a),h$2),g(await f(s.join(t,i),Mr(),a),i),g(await f(s.join(t,m$1),nn(),a),m$1),m==="enterprise"&&(g(await f(s.join(t,j),Hr(),a),j),g(await f(s.join(t,k),Ur(),a),k),g(await f(s.join(t,l),Fr(),a),l)),g(await f(s.join(t,O),$({index:v$1,context:p,model:T$1}),a),O)),Ft(i$1)){if(g(await Ze({workspacePath:t,absolutePath:s.join(t,".github/copilot-instructions.md"),generatedBody:Dr(),write:a}),".github/copilot-instructions.md"),g(await f(s.join(t,w),en(),a),w),g(await f(s.join(t,x),qt("workspace"),a),x),g(await f(s.join(t,y),Zr(),a),y),g(await f(s.join(t,z$1),qt("evidence"),a),z$1),g(await f(s.join(t,A),Mt(),a),A),g(await f(s.join(t,B$1),Mt(),a),B$1),m==="enterprise"){let u=[[C,ge({description:"Repair Workspai blockers with evidence and verification",objective:"Plan the smallest safe repair for the current Workspai 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"]})],[E,ge({description:"Assess Workspai release readiness from evidence",objective:"Assess whether this workspace is release-ready using Workspai gates.",expectedOutput:["Readiness verdict with cited reports","Blocking gates","Safe next command","Verification checklist"]})],[G,ge({description:"Onboard a project into Workspai Workspace Intelligence",objective:"Guide project onboarding using workspace model and create planner capabilities.",expectedOutput:["Target project scope","Native create, official generator, or existing lane","Safe commands","Post-onboarding verification"]})],[I,ge({description:"Adopt an existing project into Workspai 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[y,E]of u)g(await f(s.join(t,y),E,a),y);let A=[[D$1,u[0][1]],[F,u[1][1]],[H,u[2][1]],[J$1,u[3][1]]];for(let[y,E]of A)g(await f(s.join(t,y),E,a),y);if(e.hydratePrompts===true)for(let y of await Gt({workspacePath:t,skills:Q$1.skills,write:a}))g(a?"written":"skipped",y);}if(g(await f(s.join(t,K),$({index:v$1,context:p,model:T$1}),a),K),g(await f(s.join(t,L),$({index:v$1,context:p,model:T$1}),a),L),m==="enterprise"){g(await f(s.join(t,M),Ht(ke),a),M),g(await f(s.join(t,N),Ht(ke),a),N);let u=[["artifact-map.md",D({title:"Artifact Map",lines:J.map(y=>`- \`${y.relativePath}\` \u2014 ${y.label}`)})],["command-map.md",D({title:"Command Map",lines:["- `npx workspai workspace agent-sync --write --refresh-context` \u2014 refresh agent grounding.","- `npx workspai workspace model --json --write` \u2014 refresh workspace model.","- `npx workspai doctor workspace` \u2014 refresh health evidence.","- `npx workspai workspace verify --strict --json` \u2014 verify release gates."]})],["scope-model.md",D({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",D({title:"Runtime Support",lines:["- Native create is available only for Workspai-owned scaffold contracts.","- Unsupported stacks should use the official lane when a stable ecosystem generator exists.","- Existing projects should use the existing lane when native create is unavailable."]})],["create-planner-capabilities.md",D({title:"Create Planner Capabilities",lines:["- Use `contracts/create-planner-capabilities.v1.json` to decide native, official, or existing.","- 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",an()]];for(let[y,E]of u){let _=`${s.dirname(M)}/resources/${y}`;g(await f(s.join(t,_),E,a),_);let it=`${s.dirname(N)}/resources/${y}`;g(await f(s.join(t,it),E,a),it);}let A=[["workspai-advisor.agent.md",me({name:"Workspai Advisor",description:"Read-only workspace and project guidance using Workspai evidence",mode:"read-only",tools:["search","read"]})],["workspai-repair.agent.md",me({name:"Workspai Repair",description:"Turn Workspai blockers into minimal fixes and verification steps",mode:"repair",tools:["search","read","edit"]})],["workspai-release.agent.md",me({name:"Workspai Release",description:"Assess readiness, governance gates, and release safety from evidence",mode:"release",tools:["search","read"]})],["workspai-project-onboarder.agent.md",me({name:"Workspai Project Onboarder",description:"Guide create, import, and adopt flows with Workspai contracts",mode:"onboard",tools:["search","read","edit"]})]];for(let[y,E]of A){let _=`.github/agents/${y}`;g(await f(s.join(t,_),E,a),_);}}}if(m==="enterprise"){let u=on({workspaceRef:v$1.workspaceRoot,generatedAt:v$1.generatedAt});b$6(S,JSON.parse(u)),g(await f(s.join(t,S),u,a),S),g(await f(s.join(t,T),u,a),T);}if(m==="enterprise"&&e.experimentalHooks===true){let u=sn({workspaceRef:v$1.workspaceRoot,generatedAt:v$1.generatedAt});b$6(U,JSON.parse(u)),g(await f(s.join(t,U),u,a),U),g(await f(s.join(t,V),u,a),V);}let Z=a?await Kt({workspacePath:t,staleAfterHours:n$1,now:r$2}):v$1,ee=Z.reports.filter(u=>u.required&&!u.exists).map(u=>u.path),te=Z.reports.filter(u=>u.exists&&vr(u,n$1,r$2)).map(u=>u.path);if(k$1){ee.length>0&&R$1.push(`Missing required reports: ${ee.join(", ")}`),te.length>0&&R$1.push(`Stale reports (>${n$1}h): ${te.join(", ")}`);let u=K$1.map(A=>A.path).filter(A=>!jr(A));u.length>0&&R$1.push(`Unsafe generated output paths: ${u.join(", ")}`);}let N$1=a?await l$1({workspacePath:t,mode:e.projectGrounding??"managed",now:r$2}):void 0;if(k$1&&N$1&&N$1.skipped.length>0&&R$1.push(`Project grounding incomplete: ${N$1.skipped.map(u=>`${u.name} (${u.reason})`).join(", ")}`),k$1&&N$1){let u=N$1.projects.flatMap(A=>(A.hostCoverage??[]).filter(y=>y.status==="blocked"&&Er(i$1,y.id)).map(y=>`${s.basename(A.projectPath)}:${y.id}`));u.length>0&&R$1.push(`Project agent entry coverage blocked: ${u.join(", ")}`);}let ot=cn({workspaceRef:Z.workspaceRoot,generatedAt:r$2.toISOString(),preset:m,targets:c$1,index:Z,outputs:[...K$1,{path:Y,kind:"report",targets:["agents","vscode","copilot","cursor","claude","codex","gemini","qwen","kimi","grok","windsurf","amazon-q","orca"],required:true,status:a?"written":e.dryRun?"planned":"skipped"}],missingRequired:ee,staleReports:te,strictViolations:R$1,experimentalHooks:e.experimentalHooks===true});if(a&&process.env.WORKSPAI_TEST_FAIL_AGENT_SYNC_BEFORE_PACK==="1")throw new Error("Injected agent-sync failure before generation commit.");return g(await f(s.join(t,Y),`${JSON.stringify(ot,null,2)}
|
|
49
49
|
`,a),Y),{workspacePath:t,indexPath:s.join(t,X),packPath:s.join(t,Y),pack:ot,contextPath:l$2,writtenFiles:w$1,skippedFiles:I$1,blockers:v$1.blockers,missingRequired:ee,staleReports:te,strictViolations:R$1,projectLenses:N$1}}async function oa(e){if(e.write!==true)return tt(e);let t=s.resolve(e.workspacePath),r=s.join(t,".workspai","transactions","agent-sync");await b$4(r);let n=await tt({...e,write:false,dryRun:true});if(!n.pack)throw new Error("Agent-sync dry run did not produce an output inventory.");let i=[...n.pack.outputInventory.map(m=>m.path),X,Y],c=await a({journalDirectory:r});try{for(let l of [...new Set(i)].sort()){let p=s.resolve(t,l),d=s.relative(t,p);if(d===".."||d.startsWith(`..${s.sep}`)||s.isAbsolute(d))throw new Error(`Agent-sync output escapes workspace root: ${l}`);await c.captureFile(p);}let m$1=await m(t),a=new Set;for(let l of m$1.resolved)for(let p of [f$1,g$1,h,b$5,...g$2,"AGENTS.md",".gitignore"]){let d=s.join(l.projectPath,p);if((p==="AGENTS.md"||g$2.some(w=>w===p))&&(await h$1.lstat(d).catch(I=>{if(I.code==="ENOENT")return null;throw I}))?.isSymbolicLink()){let I=await a$1(l.projectPath,d);if(!I)continue;d=I;}a.has(d)||(await c.captureFile(d),a.add(d));}let k=await tt(e);return await c.commit(),k}catch(m){try{await c.rollback();}catch(a){throw new AggregateError([m,a],"Agent-sync generation failed and rollback was incomplete.")}throw m}}export{Jt as a,Xt as b,fr as c,kr as d,hr as e,X as f,Y as g,J as h,wr as i,Kt as j,aa as k,oa as l};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {b}from'./chunk-
|
|
1
|
+
import {b}from'./chunk-VN2MKTQO.js';import {d}from'./chunk-25AWHAB5.js';import {w,x as x$1}from'./chunk-VQZ5PI5J.js';import {t}from'./chunk-ODK4LCEL.js';import s from'path';import {randomUUID}from'crypto';import {open,link,copyFile}from'fs/promises';import f from'fs-extra';function N(e,t){let n=s.resolve(e),r=t.trim();if(!r||s.isAbsolute(r))throw new Error(`Workspace artifact path must be non-empty and relative: ${t}`);let l=s.resolve(n,r),o=s.relative(n,l);if(o===".."||o.startsWith(`..${s.sep}`)||s.isAbsolute(o))throw new Error(`Workspace artifact path escapes workspace root: ${t}`);return l}function m(e,t){return N(e,w(t))}async function T(e,t,n="file"){let r=s.resolve(e),l=m(r,t);if(!await f.pathExists(r)||!await f.pathExists(l))return null;let[o,p,a]=await Promise.all([f.realpath(r),f.realpath(l),f.stat(l)]),c=s.relative(o,p);if(c===".."||c.startsWith(`..${s.sep}`)||s.isAbsolute(c))throw new Error(`Workspace artifact resolves outside workspace root: ${t}`);if(!(n==="file"?a.isFile():a.isDirectory()))throw new Error(`Workspace artifact is not a regular ${n}: ${t}`);return p}async function rt(e,t$1){let n=t$1.trim().replace(/\\/g,"/").replace(/^\.\//,"");if(!n||s.isAbsolute(n))return null;let r=await T(e,n);if(r)return r;let l=t.workspaceContract;for(let o of [l,x$1(l)]){let p=await T(e,o);if(!p)continue;let a=[];try{a=(await f.readJson(p)).projects??[];}catch{return null}let c=a.filter(i=>typeof i.relativePath=="string"&&typeof i.externalPath=="string"&&s.isAbsolute(i.externalPath)).map(i=>({prefix:i.relativePath.replace(/\\/g,"/").replace(/\/$/,""),root:s.resolve(i.externalPath)})).filter(({prefix:i})=>n.startsWith(`${i}/`)).sort((i,u)=>u.prefix.length-i.prefix.length);for(let i of c){let u=n.slice(i.prefix.length+1),d=s.resolve(i.root,u),w=s.relative(i.root,d);if(!w||w===".."||w.startsWith(`..${s.sep}`)||s.isAbsolute(w)||!await f.pathExists(i.root)||!await f.pathExists(d))continue;let[g,h,P]=await Promise.all([f.realpath(i.root),f.realpath(d),f.stat(d)]),v=s.relative(g,h);if(v===".."||v.startsWith(`..${s.sep}`)||s.isAbsolute(v))throw new Error(`External evidence resolves outside its contracted root: ${t$1}`);if(!P.isFile())throw new Error(`External evidence is not a regular file: ${t$1}`);return h}return null}return null}async function C(e,t,n){let r=s.resolve(e),l=s.resolve(r,t),o=s.relative(r,l);if(!o||o===".."||o.startsWith(`..${s.sep}`)||s.isAbsolute(o)||!await f.pathExists(r))return null;let p=await f.realpath(r),a=l;for(;!await f.pathExists(a);){let u=s.dirname(a);if(u===a)return null;a=u;}let c=await f.realpath(a),i=s.relative(p,c);if(i===".."||i.startsWith(`..${s.sep}`)||s.isAbsolute(i))throw new Error(n);return l}async function at(e,t$1){let n=t$1.trim().replace(/\\/g,"/").replace(/^\.\//,"");if(!n||s.isAbsolute(n))return null;let r=t.workspaceContract;for(let l of [r,x$1(r)]){let o=await T(e,l);if(!o)continue;let p=[];try{p=(await f.readJson(o)).projects??[];}catch{return null}let a=p.filter(c=>typeof c.relativePath=="string"&&typeof c.externalPath=="string"&&s.isAbsolute(c.externalPath)).map(c=>({prefix:c.relativePath.replace(/\\/g,"/").replace(/\/$/,""),root:s.resolve(c.externalPath)})).filter(({prefix:c})=>n.startsWith(`${c}/`)).sort((c,i)=>i.prefix.length-c.prefix.length);if(a.length>0){for(let c of a){let i=n.slice(c.prefix.length+1),u=await C(c.root,i,`External evidence candidate resolves outside its contracted root: ${t$1}`);if(u)return u}return null}break}return C(e,n,`Workspace evidence candidate resolves outside workspace root: ${t$1}`)}function O(e,t){return N(e,x$1(t))}async function _(e,t){let n=s.resolve(e);await f.ensureDir(n);let r=s.dirname(t);await f.ensureDir(r);let[l,o]=await Promise.all([f.realpath(n),f.realpath(r)]),p=s.relative(l,o);if(p===".."||p.startsWith(`..${s.sep}`)||s.isAbsolute(p))throw new Error(`Workspace artifact parent resolves outside workspace root: ${r}`)}async function J(e,t){let n=s.resolve(e),[r,l]=await Promise.all([f.realpath(n),f.realpath(t)]),o=s.relative(r,l);if(o===".."||o.startsWith(`..${s.sep}`)||s.isAbsolute(o))throw new Error(`Workspace artifact resolves outside workspace root: ${t}`)}function j(e){let t=e?.code;return process.platform==="win32"&&(t==="EPERM"||t==="EINVAL"||t==="ENOSYS")}function F(e,t=process.platform){if(t!=="win32")return false;let n=e?.code;return n==="EPERM"||n==="EACCES"||n==="EBUSY"}async function E(e){let t=process.platform==="win32"?6:1,n;for(let r=0;r<t;r+=1)try{await f.remove(e);return}catch(l){if(n=l,!F(l)||r===t-1)throw l;await new Promise(o=>setTimeout(o,10*2**r));}throw n}var x=new Map;async function K(e,t){let n=x.get(e)??Promise.resolve(),r,l=new Promise(p=>{r=p;}),o=n.catch(()=>{}).then(()=>l);x.set(e,o),await n.catch(()=>{});try{return await t()}finally{r(),x.get(e)===o&&x.delete(e);}}async function L(e){try{await e.sync();}catch(t){if(!j(t))throw t}}async function k(e,t,n){await _(e,t);let r=s.dirname(t),l=`${s.basename(t)}.`,o=Date.now();for(let a of await f.readdir(r)){if(!a.startsWith(l)||!a.endsWith(".tmp"))continue;let c=s.join(r,a),i=await f.stat(c).catch(()=>null);i&&o-i.mtimeMs>3e4&&await f.remove(c).catch(()=>{});}let p=`${t}.${process.pid}.${randomUUID()}.tmp`;try{await n(p);let a=await open(p,"r");try{await L(a);}finally{await a.close();}let c=Number(process.env.WORKSPAI_TEST_ATOMIC_WRITE_DELAY_MS??0);Number.isFinite(c)&&c>0&&await new Promise(i=>setTimeout(i,Math.min(c,3e4)));try{await f.rename(p,t);}catch(i){let u=i.code;if(u!=="EEXIST"&&u!=="EPERM")throw i;await f.move(p,t,{overwrite:true});}}finally{await f.remove(p).catch(()=>{});}}async function U(e,t,n,r={}){let l=m(e,t);await _(e,l);let o=`${l}.lock`;return K(o,()=>z(o,t,n,r))}async function z(e,t,n,r){let l=r.timeoutMs??1e4,o=r.staleAfterMs??3e4,p=Date.now(),a;for(;!a;)try{a=await open(e,"wx"),await a.writeFile(`${JSON.stringify({pid:process.pid,createdAt:new Date().toISOString()})}
|
|
2
2
|
`),await L(a);}catch(c){if(!(c.code==="EEXIST"||F(c)))throw a&&(await a.close().catch(()=>{}),a=void 0,await E(e).catch(()=>{})),c;a&&(await a.close().catch(()=>{}),a=void 0,await E(e).catch(()=>{}));let[d,w]=await Promise.all([f.stat(e).catch(()=>null),f.readJson(e).catch(()=>null)]),g=Number(w?.pid),h=Number.isInteger(g)&&g>0,P=false;if(h)try{process.kill(g,0),P=true;}catch(b){P=b.code==="EPERM";}let v=!h&&!!(d&&Date.now()-d.mtimeMs>o);if(h&&!P||v){await E(e).catch(()=>{});continue}if(Date.now()-p>=l)throw new Error(`Timed out waiting for workspace artifact lock: ${t}`);await new Promise(b=>setTimeout(b,20));}try{return await n()}finally{await a.close().catch(()=>{}),await E(e);}}async function nt(e,t){let n=[m(e,t),O(e,t)];for(let r of n)if(await f.pathExists(r))return await J(e,r),r;return null}async function ot(e,t,n){b(t,n);let r=m(e,t);return await k(e,r,l=>f.writeJson(l,n,{spaces:2})),d({workspacePath:e,relativePath:t}),r}async function it(e,t,n){return Y(e,t,n.map(r=>({rootPath:e,...r})))}async function Y(e,t,n){if(n.length===0)return [];let r=n.map(o=>({...o,rootPath:s.resolve(o.rootPath),path:m(o.rootPath,o.relativePath)})),l=r.find((o,p)=>r.findIndex(a=>a.path===o.path)!==p);if(l)throw new Error(`Duplicate workspace artifact transaction target: ${l.relativePath}`);for(let o of r)b(o.relativePath,o.payload);return U(e,t,async()=>{let o=randomUUID(),p=[];try{for(let a of r){let c=await f.pathExists(a.path),i={path:a.path,rootPath:a.rootPath,exists:c,backupPath:null};if(p.push(i),c){let u=`${a.path}.${process.pid}.${o}.rollback`;await J(a.rootPath,a.path);try{try{await link(a.path,u);}catch{await copyFile(a.path,u);}i.backupPath=u;}catch(d){throw await f.remove(u).catch(()=>{}),d}}}for(let a=0;a<r.length;a+=1){let c=r[a];await k(c.rootPath,c.path,u=>f.writeJson(u,c.payload,{spaces:2}));let i=Number(process.env.WORKSPAI_TEST_FAIL_ARTIFACT_SET_AFTER??0);if(Number.isInteger(i)&&i===a+1)throw new Error(`Injected artifact-set failure after ${i} write(s).`)}for(let a of r)d({workspacePath:a.rootPath,relativePath:a.relativePath});return r.map(a=>a.path)}catch(a){let i=(await Promise.allSettled(p.map(async u=>{if(!u.exists){await f.remove(u.path);return}u.backupPath&&await k(u.rootPath,u.path,d=>copyFile(u.backupPath,d));}))).filter(u=>u.status==="rejected");throw i.length>0?new AggregateError([a,...i.map(u=>u.reason)],"Workspace artifact transaction failed and rollback was incomplete."):a}finally{await Promise.all(p.map(a=>a.backupPath?f.remove(a.backupPath).catch(()=>{}):Promise.resolve()));}})}async function st(e,t,n){let r=m(e,t);return await k(e,r,l=>f.writeFile(l,n,"utf-8")),d({workspacePath:e,relativePath:t}),r}export{m as a,T as b,rt as c,at as d,O as e,U as f,nt as g,ot as h,it as i,Y as j,st as k};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {f,h as h$1}from'./chunk-
|
|
1
|
+
import {f,h as h$1}from'./chunk-BLEIUQL6.js';import {t as t$1}from'./chunk-VQZ5PI5J.js';import {t,s}from'./chunk-ODK4LCEL.js';import u from'fs';import A from'path';var a=s.workspaceRunLast.schemaVersion,W="workspace-run-last.json",o=t.workspaceRunLast;var P=new Set(["init","test","build","start"]);function _(e){return P.has(e)}async function d(e){try{return await u.promises.access(e,u.constants.F_OK),true}catch{return false}}async function w(e){try{let r=await u.promises.readFile(e,"utf-8");return JSON.parse(r)}catch{return null}}function m(e){return !e||typeof e!="object"||Array.isArray(e)?null:e}function h(e){let r=e.stage;return typeof r!="string"||r.trim().length===0||!Array.isArray(e.projects)?false:_(r)||/^[a-z][a-z0-9_-]*$/i.test(r)}function T(e){let r=m(e);return !r||r.schemaVersion===a?false:h(r)}function C(e){let r=m(e);return r?r.schemaVersion===a&&r.stages!=null:false}function p(e){if(C(e))return e;if(T(e)){let r=e.stage;return {schemaVersion:a,generatedAt:e.generatedAt,workspacePath:e.workspacePath,latestStage:r,stages:{[r]:e},enterpriseControls:e.enterpriseControls??{jsonReady:true,evidencePath:o}}}return null}function U(e,r){let n=p(e);if(!n)return null;let t=r??n.latestStage;return n.stages[t]??null}async function V(e){let r=(await Promise.all(t$1(A.resolve(e),"reports",W).map(async t=>await d(t)?t:null))).find(t=>typeof t=="string");if(!r)return null;let n=await w(r);return p(n)}async function j(e,r){let n=A.resolve(e);return f(n,o,async()=>{let t=(await Promise.all(t$1(n,"reports",W).map(async s=>await d(s)?s:null))).find(s=>typeof s=="string"),R=t?await w(t):null,i=p(R);if(t&&!i)throw new Error(`Workspace run evidence is unreadable or invalid; refusing to overwrite: ${t}`);let l=i?{...i.stages}:{};l[r.stage]=r;let g={schemaVersion:a,generatedAt:r.generatedAt,workspacePath:r.workspacePath,latestStage:r.stage,stages:l,enterpriseControls:{jsonReady:true,evidencePath:o}};return await h$1(n,o,g),g})}export{W as a,o as b,U as c,V as d,j as e};
|