@likec4/language-server 1.33.0 → 1.34.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 (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 +8 -8
  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
@@ -50,6 +50,8 @@ declare const DocumentParserFromMixins: {
50
50
  parseRelationExprOrWhere(astNode: import("../generated/ast").RelationExprOrWhere): ProjectId;
51
51
  parseRelationExprWhere(astNode: import("../generated/ast").RelationExprWhere): ProjectId;
52
52
  parseRelationExpr(astNode: import("../generated/ast").RelationExpr): ProjectId;
53
+ parseInlineKindCondition(astNode: import("../generated/ast").OutgoingRelationExpr): ProjectId | null;
54
+ wrapInWhere(expr: ProjectId, condition: ProjectId | null): ProjectId;
53
55
  isValid: import("../validation").IsValidFn;
54
56
  readonly services: LikeC4Services;
55
57
  readonly doc: ParsedLikeC4LangiumDocument;
@@ -141,6 +143,8 @@ declare const DocumentParserFromMixins: {
141
143
  parseRelationExprOrWhere(astNode: import("../generated/ast").RelationExprOrWhere): ProjectId;
142
144
  parseRelationExprWhere(astNode: import("../generated/ast").RelationExprWhere): ProjectId;
143
145
  parseRelationExpr(astNode: import("../generated/ast").RelationExpr): ProjectId;
146
+ parseInlineKindCondition(astNode: import("../generated/ast").OutgoingRelationExpr): ProjectId | null;
147
+ wrapInWhere(expr: ProjectId, condition: ProjectId | null): ProjectId;
144
148
  isValid: import("../validation").IsValidFn;
145
149
  readonly services: LikeC4Services;
146
150
  readonly doc: ParsedLikeC4LangiumDocument;
@@ -263,6 +267,8 @@ declare const DocumentParserFromMixins: {
263
267
  parseRelationExprOrWhere(astNode: import("../generated/ast").RelationExprOrWhere): ProjectId;
264
268
  parseRelationExprWhere(astNode: import("../generated/ast").RelationExprWhere): ProjectId;
265
269
  parseRelationExpr(astNode: import("../generated/ast").RelationExpr): ProjectId;
270
+ parseInlineKindCondition(astNode: import("../generated/ast").OutgoingRelationExpr): ProjectId | null;
271
+ wrapInWhere(expr: ProjectId, condition: ProjectId | null): ProjectId;
266
272
  isValid: import("../validation").IsValidFn;
267
273
  readonly services: LikeC4Services;
268
274
  readonly doc: ParsedLikeC4LangiumDocument;
@@ -323,6 +329,8 @@ declare const DocumentParserFromMixins: {
323
329
  parseRelationExprOrWhere(astNode: import("../generated/ast").RelationExprOrWhere): ProjectId;
324
330
  parseRelationExprWhere(astNode: import("../generated/ast").RelationExprWhere): ProjectId;
325
331
  parseRelationExpr(astNode: import("../generated/ast").RelationExpr): ProjectId;
332
+ parseInlineKindCondition(astNode: import("../generated/ast").OutgoingRelationExpr): ProjectId | null;
333
+ wrapInWhere(expr: ProjectId, condition: ProjectId | null): ProjectId;
326
334
  isValid: import("../validation").IsValidFn;
327
335
  readonly services: LikeC4Services;
328
336
  readonly doc: ParsedLikeC4LangiumDocument;
@@ -391,6 +399,8 @@ declare const DocumentParserFromMixins: {
391
399
  parseRelationExprOrWhere(astNode: import("../generated/ast").RelationExprOrWhere): ProjectId;
392
400
  parseRelationExprWhere(astNode: import("../generated/ast").RelationExprWhere): ProjectId;
393
401
  parseRelationExpr(astNode: import("../generated/ast").RelationExpr): ProjectId;
402
+ parseInlineKindCondition(astNode: import("../generated/ast").OutgoingRelationExpr): ProjectId | null;
403
+ wrapInWhere(expr: ProjectId, condition: ProjectId | null): ProjectId;
394
404
  isValid: import("../validation").IsValidFn;
395
405
  readonly services: LikeC4Services;
396
406
  readonly doc: ParsedLikeC4LangiumDocument;
@@ -452,6 +462,8 @@ declare const DocumentParserFromMixins: {
452
462
  parseRelationExprOrWhere(astNode: import("../generated/ast").RelationExprOrWhere): ProjectId;
453
463
  parseRelationExprWhere(astNode: import("../generated/ast").RelationExprWhere): ProjectId;
454
464
  parseRelationExpr(astNode: import("../generated/ast").RelationExpr): ProjectId;
465
+ parseInlineKindCondition(astNode: import("../generated/ast").OutgoingRelationExpr): ProjectId | null;
466
+ wrapInWhere(expr: ProjectId, condition: ProjectId | null): ProjectId;
455
467
  isValid: import("../validation").IsValidFn;
456
468
  readonly services: LikeC4Services;
457
469
  readonly doc: ParsedLikeC4LangiumDocument;
@@ -551,6 +563,8 @@ declare const DocumentParserFromMixins: {
551
563
  parseRelationExprOrWhere(astNode: import("../generated/ast").RelationExprOrWhere): ProjectId;
552
564
  parseRelationExprWhere(astNode: import("../generated/ast").RelationExprWhere): ProjectId;
553
565
  parseRelationExpr(astNode: import("../generated/ast").RelationExpr): ProjectId;
566
+ parseInlineKindCondition(astNode: import("../generated/ast").OutgoingRelationExpr): ProjectId | null;
567
+ wrapInWhere(expr: ProjectId, condition: ProjectId | null): ProjectId;
554
568
  isValid: import("../validation").IsValidFn;
555
569
  readonly services: LikeC4Services;
556
570
  readonly doc: ParsedLikeC4LangiumDocument;
@@ -24,7 +24,9 @@ export declare function DeploymentModelParser<TBase extends WithExpressionV2>(B:
24
24
  parseRelationExprWith(astNode: ast.RelationExprWith): c4.RelationExpr.Custom;
25
25
  parseRelationExprOrWhere(astNode: ast.RelationExprOrWhere): c4.RelationExpr.OrWhere;
26
26
  parseRelationExprWhere(astNode: ast.RelationExprWhere): c4.RelationExpr.Where;
27
- parseRelationExpr(astNode: ast.RelationExpr): c4.RelationExpr;
27
+ parseRelationExpr(astNode: ast.RelationExpr): c4.RelationExpr.OrWhere;
28
+ parseInlineKindCondition(astNode: ast.OutgoingRelationExpr): c4.WhereOperator | null;
29
+ wrapInWhere(expr: c4.RelationExpr, condition: c4.WhereOperator | null): c4.RelationExpr.OrWhere;
28
30
  isValid: import("../../validation").IsValidFn;
29
31
  readonly services: import("../..").LikeC4Services;
30
32
  readonly doc: import("../../ast").ParsedLikeC4LangiumDocument;
@@ -22,7 +22,9 @@ export declare function DeploymentViewParser<TBase extends WithExpressionV2 & Wi
22
22
  parseRelationExprWith(astNode: ast.RelationExprWith): c4.RelationExpr.Custom;
23
23
  parseRelationExprOrWhere(astNode: ast.RelationExprOrWhere): c4.RelationExpr.OrWhere;
24
24
  parseRelationExprWhere(astNode: ast.RelationExprWhere): c4.RelationExpr.Where;
25
- parseRelationExpr(astNode: ast.RelationExpr): c4.RelationExpr;
25
+ parseRelationExpr(astNode: ast.RelationExpr): c4.RelationExpr.OrWhere;
26
+ parseInlineKindCondition(astNode: ast.OutgoingRelationExpr): c4.WhereOperator | null;
27
+ wrapInWhere(expr: c4.RelationExpr, condition: c4.WhereOperator | null): c4.RelationExpr.OrWhere;
26
28
  isValid: import("../../validation").IsValidFn;
27
29
  readonly services: import("../..").LikeC4Services;
28
30
  readonly doc: import("../../ast").ParsedLikeC4LangiumDocument;
@@ -17,7 +17,9 @@ export declare function ExpressionV2Parser<TBase extends Base>(B: TBase): {
17
17
  parseRelationExprWith(astNode: ast.RelationExprWith): c4.RelationExpr.Custom;
18
18
  parseRelationExprOrWhere(astNode: ast.RelationExprOrWhere): c4.RelationExpr.OrWhere;
19
19
  parseRelationExprWhere(astNode: ast.RelationExprWhere): c4.RelationExpr.Where;
20
- parseRelationExpr(astNode: ast.RelationExpr): c4.RelationExpr;
20
+ parseRelationExpr(astNode: ast.RelationExpr): c4.RelationExpr.OrWhere;
21
+ parseInlineKindCondition(astNode: ast.OutgoingRelationExpr): c4.WhereOperator | null;
22
+ wrapInWhere(expr: c4.RelationExpr, condition: c4.WhereOperator | null): c4.RelationExpr.OrWhere;
21
23
  isValid: import("../../validation").IsValidFn;
22
24
  readonly services: import("../..").LikeC4Services;
23
25
  readonly doc: import("../../ast").ParsedLikeC4LangiumDocument;
@@ -4,7 +4,7 @@ import { ast, parseAstOpacityProperty, parseAstSizeValue, parseMarkdownAsString,
4
4
  import { logWarnError } from "../../logger.js";
5
5
  import { projectIdFrom } from "../../utils/index.js";
6
6
  import { importsRef, instanceRef } from "../../utils/fqnRef.js";
7
- import { parseWhereClause } from "../model-parser-where.js";
7
+ import { createBinaryOperator, parseWhereClause } from "../model-parser-where.js";
8
8
  import { removeIndent } from "./Base.js";
9
9
  export function ExpressionV2Parser(B) {
10
10
  return class ExpressionV2Parser extends B {
@@ -317,31 +317,44 @@ export function ExpressionV2Parser(B) {
317
317
  !ast.isRelationExprWhere(astNode.subject),
318
318
  "RelationExprWhere is not allowed as subject of RelationExprWhere"
319
319
  );
320
+ const relationOrWhereExpr = this.parseRelationExpr(astNode.subject);
321
+ const expr = relationOrWhereExpr.where?.expr ?? relationOrWhereExpr;
322
+ const kindCondition = relationOrWhereExpr.where?.condition;
323
+ const whereCondition = astNode.where ? parseWhereClause(astNode.where) : null;
324
+ let condition;
325
+ if (whereCondition && kindCondition) {
326
+ condition = createBinaryOperator(
327
+ "and",
328
+ kindCondition,
329
+ whereCondition
330
+ );
331
+ } else {
332
+ condition = whereCondition ?? kindCondition ?? { kind: { neq: "--always-true--" } };
333
+ }
320
334
  return {
321
335
  where: {
322
- expr: this.parseRelationExpr(astNode.subject),
323
- condition: astNode.where ? parseWhereClause(astNode.where) : {
324
- kind: { neq: "--always-true--" }
325
- }
336
+ expr,
337
+ condition
326
338
  }
327
339
  };
328
340
  }
329
341
  parseRelationExpr(astNode) {
330
342
  switch (astNode.$type) {
331
343
  case "DirectedRelationExpr":
332
- return {
344
+ return this.wrapInWhere({
333
345
  source: this.parseFqnExpr(astNode.source.from),
334
346
  target: this.parseFqnExpr(astNode.target),
335
347
  isBidirectional: astNode.source.isBidirectional
336
- };
348
+ }, this.parseInlineKindCondition(astNode.source));
337
349
  case "InOutRelationExpr":
338
350
  return {
339
351
  inout: this.parseFqnExpr(astNode.inout.to)
340
352
  };
341
353
  case "OutgoingRelationExpr":
342
- return {
343
- outgoing: this.parseFqnExpr(astNode.from)
344
- };
354
+ return this.wrapInWhere(
355
+ { outgoing: this.parseFqnExpr(astNode.from) },
356
+ this.parseInlineKindCondition(astNode)
357
+ );
345
358
  case "IncomingRelationExpr":
346
359
  return {
347
360
  incoming: this.parseFqnExpr(astNode.to)
@@ -350,5 +363,16 @@ export function ExpressionV2Parser(B) {
350
363
  nonexhaustive(astNode);
351
364
  }
352
365
  }
366
+ parseInlineKindCondition(astNode) {
367
+ const kind = astNode.kind ?? astNode.dotKind?.kind;
368
+ if (kind) {
369
+ invariant(kind.ref, "Kind is not resolved: " + astNode.$cstNode?.text);
370
+ return { kind: { eq: kind.ref?.name } };
371
+ }
372
+ return null;
373
+ }
374
+ wrapInWhere(expr, condition) {
375
+ return condition ? { where: { expr, condition } } : expr;
376
+ }
353
377
  };
354
378
  }
@@ -46,7 +46,9 @@ export declare function GlobalsParser<TBase extends WithViewsParser>(B: TBase):
46
46
  parseRelationExprWith(astNode: ast.RelationExprWith): c4.RelationExpr.Custom;
47
47
  parseRelationExprOrWhere(astNode: ast.RelationExprOrWhere): c4.RelationExpr.OrWhere;
48
48
  parseRelationExprWhere(astNode: ast.RelationExprWhere): c4.RelationExpr.Where;
49
- parseRelationExpr(astNode: ast.RelationExpr): c4.RelationExpr;
49
+ parseRelationExpr(astNode: ast.RelationExpr): c4.RelationExpr.OrWhere;
50
+ parseInlineKindCondition(astNode: ast.OutgoingRelationExpr): c4.WhereOperator | null;
51
+ wrapInWhere(expr: c4.RelationExpr, condition: c4.WhereOperator | null): c4.RelationExpr.OrWhere;
50
52
  isValid: import("../../validation").IsValidFn;
51
53
  readonly services: import("../..").LikeC4Services;
52
54
  readonly doc: import("../../ast").ParsedLikeC4LangiumDocument;
@@ -23,7 +23,9 @@ export declare function ModelParser<TBase extends WithExpressionV2>(B: TBase): {
23
23
  parseRelationExprWith(astNode: ast.RelationExprWith): c4.RelationExpr.Custom;
24
24
  parseRelationExprOrWhere(astNode: ast.RelationExprOrWhere): c4.RelationExpr.OrWhere;
25
25
  parseRelationExprWhere(astNode: ast.RelationExprWhere): c4.RelationExpr.Where;
26
- parseRelationExpr(astNode: ast.RelationExpr): c4.RelationExpr;
26
+ parseRelationExpr(astNode: ast.RelationExpr): c4.RelationExpr.OrWhere;
27
+ parseInlineKindCondition(astNode: ast.OutgoingRelationExpr): c4.WhereOperator | null;
28
+ wrapInWhere(expr: c4.RelationExpr, condition: c4.WhereOperator | null): c4.RelationExpr.OrWhere;
27
29
  isValid: import("../../validation").IsValidFn;
28
30
  readonly services: import("../..").LikeC4Services;
29
31
  readonly doc: import("../../ast").ParsedLikeC4LangiumDocument;
@@ -28,7 +28,9 @@ export declare function PredicatesParser<TBase extends WithExpressionV2>(B: TBas
28
28
  parseRelationExprWith(astNode: ast.RelationExprWith): c4.RelationExpr.Custom;
29
29
  parseRelationExprOrWhere(astNode: ast.RelationExprOrWhere): c4.RelationExpr.OrWhere;
30
30
  parseRelationExprWhere(astNode: ast.RelationExprWhere): c4.RelationExpr.Where;
31
- parseRelationExpr(astNode: ast.RelationExpr): c4.RelationExpr;
31
+ parseRelationExpr(astNode: ast.RelationExpr): c4.RelationExpr.OrWhere;
32
+ parseInlineKindCondition(astNode: ast.OutgoingRelationExpr): c4.WhereOperator | null;
33
+ wrapInWhere(expr: c4.RelationExpr, condition: c4.WhereOperator | null): c4.RelationExpr.OrWhere;
32
34
  isValid: import("../../validation").IsValidFn;
33
35
  readonly services: import("../..").LikeC4Services;
34
36
  readonly doc: import("../../ast").ParsedLikeC4LangiumDocument;
@@ -44,7 +44,9 @@ export declare function ViewsParser<TBase extends WithPredicates & WithDeploymen
44
44
  parseRelationExprWith(astNode: ast.RelationExprWith): c4.RelationExpr.Custom;
45
45
  parseRelationExprOrWhere(astNode: ast.RelationExprOrWhere): c4.RelationExpr.OrWhere;
46
46
  parseRelationExprWhere(astNode: ast.RelationExprWhere): c4.RelationExpr.Where;
47
- parseRelationExpr(astNode: ast.RelationExpr): c4.RelationExpr;
47
+ parseRelationExpr(astNode: ast.RelationExpr): c4.RelationExpr.OrWhere;
48
+ parseInlineKindCondition(astNode: ast.OutgoingRelationExpr): c4.WhereOperator | null;
49
+ wrapInWhere(expr: c4.RelationExpr, condition: c4.WhereOperator | null): c4.RelationExpr.OrWhere;
48
50
  isValid: import("../../validation").IsValidFn;
49
51
  readonly services: import("../..").LikeC4Services;
50
52
  readonly doc: import("../../ast").ParsedLikeC4LangiumDocument;
package/dist/module.d.ts CHANGED
@@ -4,8 +4,7 @@ import { type DefaultSharedModuleContext, type LangiumServices, type LangiumShar
4
4
  import { LikeC4DocumentationProvider } from './documentation';
5
5
  import { type LikeC4LanguageServices } from './LikeC4LanguageServices';
6
6
  import { LikeC4CodeLensProvider, LikeC4CompletionProvider, LikeC4DocumentHighlightProvider, LikeC4DocumentLinkProvider, LikeC4DocumentSymbolProvider, LikeC4HoverProvider, LikeC4SemanticTokenProvider } from './lsp';
7
- import { type LikeC4MCPServer, type LikeC4MCPServerFactory } from './mcp/LikeC4MCPServerFactory';
8
- import { type LikeC4MCPTools } from './mcp/LikeC4MCPTools';
7
+ import { type LikeC4MCPServer, type LikeC4MCPServerFactory } from './mcp/interfaces';
9
8
  import { type LikeC4ModelBuilder, DeploymentsIndex, FqnIndex, LikeC4ModelLocator, LikeC4ModelParser, LikeC4ValueConverter } from './model';
10
9
  import { LikeC4ModelChanges } from './model-change/ModelChanges';
11
10
  import { LikeC4NameProvider, LikeC4ScopeComputation, LikeC4ScopeProvider } from './references';
@@ -36,7 +35,6 @@ export interface LikeC4AddedServices {
36
35
  ValidatedWorkspaceCache: WorkspaceCache<string, any>;
37
36
  Rpc: Rpc;
38
37
  mcp: {
39
- Tools: LikeC4MCPTools;
40
38
  Server: LikeC4MCPServer;
41
39
  ServerFactory: LikeC4MCPServerFactory;
42
40
  };
package/dist/module.js CHANGED
@@ -25,11 +25,7 @@ import {
25
25
  LikeC4HoverProvider,
26
26
  LikeC4SemanticTokenProvider
27
27
  } from "./lsp/index.js";
28
- import {
29
- NoopLikeC4MCPServer,
30
- NoopLikeC4MCPServerFactory
31
- } from "./mcp/LikeC4MCPServerFactory.js";
32
- import { DefaultLikeC4MCPTools } from "./mcp/LikeC4MCPTools.js";
28
+ import { NoopLikeC4MCPServer, NoopLikeC4MCPServerFactory } from "./mcp/NoopLikeC4MCPServer.js";
33
29
  import {
34
30
  DefaultLikeC4ModelBuilder,
35
31
  DeploymentsIndex,
@@ -80,7 +76,6 @@ export const LikeC4Module = {
80
76
  ValidatedWorkspaceCache: (services) => new WorkspaceCache(services.shared, DocumentState.Validated),
81
77
  Rpc: bind(Rpc),
82
78
  mcp: {
83
- Tools: bind(DefaultLikeC4MCPTools),
84
79
  Server: bind(NoopLikeC4MCPServer),
85
80
  ServerFactory: bind(NoopLikeC4MCPServerFactory)
86
81
  },
@@ -5,6 +5,19 @@ export declare namespace DidChangeModelNotification {
5
5
  const type: NotificationType<string>;
6
6
  type Type = typeof type;
7
7
  }
8
+ /**
9
+ * When server requests to open a likec4 preview panel
10
+ * (available only in the editor).
11
+ * (not the best place, but seems to be working)
12
+ */
13
+ export declare namespace DidRequestOpenViewNotification {
14
+ type Params = {
15
+ viewId: ViewId;
16
+ projectId: ProjectId;
17
+ };
18
+ const type: NotificationType<Params>;
19
+ type Type = typeof type;
20
+ }
8
21
  /**
9
22
  * Request to fetch the computed model data
10
23
  * If LSP has multiple projects, the projectId is required.
@@ -175,9 +188,12 @@ export declare namespace FetchTelemetryMetrics {
175
188
  type Res = {
176
189
  metrics: null | {
177
190
  elementKinds: number;
191
+ deploymentKinds: number;
178
192
  relationshipKinds: number;
179
193
  tags: number;
194
+ customColors: number;
180
195
  elements: number;
196
+ deploymentNodes: number;
181
197
  relationships: number;
182
198
  views: number;
183
199
  projects: number;
package/dist/protocol.js CHANGED
@@ -3,6 +3,10 @@ export var DidChangeModelNotification;
3
3
  ((DidChangeModelNotification2) => {
4
4
  DidChangeModelNotification2.type = new NotificationType("likec4/onDidChangeModel");
5
5
  })(DidChangeModelNotification || (DidChangeModelNotification = {}));
6
+ export var DidRequestOpenViewNotification;
7
+ ((DidRequestOpenViewNotification2) => {
8
+ DidRequestOpenViewNotification2.type = new NotificationType("likec4/onRequestOpenView");
9
+ })(DidRequestOpenViewNotification || (DidRequestOpenViewNotification = {}));
6
10
  export var FetchComputedModel;
7
11
  ((FetchComputedModel2) => {
8
12
  FetchComputedModel2.req = new RequestType("likec4/fetchComputedModel");
@@ -48,7 +48,7 @@ export const notesPropertyRuleChecks = (_) => {
48
48
  export const colorLiteralRuleChecks = (_) => {
49
49
  return (node, accept) => {
50
50
  if (node.$type === "HexColor") {
51
- if (node.hex === void 0) {
51
+ if (node.hex === void 0 || isString(node.hex) && !node.hex.match(/^[a-fA-F0-9]+$/)) {
52
52
  accept("error", `Invalid HEX`, {
53
53
  node,
54
54
  property: "hex"
@@ -18,6 +18,7 @@ export interface LikeC4Views {
18
18
  layoutView(viewId: ViewId, projectId?: ProjectId | undefined, cancelToken?: CancellationToken): Promise<GraphvizOut | null>;
19
19
  diagrams(projectId?: ProjectId | undefined, cancelToken?: CancellationToken): Promise<Array<DiagramView>>;
20
20
  viewsAsGraphvizOut(projectId?: ProjectId | undefined, cancelToken?: CancellationToken): Promise<Array<GraphvizSvgOut>>;
21
+ openView(viewId: ViewId, projectId?: ProjectId | undefined): Promise<void>;
21
22
  }
22
23
  export declare class DefaultLikeC4Views implements LikeC4Views {
23
24
  private services;
@@ -31,5 +32,9 @@ export declare class DefaultLikeC4Views implements LikeC4Views {
31
32
  layoutView(viewId: ViewId, projectId?: ProjectId | undefined, cancelToken?: CancellationToken): Promise<GraphvizOut | null>;
32
33
  diagrams(projectId?: ProjectId | undefined, cancelToken?: CancellationToken): Promise<Array<DiagramView>>;
33
34
  viewsAsGraphvizOut(projectId?: ProjectId | undefined, cancelToken?: CancellationToken): Promise<Array<GraphvizSvgOut>>;
35
+ /**
36
+ * Open a view in the preview panel.
37
+ */
38
+ openView(viewId: ViewId, projectId: ProjectId): Promise<void>;
34
39
  }
35
40
  export {};
@@ -134,6 +134,12 @@ export class DefaultLikeC4Views {
134
134
  cache.set(KEY, succeed);
135
135
  return succeed;
136
136
  }
137
+ /**
138
+ * Open a view in the preview panel.
139
+ */
140
+ async openView(viewId, projectId) {
141
+ await this.services.Rpc.openView({ viewId, projectId });
142
+ }
137
143
  // async overviewGraph(): Promise<OverviewGraph> {
138
144
  // const KEY = 'OverviewGraph'
139
145
  // const cache = this.services.ValidatedWorkspaceCache as WorkspaceCache<string, OverviewGraph>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@likec4/language-server",
3
3
  "description": "LikeC4 Language Server",
4
- "version": "1.33.0",
4
+ "version": "1.34.0",
5
5
  "license": "MIT",
6
6
  "bugs": "https://github.com/likec4/likec4/issues",
7
7
  "homepage": "https://likec4.dev",
@@ -89,11 +89,11 @@
89
89
  "access": "public"
90
90
  },
91
91
  "dependencies": {
92
- "@hpcc-js/wasm-graphviz": "1.7.0"
92
+ "@hpcc-js/wasm-graphviz": "1.8.0"
93
93
  },
94
94
  "devDependencies": {
95
95
  "@types/chroma-js": "^3.1.1",
96
- "@modelcontextprotocol/sdk": "^1.13.1",
96
+ "@modelcontextprotocol/sdk": "^1.13.2",
97
97
  "@msgpack/msgpack": "^3.1.2",
98
98
  "@smithy/util-base64": "^4.0.0",
99
99
  "@types/express": "^5.0.3",
@@ -132,11 +132,11 @@
132
132
  "vscode-uri": "3.1.0",
133
133
  "which": "^5.0.0",
134
134
  "zod": "3.25.67",
135
- "@likec4/core": "1.33.0",
136
- "@likec4/layouts": "1.33.0",
137
- "@likec4/log": "1.33.0",
138
- "@likec4/tsconfig": "1.33.0",
139
- "@likec4/icons": "1.33.0"
135
+ "@likec4/core": "1.34.0",
136
+ "@likec4/icons": "1.34.0",
137
+ "@likec4/layouts": "1.34.0",
138
+ "@likec4/log": "1.34.0",
139
+ "@likec4/tsconfig": "1.34.0"
140
140
  },
141
141
  "scripts": {
142
142
  "typecheck": "tsc -b --verbose",
@@ -1,96 +0,0 @@
1
- import { type ProjectId } from '@likec4/core';
2
- import { z } from 'zod';
3
- import type { LikeC4Services } from '../module';
4
- export declare namespace LikeC4MCPTools {
5
- const instructions = "This server provides access to LikeC4 model.\n\nKey capabilities:\n- List all available LikeC4 projects in the workspace\n- Search for LikeC4 project and return its summary, that includes specifications, all elements and views\n- Search for LikeC4 element by title\n- Read details about LikeC4 element by id\n- Read details about LikeC4 view by id\n\n";
6
- const listProjects: {
7
- name: string;
8
- description: string;
9
- };
10
- const readProjectSummary: {
11
- name: string;
12
- description: string;
13
- paramsSchema: {
14
- project: z.ZodOptional<z.ZodString>;
15
- };
16
- };
17
- const searchElement: {
18
- name: string;
19
- description: string;
20
- paramsSchema: {
21
- search: z.ZodString;
22
- };
23
- };
24
- const readElement: {
25
- name: string;
26
- description: string;
27
- paramsSchema: {
28
- id: z.ZodString;
29
- project: z.ZodOptional<z.ZodString>;
30
- };
31
- };
32
- const readView: {
33
- name: string;
34
- description: string;
35
- paramsSchema: {
36
- id: z.ZodString;
37
- project: z.ZodOptional<z.ZodString>;
38
- };
39
- };
40
- }
41
- export interface LikeC4MCPTools {
42
- listProjects(): Promise<string>;
43
- /**
44
- * Searches for LikeC4 project and returns its summary, specifications, elements and views
45
- *
46
- * @param project Project name (optional, will use default project if not specified)
47
- */
48
- readProjectSummary(project?: string): Promise<string>;
49
- /**
50
- * Searches for LikeC4 elements that have the search string in their names
51
- * Can be used to resolve projects for further requests (like read-element or read-project-summary)
52
- *
53
- * @param params.search non-empty string
54
- */
55
- searchElement(params: {
56
- search: string;
57
- }): Promise<string>;
58
- /**
59
- * Read details about LikeC4 element.
60
- *
61
- * @param params.id Element id (FQN)
62
- * @param params.project Project name (optional, will use default project if not specified)
63
- */
64
- readElement(params: {
65
- id: string;
66
- project?: string | undefined;
67
- }): Promise<string>;
68
- /**
69
- * Read details about LikeC4 view.
70
- *
71
- * @param params.id View id (FQN)
72
- * @param params.project Project name (optional, will use default project if not specified)
73
- */
74
- readView(params: {
75
- id: string;
76
- project?: string | undefined;
77
- }): Promise<string>;
78
- }
79
- export declare class DefaultLikeC4MCPTools implements LikeC4MCPTools {
80
- private services;
81
- private readonly languageServices;
82
- constructor(services: LikeC4Services);
83
- listProjects(): Promise<string>;
84
- readProjectSummary(_project?: ProjectId): Promise<string>;
85
- searchElement(params: {
86
- search: string;
87
- }): Promise<string>;
88
- readElement(params: {
89
- id: string;
90
- project?: string;
91
- }): Promise<string>;
92
- readView(params: {
93
- id: string;
94
- project?: string;
95
- }): Promise<string>;
96
- }