auditor-lambda 0.6.10 → 0.6.12

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.
@@ -1,14 +1,12 @@
1
1
  import type { GraphEdge } from "@audit-tools/shared";
2
+ import { isCargoManifestPath, isGoWorkspaceManifestPath, isMavenPomPath, isPyprojectPath } from "./graphPathUtils.js";
3
+ export { isCargoManifestPath, isGoWorkspaceManifestPath, isMavenPomPath, isPyprojectPath, };
2
4
  export declare function extractPackageEntrypointEdges(fromPath: string, content: string, pathLookup: Map<string, string>): GraphEdge[];
3
5
  export declare function extractPackageScriptEdges(fromPath: string, content: string, pathLookup: Map<string, string>): GraphEdge[];
4
- export declare function isGoWorkspaceManifestPath(path: string): boolean;
5
- export declare function isCargoManifestPath(path: string): boolean;
6
- export declare function isMavenPomPath(path: string): boolean;
7
6
  export declare function extractWorkspacePackageEdges(fromPath: string, content: string, pathLookup: Map<string, string>): GraphEdge[];
8
7
  export declare function extractCargoWorkspaceMemberEdges(fromPath: string, content: string, pathLookup: Map<string, string>): GraphEdge[];
9
8
  export declare function extractTypescriptProjectReferenceEdges(fromPath: string, content: string, pathLookup: Map<string, string>): GraphEdge[];
10
9
  export declare function extractGoWorkspaceModuleEdges(fromPath: string, content: string, pathLookup: Map<string, string>): GraphEdge[];
11
10
  export declare function extractMavenModuleEdges(fromPath: string, content: string, pathLookup: Map<string, string>): GraphEdge[];
12
- export declare function isPyprojectPath(path: string): boolean;
13
11
  export declare function extractPyprojectTestpathLinks(fromPath: string, content: string, pathLookup: Map<string, string>): GraphEdge[];
14
12
  export declare function extractYamlPathReferenceEdges(fromPath: string, content: string, pathLookup: Map<string, string>): GraphEdge[];
@@ -1,5 +1,9 @@
1
1
  import { posix } from "node:path";
2
- import { graphEdge, normalizeGraphPath, resolveCandidate } from "./graphPathUtils.js";
2
+ import { graphEdge, normalizeGraphPath, resolveCandidate, isCargoManifestPath, isGoModuleManifestPath, isGoWorkspaceManifestPath, isMavenPomPath, isPackageManifestPath, isPnpmWorkspaceManifestPath, isPyprojectPath, isTypescriptProjectConfigPath, } from "./graphPathUtils.js";
3
+ // Re-exported for the graph builder, which imports these manifest predicates
4
+ // from here for historical reasons; the canonical definitions live in
5
+ // graphPathUtils.
6
+ export { isCargoManifestPath, isGoWorkspaceManifestPath, isMavenPomPath, isPyprojectPath, };
3
7
  const PACKAGE_ENTRYPOINT_EDGE_CONFIDENCE = 0.9;
4
8
  const PACKAGE_SCRIPT_EDGE_CONFIDENCE = 0.88;
5
9
  const WORKSPACE_PACKAGE_EDGE_CONFIDENCE = 0.86;
@@ -8,9 +12,6 @@ const GO_WORKSPACE_MODULE_EDGE_CONFIDENCE = 0.87;
8
12
  const CARGO_WORKSPACE_MEMBER_EDGE_CONFIDENCE = 0.87;
9
13
  const MAVEN_MODULE_EDGE_CONFIDENCE = 0.87;
10
14
  const PACKAGE_SCRIPT_REFERENCE_PATTERN = /(?:^|[\s"'`])((?:\.{1,2}\/)?(?:[\w.-]+\/)*[\w.-]+\.(?:cjs|cts|js|jsx|mjs|mts|ts|tsx))(?:$|[\s"'`])/gi;
11
- function isPackageManifestPath(path) {
12
- return posix.basename(normalizeGraphPath(path)).toLowerCase() === "package.json";
13
- }
14
15
  function collectPackageEntrypointValues(value, fieldPath, entries) {
15
16
  if (typeof value === "string") {
16
17
  if (value.trim().length > 0) {
@@ -177,27 +178,6 @@ function packageWorkspacePatterns(content) {
177
178
  }
178
179
  return patterns;
179
180
  }
180
- function isPnpmWorkspaceManifestPath(path) {
181
- return (posix.basename(normalizeGraphPath(path)).toLowerCase() ===
182
- "pnpm-workspace.yaml");
183
- }
184
- export function isGoWorkspaceManifestPath(path) {
185
- return posix.basename(normalizeGraphPath(path)).toLowerCase() === "go.work";
186
- }
187
- function isGoModuleManifestPath(path) {
188
- return posix.basename(normalizeGraphPath(path)).toLowerCase() === "go.mod";
189
- }
190
- export function isCargoManifestPath(path) {
191
- return posix.basename(normalizeGraphPath(path)).toLowerCase() === "cargo.toml";
192
- }
193
- export function isMavenPomPath(path) {
194
- return posix.basename(normalizeGraphPath(path)).toLowerCase() === "pom.xml";
195
- }
196
- function isTypescriptProjectConfigPath(path) {
197
- const basename = posix.basename(normalizeGraphPath(path)).toLowerCase();
198
- return (basename === "tsconfig.json" ||
199
- (basename.startsWith("tsconfig.") && basename.endsWith(".json")));
200
- }
201
181
  function stripJsonComments(content) {
202
182
  let result = "";
203
183
  let inString = false;
@@ -987,9 +967,6 @@ export function extractMavenModuleEdges(fromPath, content, pathLookup) {
987
967
  }
988
968
  // ─── Pyproject / pytest ───────────────────────────────────────────────────────
989
969
  const PYPROJECT_TESTPATHS_LINK_CONFIDENCE = 0.85;
990
- export function isPyprojectPath(path) {
991
- return posix.basename(normalizeGraphPath(path)).toLowerCase() === "pyproject.toml";
992
- }
993
970
  function pyprojectTestpaths(content) {
994
971
  const values = [];
995
972
  let currentSection = "";
@@ -15,3 +15,19 @@ export declare function resolveReferenceLiteral(fromPath: string, literal: strin
15
15
  export declare function isJsonSchemaPath(path: string): boolean;
16
16
  /** True for pytest `conftest.py` files. */
17
17
  export declare function isPytestConftestPath(path: string): boolean;
18
+ /** True for `package.json` files. */
19
+ export declare function isPackageManifestPath(path: string): boolean;
20
+ /** True for `tsconfig.json` / `tsconfig.<name>.json` project config files. */
21
+ export declare function isTypescriptProjectConfigPath(path: string): boolean;
22
+ /** True for Go `go.mod` module manifests. */
23
+ export declare function isGoModuleManifestPath(path: string): boolean;
24
+ /** True for Go `go.work` workspace manifests. */
25
+ export declare function isGoWorkspaceManifestPath(path: string): boolean;
26
+ /** True for Rust `Cargo.toml` manifests. */
27
+ export declare function isCargoManifestPath(path: string): boolean;
28
+ /** True for Maven `pom.xml` manifests. */
29
+ export declare function isMavenPomPath(path: string): boolean;
30
+ /** True for Python `pyproject.toml` manifests. */
31
+ export declare function isPyprojectPath(path: string): boolean;
32
+ /** True for `pnpm-workspace.yaml` workspace manifests. */
33
+ export declare function isPnpmWorkspaceManifestPath(path: string): boolean;
@@ -131,3 +131,43 @@ export function isJsonSchemaPath(path) {
131
131
  export function isPytestConftestPath(path) {
132
132
  return posix.basename(normalizeGraphPath(path)).toLowerCase() === "conftest.py";
133
133
  }
134
+ // ---- Build-manifest path predicates ----
135
+ // One canonical set, shared by the graph manifest-edge extractor and the
136
+ // packetizer. Each preserves path case (so distinct files differing only by
137
+ // case are never collapsed) and matches the manifest filename
138
+ // case-insensitively, since manifest names are conventionally lowercase.
139
+ /** True for `package.json` files. */
140
+ export function isPackageManifestPath(path) {
141
+ return posix.basename(normalizeGraphPath(path)).toLowerCase() === "package.json";
142
+ }
143
+ /** True for `tsconfig.json` / `tsconfig.<name>.json` project config files. */
144
+ export function isTypescriptProjectConfigPath(path) {
145
+ const basename = posix.basename(normalizeGraphPath(path)).toLowerCase();
146
+ return (basename === "tsconfig.json" ||
147
+ (basename.startsWith("tsconfig.") && basename.endsWith(".json")));
148
+ }
149
+ /** True for Go `go.mod` module manifests. */
150
+ export function isGoModuleManifestPath(path) {
151
+ return posix.basename(normalizeGraphPath(path)).toLowerCase() === "go.mod";
152
+ }
153
+ /** True for Go `go.work` workspace manifests. */
154
+ export function isGoWorkspaceManifestPath(path) {
155
+ return posix.basename(normalizeGraphPath(path)).toLowerCase() === "go.work";
156
+ }
157
+ /** True for Rust `Cargo.toml` manifests. */
158
+ export function isCargoManifestPath(path) {
159
+ return posix.basename(normalizeGraphPath(path)).toLowerCase() === "cargo.toml";
160
+ }
161
+ /** True for Maven `pom.xml` manifests. */
162
+ export function isMavenPomPath(path) {
163
+ return posix.basename(normalizeGraphPath(path)).toLowerCase() === "pom.xml";
164
+ }
165
+ /** True for Python `pyproject.toml` manifests. */
166
+ export function isPyprojectPath(path) {
167
+ return posix.basename(normalizeGraphPath(path)).toLowerCase() === "pyproject.toml";
168
+ }
169
+ /** True for `pnpm-workspace.yaml` workspace manifests. */
170
+ export function isPnpmWorkspaceManifestPath(path) {
171
+ return (posix.basename(normalizeGraphPath(path)).toLowerCase() ===
172
+ "pnpm-workspace.yaml");
173
+ }
@@ -1,6 +1,8 @@
1
1
  import type { AuditTask } from "../types.js";
2
2
  import type { AuditPlanMetrics, ReviewPacket } from "../types/reviewPlanning.js";
3
3
  import type { GraphBundle, GraphEdge } from "@audit-tools/shared";
4
+ import { normalizeGraphPath } from "../extractors/graphPathUtils.js";
5
+ export { normalizeGraphPath };
4
6
  export declare const ESTIMATED_TOKENS_PER_LINE = 4;
5
7
  export declare const ESTIMATED_PACKET_PROMPT_TOKENS = 900;
6
8
  /**
@@ -40,7 +42,6 @@ export interface BuildReviewPacketOptions {
40
42
  */
41
43
  maxContextTokens?: number;
42
44
  }
43
- export declare function normalizeGraphPath(path: string): string;
44
45
  export declare function collectGraphEdges(graphBundle?: GraphBundle): GraphEdge[];
45
46
  export declare function graphEdgeConfidence(edge: GraphEdge): number;
46
47
  export interface GraphDegreeIndex {
@@ -2,6 +2,9 @@ import { createHash } from "node:crypto";
2
2
  import { estimateTokensFromBytes, isRecord } from "@audit-tools/shared";
3
3
  import { LENS_ORDER, priorityRank, sortLenses } from "./auditTaskUtils.js";
4
4
  import { UnionFind } from "./unionFind.js";
5
+ import { normalizeGraphPath, isPackageManifestPath, isTypescriptProjectConfigPath, isGoModuleManifestPath, isCargoManifestPath, isMavenPomPath, } from "../extractors/graphPathUtils.js";
6
+ // Re-exported for scope.ts, which imports the canonical path normalizer here.
7
+ export { normalizeGraphPath };
5
8
  const DEFAULT_MAX_TASKS_PER_PACKET = 0;
6
9
  const DEFAULT_TARGET_PACKET_LINES = 8000;
7
10
  export const ESTIMATED_TOKENS_PER_LINE = 4;
@@ -132,9 +135,6 @@ function buildTaskGroups(tasks) {
132
135
  }
133
136
  return groups;
134
137
  }
135
- export function normalizeGraphPath(path) {
136
- return path.replace(/\\/g, "/").replace(/^\.\//, "").toLowerCase();
137
- }
138
138
  export function collectGraphEdges(graphBundle) {
139
139
  if (!graphBundle?.graphs) {
140
140
  return [];
@@ -429,28 +429,11 @@ function buildSubsystemClusterEdges(groups, graphEdges, lineIndex, sizeIndex, ta
429
429
  }
430
430
  function packageManifestRoot(path) {
431
431
  const segments = normalizeGraphPath(path).split("/").filter(Boolean);
432
- if (segments.at(-1) !== "package.json" || segments.length < 2) {
432
+ if (!isPackageManifestPath(path) || segments.length < 2) {
433
433
  return undefined;
434
434
  }
435
435
  return segments.slice(0, -1).join("/");
436
436
  }
437
- function isTypescriptProjectConfigPath(path) {
438
- const basename = normalizeGraphPath(path).split("/").at(-1);
439
- if (!basename) {
440
- return false;
441
- }
442
- return (basename === "tsconfig.json" ||
443
- (basename.startsWith("tsconfig.") && basename.endsWith(".json")));
444
- }
445
- function isGoModuleManifestPath(path) {
446
- return normalizeGraphPath(path).split("/").at(-1) === "go.mod";
447
- }
448
- function isCargoManifestPath(path) {
449
- return normalizeGraphPath(path).split("/").at(-1) === "cargo.toml";
450
- }
451
- function isMavenPomPath(path) {
452
- return normalizeGraphPath(path).split("/").at(-1) === "pom.xml";
453
- }
454
437
  function configFileRoot(path, predicate) {
455
438
  const segments = normalizeGraphPath(path).split("/").filter(Boolean);
456
439
  if (!predicate(path) || segments.length < 2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auditor-lambda",
3
- "version": "0.6.10",
3
+ "version": "0.6.12",
4
4
  "private": false,
5
5
  "description": "Portable hybrid code-auditing framework for arbitrary repositories.",
6
6
  "type": "module",