workspai 0.70.0 → 0.71.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -80
- package/contracts/workspace-intelligence/goal-lifecycle-result.v1.json +19 -0
- package/dist/analyze-4YQ67OCK.js +1 -0
- package/dist/autopilot-release-V3A3YCDD.js +1 -0
- package/dist/{chunk-UT57IFS4.js → chunk-26VNCHVV.js} +6 -6
- package/dist/{chunk-Z7JIUA6I.js → chunk-2KJNASF3.js} +1 -1
- package/dist/{chunk-IET57ZKN.js → chunk-4CE3GI4Y.js} +1 -1
- package/dist/{chunk-WUXJCSYO.js → chunk-554W2TXP.js} +1 -1
- package/dist/{chunk-DNZHKBQ3.js → chunk-5HURQABR.js} +1 -1
- package/dist/{chunk-S2TOSHQW.js → chunk-7V3YDKMG.js} +1 -1
- package/dist/{chunk-LE2I2E6R.js → chunk-ACCWXKZW.js} +2 -2
- package/dist/{chunk-TLMP2MGH.js → chunk-AUQLOQ2S.js} +1 -1
- package/dist/{chunk-N6FJZ62B.js → chunk-AUVWD3WV.js} +1 -1
- package/dist/{chunk-S42KDOGG.js → chunk-C563KVBD.js} +1 -1
- package/dist/{chunk-4R7STECB.js → chunk-CX6PAQTQ.js} +1 -1
- package/dist/{chunk-AGZWDYMF.js → chunk-FFE2JZZJ.js} +8 -8
- package/dist/{chunk-LU6CYDLN.js → chunk-H64KAPJJ.js} +1 -1
- package/dist/{chunk-QZODGRAI.js → chunk-HMKDU7OU.js} +1 -1
- package/dist/{chunk-IBJEQHJR.js → chunk-HV6EQMUJ.js} +24 -7
- package/dist/{chunk-IFHM2SI6.js → chunk-IOKEF3DE.js} +1 -1
- package/dist/{chunk-ZLCLGIM6.js → chunk-K2LKJBQ4.js} +1 -1
- package/dist/{chunk-GED7JURY.js → chunk-L5IV2SI4.js} +1 -1
- package/dist/{chunk-3S2U7WRM.js → chunk-LOXR5QUX.js} +1 -1
- package/dist/{chunk-KFTJVVJR.js → chunk-M2R6UXJB.js} +1 -1
- package/dist/{chunk-ZPOZ6MDX.js → chunk-QHHSSIMZ.js} +1 -1
- package/dist/chunk-RMGSMDJW.js +5 -0
- package/dist/{chunk-TEMFNVO2.js → chunk-TD5TQZEG.js} +1 -1
- package/dist/{chunk-QNHKUSBH.js → chunk-XY537LCX.js} +1 -1
- package/dist/{chunk-EP6Q2QBU.js → chunk-YC676TPF.js} +1 -1
- package/dist/{chunk-PTSEDZIV.js → chunk-YS34N35Y.js} +1 -1
- package/dist/{chunk-IHKG5C6G.js → chunk-ZOE43SGQ.js} +1 -1
- package/dist/{create-BBALBC3U.js → create-HSHAZYAK.js} +1 -1
- package/dist/{doctor-WWVY7NB6.js → doctor-VZ2MZ7EI.js} +1 -1
- package/dist/{dotnet-webapi-clean-XL4IBUQV.js → dotnet-webapi-clean-VJX6SGGP.js} +39 -33
- package/dist/{goal-lifecycle-CEUTKUNV.js → goal-lifecycle-NKSCALES.js} +1 -1
- package/dist/{goal-pack-JQL3YOKT.js → goal-pack-MPKW4K6F.js} +1 -1
- package/dist/{gofiber-standard-OHHMCNMJ.js → gofiber-standard-I6ASLOEE.js} +77 -66
- package/dist/{gogin-standard-BAZXPOKL.js → gogin-standard-U2LSRLIP.js} +78 -67
- package/dist/index.js +100 -100
- package/dist/{pipeline-V46WWMP4.js → pipeline-RIA5UXUC.js} +1 -1
- package/dist/{project-agent-entry-MRAYG7QD.js → project-agent-entry-GQAPCSOT.js} +1 -1
- package/dist/{project-intelligence-lens-4BKPN4PE.js → project-intelligence-lens-5I2GQBWC.js} +1 -1
- package/dist/{proof-carrying-change-B7ONTBYO.js → proof-carrying-change-T33C2SSD.js} +1 -1
- package/dist/{rust-axum-CCJ6UCBW.js → rust-axum-JMV7UPO7.js} +25 -20
- package/dist/{springboot-standard-M5JQEJML.js → springboot-standard-OC2RS3KC.js} +41 -39
- package/dist/verified-goal-MK5MXGRY.js +1 -0
- package/dist/{workspace-FJ6JRYWA.js → workspace-AZKZPG45.js} +1 -1
- package/dist/{workspace-agent-sync-V33UGII3.js → workspace-agent-sync-CGK44F3O.js} +1 -1
- package/dist/{workspace-context-O6UBCBEA.js → workspace-context-S6ZWRUFZ.js} +1 -1
- package/dist/{workspace-contract-S2JYDA4K.js → workspace-contract-Y7WRHLYR.js} +1 -1
- package/dist/{workspace-explain-RP6VJ6QM.js → workspace-explain-CSJL3GJR.js} +1 -1
- package/dist/{workspace-foundation-7QXEJJKZ.js → workspace-foundation-LLND2WIF.js} +1 -1
- package/dist/{workspace-graph-stream-YY65R5EC.js → workspace-graph-stream-PHFO2J2E.js} +1 -1
- package/dist/{workspace-intelligence-LMR42ICR.js → workspace-intelligence-ND2N3B2A.js} +1 -1
- package/dist/{workspace-intelligence-runner-FXFSTCHC.js → workspace-intelligence-runner-LHHJM2AT.js} +1 -1
- package/dist/{workspace-knowledge-graph-3564KQXT.js → workspace-knowledge-graph-NOGGGENE.js} +1 -1
- package/dist/workspace-knowledge-graph-snapshot-7XHZNRFK.js +1 -0
- package/dist/{workspace-mcp-serve-ZK46EZUD.js → workspace-mcp-serve-6NVF7AS6.js} +1 -1
- package/dist/{workspace-model-6UMQAGUK.js → workspace-model-VOQOEDVU.js} +1 -1
- package/dist/{workspace-onboarding-C57OQ7XZ.js → workspace-onboarding-ZRLUMBLE.js} +1 -1
- package/dist/{workspace-registry-summary-GLQO4ZUF.js → workspace-registry-summary-NWZK5IKS.js} +1 -1
- package/dist/{workspace-repair-engine-5ZSSF3T5.js → workspace-repair-engine-VUOCH66O.js} +1 -1
- package/dist/workspace-run-3YZTVOU6.js +1 -0
- package/dist/{workspace-verify-LQHXBH2D.js → workspace-verify-4EQI3MCW.js} +1 -1
- package/dist/{workspace-watch-Z32443UP.js → workspace-watch-BPRU2X7K.js} +1 -1
- package/docs/README.md +5 -2
- package/docs/README_CONTENT_CONTRACT.md +14 -9
- package/docs/ci-workflows.md +1 -1
- package/docs/commands-reference.md +37 -32
- package/docs/native-kit-baselines.md +82 -0
- package/docs/workspace-knowledge-graph.md +6 -2
- package/docs/workspace-run.md +16 -0
- package/package.json +1 -1
- package/dist/analyze-OGWDSPXQ.js +0 -1
- package/dist/autopilot-release-QQDFEPT7.js +0 -1
- package/dist/chunk-XSSNM4F5.js +0 -5
- package/dist/verified-goal-YNSBL7L3.js +0 -1
- package/dist/workspace-knowledge-graph-snapshot-P27RPMV5.js +0 -1
- package/dist/workspace-run-UGWGT3K2.js +0 -1
package/README.md
CHANGED
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
|
|
14
14
|
## Workspace Intelligence for software systems
|
|
15
15
|
|
|
16
|
+
Workspai is an open-source CLI that gives people and AI tools one governed view
|
|
17
|
+
of the software system they are changing.
|
|
18
|
+
|
|
16
19
|
```bash
|
|
17
20
|
npx workspai adopt .
|
|
18
21
|
npx workspai workspace intelligence run --for-agent generic
|
|
@@ -47,36 +50,23 @@ for every supported host, without duplicating the Model or Graph.
|
|
|
47
50
|
|
|
48
51
|
### What the output looks like
|
|
49
52
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
The canonical workspace owns the Model, Graph, context, evidence index, and
|
|
54
|
+
Skills. Each linked project keeps only its portable entry, scoped context, and
|
|
55
|
+
workspace binding:
|
|
53
56
|
|
|
54
57
|
```text
|
|
55
|
-
your-workspace/
|
|
58
|
+
your-workspace/
|
|
56
59
|
├── .workspai/
|
|
57
|
-
│ ├──
|
|
58
|
-
│
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
│ └── skills/ # detected operational playbooks
|
|
64
|
-
├── AGENTS.md · CLAUDE.md · GEMINI.md · QWEN.md
|
|
65
|
-
├── .cursor/ · .claude/ · .github/ · .agents/ # host-native projections
|
|
66
|
-
├── nova-api/
|
|
67
|
-
│ ├── .agents/skills/workspai-*/SKILL.md # portable project Skill wrappers
|
|
68
|
-
│ └── .workspai/
|
|
69
|
-
│ ├── agent-entry.v1.json # canonical project entry
|
|
70
|
-
│ ├── workspace-link.local.json # machine-local binding
|
|
71
|
-
│ └── reports/
|
|
72
|
-
│ ├── project-context-agent.json
|
|
73
|
-
│ └── project-knowledge-graph-reference.json
|
|
74
|
-
└── summit-web/ # same project-level boundary
|
|
60
|
+
│ ├── reports/ # Model, Graph, verification, context
|
|
61
|
+
│ └── skills/ # evidence-derived playbooks
|
|
62
|
+
├── AGENTS.md · .codex/ · .cursor/ · .claude/ · .github/ · .agents/
|
|
63
|
+
└── project/.workspai/
|
|
64
|
+
├── agent-entry.v1.json # portable project entry
|
|
65
|
+
└── workspace-link.local.json # machine-local binding
|
|
75
66
|
```
|
|
76
67
|
|
|
77
|
-
Your agent starts with `agent-entry.v1.json`, compact workspace context, and the
|
|
78
|
-
index; it then retrieves
|
|
79
|
-
scan or complete Graph load is needed for ordinary work.
|
|
68
|
+
Your agent starts with `agent-entry.v1.json`, compact workspace context, and the
|
|
69
|
+
Skills index; it then retrieves task-scoped Graph evidence and targeted source.
|
|
80
70
|
|
|
81
71
|

|
|
82
72
|
|
|
@@ -85,18 +75,6 @@ scan or complete Graph load is needed for ordinary work.
|
|
|
85
75
|
[How it works](#how-workspace-intelligence-works) ·
|
|
86
76
|
[Documentation](docs/README.md)
|
|
87
77
|
|
|
88
|
-
## Why Workspai
|
|
89
|
-
|
|
90
|
-
Workspai is an open-source CLI that brings related software projects together,
|
|
91
|
-
so people and AI tools can understand and work with the same system.
|
|
92
|
-
|
|
93
|
-
- **See the whole system:** registered projects and proven relationships in one model.
|
|
94
|
-
- **Ask with proof:** trace answers back to their evidence record and source location.
|
|
95
|
-
- **Change safely:** know impact before you commit, verify after, and give AI agents
|
|
96
|
-
only the context they need.
|
|
97
|
-
|
|
98
|
-

|
|
99
|
-
|
|
100
78
|
## Start in two minutes
|
|
101
79
|
|
|
102
80
|
### Use an existing project
|
|
@@ -135,14 +113,8 @@ Choose whether to create a workspace, scaffold a project, or add existing
|
|
|
135
113
|
software. Project starters are grouped as Backend, Frontend, Desktop, and
|
|
136
114
|
Extension.
|
|
137
115
|
|
|
138
|
-
Global installation is optional:
|
|
139
|
-
|
|
140
|
-
```bash
|
|
141
|
-
npm install -g workspai
|
|
142
|
-
workspai --help
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
`wspai` is an optional short alias for the same CLI.
|
|
116
|
+
Global installation is optional: `npm install -g workspai`. `wspai` is a short
|
|
117
|
+
alias for the same CLI.
|
|
146
118
|
|
|
147
119
|
## Give your agent a goal, not an open-ended prompt
|
|
148
120
|
|
|
@@ -150,10 +122,7 @@ Describe the outcome in plain language from the adopted project:
|
|
|
150
122
|
|
|
151
123
|
```bash
|
|
152
124
|
npx workspai goal "Raise test coverage to 85%" --for-agent generic
|
|
153
|
-
# In a polyglot scope, choose interactively or bind a canonical runtime:
|
|
154
125
|
npx workspai goal "Raise test coverage to 85%" --runtime cpp --for-agent generic
|
|
155
|
-
# Or pursue feature, defect, refactor, performance, documentation, or
|
|
156
|
-
# system-understanding outcomes in the same governed flow.
|
|
157
126
|
npx workspai goal "Add retry with exponential backoff" --for-agent generic
|
|
158
127
|
```
|
|
159
128
|
|
|
@@ -173,8 +142,6 @@ Multi-project scope and polyglot runtime choices are explicit. Interactive
|
|
|
173
142
|
users get bounded choices from the canonical Workspace Model; automation gets
|
|
174
143
|
a machine-readable decision and can use `--scope` and `--runtime`.
|
|
175
144
|
|
|
176
|
-

|
|
177
|
-
|
|
178
145
|
[Learn how Goal Packs work](docs/goal-packs.md)
|
|
179
146
|
|
|
180
147
|
## Make every agent change carry proof
|
|
@@ -183,9 +150,8 @@ For source-changing work, begin a Goal-bound change before mutation:
|
|
|
183
150
|
|
|
184
151
|
```bash
|
|
185
152
|
npx workspai change begin --json
|
|
186
|
-
npx workspai change list --json
|
|
187
153
|
npx workspai change authorize --change <change-id> --effects filesystem,command --json
|
|
188
|
-
|
|
154
|
+
npx workspai change effect record --change <change-id> --file effect-receipt.json --json
|
|
189
155
|
npx workspai change verify --change <change-id> --strict --json
|
|
190
156
|
npx workspai change capsule validate --change <change-id> --json
|
|
191
157
|
```
|
|
@@ -195,10 +161,11 @@ observed effects, predicted-versus-actual Graph changes, verification receipts,
|
|
|
195
161
|
and remaining uncertainty. Prediction can guide work but can never prove its
|
|
196
162
|
own result. [Learn how Proof-Carrying Change works](docs/proof-carrying-change.md).
|
|
197
163
|
|
|
164
|
+

|
|
165
|
+
|
|
198
166
|
## What happens after the first run
|
|
199
167
|
|
|
200
|
-
|
|
201
|
-
generated in one run. The key files for each audience:
|
|
168
|
+
The key outputs for each audience are:
|
|
202
169
|
|
|
203
170
|
| Audience | What to read |
|
|
204
171
|
| ------------------- | ---------------------------------------------------------------------------- |
|
|
@@ -280,25 +247,24 @@ explicitly unproven.
|
|
|
280
247
|
|
|
281
248
|
## Everyday workflows
|
|
282
249
|
|
|
283
|
-
| Goal | Command
|
|
284
|
-
| ------------------------------------------- |
|
|
285
|
-
| Use guided setup | `npx workspai create`
|
|
286
|
-
| Link a project without moving it | `npx workspai adopt .`
|
|
287
|
-
|
|
|
288
|
-
|
|
|
289
|
-
|
|
|
290
|
-
|
|
|
291
|
-
|
|
|
292
|
-
|
|
|
293
|
-
|
|
|
294
|
-
|
|
|
295
|
-
|
|
|
296
|
-
|
|
|
297
|
-
|
|
|
298
|
-
|
|
|
299
|
-
|
|
|
300
|
-
|
|
|
301
|
-
| Start MCP server for workspace queries | `npx workspai workspace mcp serve` |
|
|
250
|
+
| Goal | Command |
|
|
251
|
+
| ------------------------------------------- | ------------------------------------------------------------------------------------------------ |
|
|
252
|
+
| Use guided setup | `npx workspai create` |
|
|
253
|
+
| Link a project without moving it | `npx workspai adopt .` |
|
|
254
|
+
| Initialize workspace and project dependencies | `npx workspai init` |
|
|
255
|
+
| Refresh the complete system view | `npx workspai workspace intelligence run --for-agent generic --strict --json` |
|
|
256
|
+
| Turn an outcome into governed work | `npx workspai goal "Raise test coverage to 85%"` |
|
|
257
|
+
| Prove an agent change from intent to verify | `npx workspai change begin --json` |
|
|
258
|
+
| Ground an agent before source discovery | `npx workspai agent bootstrap --for-agent generic --strict --json` |
|
|
259
|
+
| Copy or clone a project into a workspace | `npx workspai import <path-or-git-url> --workspace <path>` |
|
|
260
|
+
| Diagnose project or workspace health | `npx workspai doctor project` / `npx workspai doctor workspace` |
|
|
261
|
+
| Observe CLI and Studio activity | `npx workspai live --once --json --projection board` |
|
|
262
|
+
| Ask a focused architecture question | `npx workspai workspace graph search "authentication service" --limit 12 --json` |
|
|
263
|
+
| Verify current evidence | `npx workspai workspace verify --strict --json` |
|
|
264
|
+
| Inspect a governed repair before execution | `npx workspai workspace repair capabilities --json` |
|
|
265
|
+
| Refresh agent and IDE context | `npx workspai workspace agent-sync --write --preset enterprise --json` |
|
|
266
|
+
| Run the broader release gate | `npx workspai pipeline --strict --json` |
|
|
267
|
+
| Start MCP server for workspace queries | `npx workspai workspace mcp serve` |
|
|
302
268
|
|
|
303
269
|
For every command and flag, use the
|
|
304
270
|
[Command Reference](docs/commands-reference.md).
|
|
@@ -312,7 +278,7 @@ Workspai exposes the same governed data through several stable surfaces:
|
|
|
312
278
|
- versioned artifacts under `.workspai/reports/`;
|
|
313
279
|
- focused context and instructions for AI agents;
|
|
314
280
|
- MCP server with versioned read-oriented workspace tools (`workspace mcp serve`);
|
|
315
|
-
-
|
|
281
|
+
- Live activity projections and reports for IDEs and dashboards;
|
|
316
282
|
- JSON, JSON-LD, Mermaid, DOT, GraphML, and GEXF graph exports.
|
|
317
283
|
|
|
318
284
|
The [Workspai VS Code extension](https://marketplace.visualstudio.com/items?itemName=rapidkit.rapidkit-vscode)
|
|
@@ -339,11 +305,14 @@ modules; Workspai remains the workspace-level CLI.
|
|
|
339
305
|
| Create, adopt, import, or connect software | [Creating workspaces and projects](docs/creating-workspaces-and-projects.md) |
|
|
340
306
|
| Query Graph and inspect proof | [Workspace Knowledge Graph](docs/workspace-knowledge-graph.md) |
|
|
341
307
|
| Understand the exact decision loop | [Workspace Intelligence runner](docs/workspace-intelligence-runner.md) |
|
|
308
|
+
| Run dependency, test, and build stages | [Workspace Run](docs/workspace-run.md) |
|
|
309
|
+
| Observe CLI and Studio activity | [Workspai Live](docs/workspace-live-activity.md) |
|
|
342
310
|
| Plan, approve, execute, or roll back a repair | [Workspace Repair Engine](docs/workspace-repair-engine.md) |
|
|
343
311
|
| Set a release, security, or coverage outcome | [Verified engineering goals](docs/workspace-intelligence-runner.md#verified-engineering-goals) |
|
|
344
312
|
| Compile plain language into a governed plan | [Goal Packs](docs/goal-packs.md) |
|
|
345
313
|
| Prove what an agent changed and why | [Proof-Carrying Change](docs/proof-carrying-change.md) |
|
|
346
314
|
| Ground an agent in canonical project evidence | [Canonical-first agent entry](docs/agent-entry.md) |
|
|
315
|
+
| Measure bounded retrieval and model usage | [Evaluation](docs/workspace-intelligence-evaluation.md) and [benchmark](docs/workspace-intelligence-benchmark.md) |
|
|
347
316
|
| Integrate CI | [CI workflows](docs/ci-workflows.md) |
|
|
348
317
|
| Find generated files and schemas | [Artifact Catalog](docs/contracts/ARTIFACT_CATALOG.md) |
|
|
349
318
|
| Browse all documentation | [Documentation index](docs/README.md) |
|
|
@@ -364,12 +333,6 @@ Workspai is developed in the open by
|
|
|
364
333
|
[Chistiq](https://chistiq.com/), the intelligence infrastructure company behind
|
|
365
334
|
RapidKit and Workspai.
|
|
366
335
|
|
|
367
|
-
```bash
|
|
368
|
-
npm ci
|
|
369
|
-
npm run build
|
|
370
|
-
npm test
|
|
371
|
-
```
|
|
372
|
-
|
|
373
336
|
Read [CONTRIBUTING.md](CONTRIBUTING.md), the
|
|
374
337
|
[Development Guide](docs/DEVELOPMENT.md), and the
|
|
375
338
|
[Security Policy](docs/SECURITY.md).
|
|
@@ -132,6 +132,25 @@
|
|
|
132
132
|
"agentHandoff": { "type": "string" },
|
|
133
133
|
"verifiedGoalId": { "type": "string" },
|
|
134
134
|
"repairTransactionId": { "type": "string" },
|
|
135
|
+
"repairTransactionIds": {
|
|
136
|
+
"type": "array",
|
|
137
|
+
"maxItems": 25,
|
|
138
|
+
"uniqueItems": true,
|
|
139
|
+
"items": { "type": "string", "minLength": 1 }
|
|
140
|
+
},
|
|
141
|
+
"changeTransactionId": {
|
|
142
|
+
"type": "string",
|
|
143
|
+
"pattern": "^change-[a-z0-9][a-z0-9-]{7,95}$"
|
|
144
|
+
},
|
|
145
|
+
"changeTransactionIds": {
|
|
146
|
+
"type": "array",
|
|
147
|
+
"maxItems": 25,
|
|
148
|
+
"uniqueItems": true,
|
|
149
|
+
"items": {
|
|
150
|
+
"type": "string",
|
|
151
|
+
"pattern": "^change-[a-z0-9][a-z0-9-]{7,95}$"
|
|
152
|
+
}
|
|
153
|
+
},
|
|
135
154
|
"verificationReceipt": {
|
|
136
155
|
"type": "object",
|
|
137
156
|
"required": [
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{b as printAnalyzeReport,a as runAnalyze}from'./chunk-554W2TXP.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{b as AUTOPILOT_RELEASE_ALIAS_FILENAME,a as AUTOPILOT_RELEASE_LAST_RUN_FILENAME,c as runAutopilotRelease}from'./chunk-26VNCHVV.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
`,"utf-8");}async function ze(r){let e$1=Se(r.workspacePath),n=r.mode,o=[],t=[],L,H,N,q,Q,X=0,f=false,I=0,_=0,W=-1,T=-1,c="skipped",d="skipped",ne=n==="enforce"?["doctor","workspace","--json","--strict"]:["doctor","workspace","--json","--ci"];if(r.skipPipelineStages)o.push({name:"doctor-workspace",status:"skipped",durationMs:0,summary:"doctor stage skipped (pipeline already executed)"},{name:"analyze",status:"skipped",durationMs:0,summary:"analyze stage skipped (pipeline already executed)"},{name:"readiness",status:"skipped",durationMs:0,summary:"readiness stage skipped (pipeline already executed)"});else {let s=Date.now(),l=await S([...ne],e$1),m=Date.now()-s;if(c="pass",l.crashed)c="fail",f=true,t.push(`doctor workspace execution error: ${l.stderr||"unknown error"}`);else if(l.exitCode===1)c="fail",t.push("doctor workspace command failed or reported errors");else if(l.exitCode===2)c="warn",t.push("doctor workspace reported warnings");else if(l.exitCode!==0)c="fail",t.push("doctor workspace command failed");else {let p=$(l.stdout),E=p&&p.healthScore&&typeof p.healthScore=="object"?p.healthScore:{},k=Number(E.errors??0),C=Number(E.warnings??0);Number.isFinite(k)&&k>0?(c="fail",t.push(`doctor workspace reports ${k} error(s)`)):Number.isFinite(C)&&C>0&&(c="warn");}W=o.push({name:"doctor-workspace",status:c,durationMs:m,summary:c==="pass"?"doctor workspace passed":c==="warn"?"doctor workspace reported warnings":"doctor workspace reported errors"})-1,n==="enforce"&&c==="warn"&&t.push("doctor workspace reported warnings under enforce mode");let g$1=Date.now(),w=await S(["analyze","--json"],e$1),P=Date.now()-g$1;H=await g(e$1,p.analyze)??a(e$1,p.analyze);let i="pass";if(w.crashed)i="fail",f=true,t.push(`analyze execution error: ${w.stderr||"unknown error"}`);else if(w.exitCode!==0)i=w.exitCode===2?"warn":"fail",t.push(w.exitCode===2?"analyze reported needs-attention verdict":"analyze command failed or reported blocked verdict");else {let p=$(w.stdout),E=p&&p.summary&&typeof p.summary=="object"?p.summary:{},k=String(E.verdict??"ready");k==="blocked"?(i="fail",t.push("analyze reported blocked verdict")):k==="needs-attention"&&(i="warn");}o.push({name:"analyze",status:i,durationMs:P,summary:i==="pass"?"analyze passed":i==="warn"?"analyze reported needs-attention":"analyze reported blocked verdict"}),n==="enforce"&&i==="warn"&&t.push("analyze reported warnings under enforce mode");let v=Date.now(),h=await S(["readiness","--json"],e$1),y=Date.now()-v;if(d="fail",h.crashed)d="fail",f=true,t.push(`readiness execution error: ${h.stderr||"unknown error"}`);else if(h.exitCode!==0)d="fail",t.push("readiness command failed");else {let p=$(h.stdout),E=String(p?.overallStatus??"fail");if(d=oe(E),typeof p?.evidencePath=="string"&&p.evidencePath.trim().length>0&&(L=p.evidencePath),d==="fail"){let k=Array.isArray(p?.blockingReasons)?p?.blockingReasons.filter(C=>typeof C=="string"):[];k.length>0?t.push(...k.map(C=>`readiness: ${C}`)):t.push("readiness overall status is fail");}}T=o.push({name:"readiness",status:d,durationMs:y,summary:`readiness overall status is ${d}`})-1,n==="enforce"&&d==="warn"&&t.push("readiness reported warnings under enforce mode");}let ie=Date.now(),D=await S(["doctor","workspace","--plan","--json"],e$1),le=Date.now()-ie,R="warn";if(D.crashed)R="fail",f=true,t.push(`doctor remediation plan execution error: ${D.stderr||"unknown error"}`);else if(D.exitCode!==0)R="fail",t.push("doctor remediation plan command failed");else {let s=$(D.stdout),l=s&&s.remediationPlan&&typeof s.remediationPlan=="object"?s.remediationPlan:null,m=Number(l?.totalSteps??0),g=Number(l?.executableSteps??0);Number.isFinite(m)&&m>0&&(I=m),Number.isFinite(g)&&g>0&&(_=g),Number.isFinite(m)&&m===0?R="pass":R="warn";}if(o.push({name:"remediation-plan",status:R,durationMs:le,summary:R==="pass"?"no remediation steps required":"remediation steps available"}),n==="enforce"&&R==="warn"&&t.push("remediation plan has pending steps under enforce mode"),n==="safe-fix"){let s=Date.now(),l=await S(["doctor","workspace","--apply"],e$1),m=Date.now()-s,g=l.crashed||l.exitCode!==0?"fail":"pass";if(l.crashed)f=true,t.push(`doctor remediation apply execution error: ${l.stderr||"unknown error"}`);else if(g==="fail")t.push("doctor remediation apply failed");else {X=_>0?_:I>0?I:1;let w=await S(["doctor","workspace","--json"],e$1);if(w.crashed)c="fail",f=true,t.push(`post-apply doctor execution error: ${w.stderr||"unknown error"}`);else if(w.exitCode!==0)c="fail",t.push("post-apply doctor workspace command failed");else {let i=$(w.stdout),v=i&&i.healthScore&&typeof i.healthScore=="object"?i.healthScore:{},h=Number(v.errors??0),y=Number(v.warnings??0);Number.isFinite(h)&&h>0?(c="fail",t.push(`post-apply doctor reports ${h} error(s)`)):Number.isFinite(y)&&y>0?c="warn":c="pass";}W>=0&&(o[W].status=c,o[W].summary=`doctor workspace post-apply status is ${c}`);let P=await S(["readiness","--json"],e$1);if(P.crashed)d="fail",f=true,t.push(`post-apply readiness execution error: ${P.stderr||"unknown error"}`);else if(P.exitCode!==0)d="fail",t.push("post-apply readiness command failed");else {let i=$(P.stdout),v=String(i?.overallStatus??"fail");if(d=oe(v),typeof i?.evidencePath=="string"&&i.evidencePath.trim().length>0&&(L=i.evidencePath),d==="fail"){let h=Array.isArray(i?.blockingReasons)?i?.blockingReasons.filter(y=>typeof y=="string"):[];h.length>0?t.push(...h.map(y=>`post-apply readiness: ${y}`)):t.push("post-apply readiness overall status is fail");}}T>=0&&(o[T].status=d,o[T].summary=`readiness post-apply overall status is ${d}`);}o.push({name:"remediation-apply",status:g,durationMs:m,summary:g==="pass"?"safe remediation apply completed":"safe remediation apply failed"});}else o.push({name:"remediation-apply",status:"skipped",durationMs:0,summary:"remediation apply is skipped for this mode"});let ce=Date.now(),A="pass",x="workspace test/build completed for selected projects";try{let s=await
|
|
1
|
+
import {b}from'./chunk-RMGSMDJW.js';import {a as a$1,e}from'./chunk-37SWTS2B.js';import {a as a$3}from'./chunk-MGL6DBOR.js';import {g,a,h}from'./chunk-FE5R6EUV.js';import {p,s}from'./chunk-ODK4LCEL.js';import a$2 from'chalk';import re from'fs';import b$1 from'path';import {execa}from'execa';var V="autopilot-release-last-run.json",G="autopilot-release.json";function $(r){try{return JSON.parse(r)}catch{return null}}function Se(r){let e=b$1.resolve(r),n=a$3(e);if(!n)throw new Error("No Workspai workspace found in current directory or parents");return n}async function S(r,e){let n=process.argv[1];if(!n)return {exitCode:1,stdout:"",stderr:"RapidKit entrypoint is unavailable for autopilot execution.",crashed:true};try{let o=await execa(process.execPath,[n,...r],{cwd:e,reject:false,env:{...process.env,RAPIDKIT_AUTOPILOT_CHILD:"1"}});return {exitCode:Number(o.exitCode??1),stdout:o.stdout,stderr:o.stderr,crashed:false}}catch(o){return {exitCode:1,stdout:"",stderr:o instanceof Error?o.message:String(o),crashed:true}}}function oe(r){let e=r.toLowerCase();return e==="pass"?"pass":e==="warn"?"warn":e==="fail"?"fail":"warn"}function ae(r){return r.summary.failed>0||r.gates.results.some(e=>e.status==="fail")?"fail":r.gates.results.some(e=>e.status==="warn")?"warn":"pass"}function be(r){let e=r.filter(o=>o.status!=="skipped");if(e.length===0)return 100;let n=e.reduce((o,t)=>t.status==="pass"?o+1:t.status==="warn"?o+.6:o,0);return Math.round(n/e.length*100)}function Ae(r){return r.executionError?["Re-run: npx workspai autopilot release --mode audit --json","Inspect .workspai/reports/autopilot-release-last-run.json for execution failure details"]:r.blockers.length>0?["Run: npx workspai doctor workspace --plan","Run: npx workspai readiness --json --strict","Run: npx workspai workspace run test --affected --strict"]:r.hasWarnings&&r.mode!=="enforce"?["Review warning-level findings in autopilot report","Optionally run: npx workspai autopilot release --mode safe-fix"]:["Workspace is release-ready based on current autopilot policy"]}async function xe(r,e){await re.promises.mkdir(b$1.dirname(r),{recursive:true}),await re.promises.writeFile(r,`${JSON.stringify(e,null,2)}
|
|
2
|
+
`,"utf-8");}async function ze(r){let e$1=Se(r.workspacePath),n=r.mode,o=[],t=[],L,H,N,q,Q,X=0,f=false,I=0,_=0,W=-1,T=-1,c="skipped",d="skipped",ne=n==="enforce"?["doctor","workspace","--json","--strict"]:["doctor","workspace","--json","--ci"];if(r.skipPipelineStages)o.push({name:"doctor-workspace",status:"skipped",durationMs:0,summary:"doctor stage skipped (pipeline already executed)"},{name:"analyze",status:"skipped",durationMs:0,summary:"analyze stage skipped (pipeline already executed)"},{name:"readiness",status:"skipped",durationMs:0,summary:"readiness stage skipped (pipeline already executed)"});else {let s=Date.now(),l=await S([...ne],e$1),m=Date.now()-s;if(c="pass",l.crashed)c="fail",f=true,t.push(`doctor workspace execution error: ${l.stderr||"unknown error"}`);else if(l.exitCode===1)c="fail",t.push("doctor workspace command failed or reported errors");else if(l.exitCode===2)c="warn",t.push("doctor workspace reported warnings");else if(l.exitCode!==0)c="fail",t.push("doctor workspace command failed");else {let p=$(l.stdout),E=p&&p.healthScore&&typeof p.healthScore=="object"?p.healthScore:{},k=Number(E.errors??0),C=Number(E.warnings??0);Number.isFinite(k)&&k>0?(c="fail",t.push(`doctor workspace reports ${k} error(s)`)):Number.isFinite(C)&&C>0&&(c="warn");}W=o.push({name:"doctor-workspace",status:c,durationMs:m,summary:c==="pass"?"doctor workspace passed":c==="warn"?"doctor workspace reported warnings":"doctor workspace reported errors"})-1,n==="enforce"&&c==="warn"&&t.push("doctor workspace reported warnings under enforce mode");let g$1=Date.now(),w=await S(["analyze","--json"],e$1),P=Date.now()-g$1;H=await g(e$1,p.analyze)??a(e$1,p.analyze);let i="pass";if(w.crashed)i="fail",f=true,t.push(`analyze execution error: ${w.stderr||"unknown error"}`);else if(w.exitCode!==0)i=w.exitCode===2?"warn":"fail",t.push(w.exitCode===2?"analyze reported needs-attention verdict":"analyze command failed or reported blocked verdict");else {let p=$(w.stdout),E=p&&p.summary&&typeof p.summary=="object"?p.summary:{},k=String(E.verdict??"ready");k==="blocked"?(i="fail",t.push("analyze reported blocked verdict")):k==="needs-attention"&&(i="warn");}o.push({name:"analyze",status:i,durationMs:P,summary:i==="pass"?"analyze passed":i==="warn"?"analyze reported needs-attention":"analyze reported blocked verdict"}),n==="enforce"&&i==="warn"&&t.push("analyze reported warnings under enforce mode");let v=Date.now(),h=await S(["readiness","--json"],e$1),y=Date.now()-v;if(d="fail",h.crashed)d="fail",f=true,t.push(`readiness execution error: ${h.stderr||"unknown error"}`);else if(h.exitCode!==0)d="fail",t.push("readiness command failed");else {let p=$(h.stdout),E=String(p?.overallStatus??"fail");if(d=oe(E),typeof p?.evidencePath=="string"&&p.evidencePath.trim().length>0&&(L=p.evidencePath),d==="fail"){let k=Array.isArray(p?.blockingReasons)?p?.blockingReasons.filter(C=>typeof C=="string"):[];k.length>0?t.push(...k.map(C=>`readiness: ${C}`)):t.push("readiness overall status is fail");}}T=o.push({name:"readiness",status:d,durationMs:y,summary:`readiness overall status is ${d}`})-1,n==="enforce"&&d==="warn"&&t.push("readiness reported warnings under enforce mode");}let ie=Date.now(),D=await S(["doctor","workspace","--plan","--json"],e$1),le=Date.now()-ie,R="warn";if(D.crashed)R="fail",f=true,t.push(`doctor remediation plan execution error: ${D.stderr||"unknown error"}`);else if(D.exitCode!==0)R="fail",t.push("doctor remediation plan command failed");else {let s=$(D.stdout),l=s&&s.remediationPlan&&typeof s.remediationPlan=="object"?s.remediationPlan:null,m=Number(l?.totalSteps??0),g=Number(l?.executableSteps??0);Number.isFinite(m)&&m>0&&(I=m),Number.isFinite(g)&&g>0&&(_=g),Number.isFinite(m)&&m===0?R="pass":R="warn";}if(o.push({name:"remediation-plan",status:R,durationMs:le,summary:R==="pass"?"no remediation steps required":"remediation steps available"}),n==="enforce"&&R==="warn"&&t.push("remediation plan has pending steps under enforce mode"),n==="safe-fix"){let s=Date.now(),l=await S(["doctor","workspace","--apply"],e$1),m=Date.now()-s,g=l.crashed||l.exitCode!==0?"fail":"pass";if(l.crashed)f=true,t.push(`doctor remediation apply execution error: ${l.stderr||"unknown error"}`);else if(g==="fail")t.push("doctor remediation apply failed");else {X=_>0?_:I>0?I:1;let w=await S(["doctor","workspace","--json"],e$1);if(w.crashed)c="fail",f=true,t.push(`post-apply doctor execution error: ${w.stderr||"unknown error"}`);else if(w.exitCode!==0)c="fail",t.push("post-apply doctor workspace command failed");else {let i=$(w.stdout),v=i&&i.healthScore&&typeof i.healthScore=="object"?i.healthScore:{},h=Number(v.errors??0),y=Number(v.warnings??0);Number.isFinite(h)&&h>0?(c="fail",t.push(`post-apply doctor reports ${h} error(s)`)):Number.isFinite(y)&&y>0?c="warn":c="pass";}W>=0&&(o[W].status=c,o[W].summary=`doctor workspace post-apply status is ${c}`);let P=await S(["readiness","--json"],e$1);if(P.crashed)d="fail",f=true,t.push(`post-apply readiness execution error: ${P.stderr||"unknown error"}`);else if(P.exitCode!==0)d="fail",t.push("post-apply readiness command failed");else {let i=$(P.stdout),v=String(i?.overallStatus??"fail");if(d=oe(v),typeof i?.evidencePath=="string"&&i.evidencePath.trim().length>0&&(L=i.evidencePath),d==="fail"){let h=Array.isArray(i?.blockingReasons)?i?.blockingReasons.filter(y=>typeof y=="string"):[];h.length>0?t.push(...h.map(y=>`post-apply readiness: ${y}`)):t.push("post-apply readiness overall status is fail");}}T>=0&&(o[T].status=d,o[T].summary=`readiness post-apply overall status is ${d}`);}o.push({name:"remediation-apply",status:g,durationMs:m,summary:g==="pass"?"safe remediation apply completed":"safe remediation apply failed"});}else o.push({name:"remediation-apply",status:"skipped",durationMs:0,summary:"remediation apply is skipped for this mode"});let ce=Date.now(),A="pass",x="workspace test/build completed for selected projects";try{let s=await b({workspacePath:e$1,stage:"test",affected:true,since:r.since,parallel:r.parallel,maxWorkers:r.maxWorkers,strict:true,json:true,enforceGates:false});N=a(e$1,b$1.join(".workspai","reports",a$1)),await e(e$1,s),q=N;let l=ae(s);if(l==="fail")A="fail",x="workspace test stage failed for selected projects",t.push("workspace run test failed for selected projects");else {l==="warn"&&(A="warn",x="workspace test stage completed with warnings",n==="enforce"&&t.push("workspace run test reported warnings under enforce mode"));let m=await b({workspacePath:e$1,stage:"build",affected:true,since:r.since,parallel:r.parallel,maxWorkers:r.maxWorkers,strict:true,json:true,enforceGates:false});await e(e$1,m),Q=N;let g=ae(m);g==="fail"?(A="fail",x="workspace build stage failed for selected projects",t.push("workspace run build failed for selected projects")):g==="warn"&&(A="warn",x="workspace test/build completed with warnings",n==="enforce"&&t.push("workspace run test/build reported warnings under enforce mode"));}}catch(s){A="fail",x="workspace test/build orchestration failed",f=true,t.push(`workspace run orchestration error: ${s instanceof Error?s.message:String(s)}`);}let pe=Date.now()-ce;o.push({name:"workspace-run-test-build",status:A,durationMs:pe,summary:x});let M=o.filter(s=>s.status==="warn").length,ue=o.filter(s=>s.status==="fail").length,F=n==="enforce"?o.some(s=>s.status==="warn"||s.status==="fail"):ue>0,j=[...new Set(t)],O=f||F?Math.max(1,j.length):0,de=O>0?j:[],fe=O===0?j:[],me=be(o),ge=f||F?"blocked":M>0?"partial":"approved",we=f?3:F?1:M>0?2:0,he=Ae({mode:n,executionError:f,blockers:j,hasWarnings:M>0}),Y=a(e$1,".workspai/reports"),ke=b$1.join(Y,V),ye=b$1.join(Y,G),u={schemaVersion:s.autopilotReleaseLastRun.schemaVersion,generatedAt:new Date().toISOString(),workspacePath:e$1,mode:n,summary:{releaseScore:me,verdict:ge,blockers:O,warnings:M,safeFixesApplied:X,manualActions:j.length,exitCode:we},stages:o,blockingReasons:de,warningReasons:fe,nextActions:he,artifacts:{reportPath:ke,aliasEvidencePath:ye,analyzeEvidencePath:H,readinessEvidencePath:L,workspaceRunEvidencePath:N,workspaceRunTestPath:q,workspaceRunBuildPath:Q},enterpriseControls:{jsonReady:true,evidencePath:`.workspai/reports/${V}`,aliasEvidencePath:`.workspai/reports/${G}`}};if(await h(e$1,`.workspai/reports/${V}`,u),await h(e$1,`.workspai/reports/${G}`,u),r.output&&await xe(b$1.resolve(r.output),u),!r.json){console.log(a$2.bold.cyan(`
|
|
3
3
|
\u{1F680} Workspai Autopilot Release
|
|
4
|
-
`)),console.log(a$
|
|
5
|
-
Blocking reasons:`));for(let s of u.blockingReasons)console.log(a$
|
|
6
|
-
Warning reasons:`));for(let s of u.warningReasons)console.log(a$
|
|
7
|
-
Next actions:`));for(let s of u.nextActions)console.log(a$
|
|
4
|
+
`)),console.log(a$2.bold(`Workspace: ${a$2.cyan(b$1.basename(e$1))}`)),console.log(a$2.gray(`Path: ${e$1}`)),console.log(a$2.white(`Mode: ${n}`)),console.log(a$2.white(`Verdict: ${u.summary.verdict==="approved"?a$2.green("approved"):u.summary.verdict==="partial"?a$2.yellow("partial"):a$2.red("blocked")}`)),console.log(a$2.white(`Release score: ${u.summary.releaseScore}`));for(let s of u.stages){let l=s.status==="pass"?a$2.green("PASS"):s.status==="warn"?a$2.yellow("WARN"):s.status==="skipped"?a$2.gray("SKIP"):a$2.red("FAIL");console.log(` - ${s.name}: ${l} ${s.summary} (${s.durationMs}ms)`);}if(u.blockingReasons.length>0){console.log(a$2.bold.red(`
|
|
5
|
+
Blocking reasons:`));for(let s of u.blockingReasons)console.log(a$2.red(` - ${s}`));}if(u.warningReasons.length>0){console.log(a$2.bold.yellow(`
|
|
6
|
+
Warning reasons:`));for(let s of u.warningReasons)console.log(a$2.yellow(` - ${s}`));}if(u.nextActions.length>0){console.log(a$2.bold(`
|
|
7
|
+
Next actions:`));for(let s of u.nextActions)console.log(a$2.gray(` - ${s}`));}console.log(a$2.gray(`
|
|
8
8
|
Report: ${u.artifacts.reportPath}`));}return u}export{V as a,G as b,ze as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {d,m}from'./chunk-
|
|
1
|
+
import {d,m}from'./chunk-ZOE43SGQ.js';import {a,b}from'./chunk-S5KTATOU.js';function u(r){let s=new Map;for(let n of r.projects)s.has(n.name)||s.set(n.name,d(n));return s}function w(r){let s=u(r),n=m(r)??{nodes:r.projects.map(t=>({id:t.name,path:t.path})),edges:[]},a$1=a(n),o=new Map;for(let t of n.nodes){let e=s.get(t.id)??d({missing:t.id}),l=[...b(a$1,[t.id],{direction:"dependencies"}).keys()].filter(c=>c!==t.id).sort((c,f)=>c.localeCompare(f)).map(c=>({id:c,hash:s.get(c)??"<unknown>"}));o.set(t.id,{id:t.id,ownHash:e,transitiveInputsHash:d({own:e,dependencies:l})});}return o}function y(r,s){if(!s||Object.keys(s).length===0)return {verdict:"unknown",baseline:"none",changed:[],added:[],removed:[]};let n=[],a=[];for(let[e,i]of r.entries())e in s?s[e]!==i.transitiveInputsHash&&n.push(e):a.push(e);let o=[];for(let e of Object.keys(s))r.has(e)||o.push(e);return n.sort((e,i)=>e.localeCompare(i)),a.sort((e,i)=>e.localeCompare(i)),o.sort((e,i)=>e.localeCompare(i)),{verdict:n.length>0||a.length>0||o.length>0?"stale":"fresh",baseline:"recorded",changed:n,added:a,removed:o}}function M(r){let s={};for(let[n,a]of [...r.entries()].sort((o,t)=>o[0].localeCompare(t[0])))s[n]=a.transitiveInputsHash;return s}export{u as a,w as b,y as c,M as d};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-JEI6BTZI.js';import {a}from'./chunk-IVYPC36J.js';import {c,e,d}from'./chunk-QYEQVNBF.js';import {d as d$1,b}from'./chunk-
|
|
1
|
+
import {a as a$1}from'./chunk-JEI6BTZI.js';import {a}from'./chunk-IVYPC36J.js';import {c,e,d}from'./chunk-QYEQVNBF.js';import {d as d$1,b}from'./chunk-C563KVBD.js';import {g}from'./chunk-TD5TQZEG.js';import {q as q$1,m}from'./chunk-ZOE43SGQ.js';import {p,d as d$2}from'./chunk-YS34N35Y.js';import {h}from'./chunk-FE5R6EUV.js';import {b as b$1}from'./chunk-K33JJVQZ.js';import {a as a$2}from'./chunk-AFIFZTOY.js';import j from'path';import W from'fs-extra';function X(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}function q(e$1){switch(e$1){case "why":return d;case "trace":return e;default:return c}}async function P(e,n,o){try{if(!await W.pathExists(e))return null;let r=await W.readJson(e);return n?b$1(n,r,e):o&&a$2(r,o,e),r}catch(r){if((n||o)&&await W.pathExists(e))throw r;return null}}function Y(e,n){if(!e)return null;let o=n.trim().toLowerCase();return e.projects.find(r=>r.slug.toLowerCase()===o||r.relativePath.toLowerCase()===o)??null}function Q(e,n,o){let r=o.trim().toLowerCase(),t=(m(e)?.nodes.map(i=>i.id)??e.projects.map(i=>i.name)).find(i=>i.toLowerCase()===r);if(t)return t;let m$1=e.projects.find(i=>[i.name,i.path,j.basename(i.path)].filter(u=>u.trim().length>0).some(u=>u.toLowerCase()===r));if(m$1)return m$1.name;let p=Y(n,o);if(p){let i=e.projects.find(u=>u.path===p.relativePath||u.path.endsWith(`/${p.relativePath}`));if(i)return i.name}return o}function U(e,n){if(!e)return [];let o=n.trim().toLowerCase(),r=new Set;for(let d of e.projects){d.contracts.dependsOn?.some(t=>t.toLowerCase()===o)&&r.add(d.slug);for(let t of d.contracts.consumes??[])for(let m of e.projects)m.contracts.publishes?.includes(t)&&m.slug===o&&r.add(d.slug);}return [...r].sort()}function Z(e,n){if(!e)return [];let o=n.trim().toLowerCase();return e.steps.filter(r=>r.scope==="project"&&r.project?.toLowerCase()===o&&r.command?.display).map(r=>r.command.display).slice(0,8)}function l(e,n,o){return {id:e,title:n,body:o.trim()}}async function ke(e){let n=j.resolve(e.workspacePath),o=(e.now??new Date).toISOString(),r=e.model??await q$1({workspacePath:n,includeEvidence:true}),d=e.contract;if(d===void 0)try{d=(await p({workspacePath:n})).contract;}catch{d=null;}let t=e.verify;t===void 0&&(t=await P(j.join(n,d$1),d$1));let m$1=e.impact;if(m$1===void 0&&(m$1=await P(j.join(n,g),g)),e.target.kind==="release-blocked"){let s=t?.blockingReasons??[],c=(r.summary?.projectCount??r.projects.length)===0,g=[l("verdict",c?"Workspace scaffold posture":"Release verdict",t?c?`Scaffold posture: **${t.summary.verdict}** (exit ${t.summary.exitCode}). Freshness: **${t.freshness.verdict}**. No registered projects yet \u2014 release gates apply after the first project is added.`:`Verdict: **${t.summary.verdict}** (exit ${t.summary.exitCode}). Risk: **${t.impact.risk}**. Freshness: **${t.freshness.verdict}**.`:"No workspace verify report found. Run `npx workspai workspace verify --json --write` first."),l("blockers",c?"Pre-project signals":"Blocking reasons",s.length?s.map(h=>`- ${h}`).join(`
|
|
2
2
|
`):c?"No pre-project signals in the latest verify report.":"No blocking reasons in the latest verify report.")];return t?.resolutionHints?.length&&g.push(l("resolution","Resolution hints",t.resolutionHints.map(h=>`- **${h.blockerId}** (${h.resolutionClass}): ${h.commandRetryHint??h.fixHints[0]?.detail??"See fix hints"}`).join(`
|
|
3
3
|
`))),{schemaVersion:a,generatedAt:o,workspacePath:n,target:e.target,summary:t?c?b(s.length,t.summary.verdict):s.length>0||t.summary.verdict==="blocked"?`Release blocked: ${t.summary.verdict} with ${s.length} blocking reason(s).`:t.summary.verdict==="needs-attention"?"Release needs attention: advisory or incomplete verification evidence remains; no blocking reason was reported.":`Release posture: ${t.summary.verdict}; no blocking reason was reported.`:"Release posture unknown \u2014 verify report missing.",sections:g,releaseVerdict:t?.summary.verdict,evidenceFreshness:t?.freshness.verdict,blocking:!!(t&&(t.summary.verdict==="blocked"||s.length>0)),releaseRisk:t?.impact.risk,blockingReasons:s,resolutionHints:t?.resolutionHints}}if(e.target.kind==="blocker"){let s=e.target,f=t?.resolutionHints?.find(g=>g.blockerId===s.blockerId),c=t?.blockingReasons.find(g=>g.includes(s.blockerId))??t?.blockingReasons[0];return {schemaVersion:a,generatedAt:o,workspacePath:n,target:s,summary:f?`Blocker ${s.blockerId}: ${f.resolutionClass}`:`Blocker ${s.blockerId} (no structured hint)`,sections:[l("reason","Blocking signal",c??"No matching blocking reason in verify."),l("hint","Resolution class",f?`${f.resolutionClass}
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {f,e,g}from'./chunk-NSH7TTSV.js';import {a,b}from'./chunk-MGL6DBOR.js';import {b as b$1,c}from'./chunk-V52R2W2Q.js';import {a as a$1}from'./chunk-NMXGSVMD.js';import {p,a as a$2}from'./chunk-
|
|
1
|
+
import {f,e,g}from'./chunk-NSH7TTSV.js';import {a,b}from'./chunk-MGL6DBOR.js';import {b as b$1,c}from'./chunk-V52R2W2Q.js';import {a as a$1}from'./chunk-NMXGSVMD.js';import {p,a as a$2}from'./chunk-YS34N35Y.js';import {k as k$1,m,l}from'./chunk-U5ENEDJA.js';import {h as h$1}from'./chunk-FE5R6EUV.js';import {p as p$1,q}from'./chunk-ODK4LCEL.js';import {k,t,u}from'./chunk-VQZ5PI5J.js';import j from'fs';import i from'path';import s from'chalk';var ee=new Set([".git",".workspai",".rapidkit",".venv","node_modules","dist","build","target","coverage","htmlcov",".next"]);async function E(e){try{return await j.promises.access(e,j.constants.F_OK),true}catch{return false}}async function F(e){try{let n=JSON.parse(await j.promises.readFile(e,"utf-8"));return n&&typeof n=="object"&&!Array.isArray(n)?n:null}catch{return null}}async function v(e){try{return await j.promises.readFile(e,"utf-8")}catch{return ""}}function ne(e){return a(e)}async function te(e,n){return await Y([...u(e,"project.json"),...u(e,"context.json")])?true:b(e)?false:i.resolve(e)===i.resolve(n)?k$1(e).length>0:k$1(e).length>0}async function re(e){let n=await a$1(e,{skipDirs:ee,includeHiddenDirs:false,descendIntoMatchedProjects:false,isProjectDir:te}),o=(await a$2(e)).filter(a=>a.relationship==="adopted"||a.source==="adopted-local").map(a=>i.resolve(a.path)).filter(a=>j.existsSync(a)),r=[...new Set([...n.map(a=>i.resolve(a)),...o])];return r.length>0?r:b(e)?[]:k$1(e).length>0?[e]:[]}function oe(e,n){return i.relative(e,n).replace(/\\/g,"/")||"."}async function S(e,n){for(let t of n)if(await E(i.join(e,t)))return true;return false}async function Y(e){for(let n of e)if(await E(n))return true;return false}async function Z(e){for(let n of e){let t=await F(n);if(t)return t}return null}async function ae(e){if(await S(e,["health","health.ts","health.js","health.py","health.go","health.kt","health.rb","health.php","healthcheck","health-check","src/health.ts","src/health.js","src/health.py","src/health.go","src/health.kt","src/health.rb","src/health.php","src/healthcheck.ts","src/healthcheck.js","src/liveness.ts","src/readiness.ts","src/ping.ts","app/controllers/health_controller.rb","app/controllers/health_check_controller.rb","config/initializers/health_check.rb"]))return true;let t=await v(i.join(e,"config","routes.rb"));return /(?:health|readiness|liveness|readiness_check|health_check)/iu.test(t)}async function se(e,n){if(await S(e,[".env",".env.local"]))return true;let t=n?.contracts&&typeof n.contracts=="object"?n.contracts:null;if(Array.isArray(t?.env)&&t.env.length>0)return true;let o=await F(i.join(e,"package.json")),r={...o?.dependencies??{},...o?.devDependencies??{}};if(Object.keys(r).some(d=>/^(?:dotenv|dotenv-flow|env-cmd)$/iu.test(d)))return true;let a=await v(i.join(e,"pyproject.toml"));if(/\b(?:python-dotenv|pydantic-settings)\b/iu.test(a))return true;let l=[await v(i.join(e,"compose.yaml")),await v(i.join(e,"compose.yml")),await v(i.join(e,"docker-compose.yml")),await v(i.join(e,"docker-compose.yaml"))].join(`
|
|
2
2
|
`);return /^\s*(?:env_file|environment)\s*:/imu.test(l)}async function ie(e){return (await g(e)).detected}async function ce(e){let n=await F(i.join(e,"package.json")),t=n?.scripts&&typeof n.scripts=="object"?n.scripts:{};return Object.keys(t).sort()}function h(e,n,t,o,r,a,l){return {id:e,severity:n,target:t,title:o,detail:r,remediation:a,...l&&l.length>0?{files:[...l]}:{}}}function de(e){let n=e.reduce((t,o)=>o.severity==="fail"?t+28:o.severity==="warn"?t+12:t+3,0);return Math.max(0,100-n)}async function le(e,n,t){let o=await Z(u(n,"project.json")),r=m(n,o),a=l(n),l$1=r.runtime==="unknown"?a[0]||"unknown":r.runtime,d=[l$1,...a.filter(G=>G!==l$1)],p=r.key==="unknown"&&new Set(d.filter(G=>G!=="unknown")).size>1,A=await b$1(n,o,{runtime:l$1,framework:r.key}),f=["backend","service","worker"].includes(A),w=f&&/^(?:fastapi|django|flask|nestjs|express|fastify|springboot|gofiber|gogin|dotnet-webapi|laravel|rails|phoenix|axum|actix|rocket)$/u.test(r.key),k=oe(e,n),m$1=k,$=await ce(n),P=await Y([...u(n,"project.json"),...u(n,"context.json")]),x=await ie(n),R=await S(n,["Dockerfile","dockerfile"]),z=await S(n,[".env.example","env.example","config/env.example"]),y=await se(n,o),c$1=await c({projectPath:n,declaration:t?.governance}),u$1=c$1.ci.status==="repository",C=await ae(n),g=[];return r.key==="unknown"&&g.push(h(p?"project.stack.aggregate":"project.stack.unknown",p?"info":"fail",m$1,p?"Multi-runtime aggregate boundary detected":"Project stack is unknown",p?`Workspai detected multiple runtimes (${d.join(", ")}) and intentionally did not promote one nested framework as the aggregate project identity.`:"Workspai cannot confidently classify this backend project.",p?"Adopt independently operated nested projects when they need separate lifecycle, ownership, or release evidence.":"Add .workspai/project.json metadata or import the project with `workspai import`.")),P||g.push(h("project.marker.missing","warn",m$1,"Workspai marker is missing","The project can be detected by files, but it is not registered with Workspai metadata.","Run `workspai import <path>` from a workspace or create the project through Workspai.")),x||g.push(h("project.tests.missing","warn",m$1,"Test entrypoint is missing","No common test folder, config, or package test script was found.","Add a test command so `workspai workspace run test --affected` can gate changes.")),f&&y&&!z&&g.push(h("project.env.example.missing","info",m$1,"Environment example is missing","No .env.example or env.example file was found.","Add an env example for onboarding and CI secret documentation.",[".env.example"])),c$1.ci.status==="unknown"?g.push(h("project.ci.missing","warn",m$1,"CI governance is not proven","No repository CI surface or canonical external CI declaration was found for this project.","Add repository CI configuration or declare the external CI authority in the workspace contract.",[".github/workflows/ci.yml"])):c$1.ci.status==="external-observed"&&g.push(h("project.ci.external-observed","info",m$1,"Continuous integration appears externally managed",`Repository documentation references an external CI control plane (${c$1.ci.evidence.join(", ")}).`,"Declare the external CI provider in the canonical workspace contract when authoritative release gating depends on it.")),w&&!C&&g.push(h("project.health.missing","info",m$1,"Health or readiness probe is missing","The project has no obvious health or readiness endpoint to support automated deployment and runtime checks.","Add a simple health endpoint and document it for readiness gates and observability.")),f&&!R&&g.push(h("project.container.missing","info",m$1,"Container recipe is missing","No Dockerfile was found for this project.","Add a Dockerfile when the service is intended for containerized deployment.",["Dockerfile"])),{name:typeof o?.name=="string"&&o.name.trim()?o.name.trim():i.basename(n),path:n,relativePath:k,runtime:l$1,runtimeCandidates:d,framework:r.key,confidence:r.confidence,supportTier:r.supportTier,hasRapidKitMarker:P,hasTests:x,hasDockerfile:R,hasEnvExample:z,hasCiConfig:u$1,governance:c$1,hasHealthEndpoint:C,scripts:$,findings:g,score:de(g)}}function pe(e){return e.name.toLowerCase()}async function ue(e){let n=new Map(e.map(r=>[pe(r),r])),t=[];for(let r of e){let a=await F(i.join(r.path,"package.json")),l={...a?.dependencies??{},...a?.devDependencies??{},...a?.peerDependencies??{}};for(let p of Object.keys(l)){let A=p.replace(/^@[^/]+\//,"").toLowerCase(),f=n.get(A);f&&f.relativePath!==r.relativePath&&t.push({from:r.relativePath,to:f.relativePath,kind:"package"});}let d=await v(i.join(r.path,"pyproject.toml"));for(let p of e)p.relativePath!==r.relativePath&&d.includes(p.name)&&t.push({from:r.relativePath,to:p.relativePath,kind:"workspace-reference"});}let o=new Set;return t.filter(r=>{let a=`${r.from}\0${r.to}\0${r.kind}`;return o.has(a)?false:(o.add(a),true)})}function me(e,n){let t=new Map;for(let o of e)t.set(o.relativePath,{project:o.relativePath,directDependents:0,directDependencies:0});for(let o of n){let r=t.get(o.from),a=t.get(o.to);r&&(r.directDependencies+=1),a&&(a.directDependents+=1);}return Array.from(t.values()).sort((o,r)=>r.directDependents-o.directDependents||r.directDependencies-o.directDependencies)}async function fe(e){let n=await Z(t(e,"workspace.json"));return typeof n?.profile=="string"?n.profile:null}function ge(e){return {fail:e.filter(n=>n.severity==="fail").length,warn:e.filter(n=>n.severity==="warn").length,info:e.filter(n=>n.severity==="info").length}}function he(e){if(e.projectCount===0)return e.workspaceDetected?["Add your first project: npx workspai create project <name> --kit <kit>","Import an existing service: npx workspai import <path>"]:["Create a Workspai workspace: npx workspai create workspace my-workspace --profile polyglot","Import an existing service: npx workspai import ../service"];let n=[];return e.findings.some(t=>t.id==="workspace.marker.missing")&&n.push("Initialize workspace metadata with `workspai bootstrap --profile polyglot`."),e.findings.some(t=>t.id==="project.marker.missing")&&n.push("Register detected projects with `workspai import <path>` or recreate them via `workspai create project`."),e.findings.some(t=>t.id==="project.tests.missing")&&n.push("Add test entrypoints, then gate changes with `workspai workspace run test --affected --strict`."),e.findings.some(t=>t.id==="project.ci.missing")&&n.push("Add CI/CD configuration to catch regressions early and make workspace health checks actionable."),e.findings.some(t=>t.id==="project.health.missing")&&n.push("Add a health/readiness endpoint so runtime probes and deployment checks can verify service health."),e.hasCanonicalGraph||n.push("Generate canonical topology with `workspai workspace model --write --include-evidence`."),n.push("Run `workspai autopilot release --mode audit --json` before release."),Array.from(new Set(n))}async function $e(e$1={}){let n=i.resolve(e$1.workspacePath||process.cwd());if(!await E(n))throw new Error(`Workspace path does not exist: ${n}`);let t=ne(n)??n,o=k(t),r=await fe(t),a=await re(t),l;try{l=(await p({workspacePath:t})).contract;}catch{}let d=await Promise.all(a.map(c=>{let u=l?.projects.find(C=>{let g=C.externalPath??C.relativePath;return i.resolve(t,g)===i.resolve(c)});return le(t,c,u)})),p$2=await ue(d),A=me(d,p$2),f$1=[];o||f$1.push(h("workspace.marker.missing","warn",".","Workspace metadata is missing","The directory can be analyzed, but it is not a registered Workspai workspace.","Run `workspai create workspace` or `workspai bootstrap --profile polyglot` in a workspace root.")),d.length===0&&f$1.push(h("workspace.projects.missing","warn",".","No backend projects detected","Workspai did not find runtime markers or project metadata under this root.","Create a project with `workspai create project` or import one with `workspai import <path>`."));let w=[...f$1,...d.flatMap(c=>c.findings)],k$1=ge(w),m={};for(let c of d)for(let u of c.runtimeCandidates)m[u]=(m[u]||0)+1;let $=d.length>0?Math.round(d.reduce((c,u)=>c+u.score,0)/d.length):0,P=f$1.reduce((c,u)=>c+(u.severity==="fail"?20:u.severity==="warn"?8:2),0),x=Math.max(0,$-P),R=d.length===0&&k$1.fail===0&&w.length>0&&w.every(c=>c.id==="workspace.projects.missing"&&c.severity==="warn"),z=k$1.fail>0||e$1.strict&&k$1.warn>0&&!R?"blocked":k$1.warn>0?"needs-attention":"ready",y={schemaVersion:q.analyze,generatedAt:new Date().toISOString(),workspacePath:t,workspaceDetected:o,profile:r,summary:{statusScope:"source-structure",releaseReadiness:"not-evaluated",score:x,verdict:z,projectCount:d.length,runtimeCount:Object.keys(m).length,findings:k$1},runtimes:m,projects:d,dependencyGraph:{status:p$2.length>0?"generated":"empty",edges:p$2,topImpactedProjects:A.slice(0,5)},findings:w,nextActions:he({findings:w,projectCount:d.length,hasCanonicalGraph:await E(i.join(t,p$1.knowledgeGraph)),workspaceDetected:o}),enterpriseControls:{jsonReady:true,ciGateCommand:"workspai analyze --json --strict",releaseGateCommand:"workspai autopilot release --mode enforce --json",evidencePath:p$1.analyze}};if(e$1.output&&(await j.promises.mkdir(i.dirname(i.resolve(e$1.output)),{recursive:true}),await j.promises.writeFile(i.resolve(e$1.output),`${JSON.stringify(y,null,2)}
|
|
3
3
|
`)),!e$1.output&&o){let c=f(y,{commandId:"workspaceAnalyze",exitCode:y.summary.verdict==="blocked"?2:y.summary.verdict==="needs-attention"?1:0,generatedAt:y.generatedAt,blockers:y.findings.filter(u=>u.severity==="fail").map(u=>u.title).slice(0,12),runId:e()});await h$1(t,p$1.analyze,c);}return y}function Ge(e){let n=e.summary.verdict==="ready"?s.green:e.summary.verdict==="needs-attention"?s.yellow:s.red;if(console.log(s.bold(`
|
|
4
4
|
Workspai Workspace Analysis
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {m,a as a$1,l as l$1}from'./chunk-
|
|
1
|
+
import {m,a as a$1,l as l$1}from'./chunk-L5IV2SI4.js';import {b as b$5,g as g$2}from'./chunk-HMKDU7OU.js';import {b as b$4,a}from'./chunk-D5LLTUTY.js';import {b as b$2,f as f$2,s as s$1,t as t$1,u,P as P$1,v,q as q$2,r,R,n,o,p as p$2,h as h$2,i,m as m$1,j,k,l,O,w,x,y,z as z$1,A,B as B$1,C,E,G,I,D as D$1,F,H,J as J$1,K,L,M,N,S,T,U,V,Y as Y$1,X as X$1,W,a as a$3,Q}from'./chunk-QYEQVNBF.js';import {b as b$1,c,d}from'./chunk-AUVWD3WV.js';import {b as b$3}from'./chunk-COICGD62.js';import {d as d$2}from'./chunk-C563KVBD.js';import {b as b$7}from'./chunk-FFE2JZZJ.js';import {q as q$1,l as l$2,d as d$1}from'./chunk-ZOE43SGQ.js';import {p as p$1}from'./chunk-YS34N35Y.js';import {g}from'./chunk-FE5R6EUV.js';import {a as a$2,b as b$6}from'./chunk-K33JJVQZ.js';import {q,p,t,s as s$2}from'./chunk-ODK4LCEL.js';import {f as f$1,g as g$1,h}from'./chunk-VQZ5PI5J.js';import s from'path';import h$1 from'fs-extra';var pe=["Scope","Evidence","Diagnosis","Fix Plan","Run","Verify","Assumptions"];var Jt="workspace-operational-skill.v1";function Yt(e){if(typeof e!="string")return null;let t=e.trim();return !t||t.includes("/")||t.includes("..")?null:t}function Ot(e){let t=Yt(e.skillId);if(!t)throw new Error(`Invalid skill id: ${e.skillId}`);return {schemaVersion:Jt,skillId:t,canonicalPath:W(t),title:e.title,triggers:[...e.triggers].sort((r,n)=>r.localeCompare(n)),requiredReports:[...e.requiredReports].sort((r,n)=>r.localeCompare(n)),scopedProjects:[...e.scopedProjects??[]].sort((r,n)=>r.localeCompare(n)),verificationCommands:[...e.verificationCommands],answerContractSections:[...pe],...e.promptStem?{promptStem:e.promptStem}:{},markdown:e.markdown}}var Xt=q.skillsIndex;function Tt(e){let t=[...e.skills].sort((i,c)=>i.skillId.localeCompare(c.skillId)),r=e.inputsHash??d$1({skillIds:t.map(i=>i.skillId),paths:t.map(i=>i.canonicalPath),decisions:e.decisions??[]}),n=e.decisions?[...e.decisions].sort((i,c)=>i.skillId.localeCompare(c.skillId)):void 0;return {schemaVersion:Xt,generatedAt:e.generatedAt,inputsHash:r,skills:t.map(i=>({skillId:i.skillId,path:i.canonicalPath,schemaVersion:i.schemaVersion,title:i.title})),...n?{selection:{generatedCount:n.filter(i=>i.status==="generated").length,suppressedCount:n.filter(i=>i.status==="suppressed").length,decisions:n}}:{}}}var _t=[p.agentIndex,b$1,d$2],B="<!-- WORKSPAI:GENERATED-OPERATIONAL-SKILL -->",Qt=[{skillId:"workspai-diagnose-api-failure",title:"Diagnose API failure",triggers:["api failure","500 error","integration test failed","service unreachable"],objective:"Investigate a failing API or service using Workspai evidence before editing application code.",steps:[`Read \`${p.agentIndex}\` and identify fail/warn reports for the scoped project.`,`Read \`${p.doctor}\`, \`doctor-project-last-run.json\`, and project-scoped run evidence if present.`,"If a fix was requested, read `artifact-remediation-plan-last-run.json` for cross-artifact next steps, then `doctor-remediation-plan-last-run.json` for Doctor-specific file edits.","Map the failure to workspace vs project scope; cite exit codes and blocker messages.","Propose the smallest safe fix (config, env, dependency) with explicit verification commands."],applicability:"api"},{skillId:"workspai-release-readiness",title:"Release readiness",triggers:["release","ship","production","readiness gate"],objective:"Assess whether this workspace is release-ready using governed Workspai gates.",steps:[`Read \`${p.readiness}\` and \`pipeline-last-run.json\`.`,`Read \`${p.verify}\` for verdict and blocking reasons.`,`Read \`${t.artifactRemediationPlan}\` when a Studio or agent repair path is needed.`,"List blocking gates first; never claim ready without cited report fields.","Provide one safe next command and a verification checklist."],applicability:"workspace"},{skillId:"workspai-safe-schema-migration",title:"Safe schema migration",triggers:["migration","schema change","database migration","db migrate"],objective:"Plan and verify a schema migration with blast-radius awareness.",steps:["Identify affected projects from workspace model and dependency graph.","Run or review impact/verify evidence for transitive dependents.","Run a registered project-scoped test/build command when available; otherwise resolve the repository-authored validation command from cited manifests before promoting the migration.","Document rollback and verification signals."],applicability:"schema"},{skillId:"workspai-dependency-upgrade",title:"Dependency upgrade",triggers:["upgrade dependency","bump package","security advisory","outdated deps"],objective:"Upgrade dependencies with graph-aware verification.",steps:["Scope the upgrade to the owning project from workspace model.","Check transitive dependents via workspace graph / impact reports.","Use registered test/build commands for affected projects; when none are registered, resolve repository-authored commands from cited manifests instead of inventing one.","Re-run `workspace verify` after evidence refresh."],applicability:"dependency"},{skillId:"workspai-rename-contract",title:"Rename contract safely",triggers:["rename contract","rename event","breaking api","contract change"],objective:"Rename or change a shared contract with consumer awareness.",steps:[`Read \`${t.workspaceContract}\` for publishes/consumes/owns edges.`,"List all consumer projects before proposing renames.","Update contract file and regenerate workspace model.","Verify contract gate and integration tests for consumers."],applicability:"contract"}];function z(e){return `npx workspai ${e}`.trim()}function Zt(e){let t=["---",`name: ${e.template.skillId}`,`description: ${e.template.objective}`,"---","",B,"",`# ${e.template.title}`,"",`> Workspace: **${e.workspaceName}** \xB7 Skill: \`${e.template.skillId}\``,"","## Objective","",e.template.objective,"","## Triggers","",...e.template.triggers.map(r=>`- ${r}`),"","## Required evidence (read first)","",..._t.map(r=>`- \`${r}\``),"","## Why this skill exists here","",`Applicability: **${e.decision.confidence} confidence**.`,"",...e.decision.reasons.map(r=>`- ${r}`),...e.decision.signals.length>0?["","Evidence signals:","",...e.decision.signals.map(r=>`- \`${r}\``)]:[],"","## Project-aware execution boundary","",...e.projectEvidence,"",...e.retrievalCommands.length>0?["## Scoped retrieval commands","",...e.retrievalCommands.map(r=>`- \`${r}\``),""]:[],"## Procedure","",...e.template.steps.map((r,n)=>`${n+1}. ${r}`),""];if(e.scopedProjects.length>0&&t.push("## Scoped projects","",...e.scopedProjects.map(r=>`- ${r}`),""),e.contractSummary&&t.push("## Contract context","",e.contractSummary,""),e.verificationCommands.length>0){t.push("## Verification commands (this workspace)","");for(let r of e.verificationCommands)t.push(`- \`${r}\``);t.push("");}return t.push("## Answer contract","","Return: Scope, Evidence, Diagnosis, Fix Plan, Run, Verify, Assumptions.","","## Refresh stale evidence","","```bash",z("workspace agent-sync --write --refresh-context"),"```",""),t.join(`
|
|
2
2
|
`)}function er(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function tr(e){let t=new Map;for(let c of e.projects){let m=new Set([c.runtime,...c.runtimeCandidates??[]].map(er).filter(a=>a&&a!=="unknown"));for(let a of m){let k=t.get(a)??[];k.includes(c.name)||k.push(c.name),t.set(a,k);}}let r=[];for(let[c,m]of [...t.entries()].sort(([a],[k])=>a.localeCompare(k)))r.push({skillId:`workspai-${c}-runtime-validation`,title:`${c.toUpperCase()} runtime validation`,triggers:[`${c} build`,`${c} test`,`${c} runtime failure`],objective:`Validate ${c} changes against the detected runtime boundary, registered project commands, and canonical Workspai evidence.`,steps:["Read the scoped project lens and current fail/warn evidence before changing source.",`Use a registered ${c} command only when the project model identifies ${c} as the primary runtime; for a composite secondary boundary, inspect its manifest and Graph proofs instead of assuming the primary adapter covers it.`,"Run only the affected project validation first, then verify the workspace when the change crosses a contract boundary."],scopedProjects:[...m].sort(),applicability:"derived"});t.size>1&&r.push({skillId:"workspai-polyglot-change-validation",title:"Polyglot change validation",triggers:["cross-language change","polyglot change","binding change","multi-runtime validation"],objective:"Plan and verify a cross-runtime change without assuming that one runtime command proves the whole system.",steps:["Use the project topology and bounded Graph query to identify runtime and contract boundaries.","Validate each affected runtime with its registered project command.","Run workspace impact and canonical verification before declaring the change complete."],scopedProjects:Wt([...t.values()].flat()),applicability:"derived"});let n=e.projects.filter(c=>c.commands.supported.includes("test")).map(c=>c.name).sort();n.length>0&&r.push({skillId:"workspai-test-evidence-recovery",title:"Test evidence recovery",triggers:["test failure","coverage","regression","test evidence"],objective:"Repair a test or coverage blocker by proving changed behavior, not merely improving a metric.",steps:["Read the exact Analyze, Doctor, or Goal evidence that owns the test finding.","Inspect the behavior and relevant test boundary before proposing a source change.","Run the scoped test command, then the exact producer and canonical verification."],scopedProjects:n,applicability:"derived"});let i=e.projects.filter(c=>c.importantFiles.some(m=>/(?:^|\/)(?:Dockerfile|docker-compose|compose\.|Chart\.yaml|\.github\/workflows)/i.test(m))).map(c=>c.name).sort();return i.length>0&&r.push({skillId:"workspai-delivery-evidence",title:"Delivery evidence and CI recovery",triggers:["ci failure","workflow failure","container build","deployment evidence"],objective:"Diagnose delivery evidence with the owning project and CI/container artifacts before changing application source.",steps:["Identify whether the failing evidence is project-owned or workspace-owned.","Inspect the referenced workflow or delivery artifact and its bounded proof paths.","Validate the affected project first, then refresh the exact evidence producer and verify the workspace."],scopedProjects:i,applicability:"derived"}),r}function rr(e,t){if(!e?.safeCommands?.length)return [z("workspace verify --json"),z("doctor workspace --json")];let r=new Set(t);return e.safeCommands.filter(n=>n.scope==="workspace"||n.project&&r.has(n.project)).slice(0,8).map(n=>n.display)}function nr(e,t){if(!e?.projects?.length)return;let r=new Set(t),n=e.projects.filter(i=>r.has(i.slug)).filter(i=>(i.contracts?.owns?.length??0)>0||(i.contracts?.publishes?.length??0)>0||(i.contracts?.consumes?.length??0)>0||(i.contracts?.apis?.length??0)>0).slice(0,12).map(i=>{let c=i.contracts?.owns?.join(", ")||"none",m=i.contracts?.publishes?.join(", ")||"none",a=i.contracts?.consumes?.join(", ")||"none";return `- **${i.slug}**: owns \`${c}\`; publishes \`${m}\`; consumes \`${a}\``});return n.length>0?n.join(`
|
|
3
3
|
`):void 0}var ar=/(?:^|\/)(?:package(?:-lock)?\.json|pnpm-lock\.yaml|yarn\.lock|bun\.lockb?|pyproject\.toml|poetry\.lock|requirements[^/]*\.txt|Pipfile(?:\.lock)?|uv\.lock|Cargo\.toml|Cargo\.lock|go\.mod|go\.sum|pom\.xml|build\.gradle(?:\.kts)?|settings\.gradle(?:\.kts)?|Gemfile(?:\.lock)?|composer\.(?:json|lock)|mix\.exs|deps\.edn|project\.clj|[^/]+\.(?:csproj|fsproj|vbproj)|Directory\.Packages\.props)$/i,or=/(?:^|\/)(?:openapi|swagger|asyncapi)\.(?:json|ya?ml)$|(?:^|\/)(?:routes?|controllers?|endpoints?|proto)(?:\/|\.)/i,ir=/(?:^|\/)(?:migrations?|database|db|prisma)(?:\/|\.)|(?:^|\/)schema\.(?:sql|prisma)$/i;function sr(e){let t=e.attributes.artifact;return typeof t=="string"&&t.trim()?t.trim():null}function cr(e){let t=e.attributes.ports;return Array.isArray(t)&&t.length>0}function lr(e,t){return e?.entities.filter(r=>r.projectId===t)??[]}function ue(e,t=12){return [...new Set([...e].map(r=>r.trim()).filter(Boolean))].sort((r,n)=>r.localeCompare(n)).slice(0,t)}function Wt(e){return [...new Set([...e].map(t=>t.trim()).filter(Boolean))].sort((t,r)=>t.localeCompare(r))}function dr(e){if(e.template.scopedProjects)return {projects:[...e.template.scopedProjects].sort(),reasons:["The canonical workspace model directly derived this capability."],signals:ue(e.template.scopedProjects.map(i=>`model:project:${i}:${e.template.skillId}`)),confidence:"high",applicable:true};if(e.template.applicability==="workspace")return {projects:e.model.projects.map(i=>i.name).sort(),reasons:["Workspace-level release and verification gates are always available."],signals:["model:workspace",`model:project-count:${e.model.projects.length}`],confidence:"high",applicable:true};let t=[],r=[],n=new Set;for(let i of e.model.projects){let c=lr(e.graph,i.name),m=Wt([...i.importantFiles,...c.map(sr).filter(l=>!!l)]),a=e.contract?.projects.find(l=>l.slug===i.name),k=false;switch(e.template.applicability){case "dependency":{let l=m.filter(d=>ar.test(d)),p=c.filter(d=>d.kind==="package");k=l.length>0||p.length>0,r.push(...l.map(d=>`artifact:${d}`),...p.slice(0,4).map(d=>`graph:package:${d.label}`)),k&&n.add("Dependency manifests or package entities were observed.");break}case "api":{let l=c.filter(w=>w.kind==="api"||w.kind==="endpoint"||w.kind==="service"&&cr(w)),p=m.filter(w=>or.test(w)),d=a?.contracts?.apis??[],R=(a?.ports??[]).filter(w=>["http","https","grpc"].includes(w.protocol));k=l.length>0||p.length>0||d.length>0||R.length>0,r.push(...l.slice(0,4).map(w=>`graph:${w.kind}:${w.label}`),...p.map(w=>`artifact:${w}`),...d.map(w=>`contract:api:${w.name}:${w.basePath}`),...R.map(w=>`contract:port:${w.name}:${w.protocol}:${w.port}`)),k&&n.add("An API, endpoint, routed artifact, or network contract was observed.");break}case "schema":{let l=c.filter(d=>{if(d.kind==="database")return true;if(d.kind!=="schema")return false;let R=`${d.label} ${JSON.stringify(d.attributes)}`;return /database|migration|sql|prisma|orm/i.test(R)}),p=m.filter(d=>ir.test(d));k=l.length>0||p.length>0,r.push(...l.slice(0,4).map(d=>`graph:${d.kind}:${d.label}`),...p.map(d=>`artifact:${d}`)),k&&n.add("A database, schema, or migration artifact was observed.");break}case "contract":{let l=a?[...a.contracts?.owns??[],...a.contracts?.publishes??[],...a.contracts?.consumes??[],...(a.contracts?.apis??[]).map(d=>d.name)]:[],p=c.filter(d=>["api","protocol"].includes(d.kind));k=l.length>0||p.length>0,r.push(...l.map(d=>`contract:${i.name}:${d}`),...p.slice(0,6).map(d=>`graph:${d.kind}:${d.label}`)),k&&n.add("A shared API, protocol, schema, or authored contract edge was observed.");break}case "derived":k=true;break}k&&t.push(i.name);}return {projects:ue(t,e.model.projects.length),reasons:[...n],signals:ue(r),confidence:e.graph||e.contract?"high":"medium",applicable:t.length>0}}function pr(e,t,r){let n=[];for(let i of t){let c=e.projects.find(l=>l.name===i);if(!c)continue;let m=c.commands.supported.filter(l=>["build","test","lint","format"].includes(l)),a=c.commands.supported.filter(l=>["docs","doctor"].includes(l)),k=r.filter(l=>l.startsWith("artifact:")).map(l=>l.slice(9)).filter(l=>c.importantFiles.includes(l)||l.includes(c.name));n.push(`- **${c.name}** \u2014 runtime \`${c.runtime}\`, framework \`${c.framework}\`, confidence \`${c.confidence}\`.`),n.push(m.length>0?` Registered lifecycle commands: ${m.map(l=>`\`${l}\``).join(", ")}.`:" No project-native build/test command is registered; inspect repository-authored manifests and Graph proofs before running a command."),a.length>0&&n.push(` Registered evidence commands: ${a.map(l=>`\`${l}\``).join(", ")}.`),k.length>0&&n.push(` Relevant artifacts: ${ue(k,6).map(l=>`\`${l}\``).join(", ")}.`);}return n.length>0?n:["- No project boundary was proven; do not infer repository-specific commands or files."]}function ur(e,t){let r=e.applicability==="api"?"api endpoint route service failure":e.applicability==="schema"?"database schema migration persistence":e.applicability==="dependency"?"package dependency manifest lockfile":e.applicability==="contract"?"api protocol published consumed contract":e.applicability==="workspace"?"release pipeline deployment verification":`${e.title.toLowerCase()} manifest command test`;return t.slice(0,8).map(n=>z(`workspace graph search "${r}" --scope project:${n} --limit 12 --json`))}function jt(e){let t=e.model.workspace.name,r=[],n=[];for(let i of [...Qt,...tr(e.model)]){let c=dr({template:i,model:e.model,contract:e.contract??null,graph:e.graph??null}),m={skillId:i.skillId,title:i.title,status:c.applicable?"generated":"suppressed",confidence:c.confidence,reasons:c.reasons.length>0?c.reasons:["No authoritative workspace signal proves this capability is present."],signals:c.signals,scopedProjects:c.projects};if(n.push(m),m.status==="suppressed")continue;let a=m.scopedProjects,k=rr(e.context??null,a),l=nr(e.contract??null,a),p=Zt({template:i,workspaceName:t,scopedProjects:a,verificationCommands:k,contractSummary:l,decision:m,projectEvidence:pr(e.model,a,m.signals),retrievalCommands:ur(i,a)});r.push(Ot({skillId:i.skillId,title:i.title,triggers:i.triggers,requiredReports:[..._t],scopedProjects:a,verificationCommands:k,...X$1(i.skillId)?{promptStem:Y$1[i.skillId]}:{},markdown:p}));}return {skills:r,decisions:n}}async function Nt(e){let t=s.resolve(e.workspacePath),r=[],n=d$1({skills:e.skills.map(a=>({id:a.skillId,path:a.canonicalPath,hash:d$1({markdown:a.markdown})})),decisions:e.decisions??[]}),i=Tt({generatedAt:e.generatedAt,skills:e.skills,inputsHash:n,decisions:e.decisions}),c=new Set(e.skills.map(a=>a.skillId)),m=[];if(e.write){let a=s.join(t,".workspai","skills");if(await h$1.pathExists(a))for(let l of await h$1.readdir(a,{withFileTypes:true})){if(!l.isFile()||!l.name.endsWith(".md"))continue;let p=l.name.slice(0,-3);if(c.has(p))continue;let d=s.join(a,l.name);(await h$1.readFile(d,"utf8")).includes(B)&&(await h$1.remove(d),m.push(p));}for(let l of e.skills){let p=s.join(t,l.canonicalPath);await h$1.ensureDir(s.dirname(p)),await h$1.writeFile(p,l.markdown,"utf8"),r.push(l.canonicalPath);}let k=s.join(t,b$2);await h$1.ensureDir(s.dirname(k)),await h$1.writeJson(k,i,{spaces:2}),r.push(b$2);}return {skills:e.skills,index:i,writtenPaths:r,removedSkillIds:m.sort()}}function Lt(e){return ["## Operational skills (canonical)","","Read workspace-native playbooks from `.workspai/skills/` before generic repo scans. Legacy `.rapidkit/skills/` playbooks are read only when already present from older workspaces:","",...e.skills.map(r=>`- \`${r.path}\` \u2014 ${r.title} (\`${r.skillId}\`)`),"","Regenerate:","","```bash",z("workspace agent-sync --write --refresh-context"),"```",""].join(`
|
|
4
4
|
`)}var gr={"workspai-diagnose-api-failure":A,"workspai-release-readiness":E},Je="## Workspace verification (hydrated)";function mr(e){let t=[Je,"","Verification commands for this workspace:","",...e.verificationCommands.length?e.verificationCommands.map(r=>`- \`${r}\``):["- `npx workspai workspace verify --json`"]];return e.scopedProjects.length>0&&t.push("","Scoped projects:","",...e.scopedProjects.map(r=>`- ${r}`)),t.push(""),t.join(`
|