workspai 0.64.0 → 0.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -44
- package/contracts/agent-customization-pack.v1.json +4 -2
- package/contracts/analyze-last-run.v1.json +9 -1
- package/contracts/cli-runtime-command-inventory.v1.snapshot.json +117 -0
- package/contracts/extension-cli-compatibility.v1.json +2 -0
- package/contracts/published-contract-catalog.v1.json +10 -0
- package/contracts/runtime-command-surface.v1.json +59 -3
- package/contracts/workspace-activity-event.v1.json +132 -0
- package/contracts/workspace-contract.v1.json +51 -6
- package/contracts/workspace-intelligence/agent-bootstrap-receipt.v1.json +17 -0
- package/contracts/workspace-intelligence/mcp-design.v1.json +49 -2
- package/contracts/workspace-intelligence/project-agent-entry.v1.json +3 -0
- package/contracts/workspace-intelligence/project-context-agent.v1.json +78 -7
- package/contracts/workspace-intelligence/project-knowledge-graph-reference.v1.json +51 -0
- package/contracts/workspace-intelligence/workspace-knowledge-graph.v1.json +108 -3
- package/contracts/workspace-intelligence/workspace-model.v1.json +28 -1
- package/contracts/workspace-intelligence/workspace-skills-index.v1.json +34 -0
- package/contracts/workspace-model-cache.v1.json +4 -0
- package/contracts/workspace-repair-capabilities.v1.json +66 -0
- package/dist/analyze-UJQWGNM2.js +1 -0
- package/dist/{artifact-remediation-plan-XIQNI35L.js → artifact-remediation-plan-M2XBS2IU.js} +1 -1
- package/dist/autopilot-release-U6F4M2BQ.js +1 -0
- package/dist/capabilities-command-XUKPO25Z.js +1 -0
- package/dist/chunk-2LIVMG5C.js +2 -0
- package/dist/{chunk-ZGS5NKEO.js → chunk-2PACEMNE.js} +1 -1
- package/dist/chunk-334J2KIP.js +7 -0
- package/dist/{chunk-6TBTMWNA.js → chunk-3H5ACWWZ.js} +1 -1
- package/dist/{chunk-HCFWT42C.js → chunk-3NM3JAZW.js} +1 -1
- package/dist/chunk-4XEH3WNV.js +13 -0
- package/dist/chunk-5OA33JH2.js +2 -0
- package/dist/chunk-5TY74LLW.js +2 -0
- package/dist/{chunk-QCKWQFCD.js → chunk-5U4L6VF2.js} +1 -1
- package/dist/{chunk-W6FHVXNL.js → chunk-5XGR3LRI.js} +1 -1
- package/dist/{chunk-KTN2ARZJ.js → chunk-6JX56VAL.js} +3 -3
- package/dist/chunk-6UNATTB7.js +1 -0
- package/dist/{chunk-J3X56S7L.js → chunk-727IQFGN.js} +1 -1
- package/dist/chunk-7FF5EOIO.js +2 -0
- package/dist/chunk-AP4PV6WJ.js +1 -0
- package/dist/chunk-AXUA7PFV.js +2 -0
- package/dist/chunk-B4IVVTMQ.js +2 -0
- package/dist/{chunk-LNXIMF3O.js → chunk-C4S22E6S.js} +1 -1
- package/dist/{chunk-PXWKMPPI.js → chunk-D4UHRJAP.js} +1 -1
- package/dist/chunk-DUBOKZMA.js +49 -0
- package/dist/{chunk-VYDURWN7.js → chunk-ECLMYTWT.js} +1 -1
- package/dist/{chunk-VB6I52ZT.js → chunk-EHH4SKVH.js} +50 -50
- package/dist/chunk-EP4CUWOO.js +9 -0
- package/dist/chunk-FY4X2VOE.js +39 -0
- package/dist/chunk-GAYK3WGV.js +2 -0
- package/dist/{chunk-YUGKQ44M.js → chunk-H5RJCS5E.js} +1 -1
- package/dist/{chunk-5SFCBZOH.js → chunk-H7MRINGP.js} +1 -1
- package/dist/chunk-HJLGXFMK.js +1 -0
- package/dist/{chunk-VRGEPPUB.js → chunk-HLWDIIWL.js} +1 -1
- package/dist/{chunk-KJXMLBSY.js → chunk-IIFFEEMX.js} +1 -1
- package/dist/chunk-IVF6NEHS.js +1 -0
- package/dist/chunk-JC4XSU7G.js +1 -0
- package/dist/chunk-JRP6WP5C.js +681 -0
- package/dist/chunk-JZJBA2V2.js +1 -0
- package/dist/{chunk-N4QQADXX.js → chunk-L5CCIIF2.js} +1 -1
- package/dist/chunk-L5Q2S5GY.js +3 -0
- package/dist/chunk-LPCZHKD5.js +1 -0
- package/dist/chunk-MZ7U4BIQ.js +157 -0
- package/dist/chunk-NMXGSVMD.js +1 -0
- package/dist/{chunk-GQSRNUCU.js → chunk-NVND4727.js} +3 -3
- package/dist/chunk-O37UBRMX.js +4 -0
- package/dist/chunk-OI2VOU6S.js +1 -0
- package/dist/chunk-PD7Y6HIM.js +2 -0
- package/dist/chunk-PJPS7CNH.js +1 -0
- package/dist/chunk-QGAPGZPL.js +97 -0
- package/dist/chunk-R2M5OJOK.js +5 -0
- package/dist/chunk-SX6A656X.js +1 -0
- package/dist/{chunk-X6TNBARH.js → chunk-TABXSDTR.js} +2 -2
- package/dist/chunk-TTHO4MFC.js +2 -0
- package/dist/chunk-U5ENEDJA.js +7 -0
- package/dist/chunk-UOCERSAN.js +1 -0
- package/dist/chunk-UPIPSSXY.js +1 -0
- package/dist/chunk-UTV4DTNM.js +1 -0
- package/dist/chunk-VA5VSOBL.js +2 -0
- package/dist/chunk-VQOWB26M.js +12 -0
- package/dist/chunk-VQZ5PI5J.js +1 -0
- package/dist/chunk-WCJU3CFG.js +1 -0
- package/dist/chunk-WTWRSEOW.js +1 -0
- package/dist/{chunk-D65FCQIO.js → chunk-XESFJN52.js} +1 -1
- package/dist/chunk-XQFWUM2P.js +1 -0
- package/dist/chunk-XWKGZRHN.js +1 -0
- package/dist/{chunk-WRQWVSBJ.js → chunk-YX5VWPR5.js} +1 -1
- package/dist/chunk-ZEEV5J4I.js +1 -0
- package/dist/chunk-ZQH2I5RQ.js +1 -0
- package/dist/{create-PWJDTKDN.js → create-SOLLXXAB.js} +1 -1
- package/dist/{demo-kit-QHIDCSBI.js → demo-kit-5UQH2OXC.js} +1 -1
- package/dist/{doctor-CGXY4IDE.js → doctor-NQ5PUCUP.js} +1 -1
- package/dist/{dotnet-webapi-clean-AVHPJG7Y.js → dotnet-webapi-clean-YEHYIGOT.js} +1 -1
- package/dist/{goal-lifecycle-BRFFTIU2.js → goal-lifecycle-IPNY7KNR.js} +1 -1
- package/dist/goal-pack-2WV3EA4Y.js +1 -0
- package/dist/{gofiber-standard-47S2GYAO.js → gofiber-standard-C44IIQYH.js} +1 -1
- package/dist/{gogin-standard-EWB4XNOI.js → gogin-standard-X7VKACVR.js} +1 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.js +170 -170
- package/dist/live-command-Q6E45N7S.js +18 -0
- package/dist/{pipeline-DF4UIHAD.js → pipeline-MIMENSI7.js} +1 -1
- package/dist/{project-agent-entry-IWUCV72J.js → project-agent-entry-OWLJ3IHQ.js} +1 -1
- package/dist/project-intelligence-lens-I67EO6AE.js +1 -0
- package/dist/{project-test-coverage-4S7MEQ6T.js → project-test-coverage-OPDVSFPH.js} +1 -1
- package/dist/{pythonRapidkitExec-VAW5XE4Z.js → pythonRapidkitExec-44ORGQ4R.js} +1 -1
- package/dist/{rust-axum-M5X4ZC4Z.js → rust-axum-JKZTZDRZ.js} +1 -1
- package/dist/{springboot-standard-Y5ADLZMQ.js → springboot-standard-PI4FLTAN.js} +1 -1
- package/dist/verified-goal-46JWNCDY.js +1 -0
- package/dist/{workspace-35Q2IXAR.js → workspace-KO37XHF6.js} +1 -1
- package/dist/{workspace-agent-sync-FFNSW2PD.js → workspace-agent-sync-32FIJQBH.js} +1 -1
- package/dist/{workspace-archive-ZBCKJHXS.js → workspace-archive-6R5DRNZW.js} +1 -1
- package/dist/{workspace-context-IJ36ZP6G.js → workspace-context-JKRPX775.js} +1 -1
- package/dist/workspace-contract-4T3NYNK5.js +1 -0
- package/dist/workspace-explain-MOGL4GEA.js +1 -0
- package/dist/workspace-explain-contract-W2E6LF4Q.js +1 -0
- package/dist/{workspace-feedback-RQ4TGJW6.js → workspace-feedback-6VQ7T4CR.js} +1 -1
- package/dist/{workspace-foundation-GMGDUMPR.js → workspace-foundation-GHWO3BZU.js} +1 -1
- package/dist/workspace-graph-stream-PTVS47NJ.js +1 -0
- package/dist/workspace-graph-token-efficiency-Z5JD5NHI.js +1 -0
- package/dist/{workspace-history-SYCDK7FO.js → workspace-history-M2K4M2JY.js} +1 -1
- package/dist/{workspace-intelligence-5NO4K5SC.js → workspace-intelligence-PJIPTXL3.js} +1 -1
- package/dist/{workspace-intelligence-evaluation-CQDKOYZZ.js → workspace-intelligence-evaluation-GONCRE6O.js} +1 -1
- package/dist/{workspace-intelligence-runner-FGEBFVVM.js → workspace-intelligence-runner-M47QR3JM.js} +1 -1
- package/dist/{workspace-intelligence-runtime-registry-IW6J53LO.js → workspace-intelligence-runtime-registry-FFGQF4A7.js} +1 -1
- package/dist/workspace-knowledge-graph-V2EAYDCL.js +1 -0
- package/dist/workspace-knowledge-graph-contract-VANN7RCA.js +1 -0
- package/dist/{workspace-knowledge-graph-query-ON45H6Y7.js → workspace-knowledge-graph-query-RASPF7FS.js} +1 -1
- package/dist/workspace-knowledge-graph-snapshot-5YIG6EMG.js +1 -0
- package/dist/{workspace-marker-7NHMDIRL.js → workspace-marker-XGAWZZDX.js} +1 -1
- package/dist/workspace-mcp-serve-YRORNE4P.js +3 -0
- package/dist/workspace-model-VSVKLX7M.js +1 -0
- package/dist/{workspace-onboarding-VS3YYNGK.js → workspace-onboarding-2VMJZVLZ.js} +1 -1
- package/dist/{workspace-python-engine-state-J4QKW55K.js → workspace-python-engine-state-BE4A3BL5.js} +1 -1
- package/dist/{workspace-readme-G7TZ3V5T.js → workspace-readme-6X3GLTBM.js} +2 -2
- package/dist/{workspace-registry-summary-MIDFG6EC.js → workspace-registry-summary-QVSJKKTX.js} +1 -1
- package/dist/workspace-repair-engine-WSKV3Q4V.js +3 -0
- package/dist/workspace-run-3BXKTLVL.js +1 -0
- package/dist/{workspace-verify-4R7QHUPO.js → workspace-verify-EJCSOBIK.js} +1 -1
- package/dist/workspace-watch-JTIFBF4Z.js +1 -0
- package/docs/SETUP.md +10 -0
- package/docs/agent-entry.md +22 -7
- package/docs/ci-workflows.md +1 -1
- package/docs/commands-reference.md +43 -7
- package/docs/contracts/ARTIFACT_CATALOG.md +63 -44
- package/docs/contracts/COMMAND_OWNERSHIP_MATRIX.md +1 -0
- package/docs/contracts/NAMING_AND_COEXISTENCE.md +20 -18
- package/docs/contracts/README.md +4 -3
- package/docs/real-world-qualification.md +19 -3
- package/docs/workspace-knowledge-graph.md +131 -27
- package/docs/workspace-live-activity.md +199 -0
- package/docs/workspace-operations.md +54 -9
- package/docs/workspace-repair-engine.md +17 -0
- package/package.json +1 -1
- package/dist/analyze-NUGNB256.js +0 -1
- package/dist/autopilot-release-TWJWSVVF.js +0 -1
- package/dist/capabilities-command-LHM3XIS6.js +0 -1
- package/dist/chunk-2647BYBC.js +0 -1
- package/dist/chunk-27UR373Z.js +0 -1
- package/dist/chunk-2VJUAKMS.js +0 -2
- package/dist/chunk-3A23KJAQ.js +0 -1
- package/dist/chunk-4PUJVYRM.js +0 -1
- package/dist/chunk-5B2GAZAC.js +0 -5
- package/dist/chunk-6DAQ7PYT.js +0 -13
- package/dist/chunk-CCAXADKP.js +0 -49
- package/dist/chunk-CCDGHPEJ.js +0 -2
- package/dist/chunk-CJHWKXDN.js +0 -1
- package/dist/chunk-CT4IODPG.js +0 -2
- package/dist/chunk-DK6JNE6K.js +0 -2
- package/dist/chunk-DOXNVBX6.js +0 -1
- package/dist/chunk-DWB2RRF4.js +0 -1
- package/dist/chunk-FQSBOLM7.js +0 -1
- package/dist/chunk-ILIBOMYL.js +0 -1
- package/dist/chunk-ISOOENLW.js +0 -8
- package/dist/chunk-J7RU5WR5.js +0 -2
- package/dist/chunk-JQLJBK5N.js +0 -1
- package/dist/chunk-KANAJH65.js +0 -681
- package/dist/chunk-KV6PS54A.js +0 -8
- package/dist/chunk-L22EABIC.js +0 -7
- package/dist/chunk-MOSXTVPU.js +0 -1
- package/dist/chunk-NHTDPXTW.js +0 -4
- package/dist/chunk-NZ3WZYD5.js +0 -1
- package/dist/chunk-Q2WF7D5U.js +0 -2
- package/dist/chunk-RSG2GJXT.js +0 -2
- package/dist/chunk-SFO5GVRT.js +0 -1
- package/dist/chunk-T5YRFRJV.js +0 -1
- package/dist/chunk-THIOE2PB.js +0 -2
- package/dist/chunk-TOYN76K4.js +0 -144
- package/dist/chunk-U5WVR74V.js +0 -1
- package/dist/chunk-UXEO5QCF.js +0 -33
- package/dist/chunk-VR6XMUF3.js +0 -2
- package/dist/chunk-WY4DOMEA.js +0 -1
- package/dist/chunk-XKDR5BGS.js +0 -6
- package/dist/chunk-Y5YAP4F3.js +0 -2
- package/dist/chunk-ZH7CXQH3.js +0 -94
- package/dist/goal-pack-FG3QDNQH.js +0 -1
- package/dist/project-intelligence-lens-PZPPSCUW.js +0 -1
- package/dist/verified-goal-BBHZRYYH.js +0 -1
- package/dist/workspace-contract-JS4LZZQZ.js +0 -1
- package/dist/workspace-explain-TITIT5XN.js +0 -1
- package/dist/workspace-explain-contract-V2IVSROX.js +0 -1
- package/dist/workspace-graph-stream-7UU2YVHC.js +0 -1
- package/dist/workspace-graph-token-efficiency-D7CUT6NX.js +0 -1
- package/dist/workspace-knowledge-graph-RSDP2E36.js +0 -1
- package/dist/workspace-knowledge-graph-snapshot-3FJHH5IK.js +0 -1
- package/dist/workspace-mcp-serve-WUIQ2AE6.js +0 -3
- package/dist/workspace-model-OKY4CQ3X.js +0 -1
- package/dist/workspace-repair-engine-VUBT77Y7.js +0 -3
- package/dist/workspace-run-SSF6Z26G.js +0 -1
- package/dist/workspace-watch-IOPSHQS5.js +0 -1
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# Workspai Live Activity
|
|
2
|
+
|
|
3
|
+
`workspai live` renders the execution graph of Workspai commands running in
|
|
4
|
+
other terminals for the same project or workspace.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
# Terminal A
|
|
8
|
+
workspai live
|
|
9
|
+
|
|
10
|
+
# Terminal B
|
|
11
|
+
workspai workspace intelligence run
|
|
12
|
+
|
|
13
|
+
# Terminal C
|
|
14
|
+
workspai doctor workspace
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The monitor is observational. Closing it does not cancel commands, and a
|
|
18
|
+
journal or renderer failure cannot change command success.
|
|
19
|
+
|
|
20
|
+
## Commands
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
workspai live [target]
|
|
24
|
+
workspai live --global
|
|
25
|
+
workspai live --global --max-scopes 20 --max-runs 20
|
|
26
|
+
workspai live --run <run-id>
|
|
27
|
+
workspai live --once
|
|
28
|
+
workspai live --once --json
|
|
29
|
+
workspai live --refresh-ms 500 --max-runs 10
|
|
30
|
+
workspai live --no-motion --no-color
|
|
31
|
+
workspai live --ascii
|
|
32
|
+
workspai live --accessible
|
|
33
|
+
workspai live --classic
|
|
34
|
+
workspai live --capture workspai-live.svg
|
|
35
|
+
workspai live --capture launch.svg --capture-preset linkedin --capture-theme obsidian
|
|
36
|
+
workspai live --capture internal.svg --no-capture-redact
|
|
37
|
+
workspai live --replay <run-id> --replay-speed 4
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`target` defaults to the current directory. `--once` is suitable for scripts,
|
|
41
|
+
diagnostics and tests. Without a TTY, `--json` emits a new snapshot only when
|
|
42
|
+
projected activity changes. `--global` discovers bounded machine-local activity
|
|
43
|
+
channels and produces one fleet view across projects and workspaces; it cannot
|
|
44
|
+
be combined with `target`.
|
|
45
|
+
|
|
46
|
+
`--capture` writes an atomic, deterministic SVG from the same Activity Board
|
|
47
|
+
Model used by the terminal and exits. Captures are redacted by default: local
|
|
48
|
+
scope, project, run and command-argument details are replaced while semantic
|
|
49
|
+
stage and outcome data remain. Presets are `github` (1280×720), `linkedin`
|
|
50
|
+
(1200×627), `x`/`wide` (1600×900) and `square` (1080×1080); themes are
|
|
51
|
+
`obsidian`, `light` and `mono`. Use `--no-capture-redact` only for an explicitly
|
|
52
|
+
internal artifact.
|
|
53
|
+
|
|
54
|
+
`--replay <run-id>` reconstructs the selected run from immutable event prefixes
|
|
55
|
+
instead of inventing UI state. Replay defaults to 4× speed, accepts
|
|
56
|
+
`--replay-speed 0.25..64`, and is scoped to the target project or workspace.
|
|
57
|
+
|
|
58
|
+
## Flow Board
|
|
59
|
+
|
|
60
|
+
The default TTY renderer is a bounded full-screen Flow Board, not an appended
|
|
61
|
+
log. Each command publishes a versioned execution blueprint containing stable
|
|
62
|
+
block and edge IDs. The board then projects real transitions onto that graph:
|
|
63
|
+
|
|
64
|
+
- a running block uses an active cyan border;
|
|
65
|
+
- successful, warning/blocked and failed blocks become green, yellow and red;
|
|
66
|
+
- a running handoff animates on the edge entering the next block;
|
|
67
|
+
- full-board connections terminate in weight-matched ports on the card frame;
|
|
68
|
+
font-dependent triangle arrowheads are not mixed with box-drawing lines, and
|
|
69
|
+
direction is conveyed by an aligned moving wire segment plus the serpentine
|
|
70
|
+
flow layout;
|
|
71
|
+
- cards reserve their frame for topology and their content row for a stable
|
|
72
|
+
`QUEUE/RUN/DONE/WARN/BLOCK/FAIL` status rail, attempt and progress metadata;
|
|
73
|
+
- a block started again after a terminal outcome is a new durable attempt; its
|
|
74
|
+
card shows `↻2`, `↻3`, and so on, retains earlier attempt outcomes and
|
|
75
|
+
reactivates the incoming flow wire;
|
|
76
|
+
- independent runs may have multiple active blocks at the same time;
|
|
77
|
+
- phase rails are emitted by command blueprints, so grouping reflects command
|
|
78
|
+
architecture rather than a repository-specific UI assumption;
|
|
79
|
+
- terminals at least 132 columns wide receive a factual Inspector for the
|
|
80
|
+
selected active/problem block: state, phase, attempt, progress, elapsed time,
|
|
81
|
+
touches, artifacts and warnings; `i` or `Tab` toggles it;
|
|
82
|
+
- the selected run receives the full flow graph; other running commands are
|
|
83
|
+
reduced to one minimal `ALSO ACTIVE` dock in local mode; global mode uses a
|
|
84
|
+
Fleet Cockpit with location, command, active block, status and elapsed time
|
|
85
|
+
before the selected run graph;
|
|
86
|
+
- journals left running by a process that no longer exists are projected as
|
|
87
|
+
orphaned/cancelled and never inflate the active counter or active-run dock;
|
|
88
|
+
- narrow or short terminals automatically collapse to chips without losing
|
|
89
|
+
status or ordering.
|
|
90
|
+
|
|
91
|
+
The renderer updates changed terminal rows only and uses the alternate screen,
|
|
92
|
+
so monitoring does not produce an unbounded scrollback stream. Resize triggers
|
|
93
|
+
a safe full redraw. Interactive controls are:
|
|
94
|
+
|
|
95
|
+
| Key | Effect |
|
|
96
|
+
| -------------------- | --------------------------------------------- |
|
|
97
|
+
| `↑` / `↓`, `j` / `k` | Select a run |
|
|
98
|
+
| `Enter` | Focus/unfocus the selected run |
|
|
99
|
+
| `i`, `Tab` | Toggle the adaptive Inspector |
|
|
100
|
+
| `f` | Toggle active runs only |
|
|
101
|
+
| `q`, `Ctrl+C` | Close the monitor without cancelling commands |
|
|
102
|
+
|
|
103
|
+
Replay controls are `Space` to play/pause, `←`/`→` (or `,`/`.`) to step one
|
|
104
|
+
durable event backward/forward, and `q` to close. Reaching the last event pauses
|
|
105
|
+
the replay instead of exiting, which keeps the terminal ready for inspection.
|
|
106
|
+
|
|
107
|
+
`NO_COLOR`, `TERM=dumb`, `WORKSPAI_LIVE_ASCII=1` and
|
|
108
|
+
`WORKSPAI_LIVE_REDUCED_MOTION=1` are honored. `--accessible` uses a stable,
|
|
109
|
+
non-animated linear projection with no terminal control sequences for screen
|
|
110
|
+
readers and captured output. `--classic` preserves the compatibility renderer.
|
|
111
|
+
|
|
112
|
+
The implementation intentionally keeps this pipeline renderer-independent:
|
|
113
|
+
|
|
114
|
+
```text
|
|
115
|
+
workspace-activity-event.v1
|
|
116
|
+
-> deterministic monitor snapshot
|
|
117
|
+
-> Activity Board Model (runs, nodes, edges, selection, counters)
|
|
118
|
+
-> terminal + deterministic SVG adapters today / web and IDE adapters later
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
No TUI framework is part of the Activity runtime. This prevents React/Yoga or
|
|
122
|
+
terminal-widget lifecycle state from entering the future package boundary and
|
|
123
|
+
keeps browser/IDE renderers able to consume the same Board Model.
|
|
124
|
+
|
|
125
|
+
## Project and workspace behavior
|
|
126
|
+
|
|
127
|
+
The command works before adoption and does not create metadata in an ordinary
|
|
128
|
+
project. Activity journals are stored in machine-local state:
|
|
129
|
+
|
|
130
|
+
- Linux: `$XDG_STATE_HOME/workspai/activity`, or `~/.local/state/workspai/activity`;
|
|
131
|
+
- macOS: `~/Library/Application Support/Workspai/activity`;
|
|
132
|
+
- Windows: `%LOCALAPPDATA%\Workspai\activity`.
|
|
133
|
+
|
|
134
|
+
`WORKSPAI_ACTIVITY_STATE_DIR` overrides this location. Set
|
|
135
|
+
`WORKSPAI_ACTIVITY_DISABLE=1` to disable journaling.
|
|
136
|
+
|
|
137
|
+
An adopted or linked project keeps its stable physical project channel and
|
|
138
|
+
mirrors the same event/run identities into its workspace channel. This allows a
|
|
139
|
+
monitor opened before `adopt` to keep following the run while a monitor at the
|
|
140
|
+
workspace root receives subsequent linked-project activity.
|
|
141
|
+
|
|
142
|
+
`workspai live --global` scans the bounded local channel registry, deduplicates
|
|
143
|
+
mirrored records by event identity, then groups runs by semantic scope. Every
|
|
144
|
+
run also carries a machine-local origin identity, so two projects in one
|
|
145
|
+
workspace remain distinguishable while sharing one workspace lane, and projects
|
|
146
|
+
from different workspaces retain separate scope labels. The selected run owns
|
|
147
|
+
the full graph; concurrent activity from other origins stays visible in the
|
|
148
|
+
Fleet Cockpit without merging independent timelines.
|
|
149
|
+
|
|
150
|
+
## Event contract
|
|
151
|
+
|
|
152
|
+
Every NDJSON line conforms to:
|
|
153
|
+
|
|
154
|
+
```text
|
|
155
|
+
contracts/workspace-activity-event.v1.json
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
The stream contains run, block, attempt, origin, declared-edge, operation,
|
|
159
|
+
touch, artifact and warning data. Blueprint edges are explicit `sequence`, `parallel`, `gate` or
|
|
160
|
+
`handoff` relations; older journals without declared edges receive a
|
|
161
|
+
deterministic sequential projection for compatibility.
|
|
162
|
+
Stable semantic block IDs describe architecture stages rather than source line
|
|
163
|
+
numbers or function names.
|
|
164
|
+
|
|
165
|
+
Activity is not evidence or authorization:
|
|
166
|
+
|
|
167
|
+
- progress does not prove a result;
|
|
168
|
+
- an exit code does not verify an engineering outcome;
|
|
169
|
+
- a planned touch is not an observed effect;
|
|
170
|
+
- the Activity journal is not the Evidence or Decision Ledger.
|
|
171
|
+
|
|
172
|
+
Canonical domain artifacts and receipts remain owned by Model, Graph, Doctor,
|
|
173
|
+
Security, Decisions and their existing contracts.
|
|
174
|
+
|
|
175
|
+
## Privacy and retention
|
|
176
|
+
|
|
177
|
+
- sensitive command options and metadata keys are redacted before persistence;
|
|
178
|
+
- absolute paths are converted to project-relative locators when possible;
|
|
179
|
+
- external targets expose only an `<external>/<basename>` locator;
|
|
180
|
+
- environment variables, file contents and raw subprocess output are not stored;
|
|
181
|
+
- the runtime retains at most 200 journals and 14 days per channel by default,
|
|
182
|
+
even when no monitor is open;
|
|
183
|
+
- replay applies bounded per-journal read windows, a 20,000-event scoped ceiling
|
|
184
|
+
and a 50,000-event global ceiling so corrupt or oversized history cannot grow
|
|
185
|
+
monitor memory without limit;
|
|
186
|
+
- state directories and journals are created with user-only permissions where
|
|
187
|
+
the platform supports POSIX modes.
|
|
188
|
+
|
|
189
|
+
## Current limitations
|
|
190
|
+
|
|
191
|
+
- live transport uses bounded journal polling rather than an IPC broker;
|
|
192
|
+
- the local web/SSE renderer is planned but not implemented;
|
|
193
|
+
- arbitrary shell commands require a future explicit wrapper or SDK for
|
|
194
|
+
semantic block attribution;
|
|
195
|
+
- full filesystem reconciliation and syscall-level deep tracing are not part of
|
|
196
|
+
the default profile.
|
|
197
|
+
|
|
198
|
+
The future package boundary and extraction gates are documented in
|
|
199
|
+
`Docs/npm/Packages/ACTIVITY_PLANE_EXTRACTION_PLAN.md`.
|
|
@@ -88,7 +88,7 @@ versioned archive operation result instead.
|
|
|
88
88
|
|
|
89
89
|
Workspace creation publishes the initial contract, canonical model, Knowledge
|
|
90
90
|
Graph, structural baseline, context, report index, profile-aware `README.md`,
|
|
91
|
-
`AGENTS.md`, operational skills, and supported IDE/agent surfaces—even before
|
|
91
|
+
`AGENTS.md`, applicable operational skills, and supported IDE/agent surfaces—even before
|
|
92
92
|
the first project exists. The README's Workspai-managed section shows the
|
|
93
93
|
current profile, project count, canonical intelligence loop, and consumer entry
|
|
94
94
|
points while preserving user-authored content. Successful project creation,
|
|
@@ -97,6 +97,14 @@ projections in the background. The structural baseline is created once and
|
|
|
97
97
|
preserved; current model, graph, diff, impact, context, README, and project
|
|
98
98
|
grounding move forward with workspace membership.
|
|
99
99
|
|
|
100
|
+
Operational Skill generation is evidence-driven. Release readiness remains
|
|
101
|
+
available at workspace scope, while API, schema, dependency, contract, runtime,
|
|
102
|
+
test, delivery, and polyglot playbooks are emitted only for matching projects.
|
|
103
|
+
`.workspai/reports/workspace-skills-index.json` records both generated and
|
|
104
|
+
suppressed candidates, including the signals behind each decision. This keeps
|
|
105
|
+
agent discovery useful without claiming capabilities the repository does not
|
|
106
|
+
have.
|
|
107
|
+
|
|
100
108
|
Doctor, Analyze, Readiness, and Verify remain explicit checks because they may
|
|
101
109
|
run project tools or enforce release policy. Use `workspace intelligence run`
|
|
102
110
|
when you want that governed decision chain, rather than only lifecycle sync.
|
|
@@ -122,21 +130,30 @@ Workspai returns a specific error for an invalid explicit workspace, malformed
|
|
|
122
130
|
or stale link, ambiguous registration, or an unlinked project. It never picks
|
|
123
131
|
one workspace silently when ownership is ambiguous.
|
|
124
132
|
|
|
125
|
-
The project receives
|
|
133
|
+
The project receives seven complementary surfaces. They are different views of
|
|
134
|
+
one canonical workspace binding, not seven copies of the model or graph:
|
|
126
135
|
|
|
127
|
-
| File
|
|
128
|
-
|
|
|
129
|
-
| `.workspai/workspace-link.local.json`
|
|
130
|
-
| `.workspai/agent-entry.v1.json`
|
|
131
|
-
| `.workspai/reports/project-context-agent.json`
|
|
132
|
-
| `.workspai/
|
|
133
|
-
|
|
|
136
|
+
| File | Purpose | Portable |
|
|
137
|
+
| ---------------------------------------------------------- | ------------------------------------------------------------------------------ | --------------------- |
|
|
138
|
+
| `.workspai/workspace-link.local.json` | Machine-local canonical workspace binding | No; always gitignored |
|
|
139
|
+
| `.workspai/agent-entry.v1.json` | Versioned host coverage, read order, authority boundaries, and integrity proof | Yes |
|
|
140
|
+
| `.workspai/reports/project-context-agent.json` | Bounded project view of model, graph, proofs, diagnostics, and safe commands | Yes |
|
|
141
|
+
| `.workspai/reports/project-knowledge-graph-reference.json` | Integrity-bound locator for the canonical project graph projection | Yes |
|
|
142
|
+
| `.workspai/PROJECT-GROUNDING.md` | Human- and agent-readable project entry guide | Yes |
|
|
143
|
+
| `.agents/skills/workspai-*/SKILL.md` | Native project Skill wrappers for canonical workspace playbooks | Yes |
|
|
144
|
+
| `AGENTS.md` and host adapters | Route supported hosts to the same canonical-first bootstrap | Yes |
|
|
134
145
|
|
|
135
146
|
The bounded context includes project identity and commands, dependencies and
|
|
136
147
|
dependents, related API/deployment/test surfaces, current project findings,
|
|
137
148
|
portable proof locators, and model/graph freshness. It deliberately references
|
|
138
149
|
rather than duplicates workspace-wide evidence.
|
|
139
150
|
|
|
151
|
+
Representative graph entities are selected with a stratified round-robin
|
|
152
|
+
budget, so a large early-sorted kind cannot hide later architectural kinds.
|
|
153
|
+
`intelligence.projection` records the entity and byte budgets, selected and
|
|
154
|
+
omitted counts per kind, and the scoped graph-search command for retrieving
|
|
155
|
+
anything outside the lens. Aggregate counts in the lens remain exhaustive.
|
|
156
|
+
|
|
140
157
|
Use `--project-grounding managed` (default) to publish all portable surfaces,
|
|
141
158
|
`local` to keep the project lens and grounding gitignored without managing
|
|
142
159
|
`AGENTS.md`, or `off` to disable project grounding for that operation. The
|
|
@@ -226,6 +243,28 @@ npx workspai workspace contract graph --output ./contract-graph.json --json
|
|
|
226
243
|
|
|
227
244
|
Contract file: `.workspai/workspace.contract.json`. Verification checks schema, duplicate slugs, port collisions, and unknown dependencies.
|
|
228
245
|
|
|
246
|
+
Project entries may also declare governance that lives outside the repository:
|
|
247
|
+
|
|
248
|
+
```json
|
|
249
|
+
{
|
|
250
|
+
"slug": "api",
|
|
251
|
+
"relativePath": "services/api",
|
|
252
|
+
"governance": {
|
|
253
|
+
"ci": { "mode": "external", "provider": "Prow", "reference": "platform/test-infra" },
|
|
254
|
+
"release": { "mode": "external", "provider": "Release Engineering" },
|
|
255
|
+
"ownership": { "mode": "repository" }
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Workspai reconciles each control as `repository`, `external-declared`,
|
|
261
|
+
`external-observed`, or `unknown`. Analyze does not misreport an explicitly
|
|
262
|
+
external control as a missing repository file. Observed-but-undeclared external
|
|
263
|
+
governance stays advisory until the canonical contract names its authority.
|
|
264
|
+
The resolved profile is emitted by the Workspace Model, project lens, agent
|
|
265
|
+
context, facts, and project graph attributes so every consumer sees the same
|
|
266
|
+
truth.
|
|
267
|
+
|
|
229
268
|
`workspace contract graph --json` preserves its original `nodes`, `edges`, and
|
|
230
269
|
summary fields for existing consumers, and now adds an evidence-backed
|
|
231
270
|
`dependencyGraph` using the public `workspace-dependency-graph.v1` contract. It
|
|
@@ -395,6 +434,12 @@ Artifacts:
|
|
|
395
434
|
| `workspace run` | Workspace orchestrator | Fleet stage execution |
|
|
396
435
|
| `infra` | Workspace sidecar | Contract-driven local dependencies |
|
|
397
436
|
|
|
437
|
+
The readiness `env` gate only treats runtimes represented in
|
|
438
|
+
`.workspai/toolchain.lock` as pinned. A Workspai Node pin does not prove a
|
|
439
|
+
native C/C++ compiler or another unrepresented project toolchain; those scopes
|
|
440
|
+
remain `warn` until the project build contract or organization CI policy
|
|
441
|
+
provides verifiable toolchain evidence.
|
|
442
|
+
|
|
398
443
|
The unified intelligence runner keeps `sync` and baseline resolution in a
|
|
399
444
|
separate two-entry execution envelope and emits exactly 11 canonical stages.
|
|
400
445
|
Exit `2` means the evidence gate blocked readiness after successful execution;
|
|
@@ -184,6 +184,23 @@ transaction. If a manifest, required executable, isolated environment, project-d
|
|
|
184
184
|
validation, or audit surface is unavailable, the engine returns `decision-required`; it never
|
|
185
185
|
hides the gap behind a model fallback.
|
|
186
186
|
|
|
187
|
+
The same capability contract publishes an executable qualification matrix over
|
|
188
|
+
adapter, scope, failure family, and recovery path. Every failure family has one
|
|
189
|
+
bounded terminal policy: refresh stale/missing evidence, replan no-op/source
|
|
190
|
+
drift/producer failures, require a toolchain decision, rollback failed
|
|
191
|
+
validation, durably resume provider outages or interrupted rollback, and route
|
|
192
|
+
unsupported runtimes to manual repair. Contract generation fails if an adapter
|
|
193
|
+
omits reconcile/audit/test/build closure or a failure family has no recovery
|
|
194
|
+
policy. This matrix is consumed through:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
npx workspai workspace repair capabilities --json
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
It describes authority and deterministic recovery; conditional runtime support
|
|
201
|
+
remains conditional until Doctor proves the required executable and project
|
|
202
|
+
surface on the current machine.
|
|
203
|
+
|
|
187
204
|
## Consumer contract
|
|
188
205
|
|
|
189
206
|
The latest transaction is written to:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "workspai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.66.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": [
|
package/dist/analyze-NUGNB256.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{b as printAnalyzeReport,a as runAnalyze}from'./chunk-KV6PS54A.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{b as AUTOPILOT_RELEASE_ALIAS_FILENAME,a as AUTOPILOT_RELEASE_LAST_RUN_FILENAME,c as runAutopilotRelease}from'./chunk-KJXMLBSY.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{b as runDoctorCapabilities}from'./chunk-6TBTMWNA.js';
|
package/dist/chunk-2647BYBC.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import y from'fs';import u from'path';var b="polyglot-lifecycle-plan.v1",x=new Set([".git",".workspai",".rapidkit",".venv","bin","build","dist","node_modules","obj","target","third_party","vendor","fixture","fixtures","__fixtures__","testdata"]);function f(o,i){return u.relative(o,i).split(u.sep).join("/")||"."}function P(o,i){let t=[],s=(r,n)=>{if(n>i)return;let m=[];try{m=y.readdirSync(r,{withFileTypes:true});}catch{return}for(let d of m.sort((a,c)=>a.name.localeCompare(c.name))){let a=u.join(r,d.name);if(d.isDirectory()){x.has(d.name)||s(a,n+1);continue}d.isFile()&&(["package.json","pyproject.toml","go.mod","Cargo.toml","pom.xml","build.gradle","build.gradle.kts","CMakeLists.txt","meson.build"].includes(d.name)||/\.(?:cs|fs|vb)proj$/i.test(d.name))&&t.push(a);}};return s(o,0),t}function h(o,i){if(u.basename(i)!=="package.json")return false;let t=f(o,i).toLowerCase().split("/"),s=t.findIndex(r=>["test","tests","spec","specs","e2e","integration","integration-tests"].includes(r));return s<0?false:t.length-s>2}function e(o,i,t="high"){return {stage:o,command:i,confidence:t,preflight:"executable-and-inputs"}}function S(o,i){let t={};try{let n=JSON.parse(i);n.scripts&&typeof n.scripts=="object"&&!Array.isArray(n.scripts)&&(t=n.scripts);}catch{}let s=y.existsSync(u.join(o,"pnpm-lock.yaml"))?"pnpm":y.existsSync(u.join(o,"yarn.lock"))?"yarn":"npm",r=n=>`${s} run ${n}`;return [e("init",s==="yarn"?"yarn install":`${s} install`),...typeof t.test=="string"?[e("test",r("test"))]:[],...typeof t.build=="string"?[e("build",r("build"))]:[],...typeof t.start=="string"?[e("start",r("start"))]:[]]}function j(o,i){let t=u.basename(i),s=u.dirname(i),r=f(o,s),n=f(o,i),m=n.toLowerCase().split("/"),d=m.some(l=>["example","examples","sample","samples","worked"].includes(l))?"example":m.some(l=>["test","tests","e2e","integration","integration-tests"].includes(l))?"test":m.some(l=>["script","scripts","tool","tools","tooling"].includes(l))?"tooling":"production",a="";try{a=y.readFileSync(i,"utf8");}catch{return null}let c,g,p;if(t==="package.json")c="node",g="npm",p=S(s,a);else if(t==="pyproject.toml")c="python",g="python",p=[e("init","python -m pip install -e ."),...y.existsSync(u.join(s,"tests"))||/\[tool\.pytest/i.test(a)?[e("test","python -m pytest")]:[],.../\[build-system\]/.test(a)?[e("build","python -m build","medium")]:[]];else if(t==="go.mod")c="go",g="go",p=[e("init","go mod download"),e("test","go test ./..."),e("build","go build ./...")];else if(t==="Cargo.toml")c="rust",g="cargo",p=[e("init","cargo fetch"),e("test","cargo test"),e("build","cargo build"),...y.existsSync(u.join(s,"src","main.rs"))?[e("start","cargo run")]:[]];else if(t==="pom.xml"){c="java",g="maven";let l=y.existsSync(u.join(s,"mvnw"))?"./mvnw":"mvn";p=[e("init",`${l} dependency:go-offline`),e("test",`${l} test`),e("build",`${l} package`)];}else if(t==="build.gradle"||t==="build.gradle.kts"){c="java",g="gradle";let l=y.existsSync(u.join(s,"gradlew"))?"./gradlew":"gradle";p=[e("init",`${l} dependencies`),e("test",`${l} test`),e("build",`${l} build`)];}else if(/\.(?:cs|fs|vb)proj$/i.test(t)){c="dotnet",g="nuget";let l=d==="test"||/<IsTestProject>\s*true\s*<\/IsTestProject>/i.test(a)||/PackageReference\s+Include=["']Microsoft\.NET\.Test\.Sdk["']/i.test(a);p=[e("init",`dotnet restore ${t}`),...l?[e("test",`dotnet test ${t}`)]:[],e("build",`dotnet build ${t}`)];}else if(t==="CMakeLists.txt")c=/(?:\bcxx\b|\bcplusplus\b|\bc\+\+\b)/iu.test(a)?"cpp":"c",g="cmake",p=[e("init","cmake -S . -B build"),e("test","ctest --test-dir build --output-on-failure","medium"),e("build","cmake --build build")];else if(t==="meson.build")c=/(?:cpp|c\+\+)/iu.test(a)?"cpp":"c",g="meson",p=[e("init","meson setup build"),e("test","meson test -C build","medium"),e("build","meson compile -C build")];else return null;return {id:`${c}:${r}:${n}`,runtime:c,ecosystem:g,role:d,root:r,manifest:n,stages:p}}function R(o,i={}){let t=u.resolve(o),s=P(t,Math.max(0,Math.min(i.maxDepth??4,12))).filter(n=>!h(t,n)).map(n=>j(t,n)).filter(n=>!!n).filter(n=>i.includeExamples===true||n.role!=="example").sort((n,m)=>n.runtime.localeCompare(m.runtime)||n.root.localeCompare(m.root)||n.manifest.localeCompare(m.manifest)),r=[...new Set(s.map(n=>n.runtime))].sort();return {schemaVersion:b,projectRoot:".",polyglot:r.length>1,runtimes:r,units:s}}export{R as a};
|
package/dist/chunk-27UR373Z.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-GR6442P7.js';import {j,a,b as b$1,t}from'./chunk-MOSXTVPU.js';import {promises}from'fs';import c from'path';var v=new Set(["node_modules","dist","build","target","coverage","htmlcov",".workspai",".rapidkit",".venv"]);function b(t,r){if(r.has(t)||a$1(t))return true;let i=t.toLowerCase();return !!(i==="dist"||i.startsWith("dist-")||i.startsWith("dist_")||i==="build"||i.startsWith("build-")||i.startsWith("build_"))}async function D(t){try{return await promises.access(t),true}catch{return false}}async function w(t$1){for(let r of t(t$1,"context.json"))if(await D(r))return true;for(let r of t(t$1,"project.json"))if(await D(r))return true;return false}async function M(t,r){let i=[],o=[c.resolve(t)],u=new Set,P=r?.skipDirs??v,g=r?.includeHiddenDirs===true,y=r?.descendIntoMatchedProjects!==false,j$1=r?.isProjectDir??w,d=c.resolve(t);for(;o.length>0;){let e=o.shift();if(!e||u.has(e)||(u.add(e),e!==d&&j(e))||await j$1(e,d)&&(i.push(e),!y))continue;let s=[];try{s=await promises.readdir(e,{withFileTypes:true});}catch{continue}for(let n of s)n.isDirectory()&&(!g&&n.name.startsWith(".")||b(n.name,P)||n.name===a||n.name===b$1||o.push(c.join(e,n.name)));}return i.sort((e,s)=>e.localeCompare(s))}export{M as a};
|
package/dist/chunk-2VJUAKMS.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {b as b$1}from'./chunk-B6FJ6RG6.js';import {k,q}from'./chunk-GQSRNUCU.js';import {c,i}from'./chunk-J7RU5WR5.js';import {a}from'./chunk-T5YRFRJV.js';import {j as j$2}from'./chunk-XKDR5BGS.js';import {e,f as f$1}from'./chunk-X6TNBARH.js';import {b}from'./chunk-UJXE4UAX.js';import {l,s,j as j$1,t,k as k$2}from'./chunk-MOSXTVPU.js';import ce,{promises}from'fs';import c$1 from'path';import T,{homedir}from'os';import {pathToFileURL}from'url';import m from'process';import k$1 from'fs-extra';function z(o){let t=o.label.indexOf(" \u2014 ");return t>=0?o.label.slice(t+3).trim():o.label.trim()}function Q(){let o=c().map(n=>({value:n.id,label:`${K(n.category)} \xB7 ${z(n)}`,hint:`${n.runtime} \xB7 tested baseline`,name:n.label})),e=k().map(n=>({value:n.kitId,label:`Frontend \xB7 ${n.displayName}`,hint:"official \xB7 latest stable",name:`${n.displayName} \u2014 ${n.framework}`})),t=q().map(n=>({value:n.kitId,label:`${K(n.category)} \xB7 ${n.displayName}`,hint:`${n.runtimeCandidates.join(" + ")} \xB7 official latest stable`,name:`${n.displayName} \u2014 ${n.category}`})),i=[...o,...e,...t].sort((n,r)=>{let s=["Backend","Frontend","Desktop","Extension"],a=n.label?.split(" \xB7 ")[0]??"",l=r.label?.split(" \xB7 ")[0]??"";return s.indexOf(a)-s.indexOf(l)||(n.label??"").localeCompare(r.label??"")});return D(i),i}function K(o){return o.charAt(0).toUpperCase()+o.slice(1)}function D(o){let e=new Set,t=new Set;for(let i of o){let n=i.label??i.name??String(i.value),r=String(i.value);if(e.has(n))throw new Error(`Duplicate kit picker label: ${n}`);if(t.has(r))throw new Error(`Duplicate kit picker value: ${r}`);e.add(n),t.add(r);}}var Z=".workspairc.json",ee=".rapidkitrc.json",oe=["workspai.config.js","workspai.config.mjs","workspai.config.cjs","rapidkit.config.js","rapidkit.config.mjs","rapidkit.config.cjs"],te=["workspai.config.json","rapidkit.config.json"];function U(o){return typeof o=="object"&&o!==null&&"code"in o&&o.code==="ENOENT"}function R(o,e){let t=e instanceof Error?e.message:String(e),i=o.endsWith(".js")&&/module is not defined in ES module scope/i.test(t)?' CommonJS syntax in a .js config is not valid when the project package uses "type": "module"; rename the file to .cjs or use export default.':"";return `Failed to load Workspai config at ${o}.${i} Cause: ${t}`}async function Qe(){for(let o of [c$1.join(T.homedir(),Z),c$1.join(T.homedir(),ee)])try{let e$1=await promises.readFile(o,"utf-8"),t=JSON.parse(e$1);return e.debug(`Loaded config from ${o}`),t}catch{}return e.debug("No user config found, using defaults"),{}}async function Xe(o=process.cwd(),e$1={}){let t=o,i=c$1.parse(t).root;for(;t!==i;){for(let n of te){let r=c$1.join(t,n);try{let s=await promises.readFile(r,"utf-8"),a=JSON.parse(s);if(!a||typeof a!="object"||Array.isArray(a))throw new Error("configuration root must be a JSON object");return e.debug(`Loaded data-only Workspai config from ${n}`),a}catch(s){if(U(s))continue;throw new Error(R(r,s))}}for(let n of oe){let r=c$1.join(t,n);try{await promises.access(r);}catch(s){if(U(s))continue;throw new Error(R(r,s))}if(e.debug(`Found config file: ${r}`),!e$1.trustExecutableConfig)throw new Error(`Refusing to execute Workspai config at ${r} without explicit trust. Use a data-only workspai.config.json file, pass --trust-config, or set WORKSPAI_TRUST_CONFIG=1.`);try{let a=await import(pathToFileURL(r).href),l=a.default||a;return e.debug(`Loaded Workspai config from ${n}`),l}catch(s){throw new Error(R(r,s))}}t=c$1.dirname(t);}return e.debug("No Workspai config file found, using defaults"),{}}function Ze(o,e,t){return {author:t.author||e.workspace?.defaultAuthor||o.author,pythonVersion:t.pythonVersion||e.workspace?.pythonVersion||o.pythonVersion,defaultInstallMethod:t.defaultInstallMethod||e.workspace?.installMethod||o.defaultInstallMethod,defaultKit:t.defaultKit||e.projects?.defaultKit||o.defaultKit,skipGit:t.skipGit??e.projects?.skipGit??o.skipGit,license:t.license||o.license,testRapidKitPath:t.testRapidKitPath||o.testRapidKitPath}}function eo(o){return f$1("DEV_PATH")||o.testRapidKitPath||void 0}var x=class extends Error{constructor(t,i){super(["Workspai workspaces cannot be nested.",`Target: ${t}`,`Containing workspace: ${i}`,"Choose Managed home or pass --output <path> with a location outside the current workspace."].join(`
|
|
2
|
-
`));this.targetPath=t;this.containingWorkspacePath=i;this.name="NestedWorkspaceCreationError";}targetPath;containingWorkspacePath;code="WORKSPACE_NESTING_NOT_SUPPORTED"};async function ie(o){try{return !!await k$1.stat(o)}catch{return false}}function re(o,e){let t=o.indexOf(e);if(t>=0&&t+1<o.length)return o[t+1];let i=o.find(n=>n.startsWith(`${e}=`));if(i)return i.slice(e.length+1)}function se(o){return o.includes("--here")}async function G(o){let e=c$1.resolve(o);for(;;){let t=[c$1.join(e,".workspai-workspace"),c$1.join(e,".rapidkit-workspace"),c$1.join(e,".workspai","workspace.json"),c$1.join(e,".rapidkit","workspace.json")];if((await Promise.all(t.map(ie))).some(Boolean))return e;let i=c$1.dirname(e);if(i===e)return;e=i;}}async function po(o){let e=c$1.resolve(o),t=await G(c$1.dirname(e));if(t)throw new x(e,t)}async function ae(o,e=homedir()){let i=[{value:"managed",label:"Managed home",hint:k$2(e)}];return await G(o)||i.push({value:"here",label:"Current directory",hint:o}),i}function J(o,e=m.cwd()){if(se(o))return c$1.resolve(e);let t=re(o,"--output");if(t)return c$1.resolve(t)}function uo(o,e=m.cwd()){let t=c$1.resolve(o),i=c$1.resolve(e),n=c$1.relative(i,t);return n.length>0&&!n.startsWith("..")&&!c$1.isAbsolute(n)?`cd ${n}`:`cd ${t}`}function mo(o,e={}){let t=e.argv??[],i=e.outputParent??J(t,m.cwd());return l(o.trim(),{homeDir:e.homeDir,outputDir:i})}function fo(o,e,t={}){return o?c$1.resolve(o)===c$1.resolve(e)?true:t.outputParent===void 0:false}async function go(o,e={}){let t=e.cwd??m.cwd(),i=e.homeDir??homedir(),n=J(o,t);if(n!==void 0)return n;let r=e.hasYes??(o.includes("--yes")||o.includes("-y"));if(!(e.interactive??(!r&&!!m.stdin.isTTY&&!b())))return;let a=await ae(t,i);if(a.length===1)return;let{location:l}=await b$1([{type:"rawlist",name:"location",message:"Where should the workspace be created?",choices:a,default:0}]);if(l==="here")return c$1.resolve(t)}var pe=["minimal","python-only","node-only","go-only","java-only","dotnet-only","polyglot","enterprise"],de=new Set(["minimal","node-only","go-only","java-only","dotnet-only"]),xo=new Set(["python-only","polyglot","enterprise"]);function ue(o){return typeof o=="string"&&pe.includes(o)}function jo(o){return ue(o)&&de.has(o)}var Y={"python-only":"python","node-only":"node","go-only":"go","java-only":"java","dotnet-only":"dotnet"},me={python:"Python",node:"Node",go:"Go",java:"Java",dotnet:".NET",php:"PHP",ruby:"Ruby",rust:"Rust",elixir:"Elixir",clojure:"Clojure",scala:"Scala",kotlin:"Kotlin",deno:"Deno",bun:"Bun",c:"C",cpp:"C++",unknown:"Unknown"},fe={python:"python-only",node:"node-only",go:"go-only",java:"java-only",dotnet:"dotnet-only"},V=["node","deno","bun","python","go","java","kotlin","scala","dotnet","php","ruby","rust","elixir","clojure","c","cpp","unknown"];function j(o){return o==="bun"||o==="deno"?"node":o==="kotlin"||o==="scala"?"java":o}function E(o){return typeof o!="string"||o.trim().length===0?"minimal":o.trim().toLowerCase()}function f(o){if(typeof o!="string")return "unknown";let e=o.trim().toLowerCase();return e==="python"||e==="node"||e==="go"||e==="java"||e==="dotnet"||e==="php"||e==="ruby"||e==="rust"||e==="elixir"||e==="clojure"||e==="scala"||e==="kotlin"||e==="deno"||e==="bun"||e==="c"||e==="cpp"?e:e==="c++"||e==="cplusplus"||e==="cc"||e==="clang++"||e==="g++"?"cpp":e==="clang"||e==="gcc"?"c":"unknown"}function P(o){let e=new Set;for(let t of o)e.add(f(t));return [...e].sort((t,i)=>V.indexOf(t)-V.indexOf(i))}function ge(o){let e=P(o).filter(t=>t!=="unknown");if(e.length!==0)return e.length===1?fe[e[0]]:"polyglot"}function H(o,e={}){return `npx workspai bootstrap --profile ${o}${e.ci?" --ci --json":""}`}function ke(o,e){return o?"none":e==="strict"?"error":"warning"}function g(o){let e=o.ok?void 0:ge(o.runtimes)??"polyglot";return {ok:o.ok,checkId:o.checkId,status:o.ok?"passed":"failed",profile:o.profile,runtimes:o.runtimes,message:o.message,recommendedProfile:e,recommendedCommand:e?H(e):void 0,ciRecommendedCommand:e?H(e,{ci:true}):void 0,severity:ke(o.ok,o.mode)}}function Eo(o){let e=E(o.profile),t=P(o.runtimes),i=o.mode??"warn",n=Y[e];if(n){let r=t.length===0||t.every(s=>j(s)===n);return g({ok:r,checkId:`profile.${e}`,profile:e,runtimes:t,message:r?`${e} profile validated for discovered projects.`:`${e} profile mismatch: detected runtimes [${t.join(", ")}].`,mode:i})}if(e==="minimal"){let r=t.filter(l=>l!=="unknown"),a=new Set(r.map(l=>j(l))).size<=1;return g({ok:a,checkId:"profile.minimal",profile:e,runtimes:t,message:a?"minimal profile is compatible with detected runtime mix.":`minimal profile mismatch: multiple runtimes detected [${r.join(", ")}].`,mode:i})}return g({ok:true,checkId:`profile.${e}`,profile:e,runtimes:t,message:`${e} profile accepts the detected runtime mix.`,mode:i})}function vo(o){let e=E(o.profile),t=f(o.runtime),i=o.mode??"warn",n=Y[e];if(!n||t==="unknown")return g({ok:true,checkId:`profile.${e}`,profile:e,runtimes:[t],message:t==="unknown"?`Project "${o.subjectLabel}" runtime is unknown; profile compatibility will be checked by workspace doctor.`:`${e} profile accepts project "${o.subjectLabel}".`,mode:i});let r=j(t)===n;return g({ok:r,checkId:`profile.${e}`,profile:e,runtimes:r?[t]:P([n,t]),message:r?`Project "${o.subjectLabel}" is compatible with workspace profile "${e}".`:`Project "${o.subjectLabel}" is ${me[t]}, but workspace profile is "${e}".`,mode:i})}async function Fo(o){let e=(await Promise.all(s(o,"policies.yml").map(async t=>await k$1.pathExists(t)?t:null))).find(t=>typeof t=="string");if(!e)return "warn";try{return (await k$1.readFile(e,"utf-8")).match(/^\s*mode:\s*(warn|strict)\s*(?:#.*)?$/m)?.[1]==="strict"?"strict":"warn"}catch{return "warn"}}async function Io(o){let e=(await Promise.all(s(o,"workspace.json").map(async t=>await k$1.pathExists(t)?t:null))).find(t=>typeof t=="string");if(!e)return "minimal";try{let t=await k$1.readJson(e);return E(t.profile)}catch{return "minimal"}}async function $o(o,e={}){let t$1=new Set,i$1=[],n=new Set,r=[o];for(;r.length>0;){let s=r.pop();if(!s||n.has(s))continue;n.add(s);let a=[];try{a=await ce.promises.readdir(s,{withFileTypes:true});}catch{continue}for(let l of a){if(!l.isDirectory()||l.name.startsWith(".")||["node_modules","dist","build","target","coverage","htmlcov"].includes(l.name))continue;let p=c$1.join(s,l.name);if(p!==o&&j$1(p))continue;if((await Promise.all([...t(p,"context.json"),...t(p,"project.json")].map(async q=>k$1.pathExists(q)))).some(Boolean)){i$1.push(p);continue}r.push(p);}}for(let s of i$1){let a=i(s);t$1.add(f(j$2(s,a).runtime));}for(let s of await a(o))t$1.add(f(s.runtime));for(let s of e.additionalRuntimes??[])t$1.add(f(s));return P(t$1)}function Ao(o,e={}){let t=e.ci?o.ciRecommendedCommand:o.recommendedCommand;return t?`Recommended: ${t}`:null}export{Q as a,Qe as b,Xe as c,Ze as d,eo as e,po as f,uo as g,mo as h,fo as i,go as j,xo as k,jo as l,Eo as m,vo as n,Fo as o,Io as p,$o as q,Ao as r};
|
package/dist/chunk-3A23KJAQ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {b,c,d as d$1}from'./chunk-ZGS5NKEO.js';import {c as c$2}from'./chunk-W6FHVXNL.js';import {a as a$4}from'./chunk-X7FYEKLI.js';import {c as c$1,d as d$4}from'./chunk-HCFWT42C.js';import {a as a$1,b as b$1}from'./chunk-PYCJWW4B.js';import {p as p$1,a,o,g,d as d$3,f as f$1}from'./chunk-CT4IODPG.js';import {p,l,f as f$2}from'./chunk-CJHWKXDN.js';import {d}from'./chunk-EWZZUQBR.js';import {a as a$2}from'./chunk-Q2WF7D5U.js';import {d as d$2,e as e$1}from'./chunk-CCDGHPEJ.js';import {a as a$3}from'./chunk-AFIFZTOY.js';import {f,e,i,g as g$1,h}from'./chunk-NZ3WZYD5.js';import m from'path';import v from'fs-extra';var fe="rapidkit-blocker-resolution-v1";function pe(e){let t=e.blockers.map(s=>s.trim()).filter(Boolean).slice(0,12),r=e.stderrTail?.trim().slice(-400)??"";return f$2({blockers:t,exitCode:e.exitCode??null,stderrTail:r})}function we(e){let t=e.trim().toLowerCase();return t?t.includes("missing evidence")||t.includes(": missing")||t.includes("artifact missing")||t.includes("not found on disk")?"artifact-missing":t.includes("policy.")||t.includes("contract")?"config-fixable":t.includes("impact")||t.includes("untracked")||t.includes("grounding")?"semantic-attention":t.includes("failed")||t.includes("blocked")||t.includes(": fail")?"command-failed-repeat":"config-fixable":"unresolvable-without-human"}function me(e){let t=we(e.reason),r=pe({blockers:[e.reason]}),s=t==="artifact-missing"?[{actionKind:"run-once",detail:e.sourceCommand?`Run the source command once: ${e.sourceCommand}`:"Run the mapped workspace intelligence command once to generate the missing artifact.",...e.sourceCommand?{}:{studioActionId:"run-analyze"}}]:t==="semantic-attention"?[{actionKind:"commit-files",detail:"Review workspace-level grounding files (AGENTS.md, agent-sync outputs) and commit or refresh the impact baseline."},{actionKind:"refresh-baseline",detail:"Refresh snapshot + diff + impact before re-running verify."}]:[{actionKind:"edit-file",detail:"Apply the smallest safe file or policy fix for this blocker before re-running verification.",studioActionId:"fix-lens"}];return {schemaVersion:fe,blockerId:e.blockerId,sourceCommand:e.sourceCommand,sourceArtifact:e.sourceArtifact,resolutionClass:t,blockerSignature:r,commandRetryHint:t==="artifact-missing"?e.sourceCommand?`Run the source command once: ${e.sourceCommand}, then verify.`:"Run the source command once, then verify.":"Do not re-run the same failing command; fix the source issue first, then verify.",fixHints:s,verifyCommand:e.verifyCommand,verifyArtifact:e.verifyArtifact}}function Re(e){let t=e.toLowerCase();return t.includes("stale")||t.includes("missing evidence")||t.includes("no projects")||t.includes("projects.empty")||t.includes("projects discovered")||t.includes("projects.missing")||t.includes("not yet run")||t.includes("doctor-last-run")||t.includes("doctor-project-last-run")||t.includes("doctor-remediation-plan-last-run")||t.includes("doctor-fix-result-last-run")||t.includes("pipeline-last-run")||t.includes("release-readiness")||t.includes("analyze-last-run")||t.includes("analyze reported")||t.includes("analyze verdict")||t.includes("analyze needs attention")||t.includes("toolchain.lock")||t.includes("not pinned")||t.includes("readiness:")||t.includes("env:")||t.includes("workspace-run-last")||t.includes("pre-project")||t.includes("before adding projects")||t.includes("workspace.projects.missing")||t.includes("no backend projects")||t.includes("index.json")||t.includes("workspace-intelligence-history")||t.includes("validation warning")||t.includes("workspace model validation")||t.includes("workspace.marker")||t.includes("no project roots")||t.includes("no infrastructure services")||t.includes("infra/overrides")||t.includes("infra dependencies")||t.includes("contract verify")||t.includes("contract inspect")||t.includes("publish verify evidence")}function Ce(e){return e.length===0||e.every(t=>Re(t))}function ge(e){return e.projectCount>0||e.policyErrorCount>0?{verdict:e.verdict,exitCode:e.exitCode}:e.verdict==="blocked"&&Ce(e.blockingReasons)?{verdict:"needs-attention",exitCode:1}:{verdict:e.verdict,exitCode:e.exitCode}}function tt(e,t){let r=t&&t!=="ready"?` (${t.replace(/-/g," ")})`:"";return e===0?`Workspace scaffold ready${r} \u2014 add your first project to continue.`:`Workspace scaffold${r}: ${e} pre-project signal(s) \u2014 add your first project to continue.`}var ye=f.verify,G=e.verify;function Ae(e,t){return m.isAbsolute(t)?t:m.join(e,t)}async function ke(e){let t=await v.readJson(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error(`Workspace impact input is not a JSON object: ${e}`);let r=t;if(r.schemaVersion!==f$1)throw new Error(`Unsupported workspace impact schema: ${String(r.schemaVersion)}`);a$3(t,"contracts/workspace-intelligence/workspace-impact.v1.json",`Workspace impact ${e}`);let s=r;a$3(s.diff,"contracts/workspace-intelligence/workspace-model-diff.v1.json",`Embedded workspace diff in ${e}`);let i=[];s.summary.affectedProjects!==s.affectedProjects.length&&i.push("summary.affectedProjects does not match affectedProjects.length"),s.summary.workspaceItems!==s.workspaceImpact.length&&i.push("summary.workspaceItems does not match workspaceImpact.length"),s.summary.recommendedCommands!==s.verificationPlan.length&&i.push("summary.recommendedCommands does not match verificationPlan.length"),s.summary.blastRadius.directlyAffected!==s.affectedProjects.length&&i.push("blastRadius.directlyAffected does not match affectedProjects.length"),s.summary.blastRadius.transitivelyAffected!==s.transitiveImpact.length&&i.push("blastRadius.transitivelyAffected does not match transitiveImpact.length");let o=s.transitiveImpact.reduce((u,d)=>Math.max(u,d.distance??0),0);s.summary.blastRadius.maxDistance!==o&&i.push("blastRadius.maxDistance does not match transitive impact distances");let k=l(s.diff.currentModel)?.edges.length??0;if(s.summary.blastRadius.graphEdges!==k&&i.push("blastRadius.graphEdges does not match the embedded model graph"),s.summary.changed!==s.diff.summary.changed&&i.push("summary.changed does not match embedded diff summary"),s.fromRef!==s.diff.fromRef&&i.push("fromRef does not match embedded diff fromRef"),s.workspace.name!==s.diff.currentModel.workspace.name&&i.push("workspace.name does not match the embedded model"),s.diff.toHash!==d(s.diff.currentModel)&&i.push("embedded diff current-model hash does not match toHash"),i.length>0)throw new Error(`Workspace impact semantic integrity failed: ${i.join("; ")} (${e})`);return s}function Ee(e){let t=new Set,r=[];for(let s of e){let i=`${s.scope}:${s.project??""}:${s.display}`;t.has(i)||(t.add(i),r.push(s));}return r}function Se(e,t){if(!e||e==="workspace")return true;let r=(e.startsWith("project:")?e.slice(8):e).trim().toLowerCase();return t.scope==="workspace"?true:(t.project??"").trim().toLowerCase()===r}function We(e$1,t){if(e$1.id==="workspace.doctor")return m.join(t,e.doctor);if(e$1.id==="workspace.contract.verify")return m.join(t,e.contractVerify);if(e$1.id==="workspace.readiness")return m.join(t,e.readiness);if(e$1.id==="workspace.analyze")return m.join(t,".workspai","reports","analyze-last-run.json");if(e$1.id==="workspace.pipeline")return m.join(t,".workspai","reports","pipeline-last-run.json");if(e$1.id==="workspace.doctor-fix")return m.join(t,".workspai","reports","doctor-fix-result-last-run.json");if(e$1.id.startsWith("project.")&&e$1.id.includes("."))return m.join(t,".workspai","reports","workspace-run-last.json")}function C(e){return !e||typeof e!="object"||Array.isArray(e)?null:e}function je(e){if(!c$1(e,"workspace"))return {status:"fail",message:"Doctor evidence contract is missing or unsupported."};try{d$4(e);}catch(s){return {status:"fail",message:`Doctor evidence semantic validation failed: ${s instanceof Error?s.message:String(s)}`}}let t=a$4(e);return t.hasSystemErrors||t.blockingFindings>0?{status:"fail",message:`Doctor evidence reports ${t.blockingFindings} canonical blocking finding(s).`}:t.advisoryFindings+t.unknownFindings+t.contradictionCount+t.missingDiagnosisProjects>0||t.staleEvidence||t.unknownFreshness||t.minimumDiagnosisCompleteness<100?{status:"warn",message:`Doctor evidence needs attention (${t.advisoryFindings} advisory, ${t.unknownFindings} unknown, ${t.contradictionCount} contradictory; ${t.minimumDiagnosisCompleteness}% complete).`}:{status:"pass",message:"Canonical Doctor evidence is complete, fresh, and healthy."}}function xe(e){let t=typeof e.overallStatus=="string"?e.overallStatus:"unknown";return t==="fail"?{status:"fail",message:"Release readiness evidence reports blocking failures."}:t==="warn"?{status:"warn",message:"Release readiness evidence reports warnings."}:t==="pass"?{status:"pass",message:"Release readiness evidence passed."}:{status:"warn",message:`Release readiness evidence status is ${t}.`}}function Pe(e){let t=typeof e.status=="string"?e.status:"unknown";return t==="failed"||t==="fail"?{status:"fail",message:"Workspace contract verify evidence failed."}:t==="passed"||t==="pass"?{status:"pass",message:"Workspace contract verify evidence passed."}:{status:"warn",message:`Workspace contract verify evidence status is ${t}.`}}function Ie(e){let t=C(e.summary),r=typeof t?.verdict=="string"?t.verdict:void 0;return r==="blocked"?{status:"fail",message:"Analyze evidence reports blocking findings."}:r==="needs-attention"?{status:"warn",message:"Analyze evidence reports warnings."}:{status:"pass",message:"Analyze evidence is ready."}}function Ve(e){let t=e.schemaVersion===h.doctorFixResult.schemaVersion?e:e.fixResult;if(!t||typeof t!="object"||Array.isArray(t))return {status:"skipped",message:"Doctor fix result not present; run doctor workspace --fix --json to record fixes."};let r=t,s=Array.isArray(r.remainingBlockers)?r.remainingBlockers:[];if(s.length>0)return {status:"fail",message:`Doctor fix result reports ${s.length} remaining blocker(s).`};let i=Array.isArray(r.appliedFixes)?r.appliedFixes:[];return i.length===0?{status:"pass",message:"Doctor fix result recorded with no remaining blockers."}:{status:"pass",message:`Doctor fix result recorded ${i.length} applied fix(es) with no remaining blockers.`}}async function Fe(e,t){let r=await d$2(e,i.doctorRemediationPlan);if(!r)return false;try{let s=C(await v.readJson(r));if(!s||(Array.isArray(s.steps)?s.steps:[]).length>0)return false;let o=typeof s.generatedAt=="string"?s.generatedAt:void 0;if(!o||!t)return true;let k=Date.parse(o),u=Date.parse(t);return !Number.isFinite(k)||!Number.isFinite(u)?true:k>=u}catch{return false}}function $e(e){return e.id.endsWith(".init")?"init":e.id.endsWith(".test")?"test":e.id.endsWith(".build")?"build":e.id.endsWith(".start")?"start":null}function Oe(e){let t=C(e.summary),r=typeof t?.verdict=="string"?t.verdict:void 0;return r==="blocked"?{status:"fail",message:"Pipeline evidence is blocked."}:r==="needs-attention"?{status:"warn",message:"Pipeline evidence needs attention."}:r==="ready"?{status:"pass",message:"Pipeline evidence is ready."}:{status:"warn",message:"Pipeline evidence status is unknown."}}function De(e,t,r){let s=$e(t),i=c$2(e,s??void 0);if(!i)return {status:"missing",message:"Workspace run evidence is missing or unreadable."};let o=i.stage;if(s&&o!==s)return {status:"missing",message:`Workspace run evidence is for stage "${o}", expected "${s}".`};let k=Array.isArray(i.projects)?i.projects:[],u=t.project?.toLowerCase();if(!u)return {status:"missing",message:"Project-scoped workspace run evidence is missing a project identifier."};let d=k.find(g=>{let c=C(g);if(!c)return false;let n=typeof c.projectName=="string"?c.projectName.toLowerCase():"",a=["projectPath","relativePath","path"].map(f=>c[f]).filter(f=>typeof f=="string"&&f.trim().length>0).map(f=>f.replace(/\\/g,"/").toLowerCase());return n===u||a.some(f=>f.endsWith(`/${u}`)||f===u)});if(d){let g=R(i.generatedAt,r,`Workspace run evidence for ${t.project??t.id}`);if(g)return {status:"fail",message:g};let c=C(d),n=typeof c?.status=="string"?c.status:"unknown";return n==="failed"?{status:"fail",message:`Workspace run evidence failed for ${t.project}.`}:n==="passed"?{status:"pass",message:`Workspace run evidence passed for ${t.project}.`}:n==="skipped"?{status:"warn",message:`Workspace run evidence skipped for ${t.project}.`}:{status:"warn",message:`Workspace run evidence status is ${n} for ${t.project}.`}}return {status:"missing",message:`Workspace run evidence does not include project ${t.project}.`}}function R(e,t,r){if(!t)return null;if(typeof e!="string"||e.trim().length===0)return `${r} is stale: missing generatedAt timestamp (required after impact ${t}).`;let s=Date.parse(e),i=Date.parse(t);return Number.isFinite(s)?Number.isFinite(i)&&s<i?`${r} is stale: generated at ${e}, before impact ${t}.`:null:`${r} is stale: invalid generatedAt timestamp (required after impact ${t}).`}function Be(e){if(e.id==="workspace.doctor")return g$1.doctor;if(e.id==="workspace.readiness")return g$1.readiness;if(e.id==="workspace.contract.verify")return g$1.contractVerify;if(e.id==="workspace.analyze")return g$1.analyze;if(e.id==="workspace.pipeline")return "contracts/pipeline-last-run.v1.json"}async function _e(e,t,r,s){let i=We(e,t),o=i?m.relative(t,i).split(m.sep).join("/"):void 0;if(e.id==="workspace.contract.verify"&&!r)return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"skipped",required:e.required,message:"Workspace contract is not present; contract verify skipped."};let k=i?await d$2(t,o??""):null;if(!i||!k)return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"missing",required:e.required,evidencePath:o,message:o?`Missing evidence report: ${o}`:"No evidence mapping exists for this command."};let u;try{u=await v.readJson(k);}catch(n){return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"fail",required:e.required,evidencePath:o,message:`Evidence report is unreadable JSON: ${n instanceof Error?n.message:String(n)}`}}let d=C(u);if(!d)return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"fail",required:e.required,evidencePath:o,message:"Evidence report is not a JSON object."};let g=Be(e);if(g)try{a$3(d,g,`${e.label} evidence`);}catch(n){return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:"fail",required:e.required,evidencePath:o,message:`Evidence report is invalid: ${n instanceof Error?n.message:String(n)}`}}let c;if(e.id==="workspace.doctor"){let n=R(d.generatedAt,s,"Doctor evidence");n?c={status:"fail",message:n}:c=je(d);}else if(e.id==="workspace.readiness"){let n=R(d.generatedAt,s,"Release readiness evidence");n?c={status:"fail",message:n}:c=xe(d);}else if(e.id==="workspace.contract.verify"){let n=R(d.generatedAt,s,"Workspace contract verify evidence");n?c={status:"fail",message:n}:c=Pe(d);}else if(e.id==="workspace.analyze"){let n=R(d.generatedAt,s,"Analyze evidence");n?c={status:"fail",message:n}:c=Ie(d);}else if(e.id==="workspace.pipeline"){let n=R(d.generatedAt,s,"Pipeline evidence");n?c={status:"fail",message:n}:c=Oe(d);}else if(e.id==="workspace.doctor-fix"){let n=d.schemaVersion===h.doctorFixResult.schemaVersion?d:d.fixResult,a=C(n),f=typeof a?.generatedAt=="string"?a.generatedAt:void 0,y=R(f,s,"Doctor fix result");y?c={status:"fail",message:y}:await Fe(t,f)?c={status:"skipped",message:"No current doctor remediation steps are pending."}:c=Ve(d);}else if(e.id.startsWith("project."))c=De(d,e,s);else {let n=R(d.generatedAt,s,"Evidence report");n?c={status:"fail",message:n}:c={status:"pass",message:"Evidence report is present."};}return {id:e.id,label:e.label,scope:e.scope,project:e.project,command:e,status:c.status,required:e.required,evidencePath:o,message:c.message}}function Ne(e,t={blockingReasons:[],needsAttention:false}){let r=e.filter(n=>n.status==="pass").length,s=e.filter(n=>n.status==="warn").length,i=e.filter(n=>n.status==="fail").length,o=e.filter(n=>n.status==="missing").length,k=e.filter(n=>n.status==="skipped").length,u=e.filter(n=>n.required&&(n.status==="fail"||n.status==="missing")).map(n=>`${n.id}: ${n.message}`),d=e.filter(n=>n.required&&n.status==="missing").length,g="ready",c=0;return u.length>0||t.blockingReasons.length>0?(g="blocked",c=2):(s>0||e.some(n=>!n.required&&n.status==="fail")||d>0||t.needsAttention)&&(g="needs-attention",c=1),{verdict:g,exitCode:c,stepsPassed:r,stepsWarn:s,stepsFailed:i,stepsMissing:o,stepsSkipped:k}}function He(e,t){let r=x(e.affectedProjects.map(a=>a.project?.name).filter(a=>typeof a=="string")),s=new Set(r.map(a=>a.toLowerCase())),i=x(e.transitiveImpact.map(a=>a.project?.name).filter(a=>typeof a=="string").filter(a=>!s.has(a.toLowerCase()))),o=new Map;for(let a of t){if(a.scope!=="project"||!a.project)continue;let f=a.project.toLowerCase(),y=o.get(f)??[];y.push(a),o.set(f,y);}let k=[],u=[],d=[],g=[],c=false,n=(a,f)=>{let y=o.get(a.toLowerCase())??[];if(y.length===0){d.push(a);return}let P=y.filter(p=>p.status==="fail"),b=P.filter(p=>p.required),I=y.filter(p=>p.status==="missing"),E=I.filter(p=>p.required),V=y.some(p=>p.status==="pass"||p.status==="warn");if(b.length>0){u.push(a),g.push(`graph.subgraph.${a}: ${f} has failed verification evidence (${b.map(p=>p.id).join(", ")}).`);return}if(P.length>0){u.push(a),c=true;return}if(E.length>0){u.push(a),g.push(`graph.subgraph.${a}: ${f} has missing required verification evidence (${E.map(p=>p.id).join(", ")}).`);return}if(I.length>0){u.push(a),c=true;return}if(V){k.push(a);return}d.push(a);};for(let a of r)n(a,"directly-changed");for(let a of i)n(a,"transitive dependent");return {subgraph:{totalProjects:r.length+i.length,directlyChanged:r,transitiveDependents:i,covered:x(k),uncovered:x(u),unverifiable:x(d)},blockingReasons:g,needsAttention:c}}function x(e){return [...new Set(e)].sort((t,r)=>t.localeCompare(r))}async function Me(e$1){let t=m.resolve(e$1.workspacePath);if(e$1.fromImpactPath){let o=Ae(t,e$1.fromImpactPath);return {impact:await ke(o),fromImpactRef:m.relative(t,o).split(m.sep).join("/"),impactFromDisk:true}}let r=m.join(t,g);if(await v.pathExists(r))return {impact:await ke(r),fromImpactRef:g,impactFromDisk:true};let s=m.join(t,d$3);if(await v.pathExists(s))return {impact:await p$1({workspacePath:t,fromPath:d$3,scope:e$1.scope,includeAbsolutePaths:e$1.includeAbsolutePaths,includeEvidence:e$1.includeEvidence,observableScanDepth:e$1.observableScanDepth,now:e$1.now}),fromImpactRef:d$3,impactFromDisk:false};let i=await p({workspacePath:t,includeAbsolutePaths:e$1.includeAbsolutePaths,includeEvidence:e$1.includeEvidence,observableScanDepth:e$1.observableScanDepth,now:e$1.now});return {impact:{schemaVersion:f$1,generatedAt:(e$1.now??new Date).toISOString(),fromRef:"baseline",diffRef:e.diff,workspace:{name:i.workspace.name,profile:i.workspace.profile,type:i.workspace.type},summary:{changed:false,risk:"none",affectedProjects:0,workspaceItems:0,recommendedCommands:0,blastRadius:{directlyAffected:0,transitivelyAffected:0,maxDistance:0,graphEdges:l(i)?.edges.length??0}},affectedProjects:[],transitiveImpact:[],criticalPathHotspots:[],workspaceImpact:[],verificationPlan:[],agentBrief:{headline:"Baseline workspace verify run.",bullets:["No impact report or snapshot was available; baseline gates were evaluated."],unsafeAssumptions:["Do not claim runtime verification passed unless evidence exists."]},diff:{schemaVersion:f.diff,generatedAt:(e$1.now??new Date).toISOString(),fromRef:"baseline",toRef:e.model,fromHash:"baseline",toHash:"baseline",summary:{changed:false,addedProjects:0,removedProjects:0,changedProjects:0,workspaceChanges:0,validationChanges:0,gitChangedFiles:0},git:{available:false,dirty:false,changedFiles:0,untrackedFiles:0,deletedFiles:0},changes:[],currentModel:i}},impactFromDisk:false}}function Te(e,t){if(t)return e.generatedAt}async function bt(e){let t=m.resolve(e.workspacePath),{impact:r,fromImpactRef:s,impactFromDisk:i}=await Me(e),o$1=r.diff.currentModel,k=i?await p({workspacePath:t,includeAbsolutePaths:e.includeAbsolutePaths,includeEvidence:e.includeEvidence,observableScanDepth:e.observableScanDepth,now:e.now}):o$1,u=[];if(i){let l=await p$1({workspacePath:t,fromPath:r.diff.fromRef,diff:r.diff,scope:e.scope,now:e.now}),W=[r.affectedProjects,r.transitiveImpact,r.verificationPlan],A=[l.affectedProjects,l.transitiveImpact,l.verificationPlan];JSON.stringify(W)!==JSON.stringify(A)&&u.push("workspace.impact: Persisted impact semantics do not match the impact re-derived from the embedded diff. Regenerate diff and impact.");}i&&d(k)!==r.diff.toHash&&u.push("workspace.impact: Impact evidence is stale because the current workspace model no longer matches the embedded model. Regenerate diff and impact.");let d$2=r.diff.git;if(i&&d$2?.available){let l=a(t,{ref:d$2.ref}),W=r.diff.changes.filter(h=>h.type.startsWith("git.")).map(h=>`${h.type}:${h.target.replace(/^git:/,"")}`).sort(),A=[...l.changedFiles.map(h=>`git.file.changed:${h}`),...l.untrackedFiles.map(h=>`git.untracked:${h}`),...l.deletedFiles.map(h=>`git.deleted:${h}`)].sort();(!l.available||l.commit!==d$2.commit||JSON.stringify(A)!==JSON.stringify(W))&&u.push("workspace.impact: Impact evidence is stale because Git changes no longer match the diff observation. Regenerate diff and impact.");}let g=Te(r,i),c$1=Ee([...o(),...r.verificationPlan]).filter(l=>Se(e.scope,l)),n=[];for(let l of c$1)n.push(await _e(l,t,o$1.contracts.exists===true,g));let a$2=He(r,n),f=a$1(l(o$1)??{nodes:[],edges:[]}),y=b(o$1),P=await Ke(t),b$2=c(y,P?.freshness?.projectHashes),I={verdict:b$2.verdict,baseline:b$2.baseline,changed:b$2.changed,added:b$2.added,removed:b$2.removed,projectHashes:d$1(y)},E=b$1(f),V=o$1.policies?.mode??"warn",p$2=await Le(o$1,t),B=qe(V,p$2),S=Ne(n,{blockingReasons:[...a$2.blockingReasons,...E,...B.blockingReasons,...u],needsAttention:a$2.needsAttention||B.needsAttention}),he=n.filter(l=>l.status==="missing"&&l.evidencePath).map(l=>l.evidencePath),_=[...n.filter(l=>l.required&&(l.status==="fail"||l.status==="missing")).map(l=>`${l.id}: ${l.message}`),...a$2.blockingReasons,...E,...B.blockingReasons,...u],ve=p$2.filter(l=>l.severity==="error").length,be=o$1.summary?.projectCount??o$1.projects.length,U=ge({projectCount:be,verdict:S.verdict,exitCode:S.exitCode,blockingReasons:_,policyErrorCount:ve});S.verdict=U.verdict,S.exitCode=U.exitCode;let Y=Array.from(new Set(_.map(l=>l.trim()).filter(Boolean))).slice(0,12).map((l,W)=>{let A=n.find(h=>l.startsWith(`${h.id}:`));return me({reason:l,blockerId:`blocker-${W+1}`,sourceCommand:A?.command.display,sourceArtifact:A?.evidencePath,verifyCommand:"npx workspai workspace verify --from-impact .workspai/reports/workspace-impact-last-run.json --json",verifyArtifact:G})});return {schemaVersion:ye,generatedAt:(e.now??new Date).toISOString(),workspacePath:t,mode:"evidence",fromImpactRef:s,scope:e.scope,impact:{changed:r.summary.changed,risk:r.summary.risk,affectedProjects:r.summary.affectedProjects,recommendedCommands:r.summary.recommendedCommands},summary:S,steps:n,missingEvidence:he,blockingReasons:_,...Y.length>0?{resolutionHints:Y}:{},verificationPlan:c$1,affectedSubgraph:a$2.subgraph,graphIntegrity:f,freshness:I,policyMode:V,policyViolations:p$2}}async function Le(e$1,t){let r=[];for(let i of e$1.validation?.issues??[])r.push({source:"model",severity:i.severity,code:i.code,message:i.message,target:i.target});let s=await d$2(t,e.contractVerify);try{if(s&&await v.pathExists(s)){let i=await v.readJson(s);if(Array.isArray(i.violations))for(let o of i.violations)typeof o=="string"&&o.trim().length>0&&r.push({source:"contract",severity:"error",code:"contract.violation",message:o});}}catch{}return r.sort((i,o)=>i.source!==o.source?i.source.localeCompare(o.source):i.code!==o.code?i.code.localeCompare(o.code):i.message.localeCompare(o.message))}function qe(e,t){let r=t.filter(s=>s.severity==="error");return e==="enforce"&&r.length>0?{blockingReasons:r.map(s=>`policy.${s.code}: ${s.message}`),needsAttention:false}:{blockingReasons:[],needsAttention:r.length>0}}async function Ke(e){let t=m.join(e,G);try{if(!await v.pathExists(t))return null;let r=await v.readJson(t);return r&&r.schemaVersion===ye?r:null}catch{return null}}async function wt(e,t){return e$1(t,G,a$2(e))}function ze(e,t){let r=t?.strict?"strict":"default",s=[];if(e.summary.verdict==="blocked")return s.push(...e.blockingReasons),s.length===0&&s.push("verify verdict is blocked."),{passed:false,mode:r,exitCode:2,reasons:s};if(r==="strict"){if(e.summary.verdict!=="ready"&&s.push(`verify verdict is ${e.summary.verdict} (strict requires ready).`),e.freshness.verdict==="stale"){let i=[...e.freshness.changed,...e.freshness.added].slice(0,5);s.push(`freshness is stale${i.length>0?`: ${i.join(", ")}`:""} (strict requires fresh).`);}if(s.length>0)return {passed:false,mode:r,exitCode:1,reasons:s}}return {passed:true,mode:r,exitCode:0,reasons:s}}function Rt(e,t){return ze(e,t).exitCode}export{fe as a,tt as b,ye as c,G as d,He as e,bt as f,wt as g,ze as h,Rt as i};
|
package/dist/chunk-4PUJVYRM.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var Z="workspace-knowledge-search.v1";function b(e){return e.trim().toLowerCase()}var F=new WeakMap;function A(e){let t=F.get(e);if(t)return t;let o=new Map(e.relations.map(s=>[s.id,s])),a=new Map(e.entities.map(s=>[s.id,s])),l=new Map(e.proofs.map(s=>[s.id,s])),r=new Map,d=new Map,u=(s,p)=>{let g=d.get(s)??[];g.push(p),d.set(s,g);};for(let s of e.entities){let p=[s.id,s.label,s.identity.key,...s.kind==="project"&&s.projectId?[s.projectId]:[],...s.identity.aliases];for(let g of new Set(p.map(b))){let y=r.get(g)??[];y.push(s),r.set(g,y);}}for(let s of e.relations)u(s.from,{from:s.from,to:s.to,relationId:s.id,kind:s.kind,direction:"forward",proofIds:s.proofIds}),u(s.to,{from:s.to,to:s.from,relationId:s.id,kind:s.kind,direction:"reverse",proofIds:s.proofIds});for(let s of r.values())s.sort((p,g)=>p.id.localeCompare(g.id));for(let s of d.values())s.sort((p,g)=>p.to.localeCompare(g.to)||p.relationId.localeCompare(g.relationId));let c={entitiesById:a,relationsById:o,entitiesByAlias:r,proofsById:l,adjacency:d};return F.set(e,c),c}function O(e,t){let o=A(e),a=o.relationsById.get(t);if(a)return {found:true,targetType:"relation",relation:a};let l=b(t),r=o.entitiesByAlias.get(l)??[];return r.length===1?{found:true,targetType:"entity",entity:r[0]}:{found:false,query:t,candidates:r.map(d=>d.id).sort()}}function fe(e,t){let o=O(e,t);if(!o.found)return {query:t,found:false,target:null,proofs:[],candidates:o.candidates};let a=o.targetType==="entity"?o.entity:o.relation,l=new Set(a.proofIds);return {query:t,found:true,target:a,candidates:[],proofs:[...l].map(r=>A(e).proofsById.get(r)).filter(r=>!!r).sort((r,d)=>r.id.localeCompare(d.id))}}function ke(e,t,o){let a=O(e,t),l=O(e,o);if(!a.found||a.targetType!=="entity"||!l.found||l.targetType!=="entity")return {from:t,to:o,found:false,resolvedFrom:a.found&&a.targetType==="entity"?a.entity.id:null,resolvedTo:l.found&&l.targetType==="entity"?l.entity.id:null,entityPath:[],hops:[],proofs:[]};let r=A(e),d=[a.entity.id],u=new Map,c=new Set(d),s=0;for(;s<d.length&&!c.has(l.entity.id);){let h=d[s++];for(let k of r.adjacency.get(h)??[])c.has(k.to)||(c.add(k.to),u.set(k.to,k),d.push(k.to));}if(!c.has(l.entity.id))return {from:t,to:o,found:false,resolvedFrom:a.entity.id,resolvedTo:l.entity.id,entityPath:[],hops:[],proofs:[]};let p=[],g=l.entity.id;for(;g!==a.entity.id;){let h=u.get(g);if(!h)break;p.push(h),g=h.from;}p.reverse();let y=new Set(p.flatMap(h=>h.proofIds));return {from:t,to:o,found:true,resolvedFrom:a.entity.id,resolvedTo:l.entity.id,entityPath:[a.entity.id,...p.map(h=>h.to)],hops:p,proofs:[...y].map(h=>r.proofsById.get(h)).filter(h=>!!h).sort((h,k)=>h.id.localeCompare(k.id))}}function we(e,t){return e.entities.filter(o=>!t||o.kind===t).sort((o,a)=>o.kind.localeCompare(a.kind)||o.label.localeCompare(a.label))}var m={relations:24,relatedEntities:24,proofs:16,proofIdsPerItem:4,aliasesPerEntity:8,attributeArrayItems:8,attributeStringCharacters:256};function J(e){let t=[],o=new Set;for(let a=0;a<m.proofIdsPerItem&&t.length<m.proofs;a+=1)for(let l of e){let r=l.proofIds[a];if(!(!r||o.has(r))&&(o.add(r),t.push(r),t.length>=m.proofs))break}return t}function ee(e,t,o){let a=e.identity.aliases.slice(0,m.aliasesPerEntity);o.aliases+=e.identity.aliases.length-a.length;let l=Object.fromEntries(Object.entries(e.attributes).map(([d,u])=>{if(Array.isArray(u)){let c=u.slice(0,m.attributeArrayItems);return o.attributeValues+=u.length-c.length,[d,c]}return typeof u=="string"&&u.length>m.attributeStringCharacters?(o.attributeValues+=1,[d,u.slice(0,m.attributeStringCharacters)]):[d,u]})),r=e.proofIds.filter(d=>t.has(d)).slice(0,m.proofIdsPerItem);return o.proofReferences+=e.proofIds.length-r.length,{...e,identity:{...e.identity,aliases:a},attributes:l,proofIds:r}}function te(e){let t=Object.values(e.attributes).flatMap(o=>Array.isArray(o)?o:[o]);return [e.id,e.kind,e.label,e.projectId??"",e.identity.key,...e.identity.aliases,...t.map(o=>String(o??""))].join(" ").toLowerCase()}var ne=new Set(["a","an","and","are","as","at","be","been","being","by","can","check","could","did","do","does","find","for","from","give","had","has","have","how","i","in","into","is","it","its","may","might","of","on","or","our","show","should","that","the","their","them","then","there","these","they","this","those","tell","to","was","we","were","what","when","where","which","who","why","will","with","would","you","your"]);function T(e){let t=o=>b(o).split(/[^a-z0-9]+/u).filter(a=>a.length>1);return [...new Set([...t(e),...t(e.replace(/([a-z0-9])([A-Z])/g,"$1 $2"))])]}function oe(e){let t=b(e.label),o=b(e.identity.key),a=e.identity.aliases.map(b),l=te(e);return {entity:e,label:t,identity:o,aliases:a,haystack:l,labelTokens:new Set(T(e.label)),identityTokens:new Set(T(e.identity.key)),aliasTokens:new Set(e.identity.aliases.flatMap(T)),allTokens:new Set(T(l))}}function S(e,t){return e.has(t)||t.length>=3&&[...e].some(o=>o.startsWith(t))}function G(e,t){return S(e.labelTokens,t)||S(e.identityTokens,t)||S(e.aliasTokens,t)||S(e.allTokens,t)}function se(e,t,o,a){let{label:l,identity:r,aliases:d,haystack:u}=e,c=0;(l===t||r===t||d.includes(t))&&(c+=1e4),(l.startsWith(t)||r.startsWith(t))&&(c+=250),u.includes(t)&&(c+=100);let s=0;for(let p of o){let g=a.get(p)??1,y=S(e.labelTokens,p),h=S(e.identityTokens,p),k=S(e.aliasTokens,p),f=G(e,p);f&&(s+=1),l===p?c+=80*g:y&&(c+=36*g),h&&(c+=24*g),k&&(c+=20*g),f&&(c+=10*g);}return o.length>0&&(c+=s/o.length*120),c}function ae(e,t){return t.filter(o=>G(e,o)).length}var re=new Map([["clojure","clojure"],["cplusplus","cpp"],["cpp","cpp"],["typescript","typescript"],["ts","typescript"],["javascript","javascript"],["js","javascript"],["nodejs","javascript"],["python","python"],["py","python"],["go","go"],["golang","go"],["csharp","csharp"],["dotnet","csharp"],["dart","dart"],["elixir","elixir"],["fsharp","fsharp"],["java","java"],["kotlin","kotlin"],["lua","lua"],["php","php"],["ruby","ruby"],["rust","rust"],["scala","scala"],["svelte","svelte"],["swift","swift"],["vue","vue"]]);function ie(e){return new Set(e.map(t=>re.get(t)).filter(t=>!!t))}function U(e){let t=e.attributes.language;return typeof t=="string"?b(t):null}function ce(e){return {project:1e3,service:900,api:900,package:850,endpoint:800,container:700,deployment:700,environment:650,pipeline:600,"test-suite":550,owner:500,decision:450,document:400}[e.kind]??0}function le(e,t){let o=t.has("language")||t.has("languages"),a=t.has("binding")||t.has("bindings")||t.has("bridge")||t.has("bridges"),l=t.has("dependency")||t.has("dependencies")||t.has("depends"),r=t.has("core")||t.has("runtime"),d=t.has("owner")||t.has("owners")||t.has("ownership")||t.has("maintainer"),u=t.has("ci")||t.has("pipeline")||t.has("pipelines")||t.has("workflow"),c=t.has("deploy")||t.has("deployment")||t.has("infrastructure")||t.has("container"),s=t.has("doc")||t.has("docs")||t.has("document")||t.has("documentation"),p=t.has("service")||t.has("services")||t.has("api")||t.has("rpc"),g=t.has("schema")||t.has("schemas")||t.has("message")||t.has("protobuf")||t.has("proto")||t.has("contract"),y=typeof e.attributes.mechanism=="string"?b(e.attributes.mechanism):"",h=typeof e.attributes.specification=="string"?b(e.attributes.specification):"",k=b(e.label),f=0;if(o&&e.kind==="language"){let j=typeof e.attributes.fileCount=="number"?e.attributes.fileCount:0;f+=900+Math.min(j,1e4)/10;}return a&&e.kind==="protocol"&&(f+=800),l&&e.kind==="package"&&(f+=650),r&&e.kind==="package"&&/(?:^|[_-])core(?:$|[_-])/u.test(k)&&(f+=700),r&&e.kind==="protocol"&&y.includes("core")&&(f+=300),d&&e.kind==="owner"&&(f+=850),u&&e.kind==="pipeline"&&(f+=800),c&&["deployment","container","environment"].includes(e.kind)&&(f+=775),s&&["document","decision"].includes(e.kind)&&(f+=725),p&&["api","endpoint","service"].includes(e.kind)&&(f+=700),g&&(e.kind==="schema"||(e.kind==="api"||e.kind==="protocol")&&(h.includes("protobuf")||y.includes("protobuf")))&&(f+=750),f}function de(e){return [e.has("language")||e.has("languages"),e.has("binding")||e.has("bindings")||e.has("bridge")||e.has("bridges"),e.has("dependency")||e.has("dependencies")||e.has("depends"),e.has("core")||e.has("runtime"),e.has("owner")||e.has("ownership")||e.has("maintainer"),e.has("ci")||e.has("pipeline")||e.has("workflow"),e.has("deploy")||e.has("deployment")||e.has("infrastructure"),e.has("doc")||e.has("docs")||e.has("documentation"),e.has("service")||e.has("api")||e.has("rpc"),e.has("schema")||e.has("protobuf")||e.has("proto")||e.has("contract")].filter(Boolean).length>=3}function ye(e,t){let o=b(t.query),a=[...new Set(T(t.query))],l=new Set(T(t.projectId??"")),r=t.projectId?a.filter(n=>!l.has(n)):a,d=!!(t.projectId&&a.length>0&&r.length===0),u=r.filter(n=>!ne.has(n)),c=u.length>0?u:r,s=ie(c),p=new Set(c),g=de(p),y=c.length<=1?c.length:Math.min(3,Math.ceil(c.length/3)),h=t.minimumTermMatches===void 0?y:Math.min(y,Math.max(1,Math.trunc(t.minimumTermMatches))),k=Math.max(1,Math.min(Math.trunc(t.limit??12),100)),f=Math.max(0,Math.min(Math.trunc(t.relationsPerEntity??4),20)),j=new Set;if(t.projectId){let n=new Set(e.entities.filter(i=>i.kind==="project"&&(i.projectId===t.projectId||i.label===t.projectId)).map(i=>i.id));for(let i of e.relations)n.has(i.from)&&j.add(i.to),n.has(i.to)&&j.add(i.from);}let x=e.entities.filter(n=>(!t.kind||n.kind===t.kind)&&(!t.projectId||n.projectId===t.projectId||n.projectId===void 0&&j.has(n.id))).map(oe),Q=new Map(c.map(n=>{let i=x.filter(w=>G(w,n)).length;return [n,Math.log((x.length+1)/(i+1))+1]})),P=x.map(n=>{let i=ae(n,c),w=U(n.entity),I=w&&s.has(w)?400:0,K=le(n.entity,p);return {entity:n.entity,matchedTerms:i,intentScore:K,score:d?ce(n.entity):se(n,o,c,Q)+I+K}}).filter(n=>{let i=U(n.entity);return (s.size===0||i===null||s.has(i))&&(o.length===0||n.score>0&&(d||n.matchedTerms>=h||n.intentScore>0&&(g||c.length<=2)))}).sort((n,i)=>i.score-n.score||n.entity.kind.localeCompare(i.entity.kind)||n.entity.label.localeCompare(i.entity.label)),E=(g?(()=>{let n=[],i=[],w=new Map,I=new Set;for(let K of P){let V=w.get(K.entity.kind)??0,z=b(K.entity.label);V<2&&!I.has(z)?(n.push(K),w.set(K.entity.kind,V+1),I.add(z)):i.push(K);}return [...n,...i]})():P).slice(0,k).map(n=>n.entity),v=new Set(E.map(n=>n.id)),D=new Map,B=e.relations.filter(n=>{if(!(v.has(n.from)||v.has(n.to)))return false;let w=v.has(n.from)?n.from:n.to,I=D.get(w)??0;return I>=f?false:(D.set(w,I+1),true)}),W=t.projection==="agent",M=W?B.slice(0,m.relations):B,H=A(e),_=[...new Set(M.flatMap(n=>[n.from,n.to]).filter(n=>!v.has(n)))].map(n=>H.entitiesById.get(n)).filter(n=>!!n).map(({id:n,kind:i,label:w,projectId:I})=>({id:n,kind:i,label:w,...I?{projectId:I}:{}})).sort((n,i)=>n.kind.localeCompare(i.kind)||n.label.localeCompare(i.label)),L=W?_.slice(0,m.relatedEntities):_,N=new Set([...E.flatMap(n=>n.proofIds),...M.flatMap(n=>n.proofIds)]),$=W?J([...E,...M]):[...N],C=new Set($),R={entities:P.length-E.length,relations:B.length-M.length,relatedEntities:_.length-L.length,proofs:N.size-C.size,proofReferences:0,aliases:0,attributeValues:0},q=W?E.map(n=>ee(n,C,R)):E,Y=W?M.map(n=>{let i=n.proofIds.filter(w=>C.has(w)).slice(0,m.proofIdsPerItem);return R.proofReferences+=n.proofIds.length-i.length,{...n,proofIds:i}}):M,X=[...C].map(n=>H.proofsById.get(n)).filter(n=>!!n).sort((n,i)=>n.id.localeCompare(i.id));return {schemaVersion:Z,query:t.query,kind:t.kind??null,...t.projectId?{projectId:t.projectId}:{},limit:k,totalMatches:P.length,truncated:P.length>q.length||W&&Object.values(R).some(n=>n>0),entities:q,relatedEntities:L,relations:Y,proofs:X,...W?{budget:{mode:"agent",limits:{...m},omitted:R}}:{}}}export{Z as a,O as b,fe as c,ke as d,we as e,ye as f};
|
package/dist/chunk-5B2GAZAC.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import {d,b,e}from'./chunk-W6FHVXNL.js';import {a}from'./chunk-2647BYBC.js';import {a as a$1}from'./chunk-27UR373Z.js';import {d as d$2}from'./chunk-S5KTATOU.js';import {p as p$1,w,t as t$1}from'./chunk-J7RU5WR5.js';import {h,j,f,e as e$2}from'./chunk-XKDR5BGS.js';import {d as d$1}from'./chunk-CCDGHPEJ.js';import {e as e$1,i}from'./chunk-NZ3WZYD5.js';import {a as a$2}from'./chunk-TQEMLBAG.js';import {t,p,s}from'./chunk-MOSXTVPU.js';import {e as e$3,g}from'./chunk-RGNCL5OB.js';import U from'fs';import k from'path';import T from'chalk';import {execa}from'execa';function Le(e){return U.existsSync(k.join(e,"bun.lock"))||U.existsSync(k.join(e,"bunfig.toml"))?"bun":U.existsSync(k.join(e,"pnpm-lock.yaml"))?"pnpm":U.existsSync(k.join(e,"yarn.lock"))?"yarn":(U.existsSync(k.join(e,"package-lock.json")),"npm")}function Ge(e,r,t=Le(e)){return t==="npm"?`npm run ${r}`:`${t} run ${r}`}function Be(e,r=Le(e)){return `${r} install`}var ct={"python-fastapi":{runtime:"python",framework:"FastAPI",markers:["pyproject.toml","fastapi"],commands:{init:"python -m pip install -e .",test:"pytest",build:"python -m build",start:"uvicorn main:app --reload"},errorPatterns:{setup:["ModuleNotFoundError","No module named","pip: command not found"],"test-failure":["FAILED","ERROR","test session started"],dependency:["ImportError","missing.*dependency"],runtime:["TypeError","AttributeError","ValueError"],timeout:["timeout","Timeout","timed out"],unknown:[]},healthCheck:{stage:"start",type:"http",value:"http://localhost:8000/docs"},validation:{command:"python -m pip list | grep fastapi",error:"FastAPI not installed"}},"python-django":{runtime:"python",framework:"Django",markers:["manage.py","django"],commands:{init:"python manage.py migrate",test:"python manage.py test",build:"python manage.py collectstatic --noinput",start:"python manage.py runserver 0.0.0.0:8000"},errorPatterns:{setup:["ModuleNotFoundError","ProgrammingError.*migrate"],"test-failure":["FAILED","ERROR","Ran.*test"],dependency:["ImportError","missing.*dependency"],runtime:["DatabaseError","ImproperlyConfigured"],timeout:["timeout","Timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:8e3},dependencies:["init"]},"node-nestjs":{runtime:"node",framework:"NestJS",markers:["package.json","@nestjs/core"],commands:{init:"npm install",test:"npm run test",build:"npm run build",start:"npm run start"},errorPatterns:{setup:["npm ERR!","ENOENT","not found"],"test-failure":["Tests.*failed","FAIL","fail.*test"],dependency:["Cannot find module","ERR_MODULE_NOT_FOUND"],runtime:["TypeError","Error: ","ReferenceError"],timeout:["timeout","TIMEOUT"],unknown:[]},healthCheck:{stage:"start",type:"port",value:3e3}},"node-express":{runtime:"node",framework:"Express",markers:["package.json","express"],commands:{init:"npm install",test:"npm run test",build:"npm run build",start:"npm start"},errorPatterns:{setup:["npm ERR!","ENOENT"],"test-failure":["failed","FAIL"],dependency:["Cannot find module"],runtime:["Error","TypeError"],timeout:["timeout"],unknown:[]}},"go-fiber":{runtime:"go",framework:"Fiber",markers:["go.mod","fiber"],commands:{init:"go mod download && go mod tidy",test:"go test ./...",build:"go build -o app .",start:"./app"},errorPatterns:{setup:["go: .*not found","cannot find","go mod tidy"],"test-failure":["FAIL","--- FAIL"],dependency:["missing.*module"],runtime:["panic","fatal","Error"],timeout:["timeout","context deadline"],unknown:[]},dependencies:["init"]},"go-gin":{runtime:"go",framework:"Gin",markers:["go.mod","gin-gonic"],commands:{init:"go mod download && go mod tidy",test:"go test ./...",build:"go build -o app .",start:"./app"},errorPatterns:{setup:["go: .*not found"],"test-failure":["FAIL"],dependency:["missing.*module"],runtime:["panic"],timeout:["timeout"],unknown:[]}},"java-springboot":{runtime:"java",framework:"Spring Boot",markers:["pom.xml","build.gradle","spring-boot"],commands:{init:"mvn dependency:go-offline",test:"mvn test",build:"mvn package -DskipTests",start:"mvn spring-boot:run"},errorPatterns:{setup:["\\[ERROR\\]","BUILD FAILURE","missing dependencies"],"test-failure":["\\[ERROR\\] Tests run:","BUILD FAILURE"],dependency:["missing.*dependency"],runtime:["Exception","Error","NullPointerException"],timeout:["timeout","Timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:8080}},"php-laravel":{runtime:"php",framework:"Laravel",markers:["composer.json","artisan","app/Models"],commands:{init:"composer install && php artisan migrate:fresh --seed",test:"php artisan test",build:"php artisan config:cache && php artisan route:cache && php artisan view:cache",start:"php artisan serve --host=0.0.0.0 --port=8000"},errorPatterns:{setup:["Composer.*lock","Fatal error","Class.*not found"],"test-failure":["FAILED","Tests.*failed"],dependency:["Class.*not found","require.*failed"],runtime:["Fatal error","Exception","Error"],timeout:["timeout","Timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:8e3},dependencies:["init"]},"php-symfony":{runtime:"php",framework:"Symfony",markers:["composer.json","symfony.lock","bin/console"],commands:{init:"composer install && php bin/console doctrine:database:create",test:"php bin/phpunit",build:"php bin/console cache:clear --env=prod",start:"symfony serve --no-tls"},errorPatterns:{setup:["Composer.*error","Fatal error"],"test-failure":["FAILED","failure"],dependency:["Class.*not found"],runtime:["Fatal error","Exception"],timeout:["timeout"],unknown:[]},dependencies:["init"]},"rust-actix":{runtime:"rust",framework:"Actix-web",markers:["Cargo.toml","actix"],commands:{init:"cargo fetch",test:"cargo test",build:"cargo build --release",start:"cargo run --release"},errorPatterns:{setup:["error: .*could not find","failed.*download"],"test-failure":["test result:","FAILED"],dependency:["can.t find.*crate"],runtime:["error\\[E","thread.*panicked"],timeout:["timeout"],unknown:[]},validation:{command:"cargo --version",error:"Rust/Cargo not installed"}},"rust-axum":{runtime:"rust",framework:"Axum",markers:["Cargo.toml","axum"],commands:{init:"cargo fetch",test:"cargo test",build:"cargo build --release",start:"cargo run --release"},errorPatterns:{setup:["error: .*could not find"],"test-failure":["test result:","FAILED"],dependency:["can.t find.*crate"],runtime:["error\\[E"],timeout:["timeout"],unknown:[]}},"rust-rocket":{runtime:"rust",framework:"Rocket",markers:["Cargo.toml","rocket"],commands:{init:"cargo fetch",test:"cargo test",build:"cargo build --release",start:"cargo run --release"},errorPatterns:{setup:["error: .*could not find"],"test-failure":["FAILED"],dependency:["can.t find"],runtime:["error\\[E"],timeout:["timeout"],unknown:[]}},"dotnet-aspnetcore":{runtime:"dotnet",framework:"ASP.NET Core",markers:[".csproj",".sln","Program.cs"],commands:{init:"dotnet restore",test:"dotnet test",build:"dotnet build -c Release",start:"dotnet run"},errorPatterns:{setup:["error CS","CSPROJ.*not found","NuGet.*restore"],"test-failure":["Failed:.*test","FAILED"],dependency:["error NU1101"],runtime:["error CS","Exception"],timeout:["timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:5e3}},"elixir-phoenix":{runtime:"elixir",framework:"Phoenix",markers:["mix.exs","phoenix"],commands:{init:"mix setup",test:"mix test",build:"mix compile --all-warnings",start:"mix phx.server"},errorPatterns:{setup:["\\*\\* \\(.*Error\\)","Mix.InstallError"],"test-failure":["\\d+\\sfailed","FAILED"],dependency:["dependencies are not available"],runtime:["\\*\\* \\(","RuntimeError"],timeout:["timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:4e3},dependencies:["init"]},"ruby-rails":{runtime:"ruby",framework:"Rails",markers:["Gemfile","config/application.rb","bin/rails"],commands:{init:"bundle install && rails db:prepare",test:"rails test",build:"rails assets:precompile",start:"rails server --binding=0.0.0.0 --port=3000"},errorPatterns:{setup:["Bundler::.*Error","Gem::.*Error"],"test-failure":["failures,","error,","FAILED"],dependency:["Could not find.*gem"],runtime:["Error","Exception","NoMethodError"],timeout:["timeout"],unknown:[]},healthCheck:{stage:"start",type:"port",value:3e3},dependencies:["init"]},"ruby-sinatra":{runtime:"ruby",framework:"Sinatra",markers:["Gemfile","app.rb","sinatra"],commands:{init:"bundle install",test:"rspec",build:`echo "Sinatra apps don't require build"`,start:"ruby app.rb"},errorPatterns:{setup:["Bundler.*Error","Gem.*Error"],"test-failure":["failure","FAILED"],dependency:["Could not find.*gem"],runtime:["Error","NoMethodError"],timeout:["timeout"],unknown:[]}}},dt={init:{python:["pip install -e .","poetry install","pip install -r requirements.txt"],node:["npm install","pnpm install","yarn install"],go:["go mod download && go mod tidy","go get ./..."],java:["mvn dependency:go-offline","gradle dependencies"],php:["composer install"],rust:["cargo fetch"],dotnet:["dotnet restore"],c:["cmake -S . -B build"],cpp:["cmake -S . -B build"],elixir:["mix deps.get"],ruby:["bundle install"],"jvm-generic":["mvn dependency:go-offline","gradle dependencies"],unknown:[]},test:{python:["pytest","python -m unittest","python -m pytest"],node:["npm test","npm run test"],go:["go test ./...","make test"],java:["mvn test","gradle test"],php:["php artisan test","phpunit","pest"],rust:["cargo test"],dotnet:["dotnet test"],c:["ctest --test-dir build --output-on-failure"],cpp:["ctest --test-dir build --output-on-failure"],elixir:["mix test"],ruby:["rspec","ruby -m minitest"],"jvm-generic":["mvn test","gradle test"],unknown:[]},build:{python:["python -m build","python setup.py build"],node:["npm run build"],go:["go build -o app .","go build ./..."],java:["mvn package -DskipTests","gradle build -x test"],php:['echo "PHP build: typically no build step"'],rust:["cargo build --release"],dotnet:["dotnet build -c Release"],c:["cmake --build build"],cpp:["cmake --build build"],elixir:["mix compile"],ruby:["gem build *.gemspec"],"jvm-generic":["mvn package -DskipTests","gradle build"],unknown:[]},start:{python:["python app.py","python main.py","uvicorn main:app --reload"],node:["npm start","node index.js","node src/index.js"],go:["./app","go run main.go","go run ./..."],java:["mvn spring-boot:run","gradle bootRun","java -jar target/*.jar"],php:["php -S 0.0.0.0:8000","php artisan serve"],rust:["cargo run --release","./target/release/app"],dotnet:["dotnet run"],c:[],cpp:[],elixir:["mix phx.server","iex -S mix"],ruby:["rails server","ruby app.rb","bundle exec puma"],"jvm-generic":["java -jar *.jar","gradle run"],unknown:[]}};function te(e,r){if(r){let t=r.trim().toLowerCase().replace(/[_.\s]+/g,"-"),n=e$2(r),s=`${e}-${n==="gofiber"?"fiber":n==="gogin"?"gin":n==="dotnet"?"aspnetcore":n!=="unknown"?n:t==="fiber"?"fiber":t==="aspnetcore"||t==="asp-net-core"?"aspnetcore":t}`;return ct[s]}}function He(e,r,t){if(r){let n=te(e,r);if(n&&n.commands[t])return n.commands[t]}if(["init","test","build","start"].includes(t)){let n=dt[t]?.[e]??[];return n.length>0?n[0]:void 0}}var lt={test:"test",build:"build",start:"start"};function ge(e){if(e.stage==="init")return e.runtime==="node"?Be(e.projectPath):He(e.runtime,e.framework,e.stage);if(e.runtime==="node"){let r=lt[e.stage];if(r){let t=t$1(e.projectPath,r,{framework:e.framework});if(t)return Ge(e.projectPath,t.scriptName)}}return He(e.runtime,e.framework,e.stage)}function mt(e){let r=h(e).map(t=>t==="python"?"python":t==="node"||t==="bun"?"node":t==="go"?"go":t==="java"?"java":t==="php"?"php":t==="rust"?"rust":t==="dotnet"?"dotnet":t==="elixir"?"elixir":t==="ruby"?"ruby":t==="clojure"||t==="scala"||t==="kotlin"?"jvm-generic":null).filter(t=>t!==null).filter((t,n,o)=>o.indexOf(t)===n);return {primary:r.length>0?r[0]:"unknown",secondary:r.slice(1)}}function ze(e){return mt(e).primary}function ye(e,r){if(!e)return "unknown";r||(r={setup:["ModuleNotFoundError","No module named","npm ERR!","error:","not found"],"test-failure":["FAILED","FAIL","failed"],dependency:["cannot find module","import.*error"],runtime:["Exception","Error:","panic","TypeError"],timeout:["timeout","Timeout","deadline exceeded"],unknown:[]});for(let[t,n]of Object.entries(r))for(let o of n)if(new RegExp(o,"i").test(e))return t;return "unknown"}async function re(e){let r=e.split(/[&|;]\s*/)[0].trim().split(/\s+/)[0];if(["echo","cd","pwd","test","true","false","exit"].includes(r))return {valid:true};try{let n=process.platform==="win32"?"where":"which";if((await execa(n,[r],{reject:false})).exitCode===0)return {valid:true}}catch{}return {valid:false,reason:`Command '${r}' not found or not executable`}}function Je(e,r,t){if(!r)return e;let n=typeof r=="object"&&!Array.isArray(r)&&("dev"in r||"staging"in r||"prod"in r||"default"in r)&&!Object.keys(r).some(o=>["init","test","build","start"].includes(o))?r:{};return t&&typeof n[t]=="string"?n[t]:typeof n.default=="string"?n.default:e}async function qe(e,r){if(!e)return {healthy:true};switch(e.type){case "port":{let t=e.value;try{let n=await import('net');return new Promise(o=>{let s=new n.Socket,u=5e3;s.setTimeout(u),s.on("connect",()=>{s.destroy(),o({healthy:true,reason:`Port ${t} is listening`});}),s.on("timeout",()=>{s.destroy(),o({healthy:false,reason:`Port ${t} timeout after ${u}ms`});}),s.on("error",c=>{s.destroy(),o({healthy:false,reason:`Port ${t} error: ${String(c)}`});}),s.connect(t,"localhost");})}catch(n){return {healthy:false,reason:`Port check error: ${n instanceof Error?n.message:String(n)}`}}}case "http":{let t=e.value,n;try{let o=new AbortController;n=setTimeout(()=>o.abort(),5e3);let s=await fetch(t,{method:"GET",signal:o.signal});return {healthy:s.status===200,reason:`HTTP ${s.status}`,metadata:{status:s.status}}}catch(o){return {healthy:false,reason:`HTTP check error: ${o instanceof Error?o.message:String(o)}`}}finally{n&&clearTimeout(n);}}case "log":{let t=e.value;if(!r)return {healthy:true};try{let n=[k.join(r,".workspai","last-run.log"),k.join(r,".rapidkit","last-run.log")].find(o=>U.existsSync(o));if(n){let o=U.readFileSync(n,"utf-8"),s=new RegExp(t,"i");return {healthy:s.test(o),reason:s.test(o)?"Log pattern found":"Log pattern not found"}}return {healthy:true,reason:"No log file to check"}}catch(n){return {healthy:false,reason:`Log check error: ${n instanceof Error?n.message:String(n)}`}}}case "command":{let t=e.value;try{let n=await execa(t,[],{cwd:r,reject:false,shell:true});return {healthy:n.exitCode===0,reason:n.exitCode===0?"Health check passed":"Health check failed",metadata:{exitCode:n.exitCode}}}catch(n){return {healthy:false,reason:`Command check error: ${n instanceof Error?n.message:String(n)}`}}}default:return {healthy:true}}}var Ye={init:"init",test:"test",build:"build",start:"start"};function pt(e){return e in Ye?Ye[e]:null}function ft(e,r){let n=p$1(e)?.contextJson?.commands;if(!n||typeof n!="object"||Array.isArray(n))return;let o=n[r];if(typeof o=="string"&&o.trim().length>0)return o.trim();if(o&&typeof o=="object"&&!Array.isArray(o)){let s=o,u=s.default??s.dev;if(typeof u=="string"&&u.trim().length>0)return u.trim()}}function Qe(e,r,t=w(e)){let n=pt(r);if(!n)return ft(e,r)?{supported:true}:{supported:false,reason:`Workspace stage "${r}" is not part of the Workspai fleet contract.`};if(!t.projectRoot)return {supported:false,reason:"No Workspai project metadata was detected for this target."};let o=t.commandMap[n];if(!o||o.status!=="supported"){let s=t.runtimeSupportTier==="observed"||t.frameworkSupportTier==="observed";return {supported:false,reason:o?.reason??`Command "${n}" is not supported for this project runtime/framework.`,shouldFail:!s}}return {supported:true}}var gt=new Set(["init","test","build","start"]),yt=new Set([".git","node_modules",".workspai",".rapidkit",".venv","dist","build","coverage","htmlcov"]);async function B(e){try{return await U.promises.access(e,U.constants.F_OK),true}catch{return false}}async function ht(e){for(let r of e)if(await B(r))return true;return false}async function kt(e,r,t){if(r==="python"){let o=[k.join(e,".workspai","cli.py"),k.join(e,".rapidkit","cli.py")];for(let s of o)if(await B(s))return {valid:true};return {valid:false,reason:"Project-local .workspai/cli.py is missing. Run `workspai init` in this project first."}}let n=t.trim().split(/\s+/)[0];if(n&&["npm","npx","pnpm","yarn"].includes(n)){let o=e$3(n);if((await execa(o.command,[...o.prefixArgs,"--version"],{reject:false,env:g()})).exitCode===0)return {valid:true}}return re(t)}async function ne(e){let r=await U.promises.readFile(e,"utf-8");return JSON.parse(r)}function D(e){return e.replace(/\\/g,"/")}function bt(e){let r=e?.trim();return r?r.startsWith("project:")?r.slice(8).trim()||null:r:null}async function wt(e){let r=k.join(e,e$1.model);if(await B(r))try{let n=((await ne(r)).projects??[]).map(o=>typeof o.path=="string"?k.resolve(e,o.path):null).filter(o=>!!o).filter((o,s,u)=>u.indexOf(o)===s).filter(o=>U.existsSync(o));if(n.length>0)return n.sort()}catch{}return a$1(e,{skipDirs:yt,includeHiddenDirs:false,descendIntoMatchedProjects:false,isProjectDir:async(t$1,n)=>await ht([...t(t$1,"context.json"),...t(t$1,"project.json")])?true:k.resolve(t$1)===k.resolve(n)?false:h(t$1).length>0})}async function xt(e){for(let r of [k.join(".workspai","project.json"),k.join(".workspai","context.json"),k.join(".rapidkit","project.json"),k.join(".rapidkit","context.json")]){let t=k.join(e,r);if(await B(t))try{let n=await ne(t),o=n.name??n.projectName??n.slug;if(typeof o=="string"&&o.trim())return o.trim()}catch{}}return null}async function vt(e,r,t){let n=bt(t);if(!n)return {projects:r,normalizedScope:null};let o=D(n).toLowerCase(),s=[];for(let u of r){let c=D(k.relative(e,u)),m=k.basename(u),p=await xt(u);[c,m,p].filter(i=>typeof i=="string"&&i.length>0).map(i=>D(i).toLowerCase()).includes(o)&&s.push(u);}if(s.length===0)throw new Error(`Workspace run scope did not match any project: ${t}`);return {projects:s,normalizedScope:n}}async function Rt(e,r,t){let n=await execa("git",["diff","--name-only",`${t}...HEAD`],{cwd:e,reject:false,env:a$2()});if(n.exitCode!==0)return new Set(r);let o=n.stdout.split(/\r?\n/).map(u=>u.trim()).filter(u=>u.length>0).map(u=>D(u));if(o.length===0)return new Set;let s=new Set;for(let u of r){let c=D(k.relative(e,u));if(!c||c===".")continue;let m=`${c}/`;o.some(p=>p===c||p.startsWith(m))&&s.add(u);}return s}async function St(e,r,t){let n=await d$1(e,i.workspaceContract)??p(e,"workspace.contract.json");if(await B(n))try{let d=await Ct(e,r,t,n);if(d.graphStatus!=="missing")return d}catch{return {expanded:t,graphStatus:"invalid",expansionDepth:0}}let o=await d$1(e,".workspai/workspace-dependency-graph.json")??p(e,"workspace-dependency-graph.json");if(!await B(o))return {expanded:t,graphStatus:"missing",expansionDepth:0};let s;try{s=await ne(o);}catch{return {expanded:t,graphStatus:"invalid",expansionDepth:0}}let u=new Set(r.map(d=>k.resolve(d))),c=new Map;if(!s||typeof s!="object"||Array.isArray(s))return {expanded:t,graphStatus:"invalid",expansionDepth:0};let m=Array.isArray(s.projects)?s.projects:[];for(let d of m){if(!d||typeof d!="object"||Array.isArray(d))continue;let i=d,l=typeof i.path=="string"?i.path:"",y=k.resolve(e,l);if(!u.has(y))continue;let b=Array.isArray(i.dependsOn)?i.dependsOn.filter(S=>typeof S=="string"):[];for(let S of b){let g=k.resolve(e,S);u.has(g)&&(c.has(g)||c.set(g,new Set),c.get(g)?.add(y));}}let p$1=d$2(c,t);return {expanded:p$1.reached,graphStatus:"loaded",expansionDepth:p$1.added}}async function Ct(e,r,t,n){let o=await ne(n);if(!o||typeof o!="object"||Array.isArray(o))return {expanded:t,graphStatus:"invalid",expansionDepth:0};let s=o,u=Array.isArray(s.projects)?s.projects:null;if(!u)return {expanded:t,graphStatus:"invalid",expansionDepth:0};let c=new Map,m=new Map;for(let y of r){let b=D(k.relative(e,y));m.set(b,k.resolve(y));}let p=new Map,d=new Map,i=new Map;for(let y of u){if(!y||typeof y!="object"||Array.isArray(y))continue;let b=y,S=typeof b.slug=="string"?b.slug:"",g=typeof b.relativePath=="string"?D(b.relativePath):S,v=m.get(g);!S||!v||c.set(S,v);}for(let y of u){if(!y||typeof y!="object"||Array.isArray(y))continue;let b=y,S=typeof b.slug=="string"?b.slug:"",g=c.get(S);if(!g)continue;let v=b.contracts&&typeof b.contracts=="object"&&!Array.isArray(b.contracts)?b.contracts:{},E=Array.isArray(v.dependsOn)?v.dependsOn.filter(R=>typeof R=="string"):[],W=Array.isArray(v.publishes)?v.publishes.filter(R=>typeof R=="string"):[],_=Array.isArray(v.consumes)?v.consumes.filter(R=>typeof R=="string"):[];for(let R of E){let j=c.get(R);j&&(i.has(j)||i.set(j,new Set),i.get(j)?.add(g));}for(let R of W)p.has(R)||p.set(R,new Set),p.get(R)?.add(g);for(let R of _)d.has(R)||d.set(R,new Set),d.get(R)?.add(g);}for(let[y,b]of p.entries()){let S=d.get(y);if(S)for(let g of b){i.has(g)||i.set(g,new Set);for(let v of S)v!==g&&i.get(g)?.add(v);}}let l=d$2(i,t);return {expanded:l.reached,graphStatus:"loaded",expansionDepth:l.added}}async function Et(e,r){if(typeof r=="boolean")return r;let t=s(e,"policies.yml").find(s=>U.existsSync(s))??p(e,"policies.yml");if(!await B(t))return true;let n="";try{n=await U.promises.readFile(t,"utf-8");}catch{return true}let o=n.match(/^[\t ]*rules\.enforce_workspace_run_gates:\s*(true|false)\s*(?:#.*)?$/m);return o?o[1]==="true":true}function jt(e){let r=process.env.RAPIDKIT_WORKSPACE_RUN_STAGE_TIMEOUT_MS;if(r){let t=Number.parseInt(r,10);if(Number.isFinite(t)&&t>0)return t}return e==="init"?12e4:9e4}function Xe(e,r){let t=Number.parseInt(process.env[e]??"",10);return Number.isFinite(t)&&t>0?t:r}function he(e){return new Promise(r=>setTimeout(r,e))}async function Pt(e){let r=process.argv[1];if(e.useRapidkitWrapper&&!r)return {exitCode:1,stdout:"",stderr:"Workspai entrypoint is unavailable for startup verification.",healthStatus:{healthy:false,reason:"Workspai entrypoint is unavailable."}};let t=e.useRapidkitWrapper&&r?execa(process.execPath,[r,"start"],{cwd:e.projectPath,reject:false,timeout:e.timeoutMs,env:{...process.env,RAPIDKIT_WORKSPACE_RUN_CHILD:"1"}}):execa(e.finalCommand,[],{cwd:e.projectPath,reject:false,shell:true,timeout:e.timeoutMs}),n=Promise.resolve(t).then(d=>({kind:"exit",result:d}),d=>({kind:"error",error:d})),o=Xe("WORKSPAI_WORKSPACE_RUN_STARTUP_GRACE_MS",2e3),s=await Promise.race([n,he(o).then(()=>({kind:"alive"}))]);if(s.kind==="error"){let d=typeof s.error=="object"&&s.error!==null&&"timedOut"in s.error&&!!s.error.timedOut;return {exitCode:d?124:1,stdout:"",stderr:s.error instanceof Error?s.error.message:String(s.error),timedOut:d,healthStatus:{healthy:false,reason:"The start command failed before readiness."}}}if(s.kind==="exit"){let d=Number(s.result.exitCode??0);return {exitCode:d,stdout:String(s.result.stdout??""),stderr:String(s.result.stderr??""),healthStatus:{healthy:d===0,reason:d===0?"The start command completed successfully.":`The start command exited with code ${d} before readiness.`}}}let u=te(e.runtime,e.framework)?.healthCheck,c=u?{healthy:false,reason:"The configured health check has not passed yet."}:{healthy:true,reason:`The service remained alive for ${o}ms (bounded startup smoke).`};if(u){let d=Xe("WORKSPAI_WORKSPACE_RUN_STARTUP_HEALTH_TIMEOUT_MS",15e3),i=Date.now()+d;for(;Date.now()<i;){let l=await qe(u,e.projectPath);if(c={healthy:l.healthy,reason:l.reason},l.healthy)break;if((await Promise.race([n,he(350).then(()=>({kind:"alive"}))])).kind!=="alive"){c={healthy:false,reason:"The service exited before its configured health check passed."};break}}}try{t.kill?.("SIGTERM",{forceKillAfterDelay:1e3});}catch{try{t.kill?.();}catch{}}let m=await Promise.race([n,he(2e3).then(()=>({kind:"alive"}))]),p=m.kind==="exit"?m.result:void 0;return {exitCode:c.healthy?0:1,stdout:String(p?.stdout??""),stderr:String(p?.stderr??""),healthStatus:c}}async function ke(e,r,t){let n=process.argv[1];if(!n)return {exitCode:1,stdout:"",stderr:"RapidKit entrypoint is unavailable for nested workspace-run execution."};try{let o=await execa(process.execPath,[n,...e],{cwd:r,reject:false,timeout:t,env:{...process.env,RAPIDKIT_WORKSPACE_RUN_CHILD:"1"}});return {exitCode:Number(o.exitCode??1),stdout:o.stdout,stderr:o.stderr}}catch(o){return {exitCode:typeof o=="object"&&o!==null&&"timedOut"in o&&!!o.timedOut?124:1,stdout:typeof o=="object"&&o!==null&&"stdout"in o?String(o.stdout??""):"",stderr:typeof o=="object"&&o!==null&&"stderr"in o?String(o.stderr??""):o instanceof Error?o.message:String(o)}}}function At(e){return e==="node"||e==="go"||e==="java"||e==="python"||e==="dotnet"||e==="rust"||e==="php"}function Ft(){return process.env.VITEST==="true"||process.env.VITEST==="1"||process.env.NODE_ENV==="test"}function Ot(e,r=8){if(e.length<=r)return e.join(`
|
|
2
|
-
`);let t=3;return [...e.slice(0,t),...e.slice(-(r-t))].join(`
|
|
3
|
-
`)}function Tt(e){let r=/(?:\bnot found\b|\bno such\b|\bmissing\b|\bfailed\b|\berror\b|\bexception\b|\bcannot\b|\bdenied\b|\btimeout\b|\btimed out\b|\benoent\b|\beacces\b|\beperm\b)/i;return [...e].reverse().find(t=>r.test(t))??e.at(-1)}async function Mt(e){let r=process.cwd();try{process.chdir(e);let{handleInitCommand:t}=await import('./index.js');return {exitCode:await t(["init"]),stdout:"",stderr:""}}finally{process.chdir(r);}}async function Ze(e){let r=i=>{let l=f(i);return l==="node"||l==="bun"?"node":l==="python"?"python":l==="go"?"go":l==="java"?"java":l==="php"?"php":l==="ruby"?"ruby":l==="rust"?"rust":l==="dotnet"?"dotnet":l==="elixir"?"elixir":l==="clojure"||l==="scala"||l==="kotlin"?"jvm-generic":ze(e)},t=i=>{if(!i)return;let l=e$2(i);if(new Set(["fastapi","django","flask","nestjs","express","fastify","koa","gofiber","gogin","echo","springboot","laravel","symfony","rails","sinatra","dotnet","actix","axum","rocket","phoenix"]).has(l))return l},n=p$1(e),o=n?.detection??j(e,n?.projectJson??null),s=n?.contextJson,u=r(o.runtime),c=t(o.key),m={},p=new Set(["init","test","build","start"]);if(s?.commands&&typeof s.commands=="object")for(let[i,l]of Object.entries(s.commands))typeof l=="string"&&p.has(i)&&(m[i]=l);let d;if(s?.commandEnvironments&&typeof s.commandEnvironments=="object"){let i=s.commandEnvironments;d={dev:typeof i.dev=="string"?i.dev:void 0,staging:typeof i.staging=="string"?i.staging:void 0,prod:typeof i.prod=="string"?i.prod:void 0,default:typeof i.default=="string"?i.default:void 0};}return {runtime:u,framework:c,commandOverrides:Object.keys(m).length>0?m:void 0,environmentCommandVariants:d,environment:typeof s?.environment=="string"?s.environment:void 0}}async function et(e,r,t,n,o,s,u){let c=!o?.[r]&&At(t),m;if(o&&o[r]?m=o[r]:c?m=`rapidkit ${r}`:m=ge({projectPath:e,runtime:t,framework:n,stage:r}),!m)return {exitCode:127,command:`<stage not supported for ${t}>`,message:`No stage command found for runtime '${t}' and framework '${n||"unknown"}'`,errorCategory:"runtime"};let p=Je(m,s,u);if(!p)return {exitCode:127,command:m,message:"Failed to resolve stage command",errorCategory:"runtime"};let d=ge({projectPath:e,runtime:t,framework:n,stage:r});if(c){if(d){let x=c?await kt(e,t,d):await re(d);if(!x.valid)return {exitCode:127,command:p,message:x.reason||"Command not available",errorCategory:"setup"}}}else {let x=await re(p);if(!x.valid)return {exitCode:127,command:p,message:x.reason||"Command not available",errorCategory:"setup"}}let i=0,l="",y="",b,S,g=jt(r),v=Date.now();try{let x=r==="start"?await Pt({projectPath:e,finalCommand:p,useRapidkitWrapper:c,runtime:t,framework:n,timeoutMs:g}):c?r==="init"&&Ft()?await Mt(e):await ke([r],e,g):await execa(p,[],{cwd:e,reject:false,shell:true,timeout:g});if(i=Number(x.exitCode??0),l=x.stdout,y=x.stderr,S=r==="start"?x.healthStatus:void 0,i!==0){let I=`${l}
|
|
4
|
-
${y}`,V=Date.now()-v;b=i===124||ye(I)==="timeout"||i===143&&V>=Math.floor(g*.8)?"timeout":ye(I);}}catch(x){let I=typeof x=="object"&&x!==null&&"timedOut"in x&&!!x.timedOut;return {exitCode:I?124:1,command:p,message:I?`Stage timed out after ${g}ms`:x instanceof Error?x.message:"Command execution failed",errorCategory:I?"timeout":"runtime"}}let E=`${l}
|
|
5
|
-
${y}`.split(/\r?\n/).map(x=>x.trim()).filter(Boolean),W=Ot(E),_=Tt(E),R=Date.now()-v,j=i===124||b==="timeout"||i===143&&R>=Math.floor(g*.8),P=i===0?void 0:j?"timeout":b,$=i===0||!P?void 0:{category:P,exitCode:i,command:p,timedOut:j,timeoutMs:g,...W?{outputExcerpt:W}:{}};return {exitCode:i,command:p,errorCategory:P,healthStatus:S,failureDiagnostic:$,message:j?`Stage timed out after ${g}ms`:i!==0?_?`Stage failed with exit code ${i}: ${_}`:`Stage failed with exit code ${i}`:void 0}}function tt(e){try{return JSON.parse(e)}catch{return null}}function Nt(e){switch(e){case "dotnet":return "Install .NET 8+ SDK, then rerun `npx workspai setup dotnet` or `npx workspai init`.";case "go":return "Install Go 1.21+, then rerun `npx workspai setup go` or `npx workspai init`.";case "java":case "jvm-generic":return "Install Java 21+ and Maven/Gradle, then rerun `npx workspai setup java` or `npx workspai init`.";case "node":return "Install Node.js LTS and npm/pnpm/yarn, then rerun `npx workspai setup node` or `npx workspai init`.";case "python":return "Install Python 3.10+ and pip/Poetry, then rerun `npx workspai setup python` or `npx workspai init`.";default:return null}}async function Dt(e){let r=[],t=await ke(["doctor","workspace","--json"],e);if(t.exitCode!==0)r.push({gate:"doctor-workspace",status:"fail",summary:"doctor workspace command failed"});else {let s=tt(t.stdout)?.healthScore,u=Number(s?.errors??0);Number.isFinite(u)&&u>0?r.push({gate:"doctor-workspace",status:"fail",summary:`doctor workspace reports ${u} error(s)`}):r.push({gate:"doctor-workspace",status:"pass",summary:"doctor workspace passed"});}let n=await ke(["readiness","--json"],e);if(n.exitCode!==0)r.push({gate:"readiness",status:"fail",summary:"readiness command failed"});else {let o=tt(n.stdout),s=String(o?.overallStatus??"").toLowerCase();s==="fail"?r.push({gate:"readiness",status:"fail",summary:"readiness overall status is fail"}):s==="warn"?r.push({gate:"readiness",status:"warn",summary:"readiness overall status is warn"}):r.push({gate:"readiness",status:"pass",summary:"readiness overall status is pass"});}return r}var Wt=new Set(["dev","stop"]);function $t(e){let r=e.trim();return !r||Wt.has(r.toLowerCase())?false:gt.has(r)?true:/^[a-z][a-z0-9_-]*$/i.test(r)}function rt(e,r,t){let n=D(k.relative(t,r));return (Array.isArray(e.projects)?e.projects:[]).some(s=>{if(!s||typeof s!="object")return false;let u=s,c=[u.relativePath,u.path].filter(m=>typeof m=="string"&&m.length>0).map(m=>D(m));return u.status==="passed"&&(c.includes(n)||c.some(m=>m.endsWith(`/${n}`)))})}function It(e,r){return te(e,r)?.dependencies??[]}function _t(e,r){let t=Math.max(1,Math.min(4,r)),n=Number(e??t);return Number.isFinite(n)?Math.max(1,Math.min(16,Math.trunc(n))):t}async function vr(e$1){if(!$t(e$1.stage))throw new Error(`Unsupported workspace run stage: ${e$1.stage}`);let r=Date.now(),t=k.resolve(e$1.workspacePath),n=await d(t),o=await wt(t),{projects:s,normalizedScope:u}=await vt(t,o,e$1.scope),c=e$1.affected===true,m=e$1.blastRadius===true,p=e$1.since?.trim()||"HEAD~1",d$1=c?await Rt(t,s,p):new Set(s),i,l="not-applicable",y=0,b$1="all";if(c&&m){let f=await St(t,o,d$1);i=f.expanded,l=f.graphStatus,y=f.expansionDepth,b$1="affected+blast-radius";}else c?(i=d$1,b$1="affected"):(i=d$1,b$1="all");let S=e$1.stage==="init"||e$1.planOnly===true?false:await Et(t,e$1.enforceGates),g=S?await Dt(t):[{gate:"doctor-workspace",status:"skipped",summary:"workspace run gates disabled"},{gate:"readiness",status:"skipped",summary:"workspace run gates disabled"}],v=g.find(f=>f.status==="fail"),E=s.filter(f=>i.has(f)),W=e$1.continueOnError===true||e$1.stage==="init",_=e$1.parallel===true,R=_t(e$1.maxWorkers,E.length),j=E.length,P=0;e$1.json||console.log(T.gray(`Workspace run (${e$1.stage}) started: ${j} target(s), ${_?`parallel x${R}`:"sequential"}`));let $=new Map;for(let f of o){let h=D(k.relative(t,f)),a=s.includes(f),M=a&&i.has(f);$.set(f,{path:f,relativePath:h,projectName:k.basename(h)||k.basename(f),selected:M,affected:M,status:"skipped",exitCode:null,durationMs:0,reason:M?void 0:a?"not affected":"outside scope",framework:void 0,runtimeDetected:void 0,executionCommand:void 0});}if(v)for(let f of E){let h=$.get(f);h&&(h.status="skipped",h.reason=`blocked by ${v.gate}`);}else {let f=async h=>{let a$1=$.get(h);if(!a$1)return;let M=D(k.relative(t,h));e$1.json||console.log(T.gray(`\u23F3 [${P}/${j}] ${e$1.stage} ${M}`)),a$1.selected=true,a$1.affected=true;let A=Date.now(),N=a(h),F=e$1.runtime?.trim().toLowerCase(),L=N.units.filter(w=>!F||w.runtime===F).map(w=>({unit:w,stage:w.stages.find(O=>O.stage===e$1.stage)})).filter(w=>!!w.stage),z=L.map(({unit:w,stage:O})=>({unitId:w.id,runtime:w.runtime,role:w.role,root:w.root,manifest:w.manifest,stage:O.stage,command:O.command,status:"planned",exitCode:null,durationMs:0}));if(a$1.runtimeExecutions=z,e$1.planOnly){a$1.runtimeDetected=L[0]?.unit.runtime,a$1.status="skipped",a$1.reason=L.length>0?`plan only: ${L.length} runtime unit(s)`:F?`no ${F} runtime unit supports stage "${e$1.stage}"`:`no runtime unit supports stage "${e$1.stage}"`,a$1.durationMs=Date.now()-A,P+=1;return}if(N.polyglot||F){if(L.length===0){a$1.status="failed",a$1.reason=F?`No ${F} runtime unit supports stage "${e$1.stage}"`:`No runtime unit supports stage "${e$1.stage}"`,a$1.errorCategory="setup",a$1.errorMessage=a$1.reason,a$1.exitCode=127,a$1.durationMs=Date.now()-A,P+=1;return}let w;for(let C=0;C<L.length;C+=1){let{unit:ve,stage:Re}=L[C],Y=z[C],Se=k.resolve(h,ve.root),ut=Date.now(),ue=await Ze(Se),K=await et(Se,e$1.stage,ve.runtime,ue.framework,{[e$1.stage]:Re.command},ue.environmentCommandVariants,ue.environment);if(Y.durationMs=Date.now()-ut,Y.exitCode=K.exitCode,Y.status=K.exitCode===0?"passed":"failed",Y.reason=K.message,K.exitCode!==0&&!w&&(w=K.message??Re.command),K.exitCode!==0&&!W){for(let Ce of z.slice(C+1))Ce.status="skipped",Ce.reason="stopped after runtime-unit failure";break}}let O=z.find(C=>C.status==="failed");a$1.runtimeDetected=L[0]?.unit.runtime,a$1.executionCommand=z.filter(C=>C.status!=="skipped").map(C=>`[${C.runtime}:${C.root}] ${C.command}`).join(" && "),a$1.durationMs=Date.now()-A,a$1.exitCode=O?.exitCode??0,a$1.status=O?"failed":"passed",a$1.reason=O?w??"runtime-unit stage failed":void 0,a$1.errorCategory=O?"runtime":void 0,a$1.errorMessage=a$1.reason,P+=1;return}let{runtime:se,framework:ae,commandOverrides:st,environmentCommandVariants:at,environment:it}=await Ze(h);a$1.runtimeDetected=se,a$1.framework=ae;let ie=Qe(h,e$1.stage);if(!ie.supported){a$1.status=ie.shouldFail===false?"skipped":"failed",a$1.reason=ie.reason??`stage "${e$1.stage}" unsupported for project`,a$1.durationMs=Date.now()-A,a$1.exitCode=a$1.status==="failed"?127:null,a$1.status==="failed"&&(a$1.errorCategory="setup",a$1.errorMessage=a$1.reason),P+=1;return}if(e$1.reusePassed&&n){let w=n.stages[e$1.stage]??n.stages[e$1.stage];if(w&&rt(w,h,t)){a$1.status="passed",a$1.reason="reused passed result from workspace-run-last.json",a$1.durationMs=Date.now()-A,a$1.exitCode=0,P+=1,e$1.json||console.log(T.gray(`\u21BA reused passed cache for ${M}`));return}}let xe=It(se,ae).filter(w=>w!==e$1.stage);if(xe.length>0&&n){let w=xe.find(O=>{let C=n.stages[O];return !C||!rt(C,h,t)});if(w){a$1.status="skipped",a$1.reason=`dependency stage "${w}" not satisfied in workspace-run-last.json`,a$1.durationMs=Date.now()-A,a$1.exitCode=null,P+=1;return}}let G=await et(h,e$1.stage,se,ae,st,at,it);if(a$1.executionCommand=G.command,a$1.errorCategory=G.errorCategory,a$1.healthStatus=G.healthStatus,a$1.failureDiagnostic=G.failureDiagnostic,a$1.durationMs=Date.now()-A,a$1.exitCode=G.exitCode,G.exitCode===0?(a$1.status="passed",a$1.reason=void 0):(a$1.status="failed",a$1.reason=G.message||"stage command failed",a$1.errorMessage=G.message),P+=1,!e$1.json){let w=j>0?Math.round(P/j*100):100,O=a$1.status==="passed"?T.green("\u2705"):T.red("\u274C");if(console.log(T.gray(`${O} [${P}/${j}] (${w}%) ${M} ${a$1.durationMs}ms`)),a$1.status==="failed"){a$1.reason&&console.log(T.red(` Reason: ${a$1.reason}`)),a$1.executionCommand&&console.log(T.gray(` Command: ${a$1.executionCommand}`));let C=Nt(a$1.runtimeDetected);C&&a$1.errorCategory==="setup"&&console.log(T.gray(` Hint: ${C}`));}}};if(_&&E.length>1){let h=0,a=false,M=new Array(R).fill(null).map(async()=>{for(;h<E.length;){if(a&&!W)return;let A=h;h+=1;let N=E[A];await f(N),$.get(N)?.status==="failed"&&(a=true);}});if(await Promise.all(M),!W&&a){let A=false;for(let N of E){let F=$.get(N);if(F){if(F.status==="failed"){A=true;continue}A&&F.status==="skipped"&&(F.reason=F.reason||"stopped after failure");}}}}else for(let h of E){await f(h);let a=$.get(h);if(!W&&a?.status==="failed"){let M=E.slice(E.indexOf(h)+1);for(let A of M){let N=$.get(A);N&&(N.status="skipped",N.reason="stopped after failure");}break}}}let x=[];for(let f of o){let h=$.get(f);h&&x.push(h);}let I=x.filter(f=>f.status==="passed").length,V=x.filter(f=>f.status==="failed").length,oe=x.filter(f=>f.status==="skipped").length,be=e$1.strict===true,nt=V>0||be&&g.some(f=>f.status==="fail"||f.status==="warn")?1:0,we={schemaVersion:"1.0",workspacePath:t,stage:e$1.stage,generatedAt:new Date().toISOString(),durationMs:Date.now()-r,options:{affected:c,blastRadius:m,since:c?p:null,parallel:_,maxWorkers:R,continueOnError:W,strict:be,enforceGates:S,scope:u,reusePassed:e$1.reusePassed===true,planOnly:e$1.planOnly===true,runtime:e$1.runtime?.trim()||null},selection:{mode:b$1,since:c?p:null,scope:u,graphStatus:l,expansionDepth:y},gates:{enforced:S,results:g,blocked:!!v,blockingGate:v?.gate},summary:{projectCount:o.length,selectedCount:E.length,passed:I,failed:V,skipped:oe,exitCode:nt},projects:x,enterpriseControls:{jsonReady:true,evidencePath:b}},ot=k.join(t,b);return await e(t,we),e$1.json||(v&&(console.log(T.red(`\u274C Workspace run blocked by ${v.gate}`)),console.log(T.gray(` ${v.summary}`))),console.log(T.cyan(`Workspace run (${e$1.stage}) => passed: ${I}, failed: ${V}, skipped: ${oe}`)),console.log(T.gray(`Report: ${ot}`))),we}export{vr as a};
|