@stacksjs/defaults 0.74.41 → 0.74.43

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 (81) hide show
  1. package/ai/skills/stacks-actions/SKILL.md +1 -1
  2. package/ai/skills/stacks-cms/SKILL.md +4 -4
  3. package/ai/skills/stacks-composables/SKILL.md +51 -2
  4. package/ai/skills/stacks-config/SKILL.md +1 -1
  5. package/ai/skills/stacks-dashboard/SKILL.md +1 -1
  6. package/ai/skills/stacks-database/SKILL.md +1 -1
  7. package/ai/skills/stacks-migrations/SKILL.md +2 -2
  8. package/ai/skills/stacks-models/SKILL.md +16 -2
  9. package/ai/skills/stacks-orm/SKILL.md +1 -1
  10. package/ai/skills/stacks-technical-diagrams/LICENSE +1 -1
  11. package/ai/skills/stacks-technical-diagrams/SKILL.md +257 -229
  12. package/ai/skills/stacks-technical-diagrams/THIRD_PARTY_NOTICES.md +69 -0
  13. package/ai/skills/stacks-technical-diagrams/assets/JetBrainsMono-OFL.txt +93 -0
  14. package/ai/skills/stacks-technical-diagrams/assets/template.html +14588 -929
  15. package/ai/skills/stacks-technical-diagrams/bin/diagrams +10 -0
  16. package/ai/skills/stacks-technical-diagrams/bin/open-artifact.mjs +86 -0
  17. package/ai/skills/stacks-technical-diagrams/bin/preview.mjs +654 -0
  18. package/ai/skills/stacks-technical-diagrams/bin/technical-diagrams.mjs +1898 -89
  19. package/ai/skills/stacks-technical-diagrams/bin/visual-check.mjs +829 -0
  20. package/ai/skills/stacks-technical-diagrams/brand-marks/README.md +31 -0
  21. package/ai/skills/stacks-technical-diagrams/brand-marks/catalog.json +131 -0
  22. package/ai/skills/stacks-technical-diagrams/delta/architecture-delta.mjs +1221 -0
  23. package/ai/skills/stacks-technical-diagrams/examples/agent-run.lifecycle.json +18 -22
  24. package/ai/skills/stacks-technical-diagrams/examples/agent-tool-call.workflow.json +58 -52
  25. package/ai/skills/stacks-technical-diagrams/examples/async-job-roundtrip.sequence.json +61 -0
  26. package/ai/skills/stacks-technical-diagrams/examples/brand-aware-delivery.architecture.json +47 -0
  27. package/ai/skills/stacks-technical-diagrams/examples/cache-miss-request.sequence.json +30 -23
  28. package/ai/skills/stacks-technical-diagrams/examples/checkout-platform.base.architecture.json +31 -0
  29. package/ai/skills/stacks-technical-diagrams/examples/checkout-platform.head.architecture.json +31 -0
  30. package/ai/skills/stacks-technical-diagrams/examples/deployment-release.lifecycle.json +49 -0
  31. package/ai/skills/stacks-technical-diagrams/examples/event-stream.dataflow.json +57 -0
  32. package/ai/skills/stacks-technical-diagrams/examples/incident-response.workflow.json +64 -0
  33. package/ai/skills/stacks-technical-diagrams/examples/product-analytics.dataflow.json +22 -16
  34. package/ai/skills/stacks-technical-diagrams/examples/production-deployment.architecture.json +71 -0
  35. package/ai/skills/stacks-technical-diagrams/examples/release-delivery.workflow.json +62 -0
  36. package/ai/skills/stacks-technical-diagrams/examples/web-app.architecture.json +16 -11
  37. package/ai/skills/stacks-technical-diagrams/migrations/workflow-v2.mjs +279 -0
  38. package/ai/skills/stacks-technical-diagrams/recipes/scenarios.mjs +391 -0
  39. package/ai/skills/stacks-technical-diagrams/references/authoring-contract.md +243 -0
  40. package/ai/skills/stacks-technical-diagrams/references/brand-marks.md +65 -0
  41. package/ai/skills/stacks-technical-diagrams/references/delivery-contract.md +120 -0
  42. package/ai/skills/stacks-technical-diagrams/references/viewer-runtime.md +45 -0
  43. package/ai/skills/stacks-technical-diagrams/renderers/architecture/render-architecture.mjs +780 -73
  44. package/ai/skills/stacks-technical-diagrams/renderers/dataflow/README.md +25 -3
  45. package/ai/skills/stacks-technical-diagrams/renderers/dataflow/render-dataflow.mjs +240 -52
  46. package/ai/skills/stacks-technical-diagrams/renderers/lifecycle/README.md +31 -7
  47. package/ai/skills/stacks-technical-diagrams/renderers/lifecycle/render-lifecycle.mjs +227 -50
  48. package/ai/skills/stacks-technical-diagrams/renderers/sequence/README.md +36 -6
  49. package/ai/skills/stacks-technical-diagrams/renderers/sequence/render-sequence.mjs +270 -63
  50. package/ai/skills/stacks-technical-diagrams/renderers/shared/brand-marks.mjs +563 -0
  51. package/ai/skills/stacks-technical-diagrams/renderers/shared/bun-runtime.mjs +20 -0
  52. package/ai/skills/stacks-technical-diagrams/renderers/shared/cli.mjs +186 -10
  53. package/ai/skills/stacks-technical-diagrams/renderers/shared/desktop-readability.mjs +26 -0
  54. package/ai/skills/stacks-technical-diagrams/renderers/shared/diagnostics.mjs +127 -0
  55. package/ai/skills/stacks-technical-diagrams/renderers/shared/engineering-profiles.mjs +157 -0
  56. package/ai/skills/stacks-technical-diagrams/renderers/shared/generated-brand-marks.mjs +2003 -0
  57. package/ai/skills/stacks-technical-diagrams/renderers/shared/generated-validators.mjs +3 -3
  58. package/ai/skills/stacks-technical-diagrams/renderers/shared/geometry.mjs +1195 -2
  59. package/ai/skills/stacks-technical-diagrams/renderers/shared/i18n.mjs +595 -0
  60. package/ai/skills/stacks-technical-diagrams/renderers/shared/legend.mjs +217 -0
  61. package/ai/skills/stacks-technical-diagrams/renderers/shared/output-path.mjs +340 -0
  62. package/ai/skills/stacks-technical-diagrams/renderers/shared/repository-evidence.mjs +238 -0
  63. package/ai/skills/stacks-technical-diagrams/renderers/shared/repository-location.mjs +58 -0
  64. package/ai/skills/stacks-technical-diagrams/renderers/shared/text-fit.mjs +49 -0
  65. package/ai/skills/stacks-technical-diagrams/renderers/shared/utils.mjs +163 -19
  66. package/ai/skills/stacks-technical-diagrams/renderers/shared/validator.mjs +51 -5
  67. package/ai/skills/stacks-technical-diagrams/renderers/workflow/README.md +137 -17
  68. package/ai/skills/stacks-technical-diagrams/renderers/workflow/render-workflow.mjs +24 -470
  69. package/ai/skills/stacks-technical-diagrams/renderers/workflow/workflow-compiler.mjs +4400 -0
  70. package/ai/skills/stacks-technical-diagrams/renderers/workflow/workflow-migration-geometry.mjs +144 -0
  71. package/ai/skills/stacks-technical-diagrams/schemas/README.md +154 -11
  72. package/ai/skills/stacks-technical-diagrams/schemas/architecture.schema.json +61 -4
  73. package/ai/skills/stacks-technical-diagrams/schemas/common.schema.json +72 -0
  74. package/ai/skills/stacks-technical-diagrams/schemas/dataflow.schema.json +40 -18
  75. package/ai/skills/stacks-technical-diagrams/schemas/lifecycle.schema.json +43 -18
  76. package/ai/skills/stacks-technical-diagrams/schemas/sequence.schema.json +41 -4
  77. package/ai/skills/stacks-technical-diagrams/schemas/workflow.schema.json +97 -1
  78. package/ai/skills/stacks-technical-diagrams/scripts/check-render-output.mjs +551 -12
  79. package/ai/skills/stacks-technical-diagrams/scripts/render-examples.mjs +3 -4
  80. package/ide/vscode/package.json +1 -1
  81. package/package.json +2 -2
@@ -4,7 +4,7 @@ Render `diagram_type: "workflow"` JSON files into the standalone technical diagr
4
4
  template.
5
5
 
6
6
  ```bash
7
- bun --config=.claude/skills/stacks-technical-diagrams/bunfig.toml --no-env-file .claude/skills/stacks-technical-diagrams/renderers/workflow/render-workflow.mjs input.workflow.json output.html
7
+ node .claude/skills/stacks-technical-diagrams/renderers/workflow/render-workflow.mjs input.workflow.json output.html
8
8
  ```
9
9
 
10
10
  The renderer validates input against `.claude/skills/stacks-technical-diagrams/schemas/workflow.schema.json`
@@ -16,7 +16,7 @@ or falls back to `workflow.html` in the current working directory.
16
16
  After rendering, run the artifact checker:
17
17
 
18
18
  ```bash
19
- bun --config=.claude/skills/stacks-technical-diagrams/bunfig.toml --no-env-file .claude/skills/stacks-technical-diagrams/scripts/check-render-output.mjs output.html
19
+ .claude/skills/stacks-technical-diagrams/bin/diagrams check output.html
20
20
  ```
21
21
 
22
22
  It catches final-SVG issues that are easiest to see in a browser: non-finite
@@ -29,11 +29,10 @@ Workflow JSON files must set:
29
29
 
30
30
  ```json
31
31
  {
32
- "schema_version": 1,
32
+ "schema_version": 2,
33
33
  "diagram_type": "workflow",
34
34
  "meta": {
35
- "title": "Agent Tool Call Workflow",
36
- "subtitle": "Renderer-driven workflow prototype"
35
+ "title": "Agent Tool Call Workflow"
37
36
  },
38
37
  "lanes": [],
39
38
  "phases": [],
@@ -45,10 +44,17 @@ Workflow JSON files must set:
45
44
  }
46
45
  ```
47
46
 
48
- Omit `meta.viewBox` for the common case: the width is fixed at 720 and the
49
- height is derived from the lane count, so lanes and legend always fit. A
50
- complete worked example lives at
51
- `.claude/skills/stacks-technical-diagrams/examples/agent-tool-call.workflow.json`.
47
+ Use `schema_version: 2` for new workflows. Its readable layout compiler treats
48
+ every `col` as a logical rank in `0..5` and derives geometry from the measured
49
+ document. `schema_version: 1` remains the fixed legacy contract for existing
50
+ sources; valid v1 output is preserved byte-for-byte and never silently
51
+ reinterpreted as v2.
52
+
53
+ Omit `meta.viewBox` for the common v2 case so the compiler can use intrinsic
54
+ measured bounds. In v1, the omitted width remains fixed at 720 and height is
55
+ derived from lane count. A complete worked example lives at
56
+ `.claude/skills/stacks-technical-diagrams/examples/agent-tool-call.workflow.json`; its `schema_version` selects
57
+ the applicable contract.
52
58
 
53
59
  The schema lives at:
54
60
 
@@ -56,7 +62,45 @@ The schema lives at:
56
62
  .claude/skills/stacks-technical-diagrams/schemas/workflow.schema.json
57
63
  ```
58
64
 
59
- ## Layout budget
65
+ ## Migration and layout receipt
66
+
67
+ Migrate an existing v1 source into a separate v2 file:
68
+
69
+ ```bash
70
+ .claude/skills/stacks-technical-diagrams/bin/diagrams migrate workflow old.json new.json --to-schema 2 --json
71
+ ```
72
+
73
+ Running the command again with its schema-v2 output as the new source is an
74
+ idempotent verification pass: the destination bytes and geometry stay unchanged.
75
+
76
+ The command never overwrites the source by default. It maps absolute
77
+ `via[*][0]`, `labelAt[0]`, and `channelX` values from legacy to solved rank
78
+ space, preserves y coordinates unless a reported vertical constraint needs
79
+ author input, expands an explicit viewBox only for an unambiguous containment
80
+ repair, and writes the destination only after v2 compilation and artifact
81
+ checks pass. Ambiguous explicit pins fail without producing the destination.
82
+
83
+ Inspect the stable author-facing v2 plan with:
84
+
85
+ ```bash
86
+ .claude/skills/stacks-technical-diagrams/bin/diagrams validate workflow input.workflow.json --layout-json
87
+ ```
88
+
89
+ The receipt reports the selected contract, measured `viewBox` and
90
+ `requiredViewBox`, solved columns, nodes, edges, labels, and causal diagnostics.
91
+ It deliberately omits solver iterations and candidate scores.
92
+
93
+ ## Legend
94
+
95
+ The default legend derives component kinds from `nodes[].type`. Supported
96
+ `meta.legend.entries` keys, in stable order, are `frontend`, `backend`,
97
+ `security`, `messagebus`, `database`, `cloud`, and `external`. Labels and
98
+ visibility may be overridden through the shared legend contract; only kinds
99
+ backed by rendered nodes receive Semantic Legend controls.
100
+
101
+ ## Layout contracts
102
+
103
+ ### Fixed v1
60
104
 
61
105
  | Constant | Value |
62
106
  |----------|-------|
@@ -74,8 +118,38 @@ The schema lives at:
74
118
  | Legend row | y = lane bottom + 44; viewBox height must be ≥ legend y + 18 |
75
119
 
76
120
  Column-center gaps are 132 / 80 / 130 / 70 / 125 px: columns 1↔2 (80px) and
77
- 3↔4 (70px) cannot both hold default-width 92px nodes in the same lane - skip a
78
- column or reduce `width`.
121
+ 3↔4 (70px) cannot both hold default-width 92px nodes in the same lane. Such an
122
+ invalid v1 source receives one causal `workflow/column-capacity` diagnostic and
123
+ a verified migration-to-v2 repair; v1 never falls through to adaptive layout.
124
+
125
+ ### Readable v2
126
+
127
+ | Invariant | Contract |
128
+ |----------|----------|
129
+ | Logical columns | `col` is an integer in `0..5`; pixel centers are measured output |
130
+ | Adjacent-rank baseline | 120px center distance before document-specific constraints |
131
+ | Same-lane node clearance | ≥8px when vertical node intervals overlap |
132
+ | Facing direct edge | clear gap ≥`max(28px, measured label mask width + 8px)` |
133
+ | Automatic route rhythm | direct segment ≥28px; endpoint stub ≥8px; interior turn segment ≥16px |
134
+ | Implicit viewBox | intrinsic content bounds plus contract padding |
135
+ | Explicit viewBox | containment capacity; too-small input reports exact `requiredViewBox` and contributors |
136
+
137
+ The compiler applies constraints only to actual related or overlapping
138
+ same-lane nodes, so a wide node in an unrelated lane does not expand every
139
+ rank. Legacy centers are a soft preference after correctness constraints, not
140
+ a geometry promise. Phase and group frames derive from the solved rank bands.
141
+ Automatic routes are normalized once and the same final scene drives
142
+ validation and SVG serialization. Long automatic labels compare direct-gutter
143
+ growth with a legal channel instead of widening every downstream rank. Measured
144
+ multi-row legends participate in intrinsic height and explicit viewBox
145
+ capacity.
146
+
147
+ Authored `via`, `labelAt`, `channelX`, and `channelY` are absolute hard pins in
148
+ v2; an infeasible pin returns `workflow/explicit-pin-conflict` rather than being
149
+ silently moved. `fromSide` and `toSide` remain direction constraints. A route
150
+ preset restricts the automatic candidate family but is not itself an absolute
151
+ coordinate pin. When either endpoint side is omitted, the v2 compiler chooses
152
+ a feasible side; an authored side restricts that endpoint to the named port.
79
153
 
80
154
  ## Design Rules
81
155
 
@@ -84,20 +158,66 @@ column or reduce `width`.
84
158
  - Use groups for parallel checks, branch handling, or bounded work within a lane; every group must contain at least one node.
85
159
  - Use `lane.variant: "exception"` for human wait, denial, retry, fallback, and failure lanes instead of mixing those paths into the happy path.
86
160
  - Set `mainPath` when the diagram has a clear happy path; the renderer validates that consecutive ids have matching edges and move left-to-right.
87
- - Place nodes with lane IDs and column indexes, not raw SVG coordinates.
88
- - Leave short adjacent links unlabeled; the arrow is enough.
89
- - Use labels for cross-lane decisions, approvals, async traces, and return paths.
161
+ - Place nodes with lane IDs and `col` indexes in `0..5`, not raw SVG coordinates.
162
+ - Preserve semantic edge labels. Readable v2 allocates measured label clearance;
163
+ when a label does not fit, repair the reported capacity or route constraint
164
+ instead of deleting meaning.
165
+ - Use labels for decisions, approvals, protocols, async traces, return paths,
166
+ and any other relationship meaning not fully implied by its endpoints.
90
167
  - Prefer route presets - `drop` (bend between lanes; `bias` 0-1 picks where),
91
168
  `outside-right`, `return-left`, `bottom-channel`, and `up-channel` - before
92
169
  using raw `via` points. `straight` and the default `auto` cover the rest.
93
170
  - Keep workflow examples compact enough to render well in narrow chat/browser
94
171
  previews.
95
172
 
173
+ ### Optional semantic checks
174
+
175
+ Layout validation cannot infer domain truth from labels or cards. When source
176
+ evidence establishes roots, terminals, mandatory direct relationships, or
177
+ mandatory directed reachability, encode those facts in `semanticChecks`:
178
+
179
+ ```json
180
+ "semanticChecks": {
181
+ "allowedRoots": ["request", "resource_catalog"],
182
+ "allowedTerminals": ["reply", "audit_log"],
183
+ "requiredEdges": [
184
+ { "from": "dispatch", "to": "dispatch_ledger" }
185
+ ],
186
+ "requiredPaths": [
187
+ { "from": "event_ledger", "to": "runtime_host" }
188
+ ]
189
+ }
190
+ ```
191
+
192
+ When `allowedRoots` or `allowedTerminals` is present, it is the complete allow
193
+ list for zero-incoming or zero-outgoing nodes respectively. `requiredEdges`
194
+ requires one exact authored direction; `requiredPaths` permits intermediate
195
+ nodes but follows authored edge direction. These checks run before layout, do
196
+ not alter SVG or receipt bytes, and must not be weakened merely to resolve a
197
+ route or composition diagnostic. Omit fields whose domain facts are unknown.
198
+
96
199
  Schema violations exit non-zero with path-prefixed messages annotated with the
97
200
  element's id or label. The renderer additionally fails when it can detect
98
201
  layout problems, including node overlap, nodes outside their lanes, invalid
99
202
  phase/group column ranges, empty groups, broken `mainPath` steps, unknown edge
100
203
  targets, labels colliding with nodes or other labels, labels wider than their
101
204
  node, legends outside the viewBox, or straight arrows that are too short to
102
- read cleanly. Text width is estimated CJK-aware: fullwidth glyphs count as two
103
- units.
205
+ read cleanly. The shared Clean Flow Gate also rejects edges crossing unrelated
206
+ nodes with 2px clearance; lanes, phases, and groups remain intentional
207
+ pass-through containers. Text width is estimated CJK-aware: fullwidth glyphs
208
+ count as two units.
209
+
210
+ Diagnostics are causal: a rank-capacity failure suppresses derivative short
211
+ edge, endpoint-direction, and label-overlap findings. Every
212
+ `supportedFixes[]` entry is verified by replanning the proposed edit, and a
213
+ diagnostic never proposes removing a semantic label when label presence does
214
+ not cause the failed invariant.
215
+
216
+ Set `meta.quality_profile` to `showcase` for polished delivery. Unrelated proper
217
+ X crossings then fail with `composition/proper-crossing`; default `standard`
218
+ keeps them as artifact-receipt warnings. Collinear lane corridors are outside
219
+ the proper-X rule, but a separate gate warns in `standard` and fails in
220
+ `showcase` when unrelated edges overlap for at least 8px. Shared semantic
221
+ endpoints, point touches, and shorter overlaps remain valid. Showcase also
222
+ rejects any route segment below 8px and any interior turn segment below 16px;
223
+ ordinary 8-15px endpoint stubs remain valid for fixed lane gaps.