workspai 0.47.0 → 0.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/README.md +247 -136
  2. package/contracts/agent-customization-pack.v1.json +5 -0
  3. package/contracts/cli-runtime-command-inventory.v1.snapshot.json +4 -0
  4. package/contracts/extension-cli-compatibility.v1.json +8 -2
  5. package/contracts/published-contract-catalog.v1.json +33 -1
  6. package/contracts/runtime-command-surface.v1.json +163 -3
  7. package/contracts/workspace-intelligence/model-usage-event.v1.json +82 -0
  8. package/contracts/workspace-intelligence/workspace-graph-stream.v1.json +262 -0
  9. package/contracts/workspace-intelligence/workspace-intelligence-evaluation-comparison.v1.json +53 -0
  10. package/contracts/workspace-intelligence/workspace-intelligence-evaluation.v1.json +120 -0
  11. package/contracts/workspace-intelligence-architecture.v1.json +31 -2
  12. package/contracts/workspace-intelligence-chain.v1.json +44 -3
  13. package/dist/analyze-EEEU3MIF.js +1 -0
  14. package/dist/{artifact-remediation-plan-EPALZ2LC.js → artifact-remediation-plan-SPOUHMK5.js} +1 -1
  15. package/dist/autopilot-release-R4XRTWEM.js +1 -0
  16. package/dist/{chunk-2TEDAKP6.js → chunk-32OJDBIG.js} +1 -1
  17. package/dist/{chunk-ZDN7RHXJ.js → chunk-37CVKXBD.js} +1 -1
  18. package/dist/{chunk-YCL3I2JO.js → chunk-3NU32T4A.js} +1 -1
  19. package/dist/chunk-3VFA7D5T.js +1 -0
  20. package/dist/{chunk-CW7PGBIQ.js → chunk-4HDYADHT.js} +1 -1
  21. package/dist/{chunk-PBHP6JNY.js → chunk-54EP5CEV.js} +1 -1
  22. package/dist/{chunk-NOFM7MNA.js → chunk-AFL3ACCR.js} +1 -1
  23. package/dist/{chunk-MEMHNE7Y.js → chunk-BFLJ2R4D.js} +1 -1
  24. package/dist/{chunk-6SWRNA47.js → chunk-BGPXQQNY.js} +1 -1
  25. package/dist/chunk-BMWFQXGW.js +1 -0
  26. package/dist/{chunk-2GHUZDYA.js → chunk-CRHYBQI3.js} +1 -1
  27. package/dist/{chunk-KZZ36CK5.js → chunk-E2KJ5QWY.js} +1 -1
  28. package/dist/{chunk-BSRVO52Y.js → chunk-EKZLUMCS.js} +2 -2
  29. package/dist/{chunk-76YOPAOT.js → chunk-ESLPI3XZ.js} +1 -1
  30. package/dist/{chunk-DV6GJD4K.js → chunk-HDXNIN4N.js} +1 -1
  31. package/dist/{chunk-TNQI5VCW.js → chunk-HZDXO65G.js} +14 -14
  32. package/dist/{chunk-COARSXRC.js → chunk-J5ENLXDF.js} +1 -1
  33. package/dist/{chunk-QDWYIRHR.js → chunk-K4X3DM7R.js} +1 -1
  34. package/dist/chunk-LHOZXC2M.js +2 -0
  35. package/dist/{chunk-RWRLFSKW.js → chunk-NAJCUQ4X.js} +1 -1
  36. package/dist/{chunk-ZM5NQ5Z2.js → chunk-OW42TZFB.js} +1 -1
  37. package/dist/{chunk-SK6XRKGG.js → chunk-P3D5YQB2.js} +1 -1
  38. package/dist/{chunk-TWNFECMN.js → chunk-PHXQR6PX.js} +1 -1
  39. package/dist/{chunk-ITCAMC2E.js → chunk-PRTR2DQ2.js} +1 -1
  40. package/dist/{chunk-7VLCK5JW.js → chunk-RHQW3DTP.js} +1 -1
  41. package/dist/{chunk-22NJ2ZMG.js → chunk-T4YR4RAI.js} +1 -1
  42. package/dist/{chunk-VBSQ7MF6.js → chunk-TIE2XMGH.js} +20 -20
  43. package/dist/{chunk-HSGFUKCN.js → chunk-VU7NZHPM.js} +1 -1
  44. package/dist/{chunk-U5EZHZBX.js → chunk-YJZOMRAS.js} +1 -1
  45. package/dist/{create-7JKJDAQV.js → create-S64IWHAP.js} +1 -1
  46. package/dist/{doctor-PGPNIS76.js → doctor-4NNUDNGZ.js} +1 -1
  47. package/dist/{dotnet-webapi-clean-6TVFBTVI.js → dotnet-webapi-clean-A6MVDYXX.js} +4 -4
  48. package/dist/{gofiber-standard-2BL7GWZB.js → gofiber-standard-I5YPQG5V.js} +1 -1
  49. package/dist/{gogin-standard-XGP3KBXA.js → gogin-standard-VY2L4QT5.js} +1 -1
  50. package/dist/index.d.ts +35 -11
  51. package/dist/index.js +138 -136
  52. package/dist/{pipeline-IB6ILJSV.js → pipeline-LHTPE3DR.js} +1 -1
  53. package/dist/{springboot-standard-JJNUID6M.js → springboot-standard-55XKCBIZ.js} +4 -4
  54. package/dist/{workspace-H3QXBFGB.js → workspace-PJPRBUMQ.js} +1 -1
  55. package/dist/{workspace-agent-sync-C7SG2Z5W.js → workspace-agent-sync-662QHXGF.js} +1 -1
  56. package/dist/{workspace-context-BKQBKA4C.js → workspace-context-23YYCUCP.js} +1 -1
  57. package/dist/{workspace-contract-RPQQBQXR.js → workspace-contract-TU2I7GC2.js} +1 -1
  58. package/dist/{workspace-dependency-graph-23BI2HG7.js → workspace-dependency-graph-BP4EXYQ5.js} +1 -1
  59. package/dist/workspace-explain-MWUEN643.js +1 -0
  60. package/dist/workspace-explain-contract-ZPI3JXJU.js +1 -0
  61. package/dist/{workspace-feedback-WAID3IOE.js → workspace-feedback-SUVH2LUJ.js} +1 -1
  62. package/dist/{workspace-foundation-5OOJEO2D.js → workspace-foundation-WPLD7OEO.js} +1 -1
  63. package/dist/workspace-graph-stream-KAGGQPJT.js +1 -0
  64. package/dist/{workspace-history-C6OP3IAQ.js → workspace-history-BANOJRQ2.js} +1 -1
  65. package/dist/{workspace-intelligence-VKDL3H2J.js → workspace-intelligence-MFJE7W67.js} +1 -1
  66. package/dist/workspace-intelligence-evaluation-IPH7M3WV.js +1 -0
  67. package/dist/{workspace-intelligence-runner-LVALAZY7.js → workspace-intelligence-runner-OTYTHV6B.js} +1 -1
  68. package/dist/{workspace-knowledge-graph-FE2NTZKV.js → workspace-knowledge-graph-ARDC6HHG.js} +1 -1
  69. package/dist/workspace-knowledge-graph-export-UYAYFTWX.js +10 -0
  70. package/dist/workspace-mcp-serve-EZR6O76D.js +3 -0
  71. package/dist/{workspace-model-S33CIB2R.js → workspace-model-7OU2M3LE.js} +1 -1
  72. package/dist/{workspace-registry-summary-A3YDL63D.js → workspace-registry-summary-ORDK7A36.js} +1 -1
  73. package/dist/workspace-run-QND2SIYA.js +1 -0
  74. package/dist/{workspace-verify-ZGH3NXAH.js → workspace-verify-EBVL7FWT.js} +1 -1
  75. package/dist/workspace-watch-7HWGA5TF.js +1 -0
  76. package/docs/GLOSSARY.md +28 -24
  77. package/docs/OPEN_SOURCE_USER_SCENARIOS.md +11 -8
  78. package/docs/README.md +62 -23
  79. package/docs/README_CONTENT_CONTRACT.md +154 -0
  80. package/docs/ci-workflows.md +3 -3
  81. package/docs/commands-reference.md +16 -3
  82. package/docs/contracts/ARTIFACT_CATALOG.md +35 -20
  83. package/docs/contracts/README.md +3 -0
  84. package/docs/creating-workspaces-and-projects.md +16 -12
  85. package/docs/doctor-command.md +30 -28
  86. package/docs/examples/ci-agent-grounding.yml +1 -1
  87. package/docs/from-code-to-shared-understanding.md +2 -2
  88. package/docs/graph-benchmark-methodology.md +2 -2
  89. package/docs/workspace-intelligence-evaluation.md +149 -0
  90. package/docs/workspace-intelligence-runner.md +17 -6
  91. package/docs/workspace-knowledge-graph.md +31 -10
  92. package/docs/workspace-operations.md +13 -5
  93. package/package.json +9 -4
  94. package/templates/kits/fastapi-ddd/README.md.j2 +1 -1
  95. package/dist/analyze-UVXPRGYZ.js +0 -1
  96. package/dist/autopilot-release-5BQ6F5L2.js +0 -1
  97. package/dist/chunk-LNRAB7UY.js +0 -1
  98. package/dist/chunk-NRYS4CLR.js +0 -2
  99. package/dist/workspace-explain-WVN7JH3U.js +0 -1
  100. package/dist/workspace-explain-contract-SEFTVF6J.js +0 -1
  101. package/dist/workspace-mcp-serve-KT2I676Z.js +0 -3
  102. package/dist/workspace-run-M4LNJILC.js +0 -1
  103. package/dist/workspace-watch-EVBJTMV7.js +0 -1
@@ -0,0 +1,53 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://getrapidkit.com/schemas/workspace-intelligence-evaluation-comparison.v1.json",
4
+ "title": "Workspai Workspace Intelligence Evaluation Comparison",
5
+ "description": "A task-aligned comparison between two provenance-aware Workspace Intelligence evaluation runs.",
6
+ "type": "object",
7
+ "required": [
8
+ "schemaVersion",
9
+ "generatedAt",
10
+ "taskAligned",
11
+ "current",
12
+ "baseline",
13
+ "delta",
14
+ "comparableOutcome"
15
+ ],
16
+ "properties": {
17
+ "schemaVersion": { "const": "workspace-intelligence-evaluation-comparison.v1" },
18
+ "generatedAt": { "type": "string", "format": "date-time" },
19
+ "taskAligned": { "type": "boolean" },
20
+ "current": { "$ref": "#/$defs/run" },
21
+ "baseline": { "$ref": "#/$defs/run" },
22
+ "delta": {
23
+ "type": "object",
24
+ "required": ["tokens", "reductionPercent", "modelCalls", "toolCalls", "latencyMs"],
25
+ "properties": {
26
+ "tokens": { "type": "number" },
27
+ "reductionPercent": { "type": ["number", "null"] },
28
+ "modelCalls": { "type": "number" },
29
+ "toolCalls": { "type": "number" },
30
+ "latencyMs": { "type": "number" }
31
+ },
32
+ "additionalProperties": false
33
+ },
34
+ "comparableOutcome": { "type": "boolean" }
35
+ },
36
+ "$defs": {
37
+ "run": {
38
+ "type": "object",
39
+ "required": ["runId", "strategy", "tokens", "verified", "status"],
40
+ "properties": {
41
+ "runId": { "type": "string", "minLength": 1 },
42
+ "strategy": {
43
+ "enum": ["full-corpus", "grep", "vector", "graph", "workspace-intelligence", "custom"]
44
+ },
45
+ "tokens": { "type": "integer", "minimum": 0 },
46
+ "verified": { "type": "boolean" },
47
+ "status": { "enum": ["passed", "failed", "blocked", "unknown"] }
48
+ },
49
+ "additionalProperties": false
50
+ }
51
+ },
52
+ "additionalProperties": false
53
+ }
@@ -0,0 +1,120 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://getrapidkit.com/schemas/workspace-intelligence-evaluation.v1.json",
4
+ "title": "Workspai Workspace Intelligence Evaluation",
5
+ "description": "A live or finalized, provenance-aware measurement of model usage, agent activity, and verified task outcome.",
6
+ "type": "object",
7
+ "required": ["schemaVersion", "runId", "sessionId", "status", "startedAt", "updatedAt", "workspace", "configuration", "methodology", "events", "summary"],
8
+ "properties": {
9
+ "schemaVersion": { "const": "workspace-intelligence-evaluation.v1" },
10
+ "runId": { "type": "string", "minLength": 1 },
11
+ "sessionId": { "type": "string", "minLength": 1 },
12
+ "status": { "enum": ["live", "completed", "aborted"] },
13
+ "startedAt": { "type": "string", "format": "date-time" },
14
+ "updatedAt": { "type": "string", "format": "date-time" },
15
+ "completedAt": { "type": "string", "format": "date-time" },
16
+ "workspace": {
17
+ "type": "object",
18
+ "required": ["name", "path"],
19
+ "properties": {
20
+ "name": { "type": "string", "minLength": 1 },
21
+ "path": { "type": "string", "minLength": 1 }
22
+ },
23
+ "additionalProperties": false
24
+ },
25
+ "configuration": {
26
+ "type": "object",
27
+ "required": ["taskId", "strategy"],
28
+ "properties": {
29
+ "taskId": { "type": "string", "minLength": 1 },
30
+ "strategy": { "enum": ["full-corpus", "grep", "vector", "graph", "workspace-intelligence", "custom"] },
31
+ "provider": { "type": "string", "minLength": 1 },
32
+ "model": { "type": "string", "minLength": 1 },
33
+ "temperature": { "type": "number" },
34
+ "baselineRunId": { "type": "string", "minLength": 1 }
35
+ },
36
+ "additionalProperties": false
37
+ },
38
+ "methodology": {
39
+ "type": "object",
40
+ "required": ["id", "claimBoundary"],
41
+ "properties": {
42
+ "id": { "const": "provider-usage-and-verified-outcome.v1" },
43
+ "claimBoundary": { "type": "string", "minLength": 1 }
44
+ },
45
+ "additionalProperties": false
46
+ },
47
+ "events": {
48
+ "type": "array",
49
+ "items": { "$ref": "model-usage-event.v1.json" }
50
+ },
51
+ "summary": {
52
+ "type": "object",
53
+ "required": ["modelCalls", "toolCalls", "tokenSources", "tokens", "latencyMs", "costs", "outcome", "efficiency"],
54
+ "properties": {
55
+ "modelCalls": { "type": "integer", "minimum": 0 },
56
+ "toolCalls": { "type": "integer", "minimum": 0 },
57
+ "tokenSources": {
58
+ "type": "object",
59
+ "required": ["providerReported", "tokenizerCounted", "estimated", "unavailable"],
60
+ "properties": {
61
+ "providerReported": { "type": "integer", "minimum": 0 },
62
+ "tokenizerCounted": { "type": "integer", "minimum": 0 },
63
+ "estimated": { "type": "integer", "minimum": 0 },
64
+ "unavailable": { "type": "integer", "minimum": 0 }
65
+ },
66
+ "additionalProperties": false
67
+ },
68
+ "tokens": {
69
+ "type": "object",
70
+ "required": ["input", "output", "cachedInput", "reasoning", "observedTotal"],
71
+ "properties": {
72
+ "input": { "type": "integer", "minimum": 0 },
73
+ "output": { "type": "integer", "minimum": 0 },
74
+ "cachedInput": { "type": "integer", "minimum": 0 },
75
+ "reasoning": { "type": "integer", "minimum": 0 },
76
+ "observedTotal": { "type": "integer", "minimum": 0 }
77
+ },
78
+ "additionalProperties": false
79
+ },
80
+ "latencyMs": { "type": "number", "minimum": 0 },
81
+ "costs": {
82
+ "type": "array",
83
+ "items": {
84
+ "type": "object",
85
+ "required": ["currency", "amount", "providerReported", "estimated"],
86
+ "properties": {
87
+ "currency": { "type": "string", "pattern": "^[A-Z]{3}$" },
88
+ "amount": { "type": "number", "minimum": 0 },
89
+ "providerReported": { "type": "number", "minimum": 0 },
90
+ "estimated": { "type": "number", "minimum": 0 }
91
+ },
92
+ "additionalProperties": false
93
+ }
94
+ },
95
+ "outcome": {
96
+ "type": "object",
97
+ "required": ["status", "verified", "blockersResolved"],
98
+ "properties": {
99
+ "status": { "enum": ["passed", "failed", "blocked", "unknown"] },
100
+ "verified": { "type": "boolean" },
101
+ "blockersResolved": { "type": "integer", "minimum": 0 }
102
+ },
103
+ "additionalProperties": false
104
+ },
105
+ "efficiency": {
106
+ "type": "object",
107
+ "required": ["tokensPerVerifiedOutcome", "noProgressDecisions", "repeatedArtifactReads"],
108
+ "properties": {
109
+ "tokensPerVerifiedOutcome": { "type": ["number", "null"], "minimum": 0 },
110
+ "noProgressDecisions": { "type": "integer", "minimum": 0 },
111
+ "repeatedArtifactReads": { "type": "integer", "minimum": 0 }
112
+ },
113
+ "additionalProperties": false
114
+ }
115
+ },
116
+ "additionalProperties": false
117
+ }
118
+ },
119
+ "additionalProperties": false
120
+ }
@@ -101,7 +101,7 @@
101
101
  "scripts",
102
102
  "framework markers",
103
103
  "package dependencies",
104
- "supported source imports (currently bounded JavaScript and TypeScript scanning)"
104
+ "bounded multi-language source observations for supported file extensions"
105
105
  ],
106
106
  "entersAt": "model"
107
107
  },
@@ -299,8 +299,17 @@
299
299
  "commands": [
300
300
  "workspace graph emit",
301
301
  "workspace graph explain",
302
+ "workspace graph entities",
303
+ "workspace graph evidence",
304
+ "workspace graph path",
305
+ "workspace graph search",
306
+ "workspace graph benchmark",
307
+ "workspace graph overlay",
302
308
  "workspace graph dot",
303
- "workspace graph mermaid"
309
+ "workspace graph mermaid",
310
+ "workspace graph jsonld",
311
+ "workspace graph graphml",
312
+ "workspace graph gexf"
304
313
  ],
305
314
  "reads": [
306
315
  ".workspai/reports/workspace-model.json",
@@ -309,6 +318,26 @@
309
318
  "role": "Query the proof-backed graph derived from the canonical workspace model.",
310
319
  "chainStep": false
311
320
  },
321
+ {
322
+ "id": "evaluation",
323
+ "commands": [
324
+ "workspace eval init",
325
+ "workspace eval record",
326
+ "workspace eval status",
327
+ "workspace eval report",
328
+ "workspace eval compare"
329
+ ],
330
+ "reads": [
331
+ ".workspai/reports/workspace-intelligence-evaluation-live.json",
332
+ ".workspai/reports/workspace-intelligence-evaluation-last-run.json"
333
+ ],
334
+ "produces": [
335
+ ".workspai/reports/workspace-intelligence-evaluation-live.json",
336
+ ".workspai/reports/workspace-intelligence-evaluation-last-run.json"
337
+ ],
338
+ "role": "Measure model usage, activity, cost provenance, and verified outcomes without storing prompt or response bodies.",
339
+ "chainStep": false
340
+ },
312
341
  {
313
342
  "id": "watch",
314
343
  "commands": [
@@ -6,7 +6,7 @@
6
6
  "invariants": [
7
7
  "Missing or unreadable input is unknown or unavailable; it must not be presented as verified absence.",
8
8
  "Freshness and provenance travel with evidence and must not be discarded by projections.",
9
- "The current graph is a workspace dependency graph, not a complete cross-language symbol or call graph.",
9
+ "The current graph is an evidence-backed workspace knowledge graph with bounded source intelligence, not a complete cross-language symbol or call graph.",
10
10
  "Simple and standard presentations summarize the contract; their contractRefs must preserve complete traceability.",
11
11
  "Conditional provider outputs must be resolved through their dedicated inventory contract.",
12
12
  "Auxiliary capabilities expose or refresh intelligence but are not mandatory execution-chain steps.",
@@ -203,6 +203,18 @@
203
203
  "path": ".workspai/reports/workspace-intelligence-run-last-run.json",
204
204
  "schemaVersion": "workspace-intelligence-run.v1",
205
205
  "schemaContract": "contracts/workspace-intelligence/workspace-intelligence-run.v1.json"
206
+ },
207
+ {
208
+ "id": "evaluationLive",
209
+ "path": ".workspai/reports/workspace-intelligence-evaluation-live.json",
210
+ "schemaVersion": "workspace-intelligence-evaluation.v1",
211
+ "schemaContract": "contracts/workspace-intelligence/workspace-intelligence-evaluation.v1.json"
212
+ },
213
+ {
214
+ "id": "evaluationLastRun",
215
+ "path": ".workspai/reports/workspace-intelligence-evaluation-last-run.json",
216
+ "schemaVersion": "workspace-intelligence-evaluation.v1",
217
+ "schemaContract": "contracts/workspace-intelligence/workspace-intelligence-evaluation.v1.json"
206
218
  }
207
219
  ]
208
220
  },
@@ -258,7 +270,7 @@
258
270
  "scripts",
259
271
  "framework markers",
260
272
  "package dependencies",
261
- "supported source imports (currently bounded JavaScript and TypeScript scanning)"
273
+ "bounded multi-language source observations for supported file extensions"
262
274
  ],
263
275
  "entersAt": "model"
264
276
  },
@@ -496,8 +508,17 @@
496
508
  "commands": [
497
509
  "workspace graph emit",
498
510
  "workspace graph explain",
511
+ "workspace graph entities",
512
+ "workspace graph evidence",
513
+ "workspace graph path",
514
+ "workspace graph search",
515
+ "workspace graph benchmark",
516
+ "workspace graph overlay",
499
517
  "workspace graph dot",
500
- "workspace graph mermaid"
518
+ "workspace graph mermaid",
519
+ "workspace graph jsonld",
520
+ "workspace graph graphml",
521
+ "workspace graph gexf"
501
522
  ],
502
523
  "reads": [
503
524
  ".workspai/reports/workspace-model.json",
@@ -506,6 +527,26 @@
506
527
  "role": "Query the proof-backed graph derived from the canonical workspace model.",
507
528
  "chainStep": false
508
529
  },
530
+ {
531
+ "id": "evaluation",
532
+ "commands": [
533
+ "workspace eval init",
534
+ "workspace eval record",
535
+ "workspace eval status",
536
+ "workspace eval report",
537
+ "workspace eval compare"
538
+ ],
539
+ "reads": [
540
+ ".workspai/reports/workspace-intelligence-evaluation-live.json",
541
+ ".workspai/reports/workspace-intelligence-evaluation-last-run.json"
542
+ ],
543
+ "produces": [
544
+ ".workspai/reports/workspace-intelligence-evaluation-live.json",
545
+ ".workspai/reports/workspace-intelligence-evaluation-last-run.json"
546
+ ],
547
+ "role": "Measure model usage, activity, cost provenance, and verified outcomes without storing prompt or response bodies.",
548
+ "chainStep": false
549
+ },
509
550
  {
510
551
  "id": "watch",
511
552
  "commands": [
@@ -0,0 +1 @@
1
+ export{b as printAnalyzeReport,a as runAnalyze}from'./chunk-54EP5CEV.js';
@@ -1,3 +1,3 @@
1
- import {a as a$1}from'./chunk-2E6WGUN6.js';import {a,e,b}from'./chunk-2TEDAKP6.js';import y from'path';import {existsSync}from'fs';import x from'fs-extra';var I=[{artifactKind:"bootstrap-compliance",cardId:"bootstrap",fileNames:["bootstrap-compliance.latest.json"]},{artifactKind:"doctor-workspace",cardId:"doctor",fileNames:["doctor-remediation-plan-last-run.json"]},{artifactKind:"analyze",cardId:"analyze",fileNames:["analyze-last-run.json"]},{artifactKind:"readiness",cardId:"readiness",fileNames:["release-readiness-last-run.json"]},{artifactKind:"pipeline",cardId:"pipeline",fileNames:["pipeline-last-run.json"]},{artifactKind:"workspace-run",cardId:"workspaceRun",fileNames:["workspace-run-last.json"]},{artifactKind:"workspace-verify",cardId:"workspaceVerify",fileNames:["workspace-verify-last-run.json"]}];function m(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function f(e){return Array.isArray(e)?e.filter(r=>typeof r=="string"&&r.trim().length>0):[]}function k(e){return [...new Set(e.map(r=>r.trim()).filter(Boolean))]}function K(e,r,t){return t?r:y.relative(e,r)}function C(e){let r=e?.trim()||"npx workspai bootstrap";if(!/(?:^|\s)--ci(?:\s|$)/.test(r)&&/(?:^|\s)--json(?:\s|$)/.test(r))return r.replace(/(?:^|\s)--json(?:\s|$)/,i=>{let n=i.startsWith(" ")?" ":"",c=i.endsWith(" ")?" ":"";return `${n}--ci --json${c}`}).trim();let t=/(?:^|\s)--ci(?:\s|$)/.test(r)?r:`${r} --ci`;return /(?:^|\s)--json(?:\s|$)/.test(t)?t:`${t} --json`}function M(e){return `${JSON.stringify({schemaVersion:"rapidkit.compatibility-matrix.v1",generatedAt:e,source:"workspai workspace remediation-plan",runtimes:{},notes:["Minimal enterprise baseline. Add runtime and toolchain entries as governance matures."]},null,2)}
1
+ import {a as a$1}from'./chunk-2E6WGUN6.js';import {a,e,b}from'./chunk-32OJDBIG.js';import y from'path';import {existsSync}from'fs';import x from'fs-extra';var I=[{artifactKind:"bootstrap-compliance",cardId:"bootstrap",fileNames:["bootstrap-compliance.latest.json"]},{artifactKind:"doctor-workspace",cardId:"doctor",fileNames:["doctor-remediation-plan-last-run.json"]},{artifactKind:"analyze",cardId:"analyze",fileNames:["analyze-last-run.json"]},{artifactKind:"readiness",cardId:"readiness",fileNames:["release-readiness-last-run.json"]},{artifactKind:"pipeline",cardId:"pipeline",fileNames:["pipeline-last-run.json"]},{artifactKind:"workspace-run",cardId:"workspaceRun",fileNames:["workspace-run-last.json"]},{artifactKind:"workspace-verify",cardId:"workspaceVerify",fileNames:["workspace-verify-last-run.json"]}];function m(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function f(e){return Array.isArray(e)?e.filter(r=>typeof r=="string"&&r.trim().length>0):[]}function k(e){return [...new Set(e.map(r=>r.trim()).filter(Boolean))]}function K(e,r,t){return t?r:y.relative(e,r)}function C(e){let r=e?.trim()||"npx workspai bootstrap";if(!/(?:^|\s)--ci(?:\s|$)/.test(r)&&/(?:^|\s)--json(?:\s|$)/.test(r))return r.replace(/(?:^|\s)--json(?:\s|$)/,i=>{let n=i.startsWith(" ")?" ":"",c=i.endsWith(" ")?" ":"";return `${n}--ci --json${c}`}).trim();let t=/(?:^|\s)--ci(?:\s|$)/.test(r)?r:`${r} --ci`;return /(?:^|\s)--json(?:\s|$)/.test(t)?t:`${t} --json`}function M(e){return `${JSON.stringify({schemaVersion:"rapidkit.compatibility-matrix.v1",generatedAt:e,source:"workspai workspace remediation-plan",runtimes:{},notes:["Minimal enterprise baseline. Add runtime and toolchain entries as governance matures."]},null,2)}
2
2
  `}function N(e){return `${JSON.stringify({schema_version:"1.0",enabled:false,strategy:"on-demand",artifacts:[],created_at:e,note:"Minimal enterprise baseline. Set enabled: true and add artifact entries to activate mirroring."},null,2)}
3
3
  `}function $(e){let r=e.payload,t=f(r.blockers),i=f(r.blockingReasons),n=f(r.failures),c=f(r.reasons),d=f(r.policyViolations),a=m(r.summary),l=f(a?.blockers);if(e.artifactKind==="analyze"){let o=(Array.isArray(r.findings)?r.findings:[]).map(s=>m(s)).filter(s=>!!s).map(s=>String(s.message??s.title??s.id??"").trim()).filter(Boolean);return k([...t,...o,...i])}if(e.artifactKind==="workspace-run"){let u=m(r.stages),o=Object.entries(u??{}).flatMap(([s,b])=>{let h=m(b);return (Array.isArray(h?.projects)?h.projects:[]).map(p=>m(p)).filter(p=>!!p).filter(p=>p.status==="failed"||p.ok===false).map(p=>`${s}: ${String(p.project??p.name??"project")} failed`)});return k([...t,...o,...i])}return k([...t,...i,...n,...c,...d,...l])}function g(e){return {id:e.id,artifactKind:e.artifactKind,cardId:e.cardId,title:e.title,order:e.order,phase:e.phase,scope:"workspace",status:e.status??"ready",mode:e.mode,risk:e.risk,requiresApproval:true,blocker:e.blocker,summary:e.summary,...e.command?{command:e.command}:{},verifyCommand:e.verifyCommand,cwd:"workspace",files:e.files??[],...e.operation?{operation:e.operation}:{},rollback:{available:!!e.operation,strategy:e.operation?"idempotent":"none"},notes:e.notes??[]}}function P(e){let r=[],t=C("npx workspai bootstrap --json");for(let i of e.blockers)i.includes("profile.enterprise.ci")&&r.push(g({id:"bootstrap.enterprise-ci",artifactKind:"bootstrap-compliance",cardId:"bootstrap",title:"Run bootstrap in deterministic CI mode",order:10,phase:"bootstrap-preflight",blocker:i,summary:"Enterprise bootstrap compliance requires --ci for deterministic execution.",mode:"run-command",risk:"safe",command:t,verifyCommand:t})),i.includes("profile.enterprise.compatibility-matrix")&&r.push(g({id:"bootstrap.compatibility-matrix",artifactKind:"bootstrap-compliance",cardId:"bootstrap",title:"Create enterprise compatibility matrix baseline",order:20,phase:"bootstrap-config",blocker:i,summary:"Create the missing compatibility matrix baseline without overwriting user data.",mode:"edit-file",risk:"safe",verifyCommand:t,files:[".workspai/compatibility-matrix.json"],operation:{type:"file-create",path:".workspai/compatibility-matrix.json",content:M(e.generatedAt),overwrite:false}})),i.includes("profile.enterprise.mirror-config")&&r.push(g({id:"bootstrap.mirror-config",artifactKind:"bootstrap-compliance",cardId:"bootstrap",title:"Create enterprise mirror config baseline",order:30,phase:"bootstrap-config",blocker:i,summary:"Create the missing mirror configuration baseline without enabling mirroring.",mode:"edit-file",risk:"safe",verifyCommand:t,files:[".workspai/mirror-config.json"],operation:{type:"file-create",path:".workspai/mirror-config.json",content:N(e.generatedAt),overwrite:false}}));return r}function S(e){if(e.report.artifactKind==="readiness"&&/dependenc(?:y|ies).*vulnerabil|vulnerabil.*dependenc(?:y|ies)|security audit/i.test(e.blocker))return g({id:`${e.report.cardId}.doctor-owner.${e.order}`,artifactKind:e.report.artifactKind,cardId:e.report.cardId,title:"Resolve dependency vulnerability through Doctor",order:e.order,phase:"dependency-remediation",blocker:e.blocker,summary:"Release Readiness is the aggregate gate; use the project-scoped Doctor remediation capability that owns this dependency failure.",mode:"verify-before-fix",risk:"guarded",status:"review-required",command:"npx workspai doctor workspace --plan --json",verifyCommand:e.ciMode?"npx workspai readiness --strict --json":"npx workspai readiness --json",notes:["Read doctor-remediation-plan-last-run.json and execute the matching surface-security-hygiene capability before rerunning Readiness.","Do not treat a Readiness refresh as remediation for a source dependency vulnerability."]});let t={analyze:{title:"Refresh analyze evidence",phase:"analysis",command:"npx workspai analyze --strict --json",verify:"npx workspai analyze --strict --json"},readiness:{title:"Refresh release readiness",phase:"release-readiness",command:e.ciMode?"npx workspai readiness --strict --json":"npx workspai readiness --json",verify:e.ciMode?"npx workspai readiness --strict --json":"npx workspai readiness --json"},pipeline:{title:"Rerun governance pipeline",phase:"governance-pipeline",command:"npx workspai pipeline --json --strict",verify:"npx workspai pipeline --json --strict"},"workspace-run":{title:"Rerun failed workspace stage",phase:"fleet-run",command:e.ciMode?"npx workspai workspace run test --strict --json":"npx workspai workspace run test --json",verify:e.ciMode?"npx workspai workspace run test --strict --json":"npx workspai workspace run test --json"},"workspace-verify":{title:"Refresh workspace verify gate",phase:"verification",command:e.ciMode?"npx workspai workspace verify --strict --json":"npx workspai workspace verify --json",verify:e.ciMode?"npx workspai workspace verify --strict --json":"npx workspai workspace verify --json"},"doctor-workspace":{title:"Use Doctor remediation plan",phase:"doctor-remediation",command:"npx workspai doctor workspace --plan --json",verify:"npx workspai doctor workspace --json"}}[e.report.artifactKind]??{title:"Refresh artifact evidence",phase:"evidence-refresh",command:"npx workspai pipeline --json --strict",verify:"npx workspai pipeline --json --strict"};return g({id:`${e.report.cardId}.refresh.${e.order}`,artifactKind:e.report.artifactKind,cardId:e.report.cardId,title:t.title,order:e.order,phase:t.phase,blocker:e.blocker,summary:"No deterministic file operation is available for this artifact yet; refresh the evidence and continue with the card-specific plan.",mode:e.report.artifactKind==="doctor-workspace"?"verify-before-fix":"run-command",risk:"guarded",status:e.report.artifactKind==="doctor-workspace"?"review-required":"ready",command:t.command,verifyCommand:t.verify,notes:e.report.artifactKind==="doctor-workspace"?["Read doctor-remediation-plan-last-run.json for ordered file-level steps."]:[]})}async function O(e){let r=[a(e,".workspai/reports"),b(e,".workspai/reports")],t=[],i=new Set;for(let n of I)for(let c of n.fileNames){let d=(await Promise.all(r.map(a=>y.join(a,c)))).find(a=>existsSync(a));if(!(!d||i.has(`${n.artifactKind}:${c}`))){i.add(`${n.artifactKind}:${c}`);try{let a=await x.readJSON(d),l=m(a);if(!l)continue;t.push({artifactKind:n.artifactKind,cardId:n.cardId,fileName:c,absolutePath:d,payload:l});}catch{t.push({artifactKind:n.artifactKind,cardId:n.cardId,fileName:c,absolutePath:d,payload:{blockers:[`${n.artifactKind}: report exists but could not be parsed.`]}});}}}return t}async function F(e){let r=y.resolve(e.workspacePath),t=e.includeAbsolutePaths===true,i=e.ciMode===true,n=new Date().toISOString(),c=a(r,".workspai/reports"),d=await O(r),a$2=[],l=1;for(let o of d){let s=$(o);if(s.length!==0){if(o.artifactKind==="bootstrap-compliance"){a$2.push(...P({blockers:s,generatedAt:n})),l=a$2.length+1;continue}for(let b of s.slice(0,8))a$2.push(S({report:o,blocker:b,order:l,ciMode:i})),l+=1;}}let u={safe:a$2.filter(o=>o.risk==="safe").length,guarded:a$2.filter(o=>o.risk==="guarded").length,invasive:a$2.filter(o=>o.risk==="invasive").length};return {schemaVersion:a$1,generatedAt:n,workspace:{name:y.basename(r),...t?{path:r}:{}},source:{command:"workspace remediation-plan",reportsDir:K(r,c,t),includeAbsolutePaths:t,ciMode:i},summary:{artifactsScanned:d.length,cardsCovered:k(a$2.map(o=>o.cardId)).length,totalActions:a$2.length,executableActions:a$2.filter(o=>o.status==="ready").length,risk:u},actions:a$2}}async function W(e$1,r){return e(r,".workspai/reports/artifact-remediation-plan-last-run.json",e$1)}export{F as buildArtifactRemediationPlan,W as writeArtifactRemediationPlan};
@@ -0,0 +1 @@
1
+ export{b as AUTOPILOT_RELEASE_ALIAS_FILENAME,a as AUTOPILOT_RELEASE_LAST_RUN_FILENAME,c as runAutopilotRelease}from'./chunk-K4X3DM7R.js';
@@ -1,2 +1,2 @@
1
- import {b}from'./chunk-YCL3I2JO.js';import {r,s}from'./chunk-5XATWNME.js';import c from'path';import {randomUUID}from'crypto';import {open}from'fs/promises';import i from'fs-extra';function x(e,t){let s=c.resolve(e),r=t.trim();if(!r||c.isAbsolute(r))throw new Error(`Workspace artifact path must be non-empty and relative: ${t}`);let l=c.resolve(s,r),a=c.relative(s,l);if(a===".."||a.startsWith(`..${c.sep}`)||c.isAbsolute(a))throw new Error(`Workspace artifact path escapes workspace root: ${t}`);return l}function p(e,t){return x(e,r(t))}function $(e,t){return x(e,s(t))}async function W(e,t){let s=c.resolve(e);await i.ensureDir(s);let r=c.dirname(t);await i.ensureDir(r);let[l,a]=await Promise.all([i.realpath(s),i.realpath(r)]),o=c.relative(l,a);if(o===".."||o.startsWith(`..${c.sep}`)||c.isAbsolute(o))throw new Error(`Workspace artifact parent resolves outside workspace root: ${r}`)}async function M(e,t){let s=c.resolve(e),[r,l]=await Promise.all([i.realpath(s),i.realpath(t)]),a=c.relative(r,l);if(a===".."||a.startsWith(`..${c.sep}`)||c.isAbsolute(a))throw new Error(`Workspace artifact resolves outside workspace root: ${t}`)}function R(e){let t=e?.code;return process.platform==="win32"&&(t==="EPERM"||t==="EINVAL"||t==="ENOSYS")}async function T(e){try{await e.sync();}catch(t){if(!R(t))throw t}}async function y(e,t,s){await W(e,t);let r=c.dirname(t),l=`${c.basename(t)}.`,a=Date.now();for(let w of await i.readdir(r)){if(!w.startsWith(l)||!w.endsWith(".tmp"))continue;let f=c.join(r,w),n=await i.stat(f).catch(()=>null);n&&a-n.mtimeMs>3e4&&await i.remove(f).catch(()=>{});}let o=`${t}.${process.pid}.${randomUUID()}.tmp`;try{await s(o);let w=await open(o,"r");try{await T(w);}finally{await w.close();}let f=Number(process.env.WORKSPAI_TEST_ATOMIC_WRITE_DELAY_MS??0);Number.isFinite(f)&&f>0&&await new Promise(n=>setTimeout(n,Math.min(f,3e4)));try{await i.rename(o,t);}catch(n){let d=n.code;if(d!=="EEXIST"&&d!=="EPERM")throw n;await i.move(o,t,{overwrite:true});}}finally{await i.remove(o).catch(()=>{});}}async function _(e,t,s,r={}){let l=p(e,t);await W(e,l);let a=`${l}.lock`,o=r.timeoutMs??1e4,w=r.staleAfterMs??3e4,f=Date.now(),n;for(;!n;)try{n=await open(a,"wx"),await n.writeFile(`${JSON.stringify({pid:process.pid,createdAt:new Date().toISOString()})}
1
+ import {b}from'./chunk-3NU32T4A.js';import {r,s}from'./chunk-5XATWNME.js';import c from'path';import {randomUUID}from'crypto';import {open}from'fs/promises';import i from'fs-extra';function x(e,t){let s=c.resolve(e),r=t.trim();if(!r||c.isAbsolute(r))throw new Error(`Workspace artifact path must be non-empty and relative: ${t}`);let l=c.resolve(s,r),a=c.relative(s,l);if(a===".."||a.startsWith(`..${c.sep}`)||c.isAbsolute(a))throw new Error(`Workspace artifact path escapes workspace root: ${t}`);return l}function p(e,t){return x(e,r(t))}function $(e,t){return x(e,s(t))}async function W(e,t){let s=c.resolve(e);await i.ensureDir(s);let r=c.dirname(t);await i.ensureDir(r);let[l,a]=await Promise.all([i.realpath(s),i.realpath(r)]),o=c.relative(l,a);if(o===".."||o.startsWith(`..${c.sep}`)||c.isAbsolute(o))throw new Error(`Workspace artifact parent resolves outside workspace root: ${r}`)}async function M(e,t){let s=c.resolve(e),[r,l]=await Promise.all([i.realpath(s),i.realpath(t)]),a=c.relative(r,l);if(a===".."||a.startsWith(`..${c.sep}`)||c.isAbsolute(a))throw new Error(`Workspace artifact resolves outside workspace root: ${t}`)}function R(e){let t=e?.code;return process.platform==="win32"&&(t==="EPERM"||t==="EINVAL"||t==="ENOSYS")}async function T(e){try{await e.sync();}catch(t){if(!R(t))throw t}}async function y(e,t,s){await W(e,t);let r=c.dirname(t),l=`${c.basename(t)}.`,a=Date.now();for(let w of await i.readdir(r)){if(!w.startsWith(l)||!w.endsWith(".tmp"))continue;let f=c.join(r,w),n=await i.stat(f).catch(()=>null);n&&a-n.mtimeMs>3e4&&await i.remove(f).catch(()=>{});}let o=`${t}.${process.pid}.${randomUUID()}.tmp`;try{await s(o);let w=await open(o,"r");try{await T(w);}finally{await w.close();}let f=Number(process.env.WORKSPAI_TEST_ATOMIC_WRITE_DELAY_MS??0);Number.isFinite(f)&&f>0&&await new Promise(n=>setTimeout(n,Math.min(f,3e4)));try{await i.rename(o,t);}catch(n){let d=n.code;if(d!=="EEXIST"&&d!=="EPERM")throw n;await i.move(o,t,{overwrite:true});}}finally{await i.remove(o).catch(()=>{});}}async function _(e,t,s,r={}){let l=p(e,t);await W(e,l);let a=`${l}.lock`,o=r.timeoutMs??1e4,w=r.staleAfterMs??3e4,f=Date.now(),n;for(;!n;)try{n=await open(a,"wx"),await n.writeFile(`${JSON.stringify({pid:process.pid,createdAt:new Date().toISOString()})}
2
2
  `),await T(n);}catch(d){if(d.code!=="EEXIST")throw n&&(await n.close().catch(()=>{}),n=void 0,await i.remove(a).catch(()=>{})),d;let[A,S]=await Promise.all([i.stat(a).catch(()=>null),i.readJson(a).catch(()=>null)]),u=Number(S?.pid),m=Number.isInteger(u)&&u>0,h=false;if(m)try{process.kill(u,0),h=true;}catch(g){h=g.code==="EPERM";}let I=!m&&!!(A&&Date.now()-A.mtimeMs>w);if(m&&!h||I){await i.remove(a).catch(()=>{});continue}if(Date.now()-f>=o)throw new Error(`Timed out waiting for workspace artifact lock: ${t}`);await new Promise(g=>setTimeout(g,20));}try{return await s()}finally{await n.close().catch(()=>{}),await i.remove(a).catch(()=>{});}}async function z(e,t){let s=[p(e,t),$(e,t)];for(let r of s)if(await i.pathExists(r))return await M(e,r),r;return null}async function B(e,t,s){b(t,s);let r=p(e,t);return await y(e,r,l=>i.writeJson(l,s,{spaces:2})),r}async function H(e,t,s){if(s.length===0)return [];let r=s.map(a=>({...a,path:p(e,a.relativePath)})),l=r.find((a,o)=>r.findIndex(w=>w.path===a.path)!==o);if(l)throw new Error(`Duplicate workspace artifact transaction target: ${l.relativePath}`);for(let a of r)b(a.relativePath,a.payload);return _(e,t,async()=>{let a=await Promise.all(r.map(async o=>({path:o.path,exists:await i.pathExists(o.path),contents:await i.readFile(o.path).catch(()=>null)})));try{for(let o=0;o<r.length;o+=1){let w=r[o];await y(e,w.path,n=>i.writeJson(n,w.payload,{spaces:2}));let f=Number(process.env.WORKSPAI_TEST_FAIL_ARTIFACT_SET_AFTER??0);if(Number.isInteger(f)&&f===o+1)throw new Error(`Injected artifact-set failure after ${f} write(s).`)}return r.map(o=>o.path)}catch(o){let f=(await Promise.allSettled(a.map(async n=>{if(!n.exists||n.contents===null){await i.remove(n.path);return}await y(e,n.path,d=>i.writeFile(d,n.contents));}))).filter(n=>n.status==="rejected");throw f.length>0?new AggregateError([o,...f.map(n=>n.reason)],"Workspace artifact transaction failed and rollback was incomplete."):o}})}export{p as a,$ as b,_ as c,z as d,B as e,H as f};
@@ -1 +1 @@
1
- import {g,f,b as b$3}from'./chunk-COARSXRC.js';import {d}from'./chunk-OA537ZQ5.js';import {i}from'./chunk-MER6ZBN2.js';import {a as a$4,m}from'./chunk-22NJ2ZMG.js';import {a as a$2}from'./chunk-FXQJX34Z.js';import {c,b as b$2,i as i$1,w,f as f$2}from'./chunk-TWNFECMN.js';import {i as i$2,h as h$1}from'./chunk-4KUIFXHM.js';import {f as f$1,d as d$1,a as a$5,e}from'./chunk-2TEDAKP6.js';import {a as a$1}from'./chunk-GSWPGELT.js';import {a as a$3}from'./chunk-GZTYAEWX.js';import {b as b$1,a}from'./chunk-LNRAB7UY.js';import {p,o}from'./chunk-5XATWNME.js';import p$1 from'path';import C from'fs-extra';import Qe from'crypto';import {createRequire}from'module';var Ue=new Set(["service","frontend","worker","library","infra","docs","test-suite","unknown"]);async function Ie(e){try{if(!await C.pathExists(e))return null;let t=await C.readJSON(e);return t&&typeof t=="object"?t:null}catch{return null}}async function Je(e){for(let t of e){let s=await Ie(t);if(s)return s}return null}function Me(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return Ue.has(t)?t:null}async function Oe(e,t){let s=t??await Je(p(e,"project.json")),n=Me(s?.kind)??Me(s?.type);if(n)return n;let a=typeof s?.kit_name=="string"?s.kit_name:s?.kit,r=typeof s?.framework=="string"?s.framework:null,o=typeof s?.runtime=="string"?s.runtime:null,i=`${typeof a=="string"?a:""} ${r??""} ${o??""}`.trim().toLowerCase();if(/\b(frontend|nextjs|next\.js|react|vue|svelte|vite|angular|astro|remix|nuxt)\b/.test(i))return "frontend";if(/\b(fastapi|nestjs|springboot|spring boot|gofiber|gogin|dotnet|webapi|django|flask|express|fastify|python|node|java|go|rust|php|ruby|elixir)\b/.test(i))return "service";let c=await Ie(p$1.join(e,"package.json"));if(c){let d={...c.dependencies??{},...c.devDependencies??{}},u=c.scripts??{},l=Object.values(u).filter(f=>typeof f=="string").join(" ").toLowerCase();if(d.next||d.react||d.vue||d.svelte||d.vite||d["@angular/core"]||l.includes("next ")||l.includes("vite "))return "frontend";if(c.private===true&&!d.express&&!d["@nestjs/core"])return "library"}return await C.pathExists(p$1.join(e,"Dockerfile"))||await C.pathExists(p$1.join(e,"docker-compose.yml"))||await C.pathExists(p$1.join(e,"terraform.tf"))?"infra":"service"}var qe=new Set(c().map(e=>e.id)),Xe=[...i().map(e=>({id:e.kitId,aliases:[...e.aliases],ecosystem:e.framework,status:"available",canExecuteCreate:true,officialCommands:[e.commandDisplay("<name>",{skipGit:false,skipInstall:false})],adoptAfterCreate:true})),{id:"wordpress-site",aliases:["wordpress","wordpress-site","wp","wp-site"],ecosystem:"wordpress",status:"planned",canExecuteCreate:false,officialCommands:["wp core download","wp config create","wp db create","wp core install"],adoptAfterCreate:true},{id:"wordpress-block",aliases:["wordpress-block","wp-block","gutenberg-block"],ecosystem:"wordpress",status:"planned",canExecuteCreate:false,officialCommands:["npx @wordpress/create-block@latest <slug>"],adoptAfterCreate:true},{id:"laravel",aliases:["laravel","php-laravel"],ecosystem:"php",status:"planned",canExecuteCreate:false,officialCommands:["composer create-project laravel/laravel <name>"],adoptAfterCreate:true},{id:"symfony",aliases:["symfony","php-symfony"],ecosystem:"php",status:"planned",canExecuteCreate:false,officialCommands:["composer create-project symfony/skeleton <name>"],adoptAfterCreate:true},{id:"rails",aliases:["rails","ruby-on-rails","ruby-rails"],ecosystem:"ruby",status:"planned",canExecuteCreate:false,officialCommands:["rails new <name>"],adoptAfterCreate:true}],T=new Map;for(let e of Xe){T.set(e.id,e);for(let t of e.aliases)T.set(t,e);}var Ye=new Set(["php","ruby","rust","elixir","clojure","scala","kotlin","unknown"]);function F(e){return e?.trim().toLowerCase()||void 0}function _e(e){let t=F(e.kitId)??F(e.framework)??F(e.runtime)??"unknown";if(e.projectExists)return {lane:"existing",status:"available",canExecuteCreate:false,requested:t,reason:"Existing projects enter Workspace Intelligence through adopt/import."};let s=e.kitId?b$2(e.kitId):void 0;if(s&&qe.has(s))return {lane:"native",status:"available",canExecuteCreate:true,requested:t,resolved:s,reason:"Workspai owns the create contract, project marker, registry, doctor, and workspace model path."};let n=T.get(t)??T.get(F(e.framework)??"")??T.get(F(e.runtime)??"");if(n)return {lane:"official",status:n.status,canExecuteCreate:n.canExecuteCreate,requested:t,resolved:n.id,officialCommands:n.officialCommands,fallbackLane:n.canExecuteCreate?void 0:"existing",reason:n.status==="available"?"Workspai runs the official ecosystem generator, then registers the project in Workspace Intelligence.":"Official generator support is planned but not enabled; use adopt/import until Workspai owns the post-create contract."};let a=F(e.runtime);return a&&Ye.has(a)?{lane:"existing",status:"available",canExecuteCreate:false,requested:t,resolved:a,reason:"Runtime can be governed through Workspace Intelligence, but native create is not supported."}:{lane:"existing",status:"available",canExecuteCreate:false,requested:t,reason:"No native create contract is available; use adopt/import to enter Workspace Intelligence."}}function Wt(e){return !e.canExecuteCreate&&(e.lane==="official"||e.lane==="existing"&&e.resolved!==void 0)}var ae="workspace-model-cache.v1",oe=".workspai/cache/workspace-model.v1.json",De=["package.json","pyproject.toml","requirements.txt","go.mod","go.sum","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","composer.json","Gemfile","workspai.project.json",".workspai/project.json",".workspai/context.json","rapidkit.project.json",".rapidkit/project.json",".rapidkit/context.json"],Ne=[".workspai/workspace.contract.json",".workspai/workspace.json","workspai.workspace.json",".workspai/policies.yml",".workspai/policies.yaml",".rapidkit/workspace.contract.json",".rapidkit/workspace.json","rapidkit.workspace.json",".rapidkit/policies.yml",".rapidkit/policies.yaml"],et=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs"]),tt=new Set([".git",".workspai",".rapidkit","node_modules","dist","build","out","target","coverage",".next",".turbo",".cache",".venv"]),rt=1500,V=null;function ie(){if(V)return V;try{V=createRequire(import.meta.url)("../package.json")?.version??"0.0.0";}catch{V="0.0.0";}return V}async function X(e){try{let t=await C.readFile(e);return Qe.createHash("sha256").update(t).digest("hex")}catch{return null}}async function st(e){let t={};for(let a of De){let r=await X(p$1.join(e,a));r&&(t[a]=r);}let s=[],n=[e];for(;n.length>0&&s.length<rt;){let a=n.shift();if(!a)continue;let r=[];try{r=await C.readdir(a,{withFileTypes:true});}catch{continue}let o=[];for(let i of r)if(i.isDirectory()){if(tt.has(i.name)||i.name.startsWith("."))continue;o.push(p$1.join(a,i.name));}else if(i.isFile()&&et.has(p$1.extname(i.name))){let c=p$1.join(a,i.name),d=await C.stat(c).catch(()=>null);if(d){let u=p$1.relative(e,c).split(p$1.sep).join("/");s.push(`${u}:${d.size}:${Math.round(d.mtimeMs)}`);}}o.sort((i,c)=>i.localeCompare(c)),n.push(...o);}return s.sort((a,r)=>a.localeCompare(r)),b$3({manifests:t,source:s})}async function Y(e,t){let s=p$1.resolve(e),n={},a=[...new Set(t.map(r=>p$1.relative(s,p$1.resolve(r)).split(p$1.sep).join("/")))].sort((r,o)=>r.localeCompare(o));for(let r of a)n[r]=await st(p$1.join(s,r));return n}async function Q(e){let t=p$1.resolve(e),s={};for(let n of Ne){let a=await X(p$1.join(t,n));a&&(s[n]=a);}return s}async function Z(e){let t=p$1.resolve(e.workspacePath),s=[...new Set(e.projectPaths.map(r=>p$1.relative(t,p$1.resolve(r)).split(p$1.sep).join("/")))].sort((r,o)=>r.localeCompare(o)),n=[];for(let r of s){let o={};for(let i of De){let c=await X(p$1.join(t,r,i));c&&(o[i]=c);}n.push({project:r,manifests:o});}let a={};for(let r of Ne){let o=await X(p$1.join(t,r));o&&(a[r]=o);}return b$3({cacheSchema:ae,cliVersion:e.cliVersion,flags:e.flags,workspaceJson:e.workspaceJson??null,marker:e.marker??null,projects:n,workspaceFiles:a})}async function ce(e){let t=await d$1(e,oe)??a$5(e,oe);try{if(!await C.pathExists(t))return null;let s=await C.readJson(t);return !s||s.schemaVersion!==ae||typeof s.inputsHash!="string"||typeof s.cliVersion!="string"||!s.model?null:s}catch{return null}}async function ee(e$1,t){let s={schemaVersion:ae,...t};return e(e$1,oe,s)}var Te="rapidkit-fact-freshness-v1",G={durable:720*60*60,derived:10080*60,evidenceBacked:1440*60,live:300,verifyBeforeUse:1440*60};function nt(e){switch(e){case "durable":return G.durable;case "derived":return G.derived;case "evidence-backed":return G.evidenceBacked;case "live":return G.live;case "verify-before-use":return G.verifyBeforeUse}}function ot(e){if(e.status)return e.status;if(e.ttlSeconds===null)return "unknown";let t=Date.parse(e.generatedAt);if(!Number.isFinite(t))return "unknown";let s=t+e.ttlSeconds*1e3;return e.now.getTime()>s?"stale":"fresh"}function at(e){let t=e.now??new Date,s=e.generatedAt??t.toISOString(),n=Date.parse(s),a=Number.isFinite(n),r=a?s:t.toISOString(),o=e.ttlSeconds===void 0?nt(e.kind):e.ttlSeconds,i=ot({generatedAt:r,ttlSeconds:o,status:e.status??(a?void 0:"unknown"),now:t}),c=Date.parse(r),d=o===null||!Number.isFinite(c)?void 0:new Date(c+o*1e3),u=e.verifyBeforeUse??(e.kind==="live"||e.kind==="verify-before-use"||e.category!=="structure"||i!=="fresh");return {schemaVersion:Te,kind:e.kind,category:e.category,generatedAt:r,ttlSeconds:o,...d?{expiresAt:d.toISOString()}:{},status:i,verifyBeforeUse:u,...e.sourceArtifact?{sourceArtifact:e.sourceArtifact}:{},...e.sourcePath?{sourcePath:e.sourcePath}:{},inputsHash:e.inputsHash??b$3(e.value??null),reason:e.reason}}function h(e){return {id:e.id,label:e.label,scope:e.scope,value:e.value,...e.project?{project:e.project}:{},freshness:at({...e.freshness,value:e.value})}}function Ve(e){let t=e.generatedAt??(e.now??new Date).toISOString(),s={durable:0,derived:0,"evidence-backed":0,live:0,"verify-before-use":0},n={structure:0,verification:0,state:0},a=0,r=0,o=0,i=0;for(let c of e.facts)s[c.freshness.kind]+=1,n[c.freshness.category]+=1,c.freshness.status==="stale"&&(a+=1),c.freshness.status==="unknown"&&(r+=1),c.freshness.kind==="live"&&(o+=1),c.freshness.verifyBeforeUse&&(i+=1);return {schemaVersion:Te,generatedAt:t,status:a>0?"stale":r>0?"unknown":"fresh",totalFacts:e.facts.length,staleFacts:a,unknownFacts:r,liveFacts:o,verifyBeforeUseFacts:i,byKind:s,byCategory:n}}var it=b$1.model,te=a.model,ct=["package.json","pyproject.toml","requirements.txt","go.mod","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","composer.json","Gemfile","mix.exs","deno.json","deno.jsonc","bun.lock","bun.lockb","deps.edn","project.clj","build.sbt","docker-compose.yml","docker-compose.yaml","terraform.tf"],lt=new Set([".git",".hg",".svn",".workspai",".rapidkit",".venv","node_modules","dist","build","target","coverage","htmlcov",".next",".turbo"]);function Ge(e,t){return (p$1.relative(e,t)||".").split(p$1.sep).join("/")}async function Ke(e){try{if(!await C.pathExists(e))return null;let t=await C.readJSON(e);return t&&typeof t=="object"?t:null}catch{return null}}async function dt(e,t){for(let s of t)if(await C.pathExists(p$1.join(e,s)))return true;return false}function le(e){let t=Number.parseInt(process.env.RAPIDKIT_WORKSPACE_MODEL_SCAN_DEPTH??"",10),s=typeof e=="number"&&Number.isFinite(e)?e:Number.isFinite(t)?t:4;return Math.min(12,Math.max(1,Math.trunc(s)))}async function de(e,t){let s=p$1.resolve(e),n=[{dirPath:s,depth:0}],a=new Set,r=new Set;for(;n.length>0;){let o=n.shift();if(!o)continue;let i=p$1.resolve(o.dirPath);if(r.has(i))continue;if(r.add(i),i!==s&&await dt(i,ct)){a.add(i);continue}if(o.depth>=t)continue;let c=[];try{c=await C.readdir(i,{withFileTypes:true});}catch{continue}for(let d of c)!d.isDirectory()||lt.has(d.name)||d.name.startsWith(".")&&d.name!==".config"||n.push({dirPath:p$1.join(i,d.name),depth:o.depth+1});}return Array.from(a).sort((o,i)=>o.localeCompare(i))}function pe(e){let t=new Set,s=[];for(let n of e){let a=p$1.resolve(n);t.has(a)||(t.add(a),s.push(a));}return s.sort((n,a)=>n.localeCompare(a))}function $e(e,t){let s=e?.[t];return typeof s=="string"&&s.trim()?s.trim():void 0}function pt(e,t){return e?.[t]===true}function ut(e,t,s){let n=e?.frontend&&typeof e.frontend=="object"&&!Array.isArray(e.frontend)?e.frontend:void 0,a=$e(n,"generator"),r=$e(n,"command_display"),o=typeof t=="string"&&t.startsWith("frontend.");if(!(!a&&!o))return {...a?{id:a}:{},...t?{kit:t}:{},displayName:s,source:pt(n,"official_generator")?"official-generator":"metadata",...r?{commandDisplay:r}:{}}}async function mt(e){let t=[".workspai/project.json",".workspai/context.json",".rapidkit/project.json",".rapidkit/context.json","package.json","pyproject.toml","requirements.txt","go.mod","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","composer.json","Gemfile","mix.exs","deno.json","Dockerfile","docker-compose.yml","README.md"],s=[];for(let n of t)await C.pathExists(p$1.join(e,n))&&s.push(n);return s}async function S(e,t,s,n=t){let a=await d$1(e,t),r=a!==null,o={path:n.split(p$1.sep).join("/"),exists:r};if(a&&s){let i=await Ke(a);typeof i?.generatedAt=="string"&&(o.generatedAt=i.generatedAt);let c=i?.status??i?.result??i?.verdict;typeof c=="string"&&(o.status=c);}return o}async function ft(e,t,s){let n=Ge(e,t),a=".workspai/reports",r=c=>S(t,`${a}/${c}`,s,`${n}/${a}/${c}`),o=await r("doctor-project-last-run.json");return {doctor:o?.exists===true?o:await r("doctor-last-run.json"),remediationPlan:await r("doctor-remediation-plan-last-run.json"),fixResult:await r("doctor-fix-result-last-run.json"),analyze:await r("analyze-last-run.json"),readiness:await r("release-readiness-last-run.json")}}async function gt(e,t,s){let n=i$1(t),a=i$2(t,n),r=w(t),o=f$2(a.runtime),i=await Oe(t,n),c=typeof n?.name=="string"&&n.name.trim()?n.name.trim():p$1.basename(t),d=typeof n?.kit_name=="string"?n.kit_name:typeof n?.kit=="string"?n.kit:void 0,u=typeof n?.engine=="string"?n.engine:r.engine!=="unknown"?r.engine:void 0,l=ut(n,d,a.displayName),f=_e({kitId:d,framework:a.key,runtime:a.runtime});return {name:c,path:Ge(e,t),...s.includeAbsolutePaths?{absolutePath:t}:{},kind:i,runtime:a.runtime,runtimeCandidates:h$1(t),framework:a.key,frameworkDisplayName:a.displayName,confidence:a.confidence,detectionSource:a.source,supportTier:a.supportTier,runtimeSupportTier:o.tier,runtimeDoctorSupport:o.doctorSupport,moduleSupport:r.moduleSupport,...d?{kit:d}:{},...u?{engine:u}:{},...l?{generator:l}:{},createCapability:f,commands:{supported:r.supportedCommands,unsupported:r.unsupportedCommands,global:r.globalCommands,fleetStages:r.fleetStages,localOnly:r.localOnlyCommands,map:r.commandMap},importantFiles:await mt(t),evidence:await ft(e,t,s.includeEvidence),provenance:{path:"filesystem discovery",runtime:a.source,framework:a.source,commands:"project command capability matrix",createCapability:"create planner capability contract",evidence:"project .workspai/reports"}}}async function ue(e){for(let t of o(e,"workspace.json")){let s=await Ke(t);if(s)return s}return null}function kt(e){return e.length===0?"empty-workspace":e.some(t=>t.kind==="frontend")&&e.length>1?"full-stack-workspace":e.some(t=>t.kind==="frontend")?"frontend-workspace":e.length>1?"backend-platform":"backend-workspace"}function ht(e){let t=new Set;for(let s of e){let n=`${s.name} ${s.path}`.toLowerCase();for(let a of ["auth","billing","payment","notification","order","admin","report","search","analytics"])n.includes(a)&&t.add(a);}return Array.from(t).sort()}function b(e,t,s,n){return {severity:e,code:t,message:s,target:n}}function Be(e){let t=[];e.workspace.name.trim()||t.push(b("error","workspace.name.missing","Workspace name could not be resolved.","workspace")),e.workspace.type==="observed-workspace"&&t.push(b("warning","workspace.marker.missing","Workspace marker is missing; model is based on filesystem observation.","workspace.marker")),e.summary.projectCount===0&&t.push(b("warning","workspace.projects.empty","No project roots were detected in this workspace.","projects")),e.contracts.exists||t.push(b("warning","workspace.contract.missing","Workspace contract is missing; dependency and API edges may be incomplete.",e.contracts.workspaceContractPath));let s=new Map;for(let r of e.projects){let o=r.name.toLowerCase(),i=s.get(o)??[];i.push(r),s.set(o,i),r.importantFiles.length||t.push(b("warning","project.markers.missing",`Project ${r.name} has no important manifest files recorded.`,r.path)),r.runtime==="unknown"&&t.push(b("warning","project.runtime.unknown",`Project ${r.name} runtime could not be confidently detected.`,r.path));let c=["test","build"];for(let l of c)r.commands.supported.includes(l)&&r.commands.unsupported.includes(l)&&t.push(b("error","project.commands.conflict",`Project ${r.name} marks ${l} as both supported and unsupported.`,r.path));let d=new Set(r.commands.fleetStages),u=new Set(r.commands.localOnly);for(let l of r.commands.fleetStages){u.has(l)&&t.push(b("error","project.commands.scope-conflict",`Project ${r.name} marks ${l} as both fleet and local-only.`,r.path));let f=r.commands.map[l];(!f||f.status!=="supported"||f.fleetEligible!==true||f.executionScope!=="fleet")&&t.push(b("error","project.commands.fleet-stage-invalid",`Project ${r.name} advertises ${l} as a fleet stage without a supported fleet capability.`,r.path));}for(let l of r.commands.localOnly){let f=r.commands.map[l];(!f||f.status!=="supported"||f.executionScope!=="local-only"||f.fleetEligible===true)&&t.push(b("error","project.commands.local-only-invalid",`Project ${r.name} advertises ${l} as local-only without a matching local-only capability.`,r.path));}for(let l of Object.values(r.commands.map))l.status==="supported"&&(l.fleetEligible===true&&!d.has(l.command)&&t.push(b("error","project.commands.fleet-stage-missing",`Project ${r.name} capability ${l.command} is fleet-eligible but missing from fleetStages.`,r.path)),l.executionScope==="local-only"&&l.fleetEligible!==true&&!u.has(l.command)&&t.push(b("error","project.commands.local-only-missing",`Project ${r.name} capability ${l.command} is local-only but missing from localOnly commands.`,r.path)));}for(let[r,o]of s.entries())o.length>1&&t.push(b("error","project.name.duplicate",`Project name "${r}" is ambiguous across ${o.length} project roots.`,o.map(i=>i.path).join(", ")));let n=t.filter(r=>r.severity==="error").length,a=t.filter(r=>r.severity==="warning").length;return {status:n>0?"failed":a>0?"warning":"passed",errors:n,warnings:a,issues:t}}function cr(e){return Be(e)}function y(e){return e.join(".")}function yt(e,t){let s=te,n=e.generatedAt,a=[h({id:"workspace.name",label:"Workspace name",scope:"workspace",value:e.workspace.name,freshness:{kind:"durable",category:"structure",generatedAt:n,now:t,sourceArtifact:s,sourcePath:y(["workspace","name"]),reason:"Workspace identity is structural metadata and changes through workspace setup."}}),h({id:"workspace.type",label:"Workspace type",scope:"workspace",value:e.identity.workspaceType,freshness:{kind:"derived",category:"structure",generatedAt:n,now:t,sourceArtifact:s,sourcePath:y(["identity","workspaceType"]),reason:"Workspace type is derived from the current project inventory."}}),h({id:"workspace.projectCount",label:"Project count",scope:"workspace",value:e.summary.projectCount,freshness:{kind:"derived",category:"structure",generatedAt:n,now:t,sourceArtifact:s,sourcePath:y(["summary","projectCount"]),reason:"Project count is derived from workspace discovery and should be refreshed after structural changes."}}),h({id:"workspace.runtimeFamilies",label:"Runtime families",scope:"workspace",value:e.identity.runtimeFamilies,freshness:{kind:"derived",category:"structure",generatedAt:n,now:t,sourceArtifact:s,sourcePath:y(["identity","runtimeFamilies"]),reason:"Runtime coverage is inferred from project surfaces."}}),h({id:"workspace.policyMode",label:"Workspace policy mode",scope:"policy",value:e.policies.mode,freshness:{kind:"durable",category:"structure",generatedAt:n,now:t,sourceArtifact:s,sourcePath:y(["policies","mode"]),reason:"Policy mode is configuration, not runtime state."}}),h({id:"workspace.contract.exists",label:"Workspace contract presence",scope:"contract",value:e.contracts.exists,freshness:{kind:"derived",category:"structure",generatedAt:n,now:t,sourceArtifact:s,sourcePath:y(["contracts","exists"]),reason:"Contract presence is derived from workspace files and should be refreshed before release gating."}})];e.graph&&a.push(h({id:"graph.edgeCount",label:"Dependency graph edge count",scope:"graph",value:e.graph.stats.edgeCount,freshness:{kind:"derived",category:"structure",generatedAt:e.graph.generatedAt??n,now:t,sourceArtifact:s,sourcePath:y(["graph","stats","edgeCount"]),reason:"Graph topology is derived from manifests, imports, and workspace contracts."}}),h({id:"graph.evidenceCoverageRatio",label:"Dependency graph evidence coverage",scope:"graph",value:e.graph.stats.evidenceCoverageRatio,freshness:{kind:"derived",category:"structure",generatedAt:e.graph.generatedAt??n,now:t,sourceArtifact:s,sourcePath:y(["graph","stats","evidenceCoverageRatio"]),reason:"Graph evidence coverage changes when dependency evidence or contract edges change."}}));for(let[r,o]of e.projects.entries()){let i=`projects[${r}]`,c={kind:"derived",category:"structure",generatedAt:n,now:t,sourceArtifact:s,reason:"Project facts are derived from workspace discovery, project metadata, and framework probes."};a.push(h({id:`project.${o.name}.kind`,label:`${o.name} kind`,scope:"project",project:o.name,value:o.kind,freshness:{...c,sourcePath:y([i,"kind"])}}),h({id:`project.${o.name}.runtime`,label:`${o.name} runtime`,scope:"project",project:o.name,value:o.runtime,freshness:{...c,sourcePath:y([i,"runtime"])}}),h({id:`project.${o.name}.framework`,label:`${o.name} framework`,scope:"project",project:o.name,value:o.frameworkDisplayName,freshness:{...c,sourcePath:y([i,"frameworkDisplayName"])}}),h({id:`project.${o.name}.supportTier`,label:`${o.name} support tier`,scope:"project",project:o.name,value:o.supportTier,freshness:{...c,sourcePath:y([i,"supportTier"])}}),h({id:`project.${o.name}.safeFleetStages`,label:`${o.name} safe fleet stages`,scope:"command",project:o.name,value:o.commands.fleetStages,freshness:{...c,sourcePath:y([i,"commands","fleetStages"]),reason:"Safe command availability is derived from package and project command surfaces."}}));for(let[d,u]of Object.entries(o.evidence))a.push(h({id:`project.${o.name}.evidence.${d}`,label:`${o.name} ${d} evidence`,scope:"evidence",project:o.name,value:u?{path:u.path,exists:u.exists,status:u.status??null}:{exists:false},freshness:{kind:u?.exists?"evidence-backed":"verify-before-use",category:"verification",generatedAt:u?.generatedAt??n,now:t,status:u?.exists?void 0:"unknown",sourceArtifact:u?.path??s,sourcePath:y([i,"evidence",d]),verifyBeforeUse:true,reason:u?.exists?"Evidence reports can expire or become stale after source changes.":"Missing evidence must be generated before this fact is used for verification."}}));}for(let[r,o]of Object.entries(e.evidence))a.push(h({id:`workspace.evidence.${r}`,label:`Workspace ${r} evidence`,scope:"evidence",value:o?{path:o.path,exists:o.exists,status:o.status??null}:null,freshness:{kind:o?.exists?"evidence-backed":"verify-before-use",category:"verification",generatedAt:o?.generatedAt??n,now:t,status:o?.exists?void 0:"unknown",sourceArtifact:o?.path??s,sourcePath:y(["evidence",r]),verifyBeforeUse:true,reason:o?.exists?"Workspace evidence can expire or become stale after project, dependency, or policy changes.":"Missing workspace evidence must be generated before release or repair decisions."}}));return a}async function re(e){let t=p$1.resolve(e.workspacePath),s=e.includeAbsolutePaths===true,n=e.includeEvidence===true,a$4=le(e.observableScanDepth),r=e.now??new Date,[o$1,i,c,d,u]=await Promise.all([a$1(t),ue(t),a$2(t),a$3(t,{descendIntoMatchedProjects:false}),de(t,a$4)]),l=pe([...d,...u,...c.map(m=>p$1.isAbsolute(m.path)?m.path:p$1.join(t,m.path))]),f=e.reuseProjectModels,w=await Promise.all(l.map(m=>{if(f){let ze=p$1.relative(t,p$1.resolve(m)).split(p$1.sep).join("/"),me=f.get(ze);if(me)return Promise.resolve(me)}return gt(t,m,{includeAbsolutePaths:s,includeEvidence:n})})),x=typeof i?.workspace_name=="string"?i.workspace_name:typeof i?.name=="string"?i.name:o$1?.name||p$1.basename(t),j=typeof i?.profile=="string"?i.profile:typeof i?.mode=="string"?i.mode:void 0,R=Array.from(new Set(w.map(m=>m.kind))).sort(),E=Array.from(new Set(w.map(m=>m.runtime))).sort(),se=Array.from(new Set(w.map(m=>m.framework))).sort(),M=[".workspai/policies.yml",".workspai/policies.yaml",".rapidkit/policies.yml",".rapidkit/policies.yaml"].find(m=>C.existsSync(p$1.join(t,m))),I=o(t,"workspace.contract.json").map(m=>p$1.relative(t,m).split(p$1.sep).join("/")).find(m=>C.existsSync(p$1.join(t,m)))??".workspai/workspace.contract.json",P=await C.pathExists(p$1.join(t,I)),K={schemaVersion:it,generatedAt:r.toISOString(),workspace:{name:x,root:t,...j?{profile:j}:{},type:o$1?"rapidkit-workspace":"observed-workspace",...o$1?{marker:{createdBy:o$1.createdBy,version:o$1.version,createdAt:o$1.createdAt}}:{}},identity:{workspaceType:kt(w),surfaces:R,runtimeFamilies:E,businessCapabilities:ht(w)},discovery:{observableScanDepth:a$4},projects:w,policies:{mode:typeof i?.policy_mode=="string"?i.policy_mode:typeof i?.policyMode=="string"?i.policyMode:"warn",source:M??null,exists:!!M},contracts:{workspaceContractPath:I,exists:P,status:P?"known":"missing"},evidence:{doctor:await S(t,a.doctor,n),projectDoctor:await S(t,".workspai/reports/doctor-project-last-run.json",n),doctorRemediationPlan:await S(t,".workspai/reports/doctor-remediation-plan-last-run.json",n),artifactRemediationPlan:await S(t,".workspai/reports/artifact-remediation-plan-last-run.json",n),doctorFixResult:await S(t,".workspai/reports/doctor-fix-result-last-run.json",n),analyze:await S(t,a.analyze,n),readiness:await S(t,a.readiness,n),pipeline:await S(t,".workspai/reports/pipeline-last-run.json",n)},summary:{projectCount:w.length,runtimes:E,frameworks:se,firstClassProjects:w.filter(m=>m.supportTier==="first-class").length,observedProjects:w.filter(m=>m.supportTier==="observed").length}},O=await Le(t,K,{contractExists:P,now:r,incrementalGraph:e.incrementalGraph}),_={...K,graph:O},k=Be(_),v=yt({..._},r),W=Ve({facts:v,generatedAt:r.toISOString(),now:r});return {..._,facts:v,factFreshness:W,validation:k}}async function lr(e){if(e.cache!==true)return {model:await re(e),cache:"disabled"};let t=p$1.resolve(e.workspacePath),s=le(e.observableScanDepth),n=ie(),[a,r,o,i,c]=await Promise.all([a$1(t),ue(t),a$2(t),a$3(t,{descendIntoMatchedProjects:false}),de(t,s)]),d=pe([...i,...c,...o.map(j=>p$1.isAbsolute(j.path)?j.path:p$1.join(t,j.path))]),u=await Z({workspacePath:t,cliVersion:n,flags:{includeAbsolutePaths:e.includeAbsolutePaths===true,includeEvidence:e.includeEvidence===true,observableScanDepth:s},projectPaths:d,workspaceJson:r,marker:a}),l=await ce(t);if(l&&l.cliVersion===n&&l.inputsHash===u)return {model:l.model,cache:"hit"};let f=await re({...e}),[w,x]=await Promise.all([Y(t,d),Q(t)]);return await ee(t,{cliVersion:n,inputsHash:u,generatedAt:(e.now??new Date).toISOString(),model:f,projectSignatures:w,workspaceFileSignatures:x}),{model:f,cache:"miss"}}function wt(e,t){let s=new Set,n=new Set,a=new Set;for(let[r,o]of Object.entries(t))r in e?e[r]!==o&&s.add(r):n.add(r);for(let r of Object.keys(e))r in t||a.add(r);return {changed:s,added:n,removed:a}}function vt(e={},t={}){let s=new Set([...Object.keys(e),...Object.keys(t)]);for(let n of s)if(e[n]!==t[n])return false;return true}async function dr(e){let t=p$1.resolve(e.workspacePath),s=le(e.observableScanDepth),n=ie(),a=e.now??new Date,[r,o,i,c,d]=await Promise.all([a$1(t),ue(t),a$2(t),a$3(t,{descendIntoMatchedProjects:false}),de(t,s)]),u=pe([...c,...d,...i.map(k=>p$1.isAbsolute(k.path)?k.path:p$1.join(t,k.path))]),l=await ce(t),f=async()=>{let k=await re({...e}),v=await Z({workspacePath:t,cliVersion:n,flags:{includeAbsolutePaths:e.includeAbsolutePaths===true,includeEvidence:e.includeEvidence===true,observableScanDepth:s},projectPaths:u,workspaceJson:o,marker:r}),[W,m]=await Promise.all([Y(t,u),Q(t)]);return await ee(t,{cliVersion:n,inputsHash:v,generatedAt:a.toISOString(),model:k,projectSignatures:W,workspaceFileSignatures:m}),{model:k,mode:"full"}};if(!l||l.cliVersion!==n||!l.projectSignatures||!l.model?.graph)return f();let w=await Q(t);if(!vt(l.workspaceFileSignatures,w))return f();let x=await Y(t,u),{changed:j,added:R,removed:E}=wt(l.projectSignatures,x);if(j.size===0&&R.size===0&&E.size===0)return {model:l.model,mode:"unchanged"};let se=new Set([...j,...R]),M=new Map;for(let k of l.model.projects){let v=k.path.split(p$1.sep).join("/");!se.has(v)&&!E.has(v)&&M.set(v,k);}let I=new Set,P=false;for(let k of l.model.projects){let v=k.path.split(p$1.sep).join("/");j.has(v)&&I.add(k.name);}let K=R.size>0||E.size>0,O=await re({...e,reuseProjectModels:M,incrementalGraph:{previousGraph:l.model.graph,changedProjectIds:I,structuralChange:K||P}});for(let k of l.model.projects){let v=k.path.split(p$1.sep).join("/");if(!j.has(v))continue;let W=O.projects.find(m=>m.path.split(p$1.sep).join("/")===v);if(W&&W.name!==k.name){P=true;break}}if(P)return f();let _=await Z({workspacePath:t,cliVersion:n,flags:{includeAbsolutePaths:e.includeAbsolutePaths===true,includeEvidence:e.includeEvidence===true,observableScanDepth:s},projectPaths:u,workspaceJson:o,marker:r});return await ee(t,{cliVersion:n,inputsHash:_,generatedAt:a.toISOString(),model:O,projectSignatures:x,workspaceFileSignatures:w}),{model:O,mode:"incremental"}}async function He(e){try{let{contract:t}=await m({workspacePath:e});return t&&typeof t=="object"?t:null}catch{return null}}async function Le(e,t,s){let n=s.contractExists?await He(e):null;try{return s.incrementalGraph?await g({workspacePath:e,model:t,contract:n,now:s.now,previousGraph:s.incrementalGraph.previousGraph,changedProjectIds:s.incrementalGraph.changedProjectIds,structuralChange:s.incrementalGraph.structuralChange}):await f({workspacePath:e,model:t,contract:n,now:s.now})}catch{let a=t.projects.map(r=>({id:r.name,path:r.path}));return {schemaVersion:"workspace-dependency-graph.v1",generatedAt:s.now.toISOString(),nodes:a,edges:[],stats:{nodeCount:a.length,edgeCount:0,inferredEdges:0,contractEdges:0,manualEdges:0,authoritativeEdges:0,lowConfidenceEdges:0,orphanCount:a.length,connectedNodeCount:0,density:0,edgeCoverageRatio:a.length>0?0:1,evidenceCoverageRatio:1,hotspotCount:0,hasCycle:false},diagnostics:a.length>1?[{code:"graph.inference.failed",severity:"warning",message:"Dependency graph inference failed; model contains projects but no dependency edges.",recommendation:"Run workspace model again after fixing graph inputs, or add workspace contract/manual graph overrides.",nodeIds:a.map(r=>r.id).sort((r,o)=>r.localeCompare(o))}]:void 0}}}async function pr(e,t){let s=e.contracts.exists?await He(t):null,{buildWorkspaceKnowledgeGraph:n}=await import('./workspace-knowledge-graph-FE2NTZKV.js'),a$1=a$4(e),r=await n({workspacePath:t,workspace:{name:e.workspace.name,...e.workspace.profile?{profile:e.workspace.profile}:{}},projects:e.projects.map(i=>({id:i.name,path:i.path,...i.absolutePath?{absolutePath:i.absolutePath}:{},runtime:i.runtime,framework:i.framework,...i.kit?{kit:i.kit}:{}})),projectTopology:e.graph??await Le(t,e,{contractExists:e.contracts.exists,now:new Date(e.generatedAt)}),contract:s,now:new Date(e.generatedAt),source:{kind:"workspace-model",artifact:te,hashAlgorithm:"sha256",hash:d(a$1)}}),[,o]=await f$1(t,te,[{relativePath:a.knowledgeGraph,payload:r},{relativePath:te,payload:a$1}]);return o}export{Te as a,h as b,Ve as c,_e as d,Wt as e,Oe as f,it as g,te as h,cr as i,yt as j,re as k,lr as l,dr as m,pr as n};
1
+ import {g,f,b as b$3}from'./chunk-J5ENLXDF.js';import {d}from'./chunk-OA537ZQ5.js';import {i}from'./chunk-MER6ZBN2.js';import {a as a$4,m}from'./chunk-T4YR4RAI.js';import {a as a$2}from'./chunk-FXQJX34Z.js';import {c,b as b$2,i as i$1,w,f as f$2}from'./chunk-PHXQR6PX.js';import {i as i$2,h as h$1}from'./chunk-4KUIFXHM.js';import {f as f$1,d as d$1,a as a$5,e}from'./chunk-32OJDBIG.js';import {a as a$1}from'./chunk-GSWPGELT.js';import {a as a$3}from'./chunk-GZTYAEWX.js';import {b as b$1,a}from'./chunk-BMWFQXGW.js';import {p,o}from'./chunk-5XATWNME.js';import p$1 from'path';import C from'fs-extra';import Qe from'crypto';import {createRequire}from'module';var Ue=new Set(["service","frontend","worker","library","infra","docs","test-suite","unknown"]);async function Ie(e){try{if(!await C.pathExists(e))return null;let t=await C.readJSON(e);return t&&typeof t=="object"?t:null}catch{return null}}async function Je(e){for(let t of e){let s=await Ie(t);if(s)return s}return null}function Me(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return Ue.has(t)?t:null}async function Oe(e,t){let s=t??await Je(p(e,"project.json")),n=Me(s?.kind)??Me(s?.type);if(n)return n;let a=typeof s?.kit_name=="string"?s.kit_name:s?.kit,r=typeof s?.framework=="string"?s.framework:null,o=typeof s?.runtime=="string"?s.runtime:null,i=`${typeof a=="string"?a:""} ${r??""} ${o??""}`.trim().toLowerCase();if(/\b(frontend|nextjs|next\.js|react|vue|svelte|vite|angular|astro|remix|nuxt)\b/.test(i))return "frontend";if(/\b(fastapi|nestjs|springboot|spring boot|gofiber|gogin|dotnet|webapi|django|flask|express|fastify|python|node|java|go|rust|php|ruby|elixir)\b/.test(i))return "service";let c=await Ie(p$1.join(e,"package.json"));if(c){let d={...c.dependencies??{},...c.devDependencies??{}},u=c.scripts??{},l=Object.values(u).filter(f=>typeof f=="string").join(" ").toLowerCase();if(d.next||d.react||d.vue||d.svelte||d.vite||d["@angular/core"]||l.includes("next ")||l.includes("vite "))return "frontend";if(c.private===true&&!d.express&&!d["@nestjs/core"])return "library"}return await C.pathExists(p$1.join(e,"Dockerfile"))||await C.pathExists(p$1.join(e,"docker-compose.yml"))||await C.pathExists(p$1.join(e,"terraform.tf"))?"infra":"service"}var qe=new Set(c().map(e=>e.id)),Xe=[...i().map(e=>({id:e.kitId,aliases:[...e.aliases],ecosystem:e.framework,status:"available",canExecuteCreate:true,officialCommands:[e.commandDisplay("<name>",{skipGit:false,skipInstall:false})],adoptAfterCreate:true})),{id:"wordpress-site",aliases:["wordpress","wordpress-site","wp","wp-site"],ecosystem:"wordpress",status:"planned",canExecuteCreate:false,officialCommands:["wp core download","wp config create","wp db create","wp core install"],adoptAfterCreate:true},{id:"wordpress-block",aliases:["wordpress-block","wp-block","gutenberg-block"],ecosystem:"wordpress",status:"planned",canExecuteCreate:false,officialCommands:["npx @wordpress/create-block@latest <slug>"],adoptAfterCreate:true},{id:"laravel",aliases:["laravel","php-laravel"],ecosystem:"php",status:"planned",canExecuteCreate:false,officialCommands:["composer create-project laravel/laravel <name>"],adoptAfterCreate:true},{id:"symfony",aliases:["symfony","php-symfony"],ecosystem:"php",status:"planned",canExecuteCreate:false,officialCommands:["composer create-project symfony/skeleton <name>"],adoptAfterCreate:true},{id:"rails",aliases:["rails","ruby-on-rails","ruby-rails"],ecosystem:"ruby",status:"planned",canExecuteCreate:false,officialCommands:["rails new <name>"],adoptAfterCreate:true}],T=new Map;for(let e of Xe){T.set(e.id,e);for(let t of e.aliases)T.set(t,e);}var Ye=new Set(["php","ruby","rust","elixir","clojure","scala","kotlin","unknown"]);function F(e){return e?.trim().toLowerCase()||void 0}function _e(e){let t=F(e.kitId)??F(e.framework)??F(e.runtime)??"unknown";if(e.projectExists)return {lane:"existing",status:"available",canExecuteCreate:false,requested:t,reason:"Existing projects enter Workspace Intelligence through adopt/import."};let s=e.kitId?b$2(e.kitId):void 0;if(s&&qe.has(s))return {lane:"native",status:"available",canExecuteCreate:true,requested:t,resolved:s,reason:"Workspai owns the create contract, project marker, registry, doctor, and workspace model path."};let n=T.get(t)??T.get(F(e.framework)??"")??T.get(F(e.runtime)??"");if(n)return {lane:"official",status:n.status,canExecuteCreate:n.canExecuteCreate,requested:t,resolved:n.id,officialCommands:n.officialCommands,fallbackLane:n.canExecuteCreate?void 0:"existing",reason:n.status==="available"?"Workspai runs the official ecosystem generator, then registers the project in Workspace Intelligence.":"Official generator support is planned but not enabled; use adopt/import until Workspai owns the post-create contract."};let a=F(e.runtime);return a&&Ye.has(a)?{lane:"existing",status:"available",canExecuteCreate:false,requested:t,resolved:a,reason:"Runtime can be governed through Workspace Intelligence, but native create is not supported."}:{lane:"existing",status:"available",canExecuteCreate:false,requested:t,reason:"No native create contract is available; use adopt/import to enter Workspace Intelligence."}}function Wt(e){return !e.canExecuteCreate&&(e.lane==="official"||e.lane==="existing"&&e.resolved!==void 0)}var ae="workspace-model-cache.v1",oe=".workspai/cache/workspace-model.v1.json",De=["package.json","pyproject.toml","requirements.txt","go.mod","go.sum","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","composer.json","Gemfile","workspai.project.json",".workspai/project.json",".workspai/context.json","rapidkit.project.json",".rapidkit/project.json",".rapidkit/context.json"],Ne=[".workspai/workspace.contract.json",".workspai/workspace.json","workspai.workspace.json",".workspai/policies.yml",".workspai/policies.yaml",".rapidkit/workspace.contract.json",".rapidkit/workspace.json","rapidkit.workspace.json",".rapidkit/policies.yml",".rapidkit/policies.yaml"],et=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs"]),tt=new Set([".git",".workspai",".rapidkit","node_modules","dist","build","out","target","coverage",".next",".turbo",".cache",".venv"]),rt=1500,V=null;function ie(){if(V)return V;try{V=createRequire(import.meta.url)("../package.json")?.version??"0.0.0";}catch{V="0.0.0";}return V}async function X(e){try{let t=await C.readFile(e);return Qe.createHash("sha256").update(t).digest("hex")}catch{return null}}async function st(e){let t={};for(let a of De){let r=await X(p$1.join(e,a));r&&(t[a]=r);}let s=[],n=[e];for(;n.length>0&&s.length<rt;){let a=n.shift();if(!a)continue;let r=[];try{r=await C.readdir(a,{withFileTypes:true});}catch{continue}let o=[];for(let i of r)if(i.isDirectory()){if(tt.has(i.name)||i.name.startsWith("."))continue;o.push(p$1.join(a,i.name));}else if(i.isFile()&&et.has(p$1.extname(i.name))){let c=p$1.join(a,i.name),d=await C.stat(c).catch(()=>null);if(d){let u=p$1.relative(e,c).split(p$1.sep).join("/");s.push(`${u}:${d.size}:${Math.round(d.mtimeMs)}`);}}o.sort((i,c)=>i.localeCompare(c)),n.push(...o);}return s.sort((a,r)=>a.localeCompare(r)),b$3({manifests:t,source:s})}async function Y(e,t){let s=p$1.resolve(e),n={},a=[...new Set(t.map(r=>p$1.relative(s,p$1.resolve(r)).split(p$1.sep).join("/")))].sort((r,o)=>r.localeCompare(o));for(let r of a)n[r]=await st(p$1.join(s,r));return n}async function Q(e){let t=p$1.resolve(e),s={};for(let n of Ne){let a=await X(p$1.join(t,n));a&&(s[n]=a);}return s}async function Z(e){let t=p$1.resolve(e.workspacePath),s=[...new Set(e.projectPaths.map(r=>p$1.relative(t,p$1.resolve(r)).split(p$1.sep).join("/")))].sort((r,o)=>r.localeCompare(o)),n=[];for(let r of s){let o={};for(let i of De){let c=await X(p$1.join(t,r,i));c&&(o[i]=c);}n.push({project:r,manifests:o});}let a={};for(let r of Ne){let o=await X(p$1.join(t,r));o&&(a[r]=o);}return b$3({cacheSchema:ae,cliVersion:e.cliVersion,flags:e.flags,workspaceJson:e.workspaceJson??null,marker:e.marker??null,projects:n,workspaceFiles:a})}async function ce(e){let t=await d$1(e,oe)??a$5(e,oe);try{if(!await C.pathExists(t))return null;let s=await C.readJson(t);return !s||s.schemaVersion!==ae||typeof s.inputsHash!="string"||typeof s.cliVersion!="string"||!s.model?null:s}catch{return null}}async function ee(e$1,t){let s={schemaVersion:ae,...t};return e(e$1,oe,s)}var Te="rapidkit-fact-freshness-v1",G={durable:720*60*60,derived:10080*60,evidenceBacked:1440*60,live:300,verifyBeforeUse:1440*60};function nt(e){switch(e){case "durable":return G.durable;case "derived":return G.derived;case "evidence-backed":return G.evidenceBacked;case "live":return G.live;case "verify-before-use":return G.verifyBeforeUse}}function ot(e){if(e.status)return e.status;if(e.ttlSeconds===null)return "unknown";let t=Date.parse(e.generatedAt);if(!Number.isFinite(t))return "unknown";let s=t+e.ttlSeconds*1e3;return e.now.getTime()>s?"stale":"fresh"}function at(e){let t=e.now??new Date,s=e.generatedAt??t.toISOString(),n=Date.parse(s),a=Number.isFinite(n),r=a?s:t.toISOString(),o=e.ttlSeconds===void 0?nt(e.kind):e.ttlSeconds,i=ot({generatedAt:r,ttlSeconds:o,status:e.status??(a?void 0:"unknown"),now:t}),c=Date.parse(r),d=o===null||!Number.isFinite(c)?void 0:new Date(c+o*1e3),u=e.verifyBeforeUse??(e.kind==="live"||e.kind==="verify-before-use"||e.category!=="structure"||i!=="fresh");return {schemaVersion:Te,kind:e.kind,category:e.category,generatedAt:r,ttlSeconds:o,...d?{expiresAt:d.toISOString()}:{},status:i,verifyBeforeUse:u,...e.sourceArtifact?{sourceArtifact:e.sourceArtifact}:{},...e.sourcePath?{sourcePath:e.sourcePath}:{},inputsHash:e.inputsHash??b$3(e.value??null),reason:e.reason}}function h(e){return {id:e.id,label:e.label,scope:e.scope,value:e.value,...e.project?{project:e.project}:{},freshness:at({...e.freshness,value:e.value})}}function Ve(e){let t=e.generatedAt??(e.now??new Date).toISOString(),s={durable:0,derived:0,"evidence-backed":0,live:0,"verify-before-use":0},n={structure:0,verification:0,state:0},a=0,r=0,o=0,i=0;for(let c of e.facts)s[c.freshness.kind]+=1,n[c.freshness.category]+=1,c.freshness.status==="stale"&&(a+=1),c.freshness.status==="unknown"&&(r+=1),c.freshness.kind==="live"&&(o+=1),c.freshness.verifyBeforeUse&&(i+=1);return {schemaVersion:Te,generatedAt:t,status:a>0?"stale":r>0?"unknown":"fresh",totalFacts:e.facts.length,staleFacts:a,unknownFacts:r,liveFacts:o,verifyBeforeUseFacts:i,byKind:s,byCategory:n}}var it=b$1.model,te=a.model,ct=["package.json","pyproject.toml","requirements.txt","go.mod","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","composer.json","Gemfile","mix.exs","deno.json","deno.jsonc","bun.lock","bun.lockb","deps.edn","project.clj","build.sbt","docker-compose.yml","docker-compose.yaml","terraform.tf"],lt=new Set([".git",".hg",".svn",".workspai",".rapidkit",".venv","node_modules","dist","build","target","coverage","htmlcov",".next",".turbo"]);function Ge(e,t){return (p$1.relative(e,t)||".").split(p$1.sep).join("/")}async function Ke(e){try{if(!await C.pathExists(e))return null;let t=await C.readJSON(e);return t&&typeof t=="object"?t:null}catch{return null}}async function dt(e,t){for(let s of t)if(await C.pathExists(p$1.join(e,s)))return true;return false}function le(e){let t=Number.parseInt(process.env.RAPIDKIT_WORKSPACE_MODEL_SCAN_DEPTH??"",10),s=typeof e=="number"&&Number.isFinite(e)?e:Number.isFinite(t)?t:4;return Math.min(12,Math.max(1,Math.trunc(s)))}async function de(e,t){let s=p$1.resolve(e),n=[{dirPath:s,depth:0}],a=new Set,r=new Set;for(;n.length>0;){let o=n.shift();if(!o)continue;let i=p$1.resolve(o.dirPath);if(r.has(i))continue;if(r.add(i),i!==s&&await dt(i,ct)){a.add(i);continue}if(o.depth>=t)continue;let c=[];try{c=await C.readdir(i,{withFileTypes:true});}catch{continue}for(let d of c)!d.isDirectory()||lt.has(d.name)||d.name.startsWith(".")&&d.name!==".config"||n.push({dirPath:p$1.join(i,d.name),depth:o.depth+1});}return Array.from(a).sort((o,i)=>o.localeCompare(i))}function pe(e){let t=new Set,s=[];for(let n of e){let a=p$1.resolve(n);t.has(a)||(t.add(a),s.push(a));}return s.sort((n,a)=>n.localeCompare(a))}function $e(e,t){let s=e?.[t];return typeof s=="string"&&s.trim()?s.trim():void 0}function pt(e,t){return e?.[t]===true}function ut(e,t,s){let n=e?.frontend&&typeof e.frontend=="object"&&!Array.isArray(e.frontend)?e.frontend:void 0,a=$e(n,"generator"),r=$e(n,"command_display"),o=typeof t=="string"&&t.startsWith("frontend.");if(!(!a&&!o))return {...a?{id:a}:{},...t?{kit:t}:{},displayName:s,source:pt(n,"official_generator")?"official-generator":"metadata",...r?{commandDisplay:r}:{}}}async function mt(e){let t=[".workspai/project.json",".workspai/context.json",".rapidkit/project.json",".rapidkit/context.json","package.json","pyproject.toml","requirements.txt","go.mod","pom.xml","build.gradle","build.gradle.kts","Cargo.toml","composer.json","Gemfile","mix.exs","deno.json","Dockerfile","docker-compose.yml","README.md"],s=[];for(let n of t)await C.pathExists(p$1.join(e,n))&&s.push(n);return s}async function S(e,t,s,n=t){let a=await d$1(e,t),r=a!==null,o={path:n.split(p$1.sep).join("/"),exists:r};if(a&&s){let i=await Ke(a);typeof i?.generatedAt=="string"&&(o.generatedAt=i.generatedAt);let c=i?.status??i?.result??i?.verdict;typeof c=="string"&&(o.status=c);}return o}async function ft(e,t,s){let n=Ge(e,t),a=".workspai/reports",r=c=>S(t,`${a}/${c}`,s,`${n}/${a}/${c}`),o=await r("doctor-project-last-run.json");return {doctor:o?.exists===true?o:await r("doctor-last-run.json"),remediationPlan:await r("doctor-remediation-plan-last-run.json"),fixResult:await r("doctor-fix-result-last-run.json"),analyze:await r("analyze-last-run.json"),readiness:await r("release-readiness-last-run.json")}}async function gt(e,t,s){let n=i$1(t),a=i$2(t,n),r=w(t),o=f$2(a.runtime),i=await Oe(t,n),c=typeof n?.name=="string"&&n.name.trim()?n.name.trim():p$1.basename(t),d=typeof n?.kit_name=="string"?n.kit_name:typeof n?.kit=="string"?n.kit:void 0,u=typeof n?.engine=="string"?n.engine:r.engine!=="unknown"?r.engine:void 0,l=ut(n,d,a.displayName),f=_e({kitId:d,framework:a.key,runtime:a.runtime});return {name:c,path:Ge(e,t),...s.includeAbsolutePaths?{absolutePath:t}:{},kind:i,runtime:a.runtime,runtimeCandidates:h$1(t),framework:a.key,frameworkDisplayName:a.displayName,confidence:a.confidence,detectionSource:a.source,supportTier:a.supportTier,runtimeSupportTier:o.tier,runtimeDoctorSupport:o.doctorSupport,moduleSupport:r.moduleSupport,...d?{kit:d}:{},...u?{engine:u}:{},...l?{generator:l}:{},createCapability:f,commands:{supported:r.supportedCommands,unsupported:r.unsupportedCommands,global:r.globalCommands,fleetStages:r.fleetStages,localOnly:r.localOnlyCommands,map:r.commandMap},importantFiles:await mt(t),evidence:await ft(e,t,s.includeEvidence),provenance:{path:"filesystem discovery",runtime:a.source,framework:a.source,commands:"project command capability matrix",createCapability:"create planner capability contract",evidence:"project .workspai/reports"}}}async function ue(e){for(let t of o(e,"workspace.json")){let s=await Ke(t);if(s)return s}return null}function kt(e){return e.length===0?"empty-workspace":e.some(t=>t.kind==="frontend")&&e.length>1?"full-stack-workspace":e.some(t=>t.kind==="frontend")?"frontend-workspace":e.length>1?"backend-platform":"backend-workspace"}function ht(e){let t=new Set;for(let s of e){let n=`${s.name} ${s.path}`.toLowerCase();for(let a of ["auth","billing","payment","notification","order","admin","report","search","analytics"])n.includes(a)&&t.add(a);}return Array.from(t).sort()}function b(e,t,s,n){return {severity:e,code:t,message:s,target:n}}function Be(e){let t=[];e.workspace.name.trim()||t.push(b("error","workspace.name.missing","Workspace name could not be resolved.","workspace")),e.workspace.type==="observed-workspace"&&t.push(b("warning","workspace.marker.missing","Workspace marker is missing; model is based on filesystem observation.","workspace.marker")),e.summary.projectCount===0&&t.push(b("warning","workspace.projects.empty","No project roots were detected in this workspace.","projects")),e.contracts.exists||t.push(b("warning","workspace.contract.missing","Workspace contract is missing; dependency and API edges may be incomplete.",e.contracts.workspaceContractPath));let s=new Map;for(let r of e.projects){let o=r.name.toLowerCase(),i=s.get(o)??[];i.push(r),s.set(o,i),r.importantFiles.length||t.push(b("warning","project.markers.missing",`Project ${r.name} has no important manifest files recorded.`,r.path)),r.runtime==="unknown"&&t.push(b("warning","project.runtime.unknown",`Project ${r.name} runtime could not be confidently detected.`,r.path));let c=["test","build"];for(let l of c)r.commands.supported.includes(l)&&r.commands.unsupported.includes(l)&&t.push(b("error","project.commands.conflict",`Project ${r.name} marks ${l} as both supported and unsupported.`,r.path));let d=new Set(r.commands.fleetStages),u=new Set(r.commands.localOnly);for(let l of r.commands.fleetStages){u.has(l)&&t.push(b("error","project.commands.scope-conflict",`Project ${r.name} marks ${l} as both fleet and local-only.`,r.path));let f=r.commands.map[l];(!f||f.status!=="supported"||f.fleetEligible!==true||f.executionScope!=="fleet")&&t.push(b("error","project.commands.fleet-stage-invalid",`Project ${r.name} advertises ${l} as a fleet stage without a supported fleet capability.`,r.path));}for(let l of r.commands.localOnly){let f=r.commands.map[l];(!f||f.status!=="supported"||f.executionScope!=="local-only"||f.fleetEligible===true)&&t.push(b("error","project.commands.local-only-invalid",`Project ${r.name} advertises ${l} as local-only without a matching local-only capability.`,r.path));}for(let l of Object.values(r.commands.map))l.status==="supported"&&(l.fleetEligible===true&&!d.has(l.command)&&t.push(b("error","project.commands.fleet-stage-missing",`Project ${r.name} capability ${l.command} is fleet-eligible but missing from fleetStages.`,r.path)),l.executionScope==="local-only"&&l.fleetEligible!==true&&!u.has(l.command)&&t.push(b("error","project.commands.local-only-missing",`Project ${r.name} capability ${l.command} is local-only but missing from localOnly commands.`,r.path)));}for(let[r,o]of s.entries())o.length>1&&t.push(b("error","project.name.duplicate",`Project name "${r}" is ambiguous across ${o.length} project roots.`,o.map(i=>i.path).join(", ")));let n=t.filter(r=>r.severity==="error").length,a=t.filter(r=>r.severity==="warning").length;return {status:n>0?"failed":a>0?"warning":"passed",errors:n,warnings:a,issues:t}}function cr(e){return Be(e)}function y(e){return e.join(".")}function yt(e,t){let s=te,n=e.generatedAt,a=[h({id:"workspace.name",label:"Workspace name",scope:"workspace",value:e.workspace.name,freshness:{kind:"durable",category:"structure",generatedAt:n,now:t,sourceArtifact:s,sourcePath:y(["workspace","name"]),reason:"Workspace identity is structural metadata and changes through workspace setup."}}),h({id:"workspace.type",label:"Workspace type",scope:"workspace",value:e.identity.workspaceType,freshness:{kind:"derived",category:"structure",generatedAt:n,now:t,sourceArtifact:s,sourcePath:y(["identity","workspaceType"]),reason:"Workspace type is derived from the current project inventory."}}),h({id:"workspace.projectCount",label:"Project count",scope:"workspace",value:e.summary.projectCount,freshness:{kind:"derived",category:"structure",generatedAt:n,now:t,sourceArtifact:s,sourcePath:y(["summary","projectCount"]),reason:"Project count is derived from workspace discovery and should be refreshed after structural changes."}}),h({id:"workspace.runtimeFamilies",label:"Runtime families",scope:"workspace",value:e.identity.runtimeFamilies,freshness:{kind:"derived",category:"structure",generatedAt:n,now:t,sourceArtifact:s,sourcePath:y(["identity","runtimeFamilies"]),reason:"Runtime coverage is inferred from project surfaces."}}),h({id:"workspace.policyMode",label:"Workspace policy mode",scope:"policy",value:e.policies.mode,freshness:{kind:"durable",category:"structure",generatedAt:n,now:t,sourceArtifact:s,sourcePath:y(["policies","mode"]),reason:"Policy mode is configuration, not runtime state."}}),h({id:"workspace.contract.exists",label:"Workspace contract presence",scope:"contract",value:e.contracts.exists,freshness:{kind:"derived",category:"structure",generatedAt:n,now:t,sourceArtifact:s,sourcePath:y(["contracts","exists"]),reason:"Contract presence is derived from workspace files and should be refreshed before release gating."}})];e.graph&&a.push(h({id:"graph.edgeCount",label:"Dependency graph edge count",scope:"graph",value:e.graph.stats.edgeCount,freshness:{kind:"derived",category:"structure",generatedAt:e.graph.generatedAt??n,now:t,sourceArtifact:s,sourcePath:y(["graph","stats","edgeCount"]),reason:"Graph topology is derived from manifests, imports, and workspace contracts."}}),h({id:"graph.evidenceCoverageRatio",label:"Dependency graph evidence coverage",scope:"graph",value:e.graph.stats.evidenceCoverageRatio,freshness:{kind:"derived",category:"structure",generatedAt:e.graph.generatedAt??n,now:t,sourceArtifact:s,sourcePath:y(["graph","stats","evidenceCoverageRatio"]),reason:"Graph evidence coverage changes when dependency evidence or contract edges change."}}));for(let[r,o]of e.projects.entries()){let i=`projects[${r}]`,c={kind:"derived",category:"structure",generatedAt:n,now:t,sourceArtifact:s,reason:"Project facts are derived from workspace discovery, project metadata, and framework probes."};a.push(h({id:`project.${o.name}.kind`,label:`${o.name} kind`,scope:"project",project:o.name,value:o.kind,freshness:{...c,sourcePath:y([i,"kind"])}}),h({id:`project.${o.name}.runtime`,label:`${o.name} runtime`,scope:"project",project:o.name,value:o.runtime,freshness:{...c,sourcePath:y([i,"runtime"])}}),h({id:`project.${o.name}.framework`,label:`${o.name} framework`,scope:"project",project:o.name,value:o.frameworkDisplayName,freshness:{...c,sourcePath:y([i,"frameworkDisplayName"])}}),h({id:`project.${o.name}.supportTier`,label:`${o.name} support tier`,scope:"project",project:o.name,value:o.supportTier,freshness:{...c,sourcePath:y([i,"supportTier"])}}),h({id:`project.${o.name}.safeFleetStages`,label:`${o.name} safe fleet stages`,scope:"command",project:o.name,value:o.commands.fleetStages,freshness:{...c,sourcePath:y([i,"commands","fleetStages"]),reason:"Safe command availability is derived from package and project command surfaces."}}));for(let[d,u]of Object.entries(o.evidence))a.push(h({id:`project.${o.name}.evidence.${d}`,label:`${o.name} ${d} evidence`,scope:"evidence",project:o.name,value:u?{path:u.path,exists:u.exists,status:u.status??null}:{exists:false},freshness:{kind:u?.exists?"evidence-backed":"verify-before-use",category:"verification",generatedAt:u?.generatedAt??n,now:t,status:u?.exists?void 0:"unknown",sourceArtifact:u?.path??s,sourcePath:y([i,"evidence",d]),verifyBeforeUse:true,reason:u?.exists?"Evidence reports can expire or become stale after source changes.":"Missing evidence must be generated before this fact is used for verification."}}));}for(let[r,o]of Object.entries(e.evidence))a.push(h({id:`workspace.evidence.${r}`,label:`Workspace ${r} evidence`,scope:"evidence",value:o?{path:o.path,exists:o.exists,status:o.status??null}:null,freshness:{kind:o?.exists?"evidence-backed":"verify-before-use",category:"verification",generatedAt:o?.generatedAt??n,now:t,status:o?.exists?void 0:"unknown",sourceArtifact:o?.path??s,sourcePath:y(["evidence",r]),verifyBeforeUse:true,reason:o?.exists?"Workspace evidence can expire or become stale after project, dependency, or policy changes.":"Missing workspace evidence must be generated before release or repair decisions."}}));return a}async function re(e){let t=p$1.resolve(e.workspacePath),s=e.includeAbsolutePaths===true,n=e.includeEvidence===true,a$4=le(e.observableScanDepth),r=e.now??new Date,[o$1,i,c,d,u]=await Promise.all([a$1(t),ue(t),a$2(t),a$3(t,{descendIntoMatchedProjects:false}),de(t,a$4)]),l=pe([...d,...u,...c.map(m=>p$1.isAbsolute(m.path)?m.path:p$1.join(t,m.path))]),f=e.reuseProjectModels,w=await Promise.all(l.map(m=>{if(f){let ze=p$1.relative(t,p$1.resolve(m)).split(p$1.sep).join("/"),me=f.get(ze);if(me)return Promise.resolve(me)}return gt(t,m,{includeAbsolutePaths:s,includeEvidence:n})})),x=typeof i?.workspace_name=="string"?i.workspace_name:typeof i?.name=="string"?i.name:o$1?.name||p$1.basename(t),j=typeof i?.profile=="string"?i.profile:typeof i?.mode=="string"?i.mode:void 0,R=Array.from(new Set(w.map(m=>m.kind))).sort(),E=Array.from(new Set(w.map(m=>m.runtime))).sort(),se=Array.from(new Set(w.map(m=>m.framework))).sort(),M=[".workspai/policies.yml",".workspai/policies.yaml",".rapidkit/policies.yml",".rapidkit/policies.yaml"].find(m=>C.existsSync(p$1.join(t,m))),I=o(t,"workspace.contract.json").map(m=>p$1.relative(t,m).split(p$1.sep).join("/")).find(m=>C.existsSync(p$1.join(t,m)))??".workspai/workspace.contract.json",P=await C.pathExists(p$1.join(t,I)),K={schemaVersion:it,generatedAt:r.toISOString(),workspace:{name:x,root:t,...j?{profile:j}:{},type:o$1?"rapidkit-workspace":"observed-workspace",...o$1?{marker:{createdBy:o$1.createdBy,version:o$1.version,createdAt:o$1.createdAt}}:{}},identity:{workspaceType:kt(w),surfaces:R,runtimeFamilies:E,businessCapabilities:ht(w)},discovery:{observableScanDepth:a$4},projects:w,policies:{mode:typeof i?.policy_mode=="string"?i.policy_mode:typeof i?.policyMode=="string"?i.policyMode:"warn",source:M??null,exists:!!M},contracts:{workspaceContractPath:I,exists:P,status:P?"known":"missing"},evidence:{doctor:await S(t,a.doctor,n),projectDoctor:await S(t,".workspai/reports/doctor-project-last-run.json",n),doctorRemediationPlan:await S(t,".workspai/reports/doctor-remediation-plan-last-run.json",n),artifactRemediationPlan:await S(t,".workspai/reports/artifact-remediation-plan-last-run.json",n),doctorFixResult:await S(t,".workspai/reports/doctor-fix-result-last-run.json",n),analyze:await S(t,a.analyze,n),readiness:await S(t,a.readiness,n),pipeline:await S(t,".workspai/reports/pipeline-last-run.json",n)},summary:{projectCount:w.length,runtimes:E,frameworks:se,firstClassProjects:w.filter(m=>m.supportTier==="first-class").length,observedProjects:w.filter(m=>m.supportTier==="observed").length}},O=await Le(t,K,{contractExists:P,now:r,incrementalGraph:e.incrementalGraph}),_={...K,graph:O},k=Be(_),v=yt({..._},r),W=Ve({facts:v,generatedAt:r.toISOString(),now:r});return {..._,facts:v,factFreshness:W,validation:k}}async function lr(e){if(e.cache!==true)return {model:await re(e),cache:"disabled"};let t=p$1.resolve(e.workspacePath),s=le(e.observableScanDepth),n=ie(),[a,r,o,i,c]=await Promise.all([a$1(t),ue(t),a$2(t),a$3(t,{descendIntoMatchedProjects:false}),de(t,s)]),d=pe([...i,...c,...o.map(j=>p$1.isAbsolute(j.path)?j.path:p$1.join(t,j.path))]),u=await Z({workspacePath:t,cliVersion:n,flags:{includeAbsolutePaths:e.includeAbsolutePaths===true,includeEvidence:e.includeEvidence===true,observableScanDepth:s},projectPaths:d,workspaceJson:r,marker:a}),l=await ce(t);if(l&&l.cliVersion===n&&l.inputsHash===u)return {model:l.model,cache:"hit"};let f=await re({...e}),[w,x]=await Promise.all([Y(t,d),Q(t)]);return await ee(t,{cliVersion:n,inputsHash:u,generatedAt:(e.now??new Date).toISOString(),model:f,projectSignatures:w,workspaceFileSignatures:x}),{model:f,cache:"miss"}}function wt(e,t){let s=new Set,n=new Set,a=new Set;for(let[r,o]of Object.entries(t))r in e?e[r]!==o&&s.add(r):n.add(r);for(let r of Object.keys(e))r in t||a.add(r);return {changed:s,added:n,removed:a}}function vt(e={},t={}){let s=new Set([...Object.keys(e),...Object.keys(t)]);for(let n of s)if(e[n]!==t[n])return false;return true}async function dr(e){let t=p$1.resolve(e.workspacePath),s=le(e.observableScanDepth),n=ie(),a=e.now??new Date,[r,o,i,c,d]=await Promise.all([a$1(t),ue(t),a$2(t),a$3(t,{descendIntoMatchedProjects:false}),de(t,s)]),u=pe([...c,...d,...i.map(k=>p$1.isAbsolute(k.path)?k.path:p$1.join(t,k.path))]),l=await ce(t),f=async()=>{let k=await re({...e}),v=await Z({workspacePath:t,cliVersion:n,flags:{includeAbsolutePaths:e.includeAbsolutePaths===true,includeEvidence:e.includeEvidence===true,observableScanDepth:s},projectPaths:u,workspaceJson:o,marker:r}),[W,m]=await Promise.all([Y(t,u),Q(t)]);return await ee(t,{cliVersion:n,inputsHash:v,generatedAt:a.toISOString(),model:k,projectSignatures:W,workspaceFileSignatures:m}),{model:k,mode:"full"}};if(!l||l.cliVersion!==n||!l.projectSignatures||!l.model?.graph)return f();let w=await Q(t);if(!vt(l.workspaceFileSignatures,w))return f();let x=await Y(t,u),{changed:j,added:R,removed:E}=wt(l.projectSignatures,x);if(j.size===0&&R.size===0&&E.size===0)return {model:l.model,mode:"unchanged"};let se=new Set([...j,...R]),M=new Map;for(let k of l.model.projects){let v=k.path.split(p$1.sep).join("/");!se.has(v)&&!E.has(v)&&M.set(v,k);}let I=new Set,P=false;for(let k of l.model.projects){let v=k.path.split(p$1.sep).join("/");j.has(v)&&I.add(k.name);}let K=R.size>0||E.size>0,O=await re({...e,reuseProjectModels:M,incrementalGraph:{previousGraph:l.model.graph,changedProjectIds:I,structuralChange:K||P}});for(let k of l.model.projects){let v=k.path.split(p$1.sep).join("/");if(!j.has(v))continue;let W=O.projects.find(m=>m.path.split(p$1.sep).join("/")===v);if(W&&W.name!==k.name){P=true;break}}if(P)return f();let _=await Z({workspacePath:t,cliVersion:n,flags:{includeAbsolutePaths:e.includeAbsolutePaths===true,includeEvidence:e.includeEvidence===true,observableScanDepth:s},projectPaths:u,workspaceJson:o,marker:r});return await ee(t,{cliVersion:n,inputsHash:_,generatedAt:a.toISOString(),model:O,projectSignatures:x,workspaceFileSignatures:w}),{model:O,mode:"incremental"}}async function He(e){try{let{contract:t}=await m({workspacePath:e});return t&&typeof t=="object"?t:null}catch{return null}}async function Le(e,t,s){let n=s.contractExists?await He(e):null;try{return s.incrementalGraph?await g({workspacePath:e,model:t,contract:n,now:s.now,previousGraph:s.incrementalGraph.previousGraph,changedProjectIds:s.incrementalGraph.changedProjectIds,structuralChange:s.incrementalGraph.structuralChange}):await f({workspacePath:e,model:t,contract:n,now:s.now})}catch{let a=t.projects.map(r=>({id:r.name,path:r.path}));return {schemaVersion:"workspace-dependency-graph.v1",generatedAt:s.now.toISOString(),nodes:a,edges:[],stats:{nodeCount:a.length,edgeCount:0,inferredEdges:0,contractEdges:0,manualEdges:0,authoritativeEdges:0,lowConfidenceEdges:0,orphanCount:a.length,connectedNodeCount:0,density:0,edgeCoverageRatio:a.length>0?0:1,evidenceCoverageRatio:1,hotspotCount:0,hasCycle:false},diagnostics:a.length>1?[{code:"graph.inference.failed",severity:"warning",message:"Dependency graph inference failed; model contains projects but no dependency edges.",recommendation:"Run workspace model again after fixing graph inputs, or add workspace contract/manual graph overrides.",nodeIds:a.map(r=>r.id).sort((r,o)=>r.localeCompare(o))}]:void 0}}}async function pr(e,t){let s=e.contracts.exists?await He(t):null,{buildWorkspaceKnowledgeGraph:n}=await import('./workspace-knowledge-graph-ARDC6HHG.js'),a$1=a$4(e),r=await n({workspacePath:t,workspace:{name:e.workspace.name,...e.workspace.profile?{profile:e.workspace.profile}:{}},projects:e.projects.map(i=>({id:i.name,path:i.path,...i.absolutePath?{absolutePath:i.absolutePath}:{},runtime:i.runtime,framework:i.framework,...i.kit?{kit:i.kit}:{}})),projectTopology:e.graph??await Le(t,e,{contractExists:e.contracts.exists,now:new Date(e.generatedAt)}),contract:s,now:new Date(e.generatedAt),source:{kind:"workspace-model",artifact:te,hashAlgorithm:"sha256",hash:d(a$1)}}),[,o]=await f$1(t,te,[{relativePath:a.knowledgeGraph,payload:r},{relativePath:te,payload:a$1}]);return o}export{Te as a,h as b,Ve as c,_e as d,Wt as e,Oe as f,it as g,te as h,cr as i,yt as j,re as k,lr as l,dr as m,pr as n};
@@ -1,2 +1,2 @@
1
- import {a as a$1}from'./chunk-KB44JP4M.js';import {a,c,b,i}from'./chunk-LNRAB7UY.js';import h from'path';var w=Object.keys(a).flatMap(t=>{let o=t,a$1=b[o],r=c[o];return !a$1||!r?[]:[{artifactPath:a[o],schemaVersion:a$1,contractPath:r}]}),m=[{artifactPath:".workspai/workspace.contract.json",schemaVersion:1,contractPath:"contracts/workspace-contract.v1.json"},{artifactPath:".workspai/cache/workspace-model.v1.json",schemaVersion:"workspace-model-cache.v1",contractPath:"contracts/workspace-model-cache.v1.json"},{artifactPath:".workspai/workspace-registry.v1.json",schemaVersion:"workspace-registry.v1",contractPath:"contracts/workspace-registry.v1.json"},{artifactPath:".workspai/compatibility-matrix.json",schemaVersion:"rapidkit.compatibility-matrix.v1",contractPath:"contracts/compatibility-matrix.v1.json"},{artifactPath:".workspai/reports/doctor-workspace-cache.json",schemaVersion:"doctor-workspace-cache-v2",contractPath:"contracts/doctor-workspace-cache.v2.json"},{artifactPath:".workspai/reports/bootstrap-compliance.latest.json",schemaVersion:"bootstrap-compliance.v1",contractPath:"contracts/bootstrap-compliance.v1.json"},{artifactPath:".workspai/reports/mirror-ops.latest.json",schemaVersion:"mirror-ops.v1",contractPath:"contracts/mirror-ops.v1.json"},{artifactPath:".workspai/reports/transparency-evidence.latest.json",schemaVersion:"transparency-evidence.v1",contractPath:"contracts/transparency-evidence.v1.json"},{artifactPath:".workspai/reports/share-bundle.json",schemaVersion:"1.1",schemaVersionField:"schema_version",contractPath:"contracts/workspace-share-bundle.v1.json"},{artifactPath:".workspai/reports/doctor-project-last-run.json",schemaVersion:"doctor-project-evidence-v1",contractPath:"contracts/doctor-project-evidence.v1.json"},{artifactPath:".workspai/reports/doctor-remediation-plan-last-run.json",schemaVersion:"doctor-remediation-plan-v2",contractPath:"contracts/doctor-remediation-plan.v2.json"},{artifactPath:".workspai/reports/artifact-remediation-plan-last-run.json",schemaVersion:"artifact-remediation-plan-v1",contractPath:"contracts/artifact-remediation-plan.v1.json"},{artifactPath:".workspai/reports/doctor-fix-result-last-run.json",schemaVersion:"rapidkit-doctor-fix-result-v1",contractPath:"contracts/workspace-intelligence/doctor-fix-result.v1.json"},{artifactPath:".workspai/reports/pipeline-last-run.json",schemaVersion:"rapidkit-pipeline-v1",contractPath:"contracts/pipeline-last-run.v1.json"},{artifactPath:".workspai/reports/autopilot-release-last-run.json",schemaVersion:"autopilot-release-v1",contractPath:"contracts/autopilot-release.v1.json"},{artifactPath:".workspai/reports/autopilot-release.json",schemaVersion:"autopilot-release-v1",contractPath:"contracts/autopilot-release.v1.json"},{artifactPath:".workspai/reports/workspace-run-last.json",schemaVersion:"workspace-run-v1",contractPath:"contracts/workspace-run-last.v1.json"},{artifactPath:".workspai/reports/workspai-mcp-design.json",schemaVersion:"workspai-mcp-design.v1",contractPath:"contracts/workspace-intelligence/mcp-design.v1.json"},{artifactPath:".workspai/reports/workspace-why-last-run.json",schemaVersion:b.explain,contractPath:c.explain},{artifactPath:".workspai/reports/workspace-trace-last-run.json",schemaVersion:b.explain,contractPath:c.explain},{artifactPath:".vscode/workspai-agent-hooks.json",schemaVersion:"workspai-agent-hooks.v1",contractPath:"contracts/workspace-intelligence/agent-hooks.v1.json"},{artifactPath:".workspai/reports/infra-plan.json",schemaVersion:"rapidkit.infra-plan.v1",contractPath:"contracts/infra-plan.v1.json"}],d={".workspai/workspace.contract.json":[["workspace","sync"],["workspace","contract","sync"]],[a.intelligenceRun]:[["workspace","intelligence","run"]],[a.snapshot]:[["workspace","snapshot"]],[a.history]:[["workspace","feedback","record","--json"]],".workspai/cache/workspace-model.v1.json":[["workspace","model"]],".workspai/workspace-registry.v1.json":[["workspace","sync"]],".workspai/compatibility-matrix.json":[["bootstrap"]],".workspai/reports/doctor-workspace-cache.json":[["doctor","workspace"]],".workspai/reports/bootstrap-compliance.latest.json":[["bootstrap"]],".workspai/reports/mirror-ops.latest.json":[["mirror","status"]],".workspai/reports/transparency-evidence.latest.json":[["mirror","sync"]],".workspai/reports/share-bundle.json":[["workspace","share"]],".workspai/reports/doctor-project-last-run.json":[["doctor","project"]],".workspai/reports/doctor-remediation-plan-last-run.json":[["workspace","remediation-plan"]],".workspai/reports/artifact-remediation-plan-last-run.json":[["workspace","remediation-plan"]],".workspai/reports/doctor-fix-result-last-run.json":[["doctor","workspace"]],".workspai/reports/pipeline-last-run.json":[["pipeline"]],".workspai/reports/autopilot-release-last-run.json":[["autopilot","release"]],".workspai/reports/autopilot-release.json":[["autopilot","release"]],".workspai/reports/workspace-run-last.json":[["workspace","run"]],".workspai/reports/workspai-mcp-design.json":[["workspace","agent-sync","--write"]],".workspai/reports/workspace-why-last-run.json":[["workspace","why"]],".workspai/reports/workspace-trace-last-run.json":[["workspace","trace"]],".vscode/workspai-agent-hooks.json":[["workspace","agent-sync"]],".workspai/reports/infra-plan.json":[["infra","plan"]]};function j(t){let o=Object.values(i).filter(r=>r.produces.includes(t)).map(r=>[...r.command]),a=d[t]??[];return [...o,...a.map(r=>[...r])]}var k=Object.freeze(Object.fromEntries([...w,...m].map(t=>[t.artifactPath,{...t,producerCommands:j(t.artifactPath)}])));function u(t){return t.split(h.sep).join("/").replace(/^\.\//,"")}var f=[{pattern:/^\.workspai\/reports\/bootstrap-compliance-[^/]+\.json$/,canonicalPath:".workspai/reports/bootstrap-compliance.latest.json"},{pattern:/^\.workspai\/reports\/mirror-ops-[^/]+\.json$/,canonicalPath:".workspai/reports/mirror-ops.latest.json"},{pattern:/^\.workspai\/reports\/transparency-evidence-[^/]+\.json$/,canonicalPath:".workspai/reports/transparency-evidence.latest.json"}];function P(t){let o=u(t),a=k[o];if(a)return a;let r=f.find(n=>n.pattern.test(o));return r?k[r.canonicalPath]??null:null}function y(t,o,a=t){let r=P(t);if(!r)return;let n=r.schemaVersionField??"schemaVersion",i=o&&typeof o=="object"?o[n]:void 0;if(i!==r.schemaVersion)throw new Error(`${a} schemaVersion is ${String(i)}, expected ${r.schemaVersion}`);a$1(o,r.contractPath,a);}
1
+ import {a as a$1}from'./chunk-KB44JP4M.js';import {a,c,b,i}from'./chunk-BMWFQXGW.js';import h from'path';var w=Object.keys(a).flatMap(t=>{let o=t,a$1=b[o],r=c[o];return !a$1||!r?[]:[{artifactPath:a[o],schemaVersion:a$1,contractPath:r}]}),m=[{artifactPath:".workspai/workspace.contract.json",schemaVersion:1,contractPath:"contracts/workspace-contract.v1.json"},{artifactPath:".workspai/cache/workspace-model.v1.json",schemaVersion:"workspace-model-cache.v1",contractPath:"contracts/workspace-model-cache.v1.json"},{artifactPath:".workspai/workspace-registry.v1.json",schemaVersion:"workspace-registry.v1",contractPath:"contracts/workspace-registry.v1.json"},{artifactPath:".workspai/compatibility-matrix.json",schemaVersion:"rapidkit.compatibility-matrix.v1",contractPath:"contracts/compatibility-matrix.v1.json"},{artifactPath:".workspai/reports/doctor-workspace-cache.json",schemaVersion:"doctor-workspace-cache-v2",contractPath:"contracts/doctor-workspace-cache.v2.json"},{artifactPath:".workspai/reports/bootstrap-compliance.latest.json",schemaVersion:"bootstrap-compliance.v1",contractPath:"contracts/bootstrap-compliance.v1.json"},{artifactPath:".workspai/reports/mirror-ops.latest.json",schemaVersion:"mirror-ops.v1",contractPath:"contracts/mirror-ops.v1.json"},{artifactPath:".workspai/reports/transparency-evidence.latest.json",schemaVersion:"transparency-evidence.v1",contractPath:"contracts/transparency-evidence.v1.json"},{artifactPath:".workspai/reports/share-bundle.json",schemaVersion:"1.1",schemaVersionField:"schema_version",contractPath:"contracts/workspace-share-bundle.v1.json"},{artifactPath:".workspai/reports/doctor-project-last-run.json",schemaVersion:"doctor-project-evidence-v1",contractPath:"contracts/doctor-project-evidence.v1.json"},{artifactPath:".workspai/reports/doctor-remediation-plan-last-run.json",schemaVersion:"doctor-remediation-plan-v2",contractPath:"contracts/doctor-remediation-plan.v2.json"},{artifactPath:".workspai/reports/artifact-remediation-plan-last-run.json",schemaVersion:"artifact-remediation-plan-v1",contractPath:"contracts/artifact-remediation-plan.v1.json"},{artifactPath:".workspai/reports/doctor-fix-result-last-run.json",schemaVersion:"rapidkit-doctor-fix-result-v1",contractPath:"contracts/workspace-intelligence/doctor-fix-result.v1.json"},{artifactPath:".workspai/reports/pipeline-last-run.json",schemaVersion:"rapidkit-pipeline-v1",contractPath:"contracts/pipeline-last-run.v1.json"},{artifactPath:".workspai/reports/autopilot-release-last-run.json",schemaVersion:"autopilot-release-v1",contractPath:"contracts/autopilot-release.v1.json"},{artifactPath:".workspai/reports/autopilot-release.json",schemaVersion:"autopilot-release-v1",contractPath:"contracts/autopilot-release.v1.json"},{artifactPath:".workspai/reports/workspace-run-last.json",schemaVersion:"workspace-run-v1",contractPath:"contracts/workspace-run-last.v1.json"},{artifactPath:".workspai/reports/workspai-mcp-design.json",schemaVersion:"workspai-mcp-design.v1",contractPath:"contracts/workspace-intelligence/mcp-design.v1.json"},{artifactPath:".workspai/reports/workspace-why-last-run.json",schemaVersion:b.explain,contractPath:c.explain},{artifactPath:".workspai/reports/workspace-trace-last-run.json",schemaVersion:b.explain,contractPath:c.explain},{artifactPath:".vscode/workspai-agent-hooks.json",schemaVersion:"workspai-agent-hooks.v1",contractPath:"contracts/workspace-intelligence/agent-hooks.v1.json"},{artifactPath:".workspai/reports/infra-plan.json",schemaVersion:"rapidkit.infra-plan.v1",contractPath:"contracts/infra-plan.v1.json"}],d={".workspai/workspace.contract.json":[["workspace","sync"],["workspace","contract","sync"]],[a.intelligenceRun]:[["workspace","intelligence","run"]],[a.snapshot]:[["workspace","snapshot"]],[a.history]:[["workspace","feedback","record","--json"]],[a.evaluationLive]:[["workspace","eval","init"],["workspace","eval","record","--json"]],[a.evaluationLastRun]:[["workspace","eval","report","--json"]],".workspai/cache/workspace-model.v1.json":[["workspace","model"]],".workspai/workspace-registry.v1.json":[["workspace","sync"]],".workspai/compatibility-matrix.json":[["bootstrap"]],".workspai/reports/doctor-workspace-cache.json":[["doctor","workspace"]],".workspai/reports/bootstrap-compliance.latest.json":[["bootstrap"]],".workspai/reports/mirror-ops.latest.json":[["mirror","status"]],".workspai/reports/transparency-evidence.latest.json":[["mirror","sync"]],".workspai/reports/share-bundle.json":[["workspace","share"]],".workspai/reports/doctor-project-last-run.json":[["doctor","project"]],".workspai/reports/doctor-remediation-plan-last-run.json":[["workspace","remediation-plan"]],".workspai/reports/artifact-remediation-plan-last-run.json":[["workspace","remediation-plan"]],".workspai/reports/doctor-fix-result-last-run.json":[["doctor","workspace"]],".workspai/reports/pipeline-last-run.json":[["pipeline"]],".workspai/reports/autopilot-release-last-run.json":[["autopilot","release"]],".workspai/reports/autopilot-release.json":[["autopilot","release"]],".workspai/reports/workspace-run-last.json":[["workspace","run"]],".workspai/reports/workspai-mcp-design.json":[["workspace","agent-sync","--write"]],".workspai/reports/workspace-why-last-run.json":[["workspace","why"]],".workspai/reports/workspace-trace-last-run.json":[["workspace","trace"]],".vscode/workspai-agent-hooks.json":[["workspace","agent-sync"]],".workspai/reports/infra-plan.json":[["infra","plan"]]};function j(t){let o=Object.values(i).filter(r=>r.produces.includes(t)).map(r=>[...r.command]),a=d[t]??[];return [...o,...a.map(r=>[...r])]}var k=Object.freeze(Object.fromEntries([...w,...m].map(t=>[t.artifactPath,{...t,producerCommands:j(t.artifactPath)}])));function u(t){return t.split(h.sep).join("/").replace(/^\.\//,"")}var f=[{pattern:/^\.workspai\/reports\/bootstrap-compliance-[^/]+\.json$/,canonicalPath:".workspai/reports/bootstrap-compliance.latest.json"},{pattern:/^\.workspai\/reports\/mirror-ops-[^/]+\.json$/,canonicalPath:".workspai/reports/mirror-ops.latest.json"},{pattern:/^\.workspai\/reports\/transparency-evidence-[^/]+\.json$/,canonicalPath:".workspai/reports/transparency-evidence.latest.json"}];function P(t){let o=u(t),a=k[o];if(a)return a;let r=f.find(c=>c.pattern.test(o));return r?k[r.canonicalPath]??null:null}function y(t,o,a=t){let r=P(t);if(!r)return;let c=r.schemaVersionField??"schemaVersion",i=o&&typeof o=="object"?o[c]:void 0;if(i!==r.schemaVersion)throw new Error(`${a} schemaVersion is ${String(i)}, expected ${r.schemaVersion}`);a$1(o,r.contractPath,a);}
2
2
  export{P as a,y as b};
@@ -0,0 +1 @@
1
+ import {b}from'./chunk-BMWFQXGW.js';var o="model-usage-event.v1",s=b.evaluationLive,a="workspace-intelligence-evaluation-comparison.v1",i=["provider-reported","tokenizer-counted","estimated","unavailable"];export{o as a,s as b,a as c,i as d};
@@ -1,4 +1,4 @@
1
- import {a as a$1}from'./chunk-JEI6BTZI.js';import {a}from'./chunk-HSGFUKCN.js';import {c,e,d}from'./chunk-2GHUZDYA.js';import {d as d$1,b}from'./chunk-ZM5NQ5Z2.js';import {g}from'./chunk-NOFM7MNA.js';import {k}from'./chunk-ZDN7RHXJ.js';import {m,a as a$2}from'./chunk-22NJ2ZMG.js';import {e as e$1}from'./chunk-2TEDAKP6.js';import {b as b$1}from'./chunk-YCL3I2JO.js';import {a as a$3}from'./chunk-KB44JP4M.js';import j from'path';import W from'fs-extra';function G(e$1){switch(e$1){case "why":return d;case "trace":return e;default:return c}}async function P(e,n,o){try{if(!await W.pathExists(e))return null;let r=await W.readJson(e);return n?b$1(n,r,e):o&&a$3(r,o,e),r}catch(r){if((n||o)&&await W.pathExists(e))throw r;return null}}function z(e,n){if(!e)return null;let o=n.trim().toLowerCase();return e.projects.find(r=>r.slug.toLowerCase()===o||r.relativePath.toLowerCase()===o)??null}function J(e,n,o){let r=o.trim().toLowerCase(),t=(e.graph?.nodes.map(a=>a.id)??e.projects.map(a=>a.name)).find(a=>a.toLowerCase()===r);if(t)return t;let d=e.projects.find(a=>[a.name,a.path,j.basename(a.path)].filter(u=>u.trim().length>0).some(u=>u.toLowerCase()===r));if(d)return d.name;let c=z(n,o);if(c){let a=e.projects.find(u=>u.path===c.relativePath||u.path.endsWith(`/${c.relativePath}`));if(a)return a.name}return o}function X(e,n){if(!e)return [];let o=n.trim().toLowerCase(),r=new Set;for(let l of e.projects){l.contracts.dependsOn?.some(t=>t.toLowerCase()===o)&&r.add(l.slug);for(let t of l.contracts.consumes??[])for(let d of e.projects)d.contracts.publishes?.includes(t)&&d.slug===o&&r.add(l.slug);}return [...r].sort()}function Y(e,n){if(!e)return [];let o=n.trim().toLowerCase();return e.steps.filter(r=>r.scope==="project"&&r.project?.toLowerCase()===o&&r.command?.display).map(r=>r.command.display).slice(0,8)}function p(e,n,o){return {id:e,title:n,body:o.trim()}}async function me(e){let n=j.resolve(e.workspacePath),o=(e.now??new Date).toISOString(),r=e.model??await k({workspacePath:n,includeEvidence:true}),l=e.contract;if(l===void 0)try{l=(await m({workspacePath:n})).contract;}catch{l=null;}let t=e.verify;t===void 0&&(t=await P(j.join(n,d$1),d$1));let d=e.impact;if(d===void 0&&(d=await P(j.join(n,g),g)),e.target.kind==="release-blocked"){let s=t?.blockingReasons??[],i=(r.summary?.projectCount??r.projects.length)===0,g=[p("verdict",i?"Workspace scaffold posture":"Release verdict",t?i?`Scaffold posture: **${t.summary.verdict}** (exit ${t.summary.exitCode}). Freshness: **${t.freshness.verdict}**. No registered projects yet \u2014 release gates apply after the first project is added.`:`Verdict: **${t.summary.verdict}** (exit ${t.summary.exitCode}). Risk: **${t.impact.risk}**. Freshness: **${t.freshness.verdict}**.`:"No workspace verify report found. Run `npx workspai workspace verify --json --write` first."),p("blockers",i?"Pre-project signals":"Blocking reasons",s.length?s.map(h=>`- ${h}`).join(`
1
+ import {a as a$1}from'./chunk-JEI6BTZI.js';import {a}from'./chunk-VU7NZHPM.js';import {c,e,d}from'./chunk-CRHYBQI3.js';import {d as d$1,b}from'./chunk-OW42TZFB.js';import {g}from'./chunk-AFL3ACCR.js';import {k}from'./chunk-37CVKXBD.js';import {m,a as a$2}from'./chunk-T4YR4RAI.js';import {e as e$1}from'./chunk-32OJDBIG.js';import {b as b$1}from'./chunk-3NU32T4A.js';import {a as a$3}from'./chunk-KB44JP4M.js';import j from'path';import W from'fs-extra';function G(e$1){switch(e$1){case "why":return d;case "trace":return e;default:return c}}async function P(e,n,o){try{if(!await W.pathExists(e))return null;let r=await W.readJson(e);return n?b$1(n,r,e):o&&a$3(r,o,e),r}catch(r){if((n||o)&&await W.pathExists(e))throw r;return null}}function z(e,n){if(!e)return null;let o=n.trim().toLowerCase();return e.projects.find(r=>r.slug.toLowerCase()===o||r.relativePath.toLowerCase()===o)??null}function J(e,n,o){let r=o.trim().toLowerCase(),t=(e.graph?.nodes.map(a=>a.id)??e.projects.map(a=>a.name)).find(a=>a.toLowerCase()===r);if(t)return t;let d=e.projects.find(a=>[a.name,a.path,j.basename(a.path)].filter(u=>u.trim().length>0).some(u=>u.toLowerCase()===r));if(d)return d.name;let c=z(n,o);if(c){let a=e.projects.find(u=>u.path===c.relativePath||u.path.endsWith(`/${c.relativePath}`));if(a)return a.name}return o}function X(e,n){if(!e)return [];let o=n.trim().toLowerCase(),r=new Set;for(let l of e.projects){l.contracts.dependsOn?.some(t=>t.toLowerCase()===o)&&r.add(l.slug);for(let t of l.contracts.consumes??[])for(let d of e.projects)d.contracts.publishes?.includes(t)&&d.slug===o&&r.add(l.slug);}return [...r].sort()}function Y(e,n){if(!e)return [];let o=n.trim().toLowerCase();return e.steps.filter(r=>r.scope==="project"&&r.project?.toLowerCase()===o&&r.command?.display).map(r=>r.command.display).slice(0,8)}function p(e,n,o){return {id:e,title:n,body:o.trim()}}async function me(e){let n=j.resolve(e.workspacePath),o=(e.now??new Date).toISOString(),r=e.model??await k({workspacePath:n,includeEvidence:true}),l=e.contract;if(l===void 0)try{l=(await m({workspacePath:n})).contract;}catch{l=null;}let t=e.verify;t===void 0&&(t=await P(j.join(n,d$1),d$1));let d=e.impact;if(d===void 0&&(d=await P(j.join(n,g),g)),e.target.kind==="release-blocked"){let s=t?.blockingReasons??[],i=(r.summary?.projectCount??r.projects.length)===0,g=[p("verdict",i?"Workspace scaffold posture":"Release verdict",t?i?`Scaffold posture: **${t.summary.verdict}** (exit ${t.summary.exitCode}). Freshness: **${t.freshness.verdict}**. No registered projects yet \u2014 release gates apply after the first project is added.`:`Verdict: **${t.summary.verdict}** (exit ${t.summary.exitCode}). Risk: **${t.impact.risk}**. Freshness: **${t.freshness.verdict}**.`:"No workspace verify report found. Run `npx workspai workspace verify --json --write` first."),p("blockers",i?"Pre-project signals":"Blocking reasons",s.length?s.map(h=>`- ${h}`).join(`
2
2
  `):i?"No pre-project signals in the latest verify report.":"No blocking reasons in the latest verify report.")];return t?.resolutionHints?.length&&g.push(p("resolution","Resolution hints",t.resolutionHints.map(h=>`- **${h.blockerId}** (${h.resolutionClass}): ${h.commandRetryHint??h.fixHints[0]?.detail??"See fix hints"}`).join(`
3
3
  `))),{schemaVersion:a,generatedAt:o,workspacePath:n,target:e.target,summary:t?i?b(s.length,t.summary.verdict):`${s.length>0||t.summary.verdict==="blocked"?"Release blocked":"Release posture"}: ${t.summary.verdict} with ${s.length} blocking reason(s).`:"Release posture unknown \u2014 verify report missing.",sections:g,releaseRisk:t?.impact.risk,blockingReasons:s,resolutionHints:t?.resolutionHints}}if(e.target.kind==="blocker"){let s=e.target,m=t?.resolutionHints?.find(g=>g.blockerId===s.blockerId),i=t?.blockingReasons.find(g=>g.includes(s.blockerId))??t?.blockingReasons[0];return {schemaVersion:a,generatedAt:o,workspacePath:n,target:s,summary:m?`Blocker ${s.blockerId}: ${m.resolutionClass}`:`Blocker ${s.blockerId} (no structured hint)`,sections:[p("reason","Blocking signal",i??"No matching blocking reason in verify."),p("hint","Resolution class",m?`${m.resolutionClass}
4
4