workspai 0.47.0 → 0.49.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 +247 -136
- package/contracts/agent-customization-pack.v1.json +5 -0
- package/contracts/cli-runtime-command-inventory.v1.snapshot.json +4 -0
- package/contracts/extension-cli-compatibility.v1.json +8 -2
- package/contracts/published-contract-catalog.v1.json +33 -1
- package/contracts/runtime-command-surface.v1.json +163 -3
- package/contracts/workspace-intelligence/model-usage-event.v1.json +82 -0
- package/contracts/workspace-intelligence/workspace-graph-stream.v1.json +262 -0
- package/contracts/workspace-intelligence/workspace-intelligence-evaluation-comparison.v1.json +53 -0
- package/contracts/workspace-intelligence/workspace-intelligence-evaluation.v1.json +120 -0
- package/contracts/workspace-intelligence-architecture.v1.json +31 -2
- package/contracts/workspace-intelligence-chain.v1.json +44 -3
- package/dist/analyze-EEEU3MIF.js +1 -0
- package/dist/{artifact-remediation-plan-EPALZ2LC.js → artifact-remediation-plan-SPOUHMK5.js} +1 -1
- package/dist/autopilot-release-R4XRTWEM.js +1 -0
- package/dist/{chunk-2TEDAKP6.js → chunk-32OJDBIG.js} +1 -1
- package/dist/{chunk-ZDN7RHXJ.js → chunk-37CVKXBD.js} +1 -1
- package/dist/{chunk-YCL3I2JO.js → chunk-3NU32T4A.js} +1 -1
- package/dist/chunk-3VFA7D5T.js +1 -0
- package/dist/{chunk-CW7PGBIQ.js → chunk-4HDYADHT.js} +1 -1
- package/dist/{chunk-PBHP6JNY.js → chunk-54EP5CEV.js} +1 -1
- package/dist/{chunk-NOFM7MNA.js → chunk-AFL3ACCR.js} +1 -1
- package/dist/{chunk-MEMHNE7Y.js → chunk-BFLJ2R4D.js} +1 -1
- package/dist/{chunk-6SWRNA47.js → chunk-BGPXQQNY.js} +1 -1
- package/dist/chunk-BMWFQXGW.js +1 -0
- package/dist/{chunk-2GHUZDYA.js → chunk-CRHYBQI3.js} +1 -1
- package/dist/{chunk-KZZ36CK5.js → chunk-E2KJ5QWY.js} +1 -1
- package/dist/{chunk-BSRVO52Y.js → chunk-EKZLUMCS.js} +2 -2
- package/dist/{chunk-76YOPAOT.js → chunk-ESLPI3XZ.js} +1 -1
- package/dist/{chunk-DV6GJD4K.js → chunk-HDXNIN4N.js} +1 -1
- package/dist/{chunk-TNQI5VCW.js → chunk-HZDXO65G.js} +14 -14
- package/dist/{chunk-COARSXRC.js → chunk-J5ENLXDF.js} +1 -1
- package/dist/{chunk-QDWYIRHR.js → chunk-K4X3DM7R.js} +1 -1
- package/dist/chunk-LHOZXC2M.js +2 -0
- package/dist/{chunk-RWRLFSKW.js → chunk-NAJCUQ4X.js} +1 -1
- package/dist/{chunk-ZM5NQ5Z2.js → chunk-OW42TZFB.js} +1 -1
- package/dist/{chunk-SK6XRKGG.js → chunk-P3D5YQB2.js} +1 -1
- package/dist/{chunk-TWNFECMN.js → chunk-PHXQR6PX.js} +1 -1
- package/dist/{chunk-ITCAMC2E.js → chunk-PRTR2DQ2.js} +1 -1
- package/dist/{chunk-7VLCK5JW.js → chunk-RHQW3DTP.js} +1 -1
- package/dist/{chunk-22NJ2ZMG.js → chunk-T4YR4RAI.js} +1 -1
- package/dist/{chunk-VBSQ7MF6.js → chunk-TIE2XMGH.js} +20 -20
- package/dist/{chunk-HSGFUKCN.js → chunk-VU7NZHPM.js} +1 -1
- package/dist/{chunk-U5EZHZBX.js → chunk-YJZOMRAS.js} +1 -1
- package/dist/{create-7JKJDAQV.js → create-S64IWHAP.js} +1 -1
- package/dist/{doctor-PGPNIS76.js → doctor-4NNUDNGZ.js} +1 -1
- package/dist/{dotnet-webapi-clean-6TVFBTVI.js → dotnet-webapi-clean-A6MVDYXX.js} +4 -4
- package/dist/{gofiber-standard-2BL7GWZB.js → gofiber-standard-I5YPQG5V.js} +1 -1
- package/dist/{gogin-standard-XGP3KBXA.js → gogin-standard-VY2L4QT5.js} +1 -1
- package/dist/index.d.ts +35 -11
- package/dist/index.js +138 -136
- package/dist/{pipeline-IB6ILJSV.js → pipeline-LHTPE3DR.js} +1 -1
- package/dist/{springboot-standard-JJNUID6M.js → springboot-standard-55XKCBIZ.js} +4 -4
- package/dist/{workspace-H3QXBFGB.js → workspace-PJPRBUMQ.js} +1 -1
- package/dist/{workspace-agent-sync-C7SG2Z5W.js → workspace-agent-sync-662QHXGF.js} +1 -1
- package/dist/{workspace-context-BKQBKA4C.js → workspace-context-23YYCUCP.js} +1 -1
- package/dist/{workspace-contract-RPQQBQXR.js → workspace-contract-TU2I7GC2.js} +1 -1
- package/dist/{workspace-dependency-graph-23BI2HG7.js → workspace-dependency-graph-BP4EXYQ5.js} +1 -1
- package/dist/workspace-explain-MWUEN643.js +1 -0
- package/dist/workspace-explain-contract-ZPI3JXJU.js +1 -0
- package/dist/{workspace-feedback-WAID3IOE.js → workspace-feedback-SUVH2LUJ.js} +1 -1
- package/dist/{workspace-foundation-5OOJEO2D.js → workspace-foundation-WPLD7OEO.js} +1 -1
- package/dist/workspace-graph-stream-KAGGQPJT.js +1 -0
- package/dist/{workspace-history-C6OP3IAQ.js → workspace-history-BANOJRQ2.js} +1 -1
- package/dist/{workspace-intelligence-VKDL3H2J.js → workspace-intelligence-MFJE7W67.js} +1 -1
- package/dist/workspace-intelligence-evaluation-IPH7M3WV.js +1 -0
- package/dist/{workspace-intelligence-runner-LVALAZY7.js → workspace-intelligence-runner-OTYTHV6B.js} +1 -1
- package/dist/{workspace-knowledge-graph-FE2NTZKV.js → workspace-knowledge-graph-ARDC6HHG.js} +1 -1
- package/dist/workspace-knowledge-graph-export-UYAYFTWX.js +10 -0
- package/dist/workspace-mcp-serve-EZR6O76D.js +3 -0
- package/dist/{workspace-model-S33CIB2R.js → workspace-model-7OU2M3LE.js} +1 -1
- package/dist/{workspace-registry-summary-A3YDL63D.js → workspace-registry-summary-ORDK7A36.js} +1 -1
- package/dist/workspace-run-QND2SIYA.js +1 -0
- package/dist/{workspace-verify-ZGH3NXAH.js → workspace-verify-EBVL7FWT.js} +1 -1
- package/dist/workspace-watch-7HWGA5TF.js +1 -0
- package/docs/GLOSSARY.md +28 -24
- package/docs/OPEN_SOURCE_USER_SCENARIOS.md +11 -8
- package/docs/README.md +62 -23
- package/docs/README_CONTENT_CONTRACT.md +154 -0
- package/docs/ci-workflows.md +3 -3
- package/docs/commands-reference.md +16 -3
- package/docs/contracts/ARTIFACT_CATALOG.md +35 -20
- package/docs/contracts/README.md +3 -0
- package/docs/creating-workspaces-and-projects.md +16 -12
- package/docs/doctor-command.md +30 -28
- package/docs/examples/ci-agent-grounding.yml +1 -1
- package/docs/from-code-to-shared-understanding.md +2 -2
- package/docs/graph-benchmark-methodology.md +2 -2
- package/docs/workspace-intelligence-evaluation.md +149 -0
- package/docs/workspace-intelligence-runner.md +17 -6
- package/docs/workspace-knowledge-graph.md +31 -10
- package/docs/workspace-operations.md +13 -5
- package/package.json +9 -4
- package/templates/kits/fastapi-ddd/README.md.j2 +1 -1
- package/dist/analyze-UVXPRGYZ.js +0 -1
- package/dist/autopilot-release-5BQ6F5L2.js +0 -1
- package/dist/chunk-LNRAB7UY.js +0 -1
- package/dist/chunk-NRYS4CLR.js +0 -2
- package/dist/workspace-explain-WVN7JH3U.js +0 -1
- package/dist/workspace-explain-contract-SEFTVF6J.js +0 -1
- package/dist/workspace-mcp-serve-KT2I676Z.js +0 -3
- package/dist/workspace-run-M4LNJILC.js +0 -1
- package/dist/workspace-watch-EVBJTMV7.js +0 -1
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# Measure Workspace Intelligence Usage
|
|
2
|
+
|
|
3
|
+
Use this feature to answer a practical question: did focused workspace context
|
|
4
|
+
help an AI task use fewer tokens, cost less, or reach a verified result?
|
|
5
|
+
|
|
6
|
+
Workspai records model usage, tool activity, reported cost, and the final
|
|
7
|
+
verified outcome in one report that the CLI, IDE, CI, and dashboards can read.
|
|
8
|
+
|
|
9
|
+
It does not store prompt or response text. Optional SHA-256 hashes can connect
|
|
10
|
+
related calls without copying private content into the report.
|
|
11
|
+
|
|
12
|
+
## Start a measured task
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npx workspai workspace eval init repair-readiness workspace-intelligence --json
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
The optional strategy is one of `full-corpus`, `grep`, `vector`, `graph`,
|
|
19
|
+
`workspace-intelligence`, or `custom`.
|
|
20
|
+
|
|
21
|
+
The live source of truth is:
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
.workspai/reports/workspace-intelligence-evaluation-live.json
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Record events
|
|
28
|
+
|
|
29
|
+
Providers and IDE integrations append privacy-bounded events through stdin:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
printf '%s\n' '{
|
|
33
|
+
"kind": "model-call",
|
|
34
|
+
"stage": "context",
|
|
35
|
+
"modelCall": {
|
|
36
|
+
"provider": "vscode-lm",
|
|
37
|
+
"model": "selected-model",
|
|
38
|
+
"source": "provider-reported",
|
|
39
|
+
"inputTokens": 18420,
|
|
40
|
+
"outputTokens": 2150,
|
|
41
|
+
"cachedInputTokens": 6200,
|
|
42
|
+
"reasoningTokens": null,
|
|
43
|
+
"latencyMs": 4820
|
|
44
|
+
}
|
|
45
|
+
}' | npx workspai workspace eval record --json
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`source` is mandatory:
|
|
49
|
+
|
|
50
|
+
| Source | Meaning |
|
|
51
|
+
| ------------------- | -------------------------------------------------------------- |
|
|
52
|
+
| `provider-reported` | The provider returned the count |
|
|
53
|
+
| `tokenizer-counted` | A named tokenizer counted the exact serialized input or output |
|
|
54
|
+
| `estimated` | A documented estimate; never presented as provider billing |
|
|
55
|
+
| `unavailable` | The provider exposed no usable count |
|
|
56
|
+
|
|
57
|
+
Tool events record progress and repeated work without storing command output:
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"kind": "tool-call",
|
|
62
|
+
"stage": "verify",
|
|
63
|
+
"toolCall": {
|
|
64
|
+
"tool": "workspace verify",
|
|
65
|
+
"result": "passed",
|
|
66
|
+
"changedSource": false,
|
|
67
|
+
"durationMs": 814,
|
|
68
|
+
"artifact": ".workspai/reports/workspace-verify-last-run.json"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Finish with a verified outcome event. Tokens per successful outcome remain
|
|
74
|
+
`null` until `status` is `passed` and `verified` is `true`.
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"kind": "outcome",
|
|
79
|
+
"stage": "verify",
|
|
80
|
+
"outcome": {
|
|
81
|
+
"status": "passed",
|
|
82
|
+
"verified": true,
|
|
83
|
+
"blockersResolved": 1,
|
|
84
|
+
"summary": "Readiness passed after dependency remediation."
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Event bodies conform to
|
|
90
|
+
[`model-usage-event.v1.json`](../contracts/workspace-intelligence/model-usage-event.v1.json).
|
|
91
|
+
|
|
92
|
+
## Inspect and finalize
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
npx workspai workspace eval status --json
|
|
96
|
+
npx workspai workspace eval report --json
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Finalization writes:
|
|
100
|
+
|
|
101
|
+
```text
|
|
102
|
+
.workspai/reports/workspace-intelligence-evaluation-last-run.json
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Both live and final reports conform to
|
|
106
|
+
[`workspace-intelligence-evaluation.v1.json`](../contracts/workspace-intelligence/workspace-intelligence-evaluation.v1.json).
|
|
107
|
+
|
|
108
|
+
## Compare strategies
|
|
109
|
+
|
|
110
|
+
Save a completed baseline, run the same fixed task using another strategy, then
|
|
111
|
+
compare:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
npx workspai workspace eval compare --from .workspai/reports/baselines/full-corpus.json --json
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
The comparison reports token, model-call, tool-call, latency, and verified
|
|
118
|
+
outcome differences. A smaller prompt is not treated as a better result unless
|
|
119
|
+
the outcomes are task-aligned and independently verified.
|
|
120
|
+
|
|
121
|
+
Comparison JSON conforms to
|
|
122
|
+
[`workspace-intelligence-evaluation-comparison.v1.json`](../contracts/workspace-intelligence/workspace-intelligence-evaluation-comparison.v1.json),
|
|
123
|
+
so CI, IDE, and dashboard consumers do not need to infer its shape.
|
|
124
|
+
|
|
125
|
+
## Extension and dashboard contract
|
|
126
|
+
|
|
127
|
+
The VS Code extension should watch the live artifact and display its values; it
|
|
128
|
+
must not independently estimate or relabel them. At minimum the UI should show:
|
|
129
|
+
|
|
130
|
+
- run and session identity;
|
|
131
|
+
- live/final status and update time;
|
|
132
|
+
- input, output, cached-input, and reasoning token components;
|
|
133
|
+
- provider-reported, tokenizer-counted, estimated, and unavailable call counts;
|
|
134
|
+
- cost grouped by currency and source;
|
|
135
|
+
- tool calls, repeated artifact reads, and no-progress decisions;
|
|
136
|
+
- verified outcome and blockers resolved.
|
|
137
|
+
|
|
138
|
+
This makes the CLI artifact the source of truth for terminal, extension, CI,
|
|
139
|
+
and future hosted dashboards. MCP clients can read the same artifact through
|
|
140
|
+
`getWorkspaceEvaluation`; agent-sync also includes the finalized report in the
|
|
141
|
+
governed evidence index when it exists.
|
|
142
|
+
|
|
143
|
+
## Relationship to the graph benchmark
|
|
144
|
+
|
|
145
|
+
`workspace graph benchmark` measures **retrieval payload size** using a portable
|
|
146
|
+
character estimate. `workspace eval` measures **observed agent execution** and
|
|
147
|
+
requires outcome evidence. Keep both: the first is deterministic and
|
|
148
|
+
provider-independent; the second is the basis for real token, cost, and task
|
|
149
|
+
efficiency claims.
|
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
# Unified Workspace Intelligence Runner
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Use one command when you want the latest answer to these questions:
|
|
4
|
+
|
|
5
|
+
- What projects and relationships exist now?
|
|
6
|
+
- What changed, and what may be affected?
|
|
7
|
+
- Is the workspace healthy and ready?
|
|
8
|
+
- What should developers, CI, IDEs, and AI tools read?
|
|
9
|
+
|
|
10
|
+
Run it from a Workspai workspace root:
|
|
6
11
|
|
|
7
12
|
```bash
|
|
8
|
-
npx workspai workspace intelligence run --for-agent
|
|
13
|
+
npx workspai workspace intelligence run --for-agent generic --strict --json
|
|
9
14
|
```
|
|
10
15
|
|
|
11
|
-
|
|
16
|
+
`generic` is the vendor-neutral context surface. Replace it with `codex`,
|
|
17
|
+
`claude`, `cursor`, or `orca` for agent-specific context. The `agent-sync`
|
|
18
|
+
stage also publishes shared grounding for GitHub Copilot, VS Code, and
|
|
19
|
+
`AGENTS.md` consumers.
|
|
20
|
+
|
|
21
|
+
Workspai runs the required steps in a fixed order and saves one final report.
|
|
22
|
+
The technical contract writes that report atomically to
|
|
12
23
|
`.workspai/reports/workspace-intelligence-run-last-run.json` with schema
|
|
13
24
|
`workspace-intelligence-run.v1`. JSON stdout returns the same report payload.
|
|
14
25
|
Consumers should read the persisted report when they need durable evidence and
|
|
@@ -154,7 +165,7 @@ publish it without applying the relevant redaction policy.
|
|
|
154
165
|
The simplest hard gate is:
|
|
155
166
|
|
|
156
167
|
```bash
|
|
157
|
-
npx workspai workspace intelligence run --for-agent
|
|
168
|
+
npx workspai workspace intelligence run --for-agent generic --strict --json
|
|
158
169
|
```
|
|
159
170
|
|
|
160
171
|
Both exit `1` and exit `2` fail a normal CI step. If artifacts must be uploaded
|
|
@@ -93,16 +93,17 @@ be traced through `proofIds`.
|
|
|
93
93
|
|
|
94
94
|
## Pick the command by question
|
|
95
95
|
|
|
96
|
-
| You want to know… | Use
|
|
97
|
-
| ---------------------------------------------------- |
|
|
98
|
-
| What is relevant to a natural-language question? | `workspace graph search <query> --limit <n> --json`
|
|
99
|
-
| Which entities of one type exist? | `workspace graph entities <kind> --json`
|
|
100
|
-
| Why does Workspai believe an item exists? | `workspace graph evidence <entity-or-relation> --json`
|
|
101
|
-
| How are two things connected? | `workspace graph path <from> <to> --json`
|
|
102
|
-
| What changed between graph revisions? | `workspace graph overlay --from <graph.json> --json`
|
|
103
|
-
| What is the full portable graph? | `workspace graph emit --json`
|
|
104
|
-
| How
|
|
105
|
-
| How
|
|
96
|
+
| You want to know… | Use |
|
|
97
|
+
| ---------------------------------------------------- | ------------------------------------------------------- |
|
|
98
|
+
| What is relevant to a natural-language question? | `workspace graph search <query> --limit <n> --json` |
|
|
99
|
+
| Which entities of one type exist? | `workspace graph entities <kind> --json` |
|
|
100
|
+
| Why does Workspai believe an item exists? | `workspace graph evidence <entity-or-relation> --json` |
|
|
101
|
+
| How are two things connected? | `workspace graph path <from> <to> --json` |
|
|
102
|
+
| What changed between graph revisions? | `workspace graph overlay --from <graph.json> --json` |
|
|
103
|
+
| What is the full portable graph? | `workspace graph emit --json` |
|
|
104
|
+
| How do I export to semantic or graph-analysis tools? | `workspace graph jsonld\|graphml\|gexf --output <file>` |
|
|
105
|
+
| How much retrieval payload did one query avoid? | `workspace graph benchmark <query> --limit <n> --json` |
|
|
106
|
+
| How should an MCP-compatible agent retrieve context? | `workspace mcp serve` → `searchWorkspaceGraph` |
|
|
106
107
|
|
|
107
108
|
## What it models
|
|
108
109
|
|
|
@@ -186,6 +187,26 @@ The complete graph is an interchange artifact, not a prompt. Agents should
|
|
|
186
187
|
start with `INDEX.json`, use bounded search, then retrieve evidence or a path
|
|
187
188
|
for the selected result.
|
|
188
189
|
|
|
190
|
+
### Interchange and visualization
|
|
191
|
+
|
|
192
|
+
The JSON artifact is the canonical interchange form of the derived graph; the
|
|
193
|
+
Workspace Model remains the system source of truth. Other formats are
|
|
194
|
+
deterministic projections of that same graph revision:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
npx workspai workspace graph mermaid
|
|
198
|
+
npx workspai workspace graph dot
|
|
199
|
+
npx workspai workspace graph jsonld --output workspace-graph.jsonld
|
|
200
|
+
npx workspai workspace graph graphml --output workspace-graph.graphml
|
|
201
|
+
npx workspai workspace graph gexf --output workspace-graph.gexf
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
- Mermaid and DOT are suited to documentation and architecture diagrams.
|
|
205
|
+
- JSON-LD carries semantic identities, relations, and proof references.
|
|
206
|
+
- GraphML and GEXF work with graph-analysis and interactive visualization tools.
|
|
207
|
+
- The canonical JSON, JSON-LD, GraphML, and GEXF outputs can drive 2D or 3D
|
|
208
|
+
viewers; a 3D view is a presentation layer, not a separate source of truth.
|
|
209
|
+
|
|
189
210
|
## AI tool output locations
|
|
190
211
|
|
|
191
212
|
`workspace agent-sync --write --preset enterprise` generates native surfaces
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Workspace Operations
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Use this guide to bring existing software into Workspai, move or share workspace
|
|
4
|
+
state safely, and manage supporting local services. It explains what each
|
|
5
|
+
operation changes before you run it.
|
|
4
6
|
|
|
5
7
|
Command syntax: [commands-reference.md](./commands-reference.md).
|
|
6
8
|
|
|
@@ -8,8 +10,11 @@ Command syntax: [commands-reference.md](./commands-reference.md).
|
|
|
8
10
|
|
|
9
11
|
Use `import` to copy or clone an existing project into a Workspai workspace.
|
|
10
12
|
Use `adopt` when the project must stay where it already lives but should become
|
|
11
|
-
visible to Workspai
|
|
12
|
-
|
|
13
|
+
visible to Workspai. In both cases, the project becomes part of the shared
|
|
14
|
+
system map, checks, and AI context.
|
|
15
|
+
|
|
16
|
+
RapidKit Core module commands remain available only when existing project
|
|
17
|
+
metadata identifies a kit that supports modules.
|
|
13
18
|
|
|
14
19
|
```bash
|
|
15
20
|
npx workspai import ../orders-api
|
|
@@ -24,7 +29,8 @@ npx workspai adopt --json
|
|
|
24
29
|
- Local folders are copied; git sources are cloned with shallow history.
|
|
25
30
|
- Outside any workspace (no `--workspace`), Workspai creates or reuses the managed `workspai` workspace. New defaults use `~/.workspai/workspaces/workspai`; valid legacy candidates under `~/rapidkit/workspaces/workspai` and `~/Workspai/rapidkits/workspai` can still be reused.
|
|
26
31
|
- Existing workspaces under legacy managed roots remain registered after upgrade.
|
|
27
|
-
- CLI prints
|
|
32
|
+
- CLI prints the exact next `cd ...` step. JSON mode returns the same value as
|
|
33
|
+
`suggestedCdCommand`.
|
|
28
34
|
- Failed workspace sync rolls back imported files and registry entries.
|
|
29
35
|
|
|
30
36
|
### Adopt behavior
|
|
@@ -38,7 +44,9 @@ npx workspai adopt --json
|
|
|
38
44
|
### JSON output (`--json`)
|
|
39
45
|
|
|
40
46
|
- Import returns `workspacePath`, `workspaceResolution`, `defaultWorkspaceCreated`, `suggestedCdCommand`, and `importedProject`. The imported project includes its `source`.
|
|
41
|
-
- Adopt returns `workspacePath`, `workspaceResolution`,
|
|
47
|
+
- Adopt returns `workspacePath`, `workspaceResolution`,
|
|
48
|
+
`defaultWorkspaceCreated`, `wouldCreateDefaultWorkspace`,
|
|
49
|
+
`suggestedCdCommand`, `dryRun`, and `adoptedProject`.
|
|
42
50
|
- Project results include detected `name`, `path`, `stack`, `runtime`, `framework`, `supportTier`, `moduleSupport`, and `confidence` where available.
|
|
43
51
|
|
|
44
52
|
Imported projects receive `.workspai/import-readiness.json`. Adopted projects add frontend-aware detection for Next.js, React, Vite, Vue, Angular, SvelteKit, Nuxt, Astro, Remix, and Solid.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "workspai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.49.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": [
|
|
@@ -35,13 +35,17 @@
|
|
|
35
35
|
"generator",
|
|
36
36
|
"scaffold"
|
|
37
37
|
],
|
|
38
|
-
"author": "
|
|
38
|
+
"author": "Chistiq",
|
|
39
39
|
"license": "MIT",
|
|
40
40
|
"repository": {
|
|
41
41
|
"type": "git",
|
|
42
|
-
"url": "git+https://github.com/
|
|
42
|
+
"url": "git+https://github.com/chistiq/workspai.git",
|
|
43
43
|
"directory": "packages/cli"
|
|
44
44
|
},
|
|
45
|
+
"homepage": "https://www.workspai.com/",
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "https://github.com/chistiq/workspai/issues"
|
|
48
|
+
},
|
|
45
49
|
"bin": {
|
|
46
50
|
"workspai": "dist/index.js"
|
|
47
51
|
},
|
|
@@ -117,10 +121,11 @@
|
|
|
117
121
|
"security:fix": "corepack npm audit fix",
|
|
118
122
|
"metrics": "tsx scripts/metrics.ts",
|
|
119
123
|
"validate:docs-examples": "node scripts/validate-doc-examples.mjs",
|
|
124
|
+
"check:github-release-notes": "node scripts/github-release-notes.mjs --check",
|
|
120
125
|
"check:markdown-links": "node scripts/check-markdown-links.mjs",
|
|
121
126
|
"check:docs-drift": "node scripts/docs-drift-guard.mjs",
|
|
122
127
|
"smoke:readme": "node scripts/smoke-readme-commands.mjs",
|
|
123
|
-
"validate:docs": "corepack npm run check:markdown-links && corepack npm run check:docs-drift && corepack npm run validate:docs-examples && corepack npm run smoke:readme",
|
|
128
|
+
"validate:docs": "corepack npm run check:markdown-links && corepack npm run check:docs-drift && corepack npm run validate:docs-examples && corepack npm run check:github-release-notes && corepack npm run smoke:readme",
|
|
124
129
|
"smoke:frontend-generators": "tsup && node scripts/smoke-frontend-generators.mjs",
|
|
125
130
|
"smoke:frontend-generators:network": "tsup && node scripts/smoke-frontend-generators.mjs --execute",
|
|
126
131
|
"sync:contracts": "node scripts/sync-contracts.mjs",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# {{ project_name }}
|
|
2
2
|
|
|
3
|
-
Domain-driven FastAPI service generated with [RapidKit Core](https://github.com/
|
|
3
|
+
Domain-driven FastAPI service generated with [RapidKit Core](https://github.com/chistiq/rapidkit-core). It can be adopted into Workspai workspace intelligence when you want workspace-level context, evidence, and release governance.
|
|
4
4
|
|
|
5
5
|
## Quick start
|
|
6
6
|
|
package/dist/analyze-UVXPRGYZ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{b as printAnalyzeReport,a as runAnalyze}from'./chunk-PBHP6JNY.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{b as AUTOPILOT_RELEASE_ALIAS_FILENAME,a as AUTOPILOT_RELEASE_LAST_RUN_FILENAME,c as runAutopilotRelease}from'./chunk-QDWYIRHR.js';
|
package/dist/chunk-LNRAB7UY.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var o={model:".workspai/reports/workspace-model.json",knowledgeGraph:".workspai/reports/workspace-knowledge-graph.json",snapshot:".workspai/reports/workspace-model-snapshot.json",diff:".workspai/reports/workspace-model-diff-last-run.json",impact:".workspai/reports/workspace-impact-last-run.json",analyze:".workspai/reports/analyze-last-run.json",doctor:".workspai/reports/doctor-last-run.json",contractVerify:".workspai/reports/workspace-contract-verify-last-run.json",readiness:".workspai/reports/release-readiness-last-run.json",verify:".workspai/reports/workspace-verify-last-run.json",history:".workspai/reports/workspace-intelligence-history.json",agentContext:".workspai/reports/workspace-context-agent.json",agentIndex:".workspai/reports/INDEX.json",agentCustomizationPack:".workspai/reports/agent-customization-pack.json",skillsIndex:".workspai/reports/workspace-skills-index.json",agents:"AGENTS.md",explain:".workspai/reports/workspace-explain-last-run.json",intelligenceRun:".workspai/reports/workspace-intelligence-run-last-run.json"},t={model:"workspace-model.v1",knowledgeGraph:"workspace-knowledge-graph.v1",snapshot:"workspace-model-snapshot.v1",diff:"workspace-model-diff.v1",impact:"workspace-impact.v1",analyze:"rapidkit-analyze-v1",doctor:"doctor-workspace-evidence-v1",contractVerify:"workspace-contract-verify.v1",readiness:"release-readiness-v1",verify:"workspace-verify.v1",history:"workspace-intelligence-history.v1",agentContext:"workspace-context.v1",agentIndex:"rapidkit-agent-reports-index.v1",agentCustomizationPack:"rapidkit-agent-customization-pack.v1",skillsIndex:"workspace-skills-index.v1",agents:null,explain:"workspace-explain.v1",intelligenceRun:"workspace-intelligence-run.v1"},r={model:"contracts/workspace-intelligence/workspace-model.v1.json",knowledgeGraph:"contracts/workspace-intelligence/workspace-knowledge-graph.v1.json",snapshot:"contracts/workspace-intelligence/workspace-model-snapshot.v1.json",diff:"contracts/workspace-intelligence/workspace-model-diff.v1.json",impact:"contracts/workspace-intelligence/workspace-impact.v1.json",analyze:"contracts/analyze-last-run.v1.json",doctor:"contracts/doctor-workspace-evidence.v1.json",contractVerify:"contracts/workspace-intelligence/workspace-contract-verify.v1.json",readiness:"contracts/release-readiness.v1.json",verify:"contracts/workspace-intelligence/workspace-verify.v1.json",history:"contracts/workspace-intelligence/workspace-intelligence-history.v1.json",agentContext:"contracts/workspace-intelligence/workspace-context.v1.json",agentIndex:"contracts/workspace-intelligence/agent-reports-index.v1.json",agentCustomizationPack:"contracts/workspace-intelligence/agent-customization-pack-report.v1.json",skillsIndex:"contracts/workspace-intelligence/workspace-skills-index.v1.json",agents:null,explain:"contracts/workspace-intelligence/workspace-explain.v1.json",intelligenceRun:"contracts/workspace-intelligence/workspace-intelligence-run.v1.json"},a={analyze:"analyze",workspace:"workspace <action> [subaction] [key] [value]",doctor:"doctor [scope]",readiness:"readiness"},c=["analyze","readiness","doctor","workspace"],i=["model","diff","impact","doctor-evidence","contract-evidence","analyze-evidence","readiness-evidence","verify","context","agent-sync","explain"],p=["sync","baseline"],l={sync:[".workspai/workspace.contract.json",".workspai/workspace-registry.v1.json"],baseline:[o.snapshot]},e=o,d={model:{command:["workspace","model","--json","--write"],produces:[e.model,e.knowledgeGraph]},diff:{command:["workspace","diff","--from",e.snapshot,"--json"],produces:[e.diff]},impact:{command:["workspace","impact","--from",e.diff,"--json"],produces:[e.impact]},"doctor-evidence":{command:["doctor","workspace","--json"],produces:[e.doctor]},"contract-evidence":{command:["workspace","contract","verify","--strict","--json"],produces:[e.contractVerify]},"analyze-evidence":{command:["analyze","--json"],produces:[e.analyze]},"readiness-evidence":{command:["readiness","--json","--skip-verify"],produces:[e.readiness]},verify:{command:["workspace","verify","--from-impact",e.impact,"--json"],produces:[e.verify,e.history]},context:{command:["workspace","context","--for-agent","--json","--write","--no-agent-sync"],produces:[e.agentContext]},"agent-sync":{command:["workspace","agent-sync","--write","--json","--preset","enterprise"],produces:[e.agentIndex,e.agentCustomizationPack,e.skillsIndex,e.agents]},explain:{command:["workspace","explain","release-blocked","--json","--write"],produces:[e.explain]}};export{o as a,t as b,r as c,a as d,c as e,i as f,p as g,l as h,d as i};
|
package/dist/chunk-NRYS4CLR.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {k,b as b$1,c as c$2}from'./chunk-ZDN7RHXJ.js';import {c as c$1}from'./chunk-RWRLFSKW.js';import {a as a$1}from'./chunk-22NJ2ZMG.js';import {e}from'./chunk-2TEDAKP6.js';import {b,a,i,c}from'./chunk-LNRAB7UY.js';import _ from'path';import T from'fs-extra';var D="workspai-workspace-intelligence-chain-v1",V="contracts/workspace-intelligence-chain.v1.json";function P(){let e=a,t=i,s=[{id:"model",ordinal:1,phase:"understand",label:"Model",command:[...t.model.command],consumes:["workspace markers","project metadata","registry","contract","policies"],inputRefs:["projects-repositories","runtime-dependencies","workspace-rules","existing-evidence"],consumesArtifacts:[],produces:[...t.model.produces],dependsOn:[],exitPolicy:"stop-on-error",purpose:"Build the canonical current model of the software system."},{id:"diff",ordinal:2,phase:"change",label:"Diff",command:[...t.diff.command],consumes:[e.model,e.snapshot],inputRefs:["changes","model-baseline"],consumesArtifacts:[e.model,e.snapshot],produces:[...t.diff.produces],dependsOn:["model"],exitPolicy:"stop-on-error",purpose:"Describe structural change against the selected baseline."},{id:"impact",ordinal:3,phase:"change",label:"Impact",command:[...t.impact.command],consumes:[e.model,e.diff],inputRefs:[],consumesArtifacts:[e.model,e.diff],produces:[...t.impact.produces],dependsOn:["diff"],exitPolicy:"stop-on-error",purpose:"Calculate transitive blast radius over the workspace graph."},{id:"doctor-evidence",ordinal:4,phase:"evidence",label:"Doctor Evidence",command:[...t["doctor-evidence"].command],consumes:["workspace runtime and project health signals"],inputRefs:["projects-repositories","runtime-dependencies","existing-evidence"],consumesArtifacts:[],produces:[...t["doctor-evidence"].produces],dependsOn:["impact"],exitPolicy:"continue-on-structured-verdict",purpose:"Refresh health evidence after the impact artifact exists."},{id:"contract-evidence",ordinal:5,phase:"evidence",label:"Contract Evidence",command:[...t["contract-evidence"].command],consumes:[".workspai/workspace.contract.json"],inputRefs:["workspace-rules"],consumesArtifacts:[],produces:[...t["contract-evidence"].produces],dependsOn:["impact"],exitPolicy:"continue-on-structured-verdict",purpose:"Refresh structural contract evidence without hiding failed verdicts."},{id:"analyze-evidence",ordinal:6,phase:"evidence",label:"Analyze Evidence",command:[...t["analyze-evidence"].command],consumes:[e.model,"workspace runtime and dependency signals"],inputRefs:["projects-repositories","runtime-dependencies","workspace-rules"],consumesArtifacts:[e.model],produces:[...t["analyze-evidence"].produces],dependsOn:["impact"],exitPolicy:"continue-on-structured-verdict",purpose:"Refresh analysis evidence required by the release-readiness gate."},{id:"readiness-evidence",ordinal:7,phase:"evidence",label:"Readiness Evidence",command:[...t["readiness-evidence"].command],consumes:["doctor, analysis, runtime, and release signals"],inputRefs:["runtime-dependencies","existing-evidence"],consumesArtifacts:[e.doctor,e.contractVerify,e.analyze],produces:[...t["readiness-evidence"].produces],dependsOn:["doctor-evidence","contract-evidence","analyze-evidence"],exitPolicy:"continue-on-structured-verdict",purpose:"Refresh release-readiness evidence before the definitive gate."},{id:"verify",ordinal:8,phase:"gate",label:"Verify",command:[...t.verify.command],consumes:[e.impact,e.doctor,e.contractVerify,e.readiness],inputRefs:[],consumesArtifacts:[e.impact,e.doctor,e.contractVerify,e.readiness],produces:[...t.verify.produces],dependsOn:["impact","doctor-evidence","contract-evidence","analyze-evidence","readiness-evidence"],exitPolicy:"continue-on-structured-verdict",purpose:"Emit the definitive evidence-backed workspace gate."},{id:"context",ordinal:9,phase:"ground",label:"Agent Context",command:[...t.context.command],consumes:[e.model,e.impact,e.verify],inputRefs:[],consumesArtifacts:[e.model,e.impact,e.verify],produces:[...t.context.produces],dependsOn:["verify"],exitPolicy:"stop-on-error",purpose:"Build compact agent context from the same verified evidence."},{id:"agent-sync",ordinal:10,phase:"distribute",label:"Agent Grounding",command:[...t["agent-sync"].command],consumerArgs:{vscode:["--target","vscode"]},consumes:[e.agentContext],inputRefs:[],consumesArtifacts:[e.agentContext],produces:[...t["agent-sync"].produces],dependsOn:["context"],exitPolicy:"stop-on-error",purpose:"Distribute one context into portable agent and IDE surfaces."},{id:"explain",ordinal:11,phase:"explain",label:"Explain",command:[...t.explain.command],consumes:[e.verify,e.impact],inputRefs:[],consumesArtifacts:[e.verify,e.impact],produces:[...t.explain.produces],dependsOn:["verify"],exitPolicy:"continue-on-structured-verdict",purpose:"Translate evidence and blockers into a human and agent-readable narrative."}];return {schemaVersion:D,name:"Workspace Intelligence Chain",contractPath:V,invariant:"Every consumer must preserve step identity, dependencies, artifact flow, and verdict semantics; presentation may change, chain meaning may not.",invariants:["Missing or unreadable input is unknown or unavailable; it must not be presented as verified absence.","Freshness and provenance travel with evidence and must not be discarded by projections.","The current graph is a workspace dependency graph, not a complete cross-language symbol or call graph.","Simple and standard presentations summarize the contract; their contractRefs must preserve complete traceability.","Conditional provider outputs must be resolved through their dedicated inventory contract.","Auxiliary capabilities expose or refresh intelligence but are not mandatory execution-chain steps.","Canonical step commands are stage-pure: they must not implicitly execute a downstream chain step or regenerate an upstream artifact.","Canonical JSON artifacts must satisfy their registered schema both when produced and when consumed across CLI, MCP, IDE, and CI trust boundaries.","Schema validity is necessary but not sufficient: hashes, embedded models, summaries, counts, graph statistics, and artifact references must remain semantically coherent.","Persisted impact evidence must be rejected as stale when the current workspace model or Git observation no longer matches its embedded diff.","Canonical artifact replacement must be atomic and workspace-contained; an interrupted or denied write must preserve the last valid artifact.","Concurrent history updates must be serialized without silently dropping entries, and invalid history must never be overwritten as if it were absent.","The canonical global registry is ~/.workspai/workspaces.json; ~/.rapidkit/workspaces.json is a non-authoritative compatibility mirror for legacy consumers and must not diverge after a CLI registry mutation."],semantics:{workspace:"The governed operating boundary that relates one or more projects and repositories to shared metadata, policies, contracts, evidence, and consumers.",repository:"A source-control boundary that may contain one or more projects and may live inside or outside the workspace root.",project:"A discoverable build or runtime unit with its own path, metadata or observable manifests, command capabilities, and evidence.",evidence:"A sourced observation or generated verification result with provenance and freshness; evidence may be consumed by a later run.",artifact:"A durable generated file that another command or consumer can read without parsing terminal prose.",gate:"A structured verdict with reasons and exit semantics derived from current evidence."},workspaceLifecycle:{ingestionRoutes:[{id:"create",label:"Create",commands:["create workspace","create project"],result:"Create a workspace or supported project and write canonical Workspai metadata."},{id:"adopt",label:"Adopt",commands:["adopt"],result:"Register an existing project in place without requiring source relocation."},{id:"import",label:"Import",commands:["import","workspace import"],result:"Attach an existing project or repository path to the workspace inventory."}],durableState:[{id:"workspace-identity",paths:[".workspai-workspace",".workspai/workspace.json"],purpose:"Identify the workspace boundary, profile, and canonical root."},{id:"project-inventory",paths:[".workspai/project.json",".workspai/context.json",".workspai/adopt.json","~/.workspai/workspaces.json","~/.rapidkit/workspaces.json (legacy compatibility mirror)"],purpose:"Record native, adopted, imported, and globally registered project locations while preserving a non-authoritative mirror for legacy extension discovery."},{id:"governance",paths:[".workspai/policies.yml",".workspai/workspace.contract.json"],purpose:"Define workspace policy and explicit structural relationships."},{id:"graph-overrides",paths:[".workspai/workspace-graph.overrides.json"],purpose:"Provide explicit dependency edges that override inferred relationships."}],rule:"Create, adopt, and import are ingestion routes, not intelligence facts. Their durable state becomes observable input to Model."},runtimeRegistry:{authority:"contracts/workspace-intelligence-runtime-registry.ts",artifacts:Object.entries(a).map(([r,a])=>({id:r,path:a,schemaVersion:b[r],schemaContract:c[r]}))},executionEnvelope:{rule:"Sync and baseline resolution are deterministic execution prerequisites, not canonical intelligence stages; every run reports them separately and preserves the exact canonical stage sequence.",operations:[{id:"sync",executionPoint:"before:model",artifacts:[".workspai/workspace.contract.json",".workspai/workspace-registry.v1.json"],failurePolicy:"stop-and-report",purpose:"Reconcile portable workspace inventory and contract inputs before modeling."},{id:"baseline",executionPoint:"after:model-before:diff",artifacts:[e.snapshot],failurePolicy:"stop-and-report",purpose:"Create an initial structural baseline when absent or reuse the existing baseline before Diff."}],report:{artifact:e.intelligenceRun,schemaVersion:b.intelligenceRun,invariant:"The report must preserve exact preflight and stage order, registry-owned artifacts, failure propagation, and aggregate status/exit semantics."}},boundaries:{inputs:[{id:"projects-repositories",label:"Projects and repositories",sources:["projects","repositories","services","modules","imported paths"],entersAt:"model"},{id:"runtime-dependencies",label:"Runtime and dependencies",sources:["runtime manifests","lockfiles","scripts","framework markers","package dependencies","supported source imports (currently bounded JavaScript and TypeScript scanning)"],entersAt:"model"},{id:"workspace-rules",label:"Workspace rules",sources:["workspace markers","registry","project metadata","contracts","policies","ownership","graph overrides"],entersAt:"model"},{id:"changes",label:"Changes",sources:["repository state","git state","model baseline","workspace diff"],entersAt:"diff"},{id:"model-baseline",label:"Explicit model baseline",sources:[e.snapshot],entersAt:"diff"},{id:"existing-evidence",label:"Existing evidence",sources:["doctor reports","analysis reports","contract verification","release readiness","pipeline results","tests and runtime evidence","previous intelligence artifacts"],entersAt:"doctor-evidence"}],outputs:[{id:"understanding",label:"System understanding",artifacts:[e.model,e.knowledgeGraph,e.diff,e.impact],producedBy:["model","diff","impact"],inventory:"complete-for-chain"},{id:"governance-evidence",label:"Governance evidence",artifacts:[e.doctor,e.contractVerify,e.analyze,e.readiness,e.verify,e.history],producedBy:["doctor-evidence","contract-evidence","analyze-evidence","readiness-evidence","verify"],inventory:"complete-for-chain"},{id:"agent-grounding",label:"Agent grounding",artifacts:[e.agentContext,e.agentIndex,e.agentCustomizationPack,e.skillsIndex,e.agents],producedBy:["context","agent-sync"],inventory:"canonical-minimum",inventoryContract:"contracts/agent-customization-pack.v1.json"},{id:"explanations",label:"Explainable decisions",artifacts:[e.explain],producedBy:["explain"],inventory:"complete-for-chain"}],consumers:[{id:"developers",label:"Developers",channels:["CLI","reports","AGENTS.md"]},{id:"ci",label:"CI",channels:["JSON artifacts","exit codes","release gates"]},{id:"ides",label:"IDEs",channels:["synced contracts","extension","agent context"]},{id:"ai-agents",label:"AI agents",channels:["INDEX.json","context","skills","MCP"]}]},deliveryChannels:[{id:"artifacts",carries:["reports","models","context","grounding","skills"],authority:"canonical"},{id:"json-stdout",carries:["structured command results"],authority:"projection"},{id:"human-cli",carries:["summaries","diagnostics","next actions"],authority:"projection"},{id:"exit-codes",carries:["gate and command status"],authority:"projection"},{id:"watch-events",carries:["incremental workspace change events"],authority:"projection"},{id:"mcp",carries:["read-mostly access to current workspace artifacts"],authority:"projection"}],feedback:{from:["developers","ci","ides","ai-agents"],signals:["source commits","dependency updates","policy and contract edits","repairs","test and runtime results","agent action outcomes"],reentersThrough:["projects-repositories","runtime-dependencies","workspace-rules","changes","existing-evidence"],rule:"Consumer actions are not silently treated as truth. They re-enter as observable changes or evidence and must be modeled and verified again."},auxiliaryCapabilities:[{id:"graph",commands:["workspace graph emit","workspace graph explain","workspace graph dot","workspace graph mermaid"],reads:[e.model,e.knowledgeGraph],role:"Query the proof-backed graph derived from the canonical workspace model.",chainStep:false},{id:"watch",commands:["workspace watch"],reads:["workspace inputs",e.model],role:"Refresh the model incrementally and emit deterministic change events.",chainStep:false},{id:"mcp",commands:["workspace mcp serve"],reads:["workspace evidence artifacts"],role:"Expose read-mostly workspace evidence to compatible clients.",chainStep:false}],presentations:{simple:{layers:["inputs","intelligence","outputs","consumers"],nodes:[{id:"input-layer",kind:"inputs",label:"Input Layer",summary:"Projects \xB7 Repositories \xB7 Dependencies \xB7 Changes",contractRefs:["projects-repositories","runtime-dependencies","workspace-rules","changes","model-baseline","existing-evidence"]},{id:"workspace-intelligence",kind:"intelligence",label:"Workspace Intelligence",summary:"Model \xB7 Graph \xB7 Impact \xB7 Verify",contractRefs:s.map(r=>r.id)},{id:"agent-grounding",kind:"outputs",label:"Agent Grounding",summary:"AGENTS.md \xB7 Skills \xB7 Context",contractRefs:["agent-grounding"]},{id:"evidence-and-decisions",kind:"outputs",label:"Evidence Contracts",summary:"Reports \xB7 Artifacts \xB7 Gates",contractRefs:["understanding","governance-evidence","explanations"]},{id:"shared-consumers",kind:"consumers",label:"Shared Consumers",summary:"Developers \xB7 CI \xB7 IDEs \xB7 AI agents",contractRefs:["developers","ci","ides","ai-agents"]}],rule:"Use concrete user-facing language for first-contact explanations. Every input, output, consumer, and chain step must remain traceable through contractRefs even when details are summarized."},standard:{phases:["understand","change","evidence","gate","ground","distribute","explain"],nodes:[{id:"understand",label:"Understand",question:"What exists in the current workspace?",stepRefs:["model"]},{id:"change",label:"Change",question:"What changed, and what can it affect?",stepRefs:["diff","impact"]},{id:"evidence",label:"Evidence",question:"What health, contract, and readiness facts were observed?",stepRefs:["doctor-evidence","contract-evidence","analyze-evidence","readiness-evidence"]},{id:"gate",label:"Gate",question:"Is the current state acceptable and trustworthy?",stepRefs:["verify"]},{id:"ground",label:"Ground",question:"What should an agent know before acting?",stepRefs:["context"]},{id:"distribute",label:"Distribute",question:"Which durable agent and IDE surfaces receive that context?",stepRefs:["agent-sync"]},{id:"explain",label:"Explain",question:"Why did the system reach this result or verdict?",stepRefs:["explain"]}],rule:"Use for architecture education and product surfaces. Every phase must appear once and in order."},advanced:{steps:s.map(r=>r.id),requiredFields:["command","inputRefs","consumesArtifacts","produces","dependsOn","exitPolicy","purpose"],rule:"Use for implementers, adapters, IDEs, and CI. Preserve every step and its artifact and verdict semantics."}},steps:s,diagram:{direction:"TB",nodes:s.map(({id:r,label:a,phase:i})=>({id:r,label:a,phase:i})),edges:s.flatMap(r=>r.dependsOn.map(a=>({from:a,to:r.id,meaning:"required before"})))},consumers:{agents:{canonicalReadOrder:[e.agentIndex,e.agentContext,e.verify,e.impact,e.explain,e.model,e.knowledgeGraph,e.agentCustomizationPack,e.skillsIndex],entrypoints:[e.agents,".workspai/AGENT-GROUNDING.md"],rule:"Agents must cite current artifacts, preserve verified versus inferred status, and re-run the producing step when evidence is missing or stale."},ideAndCi:{requiredArtifacts:[e.model,e.knowledgeGraph,e.impact,e.verify],rule:"IDEs and CI must consume structured artifacts and verdict exit semantics rather than parse human help or terminal prose."},docsAndDiagrams:{rule:"Documentation and diagrams must derive labels, ordering, and edges from this contract and must not invent implemented steps."}}}}var z=b.agentContext,K=a.agentContext;function H(e){if(typeof e!="string"||!e.trim()||e==="true")return "generic";let t=e.trim().toLowerCase();return t==="codex"||t==="claude"||t==="cursor"||t==="orca"?t:"generic"}function O(e){return `npx --yes --package workspai workspai ${e}`.trim()}function u(e){return `npx workspai ${e}`.trim()}function d(e){return {id:e.id,scope:e.scope,display:u(e.args),execute:O(e.args),description:e.description,...e.project?{project:e.project}:{},freshness:b$1({id:`command.${e.id}`,label:`${e.id} command`,scope:"command",value:{display:u(e.args),execute:O(e.args)},...e.project?{project:e.project}:{},freshness:{kind:"derived",category:"structure",generatedAt:e.generatedAt,now:e.now,sourceArtifact:a.model,sourcePath:`safeCommands.${e.id}`,reason:"Safe command surfaces are derived from workspace model command capabilities."}}).freshness}}function N(e,t){return `workspace run ${t} --scope project:${e.name}`}function B(e){return (e.startsWith("project:")?e.slice(8):e).trim().toLowerCase()}function U(e){return [e.name,e.path,_.basename(e.path),e.absolutePath].filter(t=>typeof t=="string"&&t.trim().length>0).map(t=>t.trim().toLowerCase())}function J(e,t,s){let r={generatedAt:e.generatedAt,now:s},a=[d({id:"workspace.model",scope:"workspace",args:"workspace model --json",description:"Read the canonical workspace intelligence model.",...r}),d({id:"workspace.graph.entities",scope:"workspace",args:"workspace graph entities --json",description:"Query proof-backed workspace entities without loading the full graph.",...r}),d({id:"workspace.graph.evidence",scope:"workspace",args:"workspace graph evidence <entity-or-relation> --json",description:"Resolve portable evidence for a graph entity or relation.",...r}),d({id:"workspace.graph.path",scope:"workspace",args:"workspace graph path <from> <to> --json",description:"Find a shortest proof-carrying path between workspace entities.",...r}),d({id:"workspace.doctor",scope:"workspace",args:"doctor workspace --json",description:"Check workspace health before claiming verification.",...r}),d({id:"workspace.pipeline",scope:"workspace",args:"pipeline --json",description:"Run the governed sync, doctor, analyze, readiness, and autopilot loop.",...r}),d({id:"workspace.contract.verify",scope:"workspace",args:"workspace contract verify --json",description:"Verify workspace contract and dependency edges.",...r}),d({id:"workspace.verify",scope:"workspace",args:"workspace verify --json",description:"Evaluate evidence freshness and verification gates before release decisions.",...r})],i=t?[t]:e.projects;for(let o of i)o.commands.fleetStages.includes("test")&&a.push(d({id:`project.${o.name}.test`,scope:"project",project:o.name,args:N(o,"test"),description:`Run tests for ${o.name} through workspace orchestration.`,...r})),o.commands.fleetStages.includes("build")&&a.push(d({id:`project.${o.name}.build`,scope:"project",project:o.name,args:N(o,"build"),description:`Build ${o.name} through workspace orchestration.`,...r}));return a}function X(e){return e.commands.fleetStages.filter(t=>t==="test"||t==="build").map(t=>`workspace run ${t}`)}function Q(e,t){if(!t?.startsWith("project:"))return;let s=B(t);if(s)return e.projects.find(r=>U(r).includes(s))}function Y(e,t,s){let r=[...e.validation?.issues??[]];t?.startsWith("project:")&&!s&&r.push({severity:"error",code:"context.scope.project.missing",message:`Requested project scope was not found: ${t}`,target:t});let a=r.filter(o=>o.severity==="error").length,i=r.filter(o=>o.severity==="warning").length;return {status:a>0?"failed":i>0?"warning":"passed",errors:a,warnings:i,issues:r}}function Z(e){let t=[],s=[];for(let[r,a]of Object.entries(e.evidence))a?.exists?t.push(`${r}: ${a.path}`):s.push(r);return {available:t.sort(),missing:s.sort()}}function ee(e){let t=e.summary.projectCount,s=e.summary.runtimes.length?`${e.summary.runtimes.join(", ")} runtime coverage`:"no runtime coverage",r=e.identity.surfaces.length?e.identity.surfaces.join(", "):"no detected surfaces";return `${e.workspace.name} is a ${e.identity.workspaceType} with ${t} project${t===1?"":"s"}, ${s}, and ${r}.`}function te(e){let t=["Do not claim a command passed unless a report or command output proves it.","Do not infer secrets or environment values from file names.","Do not change project scope without checking the selected project."];return e.contracts.exists||t.push("Workspace contract is missing; dependency and API edges may be incomplete."),e.summary.observedProjects>0&&t.push("Some projects are observed rather than first-class; command support may be partial."),t}async function fe(e){let t=e.model??await k({workspacePath:e.workspacePath,includeEvidence:e.includeEvidence===true,observableScanDepth:e.observableScanDepth,now:e.now}),s=H(e.agent),r=Q(t,e.scope),a$1=Y(t,e.scope,r);if(e.strict===true&&a$1.status!=="passed"){let n=a$1.issues.map(m=>`${m.severity}:${m.code}:${m.target}`).join(", ");throw new Error(`Workspace context strict validation failed: ${n}`)}let i=e.now??new Date,o=t.facts??[],G=new Set((r?[r]:t.projects).map(n=>n.name)),v=o.filter(n=>n.project?G.has(n.project):true),M=(r?[r]:t.projects).map(n=>{let m=v.filter(F=>F.project===n.name);return {name:n.name,path:n.path,kind:n.kind,runtime:n.runtime,framework:n.frameworkDisplayName,...n.generator?{generator:n.generator}:{},createCapability:n.createCapability,supportTier:n.supportTier,safeCommands:X(n),importantFiles:n.importantFiles,facts:m}}),g=Z(t),k$1=_.join(e.workspacePath,a.knowledgeGraph),p=await T.pathExists(k$1)?await T.readJson(k$1).catch(()=>null):null,w=false;if(p?.schemaVersion===b.knowledgeGraph)try{c$1(p,t),w=true;}catch{}let b$2=ee(t),C=J(t,r,i),L=C.map(n=>b$1({id:`context.command.${n.id}`,label:`${n.id} safe command`,scope:"command",value:{display:n.display,execute:n.execute,scope:n.scope},...n.project?{project:n.project}:{},freshness:{kind:"derived",category:"structure",generatedAt:t.generatedAt,now:i,sourceArtifact:a.agentContext,sourcePath:`safeCommands.${n.id}`,reason:"Context safe commands are derived from workspace model command capabilities."}})),x=[...v,...L],f=c$2({facts:x,generatedAt:i.toISOString(),now:i}),h=P();return {schemaVersion:z,generatedAt:i.toISOString(),agent:s,workspaceSummary:b$2,modelRef:a.model,knowledgeGraph:{artifact:a.knowledgeGraph,schemaVersion:b.knowledgeGraph,available:w,...typeof p?.quality?.entityCount=="number"?{entityCount:p.quality.entityCount}:{},...typeof p?.quality?.relationCount=="number"?{relationCount:p.quality.relationCount}:{},...typeof p?.quality?.proofCount=="number"?{proofCount:p.quality.proofCount}:{},queryCommands:[u("workspace graph search <query> --limit 12 --json"),u("workspace graph entities [kind] --json"),u("workspace graph evidence <entity-or-relation> --json"),u("workspace graph path <from> <to> --json")]},intelligenceChain:{schemaVersion:h.schemaVersion,contractPath:h.contractPath,currentStep:"context",canonicalReadOrder:[...h.consumers.agents.canonicalReadOrder]},workspace:{name:t.workspace.name,root:t.workspace.root,type:t.identity.workspaceType,...t.workspace.profile?{profile:t.workspace.profile}:{}},scope:{requested:e.scope??"workspace",...r?{activeProject:r.name}:{}},projects:M,safeCommands:C,facts:x,factFreshness:f,evidence:g,policies:{mode:t.policies.mode,source:t.policies.source},contracts:{exists:t.contracts.exists,path:t.contracts.workspaceContractPath},validation:a$1,agentInstructions:[`Read \`${a.agentIndex}\` first, then this context pack and linked evidence reports.`,"Use `workspace graph search <query> --limit 12 --json` for bounded, proof-backed retrieval before loading the full graph.",`Load \`${a.knowledgeGraph}\` only when a complete graph export is explicitly required.`,"Use this context as the workspace source of truth before inspecting random files.","Prefer workspace-level evidence over generic framework assumptions.","Use `display` commands when explaining steps to a human.","Use `execute` commands when launching commands from automation or tooling.","Treat `facts[].freshness.verifyBeforeUse` as a hard refresh requirement before using that fact in advice, fixes, or release decisions.","Do not carry extracted facts beyond their freshness contract; re-read or regenerate evidence when the contract says stale, unknown, live, or verify-before-use.","Keep project-scoped advice tied to the active project scope.","Regenerate stale grounding with `npx workspai workspace agent-sync --write --refresh-context`."],unsafeAssumptions:[...te(t),...f.verifyBeforeUseFacts>0?[`${f.verifyBeforeUseFacts} fact(s) require verification before use; do not treat them as durable workspace structure.`]:[]],humanSummary:[b$2,`Evidence available: ${g.available.length}. Missing evidence groups: ${g.missing.join(", ")||"none"}.`,r?`Active project scope: ${r.name} (${r.frameworkDisplayName}).`:"Scope: whole workspace."].join(`
|
|
2
|
-
`)}}async function he(e$1,t){return e(t,K,a$1(e$1))}export{D as a,P as b,z as c,K as d,fe as e,he as f};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{b as buildWorkspaceExplain,a as resolveWorkspaceExplainArtifactPath,c as writeWorkspaceExplainReport}from'./chunk-CW7PGBIQ.js';export{c as WORKSPACE_EXPLAIN_REPORT_PATH,e as WORKSPACE_TRACE_REPORT_PATH,d as WORKSPACE_WHY_REPORT_PATH}from'./chunk-2GHUZDYA.js';export{e as WORKSPACE_MODEL_DIFF_REPORT_PATH}from'./chunk-NOFM7MNA.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as WORKSPACE_EXPLAIN_SCHEMA_VERSION,b as WORKSPACE_EXPLAIN_TARGETS,e as isWorkspaceExplainReport,c as parseWorkspaceExplainTarget,d as resolveWorkspaceTraceTarget}from'./chunk-HSGFUKCN.js';export{c as WORKSPACE_EXPLAIN_REPORT_PATH,e as WORKSPACE_TRACE_REPORT_PATH,d as WORKSPACE_WHY_REPORT_PATH}from'./chunk-2GHUZDYA.js';
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import {b}from'./chunk-CW7PGBIQ.js';import {d,c as c$2,f,e as e$1}from'./chunk-WDKNMTJQ.js';import {c as c$1,e}from'./chunk-HSGFUKCN.js';import {c as c$4,b as b$1}from'./chunk-2GHUZDYA.js';import {d as d$2}from'./chunk-NRYS4CLR.js';import {d as d$3}from'./chunk-ZM5NQ5Z2.js';import {h}from'./chunk-ZDN7RHXJ.js';import {c as c$3}from'./chunk-RWRLFSKW.js';import {e as e$2}from'./chunk-22NJ2ZMG.js';import {d as d$1}from'./chunk-2TEDAKP6.js';import {a as a$2}from'./chunk-KB44JP4M.js';import {a as a$1,c}from'./chunk-LNRAB7UY.js';import {r}from'./chunk-5XATWNME.js';import u from'path';import N from'readline';import g from'fs-extra';var q=a$1.agentIndex,L=new Map(Object.keys(a$1).flatMap(e=>{let t=c[e];return t?[[a$1[e],t]]:[]}));function M(e,t){return e.kind!==t.kind?false:e.kind==="project"&&t.kind==="project"?e.project.toLowerCase()===t.project.toLowerCase():e.kind==="blocker"&&t.kind==="blocker"?e.blockerId===t.blockerId:e.kind==="trace"&&t.kind==="trace"?e.diffRef===t.diffRef:true}var J=[{name:"getWorkspaceModel",description:"Read workspace-model.json",inputSchema:{type:"object",properties:{}}},{name:"getWorkspaceKnowledgeGraph",description:"Read the current proof-backed workspace knowledge graph artifact",inputSchema:{type:"object",properties:{}}},{name:"queryWorkspaceEntities",description:"List workspace knowledge entities, optionally filtered by kind",inputSchema:{type:"object",properties:{kind:{type:"string",description:"Optional entity kind"}}}},{name:"searchWorkspaceGraph",description:"Return bounded, proof-carrying workspace context matching a text query",inputSchema:{type:"object",properties:{query:{type:"string",description:"Text, path, symbol, service, or concept to find"},kind:{type:"string",description:"Optional entity kind filter"},limit:{type:"integer",minimum:1,maximum:100,default:12}},required:["query"]}},{name:"getWorkspaceGraphEvidence",description:"Resolve portable evidence for a knowledge graph entity or relation",inputSchema:{type:"object",properties:{query:{type:"string"}},required:["query"]}},{name:"findWorkspaceGraphPath",description:"Find a shortest proof-carrying path between two workspace entities",inputSchema:{type:"object",properties:{from:{type:"string"},to:{type:"string"}},required:["from","to"]}},{name:"getEvidenceIndex",description:"Read agent reports INDEX.json",inputSchema:{type:"object",properties:{}}},{name:"getBlockers",description:"Aggregate blocking reasons from verify, explain, and contract-verify reports",inputSchema:{type:"object",properties:{}}},{name:"getSafeCommands",description:"Read safe commands from workspace-context-agent.json",inputSchema:{type:"object",properties:{}}},{name:"getProjectContext",description:"Read scoped project context from workspace-context-agent.json",inputSchema:{type:"object",properties:{project:{type:"string",description:"Optional project name; defaults to active scope"}}}},{name:"getArtifact",description:"Read one workspace-relative artifact path",inputSchema:{type:"object",properties:{relativePath:{type:"string"}},required:["relativePath"]}},{name:"listOperationalSkills",description:"Read workspace-skills-index.json",inputSchema:{type:"object",properties:{}}},{name:"getWorkspaceExplain",description:"Build or read workspace explain report",inputSchema:{type:"object",properties:{target:{type:"string",description:"release-blocked | project:<name> | blocker:<id> | trace:<diffRef> | <project>"}}}}];function H(e){let t=e.trim().replace(/\\/g,"/");return t.length>0&&!u.isAbsolute(t)&&!t.split("/").includes("..")&&(t.startsWith(".workspai/")||t.startsWith(".rapidkit/"))}async function a(e,t){if(!H(t))throw new Error(`Unsafe artifact path: ${t}`);let r$1=await d$1(e,t)??u.join(e,t);if(!await g.pathExists(r$1))return null;let n=await g.readJson(r$1),o=r(t),c=L.get(o);if(c&&a$2(n,c,`MCP artifact ${o}`),o===a$1.knowledgeGraph){let p=u.join(e,h);if(!await g.pathExists(p))throw new Error("Workspace knowledge graph cannot be consumed without its source model.");let l=await g.readJson(p);c$3(n,l);}return n}async function F(e$1){let t=[],r=new Set,o=((await a(e$1,d$3))?.blockingReasons??[]).filter(i=>typeof i=="string"&&i.trim().length>0);if(o.length>0){t.push({artifact:d$3,reasons:o});for(let i of o)r.add(i);}let c=await a(e$1,c$4);if(e(c)){let i=(c.blockingReasons??[]).filter(s=>typeof s=="string"&&s.trim().length>0);if(i.length>0){t.push({artifact:c$4,reasons:i});for(let s of i)r.add(s);}}let p=await a(e$1,e$2),l=(p?.violations??[]).filter(i=>typeof i=="string"&&i.trim().length>0);if(l.length>0||String(p?.status??"").toLowerCase()==="failed"){let i=l.length>0?l:["Workspace contract verification failed"];t.push({artifact:e$2,reasons:i});for(let s of i)r.add(s);}return {blockingReasons:[...r],sources:t}}async function I(e$2,t,r){switch(t){case "getWorkspaceModel":return a(e$2,h);case "getWorkspaceKnowledgeGraph":return a(e$2,a$1.knowledgeGraph);case "queryWorkspaceEntities":{let n=await a(e$2,a$1.knowledgeGraph);if(!n)return null;let o=String(r.kind??"").trim();return {schemaVersion:n.schemaVersion,generatedAt:n.generatedAt,entities:e$1(n,o||void 0)}}case "searchWorkspaceGraph":{let n=await a(e$2,a$1.knowledgeGraph);if(!n)return null;let o=typeof r.limit=="number"?r.limit:Number(r.limit??12);return f(n,{query:String(r.query??""),...typeof r.kind=="string"&&r.kind.trim()?{kind:r.kind.trim()}:{},limit:Number.isFinite(o)?o:12})}case "getWorkspaceGraphEvidence":{let n=await a(e$2,a$1.knowledgeGraph);return n?c$2(n,String(r.query??"")):null}case "findWorkspaceGraphPath":{let n=await a(e$2,a$1.knowledgeGraph);return n?d(n,String(r.from??""),String(r.to??"")):null}case "getEvidenceIndex":return a(e$2,q);case "getBlockers":return F(e$2);case "getSafeCommands":return {safeCommands:(await a(e$2,d$2))?.safeCommands??[]};case "getProjectContext":{let n=await a(e$2,d$2);if(!n)return null;let o=String(r.project??"").trim(),c=n.scope?.activeProject??void 0,p=o||c,l=Array.isArray(n.projects)?n.projects:[],i=p&&l.find(s=>typeof s.name=="string"&&s.name.toLowerCase()===p.toLowerCase());return {workspace:n.workspace??null,scope:n.scope??null,validation:n.validation??null,project:i??null,safeCommands:n.safeCommands??[]}}case "getArtifact":{let n=String(r.relativePath??"").trim();return a(e$2,n)}case "listOperationalSkills":return a(e$2,b$1);case "getWorkspaceExplain":{let n=String(r.target??"release-blocked").trim(),o=c$1(n);if(!o)throw new Error(`Invalid explain target: ${n}`);let c=await a(e$2,c$4);return e(c)&&M(c.target,o)?c:b({workspacePath:e$2,target:o})}default:throw new Error(`Unknown tool: ${t}`)}}function R(e,t){process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:e??null,result:t})}
|
|
2
|
-
`);}function E(e,t){process.stdout.write(`${JSON.stringify({jsonrpc:"2.0",id:e??null,error:{code:-32e3,message:t}})}
|
|
3
|
-
`);}async function ce(e){let t=u.resolve(e.workspacePath),r=N.createInterface({input:process.stdin,terminal:false});for await(let n of r){let o=n.trim();if(!o)continue;let c;try{c=JSON.parse(o);}catch{E(null,"Invalid JSON-RPC request");continue}let{id:p,method:l,params:i}=c;try{if(l==="initialize"){R(p,{protocolVersion:"2024-11-05",capabilities:{tools:{}},serverInfo:{name:"workspai-workspace-mcp",version:"0.1.0"}});continue}if(l==="notifications/initialized")continue;if(l==="tools/list"){R(p,{tools:J.map(s=>({name:s.name,description:s.description,inputSchema:s.inputSchema}))});continue}if(l==="tools/call"){let s=String(i?.name??""),K=i?.arguments&&typeof i.arguments=="object"?i.arguments:{},S=await I(t,s,K);R(p,{content:[{type:"text",text:JSON.stringify(S,null,2)}],isError:S==null});continue}E(p,`Unsupported method: ${l??"unknown"}`);}catch(s){E(p,s instanceof Error?s.message:String(s));}}}async function pe(e,t,r={}){return I(u.resolve(e),t,r)}export{J as WORKSPACE_MCP_READ_TOOLS,pe as invokeMcpToolForTest,ce as runWorkspaceMcpServe};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{a as runWorkspaceStage}from'./chunk-KZZ36CK5.js';export{a as WORKSPACE_RUN_LAST_REPORT_FILENAME}from'./chunk-DV6GJD4K.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a}from'./chunk-ITCAMC2E.js';import {m as m$1}from'./chunk-ZDN7RHXJ.js';import {b as b$1}from'./chunk-COARSXRC.js';import {a as a$1}from'./chunk-KB44JP4M.js';import P from'fs';var w="workspace-watch-event.v1";function b(t){return a$1(t,"contracts/workspace-watch-event.v1.json","Workspace watch event"),t}function g(t){return `${t.from}\0${t.to}\0${t.kind}`}function f(t){return (t.graph?.edges??[]).map(r=>({from:r.from,to:r.to,kind:r.kind}))}function m(t){let o=[...a(t).entries()].sort((a,n)=>a[0].localeCompare(n[0])).map(([a,n])=>({id:a,hash:n})),c=f(t).map(g).sort((a,n)=>a.localeCompare(n));return b$1({projects:o,edges:c})}function R(t,r){let o=a(r),c=t?a(t):new Map,a$1=[],n=[];for(let[e,s]of o.entries())c.has(e)?c.get(e)!==s&&a$1.push(e):n.push(e);let d=[];for(let e of c.keys())o.has(e)||d.push(e);let i=new Map(t?f(t).map(e=>[g(e),e]):[]),l=new Map(f(r).map(e=>[g(e),e])),p=[];for(let[e,s]of l.entries())i.has(e)||p.push(s);let h=[];for(let[e,s]of i.entries())l.has(e)||h.push(s);let u=(e,s)=>g(e).localeCompare(g(s));return a$1.sort((e,s)=>e.localeCompare(s)),n.sort((e,s)=>e.localeCompare(s)),d.sort((e,s)=>e.localeCompare(s)),p.sort(u),h.sort(u),{changedProjects:a$1,addedProjects:n,removedProjects:d,edgesAdded:p,edgesRemoved:h}}var k=class{model=null;sequence=0;rebuild;now;constructor(r,o){this.rebuild=o?.rebuild??(()=>m$1({...r})),this.now=o?.now??(()=>new Date);}get currentModel(){return this.model}async start(){let r=Date.now(),{model:o}=await this.rebuild();return this.model=o,this.buildEvent("ready","initial",null,o,Date.now()-r)}async pulse(){let r=Date.now(),o=this.model,{model:c,mode:a}=await this.rebuild(),n=this.buildEvent(this.hasStructuralChange(o,c)?"changed":"unchanged",a,o,c,Date.now()-r);return this.model=c,n}hasStructuralChange(r,o){return r?m(r)!==m(o):true}buildEvent(r,o,c,a,n){let d=R(c,a),i=m(a),l=c?m(c)!==i:true;return b({schemaVersion:w,kind:r,sequence:this.sequence++,timestamp:this.now().toISOString(),mode:o,modelHash:i,modelHashChanged:l,changedProjects:d.changedProjects,addedProjects:d.addedProjects,removedProjects:d.removedProjects,graph:{nodeCount:a.graph?.nodes.length??0,edgeCount:a.graph?.edges.length??0,edgesAdded:d.edgesAdded,edgesRemoved:d.edgesRemoved},durationMs:n})}},C=new Set([".git",".hg",".svn","node_modules",".venv","venv","dist","build","out","target","coverage","htmlcov",".next",".turbo",".cache"]),y=new Set(["reports","cache","tmp",".cache"]);function S(t){if(!t)return false;let r=t.split(/[\\/]/).filter(Boolean);if(r.some(o=>C.has(o)))return false;for(let o=0;o<r.length-1;o+=1)if((r[o]===".workspai"||r[o]===".rapidkit")&&y.has(r[o+1]))return false;return true}async function I(t){let r=new k(t.buildOptions,t.engineOptions),o=await r.start();if(t.emit(o),t.once)return;let c=t.debounceMs??250,a=t.selfWriteSuppressionMs??Math.max(400,c+150),n=null,d=false,i=false,l=0,p=async()=>{if(d){i=true;return}d=true;try{let e=await r.pulse();t.emit(e);}catch(e){t.emit(b({schemaVersion:w,kind:"error",sequence:-1,timestamp:new Date().toISOString(),mode:"full",modelHash:r.currentModel?m(r.currentModel):"",modelHashChanged:false,changedProjects:[],addedProjects:[],removedProjects:[],graph:{nodeCount:0,edgeCount:0,edgesAdded:[],edgesRemoved:[]},durationMs:0,error:e instanceof Error?e.message:String(e)}));}finally{d=false,l=Date.now()+a,i&&(i=false,p());}},h=e=>{S(e)&&(d||Date.now()<l||(n&&clearTimeout(n),n=setTimeout(()=>{n=null,p();},c)));};t.onProgress?.(`Watching ${t.workspacePath} for changes (Ctrl+C to stop).`);let u=P.watch(t.workspacePath,{recursive:true},(e,s)=>{typeof s=="string"?h(s):s&&h(Buffer.from(s).toString("utf8"));});await new Promise(e=>{let s=()=>{n&&clearTimeout(n),u.close(),e();};if(t.signal){if(t.signal.aborted){s();return}t.signal.addEventListener("abort",s,{once:true});}u.on("error",()=>s());});}export{w as WORKSPACE_WATCH_EVENT_SCHEMA_VERSION,k as WorkspaceWatchEngine,m as computeWatchModelHash,R as diffWatchModels,S as isWatchRelevantPath,I as runWorkspaceWatch};
|