@likec4/language-server 1.33.0 → 1.34.1

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 (59) hide show
  1. package/README.md +27 -1
  2. package/dist/Rpc.d.ts +2 -0
  3. package/dist/Rpc.js +24 -6
  4. package/dist/bundled.mjs +2747 -2892
  5. package/dist/formatting/LikeC4Formatter.d.ts +1 -0
  6. package/dist/formatting/LikeC4Formatter.js +25 -1
  7. package/dist/generated/ast.d.ts +1 -1
  8. package/dist/generated/ast.js +5 -5
  9. package/dist/generated/grammar.js +1 -1
  10. package/dist/index.d.ts +0 -1
  11. package/dist/index.js +1 -2
  12. package/dist/mcp/{LikeC4MCPServerFactory.d.ts → NoopLikeC4MCPServer.d.ts} +1 -9
  13. package/dist/mcp/interfaces.d.ts +11 -0
  14. package/dist/mcp/interfaces.js +0 -0
  15. package/dist/mcp/sseserver/MCPServer.d.ts +1 -1
  16. package/dist/mcp/sseserver/MCPServer.js +5 -5
  17. package/dist/mcp/sseserver/MCPServerFactory.js +30 -58
  18. package/dist/mcp/sseserver/{with-mcp-server.d.ts → WithMCPServer.d.ts} +1 -1
  19. package/dist/mcp/tools/_common.d.ts +68 -0
  20. package/dist/mcp/tools/_common.js +14 -0
  21. package/dist/mcp/tools/list-projects.d.ts +6 -0
  22. package/dist/mcp/tools/list-projects.js +31 -0
  23. package/dist/mcp/tools/open-view.d.ts +10 -0
  24. package/dist/mcp/tools/open-view.js +29 -0
  25. package/dist/mcp/tools/read-element.d.ts +10 -0
  26. package/dist/mcp/tools/read-element.js +135 -0
  27. package/dist/mcp/tools/read-project-elements.d.ts +8 -0
  28. package/dist/mcp/tools/read-project-elements.js +93 -0
  29. package/dist/mcp/tools/read-project-summary.d.ts +8 -0
  30. package/dist/mcp/tools/read-project-summary.js +68 -0
  31. package/dist/mcp/tools/read-view.d.ts +10 -0
  32. package/dist/mcp/tools/read-view.js +164 -0
  33. package/dist/mcp/tools/search-element.d.ts +8 -0
  34. package/dist/mcp/tools/search-element.js +105 -0
  35. package/dist/mcp/utils.d.ts +17 -34
  36. package/dist/mcp/utils.js +41 -101
  37. package/dist/model/model-parser-where.d.ts +1 -0
  38. package/dist/model/model-parser-where.js +30 -24
  39. package/dist/model/model-parser.d.ts +14 -0
  40. package/dist/model/parser/DeploymentModelParser.d.ts +3 -1
  41. package/dist/model/parser/DeploymentViewParser.d.ts +3 -1
  42. package/dist/model/parser/FqnRefParser.d.ts +3 -1
  43. package/dist/model/parser/FqnRefParser.js +34 -10
  44. package/dist/model/parser/GlobalsParser.d.ts +3 -1
  45. package/dist/model/parser/ModelParser.d.ts +3 -1
  46. package/dist/model/parser/PredicatesParser.d.ts +3 -1
  47. package/dist/model/parser/ViewsParser.d.ts +3 -1
  48. package/dist/module.d.ts +1 -3
  49. package/dist/module.js +1 -6
  50. package/dist/protocol.d.ts +16 -0
  51. package/dist/protocol.js +4 -0
  52. package/dist/validation/property-checks.js +1 -1
  53. package/dist/views/likec4-views.d.ts +5 -0
  54. package/dist/views/likec4-views.js +6 -0
  55. package/package.json +7 -7
  56. package/dist/mcp/LikeC4MCPTools.d.ts +0 -96
  57. package/dist/mcp/LikeC4MCPTools.js +0 -293
  58. /package/dist/mcp/{LikeC4MCPServerFactory.js → NoopLikeC4MCPServer.js} +0 -0
  59. /package/dist/mcp/sseserver/{with-mcp-server.js → WithMCPServer.js} +0 -0
package/README.md CHANGED
@@ -12,6 +12,7 @@ likec4-language-server --stdio
12
12
  ```
13
13
 
14
14
  Valid arguments:
15
+
15
16
  - `--node-ipc`
16
17
  - `--stdio`
17
18
  - `--socket={number}`
@@ -19,9 +20,34 @@ Valid arguments:
19
20
  ### Usage in code
20
21
 
21
22
  ```js
22
- import { startLanguageServer } from '@likec4/language-server/bundled';
23
+ import { startLanguageServer } from '@likec4/language-server/bundled'
23
24
  startLanguageServer().catch((e) => {
24
25
  console.error(e)
25
26
  process.exit(1)
26
27
  })
27
28
  ```
29
+
30
+ ## Getting help
31
+
32
+ We are always happy to help you get started:
33
+
34
+ - [Join Discord community](https://discord.gg/86ZSpjKAdA) – it is the easiest way to get help
35
+ - [GitHub Discussions](https://github.com/likec4/likec4/discussions) – ask anything about the project or give feedback
36
+
37
+ ## Contributors
38
+
39
+ <a href="https://github.com/likec4/likec4/graphs/contributors">
40
+ <img src="https://contrib.rocks/image?repo=likec4/likec4" />
41
+ </a>
42
+
43
+ [Become a contributor](../../CONTRIBUTING.md)
44
+
45
+ ## Support development
46
+
47
+ LikeC4 is a MIT-licensed open source project with its ongoing development made possible entirely by your support.\
48
+ If you like the project, please consider contributing financially to help grow and improve it.\
49
+ You can support us via [OpenCollective](https://opencollective.com/likec4) or [GitHub Sponsors](https://github.com/sponsors/likec4).
50
+
51
+ ## License
52
+
53
+ This project is released under the [MIT License](LICENSE)
package/dist/Rpc.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import type { LikeC4Services } from './module';
2
+ import { DidRequestOpenViewNotification } from './protocol';
2
3
  import { ADisposable } from './utils';
3
4
  export declare class Rpc extends ADisposable {
4
5
  private services;
5
6
  constructor(services: LikeC4Services);
6
7
  init(): void;
8
+ openView(params: DidRequestOpenViewNotification.Params): Promise<void>;
7
9
  }
package/dist/Rpc.js CHANGED
@@ -11,6 +11,7 @@ import {
11
11
  ChangeView,
12
12
  ComputeView,
13
13
  DidChangeModelNotification,
14
+ DidRequestOpenViewNotification,
14
15
  FetchComputedModel,
15
16
  FetchLayoutedModel,
16
17
  FetchProjects,
@@ -195,12 +196,15 @@ export class Rpc extends ADisposable {
195
196
  return Promise.reject(new Error(`Model is empty`));
196
197
  }
197
198
  return {
198
- elementKinds: keys(model.$model.specification.elements).length,
199
- relationshipKinds: keys(model.$model.specification.relationships).length,
200
- tags: keys(model.$model.specification.tags ?? {}).length,
201
- elements: keys(model.$model.elements).length,
202
- relationships: keys(model.$model.relations).length,
203
- views: keys(model.$model.views).length,
199
+ elementKinds: keys(model.specification.elements).length,
200
+ deploymentKinds: keys(model.specification.deployments).length,
201
+ relationshipKinds: keys(model.specification.relationships).length,
202
+ tags: keys(model.specification.tags).length,
203
+ customColors: keys(model.specification.customColors ?? {}).length,
204
+ elements: keys(model.$data.elements).length,
205
+ deploymentNodes: [...model.deployment.nodes()].length,
206
+ relationships: keys(model.$data.relations).length,
207
+ views: keys(model.$data.views).length,
204
208
  projects: 1
205
209
  };
206
210
  });
@@ -209,9 +213,12 @@ export class Rpc extends ADisposable {
209
213
  const values = results.filter((r) => r.status === "fulfilled").map((r) => r.value);
210
214
  const metrics = values.length > 0 ? values.reduce((acc, r) => ({
211
215
  elementKinds: acc.elementKinds + r.elementKinds,
216
+ deploymentKinds: acc.deploymentKinds + r.deploymentKinds,
212
217
  relationshipKinds: acc.relationshipKinds + r.relationshipKinds,
213
218
  tags: acc.tags + r.tags,
219
+ customColors: acc.customColors + r.customColors,
214
220
  elements: acc.elements + r.elements,
221
+ deploymentNodes: acc.deploymentNodes + r.deploymentNodes,
215
222
  relationships: acc.relationships + r.relationships,
216
223
  views: acc.views + r.views,
217
224
  projects: acc.projects + 1
@@ -246,4 +253,15 @@ export class Rpc extends ADisposable {
246
253
  );
247
254
  }
248
255
  }
256
+ async openView(params) {
257
+ const lspConnection = this.services.shared.lsp.Connection;
258
+ if (!lspConnection) {
259
+ logger.error("No LSP connection");
260
+ return;
261
+ }
262
+ await lspConnection.sendNotification(
263
+ DidRequestOpenViewNotification.type,
264
+ params
265
+ );
266
+ }
249
267
  }