@ankhorage/paradox 0.1.1 → 0.1.2

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,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 9dc0fd2: Add sequence diagram of bin script to README.md
8
+
3
9
  ## 0.1.1
4
10
 
5
11
  ### 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.1](./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
 
@@ -27,6 +27,45 @@ and writes them to the configured output directory.
27
27
  bunx @ankhorage/paradox
28
28
  ```
29
29
 
30
+ <details>
31
+ <summary>paradox sequence</summary>
32
+
33
+ Diagram: [paradox sequence](./paradox/diagrams/sequences/paradox.mmd)
34
+
35
+ ```mermaid
36
+ sequenceDiagram
37
+ participant participant_analyze as analyze
38
+ participant participant_buildModel as buildModel
39
+ participant participant_dirname as dirname
40
+ participant participant_findParadoxConfigFile as findParadoxConfigFile
41
+ participant participant_loadParadoxConfig as loadParadoxConfig
42
+ participant participant_main as main
43
+ participant participant_render as render
44
+ participant participant_resolveOutputRoot as resolveOutputRoot
45
+ participant participant_resolvePackageRoot as resolvePackageRoot
46
+ participant participant_write as write
47
+ participant_main->>participant_findParadoxConfigFile: findParadoxConfigFile()
48
+ participant_findParadoxConfigFile-->>participant_main: return
49
+ participant_main->>participant_dirname: dirname()
50
+ participant_dirname-->>participant_main: return
51
+ participant_main->>participant_loadParadoxConfig: loadParadoxConfig()
52
+ participant_loadParadoxConfig-->>participant_main: return
53
+ participant_main->>participant_resolvePackageRoot: resolvePackageRoot()
54
+ participant_resolvePackageRoot-->>participant_main: return
55
+ participant_main->>participant_resolveOutputRoot: resolveOutputRoot()
56
+ participant_resolveOutputRoot-->>participant_main: return
57
+ participant_main->>participant_analyze: analyze()
58
+ participant_analyze-->>participant_main: return
59
+ participant_main->>participant_buildModel: buildModel()
60
+ participant_buildModel-->>participant_main: return
61
+ participant_main->>participant_render: render()
62
+ participant_render-->>participant_main: return
63
+ participant_main->>participant_write: write()
64
+ participant_write-->>participant_main: return
65
+ ```
66
+
67
+ </details>
68
+
30
69
  ## Documentation Tags
31
70
 
32
71
  <details>
@@ -82,6 +121,7 @@ export default defineParadoxConfig({
82
121
  - [Architecture overview](./paradox/diagrams/architecture-overview.mmd)
83
122
  - [Module relationships](./paradox/diagrams/module-relationships.mmd)
84
123
  - [Export graph](./paradox/diagrams/export-graph.mmd)
124
+ - [paradox sequence](./paradox/diagrams/sequences/paradox.mmd)
85
125
 
86
126
  ## Architecture preview
87
127
 
@@ -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();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ankhorage/paradox",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Deterministic documentation generator for TypeScript packages.",
5
5
  "license": "MIT",
6
6
  "publishConfig": {