@tryjourney/architecture 0.3.0 → 0.3.1
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/dist/deep.d.ts +2 -0
- package/dist/deep.js +31 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/deep.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { ArchitectureGraphV3, ArchitectureProposalSet, DeepScanResult } from "./types.js";
|
|
2
|
+
/** Keep generated and previously cached v3 graphs inside the shared API contract. */
|
|
3
|
+
export declare function normalizeArchitectureGraph(graph: ArchitectureGraphV3): ArchitectureGraphV3;
|
|
2
4
|
export declare function applyVerifiedProposals(root: string, base: ArchitectureGraphV3, proposals: ArchitectureProposalSet, analyzerVersion?: string): {
|
|
3
5
|
graph: ArchitectureGraphV3;
|
|
4
6
|
accepted: number;
|
package/dist/deep.js
CHANGED
|
@@ -13,6 +13,9 @@ const RULE_VERSION = "3.0.0";
|
|
|
13
13
|
const ID = /^[a-z0-9][a-z0-9:_-]{0,199}$/;
|
|
14
14
|
const CATEGORIES = ["manifest", "entry-point", "route", "import", "runtime-call", "deployment", "configuration", "documentation"];
|
|
15
15
|
const STRONG = new Set(["manifest", "entry-point", "route", "runtime-call", "deployment"]);
|
|
16
|
+
const MAX_EVIDENCE = 30;
|
|
17
|
+
const MAX_FILES = 100;
|
|
18
|
+
const MAX_DETAILS = 100;
|
|
16
19
|
const proposalSchema = {
|
|
17
20
|
type: "object",
|
|
18
21
|
additionalProperties: false,
|
|
@@ -93,6 +96,33 @@ function verifyEvidence(root, evidence) {
|
|
|
93
96
|
function normalizeEvidence(evidence, detector) {
|
|
94
97
|
return evidence.map((item) => ({ ...item, detector }));
|
|
95
98
|
}
|
|
99
|
+
function uniqueBounded(values, key, maximum) {
|
|
100
|
+
const seen = new Set();
|
|
101
|
+
return values.filter((value) => { const id = key(value); if (seen.has(id))
|
|
102
|
+
return false; seen.add(id); return true; }).slice(0, maximum);
|
|
103
|
+
}
|
|
104
|
+
function boundedEvidence(evidence) {
|
|
105
|
+
const assisted = evidence.filter((item) => item.detector === "codex-proposal");
|
|
106
|
+
const deterministic = evidence.filter((item) => item.detector !== "codex-proposal");
|
|
107
|
+
return uniqueBounded([...assisted, ...deterministic], (item) => `${item.path}\0${item.line}\0${item.end_line ?? ""}\0${item.category}`, MAX_EVIDENCE);
|
|
108
|
+
}
|
|
109
|
+
/** Keep generated and previously cached v3 graphs inside the shared API contract. */
|
|
110
|
+
export function normalizeArchitectureGraph(graph) {
|
|
111
|
+
const copy = structuredClone(graph);
|
|
112
|
+
copy.components = copy.components.map((component) => {
|
|
113
|
+
const evidence = boundedEvidence(component.evidence);
|
|
114
|
+
return {
|
|
115
|
+
...component,
|
|
116
|
+
technology: [...new Set(component.technology)].slice(0, 30),
|
|
117
|
+
evidence,
|
|
118
|
+
files: uniqueBounded([...evidence.map((item) => item.path), ...component.files], (value) => value, MAX_FILES),
|
|
119
|
+
details: uniqueBounded(component.details, (item) => JSON.stringify(item), MAX_DETAILS),
|
|
120
|
+
};
|
|
121
|
+
});
|
|
122
|
+
copy.connections = copy.connections.map((connection) => ({ ...connection, evidence: boundedEvidence(connection.evidence) }));
|
|
123
|
+
copy.analysis.incomplete_reasons = [...new Set(copy.analysis.incomplete_reasons)].slice(0, 50);
|
|
124
|
+
return copy;
|
|
125
|
+
}
|
|
96
126
|
function evidenceText(root, evidence) {
|
|
97
127
|
return evidence.map((item) => { try {
|
|
98
128
|
return readFileSync(resolve(root, item.path), "utf8");
|
|
@@ -206,7 +236,7 @@ export function applyVerifiedProposals(root, base, proposals, analyzerVersion) {
|
|
|
206
236
|
graph.analysis.incomplete_reasons = proposals.unresolved.map((item) => item.question).slice(0, 50);
|
|
207
237
|
graph.components.sort((a, b) => a.id.localeCompare(b.id));
|
|
208
238
|
graph.connections.sort((a, b) => a.id.localeCompare(b.id));
|
|
209
|
-
return { graph, accepted, rejected };
|
|
239
|
+
return { graph: normalizeArchitectureGraph(graph), accepted, rejected };
|
|
210
240
|
}
|
|
211
241
|
function codexVersion(root) {
|
|
212
242
|
try {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Change, Graph } from "./types.js";
|
|
2
2
|
export * from "./types.js";
|
|
3
|
-
export { applyVerifiedProposals, codexAnalyzerAvailability, deepScan } from "./deep.js";
|
|
3
|
+
export { applyVerifiedProposals, codexAnalyzerAvailability, deepScan, normalizeArchitectureGraph } from "./deep.js";
|
|
4
4
|
export declare function readExclusions(root: string): string[];
|
|
5
5
|
export declare function scan(root: string, extraExclusions?: string[]): Graph;
|
|
6
6
|
export declare function fingerprint(graph: Graph): string;
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { existsSync, lstatSync, readdirSync, readFileSync, statSync } from "node
|
|
|
4
4
|
import { basename, dirname, extname, join, relative, resolve, sep } from "node:path";
|
|
5
5
|
import ts from "typescript";
|
|
6
6
|
export * from "./types.js";
|
|
7
|
-
export { applyVerifiedProposals, codexAnalyzerAvailability, deepScan } from "./deep.js";
|
|
7
|
+
export { applyVerifiedProposals, codexAnalyzerAvailability, deepScan, normalizeArchitectureGraph } from "./deep.js";
|
|
8
8
|
const VERSION = "3.0.0";
|
|
9
9
|
const RULE_VERSION = "3.0.0";
|
|
10
10
|
const MAX_FILES = 20_000;
|