@agent-teams/engineering-foundation 0.2.0 → 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.
Files changed (141) hide show
  1. package/README.md +6 -2
  2. package/dist/capabilities/source-dependencies/adapters/outbound/filesystem/filesystem-source-tree-reader.d.ts +6 -0
  3. package/dist/capabilities/source-dependencies/adapters/outbound/filesystem/filesystem-source-tree-reader.d.ts.map +1 -0
  4. package/dist/capabilities/source-dependencies/adapters/outbound/filesystem/filesystem-source-tree-reader.js +133 -0
  5. package/dist/capabilities/source-dependencies/adapters/outbound/filesystem/filesystem-source-tree-reader.js.map +1 -0
  6. package/dist/capabilities/source-dependencies/adapters/outbound/node/node-source-dependency-resolver.d.ts +6 -0
  7. package/dist/capabilities/source-dependencies/adapters/outbound/node/node-source-dependency-resolver.d.ts.map +1 -0
  8. package/dist/capabilities/source-dependencies/adapters/outbound/node/node-source-dependency-resolver.js +151 -0
  9. package/dist/capabilities/source-dependencies/adapters/outbound/node/node-source-dependency-resolver.js.map +1 -0
  10. package/dist/capabilities/source-dependencies/adapters/outbound/oxc/oxc-source-dependency-parser.d.ts +6 -0
  11. package/dist/capabilities/source-dependencies/adapters/outbound/oxc/oxc-source-dependency-parser.d.ts.map +1 -0
  12. package/dist/capabilities/source-dependencies/adapters/outbound/oxc/oxc-source-dependency-parser.js +96 -0
  13. package/dist/capabilities/source-dependencies/adapters/outbound/oxc/oxc-source-dependency-parser.js.map +1 -0
  14. package/dist/capabilities/source-dependencies/application/model/source-workspace.d.ts +69 -0
  15. package/dist/capabilities/source-dependencies/application/model/source-workspace.d.ts.map +1 -0
  16. package/dist/capabilities/source-dependencies/application/model/source-workspace.js +13 -0
  17. package/dist/capabilities/source-dependencies/application/model/source-workspace.js.map +1 -0
  18. package/dist/capabilities/source-dependencies/application/policies/evaluate-source-dependencies.d.ts +14 -0
  19. package/dist/capabilities/source-dependencies/application/policies/evaluate-source-dependencies.d.ts.map +1 -0
  20. package/dist/capabilities/source-dependencies/application/policies/evaluate-source-dependencies.js +223 -0
  21. package/dist/capabilities/source-dependencies/application/policies/evaluate-source-dependencies.js.map +1 -0
  22. package/dist/capabilities/source-dependencies/application/ports/source-dependency-parser.d.ts +5 -0
  23. package/dist/capabilities/source-dependencies/application/ports/source-dependency-parser.d.ts.map +1 -0
  24. package/dist/capabilities/source-dependencies/application/ports/source-dependency-parser.js +2 -0
  25. package/dist/capabilities/source-dependencies/application/ports/source-dependency-parser.js.map +1 -0
  26. package/dist/capabilities/source-dependencies/application/ports/source-dependency-resolver.d.ts +12 -0
  27. package/dist/capabilities/source-dependencies/application/ports/source-dependency-resolver.d.ts.map +1 -0
  28. package/dist/capabilities/source-dependencies/application/ports/source-dependency-resolver.js +2 -0
  29. package/dist/capabilities/source-dependencies/application/ports/source-dependency-resolver.js.map +1 -0
  30. package/dist/capabilities/source-dependencies/application/ports/source-tree-reader.d.ts +5 -0
  31. package/dist/capabilities/source-dependencies/application/ports/source-tree-reader.d.ts.map +1 -0
  32. package/dist/capabilities/source-dependencies/application/ports/source-tree-reader.js +2 -0
  33. package/dist/capabilities/source-dependencies/application/ports/source-tree-reader.js.map +1 -0
  34. package/dist/capabilities/source-dependencies/application/rules.d.ts +26 -0
  35. package/dist/capabilities/source-dependencies/application/rules.d.ts.map +1 -0
  36. package/dist/capabilities/source-dependencies/application/rules.js +27 -0
  37. package/dist/capabilities/source-dependencies/application/rules.js.map +1 -0
  38. package/dist/capabilities/source-dependencies/application/use-cases/analyze-source-dependencies.d.ts +19 -0
  39. package/dist/capabilities/source-dependencies/application/use-cases/analyze-source-dependencies.d.ts.map +1 -0
  40. package/dist/capabilities/source-dependencies/application/use-cases/analyze-source-dependencies.js +69 -0
  41. package/dist/capabilities/source-dependencies/application/use-cases/analyze-source-dependencies.js.map +1 -0
  42. package/dist/capabilities/source-dependencies/contract/config.d.ts +5 -0
  43. package/dist/capabilities/source-dependencies/contract/config.d.ts.map +1 -0
  44. package/dist/capabilities/source-dependencies/contract/config.js +108 -0
  45. package/dist/capabilities/source-dependencies/contract/config.js.map +1 -0
  46. package/dist/capabilities/source-dependencies/module.d.ts +5 -0
  47. package/dist/capabilities/source-dependencies/module.d.ts.map +1 -0
  48. package/dist/capabilities/source-dependencies/module.js +61 -0
  49. package/dist/capabilities/source-dependencies/module.js.map +1 -0
  50. package/dist/capabilities/workspace-dependency-declarations/adapters/outbound/pnpm-workspace/pnpm-workspace-reader.d.ts +2 -1
  51. package/dist/capabilities/workspace-dependency-declarations/adapters/outbound/pnpm-workspace/pnpm-workspace-reader.d.ts.map +1 -1
  52. package/dist/capabilities/workspace-dependency-declarations/adapters/outbound/pnpm-workspace/pnpm-workspace-reader.js +4 -195
  53. package/dist/capabilities/workspace-dependency-declarations/adapters/outbound/pnpm-workspace/pnpm-workspace-reader.js.map +1 -1
  54. package/dist/capabilities/workspace-dependency-declarations/application/model/workspace-dependency-policy.d.ts +6 -0
  55. package/dist/capabilities/workspace-dependency-declarations/application/model/workspace-dependency-policy.d.ts.map +1 -0
  56. package/dist/capabilities/workspace-dependency-declarations/application/model/workspace-dependency-policy.js +2 -0
  57. package/dist/capabilities/workspace-dependency-declarations/application/model/workspace-dependency-policy.js.map +1 -0
  58. package/dist/capabilities/workspace-dependency-declarations/application/model/workspace-snapshot.d.ts +1 -26
  59. package/dist/capabilities/workspace-dependency-declarations/application/model/workspace-snapshot.d.ts.map +1 -1
  60. package/dist/capabilities/workspace-dependency-declarations/application/model/workspace-snapshot.js +1 -6
  61. package/dist/capabilities/workspace-dependency-declarations/application/model/workspace-snapshot.js.map +1 -1
  62. package/dist/capabilities/workspace-dependency-declarations/application/policies/evaluate-workspace-dependencies.d.ts +2 -2
  63. package/dist/capabilities/workspace-dependency-declarations/application/policies/evaluate-workspace-dependencies.d.ts.map +1 -1
  64. package/dist/capabilities/workspace-dependency-declarations/application/policies/evaluate-workspace-dependencies.js +6 -6
  65. package/dist/capabilities/workspace-dependency-declarations/application/policies/evaluate-workspace-dependencies.js.map +1 -1
  66. package/dist/capabilities/workspace-dependency-declarations/application/ports/workspace-reader.d.ts +1 -1
  67. package/dist/capabilities/workspace-dependency-declarations/application/ports/workspace-reader.d.ts.map +1 -1
  68. package/dist/capabilities/workspace-dependency-declarations/contract/config.d.ts +6 -15
  69. package/dist/capabilities/workspace-dependency-declarations/contract/config.d.ts.map +1 -1
  70. package/dist/capabilities/workspace-dependency-declarations/contract/config.js +16 -1
  71. package/dist/capabilities/workspace-dependency-declarations/contract/config.js.map +1 -1
  72. package/dist/capabilities/workspace-dependency-declarations/module.d.ts +2 -0
  73. package/dist/capabilities/workspace-dependency-declarations/module.d.ts.map +1 -1
  74. package/dist/capabilities/workspace-dependency-declarations/module.js +4 -2
  75. package/dist/capabilities/workspace-dependency-declarations/module.js.map +1 -1
  76. package/dist/capability-runtime.d.ts +1 -5
  77. package/dist/capability-runtime.d.ts.map +1 -1
  78. package/dist/capability-runtime.js +4 -4
  79. package/dist/capability-runtime.js.map +1 -1
  80. package/dist/check-contract.d.ts +3 -2
  81. package/dist/check-contract.d.ts.map +1 -1
  82. package/dist/check-runner.d.ts +0 -2
  83. package/dist/check-runner.d.ts.map +1 -1
  84. package/dist/check-runner.js +5 -11
  85. package/dist/check-runner.js.map +1 -1
  86. package/dist/cli.js +46 -13
  87. package/dist/cli.js.map +1 -1
  88. package/dist/composition/capability-registry.d.ts.map +1 -1
  89. package/dist/composition/capability-registry.js +2 -0
  90. package/dist/composition/capability-registry.js.map +1 -1
  91. package/dist/composition/rule-registry.d.ts +8 -0
  92. package/dist/composition/rule-registry.d.ts.map +1 -0
  93. package/dist/composition/rule-registry.js +7 -0
  94. package/dist/composition/rule-registry.js.map +1 -0
  95. package/dist/filesystem-path-safety.d.ts +2 -0
  96. package/dist/filesystem-path-safety.d.ts.map +1 -0
  97. package/dist/filesystem-path-safety.js +19 -0
  98. package/dist/filesystem-path-safety.js.map +1 -0
  99. package/dist/foundation-config.d.ts +11 -13
  100. package/dist/foundation-config.d.ts.map +1 -1
  101. package/dist/foundation-config.js +52 -3
  102. package/dist/foundation-config.js.map +1 -1
  103. package/dist/local-mode/adapters/outbound/time/system-clock.d.ts +2 -0
  104. package/dist/local-mode/adapters/outbound/time/system-clock.d.ts.map +1 -0
  105. package/dist/local-mode/adapters/outbound/time/system-clock.js +4 -0
  106. package/dist/local-mode/adapters/outbound/time/system-clock.js.map +1 -0
  107. package/dist/local-mode/consumer-policy.js +1 -1
  108. package/dist/local-mode/consumer-policy.js.map +1 -1
  109. package/dist/local-mode/service.d.ts +1 -1
  110. package/dist/local-mode/service.d.ts.map +1 -1
  111. package/dist/local-mode/service.js +1 -1
  112. package/dist/local-mode/service.js.map +1 -1
  113. package/dist/package-self-check.d.ts +1 -0
  114. package/dist/package-self-check.d.ts.map +1 -1
  115. package/dist/package-self-check.js +25 -20
  116. package/dist/package-self-check.js.map +1 -1
  117. package/dist/schema-catalog.d.ts +2 -2
  118. package/dist/schema-catalog.d.ts.map +1 -1
  119. package/dist/schema-catalog.js +3 -2
  120. package/dist/schema-catalog.js.map +1 -1
  121. package/dist/strict-yaml.d.ts +0 -2
  122. package/dist/strict-yaml.d.ts.map +1 -1
  123. package/dist/strict-yaml.js +16 -3
  124. package/dist/strict-yaml.js.map +1 -1
  125. package/dist/workspace-inventory/adapters/outbound/pnpm/pnpm-workspace-inventory-reader.d.ts +6 -0
  126. package/dist/workspace-inventory/adapters/outbound/pnpm/pnpm-workspace-inventory-reader.d.ts.map +1 -0
  127. package/dist/workspace-inventory/adapters/outbound/pnpm/pnpm-workspace-inventory-reader.js +288 -0
  128. package/dist/workspace-inventory/adapters/outbound/pnpm/pnpm-workspace-inventory-reader.js.map +1 -0
  129. package/dist/workspace-inventory/application/model/workspace-inventory.d.ts +38 -0
  130. package/dist/workspace-inventory/application/model/workspace-inventory.d.ts.map +1 -0
  131. package/dist/workspace-inventory/application/model/workspace-inventory.js +7 -0
  132. package/dist/workspace-inventory/application/model/workspace-inventory.js.map +1 -0
  133. package/dist/workspace-inventory/application/ports/workspace-inventory-reader.d.ts +5 -0
  134. package/dist/workspace-inventory/application/ports/workspace-inventory-reader.d.ts.map +1 -0
  135. package/dist/workspace-inventory/application/ports/workspace-inventory-reader.js +2 -0
  136. package/dist/workspace-inventory/application/ports/workspace-inventory-reader.js.map +1 -0
  137. package/package.json +5 -1
  138. package/presets/oxlint/base.json +2 -0
  139. package/presets/oxlint/type-aware.json +39 -0
  140. package/schemas/architecture-source-dependencies/v1.schema.json +97 -0
  141. package/schemas/foundation-config/v1.schema.json +10 -0
package/README.md CHANGED
@@ -23,6 +23,8 @@ schemaVersion: 1
23
23
  project:
24
24
  id: consumer-repository
25
25
  capabilities:
26
+ architecture.source-dependencies:
27
+ configPath: architecture/foundation/source-dependencies.yaml
26
28
  workspace.dependency-declarations:
27
29
  configPath: architecture/foundation/dependency-declarations.yaml
28
30
  ```
@@ -33,5 +35,7 @@ and `agent-teams-foundation explain <rule-id>` for rule guidance.
33
35
 
34
36
  TypeScript consumers may extend
35
37
  `@agent-teams/engineering-foundation/presets/typescript/node.json`. Oxlint JSON
36
- configuration extends
37
- `./node_modules/@agent-teams/engineering-foundation/presets/oxlint/node.json`.
38
+ configuration extends the fast
39
+ `./node_modules/@agent-teams/engineering-foundation/presets/oxlint/node.json`
40
+ or type-aware `type-aware.json` preset. TypeScript remains the separate typecheck
41
+ authority.
@@ -0,0 +1,6 @@
1
+ import type { SourceFileSnapshot } from "../../../application/model/source-workspace.js";
2
+ import type { SourceTreeReader } from "../../../application/ports/source-tree-reader.js";
3
+ export declare class FilesystemSourceTreeReader implements SourceTreeReader {
4
+ read(consumerRoot: string, governedRoots: readonly string[], signal?: AbortSignal): Promise<readonly SourceFileSnapshot[]>;
5
+ }
6
+ //# sourceMappingURL=filesystem-source-tree-reader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filesystem-source-tree-reader.d.ts","sourceRoot":"","sources":["../../../../../../src/capabilities/source-dependencies/adapters/outbound/filesystem/filesystem-source-tree-reader.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AACzF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AAyLzF,qBAAa,0BAA2B,YAAW,gBAAgB;IAC3D,IAAI,CACR,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,SAAS,MAAM,EAAE,EAChC,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,SAAS,kBAAkB,EAAE,CAAC,CAcxC;CACF"}
@@ -0,0 +1,133 @@
1
+ import { lstat, opendir, readFile, realpath, stat } from "node:fs/promises";
2
+ import { isAbsolute, join, posix, relative, resolve, sep } from "node:path";
3
+ import { CapabilityInputError } from "../../../../../capability-runtime.js";
4
+ import { pathTraversesSymbolicLink } from "../../../../../filesystem-path-safety.js";
5
+ import { assertNotCancelled, assertRepositoryRelativePath } from "../../../../../strict-yaml.js";
6
+ const SOURCE_EXTENSIONS = new Set([
7
+ ".cjs",
8
+ ".cts",
9
+ ".js",
10
+ ".jsx",
11
+ ".mjs",
12
+ ".mts",
13
+ ".ts",
14
+ ".tsx"
15
+ ]);
16
+ const MAX_SOURCE_FILE_BYTES = 4 * 1024 * 1024;
17
+ const MAX_SOURCE_FILES = 100_000;
18
+ const MAX_TOTAL_SOURCE_BYTES = 512 * 1024 * 1024;
19
+ const READ_CONCURRENCY = 32;
20
+ function inputError(code, message, phase) {
21
+ throw new CapabilityInputError({ code, message, phase, retryable: false });
22
+ }
23
+ function toPosixPath(path) {
24
+ return path.split(sep).join("/");
25
+ }
26
+ function portablePathIdentity(path) {
27
+ return path.normalize("NFC").toLocaleLowerCase("en-US");
28
+ }
29
+ function isContained(parent, candidate) {
30
+ const relation = relative(parent, candidate);
31
+ return (relation === "" ||
32
+ (!isAbsolute(relation) && relation !== ".." && !relation.startsWith(`..${sep}`)));
33
+ }
34
+ async function containedDirectory(canonicalRoot, repositoryPath) {
35
+ assertRepositoryRelativePath(repositoryPath, "source-discovery");
36
+ const candidate = resolve(canonicalRoot, repositoryPath);
37
+ if (await pathTraversesSymbolicLink(canonicalRoot, candidate)) {
38
+ inputError("SOURCE_SYMLINK_PROHIBITED", `Governed source roots cannot be symbolic links: ${repositoryPath}.`, "source-discovery");
39
+ }
40
+ let canonicalCandidate;
41
+ try {
42
+ canonicalCandidate = await realpath(candidate);
43
+ }
44
+ catch {
45
+ inputError("SOURCE_DIRECTORY_UNAVAILABLE", `Required source directory is unavailable: ${repositoryPath}.`, "source-discovery");
46
+ }
47
+ if (!isContained(canonicalRoot, canonicalCandidate)) {
48
+ inputError("SOURCE_DIRECTORY_ESCAPE", `Source directory escapes the consumer repository: ${repositoryPath}.`, "source-discovery");
49
+ }
50
+ if (!(await stat(canonicalCandidate)).isDirectory()) {
51
+ inputError("SOURCE_DIRECTORY_INVALID", `Source path must be a directory: ${repositoryPath}.`, "source-discovery");
52
+ }
53
+ return canonicalCandidate;
54
+ }
55
+ async function discoverSourcePaths(canonicalRoot, governedRoots, signal) {
56
+ const paths = [];
57
+ for (const governedRoot of governedRoots) {
58
+ const absoluteSourceRoot = await containedDirectory(canonicalRoot, governedRoot);
59
+ const directories = [absoluteSourceRoot];
60
+ while (directories.length > 0) {
61
+ assertNotCancelled(signal);
62
+ const directoryPath = directories.pop();
63
+ if (directoryPath === undefined) {
64
+ break;
65
+ }
66
+ const directory = await opendir(directoryPath);
67
+ for await (const entry of directory) {
68
+ assertNotCancelled(signal);
69
+ const absoluteEntry = join(directoryPath, entry.name);
70
+ if (entry.isSymbolicLink()) {
71
+ inputError("SOURCE_SYMLINK_PROHIBITED", `Source trees cannot contain symbolic links: ${toPosixPath(relative(canonicalRoot, absoluteEntry))}.`, "source-discovery");
72
+ }
73
+ if (entry.isDirectory()) {
74
+ directories.push(absoluteEntry);
75
+ }
76
+ else if (entry.isFile() && SOURCE_EXTENSIONS.has(posix.extname(entry.name))) {
77
+ paths.push(toPosixPath(relative(canonicalRoot, absoluteEntry)));
78
+ if (paths.length > MAX_SOURCE_FILES) {
79
+ inputError("SOURCE_FILE_LIMIT_EXCEEDED", `Governed source contains more than ${MAX_SOURCE_FILES} files.`, "source-discovery");
80
+ }
81
+ }
82
+ }
83
+ }
84
+ }
85
+ const uniquePaths = [...new Set(paths)].toSorted();
86
+ const caseFoldedPaths = new Map();
87
+ for (const path of uniquePaths) {
88
+ const caseFolded = portablePathIdentity(path);
89
+ const existing = caseFoldedPaths.get(caseFolded);
90
+ if (existing !== undefined && existing !== path) {
91
+ inputError("SOURCE_PATH_CASE_COLLISION", `Source paths differ only by letter case: ${existing} and ${path}.`, "source-discovery");
92
+ }
93
+ caseFoldedPaths.set(caseFolded, path);
94
+ }
95
+ return uniquePaths;
96
+ }
97
+ async function readSourceFiles(canonicalRoot, paths, signal) {
98
+ const files = [];
99
+ let totalBytes = 0;
100
+ for (let index = 0; index < paths.length; index += READ_CONCURRENCY) {
101
+ const loaded = await Promise.all(paths.slice(index, index + READ_CONCURRENCY).map(async (path) => {
102
+ assertNotCancelled(signal);
103
+ const absolutePath = resolve(canonicalRoot, path);
104
+ const metadata = await lstat(absolutePath);
105
+ if (!metadata.isFile() ||
106
+ metadata.isSymbolicLink() ||
107
+ metadata.size > MAX_SOURCE_FILE_BYTES) {
108
+ inputError("SOURCE_FILE_INVALID", `Source must be a regular file no larger than ${MAX_SOURCE_FILE_BYTES} bytes: ${path}.`, "source-read");
109
+ }
110
+ const source = await readFile(absolutePath, "utf8");
111
+ if (source.includes("\0")) {
112
+ inputError("SOURCE_FILE_INVALID", `Source file contains prohibited NUL bytes: ${path}.`, "source-read");
113
+ }
114
+ return { path, source, bytes: metadata.size };
115
+ }));
116
+ for (const file of loaded) {
117
+ totalBytes += file.bytes;
118
+ if (totalBytes > MAX_TOTAL_SOURCE_BYTES) {
119
+ inputError("SOURCE_SIZE_LIMIT_EXCEEDED", `Governed source exceeds ${MAX_TOTAL_SOURCE_BYTES} bytes.`, "source-read");
120
+ }
121
+ files.push({ path: file.path, source: file.source });
122
+ }
123
+ }
124
+ return files;
125
+ }
126
+ export class FilesystemSourceTreeReader {
127
+ async read(consumerRoot, governedRoots, signal) {
128
+ assertNotCancelled(signal);
129
+ const canonicalRoot = await realpath(consumerRoot).catch(() => inputError("CONSUMER_ROOT_UNAVAILABLE", "Consumer root must be an existing accessible directory.", "source-workspace"));
130
+ return readSourceFiles(canonicalRoot, await discoverSourcePaths(canonicalRoot, governedRoots, signal), signal);
131
+ }
132
+ }
133
+ //# sourceMappingURL=filesystem-source-tree-reader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filesystem-source-tree-reader.js","sourceRoot":"","sources":["../../../../../../src/capabilities/source-dependencies/adapters/outbound/filesystem/filesystem-source-tree-reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAE5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AACrF,OAAO,EACL,kBAAkB,EAClB,4BAA4B,EAC7B,MAAM,+BAA+B,CAAC;AAIvC,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IAChC,MAAM;IACN,MAAM;IACN,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,KAAK;IACL,MAAM;CACP,CAAC,CAAC;AACH,MAAM,qBAAqB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAC9C,MAAM,gBAAgB,GAAG,OAAO,CAAC;AACjC,MAAM,sBAAsB,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;AACjD,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B,SAAS,UAAU,CAAC,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AC1B,UAAU,IAAI,IAAI,CAAC,KAAK,CAAC;YACzB,IAAI,UAAU,GAAG,sBAAsB,EAAE,CAAC;gBACxC,UAAU,CACR,4BAA4B,EAC5B,2BAA2B,sBAAsB,SAAS,EAC1D,aAAa,CACd,CAAC;YACJ,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,OAAO,0BAA0B;IACrC,KAAK,CAAC,IAAI,CACR,YAAoB,EACpB,aAAgC,EAChC,MAAoB;QAEpB,kBAAkB,CAAC,MAAM,CAAC,CAAC;QAC3B,MAAM,aAAa,GAAG,MAAM,QAAQ,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAC5D,UAAU,CACR,2BAA2B,EAC3B,yDAAyD,EACzD,kBAAkB,CACnB,CACF,CAAC;QACF,OAAO,eAAe,CACpB,aAAa,EACb,MAAM,mBAAmB,CAAC,aAAa,EAAE,aAAa,EAAE,MAAM,CAAC,EAC/D,MAAM,CACP,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,6 @@
1
+ import type { ResolvedSourceDependency } from "../../../application/model/source-workspace.js";
2
+ import type { ResolveSourceDependencyInput, SourceDependencyResolver } from "../../../application/ports/source-dependency-resolver.js";
3
+ export declare class NodeSourceDependencyResolver implements SourceDependencyResolver {
4
+ resolve(input: ResolveSourceDependencyInput): ResolvedSourceDependency;
5
+ }
6
+ //# sourceMappingURL=node-source-dependency-resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-source-dependency-resolver.d.ts","sourceRoot":"","sources":["../../../../../../src/capabilities/source-dependencies/adapters/outbound/node/node-source-dependency-resolver.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,wBAAwB,EACzB,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EACV,4BAA4B,EAC5B,wBAAwB,EACzB,MAAM,0DAA0D,CAAC;AAmLlE,qBAAa,4BAA6B,YAAW,wBAAwB;IAC3E,OAAO,CAAC,KAAK,EAAE,4BAA4B,GAAG,wBAAwB,CAIrE;CACF"}
@@ -0,0 +1,151 @@
1
+ import { builtinModules } from "node:module";
2
+ import { posix } from "node:path";
3
+ const BUILTINS = new Set(builtinModules.flatMap((name) => [
4
+ name,
5
+ name.startsWith("node:") ? name.slice(5) : `node:${name}`
6
+ ]));
7
+ const SOURCE_EXTENSIONS = [
8
+ ".cjs",
9
+ ".cts",
10
+ ".js",
11
+ ".jsx",
12
+ ".mjs",
13
+ ".mts",
14
+ ".ts",
15
+ ".tsx"
16
+ ];
17
+ function packageNameFromSpecifier(specifier) {
18
+ if (specifier.startsWith("@")) {
19
+ const segments = specifier.split("/");
20
+ return segments.length >= 2 && segments[0] !== "" && segments[1] !== ""
21
+ ? `${segments[0]}/${segments[1]}`
22
+ : undefined;
23
+ }
24
+ const [name] = specifier.split("/");
25
+ return name === undefined || name.length === 0 ? undefined : name;
26
+ }
27
+ function declarationKind(declarations, packageName) {
28
+ const matching = declarations.filter((declaration) => declaration.dependencyName === packageName);
29
+ if (matching.some((declaration) => declaration.section === "dependencies" ||
30
+ declaration.section === "optionalDependencies" ||
31
+ declaration.section === "peerDependencies")) {
32
+ return "runtime";
33
+ }
34
+ return matching.some((declaration) => declaration.section === "devDependencies")
35
+ ? "development"
36
+ : "undeclared";
37
+ }
38
+ function candidateLocalPaths(importerPath, specifier) {
39
+ const base = posix.normalize(posix.join(posix.dirname(importerPath), specifier));
40
+ const extension = posix.extname(base);
41
+ const candidates = new Set([base]);
42
+ if (extension === ".js") {
43
+ candidates.add(`${base.slice(0, -3)}.ts`);
44
+ candidates.add(`${base.slice(0, -3)}.tsx`);
45
+ }
46
+ else if (extension === ".mjs") {
47
+ candidates.add(`${base.slice(0, -4)}.mts`);
48
+ }
49
+ else if (extension === ".cjs") {
50
+ candidates.add(`${base.slice(0, -4)}.cts`);
51
+ }
52
+ else if (extension.length === 0) {
53
+ for (const sourceExtension of SOURCE_EXTENSIONS) {
54
+ candidates.add(`${base}${sourceExtension}`);
55
+ candidates.add(posix.join(base, `index${sourceExtension}`));
56
+ }
57
+ }
58
+ return [...candidates];
59
+ }
60
+ function pathInside(path, root) {
61
+ return root === "." || path === root || path.startsWith(`${root}/`);
62
+ }
63
+ function containingPackage(path, packages) {
64
+ return packages
65
+ .filter((workspacePackage) => pathInside(path, workspacePackage.rootPath))
66
+ .toSorted((left, right) => right.rootPath.length - left.rootPath.length ||
67
+ left.name.localeCompare(right.name))[0];
68
+ }
69
+ function matchesExport(entry, subpath) {
70
+ if (!entry.subpath.includes("*")) {
71
+ return entry.subpath === subpath;
72
+ }
73
+ const [prefix, suffix] = entry.subpath.split("*");
74
+ return (prefix !== undefined &&
75
+ suffix !== undefined &&
76
+ subpath.startsWith(prefix) &&
77
+ subpath.endsWith(suffix) &&
78
+ subpath.length >= prefix.length + suffix.length);
79
+ }
80
+ function subpathExported(target, subpath) {
81
+ if (!target.exportSurface.explicit) {
82
+ return false;
83
+ }
84
+ const matching = target.exportSurface.entries
85
+ .filter((entry) => matchesExport(entry, subpath))
86
+ .toSorted((left, right) => {
87
+ const leftExact = left.subpath.includes("*") ? 0 : 1;
88
+ const rightExact = right.subpath.includes("*") ? 0 : 1;
89
+ return rightExact - leftExact || right.subpath.length - left.subpath.length;
90
+ });
91
+ return matching[0]?.availability === "available";
92
+ }
93
+ function resolveLocal(input) {
94
+ if (input.reference.specifier.includes("?") || input.reference.specifier.includes("#")) {
95
+ return {
96
+ kind: "unsupported",
97
+ reason: "relative specifiers with query strings or fragments are unsupported"
98
+ };
99
+ }
100
+ const matching = candidateLocalPaths(input.file.path, input.reference.specifier).filter((path) => input.governedFilePaths.has(path));
101
+ if (matching.length !== 1) {
102
+ return {
103
+ kind: "unresolved",
104
+ reason: `local reference resolved to ${matching.length} governed files`
105
+ };
106
+ }
107
+ const path = matching[0];
108
+ const workspacePackage = path === undefined
109
+ ? undefined
110
+ : containingPackage(path, input.inventory.packages);
111
+ return path === undefined || workspacePackage === undefined
112
+ ? { kind: "unresolved", reason: "local target has no workspace package" }
113
+ : { kind: "local-file", path, workspacePackage };
114
+ }
115
+ function resolvePackage(input) {
116
+ const specifier = input.reference.specifier;
117
+ if (BUILTINS.has(specifier)) {
118
+ return {
119
+ kind: "builtin",
120
+ specifier: specifier.startsWith("node:") ? specifier : `node:${specifier}`
121
+ };
122
+ }
123
+ if (specifier.startsWith("#") || specifier.startsWith("/") || specifier.includes(":")) {
124
+ return { kind: "unsupported", reason: "unsupported package or URL specifier" };
125
+ }
126
+ const packageName = packageNameFromSpecifier(specifier);
127
+ if (packageName === undefined) {
128
+ return { kind: "unsupported", reason: "invalid package specifier" };
129
+ }
130
+ const target = input.inventory.packages.find((workspacePackage) => workspacePackage.name === packageName);
131
+ const declaration = declarationKind(input.file.workspacePackage.dependencies, packageName);
132
+ if (target === undefined) {
133
+ return { kind: "external-package", packageName, declaration };
134
+ }
135
+ const subpath = specifier === packageName ? "." : `.${specifier.slice(packageName.length)}`;
136
+ return {
137
+ kind: "workspace-package",
138
+ workspacePackage: target,
139
+ declaration,
140
+ exported: subpathExported(target, subpath),
141
+ subpath
142
+ };
143
+ }
144
+ export class NodeSourceDependencyResolver {
145
+ resolve(input) {
146
+ return input.reference.specifier.startsWith(".")
147
+ ? resolveLocal(input)
148
+ : resolvePackage(input);
149
+ }
150
+ }
151
+ //# sourceMappingURL=node-source-dependency-resolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-source-dependency-resolver.js","sourceRoot":"","sources":["../../../../../../src/capabilities/source-dependencies/adapters/outbound/node/node-source-dependency-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAelC,MAAM,QAAQ,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,UAAU,CAAC,GAAG,CAAC;YAC9C,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC;YACrB,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;CACF"}
@@ -0,0 +1,6 @@
1
+ import type { ParsedSourceDependencies, SourceFileSnapshot } from "../../../application/model/source-workspace.js";
2
+ import type { SourceDependencyParser } from "../../../application/ports/source-dependency-parser.js";
3
+ export declare class OxcSourceDependencyParser implements SourceDependencyParser {
4
+ parse(file: SourceFileSnapshot): ParsedSourceDependencies;
5
+ }
6
+ //# sourceMappingURL=oxc-source-dependency-parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oxc-source-dependency-parser.d.ts","sourceRoot":"","sources":["../../../../../../src/capabilities/source-dependencies/adapters/outbound/oxc/oxc-source-dependency-parser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,wBAAwB,EAGxB,kBAAkB,EAEnB,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wDAAwD,CAAC;AAkBrG,qBAAa,yBAA0B,YAAW,sBAAsB;IACtE,KAAK,CAAC,IAAI,EAAE,kBAAkB,GAAG,wBAAwB,CAoGxD;CACF"}
@@ -0,0 +1,96 @@
1
+ import { parseSync, Visitor } from "oxc-parser";
2
+ function reference(kind, literal) {
3
+ return typeof literal.value === "string"
4
+ ? { kind, specifier: literal.value, start: literal.start, end: literal.end }
5
+ : undefined;
6
+ }
7
+ function unresolved(kind, node) {
8
+ return { kind, start: node.start, end: node.end };
9
+ }
10
+ export class OxcSourceDependencyParser {
11
+ parse(file) {
12
+ const parsed = parseSync(file.path, file.source, { astType: "ts" });
13
+ if (parsed.errors.length > 0) {
14
+ return {
15
+ parseErrorCount: parsed.errors.length,
16
+ references: [],
17
+ unresolved: []
18
+ };
19
+ }
20
+ const references = [];
21
+ const unresolvedReferences = [];
22
+ const addReference = (kind, literal) => {
23
+ const candidate = reference(kind, literal);
24
+ if (candidate !== undefined) {
25
+ references.push(candidate);
26
+ }
27
+ };
28
+ const visitor = new Visitor({
29
+ CallExpression(node) {
30
+ if (node.callee.type !== "Identifier" || node.callee.name !== "require") {
31
+ return;
32
+ }
33
+ const argument = node.arguments[0];
34
+ if (argument?.type === "Literal" && typeof argument.value === "string") {
35
+ addReference("commonjs", argument);
36
+ }
37
+ else {
38
+ unresolvedReferences.push(unresolved("commonjs", node));
39
+ }
40
+ },
41
+ ExportAllDeclaration(node) {
42
+ addReference(node.exportKind === "type" ? "export-type" : "export", node.source);
43
+ },
44
+ ExportNamedDeclaration(node) {
45
+ if (node.source === null) {
46
+ return;
47
+ }
48
+ const typeOnly = node.exportKind === "type" ||
49
+ (node.specifiers.length > 0 &&
50
+ node.specifiers.every((specifier) => specifier.exportKind === "type"));
51
+ addReference(typeOnly ? "export-type" : "export", node.source);
52
+ },
53
+ ImportDeclaration(node) {
54
+ const typeOnly = node.importKind === "type" ||
55
+ (node.specifiers.length > 0 &&
56
+ node.specifiers.every((specifier) => specifier.type === "ImportSpecifier" &&
57
+ specifier.importKind === "type"));
58
+ addReference(typeOnly ? "static-type" : "static", node.source);
59
+ },
60
+ ImportExpression(node) {
61
+ if (node.source.type === "Literal" && typeof node.source.value === "string") {
62
+ addReference("dynamic", node.source);
63
+ }
64
+ else {
65
+ unresolvedReferences.push(unresolved("dynamic", node));
66
+ }
67
+ },
68
+ TSImportEqualsDeclaration(node) {
69
+ if (node.moduleReference.type !== "TSExternalModuleReference") {
70
+ return;
71
+ }
72
+ const expression = node.moduleReference.expression;
73
+ if (typeof expression.value === "string") {
74
+ addReference(node.importKind === "type" ? "import-equals-type" : "import-equals", expression);
75
+ }
76
+ },
77
+ TSImportType(node) {
78
+ if (typeof node.source.value === "string") {
79
+ addReference("type-query", node.source);
80
+ }
81
+ else {
82
+ unresolvedReferences.push(unresolved("type-query", node));
83
+ }
84
+ }
85
+ });
86
+ visitor.visit(parsed.program);
87
+ return {
88
+ parseErrorCount: 0,
89
+ references: references.toSorted((left, right) => left.start - right.start ||
90
+ left.kind.localeCompare(right.kind) ||
91
+ left.specifier.localeCompare(right.specifier)),
92
+ unresolved: unresolvedReferences.toSorted((left, right) => left.start - right.start || left.kind.localeCompare(right.kind))
93
+ };
94
+ }
95
+ }
96
+ //# sourceMappingURL=oxc-source-dependency-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oxc-source-dependency-parser.js","sourceRoot":"","sources":["../../../../../../src/capabilities/source-dependencies/adapters/outbound/oxc/oxc-source-dependency-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAWhD,SAAS,SAAS,CAChB,IAA0B,EAC1B,OAAkF;IAElF,OAAO,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ;QACtC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;QAC5E,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAED,SAAS,UAAU,CACjB,IAAwC,EACxC,IAAsD;IAEtD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC;AACpD,CAAC;AAED,MAAM,OAAO,yBAAyB;IACpC,KAAK,CAAC,IAAwB;QAC5B,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QACpE,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC7B,OAAO;gBACL,eAAe,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM;gBACrC,UAAU,EAAE,EAAE;gBACd,UAAU,EAAE,EAAE;aACf,CAAC;QACJ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C,UAAU,CAAC;gBACnD,IAAI,OAAO,UAAU,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;oBACzC,YAAY,CACV,IAAI,CAAC,UAAU,KAAK,MAAM,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,eAAe,EACnE,UAAU,CACX,CAAC;gBACJ,CAAC;YACH,CAAC;YACD,YAAY,CAAC,IAAI;gBACf,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;oBAC1C,YAAY,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;gBAC1C,CAAC;qBAAM,CAAC;oBACN,oBAAoB,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC;gBAC5D,CAAC;YACH,CAAC;SACF,CAAC,CAAC;QACH,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC9B,OAAO;YACL,eAAe,EAAE,CAAC;YAClB,UAAU,EAAE,UAAU,CAAC,QAAQ,CAC7B,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CACd,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK;gBACxB,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC;gBACnC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,KAAK,CAAC,SAAS,CAAC,CAChD;YACD,UAAU,EAAE,oBAAoB,CAAC,QAAQ,CACvC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CACjF;SACF,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,69 @@
1
+ import type { WorkspacePackage } from "../../../../workspace-inventory/application/model/workspace-inventory.js";
2
+ declare const SOURCE_DEPENDENCY_KINDS: readonly ["commonjs", "dynamic", "export", "export-type", "import-equals", "import-equals-type", "static", "static-type", "type-query"];
3
+ export type SourceDependencyKind = (typeof SOURCE_DEPENDENCY_KINDS)[number];
4
+ export interface SourceDependencyReference {
5
+ readonly kind: SourceDependencyKind;
6
+ readonly specifier: string;
7
+ readonly start: number;
8
+ readonly end: number;
9
+ }
10
+ export interface UnresolvedSourceDependency {
11
+ readonly kind: "commonjs" | "dynamic" | "type-query";
12
+ readonly start: number;
13
+ readonly end: number;
14
+ }
15
+ export interface ParsedSourceDependencies {
16
+ readonly parseErrorCount: number;
17
+ readonly references: readonly SourceDependencyReference[];
18
+ readonly unresolved: readonly UnresolvedSourceDependency[];
19
+ }
20
+ export interface SourceFileSnapshot {
21
+ readonly path: string;
22
+ readonly source: string;
23
+ }
24
+ interface ParsedSourceFile extends SourceFileSnapshot {
25
+ readonly parsed: ParsedSourceDependencies;
26
+ }
27
+ export interface ArchitectureBoundaryPolicy {
28
+ readonly id: string;
29
+ readonly roots: readonly string[];
30
+ readonly allowedBoundaries: readonly string[];
31
+ readonly allowedPackages: readonly string[];
32
+ readonly allowedBuiltins: readonly string[];
33
+ readonly allowedRuntimeReferences: readonly UnresolvedSourceDependency["kind"][];
34
+ }
35
+ export interface SourceArchitecturePolicy {
36
+ readonly workspaceManifestPath: "pnpm-workspace.yaml";
37
+ readonly governedRoots: readonly string[];
38
+ readonly boundaries: readonly ArchitectureBoundaryPolicy[];
39
+ }
40
+ export interface ClassifiedSourceFile extends ParsedSourceFile {
41
+ readonly boundary: ArchitectureBoundaryPolicy;
42
+ readonly workspacePackage: WorkspacePackage;
43
+ }
44
+ export type ResolvedSourceDependency = {
45
+ readonly kind: "builtin";
46
+ readonly specifier: string;
47
+ } | {
48
+ readonly kind: "external-package";
49
+ readonly packageName: string;
50
+ readonly declaration: "development" | "runtime" | "undeclared";
51
+ } | {
52
+ readonly kind: "local-file";
53
+ readonly path: string;
54
+ readonly workspacePackage: WorkspacePackage;
55
+ } | {
56
+ readonly kind: "unsupported";
57
+ readonly reason: string;
58
+ } | {
59
+ readonly kind: "unresolved";
60
+ readonly reason: string;
61
+ } | {
62
+ readonly kind: "workspace-package";
63
+ readonly workspacePackage: WorkspacePackage;
64
+ readonly declaration: "development" | "runtime" | "undeclared";
65
+ readonly exported: boolean;
66
+ readonly subpath: string;
67
+ };
68
+ export {};
69
+ //# sourceMappingURL=source-workspace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-workspace.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/source-dependencies/application/model/source-workspace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0EAA0E,CAAC;AAEjH,QAAA,MAAM,uBAAuB,YAC3B,UAAU,EACV,SAAS,EACT,QAAQ,EACR,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,QAAQ,EACR,aAAa,EACb,YAAY,CACJ,CAAC;AAEX,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5E,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,GAAG,YAAY,CAAC;IACrD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,SAAS,yBAAyB,EAAE,CAAC;IAC1D,QAAQ,CAAC,UAAU,EAAE,SAAS,0BAA0B,EAAE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GACD;IACE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;CAC7C,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACnC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C,QAAQ,CAAC,WAAW,EAAE,aAAa,GAAG,SAAS,GAAG,YAAY,CAAC;IAC/D,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC"}
@@ -0,0 +1,13 @@
1
+ const SOURCE_DEPENDENCY_KINDS = [
2
+ "commonjs",
3
+ "dynamic",
4
+ "export",
5
+ "export-type",
6
+ "import-equals",
7
+ "import-equals-type",
8
+ "static",
9
+ "static-type",
10
+ "type-query"
11
+ ];
12
+ export {};
13
+ //# sourceMappingURL=source-workspace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-workspace.js","sourceRoot":"","sources":["../../../../../src/capabilities/source-dependencies/application/model/source-workspace.ts"],"names":[],"mappings":"AAEA,MAAM,uBAAuB,GAAG;IAC9B,UAAU;IACV,SAAS;IACT,QAAQ;IACR,aAAa;IACb,eAAe;IACf,oBAAoB;IACpB,QAAQ;IACR,aAAa;IACb,YAAY;CACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { FoundationDiagnostic } from "../../../../check-contract.js";
2
+ import type { WorkspaceInventory } from "../../../../workspace-inventory/application/model/workspace-inventory.js";
3
+ import type { ClassifiedSourceFile, SourceArchitecturePolicy, SourceFileSnapshot } from "../model/source-workspace.js";
4
+ import type { SourceDependencyResolver } from "../ports/source-dependency-resolver.js";
5
+ interface EvaluationInput {
6
+ readonly policy: SourceArchitecturePolicy;
7
+ readonly inventory: WorkspaceInventory;
8
+ readonly allSourceFiles: readonly SourceFileSnapshot[];
9
+ readonly classifiedFiles: readonly ClassifiedSourceFile[];
10
+ readonly resolver: SourceDependencyResolver;
11
+ }
12
+ export declare function evaluateSourceDependencies(input: EvaluationInput): readonly FoundationDiagnostic[];
13
+ export {};
14
+ //# sourceMappingURL=evaluate-source-dependencies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluate-source-dependencies.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/source-dependencies/application/policies/evaluate-source-dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,oBAAoB,EACrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0EAA0E,CAAC;AACnH,OAAO,KAAK,EAEV,oBAAoB,EAEpB,wBAAwB,EAExB,kBAAkB,EACnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAMvF,UAAU,eAAe;IACvB,QAAQ,CAAC,MAAM,EAAE,wBAAwB,CAAC;IAC1C,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC;IACvC,QAAQ,CAAC,cAAc,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACvD,QAAQ,CAAC,eAAe,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAC1D,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC;CAC7C;AAqMD,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,eAAe,GACrB,SAAS,oBAAoB,EAAE,CAiEjC"}