@domainlang/language 0.1.81

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 (188) hide show
  1. package/README.md +32 -0
  2. package/out/ast-augmentation.d.ts +6 -0
  3. package/out/ast-augmentation.js +2 -0
  4. package/out/ast-augmentation.js.map +1 -0
  5. package/out/domain-lang-module.d.ts +55 -0
  6. package/out/domain-lang-module.js +59 -0
  7. package/out/domain-lang-module.js.map +1 -0
  8. package/out/generated/ast.d.ts +770 -0
  9. package/out/generated/ast.js +565 -0
  10. package/out/generated/ast.js.map +1 -0
  11. package/out/generated/grammar.d.ts +6 -0
  12. package/out/generated/grammar.js +2502 -0
  13. package/out/generated/grammar.js.map +1 -0
  14. package/out/generated/module.d.ts +13 -0
  15. package/out/generated/module.js +21 -0
  16. package/out/generated/module.js.map +1 -0
  17. package/out/index.d.ts +13 -0
  18. package/out/index.js +17 -0
  19. package/out/index.js.map +1 -0
  20. package/out/lsp/domain-lang-completion.d.ts +37 -0
  21. package/out/lsp/domain-lang-completion.js +452 -0
  22. package/out/lsp/domain-lang-completion.js.map +1 -0
  23. package/out/lsp/domain-lang-formatter.d.ts +15 -0
  24. package/out/lsp/domain-lang-formatter.js +43 -0
  25. package/out/lsp/domain-lang-formatter.js.map +1 -0
  26. package/out/lsp/domain-lang-naming.d.ts +34 -0
  27. package/out/lsp/domain-lang-naming.js +49 -0
  28. package/out/lsp/domain-lang-naming.js.map +1 -0
  29. package/out/lsp/domain-lang-scope.d.ts +59 -0
  30. package/out/lsp/domain-lang-scope.js +102 -0
  31. package/out/lsp/domain-lang-scope.js.map +1 -0
  32. package/out/lsp/hover/ddd-pattern-explanations.d.ts +50 -0
  33. package/out/lsp/hover/ddd-pattern-explanations.js +196 -0
  34. package/out/lsp/hover/ddd-pattern-explanations.js.map +1 -0
  35. package/out/lsp/hover/domain-lang-hover.d.ts +19 -0
  36. package/out/lsp/hover/domain-lang-hover.js +306 -0
  37. package/out/lsp/hover/domain-lang-hover.js.map +1 -0
  38. package/out/lsp/hover/domain-lang-keywords.d.ts +13 -0
  39. package/out/lsp/hover/domain-lang-keywords.js +47 -0
  40. package/out/lsp/hover/domain-lang-keywords.js.map +1 -0
  41. package/out/main-browser.d.ts +1 -0
  42. package/out/main-browser.js +11 -0
  43. package/out/main-browser.js.map +1 -0
  44. package/out/main.d.ts +1 -0
  45. package/out/main.js +74 -0
  46. package/out/main.js.map +1 -0
  47. package/out/sdk/ast-augmentation.d.ts +136 -0
  48. package/out/sdk/ast-augmentation.js +62 -0
  49. package/out/sdk/ast-augmentation.js.map +1 -0
  50. package/out/sdk/index.d.ts +94 -0
  51. package/out/sdk/index.js +97 -0
  52. package/out/sdk/index.js.map +1 -0
  53. package/out/sdk/indexes.d.ts +16 -0
  54. package/out/sdk/indexes.js +97 -0
  55. package/out/sdk/indexes.js.map +1 -0
  56. package/out/sdk/loader-node.d.ts +47 -0
  57. package/out/sdk/loader-node.js +104 -0
  58. package/out/sdk/loader-node.js.map +1 -0
  59. package/out/sdk/loader.d.ts +49 -0
  60. package/out/sdk/loader.js +85 -0
  61. package/out/sdk/loader.js.map +1 -0
  62. package/out/sdk/patterns.d.ts +93 -0
  63. package/out/sdk/patterns.js +123 -0
  64. package/out/sdk/patterns.js.map +1 -0
  65. package/out/sdk/query.d.ts +90 -0
  66. package/out/sdk/query.js +679 -0
  67. package/out/sdk/query.js.map +1 -0
  68. package/out/sdk/resolution.d.ts +52 -0
  69. package/out/sdk/resolution.js +68 -0
  70. package/out/sdk/resolution.js.map +1 -0
  71. package/out/sdk/types.d.ts +301 -0
  72. package/out/sdk/types.js +8 -0
  73. package/out/sdk/types.js.map +1 -0
  74. package/out/services/dependency-analyzer.d.ts +94 -0
  75. package/out/services/dependency-analyzer.js +279 -0
  76. package/out/services/dependency-analyzer.js.map +1 -0
  77. package/out/services/dependency-resolver.d.ts +123 -0
  78. package/out/services/dependency-resolver.js +252 -0
  79. package/out/services/dependency-resolver.js.map +1 -0
  80. package/out/services/git-url-resolver.browser.d.ts +18 -0
  81. package/out/services/git-url-resolver.browser.js +15 -0
  82. package/out/services/git-url-resolver.browser.js.map +1 -0
  83. package/out/services/git-url-resolver.d.ts +192 -0
  84. package/out/services/git-url-resolver.js +382 -0
  85. package/out/services/git-url-resolver.js.map +1 -0
  86. package/out/services/governance-validator.d.ts +80 -0
  87. package/out/services/governance-validator.js +159 -0
  88. package/out/services/governance-validator.js.map +1 -0
  89. package/out/services/import-resolver.d.ts +18 -0
  90. package/out/services/import-resolver.js +22 -0
  91. package/out/services/import-resolver.js.map +1 -0
  92. package/out/services/performance-optimizer.d.ts +60 -0
  93. package/out/services/performance-optimizer.js +140 -0
  94. package/out/services/performance-optimizer.js.map +1 -0
  95. package/out/services/relationship-inference.d.ts +11 -0
  96. package/out/services/relationship-inference.js +98 -0
  97. package/out/services/relationship-inference.js.map +1 -0
  98. package/out/services/workspace-manager.d.ts +76 -0
  99. package/out/services/workspace-manager.js +323 -0
  100. package/out/services/workspace-manager.js.map +1 -0
  101. package/out/syntaxes/domain-lang.monarch.d.ts +76 -0
  102. package/out/syntaxes/domain-lang.monarch.js +29 -0
  103. package/out/syntaxes/domain-lang.monarch.js.map +1 -0
  104. package/out/utils/import-utils.d.ts +57 -0
  105. package/out/utils/import-utils.js +228 -0
  106. package/out/utils/import-utils.js.map +1 -0
  107. package/out/validation/bounded-context.d.ts +11 -0
  108. package/out/validation/bounded-context.js +79 -0
  109. package/out/validation/bounded-context.js.map +1 -0
  110. package/out/validation/classification.d.ts +3 -0
  111. package/out/validation/classification.js +3 -0
  112. package/out/validation/classification.js.map +1 -0
  113. package/out/validation/constants.d.ts +77 -0
  114. package/out/validation/constants.js +96 -0
  115. package/out/validation/constants.js.map +1 -0
  116. package/out/validation/domain-lang-validator.d.ts +2 -0
  117. package/out/validation/domain-lang-validator.js +27 -0
  118. package/out/validation/domain-lang-validator.js.map +1 -0
  119. package/out/validation/domain.d.ts +11 -0
  120. package/out/validation/domain.js +18 -0
  121. package/out/validation/domain.js.map +1 -0
  122. package/out/validation/import.d.ts +44 -0
  123. package/out/validation/import.js +135 -0
  124. package/out/validation/import.js.map +1 -0
  125. package/out/validation/maps.d.ts +21 -0
  126. package/out/validation/maps.js +56 -0
  127. package/out/validation/maps.js.map +1 -0
  128. package/out/validation/metadata.d.ts +7 -0
  129. package/out/validation/metadata.js +12 -0
  130. package/out/validation/metadata.js.map +1 -0
  131. package/out/validation/model.d.ts +12 -0
  132. package/out/validation/model.js +29 -0
  133. package/out/validation/model.js.map +1 -0
  134. package/out/validation/relationships.d.ts +12 -0
  135. package/out/validation/relationships.js +94 -0
  136. package/out/validation/relationships.js.map +1 -0
  137. package/out/validation/shared.d.ts +6 -0
  138. package/out/validation/shared.js +12 -0
  139. package/out/validation/shared.js.map +1 -0
  140. package/package.json +97 -0
  141. package/src/ast-augmentation.ts +5 -0
  142. package/src/domain-lang-module.ts +100 -0
  143. package/src/domain-lang.langium +356 -0
  144. package/src/generated/ast.ts +999 -0
  145. package/src/generated/grammar.ts +2504 -0
  146. package/src/generated/module.ts +25 -0
  147. package/src/index.ts +17 -0
  148. package/src/lsp/domain-lang-completion.ts +514 -0
  149. package/src/lsp/domain-lang-formatter.ts +51 -0
  150. package/src/lsp/domain-lang-naming.ts +56 -0
  151. package/src/lsp/domain-lang-scope.ts +137 -0
  152. package/src/lsp/hover/ddd-pattern-explanations.ts +237 -0
  153. package/src/lsp/hover/domain-lang-hover.ts +340 -0
  154. package/src/lsp/hover/domain-lang-keywords.ts +50 -0
  155. package/src/main-browser.ts +15 -0
  156. package/src/main.ts +85 -0
  157. package/src/sdk/README.md +297 -0
  158. package/src/sdk/ast-augmentation.ts +157 -0
  159. package/src/sdk/index.ts +128 -0
  160. package/src/sdk/indexes.ts +155 -0
  161. package/src/sdk/loader-node.ts +126 -0
  162. package/src/sdk/loader.ts +99 -0
  163. package/src/sdk/patterns.ts +147 -0
  164. package/src/sdk/query.ts +802 -0
  165. package/src/sdk/resolution.ts +78 -0
  166. package/src/sdk/types.ts +346 -0
  167. package/src/services/dependency-analyzer.ts +381 -0
  168. package/src/services/dependency-resolver.ts +334 -0
  169. package/src/services/git-url-resolver.browser.ts +31 -0
  170. package/src/services/git-url-resolver.ts +524 -0
  171. package/src/services/governance-validator.ts +219 -0
  172. package/src/services/import-resolver.ts +30 -0
  173. package/src/services/performance-optimizer.ts +170 -0
  174. package/src/services/relationship-inference.ts +121 -0
  175. package/src/services/workspace-manager.ts +416 -0
  176. package/src/syntaxes/domain-lang.monarch.ts +29 -0
  177. package/src/utils/import-utils.ts +274 -0
  178. package/src/validation/bounded-context.ts +99 -0
  179. package/src/validation/classification.ts +5 -0
  180. package/src/validation/constants.ts +124 -0
  181. package/src/validation/domain-lang-validator.ts +33 -0
  182. package/src/validation/domain.ts +24 -0
  183. package/src/validation/import.ts +171 -0
  184. package/src/validation/maps.ts +72 -0
  185. package/src/validation/metadata.ts +14 -0
  186. package/src/validation/model.ts +37 -0
  187. package/src/validation/relationships.ts +154 -0
  188. package/src/validation/shared.ts +14 -0
@@ -0,0 +1,76 @@
1
+ import { GitUrlResolver } from './git-url-resolver.js';
2
+ import type { LockFile } from './git-url-resolver.js';
3
+ export interface WorkspaceManagerOptions {
4
+ readonly autoResolve?: boolean;
5
+ readonly manifestFiles?: readonly string[];
6
+ readonly lockFiles?: readonly string[];
7
+ }
8
+ /**
9
+ * Coordinates workspace discovery, lock file lifecycle management, and git resolver configuration.
10
+ */
11
+ export declare class WorkspaceManager {
12
+ private readonly options;
13
+ private readonly manifestFiles;
14
+ private readonly lockFiles;
15
+ private workspaceRoot;
16
+ private lockFile;
17
+ private gitResolver;
18
+ private dependencyResolver;
19
+ private initializePromise;
20
+ private manifestCache;
21
+ constructor(options?: WorkspaceManagerOptions);
22
+ /**
23
+ * Finds the workspace root, loads any existing lock file, and prepares the git resolver.
24
+ * Repeated calls await the same initialization work.
25
+ */
26
+ initialize(startPath: string): Promise<void>;
27
+ /**
28
+ * Returns the absolute path of the workspace root.
29
+ * @throws Error if {@link initialize} has not completed successfully.
30
+ */
31
+ getWorkspaceRoot(): string;
32
+ /**
33
+ * Resolves the manifest file path within the workspace, if present.
34
+ */
35
+ getManifestPath(): Promise<string | undefined>;
36
+ /**
37
+ * Returns the cached lock file or triggers resolution when missing.
38
+ */
39
+ ensureLockFile(): Promise<LockFile>;
40
+ /**
41
+ * Gets the currently cached lock file without refreshing from disk.
42
+ */
43
+ getLockFile(): Promise<LockFile | undefined>;
44
+ /**
45
+ * Reloads the lock file from disk, updating the git resolver.
46
+ */
47
+ refreshLockFile(): Promise<LockFile | undefined>;
48
+ /**
49
+ * Provides the shared git URL resolver configured with the current lock file.
50
+ */
51
+ getGitResolver(): Promise<GitUrlResolver>;
52
+ /**
53
+ * Forces dependency resolution and regenerates lock files on disk.
54
+ */
55
+ regenerateLockFile(): Promise<LockFile>;
56
+ /**
57
+ * Resolves a manifest dependency alias to its git import string.
58
+ *
59
+ * @param aliasPath - Alias from import statement (may include subpaths)
60
+ * @returns Resolved git import string or undefined when alias is unknown
61
+ */
62
+ resolveDependencyImport(aliasPath: string): Promise<string | undefined>;
63
+ private performInitialization;
64
+ private ensureInitialized;
65
+ private applyLockFile;
66
+ private generateLockFile;
67
+ private ensureDependencyResolver;
68
+ private writeJsonLockFile;
69
+ private loadLockFileFromDisk;
70
+ private tryReadLockFile;
71
+ private loadManifest;
72
+ private parseJsonLockFile;
73
+ private findWorkspaceRoot;
74
+ private containsManifest;
75
+ private fileExists;
76
+ }
@@ -0,0 +1,323 @@
1
+ import path from 'node:path';
2
+ import fs from 'node:fs/promises';
3
+ import YAML from 'yaml';
4
+ import { DependencyResolver } from './dependency-resolver.js';
5
+ import { GitUrlResolver } from './git-url-resolver.js';
6
+ import { getGlobalOptimizer } from './performance-optimizer.js';
7
+ const DEFAULT_MANIFEST_FILES = [
8
+ 'model.yaml'
9
+ ];
10
+ const DEFAULT_LOCK_FILES = [
11
+ 'model.lock'
12
+ ];
13
+ const JSON_SPACE = 2;
14
+ /**
15
+ * Coordinates workspace discovery, lock file lifecycle management, and git resolver configuration.
16
+ */
17
+ export class WorkspaceManager {
18
+ constructor(options = {}) {
19
+ this.options = options;
20
+ this.manifestFiles = options.manifestFiles ?? [...DEFAULT_MANIFEST_FILES];
21
+ this.lockFiles = options.lockFiles ?? [...DEFAULT_LOCK_FILES];
22
+ }
23
+ /**
24
+ * Finds the workspace root, loads any existing lock file, and prepares the git resolver.
25
+ * Repeated calls await the same initialization work.
26
+ */
27
+ async initialize(startPath) {
28
+ if (!this.initializePromise) {
29
+ this.initializePromise = this.performInitialization(startPath);
30
+ }
31
+ await this.initializePromise;
32
+ }
33
+ /**
34
+ * Returns the absolute path of the workspace root.
35
+ * @throws Error if {@link initialize} has not completed successfully.
36
+ */
37
+ getWorkspaceRoot() {
38
+ if (!this.workspaceRoot) {
39
+ throw new Error('WorkspaceManager not initialized. Call initialize() first.');
40
+ }
41
+ return this.workspaceRoot;
42
+ }
43
+ /**
44
+ * Resolves the manifest file path within the workspace, if present.
45
+ */
46
+ async getManifestPath() {
47
+ await this.ensureInitialized();
48
+ const root = this.workspaceRoot;
49
+ if (!root) {
50
+ return undefined;
51
+ }
52
+ for (const manifest of this.manifestFiles) {
53
+ const candidate = path.join(root, manifest);
54
+ if (await this.fileExists(candidate)) {
55
+ return candidate;
56
+ }
57
+ }
58
+ return undefined;
59
+ }
60
+ /**
61
+ * Returns the cached lock file or triggers resolution when missing.
62
+ */
63
+ async ensureLockFile() {
64
+ await this.ensureInitialized();
65
+ if (!this.lockFile) {
66
+ // Try loading from cache first
67
+ const optimizer = getGlobalOptimizer();
68
+ const cached = await optimizer.getCachedLockFile(this.workspaceRoot || '');
69
+ if (cached) {
70
+ this.lockFile = cached;
71
+ }
72
+ else {
73
+ await this.generateLockFile();
74
+ }
75
+ }
76
+ if (!this.lockFile) {
77
+ throw new Error('Unable to resolve workspace lock file.');
78
+ }
79
+ return this.lockFile;
80
+ }
81
+ /**
82
+ * Gets the currently cached lock file without refreshing from disk.
83
+ */
84
+ async getLockFile() {
85
+ await this.ensureInitialized();
86
+ return this.lockFile;
87
+ }
88
+ /**
89
+ * Reloads the lock file from disk, updating the git resolver.
90
+ */
91
+ async refreshLockFile() {
92
+ await this.ensureInitialized();
93
+ const loaded = await this.loadLockFileFromDisk();
94
+ this.applyLockFile(loaded);
95
+ return this.lockFile;
96
+ }
97
+ /**
98
+ * Provides the shared git URL resolver configured with the current lock file.
99
+ */
100
+ async getGitResolver() {
101
+ await this.ensureInitialized();
102
+ if (!this.gitResolver) {
103
+ throw new Error('GitUrlResolver not available. Workspace initialization failed.');
104
+ }
105
+ return this.gitResolver;
106
+ }
107
+ /**
108
+ * Forces dependency resolution and regenerates lock files on disk.
109
+ */
110
+ async regenerateLockFile() {
111
+ await this.ensureInitialized();
112
+ await this.generateLockFile(true);
113
+ if (!this.lockFile) {
114
+ throw new Error('Failed to regenerate workspace lock file.');
115
+ }
116
+ return this.lockFile;
117
+ }
118
+ /**
119
+ * Resolves a manifest dependency alias to its git import string.
120
+ *
121
+ * @param aliasPath - Alias from import statement (may include subpaths)
122
+ * @returns Resolved git import string or undefined when alias is unknown
123
+ */
124
+ async resolveDependencyImport(aliasPath) {
125
+ await this.ensureInitialized();
126
+ const manifest = await this.loadManifest();
127
+ const dependencies = manifest?.dependencies;
128
+ if (!dependencies) {
129
+ return undefined;
130
+ }
131
+ for (const [alias, dep] of Object.entries(dependencies)) {
132
+ if (!dep?.source) {
133
+ continue;
134
+ }
135
+ if (aliasPath === alias || aliasPath.startsWith(`${alias}/`)) {
136
+ const suffix = aliasPath.slice(alias.length);
137
+ const version = dep.version ?? '';
138
+ const versionSegment = version
139
+ ? (version.startsWith('@') ? version : `@${version}`)
140
+ : '';
141
+ return `${dep.source}${versionSegment}${suffix}`;
142
+ }
143
+ }
144
+ return undefined;
145
+ }
146
+ async performInitialization(startPath) {
147
+ this.workspaceRoot = await this.findWorkspaceRoot(startPath);
148
+ if (!this.workspaceRoot) {
149
+ throw new Error('Workspace root (directory with model.yaml) not found.');
150
+ }
151
+ this.gitResolver = new GitUrlResolver();
152
+ const loaded = await this.loadLockFileFromDisk();
153
+ this.applyLockFile(loaded);
154
+ if (!this.lockFile && this.options.autoResolve !== false) {
155
+ await this.generateLockFile();
156
+ }
157
+ }
158
+ async ensureInitialized() {
159
+ if (this.initializePromise) {
160
+ await this.initializePromise;
161
+ }
162
+ else if (!this.workspaceRoot) {
163
+ throw new Error('WorkspaceManager not initialized. Call initialize() first.');
164
+ }
165
+ }
166
+ applyLockFile(loaded) {
167
+ if (!this.gitResolver) {
168
+ return;
169
+ }
170
+ if (loaded) {
171
+ this.lockFile = loaded.lockFile;
172
+ this.gitResolver.setLockFile(this.lockFile);
173
+ }
174
+ else {
175
+ this.lockFile = undefined;
176
+ this.gitResolver.setLockFile(undefined);
177
+ }
178
+ }
179
+ async generateLockFile(force = false) {
180
+ if (!this.workspaceRoot || !this.gitResolver) {
181
+ throw new Error('WorkspaceManager not initialized.');
182
+ }
183
+ const resolver = this.ensureDependencyResolver();
184
+ if (!force && this.lockFile) {
185
+ return;
186
+ }
187
+ const lockFile = await resolver.resolveDependencies();
188
+ this.lockFile = lockFile;
189
+ this.gitResolver.setLockFile(lockFile);
190
+ // Write JSON lock file
191
+ await this.writeJsonLockFile(lockFile);
192
+ }
193
+ ensureDependencyResolver() {
194
+ if (!this.workspaceRoot || !this.gitResolver) {
195
+ throw new Error('WorkspaceManager not initialized.');
196
+ }
197
+ if (!this.dependencyResolver) {
198
+ this.dependencyResolver = new DependencyResolver(this.workspaceRoot, this.gitResolver);
199
+ }
200
+ return this.dependencyResolver;
201
+ }
202
+ async writeJsonLockFile(lockFile) {
203
+ if (!this.workspaceRoot) {
204
+ return;
205
+ }
206
+ const jsonPath = path.join(this.workspaceRoot, 'model.lock');
207
+ const payload = {
208
+ version: lockFile.version,
209
+ dependencies: lockFile.dependencies,
210
+ };
211
+ await fs.writeFile(jsonPath, JSON.stringify(payload, undefined, JSON_SPACE), 'utf-8');
212
+ }
213
+ async loadLockFileFromDisk() {
214
+ if (!this.workspaceRoot) {
215
+ return undefined;
216
+ }
217
+ for (const filename of this.lockFiles) {
218
+ const filePath = path.join(this.workspaceRoot, filename);
219
+ const lockFile = await this.tryReadLockFile(filePath, filename);
220
+ if (lockFile) {
221
+ return { lockFile, filePath };
222
+ }
223
+ }
224
+ return undefined;
225
+ }
226
+ async tryReadLockFile(filePath, _filename) {
227
+ try {
228
+ const content = await fs.readFile(filePath, 'utf-8');
229
+ return this.parseJsonLockFile(content);
230
+ }
231
+ catch (error) {
232
+ if (error?.code === 'ENOENT') {
233
+ return undefined;
234
+ }
235
+ throw error;
236
+ }
237
+ }
238
+ async loadManifest() {
239
+ const manifestPath = await this.getManifestPath();
240
+ if (!manifestPath) {
241
+ this.manifestCache = undefined;
242
+ return undefined;
243
+ }
244
+ try {
245
+ const stat = await fs.stat(manifestPath);
246
+ if (this.manifestCache &&
247
+ this.manifestCache.path === manifestPath &&
248
+ this.manifestCache.mtimeMs === stat.mtimeMs) {
249
+ return this.manifestCache.manifest;
250
+ }
251
+ const content = await fs.readFile(manifestPath, 'utf-8');
252
+ const manifest = (YAML.parse(content) ?? {});
253
+ this.manifestCache = {
254
+ manifest,
255
+ path: manifestPath,
256
+ mtimeMs: stat.mtimeMs,
257
+ };
258
+ return manifest;
259
+ }
260
+ catch (error) {
261
+ if (error?.code === 'ENOENT') {
262
+ this.manifestCache = undefined;
263
+ return undefined;
264
+ }
265
+ throw error;
266
+ }
267
+ }
268
+ parseJsonLockFile(content) {
269
+ const parsed = JSON.parse(content);
270
+ const version = typeof parsed.version === 'string' ? parsed.version : '1';
271
+ const dependencies = {};
272
+ for (const [key, value] of Object.entries(parsed.dependencies ?? {})) {
273
+ if (!value || typeof value.version !== 'string' || typeof value.resolved !== 'string' || typeof value.commit !== 'string') {
274
+ continue;
275
+ }
276
+ dependencies[key] = {
277
+ version: value.version,
278
+ resolved: value.resolved,
279
+ commit: value.commit,
280
+ integrity: value.integrity,
281
+ };
282
+ }
283
+ return { version, dependencies };
284
+ }
285
+ async findWorkspaceRoot(startPath) {
286
+ let current = path.resolve(startPath);
287
+ const { root } = path.parse(current);
288
+ while (true) {
289
+ if (await this.containsManifest(current)) {
290
+ return current;
291
+ }
292
+ if (current === root) {
293
+ return undefined;
294
+ }
295
+ const parent = path.dirname(current);
296
+ if (parent === current) {
297
+ return undefined;
298
+ }
299
+ current = parent;
300
+ }
301
+ }
302
+ async containsManifest(dir) {
303
+ for (const manifest of this.manifestFiles) {
304
+ if (await this.fileExists(path.join(dir, manifest))) {
305
+ return true;
306
+ }
307
+ }
308
+ return false;
309
+ }
310
+ async fileExists(targetPath) {
311
+ try {
312
+ await fs.access(targetPath);
313
+ return true;
314
+ }
315
+ catch (error) {
316
+ if (error?.code === 'ENOENT') {
317
+ return false;
318
+ }
319
+ throw error;
320
+ }
321
+ }
322
+ }
323
+ //# sourceMappingURL=workspace-manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-manager.js","sourceRoot":"","sources":["../../src/services/workspace-manager.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGhE,MAAM,sBAAsB,GAAG;IAC3B,YAAY;CACN,CAAC;AAEX,MAAM,kBAAkB,GAAG;IACvB,YAAY;CACN,CAAC;AAEX,MAAM,UAAU,GAAG,CAAC,CAAC;AAkCrB;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAUzB,YAA6B,UAAmC,EAAE;QAArC,YAAO,GAAP,OAAO,CAA8B;QAC9D,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,IA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AChB,CAAC;QACL,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAEO,KAAK,CAAC,UAAU,CAAC,UAAkB;QACvC,IAAI,CAAC;YACD,MAAM,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YAC5B,OAAO,IAAI,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,IAAK,KAA+B,EAAE,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACtD,OAAO,KAAK,CAAC;YACjB,CAAC;YACD,MAAM,KAAK,CAAC;QAChB,CAAC;IACL,CAAC;CACJ"}
@@ -0,0 +1,76 @@
1
+ declare const _default: {
2
+ keywords: string[];
3
+ operators: string[];
4
+ symbols: RegExp;
5
+ tokenizer: {
6
+ initial: ({
7
+ regex: RegExp;
8
+ action: {
9
+ cases: {
10
+ '@keywords': {
11
+ token: string;
12
+ };
13
+ '@default': {
14
+ token: string;
15
+ };
16
+ '@operators'?: undefined;
17
+ };
18
+ token?: undefined;
19
+ };
20
+ include?: undefined;
21
+ } | {
22
+ regex: RegExp;
23
+ action: {
24
+ token: string;
25
+ cases?: undefined;
26
+ };
27
+ include?: undefined;
28
+ } | {
29
+ include: string;
30
+ regex?: undefined;
31
+ action?: undefined;
32
+ } | {
33
+ regex: RegExp;
34
+ action: {
35
+ cases: {
36
+ '@operators': {
37
+ token: string;
38
+ };
39
+ '@default': {
40
+ token: string;
41
+ };
42
+ '@keywords'?: undefined;
43
+ };
44
+ token?: undefined;
45
+ };
46
+ include?: undefined;
47
+ })[];
48
+ whitespace: ({
49
+ regex: RegExp;
50
+ action: {
51
+ token: string;
52
+ next?: undefined;
53
+ };
54
+ } | {
55
+ regex: RegExp;
56
+ action: {
57
+ token: string;
58
+ next: string;
59
+ };
60
+ })[];
61
+ comment: ({
62
+ regex: RegExp;
63
+ action: {
64
+ token: string;
65
+ next?: undefined;
66
+ };
67
+ } | {
68
+ regex: RegExp;
69
+ action: {
70
+ token: string;
71
+ next: string;
72
+ };
73
+ })[];
74
+ };
75
+ };
76
+ export default _default;
@@ -0,0 +1,29 @@
1
+ // Monarch syntax highlighting for the domain-lang language.
2
+ export default {
3
+ keywords: [
4
+ 'ACL', 'AntiCorruptionLayer', 'BBoM', 'BigBallOfMud', 'BoundedContext', 'CF', 'Classification', 'Conformist', 'ContextMap', 'CustomerSupplier', 'Decision', 'Domain', 'DomainMap', 'Import', 'Metadata', 'Namespace', 'OHS', 'OpenHostService', 'P', 'PL', 'Partnership', 'Policy', 'PublishedLanguage', 'Rule', 'SK', 'SeparateWays', 'SharedKernel', 'Team', 'Term', 'UpstreamDownstream', 'aka', 'archetype', 'as', 'bc', 'businessModel', 'by', 'classification', 'cmap', 'contains', 'decision', 'decisions', 'description', 'dmap', 'dom', 'evolution', 'examples', 'for', 'from', 'glossary', 'import', 'in', 'integrations', 'integrity', 'is', 'meta', 'metadata', 'ns', 'policy', 'relationships', 'rule', 'rules', 'synonyms', 'team', 'term', 'terminology', 'this', 'type', 'vision'
5
+ ],
6
+ operators: [
7
+ ',', '->', '.', ':', '<-', '<->', '=', '><'
8
+ ],
9
+ symbols: /,|->|\.|:|<-|<->|=|><|\[|\]|\{|\}/,
10
+ tokenizer: {
11
+ initial: [
12
+ { regex: /[_a-zA-Z][\w_-]*/, action: { cases: { '@keywords': { "token": "keyword" }, '@default': { "token": "ID" } } } },
13
+ { regex: /"(\\.|[^"\\])*"|'(\\.|[^'\\])*'/, action: { "token": "string" } },
14
+ { include: '@whitespace' },
15
+ { regex: /@symbols/, action: { cases: { '@operators': { "token": "operator" }, '@default': { "token": "" } } } },
16
+ ],
17
+ whitespace: [
18
+ { regex: /\s+/, action: { "token": "white" } },
19
+ { regex: /\/\*/, action: { "token": "comment", "next": "@comment" } },
20
+ { regex: /\/\/[^\n\r]*/, action: { "token": "comment" } },
21
+ ],
22
+ comment: [
23
+ { regex: /[^/\*]+/, action: { "token": "comment" } },
24
+ { regex: /\*\//, action: { "token": "comment", "next": "@pop" } },
25
+ { regex: /[/\*]/, action: { "token": "comment" } },
26
+ ],
27
+ }
28
+ };
29
+ //# sourceMappingURL=domain-lang.monarch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain-lang.monarch.js","sourceRoot":"","sources":["../../src/syntaxes/domain-lang.monarch.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,eAAe;IACX,QAAQ,EAAE;QACN,KAAK,EAAC,qBAAqB,EAAC,MAAM,EAAC,cAAc,EAAC,gBAAgB,EAAC,IAAI,EAAC,gBAAgB,EAAC,YAAY,EAAC,YAAY,EAAC,kBAAkB,EAAC,UAAU,EAAC,QAAQ,EAAC,WAAW,EAAC,QAAQ,EAAC,UAAU,EAAC,WAAW,EAAC,KAAK,EAAC,iBAAiB,EAAC,GAAG,EAAC,IAAI,EAAC,aAAa,EAAC,QAAQ,EAAC,mBAAmB,EAAC,MAAM,EAAC,IAAI,EAAC,cAAc,EAAC,cAAc,EAAC,MAAM,EAAC,MAAM,EAAC,oBAAoB,EAAC,KAAK,EAAC,WAAW,EAAC,IAAI,EAAC,IAAI,EAAC,eAAe,EAAC,IAAI,EAAC,gBAAgB,EAAC,MAAM,EAAC,UAAU,EAAC,UAAU,EAAC,WAAW,EAAC,aAAa,EAAC,MAAM,EAAC,KAAK,EAAC,WAAW,EAAC,UAAU,EAAC,KAAK,EAAC,MAAM,EAAC,UAAU,EAAC,QAAQ,EAAC,IAAI,EAAC,cAAc,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,EAAC,UAAU,EAAC,IAAI,EAAC,QAAQ,EAAC,eAAe,EAAC,MAAM,EAAC,OAAO,EAAC,UAAU,EAAC,MAAM,EAAC,MAAM,EAAC,aAAa,EAAC,MAAM,EAAC,MAAM,EAAC,QAAQ;KACjsB;IACD,SAAS,EAAE;QACP,GAAG,EAAC,IAAI,EAAC,GAAG,EAAC,GAAG,EAAC,IAAI,EAAC,KAAK,EAAC,GAAG,EAAC,IAAI;KACvC;IACD,OAAO,EAAE,mCAAmC;I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path to an absolute file URI.
4
+ *
5
+ * Supports:
6
+ * - Local relative paths: ./file.dlang, ../other/file.dlang
7
+ * - Workspace-relative paths: ~/contexts/sales.dlang
8
+ * - Git URLs: gh:owner/repo@v1.0.0/file.dlang
9
+ * - Full URLs: https://github.com/owner/repo/blob/v1.0.0/file.dlang
10
+ *
11
+ * @param importingDoc - The document containing the import statement
12
+ * @param rawImportPath - The raw import path from the import statement
13
+ * @returns Resolved URI to the imported file
14
+ * @throws {Error} If the import cannot be resolved
15
+ */
16
+ export declare function resolveImportPath(importingDoc: LangiumDocument, rawImportPath: string): Promise<URI>;
17
+ /**
18
+ * Legacy function for backward compatibility.
19
+ * Use resolveImportPath instead.
20
+ *
21
+ * @deprecated Use resolveImportPath which supports git URLs and workspace paths
22
+ */
23
+ export declare function resolveLocalImportPath(importingDoc: LangiumDocument, rawImportPath: string): Promise<string>;
24
+ /**
25
+ * Ensures the import graph is loaded from an entry file.
26
+ *
27
+ * @param entryFilePath - Absolute or workspace-relative path to entry file
28
+ * @param langiumDocuments - The Langium documents manager
29
+ * @returns Set of URIs (as strings) for all documents in the import graph
30
+ * @throws {Error} If entry file cannot be resolved or loaded
31
+ */
32
+ export declare function ensureImportGraphFromEntryFile(entryFilePath: string, langiumDocuments: LangiumDocuments): Promise<Set<string>>;
33
+ /**
34
+ * Recursively builds the import graph from a document.
35
+ *
36
+ * @param document - The starting document
37
+ * @param langiumDocuments - The Langium documents manager
38
+ * @returns Set of URIs (as strings) for all documents in the import graph
39
+ */
40
+ export declare function ensureImportGraphFromDocument(document: LangiumDocument, langiumDocuments: LangiumDocuments): Promise<Set<string>>;
41
+ /**
42
+ * Gets cache statistics for git imports.
43
+ *
44
+ * @returns Cache statistics including size and number of cached repositories
45
+ */
46
+ export declare function getGitCacheStats(startDir?: string): Promise<{
47
+ totalSize: number;
48
+ repoCount: number;
49
+ cacheDir: string;
50
+ }>;
51
+ /**
52
+ * Clears the git import cache.
53
+ *
54
+ * @param startDir - Starting directory for workspace resolution
55
+ * @returns Promise that resolves when cache is cleared
56
+ */
57
+ export declare function clearGitCache(startDir?: string): Promise<void>;