@domainlang/language 0.1.20 → 0.1.82

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 (110) hide show
  1. package/out/domain-lang-module.d.ts +0 -2
  2. package/out/domain-lang-module.js +3 -11
  3. package/out/domain-lang-module.js.map +1 -1
  4. package/out/generated/ast.d.ts +19 -8
  5. package/out/generated/ast.js +10 -1
  6. package/out/generated/ast.js.map +1 -1
  7. package/out/generated/grammar.d.ts +1 -1
  8. package/out/generated/grammar.js +123 -28
  9. package/out/generated/grammar.js.map +1 -1
  10. package/out/generated/module.d.ts +1 -1
  11. package/out/generated/module.js +1 -1
  12. package/out/index.d.ts +0 -3
  13. package/out/index.js +0 -5
  14. package/out/index.js.map +1 -1
  15. package/out/lsp/hover/domain-lang-hover.js +4 -0
  16. package/out/lsp/hover/domain-lang-hover.js.map +1 -1
  17. package/out/sdk/index.d.ts +1 -1
  18. package/out/sdk/loader-node.d.ts +3 -7
  19. package/out/sdk/loader-node.js +9 -24
  20. package/out/sdk/loader-node.js.map +1 -1
  21. package/out/sdk/types.d.ts +21 -0
  22. package/out/services/dependency-analyzer.d.ts +39 -3
  23. package/out/services/dependency-analyzer.js +47 -22
  24. package/out/services/dependency-analyzer.js.map +1 -1
  25. package/out/services/dependency-resolver.d.ts +45 -68
  26. package/out/services/dependency-resolver.js +43 -243
  27. package/out/services/dependency-resolver.js.map +1 -1
  28. package/out/services/git-url-resolver.browser.d.ts +12 -4
  29. package/out/services/git-url-resolver.browser.js +1 -5
  30. package/out/services/git-url-resolver.browser.js.map +1 -1
  31. package/out/services/git-url-resolver.d.ts +56 -22
  32. package/out/services/git-url-resolver.js +36 -70
  33. package/out/services/git-url-resolver.js.map +1 -1
  34. package/out/services/governance-validator.d.ts +37 -1
  35. package/out/services/governance-validator.js +10 -4
  36. package/out/services/governance-validator.js.map +1 -1
  37. package/out/services/import-resolver.d.ts +6 -65
  38. package/out/services/import-resolver.js +5 -223
  39. package/out/services/import-resolver.js.map +1 -1
  40. package/out/services/performance-optimizer.d.ts +1 -1
  41. package/out/services/workspace-manager.d.ts +10 -57
  42. package/out/services/workspace-manager.js +21 -187
  43. package/out/services/workspace-manager.js.map +1 -1
  44. package/out/syntaxes/domain-lang.monarch.js +1 -1
  45. package/out/syntaxes/domain-lang.monarch.js.map +1 -1
  46. package/out/utils/import-utils.d.ts +12 -4
  47. package/out/utils/import-utils.js +135 -35
  48. package/out/utils/import-utils.js.map +1 -1
  49. package/out/validation/constants.d.ts +0 -103
  50. package/out/validation/constants.js +1 -140
  51. package/out/validation/constants.js.map +1 -1
  52. package/out/validation/domain.js +1 -46
  53. package/out/validation/domain.js.map +1 -1
  54. package/out/validation/import.d.ts +22 -46
  55. package/out/validation/import.js +85 -187
  56. package/out/validation/import.js.map +1 -1
  57. package/out/validation/maps.js +6 -10
  58. package/out/validation/maps.js.map +1 -1
  59. package/out/validation/metadata.js +1 -5
  60. package/out/validation/metadata.js.map +1 -1
  61. package/package.json +6 -8
  62. package/src/domain-lang-module.ts +6 -18
  63. package/src/domain-lang.langium +12 -7
  64. package/src/generated/ast.ts +20 -7
  65. package/src/generated/grammar.ts +123 -28
  66. package/src/generated/module.ts +1 -1
  67. package/src/index.ts +0 -7
  68. package/src/lsp/hover/domain-lang-hover.ts +2 -0
  69. package/src/sdk/index.ts +2 -0
  70. package/src/sdk/loader-node.ts +9 -29
  71. package/src/sdk/types.ts +23 -0
  72. package/src/services/dependency-analyzer.ts +84 -24
  73. package/src/services/dependency-resolver.ts +84 -301
  74. package/src/services/git-url-resolver.browser.ts +14 -9
  75. package/src/services/git-url-resolver.ts +93 -86
  76. package/src/services/governance-validator.ts +47 -5
  77. package/src/services/import-resolver.ts +8 -270
  78. package/src/services/performance-optimizer.ts +1 -1
  79. package/src/services/workspace-manager.ts +46 -237
  80. package/src/syntaxes/domain-lang.monarch.ts +1 -1
  81. package/src/utils/import-utils.ts +160 -38
  82. package/src/validation/constants.ts +1 -181
  83. package/src/validation/domain.ts +1 -54
  84. package/src/validation/import.ts +104 -228
  85. package/src/validation/maps.ts +6 -10
  86. package/src/validation/metadata.ts +1 -5
  87. package/out/lsp/domain-lang-code-actions.d.ts +0 -55
  88. package/out/lsp/domain-lang-code-actions.js +0 -143
  89. package/out/lsp/domain-lang-code-actions.js.map +0 -1
  90. package/out/lsp/domain-lang-workspace-manager.d.ts +0 -21
  91. package/out/lsp/domain-lang-workspace-manager.js +0 -93
  92. package/out/lsp/domain-lang-workspace-manager.js.map +0 -1
  93. package/out/lsp/manifest-diagnostics.d.ts +0 -82
  94. package/out/lsp/manifest-diagnostics.js +0 -230
  95. package/out/lsp/manifest-diagnostics.js.map +0 -1
  96. package/out/services/semver.d.ts +0 -98
  97. package/out/services/semver.js +0 -195
  98. package/out/services/semver.js.map +0 -1
  99. package/out/services/types.d.ts +0 -340
  100. package/out/services/types.js +0 -46
  101. package/out/services/types.js.map +0 -1
  102. package/out/validation/manifest.d.ts +0 -144
  103. package/out/validation/manifest.js +0 -327
  104. package/out/validation/manifest.js.map +0 -1
  105. package/src/lsp/domain-lang-code-actions.ts +0 -189
  106. package/src/lsp/domain-lang-workspace-manager.ts +0 -104
  107. package/src/lsp/manifest-diagnostics.ts +0 -290
  108. package/src/services/semver.ts +0 -213
  109. package/src/services/types.ts +0 -415
  110. package/src/validation/manifest.ts +0 -439
@@ -1,195 +0,0 @@
1
- /**
2
- * Semantic Versioning Utilities
3
- *
4
- * Centralized SemVer parsing, comparison, and validation for the dependency system.
5
- * All version-related logic should use these utilities to ensure consistency.
6
- *
7
- * Supported formats:
8
- * - "1.0.0" or "v1.0.0" (tags)
9
- * - "1.0.0-alpha.1" (pre-release)
10
- * - "main", "develop" (branches)
11
- * - "abc123def" (commit SHAs, 7-40 hex chars)
12
- */
13
- // ============================================================================
14
- // Parsing
15
- // ============================================================================
16
- /**
17
- * Parses a version string into SemVer components.
18
- * Returns undefined if not a valid SemVer.
19
- *
20
- * @example
21
- * parseSemVer("v1.2.3") // { major: 1, minor: 2, patch: 3, original: "v1.2.3" }
22
- * parseSemVer("1.0.0-alpha") // { major: 1, minor: 0, patch: 0, prerelease: "alpha", ... }
23
- * parseSemVer("main") // undefined (not SemVer)
24
- */
25
- export function parseSemVer(version) {
26
- // Strip leading 'v' if present
27
- const normalized = version.startsWith('v') ? version.slice(1) : version;
28
- // Match semver pattern: major.minor.patch[-prerelease]
29
- const match = normalized.match(/^(\d+)\.(\d+)\.(\d+)(?:-(.+))?$/);
30
- if (!match)
31
- return undefined;
32
- return {
33
- major: parseInt(match[1], 10),
34
- minor: parseInt(match[2], 10),
35
- patch: parseInt(match[3], 10),
36
- preRelease: match[4],
37
- original: version,
38
- };
39
- }
40
- /**
41
- * Detects the type of a git ref based on its format.
42
- *
43
- * @example
44
- * detectRefType("v1.0.0") // 'tag'
45
- * detectRefType("1.2.3") // 'tag'
46
- * detectRefType("main") // 'branch'
47
- * detectRefType("abc123def") // 'commit'
48
- */
49
- export function detectRefType(ref) {
50
- // Commit SHA: 7-40 hex characters
51
- if (/^[0-9a-f]{7,40}$/i.test(ref)) {
52
- return 'commit';
53
- }
54
- // Tags typically start with 'v' followed by semver
55
- if (/^v?\d+\.\d+\.\d+/.test(ref)) {
56
- return 'tag';
57
- }
58
- // Everything else is treated as a branch
59
- return 'branch';
60
- }
61
- /**
62
- * Parses a ref string into a structured ParsedRef with type and optional SemVer.
63
- */
64
- export function parseRef(ref) {
65
- const type = detectRefType(ref);
66
- const semver = type === 'tag' ? parseSemVer(ref) : undefined;
67
- return { original: ref, type, semver };
68
- }
69
- // ============================================================================
70
- // Comparison
71
- // ============================================================================
72
- /**
73
- * Compares two SemVer versions.
74
- * Returns: negative if a < b, positive if a > b, zero if equal.
75
- *
76
- * @example
77
- * compareSemVer(parse("1.0.0"), parse("2.0.0")) // negative (a < b)
78
- * compareSemVer(parse("1.5.0"), parse("1.2.0")) // positive (a > b)
79
- * compareSemVer(parse("1.0.0-alpha"), parse("1.0.0")) // negative (prerelease < release)
80
- */
81
- export function compareSemVer(a, b) {
82
- if (a.major !== b.major)
83
- return a.major - b.major;
84
- if (a.minor !== b.minor)
85
- return a.minor - b.minor;
86
- if (a.patch !== b.patch)
87
- return a.patch - b.patch;
88
- // Pre-release versions are lower than release versions
89
- if (a.preRelease && !b.preRelease)
90
- return -1;
91
- if (!a.preRelease && b.preRelease)
92
- return 1;
93
- if (a.preRelease && b.preRelease) {
94
- return a.preRelease.localeCompare(b.preRelease);
95
- }
96
- return 0;
97
- }
98
- /**
99
- * Picks the latest from a list of SemVer refs.
100
- * Returns the ref string (with original 'v' prefix if present).
101
- *
102
- * @example
103
- * pickLatestSemVer(["v1.0.0", "v1.5.0", "v1.2.0"]) // "v1.5.0"
104
- */
105
- export function pickLatestSemVer(refs) {
106
- const parsed = refs
107
- .map(ref => ({ ref, semver: parseSemVer(ref) }))
108
- .filter((item) => item.semver !== undefined);
109
- if (parsed.length === 0)
110
- return undefined;
111
- parsed.sort((a, b) => compareSemVer(b.semver, a.semver)); // Descending
112
- return parsed[0].ref;
113
- }
114
- /**
115
- * Sorts version strings in descending order (newest first).
116
- * Non-SemVer refs are sorted lexicographically at the end.
117
- *
118
- * @example
119
- * sortVersionsDescending(["v1.0.0", "v2.0.0", "v1.5.0"]) // ["v2.0.0", "v1.5.0", "v1.0.0"]
120
- */
121
- export function sortVersionsDescending(versions) {
122
- return [...versions].sort((a, b) => {
123
- const semverA = parseSemVer(a);
124
- const semverB = parseSemVer(b);
125
- // Both are SemVer - compare semantically
126
- if (semverA && semverB) {
127
- return compareSemVer(semverB, semverA); // Descending
128
- }
129
- // SemVer comes before non-SemVer
130
- if (semverA && !semverB)
131
- return -1;
132
- if (!semverA && semverB)
133
- return 1;
134
- // Both non-SemVer - lexicographic
135
- return b.localeCompare(a);
136
- });
137
- }
138
- // ============================================================================
139
- // Validation
140
- // ============================================================================
141
- /**
142
- * Checks if a version/ref is a pre-release.
143
- *
144
- * Pre-release identifiers: alpha, beta, rc, pre, dev, snapshot
145
- *
146
- * @example
147
- * isPreRelease("v1.0.0") // false
148
- * isPreRelease("v1.0.0-alpha") // true
149
- * isPreRelease("v1.0.0-rc.1") // true
150
- */
151
- export function isPreRelease(ref) {
152
- const semver = parseSemVer(ref);
153
- if (semver?.preRelease) {
154
- return true;
155
- }
156
- // Also check for common pre-release patterns without proper SemVer
157
- const clean = ref.replace(/^v/, '');
158
- return /-(alpha|beta|rc|pre|dev|snapshot)/i.test(clean);
159
- }
160
- /**
161
- * Checks if two SemVer versions are compatible (same major version).
162
- *
163
- * @example
164
- * areSameMajor(parse("1.0.0"), parse("1.5.0")) // true
165
- * areSameMajor(parse("1.0.0"), parse("2.0.0")) // false
166
- */
167
- export function areSameMajor(a, b) {
168
- return a.major === b.major;
169
- }
170
- /**
171
- * Gets the major version number from a ref string.
172
- * Returns undefined if not a valid SemVer.
173
- */
174
- export function getMajorVersion(ref) {
175
- return parseSemVer(ref)?.major;
176
- }
177
- // ============================================================================
178
- // Filtering
179
- // ============================================================================
180
- /**
181
- * Filters refs to only stable versions (excludes pre-releases).
182
- *
183
- * @example
184
- * filterStableVersions(["v1.0.0", "v1.1.0-alpha", "v1.2.0"]) // ["v1.0.0", "v1.2.0"]
185
- */
186
- export function filterStableVersions(refs) {
187
- return refs.filter(ref => !isPreRelease(ref));
188
- }
189
- /**
190
- * Filters refs to only SemVer tags (excludes branches and commits).
191
- */
192
- export function filterSemVerTags(refs) {
193
- return refs.filter(ref => detectRefType(ref) === 'tag' && parseSemVer(ref) !== undefined);
194
- }
195
- //# sourceMappingURL=semver.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"semver.js","sourceRoot":"","sources":["../../src/services/semver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,+EAA+E;AAC/E,UAAU;AACV,+EAA+E;AAE/E;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe;IACvC,+BAA+B;IAC/B,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,GAA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AAS;IAC7C,OAAO,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK,CAAC;AAC/B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,GAAW;IACvC,OAAO,WAAW,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC;AACnC,CAAC;AAED,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAc;IAC/C,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;AAClD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAc;IAC3C,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,KAAK,IAAI,WAAW,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,CAAC;AAC9F,CAAC"}
@@ -1,340 +0,0 @@
1
- /**
2
- * Centralized Type Definitions for DomainLang Services
3
- *
4
- * Type design principles:
5
- * - **Atomic**: Each type represents a single, well-defined concept
6
- * - **Non-overlapping**: Types don't duplicate fields unnecessarily
7
- * - **Rich**: Types use adjacent types for composition rather than primitives
8
- * - **Discriminated**: Union types use discriminants for type narrowing
9
- *
10
- * Type hierarchy:
11
- * ```
12
- * Core Building Blocks
13
- * ├── RefType (discriminant for git references)
14
- * └── SemVer (semantic version components)
15
- *
16
- * Package Identity
17
- * └── PackageIdentity (name, version, entry)
18
- *
19
- * Dependencies
20
- * ├── DependencySpec (how deps are specified)
21
- * │ ├── ShortDependencySpec (string ref only)
22
- * │ └── ExtendedDependencySpec (full options)
23
- * └── ResolvedDependency (locked/pinned state)
24
- *
25
- * Manifest & Lock
26
- * ├── ModelManifest (model.yaml schema)
27
- * └── LockFile (model.lock schema)
28
- *
29
- * Resolution Graph
30
- * ├── DependencyNode (graph node during resolution)
31
- * └── DependencyGraph (complete resolution graph)
32
- *
33
- * Analysis & Governance
34
- * ├── GovernancePolicy (policy configuration)
35
- * └── GovernanceViolation (validation result)
36
- * ```
37
- *
38
- * @module services/types
39
- */
40
- /**
41
- * Type of git reference for version pinning.
42
- *
43
- * Used as discriminant in ref-related types:
44
- * - **tag**: SemVer version tag (v1.0.0, 2.3.4)
45
- * - **branch**: Branch name (main, develop)
46
- * - **commit**: Full commit SHA (40 hex chars)
47
- */
48
- export type RefType = 'tag' | 'branch' | 'commit';
49
- /**
50
- * Parsed semantic version following SemVer 2.0.0.
51
- *
52
- * @example
53
- * ```typescript
54
- * const v: SemVer = {
55
- * major: 1, minor: 2, patch: 3,
56
- * preRelease: 'beta.1',
57
- * original: 'v1.2.3-beta.1'
58
- * };
59
- * ```
60
- */
61
- export interface SemVer {
62
- readonly major: number;
63
- readonly minor: number;
64
- readonly patch: number;
65
- /** Pre-release identifier (e.g., "alpha", "beta.1", "rc.2") */
66
- readonly preRelease?: string;
67
- /** Build metadata - ignored in version comparison */
68
- readonly buildMetadata?: string;
69
- /** Original string representation */
70
- readonly original: string;
71
- }
72
- /**
73
- * Result of parsing a git ref string.
74
- */
75
- export interface ParsedRef {
76
- readonly type: RefType;
77
- /** Present only for valid SemVer tags */
78
- readonly semver?: SemVer;
79
- readonly original: string;
80
- }
81
- /**
82
- * Core package identity and metadata.
83
- *
84
- * Used in model.yaml `model:` section and internally during resolution.
85
- */
86
- export interface PackageIdentity {
87
- /** Package name in owner/repo format */
88
- readonly name?: string;
89
- /** SemVer version string */
90
- readonly version?: string;
91
- /** Entry point file (default: index.dlang) */
92
- readonly entry?: string;
93
- }
94
- /**
95
- * Extended dependency specification with full options.
96
- *
97
- * Either `source` OR `path` must be provided (mutually exclusive):
98
- * - `source`: Remote git coordinates (owner/repo)
99
- * - `path`: Local filesystem path for monorepo deps
100
- */
101
- export interface ExtendedDependencySpec {
102
- /** Git coordinates (owner/repo) - mutually exclusive with path */
103
- readonly source?: string;
104
- /** Git ref (tag, branch, or commit SHA) */
105
- readonly ref?: string;
106
- /** Local path - mutually exclusive with source */
107
- readonly path?: string;
108
- /** SHA-256 integrity hash for verification */
109
- readonly integrity?: string;
110
- /** Human-readable description */
111
- readonly description?: string;
112
- }
113
- /**
114
- * Dependency specification in model.yaml.
115
- *
116
- * Can be either:
117
- * - **string**: Short form (just the ref, key is owner/repo)
118
- * - **ExtendedDependencySpec**: Full form with options
119
- *
120
- * @example
121
- * ```yaml
122
- * dependencies:
123
- * acme/core: "v1.0.0" # Short form
124
- * acme/utils: # Extended form
125
- * source: acme/utils
126
- * ref: main
127
- * integrity: sha256-abc123
128
- * ```
129
- */
130
- export type DependencySpec = string | ExtendedDependencySpec;
131
- /**
132
- * Type guard for extended dependency spec.
133
- */
134
- export declare function isExtendedDependencySpec(dep: DependencySpec): dep is ExtendedDependencySpec;
135
- /**
136
- * A fully resolved and locked dependency.
137
- *
138
- * Represents a dependency after resolution with all fields pinned
139
- * to exact values for reproducible builds.
140
- */
141
- export interface LockedDependency {
142
- /** Original ref from manifest */
143
- readonly ref: string;
144
- /** Detected ref type */
145
- readonly refType: RefType;
146
- /** Full git URL used for fetching */
147
- readonly resolved: string;
148
- /** Exact commit hash (40-char SHA) */
149
- readonly commit: string;
150
- /** Optional integrity hash */
151
- readonly integrity?: string;
152
- }
153
- /**
154
- * Path aliases for @ imports.
155
- *
156
- * @example
157
- * ```yaml
158
- * paths:
159
- * "@/": "./src/"
160
- * "@shared/": "./libs/shared/"
161
- * ```
162
- */
163
- export type PathAliases = Readonly<Record<string, string>>;
164
- /**
165
- * Governance policy configuration.
166
- */
167
- export interface GovernancePolicy {
168
- /** Allowed git domains (e.g., ['github.com/acme']) */
169
- readonly allowedSources?: readonly string[];
170
- /** Blocked packages or patterns */
171
- readonly blockedPackages?: readonly string[];
172
- /** Require stable versions only (no pre-release) */
173
- readonly requireStableVersions?: boolean;
174
- /** Require team ownership metadata */
175
- readonly requireTeamOwnership?: boolean;
176
- /** Allowed licenses */
177
- readonly allowedLicenses?: readonly string[];
178
- }
179
- /**
180
- * Package manifest (model.yaml) schema.
181
- *
182
- * This is the user-facing YAML file structure.
183
- */
184
- export interface ModelManifest {
185
- /** Package identity and metadata */
186
- readonly model?: PackageIdentity;
187
- /** Path aliases for @ imports */
188
- readonly paths?: PathAliases;
189
- /** Dependencies keyed by alias or owner/repo */
190
- readonly dependencies?: Readonly<Record<string, DependencySpec>>;
191
- /** Ref overrides for conflict resolution */
192
- readonly overrides?: Readonly<Record<string, string>>;
193
- /** Governance policies */
194
- readonly governance?: GovernancePolicy;
195
- }
196
- /**
197
- * Lock file schema (model.lock).
198
- *
199
- * Pins exact commits for reproducible builds.
200
- */
201
- export interface LockFile {
202
- /** Lock file format version */
203
- readonly version: string;
204
- /** All locked dependencies keyed by package name */
205
- readonly dependencies: Readonly<Record<string, LockedDependency>>;
206
- }
207
- /**
208
- * Mutable package metadata during resolution.
209
- *
210
- * Unlike PackageIdentity (readonly user-facing), this is mutable
211
- * because the resolver builds it incrementally during YAML parsing.
212
- */
213
- export interface ResolvingPackage {
214
- name?: string;
215
- version?: string;
216
- entry?: string;
217
- exports?: Record<string, string>;
218
- /** Dependencies as name → ref constraint */
219
- dependencies?: Record<string, string>;
220
- /** Ref overrides */
221
- overrides?: Record<string, string>;
222
- }
223
- /**
224
- * Node in the dependency graph during resolution.
225
- */
226
- export interface DependencyNode {
227
- /** Package identifier (owner/repo) */
228
- readonly packageKey: string;
229
- /** Primary ref constraint from first encounter */
230
- refConstraint: string;
231
- /** All observed constraints from different parents */
232
- constraints?: Set<string>;
233
- /** Resolved ref after conflict resolution */
234
- resolvedRef?: string;
235
- /** Detected ref type */
236
- refType?: RefType;
237
- /** Resolved commit hash */
238
- commitHash?: string;
239
- /** Full git repository URL */
240
- repoUrl?: string;
241
- /** Direct dependencies of this package */
242
- dependencies: Record<string, string>;
243
- /** Parent packages that depend on this one */
244
- dependents: string[];
245
- }
246
- /**
247
- * Complete dependency graph for resolution.
248
- */
249
- export interface DependencyGraph {
250
- /** All discovered packages */
251
- readonly nodes: Record<string, DependencyNode>;
252
- /** Root package name */
253
- readonly root: string;
254
- }
255
- /** Supported git platforms */
256
- export type GitPlatform = 'github' | 'gitlab' | 'bitbucket' | 'generic';
257
- /**
258
- * Parsed git import with repository information.
259
- */
260
- export interface GitImportInfo {
261
- /** Original import string */
262
- readonly original: string;
263
- /** Git platform */
264
- readonly platform: GitPlatform;
265
- /** Repository owner/organization */
266
- readonly owner: string;
267
- /** Repository name */
268
- readonly repo: string;
269
- /** Version (tag, branch, or commit) */
270
- readonly version: string;
271
- /** Full git repository URL */
272
- readonly repoUrl: string;
273
- /** Package entry point */
274
- readonly entryPoint: string;
275
- }
276
- /**
277
- * Node in a dependency tree visualization.
278
- */
279
- export interface DependencyTreeNode {
280
- readonly packageKey: string;
281
- readonly ref: string;
282
- readonly commit: string;
283
- readonly dependencies: readonly DependencyTreeNode[];
284
- /** Depth in tree (0 = root) */
285
- readonly depth: number;
286
- }
287
- /**
288
- * Reverse dependency relationship.
289
- */
290
- export interface ReverseDependency {
291
- /** Package that depends on the target */
292
- readonly dependentPackage: string;
293
- /** Ref of the dependent */
294
- readonly ref: string;
295
- /** Relationship type */
296
- readonly type: 'direct' | 'transitive';
297
- }
298
- /**
299
- * Version update policy.
300
- */
301
- export interface VersionPolicy {
302
- readonly policy: 'latest' | 'stable' | 'pinned';
303
- readonly ref: string;
304
- readonly availableRefs?: readonly string[];
305
- }
306
- /** Governance violation type discriminant */
307
- export type GovernanceViolationType = 'blocked-source' | 'unstable-version' | 'missing-metadata' | 'license-violation';
308
- /** Governance violation severity */
309
- export type GovernanceViolationSeverity = 'error' | 'warning';
310
- /**
311
- * A governance policy violation.
312
- */
313
- export interface GovernanceViolation {
314
- readonly type: GovernanceViolationType;
315
- readonly packageKey: string;
316
- readonly message: string;
317
- readonly severity: GovernanceViolationSeverity;
318
- }
319
- /**
320
- * Governance metadata for a package (from model.yaml).
321
- */
322
- export interface GovernanceMetadata {
323
- readonly team?: string;
324
- readonly contact?: string;
325
- readonly domain?: string;
326
- readonly compliance?: readonly string[];
327
- }
328
- /**
329
- * Options for workspace manager initialization.
330
- */
331
- export interface WorkspaceManagerOptions {
332
- /** Auto-resolve dependencies on initialization */
333
- readonly autoResolve?: boolean;
334
- /** Manifest file names to search for */
335
- readonly manifestFiles?: readonly string[];
336
- /** Lock file names to search for */
337
- readonly lockFiles?: readonly string[];
338
- /** Allow network access for git operations */
339
- readonly allowNetwork?: boolean;
340
- }
@@ -1,46 +0,0 @@
1
- /**
2
- * Centralized Type Definitions for DomainLang Services
3
- *
4
- * Type design principles:
5
- * - **Atomic**: Each type represents a single, well-defined concept
6
- * - **Non-overlapping**: Types don't duplicate fields unnecessarily
7
- * - **Rich**: Types use adjacent types for composition rather than primitives
8
- * - **Discriminated**: Union types use discriminants for type narrowing
9
- *
10
- * Type hierarchy:
11
- * ```
12
- * Core Building Blocks
13
- * ├── RefType (discriminant for git references)
14
- * └── SemVer (semantic version components)
15
- *
16
- * Package Identity
17
- * └── PackageIdentity (name, version, entry)
18
- *
19
- * Dependencies
20
- * ├── DependencySpec (how deps are specified)
21
- * │ ├── ShortDependencySpec (string ref only)
22
- * │ └── ExtendedDependencySpec (full options)
23
- * └── ResolvedDependency (locked/pinned state)
24
- *
25
- * Manifest & Lock
26
- * ├── ModelManifest (model.yaml schema)
27
- * └── LockFile (model.lock schema)
28
- *
29
- * Resolution Graph
30
- * ├── DependencyNode (graph node during resolution)
31
- * └── DependencyGraph (complete resolution graph)
32
- *
33
- * Analysis & Governance
34
- * ├── GovernancePolicy (policy configuration)
35
- * └── GovernanceViolation (validation result)
36
- * ```
37
- *
38
- * @module services/types
39
- */
40
- /**
41
- * Type guard for extended dependency spec.
42
- */
43
- export function isExtendedDependencySpec(dep) {
44
- return typeof dep === 'object' && dep !== null;
45
- }
46
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/services/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AA+GH;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,GAAmB;IACxD,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,CAAC;AACnD,CAAC"}