auditor-lambda 0.10.7 → 0.10.8
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/audit-code-wrapper-install-hosts.mjs +1 -1
- package/audit-code-wrapper-lib.mjs +5 -5
- package/audit-code-wrapper-opencode.mjs +2 -3
- package/dist/cli/advanceAuditCommand.js +2 -2
- package/dist/cli/args.js +1 -1
- package/dist/cli/nextStepCommand.js +2 -4
- package/dist/cli/runToCompletion.js +2 -2
- package/dist/extractors/fsIntake.js +1 -1
- package/dist/extractors/pathPatterns.js +1 -1
- package/dist/io/artifacts.d.ts +0 -1
- package/dist/io/artifacts.js +5 -4
- package/dist/io/runArtifacts.js +1 -1
- package/dist/providers/claudeCodeProvider.js +1 -1
- package/package.json +1 -1
- package/scripts/postinstall.mjs +1 -2
- package/skills/audit-code/audit-code.prompt.md +1 -1
|
@@ -720,7 +720,7 @@ export async function installBootstrap(argv, options = {}) {
|
|
|
720
720
|
);
|
|
721
721
|
results.push(await writeGeneratedJson(installManifestPath, installManifest));
|
|
722
722
|
|
|
723
|
-
const sessionConfigPath = join(root, '.audit-
|
|
723
|
+
const sessionConfigPath = join(root, '.audit-tools', 'audit', 'session-config.json');
|
|
724
724
|
if (!(await fileExists(sessionConfigPath))) {
|
|
725
725
|
const defaultConfig = { provider: 'local-subprocess' };
|
|
726
726
|
await mkdir(dirname(sessionConfigPath), { recursive: true });
|
|
@@ -123,7 +123,7 @@ function printHelp({ usageName, preferredEntrypoint }) {
|
|
|
123
123
|
'- verify-install smoke-tests the generated host assets after install',
|
|
124
124
|
'- mcp starts the local stdio MCP server for repo-local IDE integrations',
|
|
125
125
|
'- install-host --host copilot keeps the narrower Copilot-focused install path available',
|
|
126
|
-
'- next-step advances deterministic audit state and writes .audit-
|
|
126
|
+
'- next-step advances deterministic audit state and writes .audit-tools/audit/steps/current-step.json plus current-prompt.md',
|
|
127
127
|
'- validate checks the current artifact bundle plus session-config/provider readiness and exits non-zero when issues exist',
|
|
128
128
|
'- validate-results --results FILE validates AuditResult payloads against the active task manifest without ingesting them',
|
|
129
129
|
'- explain-task <task_id> prints the resolved file coverage and current status for a task id',
|
|
@@ -141,7 +141,7 @@ function printHelp({ usageName, preferredEntrypoint }) {
|
|
|
141
141
|
'',
|
|
142
142
|
'Defaults:',
|
|
143
143
|
'- --root .',
|
|
144
|
-
'- --artifacts-dir <root>/.audit-
|
|
144
|
+
'- --artifacts-dir <root>/.audit-tools/audit',
|
|
145
145
|
'',
|
|
146
146
|
'Completion signals:',
|
|
147
147
|
'- done: audit_state.status is complete',
|
|
@@ -166,7 +166,7 @@ async function printPromptPath() {
|
|
|
166
166
|
async function runDistCommand(commandName, argv, { ensureArtifactsDir = false } = {}) {
|
|
167
167
|
const commandArgs = [...argv];
|
|
168
168
|
const rootValue = resolve(getFlag(commandArgs, '--root') ?? '.');
|
|
169
|
-
const artifactsDir = resolve(getFlag(commandArgs, '--artifacts-dir') ?? join(rootValue, '.audit-
|
|
169
|
+
const artifactsDir = resolve(getFlag(commandArgs, '--artifacts-dir') ?? join(rootValue, '.audit-tools', 'audit'));
|
|
170
170
|
|
|
171
171
|
setDefaultFlag(commandArgs, '--root', rootValue);
|
|
172
172
|
setDefaultFlag(commandArgs, '--artifacts-dir', artifactsDir);
|
|
@@ -184,7 +184,7 @@ async function runDistCommand(commandName, argv, { ensureArtifactsDir = false }
|
|
|
184
184
|
async function runDistCommandInline(commandName, argv) {
|
|
185
185
|
const commandArgs = [...argv];
|
|
186
186
|
const rootValue = resolve(getFlag(commandArgs, '--root') ?? '.');
|
|
187
|
-
const artifactsDir = resolve(getFlag(commandArgs, '--artifacts-dir') ?? join(rootValue, '.audit-
|
|
187
|
+
const artifactsDir = resolve(getFlag(commandArgs, '--artifacts-dir') ?? join(rootValue, '.audit-tools', 'audit'));
|
|
188
188
|
|
|
189
189
|
setDefaultFlag(commandArgs, '--root', rootValue);
|
|
190
190
|
setDefaultFlag(commandArgs, '--artifacts-dir', artifactsDir);
|
|
@@ -305,7 +305,7 @@ export async function runAuditCodeWrapper({
|
|
|
305
305
|
wrapperArgs.push('--single-step');
|
|
306
306
|
}
|
|
307
307
|
const rootValue = resolve(getFlag(wrapperArgs, '--root') ?? '.');
|
|
308
|
-
const artifactsDir = resolve(getFlag(wrapperArgs, '--artifacts-dir') ?? join(rootValue, '.audit-
|
|
308
|
+
const artifactsDir = resolve(getFlag(wrapperArgs, '--artifacts-dir') ?? join(rootValue, '.audit-tools', 'audit'));
|
|
309
309
|
|
|
310
310
|
setDefaultFlag(wrapperArgs, '--root', rootValue);
|
|
311
311
|
setDefaultFlag(wrapperArgs, '--artifacts-dir', artifactsDir);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export const OPENCODE_AUDIT_EDIT_PERMISSION = {
|
|
2
2
|
'*': 'ask',
|
|
3
3
|
'.audit-code/**': 'allow',
|
|
4
|
-
'.audit-
|
|
5
|
-
'audit-report.md': 'allow',
|
|
4
|
+
'.audit-tools/**': 'allow',
|
|
6
5
|
};
|
|
7
6
|
|
|
8
7
|
export const OPENCODE_AUDIT_EXTERNAL_DIRECTORY_PERMISSION = { '*': 'allow' };
|
|
@@ -176,7 +175,7 @@ export function assertOpenCodeAuditPermissionConfig(permissionConfig, label) {
|
|
|
176
175
|
if (!edit || typeof edit !== 'object' || Array.isArray(edit)) {
|
|
177
176
|
throw new Error(`OpenCode ${label}.edit must allow audit-owned file paths. Run "audit-code install --host opencode".`);
|
|
178
177
|
}
|
|
179
|
-
for (const pattern of ['.audit-code/**', '.audit-
|
|
178
|
+
for (const pattern of ['.audit-code/**', '.audit-tools/**']) {
|
|
180
179
|
if (edit[pattern] !== 'allow') {
|
|
181
180
|
throw new Error(`OpenCode ${label}.edit must allow ${pattern}. Run "audit-code install --host opencode".`);
|
|
182
181
|
}
|
|
@@ -54,7 +54,7 @@ export async function cmdAdvanceAudit(argv) {
|
|
|
54
54
|
providerName,
|
|
55
55
|
});
|
|
56
56
|
if (result.audit_state.status === "complete") {
|
|
57
|
-
await promoteFinalAuditReport({ artifactsDir
|
|
57
|
+
await promoteFinalAuditReport({ artifactsDir });
|
|
58
58
|
}
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
@@ -90,6 +90,6 @@ export async function cmdAdvanceAudit(argv) {
|
|
|
90
90
|
providerName,
|
|
91
91
|
});
|
|
92
92
|
if (result.audit_state.status === "complete") {
|
|
93
|
-
await promoteFinalAuditReport({ artifactsDir
|
|
93
|
+
await promoteFinalAuditReport({ artifactsDir });
|
|
94
94
|
}
|
|
95
95
|
}
|
package/dist/cli/args.js
CHANGED
|
@@ -6,7 +6,7 @@ import { join, resolve } from "node:path";
|
|
|
6
6
|
import { resolveFreshSessionProviderName } from "../providers/index.js";
|
|
7
7
|
export const DIRECT_CLI_DEFAULTS = {
|
|
8
8
|
rootDir: ".",
|
|
9
|
-
artifactsDir: ".
|
|
9
|
+
artifactsDir: ".audit-tools/audit",
|
|
10
10
|
maxRuns: 1000,
|
|
11
11
|
agentBatchSize: 6,
|
|
12
12
|
parallelWorkers: 1,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { mkdir, unlink, writeFile } from "node:fs/promises";
|
|
2
|
-
import { join, resolve } from "node:path";
|
|
2
|
+
import { dirname, join, resolve } from "node:path";
|
|
3
3
|
import { isFileMissingError, readJsonFile, writeJsonFile, } from "@audit-tools/shared";
|
|
4
4
|
import { loadArtifactBundle, promoteFinalAuditReport, writeCoreArtifacts, AUDIT_REPORT_FILENAME, } from "../io/artifacts.js";
|
|
5
5
|
import { advanceAudit } from "../orchestrator/advance.js";
|
|
@@ -71,14 +71,13 @@ export async function buildTerminalStep(params, bundle, state, blockedReason) {
|
|
|
71
71
|
}
|
|
72
72
|
const promoted = await promoteFinalAuditReport({
|
|
73
73
|
artifactsDir: params.artifactsDir,
|
|
74
|
-
repoRoot: params.root,
|
|
75
74
|
});
|
|
76
75
|
return {
|
|
77
76
|
kind: "complete",
|
|
78
77
|
state,
|
|
79
78
|
bundle,
|
|
80
79
|
finalReportPath: promoted.promoted
|
|
81
|
-
? join(params.
|
|
80
|
+
? join(dirname(params.artifactsDir), AUDIT_REPORT_FILENAME)
|
|
82
81
|
: join(params.artifactsDir, AUDIT_REPORT_FILENAME),
|
|
83
82
|
};
|
|
84
83
|
}
|
|
@@ -293,7 +292,6 @@ async function runDeterministicForNextStep(params) {
|
|
|
293
292
|
});
|
|
294
293
|
const promoted = await promoteFinalAuditReport({
|
|
295
294
|
artifactsDir: params.artifactsDir,
|
|
296
|
-
repoRoot: params.root,
|
|
297
295
|
});
|
|
298
296
|
return {
|
|
299
297
|
kind: "complete",
|
|
@@ -671,7 +671,7 @@ async function handleNoExecutor(params) {
|
|
|
671
671
|
providerName,
|
|
672
672
|
});
|
|
673
673
|
if (state.status === "complete") {
|
|
674
|
-
await promoteFinalAuditReport({ artifactsDir
|
|
674
|
+
await promoteFinalAuditReport({ artifactsDir });
|
|
675
675
|
}
|
|
676
676
|
}
|
|
677
677
|
async function runParallelWaveStep(params) {
|
|
@@ -869,7 +869,7 @@ async function handleMaxRunsReached(params) {
|
|
|
869
869
|
providerName,
|
|
870
870
|
});
|
|
871
871
|
if (reportRendered) {
|
|
872
|
-
await promoteFinalAuditReport({ artifactsDir
|
|
872
|
+
await promoteFinalAuditReport({ artifactsDir });
|
|
873
873
|
}
|
|
874
874
|
}
|
|
875
875
|
export async function cmdRunToCompletion(argv) {
|
|
@@ -204,7 +204,7 @@ export function isGeneratedTestArtifactPath(normalized) {
|
|
|
204
204
|
return splitSegments(normalized).some((segment) => segment.startsWith(".test-") && segment.endsWith("-artifacts"));
|
|
205
205
|
}
|
|
206
206
|
export function isAuditArtifactPath(normalized) {
|
|
207
|
-
return hasSegment(normalized, ".audit-
|
|
207
|
+
return hasSegment(normalized, ".audit-tools");
|
|
208
208
|
}
|
|
209
209
|
export function isTestPath(normalized) {
|
|
210
210
|
const segments = splitSegments(normalized);
|
package/dist/io/artifacts.d.ts
CHANGED
|
@@ -103,7 +103,6 @@ export declare function writeCoreArtifacts(root: string, bundle: ArtifactBundle,
|
|
|
103
103
|
export declare function cleanupIntermediateArtifacts(root: string): Promise<string[]>;
|
|
104
104
|
export declare function promoteFinalAuditReport(params: {
|
|
105
105
|
artifactsDir: string;
|
|
106
|
-
repoRoot: string;
|
|
107
106
|
}, options?: {
|
|
108
107
|
copy?: typeof cp;
|
|
109
108
|
remove?: typeof rm;
|
package/dist/io/artifacts.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cp, rm, unlink } from "node:fs/promises";
|
|
2
|
-
import { join } from "node:path";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
3
|
import { isFileMissingError, readOptionalJsonFile, readOptionalNdjsonFile, readOptionalTextFile, writeJsonFile, writeNdjsonFile, writeTextFile, } from "@audit-tools/shared";
|
|
4
4
|
import { buildToolingManifest } from "./toolingManifest.js";
|
|
5
5
|
// Canonical filename for the rendered findings report. Single source of truth
|
|
@@ -130,8 +130,9 @@ export async function cleanupIntermediateArtifacts(root) {
|
|
|
130
130
|
return deleted;
|
|
131
131
|
}
|
|
132
132
|
export async function promoteFinalAuditReport(params, options = {}) {
|
|
133
|
+
const outputDir = dirname(params.artifactsDir);
|
|
133
134
|
const source = join(params.artifactsDir, AUDIT_REPORT_FILENAME);
|
|
134
|
-
const destination = join(
|
|
135
|
+
const destination = join(outputDir, AUDIT_REPORT_FILENAME);
|
|
135
136
|
const copy = options.copy ?? cp;
|
|
136
137
|
const remove = options.remove ?? rm;
|
|
137
138
|
const warn = options.warn ?? ((message) => process.stderr.write(`${message}\n`));
|
|
@@ -147,12 +148,12 @@ export async function promoteFinalAuditReport(params, options = {}) {
|
|
|
147
148
|
// Promote the canonical machine contract alongside the human report. Missing
|
|
148
149
|
// (e.g. legacy bundle) or unreadable: best-effort, never blocks completion.
|
|
149
150
|
try {
|
|
150
|
-
await copy(join(params.artifactsDir, "audit-findings.json"), join(
|
|
151
|
+
await copy(join(params.artifactsDir, "audit-findings.json"), join(outputDir, "audit-findings.json"), { force: true });
|
|
151
152
|
}
|
|
152
153
|
catch (error) {
|
|
153
154
|
// audit-findings.json is optional output; absence must not fail promotion.
|
|
154
155
|
// Log so operators can distinguish a partial promotion from a clean one.
|
|
155
|
-
warn(`audit-code: could not promote audit-findings.json to ${join(
|
|
156
|
+
warn(`audit-code: could not promote audit-findings.json to ${join(outputDir, "audit-findings.json")}: ` +
|
|
156
157
|
(error instanceof Error ? error.message : String(error)));
|
|
157
158
|
}
|
|
158
159
|
try {
|
package/dist/io/runArtifacts.js
CHANGED
|
@@ -187,7 +187,7 @@ export async function writeDispatchBatchFiles(artifactsDir, runs, currentTasks,
|
|
|
187
187
|
"# audit-code parallel dispatch",
|
|
188
188
|
"",
|
|
189
189
|
`This batch launched ${runs.length} deferred review run(s).`,
|
|
190
|
-
"Each run keeps its own task.json, prompt.md, result.json, and status.json under .audit-
|
|
190
|
+
"Each run keeps its own task.json, prompt.md, result.json, and status.json under .audit-tools/audit/runs/<run_id>/.",
|
|
191
191
|
"Use current-tasks.json for the combined task list. The per-run files below are operational references for launched workers; do not read per-run prompt or schema files unless debugging a failed dispatch.",
|
|
192
192
|
"",
|
|
193
193
|
"Runs:",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import { readJsonFile, spawnLoggedCommand, applyWorkerTaskLaunchSettings } from "@audit-tools/shared";
|
|
3
3
|
export const ACTIVE_CLAUDE_CODE_SESSION_MESSAGE = "claude-code provider cannot be used inside an active Claude Code session. " +
|
|
4
|
-
'Set provider to "local-subprocess" in .audit-
|
|
4
|
+
'Set provider to "local-subprocess" in .audit-tools/audit/session-config.json, ' +
|
|
5
5
|
"then run /audit-code conversationally and follow the dispatch prompts manually.";
|
|
6
6
|
export class ClaudeCodeProvider {
|
|
7
7
|
name = "claude-code";
|
package/package.json
CHANGED
package/scripts/postinstall.mjs
CHANGED
|
@@ -41,8 +41,7 @@ const OPENCODE_AUDIT_EXTERNAL_DIRECTORY_PERMISSION = { '*': 'allow' };
|
|
|
41
41
|
const OPENCODE_AUDIT_EDIT_PERMISSION = {
|
|
42
42
|
'*': 'ask',
|
|
43
43
|
'.audit-code/**': 'allow',
|
|
44
|
-
'.audit-
|
|
45
|
-
'audit-report.md': 'allow',
|
|
44
|
+
'.audit-tools/**': 'allow',
|
|
46
45
|
};
|
|
47
46
|
|
|
48
47
|
const OPENCODE_AUDIT_BASH_PERMISSION = {
|
|
@@ -58,7 +58,7 @@ If the returned step is a dispatch step, before launching subagents check
|
|
|
58
58
|
immediately.
|
|
59
59
|
|
|
60
60
|
After the **first** `next-step` (the intake step) completes, confirm the audit
|
|
61
|
-
scope before proceeding. Read `scope_summary.json` from the `.audit-
|
|
61
|
+
scope before proceeding. Read `scope_summary.json` from the `.audit-tools/audit/`
|
|
62
62
|
directory. It contains `repo_root`, `auditable_file_count`, `git_available`, and
|
|
63
63
|
`mis_scope_smells`. Then:
|
|
64
64
|
|