@ankhorage/paradox 0.1.1 → 0.1.3

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 919d454: Render README CLI entries as per-command accordions and show sequence diagrams directly inside the expanded command section.
8
+
9
+ ## 0.1.2
10
+
11
+ ### Patch Changes
12
+
13
+ - 9dc0fd2: Add sequence diagram of bin script to README.md
14
+
3
15
  ## 0.1.1
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  # @ankhorage/paradox
5
5
 
6
- ![license: MIT](./paradox/badges/license.svg) ![npm: v0.1.0](./paradox/badges/npm.svg) ![runtime: bun](./paradox/badges/runtime.svg) ![typescript: strict](./paradox/badges/typescript.svg) ![eslint: checked](./paradox/badges/eslint.svg) ![prettier: checked](./paradox/badges/prettier.svg) ![build: checked](./paradox/badges/build.svg) ![tests: checked](./paradox/badges/tests.svg) ![docs: paradox](./paradox/badges/docs.svg)
6
+ ![license: MIT](./paradox/badges/license.svg) ![npm: v0.1.2](./paradox/badges/npm.svg) ![runtime: bun](./paradox/badges/runtime.svg) ![typescript: strict](./paradox/badges/typescript.svg) ![eslint: checked](./paradox/badges/eslint.svg) ![prettier: checked](./paradox/badges/prettier.svg) ![build: checked](./paradox/badges/build.svg) ![tests: checked](./paradox/badges/tests.svg) ![docs: paradox](./paradox/badges/docs.svg)
7
7
 
8
8
  Deterministic documentation generator for TypeScript packages.
9
9
 
@@ -15,7 +15,8 @@ bunx @ankhorage/paradox
15
15
 
16
16
  ## CLI
17
17
 
18
- ### paradox
18
+ <details>
19
+ <summary>paradox</summary>
19
20
 
20
21
  Runs the Paradox CLI.
21
22
 
@@ -27,6 +28,42 @@ and writes them to the configured output directory.
27
28
  bunx @ankhorage/paradox
28
29
  ```
29
30
 
31
+ Diagram: [paradox sequence](./paradox/diagrams/sequences/paradox.mmd)
32
+
33
+ ```mermaid
34
+ sequenceDiagram
35
+ participant participant_analyze as analyze
36
+ participant participant_buildModel as buildModel
37
+ participant participant_dirname as dirname
38
+ participant participant_findParadoxConfigFile as findParadoxConfigFile
39
+ participant participant_loadParadoxConfig as loadParadoxConfig
40
+ participant participant_main as main
41
+ participant participant_render as render
42
+ participant participant_resolveOutputRoot as resolveOutputRoot
43
+ participant participant_resolvePackageRoot as resolvePackageRoot
44
+ participant participant_write as write
45
+ participant_main->>participant_findParadoxConfigFile: findParadoxConfigFile()
46
+ participant_findParadoxConfigFile-->>participant_main: return
47
+ participant_main->>participant_dirname: dirname()
48
+ participant_dirname-->>participant_main: return
49
+ participant_main->>participant_loadParadoxConfig: loadParadoxConfig()
50
+ participant_loadParadoxConfig-->>participant_main: return
51
+ participant_main->>participant_resolvePackageRoot: resolvePackageRoot()
52
+ participant_resolvePackageRoot-->>participant_main: return
53
+ participant_main->>participant_resolveOutputRoot: resolveOutputRoot()
54
+ participant_resolveOutputRoot-->>participant_main: return
55
+ participant_main->>participant_analyze: analyze()
56
+ participant_analyze-->>participant_main: return
57
+ participant_main->>participant_buildModel: buildModel()
58
+ participant_buildModel-->>participant_main: return
59
+ participant_main->>participant_render: render()
60
+ participant_render-->>participant_main: return
61
+ participant_main->>participant_write: write()
62
+ participant_write-->>participant_main: return
63
+ ```
64
+
65
+ </details>
66
+
30
67
  ## Documentation Tags
31
68
 
32
69
  <details>
@@ -82,6 +119,7 @@ export default defineParadoxConfig({
82
119
  - [Architecture overview](./paradox/diagrams/architecture-overview.mmd)
83
120
  - [Module relationships](./paradox/diagrams/module-relationships.mmd)
84
121
  - [Export graph](./paradox/diagrams/export-graph.mmd)
122
+ - [paradox sequence](./paradox/diagrams/sequences/paradox.mmd)
85
123
 
86
124
  ## Architecture preview
87
125
 
@@ -1,5 +1,6 @@
1
1
  const MAX_SEQUENCE_CALL_EDGES = 12;
2
2
  const MAX_SEQUENCE_PARTICIPANTS = 8;
3
+ const MAX_BIN_SEQUENCE_PARTICIPANTS = 12;
3
4
  /***
4
5
  * Generates deterministic Mermaid diagrams for the documentation app.
5
6
  */
@@ -84,6 +85,31 @@ function renderSequenceArtifacts(model) {
84
85
  });
85
86
  }
86
87
  function renderSequenceScenario(model, scenario) {
88
+ if (scenario.kind === 'bin') {
89
+ return renderBinSequenceScenario(model, scenario);
90
+ }
91
+ return renderNestedSequenceScenario(model, scenario);
92
+ }
93
+ function renderBinSequenceScenario(model, scenario) {
94
+ const callEdges = collectDirectCallEdges(model.graphs.calls, scenario.symbolName);
95
+ const participants = collectSequenceParticipants(callEdges);
96
+ if (callEdges.length === 0)
97
+ return null;
98
+ if (participants.length > MAX_BIN_SEQUENCE_PARTICIPANTS)
99
+ return null;
100
+ const lines = ['sequenceDiagram'];
101
+ for (const participant of participants) {
102
+ lines.push(` participant ${toMermaidId(`participant-${participant}`)} as ${escapeLabel(participant)}`);
103
+ }
104
+ for (const edge of callEdges) {
105
+ const fromId = toMermaidId(`participant-${edge.fromSymbol}`);
106
+ const toId = toMermaidId(`participant-${edge.toSymbol}`);
107
+ lines.push(` ${fromId}->>${toId}: ${formatCallLabel(edge.callExpression)}`);
108
+ lines.push(` ${toId}-->>${fromId}: return`);
109
+ }
110
+ return `${lines.join('\n')}\n`;
111
+ }
112
+ function renderNestedSequenceScenario(model, scenario) {
87
113
  const lines = ['sequenceDiagram'];
88
114
  const reachableEdges = collectReachableCallEdges(model.graphs.calls, scenario.symbolName);
89
115
  const participants = collectSequenceParticipants(reachableEdges);
@@ -99,6 +125,9 @@ function renderSequenceScenario(model, scenario) {
99
125
  renderCallFlow(lines, reachableEdges, scenario.symbolName);
100
126
  return `${lines.join('\n')}\n`;
101
127
  }
128
+ function collectDirectCallEdges(callEdges, root) {
129
+ return callEdges.filter((edge) => edge.fromSymbol === root);
130
+ }
102
131
  function collectReachableCallEdges(callEdges, root) {
103
132
  const outgoing = groupCallsBySource(callEdges);
104
133
  const visited = new Set();
@@ -49,7 +49,8 @@ function renderCliScenarios(lines, model, outputDir, diagrams) {
49
49
  return;
50
50
  lines.push('## CLI', '');
51
51
  for (const scenario of scenarios) {
52
- lines.push(`### ${scenario.name}`, '');
52
+ lines.push('<details>');
53
+ lines.push(`<summary>${scenario.name}</summary>`, '');
53
54
  if (scenario.description !== null) {
54
55
  lines.push(scenario.description, '');
55
56
  }
@@ -61,14 +62,12 @@ function renderCliScenarios(lines, model, outputDir, diagrams) {
61
62
  }
62
63
  const diagram = findScenarioDiagram(diagrams, scenario);
63
64
  if (diagram !== undefined) {
64
- lines.push('<details>');
65
- lines.push(`<summary>${scenario.name} sequence</summary>`, '');
66
65
  lines.push(`Diagram: [${diagram.title}](./${outputDir}/${diagram.path})`, '');
67
66
  lines.push('```mermaid');
68
67
  lines.push(diagram.content.trimEnd());
69
68
  lines.push('```', '');
70
- lines.push('</details>', '');
71
69
  }
70
+ lines.push('</details>', '');
72
71
  }
73
72
  }
74
73
  function findScenarioDiagram(diagrams, scenario) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ankhorage/paradox",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Deterministic documentation generator for TypeScript packages.",
5
5
  "license": "MIT",
6
6
  "publishConfig": {