@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
@@ -0,0 +1,279 @@
1
+ import { compileWorkflow } from '../renderers/workflow/workflow-compiler.mjs';
2
+ import {
3
+ createMappedWorkflowCandidate,
4
+ intrinsicWorkflow,
5
+ planningWorkflow,
6
+ } from '../renderers/workflow/workflow-migration-geometry.mjs';
7
+ import { validateSchema } from '../renderers/shared/validator.mjs';
8
+
9
+ export { createHorizontalRankMapper } from '../renderers/workflow/workflow-migration-geometry.mjs';
10
+
11
+ const TARGET_SCHEMA_VERSION = 2;
12
+
13
+ function clone(value) {
14
+ return JSON.parse(JSON.stringify(value));
15
+ }
16
+
17
+ function diagnostic({ code, message, subject = {}, evidence = {}, supportedFixes = [] }) {
18
+ return {
19
+ code,
20
+ severity: 'error',
21
+ message,
22
+ subject,
23
+ evidence,
24
+ supportedFixes,
25
+ };
26
+ }
27
+
28
+ function schemaDiagnostics(workflow) {
29
+ try {
30
+ validateSchema('workflow', workflow);
31
+ return [];
32
+ } catch (error) {
33
+ if (Array.isArray(error?.archifyDiagnostics)) {
34
+ return error.archifyDiagnostics.map((entry) => ({ ...entry }));
35
+ }
36
+ throw error;
37
+ }
38
+ }
39
+
40
+ function legacyLayoutProbe(workflow, qualityProfile) {
41
+ // The probe discovers fixed-v1 rank centers, not authored canvas capacity.
42
+ // Omitting viewBox lets a capacity-only legacy failure reach the v2 compiler,
43
+ // which can measure and monotonically expand the real migrated document.
44
+ const probe = {
45
+ schema_version: 1,
46
+ diagram_type: 'workflow',
47
+ meta: {
48
+ title: workflow.meta.title,
49
+ ...(workflow.meta.locale ? { locale: workflow.meta.locale } : {}),
50
+ legend: { mode: 'hidden' },
51
+ },
52
+ lanes: clone(workflow.lanes),
53
+ nodes: [{
54
+ id: 'migration_probe',
55
+ lane: workflow.lanes[0].id,
56
+ col: 0,
57
+ type: 'backend',
58
+ label: 'Probe',
59
+ }],
60
+ edges: [],
61
+ };
62
+ return compileWorkflow({ workflow: probe, qualityProfile });
63
+ }
64
+
65
+ function legacyRequirementProbe(workflow, qualityProfile) {
66
+ // Measure the complete fixed-v1 document without treating an authored
67
+ // viewBox as its intrinsic requirement. The authored viewBox remains a
68
+ // migration capacity and is preserved separately on the migrated document.
69
+ const probe = clone(workflow);
70
+ delete probe.meta.viewBox;
71
+ return compileWorkflow({ workflow: probe, qualityProfile });
72
+ }
73
+
74
+ function requiredViewBoxFrom(result) {
75
+ if (Array.isArray(result?.receipt?.requiredViewBox)) {
76
+ return [...result.receipt.requiredViewBox];
77
+ }
78
+ const required = result?.diagnostics
79
+ ?.map((entry) => entry?.evidence?.requiredViewBox)
80
+ .find((candidate) => Array.isArray(candidate) && candidate.length === 2);
81
+ return required ? [...required] : null;
82
+ }
83
+
84
+ function expandableViewBox(result) {
85
+ if (result.ok || !result.diagnostics?.length) return null;
86
+ if (!result.diagnostics.every((entry) => entry.code === 'workflow/viewbox-capacity')) return null;
87
+ return requiredViewBoxFrom(result);
88
+ }
89
+
90
+ function result({
91
+ ok,
92
+ document,
93
+ fromSchemaVersion = 1,
94
+ preExistingDiagnostics = [],
95
+ migrationDiagnostics = [],
96
+ newSchemaDiagnostics = [],
97
+ changedCoordinates = [],
98
+ oldRequiredViewBox = null,
99
+ newRequiredViewBox = null,
100
+ }) {
101
+ return {
102
+ ok,
103
+ ...(document ? { document } : {}),
104
+ fromSchemaVersion,
105
+ toSchemaVersion: TARGET_SCHEMA_VERSION,
106
+ preExistingDiagnostics,
107
+ migrationDiagnostics,
108
+ newSchemaDiagnostics,
109
+ changedCoordinates,
110
+ oldRequiredViewBox,
111
+ newRequiredViewBox,
112
+ };
113
+ }
114
+
115
+ export function migrateWorkflowDocument(inputWorkflow) {
116
+ if (!inputWorkflow || typeof inputWorkflow !== 'object' || Array.isArray(inputWorkflow)) {
117
+ return result({
118
+ ok: false,
119
+ migrationDiagnostics: [diagnostic({
120
+ code: 'migration/source-document',
121
+ message: 'Workflow migration requires one parsed JSON object.',
122
+ supportedFixes: ['provide one workflow schema v1 JSON document'],
123
+ })],
124
+ });
125
+ }
126
+ // Migration has no quality override: the authored policy (or effective
127
+ // standard default) must validate the document after it leaves this process.
128
+ const qualityProfile = inputWorkflow.meta?.quality_profile || 'standard';
129
+
130
+ const workflow = clone(inputWorkflow);
131
+ const preExistingDiagnostics = schemaDiagnostics(workflow);
132
+ if (preExistingDiagnostics.length) {
133
+ return result({
134
+ ok: false,
135
+ fromSchemaVersion: workflow.schema_version,
136
+ preExistingDiagnostics,
137
+ });
138
+ }
139
+ if (workflow.schema_version === TARGET_SCHEMA_VERSION) {
140
+ const compiled = compileWorkflow({ workflow: clone(workflow), qualityProfile });
141
+ const requiredViewBox = requiredViewBoxFrom(compiled);
142
+ if (!compiled.ok) {
143
+ return result({
144
+ ok: false,
145
+ fromSchemaVersion: TARGET_SCHEMA_VERSION,
146
+ preExistingDiagnostics: compiled.diagnostics,
147
+ oldRequiredViewBox: requiredViewBox,
148
+ newRequiredViewBox: requiredViewBox,
149
+ });
150
+ }
151
+ return result({
152
+ ok: true,
153
+ document: workflow,
154
+ fromSchemaVersion: TARGET_SCHEMA_VERSION,
155
+ oldRequiredViewBox: requiredViewBox,
156
+ newRequiredViewBox: requiredViewBox,
157
+ });
158
+ }
159
+ if (workflow.schema_version !== 1) {
160
+ return result({
161
+ ok: false,
162
+ fromSchemaVersion: workflow.schema_version,
163
+ migrationDiagnostics: [diagnostic({
164
+ code: 'migration/source-schema-version',
165
+ message: 'Workflow migration to schema v2 requires a schema v1 or v2 source.',
166
+ subject: { path: '/schema_version' },
167
+ evidence: { actual: workflow.schema_version, expected: [1, 2] },
168
+ supportedFixes: ['use an unchanged schema v1 workflow or an already migrated schema v2 workflow as the source'],
169
+ })],
170
+ });
171
+ }
172
+
173
+ const legacy = compileWorkflow({ workflow: clone(workflow), qualityProfile });
174
+ const legacyProbe = legacyLayoutProbe(workflow, qualityProfile);
175
+ if (!legacyProbe.ok) {
176
+ return result({
177
+ ok: false,
178
+ preExistingDiagnostics: legacy.ok ? [] : legacy.diagnostics,
179
+ migrationDiagnostics: legacyProbe.diagnostics,
180
+ });
181
+ }
182
+ const legacyRequirement = legacyRequirementProbe(workflow, qualityProfile);
183
+ const oldRequiredViewBox = requiredViewBoxFrom(legacyRequirement)
184
+ || requiredViewBoxFrom(legacyProbe)
185
+ || requiredViewBoxFrom(legacy);
186
+ const preExistingLayoutDiagnostics = legacy.ok ? [] : legacy.diagnostics;
187
+
188
+ let planned = compileWorkflow({ workflow: intrinsicWorkflow(workflow), qualityProfile });
189
+ if (!planned.ok) {
190
+ // Old absolute pins can be invalid at the new rank centers before their X
191
+ // coordinates are mapped. Obtain the same rank plan from an automatic-route
192
+ // projection, then validate every authored pin again after mapping.
193
+ planned = compileWorkflow({ workflow: planningWorkflow(workflow), qualityProfile });
194
+ }
195
+ if (!planned.ok) {
196
+ return result({
197
+ ok: false,
198
+ preExistingDiagnostics: preExistingLayoutDiagnostics,
199
+ newSchemaDiagnostics: planned.diagnostics,
200
+ oldRequiredViewBox,
201
+ newRequiredViewBox: requiredViewBoxFrom(planned),
202
+ });
203
+ }
204
+
205
+ let mappedCandidate;
206
+ try {
207
+ mappedCandidate = createMappedWorkflowCandidate(
208
+ workflow,
209
+ legacyProbe.receipt.columns,
210
+ planned.receipt.columns,
211
+ );
212
+ } catch (error) {
213
+ return result({
214
+ ok: false,
215
+ preExistingDiagnostics: preExistingLayoutDiagnostics,
216
+ migrationDiagnostics: [diagnostic({
217
+ code: 'migration/rank-mapping',
218
+ message: 'Could not construct a stable horizontal rank mapping.',
219
+ evidence: { reason: error.message },
220
+ supportedFixes: ['report the workflow and compiler receipts to the Archify maintainers'],
221
+ })],
222
+ oldRequiredViewBox,
223
+ newRequiredViewBox: requiredViewBoxFrom(planned),
224
+ });
225
+ }
226
+
227
+ const { document: migrated, changedCoordinates } = mappedCandidate;
228
+
229
+ let compiled = compileWorkflow({ workflow: migrated, qualityProfile });
230
+ const requiredExpansion = migrated.meta.viewBox ? expandableViewBox(compiled) : null;
231
+ if (requiredExpansion) {
232
+ const current = migrated.meta.viewBox;
233
+ const expanded = [
234
+ Math.max(current[0], requiredExpansion[0]),
235
+ Math.max(current[1], requiredExpansion[1]),
236
+ ];
237
+ if (expanded[0] > current[0] || expanded[1] > current[1]) {
238
+ migrated.meta.viewBox = expanded;
239
+ compiled = compileWorkflow({ workflow: migrated, qualityProfile });
240
+ }
241
+ }
242
+
243
+ const newRequiredViewBox = requiredViewBoxFrom(compiled) || requiredViewBoxFrom(planned);
244
+ if (!compiled.ok) {
245
+ return result({
246
+ ok: false,
247
+ preExistingDiagnostics: preExistingLayoutDiagnostics,
248
+ newSchemaDiagnostics: compiled.diagnostics,
249
+ changedCoordinates,
250
+ oldRequiredViewBox,
251
+ newRequiredViewBox,
252
+ });
253
+ }
254
+
255
+ const migratedSchemaDiagnostics = schemaDiagnostics(migrated);
256
+ if (migratedSchemaDiagnostics.length) {
257
+ return result({
258
+ ok: false,
259
+ preExistingDiagnostics: preExistingLayoutDiagnostics,
260
+ newSchemaDiagnostics: migratedSchemaDiagnostics,
261
+ changedCoordinates,
262
+ oldRequiredViewBox,
263
+ newRequiredViewBox,
264
+ });
265
+ }
266
+
267
+ return result({
268
+ ok: true,
269
+ document: migrated,
270
+ preExistingDiagnostics: preExistingLayoutDiagnostics,
271
+ changedCoordinates,
272
+ oldRequiredViewBox,
273
+ newRequiredViewBox,
274
+ });
275
+ }
276
+
277
+ export function serializeMigratedWorkflow(workflow) {
278
+ return `${JSON.stringify(workflow, null, 2)}\n`;
279
+ }