workspai 0.56.0 → 0.58.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 (144) hide show
  1. package/README.md +38 -8
  2. package/contracts/adopt-effects.v1.json +72 -0
  3. package/contracts/agent-customization-pack.v1.json +10 -0
  4. package/contracts/cli-runtime-command-inventory.v1.snapshot.json +81 -0
  5. package/contracts/doctor-project-evidence.v1.json +27 -0
  6. package/contracts/doctor-workspace-evidence.v1.json +29 -0
  7. package/contracts/extension-cli-compatibility.v1.json +6 -0
  8. package/contracts/published-contract-catalog.v1.json +30 -0
  9. package/contracts/runtime-command-surface.v1.json +45 -0
  10. package/contracts/workspace-intelligence/doctor-summary.v1.json +3 -1
  11. package/contracts/workspace-intelligence/goal-agent-handoff.v1.json +96 -0
  12. package/contracts/workspace-intelligence/goal-index.v1.json +45 -0
  13. package/contracts/workspace-intelligence/goal-lifecycle-result.v1.json +96 -0
  14. package/contracts/workspace-intelligence/goal-pack.v1.json +250 -0
  15. package/contracts/workspace-intelligence/goal-plan-result.v1.json +46 -0
  16. package/contracts/workspace-intelligence/workspace-repair-proposal.v1.json +1 -0
  17. package/contracts/workspace-intelligence-architecture.v1.json +20 -0
  18. package/dist/analyze-MAU36FTX.js +1 -0
  19. package/dist/{artifact-remediation-plan-BPLON5VX.js → artifact-remediation-plan-JRX4XZ7C.js} +1 -1
  20. package/dist/autopilot-release-TA2L7SCB.js +1 -0
  21. package/dist/capabilities-command-HE2FICLG.js +1 -0
  22. package/dist/chunk-42Q5E2YV.js +1 -0
  23. package/dist/{workspace-knowledge-graph-snapshot-WB62AVDK.js → chunk-4NN5QWOB.js} +1 -1
  24. package/dist/chunk-4YICCES6.js +8 -0
  25. package/dist/{chunk-HASVV34S.js → chunk-6TNSCVR4.js} +1 -1
  26. package/dist/{chunk-PKIRVQLG.js → chunk-7IRGSM25.js} +1 -1
  27. package/dist/{chunk-NHTLE3WN.js → chunk-7KXRA5ST.js} +1 -1
  28. package/dist/{chunk-5RL254O2.js → chunk-7WUT5ZSO.js} +1 -1
  29. package/dist/{chunk-ESWFBSYM.js → chunk-A3JCETSF.js} +1 -1
  30. package/dist/{chunk-KR7CIEQR.js → chunk-AA4PNQKR.js} +1 -1
  31. package/dist/{chunk-5ZA4JYOP.js → chunk-AUCHMXUZ.js} +1 -1
  32. package/dist/{chunk-2L4PSZQB.js → chunk-C4NYG57I.js} +1 -1
  33. package/dist/{chunk-QFCKHUEP.js → chunk-CFBAGPB4.js} +1 -1
  34. package/dist/{chunk-WLCBXCZV.js → chunk-CHMCKYJJ.js} +1 -1
  35. package/dist/chunk-CNWUIXF3.js +1 -0
  36. package/dist/chunk-EEMRRCGR.js +2 -0
  37. package/dist/{chunk-QTCZPS5I.js → chunk-FXIE2WVG.js} +1 -1
  38. package/dist/{chunk-YJTEMJFV.js → chunk-FY6OHOXR.js} +1 -1
  39. package/dist/{chunk-W5ZFXKSL.js → chunk-G4VMNWSU.js} +1 -1
  40. package/dist/{chunk-ADL3CK44.js → chunk-GRGUPSNP.js} +1 -1
  41. package/dist/{chunk-XH7PDHBF.js → chunk-GVS5OFUB.js} +1 -1
  42. package/dist/{chunk-E53BGUOW.js → chunk-H545P6LN.js} +1 -1
  43. package/dist/chunk-HH54C3XJ.js +1 -0
  44. package/dist/{chunk-XMTLKDPP.js → chunk-HI7ONEFI.js} +1 -1
  45. package/dist/chunk-HYY5PQCV.js +1 -0
  46. package/dist/chunk-I5PDN2P2.js +13 -0
  47. package/dist/{chunk-V5EYVQ63.js → chunk-II4ROT6X.js} +1 -1
  48. package/dist/{chunk-GBMCHFOV.js → chunk-LGJAAPNR.js} +1 -1
  49. package/dist/{chunk-UQEQ6CXU.js → chunk-M2BK3XTP.js} +1 -1
  50. package/dist/{chunk-7PNARN6S.js → chunk-MFJ6ZP7S.js} +1 -1
  51. package/dist/{chunk-64JUYYRC.js → chunk-N3DFX4BY.js} +1 -1
  52. package/dist/chunk-NQ5H4R2I.js +83 -0
  53. package/dist/chunk-PCXBPQO6.js +1 -0
  54. package/dist/chunk-QXW3SLEX.js +1 -0
  55. package/dist/{chunk-KS4FB5W7.js → chunk-RJDGC6AQ.js} +1 -1
  56. package/dist/{chunk-ZPA6ECBJ.js → chunk-RMDVRNU7.js} +1 -1
  57. package/dist/chunk-SM55RK3C.js +91 -0
  58. package/dist/{chunk-LYVDRRDO.js → chunk-T63WRURN.js} +1 -1
  59. package/dist/{chunk-WOTTSPSF.js → chunk-TMOKXYAQ.js} +1 -1
  60. package/dist/{chunk-6HCAGHCY.js → chunk-TTLVG5AR.js} +1 -1
  61. package/dist/{chunk-5BGPGNRQ.js → chunk-VAWV3UKV.js} +1 -1
  62. package/dist/chunk-VIFTO53Y.js +1 -0
  63. package/dist/chunk-WP3CXMVA.js +2 -0
  64. package/dist/{chunk-IZLEMTES.js → chunk-WSDVFLHT.js} +1 -1
  65. package/dist/{chunk-SV2SP22H.js → chunk-XC26FNRL.js} +3 -3
  66. package/dist/chunk-YMY6EFX4.js +1 -0
  67. package/dist/{chunk-YM77FQB3.js → chunk-YYCPRYP7.js} +1 -1
  68. package/dist/{chunk-QAF26ZQX.js → chunk-ZDYGO3T7.js} +17 -17
  69. package/dist/{create-DLUWG46F.js → create-QIN56Y4M.js} +1 -1
  70. package/dist/{doctor-IZ4YOCYE.js → doctor-RP4Q2CKJ.js} +1 -1
  71. package/dist/goal-command-contract-CHE7U6YY.js +1 -0
  72. package/dist/goal-lifecycle-YTBU3ICP.js +1 -0
  73. package/dist/goal-pack-MYYH7K43.js +1 -0
  74. package/dist/index.d.ts +21 -2
  75. package/dist/index.js +168 -166
  76. package/dist/{pipeline-IBQYDLFF.js → pipeline-77NUVYQD.js} +1 -1
  77. package/dist/{project-intelligence-lens-SIU7IXKG.js → project-intelligence-lens-AM2B2PXU.js} +1 -1
  78. package/dist/project-test-coverage-MUSS7Z7V.js +1 -0
  79. package/dist/{verified-goal-M4GPOXNL.js → verified-goal-ZSIZYNVO.js} +1 -1
  80. package/dist/{workspace-3AAOUELG.js → workspace-LFESVKE7.js} +1 -1
  81. package/dist/{workspace-agent-sync-QGYLY7HH.js → workspace-agent-sync-JMRX6J2Y.js} +1 -1
  82. package/dist/{workspace-archive-BA3ONVXX.js → workspace-archive-MFHCFCDO.js} +1 -1
  83. package/dist/{workspace-context-JCLPRYNC.js → workspace-context-TBKRMVMT.js} +1 -1
  84. package/dist/{workspace-contract-IUUPBQXU.js → workspace-contract-KKVC2DUQ.js} +1 -1
  85. package/dist/workspace-explain-RGGZL5IW.js +1 -0
  86. package/dist/workspace-explain-contract-4ZZ6CJ44.js +1 -0
  87. package/dist/{workspace-feedback-PCZKXG5R.js → workspace-feedback-O6J3RQML.js} +1 -1
  88. package/dist/{workspace-foundation-7IGMO4CW.js → workspace-foundation-JQWT7YGC.js} +1 -1
  89. package/dist/{workspace-graph-stream-5YMLJXAJ.js → workspace-graph-stream-V5WOXP4B.js} +1 -1
  90. package/dist/workspace-graph-token-efficiency-TF23UYEF.js +1 -0
  91. package/dist/{workspace-history-CHJOABME.js → workspace-history-TOCRMJUJ.js} +1 -1
  92. package/dist/{workspace-intelligence-XHSUFTAT.js → workspace-intelligence-SDBIRKMK.js} +1 -1
  93. package/dist/{workspace-intelligence-evaluation-YMY3C5AW.js → workspace-intelligence-evaluation-E4UMWDAZ.js} +1 -1
  94. package/dist/{workspace-intelligence-runner-EN5V4KSC.js → workspace-intelligence-runner-DIMNL6CJ.js} +1 -1
  95. package/dist/{workspace-intelligence-runtime-registry-NCVHKCMP.js → workspace-intelligence-runtime-registry-YGWB2RRS.js} +1 -1
  96. package/dist/{workspace-knowledge-graph-VWQTIEYK.js → workspace-knowledge-graph-MUW6UAGI.js} +1 -1
  97. package/dist/{workspace-knowledge-graph-query-TXA3KVUV.js → workspace-knowledge-graph-query-6DAOXGGT.js} +1 -1
  98. package/dist/workspace-knowledge-graph-snapshot-7IU2QAXI.js +1 -0
  99. package/dist/{workspace-mcp-serve-NCAGGWQS.js → workspace-mcp-serve-2SWLIH4I.js} +1 -1
  100. package/dist/{workspace-model-NXFIKX26.js → workspace-model-VPFCKTYQ.js} +1 -1
  101. package/dist/{workspace-onboarding-OP22NHQ4.js → workspace-onboarding-GHI6UTQJ.js} +1 -1
  102. package/dist/{workspace-readme-IVJXSIBS.js → workspace-readme-RASXBZRQ.js} +1 -1
  103. package/dist/{workspace-registry-summary-A5VDPRHU.js → workspace-registry-summary-7QT7YMIU.js} +1 -1
  104. package/dist/workspace-repair-engine-AZTJIFCY.js +3 -0
  105. package/dist/workspace-run-VMZY6LIF.js +1 -0
  106. package/dist/{workspace-verify-TUVLFPPN.js → workspace-verify-RYCQZYYB.js} +1 -1
  107. package/dist/{workspace-watch-2ZNOYSUQ.js → workspace-watch-U3YGN3GG.js} +1 -1
  108. package/docs/From Code to Shared Understanding-B.png +0 -0
  109. package/docs/From Code to Shared Understanding.png +0 -0
  110. package/docs/README.md +2 -0
  111. package/docs/README_CONTENT_CONTRACT.md +25 -12
  112. package/docs/ci-workflows.md +9 -1
  113. package/docs/commands-reference.md +13 -1
  114. package/docs/contracts/ARTIFACT_CATALOG.md +11 -0
  115. package/docs/contracts/COMMAND_OWNERSHIP_MATRIX.md +1 -0
  116. package/docs/contracts/README.md +16 -12
  117. package/docs/doctor-command.md +35 -11
  118. package/docs/from-code-to-shared-understanding.md +22 -17
  119. package/docs/goal-packs.md +174 -0
  120. package/docs/real-world-qualification.md +92 -0
  121. package/docs/workspace-knowledge-graph.md +24 -3
  122. package/docs/workspace-operations.md +14 -2
  123. package/docs/workspace-run.md +16 -4
  124. package/package.json +5 -1
  125. package/dist/analyze-HJ774J3E.js +0 -1
  126. package/dist/autopilot-release-CH57CGET.js +0 -1
  127. package/dist/capabilities-command-WEOGFCWF.js +0 -1
  128. package/dist/chunk-3U4VLIGW.js +0 -1
  129. package/dist/chunk-5EPPPMAS.js +0 -1
  130. package/dist/chunk-664GXRLD.js +0 -1
  131. package/dist/chunk-7Y3KVZJF.js +0 -8
  132. package/dist/chunk-BDN32Y2N.js +0 -81
  133. package/dist/chunk-D4RST2HE.js +0 -1
  134. package/dist/chunk-DIZSHNZ5.js +0 -2
  135. package/dist/chunk-DOIZANFA.js +0 -2
  136. package/dist/chunk-OX53L237.js +0 -13
  137. package/dist/chunk-QRWWYL52.js +0 -88
  138. package/dist/chunk-VGJVIHHR.js +0 -1
  139. package/dist/project-test-coverage-FRMVYTFB.js +0 -1
  140. package/dist/workspace-explain-CZGBVDE6.js +0 -1
  141. package/dist/workspace-explain-contract-KVQO57RC.js +0 -1
  142. package/dist/workspace-graph-token-efficiency-HK4KNWWP.js +0 -1
  143. package/dist/workspace-repair-engine-N4KXNSVL.js +0 -3
  144. package/dist/workspace-run-PXKC3ELS.js +0 -1
@@ -5,26 +5,28 @@ you to replace your frameworks or move existing source code.
5
5
 
6
6
  ```mermaid
7
7
  flowchart TB
8
- Code["Your projects and repositories"]
8
+ Sources["Projects · APIs · packages<br/>infrastructure · docs · CI"]
9
9
 
10
- Routes["Create a project<br/>Adopt it in place<br/>or Import a repository"]
10
+ Connect["Create · Adopt in place · Import"]
11
11
 
12
- Workspace["Workspai builds one model of<br/>projects, dependencies, rules, and commands"]
12
+ Model["Canonical Workspace Model<br/>identity · inventory · boundaries"]
13
13
 
14
- Change["What changed?<br/>What is affected?<br/>Is the evidence ready?"]
14
+ Graph["Derived Knowledge Graph<br/>relationships · facts · canonical proof"]
15
15
 
16
- Outputs["Context, impact, verification,<br/>explanations, and release evidence"]
16
+ Decide["Diff · Impact · Evidence gates<br/>Readiness · Verify"]
17
17
 
18
- Code --> Routes
19
- Routes --> Workspace
20
- Workspace --> Change
21
- Change --> Outputs
18
+ Ground["Reports · bounded context<br/>Agent sync · Explain"]
22
19
 
23
- Outputs --> Developers["Developers"]
24
- Outputs --> CI["CI and releases"]
25
- Outputs --> IDEs["IDEs"]
26
- Outputs --> Agents["AI agents"]
27
- Outputs --> MCP["MCP clients"]
20
+ Sources --> Connect
21
+ Connect --> Model
22
+ Model -->|derives, revision-bound| Graph
23
+ Model --> Decide
24
+ Graph --> Decide
25
+ Decide --> Ground
26
+
27
+ Ground --> Humans["Developers"]
28
+ Ground --> Automation["CI · releases"]
29
+ Ground --> Tools["IDEs · MCP · AI agents"]
28
30
  ```
29
31
 
30
32
  ## What This Means
@@ -40,8 +42,8 @@ flowchart TB
40
42
  the evidence needed for a safe decision.
41
43
  4. **Share the result.** Developers, CI, IDEs, AI agents, and MCP clients consume
42
44
  the same workspace truth instead of building separate assumptions. The
43
- current CLI exposes a read-mostly `workspace mcp serve` bridge; a dedicated
44
- `packages/mcp` boundary is planned.
45
+ current CLI exposes the governed evidence through its reports, agent context,
46
+ graph queries, and read-mostly `workspace mcp serve` bridge.
45
47
 
46
48
  This is the user-facing view. The implementation uses a versioned chain of
47
49
  model, change, evidence, verification, context, grounding, and explanation
@@ -57,7 +59,10 @@ baseline lifecycle, exit codes, and failure propagation are specified in
57
59
  [Unified Workspace Intelligence Runner](./workspace-intelligence-runner.md).
58
60
 
59
61
  The npm README uses a PNG rendering because npm package pages do not reliably
60
- render Mermaid. When this source changes, regenerate
62
+ render Mermaid. npm also does not provide a dependable embedded-video player
63
+ for package READMEs. Keep the full MP4 outside the published package. For inline
64
+ motion, use a bounded, silent GIF hosted as a public asset; retain a linked MP4
65
+ for full-resolution playback and audio. When this source changes, regenerate
61
66
  `From Code to Shared Understanding.png` before publishing.
62
67
 
63
68
  ## Execute the Contract
@@ -0,0 +1,174 @@
1
+ # Goal Packs — Plain Language to Governed Work
2
+
3
+ `workspai goal` is the simple front door for an engineering outcome. It turns
4
+ one plain-language intent into a portable, versioned Goal Pack bound to the
5
+ current Workspace Model and proof-backed Knowledge Graph.
6
+
7
+ ```bash
8
+ # Run inside an adopted project; scope defaults to that project.
9
+ npx workspai goal "Raise test coverage to at least 85%"
10
+
11
+ # Plan for the whole canonical workspace.
12
+ npx workspai goal "Prepare this workspace for release" --scope workspace
13
+
14
+ # Inspect the complete machine contract without writing artifacts.
15
+ npx workspai goal "Map the authentication architecture" --dry-run --json
16
+ ```
17
+
18
+ The command plans work. It does **not** edit source, call a model, install an
19
+ agent plugin, approve a repair, or claim that the outcome is complete.
20
+
21
+ ## What it produces
22
+
23
+ A successful plan atomically publishes four portable artifacts:
24
+
25
+ | Artifact | Purpose |
26
+ | ---------------------------------------------- | ------------------------------------------------------------------------------------- |
27
+ | `.workspai/goals/<goal-id>/goal-pack.json` | Canonical intent, scope, evidence bindings, policy, criteria, and orchestration state |
28
+ | `.workspai/goals/<goal-id>/agent-handoff.json` | Bounded consumer projection for `generic`, `claude`, or `codex` |
29
+ | `.workspai/goals/index.json` | Active-goal and lifecycle discovery authority for agents and IDEs |
30
+ | `.workspai/reports/goal-pack-last-run.json` | Latest Goal Pack for IDE, CI, and automation discovery |
31
+
32
+ Agents start from the index. They do not infer the active objective by walking
33
+ directories or treating the newest timestamp as authority.
34
+
35
+ ```bash
36
+ workspai goal --status --json
37
+ workspai goal --list --json
38
+ workspai goal --activate <goal-id> --json
39
+ workspai goal --cancel <goal-id> --json
40
+ ```
41
+
42
+ The files contain logical workspace/project identity and relative artifact
43
+ paths. They do not copy the machine-local workspace root, linked-project path,
44
+ credentials, raw model responses, or unrestricted command output.
45
+
46
+ ## Scope resolution
47
+
48
+ - From an adopted or linked project, the default scope is that exact project.
49
+ - From a workspace root, the default scope is all registered projects.
50
+ - `--scope project:<name>` selects one project explicitly.
51
+ - `--scope workspace` selects the complete canonical workspace explicitly.
52
+ - `--workspace <path>` is available for automation that cannot rely on the
53
+ current directory.
54
+
55
+ An unadopted directory is rejected. `goal` never silently creates or selects a
56
+ different workspace.
57
+
58
+ ## Evidence and freshness
59
+
60
+ Goal planning requires a persisted canonical Model and a Graph whose
61
+ `source.hash` still matches that Model. Missing or mismatched evidence fails
62
+ closed with a renewal command. Use `--refresh` to run the complete Workspace
63
+ Intelligence chain before planning:
64
+
65
+ ```bash
66
+ npx workspai goal "Fix the authentication regression" --refresh --json
67
+ ```
68
+
69
+ The Goal Pack records both bindings and their exact hash semantics. The Model
70
+ uses its stable structural projection; Graph and Goal artifacts use canonical
71
+ JSON. A Goal fingerprint is an identity key and is never presented as a file
72
+ digest. Regenerating after either source binding
73
+ changes creates a different goal identity, preventing an agent from silently
74
+ executing a proposal against stale architecture.
75
+
76
+ ## Honest preflight states
77
+
78
+ `ready-to-plan` means intent, scope, at least one bounded retrieval anchor, and required
79
+ measurement capability are available. It does not mean source changed or the
80
+ goal passed. `needs-evidence` means a measurable target is valid but its
81
+ machine-readable producer or baseline still needs setup. A native C/C++
82
+ project without instrumented LCOV, Cobertura, or LLVM output is therefore
83
+ reported as `needs-evidence`, never as ready.
84
+
85
+ `blocked` means the CLI cannot provide bounded proof-backed retrieval for the
86
+ selected intent and scope. Workspai refuses to hand broad source inspection to
87
+ an agent until Workspace Intelligence is refreshed or the intent is clarified.
88
+
89
+ Preflight also carries the current Workspace Intelligence status, blocked
90
+ stages, deterministic category queries, and bounded graph anchors.
91
+
92
+ ## Relationship to verified goals
93
+
94
+ The two goal surfaces have different jobs:
95
+
96
+ | Surface | Job |
97
+ | ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
98
+ | `workspai goal "<intent>"` | Compile plain language, resolve scope, pin Model/Graph evidence, and prepare an agent handoff |
99
+ | `workspai workspace goal plan ...` | Create or resume one of the shipped deterministic success contracts: release readiness, dependency security, or test coverage |
100
+
101
+ When a plain-language intent maps exactly to one of those three measurable
102
+ contracts, the Goal Pack includes the correct `workspace goal plan` command.
103
+ For example, a coverage intent without a percentage becomes
104
+ `needs-confirmation`; Workspai does not invent a target.
105
+
106
+ For a supported deterministic contract, the lifecycle bridge is explicit:
107
+
108
+ ```bash
109
+ workspai goal --prepare <goal-id> --json
110
+ workspai goal --verify <goal-id> --json
111
+ ```
112
+
113
+ Preparation is refused while clarification or measurement evidence is
114
+ missing. Verification is refused until a CLI verified-goal contract is linked,
115
+ and only CLI evidence may transition the lifecycle to `verified`.
116
+ Only the selected `activeGoalId` may enter preparation or verification. A
117
+ completed verified goal clears the active selection. `--list` and `--cancel`
118
+ remain available when an old Goal is stale, so operators can recover safely;
119
+ `--status`, `--activate`, `--prepare`, and `--verify` require current bindings.
120
+
121
+ ## Ownership and safety boundary
122
+
123
+ ```text
124
+ User intent
125
+ -> CLI: resolve Model, Graph, scope, policy, and success contract
126
+ -> Agent: inspect bounded evidence and propose one focused source change
127
+ -> Human: approve the immutable repair plan
128
+ -> CLI Repair Engine: checkpoint, execute, reconcile, verify, keep or roll back
129
+ ```
130
+
131
+ The agent handoff is a projection, not a second source of truth. Agent plugins,
132
+ IDE chat, MCP, and future independent packages may render or transport it, but
133
+ they cannot widen scope, grant network access, authorize mutation, mark a goal
134
+ verified, or replace CLI evidence.
135
+
136
+ Current Goal Packs use `proposal-only` mutation mode. Model-driven source
137
+ proposal execution is intentionally a later bridge through the existing
138
+ Repair Engine and, ultimately, the independent Decisions architecture.
139
+
140
+ ## Options
141
+
142
+ ```text
143
+ --workspace <path> Explicit canonical workspace
144
+ --scope <scope> workspace or project:<name>
145
+ --for-agent <consumer> generic, claude, or codex (default: generic)
146
+ --max-attempts <count> Bounded proposal budget, 1–25 (default: 5)
147
+ --refresh Refresh Workspace Intelligence before planning
148
+ --dry-run Validate and preview without writes
149
+ --status [goal-id] Validate active or named Goal bindings
150
+ --list List registered Goal Packs
151
+ --activate <goal-id> Select the active agent objective
152
+ --cancel <goal-id> Cancel without deleting evidence
153
+ --prepare <goal-id> Link a deterministic verification contract
154
+ --verify <goal-id> Run CLI-owned verification
155
+ --no-run Read verification evidence without executing producers
156
+ --json Machine-readable result
157
+ ```
158
+
159
+ Choose exactly one lifecycle option. Lifecycle options cannot be combined with
160
+ an intent, `--scope`, `--refresh`, or `--dry-run`; `--no-run` applies only to
161
+ `--verify`. Invalid combinations fail before workspace resolution or writes.
162
+
163
+ Schemas:
164
+
165
+ - [`goal-pack.v1.json`](../contracts/workspace-intelligence/goal-pack.v1.json)
166
+ - [`goal-agent-handoff.v1.json`](../contracts/workspace-intelligence/goal-agent-handoff.v1.json)
167
+ - [`goal-plan-result.v1.json`](../contracts/workspace-intelligence/goal-plan-result.v1.json)
168
+ - [`goal-index.v1.json`](../contracts/workspace-intelligence/goal-index.v1.json)
169
+ - [`goal-lifecycle-result.v1.json`](../contracts/workspace-intelligence/goal-lifecycle-result.v1.json)
170
+
171
+ Every lifecycle operation uses the same `workspai.goal-lifecycle-result.v1`
172
+ success envelope. Failures use the shared CLI operation result with an
173
+ operation-specific code such as `goal.prepare.failed`; consumers never parse
174
+ terminal prose or infer a lifecycle state from directories.
@@ -0,0 +1,92 @@
1
+ # Real-world qualification
2
+
3
+ Workspai's deterministic unit, contract, integration, and adversarial suites
4
+ remain the release gates. Real-world qualification complements them by running
5
+ the installed CLI against explicitly selected reference repositories through
6
+ local, network-free Git snapshots
7
+ without installing dependencies or executing project lifecycle commands.
8
+
9
+ ## Isolated and cumulative layouts
10
+
11
+ Use one isolated workspace per repository when diagnosing detection, adoption,
12
+ Doctor, model, graph, Goal Pack, agent handoff, context, contract, and readiness
13
+ behavior:
14
+
15
+ ```bash
16
+ REFERENCE_ROOT=/path/to/reference-repositories
17
+ QUALIFICATION_ROOT=/path/to/qualification-output
18
+ npm run test:real-world -- \
19
+ --reference-root "$REFERENCE_ROOT" \
20
+ --run-root "$QUALIFICATION_ROOT" \
21
+ --projects vscode,grpc,deno \
22
+ --report "$QUALIFICATION_ROOT/isolated.json"
23
+ ```
24
+
25
+ Snapshot mode is the default and never changes adoption metadata, grounding, or
26
+ workspace links in the source repository. `--source-mode linked` remains an
27
+ explicit diagnostic escape hatch when uncommitted worktree content must be
28
+ qualified; it may update governed Workspai metadata in that linked checkout.
29
+
30
+ Use `--shared-workspace` to adopt the repositories cumulatively into one fresh
31
+ workspace. Every addition reruns the canonical chain, so transition and scale
32
+ failures are observable rather than hidden behind the final state:
33
+
34
+ ```bash
35
+ REFERENCE_ROOT=/path/to/reference-repositories
36
+ QUALIFICATION_ROOT=/path/to/qualification-output
37
+ npm run test:real-world -- \
38
+ --reference-root "$REFERENCE_ROOT" \
39
+ --run-root "$QUALIFICATION_ROOT" \
40
+ --shared-workspace enterprise-polyglot \
41
+ --projects vscode,grpc,deno,copilot-sdk \
42
+ --report "$QUALIFICATION_ROOT/shared.json"
43
+ ```
44
+
45
+ At each cumulative adoption boundary, the harness also previews a
46
+ workspace-scoped Goal and requires its scope and baseline count to match every
47
+ project adopted so far. This catches stale Model/Graph or partial-scope
48
+ handoffs before the final large-workspace state hides the transition that
49
+ introduced them.
50
+
51
+ After the shared workspace qualifies, exercise bounded queries, full graph
52
+ exports, diff/impact/verify/trace, agent dry runs, portable archives, snapshots,
53
+ and destructive-operation dry runs:
54
+
55
+ ```bash
56
+ QUALIFICATION_ROOT=/path/to/qualification-output
57
+ npm run test:real-world:enterprise -- \
58
+ --workspace "$QUALIFICATION_ROOT/enterprise-polyglot" \
59
+ --report "$QUALIFICATION_ROOT/enterprise-command-surface.json"
60
+ ```
61
+
62
+ ## Safety and interpretation
63
+
64
+ - Reference repositories are cloned locally with `git clone --shared`; no
65
+ network request is made and the original checkout is read-only. Snapshot
66
+ adoption metadata and agent grounding remain under `--run-root`.
67
+ - `--reference-root` is mandatory. The harness has no developer-machine default.
68
+ - Qualification reports are publication-safe by construction: project names are
69
+ anonymized, absolute paths and command arguments are omitted, and raw command
70
+ output is never retained. Report writing fails closed if a local path or a
71
+ forbidden raw-output field reaches the payload.
72
+ - Enterprise command artifacts (graphs, archives, exports, and snapshots) are
73
+ operational test material and remain local-only. Publish only the sanitized
74
+ qualification JSON report, never its adjacent artifact directory.
75
+ - Dependency installation, project build/test/start/init, infrastructure
76
+ mutation, publication, and model network calls are not permitted.
77
+ - Agent customization and destructive project operations are dry-run only.
78
+ - Goal qualification publishes one system-understanding Goal inside the
79
+ isolated test workspace, validates its lifecycle binding, and previews
80
+ runtime-specific coverage and release-readiness goals without executing
81
+ project tests or mutating project source.
82
+ - Exit codes `1` and `2` may be valid domain outcomes when their documented JSON
83
+ contracts parse successfully; unexpected process, timeout, buffer, or schema
84
+ failures fail qualification.
85
+ - A real repository warning remains evidence, not a CLI defect. Fix the CLI only
86
+ when detection, classification, contract, portability, or command semantics
87
+ are wrong.
88
+ - Full graphs belong in `--output` artifacts. Agents and IDEs consume bounded
89
+ `search`, `entities`, `evidence`, and `path` results.
90
+
91
+ These suites are explicit and opt-in because they require local reference
92
+ repositories. They do not replace cross-platform CI fixtures or release gates.
@@ -102,6 +102,20 @@ they are in the current graph. Exact labels and identities still win. This keeps
102
102
  a common word such as `check` from outranking a rarer term such as `user` merely
103
103
  because it appears in more files. No embedding service or model call is involved.
104
104
 
105
+ For multi-term questions, a generic kind intent such as `service` or `api`
106
+ cannot qualify an otherwise unrelated entity by itself. The result must cover
107
+ the query's meaningful terms, except for deliberate broad architecture queries
108
+ whose purpose is to return a diversified set of languages, bindings,
109
+ dependencies, ownership, CI, deployment, documentation, and contracts.
110
+
111
+ Source-structure extraction is also deliberately sampled. Local import
112
+ resolution uses the larger bounded fingerprint inventory, so a sampled source
113
+ file can still link to a valid target outside the extraction window. A target
114
+ outside the sample receives a lightweight proof-backed file entity; its full
115
+ symbols are not implied to have been extracted. The graph diagnostic reports
116
+ the sampled and indexed candidate counts and must not be read as exhaustive
117
+ symbol coverage.
118
+
105
119
  ### Fast reads without stale answers
106
120
 
107
121
  The read-oriented `search`, `entities`, `evidence`, `path`, and `benchmark`
@@ -142,11 +156,18 @@ files beyond that declared limit.
142
156
  | Why does Workspai believe an item exists? | `workspace graph evidence <entity-or-relation> --json` |
143
157
  | How are two things connected? | `workspace graph path <from> <to> --json` |
144
158
  | What changed between graph revisions? | `workspace graph overlay --from <graph.json> --json` |
145
- | What is the full portable graph? | `workspace graph emit --json` |
146
- | How do I render the project topology? | `workspace graph dot\|mermaid [--output <file>]` |
159
+ | What is the full portable graph? | `workspace graph emit --output graph.json --json` |
160
+ | How do I render the project topology? | `workspace graph dot\|mermaid [--output <file>]` |
147
161
  | How do I export to semantic or graph-analysis tools? | `workspace graph jsonld\|graphml\|gexf --output <file>` |
148
162
  | How much retrieval payload did one query avoid? | `workspace graph benchmark <query> --limit <n> --json` |
149
- | How should an MCP-compatible agent retrieve context? | `workspace mcp serve` → `searchWorkspaceGraph` |
163
+
164
+ `graph emit --json` writes the complete dependency and Knowledge Graph to
165
+ stdout and can be very large. Automation, IDEs, and agents should pass
166
+ `--output`; stdout then contains only a bounded
167
+ `workspai-cli-operation-result-v1` receipt. Use `search`, `entities`,
168
+ `evidence`, or `path` for bounded retrieval rather than loading the full
169
+ export.
170
+ | How should an MCP-compatible agent retrieve context? | `workspace mcp serve` → `searchWorkspaceGraph` |
150
171
 
151
172
  ## What it models
152
173
 
@@ -55,8 +55,12 @@ npx workspai workspace import team.workspai-archive.zip --output ./team --json
55
55
  - Registry and contract sync include adopted projects for `workspace model`, `workspace context`, Dashboard, and agents.
56
56
  - Managed grounding writes a portable project lens, project grounding, and a
57
57
  bounded managed section in `AGENTS.md`. User-authored `AGENTS.md` content is
58
- preserved.
59
- - `--dry-run --json` previews detection without writing metadata.
58
+ preserved, and an authored tracked deletion of that file is never resurrected.
59
+ - `--dry-run --json` previews detection without writing metadata. Its versioned
60
+ `adoptedProject.effects` record also declares project metadata files,
61
+ conditional `.gitignore`/`AGENTS.md` reconciliation, and the registration,
62
+ contract, model, graph, and agent-grounding operations that a real run would
63
+ perform.
60
64
 
61
65
  ### Existing workspace behavior
62
66
 
@@ -103,6 +107,7 @@ entry point into its canonical workspace:
103
107
  ```bash
104
108
  cd /absolute/path/to/project
105
109
  npx workspai project workspace status --json
110
+ npx workspai doctor workspace --json=summary
106
111
  npx workspai doctor project --json
107
112
  npx workspai workspace graph search "authentication endpoint" --limit 12 --json
108
113
  npx workspai workspace intelligence run --for-agent generic --strict --json
@@ -208,6 +213,7 @@ npx workspai workspace contract init
208
213
  npx workspai workspace contract inspect
209
214
  npx workspai workspace contract verify --strict
210
215
  npx workspai workspace contract graph
216
+ npx workspai workspace contract graph --output ./contract-graph.json --json
211
217
  ```
212
218
 
213
219
  Contract file: `.workspai/workspace.contract.json`. Verification checks schema, duplicate slugs, port collisions, and unknown dependencies.
@@ -222,6 +228,12 @@ public environment-template keys, command capabilities, key manifests,
222
228
  entrypoints, API specifications, infrastructure, documentation, and an
223
229
  operational verification profile. Environment values are never emitted.
224
230
 
231
+ The full contract graph can be large because it includes the Knowledge Graph.
232
+ For automation, IDEs, and agents, pass `--output`; the complete portable graph
233
+ is written to that file and stdout remains a bounded
234
+ `workspai-cli-operation-result-v1` receipt. Without `--output`, the existing
235
+ full JSON response remains backward compatible.
236
+
225
237
  The same response also exposes `knowledgeGraph` under the public
226
238
  `workspace-knowledge-graph.v1` contract. It is a provider-neutral,
227
239
  proof-carrying view spanning source structure, packages, service and API
@@ -35,6 +35,13 @@ family. Vendored trees, build outputs, fixtures, and nested test fixture package
35
35
  manifests are excluded from lifecycle discovery so orchestration does not turn
36
36
  sample inputs into install targets.
37
37
 
38
+ Planning and `init` do not require Doctor or release-readiness evidence. Real
39
+ `test`, `build`, and `start` runs enforce the `doctor-workspace` and `readiness`
40
+ gates by default. A failed gate prevents project commands from starting and is
41
+ recorded as `gates.blocked` in the result. `--strict` converts a failing or
42
+ warning gate into a non-zero process exit; without it, the structured gate
43
+ result remains available without turning advisory policy into a process error.
44
+
38
45
  The authoritative scaffold/import/lifecycle tiers are in
39
46
  [contracts/RUNTIME_SUPPORT_MATRIX.md](./contracts/RUNTIME_SUPPORT_MATRIX.md).
40
47
  Inspect one project's effective surface with
@@ -98,15 +105,20 @@ both command context and the final root cause without copying the full log.
98
105
  Consumers should render these fields rather than reconstructing a diagnosis
99
106
  from arbitrary stdout lines.
100
107
 
108
+ The canonical report is `.workspai/reports/workspace-run-last.json`. Workspace
109
+ verification binds a finding to its exact producer through `sourceCommand` and
110
+ `sourceArtifact`; consumers should run the cited producer and read that artifact
111
+ instead of guessing which command can refresh the evidence.
112
+
101
113
  ## Command semantics
102
114
 
103
115
  Workspai has two workspace-level execution surfaces and three equivalent full-init aliases at workspace root:
104
116
 
105
- | Command | Intent | Scope |
106
- | --- | --- | --- |
117
+ | Command | Intent | Scope |
118
+ | ------------------------------------------------------------------ | -------------------------------------------------- | ----------------- |
107
119
  | `init`, `workspace init`, `workspace run init` (at workspace root) | Mirrored full-init (workspace deps + project init) | Workspace + fleet |
108
- | `workspace run <test\|build\|start>` | Fleet stage execution | Selected projects |
109
- | `init`, `test`, `build`, `start`, `dev` (inside project dir) | Project primitive | Single project |
120
+ | `workspace run <test\|build\|start>` | Fleet stage execution | Selected projects |
121
+ | `init`, `test`, `build`, `start`, `dev` (inside project dir) | Project primitive | Single project |
110
122
 
111
123
  At workspace root, `npx workspai init`, `npx workspai workspace init`, and `npx workspai workspace run init` are equivalent aliases.
112
124
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workspai",
3
- "version": "0.56.0",
3
+ "version": "0.58.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": [
@@ -53,6 +53,8 @@
53
53
  "dist",
54
54
  "contracts",
55
55
  "docs",
56
+ "!docs/*.mp4",
57
+ "!docs/*.gif",
56
58
  "templates",
57
59
  "workspai.config.example.cjs",
58
60
  "rapidkit.config.example.cjs",
@@ -115,6 +117,8 @@
115
117
  "test:runtime-matrix": "node scripts/runtime-acceptance-matrix.mjs",
116
118
  "test:runtime-contract": "node scripts/runtime-acceptance-matrix.mjs --contract-only",
117
119
  "test:runtime-matrix:full": "node scripts/runtime-acceptance-matrix.mjs --full",
120
+ "test:real-world": "node scripts/real-world-qualification.mjs",
121
+ "test:real-world:enterprise": "node scripts/enterprise-workspace-qualification.mjs",
118
122
  "lint": "eslint src --ext .ts",
119
123
  "lint:fix": "eslint src --ext .ts --fix",
120
124
  "format": "prettier --write \"src/**/*.ts\"",
@@ -1 +0,0 @@
1
- export{b as printAnalyzeReport,a as runAnalyze}from'./chunk-YM77FQB3.js';
@@ -1 +0,0 @@
1
- export{b as AUTOPILOT_RELEASE_ALIAS_FILENAME,a as AUTOPILOT_RELEASE_LAST_RUN_FILENAME,c as runAutopilotRelease}from'./chunk-6HCAGHCY.js';
@@ -1 +0,0 @@
1
- export{b as runDoctorCapabilities}from'./chunk-KS4FB5W7.js';
@@ -1 +0,0 @@
1
- import {a}from'./chunk-W5ZFXKSL.js';import {a as a$1}from'./chunk-GR6442P7.js';import {f,e}from'./chunk-ADL3CK44.js';import {h,i}from'./chunk-5EPPPMAS.js';import {createHash}from'crypto';import c from'path';import {execa}from'execa';import u from'fs-extra';var V=h.projectTestCoverage.schemaVersion,k=i.projectTestCoverage,$=["package.json","pyproject.toml","requirements.txt","go.mod","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","composer.json","Gemfile","mix.exs","deps.edn","project.clj","build.sbt","CMakeLists.txt","meson.build","deno.json","deno.jsonc"];function p(e){let t=Number(e);return Number.isFinite(t)&&t>=0?t:0}function m(e,t,o=0){let n=p(e),r=Math.min(p(t),n),i=p(o);return {total:n,covered:r,skipped:i,percent:n>0?Math.round(r/n*1e4)/100:null}}function W(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e;return m(t.total,t.covered,t.skipped)}function y(e,t){let o=c.isAbsolute(t)?t:c.resolve(e,t),n=c.relative(e,o);return n&&!n.startsWith("..")?n.split(c.sep).join("/"):t}async function x(e){return createHash("sha256").update(await u.readFile(e)).digest("hex")}async function H(e){let t=c.resolve(e);for(;;){if(await u.pathExists(c.join(t,".workspai","project.json"))||await u.pathExists(c.join(t,".rapidkit","project.json"))||(await Promise.all($.map(r=>u.pathExists(c.join(t,r))))).some(Boolean))return t;let n=c.dirname(t);if(n===t)return c.resolve(e);t=n;}}async function D(e){if(await u.pathExists(c.join(e,"deno.json"))||await u.pathExists(c.join(e,"deno.jsonc")))return "deno";if(await u.pathExists(c.join(e,"bun.lock"))||await u.pathExists(c.join(e,"bun.lockb")))return "bun";if(await u.pathExists(c.join(e,"package.json")))return "node";if(await u.pathExists(c.join(e,"pyproject.toml"))||await u.pathExists(c.join(e,"requirements.txt")))return "python";if(await u.pathExists(c.join(e,"go.mod")))return "go";let t=await u.pathExists(c.join(e,"pom.xml"))||await u.pathExists(c.join(e,"build.gradle"))||await u.pathExists(c.join(e,"build.gradle.kts"));return t&&(await P(e,o=>o.endsWith(".kt")||o.endsWith(".kts")&&o!=="build.gradle.kts"&&o!=="settings.gradle.kts",4)).length>0?"kotlin":t?"java":await u.pathExists(c.join(e,"Cargo.toml"))?"rust":await u.pathExists(c.join(e,"composer.json"))?"php":await u.pathExists(c.join(e,"Gemfile"))?"ruby":await u.pathExists(c.join(e,"mix.exs"))?"elixir":await u.pathExists(c.join(e,"deps.edn"))||await u.pathExists(c.join(e,"project.clj"))?"clojure":await u.pathExists(c.join(e,"build.sbt"))?"scala":await u.pathExists(c.join(e,"CMakeLists.txt"))?(await P(e,n=>/\.(c|cc|cpp|cxx)$/.test(n),3)).some(n=>/\.(cc|cpp|cxx)$/.test(n))?"cpp":"c":(await P(e,o=>/\.(sln|csproj)$/.test(o),2)).length>0?"dotnet":"unknown"}async function P(e,t,o=5){let n=[],r=[{dir:e,depth:0}],i=new Set([".git",".workspai",".rapidkit","node_modules",".venv","vendor","deps"]);for(;r.length>0;){let s=r.shift();if(!s)break;let a=await u.readdir(s.dir,{withFileTypes:true}).catch(()=>[]);for(let l of a){if(i.has(l.name)||a$1(l.name))continue;let d=c.join(s.dir,l.name),g=c.relative(e,d).split(c.sep).join("/");l.isFile()&&t(l.name,g)&&n.push(d),l.isDirectory()&&s.depth<o&&r.push({dir:d,depth:s.depth+1});}}return n}async function L(e,t){let o=await u.readJson(t),n=o.total??o,r={};for(let s of ["lines","branches","functions","statements"]){let a=W(n[s]);a&&(r[s]=a);}let i=[];for(let[s,a]of Object.entries(o)){if(s==="total"||!a||typeof a!="object"||Array.isArray(a))continue;let l=a,d={};for(let g of ["lines","branches","functions","statements"]){let b=W(l[g]);b&&(d[g]=b);}i.push({path:y(e,s),metrics:d});}return {metrics:r,files:i,source:{format:"istanbul-json",path:t,sha256:await x(t)}}}async function G(e,t){let o=await u.readJson(t),n=o.totals??{},r={lines:m(n.num_statements,n.covered_lines)};p(n.num_branches)>0&&(r.branches=m(n.num_branches,n.covered_branches));let i=[];for(let[s,a]of Object.entries(o.files??{})){let l=a?.summary??{};i.push({path:y(e,s),metrics:{lines:m(l.num_statements,l.covered_lines),...p(l.num_branches)>0?{branches:m(l.num_branches,l.covered_branches)}:{}}});}return {metrics:r,files:i,source:{format:"coverage-py-json",path:t,sha256:await x(t)}}}function j(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e,o=p(t.count),n=p(t.covered);return o>0?m(o,n):void 0}async function q(e,t){let o=await u.readJson(t),n=Array.isArray(o.data)?o.data[0]??{}:o,r=n.totals??{},i={};i.lines=j(r.lines),i.functions=j(r.functions),i.branches=j(r.branches),i.statements=j(r.regions);let s=[];for(let a of Array.isArray(n.files)?n.files:[]){if(!a||typeof a!="object"||Array.isArray(a))continue;let l=a,d=l.summary??{};s.push({path:y(e,String(l.filename??"unknown")),metrics:{lines:j(d.lines),functions:j(d.functions),branches:j(d.branches),statements:j(d.regions)}});}return {metrics:i,files:s,source:{format:"llvm-cov-json",path:t,sha256:await x(t)}}}async function A(e,t){let o=await u.readFile(t,"utf8"),n=[],r="",i=0,s=0,a=0,l=0,d=0,g=0,b=v=>{r&&(n.push({path:y(e,r),metrics:{lines:m(v.lineTotal,v.lineCovered),functions:m(v.functionTotal,v.functionCovered),branches:m(v.branchTotal,v.branchCovered)}}),i+=v.lineTotal,s+=v.lineCovered,a+=v.functionTotal,l+=v.functionCovered,d+=v.branchTotal,g+=v.branchCovered);},h={lineTotal:0,lineCovered:0,functionTotal:0,functionCovered:0,branchTotal:0,branchCovered:0};for(let v of o.split(/\r?\n/))v.startsWith("SF:")?r=v.slice(3):v.startsWith("LF:")?h.lineTotal=p(v.slice(3)):v.startsWith("LH:")?h.lineCovered=p(v.slice(3)):v.startsWith("FNF:")?h.functionTotal=p(v.slice(4)):v.startsWith("FNH:")?h.functionCovered=p(v.slice(4)):v.startsWith("BRF:")?h.branchTotal=p(v.slice(4)):v.startsWith("BRH:")?h.branchCovered=p(v.slice(4)):v==="end_of_record"&&(b(h),r="",h={lineTotal:0,lineCovered:0,functionTotal:0,functionCovered:0,branchTotal:0,branchCovered:0});return {metrics:{lines:m(i,s),functions:m(a,l),branches:m(d,g)},files:n,source:{format:"lcov",path:t,sha256:await x(t)}}}async function U(e,t){let o=await u.readFile(t,"utf8"),n=new Map;for(let s of o.split(/\r?\n/).slice(1)){let a=/^(.+?):\d+\.\d+,\d+\.\d+\s+(\d+)\s+(\d+)$/.exec(s.trim());if(!a)continue;let l=n.get(a[1])??{total:0,covered:0},d=p(a[2]);l.total+=d,p(a[3])>0&&(l.covered+=d),n.set(a[1],l);}let r=[...n.entries()].map(([s,a])=>({path:y(e,s),metrics:{statements:m(a.total,a.covered)}})),i=[...n.values()].reduce((s,a)=>({total:s.total+a.total,covered:s.covered+a.covered}),{total:0,covered:0});return {metrics:{statements:m(i.total,i.covered)},files:r,source:{format:"go-coverprofile",path:t,sha256:await x(t)}}}function T(e,t){let n=[...e.matchAll(new RegExp(`<counter\\s+type=["']${t}["']\\s+missed=["'](\\d+)["']\\s+covered=["'](\\d+)["']\\s*\\/?\\s*>`,"gi"))].at(-1);return n?m(Number(n[1])+Number(n[2]),n[2]):void 0}async function C(e,t){let o=await u.readFile(e,"utf8"),n={};if(t==="cobertura-xml"){let r=/<coverage\b([^>]*)>/i.exec(o)?.[1]??"",i=/\bline-rate=["']([\d.]+)["']/i.exec(r)?.[1],s=/\bbranch-rate=["']([\d.]+)["']/i.exec(r)?.[1];i&&(n.lines=m(1e4,Math.round(Number(i)*1e4))),s&&(n.branches=m(1e4,Math.round(Number(s)*1e4)));}if(t==="clover-xml"){let i=[...o.matchAll(/<metrics\b([^>]*)\/?>/gi)].at(-1)?.[1]??"",s=g=>p(new RegExp(`\\b${g}=["'](\\d+)["']`,"i").exec(i)?.[1]),a=s("statements"),l=s("methods"),d=s("conditionals");a>0&&(n.statements=m(a,s("coveredstatements"))),l>0&&(n.functions=m(l,s("coveredmethods"))),d>0&&(n.branches=m(d,s("coveredconditionals")));}return n.lines??=T(o,"LINE"),n.branches??=T(o,"BRANCH"),n.functions??=T(o,"METHOD"),n.statements??=T(o,"INSTRUCTION"),{metrics:n,files:[],source:{format:t,path:e,sha256:await x(e)}}}async function z(e){let t=await u.readFile(e,"utf8"),o=/<scoverage\b([^>]*)>/i.exec(t)?.[1]??"",n=b=>p(new RegExp(`\\b${b}=["']([\\d.]+)["']`,"i").exec(o)?.[1]),r=n("statement-count"),i=n("statements-invoked"),s=n("branch-count"),a=n("branches-invoked"),l=n("statement-rate"),d=n("branch-rate"),g={};return r>0?g.statements=m(r,i):l>0&&(g.statements=m(1e4,Math.round(l*100))),s>0?g.branches=m(s,a):d>0&&(g.branches=m(1e4,Math.round(d*100))),{metrics:g,files:[],source:{format:"scoverage-xml",path:e,sha256:await x(e)}}}async function B(e,t){let o=await u.readJson(t),n=new Map;for(let s of Object.values(o)){let a=s?.coverage;if(!(!a||typeof a!="object"||Array.isArray(a)))for(let[l,d]of Object.entries(a)){if(!Array.isArray(d))continue;let g=n.get(l)??[];d.forEach((b,h)=>{typeof b=="number"&&(g[h]=Math.max(g[h]??0,b));}),n.set(l,g);}}let r=[...n.entries()].map(([s,a])=>{let l=a.filter(d=>typeof d=="number");return {path:y(e,s),metrics:{lines:m(l.length,l.filter(d=>d>0).length)}}}),i=r.reduce((s,a)=>{let l=a.metrics.lines;return {total:s.total+(l?.total??0),covered:s.covered+(l?.covered??0)}},{total:0,covered:0});return {metrics:{lines:m(i.total,i.covered)},files:r,source:{format:"simplecov-json",path:t,sha256:await x(t)}}}async function K(e){let t=[{relativePath:"coverage/coverage-summary.json",parser:r=>L(e,r)},{relativePath:"coverage.json",parser:async r=>{let i=await u.readJson(r);return Array.isArray(i.data)?q(e,r):G(e,r)}},{relativePath:"coverage/lcov.info",parser:r=>A(e,r)},{relativePath:"cover/lcov.info",parser:r=>A(e,r)},{relativePath:"lcov.info",parser:r=>A(e,r)},{relativePath:"coverage.out",parser:r=>U(e,r)},{relativePath:"target/site/jacoco/jacoco.xml",parser:r=>C(r,"jacoco-xml")},{relativePath:"build/reports/jacoco/test/jacocoTestReport.xml",parser:r=>C(r,"jacoco-xml")},{relativePath:"coverage.xml",parser:r=>C(r,"clover-xml")},{relativePath:".resultset.json",parser:r=>B(e,r)}];for(let r of t){let i=c.join(e,r.relativePath);if(await u.pathExists(i))return r.parser(i)}let n=(await P(e,(r,i)=>r==="coverage.cobertura.xml"||r==="jacoco.xml"||r==="clover.xml"||r==="scoverage.xml"||i.endsWith("/coverage-summary.json"),7)).sort()[0];return n?n.endsWith("coverage-summary.json")?L(e,n):n.endsWith("jacoco.xml")?C(n,"jacoco-xml"):n.endsWith("coverage.cobertura.xml")?C(n,"cobertura-xml"):n.endsWith("scoverage.xml")?z(n):C(n,"clover-xml"):null}async function X(e){return u.readJson(c.join(e,"package.json")).catch(()=>null)}async function Q(e,t){let o=(n,r)=>({cwd:e,executable:n,args:r});if(t==="node"||t==="bun"){let r=(await X(e))?.scripts??{},i=["test:coverage","test:cov","coverage"].find(a=>typeof r[a]=="string"),s=t==="bun"?"bun":await u.pathExists(c.join(e,"pnpm-lock.yaml"))?"pnpm":await u.pathExists(c.join(e,"yarn.lock"))?"yarn":"npm";if(i)return {runner:String(r[i]).split(/\s+/)[0]||s,invocations:[o(s,s==="yarn"?[i]:["run",i])],diagnostics:[]};if(typeof r.test=="string"){let a=s==="yarn"?["test","--coverage"]:s==="bun"?["test","--coverage","--coverage-reporter=lcov"]:["test","--","--coverage"];return {runner:String(r.test).split(/\s+/)[0]||s,invocations:[o(s,a)],diagnostics:[]}}return {runner:null,invocations:[],diagnostics:["No project-owned test or coverage script was detected."]}}if(t==="deno")return {runner:"deno",invocations:[o("deno",["test","--coverage=coverage"]),o("deno",["coverage","--lcov","--output=coverage/lcov.info","coverage"])],diagnostics:[]};if(t==="python")return {runner:"pytest-cov",invocations:[o(await u.pathExists(c.join(e,".venv",process.platform==="win32"?"Scripts":"bin",process.platform==="win32"?"python.exe":"python"))?c.join(".venv",process.platform==="win32"?"Scripts":"bin",process.platform==="win32"?"python.exe":"python"):process.platform==="win32"?"python":"python3",["-m","pytest","--cov=.","--cov-report=json:coverage.json"])],diagnostics:[]};if(t==="go")return {runner:"go test",invocations:[o("go",["test","./...","-coverprofile=coverage.out"])],diagnostics:[]};if(t==="java"){let n=await u.pathExists(c.join(e,"gradlew")),r=await u.pathExists(c.join(e,"gradlew.bat")),i=n||r,s=await u.pathExists(c.join(e,"mvnw")),a=await u.pathExists(c.join(e,"mvnw.cmd")),l=i?process.platform==="win32"&&r?".\\gradlew.bat":"./gradlew":await u.pathExists(c.join(e,"pom.xml"))?process.platform==="win32"&&a?".\\mvnw.cmd":s?"./mvnw":"mvn":"gradle";return {runner:i?"jacoco/gradle":"jacoco/maven",invocations:[o(l,i?["test","jacocoTestReport"]:["test","jacoco:report"])],diagnostics:[]}}return t==="dotnet"?{runner:"dotnet coverlet",invocations:[o("dotnet",["test","--collect:XPlat Code Coverage"])],diagnostics:[]}:t==="rust"?{runner:"cargo llvm-cov",invocations:[o("cargo",["llvm-cov","--json","--output-path","coverage.json"])],diagnostics:["cargo-llvm-cov must be available in the project toolchain."]}:t==="php"?{runner:"phpunit",invocations:[o(process.platform==="win32"?"vendor\\bin\\phpunit.bat":"vendor/bin/phpunit",["--coverage-clover","coverage.xml"])],diagnostics:[]}:t==="ruby"?{runner:"simplecov",invocations:[o("bundle",["exec","rspec"])],diagnostics:["The test suite must enable SimpleCov to emit .resultset.json."]}:t==="elixir"?{runner:"mix cover",invocations:[o("mix",["test","--cover"])],diagnostics:["Configure ExCoveralls for JSON or LCOV interchange when machine-readable coverage is required."]}:t==="clojure"?{runner:"cloverage",invocations:[o("clojure",["-M:coverage"])],diagnostics:["The project must declare a coverage alias such as cloverage."]}:t==="scala"?{runner:"sbt-scoverage",invocations:[o("sbt",["clean","coverage","test","coverageReport"])],diagnostics:["The project must declare the scoverage plugin."]}:t==="kotlin"?{runner:"jacoco/gradle",invocations:[o(await u.pathExists(c.join(e,process.platform==="win32"?"gradlew.bat":"gradlew"))?process.platform==="win32"?".\\gradlew.bat":"./gradlew":"gradle",["test","jacocoTestReport"])],diagnostics:["The project must declare the JaCoCo Gradle plugin."]}:t==="c"||t==="cpp"?{runner:"CTest/LLVM coverage",invocations:[o("ctest",["--test-dir","build","--output-on-failure"])],diagnostics:["The native build must be instrumented for coverage and export LCOV, Cobertura, or LLVM JSON evidence."]}:{runner:null,invocations:[],diagnostics:["Project runtime could not be detected."]}}function Y(e,t){let o=e?c.relative(e,t).split(c.sep).join("/"):c.resolve(t),n=c.basename(t).toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"project",r=createHash("sha256").update(o).digest("hex").slice(0,12);return `${n}--${r}`}function Z(e){return e.lines?"lines":e.statements?"statements":e.branches?"branches":"functions"}async function ue(e$1={}){let t=await H(e$1.projectPath??process.cwd()),o=a(t),n=await D(t),r=Math.max(0,Math.min(100,Math.round(e$1.target??80))),i=await Q(t,n),s=[],a$1=Date.now();if(e$1.run)for(let f of i.invocations){let w=await execa(f.executable,f.args,{cwd:f.cwd,reject:false,timeout:6e5}).catch(()=>({exitCode:1}));if(s.push(Number(w.exitCode??1)),Number(w.exitCode??1)!==0)break}let l=await K(t).catch(()=>null),d=l?Z(l.metrics):"lines",g=l?.metrics[d]?.percent??null,b=e$1.run&&s.some(f=>f!==0)?"failed":g===null?"unavailable":g>=r?"passed":"below-target",h=Y(o,t),v=c.join(t,k),E=o?`.workspai/reports/projects/${h}/project-test-coverage-last-run.json`:null,R={schemaVersion:V,generatedAt:new Date().toISOString(),status:b,project:{id:h,name:c.basename(t),path:t,workspacePath:o},runtime:n,runner:i.runner,target:{metric:d,percent:r},metrics:l?.metrics??{},files:l?.files??[],lowCoverageFiles:(l?.files??[]).map(f=>{let w=f.metrics[d]??f.metrics.lines??f.metrics.statements;return {path:f.path,percent:w?.percent??null,uncovered:Math.max(0,(w?.total??0)-(w?.covered??0))}}).filter(f=>f.percent===null||f.percent<r).sort((f,w)=>w.uncovered-f.uncovered||f.path.localeCompare(w.path)),source:l?.source??{format:"unknown",path:null,sha256:null},execution:{requested:e$1.run===true,invocations:i.invocations,exitCodes:s,durationMs:Date.now()-a$1},diagnostics:[...i.diagnostics,...l?[]:["No supported machine-readable coverage artifact was found."]],artifactPaths:{project:v,workspaceLatest:o?c.join(o,k):null,workspaceProject:o&&E?c.join(o,E):null}};return o&&E&&await f(o,k,[{relativePath:k,payload:R},{relativePath:E,payload:R}]),await e(t,k,R),R}export{V as a,k as b,ue as c};
@@ -1 +0,0 @@
1
- var r="workspai.doctor-capabilities.v1",k="universal-doctor-capabilities-v1",t="workspai.doctor-validation.v1",w="doctor-disease-corpus-v1";var o={model:".workspai/reports/workspace-model.json",knowledgeGraph:".workspai/reports/workspace-knowledge-graph.json",snapshot:".workspai/reports/workspace-model-snapshot.json",diff:".workspai/reports/workspace-model-diff-last-run.json",impact:".workspai/reports/workspace-impact-last-run.json",analyze:".workspai/reports/analyze-last-run.json",doctor:".workspai/reports/doctor-last-run.json",contractVerify:".workspai/reports/workspace-contract-verify-last-run.json",readiness:".workspai/reports/release-readiness-last-run.json",verify:".workspai/reports/workspace-verify-last-run.json",history:".workspai/reports/workspace-intelligence-history.json",agentContext:".workspai/reports/workspace-context-agent.json",agentIndex:".workspai/reports/INDEX.json",agentCustomizationPack:".workspai/reports/agent-customization-pack.json",skillsIndex:".workspai/reports/workspace-skills-index.json",agents:"AGENTS.md",explain:".workspai/reports/workspace-explain-last-run.json",intelligenceRun:".workspai/reports/workspace-intelligence-run-last-run.json",evaluationLive:".workspai/reports/workspace-intelligence-evaluation-live.json",evaluationLastRun:".workspai/reports/workspace-intelligence-evaluation-last-run.json",verifiedGoalStatus:".workspai/reports/verified-goal-last-run.json",repairTransaction:".workspai/reports/workspace-repair-last-run.json"},s={model:"workspace-model.v1",knowledgeGraph:"workspace-knowledge-graph.v1",snapshot:"workspace-model-snapshot.v1",diff:"workspace-model-diff.v1",impact:"workspace-impact.v1",analyze:"rapidkit-analyze-v1",doctor:"doctor-workspace-evidence-v1",contractVerify:"workspace-contract-verify.v1",readiness:"release-readiness-v1",verify:"workspace-verify.v1",history:"workspace-intelligence-history.v1",agentContext:"workspace-context.v1",agentIndex:"rapidkit-agent-reports-index.v1",agentCustomizationPack:"rapidkit-agent-customization-pack.v1",skillsIndex:"workspace-skills-index.v1",agents:null,explain:"workspace-explain.v1",intelligenceRun:"workspace-intelligence-run.v1",evaluationLive:"workspace-intelligence-evaluation.v1",evaluationLastRun:"workspace-intelligence-evaluation.v1",verifiedGoalStatus:"workspai.verified-goal-status.v1",repairTransaction:"workspai.workspace-repair-transaction.v1"},c={model:"contracts/workspace-intelligence/workspace-model.v1.json",knowledgeGraph:"contracts/workspace-intelligence/workspace-knowledge-graph.v1.json",snapshot:"contracts/workspace-intelligence/workspace-model-snapshot.v1.json",diff:"contracts/workspace-intelligence/workspace-model-diff.v1.json",impact:"contracts/workspace-intelligence/workspace-impact.v1.json",analyze:"contracts/analyze-last-run.v1.json",doctor:"contracts/doctor-workspace-evidence.v1.json",contractVerify:"contracts/workspace-intelligence/workspace-contract-verify.v1.json",readiness:"contracts/release-readiness.v1.json",verify:"contracts/workspace-intelligence/workspace-verify.v1.json",history:"contracts/workspace-intelligence/workspace-intelligence-history.v1.json",agentContext:"contracts/workspace-intelligence/workspace-context.v1.json",agentIndex:"contracts/workspace-intelligence/agent-reports-index.v1.json",agentCustomizationPack:"contracts/workspace-intelligence/agent-customization-pack-report.v1.json",skillsIndex:"contracts/workspace-intelligence/workspace-skills-index.v1.json",agents:null,explain:"contracts/workspace-intelligence/workspace-explain.v1.json",intelligenceRun:"contracts/workspace-intelligence/workspace-intelligence-run.v1.json",evaluationLive:"contracts/workspace-intelligence/workspace-intelligence-evaluation.v1.json",evaluationLastRun:"contracts/workspace-intelligence/workspace-intelligence-evaluation.v1.json",verifiedGoalStatus:"contracts/workspace-intelligence/verified-goal-status.v1.json",repairTransaction:"contracts/workspace-intelligence/workspace-repair-transaction.v1.json"},l={projectWorkspaceLink:{artifactPath:".workspai/workspace-link.local.json",schemaVersion:"project-workspace-link.v1",contractPath:"contracts/project-workspace-link.v1.json",producerCommands:[["adopt"],["import"],["project","workspace","relink"],["workspace","sync"]]},projectContextAgent:{artifactPath:".workspai/reports/project-context-agent.json",schemaVersion:"project-context-agent.v1",contractPath:"contracts/workspace-intelligence/project-context-agent.v1.json",producerCommands:[["adopt"],["import"],["workspace","sync"],["workspace","agent-sync","--write"]]},workspaceContract:{artifactPath:".workspai/workspace.contract.json",schemaVersion:1,contractPath:"contracts/workspace-contract.v1.json",producerCommands:[["workspace","sync"],["workspace","contract","sync"]]},workspaceModelCache:{artifactPath:".workspai/cache/workspace-model.v1.json",schemaVersion:"workspace-model-cache.v1",contractPath:"contracts/workspace-model-cache.v1.json",producerCommands:[["workspace","model"]]},workspaceRegistry:{artifactPath:".workspai/workspace-registry.v1.json",schemaVersion:"workspace-registry.v1",contractPath:"contracts/workspace-registry.v1.json",producerCommands:[["workspace","sync"]]},compatibilityMatrix:{artifactPath:".workspai/compatibility-matrix.json",schemaVersion:"rapidkit.compatibility-matrix.v1",contractPath:"contracts/compatibility-matrix.v1.json",producerCommands:[["bootstrap"]]},doctorWorkspaceCache:{artifactPath:".workspai/reports/doctor-workspace-cache.json",schemaVersion:"doctor-workspace-cache-v2",contractPath:"contracts/doctor-workspace-cache.v2.json",producerCommands:[["doctor","workspace"]]},doctorCapabilities:{artifactPath:".workspai/reports/doctor-capabilities.json",schemaVersion:r,contractPath:"contracts/workspace-intelligence/doctor-capabilities.v1.json",producerCommands:[["doctor","capabilities","--write"]]},doctorValidation:{artifactPath:".workspai/reports/doctor-validation-last-run.json",schemaVersion:t,contractPath:"contracts/workspace-intelligence/doctor-validation.v1.json",producerCommands:[["doctor","capabilities","--validate","--write"]]},bootstrapCompliance:{artifactPath:".workspai/reports/bootstrap-compliance.latest.json",schemaVersion:"bootstrap-compliance.v1",contractPath:"contracts/bootstrap-compliance.v1.json",producerCommands:[["bootstrap"]]},mirrorOps:{artifactPath:".workspai/reports/mirror-ops.latest.json",schemaVersion:"mirror-ops.v1",contractPath:"contracts/mirror-ops.v1.json",producerCommands:[["mirror","status"]]},transparencyEvidence:{artifactPath:".workspai/reports/transparency-evidence.latest.json",schemaVersion:"transparency-evidence.v1",contractPath:"contracts/transparency-evidence.v1.json",producerCommands:[["mirror","sync"]]},workspaceShareBundle:{artifactPath:".workspai/reports/share-bundle.json",schemaVersion:"1.1",schemaVersionField:"schema_version",contractPath:"contracts/workspace-share-bundle.v1.json",producerCommands:[["workspace","share"]]},doctorProject:{artifactPath:".workspai/reports/doctor-project-last-run.json",schemaVersion:"doctor-project-evidence-v1",contractPath:"contracts/doctor-project-evidence.v1.json",producerCommands:[["doctor","project"]]},doctorReceipt:{artifactPath:".workspai/reports/doctor-receipt-last-run.json",schemaVersion:"workspai.doctor-receipt.v1",contractPath:"contracts/workspace-intelligence/doctor-receipt.v1.json",producerCommands:[["doctor","workspace"],["doctor","project"]]},projectTestCoverage:{artifactPath:".workspai/reports/project-test-coverage-last-run.json",schemaVersion:"workspai.project-test-coverage.v1",contractPath:"contracts/project-test-coverage.v1.json",producerCommands:[["project","coverage"]]},doctorRemediationPlan:{artifactPath:".workspai/reports/doctor-remediation-plan-last-run.json",schemaVersion:"doctor-remediation-plan-v2",contractPath:"contracts/doctor-remediation-plan.v2.json",producerCommands:[["workspace","remediation-plan"]]},artifactRemediationPlan:{artifactPath:".workspai/reports/artifact-remediation-plan-last-run.json",schemaVersion:"artifact-remediation-plan-v1",contractPath:"contracts/artifact-remediation-plan.v1.json",producerCommands:[["workspace","remediation-plan"]]},doctorFixResult:{artifactPath:".workspai/reports/doctor-fix-result-last-run.json",schemaVersion:"rapidkit-doctor-fix-result-v1",contractPath:"contracts/workspace-intelligence/doctor-fix-result.v1.json",producerCommands:[["doctor","workspace"]]},pipelineLastRun:{artifactPath:".workspai/reports/pipeline-last-run.json",schemaVersion:"rapidkit-pipeline-v1",contractPath:"contracts/pipeline-last-run.v1.json",producerCommands:[["pipeline"]]},autopilotReleaseLastRun:{artifactPath:".workspai/reports/autopilot-release-last-run.json",schemaVersion:"autopilot-release-v1",contractPath:"contracts/autopilot-release.v1.json",producerCommands:[["autopilot","release"]]},autopilotReleaseAlias:{artifactPath:".workspai/reports/autopilot-release.json",schemaVersion:"autopilot-release-v1",contractPath:"contracts/autopilot-release.v1.json",producerCommands:[["autopilot","release"]]},workspaceRunLast:{artifactPath:".workspai/reports/workspace-run-last.json",schemaVersion:"workspace-run-v1",contractPath:"contracts/workspace-run-last.v1.json",producerCommands:[["workspace","run"]]},workspaiMcpDesign:{artifactPath:".workspai/reports/workspai-mcp-design.json",schemaVersion:"workspai-mcp-design.v1",contractPath:"contracts/workspace-intelligence/mcp-design.v1.json",producerCommands:[["workspace","agent-sync","--write"]]},legacyMcpDesign:{artifactPath:".workspai/reports/rapidkit-mcp-design.json",schemaVersion:"workspai-mcp-design.v1",contractPath:"contracts/workspace-intelligence/mcp-design.v1.json",producerCommands:[["workspace","agent-sync","--write"]]},workspaceWhy:{artifactPath:".workspai/reports/workspace-why-last-run.json",schemaVersion:s.explain,contractPath:c.explain,producerCommands:[["workspace","why"]]},workspaceTrace:{artifactPath:".workspai/reports/workspace-trace-last-run.json",schemaVersion:s.explain,contractPath:c.explain,producerCommands:[["workspace","trace"]]},agentHooks:{artifactPath:".vscode/workspai-agent-hooks.json",schemaVersion:"workspai-agent-hooks.v1",contractPath:"contracts/workspace-intelligence/agent-hooks.v1.json",producerCommands:[["workspace","agent-sync"]]},infraPlan:{artifactPath:".workspai/reports/infra-plan.json",schemaVersion:"rapidkit.infra-plan.v1",contractPath:"contracts/infra-plan.v1.json",producerCommands:[["infra","plan"]]}},h=Object.freeze(Object.fromEntries(Object.entries(l).map(([a,n])=>[a,n.artifactPath]))),g={[o.intelligenceRun]:[["workspace","intelligence","run"]],[o.snapshot]:[["workspace","snapshot"]],[o.history]:[["workspace","feedback","record","--json"]],[o.evaluationLive]:[["workspace","eval","init"],["workspace","eval","record","--json"]],[o.evaluationLastRun]:[["workspace","eval","report","--json"]],[o.verifiedGoalStatus]:[["workspace","goal","plan"],["workspace","goal","verify"]],[o.repairTransaction]:[["workspace","repair","plan"],["workspace","repair","propose"],["workspace","repair","approve"],["workspace","repair","decide"],["workspace","repair","execute"],["workspace","repair","resume"],["workspace","repair","rollback"],["workspace","repair","cancel"]]},j={analyze:"analyze",workspace:"workspace <action> [subaction] [key] [value]",doctor:"doctor [scope]",readiness:"readiness"},f=["analyze","readiness","doctor","workspace"],C=["model","diff","impact","doctor-evidence","contract-evidence","analyze-evidence","readiness-evidence","verify","context","agent-sync","explain"],P=["sync","baseline"],I={sync:[".workspai/workspace.contract.json",".workspai/workspace-registry.v1.json"],baseline:[o.snapshot]},e=o,d={model:{command:["workspace","model","--json","--write"],produces:[e.model,e.knowledgeGraph]},diff:{command:["workspace","diff","--from",e.snapshot,"--json"],produces:[e.diff]},impact:{command:["workspace","impact","--from",e.diff,"--json"],produces:[e.impact]},"doctor-evidence":{command:["doctor","workspace","--json"],produces:[e.doctor]},"contract-evidence":{command:["workspace","contract","verify","--strict","--json"],produces:[e.contractVerify]},"analyze-evidence":{command:["analyze","--json"],produces:[e.analyze]},"readiness-evidence":{command:["readiness","--json","--skip-verify"],produces:[e.readiness]},verify:{command:["workspace","verify","--from-impact",e.impact,"--json"],produces:[e.verify,e.history]},context:{command:["workspace","context","--for-agent","--json","--write","--no-agent-sync"],produces:[e.agentContext]},"agent-sync":{command:["workspace","agent-sync","--write","--json","--preset","enterprise"],produces:[e.agentIndex,e.agentCustomizationPack,e.skillsIndex,e.agents]},explain:{command:["workspace","explain","release-blocked","--json","--write"],produces:[e.explain]}};function y(a){return d[a]}export{r as a,k as b,t as c,w as d,o as e,s as f,c as g,l as h,h as i,g as j,j as k,f as l,C as m,P as n,I as o,d as p,y as q};
@@ -1 +0,0 @@
1
- import {b,c as c$2}from'./chunk-OX53L237.js';import {a as a$1}from'./chunk-YM77FQB3.js';import {r as r$1}from'./chunk-QRWWYL52.js';import {a as a$2}from'./chunk-7PNARN6S.js';import {g}from'./chunk-SV2SP22H.js';import {j as j$1,e as e$2}from'./chunk-GBMCHFOV.js';import {j,l as l$2}from'./chunk-QAF26ZQX.js';import {c as c$1,d}from'./chunk-WOTTSPSF.js';import {a}from'./chunk-UQEQ6CXU.js';import {f as f$1,g as g$1,h as h$2}from'./chunk-XH7PDHBF.js';import {k,l as l$1,h as h$1,m as m$1,n,p as p$2,q}from'./chunk-5BGPGNRQ.js';import {m,p as p$1,s}from'./chunk-5ZA4JYOP.js';import {l,o as o$1,p as p$3}from'./chunk-DOIZANFA.js';import {c,e as e$1}from'./chunk-ADL3CK44.js';import {b as b$1}from'./chunk-LYVDRRDO.js';import {e,f,o,p,n as n$1,m as m$2}from'./chunk-5EPPPMAS.js';import {d as d$1}from'./chunk-VRW6KXNK.js';import ue from'path';import de from'fs-extra';function r(t,s){if(!t)throw new Error(`Workspace Intelligence run semantic violation: ${s}`)}function ce(t,s){return t.length===s.length&&t.every((g,u)=>g===s[u])}function le(t){b$1(e.intelligenceRun,t,"Workspace Intelligence run report"),r(t.chainSchemaVersion===a,`chainSchemaVersion must be ${a}`),r(t.artifactPath===e.intelligenceRun,`artifactPath must be ${e.intelligenceRun}`),r(t.preflight.length===n$1.length,`preflight must contain exactly ${n$1.length} entries`);for(let[c,i]of n$1.entries()){let a=t.preflight[c];r(a?.id===i,`preflight[${c}].id must be ${i}`),r(ce(a.artifacts,o[i]),`${i} preflight artifacts must match the runtime registry`),i==="sync"?r(a.status==="passed"&&a.result==="synchronized"||a.status==="failed"&&a.result==="failed","sync preflight status and result are incoherent"):r(a.status==="passed"&&(a.result==="created"||a.result==="reused")||a.status==="failed"&&a.result==="failed"||a.status==="skipped"&&a.result==="skipped","baseline preflight status and result are incoherent");}let s=t.preflight[1];r(t.baselineCreated===(s?.result==="created"),"baselineCreated must match the baseline preflight result"),r(t.stages.length===m$2.length,`stages must contain exactly ${m$2.length} canonical steps`);let g=t.preflight[0],u=g?.status==="failed";for(let[c,i]of m$2.entries()){let a=t.stages[c];r(a?.id===i,`stages[${c}].id must be ${i}`),r(ce(a.artifacts,p[i].produces),`${i} artifacts must match the runtime registry`),u&&r(a.status==="skipped",`${i} must be skipped after a hard failure`),a.status==="passed"?r(a.exitCode===0,`${i} passed stage must have exitCode 0`):a.status==="blocked"?r(a.exitCode!==0,`${i} blocked stage must have a non-zero exitCode`):a.status==="failed"?(r(a.exitCode===1,`${i} failed stage must have exitCode 1`),u=true):(r(a.exitCode===0,`${i} skipped stage must have exitCode 0`),r(a.durationMs===0,`${i} skipped stage must have durationMs 0`)),c===0&&((g?.status==="failed"||a.status==="failed")&&r(s?.status==="skipped","baseline must be skipped when sync or model fails"),s?.status==="skipped"&&r(g?.status==="failed"||a.status==="failed"||a.status==="skipped","baseline may be skipped only after an upstream failure"),s?.status!=="passed"&&(u=true));}let m=t.preflight.some(c=>c.status==="failed")||t.stages.some(c=>c.status==="failed"),y=t.stages.some(c=>c.status==="blocked"),o$1=m?"failed":y?"blocked":"passed",f=o$1==="failed"?1:o$1==="blocked"?2:0;r(t.status===o$1,`status must be ${o$1}`),r(t.exitCode===f,`exitCode must be ${f}`);}var he=e.intelligenceRun,Ie=f.intelligenceRun,x=he;function h(t){d$1({action:"intelligence",status:t.status==="started"?"started":t.status==="passed"?"succeeded":t.status==="failed"?"failed":"warn",message:t.message,metadata:{phase:`workspace.intelligence.${t.kind}.${t.id}`,intelligenceMilestoneId:t.id,intelligenceMilestoneKind:t.kind,intelligenceMilestoneStatus:t.status}});}async function ze(t){let s=ue.resolve(t.workspacePath);return c(s,x,()=>Ee({...t,workspacePath:s}),{timeoutMs:15*6e4,staleAfterMs:3e4})}async function Ee(t){let s$1=t.workspacePath,g$2=[],u=[],m$2=false,y=async(e,n)=>{let d=[...o[e]];if(m$2){h({id:e,kind:"preflight",status:"skipped",message:`${e} prerequisite skipped after an upstream failure`}),g$2.push({id:e,status:"skipped",result:"skipped",durationMs:0,artifacts:d,message:"skipped because a required upstream operation failed"});return}let I=Date.now();h({id:e,kind:"preflight",status:"started",message:`${e} prerequisite started`});try{let l=await n();h({id:e,kind:"preflight",status:"passed",message:l.message}),g$2.push({id:e,status:"passed",result:l.result,durationMs:Date.now()-I,artifacts:d,message:l.message});}catch(l){m$2=true;let k=l instanceof Error?l.message:String(l);h({id:e,kind:"preflight",status:"failed",message:k}),g$2.push({id:e,status:"failed",result:"failed",durationMs:Date.now()-I,artifacts:d,message:k});}},o$2=async(e,n)=>{let d=[...p[e].produces];if(m$2){h({id:e,kind:"stage",status:"skipped",message:`${e} skipped after an upstream failure`}),u.push({id:e,status:"skipped",durationMs:0,artifacts:d,exitCode:0,message:"skipped because a required upstream stage failed"});return}let I=Date.now();h({id:e,kind:"stage",status:"started",message:`${e} started`});try{let l=await n(),k=l.exitCode??0,_=l.blocked||k!==0?"blocked":"passed";h({id:e,kind:"stage",status:_,message:l.message}),u.push({id:e,status:_,durationMs:Date.now()-I,artifacts:d,exitCode:k,message:l.message});}catch(l){m$2=true;let k=l instanceof Error?l.message:String(l);h({id:e,kind:"stage",status:"failed",message:k}),u.push({id:e,status:"failed",durationMs:Date.now()-I,artifacts:d,exitCode:1,message:k});}};await y("sync",async()=>{let e=await g(s$1,true),n=await l({workspacePath:s$1});return {result:"synchronized",message:`registry ${e.added.length} added/${e.skipped} existing; contract ${n.contract.projects.length} projects`}});let f,c=()=>{if(!f)throw new Error("canonical workspace model is unavailable");return f};await o$2("model",async()=>(f={...await p$1({workspacePath:s$1,includeEvidence:true}),build:m({mode:"full",engineStatus:"disabled"})},await s(f,s$1),{message:`${f.summary.projectCount} projects modeled`}));let i=ue.join(s$1,e.snapshot),a$3=false;await y("baseline",async()=>{if(!await de.pathExists(i)){let d=await k({workspacePath:s$1,model:c()});return await l$1(d,s$1),a$3=true,{result:"created",message:"initial structural baseline created"}}let e=await de.readJson(i),n=h$1(e);return n?(await l$1(n,s$1),{result:"reused",message:"legacy structural baseline migrated and reused"}):{result:"reused",message:"existing structural baseline reused"}}),await o$2("diff",async()=>{let e$1=await m$1({workspacePath:s$1,fromPath:e.snapshot,model:c()});return await n(e$1,s$1),{message:e$1.summary.changed?"workspace changes detected":"no workspace changes"}}),await o$2("impact",async()=>{let e$1=await p$2({workspacePath:s$1,fromPath:e.diff});return await q(e$1,s$1),{message:`${e$1.summary.risk} risk; ${e$1.summary.affectedProjects} affected`}}),await o$2("doctor-evidence",async()=>{let e=await r$1({workspace:s$1,json:true,quiet:true,profile:t.strict===true?"enterprise-strict":"local"});return {exitCode:e,blocked:e!==0,message:`doctor exit ${e}`}}),await o$2("contract-evidence",async()=>{let e=await o$1({workspacePath:s$1,strict:true});return await p$3({workspacePath:s$1,result:e}),{exitCode:e.status==="passed"?0:1,blocked:e.status!=="passed",message:`contract ${e.status}`}}),await o$2("analyze-evidence",async()=>{let e=await a$1({workspacePath:s$1,json:true,strict:t.strict===true});return {blocked:e.summary.verdict==="blocked"||t.strict===true&&e.summary.verdict==="needs-attention",exitCode:e.summary.verdict==="blocked"||t.strict===true&&e.summary.verdict==="needs-attention"?1:0,message:`analyze ${e.summary.verdict} (${e.summary.score}/100)`}}),await o$2("readiness-evidence",async()=>{let e=await a$2({startPath:s$1,writeReport:true,skipVerify:true});return {blocked:e.overallStatus==="fail"||t.strict===true&&e.overallStatus==="warn",exitCode:e.overallStatus==="fail"||t.strict===true&&e.overallStatus==="warn"?1:0,message:`pre-verify readiness ${e.overallStatus}`}}),await o$2("verify",async()=>{let e$1=await f$1({workspacePath:s$1,fromImpactPath:e.impact});await g$1(e$1,s$1);let n=h$2(e$1,{strict:t.strict===true});return await j$1(s$1,e$2(e$1,n.passed)),{blocked:!n.passed,exitCode:n.exitCode,message:`${e$1.summary.verdict}; gate ${n.passed?"passed":"blocked"}`}}),await o$2("context",async()=>{let e=await c$1({workspacePath:s$1,model:c(),agent:t.agent??"generic",includeEvidence:true});return await d(e,s$1),{message:`context grounded for ${e.agent}`}}),await o$2("agent-sync",async()=>{let e=await l$2({workspacePath:s$1,agent:t.agent??"generic",write:true,refreshContext:false,strict:t.strict===true,preset:"enterprise"}),n=e.strictViolations??[],d=t.strict===true&&n.length>0;return {blocked:d,exitCode:d?2:0,message:d?`${e.writtenFiles.length} grounding files written; ${n.length} strict grounding violation(s): ${n.join("; ")}`:`${e.writtenFiles.length} grounding files written`}}),await o$2("explain",async()=>{let e=await b({workspacePath:s$1,target:{kind:"release-blocked"}});return await c$2(e,s$1),{message:e.summary}});let pe=u.some(e=>e.status==="blocked"),A=m$2?"failed":pe?"blocked":"passed",ge=m$2?1:A==="blocked"?2:0,R={schemaVersion:Ie,chainSchemaVersion:a,generatedAt:new Date().toISOString(),workspacePath:s$1,baselineCreated:a$3,preflight:g$2,status:A,exitCode:ge,stages:u,artifactPath:x};le(R),await e$1(s$1,x,R);let me=await j({workspacePath:s$1});return await e$1(s$1,e.agentIndex,me),R}export{he as a,Ie as b,ze as c};