@domainlang/cli 0.5.2 → 0.6.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 (38) hide show
  1. package/README.md +15 -15
  2. package/out/dependency-commands.d.ts +1 -1
  3. package/out/dependency-commands.js +52 -24
  4. package/out/dependency-commands.js.map +1 -1
  5. package/out/main.d.ts +1 -1
  6. package/out/main.js +1 -1
  7. package/out/main.js.map +1 -1
  8. package/out/services/dependency-analyzer.d.ts +59 -0
  9. package/out/services/dependency-analyzer.js +260 -0
  10. package/out/services/dependency-analyzer.js.map +1 -0
  11. package/out/services/dependency-resolver.d.ts +148 -0
  12. package/out/services/dependency-resolver.js +448 -0
  13. package/out/services/dependency-resolver.js.map +1 -0
  14. package/out/services/git-url-resolver.d.ts +158 -0
  15. package/out/services/git-url-resolver.js +408 -0
  16. package/out/services/git-url-resolver.js.map +1 -0
  17. package/out/services/governance-validator.d.ts +56 -0
  18. package/out/services/governance-validator.js +171 -0
  19. package/out/services/governance-validator.js.map +1 -0
  20. package/out/services/index.d.ts +12 -0
  21. package/out/services/index.js +13 -0
  22. package/out/services/index.js.map +1 -0
  23. package/out/services/semver.d.ts +98 -0
  24. package/out/services/semver.js +195 -0
  25. package/out/services/semver.js.map +1 -0
  26. package/out/services/types.d.ts +58 -0
  27. package/out/services/types.js +8 -0
  28. package/out/services/types.js.map +1 -0
  29. package/package.json +4 -3
  30. package/src/dependency-commands.ts +59 -24
  31. package/src/main.ts +1 -1
  32. package/src/services/dependency-analyzer.ts +329 -0
  33. package/src/services/dependency-resolver.ts +546 -0
  34. package/src/services/git-url-resolver.ts +504 -0
  35. package/src/services/governance-validator.ts +226 -0
  36. package/src/services/index.ts +13 -0
  37. package/src/services/semver.ts +213 -0
  38. package/src/services/types.ts +81 -0
@@ -0,0 +1,408 @@
1
+ /**
2
+ * Git Repository Resolver Service (CLI-only)
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
+ * This module contains network operations (git clone, git ls-remote) and
13
+ * should ONLY be used in CLI contexts, never in the LSP.
14
+ */
15
+ import path from 'node:path';
16
+ import fs from 'node:fs/promises';
17
+ import { exec } from 'node:child_process';
18
+ import { promisify } from 'node:util';
19
+ import YAML from 'yaml';
20
+ const execAsync = promisify(exec);
21
+ /**
22
+ * Parses import URLs into structured git import information.
23
+ *
24
+ * Supported formats:
25
+ * - owner/repo@version (GitHub assumed)
26
+ * - owner/repo (GitHub, defaults to main)
27
+ * - https://github.com/owner/repo@version
28
+ * - https://gitlab.com/owner/repo@version
29
+ * - https://git.example.com/owner/repo@version
30
+ */
31
+ export class GitUrlParser {
32
+ /**
33
+ * Determines if an import string is a git repository import.
34
+ */
35
+ static isGitUrl(importStr) {
36
+ // GitHub shorthand: owner/repo or owner/repo@version
37
+ if (/^[a-zA-Z0-9-]+\/[a-zA-Z0-9-_.]+(@[^/]+)?$/.test(importStr)) {
38
+ return true;
39
+ }
40
+ // Full URLs
41
+ return (importStr.startsWith('https://github.com/') ||
42
+ importStr.startsWith('https://gitlab.com/') ||
43
+ importStr.startsWith('https://bitbucket.org/') ||
44
+ importStr.startsWith('https://git.') ||
45
+ importStr.startsWith('git://'));
46
+ }
47
+ /**
48
+ * Parses a git import URL into structured components.
49
+ *
50
+ * @param importStr - The import URL string
51
+ * @returns Parsed git import information
52
+ * @throws Error if URL format is invalid
53
+ */
54
+ static parse(importStr) {
55
+ // Handle GitHub shorthand (owner/repo or owner/repo@version)
56
+ if (this.isGitHubShorthand(importStr)) {
57
+ return this.parseGitHubShorthand(importStr);
58
+ }
59
+ // Handle full URLs
60
+ if (importStr.startsWith('https://') || importStr.startsWith('git://')) {
61
+ return this.parseFullUrl(importStr);
62
+ }
63
+ throw new Error(`Invalid git import URL: '${importStr}'.\n` +
64
+ `Hint: Use 'owner/repo' or 'owner/repo@version' format (e.g., 'domainlang/core@v1.0.0').`);
65
+ }
66
+ /**
67
+ * Checks if string is GitHub shorthand format.
68
+ */
69
+ static isGitHubShorthand(importStr) {
70
+ return /^[a-zA-Z0-9-]+\/[a-zA-Z0-9-_.]+(@[^/]+)?$/.test(importStr);
71
+ }
72
+ /**
73
+ * Parses GitHub shorthand (owner/repo or owner/repo@version).
74
+ */
75
+ static parseGitHubShorthand(importStr) {
76
+ const match = importStr.match(/^([a-zA-Z0-9-]+)\/([a-zA-Z0-9-_.]+)(?:@([^/]+))?$/);
77
+ if (!match) {
78
+ throw new Error(`Invalid GitHub shorthand format: '${importStr}'.\n` +
79
+ `Hint: Use 'owner/repo' or 'owner/repo@version' format.`);
80
+ }
81
+ const [, owner, repo, version] = match;
82
+ const resolvedVersion = version || 'main';
83
+ return {
84
+ original: importStr,
85
+ platform: 'github',
86
+ owner,
87
+ repo,
88
+ version: resolvedVersion,
89
+ repoUrl: `https://github.com/${owner}/${repo}`,
90
+ entryPoint: 'index.dlang', // Default, will be resolved from model.yaml
91
+ };
92
+ }
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
+ static parseFullUrl(importStr) {
102
+ // GitHub
103
+ const ghMatch = importStr.match(/^https:\/\/github\.com\/([^/]+)\/([^/@]+)(?:@([^/]+))?$/);
104
+ if (ghMatch) {
105
+ const [, owner, repo, version] = ghMatch;
106
+ return {
107
+ original: importStr,
108
+ platform: 'github',
109
+ owner,
110
+ repo,
111
+ version: version || 'main',
112
+ repoUrl: `https://github.com/${owner}/${repo}`,
113
+ entryPoint: 'index.dlang',
114
+ };
115
+ }
116
+ // GitLab
117
+ const glMatch = importStr.match(/^https:\/\/gitlab\.com\/([^/]+)\/([^/@]+)(?:@([^/]+))?$/);
118
+ if (glMatch) {
119
+ const [, owner, repo, version] = glMatch;
120
+ return {
121
+ original: importStr,
122
+ platform: 'gitlab',
123
+ owner,
124
+ repo,
125
+ version: version || 'main',
126
+ repoUrl: `https://gitlab.com/${owner}/${repo}`,
127
+ entryPoint: 'index.dlang',
128
+ };
129
+ }
130
+ // Bitbucket
131
+ const bbMatch = importStr.match(/^https:\/\/bitbucket\.org\/([^/]+)\/([^/@]+)(?:@([^/]+))?$/);
132
+ if (bbMatch) {
133
+ const [, owner, repo, version] = bbMatch;
134
+ return {
135
+ original: importStr,
136
+ platform: 'bitbucket',
137
+ owner,
138
+ repo,
139
+ version: version || 'main',
140
+ repoUrl: `https://bitbucket.org/${owner}/${repo}`,
141
+ entryPoint: 'index.dlang',
142
+ };
143
+ }
144
+ // Generic git URL
145
+ const genericMatch = importStr.match(/^(?:https|git):\/\/([^/]+)\/([^/]+)\/([^/@]+)(?:@([^/]+))?$/);
146
+ if (genericMatch) {
147
+ const [, host, owner, repo, version] = genericMatch;
148
+ return {
149
+ original: importStr,
150
+ platform: 'generic',
151
+ owner,
152
+ repo,
153
+ version: version || 'main',
154
+ repoUrl: `https://${host}/${owner}/${repo}`,
155
+ entryPoint: 'index.dlang',
156
+ };
157
+ }
158
+ throw new Error(`Unsupported git URL format: '${importStr}'.\n` +
159
+ `Supported formats:\n` +
160
+ ` • owner/repo (GitHub shorthand)\n` +
161
+ ` • owner/repo@version\n` +
162
+ ` • https://github.com/owner/repo\n` +
163
+ ` • https://gitlab.com/owner/repo`);
164
+ }
165
+ }
166
+ /**
167
+ * Resolves git repository imports to local entry point files.
168
+ *
169
+ * Implements a content-addressable cache:
170
+ * - Cache location: .dlang/packages/ (project-local, per PRS-010)
171
+ * - Cache key: {owner}/{repo}/{commit-hash}
172
+ * - Downloads entire repository on first use
173
+ * - Reads model.yaml to find entry point
174
+ * - Returns path to entry point file
175
+ */
176
+ export class GitUrlResolver {
177
+ /**
178
+ * Creates a GitUrlResolver with a project-local cache directory.
179
+ *
180
+ * @param cacheDir - The cache directory path. Per PRS-010, this should be
181
+ * the project's `.dlang/packages/` directory for isolation
182
+ * and reproducibility (like node_modules).
183
+ */
184
+ constructor(cacheDir) {
185
+ this.cacheDir = cacheDir;
186
+ }
187
+ /**
188
+ * Sets the lock file for dependency resolution.
189
+ *
190
+ * When a lock file is set, all package imports will use
191
+ * the locked commit hashes instead of resolving versions.
192
+ * This ensures reproducible builds and handles transitive dependencies.
193
+ *
194
+ * @param lockFile - The parsed lock file from the workspace root
195
+ */
196
+ setLockFile(lockFile) {
197
+ this.lockFile = lockFile;
198
+ }
199
+ /**
200
+ * Resolves a git import URL to the package's entry point file path.
201
+ *
202
+ * Process:
203
+ * 1. Parse git URL
204
+ * 2. Check lock file for pinned version (transitive dependency support)
205
+ * 3. Resolve version to commit hash (if not locked)
206
+ * 4. Check cache
207
+ * 5. Download repository if not cached
208
+ * 6. Read model.yaml to find entry point
209
+ * 7. Return path to entry point file
210
+ *
211
+ * @param importUrl - The git import URL
212
+ * @returns Path to the package's entry point file
213
+ */
214
+ async resolve(importUrl) {
215
+ const gitInfo = GitUrlParser.parse(importUrl);
216
+ // Check lock file for pinned version (handles transitive dependencies)
217
+ let commitHash;
218
+ const packageKey = `${gitInfo.owner}/${gitInfo.repo}`;
219
+ if (this.lockFile?.dependencies[packageKey]) {
220
+ // Use locked commit hash (reproducible build)
221
+ commitHash = this.lockFile.dependencies[packageKey].commit;
222
+ }
223
+ else {
224
+ // No lock file entry - resolve version via network
225
+ commitHash = await this.resolveCommit(gitInfo);
226
+ }
227
+ // Check cache
228
+ const cachedPath = this.getCachePath(gitInfo, commitHash);
229
+ if (!(await this.existsInCache(cachedPath))) {
230
+ // Download repository
231
+ await this.downloadRepo(gitInfo, commitHash, cachedPath);
232
+ }
233
+ // Read package metadata to get entry point
234
+ const entryPoint = await this.getEntryPoint(cachedPath);
235
+ const entryFile = path.join(cachedPath, entryPoint);
236
+ // Verify entry point exists
237
+ if (!(await this.existsInCache(entryFile))) {
238
+ throw new Error(`Entry point '${entryPoint}' not found in package '${gitInfo.owner}/${gitInfo.repo}@${gitInfo.version}'.\n` +
239
+ `Hint: Ensure the package has an entry point file (default: index.dlang).`);
240
+ }
241
+ return entryFile;
242
+ }
243
+ /**
244
+ * Reads model.yaml to get the package entry point.
245
+ * Falls back to index.dlang if no model.yaml found.
246
+ */
247
+ async getEntryPoint(repoPath) {
248
+ const yamlPath = path.join(repoPath, 'model.yaml');
249
+ try {
250
+ const yamlContent = await fs.readFile(yamlPath, 'utf-8');
251
+ const metadata = this.parseYaml(yamlContent);
252
+ return metadata.entry ?? 'index.dlang';
253
+ }
254
+ catch {
255
+ // No model.yaml or parse error, use default
256
+ return 'index.dlang';
257
+ }
258
+ }
259
+ /**
260
+ * Parses model.yaml content to extract entry point.
261
+ *
262
+ * Expected structure:
263
+ * model:
264
+ * entry: index.dlang
265
+ */
266
+ parseYaml(content) {
267
+ const parsed = YAML.parse(content);
268
+ return {
269
+ entry: parsed.model?.entry,
270
+ name: parsed.model?.name,
271
+ version: parsed.model?.version,
272
+ };
273
+ }
274
+ /**
275
+ * Resolves a version (tag/branch) to a commit hash using git ls-remote.
276
+ */
277
+ async resolveCommit(gitInfo) {
278
+ try {
279
+ // Try to resolve as tag or branch
280
+ const { stdout } = await execAsync(`git ls-remote ${gitInfo.repoUrl} ${gitInfo.version}`);
281
+ if (stdout.trim()) {
282
+ const commitHash = stdout.split('\t')[0];
283
+ return commitHash;
284
+ }
285
+ // If not found, assume it's already a commit hash
286
+ if (/^[0-9a-f]{7,40}$/i.test(gitInfo.version)) {
287
+ return gitInfo.version;
288
+ }
289
+ throw new Error(`Could not resolve version '${gitInfo.version}' for ${gitInfo.repoUrl}.\n` +
290
+ `Hint: Check that the version (tag, branch, or commit) exists in the repository.`);
291
+ }
292
+ catch (error) {
293
+ throw new Error(`Failed to resolve git version '${gitInfo.version}' for ${gitInfo.repoUrl}.\n` +
294
+ `Error: ${error}\n` +
295
+ `Hint: Verify the repository URL is correct and accessible.`);
296
+ }
297
+ }
298
+ /**
299
+ * Gets the local cache path for a git repository.
300
+ *
301
+ * Format: .dlang/packages/{owner}/{repo}/{version}/
302
+ *
303
+ * Per PRS-010: Project-local cache structure mirrors the Design Considerations
304
+ * section showing `.dlang/packages/{owner}/{repo}/{version}/` layout.
305
+ */
306
+ getCachePath(gitInfo, commitHash) {
307
+ return path.join(this.cacheDir, gitInfo.owner, gitInfo.repo, commitHash);
308
+ }
309
+ /**
310
+ * Checks if a file or directory exists in the cache.
311
+ */
312
+ async existsInCache(filePath) {
313
+ try {
314
+ await fs.access(filePath);
315
+ return true;
316
+ }
317
+ catch {
318
+ return false;
319
+ }
320
+ }
321
+ /**
322
+ * Downloads a git repository to the cache.
323
+ *
324
+ * Uses shallow clone for efficiency (only downloads the specific commit).
325
+ */
326
+ async downloadRepo(gitInfo, commitHash, cachePath) {
327
+ const targetDir = path.resolve(cachePath);
328
+ const parentDir = path.dirname(targetDir);
329
+ await fs.mkdir(parentDir, { recursive: true });
330
+ try {
331
+ await execAsync(`git clone ${gitInfo.repoUrl}.git "${targetDir}" --no-checkout`);
332
+ await execAsync(`git -C "${targetDir}" fetch --depth 1 origin ${commitHash}`);
333
+ await execAsync(`git -C "${targetDir}" checkout --force --detach ${commitHash}`);
334
+ await fs.rm(path.join(targetDir, '.git'), { recursive: true, force: true });
335
+ }
336
+ catch (error) {
337
+ await fs.rm(targetDir, { recursive: true, force: true });
338
+ const message = error instanceof Error ? error.message : String(error);
339
+ throw new Error(`Failed to download package '${gitInfo.owner}/${gitInfo.repo}@${gitInfo.version}'.\n` +
340
+ `Error: ${message}\n` +
341
+ `Hint: Check your network connection and verify the repository URL is correct.`);
342
+ }
343
+ }
344
+ /**
345
+ * Clears the entire cache.
346
+ */
347
+ async clearCache() {
348
+ await fs.rm(this.cacheDir, { recursive: true, force: true });
349
+ }
350
+ /**
351
+ * Gets cache statistics (size, number of cached repos, etc.).
352
+ *
353
+ * Cache structure: .dlang/packages/{owner}/{repo}/{version}/
354
+ */
355
+ async getCacheStats() {
356
+ let totalSize = 0;
357
+ let repoCount = 0;
358
+ try {
359
+ const owners = await fs.readdir(this.cacheDir);
360
+ for (const owner of owners) {
361
+ const ownerPath = path.join(this.cacheDir, owner);
362
+ const ownerStat = await fs.stat(ownerPath);
363
+ if (!ownerStat.isDirectory())
364
+ continue;
365
+ const repos = await fs.readdir(ownerPath);
366
+ for (const repo of repos) {
367
+ const repoPath = path.join(ownerPath, repo);
368
+ const repoStat = await fs.stat(repoPath);
369
+ if (!repoStat.isDirectory())
370
+ continue;
371
+ const versions = await fs.readdir(repoPath);
372
+ repoCount += versions.length;
373
+ for (const version of versions) {
374
+ const versionPath = path.join(repoPath, version);
375
+ totalSize += await this.getDirectorySize(versionPath);
376
+ }
377
+ }
378
+ }
379
+ }
380
+ catch {
381
+ // Cache directory doesn't exist yet
382
+ }
383
+ return {
384
+ totalSize,
385
+ repoCount,
386
+ cacheDir: this.cacheDir,
387
+ };
388
+ }
389
+ /**
390
+ * Gets the total size of a directory in bytes.
391
+ */
392
+ async getDirectorySize(dirPath) {
393
+ let size = 0;
394
+ const entries = await fs.readdir(dirPath, { withFileTypes: true });
395
+ for (const entry of entries) {
396
+ const entryPath = path.join(dirPath, entry.name);
397
+ if (entry.isDirectory()) {
398
+ size += await this.getDirectorySize(entryPath);
399
+ }
400
+ else {
401
+ const stats = await fs.stat(entryPath);
402
+ size += stats.size;
403
+ }
404
+ }
405
+ return size;
406
+ }
407
+ }
408
+ //# 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;;;;;;;;;;;;;GAaG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,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AAC,gBAAgB,CAAC,OAAe;QAC1C,IAAI,IAAI,GAAG,CAAC,CAAC;QACb,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;QAEnE,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;YAC1B,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;YACjD,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;gBACtB,IAAI,IAAI,MAAM,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;YACnD,CAAC;iBAAM,CAAC;gBACJ,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;gBACvC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC;YACvB,CAAC;QACL,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Governance and Compliance Validation Service (CLI-only)
3
+ *
4
+ * Enforces organizational policies and best practices:
5
+ * - Allowed/blocked dependency sources
6
+ * - Version policy enforcement (no pre-release in production)
7
+ * - Team ownership validation
8
+ * - License compliance
9
+ * - Audit trail generation
10
+ *
11
+ * Governance policies are defined in the `governance` section of model.yaml:
12
+ *
13
+ * ```yaml
14
+ * governance:
15
+ * allowedSources:
16
+ * - github.com/acme
17
+ * requireStableVersions: true
18
+ * requireTeamOwnership: true
19
+ * ```
20
+ */
21
+ import type { LockFile, GovernancePolicy, GovernanceMetadata, GovernanceViolation } from './types.js';
22
+ /**
23
+ * Validates dependencies against organizational governance policies.
24
+ */
25
+ export declare class GovernanceValidator {
26
+ private readonly policy;
27
+ constructor(policy: GovernancePolicy);
28
+ /**
29
+ * Validates a lock file against governance policies.
30
+ */
31
+ validate(lockFile: LockFile, workspaceRoot: string): Promise<GovernanceViolation[]>;
32
+ /**
33
+ * Checks if package source is allowed by policy.
34
+ */
35
+ private validateAllowedSources;
36
+ /**
37
+ * Checks if package is explicitly blocked by policy.
38
+ */
39
+ private validateBlockedPackages;
40
+ /**
41
+ * Checks if package version meets stability requirements.
42
+ */
43
+ private validateVersionStability;
44
+ /**
45
+ * Loads governance metadata from model.yaml.
46
+ */
47
+ loadGovernanceMetadata(workspaceRoot: string): Promise<GovernanceMetadata>;
48
+ /**
49
+ * Generates an audit report for compliance tracking.
50
+ */
51
+ generateAuditReport(lockFile: LockFile, workspaceRoot: string): Promise<string>;
52
+ }
53
+ /**
54
+ * Loads governance policy from model.yaml governance section.
55
+ */
56
+ export declare function loadGovernancePolicy(workspaceRoot: string): Promise<GovernancePolicy>;
@@ -0,0 +1,171 @@
1
+ /**
2
+ * Governance and Compliance Validation Service (CLI-only)
3
+ *
4
+ * Enforces organizational policies and best practices:
5
+ * - Allowed/blocked dependency sources
6
+ * - Version policy enforcement (no pre-release in production)
7
+ * - Team ownership validation
8
+ * - License compliance
9
+ * - Audit trail generation
10
+ *
11
+ * Governance policies are defined in the `governance` section of model.yaml:
12
+ *
13
+ * ```yaml
14
+ * governance:
15
+ * allowedSources:
16
+ * - github.com/acme
17
+ * requireStableVersions: true
18
+ * requireTeamOwnership: true
19
+ * ```
20
+ */
21
+ import path from 'node:path';
22
+ import fs from 'node:fs/promises';
23
+ import YAML from 'yaml';
24
+ import { isPreRelease } from './semver.js';
25
+ /**
26
+ * Validates dependencies against organizational governance policies.
27
+ */
28
+ export class GovernanceValidator {
29
+ constructor(policy) {
30
+ this.policy = policy;
31
+ }
32
+ /**
33
+ * Validates a lock file against governance policies.
34
+ */
35
+ async validate(lockFile, workspaceRoot) {
36
+ const violations = [];
37
+ // Validate each dependency
38
+ for (const [packageKey, locked] of Object.entries(lockFile.dependencies)) {
39
+ violations.push(...this.validateAllowedSources(packageKey, locked), ...this.validateBlockedPackages(packageKey), ...this.validateVersionStability(packageKey, locked));
40
+ }
41
+ // Validate workspace metadata
42
+ if (this.policy.requireTeamOwnership) {
43
+ const metadata = await this.loadGovernanceMetadata(workspaceRoot);
44
+ if (!metadata.team || !metadata.contact) {
45
+ violations.push({
46
+ type: 'missing-metadata',
47
+ packageKey: 'workspace',
48
+ message: 'Missing required team ownership metadata in model.yaml',
49
+ severity: 'warning',
50
+ });
51
+ }
52
+ }
53
+ return violations;
54
+ }
55
+ /**
56
+ * Checks if package source is allowed by policy.
57
+ */
58
+ validateAllowedSources(packageKey, locked) {
59
+ if (!this.policy.allowedSources || this.policy.allowedSources.length === 0) {
60
+ return [];
61
+ }
62
+ const isAllowed = this.policy.allowedSources.some(pattern => locked.resolved.includes(pattern) || packageKey.startsWith(pattern));
63
+ if (!isAllowed) {
64
+ return [{
65
+ type: 'blocked-source',
66
+ packageKey,
67
+ message: `Package from unauthorized source: ${locked.resolved}`,
68
+ severity: 'error',
69
+ }];
70
+ }
71
+ return [];
72
+ }
73
+ /**
74
+ * Checks if package is explicitly blocked by policy.
75
+ */
76
+ validateBlockedPackages(packageKey) {
77
+ if (!this.policy.blockedPackages) {
78
+ return [];
79
+ }
80
+ const isBlocked = this.policy.blockedPackages.some(pattern => packageKey.includes(pattern));
81
+ if (isBlocked) {
82
+ return [{
83
+ type: 'blocked-source',
84
+ packageKey,
85
+ message: `Package is blocked by governance policy`,
86
+ severity: 'error',
87
+ }];
88
+ }
89
+ return [];
90
+ }
91
+ /**
92
+ * Checks if package version meets stability requirements.
93
+ */
94
+ validateVersionStability(packageKey, locked) {
95
+ if (!this.policy.requireStableVersions) {
96
+ return [];
97
+ }
98
+ if (isPreRelease(locked.ref)) {
99
+ return [{
100
+ type: 'unstable-version',
101
+ packageKey,
102
+ message: `Pre-release ref not allowed: ${locked.ref}`,
103
+ severity: 'error',
104
+ }];
105
+ }
106
+ return [];
107
+ }
108
+ /**
109
+ * Loads governance metadata from model.yaml.
110
+ */
111
+ async loadGovernanceMetadata(workspaceRoot) {
112
+ const manifestPath = path.join(workspaceRoot, 'model.yaml');
113
+ try {
114
+ const content = await fs.readFile(manifestPath, 'utf-8');
115
+ const manifest = YAML.parse(content);
116
+ return manifest.metadata ?? {};
117
+ }
118
+ catch {
119
+ return {};
120
+ }
121
+ }
122
+ /**
123
+ * Generates an audit report for compliance tracking.
124
+ */
125
+ async generateAuditReport(lockFile, workspaceRoot) {
126
+ const metadata = await this.loadGovernanceMetadata(workspaceRoot);
127
+ const violations = await this.validate(lockFile, workspaceRoot);
128
+ // Build header section
129
+ const headerLines = [
130
+ '=== Dependency Audit Report ===',
131
+ '',
132
+ `Workspace: ${workspaceRoot}`,
133
+ `Team: ${metadata.team ?? 'N/A'}`,
134
+ `Contact: ${metadata.contact ?? 'N/A'}`,
135
+ `Domain: ${metadata.domain ?? 'N/A'}`,
136
+ '',
137
+ 'Dependencies:',
138
+ ];
139
+ // Build dependencies section
140
+ const depLines = [];
141
+ for (const [packageKey, locked] of Object.entries(lockFile.dependencies)) {
142
+ depLines.push(` - ${packageKey}@${locked.ref}`, ` Source: ${locked.resolved}`, ` Commit: ${locked.commit}`);
143
+ }
144
+ // Build violations section
145
+ const violationLines = violations.length > 0
146
+ ? [
147
+ '',
148
+ 'Violations:',
149
+ ...violations.map(v => ` [${v.severity.toUpperCase()}] ${v.packageKey}: ${v.message}`)
150
+ ]
151
+ : ['', '\u2713 No policy violations detected'];
152
+ return [...headerLines, ...depLines, ...violationLines].join('\n');
153
+ }
154
+ }
155
+ /**
156
+ * Loads governance policy from model.yaml governance section.
157
+ */
158
+ export async function loadGovernancePolicy(workspaceRoot) {
159
+ const manifestPath = path.join(workspaceRoot, 'model.yaml');
160
+ try {
161
+ const content = await fs.readFile(manifestPath, 'utf-8');
162
+ const manifest = YAML.parse(content);
163
+ // Return governance section or empty policy if not defined
164
+ return manifest.governance ?? {};
165
+ }
166
+ catch {
167
+ // No manifest or parse error = permissive defaults
168
+ return {};
169
+ }
170
+ }
171
+ //# sourceMappingURL=governance-validator.js.map
@@ -0,0 +1 @@
1
+ {"version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;IAAC,MAAM,CAAC;QACL,mDAAmD;QACnD,OAAO,EAAE,CAAC;IACd,CAAC;AACL,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * CLI Services Index
3
+ *
4
+ * Exports all CLI-only services for package management.
5
+ * These services contain network operations and should never be used in LSP.
6
+ */
7
+ export * from './types.js';
8
+ export * from './semver.js';
9
+ export * from './git-url-resolver.js';
10
+ export * from './dependency-resolver.js';
11
+ export * from './dependency-analyzer.js';
12
+ export * from './governance-validator.js';