edsger 0.69.0 → 0.71.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/dist/api/github.d.ts +1 -1
  2. package/dist/api/github.js +1 -1
  3. package/dist/commands/architecture-diagram/index.d.ts +8 -0
  4. package/dist/commands/architecture-diagram/index.js +10 -0
  5. package/dist/commands/class-diagram/index.d.ts +7 -0
  6. package/dist/commands/class-diagram/index.js +9 -0
  7. package/dist/commands/data-flow/index.d.ts +5 -5
  8. package/dist/commands/data-flow/index.js +8 -8
  9. package/dist/commands/diagram-shared/index.d.ts +21 -0
  10. package/dist/commands/diagram-shared/index.js +37 -0
  11. package/dist/commands/discover/index.d.ts +14 -0
  12. package/dist/commands/discover/index.js +29 -0
  13. package/dist/commands/er-diagram/index.d.ts +19 -0
  14. package/dist/commands/er-diagram/index.js +55 -0
  15. package/dist/commands/flowchart/index.d.ts +8 -0
  16. package/dist/commands/flowchart/index.js +10 -0
  17. package/dist/commands/screen-flow/index.d.ts +5 -5
  18. package/dist/commands/screen-flow/index.js +8 -8
  19. package/dist/commands/sequence-diagram/index.d.ts +19 -0
  20. package/dist/commands/sequence-diagram/index.js +55 -0
  21. package/dist/commands/state-diagram/index.d.ts +7 -0
  22. package/dist/commands/state-diagram/index.js +9 -0
  23. package/dist/index.js +139 -5
  24. package/dist/phases/architecture-diagram/index.d.ts +15 -0
  25. package/dist/phases/architecture-diagram/index.js +51 -0
  26. package/dist/phases/class-diagram/index.d.ts +14 -0
  27. package/dist/phases/class-diagram/index.js +76 -0
  28. package/dist/phases/data-flow/index.d.ts +2 -2
  29. package/dist/phases/data-flow/index.js +37 -37
  30. package/dist/phases/data-flow/mcp-server.d.ts +1 -1
  31. package/dist/phases/data-flow/mcp-server.js +2 -2
  32. package/dist/phases/data-flow/types.d.ts +1 -1
  33. package/dist/phases/data-flow/types.js +1 -1
  34. package/dist/phases/diagram-shared/clone-repos.d.ts +63 -0
  35. package/dist/phases/diagram-shared/clone-repos.js +153 -0
  36. package/dist/phases/diagram-shared/generate.d.ts +42 -0
  37. package/dist/phases/diagram-shared/generate.js +162 -0
  38. package/dist/phases/diagram-shared/graph.d.ts +62 -0
  39. package/dist/phases/diagram-shared/graph.js +169 -0
  40. package/dist/phases/diagram-shared/mcp.d.ts +35 -0
  41. package/dist/phases/diagram-shared/mcp.js +68 -0
  42. package/dist/phases/diagram-shared/prompts.d.ts +23 -0
  43. package/dist/phases/diagram-shared/prompts.js +35 -0
  44. package/dist/phases/discover-services/index.d.ts +29 -0
  45. package/dist/phases/discover-services/index.js +528 -0
  46. package/dist/phases/er-diagram/index.d.ts +28 -0
  47. package/dist/phases/er-diagram/index.js +290 -0
  48. package/dist/phases/er-diagram/mcp-server.d.ts +77 -0
  49. package/dist/phases/er-diagram/mcp-server.js +144 -0
  50. package/dist/phases/er-diagram/prompts.d.ts +14 -0
  51. package/dist/phases/er-diagram/prompts.js +36 -0
  52. package/dist/phases/er-diagram/types.d.ts +76 -0
  53. package/dist/phases/er-diagram/types.js +84 -0
  54. package/dist/phases/flowchart/index.d.ts +15 -0
  55. package/dist/phases/flowchart/index.js +50 -0
  56. package/dist/phases/output-contracts.js +178 -2
  57. package/dist/phases/screen-flow/index.d.ts +3 -3
  58. package/dist/phases/screen-flow/index.js +47 -45
  59. package/dist/phases/screen-flow/mcp-server.js +2 -2
  60. package/dist/phases/sequence-diagram/index.d.ts +30 -0
  61. package/dist/phases/sequence-diagram/index.js +290 -0
  62. package/dist/phases/sequence-diagram/mcp-server.d.ts +64 -0
  63. package/dist/phases/sequence-diagram/mcp-server.js +134 -0
  64. package/dist/phases/sequence-diagram/prompts.d.ts +14 -0
  65. package/dist/phases/sequence-diagram/prompts.js +36 -0
  66. package/dist/phases/sequence-diagram/types.d.ts +52 -0
  67. package/dist/phases/sequence-diagram/types.js +93 -0
  68. package/dist/phases/state-diagram/index.d.ts +15 -0
  69. package/dist/phases/state-diagram/index.js +53 -0
  70. package/dist/skills/phase/architecture-diagram/SKILL.md +41 -0
  71. package/dist/skills/phase/class-diagram/SKILL.md +44 -0
  72. package/dist/skills/phase/er-diagram/SKILL.md +71 -0
  73. package/dist/skills/phase/flowchart/SKILL.md +38 -0
  74. package/dist/skills/phase/sequence-diagram/SKILL.md +67 -0
  75. package/dist/skills/phase/state-diagram/SKILL.md +38 -0
  76. package/dist/workspace/session-workspace.d.ts +2 -2
  77. package/dist/workspace/session-workspace.js +2 -2
  78. package/package.json +1 -1
@@ -63,7 +63,7 @@ export interface RepositoryBasics {
63
63
  export declare function getRepositoryBasics(repositoryId: string): Promise<RepositoryBasics>;
64
64
  /**
65
65
  * Get GitHub config and token by repository ID (no product / issue required).
66
- * Used for repo-scoped analysis (quality-benchmark / recipes / flows running
66
+ * Used for repo-scoped analysis (quality-benchmark / recipes / diagrams running
67
67
  * against a single `repositories` row with no product context).
68
68
  */
69
69
  export declare function getGitHubConfigByRepository(repositoryId: string, verbose?: boolean): Promise<{
@@ -118,7 +118,7 @@ export async function getRepositoryBasics(repositoryId) {
118
118
  }
119
119
  /**
120
120
  * Get GitHub config and token by repository ID (no product / issue required).
121
- * Used for repo-scoped analysis (quality-benchmark / recipes / flows running
121
+ * Used for repo-scoped analysis (quality-benchmark / recipes / diagrams running
122
122
  * against a single `repositories` row with no product context).
123
123
  */
124
124
  export async function getGitHubConfigByRepository(repositoryId, verbose) {
@@ -0,0 +1,8 @@
1
+ /**
2
+ * CLI command: edsger architecture-diagram <productId> --diagram-id <id>
3
+ * Maps a component/dependency diagram into the diagrams tables
4
+ * (type='architecture').
5
+ */
6
+ import { type DiagramCommandOptions } from '../diagram-shared/index.js';
7
+ export type ArchitectureDiagramCliOptions = DiagramCommandOptions;
8
+ export declare function runArchitectureDiagram(productId: string | undefined, options: ArchitectureDiagramCliOptions): Promise<void>;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * CLI command: edsger architecture-diagram <productId> --diagram-id <id>
3
+ * Maps a component/dependency diagram into the diagrams tables
4
+ * (type='architecture').
5
+ */
6
+ import { runArchitectureDiagramPhase } from '../../phases/architecture-diagram/index.js';
7
+ import { runDiagramCommand, } from '../diagram-shared/index.js';
8
+ export function runArchitectureDiagram(productId, options) {
9
+ return runDiagramCommand('architecture-diagram', productId, options, runArchitectureDiagramPhase);
10
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * CLI command: edsger class-diagram <productId> --diagram-id <id>
3
+ * Maps a UML class diagram into the diagrams tables (type='class').
4
+ */
5
+ import { type DiagramCommandOptions } from '../diagram-shared/index.js';
6
+ export type ClassDiagramCliOptions = DiagramCommandOptions;
7
+ export declare function runClassDiagram(productId: string | undefined, options: ClassDiagramCliOptions): Promise<void>;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * CLI command: edsger class-diagram <productId> --diagram-id <id>
3
+ * Maps a UML class diagram into the diagrams tables (type='class').
4
+ */
5
+ import { runClassDiagramPhase } from '../../phases/class-diagram/index.js';
6
+ import { runDiagramCommand, } from '../diagram-shared/index.js';
7
+ export function runClassDiagram(productId, options) {
8
+ return runDiagramCommand('class-diagram', productId, options, runClassDiagramPhase);
9
+ }
@@ -1,16 +1,16 @@
1
1
  /**
2
- * CLI command: edsger data-flow <productId> --flow-id <id>
2
+ * CLI command: edsger data-flow <productId> --diagram-id <id>
3
3
  *
4
4
  * Maps the product's data nodes (source/dataset/transform/sink/queue/model)
5
5
  * and the connections between them into a structured flow stored in
6
- * flows / flow_nodes / flow_edges (rows tagged type='data').
6
+ * diagrams / diagram_nodes / diagram_edges (rows tagged type='data').
7
7
  *
8
- * The desktop UI creates a pending flows row first, then invokes the CLI
9
- * with --flow-id; the CLI flips status running → success/failed and
8
+ * The desktop UI creates a pending diagrams row first, then invokes the CLI
9
+ * with --diagram-id; the CLI flips status running → success/failed and
10
10
  * populates the nodes/edges tables.
11
11
  */
12
12
  export interface DataFlowCliOptions {
13
- flowId: string;
13
+ diagramId: string;
14
14
  /** Repo-only mode: generate against a single repositories row, no product. */
15
15
  repoId?: string;
16
16
  guidance?: string;
@@ -1,24 +1,24 @@
1
1
  /**
2
- * CLI command: edsger data-flow <productId> --flow-id <id>
2
+ * CLI command: edsger data-flow <productId> --diagram-id <id>
3
3
  *
4
4
  * Maps the product's data nodes (source/dataset/transform/sink/queue/model)
5
5
  * and the connections between them into a structured flow stored in
6
- * flows / flow_nodes / flow_edges (rows tagged type='data').
6
+ * diagrams / diagram_nodes / diagram_edges (rows tagged type='data').
7
7
  *
8
- * The desktop UI creates a pending flows row first, then invokes the CLI
9
- * with --flow-id; the CLI flips status running → success/failed and
8
+ * The desktop UI creates a pending diagrams row first, then invokes the CLI
9
+ * with --diagram-id; the CLI flips status running → success/failed and
10
10
  * populates the nodes/edges tables.
11
11
  */
12
12
  import { runDataFlowPhase } from '../../phases/data-flow/index.js';
13
13
  import { deregisterSession, registerSession, } from '../../system/session-manager.js';
14
14
  import { logError, logInfo, logSuccess } from '../../utils/logger.js';
15
15
  export async function runDataFlow(productId, options) {
16
- const { flowId, repoId, guidance, verbose } = options;
16
+ const { diagramId, repoId, guidance, verbose } = options;
17
17
  if (!productId && !repoId) {
18
18
  throw new Error('Either a product ID or --repo-id is required for data-flow');
19
19
  }
20
- if (!flowId) {
21
- throw new Error('--flow-id is required (the pending flows row id)');
20
+ if (!diagramId) {
21
+ throw new Error('--diagram-id is required (the pending diagrams row id)');
22
22
  }
23
23
  await registerSession({
24
24
  command: 'data-flow',
@@ -34,7 +34,7 @@ export async function runDataFlow(productId, options) {
34
34
  const result = await runDataFlowPhase({
35
35
  productId,
36
36
  repoId,
37
- flowId,
37
+ diagramId,
38
38
  guidance,
39
39
  verbose,
40
40
  });
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Shared CLI command runner for graph diagram phases (state / class /
3
+ * architecture / flowchart). Handles session registration and the
4
+ * success/failure → exit-code mapping; each command just passes its phase
5
+ * runner.
6
+ */
7
+ import type { DiagramPhaseResult } from '../../phases/diagram-shared/generate.js';
8
+ export interface DiagramCommandOptions {
9
+ diagramId: string;
10
+ /** Repo-only mode: generate against a single repositories row, no product. */
11
+ repoId?: string;
12
+ guidance?: string;
13
+ verbose?: boolean;
14
+ }
15
+ export declare function runDiagramCommand(command: string, productId: string | undefined, options: DiagramCommandOptions, run: (args: {
16
+ productId?: string;
17
+ repoId?: string;
18
+ diagramId: string;
19
+ guidance?: string;
20
+ verbose?: boolean;
21
+ }) => Promise<DiagramPhaseResult>): Promise<void>;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Shared CLI command runner for graph diagram phases (state / class /
3
+ * architecture / flowchart). Handles session registration and the
4
+ * success/failure → exit-code mapping; each command just passes its phase
5
+ * runner.
6
+ */
7
+ import { deregisterSession, registerSession, } from '../../system/session-manager.js';
8
+ import { logError, logInfo, logSuccess } from '../../utils/logger.js';
9
+ export async function runDiagramCommand(command, productId, options, run) {
10
+ const { diagramId, repoId, guidance, verbose } = options;
11
+ if (!productId && !repoId) {
12
+ throw new Error(`Either a product ID or --repo-id is required for ${command}`);
13
+ }
14
+ if (!diagramId) {
15
+ throw new Error('--diagram-id is required (the pending diagrams row id)');
16
+ }
17
+ await registerSession({ command, ...(productId ? { productId } : {}) });
18
+ logInfo(productId
19
+ ? `Starting ${command} for product ${productId}`
20
+ : `Starting ${command} for repository ${repoId}`);
21
+ try {
22
+ const result = await run({ productId, repoId, diagramId, guidance, verbose });
23
+ if (result.status === 'success') {
24
+ logSuccess(result.message);
25
+ if (result.summary) {
26
+ logInfo(`\nSummary: ${result.summary}`);
27
+ }
28
+ }
29
+ else {
30
+ logError(result.message);
31
+ process.exit(1);
32
+ }
33
+ }
34
+ finally {
35
+ await deregisterSession();
36
+ }
37
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * CLI command: `edsger discover <teamId> [runId]`
3
+ *
4
+ * Runs GitHub service discovery for a team: scans every repo in the team's
5
+ * connected GitHub org and upserts an inferred service for each. When invoked
6
+ * with an existing `runId` (the desktop creates a pending `discovery_runs` row
7
+ * first), the scan drives that row to running → success/failed; otherwise it
8
+ * creates its own run row.
9
+ */
10
+ export interface DiscoverOptions {
11
+ verbose?: boolean;
12
+ org?: string;
13
+ }
14
+ export declare function runDiscover(teamId: string, runId: string | undefined, options?: DiscoverOptions): Promise<void>;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * CLI command: `edsger discover <teamId> [runId]`
3
+ *
4
+ * Runs GitHub service discovery for a team: scans every repo in the team's
5
+ * connected GitHub org and upserts an inferred service for each. When invoked
6
+ * with an existing `runId` (the desktop creates a pending `discovery_runs` row
7
+ * first), the scan drives that row to running → success/failed; otherwise it
8
+ * creates its own run row.
9
+ */
10
+ import { discoverServices } from '../../phases/discover-services/index.js';
11
+ import { hasSupabaseSession } from '../../supabase/client.js';
12
+ import { logError, logInfo } from '../../utils/logger.js';
13
+ export async function runDiscover(teamId, runId, options = {}) {
14
+ if (!hasSupabaseSession()) {
15
+ logError('Supabase session unavailable. Sign in to the Edsger desktop app to authorize the CLI.');
16
+ process.exit(1);
17
+ }
18
+ logInfo(`Starting GitHub service discovery for team ${teamId}`);
19
+ const result = await discoverServices({
20
+ teamId,
21
+ runId,
22
+ org: options.org,
23
+ verbose: options.verbose,
24
+ });
25
+ if (result.status === 'error') {
26
+ logError(result.message);
27
+ process.exit(1);
28
+ }
29
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * CLI command: edsger er-diagram <productId> --diagram-id <id>
3
+ *
4
+ * Maps the product's persistence entities (tables / views / enums / junction
5
+ * tables) and the relationships between them into a structured flow stored in
6
+ * diagrams / diagram_nodes / diagram_edges (rows tagged type='er').
7
+ *
8
+ * The desktop UI creates a pending diagrams row first, then invokes the CLI
9
+ * with --diagram-id; the CLI flips status running → success/failed and
10
+ * populates the nodes/edges tables.
11
+ */
12
+ export interface ErDiagramCliOptions {
13
+ diagramId: string;
14
+ /** Repo-only mode: generate against a single repositories row, no product. */
15
+ repoId?: string;
16
+ guidance?: string;
17
+ verbose?: boolean;
18
+ }
19
+ export declare function runErDiagram(productId: string | undefined, options: ErDiagramCliOptions): Promise<void>;
@@ -0,0 +1,55 @@
1
+ /**
2
+ * CLI command: edsger er-diagram <productId> --diagram-id <id>
3
+ *
4
+ * Maps the product's persistence entities (tables / views / enums / junction
5
+ * tables) and the relationships between them into a structured flow stored in
6
+ * diagrams / diagram_nodes / diagram_edges (rows tagged type='er').
7
+ *
8
+ * The desktop UI creates a pending diagrams row first, then invokes the CLI
9
+ * with --diagram-id; the CLI flips status running → success/failed and
10
+ * populates the nodes/edges tables.
11
+ */
12
+ import { runErDiagramPhase } from '../../phases/er-diagram/index.js';
13
+ import { deregisterSession, registerSession, } from '../../system/session-manager.js';
14
+ import { logError, logInfo, logSuccess } from '../../utils/logger.js';
15
+ export async function runErDiagram(productId, options) {
16
+ const { diagramId, repoId, guidance, verbose } = options;
17
+ if (!productId && !repoId) {
18
+ throw new Error('Either a product ID or --repo-id is required for er-diagram');
19
+ }
20
+ if (!diagramId) {
21
+ throw new Error('--diagram-id is required (the pending diagrams row id)');
22
+ }
23
+ await registerSession({
24
+ command: 'er-diagram',
25
+ ...(productId ? { productId } : {}),
26
+ });
27
+ if (productId) {
28
+ logInfo(`Starting ER diagram generation for product ${productId}`);
29
+ }
30
+ else {
31
+ logInfo(`Starting ER diagram generation for repository ${repoId}`);
32
+ }
33
+ try {
34
+ const result = await runErDiagramPhase({
35
+ productId,
36
+ repoId,
37
+ diagramId,
38
+ guidance,
39
+ verbose,
40
+ });
41
+ if (result.status === 'success') {
42
+ logSuccess(result.message);
43
+ if (result.summary) {
44
+ logInfo(`\nSummary: ${result.summary}`);
45
+ }
46
+ }
47
+ else {
48
+ logError(result.message);
49
+ process.exit(1);
50
+ }
51
+ }
52
+ finally {
53
+ await deregisterSession();
54
+ }
55
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * CLI command: edsger flowchart <productId> --diagram-id <id>
3
+ * Maps a process/control-flow flowchart into the diagrams tables
4
+ * (type='flowchart').
5
+ */
6
+ import { type DiagramCommandOptions } from '../diagram-shared/index.js';
7
+ export type FlowchartCliOptions = DiagramCommandOptions;
8
+ export declare function runFlowchart(productId: string | undefined, options: FlowchartCliOptions): Promise<void>;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * CLI command: edsger flowchart <productId> --diagram-id <id>
3
+ * Maps a process/control-flow flowchart into the diagrams tables
4
+ * (type='flowchart').
5
+ */
6
+ import { runFlowchartPhase } from '../../phases/flowchart/index.js';
7
+ import { runDiagramCommand, } from '../diagram-shared/index.js';
8
+ export function runFlowchart(productId, options) {
9
+ return runDiagramCommand('flowchart', productId, options, runFlowchartPhase);
10
+ }
@@ -1,15 +1,15 @@
1
1
  /**
2
- * CLI command: edsger screen-flow <productId> --flow-id <id>
2
+ * CLI command: edsger screen-flow <productId> --diagram-id <id>
3
3
  *
4
4
  * Maps the product's user-facing screens and transitions into a structured
5
- * flow stored in flows / flow_nodes / flow_edges (rows tagged type='screen').
5
+ * flow stored in diagrams / diagram_nodes / diagram_edges (rows tagged type='screen').
6
6
  *
7
- * The desktop UI creates a pending flows row first, then invokes the CLI
8
- * with --flow-id; the CLI flips status running → success/failed and
7
+ * The desktop UI creates a pending diagrams row first, then invokes the CLI
8
+ * with --diagram-id; the CLI flips status running → success/failed and
9
9
  * populates the nodes/edges tables.
10
10
  */
11
11
  export interface ScreenFlowCliOptions {
12
- flowId: string;
12
+ diagramId: string;
13
13
  /** Repo-only mode: generate against a single repositories row, no product. */
14
14
  repoId?: string;
15
15
  guidance?: string;
@@ -1,23 +1,23 @@
1
1
  /**
2
- * CLI command: edsger screen-flow <productId> --flow-id <id>
2
+ * CLI command: edsger screen-flow <productId> --diagram-id <id>
3
3
  *
4
4
  * Maps the product's user-facing screens and transitions into a structured
5
- * flow stored in flows / flow_nodes / flow_edges (rows tagged type='screen').
5
+ * flow stored in diagrams / diagram_nodes / diagram_edges (rows tagged type='screen').
6
6
  *
7
- * The desktop UI creates a pending flows row first, then invokes the CLI
8
- * with --flow-id; the CLI flips status running → success/failed and
7
+ * The desktop UI creates a pending diagrams row first, then invokes the CLI
8
+ * with --diagram-id; the CLI flips status running → success/failed and
9
9
  * populates the nodes/edges tables.
10
10
  */
11
11
  import { runScreenFlowPhase } from '../../phases/screen-flow/index.js';
12
12
  import { deregisterSession, registerSession, } from '../../system/session-manager.js';
13
13
  import { logError, logInfo, logSuccess } from '../../utils/logger.js';
14
14
  export async function runScreenFlow(productId, options) {
15
- const { flowId, repoId, guidance, verbose } = options;
15
+ const { diagramId, repoId, guidance, verbose } = options;
16
16
  if (!productId && !repoId) {
17
17
  throw new Error('Either a product ID or --repo-id is required for screen-flow');
18
18
  }
19
- if (!flowId) {
20
- throw new Error('--flow-id is required (the pending flows row id)');
19
+ if (!diagramId) {
20
+ throw new Error('--diagram-id is required (the pending diagrams row id)');
21
21
  }
22
22
  await registerSession({
23
23
  command: 'screen-flow',
@@ -33,7 +33,7 @@ export async function runScreenFlow(productId, options) {
33
33
  const result = await runScreenFlowPhase({
34
34
  productId,
35
35
  repoId,
36
- flowId,
36
+ diagramId,
37
37
  guidance,
38
38
  verbose,
39
39
  });
@@ -0,0 +1,19 @@
1
+ /**
2
+ * CLI command: edsger sequence-diagram <productId> --diagram-id <id>
3
+ *
4
+ * Traces one scenario through the product's code and maps the participants
5
+ * and the ordered messages between them into a structured flow stored in
6
+ * diagrams / diagram_nodes / diagram_edges (rows tagged type='sequence').
7
+ *
8
+ * The desktop UI creates a pending diagrams row first, then invokes the CLI
9
+ * with --diagram-id; the CLI flips status running → success/failed and
10
+ * populates the nodes/edges tables.
11
+ */
12
+ export interface SequenceDiagramCliOptions {
13
+ diagramId: string;
14
+ /** Repo-only mode: generate against a single repositories row, no product. */
15
+ repoId?: string;
16
+ guidance?: string;
17
+ verbose?: boolean;
18
+ }
19
+ export declare function runSequenceDiagram(productId: string | undefined, options: SequenceDiagramCliOptions): Promise<void>;
@@ -0,0 +1,55 @@
1
+ /**
2
+ * CLI command: edsger sequence-diagram <productId> --diagram-id <id>
3
+ *
4
+ * Traces one scenario through the product's code and maps the participants
5
+ * and the ordered messages between them into a structured flow stored in
6
+ * diagrams / diagram_nodes / diagram_edges (rows tagged type='sequence').
7
+ *
8
+ * The desktop UI creates a pending diagrams row first, then invokes the CLI
9
+ * with --diagram-id; the CLI flips status running → success/failed and
10
+ * populates the nodes/edges tables.
11
+ */
12
+ import { runSequenceDiagramPhase } from '../../phases/sequence-diagram/index.js';
13
+ import { deregisterSession, registerSession, } from '../../system/session-manager.js';
14
+ import { logError, logInfo, logSuccess } from '../../utils/logger.js';
15
+ export async function runSequenceDiagram(productId, options) {
16
+ const { diagramId, repoId, guidance, verbose } = options;
17
+ if (!productId && !repoId) {
18
+ throw new Error('Either a product ID or --repo-id is required for sequence-diagram');
19
+ }
20
+ if (!diagramId) {
21
+ throw new Error('--diagram-id is required (the pending diagrams row id)');
22
+ }
23
+ await registerSession({
24
+ command: 'sequence-diagram',
25
+ ...(productId ? { productId } : {}),
26
+ });
27
+ if (productId) {
28
+ logInfo(`Starting sequence diagram generation for product ${productId}`);
29
+ }
30
+ else {
31
+ logInfo(`Starting sequence diagram generation for repository ${repoId}`);
32
+ }
33
+ try {
34
+ const result = await runSequenceDiagramPhase({
35
+ productId,
36
+ repoId,
37
+ diagramId,
38
+ guidance,
39
+ verbose,
40
+ });
41
+ if (result.status === 'success') {
42
+ logSuccess(result.message);
43
+ if (result.summary) {
44
+ logInfo(`\nSummary: ${result.summary}`);
45
+ }
46
+ }
47
+ else {
48
+ logError(result.message);
49
+ process.exit(1);
50
+ }
51
+ }
52
+ finally {
53
+ await deregisterSession();
54
+ }
55
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * CLI command: edsger state-diagram <productId> --diagram-id <id>
3
+ * Maps a state machine into the diagrams tables (type='state').
4
+ */
5
+ import { type DiagramCommandOptions } from '../diagram-shared/index.js';
6
+ export type StateDiagramCliOptions = DiagramCommandOptions;
7
+ export declare function runStateDiagram(productId: string | undefined, options: StateDiagramCliOptions): Promise<void>;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * CLI command: edsger state-diagram <productId> --diagram-id <id>
3
+ * Maps a state machine into the diagrams tables (type='state').
4
+ */
5
+ import { runStateDiagramPhase } from '../../phases/state-diagram/index.js';
6
+ import { runDiagramCommand, } from '../diagram-shared/index.js';
7
+ export function runStateDiagram(productId, options) {
8
+ return runDiagramCommand('state-diagram', productId, options, runStateDiagramPhase);
9
+ }