@domainlang/language 0.1.82 → 0.4.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 (111) hide show
  1. package/README.md +18 -18
  2. package/out/domain-lang-module.d.ts +2 -0
  3. package/out/domain-lang-module.js +11 -3
  4. package/out/domain-lang-module.js.map +1 -1
  5. package/out/generated/ast.d.ts +8 -19
  6. package/out/generated/ast.js +1 -10
  7. package/out/generated/ast.js.map +1 -1
  8. package/out/generated/grammar.d.ts +1 -1
  9. package/out/generated/grammar.js +28 -123
  10. package/out/generated/grammar.js.map +1 -1
  11. package/out/generated/module.d.ts +1 -1
  12. package/out/generated/module.js +1 -1
  13. package/out/index.d.ts +3 -0
  14. package/out/index.js +5 -0
  15. package/out/index.js.map +1 -1
  16. package/out/lsp/domain-lang-code-actions.d.ts +55 -0
  17. package/out/lsp/domain-lang-code-actions.js +143 -0
  18. package/out/lsp/domain-lang-code-actions.js.map +1 -0
  19. package/out/lsp/domain-lang-workspace-manager.d.ts +21 -0
  20. package/out/lsp/domain-lang-workspace-manager.js +93 -0
  21. package/out/lsp/domain-lang-workspace-manager.js.map +1 -0
  22. package/out/lsp/hover/domain-lang-hover.js +0 -4
  23. package/out/lsp/hover/domain-lang-hover.js.map +1 -1
  24. package/out/lsp/manifest-diagnostics.d.ts +82 -0
  25. package/out/lsp/manifest-diagnostics.js +230 -0
  26. package/out/lsp/manifest-diagnostics.js.map +1 -0
  27. package/out/sdk/index.d.ts +1 -1
  28. package/out/sdk/loader-node.d.ts +7 -3
  29. package/out/sdk/loader-node.js +24 -9
  30. package/out/sdk/loader-node.js.map +1 -1
  31. package/out/sdk/types.d.ts +0 -21
  32. package/out/services/dependency-analyzer.d.ts +3 -39
  33. package/out/services/dependency-analyzer.js +22 -47
  34. package/out/services/dependency-analyzer.js.map +1 -1
  35. package/out/services/dependency-resolver.d.ts +68 -45
  36. package/out/services/dependency-resolver.js +243 -43
  37. package/out/services/dependency-resolver.js.map +1 -1
  38. package/out/services/git-url-resolver.browser.d.ts +4 -12
  39. package/out/services/git-url-resolver.browser.js +5 -1
  40. package/out/services/git-url-resolver.browser.js.map +1 -1
  41. package/out/services/git-url-resolver.d.ts +22 -56
  42. package/out/services/git-url-resolver.js +70 -36
  43. package/out/services/git-url-resolver.js.map +1 -1
  44. package/out/services/governance-validator.d.ts +1 -37
  45. package/out/services/governance-validator.js +4 -10
  46. package/out/services/governance-validator.js.map +1 -1
  47. package/out/services/import-resolver.d.ts +65 -6
  48. package/out/services/import-resolver.js +223 -5
  49. package/out/services/import-resolver.js.map +1 -1
  50. package/out/services/performance-optimizer.d.ts +1 -1
  51. package/out/services/semver.d.ts +98 -0
  52. package/out/services/semver.js +195 -0
  53. package/out/services/semver.js.map +1 -0
  54. package/out/services/types.d.ts +340 -0
  55. package/out/services/types.js +46 -0
  56. package/out/services/types.js.map +1 -0
  57. package/out/services/workspace-manager.d.ts +57 -10
  58. package/out/services/workspace-manager.js +187 -21
  59. package/out/services/workspace-manager.js.map +1 -1
  60. package/out/syntaxes/domain-lang.monarch.js +1 -1
  61. package/out/syntaxes/domain-lang.monarch.js.map +1 -1
  62. package/out/utils/import-utils.d.ts +4 -12
  63. package/out/utils/import-utils.js +35 -135
  64. package/out/utils/import-utils.js.map +1 -1
  65. package/out/validation/constants.d.ts +103 -0
  66. package/out/validation/constants.js +141 -2
  67. package/out/validation/constants.js.map +1 -1
  68. package/out/validation/domain.js +46 -1
  69. package/out/validation/domain.js.map +1 -1
  70. package/out/validation/import.d.ts +46 -22
  71. package/out/validation/import.js +187 -85
  72. package/out/validation/import.js.map +1 -1
  73. package/out/validation/manifest.d.ts +144 -0
  74. package/out/validation/manifest.js +327 -0
  75. package/out/validation/manifest.js.map +1 -0
  76. package/out/validation/maps.js +10 -6
  77. package/out/validation/maps.js.map +1 -1
  78. package/out/validation/metadata.js +5 -1
  79. package/out/validation/metadata.js.map +1 -1
  80. package/package.json +8 -6
  81. package/src/domain-lang-module.ts +18 -6
  82. package/src/domain-lang.langium +7 -12
  83. package/src/generated/ast.ts +7 -20
  84. package/src/generated/grammar.ts +28 -123
  85. package/src/generated/module.ts +1 -1
  86. package/src/index.ts +7 -0
  87. package/src/lsp/domain-lang-code-actions.ts +189 -0
  88. package/src/lsp/domain-lang-workspace-manager.ts +104 -0
  89. package/src/lsp/hover/domain-lang-hover.ts +0 -2
  90. package/src/lsp/manifest-diagnostics.ts +290 -0
  91. package/src/sdk/index.ts +0 -2
  92. package/src/sdk/loader-node.ts +29 -9
  93. package/src/sdk/types.ts +0 -23
  94. package/src/services/dependency-analyzer.ts +24 -84
  95. package/src/services/dependency-resolver.ts +301 -84
  96. package/src/services/git-url-resolver.browser.ts +9 -14
  97. package/src/services/git-url-resolver.ts +86 -93
  98. package/src/services/governance-validator.ts +5 -47
  99. package/src/services/import-resolver.ts +270 -8
  100. package/src/services/performance-optimizer.ts +1 -1
  101. package/src/services/semver.ts +213 -0
  102. package/src/services/types.ts +415 -0
  103. package/src/services/workspace-manager.ts +237 -46
  104. package/src/syntaxes/domain-lang.monarch.ts +1 -1
  105. package/src/utils/import-utils.ts +38 -160
  106. package/src/validation/constants.ts +182 -2
  107. package/src/validation/domain.ts +54 -1
  108. package/src/validation/import.ts +228 -104
  109. package/src/validation/manifest.ts +439 -0
  110. package/src/validation/maps.ts +10 -6
  111. package/src/validation/metadata.ts +5 -1
@@ -0,0 +1,327 @@
1
+ /**
2
+ * Manifest Validation for DomainLang.
3
+ *
4
+ * Provides schema validation and issue detection for model.yaml files.
5
+ * This validation is triggered by the workspace manager when manifests are loaded.
6
+ *
7
+ * Validation includes:
8
+ * - Required fields for publishable packages
9
+ * - Dependency configuration correctness
10
+ * - Path alias validation
11
+ * - Version format validation
12
+ *
13
+ * @module
14
+ */
15
+ import { IssueCodes } from './constants.js';
16
+ // ============================================================================
17
+ // Issue Code Mapping for Manifest Validation
18
+ // ============================================================================
19
+ /**
20
+ * Issue codes specific to manifest validation.
21
+ * These extend the general IssueCodes for manifest-specific issues.
22
+ */
23
+ export const ManifestIssueCodes = {
24
+ // Model section issues
25
+ ModelMissingName: 'manifest-model-missing-name',
26
+ ModelMissingVersion: 'manifest-model-missing-version',
27
+ ModelInvalidVersion: 'manifest-model-invalid-version',
28
+ // Dependency section issues
29
+ DependencyMissingRef: 'manifest-dependency-missing-ref',
30
+ DependencyInvalidRef: 'manifest-dependency-invalid-ref',
31
+ DependencyConflictingSourcePath: 'manifest-dependency-conflicting-source-path',
32
+ DependencyMissingSourceOrPath: 'manifest-dependency-missing-source-or-path',
33
+ DependencyInvalidSource: 'manifest-dependency-invalid-source',
34
+ DependencyAbsolutePath: 'manifest-dependency-absolute-path',
35
+ // Path alias issues
36
+ PathAliasMissingAtPrefix: 'manifest-path-alias-missing-at-prefix',
37
+ PathAliasAbsolutePath: 'manifest-path-alias-absolute-path'
38
+ };
39
+ // ============================================================================
40
+ // Manifest Validator
41
+ // ============================================================================
42
+ /**
43
+ * Validates model.yaml manifests and reports issues.
44
+ *
45
+ * Usage:
46
+ * ```typescript
47
+ * const validator = new ManifestValidator();
48
+ * const result = validator.validate(manifest);
49
+ * if (!result.valid) {
50
+ * console.log(result.diagnostics);
51
+ * }
52
+ * ```
53
+ */
54
+ export class ManifestValidator {
55
+ /**
56
+ * Validates a parsed model.yaml manifest.
57
+ *
58
+ * @param manifest - The parsed manifest object
59
+ * @param options - Optional validation options
60
+ * @returns Validation result with diagnostics
61
+ */
62
+ validate(manifest, options = {}) {
63
+ const diagnostics = [];
64
+ // Validate model section
65
+ this.validateModelSection(manifest, diagnostics, options.requirePublishable ?? false);
66
+ // Validate dependencies section
67
+ this.validateDependenciesSection(manifest, diagnostics);
68
+ // Validate paths section
69
+ this.validatePathsSection(manifest, diagnostics);
70
+ // Calculate counts
71
+ const errorCount = diagnostics.filter(d => d.severity === 'error').length;
72
+ const warningCount = diagnostics.filter(d => d.severity === 'warning').length;
73
+ return {
74
+ valid: errorCount === 0,
75
+ diagnostics,
76
+ errorCount,
77
+ warningCount
78
+ };
79
+ }
80
+ /**
81
+ * Validates the model section of the manifest.
82
+ */
83
+ validateModelSection(manifest, diagnostics, requirePublishable) {
84
+ const model = manifest.model;
85
+ // If no model section and not requiring publishable, that's OK
86
+ if (!model && !requirePublishable) {
87
+ return;
88
+ }
89
+ // If requiring publishable package, name and version are required
90
+ if (requirePublishable) {
91
+ if (!model?.name) {
92
+ diagnostics.push({
93
+ code: ManifestIssueCodes.ModelMissingName,
94
+ severity: 'error',
95
+ message: 'Publishable packages require a model.name field.',
96
+ path: 'model.name',
97
+ hint: 'Add "name: my-package" under the model section.'
98
+ });
99
+ }
100
+ if (!model?.version) {
101
+ diagnostics.push({
102
+ code: ManifestIssueCodes.ModelMissingVersion,
103
+ severity: 'error',
104
+ message: 'Publishable packages require a model.version field.',
105
+ path: 'model.version',
106
+ hint: 'Add "version: 1.0.0" under the model section.'
107
+ });
108
+ }
109
+ }
110
+ // Validate version format if present
111
+ if (model?.version && !this.isValidSemVer(model.version)) {
112
+ diagnostics.push({
113
+ code: ManifestIssueCodes.ModelInvalidVersion,
114
+ severity: 'warning',
115
+ message: `Version '${model.version}' is not valid SemVer format.`,
116
+ path: 'model.version',
117
+ hint: 'Use SemVer format like "1.0.0" or "1.2.3-beta".'
118
+ });
119
+ }
120
+ }
121
+ /**
122
+ * Validates the dependencies section of the manifest.
123
+ */
124
+ validateDependenciesSection(manifest, diagnostics) {
125
+ const dependencies = manifest.dependencies;
126
+ if (!dependencies) {
127
+ return;
128
+ }
129
+ for (const [key, dep] of Object.entries(dependencies)) {
130
+ this.validateDependency(key, dep, diagnostics);
131
+ }
132
+ }
133
+ /**
134
+ * Validates a single dependency entry.
135
+ */
136
+ validateDependency(key, dep, diagnostics) {
137
+ const normalized = this.normalizeDependency(key, dep);
138
+ const basePath = `dependencies.${key}`;
139
+ // Check for conflicting source and path
140
+ if (normalized.source && normalized.path) {
141
+ diagnostics.push({
142
+ code: IssueCodes.ImportConflictingSourcePath,
143
+ severity: 'error',
144
+ message: `Dependency '${key}' cannot have both 'source' and 'path'.`,
145
+ path: basePath,
146
+ hint: `Use 'source' for git packages or 'path' for local workspace packages.`
147
+ });
148
+ return; // Don't validate further if this fundamental issue exists
149
+ }
150
+ // Check that at least one of source or path is present
151
+ if (!normalized.source && !normalized.path) {
152
+ diagnostics.push({
153
+ code: IssueCodes.ImportMissingSourceOrPath,
154
+ severity: 'error',
155
+ message: `Dependency '${key}' must have either 'source' or 'path'.`,
156
+ path: basePath,
157
+ hint: `Add 'source: owner/repo' for git packages or 'path: ./local' for local packages.`
158
+ });
159
+ return;
160
+ }
161
+ // Validate source-based dependencies
162
+ if (normalized.source) {
163
+ this.validateSourceDependency(key, normalized, basePath, diagnostics);
164
+ }
165
+ // Validate path-based dependencies
166
+ if (normalized.path) {
167
+ this.validatePathDependency(key, normalized, basePath, diagnostics);
168
+ }
169
+ }
170
+ /**
171
+ * Validates a git-source based dependency.
172
+ */
173
+ validateSourceDependency(key, dep, basePath, diagnostics) {
174
+ // Source dependencies require a ref (tag, branch, or commit)
175
+ if (!dep.ref) {
176
+ diagnostics.push({
177
+ code: IssueCodes.ImportMissingRef,
178
+ severity: 'error',
179
+ message: `Git dependency '${key}' requires a ref.`,
180
+ path: `${basePath}.ref`,
181
+ hint: `Add a git ref: 'ref: v1.0.0' (tag), 'ref: main' (branch), or a commit SHA.`
182
+ });
183
+ }
184
+ // Validate ref format
185
+ if (dep.ref && !this.isValidRefSpec(dep.ref)) {
186
+ diagnostics.push({
187
+ code: ManifestIssueCodes.DependencyInvalidRef,
188
+ severity: 'warning',
189
+ message: `Ref '${dep.ref}' for '${key}' may be invalid.`,
190
+ path: `${basePath}.ref`,
191
+ hint: `Use a tag (v1.0.0), branch name (main), or commit SHA.`
192
+ });
193
+ }
194
+ // Validate source format (should be owner/repo)
195
+ if (dep.source && !this.isValidSourceFormat(dep.source)) {
196
+ diagnostics.push({
197
+ code: ManifestIssueCodes.DependencyInvalidSource,
198
+ severity: 'error',
199
+ message: `Source '${dep.source}' is not valid owner/repo format.`,
200
+ path: `${basePath}.source`,
201
+ hint: `Use format 'owner/repo' like 'domainlang/core'.`
202
+ });
203
+ }
204
+ }
205
+ /**
206
+ * Validates a path-based local dependency.
207
+ */
208
+ validatePathDependency(key, dep, basePath, diagnostics) {
209
+ // Path dependencies should use relative paths
210
+ if (dep.path && this.isAbsolutePath(dep.path)) {
211
+ diagnostics.push({
212
+ code: IssueCodes.ImportAbsolutePath,
213
+ severity: 'error',
214
+ message: `Local path '${dep.path}' for '${key}' must be relative.`,
215
+ path: `${basePath}.path`,
216
+ hint: `Use a relative path like './packages/shared'.`
217
+ });
218
+ }
219
+ }
220
+ /**
221
+ * Validates the paths section of the manifest.
222
+ */
223
+ validatePathsSection(manifest, diagnostics) {
224
+ const paths = manifest.paths;
225
+ if (!paths) {
226
+ return;
227
+ }
228
+ for (const [alias, targetPath] of Object.entries(paths)) {
229
+ // Path aliases should start with @
230
+ if (!alias.startsWith('@')) {
231
+ diagnostics.push({
232
+ code: ManifestIssueCodes.PathAliasMissingAtPrefix,
233
+ severity: 'warning',
234
+ message: `Path alias '${alias}' should start with '@'.`,
235
+ path: `paths.${alias}`,
236
+ hint: `Rename to '@${alias}' for consistency.`
237
+ });
238
+ }
239
+ // Target paths should be relative
240
+ if (this.isAbsolutePath(targetPath)) {
241
+ diagnostics.push({
242
+ code: ManifestIssueCodes.PathAliasAbsolutePath,
243
+ severity: 'error',
244
+ message: `Path alias '${alias}' cannot map to absolute path '${targetPath}'.`,
245
+ path: `paths.${alias}`,
246
+ hint: `Use a relative path like './src' or '.'`
247
+ });
248
+ }
249
+ }
250
+ }
251
+ // ========================================================================
252
+ // Helpers
253
+ // ========================================================================
254
+ /**
255
+ * Normalizes a dependency to extended form.
256
+ */
257
+ normalizeDependency(key, dep) {
258
+ if (typeof dep === 'string') {
259
+ return { source: key, ref: dep };
260
+ }
261
+ if (dep.source || dep.path) {
262
+ return dep;
263
+ }
264
+ return { ...dep, source: key };
265
+ }
266
+ /**
267
+ * Checks if a version string is valid SemVer.
268
+ */
269
+ isValidSemVer(version) {
270
+ const semverRegex = /^\d+\.\d+\.\d+(-[\w.]+)?(\+[\w.]+)?$/;
271
+ return semverRegex.test(version);
272
+ }
273
+ /**
274
+ * Checks if a ref spec is valid (tag, branch, or commit SHA).
275
+ */
276
+ isValidRefSpec(ref) {
277
+ // SemVer with optional v prefix (tags)
278
+ if (/^v?\d+\.\d+\.\d+/.test(ref)) {
279
+ return true;
280
+ }
281
+ // Branch names (simple word chars)
282
+ if (/^[\w][\w.-]*$/.test(ref)) {
283
+ return true;
284
+ }
285
+ // Commit SHAs (40 hex chars)
286
+ if (/^[0-9a-f]{40}$/i.test(ref)) {
287
+ return true;
288
+ }
289
+ // Short commit SHAs (7+ hex chars)
290
+ if (/^[0-9a-f]{7,}$/i.test(ref)) {
291
+ return true;
292
+ }
293
+ return false;
294
+ }
295
+ /**
296
+ * Checks if source is valid owner/repo format.
297
+ */
298
+ isValidSourceFormat(source) {
299
+ return /^[a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-]+$/.test(source);
300
+ }
301
+ /**
302
+ * Checks if a path is absolute.
303
+ */
304
+ isAbsolutePath(p) {
305
+ return p.startsWith('/') || /^[A-Za-z]:/.test(p);
306
+ }
307
+ }
308
+ // ============================================================================
309
+ // Convenience Functions
310
+ // ============================================================================
311
+ /**
312
+ * Validates a manifest and returns true if valid, false otherwise.
313
+ * Use this for simple pass/fail checks.
314
+ */
315
+ export function isManifestValid(manifest) {
316
+ const validator = new ManifestValidator();
317
+ return validator.validate(manifest).valid;
318
+ }
319
+ /**
320
+ * Validates a manifest and returns all diagnostics.
321
+ * Use this to display validation errors to users.
322
+ */
323
+ export function validateManifest(manifest, options) {
324
+ const validator = new ManifestValidator();
325
+ return validator.validate(manifest, options).diagnostics;
326
+ }
327
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../src/validation/manifest.ts"],"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CAAC;QAChB,CAAC;QACD,6BAA6B;QAC7B,IAAI,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,mCAAmC;QACnC,IAAI,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAED;;OAEG;IACK,mBAAmB,CAAC,MAAc;QACtC,OAAO,oCAAoC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC7D,CAAC;IAED;;OAEG;IACK,cAAc,CAAC,CAAS;QAC5B,OAAO,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACrD,CAAC;CACJ;AAED,+EAA+E;AAC/E,wBAAwB;AACxB,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,QAAuB;IACnD,MAAM,SAAS,GAAG,IAAI,iBAAiB,EAAE,CAAC;IAC1C,OAAO,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC;AAC9C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAC5B,QAAuB,EACvB,OAA0C;IAE1C,MAAM,SAAS,GAAG,IAAI,iBAAiB,EAAE,CAAC;IAC1C,OAAO,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,WAAW,CAAC;AAC7D,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { ValidationMessages, buildCodeDescription } from './constants.js';
1
2
  /**
2
3
  * Validates that a context map contains at least one bounded context.
3
4
  * Empty context maps are not useful for documentation purposes.
@@ -7,9 +8,10 @@
7
8
  */
8
9
  function validateContextMapHasContexts(map, accept) {
9
10
  if (!map.boundedContexts || map.boundedContexts.length === 0) {
10
- accept('warning', `Context Map '${map.name}' contains no bounded contexts`, {
11
+ accept('warning', ValidationMessages.CONTEXT_MAP_NO_CONTEXTS(map.name), {
11
12
  node: map,
12
- keyword: 'contains'
13
+ keyword: 'contains',
14
+ codeDescription: buildCodeDescription('language.md', 'context-maps')
13
15
  });
14
16
  }
15
17
  }
@@ -25,9 +27,10 @@ function validateContextMapHasRelationships(map, accept) {
25
27
  const relationshipCount = map.relationships?.length ?? 0;
26
28
  // Only warn if multiple contexts exist without relationships
27
29
  if (contextCount > 1 && relationshipCount === 0) {
28
- accept('info', `Context Map '${map.name}' contains ${contextCount} contexts but no documented relationships`, {
30
+ accept('info', ValidationMessages.CONTEXT_MAP_NO_RELATIONSHIPS(map.name, contextCount), {
29
31
  node: map,
30
- keyword: 'ContextMap'
32
+ keyword: 'ContextMap',
33
+ codeDescription: buildCodeDescription('language.md', 'context-maps')
31
34
  });
32
35
  }
33
36
  }
@@ -40,9 +43,10 @@ function validateContextMapHasRelationships(map, accept) {
40
43
  */
41
44
  function validateDomainMapHasDomains(map, accept) {
42
45
  if (!map.domains || map.domains.length === 0) {
43
- accept('warning', `Domain Map '${map.name}' contains no domains`, {
46
+ accept('warning', ValidationMessages.DOMAIN_MAP_NO_DOMAINS(map.name), {
44
47
  node: map,
45
- keyword: 'contains'
48
+ keyword: 'contains',
49
+ codeDescription: buildCodeDescription('language.md', 'domain-maps')
46
50
  });
47
51
  }
48
52
  }
@@ -1 +1 @@
1
- {"version":3,"file":"maps.js","sourceRoot":"","sources":["../../src/validation/maps.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,SAAS,6BAA6B,CAClC,GAAe,EACf,MAA0B;IAE1B,IAAI,CAAC,GAAG,CAAC,eAAe,IAAI,GAAG,CAAC,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3D,MAAM,CAAC,SAAS,EAAE,gBAAgB,GAAG,CAAC,IAAI,gCAAgC,EAAE;YACxE,IAAI,EAAE,GAAG;YACT,OAAO,EAAE,UAAU;SACtB,CAAC,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A6B;IAC7B,kCAAkC;CACrC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG;IAC3B,2BAA2B;CAC9B,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { ValidationMessages, buildCodeDescription } from './constants.js';
1
2
  /**
2
3
  * Validation checks for Metadata elements.
3
4
  * - Ensures metadata keys are defined before use
@@ -5,7 +6,10 @@
5
6
  export const metadataChecks = {
6
7
  Metadata(metadata, accept) {
7
8
  if (!metadata.name) {
8
- accept('error', 'Metadata must have a name', { node: metadata });
9
+ accept('error', ValidationMessages.METADATA_MISSING_NAME(), {
10
+ node: metadata,
11
+ codeDescription: buildCodeDescription('language.md', 'metadata')
12
+ });
9
13
  }
10
14
  },
11
15
  };
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../src/validation/metadata.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAwC;IAC/D,QAAQ,CAAC,QAAkB,EAAE,MAAM;QAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;YACjB,MAAM,CAAC,OAAO,EAAE,2BAA2B,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;QACrE,CAAC;IACL,CAAC;CACJ,CAAC"}
1
+ {"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../src/validation/metadata.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE1E;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAwC;IAC/D,QAAQ,CAAC,QAAkB,EAAE,MAAM;QAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;YACjB,MAAM,CAAC,OAAO,EAAE,kBAAkB,CAAC,qBAAqB,EAAE,EAAE;gBACxD,IAAI,EAAE,QAAQ;gBACd,eAAe,EAAE,oBAAoB,CAAC,aAAa,EAAE,UAAU,CAAC;aACnE,CAAC,CAAC;QACP,CAAC;IACL,CAAC;CACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domainlang/language",
3
- "version": "0.1.82",
3
+ "version": "0.4.0",
4
4
  "displayName": "DomainLang Language",
5
5
  "description": "Core language library for DomainLang - parse, validate, and query Domain-Driven Design models programmatically",
6
6
  "author": "larsbaunwall",
@@ -23,14 +23,14 @@
23
23
  "parser",
24
24
  "sdk"
25
25
  ],
26
- "homepage": "https://github.com/larsbaunwall/DomainLang#readme",
26
+ "homepage": "https://domainlang.net",
27
27
  "repository": {
28
28
  "type": "git",
29
- "url": "https://github.com/larsbaunwall/DomainLang",
29
+ "url": "https://github.com/DomainLang/DomainLang",
30
30
  "directory": "dsl/domain-lang/packages/language"
31
31
  },
32
32
  "bugs": {
33
- "url": "https://github.com/larsbaunwall/DomainLang/issues"
33
+ "url": "https://github.com/DomainLang/DomainLang/issues"
34
34
  },
35
35
  "type": "module",
36
36
  "engines": {
@@ -86,13 +86,15 @@
86
86
  "test:coverage": "vitest run --coverage"
87
87
  },
88
88
  "dependencies": {
89
- "langium": "~4.1.0",
89
+ "langium": "~4.2.0",
90
+ "monaco-editor": "0.55.1",
91
+ "vite": "6.4.1",
90
92
  "yaml": "^2.5.0"
91
93
  },
92
94
  "devDependencies": {
93
95
  "@types/node": "~20.17.48",
94
96
  "@vitest/coverage-v8": "^3.1.4",
95
- "langium-cli": "~4.1.0",
97
+ "langium-cli": "~4.2.0",
96
98
  "shx": "~0.4.0",
97
99
  "typescript": "~5.8.3",
98
100
  "vitest": "~3.1.3"
@@ -2,8 +2,9 @@ import { type Module, inject } from 'langium';
2
2
  import type {
3
3
  DefaultSharedModuleContext,
4
4
  LangiumServices,
5
- LangiumSharedServices,
6
- PartialLangiumServices
5
+ LangiumSharedServices,
6
+ PartialLangiumServices,
7
+ PartialLangiumSharedServices
7
8
  } from 'langium/lsp';
8
9
  import { createDefaultModule, createDefaultSharedModule } from 'langium/lsp';
9
10
  import { DomainLangGeneratedModule, DomainLangGeneratedSharedModule } from './generated/module.js';
@@ -13,8 +14,10 @@ import { DomainLangScopeComputation } from './lsp/domain-lang-scope.js';
13
14
  import { DomainLangFormatter } from './lsp/domain-lang-formatter.js';
14
15
  import { DomainLangHoverProvider } from './lsp/hover/domain-lang-hover.js';
15
16
  import { DomainLangCompletionProvider } from './lsp/domain-lang-completion.js';
17
+ import { DomainLangCodeActionProvider } from './lsp/domain-lang-code-actions.js';
16
18
  import { ImportResolver } from './services/import-resolver.js';
17
19
  import { WorkspaceManager } from './services/workspace-manager.js';
20
+ import { DomainLangWorkspaceManager } from './lsp/domain-lang-workspace-manager.js';
18
21
 
19
22
  /**
20
23
  * Declaration of custom services - add your own service classes here.
@@ -30,7 +33,8 @@ export type DomainLangAddedServices = {
30
33
  lsp: {
31
34
  Formatter: DomainLangFormatter,
32
35
  HoverProvider: DomainLangHoverProvider,
33
- CompletionProvider: DomainLangCompletionProvider
36
+ CompletionProvider: DomainLangCompletionProvider,
37
+ CodeActionProvider: DomainLangCodeActionProvider
34
38
  }
35
39
  }
36
40
 
@@ -40,6 +44,12 @@ export type DomainLangAddedServices = {
40
44
  */
41
45
  export type DomainLangServices = LangiumServices & DomainLangAddedServices
42
46
 
47
+ const DomainLangSharedModule: Module<LangiumSharedServices, PartialLangiumSharedServices> = {
48
+ workspace: {
49
+ WorkspaceManager: (services: LangiumSharedServices) => new DomainLangWorkspaceManager(services)
50
+ }
51
+ };
52
+
43
53
  /**
44
54
  * Dependency injection module that overrides Langium default services and contributes the
45
55
  * declared custom services. The Langium defaults can be partially specified to override only
@@ -48,7 +58,7 @@ export type DomainLangServices = LangiumServices & DomainLangAddedServices
48
58
  export const DomainLangModule: Module<DomainLangServices, PartialLangiumServices & DomainLangAddedServices> = {
49
59
  imports: {
50
60
  ImportResolver: (services) => new ImportResolver(services),
51
- WorkspaceManager: () => new WorkspaceManager()
61
+ WorkspaceManager: () => new WorkspaceManager({ autoResolve: false, allowNetwork: false })
52
62
  },
53
63
  references: {
54
64
  ScopeComputation: (services) => new DomainLangScopeComputation(services),
@@ -57,7 +67,8 @@ export const DomainLangModule: Module<DomainLangServices, PartialLangiumServices
57
67
  lsp: {
58
68
  Formatter: () => new DomainLangFormatter(),
59
69
  HoverProvider: (services) => new DomainLangHoverProvider(services),
60
- CompletionProvider: (services) => new DomainLangCompletionProvider(services)
70
+ CompletionProvider: (services) => new DomainLangCompletionProvider(services),
71
+ CodeActionProvider: () => new DomainLangCodeActionProvider()
61
72
  },
62
73
  };
63
74
 
@@ -82,7 +93,8 @@ export function createDomainLangServices(context: DefaultSharedModuleContext): {
82
93
  } {
83
94
  const shared = inject(
84
95
  createDefaultSharedModule(context),
85
- DomainLangGeneratedSharedModule
96
+ DomainLangGeneratedSharedModule,
97
+ DomainLangSharedModule
86
98
  );
87
99
  const DomainLang = inject(
88
100
  createDefaultModule({ shared }),
@@ -292,23 +292,18 @@ BusinessRule:
292
292
  // ============================================================================
293
293
 
294
294
  /**
295
- * Import Statement - Git-native import system inspired by Go modules and Deno.
295
+ * Import Statement - Manifest-centric import system per PRS-010.
296
296
  *
297
- * Supported formats:
297
+ * Simplified syntax where import statements use short specifiers:
298
+ * - External dependencies (from manifest): import "core" as Core
298
299
  * - Local files: import "./shared/types.dlang"
299
300
  * - Workspace-relative: import "~/contexts/sales.dlang"
300
- * - GitHub packages: import "owner/repo@v1.0.0"
301
- * - GitLab/Git URLs: import "https://gitlab.com/owner/repo@v1.0.0"
302
- * - With aliases: import "ddd-patterns/core@v2.1.0" as DDD
303
- * - Named imports: import { OrderContext } from "./contexts.dlang"
301
+ *
302
+ * All resolution details (source, version, integrity) live in model.yaml manifest.
303
+ * Named imports and inline integrity checks have been removed per PRS-010.
304
304
  */
305
305
  ImportStatement:
306
- /** Imports types or namespaces from another file or module, enabling reuse and modularity. */ ('Import' | 'import') (
307
- '{' symbols+=ID (',' symbols+=ID)* '}' 'from' uri=STRING
308
- | uri=STRING
309
- ('integrity' integrity=STRING)?
310
- ('as' alias=ID)?
311
- )
306
+ /** Imports types or namespaces from another file or module, enabling reuse and modularity. */ ('Import' | 'import') uri=STRING ('as' alias=ID)?
312
307
  ;
313
308
 
314
309
  /**
@@ -1,5 +1,5 @@
1
1
  /******************************************************************************
2
- * This file was generated by langium-cli 4.1.0.
2
+ * This file was generated by langium-cli 4.2.0.
3
3
  * DO NOT EDIT MANUALLY!
4
4
  ******************************************************************************/
5
5
 
@@ -74,12 +74,10 @@ export type DomainLangKeywordNames =
74
74
  | "evolution"
75
75
  | "examples"
76
76
  | "for"
77
- | "from"
78
77
  | "glossary"
79
78
  | "import"
80
79
  | "in"
81
80
  | "integrations"
82
- | "integrity"
83
81
  | "is"
84
82
  | "meta"
85
83
  | "metadata"
@@ -352,30 +350,26 @@ export function isDomainTerm(item: unknown): item is DomainTerm {
352
350
  }
353
351
 
354
352
  /**
355
- * Import Statement - Git-native import system inspired by Go modules and Deno.
353
+ * Import Statement - Manifest-centric import system per PRS-010.
356
354
  *
357
- * Supported formats:
355
+ * Simplified syntax where import statements use short specifiers:
356
+ * - External dependencies (from manifest): import "core" as Core
358
357
  * - Local files: import "./shared/types.dlang"
359
358
  * - Workspace-relative: import "~/contexts/sales.dlang"
360
- * - GitHub packages: import "owner/repo@v1.0.0"
361
- * - GitLab/Git URLs: import "https://gitlab.com/owner/repo@v1.0.0"
362
- * - With aliases: import "ddd-patterns/core@v2.1.0" as DDD
363
- * - Named imports: import { OrderContext } from "./contexts.dlang"
359
+ *
360
+ * All resolution details (source, version, integrity) live in model.yaml manifest.
361
+ * Named imports and inline integrity checks have been removed per PRS-010.
364
362
  */
365
363
  export interface ImportStatement extends langium.AstNode {
366
364
  readonly $container: Model;
367
365
  readonly $type: 'ImportStatement';
368
366
  alias?: string;
369
- integrity?: string;
370
- symbols: Array<string>;
371
367
  uri: string;
372
368
  }
373
369
 
374
370
  export const ImportStatement = {
375
371
  $type: 'ImportStatement',
376
372
  alias: 'alias',
377
- integrity: 'integrity',
378
- symbols: 'symbols',
379
373
  uri: 'uri'
380
374
  } as const;
381
375
 
@@ -852,13 +846,6 @@ export class DomainLangAstReflection extends langium.AbstractAstReflection {
852
846
  alias: {
853
847
  name: ImportStatement.alias
854
848
  },
855
- integrity: {
856
- name: ImportStatement.integrity
857
- },
858
- symbols: {
859
- name: ImportStatement.symbols,
860
- defaultValue: []
861
- },
862
849
  uri: {
863
850
  name: ImportStatement.uri
864
851
  }