auditor-lambda 0.6.8 → 0.6.9
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/cli/lineIndex.d.ts +4 -0
- package/dist/cli/lineIndex.js +44 -0
- package/dist/cli.js +1 -39
- package/dist/extractors/fileInventory.js +1 -1452
- package/dist/extractors/languageMap.generated.d.ts +1 -0
- package/dist/extractors/languageMap.generated.js +1455 -0
- package/dist/providers/claudeCodeProvider.d.ts +1 -1
- package/dist/providers/claudeCodeProvider.js +1 -1
- package/dist/providers/localSubprocessProvider.d.ts +1 -1
- package/dist/providers/localSubprocessProvider.js +2 -2
- package/dist/providers/opencodeProvider.js +1 -1
- package/dist/providers/subprocessTemplateProvider.js +1 -1
- package/dist/quota/index.d.ts +2 -2
- package/dist/quota/index.js +5 -2
- package/package.json +5 -4
- package/dist/providers/spawnLoggedCommand.d.ts +0 -12
- package/dist/providers/spawnLoggedCommand.js +0 -186
- package/dist/quota/scheduler.d.ts +0 -20
- package/dist/quota/scheduler.js +0 -151
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AuditTask, RepoManifest } from "../types.js";
|
|
2
|
+
export declare function buildLineIndex(root: string, repoManifest: RepoManifest): Promise<Record<string, number>>;
|
|
3
|
+
export declare function buildLineIndexForPaths(root: string, paths: string[]): Promise<Record<string, number>>;
|
|
4
|
+
export declare function addFileLineCountHints(root: string, tasks: AuditTask[]): Promise<AuditTask[]>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
import { countLines } from "./args.js";
|
|
3
|
+
// Line-count helpers extracted from cli.ts. Pure functions over the repo
|
|
4
|
+
// manifest / task file paths — used to annotate audit tasks with per-file line
|
|
5
|
+
// counts and to build line indexes for prompt rendering.
|
|
6
|
+
export async function buildLineIndex(root, repoManifest) {
|
|
7
|
+
const entries = [];
|
|
8
|
+
const batchSize = 25;
|
|
9
|
+
for (let i = 0; i < repoManifest.files.length; i += batchSize) {
|
|
10
|
+
const batch = repoManifest.files.slice(i, i + batchSize);
|
|
11
|
+
const results = await Promise.all(batch.map(async (file) => {
|
|
12
|
+
try {
|
|
13
|
+
return [
|
|
14
|
+
file.path,
|
|
15
|
+
await countLines(resolve(root, file.path)),
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return [file.path, 0];
|
|
20
|
+
}
|
|
21
|
+
}));
|
|
22
|
+
entries.push(...results);
|
|
23
|
+
}
|
|
24
|
+
return Object.fromEntries(entries);
|
|
25
|
+
}
|
|
26
|
+
export async function buildLineIndexForPaths(root, paths) {
|
|
27
|
+
const uniquePaths = [...new Set(paths)].sort();
|
|
28
|
+
const entries = await Promise.all(uniquePaths.map(async (path) => {
|
|
29
|
+
try {
|
|
30
|
+
return [path, await countLines(resolve(root, path))];
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return [path, 0];
|
|
34
|
+
}
|
|
35
|
+
}));
|
|
36
|
+
return Object.fromEntries(entries);
|
|
37
|
+
}
|
|
38
|
+
export async function addFileLineCountHints(root, tasks) {
|
|
39
|
+
const lineIndex = await buildLineIndexForPaths(root, tasks.flatMap((task) => task.file_paths));
|
|
40
|
+
return tasks.map((task) => ({
|
|
41
|
+
...task,
|
|
42
|
+
file_line_counts: Object.fromEntries(task.file_paths.map((path) => [path, lineIndex[path] ?? 0])),
|
|
43
|
+
}));
|
|
44
|
+
}
|
package/dist/cli.js
CHANGED
|
@@ -45,6 +45,7 @@ import { writeCurrentStep, } from "./cli/steps.js";
|
|
|
45
45
|
import { WORKER_RESULT_CONTRACT_VERSION, buildWorkerResult, persistWorkerRunArtifacts, isWorkerResult, buildWorkerFailureBlocker, formatAuditResultValidationError, } from "./cli/workerResult.js";
|
|
46
46
|
import { DISPATCH_RESULT_MAP_FILENAME, ACTIVE_DISPATCH_FILENAME, resolveRunScopedArg, loadDispatchResultMap, entriesByTaskId, buildPendingAuditTasks, prepareDispatchArtifacts, } from "./cli/dispatch.js";
|
|
47
47
|
import { readWaveManifest, writeWaveManifest, removeWaveManifest, buildWaveSlotEntry, } from "./cli/waveManifest.js";
|
|
48
|
+
import { buildLineIndex, buildLineIndexForPaths, addFileLineCountHints, } from "./cli/lineIndex.js";
|
|
48
49
|
const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
49
50
|
const ADVANCE_AUDIT_CONTRACT_VERSION = "audit-code/v1alpha1";
|
|
50
51
|
const SAMPLE_REPO_FILES = [
|
|
@@ -114,45 +115,6 @@ function buildBlockedAuditState(params) {
|
|
|
114
115
|
: item),
|
|
115
116
|
};
|
|
116
117
|
}
|
|
117
|
-
async function buildLineIndex(root, repoManifest) {
|
|
118
|
-
const entries = [];
|
|
119
|
-
const batchSize = 25;
|
|
120
|
-
for (let i = 0; i < repoManifest.files.length; i += batchSize) {
|
|
121
|
-
const batch = repoManifest.files.slice(i, i + batchSize);
|
|
122
|
-
const results = await Promise.all(batch.map(async (file) => {
|
|
123
|
-
try {
|
|
124
|
-
return [
|
|
125
|
-
file.path,
|
|
126
|
-
await countLines(resolve(root, file.path)),
|
|
127
|
-
];
|
|
128
|
-
}
|
|
129
|
-
catch {
|
|
130
|
-
return [file.path, 0];
|
|
131
|
-
}
|
|
132
|
-
}));
|
|
133
|
-
entries.push(...results);
|
|
134
|
-
}
|
|
135
|
-
return Object.fromEntries(entries);
|
|
136
|
-
}
|
|
137
|
-
async function buildLineIndexForPaths(root, paths) {
|
|
138
|
-
const uniquePaths = [...new Set(paths)].sort();
|
|
139
|
-
const entries = await Promise.all(uniquePaths.map(async (path) => {
|
|
140
|
-
try {
|
|
141
|
-
return [path, await countLines(resolve(root, path))];
|
|
142
|
-
}
|
|
143
|
-
catch {
|
|
144
|
-
return [path, 0];
|
|
145
|
-
}
|
|
146
|
-
}));
|
|
147
|
-
return Object.fromEntries(entries);
|
|
148
|
-
}
|
|
149
|
-
async function addFileLineCountHints(root, tasks) {
|
|
150
|
-
const lineIndex = await buildLineIndexForPaths(root, tasks.flatMap((task) => task.file_paths));
|
|
151
|
-
return tasks.map((task) => ({
|
|
152
|
-
...task,
|
|
153
|
-
file_line_counts: Object.fromEntries(task.file_paths.map((path) => [path, lineIndex[path] ?? 0])),
|
|
154
|
-
}));
|
|
155
|
-
}
|
|
156
118
|
function activeReviewRunFromTask(artifactsDir, task) {
|
|
157
119
|
if (task.preferred_executor !== "agent" || !task.audit_results_path) {
|
|
158
120
|
return null;
|