dsh-knowhub 0.9.0 → 0.10.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 (195) hide show
  1. package/README.md +11 -2
  2. package/cordis.patch.yml +10 -0
  3. package/lib/host/model.js +1 -1
  4. package/lib/host/pipeline/incremental.js +3 -3
  5. package/lib/host/pipeline/initialize.js +144 -27
  6. package/lib/host/pipeline/model-output.js +2 -2
  7. package/package.json +3 -2
  8. package/skills/archify/LICENSE +202 -0
  9. package/skills/archify/LICENSE-MIT +22 -0
  10. package/skills/archify/NOTICE +26 -0
  11. package/skills/archify/SKILL.md +137 -0
  12. package/skills/archify/THIRD_PARTY_NOTICES.md +78 -0
  13. package/skills/archify/assets/JetBrainsMono-OFL.txt +93 -0
  14. package/skills/archify/assets/template.html +14768 -0
  15. package/skills/archify/bin/archify.mjs +7289 -0
  16. package/skills/archify/bin/delivery-update.mjs +92 -0
  17. package/skills/archify/bin/finalize.mjs +1055 -0
  18. package/skills/archify/bin/open-artifact.mjs +146 -0
  19. package/skills/archify/bin/preview.mjs +970 -0
  20. package/skills/archify/bin/recover-output.mjs +41 -0
  21. package/skills/archify/bin/visual-check.mjs +2780 -0
  22. package/skills/archify/brand-marks/README.md +31 -0
  23. package/skills/archify/brand-marks/catalog.json +131 -0
  24. package/skills/archify/delta/architecture-delta.mjs +1318 -0
  25. package/skills/archify/examples/agent-run.lifecycle.json +55 -0
  26. package/skills/archify/examples/agent-tool-call.workflow.json +74 -0
  27. package/skills/archify/examples/archify-dev-activity.timeline.json +176 -0
  28. package/skills/archify/examples/archify-repository.tree.json +197 -0
  29. package/skills/archify/examples/async-job-roundtrip.sequence.json +56 -0
  30. package/skills/archify/examples/brand-aware-delivery.architecture.json +34 -0
  31. package/skills/archify/examples/cache-miss-request.sequence.json +77 -0
  32. package/skills/archify/examples/checkout-platform.base.architecture.json +32 -0
  33. package/skills/archify/examples/checkout-platform.head.architecture.json +32 -0
  34. package/skills/archify/examples/checkout-request.waterfall.json +20 -0
  35. package/skills/archify/examples/delivery.explainer.json +155 -0
  36. package/skills/archify/examples/deployment-release.lifecycle.json +72 -0
  37. package/skills/archify/examples/event-stream.dataflow.json +52 -0
  38. package/skills/archify/examples/example-rebuild.waterfall.json +212 -0
  39. package/skills/archify/examples/holiday-planning.workflow.json +143 -0
  40. package/skills/archify/examples/incident-response.workflow.json +59 -0
  41. package/skills/archify/examples/locales/de.json +463 -0
  42. package/skills/archify/examples/locales/fr.json +463 -0
  43. package/skills/archify/examples/locales/fr.partial.json +22 -0
  44. package/skills/archify/examples/locales/it.json +463 -0
  45. package/skills/archify/examples/locales/ja.json +463 -0
  46. package/skills/archify/examples/locales/pt.json +463 -0
  47. package/skills/archify/examples/locales/ru.json +463 -0
  48. package/skills/archify/examples/orders.erd.json +337 -0
  49. package/skills/archify/examples/payment-incident.timeline.json +24 -0
  50. package/skills/archify/examples/payment-platform.tree.json +22 -0
  51. package/skills/archify/examples/payment-processors.class.json +177 -0
  52. package/skills/archify/examples/payments.class.json +85 -0
  53. package/skills/archify/examples/product-analytics.dataflow.json +71 -0
  54. package/skills/archify/examples/production-deployment.architecture.json +51 -0
  55. package/skills/archify/examples/release-delivery.workflow.json +57 -0
  56. package/skills/archify/examples/subscription-billing.erd.json +548 -0
  57. package/skills/archify/examples/web-app.architecture.json +41 -0
  58. package/skills/archify/explainer/browser-check.mjs +208 -0
  59. package/skills/archify/explainer/charts.mjs +70 -0
  60. package/skills/archify/explainer/check.mjs +167 -0
  61. package/skills/archify/explainer/diagrams.mjs +517 -0
  62. package/skills/archify/explainer/diff.mjs +124 -0
  63. package/skills/archify/explainer/inline.mjs +155 -0
  64. package/skills/archify/explainer/layout.mjs +35 -0
  65. package/skills/archify/explainer/page-bundle.mjs +16 -0
  66. package/skills/archify/explainer/parse.mjs +300 -0
  67. package/skills/archify/explainer/patch.mjs +117 -0
  68. package/skills/archify/explainer/prepare.mjs +131 -0
  69. package/skills/archify/explainer/reader.css +472 -0
  70. package/skills/archify/explainer/reader.js +666 -0
  71. package/skills/archify/explainer/render.mjs +224 -0
  72. package/skills/archify/explainer/revision.mjs +20 -0
  73. package/skills/archify/explainer/sources.mjs +318 -0
  74. package/skills/archify/explainer/validate.mjs +138 -0
  75. package/skills/archify/explainer/vendor/pele/LICENSE +40 -0
  76. package/skills/archify/explainer/vendor/pele/README.md +5 -0
  77. package/skills/archify/explainer/vendor/pele/chunks/3DKXF73K.js +4 -0
  78. package/skills/archify/explainer/vendor/pele/chunks/42UTT654.js +3 -0
  79. package/skills/archify/explainer/vendor/pele/chunks/DKTLEL5E.js +1 -0
  80. package/skills/archify/explainer/vendor/pele/chunks/EEIX5ZYH.js +2 -0
  81. package/skills/archify/explainer/vendor/pele/chunks/EJ5KOXYD.js +25 -0
  82. package/skills/archify/explainer/vendor/pele/chunks/GUJTEFZK.js +1 -0
  83. package/skills/archify/explainer/vendor/pele/chunks/IZOKQ2GT.js +4 -0
  84. package/skills/archify/explainer/vendor/pele/chunks/L4LY553T.js +3 -0
  85. package/skills/archify/explainer/vendor/pele/chunks/MSKIJHB2.js +2 -0
  86. package/skills/archify/explainer/vendor/pele/chunks/RVARI57O.js +1 -0
  87. package/skills/archify/explainer/vendor/pele/chunks/UKSIWDDN.js +2 -0
  88. package/skills/archify/explainer/vendor/pele/chunks/UPTXNAXN.js +2 -0
  89. package/skills/archify/explainer/vendor/pele/chunks/XTDUIGUI.js +9 -0
  90. package/skills/archify/explainer/vendor/pele/chunks/YAYTP6L5.js +9 -0
  91. package/skills/archify/explainer/vendor/pele/core.js +1 -0
  92. package/skills/archify/explainer/vendor/pele/diagrams/pie.js +1 -0
  93. package/skills/archify/explainer/vendor/pele/diagrams/quadrantChart.js +1 -0
  94. package/skills/archify/explainer/vendor/pele/diagrams/radar.js +1 -0
  95. package/skills/archify/explainer/vendor/pele/diagrams/sankey.js +1 -0
  96. package/skills/archify/explainer/vendor/pele/diagrams/venn.js +1 -0
  97. package/skills/archify/explainer/vendor/pele/diagrams/xychart.js +1 -0
  98. package/skills/archify/explainer/writing.mjs +139 -0
  99. package/skills/archify/locales/README.md +40 -0
  100. package/skills/archify/locales/ar.json +488 -0
  101. package/skills/archify/locales/en.json +488 -0
  102. package/skills/archify/locales/es.json +488 -0
  103. package/skills/archify/locales/ko.json +488 -0
  104. package/skills/archify/locales/manifest.json +10 -0
  105. package/skills/archify/locales/zh-CN.json +488 -0
  106. package/skills/archify/locales/zh-TW.json +488 -0
  107. package/skills/archify/migrations/workflow-v2.mjs +280 -0
  108. package/skills/archify/package.json +17 -0
  109. package/skills/archify/recipes/scenarios.mjs +455 -0
  110. package/skills/archify/references/architecture-layout-repair.md +18 -0
  111. package/skills/archify/references/authoring-contract.md +645 -0
  112. package/skills/archify/references/authoring-defaults.md +57 -0
  113. package/skills/archify/references/brand-marks.md +119 -0
  114. package/skills/archify/references/delivery-contract.md +665 -0
  115. package/skills/archify/references/explainer-authoring.md +274 -0
  116. package/skills/archify/references/repository-authoring.md +126 -0
  117. package/skills/archify/references/update-awareness.md +13 -0
  118. package/skills/archify/references/viewer-runtime.md +52 -0
  119. package/skills/archify/renderers/architecture/grid.mjs +62 -0
  120. package/skills/archify/renderers/architecture/labels.mjs +2 -0
  121. package/skills/archify/renderers/architecture/render-architecture.mjs +1204 -0
  122. package/skills/archify/renderers/architecture/routing.mjs +1469 -0
  123. package/skills/archify/renderers/class/README.md +130 -0
  124. package/skills/archify/renderers/class/render-class.mjs +1095 -0
  125. package/skills/archify/renderers/dataflow/README.md +176 -0
  126. package/skills/archify/renderers/dataflow/dataflow-compiler.mjs +1605 -0
  127. package/skills/archify/renderers/dataflow/joint-label-routing.mjs +165 -0
  128. package/skills/archify/renderers/dataflow/label-capacity.mjs +81 -0
  129. package/skills/archify/renderers/dataflow/render-dataflow.mjs +23 -0
  130. package/skills/archify/renderers/erd/README.md +246 -0
  131. package/skills/archify/renderers/erd/grid.mjs +150 -0
  132. package/skills/archify/renderers/erd/render-erd.mjs +1588 -0
  133. package/skills/archify/renderers/explainer/render-explainer.mjs +42 -0
  134. package/skills/archify/renderers/lifecycle/README.md +104 -0
  135. package/skills/archify/renderers/lifecycle/render-lifecycle.mjs +1134 -0
  136. package/skills/archify/renderers/sequence/README.md +146 -0
  137. package/skills/archify/renderers/sequence/render-sequence.mjs +1105 -0
  138. package/skills/archify/renderers/shared/atomic-output.mjs +1982 -0
  139. package/skills/archify/renderers/shared/automatic-labels.mjs +290 -0
  140. package/skills/archify/renderers/shared/brand-marks.mjs +706 -0
  141. package/skills/archify/renderers/shared/cli.mjs +430 -0
  142. package/skills/archify/renderers/shared/desktop-readability.mjs +132 -0
  143. package/skills/archify/renderers/shared/diagnostics.mjs +0 -0
  144. package/skills/archify/renderers/shared/engineering-profiles.mjs +157 -0
  145. package/skills/archify/renderers/shared/generated-brand-marks.mjs +2003 -0
  146. package/skills/archify/renderers/shared/generated-validators.mjs +279 -0
  147. package/skills/archify/renderers/shared/geometry.mjs +2073 -0
  148. package/skills/archify/renderers/shared/i18n.mjs +328 -0
  149. package/skills/archify/renderers/shared/layout-report.mjs +57 -0
  150. package/skills/archify/renderers/shared/legend.mjs +227 -0
  151. package/skills/archify/renderers/shared/node-card-style.mjs +32 -0
  152. package/skills/archify/renderers/shared/output-path.mjs +440 -0
  153. package/skills/archify/renderers/shared/owned-temp-directory.mjs +82 -0
  154. package/skills/archify/renderers/shared/path-semantics.mjs +1017 -0
  155. package/skills/archify/renderers/shared/portable-path.mjs +408 -0
  156. package/skills/archify/renderers/shared/repository-evidence.mjs +394 -0
  157. package/skills/archify/renderers/shared/repository-location.mjs +71 -0
  158. package/skills/archify/renderers/shared/route-quality.mjs +670 -0
  159. package/skills/archify/renderers/shared/sidecar-path.mjs +38 -0
  160. package/skills/archify/renderers/shared/software-notices.mjs +6 -0
  161. package/skills/archify/renderers/shared/spatial-grid.mjs +66 -0
  162. package/skills/archify/renderers/shared/svg-path-analysis.mjs +135 -0
  163. package/skills/archify/renderers/shared/text-fit.mjs +105 -0
  164. package/skills/archify/renderers/shared/utils.mjs +260 -0
  165. package/skills/archify/renderers/shared/validator.mjs +83 -0
  166. package/skills/archify/renderers/timeline/README.md +76 -0
  167. package/skills/archify/renderers/timeline/render-timeline.mjs +576 -0
  168. package/skills/archify/renderers/tree/README.md +96 -0
  169. package/skills/archify/renderers/tree/render-tree.mjs +573 -0
  170. package/skills/archify/renderers/waterfall/README.md +73 -0
  171. package/skills/archify/renderers/waterfall/render-waterfall.mjs +413 -0
  172. package/skills/archify/renderers/workflow/README.md +337 -0
  173. package/skills/archify/renderers/workflow/render-workflow.mjs +47 -0
  174. package/skills/archify/renderers/workflow/workflow-compiler.mjs +5920 -0
  175. package/skills/archify/renderers/workflow/workflow-migration-geometry.mjs +161 -0
  176. package/skills/archify/renderers/workflow/workflow-placement-repair.mjs +94 -0
  177. package/skills/archify/schemas/README.md +258 -0
  178. package/skills/archify/schemas/architecture.schema.json +152 -0
  179. package/skills/archify/schemas/class.schema.json +345 -0
  180. package/skills/archify/schemas/common.schema.json +181 -0
  181. package/skills/archify/schemas/dataflow.schema.json +254 -0
  182. package/skills/archify/schemas/erd.schema.json +381 -0
  183. package/skills/archify/schemas/explainer.schema.json +927 -0
  184. package/skills/archify/schemas/lifecycle.schema.json +179 -0
  185. package/skills/archify/schemas/sequence.schema.json +234 -0
  186. package/skills/archify/schemas/timeline.schema.json +160 -0
  187. package/skills/archify/schemas/tree.schema.json +141 -0
  188. package/skills/archify/schemas/waterfall.schema.json +147 -0
  189. package/skills/archify/schemas/workflow.schema.json +439 -0
  190. package/skills/archify/scripts/check-render-output.mjs +1469 -0
  191. package/skills/archify/scripts/check-update.mjs +1717 -0
  192. package/skills/archify/scripts/delivery-update-child.mjs +26 -0
  193. package/skills/archify/scripts/render-examples.mjs +36 -0
  194. package/skills/archify/scripts/update-contract.mjs +187 -0
  195. package/skills/archify/skill-release.json +10 -0
@@ -0,0 +1,83 @@
1
+ import * as validators from './generated-validators.mjs';
2
+ import { throwDiagnosticError } from './diagnostics.mjs';
3
+
4
+ // "/nodes/3/label" reads much better as "/nodes/3 (id: "router") /label" for the
5
+ // LLM fixing the JSON; resolve the nearest enclosing element's id or label.
6
+ function annotatedPath(instancePath, data) {
7
+ if (!instancePath) return { path: '/', identity: null };
8
+ let node = data;
9
+ let hint = null;
10
+ for (const seg of instancePath.split('/').slice(1)) {
11
+ if (node == null || typeof node !== 'object') break;
12
+ node = node[/^\d+$/.test(seg) ? Number(seg) : seg];
13
+ if (node && typeof node === 'object' && !Array.isArray(node)) {
14
+ const tag = node.id ?? node.label;
15
+ if (tag != null) hint = String(tag);
16
+ }
17
+ }
18
+ return { path: instancePath, identity: hint };
19
+ }
20
+
21
+ function annotatePath(instancePath, data) {
22
+ const annotated = annotatedPath(instancePath, data);
23
+ return annotated.identity != null
24
+ ? `${annotated.path} (id/label: ${JSON.stringify(annotated.identity)})`
25
+ : annotated.path;
26
+ }
27
+
28
+ function formatErrors(errors, data) {
29
+ return errors.map((e) => {
30
+ const where = annotatePath(e.instancePath, data);
31
+ const detail = e.params && Object.keys(e.params).length
32
+ ? ' ' + JSON.stringify(e.params)
33
+ : '';
34
+ return ` ${where} ${e.message}${detail}`;
35
+ }).join('\n');
36
+ }
37
+
38
+ export function validateSchema(diagramType, data) {
39
+ const validate = validators[diagramType];
40
+ if (!validate) {
41
+ throw new Error(`validateSchema: unknown diagram type "${diagramType}"`);
42
+ }
43
+ if (!validate(data)) {
44
+ const diagnostics = validate.errors.map((error) => {
45
+ const annotated = annotatedPath(error.instancePath, data);
46
+ const subject = {
47
+ diagramType,
48
+ path: annotated.path,
49
+ ...(annotated.identity != null ? { identity: String(annotated.identity) } : {}),
50
+ };
51
+ const evidence = {
52
+ keyword: error.keyword,
53
+ expected: error.schema,
54
+ ...error.params,
55
+ };
56
+ const supportedFixes = {
57
+ additionalProperties: [`remove unsupported property ${JSON.stringify(error.params?.additionalProperty)}`],
58
+ required: [`add required property ${JSON.stringify(error.params?.missingProperty)}`],
59
+ type: [`use ${JSON.stringify(error.params?.type)} at ${annotated.path}`],
60
+ enum: [`choose one of the allowed values`],
61
+ pattern: [`match the required pattern ${JSON.stringify(error.params?.pattern)}`],
62
+ minimum: [`use a value ${error.params?.comparison || '>='} ${error.params?.limit}`],
63
+ maximum: [`use a value ${error.params?.comparison || '<='} ${error.params?.limit}`],
64
+ minItems: [`provide at least ${error.params?.limit} item(s)`],
65
+ maxItems: [`provide at most ${error.params?.limit} item(s)`],
66
+ minLength: [`provide at least ${error.params?.limit} character(s)`],
67
+ maxLength: [`provide at most ${error.params?.limit} character(s)`],
68
+ }[error.keyword] || [];
69
+ return {
70
+ code: `schema/${error.keyword}`,
71
+ severity: 'error',
72
+ message: `${annotatePath(error.instancePath, data)} ${error.message}`,
73
+ subject,
74
+ evidence,
75
+ supportedFixes,
76
+ };
77
+ });
78
+ throwDiagnosticError(
79
+ `${diagramType} schema validation failed:\n${formatErrors(validate.errors, data)}`,
80
+ diagnostics,
81
+ );
82
+ }
83
+ }
@@ -0,0 +1,76 @@
1
+ # Event Timeline Renderer
2
+
3
+ Render `diagram_type: "timeline"` JSON files into the standard Archify HTML template.
4
+
5
+ ```bash
6
+ node archify/renderers/timeline/render-timeline.mjs input.timeline.json output.html
7
+ ```
8
+
9
+ `--layout-json` prints the axis segments, breaks, ticks, lanes, and placed
10
+ events (with their millisecond timestamps and x positions) instead of HTML.
11
+
12
+ ## Input
13
+
14
+ ```json
15
+ {
16
+ "schema_version": 1,
17
+ "diagram_type": "timeline",
18
+ "meta": { "title": "Payment failure incident", "evidence": "illustrative", "timezone": "Asia/Shanghai" },
19
+ "lanes": [{ "id": "release", "label": "Release" }],
20
+ "events": [{ "id": "deploy", "at": "2026-10-01T10:00:00+08:00", "title": "Deploy v2.4", "lane": "release" }]
21
+ }
22
+ ```
23
+
24
+ - `at` is ISO 8601 with an explicit `Z` or `±HH:MM` offset (schema). An
25
+ impossible date fails `timeline/invalid-timestamp`.
26
+ - `meta.timezone` is an IANA zone (default `UTC`) used for every tick and label;
27
+ ticks fall on that zone's wall clock, so a `+05:30` zone ticks on its own
28
+ hours. An unknown zone fails `timeline/invalid-timezone`.
29
+ - Across timezone-offset changes, daily ticks stay at local midnight and hourly
30
+ ticks use real local instants. Both occurrences of a repeated hour remain;
31
+ skipped hours or dates do not invent ticks. Event timestamps and proportional
32
+ elapsed-time spacing are unchanged, so consecutive daily ticks can be 23 or 25
33
+ hours apart. The existing label filter still hides text that does not fit.
34
+ - 夏令时和时区调整不会把刻度固定在时间段起点的 UTC 偏移上:日刻度保持当地
35
+ 午夜,小时刻度仅对应真实存在的当地时刻。回拨产生的两个相同墙钟时刻都保留;
36
+ 跳过的小时或整天不补造刻度。事件时间与轴上的实际时间距离不变,因此相邻
37
+ 日刻度之间可以是 23 或 25 小时;空间不足的刻度文字仍按原有规则隐藏。
38
+ - `meta.evidence` (`observed` or `illustrative`) is required and drawn as a
39
+ badge at the top-left of the canvas.
40
+ - With `lanes`, every event names a declared lane (`timeline/unknown-lane`).
41
+ `detail` appears in the Semantic Passport; `kind` (`change`, `alert`,
42
+ `action`, `recovery`) colours the card and adds a legend entry.
43
+
44
+ ## Axis
45
+
46
+ Events are sorted by time (ties keep authored order). x is linear in time with
47
+ one scale for the whole diagram; every lane shares the same axis, so one
48
+ instant has one x in every lane, whatever offset each timestamp was written in.
49
+
50
+ `layout.breaks: "auto"` (default) compresses a quiet period longer than 8× the
51
+ median gap between distinct timestamps and 10% of the span (at most the eight
52
+ longest that fit while preserving room for proportional time). A break is a
53
+ fixed-width hatched band with a zig-zag on the axis and
54
+ the omitted duration (`≈ 1 d 11 h`); the axis caption states how many periods
55
+ were compressed, and each break carries `data-break-ms` and an accessible label.
56
+ Inside each segment the scale is the same constant, so distances there remain
57
+ exact. `layout.breaks: "none"` draws one proportional axis. `layout.width`
58
+ (default 960) is the axis width.
59
+
60
+ ## Cards
61
+
62
+ Each event is a dot on its lane line plus a card with its exact time and title.
63
+ Cards are centred on their instant and sit on either side of the lane line,
64
+ packed into rows outward from it: each takes whichever side lets it sit closest
65
+ to the line without touching an earlier card (ties go below), so simultaneous
66
+ and close events stack instead of overprinting and a burst spreads both ways.
67
+ Stems are drawn behind every card, and every dot sits on one shared halo layer, so events seconds apart merge into one outlined capsule. A card is a quiet surface with a tone accent
68
+ for its kind. Titles wrap between words. On a multi-day axis a tick names its
69
+ date only when the date changes.
70
+
71
+ ## Tested size
72
+
73
+ `examples/archify-dev-activity.timeline.json` is observed data (20 tag and
74
+ merge timestamps from this repository's `origin/dev`, including events 19 s
75
+ apart, a `+05:30` committer offset, and five compressed quiet periods). It
76
+ renders in about 0.3s and passes the showcase gates.