workspai 0.59.1 → 0.60.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/README.md +5 -0
  2. package/contracts/cli-runtime-command-inventory.v1.snapshot.json +4 -0
  3. package/contracts/extension-cli-compatibility.v1.json +1 -1
  4. package/contracts/workspace-intelligence/goal-agent-handoff.v1.json +89 -8
  5. package/contracts/workspace-intelligence/goal-index.v1.json +100 -7
  6. package/contracts/workspace-intelligence/goal-lifecycle-result.v1.json +74 -6
  7. package/contracts/workspace-intelligence/goal-pack.v1.json +182 -19
  8. package/contracts/workspace-intelligence/verified-goal.v1.json +44 -3
  9. package/dist/analyze-FYNMI5KT.js +1 -0
  10. package/dist/autopilot-release-IRXB2VOH.js +1 -0
  11. package/dist/{chunk-DGGTTRYE.js → chunk-7ITSLGPZ.js} +1 -1
  12. package/dist/{chunk-5NIZNXRS.js → chunk-A4BK7C7M.js} +1 -1
  13. package/dist/{chunk-FLTIFYTJ.js → chunk-AJ535F22.js} +1 -1
  14. package/dist/{chunk-KVSYBHUR.js → chunk-B6FJ6RG6.js} +1 -1
  15. package/dist/{chunk-5PSKBJKJ.js → chunk-DIJGQUEV.js} +1 -1
  16. package/dist/{chunk-QMPFNXI7.js → chunk-E4LJ3PQD.js} +1 -1
  17. package/dist/{chunk-6FBNSTUS.js → chunk-GPGEJVVO.js} +1 -1
  18. package/dist/{chunk-U3MGJN7A.js → chunk-HQWDW2BV.js} +1 -1
  19. package/dist/chunk-I2O6AC2Z.js +2 -0
  20. package/dist/chunk-ILIBOMYL.js +1 -0
  21. package/dist/chunk-J7G3YL4O.js +1 -0
  22. package/dist/{chunk-NOZ4JCH7.js → chunk-KCJ3VS6R.js} +1 -1
  23. package/dist/{chunk-SP5EHSWG.js → chunk-KG3TUTXU.js} +1 -1
  24. package/dist/chunk-KNTPDRZB.js +1 -0
  25. package/dist/{chunk-QPE6VCDW.js → chunk-KTW4EN47.js} +19 -19
  26. package/dist/{chunk-RVKMGKYL.js → chunk-MDF2FBLS.js} +1 -1
  27. package/dist/{chunk-WSRUPDZN.js → chunk-NA2NXX5P.js} +1 -1
  28. package/dist/{chunk-OFWSZYUX.js → chunk-NBJ6AP7K.js} +1 -1
  29. package/dist/{chunk-RTDEFUTL.js → chunk-NRVSDL4J.js} +1 -1
  30. package/dist/{chunk-7WUT5ZSO.js → chunk-NVQUBUTY.js} +1 -1
  31. package/dist/{chunk-YEEAWZWI.js → chunk-O6R7SE6Y.js} +1 -1
  32. package/dist/{chunk-7SFXADXO.js → chunk-OU7DF6MP.js} +1 -1
  33. package/dist/{chunk-WJVB6SSD.js → chunk-PTNLVI62.js} +5 -5
  34. package/dist/{chunk-WP3CXMVA.js → chunk-SCP5LJNO.js} +1 -1
  35. package/dist/{chunk-QFBVQUKV.js → chunk-TFOOSYGO.js} +6 -6
  36. package/dist/{chunk-3CGR6435.js → chunk-TYQMO36U.js} +1 -1
  37. package/dist/chunk-UJXE4UAX.js +1 -0
  38. package/dist/{chunk-ENKGGWRX.js → chunk-VDFHUYAQ.js} +8 -8
  39. package/dist/chunk-VR6XMUF3.js +2 -0
  40. package/dist/{chunk-Y4B55J5S.js → chunk-VV55EAWO.js} +1 -1
  41. package/dist/{chunk-ZJCM37KX.js → chunk-WLFJHRB3.js} +1 -1
  42. package/dist/{chunk-P2WH7W2H.js → chunk-WUB6QGC7.js} +6 -6
  43. package/dist/chunk-X6TNBARH.js +6 -0
  44. package/dist/{create-HUEDWYDM.js → create-ZLDOBXG4.js} +1 -1
  45. package/dist/demo-kit-QHIDCSBI.js +149 -0
  46. package/dist/{doctor-NAZEKMGU.js → doctor-MAPZ2ZCD.js} +1 -1
  47. package/dist/{dotnet-webapi-clean-VXEF4SHM.js → dotnet-webapi-clean-AVHPJG7Y.js} +5 -5
  48. package/dist/goal-command-contract-43E22XQD.js +1 -0
  49. package/dist/goal-interactive-selection-6YJOK4WC.js +1 -0
  50. package/dist/goal-lifecycle-OV6NZDD6.js +1 -0
  51. package/dist/goal-pack-Q3O2Z7R5.js +1 -0
  52. package/dist/{gofiber-standard-AQGSC7ON.js → gofiber-standard-47S2GYAO.js} +2 -2
  53. package/dist/{gogin-standard-7DU3OCBX.js → gogin-standard-EWB4XNOI.js} +3 -3
  54. package/dist/index.js +122 -122
  55. package/dist/{pipeline-62A2SDLC.js → pipeline-NICVJLZF.js} +1 -1
  56. package/dist/{project-agent-entry-7SYHRY7J.js → project-agent-entry-DVPKQST7.js} +1 -1
  57. package/dist/{project-intelligence-lens-BSG5LK6N.js → project-intelligence-lens-RLYSPJB2.js} +1 -1
  58. package/dist/{project-test-coverage-HP37HUV2.js → project-test-coverage-E2Q4QL44.js} +1 -1
  59. package/dist/{rust-axum-4HXDICIB.js → rust-axum-M5X4ZC4Z.js} +4 -4
  60. package/dist/{springboot-standard-EK6GYN5T.js → springboot-standard-Y5ADLZMQ.js} +7 -7
  61. package/dist/verified-goal-2BRQZQBL.js +1 -0
  62. package/dist/{workspace-BNRSBWSL.js → workspace-LQ77WAHC.js} +1 -1
  63. package/dist/{workspace-agent-sync-ANBHBZ2H.js → workspace-agent-sync-YLP75OWF.js} +1 -1
  64. package/dist/{workspace-context-RAO62QVU.js → workspace-context-YAK5XX27.js} +1 -1
  65. package/dist/{workspace-contract-ACSIHJIO.js → workspace-contract-3BWIRSVQ.js} +1 -1
  66. package/dist/{workspace-explain-RH27OQB4.js → workspace-explain-QH4FXQW5.js} +1 -1
  67. package/dist/{workspace-foundation-EWYJPPT6.js → workspace-foundation-G4KPT5CN.js} +1 -1
  68. package/dist/{workspace-graph-stream-ZZZEQQTE.js → workspace-graph-stream-XTSDKRLM.js} +1 -1
  69. package/dist/{workspace-intelligence-3YERTBA3.js → workspace-intelligence-625UN27X.js} +1 -1
  70. package/dist/{workspace-intelligence-runner-QLLBUD6G.js → workspace-intelligence-runner-T6CVJIQQ.js} +1 -1
  71. package/dist/{workspace-knowledge-graph-HZZP6ZRB.js → workspace-knowledge-graph-3ZBPSAS7.js} +1 -1
  72. package/dist/workspace-knowledge-graph-snapshot-ZI4W735H.js +1 -0
  73. package/dist/{workspace-mcp-serve-5TTAN243.js → workspace-mcp-serve-ALIZV72K.js} +1 -1
  74. package/dist/{workspace-model-EIQSKDX7.js → workspace-model-ETCLINRB.js} +1 -1
  75. package/dist/{workspace-onboarding-UW3CSURE.js → workspace-onboarding-46BE3EQD.js} +1 -1
  76. package/dist/{workspace-registry-summary-OV5KX3WC.js → workspace-registry-summary-VSOBKAJG.js} +1 -1
  77. package/dist/workspace-repair-engine-SZZKV3JF.js +3 -0
  78. package/dist/workspace-run-JTEFCQYQ.js +1 -0
  79. package/dist/{workspace-verify-W4P6LBIH.js → workspace-verify-7ENGIY4S.js} +1 -1
  80. package/dist/{workspace-watch-EZ4D4VCF.js → workspace-watch-2YFSB2WL.js} +1 -1
  81. package/docs/ci-workflows.md +1 -1
  82. package/docs/commands-reference.md +12 -2
  83. package/docs/goal-packs.md +51 -11
  84. package/package.json +1 -1
  85. package/dist/analyze-52TEGLDR.js +0 -1
  86. package/dist/autopilot-release-NFLAKBA3.js +0 -1
  87. package/dist/chunk-DQ6VXTDE.js +0 -1
  88. package/dist/chunk-MZKKRAAJ.js +0 -2
  89. package/dist/chunk-RO73VVHW.js +0 -2
  90. package/dist/chunk-T3GJ7YVG.js +0 -1
  91. package/dist/chunk-VRW6KXNK.js +0 -6
  92. package/dist/demo-kit-KHH63TNA.js +0 -149
  93. package/dist/goal-command-contract-CHE7U6YY.js +0 -1
  94. package/dist/goal-lifecycle-NUKWVUAL.js +0 -1
  95. package/dist/goal-pack-TWOXHXN6.js +0 -1
  96. package/dist/verified-goal-B6HQOZWA.js +0 -1
  97. package/dist/workspace-knowledge-graph-snapshot-7DWHMEM2.js +0 -1
  98. package/dist/workspace-repair-engine-DHH2UUJN.js +0 -3
  99. package/dist/workspace-run-BLHRXT2N.js +0 -1
@@ -3,7 +3,24 @@
3
3
  "$id": "https://workspai.dev/schemas/workspace-intelligence/goal-pack.v1.json",
4
4
  "title": "Workspai Goal Pack",
5
5
  "type": "object",
6
- "required": ["schemaVersion", "id", "fingerprint", "generatedAt", "state", "intent", "workspace", "scope", "sourceBinding", "baseline", "preflight", "successCriteria", "policy", "orchestration", "artifacts", "commands"],
6
+ "required": [
7
+ "schemaVersion",
8
+ "id",
9
+ "fingerprint",
10
+ "generatedAt",
11
+ "state",
12
+ "intent",
13
+ "workspace",
14
+ "scope",
15
+ "sourceBinding",
16
+ "baseline",
17
+ "preflight",
18
+ "successCriteria",
19
+ "policy",
20
+ "orchestration",
21
+ "artifacts",
22
+ "commands"
23
+ ],
7
24
  "properties": {
8
25
  "schemaVersion": { "const": "workspai.goal-pack.v1" },
9
26
  "id": { "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{7,95}$" },
@@ -17,16 +34,52 @@
17
34
  "original": { "type": "string", "minLength": 1, "maxLength": 2000 },
18
35
  "normalized": { "type": "string", "minLength": 1, "maxLength": 2000 },
19
36
  "statement": { "type": "string", "minLength": 1, "maxLength": 2000 },
20
- "category": { "enum": ["release-readiness", "dependency-security", "test-coverage", "defect-repair", "feature-change", "refactor", "performance", "documentation", "system-understanding"] },
37
+ "category": {
38
+ "enum": [
39
+ "release-readiness",
40
+ "dependency-security",
41
+ "test-coverage",
42
+ "defect-repair",
43
+ "feature-change",
44
+ "refactor",
45
+ "performance",
46
+ "documentation",
47
+ "system-understanding"
48
+ ]
49
+ },
21
50
  "confidence": { "enum": ["high", "medium", "low"] },
22
- "ambiguities": { "type": "array", "items": { "type": "string", "minLength": 1 }, "uniqueItems": true },
51
+ "ambiguities": {
52
+ "type": "array",
53
+ "items": { "type": "string", "minLength": 1 },
54
+ "uniqueItems": true
55
+ },
23
56
  "requestedTarget": {
24
57
  "type": "object",
25
58
  "required": ["metric", "operator", "value"],
26
59
  "properties": {
27
60
  "metric": { "const": "test-coverage-percent" },
28
61
  "operator": { "const": "at-least" },
29
- "value": { "type": "number", "minimum": 0, "maximum": 100 }
62
+ "value": { "type": "number", "minimum": 0, "maximum": 100 },
63
+ "runtime": {
64
+ "enum": [
65
+ "node",
66
+ "bun",
67
+ "deno",
68
+ "python",
69
+ "go",
70
+ "java",
71
+ "dotnet",
72
+ "rust",
73
+ "php",
74
+ "ruby",
75
+ "elixir",
76
+ "clojure",
77
+ "scala",
78
+ "kotlin",
79
+ "c",
80
+ "cpp"
81
+ ]
82
+ }
30
83
  },
31
84
  "additionalProperties": false
32
85
  }
@@ -81,7 +134,11 @@
81
134
  "properties": {
82
135
  "status": { "enum": ["passed", "blocked", "unknown"] },
83
136
  "artifact": { "const": ".workspai/reports/workspace-intelligence-run-last-run.json" },
84
- "blockedStages": { "type": "array", "items": { "type": "string", "minLength": 1 }, "uniqueItems": true }
137
+ "blockedStages": {
138
+ "type": "array",
139
+ "items": { "type": "string", "minLength": 1 },
140
+ "uniqueItems": true
141
+ }
85
142
  },
86
143
  "additionalProperties": false
87
144
  },
@@ -91,9 +148,30 @@
91
148
  "properties": {
92
149
  "status": { "enum": ["available", "requires-setup", "unsupported", "not-applicable"] },
93
150
  "runtime": { "type": ["string", "null"] },
151
+ "runtimeChoices": {
152
+ "type": "array",
153
+ "items": { "type": "string", "minLength": 1 },
154
+ "uniqueItems": true
155
+ },
94
156
  "runner": { "type": ["string", "null"] },
95
- "existingEvidence": { "type": "array", "items": { "type": "object", "required": ["project", "path", "sha256"], "properties": { "project": { "type": "string", "minLength": 1 }, "path": { "type": "string", "minLength": 1 }, "sha256": { "$ref": "#/$defs/hash" } }, "additionalProperties": false } },
96
- "prerequisites": { "type": "array", "items": { "type": "string", "minLength": 1 }, "uniqueItems": true }
157
+ "existingEvidence": {
158
+ "type": "array",
159
+ "items": {
160
+ "type": "object",
161
+ "required": ["project", "path", "sha256"],
162
+ "properties": {
163
+ "project": { "type": "string", "minLength": 1 },
164
+ "path": { "type": "string", "minLength": 1 },
165
+ "sha256": { "$ref": "#/$defs/hash" }
166
+ },
167
+ "additionalProperties": false
168
+ }
169
+ },
170
+ "prerequisites": {
171
+ "type": "array",
172
+ "items": { "type": "string", "minLength": 1 },
173
+ "uniqueItems": true
174
+ }
97
175
  },
98
176
  "additionalProperties": false
99
177
  },
@@ -109,7 +187,14 @@
109
187
  "required": ["id", "kind", "expected", "producerCommand", "machineVerifiable"],
110
188
  "properties": {
111
189
  "id": { "type": "string", "minLength": 1 },
112
- "kind": { "enum": ["workspace-verify", "release-readiness", "dependency-security", "test-coverage"] },
190
+ "kind": {
191
+ "enum": [
192
+ "workspace-verify",
193
+ "release-readiness",
194
+ "dependency-security",
195
+ "test-coverage"
196
+ ]
197
+ },
113
198
  "expected": { "type": "string", "minLength": 1 },
114
199
  "producerCommand": { "type": "string", "minLength": 1 },
115
200
  "machineVerifiable": { "type": "boolean" }
@@ -119,7 +204,17 @@
119
204
  },
120
205
  "policy": {
121
206
  "type": "object",
122
- "required": ["mutationMode", "approval", "verificationOwner", "rollbackOwner", "maxAttempts", "allowBreakingChanges", "allowForce", "networkAccess", "scopeExpansion"],
207
+ "required": [
208
+ "mutationMode",
209
+ "approval",
210
+ "verificationOwner",
211
+ "rollbackOwner",
212
+ "maxAttempts",
213
+ "allowBreakingChanges",
214
+ "allowForce",
215
+ "networkAccess",
216
+ "scopeExpansion"
217
+ ],
123
218
  "properties": {
124
219
  "mutationMode": { "const": "proposal-only" },
125
220
  "approval": { "const": "required-before-mutation" },
@@ -164,7 +259,10 @@
164
259
  "required": ["goalPack", "agentHandoff", "latestReport"],
165
260
  "properties": {
166
261
  "goalPack": { "type": "string", "pattern": "^\\.workspai/goals/[^/]+/goal-pack\\.json$" },
167
- "agentHandoff": { "type": "string", "pattern": "^\\.workspai/goals/[^/]+/agent-handoff\\.json$" },
262
+ "agentHandoff": {
263
+ "type": "string",
264
+ "pattern": "^\\.workspai/goals/[^/]+/agent-handoff\\.json$"
265
+ },
168
266
  "latestReport": { "const": ".workspai/reports/goal-pack-last-run.json" }
169
267
  },
170
268
  "additionalProperties": false
@@ -173,10 +271,14 @@
173
271
  "type": "object",
174
272
  "required": ["refreshEvidence", "inspectGraph", "proposeRepair"],
175
273
  "properties": {
176
- "refreshEvidence": { "const": "workspai workspace intelligence run --for-agent generic --strict --json" },
274
+ "refreshEvidence": {
275
+ "const": "workspai workspace intelligence run --for-agent generic --strict --json"
276
+ },
177
277
  "inspectGraph": { "type": "string", "pattern": "^workspai workspace graph search " },
178
278
  "planVerifiedGoal": { "type": "string", "pattern": "^workspai workspace goal plan " },
179
- "proposeRepair": { "const": "workspai workspace repair propose --file <proposal.json> --json" }
279
+ "proposeRepair": {
280
+ "const": "workspai workspace repair propose --file <proposal.json> --json"
281
+ }
180
282
  },
181
283
  "additionalProperties": false
182
284
  }
@@ -187,15 +289,58 @@
187
289
  "type": "object",
188
290
  "required": ["kind", "projects", "selectionSource"],
189
291
  "properties": {
190
- "kind": { "enum": ["workspace", "project"] },
191
- "projects": { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 1 }, "uniqueItems": true },
192
- "selectionSource": { "enum": ["workspace", "invocation-project", "explicit"] }
292
+ "kind": { "enum": ["workspace", "project", "project-set"] },
293
+ "projects": {
294
+ "type": "array",
295
+ "minItems": 1,
296
+ "items": { "type": "string", "minLength": 1 },
297
+ "uniqueItems": true
298
+ },
299
+ "selectionSource": {
300
+ "enum": [
301
+ "workspace",
302
+ "single-project-workspace",
303
+ "invocation-project",
304
+ "explicit",
305
+ "interactive"
306
+ ]
307
+ },
308
+ "resolution": { "enum": ["selected", "selection-required"] }
193
309
  },
310
+ "allOf": [
311
+ {
312
+ "if": { "properties": { "kind": { "const": "project" } } },
313
+ "then": { "properties": { "projects": { "type": "array", "maxItems": 1 } } }
314
+ },
315
+ {
316
+ "if": { "properties": { "kind": { "const": "project-set" } } },
317
+ "then": { "properties": { "projects": { "type": "array", "minItems": 2 } } }
318
+ },
319
+ {
320
+ "if": {
321
+ "properties": { "resolution": { "const": "selection-required" } },
322
+ "required": ["resolution"]
323
+ },
324
+ "then": {
325
+ "properties": {
326
+ "kind": { "const": "workspace" },
327
+ "selectionSource": { "const": "workspace" }
328
+ }
329
+ }
330
+ }
331
+ ],
194
332
  "additionalProperties": false
195
333
  },
196
334
  "modelBinding": {
197
335
  "type": "object",
198
- "required": ["artifact", "schemaVersion", "hashAlgorithm", "hashSemantics", "hash", "generatedAt"],
336
+ "required": [
337
+ "artifact",
338
+ "schemaVersion",
339
+ "hashAlgorithm",
340
+ "hashSemantics",
341
+ "hash",
342
+ "generatedAt"
343
+ ],
199
344
  "properties": {
200
345
  "artifact": { "const": ".workspai/reports/workspace-model.json" },
201
346
  "schemaVersion": { "const": "workspace-model.v1" },
@@ -208,7 +353,15 @@
208
353
  },
209
354
  "graphBinding": {
210
355
  "type": "object",
211
- "required": ["artifact", "schemaVersion", "hashAlgorithm", "hashSemantics", "hash", "generatedAt", "modelHash"],
356
+ "required": [
357
+ "artifact",
358
+ "schemaVersion",
359
+ "hashAlgorithm",
360
+ "hashSemantics",
361
+ "hash",
362
+ "generatedAt",
363
+ "modelHash"
364
+ ],
212
365
  "properties": {
213
366
  "artifact": { "const": ".workspai/reports/workspace-knowledge-graph.json" },
214
367
  "schemaVersion": { "const": "workspace-knowledge-graph.v1" },
@@ -227,7 +380,13 @@
227
380
  "properties": {
228
381
  "status": { "enum": ["grounded", "partial", "empty"] },
229
382
  "strategy": { "const": "deterministic-category-v1" },
230
- "queries": { "type": "array", "minItems": 1, "maxItems": 3, "items": { "type": "string", "minLength": 1 }, "uniqueItems": true },
383
+ "queries": {
384
+ "type": "array",
385
+ "minItems": 1,
386
+ "maxItems": 3,
387
+ "items": { "type": "string", "minLength": 1 },
388
+ "uniqueItems": true
389
+ },
231
390
  "anchors": {
232
391
  "type": "array",
233
392
  "maxItems": 20,
@@ -238,7 +397,11 @@
238
397
  "entityId": { "type": "string", "minLength": 1 },
239
398
  "kind": { "type": "string", "minLength": 1 },
240
399
  "label": { "type": "string", "minLength": 1 },
241
- "proofIds": { "type": "array", "items": { "type": "string", "minLength": 1 }, "uniqueItems": true }
400
+ "proofIds": {
401
+ "type": "array",
402
+ "items": { "type": "string", "minLength": 1 },
403
+ "uniqueItems": true
404
+ }
242
405
  },
243
406
  "additionalProperties": false
244
407
  }
@@ -38,9 +38,23 @@
38
38
  "type": "object",
39
39
  "required": ["kind"],
40
40
  "properties": {
41
- "kind": { "enum": ["workspace", "project"] },
41
+ "kind": { "enum": ["workspace", "project", "project-set"] },
42
42
  "projectName": { "type": "string", "minLength": 1 },
43
- "projectPath": { "type": "string", "minLength": 1 }
43
+ "projectPath": { "type": "string", "minLength": 1 },
44
+ "projects": {
45
+ "type": "array",
46
+ "minItems": 2,
47
+ "uniqueItems": true,
48
+ "items": {
49
+ "type": "object",
50
+ "required": ["projectName", "projectPath"],
51
+ "properties": {
52
+ "projectName": { "type": "string", "minLength": 1 },
53
+ "projectPath": { "type": "string", "minLength": 1 }
54
+ },
55
+ "additionalProperties": false
56
+ }
57
+ }
44
58
  },
45
59
  "allOf": [
46
60
  {
@@ -52,6 +66,13 @@
52
66
  },
53
67
  "required": ["projectName", "projectPath"]
54
68
  }
69
+ },
70
+ {
71
+ "if": { "properties": { "kind": { "const": "project-set" } } },
72
+ "then": {
73
+ "properties": { "projects": { "type": "array", "minItems": 2 } },
74
+ "required": ["projects"]
75
+ }
55
76
  }
56
77
  ],
57
78
  "additionalProperties": false
@@ -97,7 +118,27 @@
97
118
  "properties": {
98
119
  "kind": { "const": "test-coverage" },
99
120
  "metric": { "const": "auto" },
100
- "minimumPercent": { "type": "number", "minimum": 0, "maximum": 100 }
121
+ "minimumPercent": { "type": "number", "minimum": 0, "maximum": 100 },
122
+ "runtime": {
123
+ "enum": [
124
+ "node",
125
+ "bun",
126
+ "deno",
127
+ "python",
128
+ "go",
129
+ "java",
130
+ "dotnet",
131
+ "rust",
132
+ "php",
133
+ "ruby",
134
+ "elixir",
135
+ "clojure",
136
+ "scala",
137
+ "kotlin",
138
+ "c",
139
+ "cpp"
140
+ ]
141
+ }
101
142
  },
102
143
  "additionalProperties": false
103
144
  }
@@ -0,0 +1 @@
1
+ export{b as printAnalyzeReport,a as runAnalyze}from'./chunk-7ITSLGPZ.js';
@@ -0,0 +1 @@
1
+ export{b as AUTOPILOT_RELEASE_ALIAS_FILENAME,a as AUTOPILOT_RELEASE_LAST_RUN_FILENAME,c as runAutopilotRelease}from'./chunk-TYQMO36U.js';
@@ -1,4 +1,4 @@
1
- import {f as f$1,e as e$1}from'./chunk-T3GJ7YVG.js';import {a,b}from'./chunk-QJCCZLOF.js';import {a as a$1}from'./chunk-27UR373Z.js';import {a as a$2}from'./chunk-T5YRFRJV.js';import {h,j as j$1}from'./chunk-ZCPT6KC3.js';import {e as e$2}from'./chunk-CCDGHPEJ.js';import {e,f}from'./chunk-NZ3WZYD5.js';import {j,s,t}from'./chunk-MOSXTVPU.js';import w from'fs';import c from'path';import i from'chalk';var L=new Set([".git",".workspai",".rapidkit",".venv","node_modules","dist","build","target","coverage","htmlcov",".next"]);async function D(e){try{return await w.promises.access(e,w.constants.F_OK),true}catch{return false}}async function z(e){try{let t=JSON.parse(await w.promises.readFile(e,"utf-8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:null}catch{return null}}async function K(e){try{return await w.promises.readFile(e,"utf-8")}catch{return ""}}function B(e){return a(e)}async function U(e,t$1){return await M([...t(e,"project.json"),...t(e,"context.json")])?true:b(e)?false:c.resolve(e)===c.resolve(t$1)?h(e).length>0:h(e).length>0}async function V(e){let t=await a$1(e,{skipDirs:L,includeHiddenDirs:false,descendIntoMatchedProjects:false,isProjectDir:U}),r=(await a$2(e)).filter(o=>o.relationship==="adopted"||o.source==="adopted-local").map(o=>c.resolve(o.path)).filter(o=>w.existsSync(o)),s=[...new Set([...t.map(o=>c.resolve(o)),...r])];return s.length>0?s:b(e)?[]:h(e).length>0?[e]:[]}function q(e,t){return c.relative(e,t).replace(/\\/g,"/")||"."}async function A(e,t){for(let n of t)if(await D(c.join(e,n)))return true;return false}async function M(e){for(let t of e)if(await D(t))return true;return false}async function Q(e){if(await A(e,[".gitlab-ci.yml",".circleci/config.yml","azure-pipelines.yml","bitbucket-pipelines.yml","cloudbuild.yaml"]))return true;try{return (await w.promises.readdir(c.join(e,".github","workflows"),{withFileTypes:true})).some(n=>n.isFile()&&/\.(?:ya?ml)$/i.test(n.name)&&!n.name.startsWith("."))}catch{return false}}async function O(e){for(let t of e){let n=await z(t);if(n)return n}return null}async function X(e){return A(e,["health","health.ts","health.js","health.py","health.go","health.kt","health.rb","health.php","healthcheck","health-check","src/health.ts","src/health.js","src/health.py","src/health.go","src/health.kt","src/health.rb","src/health.php","src/healthcheck.ts","src/healthcheck.js","src/liveness.ts","src/readiness.ts","src/ping.ts"])}async function Y(e){if(await A(e,["tests","test","__tests__","src/__tests__","pytest.ini","vitest.config.ts","jest.config.ts"]))return true;let n=await z(c.join(e,"package.json")),r=n?.scripts&&typeof n.scripts=="object"?n.scripts:{};return typeof r.test=="string"&&r.test.trim().length>0}async function Z(e){let t=await z(c.join(e,"package.json")),n=t?.scripts&&typeof t.scripts=="object"?t.scripts:{};return Object.keys(n).sort()}function g(e,t,n,r,s,o){return {id:e,severity:t,target:n,title:r,detail:s,remediation:o}}function ee(e){let t=e.reduce((n,r)=>r.severity==="fail"?n+28:r.severity==="warn"?n+12:n+3,0);return Math.max(0,100-t)}async function ne(e,t$1){let n=await O(t(t$1,"project.json")),r=j$1(t$1,n),s=h(t$1),o=r.runtime==="unknown"?s[0]||"unknown":r.runtime,a=q(e,t$1),p=a,u=await Z(t$1),f=await M([...t(t$1,"project.json"),...t(t$1,"context.json")]),l=await Y(t$1),h$1=await A(t$1,["Dockerfile","dockerfile"]),k=await A(t$1,[".env.example","env.example","config/env.example"]),P=await Q(t$1),C=await X(t$1),m=[];return r.key==="unknown"&&m.push(g("project.stack.unknown","fail",p,"Project stack is unknown","Workspai cannot confidently classify this backend project.","Add .workspai/project.json metadata or import the project with `workspai import`.")),f||m.push(g("project.marker.missing","warn",p,"Workspai marker is missing","The project can be detected by files, but it is not registered with Workspai metadata.","Run `workspai import <path>` from a workspace or create the project through Workspai.")),l||m.push(g("project.tests.missing","warn",p,"Test entrypoint is missing","No common test folder, config, or package test script was found.","Add a test command so `workspai workspace run test --affected` can gate changes.")),k||m.push(g("project.env.example.missing","info",p,"Environment example is missing","No .env.example or env.example file was found.","Add an env example for onboarding and CI secret documentation.")),P||m.push(g("project.ci.missing","warn",p,"Continuous integration is missing","No recognized CI/CD configuration file was detected for this project.","Add CI configuration so tests and checks run automatically for every change.")),C||m.push(g("project.health.missing","info",p,"Health or readiness probe is missing","The project has no obvious health or readiness endpoint to support automated deployment and runtime checks.","Add a simple health endpoint and document it for readiness gates and observability.")),h$1||m.push(g("project.container.missing","info",p,"Container recipe is missing","No Dockerfile was found for this project.","Add a Dockerfile when the service is intended for containerized deployment.")),{name:typeof n?.name=="string"&&n.name.trim()?n.name.trim():c.basename(t$1),path:t$1,relativePath:a,runtime:o,framework:r.key,confidence:r.confidence,supportTier:r.supportTier,hasRapidKitMarker:f,hasTests:l,hasDockerfile:h$1,hasEnvExample:k,hasCiConfig:P,hasHealthEndpoint:C,scripts:u,findings:m,score:ee(m)}}function te(e){return e.name.toLowerCase()}async function re(e){let t=new Map(e.map(s=>[te(s),s])),n=[];for(let s of e){let o=await z(c.join(s.path,"package.json")),a={...o?.dependencies??{},...o?.devDependencies??{},...o?.peerDependencies??{}};for(let u of Object.keys(a)){let f=u.replace(/^@[^/]+\//,"").toLowerCase(),l=t.get(f);l&&l.relativePath!==s.relativePath&&n.push({from:s.relativePath,to:l.relativePath,kind:"package"});}let p=await K(c.join(s.path,"pyproject.toml"));for(let u of e)u.relativePath!==s.relativePath&&p.includes(u.name)&&n.push({from:s.relativePath,to:u.relativePath,kind:"workspace-reference"});}let r=new Set;return n.filter(s=>{let o=`${s.from}\0${s.to}\0${s.kind}`;return r.has(o)?false:(r.add(o),true)})}function se(e,t){let n=new Map;for(let r of e)n.set(r.relativePath,{project:r.relativePath,directDependents:0,directDependencies:0});for(let r of t){let s=n.get(r.from),o=n.get(r.to);s&&(s.directDependencies+=1),o&&(o.directDependents+=1);}return Array.from(n.values()).sort((r,s)=>s.directDependents-r.directDependents||s.directDependencies-r.directDependencies)}async function oe(e){let t=await O(s(e,"workspace.json"));return typeof t?.profile=="string"?t.profile:null}function ie(e){return {fail:e.filter(t=>t.severity==="fail").length,warn:e.filter(t=>t.severity==="warn").length,info:e.filter(t=>t.severity==="info").length}}function ae(e){if(e.projectCount===0)return e.workspaceDetected?["Add your first project: npx workspai create project <name> --kit <kit>","Import an existing service: npx workspai import <path>"]:["Create a Workspai workspace: npx workspai create workspace my-workspace --profile polyglot","Import an existing service: npx workspai import ../service"];let t=[];return e.findings.some(n=>n.id==="workspace.marker.missing")&&t.push("Initialize workspace metadata with `workspai bootstrap --profile polyglot`."),e.findings.some(n=>n.id==="project.marker.missing")&&t.push("Register detected projects with `workspai import <path>` or recreate them via `workspai create project`."),e.findings.some(n=>n.id==="project.tests.missing")&&t.push("Add test entrypoints, then gate changes with `workspai workspace run test --affected --strict`."),e.findings.some(n=>n.id==="project.ci.missing")&&t.push("Add CI/CD configuration to catch regressions early and make workspace health checks actionable."),e.findings.some(n=>n.id==="project.health.missing")&&t.push("Add a health/readiness endpoint so runtime probes and deployment checks can verify service health."),e.hasGraph||t.push("Create `.workspai/workspace-dependency-graph.json` or use analyze output as the first graph seed."),t.push("Run `workspai autopilot release --mode audit --json` before release."),Array.from(new Set(t))}async function ve(e$3={}){let t=c.resolve(e$3.workspacePath||process.cwd());if(!await D(t))throw new Error(`Workspace path does not exist: ${t}`);let n=B(t)??t,r=j(n),s=await oe(n),o=await V(n),a=await Promise.all(o.map(d=>ne(n,d))),p=await re(a),u=se(a,p),f$2=[];r||f$2.push(g("workspace.marker.missing","warn",".","Workspace metadata is missing","The directory can be analyzed, but it is not a registered Workspai workspace.","Run `workspai create workspace` or `workspai bootstrap --profile polyglot` in a workspace root.")),a.length===0&&f$2.push(g("workspace.projects.missing","warn",".","No backend projects detected","Workspai did not find runtime markers or project metadata under this root.","Create a project with `workspai create project` or import one with `workspai import <path>`."));let l=[...f$2,...a.flatMap(d=>d.findings)],h=ie(l),k={};for(let d of a)k[d.runtime]=(k[d.runtime]||0)+1;let P=a.length>0?Math.round(a.reduce((d,y)=>d+y.score,0)/a.length):0,C=f$2.reduce((d,y)=>d+(y.severity==="fail"?20:y.severity==="warn"?8:2),0),m=Math.max(0,P-C),J=a.length===0&&h.fail===0&&l.length>0&&l.every(d=>d.id==="workspace.projects.missing"&&d.severity==="warn"),H=h.fail>0||e$3.strict&&h.warn>0&&!J?"blocked":h.warn>0?"needs-attention":"ready",j$1={schemaVersion:f.analyze,generatedAt:new Date().toISOString(),workspacePath:n,workspaceDetected:r,profile:s,summary:{score:m,verdict:H,projectCount:a.length,runtimeCount:Object.keys(k).length,findings:h},runtimes:k,projects:a,dependencyGraph:{status:p.length>0?"generated":"empty",edges:p,topImpactedProjects:u.slice(0,5)},findings:l,nextActions:ae({findings:l,projectCount:a.length,hasGraph:p.length>0,workspaceDetected:r}),enterpriseControls:{jsonReady:true,ciGateCommand:"workspai analyze --json --strict",releaseGateCommand:"workspai autopilot release --mode enforce --json",evidencePath:e.analyze}};if(e$3.output&&(await w.promises.mkdir(c.dirname(c.resolve(e$3.output)),{recursive:true}),await w.promises.writeFile(c.resolve(e$3.output),`${JSON.stringify(j$1,null,2)}
1
+ import {f as f$1,e as e$1}from'./chunk-ILIBOMYL.js';import {a,b}from'./chunk-QJCCZLOF.js';import {a as a$1}from'./chunk-27UR373Z.js';import {a as a$2}from'./chunk-T5YRFRJV.js';import {h,j as j$1}from'./chunk-ZCPT6KC3.js';import {e as e$2}from'./chunk-CCDGHPEJ.js';import {e,f}from'./chunk-NZ3WZYD5.js';import {j,s,t}from'./chunk-MOSXTVPU.js';import w from'fs';import c from'path';import i from'chalk';var L=new Set([".git",".workspai",".rapidkit",".venv","node_modules","dist","build","target","coverage","htmlcov",".next"]);async function D(e){try{return await w.promises.access(e,w.constants.F_OK),true}catch{return false}}async function z(e){try{let t=JSON.parse(await w.promises.readFile(e,"utf-8"));return t&&typeof t=="object"&&!Array.isArray(t)?t:null}catch{return null}}async function K(e){try{return await w.promises.readFile(e,"utf-8")}catch{return ""}}function B(e){return a(e)}async function U(e,t$1){return await M([...t(e,"project.json"),...t(e,"context.json")])?true:b(e)?false:c.resolve(e)===c.resolve(t$1)?h(e).length>0:h(e).length>0}async function V(e){let t=await a$1(e,{skipDirs:L,includeHiddenDirs:false,descendIntoMatchedProjects:false,isProjectDir:U}),r=(await a$2(e)).filter(o=>o.relationship==="adopted"||o.source==="adopted-local").map(o=>c.resolve(o.path)).filter(o=>w.existsSync(o)),s=[...new Set([...t.map(o=>c.resolve(o)),...r])];return s.length>0?s:b(e)?[]:h(e).length>0?[e]:[]}function q(e,t){return c.relative(e,t).replace(/\\/g,"/")||"."}async function A(e,t){for(let n of t)if(await D(c.join(e,n)))return true;return false}async function M(e){for(let t of e)if(await D(t))return true;return false}async function Q(e){if(await A(e,[".gitlab-ci.yml",".circleci/config.yml","azure-pipelines.yml","bitbucket-pipelines.yml","cloudbuild.yaml"]))return true;try{return (await w.promises.readdir(c.join(e,".github","workflows"),{withFileTypes:true})).some(n=>n.isFile()&&/\.(?:ya?ml)$/i.test(n.name)&&!n.name.startsWith("."))}catch{return false}}async function O(e){for(let t of e){let n=await z(t);if(n)return n}return null}async function X(e){return A(e,["health","health.ts","health.js","health.py","health.go","health.kt","health.rb","health.php","healthcheck","health-check","src/health.ts","src/health.js","src/health.py","src/health.go","src/health.kt","src/health.rb","src/health.php","src/healthcheck.ts","src/healthcheck.js","src/liveness.ts","src/readiness.ts","src/ping.ts"])}async function Y(e){if(await A(e,["tests","test","__tests__","src/__tests__","pytest.ini","vitest.config.ts","jest.config.ts"]))return true;let n=await z(c.join(e,"package.json")),r=n?.scripts&&typeof n.scripts=="object"?n.scripts:{};return typeof r.test=="string"&&r.test.trim().length>0}async function Z(e){let t=await z(c.join(e,"package.json")),n=t?.scripts&&typeof t.scripts=="object"?t.scripts:{};return Object.keys(n).sort()}function g(e,t,n,r,s,o){return {id:e,severity:t,target:n,title:r,detail:s,remediation:o}}function ee(e){let t=e.reduce((n,r)=>r.severity==="fail"?n+28:r.severity==="warn"?n+12:n+3,0);return Math.max(0,100-t)}async function ne(e,t$1){let n=await O(t(t$1,"project.json")),r=j$1(t$1,n),s=h(t$1),o=r.runtime==="unknown"?s[0]||"unknown":r.runtime,a=q(e,t$1),p=a,u=await Z(t$1),f=await M([...t(t$1,"project.json"),...t(t$1,"context.json")]),l=await Y(t$1),h$1=await A(t$1,["Dockerfile","dockerfile"]),k=await A(t$1,[".env.example","env.example","config/env.example"]),P=await Q(t$1),C=await X(t$1),m=[];return r.key==="unknown"&&m.push(g("project.stack.unknown","fail",p,"Project stack is unknown","Workspai cannot confidently classify this backend project.","Add .workspai/project.json metadata or import the project with `workspai import`.")),f||m.push(g("project.marker.missing","warn",p,"Workspai marker is missing","The project can be detected by files, but it is not registered with Workspai metadata.","Run `workspai import <path>` from a workspace or create the project through Workspai.")),l||m.push(g("project.tests.missing","warn",p,"Test entrypoint is missing","No common test folder, config, or package test script was found.","Add a test command so `workspai workspace run test --affected` can gate changes.")),k||m.push(g("project.env.example.missing","info",p,"Environment example is missing","No .env.example or env.example file was found.","Add an env example for onboarding and CI secret documentation.")),P||m.push(g("project.ci.missing","warn",p,"Continuous integration is missing","No recognized CI/CD configuration file was detected for this project.","Add CI configuration so tests and checks run automatically for every change.")),C||m.push(g("project.health.missing","info",p,"Health or readiness probe is missing","The project has no obvious health or readiness endpoint to support automated deployment and runtime checks.","Add a simple health endpoint and document it for readiness gates and observability.")),h$1||m.push(g("project.container.missing","info",p,"Container recipe is missing","No Dockerfile was found for this project.","Add a Dockerfile when the service is intended for containerized deployment.")),{name:typeof n?.name=="string"&&n.name.trim()?n.name.trim():c.basename(t$1),path:t$1,relativePath:a,runtime:o,framework:r.key,confidence:r.confidence,supportTier:r.supportTier,hasRapidKitMarker:f,hasTests:l,hasDockerfile:h$1,hasEnvExample:k,hasCiConfig:P,hasHealthEndpoint:C,scripts:u,findings:m,score:ee(m)}}function te(e){return e.name.toLowerCase()}async function re(e){let t=new Map(e.map(s=>[te(s),s])),n=[];for(let s of e){let o=await z(c.join(s.path,"package.json")),a={...o?.dependencies??{},...o?.devDependencies??{},...o?.peerDependencies??{}};for(let u of Object.keys(a)){let f=u.replace(/^@[^/]+\//,"").toLowerCase(),l=t.get(f);l&&l.relativePath!==s.relativePath&&n.push({from:s.relativePath,to:l.relativePath,kind:"package"});}let p=await K(c.join(s.path,"pyproject.toml"));for(let u of e)u.relativePath!==s.relativePath&&p.includes(u.name)&&n.push({from:s.relativePath,to:u.relativePath,kind:"workspace-reference"});}let r=new Set;return n.filter(s=>{let o=`${s.from}\0${s.to}\0${s.kind}`;return r.has(o)?false:(r.add(o),true)})}function se(e,t){let n=new Map;for(let r of e)n.set(r.relativePath,{project:r.relativePath,directDependents:0,directDependencies:0});for(let r of t){let s=n.get(r.from),o=n.get(r.to);s&&(s.directDependencies+=1),o&&(o.directDependents+=1);}return Array.from(n.values()).sort((r,s)=>s.directDependents-r.directDependents||s.directDependencies-r.directDependencies)}async function oe(e){let t=await O(s(e,"workspace.json"));return typeof t?.profile=="string"?t.profile:null}function ie(e){return {fail:e.filter(t=>t.severity==="fail").length,warn:e.filter(t=>t.severity==="warn").length,info:e.filter(t=>t.severity==="info").length}}function ae(e){if(e.projectCount===0)return e.workspaceDetected?["Add your first project: npx workspai create project <name> --kit <kit>","Import an existing service: npx workspai import <path>"]:["Create a Workspai workspace: npx workspai create workspace my-workspace --profile polyglot","Import an existing service: npx workspai import ../service"];let t=[];return e.findings.some(n=>n.id==="workspace.marker.missing")&&t.push("Initialize workspace metadata with `workspai bootstrap --profile polyglot`."),e.findings.some(n=>n.id==="project.marker.missing")&&t.push("Register detected projects with `workspai import <path>` or recreate them via `workspai create project`."),e.findings.some(n=>n.id==="project.tests.missing")&&t.push("Add test entrypoints, then gate changes with `workspai workspace run test --affected --strict`."),e.findings.some(n=>n.id==="project.ci.missing")&&t.push("Add CI/CD configuration to catch regressions early and make workspace health checks actionable."),e.findings.some(n=>n.id==="project.health.missing")&&t.push("Add a health/readiness endpoint so runtime probes and deployment checks can verify service health."),e.hasGraph||t.push("Create `.workspai/workspace-dependency-graph.json` or use analyze output as the first graph seed."),t.push("Run `workspai autopilot release --mode audit --json` before release."),Array.from(new Set(t))}async function ve(e$3={}){let t=c.resolve(e$3.workspacePath||process.cwd());if(!await D(t))throw new Error(`Workspace path does not exist: ${t}`);let n=B(t)??t,r=j(n),s=await oe(n),o=await V(n),a=await Promise.all(o.map(d=>ne(n,d))),p=await re(a),u=se(a,p),f$2=[];r||f$2.push(g("workspace.marker.missing","warn",".","Workspace metadata is missing","The directory can be analyzed, but it is not a registered Workspai workspace.","Run `workspai create workspace` or `workspai bootstrap --profile polyglot` in a workspace root.")),a.length===0&&f$2.push(g("workspace.projects.missing","warn",".","No backend projects detected","Workspai did not find runtime markers or project metadata under this root.","Create a project with `workspai create project` or import one with `workspai import <path>`."));let l=[...f$2,...a.flatMap(d=>d.findings)],h=ie(l),k={};for(let d of a)k[d.runtime]=(k[d.runtime]||0)+1;let P=a.length>0?Math.round(a.reduce((d,y)=>d+y.score,0)/a.length):0,C=f$2.reduce((d,y)=>d+(y.severity==="fail"?20:y.severity==="warn"?8:2),0),m=Math.max(0,P-C),J=a.length===0&&h.fail===0&&l.length>0&&l.every(d=>d.id==="workspace.projects.missing"&&d.severity==="warn"),H=h.fail>0||e$3.strict&&h.warn>0&&!J?"blocked":h.warn>0?"needs-attention":"ready",j$1={schemaVersion:f.analyze,generatedAt:new Date().toISOString(),workspacePath:n,workspaceDetected:r,profile:s,summary:{score:m,verdict:H,projectCount:a.length,runtimeCount:Object.keys(k).length,findings:h},runtimes:k,projects:a,dependencyGraph:{status:p.length>0?"generated":"empty",edges:p,topImpactedProjects:u.slice(0,5)},findings:l,nextActions:ae({findings:l,projectCount:a.length,hasGraph:p.length>0,workspaceDetected:r}),enterpriseControls:{jsonReady:true,ciGateCommand:"workspai analyze --json --strict",releaseGateCommand:"workspai autopilot release --mode enforce --json",evidencePath:e.analyze}};if(e$3.output&&(await w.promises.mkdir(c.dirname(c.resolve(e$3.output)),{recursive:true}),await w.promises.writeFile(c.resolve(e$3.output),`${JSON.stringify(j$1,null,2)}
2
2
  `)),!e$3.output&&r){let d=f$1(j$1,{commandId:"workspaceAnalyze",exitCode:j$1.summary.verdict==="blocked"?2:j$1.summary.verdict==="needs-attention"?1:0,generatedAt:j$1.generatedAt,blockers:j$1.findings.filter(y=>y.severity==="fail").map(y=>y.title).slice(0,12),runId:e$1()});await e$2(n,e.analyze,d);}return j$1}function be(e){let t=e.summary.verdict==="ready"?i.green:e.summary.verdict==="needs-attention"?i.yellow:i.red;if(console.log(i.bold(`
3
3
  Workspai Workspace Analysis
4
4
  `)),console.log(i.cyan("Workspace:"),e.workspacePath),console.log(i.cyan("Profile:"),e.profile||"not configured"),console.log(i.cyan("Score:"),`${e.summary.score}/100`),console.log(i.cyan("Verdict:"),t(e.summary.verdict)),console.log(i.gray(`Projects: ${e.summary.projectCount}, runtimes: ${e.summary.runtimeCount}, findings: ${e.summary.findings.fail} fail / ${e.summary.findings.warn} warn / ${e.summary.findings.info} info`)),e.projects.length>0){console.log(i.bold(`
@@ -1 +1 @@
1
- import {c,d as d$1}from'./chunk-QFBVQUKV.js';import {d}from'./chunk-CCDGHPEJ.js';import {e,f as f$1}from'./chunk-NZ3WZYD5.js';import A from'fs-extra';function t(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function W(e){let s=t(e);return !!(s&&s.schemaVersion===f$1.model&&t(s.workspace)&&Array.isArray(s.projects)&&(t(s.projectTopology)||t(s.graph)))}function G(e){let s=t(e);return !!(s&&s.schemaVersion===f$1.knowledgeGraph&&t(s.source)&&t(s.workspace)&&Array.isArray(s.entities)&&Array.isArray(s.relations)&&Array.isArray(s.proofs)&&Array.isArray(s.providers)&&t(s.quality))}async function f(e){try{return await A.readJson(e)}catch{return null}}async function I(e$1){let[s,n]=await Promise.all([d(e$1,e.model),d(e$1,e.knowledgeGraph)]);if(!s)return {status:"miss",reason:"missing-model"};if(!n)return {status:"miss",reason:"missing-graph"};let[i,o]=await Promise.all([f(s),f(n)]);if(!W(i))return {status:"miss",reason:"invalid-model"};if(!G(o))return {status:"miss",reason:"invalid-graph"};if(o.proofs.some(r=>r.freshness==="stale"))return {status:"miss",reason:"stale-proof"};try{c(o,i);}catch{return {status:"miss",reason:"source-mismatch"}}let a=o.source.inputs;if(!a)return {status:"miss",reason:"missing-input-fingerprint"};let d$2=a.scopes.filter(r=>r.kind==="workspace"),p=a.scopes.filter(r=>r.kind==="project"),k=i.projects.map(r=>r.name).sort(),w=p.map(r=>r.id).sort(),y=new Set(p.map(r=>r.fileLimit));if(a.schemaVersion!=="workspace-knowledge-graph-inputs.v1"||a.strategy!=="hybrid-git-content-v2"||a.hashAlgorithm!=="sha256"||d$2.length!==1||y.size>1||JSON.stringify(k)!==JSON.stringify(w))return {status:"miss",reason:"invalid-input-fingerprint"};let c$1;try{c$1=await d$1({workspacePath:e$1,projects:i.projects.map(r=>({id:r.name,path:r.path,...r.absolutePath?{absolutePath:r.absolutePath}:{}})),projectFileLimit:p[0]?.fileLimit??2e4,workspaceFileLimit:d$2[0].fileLimit});}catch{return {status:"miss",reason:"input-scan-failed"}}return !c$1||c$1.hash!==a.hash?{status:"miss",reason:"live-input-mismatch"}:{status:"hit",model:i,graph:o,modelPath:s,graphPath:n}}export{I as a};
1
+ import {c,d as d$1}from'./chunk-TFOOSYGO.js';import {d}from'./chunk-CCDGHPEJ.js';import {e,f as f$1}from'./chunk-NZ3WZYD5.js';import A from'fs-extra';function t(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function W(e){let s=t(e);return !!(s&&s.schemaVersion===f$1.model&&t(s.workspace)&&Array.isArray(s.projects)&&(t(s.projectTopology)||t(s.graph)))}function G(e){let s=t(e);return !!(s&&s.schemaVersion===f$1.knowledgeGraph&&t(s.source)&&t(s.workspace)&&Array.isArray(s.entities)&&Array.isArray(s.relations)&&Array.isArray(s.proofs)&&Array.isArray(s.providers)&&t(s.quality))}async function f(e){try{return await A.readJson(e)}catch{return null}}async function I(e$1){let[s,n]=await Promise.all([d(e$1,e.model),d(e$1,e.knowledgeGraph)]);if(!s)return {status:"miss",reason:"missing-model"};if(!n)return {status:"miss",reason:"missing-graph"};let[i,o]=await Promise.all([f(s),f(n)]);if(!W(i))return {status:"miss",reason:"invalid-model"};if(!G(o))return {status:"miss",reason:"invalid-graph"};if(o.proofs.some(r=>r.freshness==="stale"))return {status:"miss",reason:"stale-proof"};try{c(o,i);}catch{return {status:"miss",reason:"source-mismatch"}}let a=o.source.inputs;if(!a)return {status:"miss",reason:"missing-input-fingerprint"};let d$2=a.scopes.filter(r=>r.kind==="workspace"),p=a.scopes.filter(r=>r.kind==="project"),k=i.projects.map(r=>r.name).sort(),w=p.map(r=>r.id).sort(),y=new Set(p.map(r=>r.fileLimit));if(a.schemaVersion!=="workspace-knowledge-graph-inputs.v1"||a.strategy!=="hybrid-git-content-v2"||a.hashAlgorithm!=="sha256"||d$2.length!==1||y.size>1||JSON.stringify(k)!==JSON.stringify(w))return {status:"miss",reason:"invalid-input-fingerprint"};let c$1;try{c$1=await d$1({workspacePath:e$1,projects:i.projects.map(r=>({id:r.name,path:r.path,...r.absolutePath?{absolutePath:r.absolutePath}:{}})),projectFileLimit:p[0]?.fileLimit??2e4,workspaceFileLimit:d$2[0].fileLimit});}catch{return {status:"miss",reason:"input-scan-failed"}}return !c$1||c$1.hash!==a.hash?{status:"miss",reason:"live-input-mismatch"}:{status:"hit",model:i,graph:o,modelPath:s,graphPath:n}}export{I as a};
@@ -1,4 +1,4 @@
1
- import {g,b,i as i$1,d as d$2,e as e$1,f}from'./chunk-MZKKRAAJ.js';import {c}from'./chunk-GPOZILMY.js';import {c as c$1}from'./chunk-X7FYEKLI.js';import {d as d$3,b as b$1,a as a$1}from'./chunk-3RBUSW7H.js';import {d as d$1}from'./chunk-EWZZUQBR.js';import {a}from'./chunk-AFIFZTOY.js';import {h,e,i}from'./chunk-NZ3WZYD5.js';import {t,h as h$1,g as g$1}from'./chunk-MOSXTVPU.js';import le from'crypto';import H from'fs';import k from'fs/promises';import d from'path';import {execa}from'execa';import he from'fs-extra';var ke=h.projectContextAgent.schemaVersion,Ze=["managed","local","off"],de="<!-- WORKSPAI:PROJECT-GROUNDING:START -->",pe="<!-- WORKSPAI:PROJECT-GROUNDING:END -->";function oe(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}async function E(e){try{return JSON.parse(await k.readFile(e,"utf8"))}catch(t){return null}}function G(e){return e.replace(/\\/g,"/").replace(/^\.\/+/,"")}function x(e,t,n){let o=e.replace(/\\/g,"/"),i=/^[A-Za-z]:\//.test(o);if(!d.isAbsolute(e)&&!i)return G(o);if(i&&process.platform!=="win32")return null;let c=d.resolve(e),s=d.relative(n,c);if(s&&!s.startsWith("..")&&!d.isAbsolute(s))return G(s);let l=d.relative(t,c);return l&&!l.startsWith("..")&&!d.isAbsolute(l)?`workspace:${G(l)}`:null}function P(e,t,n){return [[n,"project:"],[n.replace(/\\/g,"/"),"project:"],[t,"workspace:"],[t.replace(/\\/g,"/"),"workspace:"]].reduce((i,[c,s])=>c.length>0?i.split(c).join(s):i,e)}function ge(e,t){return oe(e?.adoption)?.mode==="linked"?"adopted":oe(e?.import)?"imported":t}function we(e){if(!e.model)return null;let t=G(e.relativePath);return e.model.projects.find(n=>n.name===e.projectName||G(n.path)===t)??null}function ne(e,t){e[t]=(e[t]??0)+1;}var ye=["project","language","service","api","endpoint","schema","protocol","runtime-unit","lifecycle-stage","database","queue","container","deployment","pipeline","environment","test-suite","owner","decision","document","package","file","module","symbol"];function je(e,t=160){let n={language:32,api:32,service:32,endpoint:32,schema:32,protocol:32,"runtime-unit":32,"lifecycle-stage":32,file:8,module:8,symbol:8},o=[];for(let i of ye){let c=e.filter(s=>s.kind===i).sort((s,l)=>s.label.localeCompare(l.label)||s.id.localeCompare(l.id)).slice(0,n[i]??32);for(let s of c){if(o.length>=t)return o;o.push(s);}}return o}function Pe(e,t){if(!e)return {entityCount:0,relationCount:0,proofCount:0,entitiesByKind:{},relationsByKind:{},languages:{},semantic:{protocolConceptCount:0,protocolImplementationBindings:0,equivalenceBindings:0,generationBindings:0,runtimeUnitCount:0,lifecycleStageCount:0,runtimeCoverage:[]},relatedProjects:[],proofArtifacts:[],entities:[],relations:[],proofs:[],topology:{status:"unavailable",dependencies:[],dependents:[]},diagnostics:[]};let n=e.entities.find(r=>r.kind==="project"&&(r.id===t||r.label===t||r.projectId===t)),o=new Set(e.entities.filter(r=>r.projectId===t||r.id===n?.id||r.kind==="project"&&r.label===t).map(r=>r.id));n&&o.add(n.id);let i=e.relations.filter(r=>o.has(r.from)||o.has(r.to)),c=new Set(o);for(let r of i)c.add(r.from),c.add(r.to);let s=e.entities.filter(r=>c.has(r.id)),l=new Set,g={},u={},f={},w=new Set(s.filter(r=>r.kind==="language").map(r=>r.attributes.language).filter(r=>typeof r=="string"));for(let r of s){ne(g,r.kind);let a=typeof r.attributes.language=="string"?r.attributes.language:void 0;if(a&&r.kind==="language")f[a]={fileCount:typeof r.attributes.fileCount=="number"?r.attributes.fileCount:0,symbolCount:f[a]?.symbolCount??0,generatedFileCount:typeof r.attributes.generatedFileCount=="number"?r.attributes.generatedFileCount:0};else if(a&&(r.kind==="file"||r.kind==="symbol")){let h=f[a]??{fileCount:0,symbolCount:0,generatedFileCount:0};r.kind==="file"&&!w.has(a)?(h.fileCount+=1,r.attributes.generated===true&&(h.generatedFileCount+=1)):r.kind==="symbol"&&(h.symbolCount+=1),f[a]=h;}for(let h of r.proofIds)l.add(h);}for(let r of i){ne(u,r.kind);for(let a of r.proofIds)l.add(a);}let y=e.proofs.filter(r=>l.has(r.id)),b=[...new Set(e.entities.filter(r=>c.has(r.id)&&r.projectId&&r.projectId!==t).map(r=>r.projectId))].sort(),m=e.diagnostics.filter(r=>r.entityIds?.some(a=>c.has(a))||r.relationIds?.some(a=>i.some(h=>h.id===a))).map(r=>({code:r.code,severity:r.severity,message:r.message,...r.recommendation?{recommendation:r.recommendation}:{}})),p=(r,a)=>({project:a,kind:r.kind,source:r.source,confidence:r.confidence,evidence:[...new Set(r.evidence.map(h=>h.file.replace(/\\/g,"/")))].sort()}),v=e.projectTopology.edges.filter(r=>r.from===t).map(r=>p(r,r.to)).sort((r,a)=>`${r.project}:${r.kind}`.localeCompare(`${a.project}:${a.kind}`)),C=e.projectTopology.edges.filter(r=>r.to===t).map(r=>p(r,r.from)).sort((r,a)=>`${r.project}:${r.kind}`.localeCompare(`${a.project}:${a.kind}`)),R=je(s),N=s.filter(r=>r.kind==="runtime-unit"),j=new Set(R.map(r=>r.id)),_=[...i].sort((r,a)=>{let h=Number(j.has(r.from)||j.has(r.to));return Number(j.has(a.from)||j.has(a.to))-h||r.id.localeCompare(a.id)}).slice(0,128),$=new Set([...R.flatMap(r=>r.proofIds),..._.flatMap(r=>r.proofIds)]);return {entityCount:s.length,relationCount:i.length,proofCount:y.length,entitiesByKind:g,relationsByKind:u,languages:Object.fromEntries(Object.entries(f).sort(([r],[a])=>r.localeCompare(a))),semantic:{protocolConceptCount:g.protocol??0,protocolImplementationBindings:u["implements-protocol"]??0,equivalenceBindings:u["equivalent-to"]??0,generationBindings:(u["generated-from"]??0)+(u["generated-by"]??0),runtimeUnitCount:N.length,lifecycleStageCount:g["lifecycle-stage"]??0,runtimeCoverage:[...new Set(N.map(r=>r.attributes.runtime).filter(r=>typeof r=="string"))].sort()},relatedProjects:b,proofArtifacts:[...new Set(y.map(r=>r.artifact))].sort(),entities:R,relations:_,proofs:y.filter(r=>$.has(r.id)).sort((r,a)=>r.id.localeCompare(a.id)).slice(0,128),topology:{status:v.length>0||C.length>0?"proven":e.projectTopology.nodes.some(r=>r.id===t)?"unproven":"unavailable",dependencies:v,dependents:C},diagnostics:m}}function ue(e,t,n){return Array.isArray(e)?e.map(o=>typeof o=="string"?P(o,t,n):o):typeof e=="string"?P(e,t,n):e}function be(e,t,n){return {id:e.id,kind:e.kind,label:P(e.label,t,n),attributes:Object.fromEntries(Object.entries(e.attributes).map(([o,i])=>[o,ue(i,t,n)])),proofIds:[...e.proofIds].sort()}}function ve(e,t,n){let o=(...c)=>e.filter(s=>c.includes(s.kind)).map(s=>be(s,t,n)).slice(0,32),i=[];for(let c of e){for(let[s,l]of Object.entries(c.attributes))if(/(?:^|[-_.])ports?(?:$|[-_.])/i.test(s)&&(i.push({entityId:c.id,label:P(c.label,t,n),attribute:s,value:ue(l,t,n)}),i.length>=32))break;if(i.length>=32)break}return {services:o("service"),packages:o("package"),protocols:o("protocol"),runtimeUnits:o("runtime-unit"),lifecycleStages:o("lifecycle-stage"),apis:o("api"),endpoints:o("endpoint"),dataStores:o("database","queue"),deployments:o("container","deployment","environment"),pipelines:o("pipeline"),tests:o("test-suite"),owners:o("owner"),decisions:o("decision"),ports:i}}function Ae(e,t,n){let o=x(e.artifact,t,n);return o?{id:e.id,provider:e.provider,artifact:o,...e.pointer?{pointer:P(e.pointer,t,n)}:{},...e.line!==void 0?{line:e.line}:{},derivation:e.derivation,trust:e.trust,confidence:e.confidence,freshness:e.freshness}:null}async function Ee(e,t,n){let o=[],i=await E(d.join(e,".workspai","reports","INDEX.json"));if(Array.isArray(i?.blockers))for(let s of i.blockers)typeof s=="string"&&(s.startsWith(`${n}:`)||s.includes(`project:${n}`)||s.includes(`project ${n}`))&&o.push({source:"workspace-report-index",severity:"error",message:P(s,e,t)});let c=await E(d.join(e,".workspai","reports","doctor-project-last-run.json"));if(c?.projectName===n)for(let s of c$1({project:c.project}))o.push({source:"doctor-project",severity:s.status==="blocking"?"error":"warning",message:P(s.message,e,t),...s.id?{code:s.id}:{}});return [...new Map(o.map(s=>[`${s.source}:${s.code??""}:${s.message}`,s])).values()].slice(0,32)}function U(e,t=[]){return typeof e=="string"?/^[A-Za-z]:[\\/]/.test(e)||/(?:^|[\s("'`])[A-Za-z]:[\\/]/.test(e)||/(?:^|[\s("'`])\/(?:Users|home|private|var|opt|srv|mnt|Volumes|tmp)\//.test(e)||t.some(n=>n.length>0&&(e.includes(n)||e.includes(n.replace(/\\/g,"/")))):Array.isArray(e)?e.some(n=>U(n,t)):e&&typeof e=="object"?Object.values(e).some(n=>U(n,t)):false}function Ce(e){return le.createHash("sha256").update(JSON.stringify(e)).digest("hex")}async function Re(e$1){let t$1=d.resolve(e$1.workspacePath),n=d.resolve(e$1.projectPath),o=t(n,"project.json").find(a=>H.existsSync(a)),i$1=o?await E(o):null,c=await E(d.join(t$1,".workspai","workspace.contract.json")),s=d.resolve(n),l=c?.projects?.find(a=>a.externalPath?d.resolve(a.externalPath)===s:!a.relativePath||a.relativePath.startsWith("external/")?false:d.resolve(t$1,a.relativePath)===s)??c?.projects?.find(a=>a.slug===e$1.projectName||a.slug===d.basename(n)),g=e$1.projectName??(typeof i$1?.name=="string"?i$1.name:void 0)??l?.slug??d.basename(n),u=l?.relativePath??(()=>{let a=G(d.relative(t$1,n));return !a||a.startsWith("..")?`external/${g}`:a})(),f=await E(d.join(t$1,e.model)),w=await E(d.join(t$1,e.knowledgeGraph)),y=f?d$1(f):void 0,b$1=!!(y&&w?.source.hash===y),m=we({model:f,projectName:g,relativePath:u}),p=Pe(b$1?w:null,g),v=await Ee(t$1,n,g),C=p.proofs.map(a=>a.freshness),R=w?!b$1||C.includes("stale")?"stale":C.includes("unknown")?"unknown":"fresh":"missing",N=f?f.factFreshness?.status??"unknown":"missing",j=[...f?[]:[{code:"project.context.model-missing",severity:"warning",message:"The canonical Workspace Model has not been generated yet. Refresh workspace intelligence before relying on project topology."}],...f&&!m?[{code:"project.context.project-not-materialized",severity:"warning",message:"The project is registered in the workspace contract but is not present in the current Workspace Model."}]:[],...w?[]:[{code:"project.context.graph-missing",severity:"warning",message:"The Workspace Knowledge Graph has not been generated yet. Run the workspace intelligence loop to build proof-backed relationships."}],...w&&!b$1?[{code:"project.context.graph-model-mismatch",severity:"warning",message:"The persisted Knowledge Graph does not match the current Workspace Model and was excluded from this project lens."}]:[]],_=ge(i$1,e$1.relationship??l?.relationship??"managed"),$={schemaVersion:ke,generatedAt:(e$1.now??new Date).toISOString(),workspace:{name:c?.workspace?.name??f?.workspace.name??d.basename(t$1),...c?.workspace?.profile||f?.workspace.profile?{profile:c?.workspace?.profile??f?.workspace.profile}:{},relationship:_,contract:`workspace:${i.workspaceContract}`,model:`workspace:${e.model}`,knowledgeGraph:`workspace:${e.knowledgeGraph}`,access:{localBinding:i.projectWorkspaceLink,canonicalEvidenceAvailableAtGeneration:true,identityIsFilesystemPath:false,resolverCommand:"workspai project workspace status --json",portableUriScheme:"workspace:",resolvedPathPolicy:"runtime-private-never-persist"}},project:{name:g,relativePath:u,...m?.kind?{kind:m.kind}:{},...m?.runtime||l?.runtime?{runtime:m?.runtime??l?.runtime}:{},...m?.runtimeCandidates?.length?{runtimeCandidates:[...m.runtimeCandidates].sort()}:{},...m?.framework||l?.framework?{framework:m?.framework??l?.framework}:{},...m?.kit||l?.kit?{kit:m?.kit??l?.kit}:{},...m?.supportTier?{supportTier:m.supportTier}:{},commands:{supported:[...m?.commands.supported??[]].sort(),unsupported:[...m?.commands.unsupported??[]].sort(),fleetStages:[...m?.commands.fleetStages??[]].sort()},importantFiles:[...new Set((m?.importantFiles??[]).map(a=>x(a,t$1,n)).filter(a=>a!==null))].sort()},intelligence:{...f?.generatedAt?{modelGeneratedAt:f.generatedAt}:{},...w?.generatedAt?{graphGeneratedAt:w.generatedAt}:{},...w?.source.hash?{graphModelHash:w.source.hash}:{},entityCount:p.entityCount,relationCount:p.relationCount,proofCount:p.proofCount,entitiesByKind:p.entitiesByKind,relationsByKind:p.relationsByKind,languages:p.languages,semantic:p.semantic,relatedProjects:p.relatedProjects,freshness:{model:N,graph:R,graphMatchesModel:b$1},topology:{...p.topology,dependencies:p.topology.dependencies.map(a=>({...a,evidence:a.evidence.map(h=>x(h,t$1,n)).filter(h=>h!==null)})),dependents:p.topology.dependents.map(a=>({...a,evidence:a.evidence.map(h=>x(h,t$1,n)).filter(h=>h!==null)}))},surfaces:ve(p.entities,t$1,n),diagnostics:[...j,...p.diagnostics].map(a=>({...a,message:P(a.message,t$1,n),...a.recommendation?{recommendation:P(a.recommendation,t$1,n)}:{}}))},evidence:{readOrder:[b,".workspai/PROJECT-GROUNDING.md",i.projectContextAgent,"AGENTS.md","workspace:.workspai/goals/index.json",`workspace:${i.goalPackLastRun}`,"workspace:.workspai/reports/INDEX.json","workspace:.workspai/reports/workspace-context-agent.json",`workspace:${e.model}`,`workspace:${e.knowledgeGraph}`],projectProofArtifacts:[...new Set(p.proofArtifacts.map(a=>x(a,t$1,n)).filter(a=>a!==null))],relations:p.relations.map(a=>({id:a.id,from:a.from,to:a.to,kind:a.kind,derivation:a.derivation,trust:a.trust,confidence:a.confidence,proofIds:[...a.proofIds].sort()})),proofs:p.proofs.map(a=>Ae(a,t$1,n)).filter(a=>a!==null)},blockers:v,agentRouting:{enforcement:"required",mandatoryPreflight:{command:"workspai agent bootstrap --for-agent generic --strict --json",successCondition:"ready"},workspaceLocator:{command:"workspai project workspace status --json",successCondition:"resolved",outputClassification:"machine-local",persistence:"forbidden",disclosure:"forbidden",portableUriScheme:"workspace:"},workspaceEvidenceRequiredFor:["repository-analysis","architecture-analysis","change-impact","cross-project-change","contract-change","infrastructure-change","release-readiness"],requiredReadOrder:[b,"command:workspai agent bootstrap --for-agent generic --strict --json","command:workspai project workspace status --json",i.projectContextAgent,"workspace:.workspai/reports/INDEX.json","workspace:.workspai/reports/workspace-context-agent.json",`command:npx workspai workspace graph search ${JSON.stringify(g)} --scope ${JSON.stringify(`project:${g}`)} --limit 12 --json`],degradedMode:{allowCompleteArchitectureClaims:false,requireDisclosure:true}},commands:{refresh:"workspai workspace intelligence run --for-agent generic --strict --json",verify:"workspai workspace verify --strict --json",graphSearch:`workspai workspace graph search ${JSON.stringify(g)} --scope ${JSON.stringify(`project:${g}`)} --limit 12 --json`,doctor:"workspai doctor project --json",workspaceStatus:"workspai project workspace status --json"}};if(U($,[t$1,n]))throw new Error("Project context lens rejected a non-portable absolute path.");let r={...$,integrity:{algorithm:"sha256",...y?{modelHash:y}:{},payloadHash:Ce($),portable:true,absolutePathsEmitted:false}};return a(r,"contracts/workspace-intelligence/project-context-agent.v1.json","Project context agent"),r}function Te(e){let t=e.intelligence.relatedProjects.length>0?e.intelligence.relatedProjects.map(i=>`\`${i}\``).join(", "):"No proven cross-project relation is currently available.",n=e.intelligence.diagnostics.length>0?e.intelligence.diagnostics.slice(0,8).map(i=>`- **${i.severity} \xB7 ${i.code}:** ${i.message}`).join(`
1
+ import {g,b,i as i$1,d as d$2,e as e$1,f}from'./chunk-I2O6AC2Z.js';import {c}from'./chunk-GPOZILMY.js';import {c as c$1}from'./chunk-X7FYEKLI.js';import {d as d$3,b as b$1,a as a$1}from'./chunk-3RBUSW7H.js';import {d as d$1}from'./chunk-EWZZUQBR.js';import {a}from'./chunk-AFIFZTOY.js';import {h,e,i}from'./chunk-NZ3WZYD5.js';import {t,h as h$1,g as g$1}from'./chunk-MOSXTVPU.js';import le from'crypto';import H from'fs';import k from'fs/promises';import d from'path';import {execa}from'execa';import he from'fs-extra';var ke=h.projectContextAgent.schemaVersion,Ze=["managed","local","off"],de="<!-- WORKSPAI:PROJECT-GROUNDING:START -->",pe="<!-- WORKSPAI:PROJECT-GROUNDING:END -->";function oe(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}async function E(e){try{return JSON.parse(await k.readFile(e,"utf8"))}catch(t){return null}}function G(e){return e.replace(/\\/g,"/").replace(/^\.\/+/,"")}function x(e,t,n){let o=e.replace(/\\/g,"/"),i=/^[A-Za-z]:\//.test(o);if(!d.isAbsolute(e)&&!i)return G(o);if(i&&process.platform!=="win32")return null;let c=d.resolve(e),s=d.relative(n,c);if(s&&!s.startsWith("..")&&!d.isAbsolute(s))return G(s);let l=d.relative(t,c);return l&&!l.startsWith("..")&&!d.isAbsolute(l)?`workspace:${G(l)}`:null}function P(e,t,n){return [[n,"project:"],[n.replace(/\\/g,"/"),"project:"],[t,"workspace:"],[t.replace(/\\/g,"/"),"workspace:"]].reduce((i,[c,s])=>c.length>0?i.split(c).join(s):i,e)}function ge(e,t){return oe(e?.adoption)?.mode==="linked"?"adopted":oe(e?.import)?"imported":t}function we(e){if(!e.model)return null;let t=G(e.relativePath);return e.model.projects.find(n=>n.name===e.projectName||G(n.path)===t)??null}function ne(e,t){e[t]=(e[t]??0)+1;}var ye=["project","language","service","api","endpoint","schema","protocol","runtime-unit","lifecycle-stage","database","queue","container","deployment","pipeline","environment","test-suite","owner","decision","document","package","file","module","symbol"];function je(e,t=160){let n={language:32,api:32,service:32,endpoint:32,schema:32,protocol:32,"runtime-unit":32,"lifecycle-stage":32,file:8,module:8,symbol:8},o=[];for(let i of ye){let c=e.filter(s=>s.kind===i).sort((s,l)=>s.label.localeCompare(l.label)||s.id.localeCompare(l.id)).slice(0,n[i]??32);for(let s of c){if(o.length>=t)return o;o.push(s);}}return o}function Pe(e,t){if(!e)return {entityCount:0,relationCount:0,proofCount:0,entitiesByKind:{},relationsByKind:{},languages:{},semantic:{protocolConceptCount:0,protocolImplementationBindings:0,equivalenceBindings:0,generationBindings:0,runtimeUnitCount:0,lifecycleStageCount:0,runtimeCoverage:[]},relatedProjects:[],proofArtifacts:[],entities:[],relations:[],proofs:[],topology:{status:"unavailable",dependencies:[],dependents:[]},diagnostics:[]};let n=e.entities.find(r=>r.kind==="project"&&(r.id===t||r.label===t||r.projectId===t)),o=new Set(e.entities.filter(r=>r.projectId===t||r.id===n?.id||r.kind==="project"&&r.label===t).map(r=>r.id));n&&o.add(n.id);let i=e.relations.filter(r=>o.has(r.from)||o.has(r.to)),c=new Set(o);for(let r of i)c.add(r.from),c.add(r.to);let s=e.entities.filter(r=>c.has(r.id)),l=new Set,g={},u={},f={},w=new Set(s.filter(r=>r.kind==="language").map(r=>r.attributes.language).filter(r=>typeof r=="string"));for(let r of s){ne(g,r.kind);let a=typeof r.attributes.language=="string"?r.attributes.language:void 0;if(a&&r.kind==="language")f[a]={fileCount:typeof r.attributes.fileCount=="number"?r.attributes.fileCount:0,symbolCount:f[a]?.symbolCount??0,generatedFileCount:typeof r.attributes.generatedFileCount=="number"?r.attributes.generatedFileCount:0};else if(a&&(r.kind==="file"||r.kind==="symbol")){let h=f[a]??{fileCount:0,symbolCount:0,generatedFileCount:0};r.kind==="file"&&!w.has(a)?(h.fileCount+=1,r.attributes.generated===true&&(h.generatedFileCount+=1)):r.kind==="symbol"&&(h.symbolCount+=1),f[a]=h;}for(let h of r.proofIds)l.add(h);}for(let r of i){ne(u,r.kind);for(let a of r.proofIds)l.add(a);}let y=e.proofs.filter(r=>l.has(r.id)),b=[...new Set(e.entities.filter(r=>c.has(r.id)&&r.projectId&&r.projectId!==t).map(r=>r.projectId))].sort(),m=e.diagnostics.filter(r=>r.entityIds?.some(a=>c.has(a))||r.relationIds?.some(a=>i.some(h=>h.id===a))).map(r=>({code:r.code,severity:r.severity,message:r.message,...r.recommendation?{recommendation:r.recommendation}:{}})),p=(r,a)=>({project:a,kind:r.kind,source:r.source,confidence:r.confidence,evidence:[...new Set(r.evidence.map(h=>h.file.replace(/\\/g,"/")))].sort()}),v=e.projectTopology.edges.filter(r=>r.from===t).map(r=>p(r,r.to)).sort((r,a)=>`${r.project}:${r.kind}`.localeCompare(`${a.project}:${a.kind}`)),C=e.projectTopology.edges.filter(r=>r.to===t).map(r=>p(r,r.from)).sort((r,a)=>`${r.project}:${r.kind}`.localeCompare(`${a.project}:${a.kind}`)),R=je(s),N=s.filter(r=>r.kind==="runtime-unit"),j=new Set(R.map(r=>r.id)),_=[...i].sort((r,a)=>{let h=Number(j.has(r.from)||j.has(r.to));return Number(j.has(a.from)||j.has(a.to))-h||r.id.localeCompare(a.id)}).slice(0,128),$=new Set([...R.flatMap(r=>r.proofIds),..._.flatMap(r=>r.proofIds)]);return {entityCount:s.length,relationCount:i.length,proofCount:y.length,entitiesByKind:g,relationsByKind:u,languages:Object.fromEntries(Object.entries(f).sort(([r],[a])=>r.localeCompare(a))),semantic:{protocolConceptCount:g.protocol??0,protocolImplementationBindings:u["implements-protocol"]??0,equivalenceBindings:u["equivalent-to"]??0,generationBindings:(u["generated-from"]??0)+(u["generated-by"]??0),runtimeUnitCount:N.length,lifecycleStageCount:g["lifecycle-stage"]??0,runtimeCoverage:[...new Set(N.map(r=>r.attributes.runtime).filter(r=>typeof r=="string"))].sort()},relatedProjects:b,proofArtifacts:[...new Set(y.map(r=>r.artifact))].sort(),entities:R,relations:_,proofs:y.filter(r=>$.has(r.id)).sort((r,a)=>r.id.localeCompare(a.id)).slice(0,128),topology:{status:v.length>0||C.length>0?"proven":e.projectTopology.nodes.some(r=>r.id===t)?"unproven":"unavailable",dependencies:v,dependents:C},diagnostics:m}}function ue(e,t,n){return Array.isArray(e)?e.map(o=>typeof o=="string"?P(o,t,n):o):typeof e=="string"?P(e,t,n):e}function be(e,t,n){return {id:e.id,kind:e.kind,label:P(e.label,t,n),attributes:Object.fromEntries(Object.entries(e.attributes).map(([o,i])=>[o,ue(i,t,n)])),proofIds:[...e.proofIds].sort()}}function ve(e,t,n){let o=(...c)=>e.filter(s=>c.includes(s.kind)).map(s=>be(s,t,n)).slice(0,32),i=[];for(let c of e){for(let[s,l]of Object.entries(c.attributes))if(/(?:^|[-_.])ports?(?:$|[-_.])/i.test(s)&&(i.push({entityId:c.id,label:P(c.label,t,n),attribute:s,value:ue(l,t,n)}),i.length>=32))break;if(i.length>=32)break}return {services:o("service"),packages:o("package"),protocols:o("protocol"),runtimeUnits:o("runtime-unit"),lifecycleStages:o("lifecycle-stage"),apis:o("api"),endpoints:o("endpoint"),dataStores:o("database","queue"),deployments:o("container","deployment","environment"),pipelines:o("pipeline"),tests:o("test-suite"),owners:o("owner"),decisions:o("decision"),ports:i}}function Ae(e,t,n){let o=x(e.artifact,t,n);return o?{id:e.id,provider:e.provider,artifact:o,...e.pointer?{pointer:P(e.pointer,t,n)}:{},...e.line!==void 0?{line:e.line}:{},derivation:e.derivation,trust:e.trust,confidence:e.confidence,freshness:e.freshness}:null}async function Ee(e,t,n){let o=[],i=await E(d.join(e,".workspai","reports","INDEX.json"));if(Array.isArray(i?.blockers))for(let s of i.blockers)typeof s=="string"&&(s.startsWith(`${n}:`)||s.includes(`project:${n}`)||s.includes(`project ${n}`))&&o.push({source:"workspace-report-index",severity:"error",message:P(s,e,t)});let c=await E(d.join(e,".workspai","reports","doctor-project-last-run.json"));if(c?.projectName===n)for(let s of c$1({project:c.project}))o.push({source:"doctor-project",severity:s.status==="blocking"?"error":"warning",message:P(s.message,e,t),...s.id?{code:s.id}:{}});return [...new Map(o.map(s=>[`${s.source}:${s.code??""}:${s.message}`,s])).values()].slice(0,32)}function U(e,t=[]){return typeof e=="string"?/^[A-Za-z]:[\\/]/.test(e)||/(?:^|[\s("'`])[A-Za-z]:[\\/]/.test(e)||/(?:^|[\s("'`])\/(?:Users|home|private|var|opt|srv|mnt|Volumes|tmp)\//.test(e)||t.some(n=>n.length>0&&(e.includes(n)||e.includes(n.replace(/\\/g,"/")))):Array.isArray(e)?e.some(n=>U(n,t)):e&&typeof e=="object"?Object.values(e).some(n=>U(n,t)):false}function Ce(e){return le.createHash("sha256").update(JSON.stringify(e)).digest("hex")}async function Re(e$1){let t$1=d.resolve(e$1.workspacePath),n=d.resolve(e$1.projectPath),o=t(n,"project.json").find(a=>H.existsSync(a)),i$1=o?await E(o):null,c=await E(d.join(t$1,".workspai","workspace.contract.json")),s=d.resolve(n),l=c?.projects?.find(a=>a.externalPath?d.resolve(a.externalPath)===s:!a.relativePath||a.relativePath.startsWith("external/")?false:d.resolve(t$1,a.relativePath)===s)??c?.projects?.find(a=>a.slug===e$1.projectName||a.slug===d.basename(n)),g=e$1.projectName??(typeof i$1?.name=="string"?i$1.name:void 0)??l?.slug??d.basename(n),u=l?.relativePath??(()=>{let a=G(d.relative(t$1,n));return !a||a.startsWith("..")?`external/${g}`:a})(),f=await E(d.join(t$1,e.model)),w=await E(d.join(t$1,e.knowledgeGraph)),y=f?d$1(f):void 0,b$1=!!(y&&w?.source.hash===y),m=we({model:f,projectName:g,relativePath:u}),p=Pe(b$1?w:null,g),v=await Ee(t$1,n,g),C=p.proofs.map(a=>a.freshness),R=w?!b$1||C.includes("stale")?"stale":C.includes("unknown")?"unknown":"fresh":"missing",N=f?f.factFreshness?.status??"unknown":"missing",j=[...f?[]:[{code:"project.context.model-missing",severity:"warning",message:"The canonical Workspace Model has not been generated yet. Refresh workspace intelligence before relying on project topology."}],...f&&!m?[{code:"project.context.project-not-materialized",severity:"warning",message:"The project is registered in the workspace contract but is not present in the current Workspace Model."}]:[],...w?[]:[{code:"project.context.graph-missing",severity:"warning",message:"The Workspace Knowledge Graph has not been generated yet. Run the workspace intelligence loop to build proof-backed relationships."}],...w&&!b$1?[{code:"project.context.graph-model-mismatch",severity:"warning",message:"The persisted Knowledge Graph does not match the current Workspace Model and was excluded from this project lens."}]:[]],_=ge(i$1,e$1.relationship??l?.relationship??"managed"),$={schemaVersion:ke,generatedAt:(e$1.now??new Date).toISOString(),workspace:{name:c?.workspace?.name??f?.workspace.name??d.basename(t$1),...c?.workspace?.profile||f?.workspace.profile?{profile:c?.workspace?.profile??f?.workspace.profile}:{},relationship:_,contract:`workspace:${i.workspaceContract}`,model:`workspace:${e.model}`,knowledgeGraph:`workspace:${e.knowledgeGraph}`,access:{localBinding:i.projectWorkspaceLink,canonicalEvidenceAvailableAtGeneration:true,identityIsFilesystemPath:false,resolverCommand:"workspai project workspace status --json",portableUriScheme:"workspace:",resolvedPathPolicy:"runtime-private-never-persist"}},project:{name:g,relativePath:u,...m?.kind?{kind:m.kind}:{},...m?.runtime||l?.runtime?{runtime:m?.runtime??l?.runtime}:{},...m?.runtimeCandidates?.length?{runtimeCandidates:[...m.runtimeCandidates].sort()}:{},...m?.framework||l?.framework?{framework:m?.framework??l?.framework}:{},...m?.kit||l?.kit?{kit:m?.kit??l?.kit}:{},...m?.supportTier?{supportTier:m.supportTier}:{},commands:{supported:[...m?.commands.supported??[]].sort(),unsupported:[...m?.commands.unsupported??[]].sort(),fleetStages:[...m?.commands.fleetStages??[]].sort()},importantFiles:[...new Set((m?.importantFiles??[]).map(a=>x(a,t$1,n)).filter(a=>a!==null))].sort()},intelligence:{...f?.generatedAt?{modelGeneratedAt:f.generatedAt}:{},...w?.generatedAt?{graphGeneratedAt:w.generatedAt}:{},...w?.source.hash?{graphModelHash:w.source.hash}:{},entityCount:p.entityCount,relationCount:p.relationCount,proofCount:p.proofCount,entitiesByKind:p.entitiesByKind,relationsByKind:p.relationsByKind,languages:p.languages,semantic:p.semantic,relatedProjects:p.relatedProjects,freshness:{model:N,graph:R,graphMatchesModel:b$1},topology:{...p.topology,dependencies:p.topology.dependencies.map(a=>({...a,evidence:a.evidence.map(h=>x(h,t$1,n)).filter(h=>h!==null)})),dependents:p.topology.dependents.map(a=>({...a,evidence:a.evidence.map(h=>x(h,t$1,n)).filter(h=>h!==null)}))},surfaces:ve(p.entities,t$1,n),diagnostics:[...j,...p.diagnostics].map(a=>({...a,message:P(a.message,t$1,n),...a.recommendation?{recommendation:P(a.recommendation,t$1,n)}:{}}))},evidence:{readOrder:[b,".workspai/PROJECT-GROUNDING.md",i.projectContextAgent,"AGENTS.md","workspace:.workspai/goals/index.json",`workspace:${i.goalPackLastRun}`,"workspace:.workspai/reports/INDEX.json","workspace:.workspai/reports/workspace-context-agent.json",`workspace:${e.model}`,`workspace:${e.knowledgeGraph}`],projectProofArtifacts:[...new Set(p.proofArtifacts.map(a=>x(a,t$1,n)).filter(a=>a!==null))],relations:p.relations.map(a=>({id:a.id,from:a.from,to:a.to,kind:a.kind,derivation:a.derivation,trust:a.trust,confidence:a.confidence,proofIds:[...a.proofIds].sort()})),proofs:p.proofs.map(a=>Ae(a,t$1,n)).filter(a=>a!==null)},blockers:v,agentRouting:{enforcement:"required",mandatoryPreflight:{command:"workspai agent bootstrap --for-agent generic --strict --json",successCondition:"ready"},workspaceLocator:{command:"workspai project workspace status --json",successCondition:"resolved",outputClassification:"machine-local",persistence:"forbidden",disclosure:"forbidden",portableUriScheme:"workspace:"},workspaceEvidenceRequiredFor:["repository-analysis","architecture-analysis","change-impact","cross-project-change","contract-change","infrastructure-change","release-readiness"],requiredReadOrder:[b,"command:workspai agent bootstrap --for-agent generic --strict --json","command:workspai project workspace status --json",i.projectContextAgent,"workspace:.workspai/reports/INDEX.json","workspace:.workspai/reports/workspace-context-agent.json",`command:npx workspai workspace graph search ${JSON.stringify(g)} --scope ${JSON.stringify(`project:${g}`)} --limit 12 --json`],degradedMode:{allowCompleteArchitectureClaims:false,requireDisclosure:true}},commands:{refresh:"workspai workspace intelligence run --for-agent generic --strict --json",verify:"workspai workspace verify --strict --json",graphSearch:`workspai workspace graph search ${JSON.stringify(g)} --scope ${JSON.stringify(`project:${g}`)} --limit 12 --json`,doctor:"workspai doctor project --json",workspaceStatus:"workspai project workspace status --json"}};if(U($,[t$1,n]))throw new Error("Project context lens rejected a non-portable absolute path.");let r={...$,integrity:{algorithm:"sha256",...y?{modelHash:y}:{},payloadHash:Ce($),portable:true,absolutePathsEmitted:false}};return a(r,"contracts/workspace-intelligence/project-context-agent.v1.json","Project context agent"),r}function Te(e){let t=e.intelligence.relatedProjects.length>0?e.intelligence.relatedProjects.map(i=>`\`${i}\``).join(", "):"No proven cross-project relation is currently available.",n=e.intelligence.diagnostics.length>0?e.intelligence.diagnostics.slice(0,8).map(i=>`- **${i.severity} \xB7 ${i.code}:** ${i.message}`).join(`
2
2
  `):"- No project-scoped graph diagnostic is currently recorded.",o=e.blockers.length>0?e.blockers.slice(0,12).map(i=>`- **${i.severity}${i.code?` \xB7 ${i.code}`:""}:** ${i.message}`).join(`
3
3
  `):"- No current project-scoped blocker is recorded.";return `# Workspai project grounding
4
4
 
@@ -1 +1 @@
1
- import {a as a$1}from'./chunk-VRW6KXNK.js';import {b}from'./chunk-RO73VVHW.js';import {intro,confirm,isCancel,password,text,multiselect,select,cancel}from'@clack/prompts';var c=false;function O(n){if(b()||c)return;c=true;let i=`${a$1.brand("\u25C6")} ${a$1.white("Workspai")}${n?a$1.dim(` ${n}`):""}`;intro(i);}function a(n="Cancelled"){b()||(cancel(a$1.dim(n)),c=false);}function m(n){if(n)return i=>{let e=n(i);if(e!==true)return e===false?"Invalid value":e}}function v(n){return n.replace(/^[\p{Emoji_Presentation}\p{Extended_Pictographic}\s]+/u,"").trim()}function E(n){let i=v(n);for(let e of [" \u2014 "," \u2013 "," - "]){let t=i.indexOf(e);if(t>0)return {label:i.slice(0,t).trim(),hint:i.slice(t+e.length).trim()}}return {label:i}}function g(n){if(n.label)return {label:n.label,hint:n.hint};let i=E(n.name??String(n.value));return {label:i.label,hint:n.hint??i.hint}}function w(n,i){if(typeof n=="number")return n;if(n===void 0)return;let e=i.findIndex(t=>t.value===n);return e>=0?e:void 0}function h(n,i){return n.when===void 0?true:typeof n.when=="function"?n.when(i):n.when}async function Q(n,i){let e=n,t=v(e.message??e.name);if(e.type==="confirm"){let r=await confirm({message:t,initialValue:typeof e.default=="boolean"?e.default:false,active:a$1.success("yes"),inactive:a$1.dim("no")});return isCancel(r)&&(a(),process.exit(130)),r}if(e.type==="password"){let r=await password({message:t,validate:m(e.validate)});return isCancel(r)&&(a(),process.exit(130)),r}if(e.type==="input"){let r=await text({message:t,defaultValue:typeof e.default=="string"?e.default:void 0,initialValue:typeof e.default=="string"?e.default:void 0,validate:m(e.validate),placeholder:typeof e.default=="string"?e.default:void 0});return isCancel(r)&&(a(),process.exit(130)),r}if(e.type==="checkbox"){let r=[...e.choices??[]],l=await multiselect({message:t,options:r.map(u=>{let s=g(u);return {value:u.value,label:s.label,hint:s.hint}}),required:false});return isCancel(l)&&(a(),process.exit(130)),l}if(e.type==="rawlist"||e.type==="list"){let r=[...e.choices??[]].filter(s=>!s.disabled),l=w(e.default,r),u=await select({message:t,options:r.map(s=>{let p=g(s);return {value:s.value,label:p.label,hint:p.hint}}),initialValue:l!==void 0?r[l]?.value:void 0});return isCancel(u)&&(a(),process.exit(130)),u}throw new Error(`Unsupported prompt type: ${e.type}`)}async function A(n){if(b()){let e={};for(let t of n)if(h(t,e))if(t.default!==void 0)e[t.name]=t.default;else if(t.type==="confirm")e[t.name]=false;else if(t.type==="checkbox")e[t.name]=[];else if(t.choices?.length){let r=w(t.default,[...t.choices]);e[t.name]=r!==void 0?t.choices[r]?.value:t.choices[0]?.value;}else e[t.name]="";return e}let i={};for(let e of n)h(e,i)&&(i[e.name]=await Q(e));return i}export{O as a,A as b};
1
+ import {a as a$1}from'./chunk-J7G3YL4O.js';import {b}from'./chunk-UJXE4UAX.js';import {intro,confirm,isCancel,password,text,multiselect,select,cancel}from'@clack/prompts';var c=false;function O(n){if(b()||c)return;c=true;let i=`${a$1.brand("\u25C6")} ${a$1.white("Workspai")}${n?a$1.dim(` ${n}`):""}`;intro(i);}function a(n="Cancelled"){b()||(cancel(a$1.dim(n)),c=false);}function m(n){if(n)return i=>{let e=n(i);if(e!==true)return e===false?"Invalid value":e}}function v(n){return n.replace(/^[\p{Emoji_Presentation}\p{Extended_Pictographic}\s]+/u,"").trim()}function E(n){let i=v(n);for(let e of [" \u2014 "," \u2013 "," - "]){let t=i.indexOf(e);if(t>0)return {label:i.slice(0,t).trim(),hint:i.slice(t+e.length).trim()}}return {label:i}}function g(n){if(n.label)return {label:n.label,hint:n.hint};let i=E(n.name??String(n.value));return {label:i.label,hint:n.hint??i.hint}}function w(n,i){if(typeof n=="number")return n;if(n===void 0)return;let e=i.findIndex(t=>t.value===n);return e>=0?e:void 0}function h(n,i){return n.when===void 0?true:typeof n.when=="function"?n.when(i):n.when}async function Q(n,i){let e=n,t=v(e.message??e.name);if(e.type==="confirm"){let r=await confirm({message:t,initialValue:typeof e.default=="boolean"?e.default:false,active:a$1.success("yes"),inactive:a$1.dim("no")});return isCancel(r)&&(a(),process.exit(130)),r}if(e.type==="password"){let r=await password({message:t,validate:m(e.validate)});return isCancel(r)&&(a(),process.exit(130)),r}if(e.type==="input"){let r=await text({message:t,defaultValue:typeof e.default=="string"?e.default:void 0,initialValue:typeof e.default=="string"?e.default:void 0,validate:m(e.validate),placeholder:typeof e.default=="string"?e.default:void 0});return isCancel(r)&&(a(),process.exit(130)),r}if(e.type==="checkbox"){let r=[...e.choices??[]],l=await multiselect({message:t,options:r.map(u=>{let s=g(u);return {value:u.value,label:s.label,hint:s.hint}}),required:false});return isCancel(l)&&(a(),process.exit(130)),l}if(e.type==="rawlist"||e.type==="list"){let r=[...e.choices??[]].filter(s=>!s.disabled),l=w(e.default,r),u=await select({message:t,options:r.map(s=>{let p=g(s);return {value:s.value,label:p.label,hint:p.hint}}),initialValue:l!==void 0?r[l]?.value:void 0});return isCancel(u)&&(a(),process.exit(130)),u}throw new Error(`Unsupported prompt type: ${e.type}`)}async function A(n){if(b()){let e={};for(let t of n)if(h(t,e))if(t.default!==void 0)e[t.name]=t.default;else if(t.type==="confirm")e[t.name]=false;else if(t.type==="checkbox")e[t.name]=[];else if(t.choices?.length){let r=w(t.default,[...t.choices]);e[t.name]=r!==void 0?t.choices[r]?.value:t.choices[0]?.value;}else e[t.name]="";return e}let i={};for(let e of n)h(e,i)&&(i[e.name]=await Q(e));return i}export{O as a,A as b};