workspai 0.61.0 → 0.63.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 (65) hide show
  1. package/README.md +7 -5
  2. package/contracts/studio-card-repair-capabilities.v1.json +65 -1
  3. package/contracts/workspace-intelligence/agent-bootstrap-receipt.v1.json +31 -3
  4. package/contracts/workspace-intelligence/agent-customization-pack-report.v1.json +5 -1
  5. package/contracts/workspace-intelligence/agent-reports-index.v1.json +5 -1
  6. package/contracts/workspace-intelligence/project-agent-entry.v1.json +32 -4
  7. package/contracts/workspace-intelligence/project-context-agent.v1.json +34 -2
  8. package/contracts/workspace-intelligence/studio-blocker-handoff.v1.json +28 -0
  9. package/contracts/workspace-intelligence/workspace-context.v1.json +4 -1
  10. package/contracts/workspace-intelligence-chain.v1.json +4 -5
  11. package/dist/{artifact-remediation-plan-HPNQTNJ2.js → artifact-remediation-plan-XIQNI35L.js} +1 -1
  12. package/dist/autopilot-release-NUQKFKKK.js +1 -0
  13. package/dist/{chunk-NJ6WJ7VU.js → chunk-2LLMKTMO.js} +1 -1
  14. package/dist/{chunk-2FPANIX3.js → chunk-GXPOT3A7.js} +14 -12
  15. package/dist/{chunk-YGONW6VG.js → chunk-J5OMC4RZ.js} +1 -1
  16. package/dist/{chunk-WQX3JYEP.js → chunk-LNXIMF3O.js} +1 -1
  17. package/dist/chunk-ODJAKGQF.js +49 -0
  18. package/dist/{chunk-2JVRDBJC.js → chunk-PPQL5UTI.js} +1 -1
  19. package/dist/{chunk-JEGG4EEZ.js → chunk-QB3BLYUR.js} +1 -1
  20. package/dist/{chunk-4KNDIFJ5.js → chunk-QQU536KA.js} +1 -1
  21. package/dist/{chunk-GWMC6SSY.js → chunk-TTQVOCG6.js} +1 -1
  22. package/dist/{chunk-JRIEP4BY.js → chunk-TVCJKE2U.js} +1 -1
  23. package/dist/chunk-U5WVR74V.js +1 -0
  24. package/dist/{chunk-5YNZR74I.js → chunk-UDXFUASA.js} +1 -1
  25. package/dist/chunk-UIBBSKJ3.js +94 -0
  26. package/dist/chunk-VYDURWN7.js +1 -0
  27. package/dist/chunk-WRQWVSBJ.js +3 -0
  28. package/dist/chunk-YUGKQ44M.js +1 -0
  29. package/dist/chunk-Z5L2IK54.js +2 -0
  30. package/dist/{create-TPUFKW6B.js → create-2VELRQAX.js} +1 -1
  31. package/dist/{doctor-MAPZ2ZCD.js → doctor-LDZ7BIU3.js} +1 -1
  32. package/dist/{goal-lifecycle-BNLXDHED.js → goal-lifecycle-HAWBRYDF.js} +1 -1
  33. package/dist/{goal-pack-2PF775AU.js → goal-pack-HNQHQFRW.js} +1 -1
  34. package/dist/index.js +170 -170
  35. package/dist/{pipeline-BY2YL7C6.js → pipeline-TWHWU6GP.js} +1 -1
  36. package/dist/{project-agent-entry-VXCOXRJB.js → project-agent-entry-YFRLKNOB.js} +1 -1
  37. package/dist/{project-intelligence-lens-BA6JLXQH.js → project-intelligence-lens-VWBLAGQ7.js} +1 -1
  38. package/dist/{verified-goal-5OV4BALK.js → verified-goal-Y4NTKSWH.js} +1 -1
  39. package/dist/{workspace-J4OGSSNO.js → workspace-XWKEBPS3.js} +1 -1
  40. package/dist/{workspace-agent-sync-MU7W3C4S.js → workspace-agent-sync-FQU6VIEU.js} +1 -1
  41. package/dist/{workspace-context-MDACPLHD.js → workspace-context-DPDGFTWJ.js} +1 -1
  42. package/dist/workspace-explain-OU2PEVYO.js +1 -0
  43. package/dist/{workspace-explain-contract-JWFM22L4.js → workspace-explain-contract-V2IVSROX.js} +1 -1
  44. package/dist/{workspace-foundation-3X5OBEMM.js → workspace-foundation-MHKSQDKT.js} +1 -1
  45. package/dist/{workspace-intelligence-runner-DEW3CZKA.js → workspace-intelligence-runner-YQWX5VAM.js} +1 -1
  46. package/dist/{workspace-mcp-serve-S5IXSJJL.js → workspace-mcp-serve-PYKYJIE6.js} +1 -1
  47. package/dist/{workspace-onboarding-LK5IK6LE.js → workspace-onboarding-DRFJWRLH.js} +1 -1
  48. package/dist/{workspace-readme-56YZ4EAZ.js → workspace-readme-G7TZ3V5T.js} +1 -1
  49. package/dist/workspace-repair-engine-XZLHR27V.js +3 -0
  50. package/dist/workspace-run-YXI5L466.js +1 -0
  51. package/docs/agent-entry.md +32 -2
  52. package/docs/ci-workflows.md +1 -1
  53. package/package.json +1 -1
  54. package/dist/autopilot-release-7Q5JT7YN.js +0 -1
  55. package/dist/chunk-7DSYI7YN.js +0 -3
  56. package/dist/chunk-ASOFWN6J.js +0 -1
  57. package/dist/chunk-BQCGULHR.js +0 -1
  58. package/dist/chunk-PVXSIYLP.js +0 -1
  59. package/dist/chunk-RALI2ESF.js +0 -49
  60. package/dist/chunk-VDFHUYAQ.js +0 -91
  61. package/dist/chunk-ZJ62F4U3.js +0 -2
  62. package/dist/workspace-explain-NWP3JTFR.js +0 -1
  63. package/dist/workspace-repair-engine-3OLRNXD6.js +0 -3
  64. package/dist/workspace-run-JTEIX4WA.js +0 -1
  65. /package/dist/{chunk-JMFCMPWI.js → chunk-QA62UOE4.js} +0 -0
@@ -48,6 +48,11 @@ Workspai writes a portable entry contract at
48
48
  `.workspai/reports/project-context-agent.json`, and host adapters when project
49
49
  grounding is managed.
50
50
 
51
+ The shared context is intentionally compact. A complete Model or Graph export
52
+ is validated as canonical evidence but is not injected into first-contact
53
+ instructions. Agents retrieve task-specific, proof-backed slices through graph
54
+ search and only open the returned proof paths.
55
+
51
56
  At the start of an agent session, issue a receipt from the project directory:
52
57
 
53
58
  ```bash
@@ -70,8 +75,8 @@ The `workspai.agent-bootstrap-receipt.v1` payload checks:
70
75
  - canonical project-to-workspace membership;
71
76
  - entry manifest and project-context integrity hashes;
72
77
  - host discovery files without overwriting authored repository state;
73
- - presence and schema validity of the report index, agent context, Workspace
74
- Model, and Knowledge Graph;
78
+ - presence and schema validity of the report index, agent context, compact
79
+ Skills index, Workspace Model, and Knowledge Graph;
75
80
  - persisted Model/Graph compatibility;
76
81
  - live project input compatibility, unless explicitly skipped;
77
82
  - active Goal Pack and agent-handoff bindings;
@@ -84,6 +89,15 @@ provider-neutral bootstrap command; each runtime receipt replaces that step in
84
89
  `requiredReadOrder` with the resolved host (or `all` for a complete host audit),
85
90
  so a consumer is never routed back through the wrong adapter.
86
91
 
92
+ The Workspace Model and complete Knowledge Graph are validated by the receipt,
93
+ but are deliberately **not** part of `requiredReadOrder`. They are on-demand
94
+ deep-evidence artifacts: load them only for an explicit full export, offline
95
+ audit, or a task that cannot be answered from the project lens, bounded context,
96
+ and task-scoped Graph query. This keeps first contact bounded on large workspaces.
97
+ The compact Workspace Skills index *is* part of the route: use it to select one
98
+ relevant playbook, rather than loading every Skill or asking the model to infer
99
+ an operational procedure from raw source alone.
100
+
87
101
  The generated workspace name is a logical identity, never a filesystem path.
88
102
  Project-local artifacts use `.workspai/...`; canonical workspace artifacts use
89
103
  the `workspace:` URI prefix. When an agent requires direct file access, it
@@ -97,6 +111,9 @@ That resolver intentionally returns absolute paths to the local process. Its
97
111
  contract classifies them as machine-local, non-portable, forbidden to persist,
98
112
  and forbidden to disclose. Entry manifests, project lenses, bootstrap receipts,
99
113
  answers, shared logs, commits, prompts, and telemetry must not copy those paths.
114
+ Workspace-level agent reports use `workspace:<name>` as their `workspaceRoot`
115
+ identity for the same reason. A local filesystem root is runtime-only data, not
116
+ consumer-facing evidence.
100
117
 
101
118
  | Status | Meaning | Consumer rule |
102
119
  | ---------- | --------------------------------------------------------------------- | --------------------------------------------------------------------------- |
@@ -168,6 +185,19 @@ If an authored instruction file or symbolic link prevents safe management,
168
185
  Workspai preserves repository ownership and reports degraded or blocked host
169
186
  coverage. It does not replace the file to make a check pass.
170
187
 
188
+ ## Skills
189
+
190
+ Agent-sync derives operational playbooks from the detected workspace: runtime
191
+ validation is generated per detected runtime, and polyglot, test-evidence, and
192
+ delivery playbooks appear only when their supporting signals exist. The
193
+ canonical inventory remains under `.workspai/skills/`; standard portable
194
+ projections use `skills/<skill-name>/SKILL.md` with YAML frontmatter for hosts
195
+ that implement Agent Skills. A host without a documented Skills surface still
196
+ receives its native adapter and the portable canonical-first entry contract.
197
+ Agent-sync reconciles only Skill files marked as Workspai-generated, so a
198
+ runtime that disappears cannot leave a stale generated playbook behind and
199
+ authored Skill files remain untouched.
200
+
171
201
  ## Consumer integration
172
202
 
173
203
  IDEs and agent runtimes should:
@@ -63,7 +63,7 @@ Validate or preview the current CLI announcement locally:
63
63
  npm --workspace workspai run check:release-announcement
64
64
  npm --workspace workspai run release:announcement -- \
65
65
  --product workspai-cli \
66
- --tag v0.61.0 \
66
+ --tag v0.63.0 \
67
67
  --markdown-output /tmp/workspai-discord-announcement.md
68
68
  ```
69
69
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workspai",
3
- "version": "0.61.0",
3
+ "version": "0.63.0",
4
4
  "type": "module",
5
5
  "description": "Open-source workspace intelligence CLI for software systems: create, adopt, govern, verify, and align polyglot workspaces for humans, CI, IDEs, and AI agents.",
6
6
  "keywords": [
@@ -1 +0,0 @@
1
- export{b as AUTOPILOT_RELEASE_ALIAS_FILENAME,a as AUTOPILOT_RELEASE_LAST_RUN_FILENAME,c as runAutopilotRelease}from'./chunk-NJ6WJ7VU.js';
@@ -1,3 +0,0 @@
1
- import {a as a$1}from'./chunk-PVXSIYLP.js';import {b as b$1}from'./chunk-AO2ZI42U.js';import {a,e,b}from'./chunk-CCDGHPEJ.js';import {i,h}from'./chunk-NZ3WZYD5.js';import w from'path';import {existsSync}from'fs';import Z from'fs-extra';var G=[{artifactKind:"bootstrap-compliance",cardId:"bootstrap",fileNames:["bootstrap-compliance.latest.json"]},{artifactKind:"doctor-workspace",cardId:"doctor",fileNames:["doctor-remediation-plan-last-run.json","doctor-last-run.json"]},{artifactKind:"analyze",cardId:"analyze",fileNames:["analyze-last-run.json"]},{artifactKind:"readiness",cardId:"readiness",fileNames:["release-readiness-last-run.json"]},{artifactKind:"pipeline",cardId:"pipeline",fileNames:["pipeline-last-run.json"]},{artifactKind:"workspace-run",cardId:"workspaceRun",fileNames:["workspace-run-last.json"]},{artifactKind:"workspace-verify",cardId:"workspaceVerify",fileNames:["workspace-verify-last-run.json"]}];function g(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function A(e){return Array.isArray(e)?e.filter(r=>typeof r=="string"&&r.trim().length>0):[]}function I(e){return [...new Set(e.map(r=>r.trim()).filter(Boolean))]}function W(e){return (e.notes.includes("Doctor finding status: blocking")?16:0)+(e.transaction?8:0)+(e.operation?4:0)+(e.invocation?2:0)+(e.strategy?.length?1:0)}function Q(e){let r=W(e.incoming)>W(e.existing),o=structuredClone(r?e.incoming:e.existing),a=r?e.existing:e.incoming,t=a.sourceStepId;return o.order=e.existing.order,o.files=I([...o.files,...a.files]),o.notes=I([...o.notes,...a.notes.filter(i=>!i.startsWith("Source Doctor capability:")&&!i.startsWith("Doctor finding status:")),...t?[`Also satisfies Doctor capability: ${t}`]:[]]),o}function S(e,r,o){return o?r:w.relative(e,r).split(w.sep).join("/")}function X(e){let r=e?.trim()||"npx workspai bootstrap";if(!/(?:^|\s)--ci(?:\s|$)/.test(r)&&/(?:^|\s)--json(?:\s|$)/.test(r))return r.replace(/(?:^|\s)--json(?:\s|$)/,a=>{let t=a.startsWith(" ")?" ":"",i=a.endsWith(" ")?" ":"";return `${t}--ci --json${i}`}).trim();let o=/(?:^|\s)--ci(?:\s|$)/.test(r)?r:`${r} --ci`;return /(?:^|\s)--json(?:\s|$)/.test(o)?o:`${o} --json`}function Y(e){return `${JSON.stringify({schemaVersion:h.compatibilityMatrix.schemaVersion,generatedAt:e,source:"workspai workspace remediation-plan",runtimes:{},notes:["Minimal enterprise baseline. Add runtime and toolchain entries as governance matures."]},null,2)}
2
- `}function ee(e){return `${JSON.stringify({schema_version:"1.0",enabled:false,strategy:"on-demand",artifacts:[],created_at:e,note:"Minimal enterprise baseline. Set enabled: true and add artifact entries to activate mirroring."},null,2)}
3
- `}function te(e){let r=e.payload,o=A(r.blockers),a=A(r.blockingReasons),t=A(r.failures),i=A(r.reasons),d=A(r.policyViolations),s=g(r.summary),m=A(s?.blockers);if(e.artifactKind==="analyze"){let c=(Array.isArray(r.findings)?r.findings:[]).map(y=>g(y)).filter(y=>!!y).map(y=>String(y.message??y.title??y.id??"").trim()).filter(Boolean);return I([...o,...c,...a])}if(e.artifactKind==="workspace-run"){let b=g(r.stages),c=Object.entries(b??{}).flatMap(([y,f])=>{let n=g(f);return (Array.isArray(n?.projects)?n.projects:[]).map(l=>g(l)).filter(l=>!!l).filter(l=>l.status==="failed"||l.ok===false).map(l=>`${y}: ${String(l.project??l.name??"project")} failed`)});return I([...o,...c,...a])}return I([...o,...a,...t,...i,...d,...m])}function R(e){let r=e.findingId?.trim()||e.sourceStepId?.trim()||e.id,o=e.findingStatus??"blocking",a=e.causalKey?.trim()||[e.cardId,e.projectName??e.scope??"workspace",r].map(t=>String(t).trim().toLowerCase()).join(":");return {id:e.id,artifactKind:e.artifactKind,cardId:e.cardId,title:e.title,order:e.order,phase:e.phase,scope:e.scope??"workspace",...e.projectName?{projectName:e.projectName}:{},...e.projectPath?{projectPath:e.projectPath}:{},...e.sourceStepId?{sourceStepId:e.sourceStepId}:{},findingId:r,findingStatus:o,causalKey:a,...e.dependsOn?{dependsOn:e.dependsOn}:{},...e.strategy?{strategy:structuredClone(e.strategy)}:{},...e.transaction?{transaction:structuredClone(e.transaction)}:{},status:e.status??"ready",mode:e.mode,risk:e.risk,requiresApproval:true,blocker:e.blocker,summary:e.summary,...e.command?{command:e.command}:{},...e.invocation?{invocation:structuredClone(e.invocation)}:{},verifyCommand:e.verifyCommand,cwd:e.cwd??"workspace",files:e.files??[],...e.operation?{operation:e.operation}:{},rollback:e.rollback??(e.operation?{available:true,strategy:"idempotent"}:{available:false,strategy:"none"}),notes:e.notes??[]}}function re(e){return (Array.isArray(e.report.payload.steps)?e.report.payload.steps:[]).flatMap((o,a)=>{let t=g(o),i=typeof t?.id=="string"?t.id.trim():"",d=typeof t?.projectName=="string"?t.projectName.trim():"",s=typeof t?.projectPath=="string"?t.projectPath.trim():"",m=typeof t?.originalCommand=="string"?t.originalCommand.trim():"";if(!t||!i||!d||!s)return [];let b=g(t.studioStatus),c=b?.state==="ready"||b?.state==="review-required"||b?.state==="blocked"||b?.state==="guidance-only"?b.state:"guidance-only",y=t.risk==="safe"||t.risk==="guarded"||t.risk==="invasive"?t.risk:"guarded",f=g(t.preview),n=S(e.workspacePath,s,e.includeAbsolutePaths),u=z({capability:{...t,command:m},absoluteProjectPath:s,includeAbsolutePaths:e.includeAbsolutePaths}),l=q({capability:t,absoluteProjectPath:s,includeAbsolutePaths:e.includeAbsolutePaths}),v=E({operation:t.operation,absoluteProjectPath:s}),k=t.findingStatus==="blocking"||t.findingStatus==="advisory"||t.findingStatus==="informational"?t.findingStatus:"unknown",p=typeof t.diagnosisFindingId=="string"&&t.diagnosisFindingId.trim()?t.diagnosisFindingId.trim():typeof t.issueId=="string"&&t.issueId.trim()?t.issueId.trim():i,h=typeof t.causalKey=="string"&&t.causalKey.trim()?t.causalKey.trim():void 0,C=t.executableInCurrentEnvironment===true&&!!u,$=J({strategy:t.strategy,includeAbsolutePaths:e.includeAbsolutePaths}),j=g(t.transaction),x=j?.schemaVersion==="workspai.doctor-dependency-repair-transaction.v1"?structuredClone(j):void 0;return x&&(x.projectPath=n),[R({id:`doctor.${i}`,artifactKind:e.report.artifactKind,cardId:e.report.cardId,title:typeof f?.title=="string"&&f.title.trim()?f.title.trim():`Repair ${d}`,order:e.startOrder+a,phase:typeof t.phase=="string"?t.phase:"doctor-remediation",blocker:typeof f?.summary=="string"&&f.summary.trim()?f.summary.trim():`Doctor remediation is pending for ${d}.`,summary:typeof f?.summary=="string"&&f.summary.trim()?f.summary.trim():`Execute the CLI-authored Doctor step for ${d}.`,mode:C?"run-command":"manual-guidance",risk:y,status:c,...C&&u?{command:u}:{},...C&&l?{invocation:l}:{},...v?{operation:v}:{},verifyCommand:typeof t.verifyCommand=="string"&&t.verifyCommand.trim()?t.verifyCommand.trim():"npx workspai doctor project --json",files:A(t.files).map(P=>{let O=w.isAbsolute(P)?P:w.resolve(s,P);return S(e.workspacePath,O,e.includeAbsolutePaths)}),notes:[`Source Doctor step: ${i}`,`Doctor finding id: ${p}`,`Doctor finding status: ${k}`,...typeof b?.reason=="string"?[b.reason]:[]],scope:"project",projectName:d,projectPath:n,sourceStepId:i,findingId:p,findingStatus:k,causalKey:h,dependsOn:A(t.dependsOn).map(P=>`doctor.${P}`),strategy:$,transaction:x,cwd:"project",...g(t.rollback)?.available===true?{rollback:{available:true,strategy:"manual"}}:{}})]})}function z(e){let r=typeof e.capability.command=="string"?e.capability.command.trim():"";if(e.includeAbsolutePaths&&r)return r;let o=E({operation:e.capability.operation,absoluteProjectPath:e.absoluteProjectPath});if(o)return b$1(o);let a=g(e.capability.invocation),t=typeof a?.executable=="string"?a.executable.trim():"",i=A(a?.args);if(t)return [t,...i].map(s=>/^[a-zA-Z0-9_./:@=+-]+$/.test(s)?s:JSON.stringify(s)).join(" ");if(!r)return;let d=e.absoluteProjectPath.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return r.replace(new RegExp(`^cd\\s+["']?${d}["']?\\s*&&\\s*`,"i"),"").replaceAll(e.absoluteProjectPath,".")}function q(e){let r=g(e.capability.invocation),o=typeof r?.executable=="string"?r.executable.trim():"",a=A(r?.args);if(!(!o||a.length!==(Array.isArray(r?.args)?r.args.length:0)))return {cwd:e.includeAbsolutePaths?e.absoluteProjectPath:".",executable:o,args:a}}function E(e){let r=g(e.operation);if(!r||typeof r.type!="string")return;let o=structuredClone(r);for(let a of ["path","sourcePath"]){let t=o[a];if(typeof t!="string")continue;let i=w.isAbsolute(t)?w.relative(e.absoluteProjectPath,t):t;if(!i||i===".."||i.startsWith(`..${w.sep}`)||w.isAbsolute(i))return;o[a]=i.split(w.sep).join("/");}return o}function J(e){if(!Array.isArray(e.strategy))return;let r=structuredClone(e.strategy);if(!e.includeAbsolutePaths)for(let o of r)o.invocation&&(o.invocation.cwd=".");return r}function oe(e){let r=Array.isArray(e.report.payload.projects)?e.report.payload.projects:e.report.payload.project?[e.report.payload.project]:[],o=new Set,a=[];for(let t of r){let i=g(t);if(!i)continue;let d=typeof i.name=="string"?i.name.trim():"",s=typeof i.path=="string"?i.path.trim():"";if(!d||!s)continue;let m=Array.isArray(i.repairCapabilities)?i.repairCapabilities:Array.isArray(i.probes)?i.probes.map(f=>g(f)?.repairCapability).filter(f=>f!==void 0):[],b=new Map,c=new Map,y=g(i.diagnosis);for(let f of Array.isArray(y?.findings)?y.findings:[]){let n=g(f),u=g(n?.repair),l=typeof u?.capabilityId=="string"?u.capabilityId.trim():"",v=typeof n?.id=="string"?n.id.trim():"",k=typeof n?.causalKey=="string"?n.causalKey.trim():"",p=n?.status==="blocking"||n?.status==="advisory"||n?.status==="informational"||n?.status==="unknown"?n.status:"unknown";l&&v&&k&&c.set(l,{findingId:v,causalKey:k,findingStatus:p});}for(let f of Array.isArray(i.probes)?i.probes:[]){let n=g(f),u=g(n?.repairCapability),l=typeof u?.id=="string"?u.id.trim():"";l&&b.set(l,n?.status==="fail"?"blocking":"advisory");}for(let f of m){let n=g(f),u=typeof n?.id=="string"?n.id.trim():"";if(!n||!u)continue;let l=`${d}:${u}`;if(o.has(l))continue;o.add(l);let v=n.risk==="safe"||n.risk==="guarded"||n.risk==="invasive"?n.risk:"guarded",k=z({capability:n,absoluteProjectPath:s,includeAbsolutePaths:e.includeAbsolutePaths}),p=q({capability:n,absoluteProjectPath:s,includeAbsolutePaths:e.includeAbsolutePaths}),h=E({operation:n.operation,absoluteProjectPath:s}),C=n.status==="available"&&!!k,$=g(n.transaction),j=$?.schemaVersion==="workspai.doctor-dependency-repair-transaction.v1"?structuredClone($):void 0,x=c.get(u),P=x?.findingStatus??b.get(u)??(j?"blocking":"advisory");j&&(j.projectPath=S(e.workspacePath,s,e.includeAbsolutePaths));let O=J({strategy:n.strategy,includeAbsolutePaths:e.includeAbsolutePaths}),U=A(n.files).map(K=>S(e.workspacePath,K,e.includeAbsolutePaths)),T=R({id:`doctor.${d}.${u}`,artifactKind:e.report.artifactKind,cardId:e.report.cardId,title:typeof n.title=="string"&&n.title.trim()?n.title.trim():`Repair ${d}`,order:e.startOrder+a.length,phase:j?"dependency-remediation":"doctor-remediation",blocker:typeof n.reason=="string"&&n.reason.trim()?n.reason.trim():`Doctor remediation is pending for ${d}.`,summary:typeof n.reason=="string"&&n.reason.trim()?n.reason.trim():`Execute the Doctor-authored repair capability for ${d}.`,mode:C?n.canEditFiles===true?"edit-file":"run-command":"manual-guidance",risk:v,status:C?"ready":n.status==="manual"?"guidance-only":"blocked",...k?{command:k}:{},...p?{invocation:p}:{},verifyCommand:typeof n.verifyCommand=="string"&&n.verifyCommand.trim()?n.verifyCommand.trim():"npx workspai doctor project --json",files:U,notes:[`Source Doctor capability: ${u}`,`Doctor finding status: ${P}`,...A(n.limitations)],scope:"project",projectName:d,projectPath:S(e.workspacePath,s,e.includeAbsolutePaths),sourceStepId:u,findingId:x?.findingId??(typeof n.issueId=="string"&&n.issueId.trim()?n.issueId.trim():u),findingStatus:P,causalKey:x?.causalKey,strategy:O,transaction:j,cwd:"project",...h?{operation:h,rollback:{available:true,strategy:"manual"}}:{}}),M=k?a.findIndex(K=>K.projectName===d&&K.command===k&&K.cwd==="project"):-1;if(M>=0){a[M]=Q({existing:a[M],incoming:T});continue}a.push(T);}}return a}function ie(e){let r=[],o=X("npx workspai bootstrap --json");for(let a of e.blockers)a.includes("profile.enterprise.ci")&&r.push(R({id:"bootstrap.enterprise-ci",artifactKind:"bootstrap-compliance",cardId:"bootstrap",title:"Run bootstrap in deterministic CI mode",order:10,phase:"bootstrap-preflight",blocker:a,summary:"Enterprise bootstrap compliance requires --ci for deterministic execution.",mode:"run-command",risk:"safe",command:o,verifyCommand:o})),a.includes("profile.enterprise.compatibility-matrix")&&r.push(R({id:"bootstrap.compatibility-matrix",artifactKind:"bootstrap-compliance",cardId:"bootstrap",title:"Create enterprise compatibility matrix baseline",order:20,phase:"bootstrap-config",blocker:a,summary:"Create the missing compatibility matrix baseline without overwriting user data.",mode:"edit-file",risk:"safe",verifyCommand:o,files:[i.compatibilityMatrix],operation:{type:"file-create",path:i.compatibilityMatrix,content:Y(e.generatedAt),overwrite:false}})),a.includes("profile.enterprise.mirror-config")&&r.push(R({id:"bootstrap.mirror-config",artifactKind:"bootstrap-compliance",cardId:"bootstrap",title:"Create enterprise mirror config baseline",order:30,phase:"bootstrap-config",blocker:a,summary:"Create the missing mirror configuration baseline without enabling mirroring.",mode:"edit-file",risk:"safe",verifyCommand:o,files:[".workspai/mirror-config.json"],operation:{type:"file-create",path:".workspai/mirror-config.json",content:ee(e.generatedAt),overwrite:false}}));return r}function ae(e){let r=Array.isArray(e.report.payload.steps)?e.report.payload.steps:[],o=[],a=new Map;for(let t of r){let i=g(t),d=g(i?.command),s=typeof i?.id=="string"?i.id.trim():"",m=typeof i?.project=="string"?i.project.trim():"",b=typeof i?.status=="string"?i.status:"",c=typeof d?.display=="string"?d.display.trim():"",y=i?.required===true;if(!s.startsWith("project.")||!m||!y||b!=="fail"&&b!=="missing"||!/^npx\s+workspai\s+workspace\s+run\s+/i.test(c))continue;let f=s.split(".").at(-1)??"stage",n=`workspaceVerify.${s}`,u=a.get(m),l=/(?:^|\s)--no-gates(?:\s|$)/.test(c)?c:`${c} --no-gates`;o.push(R({id:n,artifactKind:e.report.artifactKind,cardId:e.report.cardId,title:typeof i.label=="string"&&i.label.trim()?i.label.trim():`Run ${f} for ${m}`,order:e.startOrder+o.length,phase:"fleet-run",blocker:typeof i.message=="string"&&i.message.trim()?i.message.trim():`${f} evidence is not current for ${m}.`,summary:`Produce fresh ${f} evidence for ${m} without re-entering the blocked aggregate gates.`,mode:"run-command",risk:f==="start"?"guarded":"safe",status:"ready",command:l,verifyCommand:e.ciMode?"npx workspai workspace verify --strict --json":"npx workspai workspace verify --json",scope:"project",projectName:m,projectPath:m,sourceStepId:s,...u?{dependsOn:[u]}:{},cwd:"workspace",notes:[`Source Workspace Verify step: ${s}`,"Aggregate verification must run only after this project evidence producer completes."]})),a.set(m,n);}return o}function ne(e){let r=I(e.blockers.flatMap(a=>{let t=a.match(/(?:project runtimes?|workspace)\s*\(([^)]+)\)\s+(?:is|are) not pinned/i);return t?.[1]?t[1].split(",").map(i=>i.trim().toLowerCase()).filter(i=>/^(python|node|go|java|dotnet|rust|php)$/.test(i)):[]})),o=[];for(let a of r){let t=`readiness.toolchain.${a}.setup`,i=e.blockers.find(d=>d.toLowerCase().includes(`(${a})`))??`The ${a} runtime is not pinned in the canonical workspace toolchain.`;o.push(R({id:t,artifactKind:e.report.artifactKind,cardId:e.report.cardId,title:`Pin ${a} in the workspace toolchain`,order:e.startOrder+o.length,phase:"toolchain-reconciliation",blocker:i,summary:`Detect and persist the current ${a} runtime in the canonical workspace toolchain lock.`,mode:"run-command",risk:"safe",command:`npx workspai setup ${a} --json`,verifyCommand:e.ciMode?"npx workspai readiness --strict --json":"npx workspai readiness --json",notes:["Run from the workspace root so the canonical toolchain.lock is updated."]})),o.push(R({id:`readiness.toolchain.${a}.bootstrap`,artifactKind:e.report.artifactKind,cardId:e.report.cardId,title:`Reconcile the ${a} workspace foundation`,order:e.startOrder+o.length,phase:"toolchain-reconciliation",blocker:`The ${a} runtime pin must be reconciled with the workspace foundation.`,summary:"Refresh the workspace foundation after the runtime pin is written.",mode:"run-command",risk:"guarded",command:"npx workspai bootstrap --ci --json",verifyCommand:e.ciMode?"npx workspai readiness --strict --json":"npx workspai readiness --json",dependsOn:[t]}));}return o}function se(e){if(e.report.artifactKind==="readiness"&&/dependenc(?:y|ies).*vulnerabil|vulnerabil.*dependenc(?:y|ies)|security audit/i.test(e.blocker))return R({id:`${e.report.cardId}.doctor-owner.${e.order}`,artifactKind:e.report.artifactKind,cardId:e.report.cardId,title:"Resolve dependency vulnerability through Doctor",order:e.order,phase:"dependency-remediation",blocker:e.blocker,summary:"Release Readiness is the aggregate gate; use the project-scoped Doctor remediation capability that owns this dependency failure.",mode:"verify-before-fix",risk:"guarded",status:"review-required",command:"npx workspai doctor workspace --plan --json",verifyCommand:e.ciMode?"npx workspai readiness --strict --json":"npx workspai readiness --json",notes:["Read doctor-remediation-plan-last-run.json and execute the matching surface-security-hygiene capability before rerunning Readiness.","Do not treat a Readiness refresh as remediation for a source dependency vulnerability."]});let o={analyze:{title:"Refresh analyze evidence",phase:"analysis",command:"npx workspai analyze --strict --json",verify:"npx workspai analyze --strict --json"},readiness:{title:"Refresh release readiness",phase:"release-readiness",command:e.ciMode?"npx workspai readiness --strict --json":"npx workspai readiness --json",verify:e.ciMode?"npx workspai readiness --strict --json":"npx workspai readiness --json"},pipeline:{title:"Rerun governance pipeline",phase:"governance-pipeline",command:"npx workspai pipeline --json --strict",verify:"npx workspai pipeline --json --strict"},"workspace-run":{title:"Rerun failed workspace stage",phase:"fleet-run",command:e.ciMode?"npx workspai workspace run test --strict --json":"npx workspai workspace run test --json",verify:e.ciMode?"npx workspai workspace run test --strict --json":"npx workspai workspace run test --json"},"workspace-verify":{title:"Refresh workspace verify gate",phase:"verification",command:e.ciMode?"npx workspai workspace verify --strict --json":"npx workspai workspace verify --json",verify:e.ciMode?"npx workspai workspace verify --strict --json":"npx workspai workspace verify --json"},"doctor-workspace":{title:"Use Doctor remediation plan",phase:"doctor-remediation",command:"npx workspai doctor workspace --plan --json",verify:"npx workspai doctor workspace --json"}}[e.report.artifactKind]??{title:"Refresh artifact evidence",phase:"evidence-refresh",command:"npx workspai pipeline --json --strict",verify:"npx workspai pipeline --json --strict"};return R({id:`${e.report.cardId}.refresh.${e.order}`,artifactKind:e.report.artifactKind,cardId:e.report.cardId,title:o.title,order:e.order,phase:o.phase,blocker:e.blocker,summary:"No deterministic file operation is available for this artifact yet; refresh the evidence and continue with the card-specific plan.",mode:e.report.artifactKind==="doctor-workspace"?"verify-before-fix":"run-command",risk:"guarded",status:e.report.artifactKind==="doctor-workspace"?"review-required":"ready",command:o.command,verifyCommand:o.verify,notes:e.report.artifactKind==="doctor-workspace"?["Read doctor-remediation-plan-last-run.json for ordered file-level steps."]:[]})}async function ce(e){let r=[a(e,".workspai/reports"),b(e,".workspai/reports")],o=[],a$1=new Set;for(let t of G)for(let i of t.fileNames){let d=(await Promise.all(r.map(s=>w.join(s,i)))).find(s=>existsSync(s));if(!(!d||a$1.has(`${t.artifactKind}:${i}`))){a$1.add(`${t.artifactKind}:${i}`);try{let s=await Z.readJSON(d),m=g(s);if(!m)continue;o.push({artifactKind:t.artifactKind,cardId:t.cardId,fileName:i,absolutePath:d,payload:m});break}catch{o.push({artifactKind:t.artifactKind,cardId:t.cardId,fileName:i,absolutePath:d,payload:{blockers:[`${t.artifactKind}: report exists but could not be parsed.`]}});break}}}return o}async function ke(e){let r=w.resolve(e.workspacePath),o=e.includeAbsolutePaths===true,a$2=e.ciMode===true,t=new Date().toISOString(),i=a(r,".workspai/reports"),d=await ce(r),s=[],m=1;for(let c of d){if(c.artifactKind==="doctor-workspace"){let p=Array.isArray(c.payload.steps)?re({report:c,workspacePath:r,includeAbsolutePaths:o,startOrder:m}):oe({report:c,workspacePath:r,includeAbsolutePaths:o,startOrder:m});s.push(...p),m+=p.length;continue}let y=te(c);if(y.length===0)continue;if(c.artifactKind==="bootstrap-compliance"){s.push(...ie({blockers:y,generatedAt:t})),m=s.length+1;continue}if(c.artifactKind==="workspace-verify"){let p=ae({report:c,startOrder:m,ciMode:a$2});if(p.length>0){s.push(...p),m+=p.length;continue}}if(c.artifactKind==="readiness"){let p=ne({report:c,blockers:y,startOrder:m,ciMode:a$2});if(p.length>0){s.push(...p),m+=p.length;continue}}let f=s.some(p=>p.transaction?.kind==="dependency-security"),n=c.artifactKind==="readiness"&&y.some(p=>/dependenc(?:y|ies).*vulnerabil|vulnerabil.*dependenc(?:y|ies)|security audit/i.test(p));if(f&&n)continue;let u=y[0],l=se({report:c,blocker:u,order:m,ciMode:a$2}),k={readiness:new Set(["bootstrap","doctor"]),pipeline:new Set(["bootstrap","doctor","analyze","readiness"]),workspaceVerify:new Set(["bootstrap","doctor","readiness","workspaceRun"])}[c.cardId];if(c.cardId==="pipeline"){let p=["doctor","analyze","readiness"].find(h=>u.toLowerCase().includes(h));p&&(k=new Set([p]));}if(k){let p=s.filter(h=>k.has(h.cardId)&&h.risk!=="invasive"&&h.status!=="blocked"&&h.status!=="guidance-only").map(h=>h.id);p.length>0&&(l.dependsOn=I([...l.dependsOn??[],...p]),l.notes.push("This aggregate gate must run after its contract-owned upstream remediation actions."));}y.length>1&&l.notes.push(...y.slice(1,8).map(p=>`Related blocker: ${p}`)),s.push(l),m+=1;}let b={safe:s.filter(c=>c.risk==="safe").length,guarded:s.filter(c=>c.risk==="guarded").length,invasive:s.filter(c=>c.risk==="invasive").length};return {schemaVersion:a$1,generatedAt:t,workspace:{name:w.basename(r),...o?{path:r}:{}},source:{command:"workspace remediation-plan",reportsDir:S(r,i,o),includeAbsolutePaths:o,ciMode:a$2},summary:{artifactsScanned:d.length,cardsCovered:I(s.map(c=>c.cardId)).length,totalActions:s.length,executableActions:s.filter(c=>c.status==="ready").length,risk:b},actions:s}}async function he(e$1,r){return e(r,i.artifactRemediationPlan,e$1)}export{ke as a,he as b};
@@ -1 +0,0 @@
1
- import {i,e}from'./chunk-NZ3WZYD5.js';var _=".workspai/skills";var p=e.skillsIndex,a=e.explain,c=i.workspaceWhy,P=i.workspaceTrace,O=".workspai/AGENT-GROUNDING.md",I=".rapidkit/AGENT-GROUNDING.md",A=".cursor/rules/workspai-grounding.mdc",R=".cursor/rules/workspai-evidence.mdc",E=".cursor/rules/workspai-diagnose.mdc",T=".cursor/rules/workspai-repair.mdc",L=".cursor/rules/workspai-release.mdc",S=".cursor/rules/rapidkit-grounding.mdc",d=".windsurfrules",k=".windsurf/rules/workspai-grounding.md",C=".windsurf/rules/workspai-evidence.md",u=".grok/rules/workspai-grounding.md",N=".grok/rules/workspai-evidence.md",l=".claude/rules/workspai-evidence.md",K=".claude/rules/workspai-workspace.md",m=".claude/rules/rapidkit-evidence.md",g=".amazonq/rules/workspai-workspace.md",G=".github/instructions/workspai-workspace.instructions.md",x=".github/instructions/rapidkit-workspace.instructions.md",w=".github/instructions/workspai-evidence.instructions.md",H=".github/instructions/rapidkit-evidence.instructions.md",D=".github/prompts/workspai-diagnose.prompt.md",U=".github/prompts/rapidkit-diagnose.prompt.md",W=".github/prompts/workspai-repair.prompt.md",h=".github/prompts/rapidkit-repair.prompt.md",b=".github/prompts/workspai-release-readiness.prompt.md",M=".github/prompts/rapidkit-release-readiness.prompt.md",Y=".github/prompts/workspai-project-onboard.prompt.md",f=".github/prompts/rapidkit-project-onboard.prompt.md",v=".github/prompts/workspai-adopt-project.prompt.md",B=".github/prompts/rapidkit-adopt-project.prompt.md",V=".github/skills/workspai-grounding/SKILL.md",y=".github/skills/rapidkit-grounding/SKILL.md",F=".github/skills/workspai-workspace-intelligence/SKILL.md",j=".github/skills/rapidkit-workspace-intelligence/SKILL.md",J=".cursor/skills/workspai-grounding/SKILL.md",X=".claude/skills/workspai-grounding/SKILL.md",$=".agents/skills/workspai-grounding/SKILL.md",z=".grok/skills/workspai-grounding/SKILL.md",q=i.workspaiMcpDesign,Q=i.legacyMcpDesign,Z=i.agentHooks,ss=".vscode/rapidkit-agent-hooks.json";function os(r){let o=r.trim();if(!o||o.includes("..")||o.includes("/"))throw new Error(`Invalid operational skill id: ${r}`);return `${_}/${o}.md`}var ts={"workspai-diagnose-api-failure":"workspai-diagnose","workspai-release-readiness":"workspai-release-readiness","workspai-safe-schema-migration":"workspai-safe-schema-migration","workspai-dependency-upgrade":"workspai-dependency-upgrade","workspai-rename-contract":"workspai-rename-contract"};export{D as A,U as B,W as C,h as D,b as E,M as F,Y as G,f as H,v as I,B as J,V as K,y as L,F as M,j as N,J as O,X as P,$ as Q,z as R,q as S,Q as T,Z as U,ss as V,os as W,ts as X,_ as a,p as b,a as c,c as d,P as e,O as f,I as g,A as h,R as i,E as j,T as k,L as l,S as m,d as n,k as o,C as p,u as q,N as r,l as s,K as t,m as u,g as v,G as w,x,w as y,H as z};
@@ -1 +0,0 @@
1
- import {a as a$1}from'./chunk-LPCWROQ3.js';import {f,e as e$1,g as g$1,i}from'./chunk-NZ3WZYD5.js';var g=f.repairTransaction,v=e$1.repairTransaction,b=g$1.repairTransaction;var k="workspai.workspace-repair-proposal.v1",x="contracts/workspace-intelligence/workspace-repair-proposal.v1.json";var m="workspai.workspace-repair-capabilities.v1",y="workspai.workspace-repair-consumer-protocol.v1",w=[{id:"node",ecosystem:"JavaScript / TypeScript",manifests:["package.json"],lockfiles:["package-lock.json","npm-shrinkwrap.json","pnpm-lock.yaml","yarn.lock","bun.lock","bun.lockb"],packageManagers:["npm","pnpm","yarn","bun"],support:"full",stages:{reconcile:"native",audit:"native",test:"declared",build:"declared"},requiredToolFamilies:["selected package manager"]},{id:"python",ecosystem:"Python",manifests:["pyproject.toml","requirements.txt"],lockfiles:["uv.lock","poetry.lock","requirements.txt"],packageManagers:["uv","poetry","pip"],support:"conditional",stages:{reconcile:"conditional",audit:"conditional",test:"conditional",build:"declared"},requiredToolFamilies:["isolated Python","selected environment manager","pip-audit or governed Doctor audit"],limitation:"A bounded isolated environment and an installed audit surface are required."},{id:"go",ecosystem:"Go",manifests:["go.mod"],lockfiles:["go.sum"],packageManagers:["go modules"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"native",build:"native"},requiredToolFamilies:["go","govulncheck"],limitation:"govulncheck must be installed; the engine never fetches an unreviewed tool."},{id:"rust",ecosystem:"Rust",manifests:["Cargo.toml"],lockfiles:["Cargo.lock"],packageManagers:["cargo"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"native",build:"native"},requiredToolFamilies:["cargo","cargo-audit"],limitation:"The cargo-audit subcommand must already be installed."},{id:"php-composer",ecosystem:"PHP",manifests:["composer.json"],lockfiles:["composer.lock"],packageManagers:["composer"],support:"full",stages:{reconcile:"native",audit:"native",test:"declared",build:"declared"},requiredToolFamilies:["composer"]},{id:"ruby-bundler",ecosystem:"Ruby",manifests:["Gemfile"],lockfiles:["Gemfile.lock"],packageManagers:["bundler"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"declared",build:"declared"},requiredToolFamilies:["bundle","bundle-audit"],limitation:"bundle-audit and the declared Rake tasks must already exist."},{id:"elixir-mix",ecosystem:"Elixir",manifests:["mix.exs"],lockfiles:["mix.lock"],packageManagers:["mix"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"native",build:"native"},requiredToolFamilies:["mix","Hex audit task"],limitation:"The project must expose the Hex audit task used by its dependency policy."},{id:"deno",ecosystem:"Deno",manifests:["deno.json","deno.jsonc"],lockfiles:["deno.lock"],packageManagers:["deno"],support:"full",stages:{reconcile:"native",audit:"native",test:"declared",build:"declared"},requiredToolFamilies:["deno"]},{id:"dotnet",ecosystem:".NET",manifests:["*.sln","*.csproj","*.fsproj","*.vbproj"],lockfiles:["Directory.Packages.props","packages.lock.json"],packageManagers:["NuGet / dotnet"],support:"full",stages:{reconcile:"native",audit:"native",test:"native",build:"native"},requiredToolFamilies:["dotnet"]},{id:"jvm-maven",ecosystem:"JVM / Maven",manifests:["pom.xml"],lockfiles:[],packageManagers:["Maven Wrapper","Maven"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"native",build:"native"},requiredToolFamilies:["mvnw or mvn","governed Doctor audit"],limitation:"A project-specific dependency audit command must be declared by Doctor evidence."},{id:"jvm-gradle",ecosystem:"JVM / Gradle",manifests:["build.gradle.kts","build.gradle"],lockfiles:["gradle.lockfile","gradle/libs.versions.toml"],packageManagers:["Gradle Wrapper","Gradle"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"native",build:"native"},requiredToolFamilies:["gradlew or gradle","governed Doctor audit"],limitation:"A project-specific dependency audit command must be declared by Doctor evidence."},{id:"clojure",ecosystem:"Clojure",manifests:["deps.edn","project.clj"],lockfiles:[],packageManagers:["Clojure CLI","Leiningen"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"conditional",build:"conditional"},requiredToolFamilies:["clojure or lein","governed project audit"],limitation:"Tests and builds run only when the selected Clojure project surface declares a deterministic entrypoint."},{id:"scala-sbt",ecosystem:"Scala / sbt",manifests:["build.sbt"],lockfiles:[],packageManagers:["sbt"],support:"conditional",stages:{reconcile:"native",audit:"conditional",test:"native",build:"native"},requiredToolFamilies:["sbt","governed project audit"],limitation:"A project-specific dependency audit command must be declared by Doctor evidence."}];function T(){return {schemaVersion:m,owner:"Workspai CLI",workflow:["plan","preconditions","approval","target-precondition","checkpoint","execute","reconcile","audit","test","build","target-producer-verify","canonical-verify","close-or-rollback-or-decision"],invariants:{multiAdapterProjects:true,missingTools:"decision-required",unsupportedEcosystems:"decision-required",silentFallbackToModelExecution:false,mutationAuthority:"cli-only",targetClosure:"selected-causal-action-set",changeReceipt:"checkpoint-hash-delta",consumerTimeline:"durable-transaction-events",typedDecisionCauses:true,registeredLinkedProjectMutationBoundary:true,sourceProposalIntegrity:"project-bound-hash-pinned",completionAuthority:"cli-verification-receipt",goalSourceTransition:"closed-integrity-bound-v1",goalAttemptBudget:"durable-serialized-v1",consumerHandshakeRequired:true,ephemeralProposalsAreEvidence:false,approvalBoundToPlanHash:true,canonicalVerificationRequired:true,rollbackConflictDetection:true},consumerProtocol:{protocolVersion:y,versionProbe:{args:["--version","--json"],schemaVersion:"rapidkit-version-v1"},capabilityProbe:{args:["workspace","repair","capabilities","--json"],schemaVersion:m},invocation:{command:"workspace repair",workspaceResolution:["process-cwd","--workspace"],actions:["capabilities","plan","propose","approve","decide","execute","resume","status","list","rollback","cancel"]},contracts:{operationResult:a$1,proposal:k,transaction:g},transientPaths:[".workspai/repair/inbox/*.json",".workspai/repair/engine.lock"]},adapters:w}}var N="workspai.studio-card-repair-capabilities.v1",R="npx workspai workspace verify --json",a=e$1,r=i;function e(f,n,c,o={}){return {cardId:f,scope:o.scope??"workspace",producerCommand:n,producerArtifact:c,verifyCommand:n,verifyArtifact:c,aggregateVerifyCommand:R,targetClosure:"exact-producer-and-causal-action-set",workspacePosture:"reported-separately",repairPolicy:o.repairPolicy??"refresh-producer",remediationArtifacts:o.remediationArtifacts??[]}}var M=[e("doctor","npx workspai doctor workspace --json",a.doctor,{repairPolicy:"diagnose-and-repair",remediationArtifacts:[r.doctorRemediationPlan,r.artifactRemediationPlan]}),e("projectDoctor","npx workspai doctor project --json",r.doctorProject,{scope:"project",repairPolicy:"diagnose-and-repair",remediationArtifacts:[r.doctorRemediationPlan,r.artifactRemediationPlan]}),e("pipeline","npx workspai pipeline --json --strict",r.pipelineLastRun,{repairPolicy:"source-repair-then-produce",remediationArtifacts:[r.artifactRemediationPlan]}),e("analyze","npx workspai analyze --json",a.analyze,{repairPolicy:"source-repair-then-produce",remediationArtifacts:[r.artifactRemediationPlan]}),e("readiness","npx workspai readiness --json",a.readiness,{repairPolicy:"source-repair-then-produce",remediationArtifacts:[r.artifactRemediationPlan]}),e("bootstrap","npx workspai bootstrap --ci --json",r.bootstrapCompliance,{repairPolicy:"source-repair-then-produce",remediationArtifacts:[r.artifactRemediationPlan]}),e("workspaceSync","npx workspai workspace sync --json",r.workspaceRegistry),e("foundation","npx workspai workspace foundation ensure --json",".workspai/workspace.json"),e("contract","npx workspai workspace contract verify --strict --json",a.contractVerify,{repairPolicy:"source-repair-then-produce"}),e("autopilot","npx workspai autopilot release --json",r.autopilotReleaseLastRun,{repairPolicy:"source-repair-then-produce"}),e("workspaceRun","npx workspai workspace run test --json",r.workspaceRunLast,{repairPolicy:"source-repair-then-produce",remediationArtifacts:[r.artifactRemediationPlan]}),e("setup","npx workspai setup --json",".workspai/toolchain.lock",{repairPolicy:"source-repair-then-produce"}),e("importReadiness","npx workspai doctor project --json",r.doctorProject,{scope:"project",repairPolicy:"diagnose-and-repair",remediationArtifacts:[r.artifactRemediationPlan]}),e("snapshot","npx workspai snapshot create --json",".workspai/reports/snapshot-last-run.json"),e("workspaceModel","npx workspai workspace model --json --write",a.model),e("intelligenceSnapshot","npx workspai workspace snapshot --json",a.snapshot),e("workspaceDiff",`npx workspai workspace diff --from ${a.snapshot} --json`,a.diff),e("workspaceImpact",`npx workspai workspace impact --from ${a.diff} --json`,a.impact),e("workspaceIntelligenceRun","npx workspai workspace intelligence run --for-agent generic --strict --json",a.intelligenceRun,{repairPolicy:"source-repair-then-produce"}),e("workspaceVerify",R,a.verify,{repairPolicy:"source-repair-then-produce",remediationArtifacts:[r.artifactRemediationPlan]}),e("workspaceExplain","npx workspai workspace explain release-blocked --json --write",a.explain),e("workspaceWhy","npx workspai workspace why release-blocked --json --write",r.workspaceWhy),e("workspaceTrace",`npx workspai workspace trace --from ${a.diff} --json --write`,r.workspaceTrace),e("workspaceWatch","npx workspai workspace watch --once --json",a.model),e("workspaceContextAgent","npx workspai workspace context --for-agent --json --write",a.agentContext),e("agentGrounding","npx workspai workspace agent-sync --write --refresh-context --json --preset enterprise --target vscode",a.agentCustomizationPack),e("share",`npx workspai workspace share --output ${r.workspaceShareBundle} --json`,r.workspaceShareBundle),e("archive","npx workspai workspace export --output team-workspace.workspai-archive.zip --json",".workspai/archive-manifest.json"),e("mirror","npx workspai mirror status --json",r.mirrorOps),e("cache","npx workspai cache status --json",".workspai/cache-config.yml"),e("policy","npx workspai workspace policy show --json",".workspai/policies.yml",{repairPolicy:"source-repair-then-produce"}),e("infra","npx workspai infra plan --json",r.infraPlan,{repairPolicy:"source-repair-then-produce"})];export{g as a,v as b,b as c,k as d,x as e,m as f,w as g,T as h,N as i,M as j};
@@ -1 +0,0 @@
1
- import {h}from'./chunk-NZ3WZYD5.js';var _=h.artifactRemediationPlan.schemaVersion;export{_ as a};
@@ -1,49 +0,0 @@
1
- import {b as b$3,a}from'./chunk-THIOE2PB.js';import {h,g as g$2}from'./chunk-2FPANIX3.js';import {b as b$4,g as g$1}from'./chunk-ZJ62F4U3.js';import {b as b$1,f as f$2,s,t,u,P,v,q,r,R as R$1,Q,n,o,p as p$1,h as h$2,i as i$2,m as m$1,j,k as k$1,l,O,w as w$1,x,y,z,A,B,C,E,G,I,D,F as F$1,H,J,K,L as L$1,M,N as N$1,S,T,U as U$1,V as V$1,W,a as a$2,X}from'./chunk-ASOFWN6J.js';import {b,c,d as d$2}from'./chunk-JRIEP4BY.js';import {b as b$2}from'./chunk-WQX3JYEP.js';import {d as d$3}from'./chunk-O6R7SE6Y.js';import {p,k as k$2,f as f$3}from'./chunk-NA2NXX5P.js';import {m}from'./chunk-KG3TUTXU.js';import {d as d$1}from'./chunk-CCDGHPEJ.js';import {a as a$1,b as b$5}from'./chunk-D65FCQIO.js';import {f,e,i,h as h$3}from'./chunk-NZ3WZYD5.js';import {f as f$1,g,h as h$1}from'./chunk-MOSXTVPU.js';import i$1 from'path';import k from'fs-extra';var ne=["Scope","Evidence","Diagnosis","Fix Plan","Run","Verify","Assumptions"];var Dt="workspace-operational-skill.v1";function $t(e){if(typeof e!="string")return null;let t=e.trim();return !t||t.includes("/")||t.includes("..")?null:t}function yt(e){let t=$t(e.skillId);if(!t)throw new Error(`Invalid skill id: ${e.skillId}`);return {schemaVersion:Dt,skillId:t,canonicalPath:W(t),title:e.title,triggers:[...e.triggers].sort((r,a)=>r.localeCompare(a)),requiredReports:[...e.requiredReports].sort((r,a)=>r.localeCompare(a)),scopedProjects:[...e.scopedProjects??[]].sort((r,a)=>r.localeCompare(a)),verificationCommands:[...e.verificationCommands],answerContractSections:[...ne],...e.promptStem?{promptStem:e.promptStem}:{},markdown:e.markdown}}var Kt=f.skillsIndex;function vt(e){let t=[...e.skills].sort((a,c)=>a.skillId.localeCompare(c.skillId)),r=e.inputsHash??f$3({skillIds:t.map(a=>a.skillId),paths:t.map(a=>a.canonicalPath)});return {schemaVersion:Kt,generatedAt:e.generatedAt,inputsHash:r,skills:t.map(a=>({skillId:a.skillId,path:a.canonicalPath,schemaVersion:a.schemaVersion,title:a.title}))}}var bt=[e.agentIndex,b,d$3],qt=[{skillId:"workspai-diagnose-api-failure",title:"Diagnose API failure",triggers:["api failure","500 error","integration test failed","service unreachable"],objective:"Investigate a failing API or service using Workspai evidence before editing application code.",steps:[`Read \`${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."]},{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."]},{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 \`${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."]}];function ae(e){return `npx workspai ${e}`.trim()}function Ht(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)","",...bt.map(r=>`- \`${r}\``),"","## Procedure","",...e.template.steps.map((r,a)=>`${a+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",ae("workspace agent-sync --write --refresh-context"),"```",""),t.join(`
2
- `)}function Mt(e){return e?.safeCommands?.length?e.safeCommands.slice(0,8).map(t=>t.display):[ae("workspace verify --json"),ae("doctor workspace --json")]}function Ut(e){return e?.projects?.length?e.projects.slice(0,12).map(r=>{let a=r.contracts?.owns?.join(", ")||"none",c=r.contracts?.publishes?.join(", ")||"none",p=r.contracts?.consumes?.join(", ")||"none";return `- **${r.slug}**: owns \`${a}\`; publishes \`${c}\`; consumes \`${p}\``}).join(`
3
- `):void 0}function Et(e){let t=e.model.workspace.name,r=e.model.projects.map(p=>p.name).sort(),a=Mt(e.context??null),c=Ut(e.contract??null);return qt.map(p=>{let u=Ht({template:p,workspaceName:t,scopedProjects:r,verificationCommands:a,contractSummary:c});return yt({skillId:p.skillId,title:p.title,triggers:p.triggers,requiredReports:[...bt],scopedProjects:r,verificationCommands:a,promptStem:X[p.skillId],markdown:u})})}async function xt(e){let t=i$1.resolve(e.workspacePath),r=[],a=f$3({skills:e.skills.map(p=>({id:p.skillId,path:p.canonicalPath,hash:f$3({markdown:p.markdown})}))}),c=vt({generatedAt:e.generatedAt,skills:e.skills,inputsHash:a});if(e.write){for(let u of e.skills){let o=i$1.join(t,u.canonicalPath);await k.ensureDir(i$1.dirname(o)),await k.writeFile(o,u.markdown,"utf8"),r.push(u.canonicalPath);}let p=i$1.join(t,b$1);await k.ensureDir(i$1.dirname(p)),await k.writeJson(p,c,{spaces:2}),r.push(b$1);}return {skills:e.skills,index:c,writtenPaths:r}}function Ct(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",ae("workspace agent-sync --write --refresh-context"),"```",""].join(`
4
- `)}var Vt={"workspai-diagnose-api-failure":A,"workspai-release-readiness":E},Ue="## Workspace verification (hydrated)";function Ft(e){let t=[Ue,"","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 It(e){let t=i$1.resolve(e.workspacePath),r=[];for(let a of e.skills){let c=Vt[a.skillId];if(!c)continue;let p=i$1.join(t,c);if(!await k.pathExists(p))continue;let u=await k.readFile(p,"utf8"),o=Ft(a),P=u.includes(Ue)?u.replace(new RegExp(`${Ue}[\\s\\S]*$`),o.trimEnd()):`${u.trimEnd()}
6
-
7
- ${o}`;e.write&&await k.writeFile(p,`${P.trimEnd()}
8
- `,"utf8"),r.push(c);}return r}var zt="workspai-agent-customization-pack-capabilities.v1";function _t(){return {schemaVersion:zt,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$1,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 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"]},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:[...ne],requiredReports:U.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$2}/`],l2PrefixedMirrorRoots:[".github/",".cursor/",".claude/",".amazonq/"],l3SharedIndustryFiles:["AGENTS.md",".github/copilot-instructions.md","CLAUDE.md","GEMINI.md","QWEN.md"]}}}var Jt=f.agentIndex,Bt=f.agentCustomizationPack,F=e.agentIndex,V=e.agentCustomizationPack;var U=[{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 Yt(){let e=U.map(a=>a.relativePath),r=b$2().consumers.agents.canonicalReadOrder.filter(a=>a!==F&&e.includes(a));return [...new Set([i.goalIndex,i.goalPackLastRun,...r,...e])]}function w(e){return `npx workspai ${e}`.trim()}function Ye(e){return e&&typeof e=="object"?e:null}function Ve(e,t=12){return Array.isArray(e)?e.filter(r=>typeof r=="string"&&r.trim().length>0).slice(0,t):[]}function Xt(e){let t=Ve(e.blockers,12);if(t.length>0)return t;let r=Ve(e.blockingReasons,12);if(r.length>0)return r;let a=Ye(e.summary);return a&&Array.isArray(a.blockingReasons)?Ve(a.blockingReasons,12):[]}function Qt(e){let t=[...new Set(e.map(r=>r.trim()).filter(Boolean))];return t.filter(r=>{let a=r.toLowerCase();return !t.some(c=>{if(c===r||!c.includes(":"))return false;let p=c.toLowerCase();return p.length>a.length&&p.endsWith(a)})})}function Zt(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=>Ye(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,a)=>Date.parse(a)>Date.parse(r)?a:r)}}function er(e,t,r){if(!e)return true;let a=Date.parse(e);return Number.isFinite(a)?r.getTime()-a>t*60*60*1e3:true}function tr(e$1,t,r){return e$1.path===e.snapshot?false:er(e$1.generatedAt,t,r)}function rr(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 R(e,t){return e.has("all")||e.has(t)}function Nt(e){return R(e,"copilot")||R(e,"vscode")}function nr(e,t){return t==="generic"?R(e,"agents"):t==="copilot"?Nt(e):t==="grok"?R(e,"grok")||R(e,"orca"):R(e,t)}function ar(e){return e??"enterprise"}function or(e){return e===b$1?"skills-index":e.includes("workspace-explain-last-run.json")?"explain-report":(e.startsWith(`${a$2}/`)||e.startsWith(".rapidkit/skills/"))&&e.endsWith(".md")?"operational-skill":e.includes("hooks")||e===U$1||e===V$1?"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 ir(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/")?["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 sr(e,t){return _t().presets[t].requiredOutputs.includes(e)}async function cr(e,t){if(t)return t;let r=await d$1(e,k$2)??i$1.join(e,k$2);if(await k.pathExists(r))try{let a=await k.readJson(r);return b$5(k$2,a,r),a}catch{}return p({workspacePath:e,includeEvidence:true})}function lr(e){return e.length>0&&!i$1.isAbsolute(e)&&!e.split(/[\\/]+/).includes("..")}function dr(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(a=>a.targets.includes(r)).map(a=>a.path).sort()}]))}async function pr(e,t){try{if(!await k.pathExists(e))return {payload:null,exists:false,validity:"missing"};let r=await k.readJson(e),a=Ye(r);return a?a$1(t)?(b$5(t,a,e),{payload:a,exists:true,validity:"valid"}):{payload:a,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 Ot(e){let t=e.now??new Date,r=e.staleAfterHours??24,a=[],c=[];for(let o of U){let P=await d$1(e.workspacePath,o.relativePath)??i$1.join(e.workspacePath,o.relativePath),h=await pr(P,o.relativePath),g=h.payload;h.validity==="invalid"?c.push(`Invalid evidence contract: ${o.relativePath}`):g&&c.push(...Xt(g)),a.push({path:o.relativePath,label:o.label,required:o.required,exists:h.exists,validity:h.validity,validationError:h.validationError,generatedAt:g?Zt(g):void 0,commandId:typeof g?.commandId=="string"?g.commandId:void 0,exitCode:typeof g?.exitCode=="number"?g.exitCode:void 0});}let p=Qt(c).slice(0,16),u=b$2();return {schemaVersion:Jt,generatedAt:t.toISOString(),workspaceRoot:e.workspacePath,intelligenceChain:{schemaVersion:u.schemaVersion,contractPath:u.contractPath,currentStep:"agent-sync"},readOrder:Yt(),blockers:p,staleAfterHours:r,reports:a,refreshCommand:w("workspace agent-sync --write --refresh-context")}}function ur(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. Read only the task-relevant evidence artifacts listed in the index.","5. 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",w("workspace agent-sync --write --refresh-context"),w("workspace context --for-agent --json --write"),w("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 gr(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 mr(){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",w("workspace agent-sync --write --refresh-context"),"```",""].join(`
11
- `)}function fr(){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 Fe(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 kr(){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 inspect workspace model and dependency graph.","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",w("workspace agent-sync --write --refresh-context"),"```",""].join(`
14
- `)}function hr(){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",w("workspace intelligence run"),"```",""].join(`
15
- `)}function Xe(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 wr(){return Xe({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 Ar(){return Xe({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 Rr(){return Xe({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 Pr(){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",w("workspace agent-sync --write --refresh-context"),"```",""].join(`
17
- `)}function Sr(){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 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.`,"- 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",w("workspace agent-sync --write --refresh-context"),"```",""].join(`
19
- `)}function vr(){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",w("workspace intelligence run"),"```",""].join(`
20
- `)}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.`,"- 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 Er(){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",w("workspace agent-sync --write --refresh-context"),"```",""].join(`
22
- `)}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 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 inspect workspace model and dependency graph.","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",w("workspace agent-sync --write --refresh-context"),"```",""].join(`
23
- `)}function Cr(){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 Ir(){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 _r(){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",w("workspace intelligence run"),"```",""].join(`
26
- `)}function Or(){return ["# Legacy RapidKit evidence alias","","Compatibility path only. Use `.claude/rules/workspai-evidence.md` as the canonical rule.",""].join(`
27
- `)}function Tr(){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 Tt(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 Wt(){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 oe(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 L(e){return ["# "+e.title,"",...e.lines,""].join(`
32
- `)}function Wr(){return L({title:"MCP Tool Design",lines:["Workspai MCP is a read-mostly bridge over contract-validated workspace artifacts.","","Candidate 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.","- `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 jr(e$1){return `${JSON.stringify({schemaVersion:h$3.workspaiMcpDesign.schemaVersion,generatedAt:e$1.generatedAt,workspaceRoot:e$1.workspacePath,status:"design-only",mode:"read-mostly",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},{name:"refreshWorkspaceIntelligence",command:w("workspace agent-sync --write --refresh-context"),mutates:true,approvalRequired:true}]},null,2)}
33
- `}function Nr(e$1){return `${JSON.stringify({schemaVersion:h$3.agentHooks.schemaVersion,generatedAt:e$1.generatedAt,workspaceRoot:e$1.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:[e.agentIndex,e.agentContext]}]},null,2)}
34
- `}function jt(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 ie(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 N(e$1){let t=["---","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 \`${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(a=>a.name||a.slug).filter(Boolean).slice(0,10);if(r&&r.length>0){t.push("## Projects in this workspace","");for(let a of r)t.push(`- ${a}`);t.push("");}if(e$1.index.blockers.length>0){t.push("## Current blockers","");for(let a of e$1.index.blockers.slice(0,8))t.push(`- ${a}`);t.push("");}if(e$1.context?.safeCommands?.length){t.push("## Safe commands (prefer these)","");for(let a of e$1.context.safeCommands.slice(0,6))t.push(`- \`${a.display}\` \u2014 ${a.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",w("workspace agent-sync --write --refresh-context"),"```",""),t.join(`
37
- `)}async function d(e,t,r){return r?(await k.ensureDir(i$1.dirname(e)),await k.writeFile(e,t,"utf8"),"written"):"skipped"}async function ze(e){if(!e.write)return "skipped";await Qe(e.workspacePath,e.absolutePath);let t=await k.pathExists(e.absolutePath)?await k.readFile(e.absolutePath,"utf8"):null,{upsertManagedAgentSection:r}=await import('./managed-agent-markers-COE5DJ3W.js'),a=r(t,e.generatedBody),c=e.preamble?`${e.preamble.trimEnd()}
38
-
39
- ${a}`:a;return await k.ensureDir(i$1.dirname(e.absolutePath)),await k.writeFile(e.absolutePath,c,"utf8"),"written"}async function Je(e){if(!e.write)return "skipped";await Qe(e.workspacePath,e.absolutePath);let t=await k.pathExists(e.absolutePath)?await k.readFile(e.absolutePath,"utf8"):"",{upsertManagedAgentSection:r}=await import('./managed-agent-markers-COE5DJ3W.js'),a=r(t,e.generatedBody),c=a.includes(e.importLine)?a:`${e.importLine}
40
-
41
- ${a}`;return await k.ensureDir(i$1.dirname(e.absolutePath)),await k.writeFile(e.absolutePath,c,"utf8"),"written"}async function Qe(e,t){let r=i$1.resolve(e),a=i$1.resolve(t),c=i$1.relative(r,a);if(!c||c===".."||c.startsWith(`..${i$1.sep}`)||i$1.isAbsolute(c))throw new Error("Agent output path must remain inside the canonical workspace.");let p=c.split(i$1.sep),u=r;for(let[o,P]of p.entries()){u=i$1.join(u,P);let h=await k.lstat(u).catch(T=>{if(T.code==="ENOENT")return null;throw T});if(!h)return;let g=o===p.length-1;if(h.isSymbolicLink()||(g?!h.isFile():!h.isDirectory()))throw new Error(`Agent output path is blocked by authored repository state: ${c}`)}}function On(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(a=>a.trim().toLowerCase()).filter(a=>t.has(a));return r.length>0?r:void 0}function Lr(e){let t=[...e.outputs].sort((a,c)=>a.path.localeCompare(c.path)),r=b$2();return {schemaVersion:Bt,generatedAt:e.generatedAt,workspaceRoot:e.workspacePath,preset:e.preset,targets:[...e.targets].sort(),sourceReports:e.index.reports.filter(a=>a.exists).map(a=>a.path).sort(),intelligenceChain:{schemaVersion:r.schemaVersion,contractPath:r.contractPath,currentStep:"agent-sync"},outputInventory:t,capabilityMatrix:dr({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(a=>a.kind==="mcp-design")}}}async function Be(e){let t$1=i$1.resolve(e.workspacePath),r$1=e.now??new Date,a=e.staleAfterHours??24,c$1=rr(e.targets),p$2=[...c$1].sort(),u$1=ar(e.preset),o$1=e.write===true,P$1=e.strict===true,h,g=null,T$1=e.model;e.refreshContext&&(T$1??=await p({workspacePath:t$1,includeEvidence:true}),g=await c({workspacePath:t$1,model:T$1,agent:e.agent??"generic",scope:e.scope,includeEvidence:true}),o$1&&(h=await d$2(g,t$1)));let b=[],se=[],ce=[],le=[],s$1=(l,f)=>{l==="written"?se.push(f):ce.push(f),le.push({path:f,kind:or(f),targets:ir(f),required:sr(f,u$1),status:l==="written"?"written":e.dryRun?"planned":"skipped"});},de="",E$1=await cr(t$1,T$1),pe=null;try{pe=(await m({workspacePath:t$1})).contract;}catch{pe=null;}let Lt=Et({model:E$1,context:g,contract:pe}),ue=await xt({workspacePath:t$1,skills:Lt,generatedAt:r$1.toISOString(),write:o$1});for(let l of ue.skills)s$1(o$1?"written":"skipped",l.canonicalPath);s$1(o$1?"written":"skipped",b$1),de=Ct(ue.index);let S$1=await Ot({workspacePath:t$1,staleAfterHours:a,now:r$1});if(s$1(await d(i$1.join(t$1,F),`${JSON.stringify(S$1,null,2)}
42
- `,o$1),F),s$1(await d(i$1.join(t$1,f$2),`${gr(S$1)}
43
- `,o$1),f$2),["agents","vscode","copilot","cursor","claude","codex","gemini","qwen","kimi","grok","windsurf","amazon-q","orca"].some(l=>R(c$1,l))&&s$1(await ze({workspacePath:t$1,absolutePath:i$1.join(t$1,"AGENTS.md"),generatedBody:ur({index:S$1,context:g}),write:o$1}),"AGENTS.md"),R(c$1,"claude")){let l=i$1.join(t$1,"CLAUDE.md");if(o$1){await Qe(t$1,l);let{upsertManagedAgentSection:f}=await import('./managed-agent-markers-COE5DJ3W.js'),m=await k.pathExists(l)?await k.readFile(l,"utf8"):"",y=f(m,fr()),x=y.includes("@AGENTS.md")?y:`@AGENTS.md
44
-
45
- ${y}`;await k.ensureDir(i$1.dirname(l)),await k.writeFile(l,x,"utf8"),se.push("CLAUDE.md");}else ce.push("CLAUDE.md");s$1(await d(i$1.join(t$1,s),`${_r()}
46
- `,o$1),s),s$1(await d(i$1.join(t$1,t),`${xr()}
47
- `,o$1),t),s$1(await d(i$1.join(t$1,u),`${Or()}
48
- `,o$1),u),s$1(await d(i$1.join(t$1,P),N({index:S$1,context:g,model:E$1}),o$1),P);}if(R(c$1,"gemini")&&s$1(await Je({workspacePath:t$1,absolutePath:i$1.join(t$1,"GEMINI.md"),importLine:"@./AGENTS.md",generatedBody:Fe("Gemini CLI"),write:o$1}),"GEMINI.md"),R(c$1,"qwen")&&s$1(await Je({workspacePath:t$1,absolutePath:i$1.join(t$1,"QWEN.md"),importLine:"@AGENTS.md",generatedBody:Fe("Qwen Code"),write:o$1}),"QWEN.md"),R(c$1,"amazon-q")&&(s$1(await Je({workspacePath:t$1,absolutePath:i$1.join(t$1,".amazonq/rules/workspai-agent-entry.md"),importLine:"@../../AGENTS.md",generatedBody:Fe("Amazon Q Developer"),write:o$1}),".amazonq/rules/workspai-agent-entry.md"),s$1(await d(i$1.join(t$1,v),br(),o$1),v)),R(c$1,"grok")&&(s$1(await d(i$1.join(t$1,q),yr(),o$1),q),s$1(await d(i$1.join(t$1,r),vr(),o$1),r),s$1(await d(i$1.join(t$1,R$1),N({index:S$1,context:g,model:E$1}),o$1),R$1)),R(c$1,"codex")&&s$1(await d(i$1.join(t$1,Q),N({index:S$1,context:g,model:E$1}),o$1),Q),R(c$1,"windsurf")&&(s$1(await ze({workspacePath:t$1,absolutePath:i$1.join(t$1,n),generatedBody:Er(),write:o$1}),n),s$1(await d(i$1.join(t$1,o),Pr(),o$1),o),s$1(await d(i$1.join(t$1,p$1),Sr(),o$1),p$1)),R(c$1,"cursor")&&(s$1(await d(i$1.join(t$1,h$2),kr(),o$1),h$2),s$1(await d(i$1.join(t$1,i$2),hr(),o$1),i$2),s$1(await d(i$1.join(t$1,m$1),Tr(),o$1),m$1),u$1==="enterprise"&&(s$1(await d(i$1.join(t$1,j),wr(),o$1),j),s$1(await d(i$1.join(t$1,k$1),Ar(),o$1),k$1),s$1(await d(i$1.join(t$1,l),Rr(),o$1),l)),s$1(await d(i$1.join(t$1,O),N({index:S$1,context:g,model:E$1}),o$1),O)),Nt(c$1)){if(s$1(await ze({workspacePath:t$1,absolutePath:i$1.join(t$1,".github/copilot-instructions.md"),generatedBody:mr(),write:o$1}),".github/copilot-instructions.md"),s$1(await d(i$1.join(t$1,w$1),Ir(),o$1),w$1),s$1(await d(i$1.join(t$1,x),Tt("workspace"),o$1),x),s$1(await d(i$1.join(t$1,y),Cr(),o$1),y),s$1(await d(i$1.join(t$1,z),Tt("evidence"),o$1),z),s$1(await d(i$1.join(t$1,A),Wt(),o$1),A),s$1(await d(i$1.join(t$1,B),Wt(),o$1),B),u$1==="enterprise"){let l=[[C,oe({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,oe({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,oe({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,oe({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[m,y]of l)s$1(await d(i$1.join(t$1,m),y,o$1),m);let f=[[D,l[0][1]],[F$1,l[1][1]],[H,l[2][1]],[J,l[3][1]]];for(let[m,y]of f)s$1(await d(i$1.join(t$1,m),y,o$1),m);if(e.hydratePrompts===true)for(let m of await It({workspacePath:t$1,skills:ue.skills,write:o$1}))s$1(o$1?"written":"skipped",m);}if(s$1(await d(i$1.join(t$1,K),N({index:S$1,context:g,model:E$1}),o$1),K),s$1(await d(i$1.join(t$1,L$1),N({index:S$1,context:g,model:E$1}),o$1),L$1),u$1==="enterprise"){s$1(await d(i$1.join(t$1,M),jt(de),o$1),M),s$1(await d(i$1.join(t$1,N$1),jt(de),o$1),N$1);let l=[["artifact-map.md",L({title:"Artifact Map",lines:U.map(m=>`- \`${m.relativePath}\` \u2014 ${m.label}`)})],["command-map.md",L({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",L({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",L({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",L({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",Wr()]];for(let[m,y]of l){let x=`${i$1.dirname(M)}/resources/${m}`;s$1(await d(i$1.join(t$1,x),y,o$1),x);let et=`${i$1.dirname(N$1)}/resources/${m}`;s$1(await d(i$1.join(t$1,et),y,o$1),et);}let f=[["workspai-advisor.agent.md",ie({name:"Workspai Advisor",description:"Read-only workspace and project guidance using Workspai evidence",mode:"read-only",tools:["search","read"]})],["workspai-repair.agent.md",ie({name:"Workspai Repair",description:"Turn Workspai blockers into minimal fixes and verification steps",mode:"repair",tools:["search","read","edit"]})],["workspai-release.agent.md",ie({name:"Workspai Release",description:"Assess readiness, governance gates, and release safety from evidence",mode:"release",tools:["search","read"]})],["workspai-project-onboarder.agent.md",ie({name:"Workspai Project Onboarder",description:"Guide create, import, and adopt flows with Workspai contracts",mode:"onboard",tools:["search","read","edit"]})]];for(let[m,y]of f){let x=`.github/agents/${m}`;s$1(await d(i$1.join(t$1,x),y,o$1),x);}}}if(u$1==="enterprise"){let l=jr({workspacePath:t$1,generatedAt:S$1.generatedAt});b$5(S,JSON.parse(l)),s$1(await d(i$1.join(t$1,S),l,o$1),S),s$1(await d(i$1.join(t$1,T),l,o$1),T);}if(u$1==="enterprise"&&e.experimentalHooks===true){let l=Nr({workspacePath:t$1,generatedAt:S$1.generatedAt});b$5(U$1,JSON.parse(l)),s$1(await d(i$1.join(t$1,U$1),l,o$1),U$1),s$1(await d(i$1.join(t$1,V$1),l,o$1),V$1);}let ge=o$1?await Ot({workspacePath:t$1,staleAfterHours:a,now:r$1}):S$1,z$1=ge.reports.filter(l=>l.required&&!l.exists).map(l=>l.path),J$1=ge.reports.filter(l=>l.exists&&tr(l,a,r$1)).map(l=>l.path);if(P$1){z$1.length>0&&b.push(`Missing required reports: ${z$1.join(", ")}`),J$1.length>0&&b.push(`Stale reports (>${a}h): ${J$1.join(", ")}`);let l=le.map(f=>f.path).filter(f=>!lr(f));l.length>0&&b.push(`Unsafe generated output paths: ${l.join(", ")}`);}let W=o$1?await g$2({workspacePath:t$1,mode:e.projectGrounding??"managed",now:r$1}):void 0;if(P$1&&W&&W.skipped.length>0&&b.push(`Project grounding incomplete: ${W.skipped.map(l=>`${l.name} (${l.reason})`).join(", ")}`),P$1&&W){let l=W.projects.flatMap(f=>(f.hostCoverage??[]).filter(m=>m.status==="blocked"&&nr(c$1,m.id)).map(m=>`${i$1.basename(f.projectPath)}:${m.id}`));l.length>0&&b.push(`Project agent entry coverage blocked: ${l.join(", ")}`);}let Ze=Lr({workspacePath:t$1,generatedAt:r$1.toISOString(),preset:u$1,targets:p$2,index:ge,outputs:[...le,{path:V,kind:"report",targets:["agents","vscode","copilot","cursor","claude","codex","gemini","qwen","kimi","grok","windsurf","amazon-q","orca"],required:true,status:o$1?"written":e.dryRun?"planned":"skipped"}],missingRequired:z$1,staleReports:J$1,strictViolations:b,experimentalHooks:e.experimentalHooks===true});if(o$1&&process.env.WORKSPAI_TEST_FAIL_AGENT_SYNC_BEFORE_PACK==="1")throw new Error("Injected agent-sync failure before generation commit.");return s$1(await d(i$1.join(t$1,V),`${JSON.stringify(Ze,null,2)}
49
- `,o$1),V),{workspacePath:t$1,indexPath:i$1.join(t$1,F),packPath:i$1.join(t$1,V),pack:Ze,contextPath:h,writtenFiles:se,skippedFiles:ce,blockers:S$1.blockers,missingRequired:z$1,staleReports:J$1,strictViolations:b,projectLenses:W}}async function Tn(e){if(e.write!==true)return Be(e);let t=i$1.resolve(e.workspacePath),r=i$1.join(t,".workspai","transactions","agent-sync");await b$3(r);let a$1=await Be({...e,write:false,dryRun:true});if(!a$1.pack)throw new Error("Agent-sync dry run did not produce an output inventory.");let c=[...a$1.pack.outputInventory.map(u=>u.path),F,V],p=await a({journalDirectory:r});try{for(let P of [...new Set(c)].sort()){let h=i$1.resolve(t,P),g=i$1.relative(t,h);if(g===".."||g.startsWith(`..${i$1.sep}`)||i$1.isAbsolute(g))throw new Error(`Agent-sync output escapes workspace root: ${P}`);await p.captureFile(h);}let u=await h(t);for(let P of u.resolved)for(let h of [f$1,g,h$1,b$4,...g$1,"AGENTS.md",".gitignore"])await p.captureFile(i$1.join(P.projectPath,h));let o=await Be(e);return await p.commit(),o}catch(u){try{await p.rollback();}catch(o){throw new AggregateError([u,o],"Agent-sync generation failed and rollback was incomplete.")}throw u}}export{Dt as a,Kt as b,zt as c,Jt as d,Bt as e,F as f,V as g,U as h,Yt as i,Ot as j,On as k,Tn as l};