workspai 0.65.0 → 0.66.0
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 +4 -1
- package/contracts/agent-customization-pack.v1.json +4 -2
- package/contracts/analyze-last-run.v1.json +9 -1
- package/contracts/cli-runtime-command-inventory.v1.snapshot.json +113 -0
- package/contracts/extension-cli-compatibility.v1.json +2 -0
- package/contracts/published-contract-catalog.v1.json +10 -0
- package/contracts/runtime-command-surface.v1.json +47 -2
- package/contracts/workspace-activity-event.v1.json +132 -0
- package/contracts/workspace-intelligence/agent-bootstrap-receipt.v1.json +17 -0
- package/contracts/workspace-intelligence/mcp-design.v1.json +49 -2
- package/contracts/workspace-intelligence/project-agent-entry.v1.json +3 -0
- package/contracts/workspace-intelligence/project-context-agent.v1.json +49 -7
- package/contracts/workspace-intelligence/project-knowledge-graph-reference.v1.json +51 -0
- package/contracts/workspace-intelligence/workspace-knowledge-graph.v1.json +97 -2
- package/contracts/workspace-intelligence/workspace-skills-index.v1.json +34 -0
- package/dist/analyze-UJQWGNM2.js +1 -0
- package/dist/{artifact-remediation-plan-XIQNI35L.js → artifact-remediation-plan-M2XBS2IU.js} +1 -1
- package/dist/autopilot-release-U6F4M2BQ.js +1 -0
- package/dist/capabilities-command-XUKPO25Z.js +1 -0
- package/dist/chunk-2LIVMG5C.js +2 -0
- package/dist/{chunk-XGE2FDI4.js → chunk-2PACEMNE.js} +1 -1
- package/dist/chunk-334J2KIP.js +7 -0
- package/dist/{chunk-6TBTMWNA.js → chunk-3H5ACWWZ.js} +1 -1
- package/dist/{chunk-HCFWT42C.js → chunk-3NM3JAZW.js} +1 -1
- package/dist/chunk-4XEH3WNV.js +13 -0
- package/dist/chunk-5OA33JH2.js +2 -0
- package/dist/chunk-5TY74LLW.js +2 -0
- package/dist/{chunk-QCKWQFCD.js → chunk-5U4L6VF2.js} +1 -1
- package/dist/{chunk-W6FHVXNL.js → chunk-5XGR3LRI.js} +1 -1
- package/dist/{chunk-KTN2ARZJ.js → chunk-6JX56VAL.js} +3 -3
- package/dist/chunk-6UNATTB7.js +1 -0
- package/dist/{chunk-J3X56S7L.js → chunk-727IQFGN.js} +1 -1
- package/dist/chunk-7FF5EOIO.js +2 -0
- package/dist/{chunk-D5YJOQYK.js → chunk-AP4PV6WJ.js} +1 -1
- package/dist/chunk-AXUA7PFV.js +2 -0
- package/dist/chunk-B4IVVTMQ.js +2 -0
- package/dist/{chunk-LNXIMF3O.js → chunk-C4S22E6S.js} +1 -1
- package/dist/{chunk-PXWKMPPI.js → chunk-D4UHRJAP.js} +1 -1
- package/dist/chunk-DUBOKZMA.js +49 -0
- package/dist/{chunk-VYDURWN7.js → chunk-ECLMYTWT.js} +1 -1
- package/dist/{chunk-2RL6RRT2.js → chunk-EHH4SKVH.js} +50 -50
- package/dist/chunk-EP4CUWOO.js +9 -0
- package/dist/chunk-FY4X2VOE.js +39 -0
- package/dist/chunk-GAYK3WGV.js +2 -0
- package/dist/{chunk-YUGKQ44M.js → chunk-H5RJCS5E.js} +1 -1
- package/dist/{chunk-YN5X2FTP.js → chunk-H7MRINGP.js} +1 -1
- package/dist/chunk-HJLGXFMK.js +1 -0
- package/dist/{chunk-VRGEPPUB.js → chunk-HLWDIIWL.js} +1 -1
- package/dist/{chunk-HDNATYW7.js → chunk-IIFFEEMX.js} +1 -1
- package/dist/chunk-IVF6NEHS.js +1 -0
- package/dist/chunk-JC4XSU7G.js +1 -0
- package/dist/chunk-JRP6WP5C.js +681 -0
- package/dist/chunk-JZJBA2V2.js +1 -0
- package/dist/{chunk-N4QQADXX.js → chunk-L5CCIIF2.js} +1 -1
- package/dist/chunk-L5Q2S5GY.js +3 -0
- package/dist/chunk-LPCZHKD5.js +1 -0
- package/dist/chunk-MZ7U4BIQ.js +157 -0
- package/dist/chunk-NMXGSVMD.js +1 -0
- package/dist/{chunk-GQSRNUCU.js → chunk-NVND4727.js} +3 -3
- package/dist/chunk-O37UBRMX.js +4 -0
- package/dist/chunk-OI2VOU6S.js +1 -0
- package/dist/chunk-PD7Y6HIM.js +2 -0
- package/dist/chunk-PJPS7CNH.js +1 -0
- package/dist/chunk-QGAPGZPL.js +97 -0
- package/dist/chunk-R2M5OJOK.js +5 -0
- package/dist/chunk-SX6A656X.js +1 -0
- package/dist/{chunk-X6TNBARH.js → chunk-TABXSDTR.js} +2 -2
- package/dist/chunk-TTHO4MFC.js +2 -0
- package/dist/chunk-U5ENEDJA.js +7 -0
- package/dist/chunk-UOCERSAN.js +1 -0
- package/dist/chunk-UPIPSSXY.js +1 -0
- package/dist/chunk-UTV4DTNM.js +1 -0
- package/dist/chunk-VA5VSOBL.js +2 -0
- package/dist/chunk-VQOWB26M.js +12 -0
- package/dist/chunk-VQZ5PI5J.js +1 -0
- package/dist/chunk-WTWRSEOW.js +1 -0
- package/dist/{chunk-D65FCQIO.js → chunk-XESFJN52.js} +1 -1
- package/dist/{chunk-YYQEWAES.js → chunk-XQFWUM2P.js} +1 -1
- package/dist/chunk-XWKGZRHN.js +1 -0
- package/dist/{chunk-WRQWVSBJ.js → chunk-YX5VWPR5.js} +1 -1
- package/dist/chunk-ZQH2I5RQ.js +1 -0
- package/dist/{create-ALT2ME6H.js → create-SOLLXXAB.js} +1 -1
- package/dist/{demo-kit-QHIDCSBI.js → demo-kit-5UQH2OXC.js} +1 -1
- package/dist/{doctor-RW4R3O5C.js → doctor-NQ5PUCUP.js} +1 -1
- package/dist/{dotnet-webapi-clean-AVHPJG7Y.js → dotnet-webapi-clean-YEHYIGOT.js} +1 -1
- package/dist/{goal-lifecycle-VYOKS6E6.js → goal-lifecycle-IPNY7KNR.js} +1 -1
- package/dist/goal-pack-2WV3EA4Y.js +1 -0
- package/dist/{gofiber-standard-47S2GYAO.js → gofiber-standard-C44IIQYH.js} +1 -1
- package/dist/{gogin-standard-EWB4XNOI.js → gogin-standard-X7VKACVR.js} +1 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.js +170 -170
- package/dist/live-command-Q6E45N7S.js +18 -0
- package/dist/{pipeline-U4N2DVD7.js → pipeline-MIMENSI7.js} +1 -1
- package/dist/{project-agent-entry-YAQCHIMP.js → project-agent-entry-OWLJ3IHQ.js} +1 -1
- package/dist/project-intelligence-lens-I67EO6AE.js +1 -0
- package/dist/{project-test-coverage-4S7MEQ6T.js → project-test-coverage-OPDVSFPH.js} +1 -1
- package/dist/{pythonRapidkitExec-VAW5XE4Z.js → pythonRapidkitExec-44ORGQ4R.js} +1 -1
- package/dist/{rust-axum-M5X4ZC4Z.js → rust-axum-JKZTZDRZ.js} +1 -1
- package/dist/{springboot-standard-Y5ADLZMQ.js → springboot-standard-PI4FLTAN.js} +1 -1
- package/dist/verified-goal-46JWNCDY.js +1 -0
- package/dist/{workspace-HGUZWNAB.js → workspace-KO37XHF6.js} +1 -1
- package/dist/{workspace-agent-sync-GEN3KBAX.js → workspace-agent-sync-32FIJQBH.js} +1 -1
- package/dist/{workspace-archive-ZBCKJHXS.js → workspace-archive-6R5DRNZW.js} +1 -1
- package/dist/{workspace-context-4WIWFW26.js → workspace-context-JKRPX775.js} +1 -1
- package/dist/{workspace-contract-7DXK4GF5.js → workspace-contract-4T3NYNK5.js} +1 -1
- package/dist/workspace-explain-MOGL4GEA.js +1 -0
- package/dist/workspace-explain-contract-W2E6LF4Q.js +1 -0
- package/dist/{workspace-feedback-RQ4TGJW6.js → workspace-feedback-6VQ7T4CR.js} +1 -1
- package/dist/{workspace-foundation-J3NNRMI3.js → workspace-foundation-GHWO3BZU.js} +1 -1
- package/dist/{workspace-graph-stream-PQI7OGCE.js → workspace-graph-stream-PTVS47NJ.js} +1 -1
- package/dist/workspace-graph-token-efficiency-Z5JD5NHI.js +1 -0
- package/dist/{workspace-history-SYCDK7FO.js → workspace-history-M2K4M2JY.js} +1 -1
- package/dist/{workspace-intelligence-6FS26JOQ.js → workspace-intelligence-PJIPTXL3.js} +1 -1
- package/dist/{workspace-intelligence-evaluation-CQDKOYZZ.js → workspace-intelligence-evaluation-GONCRE6O.js} +1 -1
- package/dist/{workspace-intelligence-runner-XYUPCSLN.js → workspace-intelligence-runner-M47QR3JM.js} +1 -1
- package/dist/{workspace-intelligence-runtime-registry-IW6J53LO.js → workspace-intelligence-runtime-registry-FFGQF4A7.js} +1 -1
- package/dist/workspace-knowledge-graph-V2EAYDCL.js +1 -0
- package/dist/{workspace-knowledge-graph-contract-L3CLAM2M.js → workspace-knowledge-graph-contract-VANN7RCA.js} +1 -1
- package/dist/{workspace-knowledge-graph-query-FZXSPWGK.js → workspace-knowledge-graph-query-RASPF7FS.js} +1 -1
- package/dist/workspace-knowledge-graph-snapshot-5YIG6EMG.js +1 -0
- package/dist/{workspace-marker-7NHMDIRL.js → workspace-marker-XGAWZZDX.js} +1 -1
- package/dist/workspace-mcp-serve-YRORNE4P.js +3 -0
- package/dist/workspace-model-VSVKLX7M.js +1 -0
- package/dist/{workspace-onboarding-X3PWRIIS.js → workspace-onboarding-2VMJZVLZ.js} +1 -1
- package/dist/{workspace-python-engine-state-J4QKW55K.js → workspace-python-engine-state-BE4A3BL5.js} +1 -1
- package/dist/{workspace-readme-G7TZ3V5T.js → workspace-readme-6X3GLTBM.js} +2 -2
- package/dist/{workspace-registry-summary-LJN4WHIZ.js → workspace-registry-summary-QVSJKKTX.js} +1 -1
- package/dist/workspace-repair-engine-WSKV3Q4V.js +3 -0
- package/dist/workspace-run-3BXKTLVL.js +1 -0
- package/dist/{workspace-verify-USRRIM2F.js → workspace-verify-EJCSOBIK.js} +1 -1
- package/dist/{workspace-watch-43YZPLF7.js → workspace-watch-JTIFBF4Z.js} +1 -1
- package/docs/SETUP.md +10 -0
- package/docs/agent-entry.md +22 -7
- package/docs/ci-workflows.md +1 -1
- package/docs/commands-reference.md +41 -7
- package/docs/contracts/ARTIFACT_CATALOG.md +63 -44
- package/docs/contracts/COMMAND_OWNERSHIP_MATRIX.md +1 -0
- package/docs/contracts/NAMING_AND_COEXISTENCE.md +20 -18
- package/docs/contracts/README.md +4 -3
- package/docs/real-world-qualification.md +19 -3
- package/docs/workspace-knowledge-graph.md +95 -27
- package/docs/workspace-live-activity.md +199 -0
- package/docs/workspace-operations.md +32 -9
- package/package.json +1 -1
- package/dist/analyze-5PDVWECJ.js +0 -1
- package/dist/autopilot-release-JVIJCTKX.js +0 -1
- package/dist/capabilities-command-LHM3XIS6.js +0 -1
- package/dist/chunk-2647BYBC.js +0 -1
- package/dist/chunk-27UR373Z.js +0 -1
- package/dist/chunk-2C5ZBVBI.js +0 -2
- package/dist/chunk-6JWNDWOA.js +0 -1
- package/dist/chunk-CCDGHPEJ.js +0 -2
- package/dist/chunk-DFG33SBR.js +0 -2
- package/dist/chunk-FY4IIAIF.js +0 -1
- package/dist/chunk-HEZZ72V4.js +0 -94
- package/dist/chunk-HN7P4T3B.js +0 -681
- package/dist/chunk-ILIBOMYL.js +0 -1
- package/dist/chunk-J7QYANXK.js +0 -8
- package/dist/chunk-JD3A5QM6.js +0 -2
- package/dist/chunk-JQLJBK5N.js +0 -1
- package/dist/chunk-KLSSPJTV.js +0 -1
- package/dist/chunk-L22EABIC.js +0 -7
- package/dist/chunk-MDTI3UEB.js +0 -1
- package/dist/chunk-MOSXTVPU.js +0 -1
- package/dist/chunk-MYJQGGIU.js +0 -5
- package/dist/chunk-NOV6723U.js +0 -1
- package/dist/chunk-NYEAMMUL.js +0 -1
- package/dist/chunk-NZ3WZYD5.js +0 -1
- package/dist/chunk-O5B2L3R2.js +0 -1
- package/dist/chunk-OWB5KWSS.js +0 -13
- package/dist/chunk-P5PSZQPB.js +0 -2
- package/dist/chunk-QI3HG6IG.js +0 -144
- package/dist/chunk-SWGSFLTC.js +0 -1
- package/dist/chunk-THIOE2PB.js +0 -2
- package/dist/chunk-U5FCQTVL.js +0 -4
- package/dist/chunk-UXEO5QCF.js +0 -33
- package/dist/chunk-VR6XMUF3.js +0 -2
- package/dist/chunk-VVJK5NFY.js +0 -2
- package/dist/chunk-VXKWWX7S.js +0 -8
- package/dist/chunk-W322YDHS.js +0 -49
- package/dist/chunk-WPRLXKWC.js +0 -8
- package/dist/chunk-Y5YAP4F3.js +0 -2
- package/dist/chunk-YOCN7GF4.js +0 -1
- package/dist/goal-pack-YWPI43QL.js +0 -1
- package/dist/project-intelligence-lens-MRQR2LQW.js +0 -1
- package/dist/verified-goal-WM34TTGE.js +0 -1
- package/dist/workspace-explain-TE2LGOAV.js +0 -1
- package/dist/workspace-explain-contract-V2IVSROX.js +0 -1
- package/dist/workspace-graph-token-efficiency-2I4X374C.js +0 -1
- package/dist/workspace-knowledge-graph-SWCKDTPF.js +0 -1
- package/dist/workspace-knowledge-graph-snapshot-M572JRB4.js +0 -1
- package/dist/workspace-mcp-serve-IBMTFQDY.js +0 -3
- package/dist/workspace-model-ZL6WCICX.js +0 -1
- package/dist/workspace-repair-engine-NX7I632M.js +0 -3
- package/dist/workspace-run-6GT5OBQ5.js +0 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {b as b$3,a}from'./chunk-5OA33JH2.js';import {m,a as a$1,l as l$1}from'./chunk-MZ7U4BIQ.js';import {b as b$4,g as g$1}from'./chunk-TTHO4MFC.js';import {b as b$1,f as f$3,s as s$1,t,u,P as P$1,v,q as q$1,r,R,n,o,p as p$1,h as h$2,i as i$1,m as m$1,j,k,l,O,w,x,y as y$1,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-H5RJCS5E.js';import {b,c,d as d$1}from'./chunk-PD7Y6HIM.js';import {b as b$2}from'./chunk-C4S22E6S.js';import {d as d$3}from'./chunk-UOCERSAN.js';import {b as b$6}from'./chunk-VQOWB26M.js';import {q,l as l$2,d as d$2}from'./chunk-PJPS7CNH.js';import {p}from'./chunk-7FF5EOIO.js';import {d}from'./chunk-GAYK3WGV.js';import {a as a$2,b as b$5}from'./chunk-XESFJN52.js';import {f as f$1,e,i,h as h$3}from'./chunk-6UNATTB7.js';import {f as f$2,g,h}from'./chunk-VQZ5PI5J.js';import s from'path';import h$1 from'fs-extra';var pe=["Scope","Evidence","Diagnosis","Fix Plan","Run","Verify","Assumptions"];var Bt="workspace-operational-skill.v1";function Jt(e){if(typeof e!="string")return null;let t=e.trim();return !t||t.includes("/")||t.includes("..")?null:t}function Ot(e){let t=Jt(e.skillId);if(!t)throw new Error(`Invalid skill id: ${e.skillId}`);return {schemaVersion:Bt,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 Yt=f$1.skillsIndex;function Tt(e){let t=[...e.skills].sort((i,c)=>i.skillId.localeCompare(c.skillId)),r=e.inputsHash??d$2({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:Yt,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=[e.agentIndex,b,d$3],B="<!-- WORKSPAI:GENERATED-OPERATIONAL-SKILL -->",Xt=[{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 \`${e.agentIndex}\` and identify fail/warn reports for the scoped project.`,`Read \`${e.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 \`${e.readiness}\` and \`pipeline-last-run.json\`.`,`Read \`${e.verify}\` for verdict and blocking reasons.`,`Read \`${i.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 \`${i.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 Qt(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
|
+
`)}function Zt(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function er(e){let t=new Map;for(let c of e.projects){let m=new Set([c.runtime,...c.runtimeCandidates??[]].map(Zt).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."],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 tr(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 rr(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
|
+
`):void 0}var nr=/(?:^|\/)(?: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,ar=/(?:^|\/)(?:openapi|swagger|asyncapi)\.(?:json|ya?ml)$|(?:^|\/)(?:routes?|controllers?|endpoints?|proto)(?:\/|\.)/i,or=/(?:^|\/)(?:migrations?|database|db|prisma)(?:\/|\.)|(?:^|\/)schema\.(?:sql|prisma)$/i;function ir(e){let t=e.attributes.artifact;return typeof t=="string"&&t.trim()?t.trim():null}function sr(e){let t=e.attributes.ports;return Array.isArray(t)&&t.length>0}function cr(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 lr(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=cr(e.graph,i.name),m=lr([...i.importantFiles,...c.map(ir).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=>nr.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"&&sr(w)),p=m.filter(w=>ar.test(w)),d=a?.contracts?.apis??[],b=(a?.ports??[]).filter(w=>["http","https","grpc"].includes(w.protocol));k=l.length>0||p.length>0||d.length>0||b.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}`),...b.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 b=`${d.label} ${JSON.stringify(d.attributes)}`;return /database|migration|sql|prisma|orm/i.test(b)}),p=m.filter(d=>or.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 Wt(e){let t=e.model.workspace.name,r=[],n=[];for(let i of [...Xt,...er(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=tr(e.context??null,a),l=rr(e.contract??null,a),p=Qt({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 jt(e){let t=s.resolve(e.workspacePath),r=[],n=d$2({skills:e.skills.map(a=>({id:a.skillId,path:a.canonicalPath,hash:d$2({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$1);await h$1.ensureDir(s.dirname(k)),await h$1.writeJson(k,i,{spaces:2}),r.push(b$1);}return {skills:e.skills,index:i,writtenPaths:r,removedSkillIds:m.sort()}}function Nt(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
|
+
`)}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
|
+
`)}async function Lt(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
|
+
|
|
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 Gt(){return {schemaVersion:fr,presets:{minimal:{meaning:"Generate the portable grounding index, AGENTS.md, and provider-specific lightweight instructions.",requiredOutputs:[e.agentIndex,e.agentCustomizationPack,e.agents]},enterprise:{meaning:"Generate the full VS Code-native pack: instructions, prompts, skills, custom agents, and validation metadata.",requiredOutputs:[e.agentIndex,e.agentCustomizationPack,e.agents,w,A,M,".github/agents/workspai-advisor.agent.md",S,b$1]}},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=f$1.agentIndex,hr=f$1.agentCustomizationPack,X=e.agentIndex,Y=e.agentCustomizationPack;var J=[{relativePath:i.goalIndex,label:"Active Goal Pack index",required:false},{relativePath:i.goalPackLastRun,label:"Latest governed Goal Pack",required:false},{relativePath:b,label:"Agent context pack",required:true},{relativePath:b$1,label:"Operational skills index",required:true},{relativePath:e.model,label:"Workspace model",required:false},{relativePath:e.knowledgeGraph,label:"Workspace knowledge graph",required:false},{relativePath:e.evaluationLastRun,label:"Workspace Intelligence evaluation",required:false},{relativePath:e.doctor,label:"Workspace doctor",required:false},{relativePath:i.doctorProject,label:"Project doctor",required:false},{relativePath:i.doctorRemediationPlan,label:"Doctor remediation plan",required:false},{relativePath:i.artifactRemediationPlan,label:"Artifact remediation plan",required:false},{relativePath:i.doctorFixResult,label:"Doctor fix result",required:false},{relativePath:e.analyze,label:"Workspace analyze",required:false},{relativePath:i.pipelineLastRun,label:"Governance pipeline",required:false},{relativePath:e.readiness,label:"Release readiness",required:false},{relativePath:e.impact,label:"Workspace impact",required:false},{relativePath:e.verify,label:"Workspace verify",required:false},{relativePath:e.snapshot,label:"Workspace model snapshot",required:false},{relativePath:e.diff,label:"Workspace model diff",required:false},{relativePath:e.explain,label:"Workspace explain",required:false},{relativePath:e.contractVerify,label:"Workspace contract verify",required:false},{relativePath:e.history,label:"Workspace intelligence history",required:false}];function wr(){let e=J.map(r=>r.relativePath),t=b$2().consumers.agents.canonicalReadOrder;return [...new Set(t.filter(r=>r!==X&&e.includes(r)))]}async function Ar(e){try{let{contract:t}=await p({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 Rr(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 br(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 yr(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$1,t,r){return e$1.path===e.snapshot?false:Pr(e$1.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 y(e,t){return e.has("all")||e.has(t)}function Ut(e){return y(e,"copilot")||y(e,"vscode")}function Xe(e){return y(e,"agents")||y(e,"codex")||y(e,"kimi")||y(e,"grok")||y(e,"orca")}function Er(e,t){return t==="generic"?y(e,"agents"):t==="copilot"?Ut(e):t==="grok"?y(e,"grok")||y(e,"orca"):y(e,t)}function Ir(e){return e??"enterprise"}function Cr(e){return e===b$1?"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 $t(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 Gt().presets[t].requiredOutputs.includes(e)}async function _r(e,t){if(t)return t;let r=await d(e,l$2)??s.join(e,l$2);if(await h$1.pathExists(r))try{let n=await h$1.readJson(r);return b$5(l$2,n,r),n}catch{}return q({workspacePath:e,includeEvidence:true})}async function Wr(e$1,t){let r=await d(e$1,e.knowledgeGraph);if(!r)return null;try{let n=await h$1.readJson(r);b$5(e.knowledgeGraph,n,r);let i=n;return i.proofs.some(c=>c.freshness==="stale")?null:(b$6(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$5(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 Dt(e){let t=e.now??new Date,r=e.staleAfterHours??24,n=[],i=[];for(let a of J){let k=await d(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(...Rr(p)),n.push({path:a.relativePath,label:a.label,required:a.required,exists:l.exists,validity:l.validity,validationError:l.validationError,generatedAt:p?yr(p):void 0,commandId:typeof p?.commandId=="string"?p.commandId:void 0,exitCode:typeof p?.exitCode=="number"?p.exitCode:void 0});}let c=br(i).slice(0,16),m=b$2();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$1){let t=["# Workspai agent grounding","","Cross-tool instructions for Copilot, Cursor, Claude Code, Codex, Grok, and other agents.","","## Read order (mandatory before workspace diagnosis)","",`1. \`${e.agentIndex}\` \u2014 latest blockers, timestamps, and report paths`,`2. \`${i.goalIndex}\` \u2014 when present, read the active Goal Pack and its handoff before choosing work.`,`3. \`${e.agentContext}\` \u2014 read only task-relevant context`,`4. \`${e.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.","","## Regenerate intelligence","","```bash",P("workspace agent-sync --write --refresh-context"),P("workspace context --for-agent --json --write"),P("pipeline --json --write"),"```",""];if(e$1.index.blockers.length>0){t.push("## Current blockers","");for(let r of e$1.index.blockers.slice(0,12))t.push(`- ${r}`);t.push("");}if(e$1.context?.safeCommands?.length){t.push("## Safe commands (prefer these)","");for(let r of e$1.context.safeCommands.slice(0,10))t.push(`- \`${r.display}\` \u2014 ${r.description}`);t.push("");}return t.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.join(`
|
|
9
|
+
`)}function $r(e$1){return ["# Workspai agent grounding","",`Generated: ${e$1.generatedAt}`,"",`This file is tool-agnostic. Synced agents should read it together with \`${e.agentIndex}\`.`,"","## Mandatory read order","",...e$1.readOrder.map((t,r)=>`${r+1}. \`${t}\``),"",e$1.blockers.length>0?"## Blockers":"",...e$1.blockers.length>0?e$1.blockers.map(t=>`- ${t}`):[],"","## Refresh","","```bash",e$1.refreshCommand,"```",""].filter(t=>t!=="").join(`
|
|
10
|
+
`)}function Dr(){return ["# Workspai workspace grounding","","Before answering workspace, release, or architecture questions:","","1. Read `AGENTS.md` (managed Workspai section).",`2. Read \`${e.agentIndex}\` and only task-relevant context from \`${e.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
|
+
`)}function Kr(){return ["## Claude Code","",`- Load \`${e.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(`
|
|
12
|
+
`)}function Qe(e$1){return [`## ${e$1}`,"","- Treat `AGENTS.md` as the portable workspace instruction authority.",`- Load \`${e.agentIndex}\` before diagnosing blockers or architecture.`,`- Read only task-relevant context from \`${e.agentContext}\`.`,"- Use bounded Workspace Knowledge Graph search before broad source discovery.","- Treat `.workspai/reports/*` JSON reports as canonical gate and health evidence.","- Do not invent pass/fail state \u2014 cite `exitCode`, `blockers`, and `generatedAt` fields.","- Return answers with: Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.","- Refresh grounding with `workspai workspace agent-sync --write --refresh-context`.",""].join(`
|
|
13
|
+
`)}function qr(){return ["---","description: Workspai workspace evidence and intelligence grounding","globs: []","alwaysApply: true","---","","# Workspai Workspace Intelligence","","Use Workspai reports as the workspace source of truth before giving architectural, repair, release, or project lifecycle advice.","","## Read order","",`1. Read \`${e.agents}\` and \`${e.agentIndex}\`.`,`2. Read only task-relevant context from \`${e.agentContext}\`.`,"3. Prefer bounded graph search and evidence reports over full-repo exploration.","","## Scope rules","",`- Start from \`${e.agentIndex}\`; read only task-relevant context and evidence.`,"- 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.","","## Intelligent loop","","When applying changes, follow the full repair loop:","","1. Discover \u2014 read bounded workspace context, select a matching Skill, and query the graph for the task.","2. Inspect \u2014 read relevant evidence and source files.","3. Patch \u2014 apply changes through the CLI-owned repair transaction.","4. Verify \u2014 run verification to confirm workspace health.","5. Complete \u2014 only after verified evidence confirms success.","","## Answer contract","","Return answers with: Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.","","## Refresh when stale","","```bash",P("workspace agent-sync --write --refresh-context"),"```",""].join(`
|
|
14
|
+
`)}function Mr(){return ["---","description: Workspai evidence artifact discipline",'globs: [".workspai/**", "**/.workspai/**", ".rapidkit/**", "**/.rapidkit/**"]',"alwaysApply: false","---","","When reading or editing `.workspai/` or legacy `.rapidkit/` artifacts:","",`- Start from \`${e.agentIndex}\` for read order and active blockers.`,"- Treat `.workspai/reports/*` JSON reports as canonical gate and health evidence.","- Do not invent pass/fail state \u2014 cite `exitCode`, `blockers`, and `generatedAt` fields.","- JSON files (.json) require strictly valid JSON. Never include comments, trailing commas, or non-standard syntax.","","Regenerate evidence:","","```bash",P("workspace intelligence run"),"```",""].join(`
|
|
15
|
+
`)}function nt(e$1){return ["---",`description: ${e$1.description}`,`globs: ${e$1.globs}`,"alwaysApply: false","---","",e$1.objective,"","Read first:","",`- \`${e.agentIndex}\``,`- \`${e.agentContext}\``,"- Any report referenced by the current blocker or task","","Steps:","",...e$1.steps.map((t,r)=>`${r+1}. ${t}`),"","Use the standard Workspai answer contract: Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.",""].join(`
|
|
16
|
+
`)}function Hr(){return nt({description:"Diagnose Workspai workspace blockers from evidence reports",globs:"[]",objective:"Diagnose this workspace using Workspai evidence only.",steps:["Root cause grounded in report blockers","Smallest safe fix path (commands + file edits)","One verification command to prove recovery"]})}function Ur(){return nt({description:"Repair Workspai blockers with evidence and verification",globs:"[]",objective:"Plan the smallest safe repair for the current Workspai blocker.",steps:["Blocker and affected workspace/project scope","Evidence paths and exact failing signals","Minimal fix plan","Human-run commands","Verification command and expected success signal"]})}function Fr(){return nt({description:"Assess Workspai release readiness from evidence",globs:"[]",objective:"Assess whether this workspace is release-ready using Workspai gates.",steps:["Readiness verdict with cited reports","Blocking gates","Safe next command","Verification checklist"]})}function Vr(){return ["---","trigger: always_on","description: Workspai workspace evidence and intelligence grounding","---","","# Workspai Workspace Intelligence","","Use Workspai reports as the workspace source of truth before giving architectural, repair, release, or project lifecycle advice.","","## Read order","",`1. \`${e.agents}\` and \`${e.agentIndex}\`.`,`2. Only task-relevant context from \`${e.agentContext}\`.`,"3. Prefer bounded graph search and evidence reports over full-repo exploration.","","## Scope rules","",`- Start from \`${e.agentIndex}\`; read only task-relevant context.`,"- Distinguish workspace-level blockers from project-level blockers.","- When a project is active, cite its name, path, framework, and evidence source.","","## Answer contract","","Return answers with: Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.","","## Refresh when stale","","```bash",P("workspace agent-sync --write --refresh-context"),"```",""].join(`
|
|
17
|
+
`)}function zr(){return ["---","trigger: glob","description: Workspai evidence artifact discipline",'globs: [".workspai/**", ".rapidkit/**"]',"---","","When reading or editing `.workspai/` or legacy `.rapidkit/` artifacts:","",`- Start from \`${e.agentIndex}\` for read order and active blockers.`,"- Treat `.workspai/reports/*` JSON reports as canonical gate and health evidence.","- Do not invent pass/fail state \u2014 cite `exitCode`, `blockers`, and `generatedAt` fields.","- JSON files (.json) require strictly valid JSON. No comments, no trailing commas.",""].join(`
|
|
18
|
+
`)}function Br(){return ["# Workspai Workspace Intelligence","","Use Workspai reports as the workspace source of truth before giving architectural, repair, release, or project lifecycle advice.","","## Read order","",`1. \`${e.agents}\` and \`${e.agentIndex}\`.`,`2. Only task-relevant context from \`${e.agentContext}\`.`,"3. Prefer bounded graph search and evidence reports over full-repo exploration.","","## Scope rules","",`- Start from \`${e.agentIndex}\`; read only task-relevant context.`,"- Distinguish workspace-level blockers from project-level blockers.","- When a project is active, cite its name, path, framework, and evidence source.","","## Answer contract","","Return answers with: Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.","","## Refresh when stale","","```bash",P("workspace agent-sync --write --refresh-context"),"```",""].join(`
|
|
19
|
+
`)}function Jr(){return ["# Workspai evidence artifact discipline","","Applies when reading or editing `.workspai/` or legacy `.rapidkit/` artifacts.","",`- Start from \`${e.agentIndex}\` for read order and active blockers.`,"- Treat `.workspai/reports/*` JSON reports as canonical gate and health evidence.","- Do not invent pass/fail state \u2014 cite `exitCode`, `blockers`, and `generatedAt` fields.","- JSON files (.json) require strictly valid JSON. No comments, no trailing commas.","","Regenerate evidence:","","```bash",P("workspace intelligence run"),"```",""].join(`
|
|
20
|
+
`)}function Yr(){return ["# Workspai Workspace Intelligence","","Use Workspai reports as the workspace source of truth before giving architectural, repair, release, or project lifecycle advice.","","## Read order","",`1. \`${e.agents}\` and \`${e.agentIndex}\`.`,`2. Only task-relevant context from \`${e.agentContext}\`.`,"3. Prefer bounded graph search and evidence reports over full-repo exploration.","","## Scope rules","",`- Start from \`${e.agentIndex}\`; read only task-relevant context.`,"- Treat `.workspai/reports/*` JSON reports as canonical gate and health evidence.","- Do not invent pass/fail state \u2014 cite `exitCode`, `blockers`, and `generatedAt` fields.","","## Answer contract","","Return answers with: Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.",""].join(`
|
|
21
|
+
`)}function Xr(){return ["# Workspai Workspace Intelligence","","Use Workspai reports as the workspace source of truth before giving architectural, repair, release, or project lifecycle advice.","","## Read order","",`1. \`${e.agents}\` and \`${e.agentIndex}\`.`,`2. Only task-relevant context from \`${e.agentContext}\`.`,"3. Prefer bounded graph search and evidence reports over full-repo exploration.","","## Scope rules","",`- Start from \`${e.agentIndex}\`; read only task-relevant context.`,"- 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.","","## Evidence discipline","","- Treat `.workspai/reports/*` JSON reports as canonical gate and health evidence.","- Do not invent pass/fail state \u2014 cite `exitCode`, `blockers`, and `generatedAt` fields.","- JSON files (.json) require strictly valid JSON. No comments, no trailing commas.","","## Answer contract","","Return answers with: Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.","","## Refresh when stale","","```bash",P("workspace agent-sync --write --refresh-context"),"```",""].join(`
|
|
22
|
+
`)}function Qr(){return ["# Workspai Workspace Intelligence","","Use Workspai reports as the workspace source of truth before giving architectural, repair, release, or project lifecycle advice.","","## Read order","",`1. \`${e.agents}\` and \`${e.agentIndex}\`.`,`2. Only task-relevant context from \`${e.agentContext}\`.`,"3. Prefer bounded graph search and evidence reports over full-repo exploration.","","## Scope rules","",`- Start from \`${e.agentIndex}\`; read only task-relevant context and evidence.`,"- Distinguish workspace-level blockers from project-level blockers.","- When a project is active, cite its name, path, framework, and evidence source.","","## Intelligent loop","","When applying changes, follow the full repair loop:","","1. Discover \u2014 read bounded workspace context, select a matching Skill, and query the graph for the task.","2. Inspect \u2014 read relevant evidence and source files.","3. Patch \u2014 apply changes through the CLI-owned repair transaction.","4. Verify \u2014 run verification to confirm workspace health.","5. Complete \u2014 only after verified evidence confirms success.","","## Answer contract","","Return answers with: Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.","","## Refresh when stale","","```bash",P("workspace agent-sync --write --refresh-context"),"```",""].join(`
|
|
23
|
+
`)}function Zr(){return ["---",'applyTo: ".workspai/**,**/.workspai/**,.rapidkit/**,**/.rapidkit/**"',"description: Workspai evidence and intelligence artifacts","---","","When working under `.workspai/` or legacy `.rapidkit/`:","","- Treat `.workspai/reports/*` JSON reports as canonical gate and health evidence.",`- Start from \`${e.agentIndex}\` for read order and blockers.`,"- Do not invent pass/fail state \u2014 cite `exitCode`, `blockers`, and `generatedAt` fields.",""].join(`
|
|
24
|
+
`)}function en(){return ["---",'applyTo: "**"',"description: Workspai workspace scope, evidence, and command discipline","---","","# Workspai Workspace Intelligence","","Use Workspai reports as the workspace source of truth before giving architectural, repair, release, or project lifecycle advice.","","## Scope rules","",`- Start from \`${e.agentIndex}\`; read only task-relevant context and evidence.`,"- Prefer bounded `workspace graph search` or MCP `searchWorkspaceGraph` over loading the complete graph.","- 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(`
|
|
25
|
+
`)}function tn(){return ["---","paths:",' - ".workspai/**"',' - ".rapidkit/**"',"---","","# Workspai evidence","","When reading or editing `.workspai/` or legacy `.rapidkit/` artifacts:","",`- Start from \`${e.agentIndex}\` for read order and active blockers.`,"- Treat `.workspai/reports/*` JSON reports as canonical gate and health evidence.","- Do not invent pass/fail state \u2014 cite `exitCode`, `blockers`, and `generatedAt` fields.","- JSON files (.json) require strictly valid JSON. No comments, no trailing commas.","","Regenerate evidence:","","```bash",P("workspace intelligence run"),"```",""].join(`
|
|
26
|
+
`)}function rn(){return ["# Legacy RapidKit evidence alias","","Compatibility path only. Use `.claude/rules/workspai-evidence.md` as the canonical rule.",""].join(`
|
|
27
|
+
`)}function nn(){return ["---","description: Legacy RapidKit metadata compatibility alias",'globs: [".rapidkit/**", "**/.rapidkit/**"]',"alwaysApply: false","---","","Use `.cursor/rules/workspai-grounding.mdc` for canonical Workspai grounding.",""].join(`
|
|
28
|
+
`)}function Kt(e){return ["---",'applyTo: ".rapidkit/**,**/.rapidkit/**"',"description: Legacy RapidKit metadata compatibility alias","---","",`Use \`.github/instructions/workspai-${e}.instructions.md\` as the canonical Workspai instruction.`,""].join(`
|
|
29
|
+
`)}function qt(){return ["---","description: Diagnose Workspai workspace blockers from evidence reports","---","","Diagnose this workspace using Workspai evidence only.","","Read:","",`- \`${e.agentIndex}\``,`- \`${e.agentContext}\``,"- 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(`
|
|
30
|
+
`)}function ge(e$1){return ["---",`description: ${e$1.description}`,"---","",e$1.objective,"","Read first:","",`- \`${e.agentIndex}\``,`- \`${e.agentContext}\``,"- Any report referenced by the current blocker or task","","Return:","",...e$1.expectedOutput.map((t,r)=>`${r+1}. ${t}`),"","Use the standard Workspai answer contract: Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.",""].join(`
|
|
31
|
+
`)}function D(e){return ["# "+e.title,"",...e.lines,""].join(`
|
|
32
|
+
`)}function an(){return D({title:"MCP Tool Design",lines:["Workspai MCP is a read-mostly bridge over contract-validated workspace artifacts.","","Served read tools:",`- \`getWorkspaceModel\` \u2014 read \`${e.model}\`.`,`- \`getWorkspaceKnowledgeGraph\` \u2014 read \`${e.knowledgeGraph}\`.`,`- \`getWorkspaceEvaluation\` \u2014 read \`${e.evaluationLastRun}\` (or the live evaluation when requested).`,"- `queryWorkspaceEntities` \u2014 filter proof-backed graph entities by kind.","- `searchWorkspaceGraph` \u2014 retrieve bounded proof-backed context by text query.","- `getWorkspaceGraphEvidence` \u2014 resolve evidence for an entity or relation.","- `findWorkspaceGraphPath` \u2014 find a shortest proof-carrying relationship path.",`- \`getEvidenceIndex\` \u2014 read \`${e.agentIndex}\`.`,"- `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 \`${e.skillsIndex}\`.`,"- `getWorkspaceExplain` \u2014 read/build workspace explain for release-blocked or project scope.","","Planned, not served:","- `refreshWorkspaceIntelligence` \u2014 requires an explicit approval boundary before it can become an MCP write tool.","","The server supports legacy initialize-era clients and the 2026-07-28 stateless discovery era. Tool results include text plus structured content; actionable execution failures are returned as tool errors."]})}function on(e$1){return `${JSON.stringify({schemaVersion:h$3.workspaiMcpDesign.schemaVersion,generatedAt:e$1.generatedAt,workspaceRoot:e$1.workspaceRef,status:"implemented",mode:"read-mostly",runtime:{command:P("workspace mcp serve"),transport:"stdio-jsonrpc",lifecycle:"dual-era",supportedProtocolVersions:["2024-11-05","2025-03-26","2025-06-18","2025-11-25","2026-07-28"],structuredContent:true,toolExecutionErrors:true},safety:{writeToolsEnabled:false,approvalRequiredForRefresh:true,artifactReadsMustStayInsideWorkspace:true},candidateTools:[{name:"getWorkspaceModel",reads:[e.model],mutates:false},{name:"getWorkspaceKnowledgeGraph",reads:[e.knowledgeGraph],mutates:false},{name:"getWorkspaceEvaluation",reads:[e.evaluationLive,e.evaluationLastRun],mutates:false},{name:"queryWorkspaceEntities",reads:[e.knowledgeGraph],mutates:false},{name:"searchWorkspaceGraph",reads:[e.knowledgeGraph],mutates:false},{name:"getWorkspaceGraphEvidence",reads:[e.knowledgeGraph],mutates:false},{name:"findWorkspaceGraphPath",reads:[e.knowledgeGraph],mutates:false},{name:"getEvidenceIndex",reads:[e.agentIndex],mutates:false},{name:"getBlockers",reads:[e.agentIndex,e.verify,i.pipelineLastRun],mutates:false},{name:"getSafeCommands",reads:[e.agentContext],mutates:false},{name:"getProjectContext",reads:[e.model,e.agentContext],mutates:false},{name:"getArtifact",reads:["requested workspace-relative artifact path"],mutates:false},{name:"listOperationalSkills",reads:[e.skillsIndex],mutates:false},{name:"getWorkspaceExplain",reads:[e.explain,e.verify,e.impact],mutates:false}],plannedTools:[{name:"refreshWorkspaceIntelligence",command:P("workspace agent-sync --write --refresh-context"),mutates:true,approvalRequired:true,availability:"not-served"}]},null,2)}
|
|
33
|
+
`}function sn(e$1){return `${JSON.stringify({schemaVersion:h$3.agentHooks.schemaVersion,generatedAt:e$1.generatedAt,workspaceRoot:e$1.workspaceRef,enabledByDefault:false,mode:"advisory",hooks:[{name:"workspai-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:"workspai-post-tool-use-verify-suggestion",event:"PostToolUse",purpose:"Suggest non-destructive verification commands after edits.",defaultAction:"suggest",commands:[P("doctor workspace"),P("workspace verify --strict --json")]},{name:"workspai-user-prompt-submit-scope-hint",event:"UserPromptSubmit",purpose:"Inject lightweight workspace scope and evidence index hints.",defaultAction:"inject-context-hint",reads:[e.agentIndex,e.agentContext]}]},null,2)}
|
|
34
|
+
`}function Mt(e$1){let t=["---","name: workspai-workspace-intelligence","description: Use Workspai workspace intelligence reports to answer, repair, verify, and release with evidence","---","","# Workspai 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 \`${e.agentIndex}\`.`,`3. Load \`${e.agentContext}\`.`,`4. Load \`${e.skillsIndex}\` 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 Workspai 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$1?.trim()&&t.push(e$1.trim(),""),t.join(`
|
|
35
|
+
`)}function me(e$1){return ["---",`name: ${e$1.name}`,`description: ${e$1.description}`,`tools: [${e$1.tools.map(t=>`'${t}'`).join(", ")}]`,"---","",`You are the ${e$1.name} agent for Workspai Workspace Intelligence.`,"",`Mode: ${e$1.mode}.`,"",`Start every task by reading \`${e.agentIndex}\` and \`${e.agentContext}\`.`,"","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(`
|
|
36
|
+
`)}function $(e$1){let t=["---","name: workspai-grounding","description: Load Workspai workspace intelligence reports before diagnosing or changing code","---","","<!-- WORKSPAI:GENERATED-PORTABLE-SKILL -->","","# Workspai grounding","","Use when the user asks about workspace health, release gates, doctor/pipeline failures, or project structure.","","## Workflow","",`1. Read \`${e.agentIndex}\``,`2. Read \`${e.agentContext}\``,"3. Read fail/warn evidence artifacts listed in the index","4. Propose the smallest safe fix with explicit verification commands",""],r=e$1.model?.projects?.map(n=>n.name||n.slug).filter(Boolean).slice(0,10);if(r&&r.length>0){t.push("## Projects in this workspace","");for(let n of r)t.push(`- ${n}`);t.push("");}if(e$1.index.blockers.length>0){t.push("## Current blockers","");for(let n of e$1.index.blockers.slice(0,8))t.push(`- ${n}`);t.push("");}if(e$1.context?.safeCommands?.length){t.push("## Safe commands (prefer these)","");for(let n of e$1.context.safeCommands.slice(0,6))t.push(`- \`${n.display}\` \u2014 ${n.description}`);t.push("");}return t.push("## Rules","","- Treat `.workspai/reports/*` JSON reports as canonical gate and health evidence.","- Do not invent pass/fail state \u2014 cite `exitCode`, `blockers`, and `generatedAt` fields.","- Return answers with: Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.","","## Refresh stale evidence","","```bash",P("workspace agent-sync --write --refresh-context"),"```",""),t.join(`
|
|
37
|
+
`)}async function f(e,t,r){return r?(await h$1.ensureDir(s.dirname(e)),await h$1.writeFile(e,t,"utf8"),"written"):"skipped"}async function Ht(e){if(!e.write)return "skipped";let t=s.join(e.workspacePath,e.relativePath),r=await fe(e.workspacePath,t);if(await h$1.pathExists(r)){let n=await h$1.readFile(r,"utf8");if(!(n.includes(B)||n.includes("<!-- WORKSPAI:GENERATED-PORTABLE-SKILL -->")||n.includes("name: workspai-grounding")&&n.includes("# Workspai grounding")&&n.includes("workspace agent-sync --write --refresh-context")))return "skipped"}return await h$1.ensureDir(s.dirname(r)),await h$1.writeFile(r,e.content,"utf8"),"written"}async function Ze(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"):null,{upsertManagedAgentSection:r}=await import('./managed-agent-markers-COE5DJ3W.js'),n=r(t,e.generatedBody),i=e.preamble?`${e.preamble.trimEnd()}
|
|
38
|
+
|
|
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
|
+
|
|
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(b=>{if(b.code==="ENOENT")return null;throw b});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 b=await h$1.realpath(a),w=s.relative(n,b),I=w!==".."&&!w.startsWith(`..${s.sep}`)&&!s.isAbsolute(w),K=await h$1.stat(b);if(!I||!K.isDirectory())throw new Error(`Agent output path is blocked by authored repository state: ${c}`);a=b;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$2();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$1=s.resolve(e.workspacePath),r$1=e.now??new Date,n$1=e.staleAfterHours??24,i=Sr(e.targets),c$1=[...i].sort(),m=Ir(e.preset),a=e.write===true,k$1=e.strict===true,l$2,p$2=null,d=e.model;e.refreshContext&&(d??=await q({workspacePath:t$1,includeEvidence:true}),p$2=await c({workspacePath:t$1,model:d,agent:e.agent??"generic",scope:e.scope,includeEvidence:true}),a&&(l$2=await d$1(p$2,t$1)));let b=[],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$1,d),he=null;try{he=(await p({workspacePath:t$1})).contract;}catch{he=null;}let Ft=await Wr(t$1,T$1),at=Wt({model:T$1,context:p$2,contract:he,graph:Ft}),Vt=at.skills,Q$1=await jt({workspacePath:t$1,skills:Vt,generatedAt:r$1.toISOString(),write:a,decisions:at.decisions});for(let u of Q$1.skills){g(a?"written":"skipped",u.canonicalPath);for(let A of $t(u.skillId))(A.target==="agents"?!Xe(i):!y(i,A.target))||g(await Ht({workspacePath:t$1,relativePath:A.path,content:u.markdown,write:a}),A.path);}for(let u of Q$1.removedSkillIds)for(let A of $t(u))!(A.target==="agents"?Xe(i):y(i,A.target))||!a||await Or(t$1,A.path);g(a?"written":"skipped",b$1),ke=Nt(Q$1.index);let v$1=await Dt({workspacePath:t$1,staleAfterHours:n$1,now:r$1});if(g(await f(s.join(t$1,X),`${JSON.stringify(v$1,null,2)}
|
|
42
|
+
`,a),X),g(await f(s.join(t$1,f$3),`${$r(v$1)}
|
|
43
|
+
`,a),f$3),["agents","vscode","copilot","cursor","claude","codex","gemini","qwen","kimi","grok","windsurf","amazon-q","orca"].some(u=>y(i,u))&&g(await Ze({workspacePath:t$1,absolutePath:s.join(t$1,"AGENTS.md"),generatedBody:Gr({index:v$1,context:p$2}),write:a}),"AGENTS.md"),y(i,"claude")){let u$1=s.join(t$1,"CLAUDE.md");if(a){await fe(t$1,u$1);let{upsertManagedAgentSection:A}=await import('./managed-agent-markers-COE5DJ3W.js'),R=await h$1.pathExists(u$1)?await h$1.readFile(u$1,"utf8"):"",E=A(R,Kr()),_=E.includes("@AGENTS.md")?E:`@AGENTS.md
|
|
44
|
+
|
|
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$1,s$1),`${tn()}
|
|
46
|
+
`,a),s$1),g(await f(s.join(t$1,t),`${Qr()}
|
|
47
|
+
`,a),t),g(await f(s.join(t$1,u),`${rn()}
|
|
48
|
+
`,a),u),g(await f(s.join(t$1,P$1),$({index:v$1,context:p$2,model:T$1}),a),P$1);}if(y(i,"gemini")&&g(await et({workspacePath:t$1,absolutePath:s.join(t$1,"GEMINI.md"),importLine:"@./AGENTS.md",generatedBody:Qe("Gemini CLI"),write:a}),"GEMINI.md"),y(i,"qwen")&&g(await et({workspacePath:t$1,absolutePath:s.join(t$1,"QWEN.md"),importLine:"@AGENTS.md",generatedBody:Qe("Qwen Code"),write:a}),"QWEN.md"),y(i,"amazon-q")&&(g(await et({workspacePath:t$1,absolutePath:s.join(t$1,".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$1,v),Yr(),a),v)),y(i,"grok")&&(g(await f(s.join(t$1,q$1),Br(),a),q$1),g(await f(s.join(t$1,r),Jr(),a),r),g(await f(s.join(t$1,R),$({index:v$1,context:p$2,model:T$1}),a),R)),Xe(i)&&g(await Ht({workspacePath:t$1,relativePath:Q,content:$({index:v$1,context:p$2,model:T$1}),write:a}),Q),y(i,"windsurf")&&(g(await Ze({workspacePath:t$1,absolutePath:s.join(t$1,n),generatedBody:Xr(),write:a}),n),g(await f(s.join(t$1,o),Vr(),a),o),g(await f(s.join(t$1,p$1),zr(),a),p$1)),y(i,"cursor")&&(g(await f(s.join(t$1,h$2),qr(),a),h$2),g(await f(s.join(t$1,i$1),Mr(),a),i$1),g(await f(s.join(t$1,m$1),nn(),a),m$1),m==="enterprise"&&(g(await f(s.join(t$1,j),Hr(),a),j),g(await f(s.join(t$1,k),Ur(),a),k),g(await f(s.join(t$1,l),Fr(),a),l)),g(await f(s.join(t$1,O),$({index:v$1,context:p$2,model:T$1}),a),O)),Ut(i)){if(g(await Ze({workspacePath:t$1,absolutePath:s.join(t$1,".github/copilot-instructions.md"),generatedBody:Dr(),write:a}),".github/copilot-instructions.md"),g(await f(s.join(t$1,w),en(),a),w),g(await f(s.join(t$1,x),Kt("workspace"),a),x),g(await f(s.join(t$1,y$1),Zr(),a),y$1),g(await f(s.join(t$1,z$1),Kt("evidence"),a),z$1),g(await f(s.join(t$1,A),qt(),a),A),g(await f(s.join(t$1,B$1),qt(),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[R,E]of u)g(await f(s.join(t$1,R),E,a),R);let A=[[D$1,u[0][1]],[F,u[1][1]],[H,u[2][1]],[J$1,u[3][1]]];for(let[R,E]of A)g(await f(s.join(t$1,R),E,a),R);if(e.hydratePrompts===true)for(let R of await Lt({workspacePath:t$1,skills:Q$1.skills,write:a}))g(a?"written":"skipped",R);}if(g(await f(s.join(t$1,K),$({index:v$1,context:p$2,model:T$1}),a),K),g(await f(s.join(t$1,L),$({index:v$1,context:p$2,model:T$1}),a),L),m==="enterprise"){g(await f(s.join(t$1,M),Mt(ke),a),M),g(await f(s.join(t$1,N),Mt(ke),a),N);let u=[["artifact-map.md",D({title:"Artifact Map",lines:J.map(R=>`- \`${R.relativePath}\` \u2014 ${R.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[R,E]of u){let _=`${s.dirname(M)}/resources/${R}`;g(await f(s.join(t$1,_),E,a),_);let it=`${s.dirname(N)}/resources/${R}`;g(await f(s.join(t$1,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[R,E]of A){let _=`.github/agents/${R}`;g(await f(s.join(t$1,_),E,a),_);}}}if(m==="enterprise"){let u=on({workspaceRef:v$1.workspaceRoot,generatedAt:v$1.generatedAt});b$5(S,JSON.parse(u)),g(await f(s.join(t$1,S),u,a),S),g(await f(s.join(t$1,T),u,a),T);}if(m==="enterprise"&&e.experimentalHooks===true){let u=sn({workspaceRef:v$1.workspaceRoot,generatedAt:v$1.generatedAt});b$5(U,JSON.parse(u)),g(await f(s.join(t$1,U),u,a),U),g(await f(s.join(t$1,V),u,a),V);}let Z=a?await Dt({workspacePath:t$1,staleAfterHours:n$1,now:r$1}):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$1)).map(u=>u.path);if(k$1){ee.length>0&&b.push(`Missing required reports: ${ee.join(", ")}`),te.length>0&&b.push(`Stale reports (>${n$1}h): ${te.join(", ")}`);let u=K$1.map(A=>A.path).filter(A=>!jr(A));u.length>0&&b.push(`Unsafe generated output paths: ${u.join(", ")}`);}let N$1=a?await l$1({workspacePath:t$1,mode:e.projectGrounding??"managed",now:r$1}):void 0;if(k$1&&N$1&&N$1.skipped.length>0&&b.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(R=>R.status==="blocked"&&Er(i,R.id)).map(R=>`${s.basename(A.projectPath)}:${R.id}`));u.length>0&&b.push(`Project agent entry coverage blocked: ${u.join(", ")}`);}let ot=cn({workspaceRef:Z.workspaceRoot,generatedAt:r$1.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:b,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$1,Y),`${JSON.stringify(ot,null,2)}
|
|
49
|
+
`,a),Y),{workspacePath:t$1,indexPath:s.join(t$1,X),packPath:s.join(t$1,Y),pack:ot,contextPath:l$2,writtenFiles:w$1,skippedFiles:I$1,blockers:v$1.blockers,missingRequired:ee,staleReports:te,strictViolations:b,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$3(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$2,g,h,b$4,...g$1,"AGENTS.md",".gitignore"]){let d=s.join(l.projectPath,p);if((p==="AGENTS.md"||g$1.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{Bt as a,Yt as b,fr as c,kr as d,hr as e,X as f,Y as g,J as h,wr as i,Dt as j,aa as k,oa as l};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {h as h$1}from'./chunk-
|
|
1
|
+
import {h as h$1}from'./chunk-6UNATTB7.js';import o from'path';var h=h$1.artifactRemediationPlan.schemaVersion;function c(t){return t.replace(/\\/g,"/")}function P(t,r){return t.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/-+/g,"-").replace(/^[-_.]+|[-_.]+$/g,"").slice(0,80)||r}function p(t,r){let e=c(o.relative(t,r));return !e||e.startsWith("..")?true:e.split("/").filter(Boolean).some(a=>a==="..")}function A(t){let r=c(o.relative(t.workspacePath,t.projectPath)),e=p(t.workspacePath,t.projectPath),a=P(t.projectName,o.basename(t.projectPath)),n=e?`external/${a}`:r||a;return {relativePath:r||n,contractRelativePath:n,isExternal:e}}export{h as a,A as b};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {c
|
|
2
|
-
`);}async function
|
|
3
|
-
`),await
|
|
1
|
+
import {c}from'./chunk-3NM3JAZW.js';import {a}from'./chunk-A5FBGRJA.js';import {a as a$2}from'./chunk-NMXGSVMD.js';import {b}from'./chunk-XESFJN52.js';import {i,h as h$1}from'./chunk-6UNATTB7.js';import {h}from'./chunk-TABXSDTR.js';import {a as a$1}from'./chunk-TQEMLBAG.js';import {q,r,s}from'./chunk-RGNCL5OB.js';import {u,t}from'./chunk-VQZ5PI5J.js';import {promises}from'fs';import {randomUUID}from'crypto';import n from'path';import p from'chalk';import le from'fs-extra';import N from'ora';import {execa}from'execa';var de=3e4,me=45e3;async function ge(e){try{let r=await execa("git",["rev-parse","--show-toplevel"],{cwd:e,env:a$1()});return r.stdout.trim()?n.resolve(e,r.stdout.trim()):null}catch{return null}}async function re(e,r,t){if(await ge(e)){r.warn("Git initialization skipped because target is already inside a git worktree");return}r.start("Initializing git repository...");try{await execa("git",["init"],{cwd:e,env:a$1()}),await execa("git",["add","."],{cwd:e,env:a$1()}),await execa("git",["-c","user.name=Workspai","-c","user.email=workspai@localhost","commit","-m",t],{cwd:e,env:a$1()}),r.succeed("Git repository initialized");}catch{r.warn("Could not initialize git repository");}}function G(e){let r=a(e.path),t=Array.isArray(e.projects)?e.projects:[],o=[],a$1=new Set;for(let s of t){if(!s||typeof s.name!="string"||typeof s.path!="string")continue;let i=a(s.path);a$1.has(i)||(a$1.add(i),o.push({name:s.name,path:i}));}return {name:e.name,path:r,mode:e.mode,projects:o}}function I(e){let r=[],t=new Set;for(let o of e.workspaces||[]){if(!o||typeof o.name!="string"||typeof o.path!="string")continue;let a=G(o);t.has(a.path)||(t.add(a.path),r.push(a));}return {workspaces:r}}async function ue(e){let r;try{r=await promises.readFile(e,"utf8");}catch(t){if(t.code==="ENOENT")return {workspaces:[]};throw t}try{let t=JSON.parse(r);if(!t||!Array.isArray(t.workspaces))throw new Error("missing workspaces array");return I(t)}catch(t){throw new Error(`Workspace registry is invalid: ${e}`,{cause:t})}}async function ke(e){let r;try{r=await promises.readFile(e,"utf8");}catch(o){if(o.code==="ENOENT")return {workspaces:[]};throw o}let t;try{t=JSON.parse(r);}catch(o){throw new Error(`Workspace registry is invalid: ${e}`,{cause:o})}if(!t||typeof t!="object"||!Array.isArray(t.workspaces))throw new Error(`Workspace registry is invalid: ${e}`);for(let o of t.workspaces)if(!o||typeof o.name!="string"||typeof o.path!="string"||o.mode!==void 0&&typeof o.mode!="string"||o.projects!==void 0&&!Array.isArray(o.projects)||Array.isArray(o.projects)&&o.projects.some(a=>!a||typeof a.name!="string"||typeof a.path!="string"))throw new Error(`Workspace registry contains an invalid entry: ${e}`);return I(t)}async function z(){let e={workspaces:[]},r=new Set;for(let t of s()){let o=await ue(t);for(let a of o.workspaces)r.has(a.path)||(r.add(a.path),e.workspaces.push(a));}return e}async function oe(e=s()){let r={workspaces:[]},t=new Set;for(let o of e){let a=await ke(o);for(let s of a.workspaces)t.has(s.path)||(t.add(s.path),r.workspaces.push(s));}return r}function fe(e){let r=e?.code;return process.platform==="win32"&&(r==="EPERM"||r==="EINVAL"||r==="ENOSYS")}async function ae(e){try{await e.sync();}catch(r){if(!fe(r))throw r}}async function X(e,r){let t=n.dirname(e);await promises.mkdir(t,{recursive:true});let o=`${n.basename(e)}.`,a=Date.now();for(let i of await promises.readdir(t)){if(!i.startsWith(o)||!i.endsWith(".tmp"))continue;let c=n.join(t,i),d=await promises.stat(c).catch(()=>null);d&&a-d.mtimeMs>3e4&&await promises.rm(c,{force:true}).catch(()=>{});}let s=await promises.readFile(e,"utf8").catch(()=>null);if(s!==null){let i=false;try{let c=JSON.parse(s);i=Array.isArray(c.workspaces);}catch{i=false;}if(!i){let c=`${e}.corrupt-${Date.now()}`;await promises.copyFile(e,c);}}await se(e,`${JSON.stringify(I(r),null,2)}
|
|
2
|
+
`);}async function se(e,r){let t=n.dirname(e);await promises.mkdir(t,{recursive:true});let o=`${e}.${process.pid}.${randomUUID()}.tmp`;try{await promises.writeFile(o,r);let a=await promises.open(o,"r");try{await ae(a);}finally{await a.close();}try{await promises.rename(o,e);}catch(s){let i=s.code;if(i!=="EEXIST"&&i!=="EPERM")throw s;await le.move(o,e,{overwrite:true});}}finally{await promises.rm(o,{force:true}).catch(()=>{});}}async function Z(e){try{return {exists:true,content:await promises.readFile(e)}}catch(r){if(r.code==="ENOENT")return {exists:false};throw r}}async function ee(e,r){if(!r.exists){await promises.rm(e,{force:true});return}await se(e,r.content);}async function we(e,r){let t=n.join(e,"workspaces.json.lock"),o=randomUUID();await promises.mkdir(e,{recursive:true});let a=Date.now(),s;for(;!s;)try{s=await promises.open(t,"wx"),await s.writeFile(`${JSON.stringify({pid:process.pid,lockId:o,createdAt:new Date().toISOString()})}
|
|
3
|
+
`),await ae(s);}catch(i){if(i.code!=="EEXIST")throw i;let c=await promises.stat(t).catch(()=>null);if(c&&Date.now()-c.mtimeMs>de){let d=await promises.readFile(t,"utf8").then(g=>JSON.parse(g)).catch(()=>null),u=Number(d?.pid),f=false;if(Number.isInteger(u)&&u>0)try{process.kill(u,0),f=true;}catch(g){f=g.code==="EPERM";}if(!f){await promises.rm(t,{force:true}).catch(()=>{});continue}}if(Date.now()-a>me)throw new Error(`Timed out waiting for workspace registry lock: ${t}`);await new Promise(d=>setTimeout(d,25));}try{return await r()}finally{await s.close().catch(()=>{}),await promises.readFile(t,"utf8").then(c=>JSON.parse(c).lockId===o).catch(()=>false)&&await promises.rm(t,{force:true}).catch(()=>{});}}async function S(e){let r$1=q(),t=n.join(r$1,"workspaces.json"),o=n.join(r(),"workspaces.json"),a=[...new Set(s())];return we(r$1,async()=>{let[s,i]=await Promise.all([Z(t),Z(o)]),c=await oe(a);await e(c);let d=I(c);try{await X(t,d),await X(o,d);}catch(u){let g=(await Promise.allSettled([ee(t,s),ee(o,i)])).filter(k=>k.status==="rejected").map(k=>k.reason);throw g.length>0?new AggregateError([u,...g],"Workspace registry transaction failed and could not be fully restored"):u}return d})}async function ie(e,r){let t=a(e);await S(o=>{let a=o.workspaces.find(s=>s.path===t);if(a){a.name=r,a.mode=a.mode||"full",a.projects=Array.isArray(a.projects)?a.projects:[];return}o.workspaces.push({name:r,path:t,mode:"full",projects:[]});});}async function He(e){let r=a(e),o=(await oe()).workspaces.find(a=>a.path===r);return o?{...o,projects:o.projects.map(a=>({...a}))}:null}async function Ke(e,r){let t=a(e);await S(o=>{let a=o.workspaces.findIndex(i=>i.path===t);if(!r){a>=0&&o.workspaces.splice(a,1);return}let s=G(r);a>=0?o.workspaces[a]=s:o.workspaces.push(s);});}async function qe(e){let r=a(e);await S(t=>{t.workspaces=t.workspaces.filter(o=>o.path!==r);});}async function he(e,r){try{await ie(e,r);}catch{console.warn(p.gray("Note: Could not register workspace in shared registry"));}}async function Qe(e,r=false){let t=a(e),o={workspacePath:t,workspaceFound:false,added:[],skipped:0};try{let a$1=await z(),s=a$1.workspaces.find(k=>k.path===t);if(!s){if(await he(t,n.basename(n.resolve(e))),a$1=await z(),s=a$1.workspaces.find(k=>k.path===t),!s)return r||console.log("\u26A0\uFE0F Workspace could not be registered in registry"),o;r||console.log("\u2714 Registered workspace in shared registry");}Array.isArray(s.projects)||(s.projects=[]);let i=0,c=0,d=[],u$1=[],f=[e],g=new Set;for(;f.length>0;){let k=f.shift();if(!k||g.has(k))continue;g.add(k);let w=await promises.readdir(k,{withFileTypes:true});for(let h of w){if(!h.isDirectory()||h.name.startsWith(".")||["node_modules","dist","build","target","coverage","htmlcov"].includes(h.name))continue;let v=n.join(k,h.name),y=a(v);try{let x=false;for(let P of [...u(y,"context.json"),...u(y,"project.json")])try{await promises.access(P),x=true;break}catch{}if(x){let P=n.basename(y),m=s.projects.some($=>$.path===y);u$1.push({name:P,path:y}),m?c++:(s.projects.push({name:P,path:y}),i++,d.push(y),r||console.log(`\u2714 Added: ${n.relative(e,y)}`));continue}}catch{}f.push(v);}}return await S(k=>{let w=k.workspaces.find(y=>y.path===t);if(!w)return;let h=`${t}${n.sep}`,v=(w.projects||[]).filter(y=>y.path!==t&&!y.path.startsWith(h));w.projects=G({...w,projects:[...v,...u$1]}).projects;}),i>0?r||console.log(`
|
|
4
4
|
\u2705 Synced ${i} project(s) to registry`):r||console.log(`
|
|
5
|
-
\u2705 All projects already registered (${
|
|
5
|
+
\u2705 All projects already registered (${c} found)`),{workspacePath:t,workspaceFound:true,added:d,skipped:c}}catch(a){return r||console.error("\u274C Failed to sync projects:",a.message),o}}async function ye(e,r,t){let o=a(e),a$1=a(t);await S(s=>{let i=s.workspaces.find(u=>u.path===o);if(!i)throw new Error(`Workspace is not registered: ${o}`);i.projects=Array.isArray(i.projects)?i.projects:[];let c=i.projects.findIndex(u=>u.path===a$1||u.name===r),d={name:r,path:a$1};c>=0?i.projects[c]=d:i.projects.push(d);});}async function Xe(e,r,t){try{await ye(e,r,t);}catch{}}async function Ze(e,r){let t=N("Creating Workspai workspace...").start();try{await promises.mkdir(e,{recursive:true}),await promises.mkdir(n.join(e,".workspai"),{recursive:true});let o={workspace_name:r.name,author:r.author,rapidkit_version:h(),created_at:new Date().toISOString(),type:"workspace"};await promises.writeFile(n.join(e,".workspai","config.json"),JSON.stringify(o,null,2));let{syncWorkspaceFoundationFiles:a}=await import('./create-SOLLXXAB.js');await a(e,{workspaceName:r.name,installMethod:"venv",writeMarker:true,writeGitignore:false,onlyIfMissing:true});let s=$e();await promises.writeFile(n.join(e,"rapidkit"),s),await promises.chmod(n.join(e,"rapidkit"),493);let i=je();await promises.writeFile(n.join(e,"rapidkit.cmd"),i);let c=ve(r.name);await promises.writeFile(n.join(e,"README.md"),c),await promises.writeFile(n.join(e,".gitignore"),`# Workspai workspace
|
|
6
6
|
.env
|
|
7
7
|
.env.*
|
|
8
8
|
!.env.example
|
|
@@ -17,10 +17,10 @@ Thumbs.db
|
|
|
17
17
|
|
|
18
18
|
# Logs
|
|
19
19
|
*.log
|
|
20
|
-
`),await
|
|
21
|
-
${
|
|
20
|
+
`),await _e(e),t.succeed("Workspace created!"),r.skipGit||await re(e,N(),"Initial commit: Workspai workspace"),await ie(e,r.name);let{publishWorkspaceRegistrySummary:u}=await import('./workspace-registry-summary-QVSJKKTX.js');await u(e),console.log(`
|
|
21
|
+
${p.green("\u2728 Workspai workspace created successfully!")}
|
|
22
22
|
|
|
23
|
-
${
|
|
23
|
+
${p.bold("\u{1F4C2} Workspace structure:")}
|
|
24
24
|
${e}/
|
|
25
25
|
\u251C\u2500\u2500 rapidkit # Local CLI wrapper
|
|
26
26
|
\u251C\u2500\u2500 rapidkit.cmd # Windows local CLI wrapper
|
|
@@ -32,29 +32,29 @@ ${e}/
|
|
|
32
32
|
\u2502 \u2514\u2500\u2500 config.json # Workspai workspace config
|
|
33
33
|
\u2514\u2500\u2500 README.md
|
|
34
34
|
|
|
35
|
-
${
|
|
36
|
-
${
|
|
37
|
-
${
|
|
38
|
-
${
|
|
39
|
-
${
|
|
40
|
-
${
|
|
35
|
+
${p.bold("\u{1F680} Get started:")}
|
|
36
|
+
${p.cyan(`cd ${r.name}`)}
|
|
37
|
+
${p.cyan("npx workspai create project fastapi.standard my-api --yes")}
|
|
38
|
+
${p.cyan("cd my-api")}
|
|
39
|
+
${p.cyan("npx workspai init")}
|
|
40
|
+
${p.cyan("npx workspai dev")}
|
|
41
41
|
|
|
42
|
-
${
|
|
42
|
+
${p.bold("\u{1F4E6} Available templates:")}
|
|
43
43
|
fastapi - FastAPI + Python
|
|
44
44
|
nestjs - NestJS + TypeScript
|
|
45
45
|
springboot - Spring Boot + Java
|
|
46
46
|
gofiber - Go Fiber
|
|
47
47
|
gogin - Go Gin
|
|
48
48
|
|
|
49
|
-
${
|
|
49
|
+
${p.bold("\u{1F4DA} Commands:")}
|
|
50
50
|
npx workspai create project <kit> <name> Create a new project
|
|
51
51
|
npx workspai init Install dependencies
|
|
52
52
|
npx workspai dev Start dev server
|
|
53
53
|
npx workspai help Show all commands
|
|
54
54
|
|
|
55
|
-
${
|
|
56
|
-
${
|
|
57
|
-
`);}catch(o){throw t.fail("Failed to create workspace"),o}}function
|
|
55
|
+
${p.gray("Alternative: npx workspai dev, make dev")}
|
|
56
|
+
${p.gray("\u{1F4A1} Tip: Install globally (npm i -g workspai) to use without npx")}
|
|
57
|
+
`);}catch(o){throw t.fail("Failed to create workspace"),o}}function $e(){return `#!/usr/bin/env bash
|
|
58
58
|
#
|
|
59
59
|
# Workspai CLI - local workspace commands
|
|
60
60
|
# This script provides legacy ./rapidkit commands within the workspace
|
|
@@ -440,7 +440,7 @@ main() {
|
|
|
440
440
|
}
|
|
441
441
|
|
|
442
442
|
main "$@"
|
|
443
|
-
`}function
|
|
443
|
+
`}function je(){return `@echo off
|
|
444
444
|
setlocal enabledelayedexpansion
|
|
445
445
|
|
|
446
446
|
set "SCRIPT_DIR=%~dp0"
|
|
@@ -460,7 +460,7 @@ if %ERRORLEVEL%==0 (
|
|
|
460
460
|
echo [Workspai] No sh/bash found. Falling back to npx workspai.
|
|
461
461
|
npx workspai %*
|
|
462
462
|
exit /b %ERRORLEVEL%
|
|
463
|
-
`}function
|
|
463
|
+
`}function ve(e){return `# ${e}
|
|
464
464
|
|
|
465
465
|
Workspai workspace for building API projects.
|
|
466
466
|
|
|
@@ -517,7 +517,7 @@ instructions start at \`AGENTS.md\`.
|
|
|
517
517
|
|
|
518
518
|
- [Workspai Documentation](https://workspai.dev)
|
|
519
519
|
- [GitHub Repository](https://github.com/chistiq/workspai)
|
|
520
|
-
`}async function
|
|
520
|
+
`}async function _e(e){let{fileURLToPath:r}=await import('url'),t=r(import.meta.url),o=n.dirname(t),a=n.resolve(o,".."),s=n.join(a,"templates","kits"),i=n.join(e,".workspai","templates"),{default:c}=await import('fs-extra');await c.copy(s,i);let d=n.join(a,"templates","generator.js"),u=n.join(e,".workspai","generator.js");await c.copy(d,u);}async function et(e,r){let t=r.template==="fastapi",o=t?"FastAPI":"NestJS",a=N(`Creating ${o} project...`).start();try{let{fileURLToPath:s}=await import('url'),i=s(import.meta.url),c=n.dirname(i),d=n.resolve(c,".."),u=t?"fastapi-standard":"nestjs-standard",f=n.join(d,"templates","kits",u);await promises.mkdir(e,{recursive:true});let g={project_name:t?r.name.replace(/-/g,"_").toLowerCase():r.name.replace(/_/g,"-").toLowerCase(),author:r.author,description:r.description||`${o} application generated with Workspai`,app_version:"0.1.0",license:"MIT",package_manager:r.package_manager||"npm",created_at:new Date().toISOString(),rapidkit_version:h()};await ne(f,e,g);let k=t?`# Python
|
|
521
521
|
__pycache__/
|
|
522
522
|
*.py[cod]
|
|
523
523
|
*$py.class
|
|
@@ -585,10 +585,10 @@ Thumbs.db
|
|
|
585
585
|
|
|
586
586
|
# Coverage
|
|
587
587
|
coverage/
|
|
588
|
-
`;if(await promises.writeFile(
|
|
589
|
-
${
|
|
588
|
+
`;if(await promises.writeFile(n.join(e,".gitignore"),k),a.succeed(`${o} project created!`),r.skipGit||await re(e,N(),`Initial commit: ${o} project via Workspai`),!r.skipInstall&&!t){let h=r.package_manager||"npm",v=N(`Installing dependencies with ${h}...`).start();try{await execa(h,["install"],{cwd:e}),v.succeed("Dependencies installed");}catch{v.warn(`Could not install dependencies. Run '${h} install' manually.`);}}let w=n.basename(e);console.log(t?`
|
|
589
|
+
${p.green("\u2728 FastAPI project created successfully!")}
|
|
590
590
|
|
|
591
|
-
${
|
|
591
|
+
${p.bold("\u{1F4C2} Project structure:")}
|
|
592
592
|
${e}/
|
|
593
593
|
\u251C\u2500\u2500 .workspai/ # Project metadata
|
|
594
594
|
\u251C\u2500\u2500 src/
|
|
@@ -600,12 +600,12 @@ ${e}/
|
|
|
600
600
|
\u251C\u2500\u2500 pyproject.toml # Poetry configuration
|
|
601
601
|
\u2514\u2500\u2500 README.md
|
|
602
602
|
|
|
603
|
-
${
|
|
604
|
-
${
|
|
605
|
-
${
|
|
606
|
-
${
|
|
603
|
+
${p.bold("\u{1F680} Get started:")}
|
|
604
|
+
${p.cyan(`cd ${w}`)}
|
|
605
|
+
${p.cyan("npx workspai init")} ${p.gray("# Install dependencies")}
|
|
606
|
+
${p.cyan("npx workspai dev")} ${p.gray("# Start dev server")}
|
|
607
607
|
|
|
608
|
-
${
|
|
608
|
+
${p.bold("\u{1F4DA} Available commands:")}
|
|
609
609
|
npx workspai init # Install dependencies (poetry install)
|
|
610
610
|
npx workspai dev # Start dev server with hot reload
|
|
611
611
|
npx workspai start # Start production server
|
|
@@ -613,12 +613,12 @@ ${c.bold("\u{1F4DA} Available commands:")}
|
|
|
613
613
|
npx workspai lint # Lint code
|
|
614
614
|
npx workspai format # Format code
|
|
615
615
|
|
|
616
|
-
${
|
|
617
|
-
${
|
|
616
|
+
${p.gray("Alternative: make dev, npx workspai dev, poetry run dev")}
|
|
617
|
+
${p.gray("\u{1F4A1} Tip: Install globally (npm i -g workspai) to use without npx")}
|
|
618
618
|
`:`
|
|
619
|
-
${
|
|
619
|
+
${p.green("\u2728 NestJS project created successfully!")}
|
|
620
620
|
|
|
621
|
-
${
|
|
621
|
+
${p.bold("\u{1F4C2} Project structure:")}
|
|
622
622
|
${e}/
|
|
623
623
|
\u251C\u2500\u2500 .workspai/ # Project metadata
|
|
624
624
|
\u251C\u2500\u2500 src/
|
|
@@ -630,13 +630,13 @@ ${e}/
|
|
|
630
630
|
\u251C\u2500\u2500 package.json # Dependencies
|
|
631
631
|
\u2514\u2500\u2500 README.md
|
|
632
632
|
|
|
633
|
-
${
|
|
634
|
-
${
|
|
635
|
-
${r.skipInstall?
|
|
636
|
-
`:""}${
|
|
637
|
-
${
|
|
633
|
+
${p.bold("\u{1F680} Get started:")}
|
|
634
|
+
${p.cyan(`cd ${w}`)}
|
|
635
|
+
${r.skipInstall?p.cyan("npx workspai init")+p.gray(" # npm install")+`
|
|
636
|
+
`:""}${p.cyan("cp .env.example .env")}
|
|
637
|
+
${p.cyan("npx workspai dev")} ${p.gray("# Start dev server")}
|
|
638
638
|
|
|
639
|
-
${
|
|
639
|
+
${p.bold("\u{1F4DA} Available commands:")}
|
|
640
640
|
npx workspai init # Install dependencies
|
|
641
641
|
npx workspai dev # Start dev server with hot reload
|
|
642
642
|
npx workspai start # Start production server
|
|
@@ -645,22 +645,22 @@ ${c.bold("\u{1F4DA} Available commands:")}
|
|
|
645
645
|
npx workspai lint # Lint code
|
|
646
646
|
npx workspai format # Format code
|
|
647
647
|
|
|
648
|
-
${
|
|
648
|
+
${p.bold("\u{1F310} API endpoints:")}
|
|
649
649
|
http://localhost:8000/health # Health check
|
|
650
650
|
http://localhost:8000/docs # Swagger docs
|
|
651
651
|
http://localhost:8000/examples/notes # Example API
|
|
652
652
|
|
|
653
|
-
${
|
|
654
|
-
`);}catch(s){throw a.fail(`Failed to create ${o} project`),s}}async function
|
|
653
|
+
${p.gray("\u{1F4A1} Tip: Install globally (npm i -g workspai) to use without npx")}
|
|
654
|
+
`);}catch(s){throw a.fail(`Failed to create ${o} project`),s}}async function ne(e,r,t){let o=await promises.readdir(e,{withFileTypes:true});for(let a of o){let s=n.join(e,a.name),i=a.name.replace(/\.j2$/,""),c=n.join(r,i);if(a.isDirectory())await promises.mkdir(c,{recursive:true}),await ne(s,c,t);else {let d=await promises.readFile(s,"utf-8");a.name.endsWith(".j2")&&(d=Pe(d,t)),await promises.writeFile(c,d),(i==="rapidkit"||i==="activate"||i.endsWith(".py")&&(c.includes(".workspai")||c.includes(".rapidkit")))&&await promises.chmod(c,493);}}}function Pe(e,r){let t=e;for(let[o,a]of Object.entries(r)){let s=new RegExp(`\\{\\{\\s*${o}\\s*\\}\\}`,"g");t=t.replace(s,String(a));let i=new RegExp(`\\{\\{\\s*${o}\\s*\\|\\s*replace\\s*\\(\\s*['"]([^'"]+)['"]\\s*,\\s*['"]([^'"]*)['"]\\s*\\)\\s*\\}\\}`,"g");t=t.replace(i,(u,f,g)=>String(a).replace(new RegExp(f,"g"),g));let c=new RegExp(`\\{\\{\\s*${o}\\s*\\|\\s*lower\\s*\\}\\}`,"g");t=t.replace(c,String(a).toLowerCase());let d=new RegExp(`\\{\\{\\s*${o}\\s*\\|\\s*replace\\s*\\(\\s*['"]([^'"]+)['"]\\s*,\\s*['"]([^'"]*)['"]\\s*\\)\\s*\\|\\s*lower\\s*\\}\\}`,"g");t=t.replace(d,(u,f,g)=>String(a).replace(new RegExp(f,"g"),g).toLowerCase());}return t}async function tt(e={}){let r=q(),t=n.join(r,"workspaces.json"),o=await z();if(o.workspaces.length===0){if(e.json){console.log(JSON.stringify({schemaVersion:"rapidkit-workspace-list-v1",registryPath:t,workspaces:[],summary:{total:0,missing:0,registryExists:false}},null,2));return}console.log(p.yellow(`
|
|
655
655
|
\u26A0\uFE0F No workspaces registered yet.
|
|
656
|
-
`)),console.log(
|
|
657
|
-
`));return}try{let a=o;if(!a||typeof a!="object"||!Array.isArray(a.workspaces)){if(e.json){console.log(JSON.stringify({schemaVersion:"rapidkit-workspace-list-v1",registryPath:t,workspaces:[],summary:{total:0,missing:0,registryExists:true,registryValid:false},error:{code:"workspace.registry.invalid",message:"Workspace registry is invalid."}},null,2));return}console.log(
|
|
656
|
+
`)),console.log(p.gray(`Create a workspace with: npx workspai <workspace-name>
|
|
657
|
+
`));return}try{let a=o;if(!a||typeof a!="object"||!Array.isArray(a.workspaces)){if(e.json){console.log(JSON.stringify({schemaVersion:"rapidkit-workspace-list-v1",registryPath:t,workspaces:[],summary:{total:0,missing:0,registryExists:true,registryValid:false},error:{code:"workspace.registry.invalid",message:"Workspace registry is invalid."}},null,2));return}console.log(p.yellow(`
|
|
658
658
|
\u26A0\uFE0F Workspace registry is invalid; resetting to empty state.
|
|
659
|
-
`)),await
|
|
659
|
+
`)),await S(g=>{g.workspaces=[];});return}let s=I(a),i=[],c=0;for(let g of s.workspaces)await promises.stat(g.path).catch(()=>null)?i.push(g):c+=1;let d={workspaces:i},u=JSON.stringify(a),f=JSON.stringify(d);if(!e.json&&u!==f){let g=new Set(i.map(k=>k.path));await S(k=>{k.workspaces=k.workspaces.filter(w=>g.has(w.path));});}if(!d.workspaces||d.workspaces.length===0){if(e.json){console.log(JSON.stringify({schemaVersion:"rapidkit-workspace-list-v1",registryPath:t,workspaces:[],summary:{total:0,missing:c,registryExists:true,registryValid:true,cleanupApplied:false}},null,2));return}console.log(p.yellow(`
|
|
660
660
|
\u26A0\uFE0F No workspaces registered yet.
|
|
661
|
-
`)),
|
|
662
|
-
`));return}if(e.json){console.log(JSON.stringify({schemaVersion:"rapidkit-workspace-list-v1",registryPath:t,workspaces:d.workspaces,summary:{total:d.workspaces.length,missing:
|
|
661
|
+
`)),c>0&&console.log(p.gray(`Cleaned ${c} stale workspace entr${c===1?"y":"ies"}.
|
|
662
|
+
`));return}if(e.json){console.log(JSON.stringify({schemaVersion:"rapidkit-workspace-list-v1",registryPath:t,workspaces:d.workspaces,summary:{total:d.workspaces.length,missing:c,registryExists:true,registryValid:true,cleanupApplied:false}},null,2));return}console.log(p.bold(`
|
|
663
663
|
\u{1F4E6} Registered Workspai Workspaces:
|
|
664
|
-
`));for(let
|
|
665
|
-
`));}catch(a){if(e.json){console.log(JSON.stringify({schemaVersion:"rapidkit-workspace-list-v1",registryPath:t,workspaces:[],summary:{total:0,missing:0,registryExists:true,registryValid:false},error:{code:"workspace.registry.read_failed",message:a.message}},null,2));return}console.error(
|
|
666
|
-
\u274C Failed to read workspace registry`)),console.error(
|
|
664
|
+
`));for(let g of d.workspaces)console.log(p.cyan(` ${g.name}`)),console.log(p.gray(` Path: ${g.path}`)),console.log(p.gray(` Projects: ${g.projects?.length||0}`)),console.log();c>0&&console.log(p.gray(`Cleaned ${c} stale workspace entr${c===1?"y":"ies"}.`)),console.log(p.gray(`Total: ${d.workspaces.length} workspace(s)
|
|
665
|
+
`));}catch(a){if(e.json){console.log(JSON.stringify({schemaVersion:"rapidkit-workspace-list-v1",registryPath:t,workspaces:[],summary:{total:0,missing:0,registryExists:true,registryValid:false},error:{code:"workspace.registry.read_failed",message:a.message}},null,2));return}console.error(p.red(`
|
|
666
|
+
\u274C Failed to read workspace registry`)),console.error(p.gray(String(a)));}}function Re(e){if(!e||typeof e!="object"||Array.isArray(e))return [];let r=e.projects;return Array.isArray(r)?r.filter(t=>!!t&&typeof t=="object"&&!Array.isArray(t)):[]}function Se(e,r){if(r||!e||typeof e!="object"||Array.isArray(e))return e;let t=structuredClone(e);return Array.isArray(t.projects)&&(t.projects=t.projects.map(o=>{if(!o||typeof o!="object"||Array.isArray(o))return o;let a={...o};return delete a.externalPath,a})),t}async function xe(e){try{let r=await promises.readFile(e,"utf8");return JSON.parse(r)}catch{return null}}async function B(e){for(let r of e){let t=await xe(r);if(t!==null)return t}return null}function Ee(e){return c(e)}async function We(e){return a$2(e,{skipDirs:new Set(["node_modules","dist","build","target","coverage","htmlcov"]),includeHiddenDirs:false,descendIntoMatchedProjects:true})}async function J(e){try{return (await promises.readdir(e,{withFileTypes:true})).filter(t=>t.isFile()&&t.name.toLowerCase().endsWith(".json")).map(t=>t.name).sort((t,o)=>t.localeCompare(o))}catch{return []}}async function rt(e,r){let t$1=r?.includePaths===true,o=r?.includeDoctorEvidence!==false,a=r?.includeBlueprint!==false,s=n.resolve(e),i$1=await B(t(s,"workspace.json")),c=typeof i$1?.workspace_name=="string"&&i$1.workspace_name.trim()||n.basename(s),d=typeof i$1?.profile=="string"?i$1.profile:void 0,u$1=typeof i$1?.rapidkit_version=="string"?i$1.rapidkit_version:void 0,f=await B(t(s,"workspace.contract.json")),g=Se(f,t$1),k=await We(s),w=new Map;for(let m of k)w.set(n.resolve(m),{projectPath:n.resolve(m)});for(let m of Re(f)){let $=typeof m.externalPath=="string"?m.externalPath.trim():"",j=typeof m.relativePath=="string"?m.relativePath.trim():"";if(!$&&!j)continue;let b=n.resolve(s,$||j),R=w.get(b);w.set(b,{projectPath:b,name:typeof m.slug=="string"&&m.slug.trim()?m.slug.trim():R?.name,relativePath:j||R?.relativePath,runtime:typeof m.runtime=="string"&&m.runtime.trim()?m.runtime.trim():R?.runtime,kit:typeof m.kit=="string"&&m.kit.trim()?m.kit.trim():R?.kit,modules:Array.isArray(m.modules)?m.modules.filter(L=>typeof L=="string"):R?.modules});}let h=[];for(let m of w.values()){let $=m.projectPath,j=await B(u($,"project.json")),b=m.relativePath||n.relative(s,$)||".",R=n.dirname(u($,n.join("reports","placeholder"))[0]),L=n.dirname(u($,n.join("reports","placeholder"))[1]),D={name:m.name||n.basename($),relative_path:b,runtime:typeof j?.runtime=="string"?j.runtime:m.runtime,kit_name:typeof j?.kit_name=="string"?j.kit_name:m.kit,modules:Array.isArray(j?.modules)?j.modules.filter(E=>typeof E=="string"):m.modules};if(t$1&&(D.absolute_path=$),o){let E=await B([n.join(R,"doctor-last-run.json"),n.join(L,"doctor-last-run.json")]);Ee(E)&&(D.doctor_report=E);}let M=[...await J(R),...await J(L)].filter((E,ce,pe)=>pe.indexOf(E)===ce);M.length>0&&(D.reports=M),h.push(D);}let v=t(s,"reports"),y=[...await J(v[0]),...await J(v[1])].filter((m,$,j)=>j.indexOf(m)===$),x={schema_version:h$1.workspaceShareBundle.schemaVersion,generated_at:new Date().toISOString(),generated_by:"workspai",workspace:{name:c,relative_root:".",profile:d,rapidkit_version:u$1,...t$1?{absolute_root:s}:{}},summary:{project_count:h.length,doctor_evidence_included:o,contract_included:!!g},reports:{workspace:y},projects:h,...g?{contract:g}:{}};a&&(x.blueprint={schema_version:"rapidkit.workspace-blueprint.v1",purpose:"portable-reproducibility",workspace:{name:c,profile:d},projects:h.map(m=>({name:m.name,relative_path:m.relative_path,runtime:m.runtime,kit_name:m.kit_name,modules:m.modules??[],recreate_commands:[...m.kit_name?[`npx workspai create project ${m.kit_name} ${m.name} --yes --skip-install`]:[],`cd ${m.relative_path}`,"npx workspai init","npx workspai test"]})),recommended_commands:["npx workspai workspace contract verify --strict","npx workspai doctor workspace","npx workspai workspace run init --json","npx workspai workspace run test --strict --json","npx workspai readiness --strict --json"]});let P=r?.outputPath?n.resolve(r.outputPath):n.join(v[0],"share-bundle.json");return r?.outputPath||b(i.workspaceShareBundle,x),await promises.mkdir(n.dirname(P),{recursive:true}),await promises.writeFile(P,JSON.stringify(x,null,2),"utf8"),P}export{G as a,ie as b,He as c,Ke as d,qe as e,he as f,Qe as g,ye as h,Xe as i,Ze as j,et as k,tt as l,rt as m};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import {a as a$4}from'./chunk-ZEEV5J4I.js';import {f as f$1,e as e$1}from'./chunk-SX6A656X.js';import {a as a$1,b}from'./chunk-HLWDIIWL.js';import {b as b$1,c}from'./chunk-JZJBA2V2.js';import {a as a$2}from'./chunk-NMXGSVMD.js';import {p,a as a$3}from'./chunk-7FF5EOIO.js';import {k as k$1,m,l}from'./chunk-U5ENEDJA.js';import {e as e$2}from'./chunk-GAYK3WGV.js';import {e,f}from'./chunk-6UNATTB7.js';import {k,t,u}from'./chunk-VQZ5PI5J.js';import j from'fs';import i from'path';import a from'chalk';var Z=new Set([".git",".workspai",".rapidkit",".venv","node_modules","dist","build","target","coverage","htmlcov",".next"]);async function I(e){try{return await j.promises.access(e,j.constants.F_OK),true}catch{return false}}async function S(e){try{let n=JSON.parse(await j.promises.readFile(e,"utf-8"));return n&&typeof n=="object"&&!Array.isArray(n)?n:null}catch{return null}}async function v(e){try{return await j.promises.readFile(e,"utf-8")}catch{return ""}}function ee(e){return a$1(e)}async function ne(e,n){return await X([...u(e,"project.json"),...u(e,"context.json")])?true:b(e)?false:i.resolve(e)===i.resolve(n)?k$1(e).length>0:k$1(e).length>0}async function te(e){let n=await a$2(e,{skipDirs:Z,includeHiddenDirs:false,descendIntoMatchedProjects:false,isProjectDir:ne}),r=(await a$3(e)).filter(s=>s.relationship==="adopted"||s.source==="adopted-local").map(s=>i.resolve(s.path)).filter(s=>j.existsSync(s)),o=[...new Set([...n.map(s=>i.resolve(s)),...r])];return o.length>0?o:b(e)?[]:k$1(e).length>0?[e]:[]}function re(e,n){return i.relative(e,n).replace(/\\/g,"/")||"."}async function E(e,n){for(let t of n)if(await I(i.join(e,t)))return true;return false}async function X(e){for(let n of e)if(await I(n))return true;return false}async function Y(e){for(let n of e){let t=await S(n);if(t)return t}return null}async function oe(e){if(await E(e,["health","health.ts","health.js","health.py","health.go","health.kt","health.rb","health.php","healthcheck","health-check","src/health.ts","src/health.js","src/health.py","src/health.go","src/health.kt","src/health.rb","src/health.php","src/healthcheck.ts","src/healthcheck.js","src/liveness.ts","src/readiness.ts","src/ping.ts","app/controllers/health_controller.rb","app/controllers/health_check_controller.rb","config/initializers/health_check.rb"]))return true;let t=await v(i.join(e,"config","routes.rb"));return /(?:health|readiness|liveness|readiness_check|health_check)/iu.test(t)}async function se(e,n){if(await E(e,[".env",".env.local"]))return true;let t=n?.contracts&&typeof n.contracts=="object"?n.contracts:null;if(Array.isArray(t?.env)&&t.env.length>0)return true;let r=await S(i.join(e,"package.json")),o={...r?.dependencies??{},...r?.devDependencies??{}};if(Object.keys(o).some(c=>/^(?:dotenv|dotenv-flow|env-cmd)$/iu.test(c)))return true;let s=await v(i.join(e,"pyproject.toml"));if(/\b(?:python-dotenv|pydantic-settings)\b/iu.test(s))return true;let p=[await v(i.join(e,"compose.yaml")),await v(i.join(e,"compose.yml")),await v(i.join(e,"docker-compose.yml")),await v(i.join(e,"docker-compose.yaml"))].join(`
|
|
2
|
+
`);return /^\s*(?:env_file|environment)\s*:/imu.test(p)}async function ae(e){return (await a$4(e)).detected}async function ie(e){let n=await S(i.join(e,"package.json")),t=n?.scripts&&typeof n.scripts=="object"?n.scripts:{};return Object.keys(t).sort()}function y(e,n,t,r,o,s,p){return {id:e,severity:n,target:t,title:r,detail:o,remediation:s,...p&&p.length>0?{files:[...p]}:{}}}function ce(e){let n=e.reduce((t,r)=>r.severity==="fail"?t+28:r.severity==="warn"?t+12:t+3,0);return Math.max(0,100-n)}async function de(e,n,t){let r=await Y(u(n,"project.json")),o=m(n,r),s=l(n),p=o.runtime==="unknown"?s[0]||"unknown":o.runtime,c$1=[p,...s.filter(G=>G!==p)],g=await b$1(n,r,{runtime:p,framework:o.key}),w=["backend","service","worker"].includes(g),h=w&&/^(?:fastapi|django|flask|nestjs|express|fastify|springboot|gofiber|gogin|dotnet-webapi|laravel|rails|phoenix|axum|actix|rocket)$/u.test(o.key),k=re(e,n),u$1=k,b=await ie(n),C=await X([...u(n,"project.json"),...u(n,"context.json")]),P=await ae(n),x=await E(n,["Dockerfile","dockerfile"]),R=await E(n,[".env.example","env.example","config/env.example"]),F=await se(n,r),m$1=await c({projectPath:n,declaration:t?.governance}),d=m$1.ci.status==="repository",l$1=await oe(n),f=[];return o.key==="unknown"&&f.push(y("project.stack.unknown","fail",u$1,"Project stack is unknown","Workspai cannot confidently classify this backend project.","Add .workspai/project.json metadata or import the project with `workspai import`.")),C||f.push(y("project.marker.missing","warn",u$1,"Workspai marker is missing","The project can be detected by files, but it is not registered with Workspai metadata.","Run `workspai import <path>` from a workspace or create the project through Workspai.")),P||f.push(y("project.tests.missing","warn",u$1,"Test entrypoint is missing","No common test folder, config, or package test script was found.","Add a test command so `workspai workspace run test --affected` can gate changes.")),w&&F&&!R&&f.push(y("project.env.example.missing","info",u$1,"Environment example is missing","No .env.example or env.example file was found.","Add an env example for onboarding and CI secret documentation.",[".env.example"])),m$1.ci.status==="unknown"?f.push(y("project.ci.missing","warn",u$1,"CI governance is not proven","No repository CI surface or canonical external CI declaration was found for this project.","Add repository CI configuration or declare the external CI authority in the workspace contract.",[".github/workflows/ci.yml"])):m$1.ci.status==="external-observed"&&f.push(y("project.ci.external-observed","info",u$1,"Continuous integration appears externally managed",`Repository documentation references an external CI control plane (${m$1.ci.evidence.join(", ")}).`,"Declare the external CI provider in the canonical workspace contract when authoritative release gating depends on it.")),h&&!l$1&&f.push(y("project.health.missing","info",u$1,"Health or readiness probe is missing","The project has no obvious health or readiness endpoint to support automated deployment and runtime checks.","Add a simple health endpoint and document it for readiness gates and observability.")),w&&!x&&f.push(y("project.container.missing","info",u$1,"Container recipe is missing","No Dockerfile was found for this project.","Add a Dockerfile when the service is intended for containerized deployment.",["Dockerfile"])),{name:typeof r?.name=="string"&&r.name.trim()?r.name.trim():i.basename(n),path:n,relativePath:k,runtime:p,runtimeCandidates:c$1,framework:o.key,confidence:o.confidence,supportTier:o.supportTier,hasRapidKitMarker:C,hasTests:P,hasDockerfile:x,hasEnvExample:R,hasCiConfig:d,governance:m$1,hasHealthEndpoint:l$1,scripts:b,findings:f,score:ce(f)}}function le(e){return e.name.toLowerCase()}async function pe(e){let n=new Map(e.map(o=>[le(o),o])),t=[];for(let o of e){let s=await S(i.join(o.path,"package.json")),p={...s?.dependencies??{},...s?.devDependencies??{},...s?.peerDependencies??{}};for(let g of Object.keys(p)){let w=g.replace(/^@[^/]+\//,"").toLowerCase(),h=n.get(w);h&&h.relativePath!==o.relativePath&&t.push({from:o.relativePath,to:h.relativePath,kind:"package"});}let c=await v(i.join(o.path,"pyproject.toml"));for(let g of e)g.relativePath!==o.relativePath&&c.includes(g.name)&&t.push({from:o.relativePath,to:g.relativePath,kind:"workspace-reference"});}let r=new Set;return t.filter(o=>{let s=`${o.from}\0${o.to}\0${o.kind}`;return r.has(s)?false:(r.add(s),true)})}function ue(e,n){let t=new Map;for(let r of e)t.set(r.relativePath,{project:r.relativePath,directDependents:0,directDependencies:0});for(let r of n){let o=t.get(r.from),s=t.get(r.to);o&&(o.directDependencies+=1),s&&(s.directDependents+=1);}return Array.from(t.values()).sort((r,o)=>o.directDependents-r.directDependents||o.directDependencies-r.directDependencies)}async function me(e){let n=await Y(t(e,"workspace.json"));return typeof n?.profile=="string"?n.profile:null}function fe(e){return {fail:e.filter(n=>n.severity==="fail").length,warn:e.filter(n=>n.severity==="warn").length,info:e.filter(n=>n.severity==="info").length}}function ge(e){if(e.projectCount===0)return e.workspaceDetected?["Add your first project: npx workspai create project <name> --kit <kit>","Import an existing service: npx workspai import <path>"]:["Create a Workspai workspace: npx workspai create workspace my-workspace --profile polyglot","Import an existing service: npx workspai import ../service"];let n=[];return e.findings.some(t=>t.id==="workspace.marker.missing")&&n.push("Initialize workspace metadata with `workspai bootstrap --profile polyglot`."),e.findings.some(t=>t.id==="project.marker.missing")&&n.push("Register detected projects with `workspai import <path>` or recreate them via `workspai create project`."),e.findings.some(t=>t.id==="project.tests.missing")&&n.push("Add test entrypoints, then gate changes with `workspai workspace run test --affected --strict`."),e.findings.some(t=>t.id==="project.ci.missing")&&n.push("Add CI/CD configuration to catch regressions early and make workspace health checks actionable."),e.findings.some(t=>t.id==="project.health.missing")&&n.push("Add a health/readiness endpoint so runtime probes and deployment checks can verify service health."),e.hasCanonicalGraph||n.push("Generate canonical topology with `workspai workspace model --write --include-evidence`."),n.push("Run `workspai autopilot release --mode audit --json` before release."),Array.from(new Set(n))}async function Fe(e$3={}){let n=i.resolve(e$3.workspacePath||process.cwd());if(!await I(n))throw new Error(`Workspace path does not exist: ${n}`);let t=ee(n)??n,r=k(t),o=await me(t),s=await te(t),p$1;try{p$1=(await p({workspacePath:t})).contract;}catch{}let c=await Promise.all(s.map(d=>{let l=p$1?.projects.find(f=>{let G=f.externalPath??f.relativePath;return i.resolve(t,G)===i.resolve(d)});return de(t,d,l)})),g=await pe(c),w=ue(c,g),h=[];r||h.push(y("workspace.marker.missing","warn",".","Workspace metadata is missing","The directory can be analyzed, but it is not a registered Workspai workspace.","Run `workspai create workspace` or `workspai bootstrap --profile polyglot` in a workspace root.")),c.length===0&&h.push(y("workspace.projects.missing","warn",".","No backend projects detected","Workspai did not find runtime markers or project metadata under this root.","Create a project with `workspai create project` or import one with `workspai import <path>`."));let k$1=[...h,...c.flatMap(d=>d.findings)],u=fe(k$1),b={};for(let d of c)for(let l of d.runtimeCandidates)b[l]=(b[l]||0)+1;let C=c.length>0?Math.round(c.reduce((d,l)=>d+l.score,0)/c.length):0,P=h.reduce((d,l)=>d+(l.severity==="fail"?20:l.severity==="warn"?8:2),0),x=Math.max(0,C-P),R=c.length===0&&u.fail===0&&k$1.length>0&&k$1.every(d=>d.id==="workspace.projects.missing"&&d.severity==="warn"),F=u.fail>0||e$3.strict&&u.warn>0&&!R?"blocked":u.warn>0?"needs-attention":"ready",m={schemaVersion:f.analyze,generatedAt:new Date().toISOString(),workspacePath:t,workspaceDetected:r,profile:o,summary:{statusScope:"source-structure",releaseReadiness:"not-evaluated",score:x,verdict:F,projectCount:c.length,runtimeCount:Object.keys(b).length,findings:u},runtimes:b,projects:c,dependencyGraph:{status:g.length>0?"generated":"empty",edges:g,topImpactedProjects:w.slice(0,5)},findings:k$1,nextActions:ge({findings:k$1,projectCount:c.length,hasCanonicalGraph:await I(i.join(t,e.knowledgeGraph)),workspaceDetected:r}),enterpriseControls:{jsonReady:true,ciGateCommand:"workspai analyze --json --strict",releaseGateCommand:"workspai autopilot release --mode enforce --json",evidencePath:e.analyze}};if(e$3.output&&(await j.promises.mkdir(i.dirname(i.resolve(e$3.output)),{recursive:true}),await j.promises.writeFile(i.resolve(e$3.output),`${JSON.stringify(m,null,2)}
|
|
3
|
+
`)),!e$3.output&&r){let d=f$1(m,{commandId:"workspaceAnalyze",exitCode:m.summary.verdict==="blocked"?2:m.summary.verdict==="needs-attention"?1:0,generatedAt:m.generatedAt,blockers:m.findings.filter(l=>l.severity==="fail").map(l=>l.title).slice(0,12),runId:e$1()});await e$2(t,e.analyze,d);}return m}function Ge(e){let n=e.summary.verdict==="ready"?a.green:e.summary.verdict==="needs-attention"?a.yellow:a.red;if(console.log(a.bold(`
|
|
4
|
+
Workspai Workspace Analysis
|
|
5
|
+
`)),console.log(a.cyan("Workspace:"),e.workspacePath),console.log(a.cyan("Profile:"),e.profile||"not configured"),console.log(a.cyan("Source score:"),`${e.summary.score}/100`),console.log(a.cyan("Source verdict:"),n(e.summary.verdict)),console.log(a.cyan("Release readiness:"),e.summary.releaseReadiness),console.log(a.gray(`Projects: ${e.summary.projectCount}, runtimes: ${e.summary.runtimeCount}, findings: ${e.summary.findings.fail} fail / ${e.summary.findings.warn} warn / ${e.summary.findings.info} info`)),e.projects.length>0){console.log(a.bold(`
|
|
6
|
+
Projects`));for(let t of e.projects){let r=t.score>=85?a.green("pass"):t.score>=65?a.yellow("watch"):a.red("risk");console.log(` ${t.relativePath} ${a.gray(`${t.runtime}/${t.framework}`)} ${r} ${t.score}/100`);}}if(e.dependencyGraph.status==="generated"&&(console.log(a.bold(`
|
|
7
|
+
Dependency Graph`)),console.log(a.gray(` edges: ${e.dependencyGraph.edges.length}`)),e.dependencyGraph.topImpactedProjects.length>0)){console.log(a.gray(" Top impacted projects:"));for(let t of e.dependencyGraph.topImpactedProjects.slice(0,3))console.log(` ${t.project} (${t.directDependents} dependents, ${t.directDependencies} dependencies)`);}if(e.findings.length>0){console.log(a.bold(`
|
|
8
|
+
Top Findings`));for(let t of e.findings.slice(0,8)){let r=t.severity==="fail"?a.red:t.severity==="warn"?a.yellow:a.gray;console.log(` ${r(t.severity.toUpperCase())} ${t.target}: ${t.title}`),console.log(a.gray(` ${t.remediation}`));}}console.log(a.bold(`
|
|
9
|
+
Next Actions`));for(let t of e.nextActions.slice(0,5))console.log(a.gray(` - ${t}`));console.log();}export{Fe as a,Ge as b};
|