dsh-model-everything 0.4.1 → 0.5.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 (78) hide show
  1. package/README.en-US.md +63 -19
  2. package/README.md +373 -345
  3. package/cordis.patch.yml +9 -0
  4. package/diagram/package.json +5 -0
  5. package/lib/client.js +1273 -0
  6. package/lib/diagram-diff-tool.js +90 -0
  7. package/lib/diagram-render-tool.js +102 -0
  8. package/lib/diagram-review-tool.js +99 -0
  9. package/lib/diagram.js +43 -0
  10. package/lib/gate.js +14 -12
  11. package/lib/presentation.js +10 -0
  12. package/lib/render/budget.js +99 -0
  13. package/lib/render/collapse.js +163 -0
  14. package/lib/render/diff.js +138 -0
  15. package/lib/render/from-mermaid.js +211 -0
  16. package/lib/render/from-plantuml.js +158 -0
  17. package/lib/render/index.js +42 -0
  18. package/lib/render/layout.js +52 -0
  19. package/lib/render/model.js +17 -0
  20. package/lib/render/paint.js +194 -0
  21. package/lib/render/palette.js +127 -0
  22. package/lib/render/place.js +210 -0
  23. package/lib/render/svg.js +107 -0
  24. package/lib/render/viewmodel.js +126 -0
  25. package/lib/render/write.js +14 -0
  26. package/lib/scan.js +248 -8
  27. package/lib/structure-tool.js +2 -2
  28. package/lib/types/client.d.ts +83 -0
  29. package/lib/types/diagram-diff-tool.d.ts +8 -0
  30. package/lib/types/diagram-render-tool.d.ts +8 -0
  31. package/lib/types/diagram-review-tool.d.ts +8 -0
  32. package/lib/types/diagram.d.ts +34 -0
  33. package/lib/types/presentation.d.ts +7 -0
  34. package/lib/types/render/budget.d.ts +55 -0
  35. package/lib/types/render/collapse.d.ts +23 -0
  36. package/lib/types/render/diff.d.ts +44 -0
  37. package/lib/types/render/from-mermaid.d.ts +27 -0
  38. package/lib/types/render/from-plantuml.d.ts +27 -0
  39. package/lib/types/render/index.d.ts +38 -0
  40. package/lib/types/render/layout.d.ts +22 -0
  41. package/lib/types/render/model.d.ts +56 -0
  42. package/lib/types/render/paint.d.ts +94 -0
  43. package/lib/types/render/palette.d.ts +41 -0
  44. package/lib/types/render/place.d.ts +39 -0
  45. package/lib/types/render/svg.d.ts +19 -0
  46. package/lib/types/render/viewmodel.d.ts +20 -0
  47. package/lib/types/render/write.d.ts +14 -0
  48. package/lib/types/scan.d.ts +10 -2
  49. package/lib/types/structure.d.ts +1 -0
  50. package/package.json +35 -19
  51. package/skills/model-everything/SKILL.md +454 -454
  52. package/skills/model-everything/references/architecture-domains.md +137 -0
  53. package/skills/model-everything/references/architecture-views.md +119 -0
  54. package/skills/model-everything-diagram/SKILL.md +82 -0
  55. package/src/client.ts +307 -0
  56. package/src/diagram-diff-tool.ts +94 -0
  57. package/src/diagram-render-tool.ts +108 -0
  58. package/src/diagram-review-tool.ts +109 -0
  59. package/src/diagram.ts +61 -0
  60. package/src/gate.ts +14 -12
  61. package/src/presentation.ts +12 -0
  62. package/src/render/budget.ts +135 -0
  63. package/src/render/collapse.ts +155 -0
  64. package/src/render/diff.ts +162 -0
  65. package/src/render/from-mermaid.ts +236 -0
  66. package/src/render/from-plantuml.ts +178 -0
  67. package/src/render/index.ts +73 -0
  68. package/src/render/layout.ts +62 -0
  69. package/src/render/model.ts +67 -0
  70. package/src/render/paint.ts +290 -0
  71. package/src/render/palette.ts +164 -0
  72. package/src/render/place.ts +234 -0
  73. package/src/render/svg.ts +127 -0
  74. package/src/render/viewmodel.ts +136 -0
  75. package/src/render/write.ts +17 -0
  76. package/src/scan.ts +807 -564
  77. package/src/structure-tool.ts +2 -2
  78. package/src/structure.ts +1 -1
package/README.en-US.md CHANGED
@@ -1,4 +1,4 @@
1
- # Modeling / Automated Review for Designs and Code (dsh-model-everything)
1
+ # Modeling, Architecture Visualisation and Automated Review (dsh-model-everything)
2
2
 
3
3
  <p align="center"><strong>English</strong> · <a href="README.md">中文</a></p>
4
4
 
@@ -11,38 +11,39 @@
11
11
 
12
12
  Abstract what a design or a piece of code claims into a model and let an engine run it: findings carry citations and hashes, so they can be recomputed and compared. The conclusion comes from a run rather than from reasoning it out: thinking it through becomes running it.
13
13
 
14
+ The same models can be **drawn**: an architecture source renders directly, parent and child boundaries fold, the structure is measured against budgets, and two designs are compared by containment.
15
+
14
16
  A native DeepSeek Harness plugin. It turns the assertions a design makes **about behaviour** into models that can be run, reviewed and exported:
15
17
 
16
18
  - **Check a claim**: against the source, cited to `file:line`.
17
19
  - **Run a model**: state machines, protocols, composed machines and data models become executable, and an engine runs them.
18
20
  - **Review a diagram**: read as a model, reviewed as a model, reconciled with it.
21
+ - **Draw the architecture**: a Mermaid or PlantUML source becomes a drawing - nested boundaries, folding, light and dark - while `diagram_review` measures the structure and `diagram_diff` compares two versions.
19
22
  - **Compare a refactor**: a model before and after, with the two reports side by side.
20
23
  - **Leave a record**: conclusions fixed into a report with hashes, recomputable and comparable and exportable.
21
24
 
22
- ## It costs more; what it returns is a verdict
25
+ ## Specialised in modelling review for medium-to-large, medium-to-high-complexity projects
23
26
 
24
- This is a capability tool, not a token-saving one.
27
+ This tool does one thing: it turns what a project claims about behaviour, structure and data into a model,
28
+ runs it, and returns a conclusion that can be recomputed - not a paragraph that reads like one.
25
29
 
26
- **How much it costs depends on the size of the task, and the direction is the opposite of intuition.** On a
27
- fixture of a few hundred lines it costs several times the baseline, because the fixed cost - skill body,
28
- tool definitions - has nothing to amortise against. On an object of tens of thousands of lines across
29
- hundreds of files the ratio falls back toward parity: we measured 0.93x to 1.11x. **The larger the task,
30
- the better the trade**: one decision replaces dozens of `read` calls rather than a few lines of code.
30
+ **The scale it specialises in is the medium-to-large, medium-to-high-complexity project**: tens of
31
+ thousands of lines, hundreds of files, protocols and state machines that cross modules. At that scale one
32
+ decision replaces dozens of reads, and the fixed cost of the skill body and the tool definitions is
33
+ amortised; the ratio we measured falls to 0.93x-1.11x there.
31
34
 
32
- What the extra buys:
35
+ It hands back three things:
33
36
 
34
- - a conclusion that can be **recomputed**: hashes, `verdict`, citations, not a paragraph that reads like one;
37
+ - a conclusion that can be **recomputed**: hashes, `verdict`, citations;
35
38
  - a **counterexample path**: the steps or the event sequence that breaks the claim;
36
- - a **portable model**: the same conclusion can be handed to UPPAAL, TLA+, PRISM or SPIN for a second opinion.
37
-
38
- When it is not worth it: when one reading of the code settles the claim, or three lines of script count
39
- it out. **It does not buy speed over reading.** It buys the claims that reading cannot decide.
39
+ - a **portable model**: the same conclusion can be handed to UPPAAL, TLA+, PRISM or SPIN for a second
40
+ opinion.
40
41
 
41
- **It decides small models, not programs.** The engine enumerates states, so a model that explodes is
42
- reported `truncated` with the undecided check named. That is not a bug to retry with a larger `maxStates`:
43
- reduce the model first, and if it still explodes the property needs a tool that does not enumerate - SPIN
44
- for partial-order reduction, NuSMV for symbolic search, CBMC for bounded SAT. This plugin builds no
45
- abstraction and reads no program source.
42
+ **What it specialises in deciding is the small model a person has already abstracted**: state machines,
43
+ finite-word automata, data models and migrations, design declarations, dependency graphs. When a model is
44
+ too large to enumerate, it reports `truncated` and names the undecided check; reducing the model (dropping
45
+ variables the property does not read, collapsing symmetric states), or handing that model to SPIN for
46
+ partial-order reduction, NuSMV for symbolic search, CBMC for bounded SAT, carries the question further.
46
47
 
47
48
  ## Report cards
48
49
 
@@ -71,6 +72,36 @@ A card **saves no tokens**: the model still gets the full text.
71
72
  | Concurrency / synchrony / async | Mines claims about how work is executed (thread-safe, locks, interrupts, async/await, the event loop) and routes each to a tool that can decide it. It proves nothing itself |
72
73
  | Export | Exports a verified model as input for UPPAAL, TLA+, PRISM or SPIN |
73
74
  | Reports | Report body rendering, baseline comparison (`report_diff`), hash specification. Every report also carries a summary for a UI - verdict, the first finding, the next step - while the model still gets the full text |
75
+ | Architecture visualisation | Draws a source directly (the drawable Mermaid / PlantUML subset), measures its structure against budgets, and compares two designs by containment. Parent/child grouping is first-class: nested boundaries, folding, light and dark palettes, and a sidebar whiteboard |
76
+
77
+ ## Architecture visualisation
78
+
79
+ Drawing is not decoration here; it is how a design gets read. Three questions, kept apart because they are
80
+ different questions:
81
+
82
+ | You want | Tool | It answers | It does not answer |
83
+ |---|---|---|---|
84
+ | The source drawn | `diagram_render` | What the drawing looks like | Whether the system it draws is right |
85
+ | Whether the drawing is too dense | `diagram_review` | How wide each boundary is, how deep they nest, how many nodes | Whether those boundaries should exist |
86
+ | What changed between two designs | `diagram_diff` | Which boundary appeared, vanished, was renamed or re-parented, and which component changed owner | Whether the change is an improvement |
87
+
88
+ **Parent/child grouping is first-class.** Mermaid `subgraph` and PlantUML `package` both read as boundaries,
89
+ boundaries nest, and the layout stacks a group's members inside it and wraps a parent around its children -
90
+ because a layered diagram whose members float outside their package is not showing containment at all. Clicking a
91
+ boundary folds it into one box and clicking again unfolds it; folding is a transform on the model, not a mode of
92
+ the painter, so the edges re-aim at the box.
93
+
94
+ **A line it cannot draw is refused with its line number.** Sequence diagrams, class diagrams, Gantt charts, the
95
+ `click`/`classDef` directives and PlantUML's `actor`/`note` are all refused by line. A sequence diagram that
96
+ quietly lost its lifelines looks complete, and that is worse than no drawing.
97
+
98
+ **Light and dark follow the page.** The rendered background decides which palette is used, and four schemes are
99
+ available (`default`, `github`, `high-contrast`, `print`); the surface is painted inside the SVG, so a re-skinned
100
+ container cannot change a picture's contrast. The right sidebar carries a whiteboard tab as well: paste a source,
101
+ get the drawing, with no tool result involved.
102
+
103
+ It **does not prove the design is right**: a tidy drawing is a readable model, and the judgement stays with
104
+ `model_verify` and `uml_structure_verify`.
74
105
 
75
106
  ## Typical uses
76
107
 
@@ -170,6 +201,9 @@ What is kept is the **source file**; a rendered image is a by-product.
170
201
  | `model_automaton_verify` | Finite-word automata: empty language, trap states, reachability, and the equivalence or inclusion relation against another automaton, with the **shortest witness word** when it fails |
171
202
  | `model_edit` | Changes a model file by naming one change (add/remove a state, add/remove/update a transition, pointer set/remove): returns the structural diff and the difference in findings, so edit-verify-compare takes one call |
172
203
  | `report_diff` | Compares two reports: what a change added, removed or changed |
204
+ | `diagram_render` | Source text to SVG: the drawable subset of Mermaid (flowchart, stateDiagram) and PlantUML (component, package, state). Layout, paint and output are all computed here; optionally writes a file and takes a colour scheme. A line it cannot draw is **refused with its line number**, never half-drawn |
205
+ | `diagram_review` | Structural budgets: how wide each boundary is, how deep they nest, how many nodes the drawing holds. Every finding names its group, and the report also prints **what it measured**, so "nothing to check" cannot read as "checked and clean" |
206
+ | `diagram_diff` | Structural difference between two drawings: boundaries added, removed, renamed or re-parented, and nodes that changed owner. It says what moved, never whether the move is better |
173
207
 
174
208
  `model_verify`, `model_datamodel_verify` and `model_design_review` also take `modelPath`: a JSON file in the workspace, in any formatting (indentation, a BOM and a trailing newline all parse). It is the alternative to an inline `model`; passing both is refused.
175
209
 
@@ -251,6 +285,16 @@ It registers its skills through the standard DSH filesystem skill provider and i
251
285
  |---|---|---|---|
252
286
  | `dsh-model-everything` | `dsh-model-everything` | every tool and skill | on |
253
287
  | Injected routing prompt | `dsh-model-everything-gate` | one routing message in the first model step of a session | on |
288
+ | Drawing | `dsh-model-everything-diagram` | the three drawing tools, and the diagram whiteboard in the right sidebar | on |
289
+
290
+ **Drawing** is the third component, kept apart on purpose: it carries no engine, so the two rows above can be
291
+ off and it still draws. A deployment that only wants its Mermaid sources drawn installs the same package and
292
+ enables this row alone.
293
+
294
+ The whiteboard is a tab in the right sidebar: paste a source, get a drawing. It scales, switches colour scheme
295
+ (`default`, `github`, `high-contrast`, `print`), follows the page's light or dark surface, and folds a group into
296
+ one box when you click it. It reads no tool result at all, which is why a change on the tool side cannot break
297
+ it.
254
298
 
255
299
  **Injected routing prompt** is the second component, switched on its own. It covers what text routing cannot: the catalog line is cut at 500 characters, and more to the point, a session that never decides to load a skill is never routed by anything.
256
300