@likec4/language-server 1.37.0 → 1.38.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 (62) hide show
  1. package/dist/LikeC4LanguageServices.d.ts +7 -4
  2. package/dist/LikeC4LanguageServices.js +12 -2
  3. package/dist/browser.d.ts +1 -1
  4. package/dist/browser.js +1 -1
  5. package/dist/bundled.mjs +4263 -3104
  6. package/dist/empty.d.ts +2 -0
  7. package/dist/empty.js +1 -0
  8. package/dist/filesystem/ChokidarWatcher.d.ts +14 -0
  9. package/dist/filesystem/ChokidarWatcher.js +64 -0
  10. package/dist/filesystem/FileSystemWatcher.d.ts +19 -0
  11. package/dist/filesystem/FileSystemWatcher.js +11 -0
  12. package/dist/filesystem/LikeC4FileSystem.d.ts +5 -0
  13. package/dist/filesystem/LikeC4FileSystem.js +56 -0
  14. package/dist/filesystem/index.d.ts +20 -0
  15. package/dist/filesystem/index.js +16 -0
  16. package/dist/index.d.ts +18 -4
  17. package/dist/index.js +23 -10
  18. package/dist/mcp/{sseserver/MCPServerFactory.d.ts → MCPServerFactory.d.ts} +1 -1
  19. package/dist/mcp/MCPServerFactory.js +69 -0
  20. package/dist/mcp/NoopLikeC4MCPServer.d.ts +4 -10
  21. package/dist/mcp/NoopLikeC4MCPServer.js +5 -10
  22. package/dist/mcp/interfaces.d.ts +7 -5
  23. package/dist/mcp/interfaces.js +4 -0
  24. package/dist/mcp/server/StdioLikeC4MCPServer.d.ts +16 -0
  25. package/dist/mcp/server/StdioLikeC4MCPServer.js +43 -0
  26. package/dist/mcp/{sseserver/MCPServer.d.ts → server/StreamableLikeC4MCPServer.d.ts} +3 -2
  27. package/dist/mcp/server/StreamableLikeC4MCPServer.js +156 -0
  28. package/dist/mcp/server/WithMCPServer.d.ts +2 -0
  29. package/dist/mcp/server/WithMCPServer.js +57 -0
  30. package/dist/mcp/tools/_common.d.ts +24 -5
  31. package/dist/mcp/tools/_common.js +31 -3
  32. package/dist/mcp/tools/find-relationships.d.ts +13 -0
  33. package/dist/mcp/tools/find-relationships.js +151 -0
  34. package/dist/mcp/tools/list-projects.js +40 -12
  35. package/dist/mcp/tools/open-view.d.ts +4 -3
  36. package/dist/mcp/tools/open-view.js +37 -14
  37. package/dist/mcp/tools/{read-project-elements.d.ts → read-deployment.d.ts} +6 -3
  38. package/dist/mcp/tools/read-deployment.js +130 -0
  39. package/dist/mcp/tools/read-element.d.ts +4 -3
  40. package/dist/mcp/tools/read-element.js +114 -51
  41. package/dist/mcp/tools/read-project-summary.d.ts +3 -2
  42. package/dist/mcp/tools/read-project-summary.js +139 -32
  43. package/dist/mcp/tools/read-view.d.ts +4 -3
  44. package/dist/mcp/tools/read-view.js +146 -105
  45. package/dist/mcp/tools/search-element.js +81 -30
  46. package/dist/mcp/utils.js +7 -4
  47. package/dist/module.d.ts +9 -9
  48. package/dist/module.js +24 -29
  49. package/dist/protocol.d.ts +1 -1
  50. package/dist/protocol.js +1 -1
  51. package/dist/test/testServices.js +3 -2
  52. package/dist/workspace/ProjectsManager.js +5 -2
  53. package/dist/workspace/WorkspaceManager.d.ts +9 -2
  54. package/dist/workspace/WorkspaceManager.js +30 -39
  55. package/package.json +14 -10
  56. package/dist/LikeC4FileSystem.d.ts +0 -14
  57. package/dist/LikeC4FileSystem.js +0 -39
  58. package/dist/mcp/sseserver/MCPServer.js +0 -80
  59. package/dist/mcp/sseserver/MCPServerFactory.js +0 -50
  60. package/dist/mcp/sseserver/WithMCPServer.d.ts +0 -9
  61. package/dist/mcp/sseserver/WithMCPServer.js +0 -53
  62. package/dist/mcp/tools/read-project-elements.js +0 -93
@@ -1,93 +0,0 @@
1
- import { invariant } from "@likec4/core";
2
- import z from "zod";
3
- import { safeCall } from "../../utils/index.js";
4
- import { ProjectsManager } from "../../workspace/index.js";
5
- import { likec4Tool } from "../utils.js";
6
- import { locationSchema } from "./_common.js";
7
- const elementSchema = z.array(
8
- z.discriminatedUnion("type", [
9
- z.object({
10
- type: z.literal("logical"),
11
- id: z.string().describe("Element ID (FQN)"),
12
- kind: z.string(),
13
- title: z.string(),
14
- description: z.string().nullish(),
15
- technology: z.string().nullish(),
16
- shape: z.string(),
17
- tags: z.array(z.string()),
18
- defaultView: z.string().nullish().describe("Name of the default view of this element"),
19
- sourceLocation: locationSchema.nullish()
20
- }),
21
- z.object({
22
- type: z.literal("deployment-node"),
23
- id: z.string().describe("Deployment ID (FQN)"),
24
- kind: z.string(),
25
- title: z.string(),
26
- description: z.string().nullish(),
27
- technology: z.string().nullish(),
28
- shape: z.string(),
29
- tags: z.array(z.string()),
30
- defaultView: z.string().nullish().describe("Name of the default view of this element"),
31
- sourceLocation: locationSchema.nullish()
32
- })
33
- ])
34
- );
35
- export const readProjectElements = likec4Tool({
36
- name: "read-project-elements",
37
- annotations: {
38
- readOnlyHint: true
39
- },
40
- description: `
41
- Returns array of all elements in the project:
42
- - type (logical or deployment-node)
43
- - id (FQN)
44
- - kind
45
- - title, description and technology
46
- - shape
47
- - assigned tags
48
- - name of the default view of this element if any (applies to logical elements only)
49
- - source location (where the element is defined, if running in the editor)
50
- `,
51
- inputSchema: {
52
- project: z.string().optional().describe('Project name (optional, will use "default" if not specified)')
53
- },
54
- outputSchema: {
55
- elements: elementSchema
56
- }
57
- }, async (languageServices, args) => {
58
- const projectId = args.project ?? ProjectsManager.DefaultProjectId;
59
- const project = languageServices.projects().find((p) => p.id === projectId);
60
- invariant(project, `Project "${projectId}" not found`);
61
- const model = await languageServices.computedModel(project.id);
62
- const elements = [];
63
- for (const el of model.elements()) {
64
- elements.push({
65
- type: "logical",
66
- id: el.id,
67
- title: el.title,
68
- description: el.description.text,
69
- technology: el.technology,
70
- kind: el.kind,
71
- tags: [...el.tags],
72
- shape: el.shape,
73
- defaultView: el.defaultView?.id,
74
- sourceLocation: safeCall(() => languageServices.locate({ element: el.id, projectId }))
75
- });
76
- }
77
- for (const el of model.deployment.nodes()) {
78
- elements.push({
79
- type: "deployment-node",
80
- id: el.id,
81
- title: el.title,
82
- description: el.description.text,
83
- technology: el.technology,
84
- kind: el.kind,
85
- tags: [...el.tags],
86
- shape: el.shape,
87
- sourceLocation: safeCall(() => languageServices.locate({ deployment: el.id, projectId }))
88
- });
89
- }
90
- return {
91
- elements
92
- };
93
- });