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
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Shared in-process MCP server builder for graph diagram types.
3
+ *
4
+ * Each lean diagram phase (state / class / architecture / flowchart) supplies
5
+ * its own zod node/edge schemas + tool name; this assembles the standard
6
+ * `submit_<type>` capture tool (validated against the shared graph consistency
7
+ * rules) plus a `record_progress` status tool.
8
+ */
9
+ import { type ZodTypeAny } from 'zod';
10
+ import { type DiagramExtraction } from './graph.js';
11
+ export interface DiagramCaptureState {
12
+ captured: DiagramExtraction | null;
13
+ }
14
+ export declare function createDiagramCaptureState(): DiagramCaptureState;
15
+ export type DiagramProgressSink = (event: {
16
+ phase: 'detection' | 'enumeration' | 'nodes' | 'edges' | 'submission';
17
+ message: string;
18
+ }) => void;
19
+ export interface DiagramMcpConfig {
20
+ /** Server name + submit tool become `submit_<toolName>`. */
21
+ name: string;
22
+ toolName: string;
23
+ summaryDescribe: string;
24
+ nodesSchema: ZodTypeAny;
25
+ nodesDescribe: string;
26
+ edgesSchema: ZodTypeAny;
27
+ edgesDescribe: string;
28
+ }
29
+ /**
30
+ * Build the MCP server for one diagram type. The submit tool captures the
31
+ * extraction into `state` after passing the shared consistency check.
32
+ */
33
+ export declare function createDiagramMcpServer(config: DiagramMcpConfig, state: DiagramCaptureState, options?: {
34
+ onProgress?: DiagramProgressSink;
35
+ }): import("@anthropic-ai/claude-agent-sdk").McpSdkServerConfigWithInstance;
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Shared in-process MCP server builder for graph diagram types.
3
+ *
4
+ * Each lean diagram phase (state / class / architecture / flowchart) supplies
5
+ * its own zod node/edge schemas + tool name; this assembles the standard
6
+ * `submit_<type>` capture tool (validated against the shared graph consistency
7
+ * rules) plus a `record_progress` status tool.
8
+ */
9
+ import { createSdkMcpServer, tool } from '@anthropic-ai/claude-agent-sdk';
10
+ import { z } from 'zod';
11
+ import { validateGraphConsistency, } from './graph.js';
12
+ export function createDiagramCaptureState() {
13
+ return { captured: null };
14
+ }
15
+ function createRecordProgressTool(sink) {
16
+ return tool('record_progress', 'Send a short status update to the user. Does not affect the extraction. Call it at each phase boundary so the user sees progress.', {
17
+ phase: z
18
+ .enum(['detection', 'enumeration', 'nodes', 'edges', 'submission'])
19
+ .describe('Which phase the message belongs to.'),
20
+ message: z.string().min(1).describe('Human-readable status update.'),
21
+ }, async (args) => {
22
+ sink?.({ phase: args.phase, message: args.message });
23
+ return { content: [{ type: 'text', text: 'ok' }] };
24
+ });
25
+ }
26
+ /**
27
+ * Build the MCP server for one diagram type. The submit tool captures the
28
+ * extraction into `state` after passing the shared consistency check.
29
+ */
30
+ export function createDiagramMcpServer(config, state, options) {
31
+ const submitTool = tool(`submit_${config.toolName}`, [
32
+ `Submit the final ${config.name}. Call this EXACTLY once, when you have`,
33
+ 'finished mapping every node and edge. After it succeeds, end your turn —',
34
+ 'do NOT also paste the same data as a fenced code block. If validation',
35
+ 'fails, the error tells you what to fix; call the tool again.',
36
+ ].join(' '), {
37
+ summary: z.string().min(1).describe(config.summaryDescribe),
38
+ nodes: config.nodesSchema.describe(config.nodesDescribe),
39
+ edges: config.edgesSchema.describe(config.edgesDescribe),
40
+ }, async (args) => {
41
+ const extraction = {
42
+ summary: args.summary,
43
+ nodes: args.nodes,
44
+ edges: args.edges,
45
+ };
46
+ const { error } = validateGraphConsistency(extraction);
47
+ if (error) {
48
+ return {
49
+ content: [{ type: 'text', text: error }],
50
+ isError: true,
51
+ };
52
+ }
53
+ state.captured = extraction;
54
+ return {
55
+ content: [
56
+ {
57
+ type: 'text',
58
+ text: `Captured ${extraction.nodes.length} nodes / ${extraction.edges.length} edges. End your turn now.`,
59
+ },
60
+ ],
61
+ };
62
+ });
63
+ return createSdkMcpServer({
64
+ name: config.name,
65
+ version: '1.0.0',
66
+ tools: [submitTool, createRecordProgressTool(options?.onProgress)],
67
+ });
68
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Shared prompt builders for graph diagram phases. The system prompt loads the
3
+ * type's SKILL.md (project-overridable) and appends its JSON output contract;
4
+ * the user prompt wraps a type-specific task + process paragraph in the
5
+ * standard "call the submit tool" envelope.
6
+ */
7
+ export declare function buildDiagramSystemPrompt(skillRef: string, contractKey: string, opts?: {
8
+ projectDir?: string;
9
+ hasCodebase?: boolean;
10
+ }): Promise<string>;
11
+ export declare function buildDiagramUserPrompt(args: {
12
+ /** e.g. "Map the state machine for". The product name is appended. */
13
+ task: string;
14
+ productName: string;
15
+ productDescription?: string;
16
+ guidance?: string;
17
+ /** One paragraph telling the agent what to scan / how to proceed. */
18
+ process: string;
19
+ /** MCP server name, e.g. 'state-diagram'. */
20
+ mcpName: string;
21
+ /** Submit tool suffix, e.g. 'state_diagram' → submit_state_diagram. */
22
+ toolName: string;
23
+ }): string;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Shared prompt builders for graph diagram phases. The system prompt loads the
3
+ * type's SKILL.md (project-overridable) and appends its JSON output contract;
4
+ * the user prompt wraps a type-specific task + process paragraph in the
5
+ * standard "call the submit tool" envelope.
6
+ */
7
+ import { processConditionals, resolveSkill, } from '../../services/skill-resolver.js';
8
+ import { OUTPUT_CONTRACTS } from '../output-contracts.js';
9
+ export async function buildDiagramSystemPrompt(skillRef, contractKey, opts) {
10
+ const skill = await resolveSkill(skillRef, { projectDir: opts?.projectDir });
11
+ if (!skill) {
12
+ throw new Error(`Failed to load skill: ${skillRef}`);
13
+ }
14
+ const prompt = processConditionals(skill.prompt, {
15
+ hasCodebase: opts?.hasCodebase ?? true,
16
+ });
17
+ return `${prompt}
18
+
19
+ ${OUTPUT_CONTRACTS[contractKey]}`;
20
+ }
21
+ export function buildDiagramUserPrompt(args) {
22
+ const descBlock = args.productDescription
23
+ ? `\n**Product description**: ${args.productDescription}`
24
+ : '';
25
+ const guidanceBlock = args.guidance
26
+ ? `\n\n**Human guidance for this run** (focus or exclude as instructed):\n${args.guidance}`
27
+ : '';
28
+ return `${args.task} **${args.productName}**.${descBlock}${guidanceBlock}
29
+
30
+ ${args.process}
31
+
32
+ Call \`mcp__${args.mcpName}__record_progress\` at each phase boundary so the user can see your progress (otherwise the CLI looks frozen).
33
+
34
+ When you are done, return the result by **calling the \`mcp__${args.mcpName}__submit_${args.toolName}\` tool exactly once**. Do not paste the JSON as a fenced text block — the tool call is the deliverable. If the tool returns an error, fix the issue it describes and call the tool again.`;
35
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Phase: discover-services (GitHub Discovery)
3
+ *
4
+ * Scans every repository in a team's connected GitHub organisation and infers
5
+ * a service for each one. The server mints a short-lived org-scoped token
6
+ * (`github/org_token`) and the CLI reads each repo's signal files directly via
7
+ * Octokit — a handful of root files (README, package manifests, Dockerfile) —
8
+ * so private repos are read over the API without cloning. It then derives a
9
+ * service identity (name, language, kind, description) heuristically and
10
+ * upserts it into the team-scoped service catalog (`services` + a `repo`
11
+ * component).
12
+ *
13
+ * Progress is recorded against a `discovery_runs` row: the run is flipped to
14
+ * `running`, heart-beaten on every repo, and finalized as `success`/`failed`.
15
+ * The desktop Discover Services page reads that row to render live status.
16
+ */
17
+ export interface DiscoverServicesResult {
18
+ status: 'success' | 'error';
19
+ message: string;
20
+ reposScanned: number;
21
+ servicesCreated: number;
22
+ servicesUpdated: number;
23
+ }
24
+ export declare function discoverServices(opts: {
25
+ teamId: string;
26
+ runId?: string;
27
+ org?: string;
28
+ verbose?: boolean;
29
+ }): Promise<DiscoverServicesResult>;