@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,18 @@
1
+ export interface GitImportInfo {
2
+ original: string;
3
+ platform: 'github' | 'gitlab' | 'bitbucket' | 'generic';
4
+ owner: string;
5
+ repo: string;
6
+ version: string;
7
+ repoUrl: string;
8
+ entryPoint: string;
9
+ }
10
+ export declare class GitUrlResolver {
11
+ constructor();
12
+ }
13
+ export declare const GitUrlParser: {
14
+ parse(): never;
15
+ };
16
+ export declare function loadLockFile(): void;
17
+ export type LockFile = unknown;
18
+ export type LockedDependency = unknown;
@@ -0,0 +1,15 @@
1
+ // Browser stub for GitUrlResolver
2
+ export class GitUrlResolver {
3
+ constructor() {
4
+ throw new Error('GitUrlResolver is not available in the browser.');
5
+ }
6
+ }
7
+ export const GitUrlParser = {
8
+ parse() {
9
+ throw new Error('GitUrlParser is not available in the browser.');
10
+ }
11
+ };
12
+ export function loadLockFile() {
13
+ throw new Error('loadLockFile is not available in the browser.');
14
+ }
15
+ //# sourceMappingURL=git-url-resolver.browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-url-resolver.browser.js","sourceRoot":"","sources":["../../src/services/git-url-resolver.browser.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAYlC,MAAM,OAAO,cAAc;IACvB;QACI,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACvE,CAAC;CACJ;AAGD,MAAM,CAAC,MAAM,YAAY,GAAG;IACxB,KAAK;QACD,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACrE,CAAC;CACJ,CAAC;AAEF,MAAM,UAAU,YAAY;IACxB,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;AACrE,CAAC"}
@@ -0,0 +1,192 @@
1
+ /**
2
+ * Git Repository Resolver Service
3
+ *
4
+ * Resolves git-based package imports to local cached repositories.
5
+ * Supports simplified GitHub syntax (owner/repo@version) and full URLs.
6
+ *
7
+ * Design: Repository-level imports (not individual files)
8
+ * - Imports load entire package
9
+ * - Package entry point defined in model.yaml
10
+ * - Version pinning at repository level
11
+ */
12
+ import { URI } from 'langium';
13
+ /**
14
+ * Parsed git import with repository-level information.
15
+ */
16
+ export interface GitImportInfo {
17
+ /** Original import string */
18
+ original: string;
19
+ /** Git platform (github, gitlab, bitbucket, or generic) */
20
+ platform: 'github' | 'gitlab' | 'bitbucket' | 'generic';
21
+ /** Repository owner/organization */
22
+ owner: string;
23
+ /** Repository name */
24
+ repo: string;
25
+ /** Version (tag, branch, or commit hash) */
26
+ version: string;
27
+ /** Full git repository URL */
28
+ repoUrl: string;
29
+ /** Package main entry point (from dlang.toml or default index.dlang) */
30
+ entryPoint: string;
31
+ }
32
+ /**
33
+ * Package metadata from model.yaml
34
+ */
35
+ export interface PackageMetadata {
36
+ name?: string;
37
+ version?: string;
38
+ main?: string;
39
+ entry?: string;
40
+ exports?: Record<string, string>;
41
+ dependencies?: Record<string, string>;
42
+ }
43
+ /**
44
+ * Lock file format (dlang.lock)
45
+ *
46
+ * Pins exact versions and commit hashes for all dependencies
47
+ * in the dependency tree. Ensures reproducible builds.
48
+ */
49
+ export interface LockFile {
50
+ version: string;
51
+ dependencies: Record<string, LockedDependency>;
52
+ }
53
+ /**
54
+ * A single locked dependency with pinned version and commit.
55
+ */
56
+ export interface LockedDependency {
57
+ version: string;
58
+ resolved: string;
59
+ commit: string;
60
+ integrity?: string;
61
+ }
62
+ /**
63
+ * Parses import URLs into structured git import information.
64
+ *
65
+ * Supported formats:
66
+ * - owner/repo@version (GitHub assumed)
67
+ * - owner/repo (GitHub, defaults to main)
68
+ * - https://github.com/owner/repo@version
69
+ * - https://gitlab.com/owner/repo@version
70
+ * - https://git.example.com/owner/repo@version
71
+ */
72
+ export declare class GitUrlParser {
73
+ /**
74
+ * Determines if an import string is a git repository import.
75
+ */
76
+ static isGitUrl(importStr: string): boolean;
77
+ /**
78
+ * Parses a git import URL into structured components.
79
+ *
80
+ * @param importStr - The import URL string
81
+ * @returns Parsed git import information
82
+ * @throws Error if URL format is invalid
83
+ */
84
+ static parse(importStr: string): GitImportInfo;
85
+ /**
86
+ * Checks if string is GitHub shorthand format.
87
+ */
88
+ private static isGitHubShorthand;
89
+ /**
90
+ * Parses GitHub shorthand (owner/repo or owner/repo@version).
91
+ */
92
+ private static parseGitHubShorthand;
93
+ /**
94
+ * Parses full git URLs (https://...).
95
+ *
96
+ * Supported:
97
+ * - https://github.com/owner/repo@version
98
+ * - https://gitlab.com/owner/repo@version
99
+ * - https://git.example.com/owner/repo@version
100
+ */
101
+ private static parseFullUrl;
102
+ }
103
+ /**
104
+ * Resolves git repository imports to local entry point files.
105
+ *
106
+ * Implements a content-addressable cache:
107
+ * - Cache location: ~/.dlang/cache/
108
+ * - Cache key: platform/owner/repo/commit-hash
109
+ * - Downloads entire repository on first use
110
+ * - Reads dlang.toml to find entry point
111
+ * - Returns URI to entry point file
112
+ */
113
+ export declare class GitUrlResolver {
114
+ private cacheDir;
115
+ private lockFile?;
116
+ constructor(cacheDir?: string);
117
+ /**
118
+ * Sets the lock file for dependency resolution.
119
+ *
120
+ * When a lock file is set, all package imports will use
121
+ * the locked commit hashes instead of resolving versions.
122
+ * This ensures reproducible builds and handles transitive dependencies.
123
+ *
124
+ * @param lockFile - The parsed lock file from the workspace root
125
+ */
126
+ setLockFile(lockFile: LockFile | undefined): void;
127
+ /**
128
+ * Resolves a git import URL to the package's entry point file.
129
+ *
130
+ * Process:
131
+ * 1. Parse git URL
132
+ * 2. Check lock file for pinned version (transitive dependency support)
133
+ * 3. Resolve version to commit hash (if not locked)
134
+ * 4. Check cache
135
+ * 5. Download repository if not cached
136
+ * 6. Read dlang.toml to find entry point
137
+ * 7. Return URI to entry point file
138
+ *
139
+ * @param importUrl - The git import URL
140
+ * @returns URI to the package's entry point file
141
+ */
142
+ resolve(importUrl: string): Promise<URI>;
143
+ /**
144
+ * Reads model.yaml to get the package entry point.
145
+ * Falls back to index.dlang if no model.yaml found.
146
+ */
147
+ private getEntryPoint;
148
+ /**
149
+ * Parses model.yaml content to extract entry point.
150
+ *
151
+ * Expected structure:
152
+ * model:
153
+ * entry: index.dlang
154
+ */
155
+ private parseYaml;
156
+ /**
157
+ * Resolves a version (tag/branch) to a commit hash using git ls-remote.
158
+ */
159
+ private resolveCommit;
160
+ /**
161
+ * Gets the local cache path for a git repository.
162
+ *
163
+ * Format: ~/.dlang/cache/{platform}/{owner}/{repo}/{commit-hash}/
164
+ */
165
+ private getCachePath;
166
+ /**
167
+ * Checks if a file or directory exists in the cache.
168
+ */
169
+ private existsInCache;
170
+ /**
171
+ * Downloads a git repository to the cache.
172
+ *
173
+ * Uses shallow clone for efficiency (only downloads the specific commit).
174
+ */
175
+ private downloadRepo;
176
+ /**
177
+ * Clears the entire cache.
178
+ */
179
+ clearCache(): Promise<void>;
180
+ /**
181
+ * Gets cache statistics (size, number of cached repos, etc.).
182
+ */
183
+ getCacheStats(): Promise<{
184
+ totalSize: number;
185
+ repoCount: number;
186
+ cacheDir: string;
187
+ }>;
188
+ /**
189
+ * Gets the total size of a directory in bytes.
190
+ */
191
+ private getDirectorySize;
192
+ }
@@ -0,0 +1,382 @@
1
+ /**
2
+ * Git Repository Resolver Service
3
+ *
4
+ * Resolves git-based package imports to local cached repositories.
5
+ * Supports simplified GitHub syntax (owner/repo@version) and full URLs.
6
+ *
7
+ * Design: Repository-level imports (not individual files)
8
+ * - Imports load entire package
9
+ * - Package entry point defined in model.yaml
10
+ * - Version pinning at repository level
11
+ */
12
+ import { URI } from 'langium';
13
+ import path from 'node:path';
14
+ import fs from 'node:fs/promises';
15
+ import os from 'node:os';
16
+ import { exec } from 'node:child_process';
17
+ import { promisify } from 'node:util';
18
+ import YAML from 'yaml';
19
+ const execAsync = promisify(exec);
20
+ /**
21
+ * Parses import URLs into structured git import information.
22
+ *
23
+ * Supported formats:
24
+ * - owner/repo@version (GitHub assumed)
25
+ * - owner/repo (GitHub, defaults to main)
26
+ * - https://github.com/owner/repo@version
27
+ * - https://gitlab.com/owner/repo@version
28
+ * - https://git.example.com/owner/repo@version
29
+ */
30
+ export class GitUrlParser {
31
+ /**
32
+ * Determines if an import string is a git repository import.
33
+ */
34
+ static isGitUrl(importStr) {
35
+ // GitHub shorthand: owner/repo or owner/repo@version
36
+ if (/^[a-zA-Z0-9-]+\/[a-zA-Z0-9-_.]+(@[^/]+)?$/.test(importStr)) {
37
+ return true;
38
+ }
39
+ // Full URLs
40
+ return (importStr.startsWith('https://github.com/') ||
41
+ importStr.startsWith('https://gitlab.com/') ||
42
+ importStr.startsWith('https://bitbucket.org/') ||
43
+ importStr.startsWith('https://git.') ||
44
+ importStr.startsWith('git://'));
45
+ }
46
+ /**
47
+ * Parses a git import URL into structured components.
48
+ *
49
+ * @param importStr - The import URL string
50
+ * @returns Parsed git import information
51
+ * @throws Error if URL format is invalid
52
+ */
53
+ static parse(importStr) {
54
+ // Handle GitHub shorthand (owner/repo or owner/repo@version)
55
+ if (this.isGitHubShorthand(importStr)) {
56
+ return this.parseGitHubShorthand(importStr);
57
+ }
58
+ // Handle full URLs
59
+ if (importStr.startsWith('https://') || importStr.startsWith('git://')) {
60
+ return this.parseFullUrl(importStr);
61
+ }
62
+ throw new Error(`Invalid git import URL: ${importStr}`);
63
+ }
64
+ /**
65
+ * Checks if string is GitHub shorthand format.
66
+ */
67
+ static isGitHubShorthand(importStr) {
68
+ return /^[a-zA-Z0-9-]+\/[a-zA-Z0-9-_.]+(@[^/]+)?$/.test(importStr);
69
+ }
70
+ /**
71
+ * Parses GitHub shorthand (owner/repo or owner/repo@version).
72
+ */
73
+ static parseGitHubShorthand(importStr) {
74
+ const match = importStr.match(/^([a-zA-Z0-9-]+)\/([a-zA-Z0-9-_.]+)(?:@([^/]+))?$/);
75
+ if (!match) {
76
+ throw new Error(`Invalid GitHub shorthand format: ${importStr}`);
77
+ }
78
+ const [, owner, repo, version] = match;
79
+ const resolvedVersion = version || 'main';
80
+ return {
81
+ original: importStr,
82
+ platform: 'github',
83
+ owner,
84
+ repo,
85
+ version: resolvedVersion,
86
+ repoUrl: `https://github.com/${owner}/${repo}`,
87
+ entryPoint: 'index.dlang', // Default, will be resolved from dlang.toml
88
+ };
89
+ }
90
+ /**
91
+ * Parses full git URLs (https://...).
92
+ *
93
+ * Supported:
94
+ * - https://github.com/owner/repo@version
95
+ * - https://gitlab.com/owner/repo@version
96
+ * - https://git.example.com/owner/repo@version
97
+ */
98
+ static parseFullUrl(importStr) {
99
+ // GitHub
100
+ const ghMatch = importStr.match(/^https:\/\/github\.com\/([^/]+)\/([^/@]+)(?:@([^/]+))?$/);
101
+ if (ghMatch) {
102
+ const [, owner, repo, version] = ghMatch;
103
+ return {
104
+ original: importStr,
105
+ platform: 'github',
106
+ owner,
107
+ repo,
108
+ version: version || 'main',
109
+ repoUrl: `https://github.com/${owner}/${repo}`,
110
+ entryPoint: 'index.dlang',
111
+ };
112
+ }
113
+ // GitLab
114
+ const glMatch = importStr.match(/^https:\/\/gitlab\.com\/([^/]+)\/([^/@]+)(?:@([^/]+))?$/);
115
+ if (glMatch) {
116
+ const [, owner, repo, version] = glMatch;
117
+ return {
118
+ original: importStr,
119
+ platform: 'gitlab',
120
+ owner,
121
+ repo,
122
+ version: version || 'main',
123
+ repoUrl: `https://gitlab.com/${owner}/${repo}`,
124
+ entryPoint: 'index.dlang',
125
+ };
126
+ }
127
+ // Bitbucket
128
+ const bbMatch = importStr.match(/^https:\/\/bitbucket\.org\/([^/]+)\/([^/@]+)(?:@([^/]+))?$/);
129
+ if (bbMatch) {
130
+ const [, owner, repo, version] = bbMatch;
131
+ return {
132
+ original: importStr,
133
+ platform: 'bitbucket',
134
+ owner,
135
+ repo,
136
+ version: version || 'main',
137
+ repoUrl: `https://bitbucket.org/${owner}/${repo}`,
138
+ entryPoint: 'index.dlang',
139
+ };
140
+ }
141
+ // Generic git URL
142
+ const genericMatch = importStr.match(/^(?:https|git):\/\/([^/]+)\/([^/]+)\/([^/@]+)(?:@([^/]+))?$/);
143
+ if (genericMatch) {
144
+ const [, host, owner, repo, version] = genericMatch;
145
+ return {
146
+ original: importStr,
147
+ platform: 'generic',
148
+ owner,
149
+ repo,
150
+ version: version || 'main',
151
+ repoUrl: `https://${host}/${owner}/${repo}`,
152
+ entryPoint: 'index.dlang',
153
+ };
154
+ }
155
+ throw new Error(`Unsupported git URL format: ${importStr}`);
156
+ }
157
+ }
158
+ /**
159
+ * Resolves git repository imports to local entry point files.
160
+ *
161
+ * Implements a content-addressable cache:
162
+ * - Cache location: ~/.dlang/cache/
163
+ * - Cache key: platform/owner/repo/commit-hash
164
+ * - Downloads entire repository on first use
165
+ * - Reads dlang.toml to find entry point
166
+ * - Returns URI to entry point file
167
+ */
168
+ export class GitUrlResolver {
169
+ constructor(cacheDir) {
170
+ this.cacheDir = cacheDir || path.join(os.homedir(), '.dlang', 'cache');
171
+ }
172
+ /**
173
+ * Sets the lock file for dependency resolution.
174
+ *
175
+ * When a lock file is set, all package imports will use
176
+ * the locked commit hashes instead of resolving versions.
177
+ * This ensures reproducible builds and handles transitive dependencies.
178
+ *
179
+ * @param lockFile - The parsed lock file from the workspace root
180
+ */
181
+ setLockFile(lockFile) {
182
+ this.lockFile = lockFile;
183
+ }
184
+ /**
185
+ * Resolves a git import URL to the package's entry point file.
186
+ *
187
+ * Process:
188
+ * 1. Parse git URL
189
+ * 2. Check lock file for pinned version (transitive dependency support)
190
+ * 3. Resolve version to commit hash (if not locked)
191
+ * 4. Check cache
192
+ * 5. Download repository if not cached
193
+ * 6. Read dlang.toml to find entry point
194
+ * 7. Return URI to entry point file
195
+ *
196
+ * @param importUrl - The git import URL
197
+ * @returns URI to the package's entry point file
198
+ */
199
+ async resolve(importUrl) {
200
+ const gitInfo = GitUrlParser.parse(importUrl);
201
+ // Check lock file for pinned version (handles transitive dependencies)
202
+ let commitHash;
203
+ const packageKey = `${gitInfo.owner}/${gitInfo.repo}`;
204
+ if (this.lockFile?.dependencies[packageKey]) {
205
+ // Use locked commit hash (reproducible build)
206
+ commitHash = this.lockFile.dependencies[packageKey].commit;
207
+ }
208
+ else {
209
+ // Resolve version dynamically (development mode or missing lock)
210
+ commitHash = await this.resolveCommit(gitInfo);
211
+ }
212
+ // Check cache
213
+ const cachedPath = this.getCachePath(gitInfo, commitHash);
214
+ if (!(await this.existsInCache(cachedPath))) {
215
+ // Download repository
216
+ await this.downloadRepo(gitInfo, commitHash, cachedPath);
217
+ }
218
+ // Read package metadata to get entry point
219
+ const entryPoint = await this.getEntryPoint(cachedPath);
220
+ const entryFile = path.join(cachedPath, entryPoint);
221
+ // Verify entry point exists
222
+ if (!(await this.existsInCache(entryFile))) {
223
+ throw new Error(`Entry point not found: ${entryPoint} in ${gitInfo.repoUrl}@${gitInfo.version}`);
224
+ }
225
+ return URI.file(entryFile);
226
+ }
227
+ /**
228
+ * Reads model.yaml to get the package entry point.
229
+ * Falls back to index.dlang if no model.yaml found.
230
+ */
231
+ async getEntryPoint(repoPath) {
232
+ const yamlPath = path.join(repoPath, 'model.yaml');
233
+ try {
234
+ const yamlContent = await fs.readFile(yamlPath, 'utf-8');
235
+ const metadata = this.parseYaml(yamlContent);
236
+ // Prefer 'entry' field, fallback to 'main' for backward compatibility
237
+ return metadata.entry || metadata.main || 'index.dlang';
238
+ }
239
+ catch {
240
+ // No model.yaml or parse error, use default
241
+ return 'index.dlang';
242
+ }
243
+ }
244
+ /**
245
+ * Parses model.yaml content to extract entry point.
246
+ *
247
+ * Expected structure:
248
+ * model:
249
+ * entry: index.dlang
250
+ */
251
+ parseYaml(content) {
252
+ const parsed = YAML.parse(content);
253
+ return {
254
+ entry: parsed.model?.entry,
255
+ main: parsed.model?.main,
256
+ name: parsed.model?.name,
257
+ version: parsed.model?.version,
258
+ };
259
+ }
260
+ /**
261
+ * Resolves a version (tag/branch) to a commit hash using git ls-remote.
262
+ */
263
+ async resolveCommit(gitInfo) {
264
+ try {
265
+ // Try to resolve as tag or branch
266
+ const { stdout } = await execAsync(`git ls-remote ${gitInfo.repoUrl} ${gitInfo.version}`);
267
+ if (stdout.trim()) {
268
+ const commitHash = stdout.split('\t')[0];
269
+ return commitHash;
270
+ }
271
+ // If not found, assume it's already a commit hash
272
+ if (/^[0-9a-f]{7,40}$/i.test(gitInfo.version)) {
273
+ return gitInfo.version;
274
+ }
275
+ throw new Error(`Could not resolve version: ${gitInfo.version}`);
276
+ }
277
+ catch (error) {
278
+ throw new Error(`Failed to resolve git version ${gitInfo.version} for ${gitInfo.repoUrl}: ${error}`);
279
+ }
280
+ }
281
+ /**
282
+ * Gets the local cache path for a git repository.
283
+ *
284
+ * Format: ~/.dlang/cache/{platform}/{owner}/{repo}/{commit-hash}/
285
+ */
286
+ getCachePath(gitInfo, commitHash) {
287
+ return path.join(this.cacheDir, gitInfo.platform, gitInfo.owner, gitInfo.repo, commitHash);
288
+ }
289
+ /**
290
+ * Checks if a file or directory exists in the cache.
291
+ */
292
+ async existsInCache(filePath) {
293
+ try {
294
+ await fs.access(filePath);
295
+ return true;
296
+ }
297
+ catch {
298
+ return false;
299
+ }
300
+ }
301
+ /**
302
+ * Downloads a git repository to the cache.
303
+ *
304
+ * Uses shallow clone for efficiency (only downloads the specific commit).
305
+ */
306
+ async downloadRepo(gitInfo, commitHash, cachePath) {
307
+ const targetDir = path.resolve(cachePath);
308
+ const parentDir = path.dirname(targetDir);
309
+ await fs.mkdir(parentDir, { recursive: true });
310
+ try {
311
+ await execAsync(`git clone ${gitInfo.repoUrl}.git "${targetDir}" --no-checkout`);
312
+ await execAsync(`git -C "${targetDir}" fetch --depth 1 origin ${commitHash}`);
313
+ await execAsync(`git -C "${targetDir}" checkout --force --detach ${commitHash}`);
314
+ await fs.rm(path.join(targetDir, '.git'), { recursive: true, force: true });
315
+ }
316
+ catch (error) {
317
+ await fs.rm(targetDir, { recursive: true, force: true });
318
+ const message = error instanceof Error ? error.message : String(error);
319
+ throw new Error(`Failed to download git repository ${gitInfo.repoUrl}@${gitInfo.version}: ${message}`);
320
+ }
321
+ }
322
+ /**
323
+ * Clears the entire cache.
324
+ */
325
+ async clearCache() {
326
+ await fs.rm(this.cacheDir, { recursive: true, force: true });
327
+ }
328
+ /**
329
+ * Gets cache statistics (size, number of cached repos, etc.).
330
+ */
331
+ async getCacheStats() {
332
+ let totalSize = 0;
333
+ let repoCount = 0;
334
+ try {
335
+ const platforms = await fs.readdir(this.cacheDir);
336
+ for (const platform of platforms) {
337
+ const platformPath = path.join(this.cacheDir, platform);
338
+ const owners = await fs.readdir(platformPath);
339
+ for (const owner of owners) {
340
+ const ownerPath = path.join(platformPath, owner);
341
+ const repos = await fs.readdir(ownerPath);
342
+ for (const repo of repos) {
343
+ const repoPath = path.join(ownerPath, repo);
344
+ const commits = await fs.readdir(repoPath);
345
+ repoCount += commits.length;
346
+ for (const commit of commits) {
347
+ const commitPath = path.join(repoPath, commit);
348
+ totalSize += await this.getDirectorySize(commitPath);
349
+ }
350
+ }
351
+ }
352
+ }
353
+ }
354
+ catch {
355
+ // Cache directory doesn't exist yet
356
+ }
357
+ return {
358
+ totalSize,
359
+ repoCount,
360
+ cacheDir: this.cacheDir,
361
+ };
362
+ }
363
+ /**
364
+ * Gets the total size of a directory in bytes.
365
+ */
366
+ async getDirectorySize(dirPath) {
367
+ let size = 0;
368
+ const entries = await fs.readdir(dirPath, { withFileTypes: true });
369
+ for (const entry of entries) {
370
+ const entryPath = path.join(dirPath, entry.name);
371
+ if (entry.isDirectory()) {
372
+ size += await this.getDirectorySize(entryPath);
373
+ }
374
+ else {
375
+ const stats = await fs.stat(entryPath);
376
+ size += stats.size;
377
+ }
378
+ }
379
+ return size;
380
+ }
381
+ }
382
+ //# sourceMappingURL=git-url-resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-url-resolver.js","sourceRoot":"","sources":["../../src/services/git-url-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAuDlC;;;;;;;;;GASG;AACH,MAAM,OAAO,YAAY;IACrB;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,SAAiB;QAC7B,qDAAqD;QACrD,IAAI,2CAA2C,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YAC9D,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,YAAY;QACZ,OAAO,CACH,SAAS,CAAC,UAAU,CAAC,qBAAqB,CAAC;YAC3C,SAAS,CAAC,UAAU,CAAC,qBAAqB,CAAC;YAC3C,SAAS,CAAC,UAAU,CAAC,wBAAwB,CAAC;YAC9C,SAAS,CAAC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