@diagrammo/dgmo 0.8.4 → 0.8.6

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 (68) hide show
  1. package/.claude/commands/dgmo.md +300 -0
  2. package/.cursorrules +20 -2
  3. package/.github/copilot-instructions.md +20 -2
  4. package/.windsurfrules +20 -2
  5. package/AGENTS.md +23 -3
  6. package/dist/cli.cjs +191 -189
  7. package/dist/editor.cjs +5 -18
  8. package/dist/editor.cjs.map +1 -1
  9. package/dist/editor.js +5 -18
  10. package/dist/editor.js.map +1 -1
  11. package/dist/highlight.cjs +543 -0
  12. package/dist/highlight.cjs.map +1 -0
  13. package/dist/highlight.d.cts +32 -0
  14. package/dist/highlight.d.ts +32 -0
  15. package/dist/highlight.js +513 -0
  16. package/dist/highlight.js.map +1 -0
  17. package/dist/index.cjs +3253 -3356
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +77 -56
  20. package/dist/index.d.ts +77 -56
  21. package/dist/index.js +3247 -3349
  22. package/dist/index.js.map +1 -1
  23. package/docs/ai-integration.md +1 -1
  24. package/docs/language-reference.md +113 -33
  25. package/gallery/fixtures/boxes-and-lines.dgmo +64 -0
  26. package/gallery/fixtures/slope.dgmo +7 -6
  27. package/package.json +26 -6
  28. package/src/boxes-and-lines/collapse.ts +78 -0
  29. package/src/boxes-and-lines/layout.ts +319 -0
  30. package/src/boxes-and-lines/parser.ts +694 -0
  31. package/src/boxes-and-lines/renderer.ts +848 -0
  32. package/src/boxes-and-lines/types.ts +40 -0
  33. package/src/c4/parser.ts +10 -5
  34. package/src/c4/renderer.ts +232 -56
  35. package/src/chart.ts +9 -4
  36. package/src/cli.ts +49 -6
  37. package/src/completion.ts +25 -33
  38. package/src/d3.ts +187 -46
  39. package/src/dgmo-router.ts +3 -7
  40. package/src/echarts.ts +38 -2
  41. package/src/editor/highlight-api.ts +444 -0
  42. package/src/editor/keywords.ts +6 -19
  43. package/src/er/parser.ts +10 -4
  44. package/src/gantt/parser.ts +7 -4
  45. package/src/gantt/renderer.ts +3 -5
  46. package/src/index.ts +106 -50
  47. package/src/infra/parser.ts +7 -5
  48. package/src/infra/renderer.ts +2 -2
  49. package/src/kanban/parser.ts +7 -5
  50. package/src/kanban/renderer.ts +43 -18
  51. package/src/org/parser.ts +7 -4
  52. package/src/org/renderer.ts +40 -29
  53. package/src/sequence/parser.ts +11 -5
  54. package/src/sequence/renderer.ts +114 -45
  55. package/src/sitemap/parser.ts +8 -4
  56. package/src/sitemap/renderer.ts +137 -57
  57. package/src/utils/legend-svg.ts +44 -20
  58. package/src/utils/parsing.ts +1 -1
  59. package/src/utils/tag-groups.ts +21 -1
  60. package/gallery/fixtures/initiative-status-full.dgmo +0 -46
  61. package/gallery/fixtures/initiative-status-phases.dgmo +0 -29
  62. package/gallery/fixtures/initiative-status.dgmo +0 -9
  63. package/src/initiative-status/collapse.ts +0 -76
  64. package/src/initiative-status/filter.ts +0 -63
  65. package/src/initiative-status/layout.ts +0 -650
  66. package/src/initiative-status/parser.ts +0 -629
  67. package/src/initiative-status/renderer.ts +0 -1199
  68. package/src/initiative-status/types.ts +0 -57
@@ -1,46 +0,0 @@
1
- initiative-status Platform Modernization — Full Status
2
-
3
- tag Phase alias p
4
- Discovery(green) default
5
- Build(blue)
6
- Launch(orange)
7
- Maintenance(purple)
8
-
9
- tag Team alias t
10
- Frontend(blue)
11
- Backend(green)
12
- Platform(teal)
13
- Data(purple)
14
-
15
- [Identity] | t: Backend
16
- Auth Service | done, p: Build
17
- SSO Integration | doing, p: Build
18
- -> Auth Service | done
19
- MFA Rollout | blocked, p: Launch
20
- -> SSO Integration | doing
21
-
22
- [Payments] | t: Platform
23
- Payment Gateway | doing, p: Build
24
- Billing UI | todo, p: Build, t: Frontend
25
- -> Payment Gateway | doing
26
- Invoice API | todo, p: Launch
27
- -> Payment Gateway | doing
28
- -> Billing UI | todo
29
-
30
- [Search] | t: Backend
31
- Search API | done, p: Build
32
- Search UI | doing, p: Build, t: Frontend
33
- -> Search API | done
34
- Search Analytics | na, p: Maintenance, t: Data
35
-
36
- [Observability] | t: Platform
37
- Metrics Pipeline | done, p: Discovery
38
- Alert Rules | done, p: Build
39
- -> Metrics Pipeline | done
40
- Dashboard | doing, p: Build, t: Frontend
41
- -> Metrics Pipeline | done
42
- -> Alert Rules | done
43
-
44
- Auth Service -> Payment Gateway: validates | done
45
- SSO Integration -> Search API: provides identity | done
46
- Metrics Pipeline -> Search API: monitors | done
@@ -1,29 +0,0 @@
1
- initiative-status Platform Migration
2
-
3
- tag Phase alias p
4
- Discovery default
5
- Build
6
- Launch
7
-
8
- tag Team alias t
9
- Frontend
10
- Backend
11
- Platform
12
-
13
- [Identity]
14
- Auth Service | done, p: Discovery, t: Backend
15
- SSO Integration | doing, p: Build, t: Backend
16
- -> Auth Service | done
17
-
18
- [Payments]
19
- Payment Gateway | doing, p: Build, t: Platform
20
- Billing UI | todo, p: Build, t: Frontend
21
- -> Payment Gateway | doing
22
-
23
- [Search]
24
- Search API | todo, p: Launch, t: Backend
25
- Search UI | todo, p: Launch, t: Frontend
26
- -> Search API
27
-
28
- Auth Service -> Payment Gateway: validates | done
29
- SSO Integration -> Search API: provides identity | todo
@@ -1,9 +0,0 @@
1
- initiative-status Q2 Platform Roadmap
2
-
3
- Auth Service | done
4
- Payment Gateway | doing
5
- -> Auth Service | done
6
- Search API | todo
7
- -> Auth Service | done
8
- Billing UI | blocked
9
- -> Payment Gateway | doing
@@ -1,76 +0,0 @@
1
- import type { ParsedInitiativeStatus, InitiativeStatus, ISGroup } from './types';
2
- import { rollUpStatus } from './layout';
3
-
4
- // ============================================================
5
- // CollapseResult — returned by collapseInitiativeStatus
6
- // ============================================================
7
-
8
- export interface CollapseResult {
9
- parsed: ParsedInitiativeStatus;
10
- collapsedGroupStatuses: Map<string, InitiativeStatus>;
11
- originalGroups: ISGroup[];
12
- }
13
-
14
- // ============================================================
15
- // collapseInitiativeStatus — pure transform
16
- //
17
- // Returns a new ParsedInitiativeStatus with:
18
- // - Children of collapsed groups removed from nodes
19
- // - Edges redirected: source/target pointing to hidden nodes
20
- // → point to the group label
21
- // - Internal edges (both endpoints in same collapsed group) dropped
22
- // - Duplicate edges (same source, target, label) deduplicated
23
- // (first occurrence kept)
24
- // - Collapsed groups removed from groups[] (layout handles them
25
- // as regular nodes)
26
- // - collapsedGroupStatuses: worst-case status per collapsed group
27
- // ============================================================
28
-
29
- export function collapseInitiativeStatus(
30
- parsed: ParsedInitiativeStatus,
31
- collapsedGroups: Set<string>
32
- ): CollapseResult {
33
- const originalGroups = parsed.groups;
34
-
35
- if (collapsedGroups.size === 0) {
36
- return { parsed, collapsedGroupStatuses: new Map(), originalGroups };
37
- }
38
-
39
- // Build node → collapsed group lookup
40
- const nodeToGroup = new Map<string, string>();
41
- const collapsedGroupStatuses = new Map<string, InitiativeStatus>();
42
-
43
- for (const group of parsed.groups) {
44
- if (!collapsedGroups.has(group.label)) continue;
45
- const children = group.nodeLabels
46
- .map((l) => parsed.nodes.find((n) => n.label === l))
47
- .filter((n): n is (typeof parsed.nodes)[0] => n !== undefined);
48
- for (const node of children) nodeToGroup.set(node.label, group.label);
49
- collapsedGroupStatuses.set(group.label, rollUpStatus(children));
50
- }
51
-
52
- // Filter nodes: remove children of collapsed groups
53
- const nodes = parsed.nodes.filter((n) => !nodeToGroup.has(n.label));
54
-
55
- // Remap and deduplicate edges
56
- const edgeKeys = new Set<string>();
57
- const edges: typeof parsed.edges = [];
58
- for (const edge of parsed.edges) {
59
- const src = nodeToGroup.get(edge.source) ?? edge.source;
60
- const tgt = nodeToGroup.get(edge.target) ?? edge.target;
61
- if (src === tgt) continue; // internal edge → drop
62
- const key = `${src}|${tgt}|${edge.label ?? ''}`;
63
- if (edgeKeys.has(key)) continue; // duplicate → drop
64
- edgeKeys.add(key);
65
- edges.push({ ...edge, source: src, target: tgt });
66
- }
67
-
68
- // Keep only expanded groups in groups[]
69
- const groups = parsed.groups.filter((g) => !collapsedGroups.has(g.label));
70
-
71
- return {
72
- parsed: { ...parsed, nodes, edges, groups },
73
- collapsedGroupStatuses,
74
- originalGroups,
75
- };
76
- }
@@ -1,63 +0,0 @@
1
- // ============================================================
2
- // Initiative Status — Tag-Based Filter
3
- //
4
- // Immutable graph transform: returns a new ParsedInitiativeStatus
5
- // with hidden-value nodes removed, their edges dropped,
6
- // and group.nodeLabels cleaned.
7
- // ============================================================
8
-
9
- import type { ParsedInitiativeStatus } from './types';
10
-
11
- /**
12
- * Filter an initiative-status graph by hiding nodes whose tag metadata
13
- * matches any hidden value. Returns a new (immutable copy) ParsedInitiativeStatus.
14
- *
15
- * @param parsed Fully-resolved parsed result (defaults already injected)
16
- * @param hiddenTagValues Map<groupKey, Set<hiddenValues>> — all keys/values lowercase
17
- * @returns Filtered copy; original is not mutated
18
- */
19
- export function filterInitiativeStatusByTags(
20
- parsed: ParsedInitiativeStatus,
21
- hiddenTagValues: Map<string, Set<string>>
22
- ): ParsedInitiativeStatus {
23
- // Fast path: no filtering
24
- if (hiddenTagValues.size === 0) return parsed;
25
-
26
- // Build set of hidden node labels
27
- const hiddenNodeLabels = new Set<string>();
28
- for (const node of parsed.nodes) {
29
- for (const [groupKey, hiddenValues] of hiddenTagValues) {
30
- const nodeValue = node.metadata[groupKey];
31
- if (nodeValue && hiddenValues.has(nodeValue.toLowerCase())) {
32
- hiddenNodeLabels.add(node.label);
33
- break;
34
- }
35
- }
36
- }
37
-
38
- // No nodes hidden — return input unchanged
39
- if (hiddenNodeLabels.size === 0) return parsed;
40
-
41
- // Filter nodes
42
- const nodes = parsed.nodes.filter((n) => !hiddenNodeLabels.has(n.label));
43
-
44
- // Filter edges: remove edges where source OR target is hidden
45
- const edges = parsed.edges.filter(
46
- (e) => !hiddenNodeLabels.has(e.source) && !hiddenNodeLabels.has(e.target)
47
- );
48
-
49
- // Clean group nodeLabels; remove empty groups
50
- const groups = parsed.groups
51
- .map((g) => ({
52
- ...g,
53
- nodeLabels: g.nodeLabels.filter((l) => !hiddenNodeLabels.has(l)),
54
- }))
55
- .filter((g) => g.nodeLabels.length > 0);
56
-
57
- return {
58
- ...parsed,
59
- nodes,
60
- edges,
61
- groups,
62
- };
63
- }