workspai 0.43.1 → 0.45.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.
Files changed (137) hide show
  1. package/README.md +28 -11
  2. package/contracts/agent-customization-pack.v1.json +1 -1
  3. package/contracts/autopilot-release.v1.json +204 -0
  4. package/contracts/cli-operation-result.v1.json +119 -0
  5. package/contracts/cli-runtime-command-inventory.v1.snapshot.json +1368 -0
  6. package/contracts/command-capabilities.v1.json +303 -0
  7. package/contracts/compatibility-matrix.v1.json +37 -0
  8. package/contracts/create-planner-capabilities.v1.json +156 -65
  9. package/contracts/doctor-project-scan.v2.json +60 -0
  10. package/contracts/doctor-remediation-plan.v1.json +19 -4
  11. package/contracts/doctor-remediation-plan.v2.json +7 -0
  12. package/contracts/doctor-workspace-cache.v2.json +82 -0
  13. package/contracts/extension-cli-compatibility.v1.json +48 -3
  14. package/contracts/infra-plan.v1.json +189 -0
  15. package/contracts/private-product-manifest.v1.json +155 -0
  16. package/contracts/product-factory-plan.v1.json +200 -0
  17. package/contracts/project-archive.v1.json +40 -0
  18. package/contracts/project-entry-capability.v1.json +127 -0
  19. package/contracts/published-contract-catalog.v1.json +339 -0
  20. package/contracts/runtime-command-surface.v1.json +1680 -11
  21. package/contracts/version.v1.json +48 -0
  22. package/contracts/workspace-archive-capabilities.v1.json +90 -0
  23. package/contracts/workspace-archive-manifest.v1.json +107 -0
  24. package/contracts/workspace-archive-operation-result.v1.json +565 -0
  25. package/contracts/workspace-intelligence/agent-customization-pack-report.v1.json +98 -0
  26. package/contracts/workspace-intelligence/agent-hooks.v1.json +38 -0
  27. package/contracts/workspace-intelligence/agent-reports-index.v1.json +56 -0
  28. package/contracts/workspace-intelligence/mcp-design.v1.json +42 -0
  29. package/contracts/workspace-intelligence/workspace-context.v1.json +12 -0
  30. package/contracts/workspace-intelligence/workspace-explain.v1.json +1 -0
  31. package/contracts/workspace-intelligence-architecture.v1.json +723 -0
  32. package/contracts/workspace-intelligence-chain.v1.json +1194 -0
  33. package/contracts/workspace-list.v1.json +56 -0
  34. package/contracts/workspace-model-cache.v1.json +55 -0
  35. package/contracts/workspace-snapshot.v1.json +58 -0
  36. package/contracts/workspace-snapshot.v2.json +97 -0
  37. package/contracts/workspace-sync.v1.json +30 -0
  38. package/contracts/workspace-watch-event.v1.json +112 -0
  39. package/dist/analyze-YLV7NVLF.js +1 -0
  40. package/dist/{artifact-remediation-plan-244S5K6I.js → artifact-remediation-plan-WLZGROUU.js} +2 -2
  41. package/dist/autopilot-release-YBN3SWAA.js +1 -0
  42. package/dist/{chunk-LZQNVH7D.js → chunk-2K3GYCPS.js} +1 -1
  43. package/dist/chunk-2QOWRBQD.js +1 -0
  44. package/dist/chunk-42G2OK64.js +1 -0
  45. package/dist/chunk-5AKYMAIL.js +1 -0
  46. package/dist/chunk-5GNT4RJI.js +8 -0
  47. package/dist/{chunk-FDDDQMJ2.js → chunk-5PVEQ6CZ.js} +1 -1
  48. package/dist/chunk-6AA3WWQZ.js +2 -0
  49. package/dist/chunk-6ZENXBMG.js +33 -0
  50. package/dist/chunk-7RIWU5TZ.js +1 -0
  51. package/dist/chunk-BJLE5CH7.js +4 -0
  52. package/dist/{chunk-PPHTYJ7G.js → chunk-DXPU4DDV.js} +36 -37
  53. package/dist/{chunk-DOCPUNWS.js → chunk-G3H5R3RR.js} +1 -1
  54. package/dist/chunk-HYJK7W3B.js +1 -0
  55. package/dist/chunk-IMUU5Q2V.js +13 -0
  56. package/dist/chunk-J4AICQFB.js +1 -0
  57. package/dist/{chunk-EMTQ6OKI.js → chunk-JP25YL3J.js} +1 -1
  58. package/dist/{chunk-ONU457VN.js → chunk-K63BSU56.js} +52 -50
  59. package/dist/chunk-KPPGZCUW.js +78 -0
  60. package/dist/chunk-KU4S7RCM.js +1 -0
  61. package/dist/chunk-LCRROMRR.js +2 -0
  62. package/dist/chunk-LG6RFLPZ.js +1 -0
  63. package/dist/{chunk-JHC6SCJC.js → chunk-NHN4QXPP.js} +1 -1
  64. package/dist/{chunk-U6AXYUQY.js → chunk-OOOPYUL2.js} +1 -1
  65. package/dist/chunk-P7SCWJFG.js +8 -0
  66. package/dist/chunk-QWU2CZBG.js +2 -0
  67. package/dist/chunk-V2H2KRMZ.js +1 -0
  68. package/dist/chunk-WANW4QA4.js +4 -0
  69. package/dist/chunk-XIVFLY6G.js +1 -0
  70. package/dist/chunk-ZWO6K24C.js +2 -0
  71. package/dist/{create-42RTNLH2.js → create-KFR6FLRT.js} +1 -1
  72. package/dist/doctor-YJDM5XBH.js +1 -0
  73. package/dist/index.d.ts +284 -25
  74. package/dist/index.js +214 -204
  75. package/dist/pipeline-FEDYO3IA.js +5 -0
  76. package/dist/{platform-capabilities-XAVU4HSM.js → platform-capabilities-YICBF4FA.js} +1 -1
  77. package/dist/{pythonRapidkitExec-GCQ3M46E.js → pythonRapidkitExec-UJYIB6FL.js} +1 -1
  78. package/dist/{workspace-DZHWB7BV.js → workspace-PLXOO6ST.js} +1 -1
  79. package/dist/workspace-agent-sync-G5YVI3BJ.js +1 -0
  80. package/dist/workspace-archive-EEGLHZDW.js +10 -0
  81. package/dist/workspace-context-E3UFWL5X.js +1 -0
  82. package/dist/{workspace-contract-2TA27LGT.js → workspace-contract-LQJDZV36.js} +1 -1
  83. package/dist/workspace-explain-G74ZIF23.js +1 -0
  84. package/dist/workspace-explain-contract-KT757JGQ.js +1 -0
  85. package/dist/{workspace-feedback-R6H4UFZB.js → workspace-feedback-YY6WQPWQ.js} +1 -1
  86. package/dist/{workspace-foundation-FQWHPQGX.js → workspace-foundation-3C2DLCVI.js} +1 -1
  87. package/dist/{workspace-history-CGCK2DJI.js → workspace-history-VF3CHDYQ.js} +1 -1
  88. package/dist/workspace-intelligence-3GG7GEDQ.js +1 -0
  89. package/dist/workspace-mcp-serve-MJMUV4RY.js +3 -0
  90. package/dist/{workspace-model-F3B75TYT.js → workspace-model-NG45SRM5.js} +1 -1
  91. package/dist/workspace-registry-summary-JM2XY52C.js +1 -0
  92. package/dist/workspace-run-WEQYIERE.js +1 -0
  93. package/dist/{workspace-verify-OAATQV5T.js → workspace-verify-ZNT6JX7D.js} +1 -1
  94. package/dist/workspace-watch-W47T4RX2.js +1 -0
  95. package/docs/AI_FEATURES.md +67 -34
  96. package/docs/README.md +2 -1
  97. package/docs/commands-reference.md +39 -14
  98. package/docs/contracts/ARTIFACT_CATALOG.md +60 -36
  99. package/docs/contracts/COMMAND_OWNERSHIP_MATRIX.md +27 -6
  100. package/docs/contracts/README.md +3 -2
  101. package/docs/create-planner-capabilities.md +36 -18
  102. package/docs/workspace-operations.md +25 -0
  103. package/package.json +27 -14
  104. package/scripts/enterprise-package-smoke.mjs +40 -8
  105. package/scripts/prepack-enterprise.mjs +12 -0
  106. package/dist/analyze-5BU4QIPK.js +0 -1
  107. package/dist/autopilot-release-45YVOBQO.js +0 -1
  108. package/dist/chunk-3QVTWKUI.js +0 -4
  109. package/dist/chunk-753LOKFZ.js +0 -2
  110. package/dist/chunk-AMDKXXLP.js +0 -1
  111. package/dist/chunk-AQ4XZZC6.js +0 -1
  112. package/dist/chunk-CDE4Q77U.js +0 -2
  113. package/dist/chunk-DNAY5ALC.js +0 -1
  114. package/dist/chunk-FHSMY75W.js +0 -1
  115. package/dist/chunk-FM7GMFZA.js +0 -2
  116. package/dist/chunk-HV5ZFXAZ.js +0 -13
  117. package/dist/chunk-LRW2SAGL.js +0 -4
  118. package/dist/chunk-LTWYYP6E.js +0 -7
  119. package/dist/chunk-NAAQMSO3.js +0 -1
  120. package/dist/chunk-NFUXULIF.js +0 -1
  121. package/dist/chunk-OL64GWQC.js +0 -9
  122. package/dist/chunk-SI3AQKIP.js +0 -1
  123. package/dist/chunk-TH5Y3EMA.js +0 -33
  124. package/dist/chunk-UQKCCWUL.js +0 -78
  125. package/dist/chunk-XNGANEXM.js +0 -2
  126. package/dist/doctor-DK4BON3N.js +0 -1
  127. package/dist/pipeline-HQ57V6OZ.js +0 -5
  128. package/dist/workspace-agent-sync-5ADIQS7B.js +0 -1
  129. package/dist/workspace-archive-GCZNI44O.js +0 -3
  130. package/dist/workspace-context-GEXDHA7A.js +0 -1
  131. package/dist/workspace-explain-D5NNL3NG.js +0 -1
  132. package/dist/workspace-explain-contract-DNS2YEL7.js +0 -1
  133. package/dist/workspace-intelligence-BEM6WGCZ.js +0 -1
  134. package/dist/workspace-mcp-serve-OMBA5V3C.js +0 -3
  135. package/dist/workspace-registry-summary-6MFBRWDS.js +0 -1
  136. package/dist/workspace-run-3WJXIQKR.js +0 -1
  137. package/dist/workspace-watch-HU2OTQ52.js +0 -1
@@ -1,33 +0,0 @@
1
- import {b,c as c$1,d}from'./chunk-CDE4Q77U.js';import {d as d$1}from'./chunk-AMDKXXLP.js';import {b as b$1,f,j as j$1,k as k$1,h,i,l as l$1,m,n as n$2,o,p,q,r,t,v,x,s,u,w as w$1,y,z as z$1,A,B as B$1,C,D,E as E$1,F as F$1,G,a,H,I}from'./chunk-DNAY5ALC.js';import {n as n$1,k as k$2,b as b$2,j as j$2}from'./chunk-FHSMY75W.js';import {j}from'./chunk-XNGANEXM.js';import {c}from'./chunk-NAAQMSO3.js';import n from'path';import k from'fs-extra';var U=["Scope","Evidence","Diagnosis","Fix Plan","Run","Verify","Assumptions"];var it="workspace-operational-skill.v1";function ct(e){if(typeof e!="string")return null;let t=e.trim();return !t||t.includes("/")||t.includes("..")?null:t}function Ge(e){let t=ct(e.skillId);if(!t)throw new Error(`Invalid skill id: ${e.skillId}`);return {schemaVersion:it,skillId:t,canonicalPath:H(t),title:e.title,triggers:[...e.triggers].sort((r,o)=>r.localeCompare(o)),requiredReports:[...e.requiredReports].sort((r,o)=>r.localeCompare(o)),scopedProjects:[...e.scopedProjects??[]].sort((r,o)=>r.localeCompare(o)),verificationCommands:[...e.verificationCommands],answerContractSections:[...U],...e.promptStem?{promptStem:e.promptStem}:{},markdown:e.markdown}}var pt="workspace-skills-index.v1";function He(e){let t=[...e.skills].sort((o,c)=>o.skillId.localeCompare(c.skillId)),r=e.inputsHash??b$2({skillIds:t.map(o=>o.skillId),paths:t.map(o=>o.canonicalPath)});return {schemaVersion:pt,generatedAt:e.generatedAt,inputsHash:r,skills:t.map(o=>({skillId:o.skillId,path:o.canonicalPath,schemaVersion:o.schemaVersion,title:o.title}))}}var Me=[".workspai/reports/INDEX.json",b,d$1],lt=[{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 `.workspai/reports/INDEX.json` and identify fail/warn reports for the scoped project.","Read `.workspai/reports/doctor-last-run.json`, `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."]},{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 `.workspai/reports/release-readiness-last-run.json` and `pipeline-last-run.json`.","Read `.workspai/reports/workspace-verify-last-run.json` for verdict and blocking reasons.","Read `.workspai/reports/artifact-remediation-plan-last-run.json` 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."]},{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.","Require project-scoped test/build commands before promoting the migration.","Document rollback and verification signals."]},{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.","Prefer workspace run test/build for affected projects.","Re-run `workspace verify` after evidence refresh."]},{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 `.workspai/workspace.contract.json` for publishes/consumes/owns edges.","List all consumer projects before proposing renames.","Update contract file and regenerate workspace model.","Verify contract gate and integration tests for consumers."]}];function z(e){return `npx workspai ${e}`.trim()}function dt(e){let t=[`# ${e.template.title}`,"",`> Workspace: **${e.workspaceName}** \xB7 Skill: \`${e.template.skillId}\``,"","## Objective","",e.template.objective,"","## Triggers","",...e.template.triggers.map(r=>`- ${r}`),"","## Required evidence (read first)","",...Me.map(r=>`- \`${r}\``),"","## Procedure","",...e.template.steps.map((r,o)=>`${o+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 ut(e){return e?.safeCommands?.length?e.safeCommands.slice(0,8).map(t=>t.display):[z("workspace verify --json"),z("doctor workspace --json")]}function gt(e){return e?.projects?.length?e.projects.slice(0,12).map(r=>{let o=r.contracts.owns.join(", ")||"none",c=r.contracts.publishes.join(", ")||"none",d=r.contracts.consumes.join(", ")||"none";return `- **${r.slug}**: owns \`${o}\`; publishes \`${c}\`; consumes \`${d}\``}).join(`
3
- `):void 0}function Ke(e){let t=e.model.workspace.name,r=e.model.projects.map(d=>d.name).sort(),o=ut(e.context??null),c=gt(e.contract??null);return lt.map(d=>{let p=dt({template:d,workspaceName:t,scopedProjects:r,verificationCommands:o,contractSummary:c});return Ge({skillId:d.skillId,title:d.title,triggers:d.triggers,requiredReports:[...Me],scopedProjects:r,verificationCommands:o,promptStem:I[d.skillId],markdown:p})})}async function qe(e){let t=n.resolve(e.workspacePath),r=[],o=b$2({skills:e.skills.map(d=>({id:d.skillId,path:d.canonicalPath,hash:b$2({markdown:d.markdown})}))}),c=He({generatedAt:e.generatedAt,skills:e.skills,inputsHash:o});if(e.write){for(let p of e.skills){let s=n.join(t,p.canonicalPath);await k.ensureDir(n.dirname(s)),await k.writeFile(s,p.markdown,"utf8"),r.push(p.canonicalPath);}let d=n.join(t,b$1);await k.ensureDir(n.dirname(d)),await k.writeJson(d,c,{spaces:2}),r.push(b$1);}return {skills:e.skills,index:c,writtenPaths:r}}function $e(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 kt={"workspai-diagnose-api-failure":p,"workspai-release-readiness":t},Ae="## Workspace verification (hydrated)";function mt(e){let t=[Ae,"","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 Ve(e){let t=n.resolve(e.workspacePath),r=[];for(let o of e.skills){let c=kt[o.skillId];if(!c)continue;let d=n.join(t,c);if(!await k.pathExists(d))continue;let p=await k.readFile(d,"utf8"),s=mt(o),m=p.includes(Ae)?p.replace(new RegExp(`${Ae}[\\s\\S]*$`),s.trimEnd()):`${p.trimEnd()}
6
-
7
- ${s}`;e.write&&await k.writeFile(d,`${m.trimEnd()}
8
- `,"utf8"),r.push(c);}return r}var ft="rapidkit-agent-customization-pack.v1";function Ue(){return {schemaVersion:ft,presets:{minimal:{meaning:"Generate the portable grounding index, AGENTS.md, and provider-specific lightweight instructions.",requiredOutputs:[".workspai/reports/INDEX.json",".workspai/reports/agent-customization-pack.json","AGENTS.md"]},enterprise:{meaning:"Generate the full VS Code-native pack: instructions, prompts, skills, custom agents, and validation metadata.",requiredOutputs:[".workspai/reports/INDEX.json",".workspai/reports/agent-customization-pack.json","AGENTS.md",l$1,p,B$1,".github/agents/workspai-advisor.agent.md",D,b$1]}},targets:{all:{meaning:"Generate every supported customization surface.",outputFamilies:["portable","vscode","copilot","cursor","claude"]},vscode:{meaning:"Generate VS Code-native customizations for Copilot Chat and agent workflows.",outputFamilies:["instructions","prompts","skills","agents","hooks"]},agents:{meaning:"Generate portable AGENTS.md grounding for any agent.",outputFamilies:["portable"]},copilot:{meaning:"Generate GitHub Copilot instructions, prompts, and skills.",outputFamilies:["instructions","prompts","skills"]},cursor:{meaning:"Generate Cursor rules.",outputFamilies:["rules"]},claude:{meaning:"Generate Claude Code grounding files.",outputFamilies:["rules","portable"]},codex:{meaning:"Use AGENTS.md and the report index as the Codex grounding layer.",outputFamilies:["portable"]},orca:{meaning:"Use AGENTS.md and the report index as the Orca/Grok grounding layer.",outputFamilies:["portable"]}},standardAnswerContract:[...U],requiredReports:N.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}/`],l2PrefixedMirrorRoots:[".github/",".cursor/",".claude/"],l3SharedIndustryFiles:["AGENTS.md",".github/copilot-instructions.md","CLAUDE.md"]}}}var wt="rapidkit-agent-reports-index.v1",ht="rapidkit-agent-customization-pack.v1",Pe=".workspai/reports/INDEX.json",F=".workspai/reports/agent-customization-pack.json";var N=[{relativePath:b,label:"Agent context pack",required:true},{relativePath:b$1,label:"Operational skills index",required:true},{relativePath:".workspai/reports/workspace-model.json",label:"Workspace model graph",required:false},{relativePath:".workspai/reports/doctor-last-run.json",label:"Workspace doctor",required:false},{relativePath:".workspai/reports/doctor-project-last-run.json",label:"Project doctor",required:false},{relativePath:".workspai/reports/doctor-remediation-plan-last-run.json",label:"Doctor remediation plan",required:false},{relativePath:".workspai/reports/artifact-remediation-plan-last-run.json",label:"Artifact remediation plan",required:false},{relativePath:".workspai/reports/doctor-fix-result-last-run.json",label:"Doctor fix result",required:false},{relativePath:".workspai/reports/analyze-last-run.json",label:"Workspace analyze",required:false},{relativePath:".workspai/reports/pipeline-last-run.json",label:"Governance pipeline",required:false},{relativePath:".workspai/reports/release-readiness-last-run.json",label:"Release readiness",required:false},{relativePath:".workspai/reports/workspace-impact-last-run.json",label:"Workspace impact",required:false},{relativePath:".workspai/reports/workspace-verify-last-run.json",label:"Workspace verify",required:false},{relativePath:".workspai/reports/workspace-model-snapshot.json",label:"Workspace model snapshot",required:false},{relativePath:".workspai/reports/workspace-model-diff-last-run.json",label:"Workspace model diff",required:false},{relativePath:".workspai/reports/workspace-explain-last-run.json",label:"Workspace explain",required:false},{relativePath:".workspai/reports/workspace-contract-verify-last-run.json",label:"Workspace contract verify",required:false},{relativePath:".workspai/reports/workspace-intelligence-history.json",label:"Workspace intelligence history",required:false}];function w(e){return `npx workspai ${e}`.trim()}function ot(e){return e&&typeof e=="object"?e:null}function Re(e,t=12){return Array.isArray(e)?e.filter(r=>typeof r=="string"&&r.trim().length>0).slice(0,t):[]}function At(e){let t=Re(e.blockers,12);if(t.length>0)return t;let r=Re(e.blockingReasons,12);if(r.length>0)return r;let o=ot(e.summary);return o&&Array.isArray(o.blockingReasons)?Re(o.blockingReasons,12):[]}function Pt(e){for(let t of ["generatedAt","timestamp"]){let r=e[t];if(typeof r=="string"&&r.trim())return r.trim()}}function Rt(e,t,r){if(!e)return true;let o=Date.parse(e);return Number.isFinite(o)?r.getTime()-o>t*60*60*1e3:true}function St(e){let t=e&&e.length>0?e:["all"];return t.includes("all")?new Set(["all","vscode","agents","copilot","cursor","claude","codex","orca"]):new Set(t)}function P(e,t){return e.has("all")||e.has(t)}function Ot(e){return P(e,"copilot")||P(e,"vscode")}function yt(e){return e??"enterprise"}function Ct(e){return e===b$1?"skills-index":e.includes("workspace-explain-last-run.json")?"explain-report":(e.startsWith(`${a}/`)||e.startsWith(".rapidkit/skills/"))&&e.endsWith(".md")?"operational-skill":e.includes("hooks")||e===F$1||e===G?"hook":e.includes("mcp")||e===D||e===E$1?"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 xt(e){return e.startsWith(".github/")?["vscode","copilot"]:e.startsWith(".cursor/")?["cursor"]:e.startsWith(".claude/")||e==="CLAUDE.md"?["claude"]:e==="AGENTS.md"||e.startsWith(".rapidkit/")?["agents","codex","orca","vscode"]:e.startsWith(".vscode/")?["vscode"]:["agents"]}function Et(e,t){return Ue().presets[t].requiredOutputs.includes(e)}function It(e){return e.schemaVersion===j$2&&typeof e.generatedAt=="string"&&e.summary!=null&&typeof e.summary=="object"&&!Array.isArray(e.summary)&&Array.isArray(e.projects)}async function bt(e,t){if(t)return t;let r=await c(e,k$2)??n.join(e,k$2);if(await k.pathExists(r))try{let o=await k.readJson(r);if(It(o))return o}catch{}return n$1({workspacePath:e,includeEvidence:true})}function _t(e){return e.length>0&&!n.isAbsolute(e)&&!e.split(/[\\/]+/).includes("..")}function Tt(e){return Object.fromEntries(["all","vscode","agents","copilot","cursor","claude","codex","orca"].map(r=>[r,{enabled:e.targets.includes("all")||e.targets.includes(r),outputs:e.outputs.filter(o=>o.targets.includes(r)).map(o=>o.path).sort()}]))}async function jt(e){try{if(!await k.pathExists(e))return null;let t=await k.readJson(e);return ot(t)}catch{return null}}async function ze(e){let t=e.now??new Date,r=e.staleAfterHours??24,o=[],c$1=[];for(let p of N){let s=await c(e.workspacePath,p.relativePath)??n.join(e.workspacePath,p.relativePath),m=await jt(s),I=m!==null;I&&m&&c$1.push(...At(m)),o.push({path:p.relativePath,label:p.label,required:p.required,exists:I,generatedAt:m?Pt(m):void 0,commandId:typeof m?.commandId=="string"?m.commandId:void 0,exitCode:typeof m?.exitCode=="number"?m.exitCode:void 0});}let d=[...new Set(c$1.map(p=>p.trim()).filter(Boolean))].slice(0,16);return {schemaVersion:wt,generatedAt:t.toISOString(),workspaceRoot:e.workspacePath,readOrder:N.map(p=>p.relativePath),blockers:d,staleAfterHours:r,reports:o,refreshCommand:w("workspace agent-sync --write --refresh-context")}}function Fe(e){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. `.workspai/reports/INDEX.json` \u2014 latest blockers, timestamps, and report paths","2. `.workspai/reports/workspace-context-agent.json` \u2014 canonical agent context pack","3. Evidence artifacts listed in the index (doctor, analyze, pipeline, readiness, impact, verify)","","Do **not** full-repo scan until these reports are read or regenerated.","","## Regenerate intelligence","","```bash",w("workspace agent-sync --write --refresh-context"),w("workspace context --for-agent --json --write"),w("pipeline --json --write"),"```",""];if(e.index.blockers.length>0){t.push("## Current blockers","");for(let r of e.index.blockers.slice(0,12))t.push(`- ${r}`);t.push("");}if(e.context?.safeCommands?.length){t.push("## Safe commands (prefer these)","");for(let r of e.context.safeCommands.slice(0,10))t.push(`- \`${r.display}\` \u2014 ${r.description}`);t.push("");}return t.push("## Rules","","- Treat `.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.",""),t.join(`
9
- `)}function vt(e){return ["# Workspai agent grounding","",`Generated: ${e.generatedAt}`,"","This file is tool-agnostic. Synced agents should read it together with `.workspai/reports/INDEX.json`.","","## Mandatory read order","",...e.readOrder.map((t,r)=>`${r+1}. \`${t}\``),"",e.blockers.length>0?"## Blockers":"",...e.blockers.length>0?e.blockers.map(t=>`- ${t}`):[],"","## Refresh","","```bash",e.refreshCommand,"```",""].filter(t=>t!=="").join(`
10
- `)}function Wt(){return ["# Workspai workspace grounding","","Before answering workspace, release, or architecture questions:","","1. Read `AGENTS.md` (managed Workspai section).","2. Read `.workspai/reports/INDEX.json` and `.workspai/reports/workspace-context-agent.json`.","3. Use evidence reports before scanning the full repository.","","Regenerate stale intelligence:","","```bash",w("workspace agent-sync --write --refresh-context"),"```",""].join(`
11
- `)}function Nt(){return ["## Claude Code","","- Load `.workspai/reports/INDEX.json` 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 Xe(){return ["---","description: Workspai workspace evidence and intelligence grounding","globs: []","alwaysApply: true","---","","Before proposing fixes in this workspace:","","1. Read `AGENTS.md` and `.workspai/reports/INDEX.json`.","2. Read `.workspai/reports/workspace-context-agent.json`.","3. Prefer evidence in `.workspai/reports/*` over full-repo exploration.","","Refresh when stale:","","```bash",w("workspace agent-sync --write --refresh-context"),"```",""].join(`
13
- `)}function Be(){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 `.workspai/reports/INDEX.json` for read order and blockers.","- Do not invent pass/fail state \u2014 cite `exitCode`, `blockers`, and `generatedAt` fields.",""].join(`
14
- `)}function Ye(){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 `.workspai/reports/INDEX.json` and `.workspai/reports/workspace-context-agent.json`.","- Distinguish workspace-level blockers from project-level blockers.","- When a project is active, cite its name, path, framework, and evidence source.","- Do not translate unsupported stack requests into unrelated native kits.","","## Answer contract","","Return answers with: Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.",""].join(`
15
- `)}function Je(){return ["# Workspai evidence","","Applies when reading or editing `.workspai/reports/*`.","","- Start from `INDEX.json`, then `workspace-context-agent.json`.","- Use report blockers as the primary fix target.","- Regenerate with `npx workspai workspace agent-sync --write`.",""].join(`
16
- `)}function Ze(){return ["---","description: Diagnose Workspai workspace blockers from evidence reports","---","","Diagnose this workspace using Workspai evidence only.","","Read:","","- `.workspai/reports/INDEX.json`","- `.workspai/reports/workspace-context-agent.json`","- Any fail/warn reports referenced in the index","","Return:","","1. Root cause grounded in report blockers","2. Smallest safe fix path (commands + file edits)","3. One verification command to prove recovery",""].join(`
17
- `)}function X(e){return ["---",`description: ${e.description}`,"---","",e.objective,"","Read first:","","- `.workspai/reports/INDEX.json`","- `.workspai/reports/workspace-context-agent.json`","- Any report referenced by the current blocker or task","","Return:","",...e.expectedOutput.map((t,r)=>`${r+1}. ${t}`),"","Use the standard Workspai answer contract: Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.",""].join(`
18
- `)}function E(e){return ["# "+e.title,"",...e.lines,""].join(`
19
- `)}function Lt(){return E({title:"MCP Tool Design",lines:["Workspai MCP is a future read-mostly bridge. Use the CLI reports today; do not assume a running MCP server exists.","","Candidate read tools:","- `getWorkspaceModel` \u2014 read `.workspai/reports/workspace-model.json`.","- `getEvidenceIndex` \u2014 read `.workspai/reports/INDEX.json`.","- `getBlockers` \u2014 derive current blockers from INDEX and gate reports.","- `getSafeCommands` \u2014 read safe commands from `workspace-context-agent.json`.","- `getProjectContext` \u2014 return one project-scoped slice of the workspace model.","- `getArtifact` \u2014 read one explicit artifact path inside the workspace root.","- `listOperationalSkills` \u2014 read `.workspai/reports/workspace-skills-index.json`.","- `getWorkspaceExplain` \u2014 read/build workspace explain for release-blocked or project scope.","- `refreshWorkspaceIntelligence` \u2014 explicit user-approved refresh command only.","","Write or repair tools require explicit approval boundaries and are intentionally not part of the first read-mostly design."]})}function Qe(e){return `${JSON.stringify({schemaVersion:"workspai-mcp-design.v1",generatedAt:e.generatedAt,workspaceRoot:e.workspacePath,status:"design-only",mode:"read-mostly",safety:{writeToolsEnabled:false,approvalRequiredForRefresh:true,artifactReadsMustStayInsideWorkspace:true},candidateTools:[{name:"getWorkspaceModel",reads:[".workspai/reports/workspace-model.json"],mutates:false},{name:"getEvidenceIndex",reads:[".workspai/reports/INDEX.json"],mutates:false},{name:"getBlockers",reads:[".workspai/reports/INDEX.json",".workspai/reports/workspace-verify-last-run.json",".workspai/reports/pipeline-last-run.json"],mutates:false},{name:"getSafeCommands",reads:[".workspai/reports/workspace-context-agent.json"],mutates:false},{name:"getProjectContext",reads:[".workspai/reports/workspace-model.json",".workspai/reports/workspace-context-agent.json"],mutates:false},{name:"getArtifact",reads:["requested workspace-relative artifact path"],mutates:false},{name:"listOperationalSkills",reads:[".workspai/reports/workspace-skills-index.json"],mutates:false},{name:"getWorkspaceExplain",reads:[".workspai/reports/workspace-explain-last-run.json",".workspai/reports/workspace-verify-last-run.json",".workspai/reports/workspace-impact-last-run.json"],mutates:false},{name:"refreshWorkspaceIntelligence",command:w("workspace agent-sync --write --refresh-context"),mutates:true,approvalRequired:true}]},null,2)}
20
- `}function et(e){return `${JSON.stringify({schemaVersion:"workspai-agent-hooks.v1",generatedAt:e.generatedAt,workspaceRoot:e.workspacePath,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:[w("doctor workspace"),w("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:[".workspai/reports/INDEX.json",".workspai/reports/workspace-context-agent.json"]}]},null,2)}
21
- `}function tt(e){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 `.workspai/reports/INDEX.json`.","3. Load `.workspai/reports/workspace-context-agent.json`.","4. Load `.workspai/reports/workspace-skills-index.json` when operational playbooks are needed.","5. Load the smallest evidence report required for the task.","6. Answer with Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.","","## Rules","","- Prefer 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?.trim()&&t.push(e.trim(),""),t.join(`
22
- `)}function B(e){return ["---",`name: ${e.name}`,`description: ${e.description}`,`tools: [${e.tools.map(t=>`'${t}'`).join(", ")}]`,"---","",`You are the ${e.name} agent for Workspai Workspace Intelligence.`,"",`Mode: ${e.mode}.`,"","Start every task by reading `.workspai/reports/INDEX.json` and `.workspai/reports/workspace-context-agent.json`.","","Use this answer contract:","","- Scope","- Evidence","- Diagnosis","- Fix Plan","- Run","- Verify","- Assumptions","","Do not invent health, readiness, or policy status. Cite report paths and command outputs.",""].join(`
23
- `)}function rt(){return ["---","name: workspai-grounding","description: Load Workspai workspace intelligence reports before diagnosing or changing code","---","","# Workspai grounding","","Use when the user asks about workspace health, release gates, doctor/pipeline failures, or project structure.","","## Workflow","","1. Read `.workspai/reports/INDEX.json`","2. Read `.workspai/reports/workspace-context-agent.json`","3. Read fail/warn evidence artifacts listed in the index","4. Propose the smallest safe fix with explicit verification commands","","## Refresh stale evidence","","```bash",w("workspace agent-sync --write --refresh-context"),"```",""].join(`
24
- `)}async function l(e,t,r){return r?(await k.ensureDir(n.dirname(e)),await k.writeFile(e,t,"utf8"),"written"):"skipped"}async function Se(e){if(!e.write)return "skipped";let t=await k.pathExists(e.absolutePath)?await k.readFile(e.absolutePath,"utf8"):null,{upsertManagedAgentSection:r}=await import('./managed-agent-markers-AXUM75OE.js'),o=r(t,e.generatedBody),c=e.preamble?`${e.preamble.trimEnd()}
25
-
26
- ${o}`:o;return await k.ensureDir(n.dirname(e.absolutePath)),await k.writeFile(e.absolutePath,c,"utf8"),"written"}function Pr(e){if(!e?.trim())return;let t=new Set(["all","vscode","agents","copilot","cursor","claude","codex","orca"]),r=e.split(",").map(o=>o.trim().toLowerCase()).filter(o=>t.has(o));return r.length>0?r:void 0}function Dt(e){let t=[...e.outputs].sort((r,o)=>r.path.localeCompare(o.path));return {schemaVersion:ht,generatedAt:e.generatedAt,workspaceRoot:e.workspacePath,preset:e.preset,targets:[...e.targets].sort(),sourceReports:e.index.reports.filter(r=>r.exists).map(r=>r.path).sort(),outputInventory:t,capabilityMatrix:Tt({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:w(`workspace agent-sync --write --refresh-context --preset ${e.preset}`),experimental:{hooksEnabled:e.experimentalHooks,mcpReady:t.some(r=>r.kind==="mcp-design")}}}async function Rr(e){let t$1=n.resolve(e.workspacePath),r$1=new Date,o$1=e.staleAfterHours??24,c=St(e.targets),d$1=[...c].sort(),p$1=yt(e.preset),s$1=e.write===true,m$1=e.strict===true,I,b=null,Y;e.refreshContext&&(Y=await n$1({workspacePath:t$1,includeEvidence:true}),b=await c$1({workspacePath:t$1,model:Y,agent:e.agent??"generic",scope:e.scope,includeEvidence:true}),s$1&&(I=await d(b,t$1)));let h$1=await ze({workspacePath:t$1,staleAfterHours:o$1,now:r$1}),_=[],J=[],Z=[],Q=[],a=(i,g)=>{i==="written"?J.push(g):Z.push(g),Q.push({path:g,kind:Ct(g),targets:xt(g),required:Et(g,p$1),status:i==="written"?"written":e.dryRun?"planned":"skipped"});};a(await l(n.join(t$1,Pe),`${JSON.stringify(h$1,null,2)}
27
- `,s$1),Pe),a(await l(n.join(t$1,f),`${vt(h$1)}
28
- `,s$1),f);let ee="",st=await bt(t$1,Y),te=null;try{te=(await j({workspacePath:t$1})).contract;}catch{te=null;}let nt=Ke({model:st,context:b,contract:te}),re=await qe({workspacePath:t$1,skills:nt,generatedAt:r$1.toISOString(),write:s$1});for(let i of re.skills)a(s$1?"written":"skipped",i.canonicalPath);if(a(s$1?"written":"skipped",b$1),ee=$e(re.index),(P(c,"agents")||P(c,"vscode"))&&a(await Se({absolutePath:n.join(t$1,"AGENTS.md"),generatedBody:Fe({index:h$1,context:b}),write:s$1}),"AGENTS.md"),P(c,"claude")){let i=n.join(t$1,"CLAUDE.md");if(s$1){let{upsertManagedAgentSection:g}=await import('./managed-agent-markers-AXUM75OE.js'),u=await k.pathExists(i)?await k.readFile(i,"utf8"):"",f=g(u,Nt()),R=f.includes("@AGENTS.md")?f:`@AGENTS.md
29
-
30
- ${f}`;await k.ensureDir(n.dirname(i)),await k.writeFile(i,R,"utf8"),J.push("CLAUDE.md");}else Z.push("CLAUDE.md");a(await l(n.join(t$1,j$1),`${Je()}
31
- `,s$1),j$1),a(await l(n.join(t$1,k$1),`${Je()}
32
- `,s$1),k$1);}if(P(c,"cursor")&&(a(await l(n.join(t$1,h),Xe(),s$1),h),a(await l(n.join(t$1,i),Xe(),s$1),i)),Ot(c)){if(a(await Se({absolutePath:n.join(t$1,".github/copilot-instructions.md"),generatedBody:Wt(),write:s$1}),".github/copilot-instructions.md"),a(await l(n.join(t$1,l$1),Ye(),s$1),l$1),a(await l(n.join(t$1,m),Ye(),s$1),m),a(await l(n.join(t$1,n$2),Be(),s$1),n$2),a(await l(n.join(t$1,o),Be(),s$1),o),a(await l(n.join(t$1,p),Ze(),s$1),p),a(await l(n.join(t$1,q),Ze(),s$1),q),p$1==="enterprise"){let i=[[r,X({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"]})],[t,X({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"]})],[v,X({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, external create-adopt, or adopt-only lane","Safe commands","Post-onboarding verification"]})],[x,X({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[u,f]of i)a(await l(n.join(t$1,u),f,s$1),u);let g=[[s,i[0][1]],[u,i[1][1]],[w$1,i[2][1]],[y,i[3][1]]];for(let[u,f]of g)a(await l(n.join(t$1,u),f,s$1),u);if(e.hydratePrompts===true)for(let u of await Ve({workspacePath:t$1,skills:re.skills,write:s$1}))a(s$1?"written":"skipped",u);}if(a(await l(n.join(t$1,z$1),rt(),s$1),z$1),a(await l(n.join(t$1,A),rt(),s$1),A),p$1==="enterprise"){a(await l(n.join(t$1,B$1),tt(ee),s$1),B$1),a(await l(n.join(t$1,C),tt(ee),s$1),C);let i=[["artifact-map.md",E({title:"Artifact Map",lines:N.map(u=>`- \`${u.relativePath}\` \u2014 ${u.label}`)})],["command-map.md",E({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",E({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",E({title:"Runtime Support",lines:["- Native create is available only for Workspai-owned scaffold contracts.","- Unsupported stacks should use external-create-adopt when a stable ecosystem generator exists.","- Existing projects should use adopt-only when native create is unavailable."]})],["create-planner-capabilities.md",E({title:"Create Planner Capabilities",lines:["- Use `contracts/create-planner-capabilities.v1.json` to decide native-create, external-create-adopt, or adopt-only.","- Do not map PHP, WordPress, Laravel, Rails, or Symfony requests to unrelated native kits.","- Explain unsupported native create requests and guide users to adopt/import."]})],["mcp-tools.md",Lt()]];for(let[u,f]of i){let R=`${n.dirname(B$1)}/resources/${u}`;a(await l(n.join(t$1,R),f,s$1),R);let ye=`${n.dirname(C)}/resources/${u}`;a(await l(n.join(t$1,ye),f,s$1),ye);}let g=[["workspai-advisor.agent.md",B({name:"Workspai Advisor",description:"Read-only workspace and project guidance using Workspai evidence",mode:"read-only",tools:["search","read"]})],["workspai-repair.agent.md",B({name:"Workspai Repair",description:"Turn Workspai blockers into minimal fixes and verification steps",mode:"repair",tools:["search","read","edit"]})],["workspai-release.agent.md",B({name:"Workspai Release",description:"Assess readiness, governance gates, and release safety from evidence",mode:"release",tools:["search","read"]})],["workspai-project-onboarder.agent.md",B({name:"Workspai Project Onboarder",description:"Guide create, import, and adopt flows with Workspai contracts",mode:"onboard",tools:["search","read","edit"]})]];for(let[u,f]of g){let R=`.github/agents/${u}`;a(await l(n.join(t$1,R),f,s$1),R);}}}p$1==="enterprise"&&(a(await l(n.join(t$1,D),Qe({workspacePath:t$1,generatedAt:h$1.generatedAt}),s$1),D),a(await l(n.join(t$1,E$1),Qe({workspacePath:t$1,generatedAt:h$1.generatedAt}),s$1),E$1)),p$1==="enterprise"&&e.experimentalHooks===true&&(a(await l(n.join(t$1,F$1),et({workspacePath:t$1,generatedAt:h$1.generatedAt}),s$1),F$1),a(await l(n.join(t$1,G),et({workspacePath:t$1,generatedAt:h$1.generatedAt}),s$1),G)),(P(c,"codex")||P(c,"orca"))&&(P(c,"agents")||a(await Se({absolutePath:n.join(t$1,"AGENTS.md"),generatedBody:Fe({index:h$1,context:b}),write:s$1}),"AGENTS.md"));let oe=s$1?await ze({workspacePath:t$1,staleAfterHours:o$1,now:r$1}):h$1,L=oe.reports.filter(i=>i.required&&!i.exists).map(i=>i.path),D$1=oe.reports.filter(i=>i.exists&&Rt(i.generatedAt,o$1,r$1)).map(i=>i.path);if(m$1){L.length>0&&_.push(`Missing required reports: ${L.join(", ")}`),D$1.length>0&&_.push(`Stale reports (>${o$1}h): ${D$1.join(", ")}`);let i=Q.map(g=>g.path).filter(g=>!_t(g));i.length>0&&_.push(`Unsafe generated output paths: ${i.join(", ")}`);}let Oe=Dt({workspacePath:t$1,generatedAt:r$1.toISOString(),preset:p$1,targets:d$1,index:oe,outputs:[...Q,{path:F,kind:"report",targets:["agents","vscode","copilot","codex","orca"],required:true,status:s$1?"written":e.dryRun?"planned":"skipped"}],missingRequired:L,staleReports:D$1,strictViolations:_,experimentalHooks:e.experimentalHooks===true});return a(await l(n.join(t$1,F),`${JSON.stringify(Oe,null,2)}
33
- `,s$1),F),{workspacePath:t$1,indexPath:n.join(t$1,Pe),packPath:n.join(t$1,F),pack:Oe,contextPath:I,writtenFiles:J,skippedFiles:Z,blockers:h$1.blockers,missingRequired:L,staleReports:D$1,strictViolations:_}}export{it as a,pt as b,wt as c,ht as d,Pe as e,F as f,N as g,ze as h,Pr as i,Rr as j,ft as k};