@likec4/language-server 1.39.1 → 1.39.3

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 (136) hide show
  1. package/dist/{LikeC4LanguageServices.js → LikeC4LanguageServices.mjs} +3 -3
  2. package/dist/{Rpc.js → Rpc.mjs} +3 -3
  3. package/dist/{ast.js → ast.mjs} +2 -2
  4. package/dist/browser-worker.mjs +2 -0
  5. package/dist/{browser.js → browser.mjs} +3 -3
  6. package/dist/bundled.mjs +1900 -1894
  7. package/dist/documentation/{documentation-provider.js → documentation-provider.mjs} +2 -2
  8. package/dist/documentation/{index.js → index.mjs} +1 -1
  9. package/dist/filesystem/{ChokidarWatcher.js → ChokidarWatcher.mjs} +8 -7
  10. package/dist/filesystem/LikeC4FileSystem.d.ts +1 -0
  11. package/dist/filesystem/{LikeC4FileSystem.js → LikeC4FileSystem.mjs} +6 -6
  12. package/dist/filesystem/{index.js → index.mjs} +1 -1
  13. package/dist/formatting/{LikeC4Formatter.js → LikeC4Formatter.mjs} +2 -2
  14. package/dist/generated/{module.js → module.mjs} +2 -2
  15. package/dist/{index.js → index.mjs} +9 -9
  16. package/dist/{likec4lib.js → likec4lib.mjs} +1 -1
  17. package/dist/lsp/{CodeLensProvider.js → CodeLensProvider.mjs} +3 -3
  18. package/dist/lsp/{CompletionProvider.js → CompletionProvider.mjs} +1 -1
  19. package/dist/lsp/{DocumentLinkProvider.js → DocumentLinkProvider.mjs} +2 -2
  20. package/dist/lsp/{DocumentSymbolProvider.js → DocumentSymbolProvider.mjs} +3 -3
  21. package/dist/lsp/{HoverProvider.js → HoverProvider.mjs} +1 -1
  22. package/dist/lsp/{SemanticTokenProvider.js → SemanticTokenProvider.mjs} +1 -1
  23. package/dist/lsp/index.mjs +7 -0
  24. package/dist/mcp/{MCPServerFactory.js → MCPServerFactory.mjs} +9 -9
  25. package/dist/mcp/{interfaces.js → interfaces.mjs} +1 -1
  26. package/dist/mcp/server/{StdioLikeC4MCPServer.js → StdioLikeC4MCPServer.mjs} +1 -1
  27. package/dist/mcp/server/{StreamableLikeC4MCPServer.js → StreamableLikeC4MCPServer.mjs} +1 -1
  28. package/dist/mcp/server/{WithMCPServer.js → WithMCPServer.mjs} +3 -3
  29. package/dist/mcp/tools/{_common.js → _common.mjs} +2 -2
  30. package/dist/mcp/tools/{find-relationships.js → find-relationships.mjs} +2 -2
  31. package/dist/mcp/tools/{list-projects.js → list-projects.mjs} +1 -1
  32. package/dist/mcp/tools/{open-view.js → open-view.mjs} +2 -2
  33. package/dist/mcp/tools/{read-deployment.js → read-deployment.mjs} +2 -2
  34. package/dist/mcp/tools/{read-element.js → read-element.mjs} +2 -2
  35. package/dist/mcp/tools/{read-project-summary.js → read-project-summary.mjs} +2 -2
  36. package/dist/mcp/tools/{read-view.js → read-view.mjs} +2 -2
  37. package/dist/mcp/tools/{search-element.js → search-element.mjs} +2 -2
  38. package/dist/mcp/{utils.js → utils.mjs} +1 -1
  39. package/dist/model/builder/{MergedSpecification.js → MergedSpecification.mjs} +2 -2
  40. package/dist/model/builder/{buildModel.js → buildModel.mjs} +4 -4
  41. package/dist/model/{deployments-index.js → deployments-index.mjs} +4 -4
  42. package/dist/model/{fqn-index.js → fqn-index.mjs} +5 -5
  43. package/dist/model/index.mjs +6 -0
  44. package/dist/model/{model-builder.js → model-builder.mjs} +5 -5
  45. package/dist/model/{model-locator.js → model-locator.mjs} +4 -4
  46. package/dist/model/{model-parser-where.js → model-parser-where.mjs} +1 -1
  47. package/dist/model/{model-parser.js → model-parser.mjs} +13 -13
  48. package/dist/model/parser/{Base.js → Base.mjs} +5 -5
  49. package/dist/model/parser/{DeploymentModelParser.js → DeploymentModelParser.mjs} +3 -3
  50. package/dist/model/parser/{DeploymentViewParser.js → DeploymentViewParser.mjs} +5 -5
  51. package/dist/model/parser/{FqnRefParser.js → FqnRefParser.mjs} +6 -6
  52. package/dist/model/parser/{GlobalsParser.js → GlobalsParser.mjs} +2 -2
  53. package/dist/model/parser/{ImportsParser.js → ImportsParser.mjs} +1 -1
  54. package/dist/model/parser/{ModelParser.js → ModelParser.mjs} +3 -3
  55. package/dist/model/parser/{PredicatesParser.js → PredicatesParser.mjs} +1 -1
  56. package/dist/model/parser/{SpecificationParser.js → SpecificationParser.mjs} +3 -3
  57. package/dist/model/parser/{ViewsParser.js → ViewsParser.mjs} +6 -6
  58. package/dist/model-change/{ModelChanges.js → ModelChanges.mjs} +3 -3
  59. package/dist/model-change/{changeElementStyle.js → changeElementStyle.mjs} +1 -1
  60. package/dist/model-change/{changeViewLayout.js → changeViewLayout.mjs} +1 -1
  61. package/dist/model-change/{saveManualLayout.js → saveManualLayout.mjs} +1 -1
  62. package/dist/{module.js → module.mjs} +16 -16
  63. package/dist/references/index.mjs +3 -0
  64. package/dist/references/{name-provider.js → name-provider.mjs} +1 -1
  65. package/dist/references/{scope-computation.js → scope-computation.mjs} +2 -2
  66. package/dist/references/{scope-provider.js → scope-provider.mjs} +4 -4
  67. package/dist/shared/{NodeKindProvider.js → NodeKindProvider.mjs} +1 -1
  68. package/dist/shared/index.mjs +2 -0
  69. package/dist/test/index.mjs +1 -0
  70. package/dist/test/{testServices.js → testServices.mjs} +2 -2
  71. package/dist/utils/{disposable.js → disposable.mjs} +1 -1
  72. package/dist/utils/{elementRef.js → elementRef.mjs} +1 -1
  73. package/dist/utils/{fqnRef.js → fqnRef.mjs} +1 -1
  74. package/dist/utils/{index.js → index.mjs} +6 -6
  75. package/dist/utils/{projectId.js → projectId.mjs} +1 -1
  76. package/dist/validation/{_shared.js → _shared.mjs} +1 -1
  77. package/dist/validation/{deployment-checks.js → deployment-checks.mjs} +3 -3
  78. package/dist/validation/{dynamic-view-step.js → dynamic-view-step.mjs} +2 -2
  79. package/dist/validation/{element-ref.js → element-ref.mjs} +2 -2
  80. package/dist/validation/{element.js → element.mjs} +2 -2
  81. package/dist/validation/{imports.js → imports.mjs} +2 -2
  82. package/dist/validation/{index.js → index.mjs} +13 -13
  83. package/dist/validation/{property-checks.js → property-checks.mjs} +2 -2
  84. package/dist/validation/{relation.js → relation.mjs} +2 -2
  85. package/dist/validation/{specification.js → specification.mjs} +3 -3
  86. package/dist/validation/view-predicates/{fqn-expr-with.js → fqn-expr-with.mjs} +4 -3
  87. package/dist/validation/view-predicates/{fqn-ref-expr.js → fqn-ref-expr.mjs} +3 -3
  88. package/dist/validation/view-predicates/{incoming.js → incoming.mjs} +2 -2
  89. package/dist/validation/view-predicates/index.mjs +6 -0
  90. package/dist/validation/view-predicates/{outgoing.js → outgoing.mjs} +2 -2
  91. package/dist/validation/view-predicates/{relation-expr.js → relation-expr.mjs} +2 -2
  92. package/dist/validation/view-predicates/{relation-with.js → relation-with.mjs} +2 -2
  93. package/dist/validation/{view.js → view.mjs} +3 -3
  94. package/dist/view-utils/index.mjs +2 -0
  95. package/dist/view-utils/{manual-layout.js → manual-layout.mjs} +1 -1
  96. package/dist/views/{configurable-layouter.js → configurable-layouter.mjs} +1 -1
  97. package/dist/views/index.mjs +1 -0
  98. package/dist/views/{likec4-views.js → likec4-views.mjs} +2 -2
  99. package/dist/workspace/{LangiumDocuments.js → LangiumDocuments.mjs} +2 -2
  100. package/dist/workspace/{ProjectsManager.js → ProjectsManager.mjs} +1 -1
  101. package/dist/workspace/{WorkspaceManager.js → WorkspaceManager.mjs} +2 -2
  102. package/dist/workspace/index.mjs +5 -0
  103. package/package.json +23 -21
  104. package/dist/browser-worker.js +0 -2
  105. package/dist/bundled.js +0 -40
  106. package/dist/lsp/index.js +0 -7
  107. package/dist/model/index.js +0 -6
  108. package/dist/references/index.js +0 -3
  109. package/dist/shared/index.js +0 -2
  110. package/dist/test/index.js +0 -1
  111. package/dist/validation/view-predicates/index.js +0 -6
  112. package/dist/view-utils/index.js +0 -2
  113. package/dist/views/index.js +0 -1
  114. package/dist/workspace/index.js +0 -5
  115. /package/dist/{empty.js → empty.mjs} +0 -0
  116. /package/dist/filesystem/{FileSystemWatcher.js → FileSystemWatcher.mjs} +0 -0
  117. /package/dist/formatting/{utils.js → utils.mjs} +0 -0
  118. /package/dist/generated/{ast.js → ast.mjs} +0 -0
  119. /package/dist/generated/{grammar.js → grammar.mjs} +0 -0
  120. /package/dist/generated-lib/{icons.js → icons.mjs} +0 -0
  121. /package/dist/{logger.js → logger.mjs} +0 -0
  122. /package/dist/lsp/{DocumentHighlightProvider.js → DocumentHighlightProvider.mjs} +0 -0
  123. /package/dist/lsp/{RenameProvider.js → RenameProvider.mjs} +0 -0
  124. /package/dist/mcp/{NoopLikeC4MCPServer.js → NoopLikeC4MCPServer.mjs} +0 -0
  125. /package/dist/model/builder/{MergedExtends.js → MergedExtends.mjs} +0 -0
  126. /package/dist/model/builder/{assignTagColors.js → assignTagColors.mjs} +0 -0
  127. /package/dist/model/parser/{ValueConverter.js → ValueConverter.mjs} +0 -0
  128. /package/dist/{protocol.js → protocol.mjs} +0 -0
  129. /package/dist/shared/{WorkspaceSymbolProvider.js → WorkspaceSymbolProvider.mjs} +0 -0
  130. /package/dist/utils/{printDocs.js → printDocs.mjs} +0 -0
  131. /package/dist/utils/{stringHash.js → stringHash.mjs} +0 -0
  132. /package/dist/validation/{DocumentValidator.js → DocumentValidator.mjs} +0 -0
  133. /package/dist/view-utils/{assignNavigateTo.js → assignNavigateTo.mjs} +0 -0
  134. /package/dist/view-utils/{resolve-relative-paths.js → resolve-relative-paths.mjs} +0 -0
  135. /package/dist/workspace/{AstNodeDescriptionProvider.js → AstNodeDescriptionProvider.mjs} +0 -0
  136. /package/dist/workspace/{IndexManager.js → IndexManager.mjs} +0 -0
@@ -1,7 +1,7 @@
1
1
  import { FqnRef } from "@likec4/core";
2
2
  import { AstUtils } from "langium";
3
- import { ast } from "../ast.js";
4
- import { logWarnError } from "../logger.js";
3
+ import { ast } from "../ast.mjs";
4
+ import { logWarnError } from "../logger.mjs";
5
5
  export class LikeC4DocumentationProvider {
6
6
  parser;
7
7
  locator;
@@ -1 +1 @@
1
- export { LikeC4DocumentationProvider } from "./documentation-provider.js";
1
+ export { LikeC4DocumentationProvider } from "./documentation-provider.mjs";
@@ -2,8 +2,8 @@ import { isLikeC4Config } from "@likec4/config/node";
2
2
  import { loggable } from "@likec4/log";
3
3
  import chokidar from "chokidar";
4
4
  import { URI } from "langium";
5
- import { logger as mainLogger } from "../logger.js";
6
- import { isAnyLikeC4File } from "./LikeC4FileSystem.js";
5
+ import { logger as mainLogger } from "../logger.mjs";
6
+ import { isAnyLikeC4File, isLikeC4File } from "./LikeC4FileSystem.mjs";
7
7
  const logger = mainLogger.getChild("chokidar");
8
8
  export const chokidarFileSystemWatcher = {
9
9
  fileSystemWatcher: (services) => new ChokidarFileSystemWatcher(services)
@@ -30,9 +30,10 @@ export class ChokidarFileSystemWatcher {
30
30
  }
31
31
  createWatcher(folder) {
32
32
  let watcher = chokidar.watch(folder, {
33
- ignored: (path, stats) => {
34
- return path.includes("node_modules") || !!stats && stats.isFile() && !isAnyLikeC4File(path);
35
- },
33
+ ignored: [
34
+ (path) => path.includes("node_modules") || path.includes(".git"),
35
+ (path, stats) => !!stats && stats.isFile() && !isAnyLikeC4File(path)
36
+ ],
36
37
  ignoreInitial: true
37
38
  });
38
39
  const onAddOrChange = async (path) => {
@@ -40,7 +41,7 @@ export class ChokidarFileSystemWatcher {
40
41
  if (isLikeC4Config(path)) {
41
42
  logger.debug`project file changed: ${path}`;
42
43
  await this.services.workspace.ProjectsManager.reloadProjects();
43
- } else {
44
+ } else if (isLikeC4File(path)) {
44
45
  logger.debug`file changed: ${path}`;
45
46
  await this.services.workspace.DocumentBuilder.update([URI.file(path)], []);
46
47
  }
@@ -53,7 +54,7 @@ export class ChokidarFileSystemWatcher {
53
54
  if (isLikeC4Config(path)) {
54
55
  logger.debug`project file removed: ${path}`;
55
56
  await this.services.workspace.ProjectsManager.reloadProjects();
56
- } else {
57
+ } else if (isLikeC4File(path)) {
57
58
  logger.debug`file removed: ${path}`;
58
59
  await this.services.workspace.DocumentBuilder.update([], [URI.file(path)]);
59
60
  }
@@ -1,3 +1,4 @@
1
1
  import type { FileSystemModuleContext } from './index';
2
2
  export declare const LikeC4FileSystem: (ehableWatcher?: boolean) => FileSystemModuleContext;
3
+ export declare const isLikeC4File: (path: string) => any;
3
4
  export declare const isAnyLikeC4File: (path: string) => any;
@@ -2,16 +2,16 @@ import { isLikeC4Config, loadConfig } from "@likec4/config/node";
2
2
  import { fdir } from "fdir";
3
3
  import { URI } from "langium";
4
4
  import { NodeFileSystemProvider } from "langium/node";
5
- import { LikeC4LanguageMetaData } from "../generated/module.js";
6
- import { Content, isLikeC4Builtin } from "../likec4lib.js";
7
- import { logError } from "../logger.js";
8
- import { chokidarFileSystemWatcher } from "./ChokidarWatcher.js";
9
- import { noopFileSystemWatcher } from "./FileSystemWatcher.js";
5
+ import { LikeC4LanguageMetaData } from "../generated/module.mjs";
6
+ import { Content, isLikeC4Builtin } from "../likec4lib.mjs";
7
+ import { logError } from "../logger.mjs";
8
+ import { chokidarFileSystemWatcher } from "./ChokidarWatcher.mjs";
9
+ import { noopFileSystemWatcher } from "./FileSystemWatcher.mjs";
10
10
  export const LikeC4FileSystem = (ehableWatcher = true) => ({
11
11
  fileSystemProvider: () => new SymLinkTraversingFileSystemProvider(),
12
12
  ...ehableWatcher ? chokidarFileSystemWatcher : noopFileSystemWatcher
13
13
  });
14
- const isLikeC4File = (path) => LikeC4LanguageMetaData.fileExtensions.some((ext) => path.endsWith(ext));
14
+ export const isLikeC4File = (path) => LikeC4LanguageMetaData.fileExtensions.some((ext) => path.endsWith(ext));
15
15
  export const isAnyLikeC4File = (path) => isLikeC4File(path) || isLikeC4Config(path);
16
16
  class SymLinkTraversingFileSystemProvider extends NodeFileSystemProvider {
17
17
  async readFile(uri) {
@@ -1,4 +1,4 @@
1
- import { noopFileSystemWatcher } from "./FileSystemWatcher.js";
1
+ import { noopFileSystemWatcher } from "./FileSystemWatcher.mjs";
2
2
  export class NoopFileSystemProvider {
3
3
  scanProjectFiles() {
4
4
  return Promise.resolve([]);
@@ -4,8 +4,8 @@ import {
4
4
  } from "langium";
5
5
  import { AbstractFormatter, Formatting } from "langium/lsp";
6
6
  import { filter, isTruthy } from "remeda";
7
- import * as ast from "../generated/ast.js";
8
- import * as utils from "./utils.js";
7
+ import * as ast from "../generated/ast.mjs";
8
+ import * as utils from "./utils.mjs";
9
9
  const FormattingOptions = {
10
10
  newLine: Formatting.newLine({ allowMore: true }),
11
11
  oneSpace: Formatting.oneSpace(),
@@ -1,5 +1,5 @@
1
- import { LikeC4AstReflection } from "./ast.js";
2
- import { LikeC4Grammar } from "./grammar.js";
1
+ import { LikeC4AstReflection } from "./ast.mjs";
2
+ import { LikeC4Grammar } from "./grammar.mjs";
3
3
  export const LikeC4LanguageMetaData = {
4
4
  languageId: "likec4",
5
5
  fileExtensions: [".c4", ".likec4", ".like-c4"],
@@ -2,15 +2,15 @@ import { configureLogger, getConsoleSink, getTextFormatter } from "@likec4/log";
2
2
  import { defu } from "defu";
3
3
  import { startLanguageServer as startLanguim } from "langium/lsp";
4
4
  import { createConnection, ProposedFeatures } from "vscode-languageserver/node";
5
- import { NoopFileSystem } from "./filesystem/index.js";
6
- import { LikeC4FileSystem } from "./filesystem/LikeC4FileSystem.js";
7
- import { getTelemetrySink, logger } from "./logger.js";
8
- import { WithMCPServer } from "./mcp/server/WithMCPServer.js";
9
- import { createLanguageServices } from "./module.js";
10
- import { ConfigurableLayouter } from "./views/configurable-layouter.js";
11
- export { getLspConnectionSink, logger as lspLogger } from "./logger.js";
12
- export { isLikeC4Builtin } from "./likec4lib.js";
13
- export { createLanguageServices } from "./module.js";
5
+ import { NoopFileSystem } from "./filesystem/index.mjs";
6
+ import { LikeC4FileSystem } from "./filesystem/LikeC4FileSystem.mjs";
7
+ import { getTelemetrySink, logger } from "./logger.mjs";
8
+ import { WithMCPServer } from "./mcp/server/WithMCPServer.mjs";
9
+ import { createLanguageServices } from "./module.mjs";
10
+ import { ConfigurableLayouter } from "./views/configurable-layouter.mjs";
11
+ export { getLspConnectionSink, logger as lspLogger } from "./logger.mjs";
12
+ export { isLikeC4Builtin } from "./likec4lib.mjs";
13
+ export { createLanguageServices } from "./module.mjs";
14
14
  export { LikeC4FileSystem, NoopFileSystem, WithMCPServer };
15
15
  export function startLanguageServer(options) {
16
16
  const opts = defu(options, {
@@ -1,4 +1,4 @@
1
- import { LibIcons } from "./generated-lib/icons.js";
1
+ import { LibIcons } from "./generated-lib/icons.mjs";
2
2
  export const Scheme = "likec4builtin";
3
3
  export const Uri = `${Scheme}:///likec4/lib/icons.c4`;
4
4
  export { LibIcons as Content };
@@ -1,7 +1,7 @@
1
1
  import { DocumentState } from "langium";
2
- import { isLikeC4LangiumDocument, ViewOps } from "../ast.js";
3
- import { logger } from "../logger.js";
4
- import { projectIdFrom } from "../utils/index.js";
2
+ import { isLikeC4LangiumDocument, ViewOps } from "../ast.mjs";
3
+ import { logger } from "../logger.mjs";
4
+ import { projectIdFrom } from "../utils/index.mjs";
5
5
  export class LikeC4CodeLensProvider {
6
6
  constructor(services) {
7
7
  this.services = services;
@@ -5,7 +5,7 @@ import {
5
5
  } from "langium/lsp";
6
6
  import { anyPass } from "remeda";
7
7
  import { CompletionItemKind, InsertTextFormat } from "vscode-languageserver-types";
8
- import { ast } from "../ast.js";
8
+ import { ast } from "../ast.mjs";
9
9
  const STYLE_FIELDS = [
10
10
  "color",
11
11
  "shape",
@@ -1,7 +1,7 @@
1
1
  import { AstUtils, GrammarUtils } from "langium";
2
2
  import { hasLeadingSlash, hasProtocol, isRelative, joinRelativeURL, withoutBase, withoutLeadingSlash } from "ufo";
3
- import { ast, isLikeC4LangiumDocument } from "../ast.js";
4
- import { logWarnError } from "../logger.js";
3
+ import { ast, isLikeC4LangiumDocument } from "../ast.mjs";
4
+ import { logWarnError } from "../logger.mjs";
5
5
  export class LikeC4DocumentLinkProvider {
6
6
  constructor(services) {
7
7
  this.services = services;
@@ -2,9 +2,9 @@ import { nonexhaustive } from "@likec4/core";
2
2
  import { AstUtils, DocumentState, GrammarUtils } from "langium";
3
3
  import { filter, isEmpty, isTruthy, map, pipe } from "remeda";
4
4
  import { SymbolKind } from "vscode-languageserver-types";
5
- import { ast, isLikeC4LangiumDocument } from "../ast.js";
6
- import { logger as rootLogger, logWarnError } from "../logger.js";
7
- import { readStrictFqn } from "../utils/elementRef.js";
5
+ import { ast, isLikeC4LangiumDocument } from "../ast.mjs";
6
+ import { logger as rootLogger, logWarnError } from "../logger.mjs";
7
+ import { readStrictFqn } from "../utils/elementRef.mjs";
8
8
  const logger = rootLogger.getChild("DocumentSymbolProvider");
9
9
  export class LikeC4DocumentSymbolProvider {
10
10
  constructor(services) {
@@ -1,7 +1,7 @@
1
1
  import { FqnRef } from "@likec4/core";
2
2
  import { AstUtils } from "langium";
3
3
  import { AstNodeHoverProvider } from "langium/lsp";
4
- import { ast } from "../ast.js";
4
+ import { ast } from "../ast.mjs";
5
5
  export class LikeC4HoverProvider extends AstNodeHoverProvider {
6
6
  parser;
7
7
  locator;
@@ -1,7 +1,7 @@
1
1
  import { AbstractSemanticTokenProvider } from "langium/lsp";
2
2
  import { isTruthy } from "remeda";
3
3
  import { SemanticTokenModifiers, SemanticTokenTypes } from "vscode-languageserver-types";
4
- import { ast } from "../ast.js";
4
+ import { ast } from "../ast.mjs";
5
5
  export class LikeC4SemanticTokenProvider extends AbstractSemanticTokenProvider {
6
6
  // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
7
7
  highlightElement(node, acceptor) {
@@ -0,0 +1,7 @@
1
+ export * from "./CodeLensProvider.mjs";
2
+ export * from "./CompletionProvider.mjs";
3
+ export * from "./DocumentHighlightProvider.mjs";
4
+ export * from "./DocumentLinkProvider.mjs";
5
+ export * from "./DocumentSymbolProvider.mjs";
6
+ export * from "./HoverProvider.mjs";
7
+ export * from "./SemanticTokenProvider.mjs";
@@ -1,15 +1,15 @@
1
1
  import { loggable } from "@likec4/log";
2
2
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
3
  import packageJson from "../../package.json" with { type: "json" };
4
- import { logger } from "../logger.js";
5
- import { findRelationships } from "./tools/find-relationships.js";
6
- import { listProjects } from "./tools/list-projects.js";
7
- import { openView } from "./tools/open-view.js";
8
- import { readDeployment } from "./tools/read-deployment.js";
9
- import { readElement } from "./tools/read-element.js";
10
- import { readProjectSummary } from "./tools/read-project-summary.js";
11
- import { readView } from "./tools/read-view.js";
12
- import { searchElement } from "./tools/search-element.js";
4
+ import { logger } from "../logger.mjs";
5
+ import { findRelationships } from "./tools/find-relationships.mjs";
6
+ import { listProjects } from "./tools/list-projects.mjs";
7
+ import { openView } from "./tools/open-view.mjs";
8
+ import { readDeployment } from "./tools/read-deployment.mjs";
9
+ import { readElement } from "./tools/read-element.mjs";
10
+ import { readProjectSummary } from "./tools/read-project-summary.mjs";
11
+ import { readView } from "./tools/read-view.mjs";
12
+ import { searchElement } from "./tools/search-element.mjs";
13
13
  export class LikeC4MCPServerFactory {
14
14
  constructor(services) {
15
15
  this.services = services;
@@ -1,4 +1,4 @@
1
- import { NoopLikeC4MCPServer } from "./NoopLikeC4MCPServer.js";
1
+ import { NoopLikeC4MCPServer } from "./NoopLikeC4MCPServer.mjs";
2
2
  export const NoMCPServer = {
3
3
  mcpServer: () => new NoopLikeC4MCPServer()
4
4
  };
@@ -1,5 +1,5 @@
1
1
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
2
- import { logger } from "../utils.js";
2
+ import { logger } from "../utils.mjs";
3
3
  export class StdioLikeC4MCPServer {
4
4
  constructor(services) {
5
5
  this.services = services;
@@ -4,7 +4,7 @@ import { loggable } from "@likec4/log";
4
4
  import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
5
5
  import { toFetchResponse, toReqRes } from "fetch-to-node";
6
6
  import { Hono } from "hono";
7
- import { logger } from "../utils.js";
7
+ import { logger } from "../utils.mjs";
8
8
  export class StreamableLikeC4MCPServer {
9
9
  constructor(services, _port = 33335) {
10
10
  this.services = services;
@@ -1,8 +1,8 @@
1
1
  import { loggable } from "@likec4/log";
2
2
  import { isError } from "remeda";
3
- import { logger } from "../utils.js";
4
- import { StdioLikeC4MCPServer } from "./StdioLikeC4MCPServer.js";
5
- import { StreamableLikeC4MCPServer } from "./StreamableLikeC4MCPServer.js";
3
+ import { logger } from "../utils.mjs";
4
+ import { StdioLikeC4MCPServer } from "./StdioLikeC4MCPServer.mjs";
5
+ import { StreamableLikeC4MCPServer } from "./StreamableLikeC4MCPServer.mjs";
6
6
  const streamableLikeC4MCPServer = (services, defaultPort = 33335) => {
7
7
  logger.debug("Creating StreamableLikeC4MCPServer");
8
8
  const server = new StreamableLikeC4MCPServer(services, defaultPort);
@@ -1,7 +1,7 @@
1
1
  import { URI } from "vscode-uri";
2
2
  import z from "zod";
3
- import { ProjectsManager } from "../../workspace/index.js";
4
- import { logger } from "../utils.js";
3
+ import { ProjectsManager } from "../../workspace/index.mjs";
4
+ import { logger } from "../utils.mjs";
5
5
  export const locationSchema = z.object({
6
6
  path: z.string().describe("Path to the file"),
7
7
  range: z.object({
@@ -1,8 +1,8 @@
1
1
  import { modelConnection } from "@likec4/core/model";
2
2
  import { invariant, isSameHierarchy } from "@likec4/core/utils";
3
3
  import z from "zod";
4
- import { likec4Tool } from "../utils.js";
5
- import { includedInViews, includedInViewsSchema, locationSchema, mkLocate, projectIdSchema } from "./_common.js";
4
+ import { likec4Tool } from "../utils.mjs";
5
+ import { includedInViews, includedInViewsSchema, locationSchema, mkLocate, projectIdSchema } from "./_common.mjs";
6
6
  const endpointSchema = z.object({
7
7
  id: z.string(),
8
8
  title: z.string(),
@@ -1,5 +1,5 @@
1
1
  import z from "zod";
2
- import { likec4Tool } from "../utils.js";
2
+ import { likec4Tool } from "../utils.mjs";
3
3
  export const listProjects = likec4Tool({
4
4
  name: "list-projects",
5
5
  description: `
@@ -1,6 +1,6 @@
1
1
  import z from "zod";
2
- import { likec4Tool } from "../utils.js";
3
- import { locationSchema, mkLocate, projectIdSchema } from "./_common.js";
2
+ import { likec4Tool } from "../utils.mjs";
3
+ import { locationSchema, mkLocate, projectIdSchema } from "./_common.mjs";
4
4
  export const openView = likec4Tool({
5
5
  name: "open-view",
6
6
  description: `
@@ -1,7 +1,7 @@
1
1
  import { invariant } from "@likec4/core";
2
2
  import z from "zod";
3
- import { likec4Tool } from "../utils.js";
4
- import { includedInViews, includedInViewsSchema, locationSchema, mkLocate, projectIdSchema } from "./_common.js";
3
+ import { likec4Tool } from "../utils.mjs";
4
+ import { includedInViews, includedInViewsSchema, locationSchema, mkLocate, projectIdSchema } from "./_common.mjs";
5
5
  export const readDeployment = likec4Tool({
6
6
  name: "read-deployment",
7
7
  description: `
@@ -1,7 +1,7 @@
1
1
  import { invariant } from "@likec4/core";
2
2
  import z from "zod";
3
- import { likec4Tool } from "../utils.js";
4
- import { includedInViews, includedInViewsSchema, locationSchema, mkLocate, projectIdSchema } from "./_common.js";
3
+ import { likec4Tool } from "../utils.mjs";
4
+ import { includedInViews, includedInViewsSchema, locationSchema, mkLocate, projectIdSchema } from "./_common.mjs";
5
5
  export const readElement = likec4Tool({
6
6
  name: "read-element",
7
7
  description: `
@@ -1,7 +1,7 @@
1
1
  import { keys } from "remeda";
2
2
  import z from "zod";
3
- import { likec4Tool } from "../utils.js";
4
- import { projectIdSchema } from "./_common.js";
3
+ import { likec4Tool } from "../utils.mjs";
4
+ import { projectIdSchema } from "./_common.mjs";
5
5
  export const readProjectSummary = likec4Tool({
6
6
  name: "read-project-summary",
7
7
  annotations: {
@@ -1,6 +1,6 @@
1
1
  import z from "zod";
2
- import { likec4Tool } from "../utils.js";
3
- import { locationSchema, mkLocate, projectIdSchema } from "./_common.js";
2
+ import { likec4Tool } from "../utils.mjs";
3
+ import { locationSchema, mkLocate, projectIdSchema } from "./_common.mjs";
4
4
  const modelRef = (node) => {
5
5
  if (node.hasElement()) {
6
6
  return node.element.id;
@@ -1,7 +1,7 @@
1
1
  import { ifilter } from "@likec4/core/utils";
2
2
  import z from "zod";
3
- import { likec4Tool, logger } from "../utils.js";
4
- import { includedInViews, includedInViewsSchema } from "./_common.js";
3
+ import { likec4Tool, logger } from "../utils.mjs";
4
+ import { includedInViews, includedInViewsSchema } from "./_common.mjs";
5
5
  const searchResultSchema = z.array(
6
6
  z.discriminatedUnion("type", [
7
7
  z.object({
@@ -1,5 +1,5 @@
1
1
  import { loggable } from "@likec4/log";
2
- import { logger as mainLogger } from "../logger.js";
2
+ import { logger as mainLogger } from "../logger.mjs";
3
3
  export const logger = mainLogger.getChild("mcp");
4
4
  export function likec4Tool(config, cb) {
5
5
  const { name, description, ...rest } = config;
@@ -6,8 +6,8 @@ import {
6
6
  isNonNullish,
7
7
  isNumber
8
8
  } from "remeda";
9
- import { logger, logWarnError } from "../../logger.js";
10
- import { assignTagColors } from "./assignTagColors.js";
9
+ import { logger, logWarnError } from "../../logger.mjs";
10
+ import { assignTagColors } from "./assignTagColors.mjs";
11
11
  export class MergedSpecification {
12
12
  specs = {
13
13
  elements: {},
@@ -25,10 +25,10 @@ import {
25
25
  prop,
26
26
  reduce
27
27
  } from "remeda";
28
- import { logger } from "../../logger.js";
29
- import { resolveRelativePaths } from "../../view-utils/index.js";
30
- import { MergedExtends } from "./MergedExtends.js";
31
- import { MergedSpecification } from "./MergedSpecification.js";
28
+ import { logger } from "../../logger.mjs";
29
+ import { resolveRelativePaths } from "../../view-utils/index.mjs";
30
+ import { MergedExtends } from "./MergedExtends.mjs";
31
+ import { MergedSpecification } from "./MergedSpecification.mjs";
32
32
  export function buildModelData(project, docs) {
33
33
  const c4Specification = new MergedSpecification(docs);
34
34
  const customColors = mapValues(
@@ -4,10 +4,10 @@ import { isDefined, isTruthy } from "remeda";
4
4
  import {
5
5
  ast,
6
6
  ElementOps
7
- } from "../ast.js";
8
- import { logWarnError } from "../logger.js";
9
- import { readStrictFqn } from "../utils/elementRef.js";
10
- import { DocumentFqnIndex, FqnIndex } from "./fqn-index.js";
7
+ } from "../ast.mjs";
8
+ import { logWarnError } from "../logger.mjs";
9
+ import { readStrictFqn } from "../utils/elementRef.mjs";
10
+ import { DocumentFqnIndex, FqnIndex } from "./fqn-index.mjs";
11
11
  export class DeploymentsIndex extends FqnIndex {
12
12
  constructor(services) {
13
13
  super(services, "deployments-index");
@@ -12,11 +12,11 @@ import {
12
12
  ast,
13
13
  ElementOps,
14
14
  isLikeC4LangiumDocument
15
- } from "../ast.js";
16
- import { logWarnError } from "../logger.js";
17
- import { ADisposable } from "../utils/index.js";
18
- import { readStrictFqn } from "../utils/elementRef.js";
19
- import { ProjectsManager } from "../workspace/index.js";
15
+ } from "../ast.mjs";
16
+ import { logWarnError } from "../logger.mjs";
17
+ import { ADisposable } from "../utils/index.mjs";
18
+ import { readStrictFqn } from "../utils/elementRef.mjs";
19
+ import { ProjectsManager } from "../workspace/index.mjs";
20
20
  export class FqnIndex extends ADisposable {
21
21
  constructor(services, cachePrefix = "fqn-index") {
22
22
  super();
@@ -0,0 +1,6 @@
1
+ export * from "./deployments-index.mjs";
2
+ export * from "./fqn-index.mjs";
3
+ export * from "./model-builder.mjs";
4
+ export * from "./model-locator.mjs";
5
+ export * from "./model-parser.mjs";
6
+ export * from "./parser/ValueConverter.mjs";
@@ -23,11 +23,11 @@ import {
23
23
  values
24
24
  } from "remeda";
25
25
  import { CancellationToken } from "vscode-jsonrpc";
26
- import { isLikeC4Builtin } from "../likec4lib.js";
27
- import { logger as mainLogger, logWarnError } from "../logger.js";
28
- import { ADisposable, performanceMark } from "../utils/index.js";
29
- import { assignNavigateTo } from "../view-utils/index.js";
30
- import { buildModelData } from "./builder/buildModel.js";
26
+ import { isLikeC4Builtin } from "../likec4lib.mjs";
27
+ import { logger as mainLogger, logWarnError } from "../logger.mjs";
28
+ import { ADisposable, performanceMark } from "../utils/index.mjs";
29
+ import { assignNavigateTo } from "../view-utils/index.mjs";
30
+ import { buildModelData } from "./builder/buildModel.mjs";
31
31
  const parsedWithoutImportsCacheKey = (projectId) => `parsed-without-imports-${projectId}`;
32
32
  const parsedModelCacheKey = (projectId) => `parsed-model-${projectId}`;
33
33
  const computedModelCacheKey = (projectId) => `computed-model-${projectId}`;
@@ -3,10 +3,10 @@ import { ifilter, invariant, toArray } from "@likec4/core/utils";
3
3
  import { loggable } from "@likec4/log";
4
4
  import { AstUtils, DocumentState, GrammarUtils } from "langium";
5
5
  import { flatMap, isString, pipe } from "remeda";
6
- import { ast, isLikeC4LangiumDocument } from "../ast.js";
7
- import { logger as serverLogger } from "../logger.js";
8
- import { projectIdFrom } from "../utils/index.js";
9
- import { MergedSpecification } from "./builder/MergedSpecification.js";
6
+ import { ast, isLikeC4LangiumDocument } from "../ast.mjs";
7
+ import { logger as serverLogger } from "../logger.mjs";
8
+ import { projectIdFrom } from "../utils/index.mjs";
9
+ import { MergedSpecification } from "./builder/MergedSpecification.mjs";
10
10
  const { findNodeForKeyword, findNodeForProperty } = GrammarUtils;
11
11
  const { getDocument, streamAllContents } = AstUtils;
12
12
  const logger = serverLogger.getChild("ModelLocator");
@@ -1,6 +1,6 @@
1
1
  import { invariant, isNonEmptyArray, nonexhaustive } from "@likec4/core";
2
2
  import { isAndOperator, isOrOperator } from "@likec4/core";
3
- import { ast } from "../ast.js";
3
+ import { ast } from "../ast.mjs";
4
4
  const parseEquals = ({ operator, not }, value) => {
5
5
  if (operator.startsWith("!=")) {
6
6
  return {
@@ -3,19 +3,19 @@ import { loggable } from "@likec4/log";
3
3
  import { DocumentState } from "langium";
4
4
  import { pipe } from "remeda";
5
5
  import { DiagnosticSeverity } from "vscode-languageserver-types";
6
- import { isLikeC4LangiumDocument } from "../ast.js";
7
- import { isLikeC4Builtin } from "../likec4lib.js";
8
- import { logger as rootLogger } from "../logger.js";
9
- import { BaseParser } from "./parser/Base.js";
10
- import { DeploymentModelParser } from "./parser/DeploymentModelParser.js";
11
- import { DeploymentViewParser } from "./parser/DeploymentViewParser.js";
12
- import { ExpressionV2Parser } from "./parser/FqnRefParser.js";
13
- import { GlobalsParser } from "./parser/GlobalsParser.js";
14
- import { ImportsParser } from "./parser/ImportsParser.js";
15
- import { ModelParser } from "./parser/ModelParser.js";
16
- import { PredicatesParser } from "./parser/PredicatesParser.js";
17
- import { SpecificationParser } from "./parser/SpecificationParser.js";
18
- import { ViewsParser } from "./parser/ViewsParser.js";
6
+ import { isLikeC4LangiumDocument } from "../ast.mjs";
7
+ import { isLikeC4Builtin } from "../likec4lib.mjs";
8
+ import { logger as rootLogger } from "../logger.mjs";
9
+ import { BaseParser } from "./parser/Base.mjs";
10
+ import { DeploymentModelParser } from "./parser/DeploymentModelParser.mjs";
11
+ import { DeploymentViewParser } from "./parser/DeploymentViewParser.mjs";
12
+ import { ExpressionV2Parser } from "./parser/FqnRefParser.mjs";
13
+ import { GlobalsParser } from "./parser/GlobalsParser.mjs";
14
+ import { ImportsParser } from "./parser/ImportsParser.mjs";
15
+ import { ModelParser } from "./parser/ModelParser.mjs";
16
+ import { PredicatesParser } from "./parser/PredicatesParser.mjs";
17
+ import { SpecificationParser } from "./parser/SpecificationParser.mjs";
18
+ import { ViewsParser } from "./parser/ViewsParser.mjs";
19
19
  const DocumentParserFromMixins = pipe(
20
20
  BaseParser,
21
21
  ExpressionV2Parser,
@@ -22,11 +22,11 @@ import {
22
22
  parseAstSizeValue,
23
23
  parseMarkdownAsString,
24
24
  toColor
25
- } from "../../ast.js";
26
- import { logger } from "../../logger.js";
27
- import { projectIdFrom } from "../../utils/index.js";
28
- import { readStrictFqn } from "../../utils/elementRef.js";
29
- import { checksFromDiagnostics } from "../../validation/index.js";
25
+ } from "../../ast.mjs";
26
+ import { logger } from "../../logger.mjs";
27
+ import { projectIdFrom } from "../../utils/index.mjs";
28
+ import { readStrictFqn } from "../../utils/elementRef.mjs";
29
+ import { checksFromDiagnostics } from "../../validation/index.mjs";
30
30
  export function toSingleLine(str) {
31
31
  if (str === null || str === void 0) {
32
32
  return void 0;
@@ -3,9 +3,9 @@ import { filter, first, isDefined, isEmpty, isTruthy, map, mapToObj, pipe } from
3
3
  import {
4
4
  ast,
5
5
  toRelationshipStyleExcludeDefaults
6
- } from "../../ast.js";
7
- import { logWarnError } from "../../logger.js";
8
- import { stringHash } from "../../utils/stringHash.js";
6
+ } from "../../ast.mjs";
7
+ import { logWarnError } from "../../logger.mjs";
8
+ import { stringHash } from "../../utils/stringHash.mjs";
9
9
  function* streamDeploymentModel(doc) {
10
10
  const traverseStack = LinkedList.from(
11
11
  doc.parseResult.value.deployments.flatMap((m) => m.elements)
@@ -1,11 +1,11 @@
1
1
  import * as c4 from "@likec4/core";
2
2
  import { invariant, isNonEmptyArray, nonexhaustive } from "@likec4/core";
3
3
  import { filter, isNonNullish, mapToObj, pipe } from "remeda";
4
- import { ast, parseMarkdownAsString, toAutoLayout, ViewOps } from "../../ast.js";
5
- import { logWarnError } from "../../logger.js";
6
- import { stringHash } from "../../utils/index.js";
7
- import { parseViewManualLayout } from "../../view-utils/manual-layout.js";
8
- import { removeIndent, toSingleLine } from "./Base.js";
4
+ import { ast, parseMarkdownAsString, toAutoLayout, ViewOps } from "../../ast.mjs";
5
+ import { logWarnError } from "../../logger.mjs";
6
+ import { stringHash } from "../../utils/index.mjs";
7
+ import { parseViewManualLayout } from "../../view-utils/manual-layout.mjs";
8
+ import { removeIndent, toSingleLine } from "./Base.mjs";
9
9
  export function DeploymentViewParser(B) {
10
10
  return class DeploymentViewParser extends B {
11
11
  parseDeploymentView(astNode) {