@jpeakai/mermaidjs-lint 0.2.0 → 0.4.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 (57) hide show
  1. package/README.md +12 -9
  2. package/dist/bin.js +214 -64
  3. package/dist/index.js +217 -64
  4. package/dist/testing.js +99 -32
  5. package/dist/types/bin.d.ts +2 -0
  6. package/dist/types/check.d.ts +10 -0
  7. package/dist/types/cli.d.ts +9 -0
  8. package/dist/types/config.d.ts +20 -0
  9. package/dist/types/errors.d.ts +88 -0
  10. package/dist/types/files.d.ts +8 -0
  11. package/dist/types/fix/engine.d.ts +10 -0
  12. package/dist/types/fix/verify.d.ts +12 -0
  13. package/dist/types/index.d.ts +18 -0
  14. package/dist/types/model.d.ts +27 -0
  15. package/dist/types/parse/color.d.ts +28 -0
  16. package/dist/types/parse/contrast.d.ts +35 -0
  17. package/dist/types/parse/metrics.d.ts +48 -0
  18. package/dist/types/parse/stats.d.ts +25 -0
  19. package/dist/types/plugins/contract.d.ts +24 -0
  20. package/dist/types/plugins/discover.d.ts +20 -0
  21. package/dist/types/plugins/index.d.ts +19 -0
  22. package/dist/types/plugins/load.d.ts +14 -0
  23. package/dist/types/plugins/runtime.d.ts +6 -0
  24. package/dist/types/project.d.ts +18 -0
  25. package/dist/types/rules/complexity-node-count-acceptable-exceeded.d.ts +1 -0
  26. package/dist/types/rules/complexity-node-count-cognitive-limit.d.ts +1 -0
  27. package/dist/types/rules/complexity-node-count-hard-limit.d.ts +1 -0
  28. package/dist/types/rules/complexity-subgraph-nesting-too-deep.d.ts +2 -0
  29. package/dist/types/rules/complexity-visual-score-acceptable-exceeded.d.ts +1 -0
  30. package/dist/types/rules/complexity-visual-score-critical.d.ts +1 -0
  31. package/dist/types/rules/complexity.d.ts +12 -0
  32. package/dist/types/rules/contrast-border-below-ui-minimum.d.ts +2 -0
  33. package/dist/types/rules/contrast-directive-unauditable.d.ts +2 -0
  34. package/dist/types/rules/contrast-text-below-aa.d.ts +2 -0
  35. package/dist/types/rules/index.d.ts +3 -0
  36. package/dist/types/rules/parse-diagram-unparseable.d.ts +2 -0
  37. package/dist/types/rules/parse-fence-unterminated.d.ts +2 -0
  38. package/dist/types/rules/registry.d.ts +29 -0
  39. package/dist/types/rules/shared.d.ts +18 -0
  40. package/dist/types/rules/types.d.ts +67 -0
  41. package/dist/types/testing.d.ts +15 -0
  42. package/package.json +5 -4
  43. package/src/cli.ts +47 -15
  44. package/src/errors.ts +46 -0
  45. package/src/files.ts +21 -2
  46. package/src/fix/engine.ts +22 -10
  47. package/src/fix/verify.ts +31 -3
  48. package/src/index.ts +5 -3
  49. package/src/parse/metrics.ts +8 -1
  50. package/src/parse/stats.ts +72 -16
  51. package/src/plugins/contract.ts +4 -2
  52. package/src/plugins/discover.ts +38 -15
  53. package/src/plugins/index.ts +5 -3
  54. package/src/plugins/load.ts +32 -1
  55. package/src/project.ts +3 -1
  56. package/src/rules/complexity-subgraph-nesting-too-deep.ts +5 -0
  57. package/src/rules/parse-fence-unterminated.ts +1 -1
package/README.md CHANGED
@@ -5,8 +5,9 @@ Deterministic checks and verified fixes for Mermaid diagrams in markdown.
5
5
 
6
6
  **[Docs](https://jpeakai.github.io/jpai-mermaidjs-lint/)** | **[Rules](https://jpeakai.github.io/jpai-mermaidjs-lint/reference/rules/)** | **[Changelog](CHANGELOG.md)** | **[GitHub](https://github.com/jpeakai/jpai-mermaidjs-lint)** | **[npm](https://www.npmjs.com/package/@jpeakai/mermaidjs-lint)**
7
7
 
8
- This README and the docs site describe the `main` branch.
9
- A feature on `main` but not yet on npm is listed under `Unreleased` in the [changelog](CHANGELOG.md).
8
+ The docs site describes the latest release on npm.
9
+ This README, read on GitHub, describes the `main` branch.
10
+ A change on `main` that is not yet released is listed under `Unreleased` in the [changelog](CHANGELOG.md).
10
11
 
11
12
  ## Usage
12
13
 
@@ -40,14 +41,14 @@ Three tenets are guarantees about every diagram the tool passes, and the fourth
40
41
  | Extensible | Local rules and plugin packages |
41
42
 
42
43
  The [concepts page](https://jpeakai.github.io/jpai-mermaidjs-lint/concepts/) states the limit of each tenet.
43
- `mermaidjs-lint --list-rules` prints every rule.
44
+ `bunx @jpeakai/mermaidjs-lint --list-rules` prints every rule.
44
45
  The [rules page](https://jpeakai.github.io/jpai-mermaidjs-lint/reference/rules/) draws each one before and after `--fix`, and [RULES.md](RULES.md) holds the same examples as plain markdown.
45
46
 
46
47
  Every finding fails the run, and a rule you do not want is switched off in the config.
47
48
  Node, edge and subgraph counts come from mermaid's own parsers.
48
49
  Style directives are read line by line, so a style joined to other statements by a semicolon is not seen.
49
50
  Every fix is verified by parsing the document again, and a fix that fails the check is refused, so the finding stays for a human.
50
- The check holds the markdown outside the diagrams unchanged, and each diagram's type, node ids, subgraph names and counts.
51
+ The check holds the markdown outside the diagrams unchanged, and each diagram's type, node ids, subgraph names and counts, and whether it parses.
51
52
  It does not compare edge endpoints, edge labels or node text, so review the diff a fix writes.
52
53
 
53
54
  ## Requirements and compatibility
@@ -70,17 +71,19 @@ It does not compare edge endpoints, edge labels or node text, so review the diff
70
71
 
71
72
  [`skills/mermaidjs-lint/`](skills/mermaidjs-lint/SKILL.md) is an agent skill that runs the linter, applies the safe fixes, then fixes what remains by judgement.
72
73
  It is not in the npm package, so copy it from this repository.
74
+ The skill is the one file `SKILL.md`.
75
+ Its `evals/` folder holds deliberately failing fixtures for this repository's own tests, so never copy it.
73
76
  For Claude Code, run these in your project:
74
77
 
75
78
  ```sh
76
- git clone --depth 1 https://github.com/jpeakai/jpai-mermaidjs-lint.git mermaidjs-lint-src
77
- mkdir -p .claude/skills
78
- cp -R mermaidjs-lint-src/skills/mermaidjs-lint .claude/skills/
79
+ mkdir -p .claude/skills/mermaidjs-lint
80
+ curl -fsSL https://raw.githubusercontent.com/jpeakai/jpai-mermaidjs-lint/main/skills/mermaidjs-lint/SKILL.md \
81
+ -o .claude/skills/mermaidjs-lint/SKILL.md
79
82
  ```
80
83
 
81
- Copy it to `~/.claude/skills/` instead to use it in every project, then delete the clone.
84
+ Use `~/.claude/skills/mermaidjs-lint` instead to use it in every project.
82
85
  Another agent can follow `SKILL.md` as plain instructions.
83
- [Agent evals](https://jpeakai.github.io/jpai-mermaidjs-lint/gallery/agent-evals/) shows how well agents fix the fixtures with it.
86
+ [Agent evals](https://jpeakai.github.io/jpai-mermaidjs-lint/gallery/agent-evals/) shows how well agents fixed the failing fixtures it lists, and which skill revision they used.
84
87
 
85
88
  ## Library use
86
89