@agent-teams/engineering-foundation 0.2.1 → 0.3.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.
- package/README.md +6 -2
- package/dist/capabilities/source-dependencies/adapters/outbound/filesystem/filesystem-source-tree-reader.d.ts +6 -0
- package/dist/capabilities/source-dependencies/adapters/outbound/filesystem/filesystem-source-tree-reader.d.ts.map +1 -0
- package/dist/capabilities/source-dependencies/adapters/outbound/filesystem/filesystem-source-tree-reader.js +133 -0
- package/dist/capabilities/source-dependencies/adapters/outbound/filesystem/filesystem-source-tree-reader.js.map +1 -0
- package/dist/capabilities/source-dependencies/adapters/outbound/node/node-source-dependency-resolver.d.ts +6 -0
- package/dist/capabilities/source-dependencies/adapters/outbound/node/node-source-dependency-resolver.d.ts.map +1 -0
- package/dist/capabilities/source-dependencies/adapters/outbound/node/node-source-dependency-resolver.js +151 -0
- package/dist/capabilities/source-dependencies/adapters/outbound/node/node-source-dependency-resolver.js.map +1 -0
- package/dist/capabilities/source-dependencies/adapters/outbound/oxc/oxc-source-dependency-parser.d.ts +6 -0
- package/dist/capabilities/source-dependencies/adapters/outbound/oxc/oxc-source-dependency-parser.d.ts.map +1 -0
- package/dist/capabilities/source-dependencies/adapters/outbound/oxc/oxc-source-dependency-parser.js +96 -0
- package/dist/capabilities/source-dependencies/adapters/outbound/oxc/oxc-source-dependency-parser.js.map +1 -0
- package/dist/capabilities/source-dependencies/application/model/source-workspace.d.ts +69 -0
- package/dist/capabilities/source-dependencies/application/model/source-workspace.d.ts.map +1 -0
- package/dist/capabilities/source-dependencies/application/model/source-workspace.js +13 -0
- package/dist/capabilities/source-dependencies/application/model/source-workspace.js.map +1 -0
- package/dist/capabilities/source-dependencies/application/policies/evaluate-source-dependencies.d.ts +14 -0
- package/dist/capabilities/source-dependencies/application/policies/evaluate-source-dependencies.d.ts.map +1 -0
- package/dist/capabilities/source-dependencies/application/policies/evaluate-source-dependencies.js +223 -0
- package/dist/capabilities/source-dependencies/application/policies/evaluate-source-dependencies.js.map +1 -0
- package/dist/capabilities/source-dependencies/application/ports/source-dependency-parser.d.ts +5 -0
- package/dist/capabilities/source-dependencies/application/ports/source-dependency-parser.d.ts.map +1 -0
- package/dist/capabilities/source-dependencies/application/ports/source-dependency-parser.js +2 -0
- package/dist/capabilities/source-dependencies/application/ports/source-dependency-parser.js.map +1 -0
- package/dist/capabilities/source-dependencies/application/ports/source-dependency-resolver.d.ts +12 -0
- package/dist/capabilities/source-dependencies/application/ports/source-dependency-resolver.d.ts.map +1 -0
- package/dist/capabilities/source-dependencies/application/ports/source-dependency-resolver.js +2 -0
- package/dist/capabilities/source-dependencies/application/ports/source-dependency-resolver.js.map +1 -0
- package/dist/capabilities/source-dependencies/application/ports/source-tree-reader.d.ts +5 -0
- package/dist/capabilities/source-dependencies/application/ports/source-tree-reader.d.ts.map +1 -0
- package/dist/capabilities/source-dependencies/application/ports/source-tree-reader.js +2 -0
- package/dist/capabilities/source-dependencies/application/ports/source-tree-reader.js.map +1 -0
- package/dist/capabilities/source-dependencies/application/rules.d.ts +26 -0
- package/dist/capabilities/source-dependencies/application/rules.d.ts.map +1 -0
- package/dist/capabilities/source-dependencies/application/rules.js +27 -0
- package/dist/capabilities/source-dependencies/application/rules.js.map +1 -0
- package/dist/capabilities/source-dependencies/application/use-cases/analyze-source-dependencies.d.ts +19 -0
- package/dist/capabilities/source-dependencies/application/use-cases/analyze-source-dependencies.d.ts.map +1 -0
- package/dist/capabilities/source-dependencies/application/use-cases/analyze-source-dependencies.js +69 -0
- package/dist/capabilities/source-dependencies/application/use-cases/analyze-source-dependencies.js.map +1 -0
- package/dist/capabilities/source-dependencies/contract/config.d.ts +5 -0
- package/dist/capabilities/source-dependencies/contract/config.d.ts.map +1 -0
- package/dist/capabilities/source-dependencies/contract/config.js +108 -0
- package/dist/capabilities/source-dependencies/contract/config.js.map +1 -0
- package/dist/capabilities/source-dependencies/module.d.ts +5 -0
- package/dist/capabilities/source-dependencies/module.d.ts.map +1 -0
- package/dist/capabilities/source-dependencies/module.js +61 -0
- package/dist/capabilities/source-dependencies/module.js.map +1 -0
- package/dist/capabilities/workspace-dependency-declarations/adapters/outbound/pnpm-workspace/pnpm-workspace-reader.d.ts +1 -0
- package/dist/capabilities/workspace-dependency-declarations/adapters/outbound/pnpm-workspace/pnpm-workspace-reader.d.ts.map +1 -1
- package/dist/capabilities/workspace-dependency-declarations/adapters/outbound/pnpm-workspace/pnpm-workspace-reader.js +4 -195
- package/dist/capabilities/workspace-dependency-declarations/adapters/outbound/pnpm-workspace/pnpm-workspace-reader.js.map +1 -1
- package/dist/capabilities/workspace-dependency-declarations/application/model/workspace-dependency-policy.d.ts +6 -0
- package/dist/capabilities/workspace-dependency-declarations/application/model/workspace-dependency-policy.d.ts.map +1 -0
- package/dist/capabilities/workspace-dependency-declarations/application/model/workspace-dependency-policy.js +2 -0
- package/dist/capabilities/workspace-dependency-declarations/application/model/workspace-dependency-policy.js.map +1 -0
- package/dist/capabilities/workspace-dependency-declarations/application/model/workspace-snapshot.d.ts +1 -26
- package/dist/capabilities/workspace-dependency-declarations/application/model/workspace-snapshot.d.ts.map +1 -1
- package/dist/capabilities/workspace-dependency-declarations/application/model/workspace-snapshot.js +1 -6
- package/dist/capabilities/workspace-dependency-declarations/application/model/workspace-snapshot.js.map +1 -1
- package/dist/capabilities/workspace-dependency-declarations/application/policies/evaluate-workspace-dependencies.d.ts +1 -1
- package/dist/capabilities/workspace-dependency-declarations/application/policies/evaluate-workspace-dependencies.d.ts.map +1 -1
- package/dist/capabilities/workspace-dependency-declarations/contract/config.d.ts +1 -5
- package/dist/capabilities/workspace-dependency-declarations/contract/config.d.ts.map +1 -1
- package/dist/capabilities/workspace-dependency-declarations/contract/config.js.map +1 -1
- package/dist/capabilities/workspace-dependency-declarations/module.d.ts +2 -0
- package/dist/capabilities/workspace-dependency-declarations/module.d.ts.map +1 -1
- package/dist/capabilities/workspace-dependency-declarations/module.js +2 -0
- package/dist/capabilities/workspace-dependency-declarations/module.js.map +1 -1
- package/dist/capability-runtime.d.ts +1 -5
- package/dist/capability-runtime.d.ts.map +1 -1
- package/dist/capability-runtime.js +4 -4
- package/dist/capability-runtime.js.map +1 -1
- package/dist/check-contract.d.ts +3 -2
- package/dist/check-contract.d.ts.map +1 -1
- package/dist/check-runner.d.ts +0 -2
- package/dist/check-runner.d.ts.map +1 -1
- package/dist/check-runner.js +1 -7
- package/dist/check-runner.js.map +1 -1
- package/dist/cli.js +11 -5
- package/dist/cli.js.map +1 -1
- package/dist/composition/capability-registry.d.ts.map +1 -1
- package/dist/composition/capability-registry.js +2 -0
- package/dist/composition/capability-registry.js.map +1 -1
- package/dist/composition/rule-registry.d.ts +8 -0
- package/dist/composition/rule-registry.d.ts.map +1 -0
- package/dist/composition/rule-registry.js +7 -0
- package/dist/composition/rule-registry.js.map +1 -0
- package/dist/filesystem-path-safety.d.ts +2 -0
- package/dist/filesystem-path-safety.d.ts.map +1 -0
- package/dist/filesystem-path-safety.js +19 -0
- package/dist/filesystem-path-safety.js.map +1 -0
- package/dist/foundation-config.d.ts +5 -4
- package/dist/foundation-config.d.ts.map +1 -1
- package/dist/foundation-config.js +50 -15
- package/dist/foundation-config.js.map +1 -1
- package/dist/local-mode/adapters/outbound/time/system-clock.d.ts +2 -0
- package/dist/local-mode/adapters/outbound/time/system-clock.d.ts.map +1 -0
- package/dist/local-mode/adapters/outbound/time/system-clock.js +4 -0
- package/dist/local-mode/adapters/outbound/time/system-clock.js.map +1 -0
- package/dist/local-mode/consumer-policy.js +1 -1
- package/dist/local-mode/consumer-policy.js.map +1 -1
- package/dist/local-mode/service.d.ts +1 -1
- package/dist/local-mode/service.d.ts.map +1 -1
- package/dist/local-mode/service.js +1 -1
- package/dist/local-mode/service.js.map +1 -1
- package/dist/package-self-check.d.ts +1 -0
- package/dist/package-self-check.d.ts.map +1 -1
- package/dist/package-self-check.js +25 -20
- package/dist/package-self-check.js.map +1 -1
- package/dist/schema-catalog.d.ts +2 -2
- package/dist/schema-catalog.d.ts.map +1 -1
- package/dist/schema-catalog.js +3 -2
- package/dist/schema-catalog.js.map +1 -1
- package/dist/strict-yaml.d.ts +0 -2
- package/dist/strict-yaml.d.ts.map +1 -1
- package/dist/strict-yaml.js +2 -2
- package/dist/strict-yaml.js.map +1 -1
- package/dist/workspace-inventory/adapters/outbound/pnpm/pnpm-workspace-inventory-reader.d.ts +6 -0
- package/dist/workspace-inventory/adapters/outbound/pnpm/pnpm-workspace-inventory-reader.d.ts.map +1 -0
- package/dist/workspace-inventory/adapters/outbound/pnpm/pnpm-workspace-inventory-reader.js +288 -0
- package/dist/workspace-inventory/adapters/outbound/pnpm/pnpm-workspace-inventory-reader.js.map +1 -0
- package/dist/workspace-inventory/application/model/workspace-inventory.d.ts +38 -0
- package/dist/workspace-inventory/application/model/workspace-inventory.d.ts.map +1 -0
- package/dist/workspace-inventory/application/model/workspace-inventory.js +7 -0
- package/dist/workspace-inventory/application/model/workspace-inventory.js.map +1 -0
- package/dist/workspace-inventory/application/ports/workspace-inventory-reader.d.ts +5 -0
- package/dist/workspace-inventory/application/ports/workspace-inventory-reader.d.ts.map +1 -0
- package/dist/workspace-inventory/application/ports/workspace-inventory-reader.js +2 -0
- package/dist/workspace-inventory/application/ports/workspace-inventory-reader.js.map +1 -0
- package/package.json +5 -1
- package/presets/oxlint/base.json +2 -0
- package/presets/oxlint/type-aware.json +39 -0
- package/schemas/architecture-source-dependencies/v1.schema.json +97 -0
- package/schemas/foundation-config/v1.schema.json +10 -0
package/dist/capabilities/source-dependencies/application/policies/evaluate-source-dependencies.js
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { SOURCE_DEPENDENCY_RULES } from "../rules.js";
|
|
2
|
+
function diagnostic(input) {
|
|
3
|
+
return {
|
|
4
|
+
ruleId: input.rule.id,
|
|
5
|
+
severity: input.rule.severity,
|
|
6
|
+
subject: input.subject,
|
|
7
|
+
message: input.message,
|
|
8
|
+
location: { path: input.path },
|
|
9
|
+
relatedLocations: input.relatedPath === undefined ? [] : [{ path: input.relatedPath }],
|
|
10
|
+
evidence: input.evidence ?? [],
|
|
11
|
+
remediation: input.rule.remediation,
|
|
12
|
+
requiresArchitectureReview: input.rule.requiresArchitectureReview
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function boundaryForPath(path, files) {
|
|
16
|
+
return files.find((file) => file.path === path)?.boundary;
|
|
17
|
+
}
|
|
18
|
+
function declarationDiagnostics(input) {
|
|
19
|
+
if (input.declaration === "runtime") {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
const rule = input.declaration === "development"
|
|
23
|
+
? SOURCE_DEPENDENCY_RULES.runtimeImportFromDevelopmentDependency
|
|
24
|
+
: input.workspace
|
|
25
|
+
? SOURCE_DEPENDENCY_RULES.undeclaredWorkspaceDependency
|
|
26
|
+
: SOURCE_DEPENDENCY_RULES.undeclaredExternalDependency;
|
|
27
|
+
return [
|
|
28
|
+
diagnostic({
|
|
29
|
+
rule,
|
|
30
|
+
subject: `${input.file.workspacePackage.name}->${input.packageName}`,
|
|
31
|
+
message: input.declaration === "development"
|
|
32
|
+
? `Runtime source imports development-only dependency ${input.packageName}.`
|
|
33
|
+
: `Runtime source imports undeclared dependency ${input.packageName}.`,
|
|
34
|
+
path: input.file.path,
|
|
35
|
+
relatedPath: input.file.workspacePackage.manifestPath,
|
|
36
|
+
evidence: [{ kind: "specifier", value: input.reference.specifier }]
|
|
37
|
+
})
|
|
38
|
+
];
|
|
39
|
+
}
|
|
40
|
+
function evaluateResolved(input) {
|
|
41
|
+
const { file, reference, resolved } = input;
|
|
42
|
+
switch (resolved.kind) {
|
|
43
|
+
case "builtin":
|
|
44
|
+
return file.boundary.allowedBuiltins.includes(resolved.specifier)
|
|
45
|
+
? []
|
|
46
|
+
: [
|
|
47
|
+
diagnostic({
|
|
48
|
+
rule: SOURCE_DEPENDENCY_RULES.forbiddenBuiltinDependency,
|
|
49
|
+
subject: `${file.boundary.id}->${resolved.specifier}`,
|
|
50
|
+
message: `Boundary ${file.boundary.id} cannot import ${resolved.specifier}.`,
|
|
51
|
+
path: file.path,
|
|
52
|
+
evidence: [{ kind: "specifier", value: reference.specifier }]
|
|
53
|
+
})
|
|
54
|
+
];
|
|
55
|
+
case "external-package":
|
|
56
|
+
return [
|
|
57
|
+
...(file.boundary.allowedPackages.includes(resolved.packageName)
|
|
58
|
+
? []
|
|
59
|
+
: [
|
|
60
|
+
diagnostic({
|
|
61
|
+
rule: SOURCE_DEPENDENCY_RULES.forbiddenPackageDependency,
|
|
62
|
+
subject: `${file.boundary.id}->${resolved.packageName}`,
|
|
63
|
+
message: `Boundary ${file.boundary.id} cannot import package ${resolved.packageName}.`,
|
|
64
|
+
path: file.path,
|
|
65
|
+
evidence: [{ kind: "specifier", value: reference.specifier }]
|
|
66
|
+
})
|
|
67
|
+
]),
|
|
68
|
+
...declarationDiagnostics({
|
|
69
|
+
file,
|
|
70
|
+
reference,
|
|
71
|
+
packageName: resolved.packageName,
|
|
72
|
+
declaration: resolved.declaration,
|
|
73
|
+
workspace: false
|
|
74
|
+
})
|
|
75
|
+
];
|
|
76
|
+
case "local-file": {
|
|
77
|
+
if (resolved.workspacePackage.name !== file.workspacePackage.name) {
|
|
78
|
+
return [
|
|
79
|
+
diagnostic({
|
|
80
|
+
rule: SOURCE_DEPENDENCY_RULES.crossPackageRelativeImport,
|
|
81
|
+
subject: `${file.workspacePackage.name}->${resolved.workspacePackage.name}`,
|
|
82
|
+
message: `Relative import crosses from ${file.workspacePackage.name} into ${resolved.workspacePackage.name}.`,
|
|
83
|
+
path: file.path,
|
|
84
|
+
relatedPath: resolved.path,
|
|
85
|
+
evidence: [{ kind: "specifier", value: reference.specifier }]
|
|
86
|
+
})
|
|
87
|
+
];
|
|
88
|
+
}
|
|
89
|
+
const targetBoundary = boundaryForPath(resolved.path, input.classifiedFiles);
|
|
90
|
+
if (targetBoundary === undefined ||
|
|
91
|
+
targetBoundary.id === file.boundary.id ||
|
|
92
|
+
file.boundary.allowedBoundaries.includes(targetBoundary.id)) {
|
|
93
|
+
return [];
|
|
94
|
+
}
|
|
95
|
+
return [
|
|
96
|
+
diagnostic({
|
|
97
|
+
rule: SOURCE_DEPENDENCY_RULES.forbiddenBoundaryDependency,
|
|
98
|
+
subject: `${file.boundary.id}->${targetBoundary.id}`,
|
|
99
|
+
message: `Boundary dependency is not allowed: ${file.boundary.id} -> ${targetBoundary.id}.`,
|
|
100
|
+
path: file.path,
|
|
101
|
+
relatedPath: resolved.path,
|
|
102
|
+
evidence: [{ kind: "specifier", value: reference.specifier }]
|
|
103
|
+
})
|
|
104
|
+
];
|
|
105
|
+
}
|
|
106
|
+
case "unsupported":
|
|
107
|
+
return [
|
|
108
|
+
diagnostic({
|
|
109
|
+
rule: SOURCE_DEPENDENCY_RULES.unsupportedImportSpecifier,
|
|
110
|
+
subject: `${file.path}:${reference.specifier}`,
|
|
111
|
+
message: `Import specifier cannot be classified: ${resolved.reason}.`,
|
|
112
|
+
path: file.path,
|
|
113
|
+
evidence: [{ kind: "specifier", value: reference.specifier }]
|
|
114
|
+
})
|
|
115
|
+
];
|
|
116
|
+
case "unresolved":
|
|
117
|
+
return [
|
|
118
|
+
diagnostic({
|
|
119
|
+
rule: SOURCE_DEPENDENCY_RULES.unresolvedLocalImport,
|
|
120
|
+
subject: `${file.path}:${reference.specifier}`,
|
|
121
|
+
message: `Import could not be resolved: ${resolved.reason}.`,
|
|
122
|
+
path: file.path,
|
|
123
|
+
evidence: [{ kind: "specifier", value: reference.specifier }]
|
|
124
|
+
})
|
|
125
|
+
];
|
|
126
|
+
case "workspace-package":
|
|
127
|
+
return [
|
|
128
|
+
...(resolved.workspacePackage.name === file.workspacePackage.name ||
|
|
129
|
+
file.boundary.allowedPackages.includes(resolved.workspacePackage.name)
|
|
130
|
+
? []
|
|
131
|
+
: [
|
|
132
|
+
diagnostic({
|
|
133
|
+
rule: SOURCE_DEPENDENCY_RULES.forbiddenPackageDependency,
|
|
134
|
+
subject: `${file.boundary.id}->${resolved.workspacePackage.name}`,
|
|
135
|
+
message: `Boundary ${file.boundary.id} cannot import workspace package ${resolved.workspacePackage.name}.`,
|
|
136
|
+
path: file.path,
|
|
137
|
+
relatedPath: resolved.workspacePackage.manifestPath,
|
|
138
|
+
evidence: [{ kind: "specifier", value: reference.specifier }]
|
|
139
|
+
})
|
|
140
|
+
]),
|
|
141
|
+
...(resolved.workspacePackage.name === file.workspacePackage.name
|
|
142
|
+
? []
|
|
143
|
+
: declarationDiagnostics({
|
|
144
|
+
file,
|
|
145
|
+
reference,
|
|
146
|
+
packageName: resolved.workspacePackage.name,
|
|
147
|
+
declaration: resolved.declaration,
|
|
148
|
+
workspace: true
|
|
149
|
+
})),
|
|
150
|
+
...(resolved.exported
|
|
151
|
+
? []
|
|
152
|
+
: [
|
|
153
|
+
diagnostic({
|
|
154
|
+
rule: SOURCE_DEPENDENCY_RULES.packageSubpathNotExported,
|
|
155
|
+
subject: `${resolved.workspacePackage.name}:${resolved.subpath}`,
|
|
156
|
+
message: `Workspace package subpath is not exported: ${reference.specifier}.`,
|
|
157
|
+
path: file.path,
|
|
158
|
+
relatedPath: resolved.workspacePackage.manifestPath,
|
|
159
|
+
evidence: [{ kind: "subpath", value: resolved.subpath }]
|
|
160
|
+
})
|
|
161
|
+
])
|
|
162
|
+
];
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
export function evaluateSourceDependencies(input) {
|
|
166
|
+
const diagnostics = [];
|
|
167
|
+
const classifiedPaths = new Set(input.classifiedFiles.map((file) => file.path));
|
|
168
|
+
const governedFilePaths = new Set(input.allSourceFiles.map((file) => file.path));
|
|
169
|
+
for (const sourceFile of input.allSourceFiles) {
|
|
170
|
+
if (!classifiedPaths.has(sourceFile.path)) {
|
|
171
|
+
diagnostics.push(diagnostic({
|
|
172
|
+
rule: SOURCE_DEPENDENCY_RULES.unclassifiedSourceFile,
|
|
173
|
+
subject: sourceFile.path,
|
|
174
|
+
message: "Governed source file does not belong to an architecture boundary.",
|
|
175
|
+
path: sourceFile.path
|
|
176
|
+
}));
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
for (const file of input.classifiedFiles) {
|
|
180
|
+
if (file.parsed.parseErrorCount > 0) {
|
|
181
|
+
diagnostics.push(diagnostic({
|
|
182
|
+
rule: SOURCE_DEPENDENCY_RULES.sourceParseError,
|
|
183
|
+
subject: file.path,
|
|
184
|
+
message: `Source parser reported ${file.parsed.parseErrorCount} error(s).`,
|
|
185
|
+
path: file.path,
|
|
186
|
+
evidence: [
|
|
187
|
+
{ kind: "parse-error-count", value: String(file.parsed.parseErrorCount) }
|
|
188
|
+
]
|
|
189
|
+
}));
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
for (const unresolvedReference of file.parsed.unresolved) {
|
|
193
|
+
if (file.boundary.allowedRuntimeReferences.includes(unresolvedReference.kind)) {
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
diagnostics.push(diagnostic({
|
|
197
|
+
rule: SOURCE_DEPENDENCY_RULES.unresolvedRuntimeReference,
|
|
198
|
+
subject: `${file.path}:${unresolvedReference.kind}:${unresolvedReference.start}`,
|
|
199
|
+
message: `Non-literal ${unresolvedReference.kind} reference hides a dependency edge.`,
|
|
200
|
+
path: file.path,
|
|
201
|
+
evidence: [
|
|
202
|
+
{ kind: "reference-kind", value: unresolvedReference.kind },
|
|
203
|
+
{ kind: "offset", value: String(unresolvedReference.start) }
|
|
204
|
+
]
|
|
205
|
+
}));
|
|
206
|
+
}
|
|
207
|
+
for (const reference of file.parsed.references) {
|
|
208
|
+
diagnostics.push(...evaluateResolved({
|
|
209
|
+
file,
|
|
210
|
+
reference,
|
|
211
|
+
resolved: input.resolver.resolve({
|
|
212
|
+
file,
|
|
213
|
+
governedFilePaths,
|
|
214
|
+
inventory: input.inventory,
|
|
215
|
+
reference
|
|
216
|
+
}),
|
|
217
|
+
classifiedFiles: input.classifiedFiles
|
|
218
|
+
}));
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return diagnostics;
|
|
222
|
+
}
|
|
223
|
+
//# sourceMappingURL=evaluate-source-dependencies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluate-source-dependencies.js","sourceRoot":"","sources":["../../../../../src/capabilities/source-dependencies/application/policies/evaluate-source-dependencies.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,uBAAuB,EAExB,MAAM,aAAa,CAAC;AAUrB,SAAS,UAAU,CAAC,KAOnB;IACC,OAAO;QACL,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE;QACrB,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ;QAC7B,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,QAAQ,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE;QAC9B,gBAAgB,EACd,KAAK,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC;QACtE,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,EAAE;QAC9B,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,WAAW;QACnC,0BAA0B,EAAE,KAAK,CAAC,IAAI,CAAC,0BAA0B;KAClE,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CACtB,IAAY,EACZ,KAAsC;IAEtC,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,QAAQ,CAAC;AAC5D,CAAC;AAED,SAAS,sBAAsB,CAAC,KAM/B;IACC,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;QACpC,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,IAAI,GACR,KAAK,CAAC,WAAW,KAAK,aAAa;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d,UAAU,CAAC;gBACT,IAAI,EAAE,uBAAuB,CAAC,0BAA0B;gBACxD,OAAO,EAAE,GAAG,IAAI,CAAC,IAAI,IAAI,mBAAmB,CAAC,IAAI,IAAI,mBAAmB,CAAC,KAAK,EAAE;gBAChF,OAAO,EAAE,eAAe,mBAAmB,CAAC,IAAI,qCAAqC;gBACrF,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,QAAQ,EAAE;oBACR,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,mBAAmB,CAAC,IAAI,EAAE;oBAC3D,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,EAAE;iBAC7D;aACF,CAAC,CACH,CAAC;QACJ,CAAC;QACD,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;YAC/C,WAAW,CAAC,IAAI,CACd,GAAG,gBAAgB,CAAC;gBAClB,IAAI;gBACJ,SAAS;gBACT,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC;oBAC/B,IAAI;oBACJ,iBAAiB;oBACjB,SAAS,EAAE,KAAK,CAAC,SAAS;oBAC1B,SAAS;iBACV,CAAC;gBACF,eAAe,EAAE,KAAK,CAAC,eAAe;aACvC,CAAC,CACH,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
package/dist/capabilities/source-dependencies/application/ports/source-dependency-parser.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-dependency-parser.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/source-dependencies/application/ports/source-dependency-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,kBAAkB,EACnB,MAAM,8BAA8B,CAAC;AAEtC,MAAM,WAAW,sBAAsB;IACrC,KAAK,CAAC,IAAI,EAAE,kBAAkB,GAAG,wBAAwB,CAAC;CAC3D"}
|
package/dist/capabilities/source-dependencies/application/ports/source-dependency-parser.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-dependency-parser.js","sourceRoot":"","sources":["../../../../../src/capabilities/source-dependencies/application/ports/source-dependency-parser.ts"],"names":[],"mappings":""}
|
package/dist/capabilities/source-dependencies/application/ports/source-dependency-resolver.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { WorkspaceInventory } from "../../../../workspace-inventory/application/model/workspace-inventory.js";
|
|
2
|
+
import type { ClassifiedSourceFile, ResolvedSourceDependency, SourceDependencyReference } from "../model/source-workspace.js";
|
|
3
|
+
export interface ResolveSourceDependencyInput {
|
|
4
|
+
readonly file: ClassifiedSourceFile;
|
|
5
|
+
readonly governedFilePaths: ReadonlySet<string>;
|
|
6
|
+
readonly inventory: WorkspaceInventory;
|
|
7
|
+
readonly reference: SourceDependencyReference;
|
|
8
|
+
}
|
|
9
|
+
export interface SourceDependencyResolver {
|
|
10
|
+
resolve(input: ResolveSourceDependencyInput): ResolvedSourceDependency;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=source-dependency-resolver.d.ts.map
|
package/dist/capabilities/source-dependencies/application/ports/source-dependency-resolver.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-dependency-resolver.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/source-dependencies/application/ports/source-dependency-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0EAA0E,CAAC;AACnH,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,8BAA8B,CAAC;AAEtC,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;IACpC,QAAQ,CAAC,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAChD,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC;IACvC,QAAQ,CAAC,SAAS,EAAE,yBAAyB,CAAC;CAC/C;AAED,MAAM,WAAW,wBAAwB;IACvC,OAAO,CAAC,KAAK,EAAE,4BAA4B,GAAG,wBAAwB,CAAC;CACxE"}
|
package/dist/capabilities/source-dependencies/application/ports/source-dependency-resolver.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-dependency-resolver.js","sourceRoot":"","sources":["../../../../../src/capabilities/source-dependencies/application/ports/source-dependency-resolver.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SourceFileSnapshot } from "../model/source-workspace.js";
|
|
2
|
+
export interface SourceTreeReader {
|
|
3
|
+
read(consumerRoot: string, governedRoots: readonly string[], signal?: AbortSignal): Promise<readonly SourceFileSnapshot[]>;
|
|
4
|
+
}
|
|
5
|
+
//# sourceMappingURL=source-tree-reader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-tree-reader.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/source-dependencies/application/ports/source-tree-reader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CACF,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,SAAS,MAAM,EAAE,EAChC,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,SAAS,kBAAkB,EAAE,CAAC,CAAC;CAC3C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-tree-reader.js","sourceRoot":"","sources":["../../../../../src/capabilities/source-dependencies/application/ports/source-tree-reader.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { DiagnosticSeverity } from "../../../check-contract.js";
|
|
2
|
+
export interface SourceDependencyRuleMetadata {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly severity: DiagnosticSeverity;
|
|
5
|
+
readonly rationale: string;
|
|
6
|
+
readonly remediation: string;
|
|
7
|
+
readonly documentation: string;
|
|
8
|
+
readonly requiresArchitectureReview: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const SOURCE_DEPENDENCY_RULES: Readonly<{
|
|
11
|
+
crossPackageRelativeImport: SourceDependencyRuleMetadata;
|
|
12
|
+
forbiddenBoundaryDependency: SourceDependencyRuleMetadata;
|
|
13
|
+
forbiddenBuiltinDependency: SourceDependencyRuleMetadata;
|
|
14
|
+
forbiddenPackageDependency: SourceDependencyRuleMetadata;
|
|
15
|
+
packageSubpathNotExported: SourceDependencyRuleMetadata;
|
|
16
|
+
sourceParseError: SourceDependencyRuleMetadata;
|
|
17
|
+
undeclaredExternalDependency: SourceDependencyRuleMetadata;
|
|
18
|
+
undeclaredWorkspaceDependency: SourceDependencyRuleMetadata;
|
|
19
|
+
unresolvedLocalImport: SourceDependencyRuleMetadata;
|
|
20
|
+
unresolvedRuntimeReference: SourceDependencyRuleMetadata;
|
|
21
|
+
runtimeImportFromDevelopmentDependency: SourceDependencyRuleMetadata;
|
|
22
|
+
unsupportedImportSpecifier: SourceDependencyRuleMetadata;
|
|
23
|
+
unclassifiedSourceFile: SourceDependencyRuleMetadata;
|
|
24
|
+
}>;
|
|
25
|
+
export declare const SOURCE_DEPENDENCY_RULES_BY_ID: ReadonlyMap<string, SourceDependencyRuleMetadata>;
|
|
26
|
+
//# sourceMappingURL=rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/source-dependencies/application/rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,0BAA0B,EAAE,OAAO,CAAC;CAC9C;AAkBD,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;EA0ElC,CAAC;AAEH,eAAO,MAAM,6BAA6B,EAAE,WAAW,CACrD,MAAM,EACN,4BAA4B,CAG7B,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
function rule(suffix, rationale, remediation, requiresArchitectureReview = false) {
|
|
2
|
+
return Object.freeze({
|
|
3
|
+
id: `architecture.source-dependencies.${suffix}`,
|
|
4
|
+
severity: "error",
|
|
5
|
+
rationale,
|
|
6
|
+
remediation,
|
|
7
|
+
documentation: "docs/architecture/executable-capabilities.md#architecturesource-dependencies",
|
|
8
|
+
requiresArchitectureReview
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
export const SOURCE_DEPENDENCY_RULES = Object.freeze({
|
|
12
|
+
crossPackageRelativeImport: rule("cross-package-relative-import", "Cross-package relative imports bypass package identity and public exports.", "Import the target package through an exported package subpath.", true),
|
|
13
|
+
forbiddenBoundaryDependency: rule("forbidden-boundary-dependency", "Source boundaries must follow the consumer-owned architecture graph.", "Move the dependency behind a port or approve the boundary edge.", true),
|
|
14
|
+
forbiddenBuiltinDependency: rule("forbidden-builtin-dependency", "Runtime builtins are capabilities that must be explicit per boundary.", "Move the builtin access to an adapter or approve it for this boundary.", true),
|
|
15
|
+
forbiddenPackageDependency: rule("forbidden-package-dependency", "Package dependencies must be explicit per architecture boundary.", "Move the import behind a port or approve the package for this boundary.", true),
|
|
16
|
+
packageSubpathNotExported: rule("package-subpath-not-exported", "Workspace consumers may only import explicit package exports.", "Use an existing public entrypoint or deliberately add a package export.", true),
|
|
17
|
+
sourceParseError: rule("source-parse-error", "Architecture evidence cannot be trusted when governed source does not parse.", "Fix the source syntax before evaluating architecture boundaries."),
|
|
18
|
+
undeclaredExternalDependency: rule("undeclared-external-dependency", "Runtime source must not rely on undeclared transitive dependencies.", "Declare the external package in dependencies, optionalDependencies, or peerDependencies."),
|
|
19
|
+
undeclaredWorkspaceDependency: rule("undeclared-workspace-dependency", "An allowed architecture edge still requires an explicit package dependency.", "Declare the workspace package with the package manager workspace protocol."),
|
|
20
|
+
unresolvedLocalImport: rule("unresolved-local-import", "Unresolved governed imports make the observed dependency graph incomplete.", "Use a supported literal import that resolves to a governed source file."),
|
|
21
|
+
unresolvedRuntimeReference: rule("unresolved-runtime-reference", "Non-literal runtime loading can hide architecture edges from static evidence.", "Centralize dynamic loading behind an approved adapter with literal module references.", true),
|
|
22
|
+
runtimeImportFromDevelopmentDependency: rule("runtime-import-from-development-dependency", "Published runtime source cannot depend only on development dependencies.", "Move the dependency to an appropriate runtime dependency section."),
|
|
23
|
+
unsupportedImportSpecifier: rule("unsupported-import-specifier", "Unsupported specifiers cannot be classified reliably by the architecture gate.", "Use relative, node builtin, declared external, or governed workspace package imports.", true),
|
|
24
|
+
unclassifiedSourceFile: rule("unclassified-source-file", "Every governed source file must belong to exactly one declared architecture boundary.", "Classify the file in an existing boundary or introduce an explicitly reviewed boundary.", true)
|
|
25
|
+
});
|
|
26
|
+
export const SOURCE_DEPENDENCY_RULES_BY_ID = new Map(Object.values(SOURCE_DEPENDENCY_RULES).map((metadata) => [metadata.id, metadata]));
|
|
27
|
+
//# sourceMappingURL=rules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.js","sourceRoot":"","sources":["../../../../src/capabilities/source-dependencies/application/rules.ts"],"names":[],"mappings":"AAWA,SAAS,IAAI,CACX,MAAc,EACd,SAAiB,EACjB,WAAmB,EACnB,0BAA0B,GAAG,KAAK;IAElC,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,EAAE,EAAE,oC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B,0BAA0B,EAC1B,uFAAuF,EACvF,yFAAyF,EACzF,IAAI,CACL;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,6BAA6B,GAGtC,IAAI,GAAG,CACT,MAAM,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC,CAClF,CAAC"}
|
package/dist/capabilities/source-dependencies/application/use-cases/analyze-source-dependencies.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { FoundationDiagnostic } from "../../../../check-contract.js";
|
|
2
|
+
import type { WorkspaceInventoryReader } from "../../../../workspace-inventory/application/ports/workspace-inventory-reader.js";
|
|
3
|
+
import type { SourceArchitecturePolicy } from "../model/source-workspace.js";
|
|
4
|
+
import type { SourceDependencyParser } from "../ports/source-dependency-parser.js";
|
|
5
|
+
import type { SourceDependencyResolver } from "../ports/source-dependency-resolver.js";
|
|
6
|
+
import type { SourceTreeReader } from "../ports/source-tree-reader.js";
|
|
7
|
+
export interface AnalyzeSourceDependenciesInput {
|
|
8
|
+
readonly consumerRoot: string;
|
|
9
|
+
readonly policy: SourceArchitecturePolicy;
|
|
10
|
+
readonly signal?: AbortSignal;
|
|
11
|
+
}
|
|
12
|
+
export interface AnalyzeSourceDependenciesDependencies {
|
|
13
|
+
readonly inventoryReader: WorkspaceInventoryReader;
|
|
14
|
+
readonly parser: SourceDependencyParser;
|
|
15
|
+
readonly resolver: SourceDependencyResolver;
|
|
16
|
+
readonly sourceReader: SourceTreeReader;
|
|
17
|
+
}
|
|
18
|
+
export declare function analyzeSourceDependencies(input: AnalyzeSourceDependenciesInput, dependencies: AnalyzeSourceDependenciesDependencies): Promise<readonly FoundationDiagnostic[]>;
|
|
19
|
+
//# sourceMappingURL=analyze-source-dependencies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze-source-dependencies.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/source-dependencies/application/use-cases/analyze-source-dependencies.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAG1E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iFAAiF,CAAC;AAChI,OAAO,KAAK,EAGV,wBAAwB,EAEzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAGvE,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,wBAAwB,CAAC;IAC1C,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED,MAAM,WAAW,qCAAqC;IACpD,QAAQ,CAAC,eAAe,EAAE,wBAAwB,CAAC;IACnD,QAAQ,CAAC,MAAM,EAAE,sBAAsB,CAAC;IACxC,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC;IAC5C,QAAQ,CAAC,YAAY,EAAE,gBAAgB,CAAC;CACzC;AA+ED,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,8BAA8B,EACrC,YAAY,EAAE,qCAAqC,GAClD,OAAO,CAAC,SAAS,oBAAoB,EAAE,CAAC,CA4B1C"}
|
package/dist/capabilities/source-dependencies/application/use-cases/analyze-source-dependencies.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { CapabilityInputError } from "../../../../capability-runtime.js";
|
|
2
|
+
import { assertNotCancelled } from "../../../../strict-yaml.js";
|
|
3
|
+
import { evaluateSourceDependencies } from "../policies/evaluate-source-dependencies.js";
|
|
4
|
+
function pathInside(path, root) {
|
|
5
|
+
return path === root || path.startsWith(`${root}/`);
|
|
6
|
+
}
|
|
7
|
+
function deepestBoundary(file, boundaries) {
|
|
8
|
+
return boundaries
|
|
9
|
+
.filter((boundary) => boundary.roots.some((root) => pathInside(file.path, root)))
|
|
10
|
+
.toSorted((left, right) => Math.max(...right.roots.map((root) => root.length)) -
|
|
11
|
+
Math.max(...left.roots.map((root) => root.length)) ||
|
|
12
|
+
left.id.localeCompare(right.id))[0];
|
|
13
|
+
}
|
|
14
|
+
function containingPackage(path, packages) {
|
|
15
|
+
return packages
|
|
16
|
+
.filter((workspacePackage) => workspacePackage.rootPath === "."
|
|
17
|
+
? true
|
|
18
|
+
: pathInside(path, workspacePackage.rootPath))
|
|
19
|
+
.toSorted((left, right) => right.rootPath.length - left.rootPath.length ||
|
|
20
|
+
left.name.localeCompare(right.name))[0];
|
|
21
|
+
}
|
|
22
|
+
function classifyFiles(files, policy, packages, parser, signal) {
|
|
23
|
+
const classified = [];
|
|
24
|
+
for (const file of files) {
|
|
25
|
+
assertNotCancelled(signal);
|
|
26
|
+
const boundary = deepestBoundary(file, policy.boundaries);
|
|
27
|
+
const workspacePackage = containingPackage(file.path, packages);
|
|
28
|
+
if (boundary === undefined || workspacePackage === undefined) {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
classified.push({
|
|
32
|
+
...file,
|
|
33
|
+
boundary,
|
|
34
|
+
workspacePackage,
|
|
35
|
+
parsed: parser.parse(file)
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return classified;
|
|
39
|
+
}
|
|
40
|
+
function assertInventoryUsable(packages) {
|
|
41
|
+
const names = new Set();
|
|
42
|
+
for (const workspacePackage of packages) {
|
|
43
|
+
if (workspacePackage.name.startsWith("<unnamed:") || names.has(workspacePackage.name)) {
|
|
44
|
+
throw new CapabilityInputError({
|
|
45
|
+
code: "WORKSPACE_IDENTITY_INVALID",
|
|
46
|
+
message: "Source architecture requires unique named workspace packages.",
|
|
47
|
+
phase: "source-workspace-inventory",
|
|
48
|
+
retryable: false
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
names.add(workspacePackage.name);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export async function analyzeSourceDependencies(input, dependencies) {
|
|
55
|
+
const [inventory, sourceFiles] = await Promise.all([
|
|
56
|
+
dependencies.inventoryReader.read(input.consumerRoot, input.policy.workspaceManifestPath, input.signal),
|
|
57
|
+
dependencies.sourceReader.read(input.consumerRoot, input.policy.governedRoots, input.signal)
|
|
58
|
+
]);
|
|
59
|
+
assertInventoryUsable(inventory.packages);
|
|
60
|
+
const classifiedFiles = classifyFiles(sourceFiles, input.policy, inventory.packages, dependencies.parser, input.signal);
|
|
61
|
+
return evaluateSourceDependencies({
|
|
62
|
+
policy: input.policy,
|
|
63
|
+
inventory,
|
|
64
|
+
allSourceFiles: sourceFiles,
|
|
65
|
+
classifiedFiles,
|
|
66
|
+
resolver: dependencies.resolver
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=analyze-source-dependencies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyze-source-dependencies.js","sourceRoot":"","sources":["../../../../../src/capabilities/source-dependencies/application/use-cases/analyze-source-dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAYhE,OAAO,EAAE,0BAA0B,EAAE,MAAM,6CAA6C,CAAC;AAezF,SAAS,UAAU,CAAC,IAAY,EAAE,IAAY;IAC5C,OAAO,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC;AACtD,CAAC;AAED,SAAS,eAAe,CACtB,IAAwB,EACxB,UAAiD;IAEjD,OAAO,UAAU;SACd,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,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,CACb;QACD,YAAY,CAAC,YAAY,CAAC,IAAI,CAC5B,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,MAAM,CAAC,aAAa,EAC1B,KAAK,CAAC,MAAM,CACb;KACF,CAAC,CAAC;IACH,qBAAqB,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC1C,MAAM,eAAe,GAAG,aAAa,CACnC,WAAW,EACX,KAAK,CAAC,MAAM,EACZ,SAAS,CAAC,QAAQ,EAClB,YAAY,CAAC,MAAM,EACnB,KAAK,CAAC,MAAM,CACb,CAAC;IACF,OAAO,0BAA0B,CAAC;QAChC,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,SAAS;QACT,cAAc,EAAE,WAAW;QAC3B,eAAe;QACf,QAAQ,EAAE,YAAY,CAAC,QAAQ;KAChC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SourceArchitecturePolicy } from "../application/model/source-workspace.js";
|
|
2
|
+
export declare const CAPABILITY_ID: "architecture.source-dependencies";
|
|
3
|
+
export declare const CAPABILITY_CONFIG_SCHEMA_VERSION: 1;
|
|
4
|
+
export declare function loadCapabilityConfig(consumerRoot: string, configPath: string, signal?: AbortSignal): Promise<SourceArchitecturePolicy>;
|
|
5
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/source-dependencies/contract/config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,wBAAwB,EACzB,MAAM,0CAA0C,CAAC;AAElD,eAAO,MAAM,aAAa,EAAG,kCAA2C,CAAC;AACzE,eAAO,MAAM,gCAAgC,EAAG,CAAU,CAAC;AAuG3D,wBAAsB,oBAAoB,CACxC,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,wBAAwB,CAAC,CA4BnC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { CapabilityInputError } from "../../../capability-runtime.js";
|
|
2
|
+
import { assertSchema } from "../../../schema-catalog.js";
|
|
3
|
+
import { loadStrictYamlFile } from "../../../strict-yaml.js";
|
|
4
|
+
export const CAPABILITY_ID = "architecture.source-dependencies";
|
|
5
|
+
export const CAPABILITY_CONFIG_SCHEMA_VERSION = 1;
|
|
6
|
+
function inputError(message) {
|
|
7
|
+
throw new CapabilityInputError({
|
|
8
|
+
code: "SOURCE_ARCHITECTURE_CONFIG_INVALID",
|
|
9
|
+
message,
|
|
10
|
+
phase: "source-architecture-config",
|
|
11
|
+
retryable: false
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function isRecord(value) {
|
|
15
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16
|
+
}
|
|
17
|
+
function record(value, field) {
|
|
18
|
+
if (!isRecord(value)) {
|
|
19
|
+
inputError(`${field} must be an object.`);
|
|
20
|
+
}
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
function strings(value, field) {
|
|
24
|
+
if (!Array.isArray(value)) {
|
|
25
|
+
inputError(`${field} must be an array of strings.`);
|
|
26
|
+
}
|
|
27
|
+
const output = [];
|
|
28
|
+
for (const entry of value) {
|
|
29
|
+
if (typeof entry !== "string") {
|
|
30
|
+
inputError(`${field} must be an array of strings.`);
|
|
31
|
+
}
|
|
32
|
+
output.push(entry);
|
|
33
|
+
}
|
|
34
|
+
return output;
|
|
35
|
+
}
|
|
36
|
+
function string(value, field) {
|
|
37
|
+
if (typeof value !== "string") {
|
|
38
|
+
inputError(`${field} must be a string.`);
|
|
39
|
+
}
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
42
|
+
function pathInside(path, root) {
|
|
43
|
+
return path === root || path.startsWith(`${root}/`);
|
|
44
|
+
}
|
|
45
|
+
function validatePolicy(policy) {
|
|
46
|
+
const boundaryIds = new Set();
|
|
47
|
+
const boundaryRoots = new Set();
|
|
48
|
+
for (const boundary of policy.boundaries) {
|
|
49
|
+
if (boundaryIds.has(boundary.id)) {
|
|
50
|
+
inputError(`Architecture boundary ID is duplicated: ${boundary.id}.`);
|
|
51
|
+
}
|
|
52
|
+
boundaryIds.add(boundary.id);
|
|
53
|
+
for (const root of boundary.roots) {
|
|
54
|
+
if (boundaryRoots.has(root)) {
|
|
55
|
+
inputError(`Architecture boundary root is duplicated: ${root}.`);
|
|
56
|
+
}
|
|
57
|
+
if (!policy.governedRoots.some((governedRoot) => pathInside(root, governedRoot))) {
|
|
58
|
+
inputError(`Architecture boundary root is outside governed roots: ${root}.`);
|
|
59
|
+
}
|
|
60
|
+
boundaryRoots.add(root);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
for (const boundary of policy.boundaries) {
|
|
64
|
+
for (const target of boundary.allowedBoundaries) {
|
|
65
|
+
if (target === boundary.id || !boundaryIds.has(target)) {
|
|
66
|
+
inputError(`Boundary edge must target another declared boundary: ${boundary.id} -> ${target}.`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
for (const governedRoot of policy.governedRoots) {
|
|
71
|
+
if (![...boundaryRoots].some((root) => pathInside(root, governedRoot))) {
|
|
72
|
+
inputError(`Governed root has no architecture boundary: ${governedRoot}.`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function mapBoundary(value, index) {
|
|
77
|
+
const boundary = record(value, `boundaries[${index}]`);
|
|
78
|
+
const allow = record(boundary["allow"], `boundaries[${index}].allow`);
|
|
79
|
+
return Object.freeze({
|
|
80
|
+
id: string(boundary["id"], `boundaries[${index}].id`),
|
|
81
|
+
roots: Object.freeze(strings(boundary["roots"], `boundaries[${index}].roots`)),
|
|
82
|
+
allowedBoundaries: Object.freeze(strings(allow["boundaries"], `boundaries[${index}].allow.boundaries`)),
|
|
83
|
+
allowedPackages: Object.freeze(strings(allow["packages"], `boundaries[${index}].allow.packages`)),
|
|
84
|
+
allowedBuiltins: Object.freeze(strings(allow["builtins"], `boundaries[${index}].allow.builtins`)),
|
|
85
|
+
allowedRuntimeReferences: Object.freeze(strings(allow["runtimeReferences"], `boundaries[${index}].allow.runtimeReferences`))
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
export async function loadCapabilityConfig(consumerRoot, configPath, signal) {
|
|
89
|
+
const input = await loadStrictYamlFile(consumerRoot, configPath, "source-architecture-config", signal);
|
|
90
|
+
await assertSchema("architecture-source-dependencies/v1", input, "source-architecture-config");
|
|
91
|
+
const root = record(input, "source architecture config");
|
|
92
|
+
const workspace = record(root["workspace"], "workspace");
|
|
93
|
+
const boundaryInput = root["boundaries"];
|
|
94
|
+
if (!Array.isArray(boundaryInput)) {
|
|
95
|
+
inputError("boundaries must be an array.");
|
|
96
|
+
}
|
|
97
|
+
if (workspace["kind"] !== "pnpm" || workspace["manifest"] !== "pnpm-workspace.yaml") {
|
|
98
|
+
inputError("workspace must select pnpm-workspace.yaml.");
|
|
99
|
+
}
|
|
100
|
+
const policy = Object.freeze({
|
|
101
|
+
workspaceManifestPath: "pnpm-workspace.yaml",
|
|
102
|
+
governedRoots: Object.freeze(strings(root["governedRoots"], "governedRoots")),
|
|
103
|
+
boundaries: Object.freeze(boundaryInput.map(mapBoundary))
|
|
104
|
+
});
|
|
105
|
+
validatePolicy(policy);
|
|
106
|
+
return policy;
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../src/capabilities/source-dependencies/contract/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAM7D,MAAM,CAAC,MAAM,aAAa,GAAG,kCAA2C,CAAC;AACz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5 @@
|
|
|
1
|
+
import { type CapabilityDefinition } from "../../capability-runtime.js";
|
|
2
|
+
import { SOURCE_DEPENDENCY_RULES_BY_ID } from "./application/rules.js";
|
|
3
|
+
export { SOURCE_DEPENDENCY_RULES_BY_ID };
|
|
4
|
+
export declare function createSourceDependenciesCapability(): CapabilityDefinition;
|
|
5
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/capabilities/source-dependencies/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,oBAAoB,EAE1B,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC;AAOvE,OAAO,EAAE,6BAA6B,EAAE,CAAC;AAEzC,wBAAgB,kCAAkC,IAAI,oBAAoB,CAyDzE"}
|