workspai 0.52.2 → 0.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/README.md +2 -0
  2. package/contracts/artifact-remediation-plan.v1.json +1 -0
  3. package/contracts/cli-runtime-command-inventory.v1.snapshot.json +36 -0
  4. package/contracts/extension-cli-compatibility.v1.json +24 -2
  5. package/contracts/pipeline-last-run.v1.json +6 -1
  6. package/contracts/published-contract-catalog.v1.json +113 -2
  7. package/contracts/runtime-command-surface.v1.json +216 -5
  8. package/contracts/studio-card-repair-capabilities.v1.json +378 -0
  9. package/contracts/workspace-intelligence/workspace-repair-proposal.v1.json +78 -0
  10. package/contracts/workspace-intelligence/workspace-repair-transaction.v1.json +249 -0
  11. package/contracts/workspace-intelligence-chain.v1.json +6 -0
  12. package/contracts/workspace-repair-capabilities.v1.json +316 -0
  13. package/dist/analyze-AAZEJ4FC.js +1 -0
  14. package/dist/artifact-remediation-plan-CJSPCMWA.js +1 -0
  15. package/dist/autopilot-release-LZWNQQLY.js +1 -0
  16. package/dist/chunk-27AXFTKW.js +1 -0
  17. package/dist/{chunk-OTDGTAZJ.js → chunk-2FJW6GSW.js} +1 -1
  18. package/dist/chunk-3DONU3DU.js +1 -0
  19. package/dist/chunk-44VJHNZB.js +1 -0
  20. package/dist/chunk-5XDPQ3CB.js +1 -0
  21. package/dist/chunk-7AR5PDLD.js +1 -0
  22. package/dist/chunk-7KKP7RNB.js +3 -0
  23. package/dist/chunk-AMB42V2F.js +1 -0
  24. package/dist/chunk-BYVTHIC3.js +2 -0
  25. package/dist/chunk-E5YYVFM2.js +1 -0
  26. package/dist/{chunk-6PBSAAS5.js → chunk-EBKYSDCX.js} +1 -1
  27. package/dist/chunk-FQLB4BIC.js +7 -0
  28. package/dist/{chunk-ICLYL3N5.js → chunk-FZCYTRBQ.js} +1 -1
  29. package/dist/{chunk-ZVOEPWQM.js → chunk-GDU7VP6G.js} +1 -1
  30. package/dist/chunk-H7P7SSUW.js +75 -0
  31. package/dist/chunk-HOVJUP7K.js +8 -0
  32. package/dist/{chunk-MZFSINY7.js → chunk-HRN5J6PW.js} +12 -12
  33. package/dist/chunk-HY3RMPW5.js +10 -0
  34. package/dist/chunk-KFKZOPZC.js +1 -0
  35. package/dist/{chunk-HPWLSLMC.js → chunk-KVUYAYTY.js} +1 -1
  36. package/dist/chunk-MQ73VS4E.js +2 -0
  37. package/dist/{chunk-2OIBHUVH.js → chunk-MRFN5ZQP.js} +1 -1
  38. package/dist/{chunk-4UVGTFOX.js → chunk-NYHVCFBT.js} +1 -1
  39. package/dist/{chunk-IO54DFWR.js → chunk-OLX6LX77.js} +1 -1
  40. package/dist/chunk-OUBBBC7T.js +36 -0
  41. package/dist/{chunk-WJY7ZXVJ.js → chunk-P7K5RHJC.js} +1 -1
  42. package/dist/chunk-QZ7PNMVP.js +1 -0
  43. package/dist/chunk-RA24WQLF.js +1 -0
  44. package/dist/chunk-RMXXK64P.js +4 -0
  45. package/dist/{chunk-PTTZPDLX.js → chunk-S7Z4DP3P.js} +1 -1
  46. package/dist/chunk-SJLUE6AY.js +1 -0
  47. package/dist/chunk-SUV7Y2FH.js +3 -0
  48. package/dist/chunk-T6JI7GYZ.js +88 -0
  49. package/dist/chunk-USMLRNZ7.js +5 -0
  50. package/dist/chunk-WD2XDMGB.js +1 -0
  51. package/dist/chunk-WIO6L24E.js +2 -0
  52. package/dist/{chunk-QURMI7ID.js → chunk-WZA5ISAQ.js} +1 -1
  53. package/dist/chunk-XVRJVKOX.js +1 -0
  54. package/dist/{create-ESK3CQPK.js → create-R6A7EHQZ.js} +1 -1
  55. package/dist/{doctor-MYRJ5BFF.js → doctor-KNIYGDM7.js} +1 -1
  56. package/dist/index.d.ts +92 -23
  57. package/dist/index.js +246 -244
  58. package/dist/pipeline-PVCLAQDI.js +5 -0
  59. package/dist/{project-intelligence-lens-Q4SZDI2N.js → project-intelligence-lens-ZOAWXYC5.js} +1 -1
  60. package/dist/project-test-coverage-44ZPCOPV.js +1 -0
  61. package/dist/{verified-goal-23HZPMRK.js → verified-goal-MCSNMA3P.js} +1 -1
  62. package/dist/{workspace-LSOZM2CG.js → workspace-B53XH35L.js} +1 -1
  63. package/dist/{workspace-agent-sync-RZBQXCNJ.js → workspace-agent-sync-446AXPHJ.js} +1 -1
  64. package/dist/{workspace-archive-ZOWQXWJ6.js → workspace-archive-VHUPOBAV.js} +1 -1
  65. package/dist/{workspace-context-IYJKO5BN.js → workspace-context-XSECHC7O.js} +1 -1
  66. package/dist/{workspace-contract-AZFISDLS.js → workspace-contract-AYFTZIKM.js} +1 -1
  67. package/dist/workspace-explain-SZI2WAAD.js +1 -0
  68. package/dist/workspace-explain-contract-N2XQHAPM.js +1 -0
  69. package/dist/{workspace-feedback-LIHEWTNV.js → workspace-feedback-WXE7NVMV.js} +1 -1
  70. package/dist/{workspace-foundation-H5UTAUXQ.js → workspace-foundation-FFNCK5ZD.js} +1 -1
  71. package/dist/{workspace-graph-stream-KUDOZE73.js → workspace-graph-stream-AJPS45FD.js} +1 -1
  72. package/dist/{workspace-history-HULG5EFN.js → workspace-history-YY7YRDOH.js} +1 -1
  73. package/dist/{workspace-intelligence-A4UE4DZK.js → workspace-intelligence-FWRB47EJ.js} +1 -1
  74. package/dist/{workspace-intelligence-evaluation-AOLGHYHC.js → workspace-intelligence-evaluation-UP2K3L35.js} +1 -1
  75. package/dist/{workspace-intelligence-runner-VYGSASDP.js → workspace-intelligence-runner-JNCQLUH7.js} +1 -1
  76. package/dist/workspace-intelligence-runtime-registry-MRSF7RTT.js +1 -0
  77. package/dist/{workspace-knowledge-graph-LEM6X5CM.js → workspace-knowledge-graph-BMMM2FUE.js} +1 -1
  78. package/dist/{workspace-mcp-serve-N2QPR7VJ.js → workspace-mcp-serve-COA4FMCA.js} +1 -1
  79. package/dist/{workspace-model-FJXX3NET.js → workspace-model-MNJOGBPP.js} +1 -1
  80. package/dist/{workspace-onboarding-IKFISWWY.js → workspace-onboarding-2B7CYZ5H.js} +1 -1
  81. package/dist/{workspace-readme-E2M35RJH.js → workspace-readme-4S6PJ74A.js} +1 -1
  82. package/dist/{workspace-registry-summary-HOQ3OBNT.js → workspace-registry-summary-GPJEL7K7.js} +1 -1
  83. package/dist/workspace-repair-engine-SRWECKZO.js +3 -0
  84. package/dist/workspace-run-3U77TMKX.js +1 -0
  85. package/dist/{workspace-verify-32AWCJQG.js → workspace-verify-C6HWHRLJ.js} +1 -1
  86. package/dist/{workspace-watch-4WVNB26E.js → workspace-watch-DLPHLF5R.js} +1 -1
  87. package/docs/README.md +2 -0
  88. package/docs/commands-reference.md +10 -8
  89. package/docs/contracts/ARTIFACT_CATALOG.md +27 -22
  90. package/docs/contracts/README.md +3 -0
  91. package/docs/contracts/RUNTIME_ACCEPTANCE_MATRIX.md +20 -11
  92. package/docs/doctor-command.md +10 -4
  93. package/docs/workspace-intelligence-runner.md +2 -1
  94. package/docs/workspace-knowledge-graph.md +6 -1
  95. package/docs/workspace-operations.md +3 -1
  96. package/docs/workspace-repair-engine.md +113 -0
  97. package/docs/workspace-run.md +17 -14
  98. package/package.json +3 -2
  99. package/scripts/enterprise-package-smoke.mjs +9 -6
  100. package/dist/analyze-J7VNZMDH.js +0 -1
  101. package/dist/artifact-remediation-plan-2UKY4TKO.js +0 -3
  102. package/dist/autopilot-release-34H5BSI2.js +0 -1
  103. package/dist/chunk-23JDMHSD.js +0 -86
  104. package/dist/chunk-2E6WGUN6.js +0 -1
  105. package/dist/chunk-3D3PFPP5.js +0 -1
  106. package/dist/chunk-4D7DIGAB.js +0 -1
  107. package/dist/chunk-5XJRCP3D.js +0 -36
  108. package/dist/chunk-62K2H72S.js +0 -1
  109. package/dist/chunk-7MQZQ4UU.js +0 -1
  110. package/dist/chunk-AL237TSJ.js +0 -7
  111. package/dist/chunk-AYHNNPPH.js +0 -8
  112. package/dist/chunk-B4CPDK6J.js +0 -2
  113. package/dist/chunk-CZC5P2MF.js +0 -1
  114. package/dist/chunk-DZ4VKAXB.js +0 -75
  115. package/dist/chunk-FUPHQOJB.js +0 -1
  116. package/dist/chunk-GHB6QMQH.js +0 -1
  117. package/dist/chunk-JIUWK4ML.js +0 -1
  118. package/dist/chunk-KHEJO3JU.js +0 -4
  119. package/dist/chunk-LOCPNNSK.js +0 -1
  120. package/dist/chunk-LPCL4U4L.js +0 -1
  121. package/dist/chunk-MBRU3VWJ.js +0 -2
  122. package/dist/chunk-P4OSLAVD.js +0 -3
  123. package/dist/chunk-Q6CUJ3WF.js +0 -10
  124. package/dist/chunk-SQTV2OYU.js +0 -4
  125. package/dist/chunk-ULR66OJR.js +0 -2
  126. package/dist/chunk-XHRHNVCZ.js +0 -1
  127. package/dist/pipeline-FOZ46ELQ.js +0 -5
  128. package/dist/project-test-coverage-A677ZLW3.js +0 -1
  129. package/dist/workspace-explain-26UGV7L4.js +0 -1
  130. package/dist/workspace-explain-contract-GIWPCCEF.js +0 -1
  131. package/dist/workspace-intelligence-runtime-registry-YOQ5GFFJ.js +0 -1
  132. package/dist/workspace-run-GUW4EOYB.js +0 -1
@@ -0,0 +1,249 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://workspai.dev/contracts/workspace-intelligence/workspace-repair-transaction.v1.json",
4
+ "title": "Workspai Workspace Repair Transaction v1",
5
+ "description": "Durable CLI-owned state for one governed workspace repair from plan through verification or rollback.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "schemaVersion",
10
+ "transactionId",
11
+ "revision",
12
+ "createdAt",
13
+ "updatedAt",
14
+ "workspace",
15
+ "target",
16
+ "state",
17
+ "policy",
18
+ "approval",
19
+ "preconditions",
20
+ "checkpoint",
21
+ "stages",
22
+ "events",
23
+ "integrity"
24
+ ],
25
+ "properties": {
26
+ "schemaVersion": { "const": "workspai.workspace-repair-transaction.v1" },
27
+ "transactionId": { "type": "string", "pattern": "^[A-Za-z0-9_-]{12,128}$" },
28
+ "revision": { "type": "integer", "minimum": 1 },
29
+ "createdAt": { "type": "string", "format": "date-time" },
30
+ "updatedAt": { "type": "string", "format": "date-time" },
31
+ "workspace": {
32
+ "type": "object",
33
+ "additionalProperties": false,
34
+ "required": ["name", "rootRef"],
35
+ "properties": {
36
+ "name": { "type": "string", "minLength": 1 },
37
+ "rootRef": { "const": "." }
38
+ }
39
+ },
40
+ "target": {
41
+ "type": "object",
42
+ "additionalProperties": false,
43
+ "required": ["cardId", "scope", "actionIds"],
44
+ "properties": {
45
+ "cardId": { "type": "string", "minLength": 1 },
46
+ "scope": { "enum": ["workspace", "project"] },
47
+ "projectName": { "type": "string", "minLength": 1 },
48
+ "projectPath": { "type": "string", "minLength": 1 },
49
+ "actionIds": {
50
+ "type": "array",
51
+ "minItems": 1,
52
+ "uniqueItems": true,
53
+ "items": { "type": "string", "minLength": 1 }
54
+ }
55
+ }
56
+ },
57
+ "state": {
58
+ "enum": [
59
+ "planned",
60
+ "awaiting-approval",
61
+ "approved",
62
+ "checkpointed",
63
+ "executing",
64
+ "verifying",
65
+ "closed",
66
+ "decision-required",
67
+ "rollback-required",
68
+ "rolling-back",
69
+ "rolled-back",
70
+ "failed",
71
+ "cancelled"
72
+ ]
73
+ },
74
+ "policy": {
75
+ "type": "object",
76
+ "additionalProperties": false,
77
+ "required": ["maxRisk", "allowForce", "allowBreaking", "autoRollback", "strictVerify"],
78
+ "properties": {
79
+ "maxRisk": { "enum": ["safe", "guarded", "invasive"] },
80
+ "allowForce": { "type": "boolean" },
81
+ "allowBreaking": { "type": "boolean" },
82
+ "autoRollback": { "type": "boolean" },
83
+ "strictVerify": { "const": true }
84
+ }
85
+ },
86
+ "approval": {
87
+ "type": "object",
88
+ "additionalProperties": false,
89
+ "required": ["required", "status"],
90
+ "properties": {
91
+ "required": { "const": true },
92
+ "status": { "enum": ["pending", "approved", "rejected", "expired"] },
93
+ "approvedAt": { "type": "string", "format": "date-time" },
94
+ "approvedBy": { "type": "string", "minLength": 1 },
95
+ "approvedPlanHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
96
+ }
97
+ },
98
+ "preconditions": {
99
+ "type": "array",
100
+ "items": { "$ref": "#/$defs/precondition" }
101
+ },
102
+ "adapterEvaluations": {
103
+ "type": "array",
104
+ "items": { "$ref": "#/$defs/adapterEvaluation" }
105
+ },
106
+ "checkpoint": { "$ref": "#/$defs/checkpoint" },
107
+ "stages": {
108
+ "type": "array",
109
+ "minItems": 1,
110
+ "items": { "$ref": "#/$defs/stage" }
111
+ },
112
+ "verification": { "$ref": "#/$defs/verification" },
113
+ "decision": { "$ref": "#/$defs/decision" },
114
+ "events": {
115
+ "type": "array",
116
+ "items": { "$ref": "#/$defs/event" }
117
+ },
118
+ "integrity": {
119
+ "type": "object",
120
+ "additionalProperties": false,
121
+ "required": ["planHash", "sourceEvidenceHash"],
122
+ "properties": {
123
+ "planHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
124
+ "sourceEvidenceHash": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
125
+ }
126
+ }
127
+ },
128
+ "$defs": {
129
+ "adapterEvaluation": {
130
+ "type": "object",
131
+ "additionalProperties": false,
132
+ "required": ["adapterId", "ecosystem", "projectPath", "manifests", "support", "status", "requiredExecutables", "missingExecutables", "message"],
133
+ "properties": {
134
+ "adapterId": { "type": "string", "minLength": 1 },
135
+ "ecosystem": { "type": "string", "minLength": 1 },
136
+ "projectPath": { "type": "string", "minLength": 1 },
137
+ "manifests": { "type": "array", "items": { "type": "string" }, "uniqueItems": true },
138
+ "support": { "enum": ["full", "conditional", "unsupported"] },
139
+ "status": { "enum": ["ready", "partial", "unsupported"] },
140
+ "requiredExecutables": { "type": "array", "items": { "type": "string" }, "uniqueItems": true },
141
+ "missingExecutables": { "type": "array", "items": { "type": "string" }, "uniqueItems": true },
142
+ "message": { "type": "string" }
143
+ }
144
+ },
145
+ "invocation": {
146
+ "type": "object",
147
+ "additionalProperties": false,
148
+ "required": ["cwd", "executable", "args", "purpose", "timeoutMs"],
149
+ "properties": {
150
+ "cwd": { "type": "string", "minLength": 1 },
151
+ "executable": { "type": "string", "minLength": 1 },
152
+ "args": { "type": "array", "items": { "type": "string" } },
153
+ "purpose": { "enum": ["repair", "reconcile", "audit", "test", "build", "verify"] },
154
+ "timeoutMs": { "type": "integer", "minimum": 1000, "maximum": 900000 }
155
+ }
156
+ },
157
+ "precondition": {
158
+ "type": "object",
159
+ "additionalProperties": false,
160
+ "required": ["id", "status", "message"],
161
+ "properties": {
162
+ "id": { "type": "string", "minLength": 1 },
163
+ "status": { "enum": ["passed", "failed", "unknown"] },
164
+ "message": { "type": "string" }
165
+ }
166
+ },
167
+ "checkpointFile": {
168
+ "type": "object",
169
+ "additionalProperties": false,
170
+ "required": ["path", "existed", "beforeHash"],
171
+ "properties": {
172
+ "path": { "type": "string", "minLength": 1 },
173
+ "existed": { "type": "boolean" },
174
+ "beforeHash": { "type": ["string", "null"] },
175
+ "mode": { "type": "integer", "minimum": 0, "maximum": 65535 },
176
+ "afterHash": { "type": ["string", "null"] },
177
+ "backupRef": { "type": "string", "minLength": 1 }
178
+ }
179
+ },
180
+ "checkpoint": {
181
+ "type": "object",
182
+ "additionalProperties": false,
183
+ "required": ["status", "files"],
184
+ "properties": {
185
+ "status": { "enum": ["pending", "captured", "restored", "conflicted", "unavailable"] },
186
+ "capturedAt": { "type": "string", "format": "date-time" },
187
+ "restoredAt": { "type": "string", "format": "date-time" },
188
+ "files": { "type": "array", "items": { "$ref": "#/$defs/checkpointFile" } }
189
+ }
190
+ },
191
+ "stage": {
192
+ "type": "object",
193
+ "additionalProperties": false,
194
+ "required": ["id", "kind", "status", "required", "risk", "summary"],
195
+ "properties": {
196
+ "id": { "type": "string", "minLength": 1 },
197
+ "kind": { "enum": ["repair", "reconcile", "audit", "test", "build", "verify", "rollback"] },
198
+ "status": { "enum": ["pending", "running", "passed", "failed", "blocked", "skipped", "cancelled"] },
199
+ "required": { "type": "boolean" },
200
+ "risk": { "enum": ["safe", "guarded", "invasive"] },
201
+ "summary": { "type": "string" },
202
+ "invocation": { "$ref": "#/$defs/invocation" },
203
+ "startedAt": { "type": "string", "format": "date-time" },
204
+ "completedAt": { "type": "string", "format": "date-time" },
205
+ "exitCode": { "type": ["integer", "null"] },
206
+ "stdoutTail": { "type": "string" },
207
+ "stderrTail": { "type": "string" },
208
+ "changedPaths": { "type": "array", "items": { "type": "string" } }
209
+ }
210
+ },
211
+ "verification": {
212
+ "type": "object",
213
+ "additionalProperties": false,
214
+ "required": ["status", "artifact", "exitCode", "summary"],
215
+ "properties": {
216
+ "status": { "enum": ["passed", "failed", "not-run"] },
217
+ "artifact": { "const": ".workspai/reports/workspace-intelligence-run-last-run.json" },
218
+ "exitCode": { "type": ["integer", "null"] },
219
+ "summary": { "type": "string" }
220
+ }
221
+ },
222
+ "decision": {
223
+ "type": "object",
224
+ "additionalProperties": false,
225
+ "required": ["reason", "options"],
226
+ "properties": {
227
+ "reason": { "type": "string", "minLength": 1 },
228
+ "options": {
229
+ "type": "array",
230
+ "minItems": 1,
231
+ "items": { "enum": ["approve-guarded", "approve-invasive", "allow-breaking", "allow-force", "manual-repair", "rollback", "cancel"] }
232
+ }
233
+ }
234
+ },
235
+ "event": {
236
+ "type": "object",
237
+ "additionalProperties": false,
238
+ "required": ["sequence", "at", "type", "message"],
239
+ "properties": {
240
+ "sequence": { "type": "integer", "minimum": 1 },
241
+ "at": { "type": "string", "format": "date-time" },
242
+ "type": { "enum": ["planned", "approval", "checkpoint", "stage", "verification", "decision", "rollback", "closed", "failed", "cancelled"] },
243
+ "stageId": { "type": "string" },
244
+ "status": { "type": "string" },
245
+ "message": { "type": "string" }
246
+ }
247
+ }
248
+ }
249
+ }
@@ -221,6 +221,12 @@
221
221
  "path": ".workspai/reports/verified-goal-last-run.json",
222
222
  "schemaVersion": "workspai.verified-goal-status.v1",
223
223
  "schemaContract": "contracts/workspace-intelligence/verified-goal-status.v1.json"
224
+ },
225
+ {
226
+ "id": "repairTransaction",
227
+ "path": ".workspai/reports/workspace-repair-last-run.json",
228
+ "schemaVersion": "workspai.workspace-repair-transaction.v1",
229
+ "schemaContract": "contracts/workspace-intelligence/workspace-repair-transaction.v1.json"
224
230
  }
225
231
  ]
226
232
  },
@@ -0,0 +1,316 @@
1
+ {
2
+ "schemaVersion": "workspai.workspace-repair-capabilities.v1",
3
+ "owner": "Workspai CLI",
4
+ "workflow": [
5
+ "plan",
6
+ "preconditions",
7
+ "approval",
8
+ "checkpoint",
9
+ "execute",
10
+ "reconcile",
11
+ "audit",
12
+ "test",
13
+ "build",
14
+ "canonical-verify",
15
+ "close-or-rollback-or-decision"
16
+ ],
17
+ "invariants": {
18
+ "multiAdapterProjects": true,
19
+ "missingTools": "decision-required",
20
+ "unsupportedEcosystems": "decision-required",
21
+ "silentFallbackToModelExecution": false,
22
+ "approvalBoundToPlanHash": true,
23
+ "canonicalVerificationRequired": true,
24
+ "rollbackConflictDetection": true
25
+ },
26
+ "adapters": [
27
+ {
28
+ "id": "node",
29
+ "ecosystem": "JavaScript / TypeScript",
30
+ "manifests": [
31
+ "package.json"
32
+ ],
33
+ "lockfiles": [
34
+ "package-lock.json",
35
+ "npm-shrinkwrap.json",
36
+ "pnpm-lock.yaml",
37
+ "yarn.lock",
38
+ "bun.lock",
39
+ "bun.lockb"
40
+ ],
41
+ "packageManagers": [
42
+ "npm",
43
+ "pnpm",
44
+ "yarn",
45
+ "bun"
46
+ ],
47
+ "support": "full",
48
+ "stages": {
49
+ "reconcile": "native",
50
+ "audit": "native",
51
+ "test": "declared",
52
+ "build": "declared"
53
+ },
54
+ "requiredToolFamilies": [
55
+ "selected package manager"
56
+ ]
57
+ },
58
+ {
59
+ "id": "python",
60
+ "ecosystem": "Python",
61
+ "manifests": [
62
+ "pyproject.toml",
63
+ "requirements.txt"
64
+ ],
65
+ "lockfiles": [
66
+ "uv.lock",
67
+ "poetry.lock",
68
+ "requirements.txt"
69
+ ],
70
+ "packageManagers": [
71
+ "uv",
72
+ "poetry",
73
+ "pip"
74
+ ],
75
+ "support": "conditional",
76
+ "stages": {
77
+ "reconcile": "conditional",
78
+ "audit": "conditional",
79
+ "test": "conditional",
80
+ "build": "declared"
81
+ },
82
+ "requiredToolFamilies": [
83
+ "isolated Python",
84
+ "selected environment manager",
85
+ "pip-audit or governed Doctor audit"
86
+ ],
87
+ "limitation": "A bounded isolated environment and an installed audit surface are required."
88
+ },
89
+ {
90
+ "id": "go",
91
+ "ecosystem": "Go",
92
+ "manifests": [
93
+ "go.mod"
94
+ ],
95
+ "lockfiles": [
96
+ "go.sum"
97
+ ],
98
+ "packageManagers": [
99
+ "go modules"
100
+ ],
101
+ "support": "conditional",
102
+ "stages": {
103
+ "reconcile": "native",
104
+ "audit": "conditional",
105
+ "test": "native",
106
+ "build": "native"
107
+ },
108
+ "requiredToolFamilies": [
109
+ "go",
110
+ "govulncheck"
111
+ ],
112
+ "limitation": "govulncheck must be installed; the engine never fetches an unreviewed tool."
113
+ },
114
+ {
115
+ "id": "rust",
116
+ "ecosystem": "Rust",
117
+ "manifests": [
118
+ "Cargo.toml"
119
+ ],
120
+ "lockfiles": [
121
+ "Cargo.lock"
122
+ ],
123
+ "packageManagers": [
124
+ "cargo"
125
+ ],
126
+ "support": "conditional",
127
+ "stages": {
128
+ "reconcile": "native",
129
+ "audit": "conditional",
130
+ "test": "native",
131
+ "build": "native"
132
+ },
133
+ "requiredToolFamilies": [
134
+ "cargo",
135
+ "cargo-audit"
136
+ ],
137
+ "limitation": "The cargo-audit subcommand must already be installed."
138
+ },
139
+ {
140
+ "id": "php-composer",
141
+ "ecosystem": "PHP",
142
+ "manifests": [
143
+ "composer.json"
144
+ ],
145
+ "lockfiles": [
146
+ "composer.lock"
147
+ ],
148
+ "packageManagers": [
149
+ "composer"
150
+ ],
151
+ "support": "full",
152
+ "stages": {
153
+ "reconcile": "native",
154
+ "audit": "native",
155
+ "test": "declared",
156
+ "build": "declared"
157
+ },
158
+ "requiredToolFamilies": [
159
+ "composer"
160
+ ]
161
+ },
162
+ {
163
+ "id": "ruby-bundler",
164
+ "ecosystem": "Ruby",
165
+ "manifests": [
166
+ "Gemfile"
167
+ ],
168
+ "lockfiles": [
169
+ "Gemfile.lock"
170
+ ],
171
+ "packageManagers": [
172
+ "bundler"
173
+ ],
174
+ "support": "conditional",
175
+ "stages": {
176
+ "reconcile": "native",
177
+ "audit": "conditional",
178
+ "test": "declared",
179
+ "build": "declared"
180
+ },
181
+ "requiredToolFamilies": [
182
+ "bundle",
183
+ "bundle-audit"
184
+ ],
185
+ "limitation": "bundle-audit and the declared Rake tasks must already exist."
186
+ },
187
+ {
188
+ "id": "elixir-mix",
189
+ "ecosystem": "Elixir",
190
+ "manifests": [
191
+ "mix.exs"
192
+ ],
193
+ "lockfiles": [
194
+ "mix.lock"
195
+ ],
196
+ "packageManagers": [
197
+ "mix"
198
+ ],
199
+ "support": "conditional",
200
+ "stages": {
201
+ "reconcile": "native",
202
+ "audit": "conditional",
203
+ "test": "native",
204
+ "build": "native"
205
+ },
206
+ "requiredToolFamilies": [
207
+ "mix",
208
+ "Hex audit task"
209
+ ],
210
+ "limitation": "The project must expose the Hex audit task used by its dependency policy."
211
+ },
212
+ {
213
+ "id": "deno",
214
+ "ecosystem": "Deno",
215
+ "manifests": [
216
+ "deno.json",
217
+ "deno.jsonc"
218
+ ],
219
+ "lockfiles": [
220
+ "deno.lock"
221
+ ],
222
+ "packageManagers": [
223
+ "deno"
224
+ ],
225
+ "support": "full",
226
+ "stages": {
227
+ "reconcile": "native",
228
+ "audit": "native",
229
+ "test": "declared",
230
+ "build": "declared"
231
+ },
232
+ "requiredToolFamilies": [
233
+ "deno"
234
+ ]
235
+ },
236
+ {
237
+ "id": "dotnet",
238
+ "ecosystem": ".NET",
239
+ "manifests": [
240
+ "*.sln",
241
+ "*.csproj",
242
+ "*.fsproj",
243
+ "*.vbproj"
244
+ ],
245
+ "lockfiles": [
246
+ "Directory.Packages.props",
247
+ "packages.lock.json"
248
+ ],
249
+ "packageManagers": [
250
+ "NuGet / dotnet"
251
+ ],
252
+ "support": "full",
253
+ "stages": {
254
+ "reconcile": "native",
255
+ "audit": "native",
256
+ "test": "native",
257
+ "build": "native"
258
+ },
259
+ "requiredToolFamilies": [
260
+ "dotnet"
261
+ ]
262
+ },
263
+ {
264
+ "id": "jvm-maven",
265
+ "ecosystem": "JVM / Maven",
266
+ "manifests": [
267
+ "pom.xml"
268
+ ],
269
+ "lockfiles": [],
270
+ "packageManagers": [
271
+ "Maven Wrapper",
272
+ "Maven"
273
+ ],
274
+ "support": "conditional",
275
+ "stages": {
276
+ "reconcile": "native",
277
+ "audit": "conditional",
278
+ "test": "native",
279
+ "build": "native"
280
+ },
281
+ "requiredToolFamilies": [
282
+ "mvnw or mvn",
283
+ "governed Doctor audit"
284
+ ],
285
+ "limitation": "A project-specific dependency audit command must be declared by Doctor evidence."
286
+ },
287
+ {
288
+ "id": "jvm-gradle",
289
+ "ecosystem": "JVM / Gradle",
290
+ "manifests": [
291
+ "build.gradle.kts",
292
+ "build.gradle"
293
+ ],
294
+ "lockfiles": [
295
+ "gradle.lockfile",
296
+ "gradle/libs.versions.toml"
297
+ ],
298
+ "packageManagers": [
299
+ "Gradle Wrapper",
300
+ "Gradle"
301
+ ],
302
+ "support": "conditional",
303
+ "stages": {
304
+ "reconcile": "native",
305
+ "audit": "conditional",
306
+ "test": "native",
307
+ "build": "native"
308
+ },
309
+ "requiredToolFamilies": [
310
+ "gradlew or gradle",
311
+ "governed Doctor audit"
312
+ ],
313
+ "limitation": "A project-specific dependency audit command must be declared by Doctor evidence."
314
+ }
315
+ ]
316
+ }
@@ -0,0 +1 @@
1
+ export{b as printAnalyzeReport,a as runAnalyze}from'./chunk-KVUYAYTY.js';
@@ -0,0 +1 @@
1
+ export{a as buildArtifactRemediationPlan,b as writeArtifactRemediationPlan}from'./chunk-SUV7Y2FH.js';
@@ -0,0 +1 @@
1
+ export{b as AUTOPILOT_RELEASE_ALIAS_FILENAME,a as AUTOPILOT_RELEASE_LAST_RUN_FILENAME,c as runAutopilotRelease}from'./chunk-HOVJUP7K.js';
@@ -0,0 +1 @@
1
+ import {b as b$1,c as c$1}from'./chunk-WZA5ISAQ.js';import {a as a$2}from'./chunk-KVUYAYTY.js';import {q as q$1}from'./chunk-T6JI7GYZ.js';import {a as a$3}from'./chunk-RMXXK64P.js';import {g}from'./chunk-HRN5J6PW.js';import {j,e as e$1}from'./chunk-GDU7VP6G.js';import {l as l$2}from'./chunk-OUBBBC7T.js';import {c,d}from'./chunk-P7K5RHJC.js';import {a as a$1}from'./chunk-RA24WQLF.js';import {f,g as g$1,h as h$2}from'./chunk-XVRJVKOX.js';import {k as k$1,l as l$1,h as h$1,m as m$1,n,p as p$1,q}from'./chunk-S7Z4DP3P.js';import {m,p,s}from'./chunk-7AR5PDLD.js';import {o,r as r$1,s as s$1}from'./chunk-MQ73VS4E.js';import {e}from'./chunk-WIO6L24E.js';import {b as b$2}from'./chunk-BYVTHIC3.js';import {a,b,k,l,j as j$1,i}from'./chunk-44VJHNZB.js';import {d as d$1}from'./chunk-VRW6KXNK.js';import oe from'path';import ce from'fs-extra';function r(t,s){if(!t)throw new Error(`Workspace Intelligence run semantic violation: ${s}`)}function ie(t,s){return t.length===s.length&&t.every((u,d)=>u===s[d])}function ne(t){b$2(a.intelligenceRun,t,"Workspace Intelligence run report"),r(t.chainSchemaVersion===a$1,`chainSchemaVersion must be ${a$1}`),r(t.artifactPath===a.intelligenceRun,`artifactPath must be ${a.intelligenceRun}`),r(t.preflight.length===j$1.length,`preflight must contain exactly ${j$1.length} entries`);for(let[o,i]of j$1.entries()){let a=t.preflight[o];r(a?.id===i,`preflight[${o}].id must be ${i}`),r(ie(a.artifacts,k[i]),`${i} preflight artifacts must match the runtime registry`),i==="sync"?r(a.status==="passed"&&a.result==="synchronized"||a.status==="failed"&&a.result==="failed","sync preflight status and result are incoherent"):r(a.status==="passed"&&(a.result==="created"||a.result==="reused")||a.status==="failed"&&a.result==="failed"||a.status==="skipped"&&a.result==="skipped","baseline preflight status and result are incoherent");}let s=t.preflight[1];r(t.baselineCreated===(s?.result==="created"),"baselineCreated must match the baseline preflight result"),r(t.stages.length===i.length,`stages must contain exactly ${i.length} canonical steps`);let u=t.preflight[0],d=u?.status==="failed";for(let[o,i$1]of i.entries()){let a=t.stages[o];r(a?.id===i$1,`stages[${o}].id must be ${i$1}`),r(ie(a.artifacts,l[i$1].produces),`${i$1} artifacts must match the runtime registry`),d&&r(a.status==="skipped",`${i$1} must be skipped after a hard failure`),a.status==="passed"?r(a.exitCode===0,`${i$1} passed stage must have exitCode 0`):a.status==="blocked"?r(a.exitCode!==0,`${i$1} blocked stage must have a non-zero exitCode`):a.status==="failed"?(r(a.exitCode===1,`${i$1} failed stage must have exitCode 1`),d=true):(r(a.exitCode===0,`${i$1} skipped stage must have exitCode 0`),r(a.durationMs===0,`${i$1} skipped stage must have durationMs 0`)),o===0&&((u?.status==="failed"||a.status==="failed")&&r(s?.status==="skipped","baseline must be skipped when sync or model fails"),s?.status==="skipped"&&r(u?.status==="failed"||a.status==="failed"||a.status==="skipped","baseline may be skipped only after an upstream failure"),s?.status!=="passed"&&(d=true));}let m=t.preflight.some(o=>o.status==="failed")||t.stages.some(o=>o.status==="failed"),y=t.stages.some(o=>o.status==="blocked"),n=m?"failed":y?"blocked":"passed",f=n==="failed"?1:n==="blocked"?2:0;r(t.status===n,`status must be ${n}`),r(t.exitCode===f,`exitCode must be ${f}`);}var me=a.intelligenceRun,fe=b.intelligenceRun,le=me;function h(t){d$1({action:"intelligence",status:t.status==="started"?"started":t.status==="passed"?"succeeded":t.status==="failed"?"failed":"warn",message:t.message,metadata:{phase:`workspace.intelligence.${t.kind}.${t.id}`,intelligenceMilestoneId:t.id,intelligenceMilestoneKind:t.kind,intelligenceMilestoneStatus:t.status}});}async function He(t){let s$2=oe.resolve(t.workspacePath),u=[],d$1=[],m$2=false,y=async(e,l)=>{let g=[...k[e]];if(m$2){h({id:e,kind:"preflight",status:"skipped",message:`${e} prerequisite skipped after an upstream failure`}),u.push({id:e,status:"skipped",result:"skipped",durationMs:0,artifacts:g,message:"skipped because a required upstream operation failed"});return}let I=Date.now();h({id:e,kind:"preflight",status:"started",message:`${e} prerequisite started`});try{let c=await l();h({id:e,kind:"preflight",status:"passed",message:c.message}),u.push({id:e,status:"passed",result:c.result,durationMs:Date.now()-I,artifacts:g,message:c.message});}catch(c){m$2=true;let k=c instanceof Error?c.message:String(c);h({id:e,kind:"preflight",status:"failed",message:k}),u.push({id:e,status:"failed",result:"failed",durationMs:Date.now()-I,artifacts:g,message:k});}},n$1=async(e,l$1)=>{let g=[...l[e].produces];if(m$2){h({id:e,kind:"stage",status:"skipped",message:`${e} skipped after an upstream failure`}),d$1.push({id:e,status:"skipped",durationMs:0,artifacts:g,exitCode:0,message:"skipped because a required upstream stage failed"});return}let I=Date.now();h({id:e,kind:"stage",status:"started",message:`${e} started`});try{let c=await l$1(),k=c.exitCode??0,x=c.blocked||k!==0?"blocked":"passed";h({id:e,kind:"stage",status:x,message:c.message}),d$1.push({id:e,status:x,durationMs:Date.now()-I,artifacts:g,exitCode:k,message:c.message});}catch(c){m$2=true;let k=c instanceof Error?c.message:String(c);h({id:e,kind:"stage",status:"failed",message:k}),d$1.push({id:e,status:"failed",durationMs:Date.now()-I,artifacts:g,exitCode:1,message:k});}};await y("sync",async()=>{let e=await g(s$2,true),l=await o({workspacePath:s$2});return {result:"synchronized",message:`registry ${e.added.length} added/${e.skipped} existing; contract ${l.contract.projects.length} projects`}});let f$1,o$1=()=>{if(!f$1)throw new Error("canonical workspace model is unavailable");return f$1};await n$1("model",async()=>(f$1={...await p({workspacePath:s$2,includeEvidence:true}),build:m({mode:"full",engineStatus:"disabled"})},await s(f$1,s$2),{message:`${f$1.summary.projectCount} projects modeled`}));let i=oe.join(s$2,a.snapshot),a$4=false;await y("baseline",async()=>{if(!await ce.pathExists(i)){let g=await k$1({workspacePath:s$2,model:o$1()});return await l$1(g,s$2),a$4=true,{result:"created",message:"initial structural baseline created"}}let e=await ce.readJson(i),l=h$1(e);return l?(await l$1(l,s$2),{result:"reused",message:"legacy structural baseline migrated and reused"}):{result:"reused",message:"existing structural baseline reused"}}),await n$1("diff",async()=>{let e=await m$1({workspacePath:s$2,fromPath:a.snapshot,model:o$1()});return await n(e,s$2),{message:e.summary.changed?"workspace changes detected":"no workspace changes"}}),await n$1("impact",async()=>{let e=await p$1({workspacePath:s$2,fromPath:a.diff});return await q(e,s$2),{message:`${e.summary.risk} risk; ${e.summary.affectedProjects} affected`}}),await n$1("doctor-evidence",async()=>{let e=await q$1({workspace:s$2,json:true,quiet:true});return {exitCode:e,blocked:e!==0,message:`doctor exit ${e}`}}),await n$1("contract-evidence",async()=>{let e=await r$1({workspacePath:s$2,strict:true});return await s$1({workspacePath:s$2,result:e}),{exitCode:e.status==="passed"?0:1,blocked:e.status!=="passed",message:`contract ${e.status}`}}),await n$1("analyze-evidence",async()=>{let e=await a$2({workspacePath:s$2,json:true,strict:false});return {blocked:e.summary.verdict==="blocked"||t.strict===true&&e.summary.verdict==="needs-attention",exitCode:e.summary.verdict==="blocked"||t.strict===true&&e.summary.verdict==="needs-attention"?1:0,message:`analyze ${e.summary.verdict} (${e.summary.score}/100)`}}),await n$1("readiness-evidence",async()=>{let e=await a$3({startPath:s$2,writeReport:true,skipVerify:true});return {blocked:e.overallStatus==="fail"||t.strict===true&&e.overallStatus==="warn",exitCode:e.overallStatus==="fail"||t.strict===true&&e.overallStatus==="warn"?1:0,message:`pre-verify readiness ${e.overallStatus}`}}),await n$1("verify",async()=>{let e=await f({workspacePath:s$2,fromImpactPath:a.impact});await g$1(e,s$2);let l=h$2(e,{strict:t.strict===true});return await j(s$2,e$1(e,l.passed)),{blocked:!l.passed,exitCode:l.exitCode,message:`${e.summary.verdict}; gate ${l.passed?"passed":"blocked"}`}}),await n$1("context",async()=>{let e=await c({workspacePath:s$2,model:o$1(),agent:t.agent??"generic",includeEvidence:true});return await d(e,s$2),{message:`context grounded for ${e.agent}`}}),await n$1("agent-sync",async()=>({message:`${(await l$2({workspacePath:s$2,agent:t.agent??"generic",write:true,refreshContext:false,strict:false,preset:"enterprise"})).writtenFiles.length} grounding files written`})),await n$1("explain",async()=>{let e=await b$1({workspacePath:s$2,target:{kind:"release-blocked"}});return await c$1(e,s$2),{message:e.summary}});let de=d$1.some(e=>e.status==="blocked"),P=m$2?"failed":de?"blocked":"passed",ue=m$2?1:P==="blocked"?2:0,R={schemaVersion:fe,chainSchemaVersion:a$1,generatedAt:new Date().toISOString(),workspacePath:s$2,baselineCreated:a$4,preflight:u,status:P,exitCode:ue,stages:d$1,artifactPath:le};return ne(R),await e(s$2,le,R),R}export{me as a,fe as b,He as c};
@@ -1 +1 @@
1
- import e from'path';import N from'fs-extra';import F from'chalk';async function K(n,o={}){let t=e.resolve(n),{WORKSPACE_CONTRACT_PATH:i,syncWorkspaceContract:c,verifyWorkspaceContract:m,writeWorkspaceContractVerifyEvidence:k}=await import('./workspace-contract-AZFISDLS.js'),p=await c({workspacePath:t,strict:true}),{syncWorkspaceReadme:f,WORKSPACE_README_PATH:d}=await import('./workspace-readme-E2M35RJH.js'),h=await f({workspacePath:t,workspaceName:p.contract.workspace.name,profile:p.contract.workspace.profile??"minimal",projectCount:p.contract.projects.length}),{buildWorkspaceModel:u,writeWorkspaceModel:g}=await import('./workspace-model-FJXX3NET.js'),a=await u({workspacePath:t,includeEvidence:true}),P=await g(a,t),{buildWorkspaceImpact:W,buildWorkspaceModelSnapshot:C,diffWorkspaceModel:y,writeWorkspaceImpact:A,writeWorkspaceModelDiff:j,writeWorkspaceModelSnapshot:E}=await import('./workspace-intelligence-A4UE4DZK.js'),{WORKSPACE_INTELLIGENCE_ARTIFACTS:s}=await import('./workspace-intelligence-runtime-registry-YOQ5GFFJ.js'),R=e.join(t,s.snapshot),l=false;if(!await N.pathExists(R)){let r=await C({workspacePath:t,model:a});await E(r,t),l=true;}let S=await y({workspacePath:t,fromPath:s.snapshot,model:a}),b=await j(S,t),v=await W({workspacePath:t,fromPath:s.diff}),O=await A(v,t),T=await m({workspacePath:t,strict:true}),_=await k({workspacePath:t,result:T}),{syncWorkspaceAgentGrounding:M}=await import('./workspace-agent-sync-RZBQXCNJ.js'),w=await M({workspacePath:t,model:a,write:true,refreshContext:true,strict:false,preset:"enterprise",targets:["all"],projectGrounding:o.projectGrounding??"managed"}),x=[i,(await import('./workspace-registry-summary-HOQ3OBNT.js')).WORKSPACE_REGISTRY_SUMMARY_RELATIVE_PATH,e.relative(t,h).split(e.sep).join("/")||d,e.relative(t,P).split(e.sep).join("/"),s.knowledgeGraph,...l?[s.snapshot]:[],e.relative(t,b).split(e.sep).join("/"),e.relative(t,O).split(e.sep).join("/"),e.relative(t,_).split(e.sep).join("/"),...w.writtenFiles].filter((r,I,G)=>G.indexOf(r)===I);return o.silent||console.log(F.gray(`\u2713 Workspace Intelligence synced \xB7 ${a.summary.projectCount} project(s) \xB7 model + graph + agent grounding`)),{workspacePath:t,projectCount:a.summary.projectCount,baselineCreated:l,writtenFiles:x,warnings:w.projectLenses?.skipped.map(r=>`${r.name}: ${r.reason}`)??[]}}async function D(n,o={}){let t=e.resolve(n),i=o.workspaceName??e.basename(t),{registerWorkspaceStrict:c}=await import('./workspace-LSOZM2CG.js');return await c(t,i),K(t,{silent:o.silent})}export{K as a,D as b};
1
+ import e from'path';import N from'fs-extra';import F from'chalk';async function K(n,o={}){let t=e.resolve(n),{WORKSPACE_CONTRACT_PATH:i,syncWorkspaceContract:c,verifyWorkspaceContract:m,writeWorkspaceContractVerifyEvidence:k}=await import('./workspace-contract-AYFTZIKM.js'),p=await c({workspacePath:t,strict:true}),{syncWorkspaceReadme:f,WORKSPACE_README_PATH:d}=await import('./workspace-readme-4S6PJ74A.js'),h=await f({workspacePath:t,workspaceName:p.contract.workspace.name,profile:p.contract.workspace.profile??"minimal",projectCount:p.contract.projects.length}),{buildWorkspaceModel:u,writeWorkspaceModel:g}=await import('./workspace-model-MNJOGBPP.js'),a=await u({workspacePath:t,includeEvidence:true}),P=await g(a,t),{buildWorkspaceImpact:W,buildWorkspaceModelSnapshot:C,diffWorkspaceModel:y,writeWorkspaceImpact:A,writeWorkspaceModelDiff:j,writeWorkspaceModelSnapshot:E}=await import('./workspace-intelligence-FWRB47EJ.js'),{WORKSPACE_INTELLIGENCE_ARTIFACTS:s}=await import('./workspace-intelligence-runtime-registry-MRSF7RTT.js'),R=e.join(t,s.snapshot),l=false;if(!await N.pathExists(R)){let r=await C({workspacePath:t,model:a});await E(r,t),l=true;}let S=await y({workspacePath:t,fromPath:s.snapshot,model:a}),b=await j(S,t),v=await W({workspacePath:t,fromPath:s.diff}),O=await A(v,t),T=await m({workspacePath:t,strict:true}),_=await k({workspacePath:t,result:T}),{syncWorkspaceAgentGrounding:M}=await import('./workspace-agent-sync-446AXPHJ.js'),w=await M({workspacePath:t,model:a,write:true,refreshContext:true,strict:false,preset:"enterprise",targets:["all"],projectGrounding:o.projectGrounding??"managed"}),x=[i,(await import('./workspace-registry-summary-GPJEL7K7.js')).WORKSPACE_REGISTRY_SUMMARY_RELATIVE_PATH,e.relative(t,h).split(e.sep).join("/")||d,e.relative(t,P).split(e.sep).join("/"),s.knowledgeGraph,...l?[s.snapshot]:[],e.relative(t,b).split(e.sep).join("/"),e.relative(t,O).split(e.sep).join("/"),e.relative(t,_).split(e.sep).join("/"),...w.writtenFiles].filter((r,I,G)=>G.indexOf(r)===I);return o.silent||console.log(F.gray(`\u2713 Workspace Intelligence synced \xB7 ${a.summary.projectCount} project(s) \xB7 model + graph + agent grounding`)),{workspacePath:t,projectCount:a.summary.projectCount,baselineCreated:l,writtenFiles:x,warnings:w.projectLenses?.skipped.map(r=>`${r.name}: ${r.reason}`)??[]}}async function D(n,o={}){let t=e.resolve(n),i=o.workspaceName??e.basename(t),{registerWorkspaceStrict:c}=await import('./workspace-B53XH35L.js');return await c(t,i),K(t,{silent:o.silent})}export{K as a,D as b};
@@ -0,0 +1 @@
1
+ import {a as a$1}from'./chunk-A5FBGRJA.js';import {g,p}from'./chunk-MQ73VS4E.js';import {d as d$1,e as e$1}from'./chunk-WIO6L24E.js';import {e,d}from'./chunk-44VJHNZB.js';import {s}from'./chunk-MOSXTVPU.js';import {s as s$1,q}from'./chunk-RJIYCDVC.js';import a from'path';import {existsSync}from'fs';import m from'fs-extra';var f=e.workspaceRegistry,w=d.workspaceRegistry.schemaVersion;function E(r){return {slug:r.slug,relativePath:r.relativePath,framework:r.framework,kit:r.kit,source:r.source}}async function b(r){let e=s(r,"workspace.json").find(t=>existsSync(t));if(!e)return {exists:false,legacyProjectCount:0};try{let t=await m.readJson(e),c=Array.isArray(t.projects)?t.projects.length:0,o=typeof t.workspace_name=="string"&&t.workspace_name.trim()||typeof t.name=="string"&&t.name.trim()||a.basename(r);return {exists:true,manifestPath:e,workspaceName:o,profile:typeof t.profile=="string"?t.profile:void 0,legacyProjectCount:c}}catch{return {exists:true,manifestPath:e,legacyProjectCount:0,workspaceName:a.basename(r)}}}async function _(r){let e=a$1(r);for(let t of s$1())if(await m.pathExists(t))try{let o=((await m.readJson(t)).workspaces||[]).find(s=>a$1(s.path)===e);if(o)return {exists:true,projectCount:Array.isArray(o.projects)?o.projects.length:0,registryPath:t}}catch{continue}return {exists:false,projectCount:0,registryPath:a.join(q(),"workspaces.json")}}async function T(r,e){let t=a.resolve(r),c=await d$1(t,g),o=await b(t),s=await _(t),i=e?.contract!==void 0||!!c,n=[];if(e?.contract)n=e.contract.projects||[];else if(i)try{let{contract:A}=await p({workspacePath:t});n=A.projects||[];}catch{n=[];}let d={contract:{exists:i,projectCount:n.length,path:g},globalRegistry:{exists:s.exists,projectCount:s.projectCount,path:s.registryPath},legacyWorkspaceJson:{exists:o.exists,projectCount:o.legacyProjectCount,path:o.manifestPath?a.relative(t,o.manifestPath):void 0}},p$1="none",u=[],y=0;return i?(p$1="workspace.contract.json",u=n.map(E),y=u.length):s.projectCount>0?(p$1="global-registry",y=s.projectCount):o.legacyProjectCount>0&&(p$1="legacy-workspace.json",y=o.legacyProjectCount),{contractExists:i,summary:{schemaVersion:w,kind:"rapidkit.workspace.registry",workspacePath:t,workspaceName:o.workspaceName||a.basename(t),profile:o.profile,projectCount:y,authority:p$1,contractPath:g,projects:u,sources:d}}}async function U(r){let e=await d$1(r,f);if(!e)return null;try{let t=await m.readJson(e);return t?.schemaVersion!==w?null:t}catch{return null}}async function D(r,e){let t=await M(r,e);return await e$1(r,f,t),t}async function M(r,e){return {...(await T(r,{contract:e?.contract})).summary,generatedAt:(e?.now??new Date).toISOString(),registrySummaryPath:f}}function F(r,e=""){return r.projectCount>0?r.authority==="workspace.contract.json"?`${r.projectCount} project(s) registered in workspace contract${e}.`:r.authority==="global-registry"?`${r.projectCount} project(s) registered in global workspace registry${e}.`:`${r.projectCount} project(s) registered in legacy workspace manifest${e}.`:`Workspace state exists, but no projects are registered yet${e}.`}export{f as a,w as b,T as c,U as d,D as e,M as f,F as g};