auditor-lambda 0.1.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.
- package/README.md +173 -0
- package/audit-code-wrapper-lib.mjs +905 -0
- package/audit-code.mjs +13 -0
- package/dist/adapters/coverageSummary.d.ts +8 -0
- package/dist/adapters/coverageSummary.js +13 -0
- package/dist/adapters/eslint.d.ts +13 -0
- package/dist/adapters/eslint.js +21 -0
- package/dist/adapters/normalizeExternal.d.ts +12 -0
- package/dist/adapters/normalizeExternal.js +19 -0
- package/dist/adapters/npmAudit.d.ts +15 -0
- package/dist/adapters/npmAudit.js +12 -0
- package/dist/adapters/semgrep.d.ts +22 -0
- package/dist/adapters/semgrep.js +14 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +724 -0
- package/dist/coverage.d.ts +11 -0
- package/dist/coverage.js +102 -0
- package/dist/extractors/bucketing.d.ts +7 -0
- package/dist/extractors/bucketing.js +72 -0
- package/dist/extractors/disposition.d.ts +4 -0
- package/dist/extractors/disposition.js +41 -0
- package/dist/extractors/fileInventory.d.ts +7 -0
- package/dist/extractors/fileInventory.js +44 -0
- package/dist/extractors/flows.d.ts +5 -0
- package/dist/extractors/flows.js +125 -0
- package/dist/extractors/fsIntake.d.ts +8 -0
- package/dist/extractors/fsIntake.js +66 -0
- package/dist/extractors/graph.d.ts +4 -0
- package/dist/extractors/graph.js +46 -0
- package/dist/extractors/ignore.d.ts +1 -0
- package/dist/extractors/ignore.js +17 -0
- package/dist/extractors/risk.d.ts +5 -0
- package/dist/extractors/risk.js +45 -0
- package/dist/extractors/surfaces.d.ts +4 -0
- package/dist/extractors/surfaces.js +40 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/io/artifacts.d.ts +38 -0
- package/dist/io/artifacts.js +100 -0
- package/dist/io/json.d.ts +8 -0
- package/dist/io/json.js +96 -0
- package/dist/io/runArtifacts.d.ts +14 -0
- package/dist/io/runArtifacts.js +37 -0
- package/dist/orchestrator/advance.d.ts +24 -0
- package/dist/orchestrator/advance.js +104 -0
- package/dist/orchestrator/artifactMetadata.d.ts +4 -0
- package/dist/orchestrator/artifactMetadata.js +111 -0
- package/dist/orchestrator/autoFixExecutor.d.ts +3 -0
- package/dist/orchestrator/autoFixExecutor.js +63 -0
- package/dist/orchestrator/chunking.d.ts +5 -0
- package/dist/orchestrator/chunking.js +13 -0
- package/dist/orchestrator/dependencyMap.d.ts +1 -0
- package/dist/orchestrator/dependencyMap.js +82 -0
- package/dist/orchestrator/executors.d.ts +6 -0
- package/dist/orchestrator/executors.js +52 -0
- package/dist/orchestrator/flowCoverage.d.ts +4 -0
- package/dist/orchestrator/flowCoverage.js +44 -0
- package/dist/orchestrator/flowPlanning.d.ts +3 -0
- package/dist/orchestrator/flowPlanning.js +42 -0
- package/dist/orchestrator/flowRequeue.d.ts +5 -0
- package/dist/orchestrator/flowRequeue.js +58 -0
- package/dist/orchestrator/internalExecutors.d.ts +16 -0
- package/dist/orchestrator/internalExecutors.js +212 -0
- package/dist/orchestrator/nextStep.d.ts +9 -0
- package/dist/orchestrator/nextStep.js +44 -0
- package/dist/orchestrator/planning.d.ts +4 -0
- package/dist/orchestrator/planning.js +62 -0
- package/dist/orchestrator/requeue.d.ts +3 -0
- package/dist/orchestrator/requeue.js +25 -0
- package/dist/orchestrator/requeueCommand.d.ts +10 -0
- package/dist/orchestrator/requeueCommand.js +27 -0
- package/dist/orchestrator/resultIngestion.d.ts +2 -0
- package/dist/orchestrator/resultIngestion.js +13 -0
- package/dist/orchestrator/runtimeValidation.d.ts +7 -0
- package/dist/orchestrator/runtimeValidation.js +103 -0
- package/dist/orchestrator/runtimeValidationUpdate.d.ts +2 -0
- package/dist/orchestrator/runtimeValidationUpdate.js +52 -0
- package/dist/orchestrator/staleness.d.ts +2 -0
- package/dist/orchestrator/staleness.js +83 -0
- package/dist/orchestrator/state.d.ts +3 -0
- package/dist/orchestrator/state.js +85 -0
- package/dist/orchestrator/syntaxResolutionExecutor.d.ts +3 -0
- package/dist/orchestrator/syntaxResolutionExecutor.js +99 -0
- package/dist/orchestrator/taskBuilder.d.ts +12 -0
- package/dist/orchestrator/taskBuilder.js +154 -0
- package/dist/orchestrator/unitBuilder.d.ts +3 -0
- package/dist/orchestrator/unitBuilder.js +145 -0
- package/dist/orchestrator.d.ts +6 -0
- package/dist/orchestrator.js +33 -0
- package/dist/prompts/renderWorkerPrompt.d.ts +2 -0
- package/dist/prompts/renderWorkerPrompt.js +19 -0
- package/dist/providers/claudeCodeProvider.d.ts +8 -0
- package/dist/providers/claudeCodeProvider.js +20 -0
- package/dist/providers/index.d.ts +7 -0
- package/dist/providers/index.js +77 -0
- package/dist/providers/localSubprocessProvider.d.ts +5 -0
- package/dist/providers/localSubprocessProvider.js +13 -0
- package/dist/providers/opencodeProvider.d.ts +8 -0
- package/dist/providers/opencodeProvider.js +15 -0
- package/dist/providers/spawnLoggedCommand.d.ts +2 -0
- package/dist/providers/spawnLoggedCommand.js +48 -0
- package/dist/providers/subprocessTemplateProvider.d.ts +8 -0
- package/dist/providers/subprocessTemplateProvider.js +41 -0
- package/dist/providers/types.d.ts +22 -0
- package/dist/providers/types.js +1 -0
- package/dist/providers/vscodeTaskProvider.d.ts +8 -0
- package/dist/providers/vscodeTaskProvider.js +14 -0
- package/dist/reporting/mergeFindings.d.ts +4 -0
- package/dist/reporting/mergeFindings.js +136 -0
- package/dist/reporting/rootCause.d.ts +11 -0
- package/dist/reporting/rootCause.js +69 -0
- package/dist/reporting/synthesis.d.ts +21 -0
- package/dist/reporting/synthesis.js +55 -0
- package/dist/supervisor/operatorHandoff.d.ts +37 -0
- package/dist/supervisor/operatorHandoff.js +144 -0
- package/dist/supervisor/runLedger.d.ts +3 -0
- package/dist/supervisor/runLedger.js +17 -0
- package/dist/supervisor/sessionConfig.d.ts +4 -0
- package/dist/supervisor/sessionConfig.js +26 -0
- package/dist/types/artifactMetadata.d.ts +8 -0
- package/dist/types/artifactMetadata.js +1 -0
- package/dist/types/auditState.d.ts +14 -0
- package/dist/types/auditState.js +1 -0
- package/dist/types/disposition.d.ts +9 -0
- package/dist/types/disposition.js +1 -0
- package/dist/types/externalAnalyzer.d.ts +16 -0
- package/dist/types/externalAnalyzer.js +1 -0
- package/dist/types/flowCoverage.d.ts +11 -0
- package/dist/types/flowCoverage.js +1 -0
- package/dist/types/flows.d.ts +11 -0
- package/dist/types/flows.js +1 -0
- package/dist/types/graph.d.ts +18 -0
- package/dist/types/graph.js +1 -0
- package/dist/types/risk.d.ts +9 -0
- package/dist/types/risk.js +1 -0
- package/dist/types/runLedger.d.ts +13 -0
- package/dist/types/runLedger.js +1 -0
- package/dist/types/runtimeValidation.d.ts +22 -0
- package/dist/types/runtimeValidation.js +1 -0
- package/dist/types/sessionConfig.d.ts +27 -0
- package/dist/types/sessionConfig.js +1 -0
- package/dist/types/surfaces.d.ts +11 -0
- package/dist/types/surfaces.js +1 -0
- package/dist/types/workerResult.d.ts +13 -0
- package/dist/types/workerResult.js +1 -0
- package/dist/types/workerSession.d.ts +13 -0
- package/dist/types/workerSession.js +1 -0
- package/dist/types.d.ts +104 -0
- package/dist/types.js +1 -0
- package/dist/validation/artifacts.d.ts +3 -0
- package/dist/validation/artifacts.js +191 -0
- package/dist/validation/basic.d.ts +5 -0
- package/dist/validation/basic.js +9 -0
- package/dist/validation/sessionConfig.d.ts +6 -0
- package/dist/validation/sessionConfig.js +139 -0
- package/docs/agent-integrations.md +237 -0
- package/docs/agent-roles.md +69 -0
- package/docs/architecture.md +90 -0
- package/docs/artifacts.md +69 -0
- package/docs/bootstrap-install.md +79 -0
- package/docs/contract.md +140 -0
- package/docs/github-copilot.md +50 -0
- package/docs/model-selection.md +86 -0
- package/docs/next-steps.md +161 -0
- package/docs/packaging.md +88 -0
- package/docs/pipeline.md +152 -0
- package/docs/product-direction.md +111 -0
- package/docs/production-launch-bar.md +83 -0
- package/docs/production-readiness.md +52 -0
- package/docs/repo-layout.md +30 -0
- package/docs/run-flow.md +49 -0
- package/docs/session-config.md +232 -0
- package/docs/supervisor.md +83 -0
- package/docs/usage.md +172 -0
- package/docs/windows-setup.md +146 -0
- package/package.json +56 -0
- package/schemas/audit-code-v1alpha1.schema.json +191 -0
- package/schemas/audit_result.schema.json +48 -0
- package/schemas/audit_state.schema.json +36 -0
- package/schemas/audit_task.schema.json +49 -0
- package/schemas/blind_spot_register.schema.json +40 -0
- package/schemas/coverage_matrix.schema.json +50 -0
- package/schemas/critical_flows.schema.json +38 -0
- package/schemas/external_analyzer_results.schema.json +31 -0
- package/schemas/file_disposition.schema.json +33 -0
- package/schemas/finding.schema.json +62 -0
- package/schemas/flow_coverage.schema.json +44 -0
- package/schemas/graph_bundle.schema.json +55 -0
- package/schemas/merged_findings.schema.json +14 -0
- package/schemas/repo_manifest.schema.json +37 -0
- package/schemas/risk_register.schema.json +30 -0
- package/schemas/root_cause_clusters.schema.json +31 -0
- package/schemas/runtime_validation_report.schema.json +34 -0
- package/schemas/runtime_validation_tasks.schema.json +36 -0
- package/schemas/surface_manifest.schema.json +32 -0
- package/schemas/synthesis_report.schema.json +61 -0
- package/schemas/unit_manifest.schema.json +36 -0
- package/skills/audit-code/SKILL.md +54 -0
- package/skills/audit-code/audit-code.prompt.md +66 -0
package/audit-code.mjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { runAuditCodeWrapper } from "./audit-code-wrapper-lib.mjs";
|
|
4
|
+
|
|
5
|
+
try {
|
|
6
|
+
await runAuditCodeWrapper({
|
|
7
|
+
usageName: "audit-code.mjs",
|
|
8
|
+
ensureArtifactsDir: true,
|
|
9
|
+
});
|
|
10
|
+
} catch (error) {
|
|
11
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
12
|
+
process.exitCode = 1;
|
|
13
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ExternalAnalyzerResults } from "../types/externalAnalyzer.js";
|
|
2
|
+
interface CoverageFileSummary {
|
|
3
|
+
path: string;
|
|
4
|
+
lines_pct: number;
|
|
5
|
+
branches_pct?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function normalizeCoverageSummary(files: CoverageFileSummary[]): ExternalAnalyzerResults;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { normalizeGenericExternalResults } from "./normalizeExternal.js";
|
|
2
|
+
export function normalizeCoverageSummary(files) {
|
|
3
|
+
return normalizeGenericExternalResults("coverage-summary", files
|
|
4
|
+
.filter((file) => file.lines_pct < 80)
|
|
5
|
+
.map((file, index) => ({
|
|
6
|
+
id: `coverage-${index + 1}`,
|
|
7
|
+
category: "tests",
|
|
8
|
+
severity: file.lines_pct < 50 ? "high" : "medium",
|
|
9
|
+
path: file.path,
|
|
10
|
+
summary: `Low line coverage: ${file.lines_pct}%${typeof file.branches_pct === "number" ? `, branch coverage ${file.branches_pct}%` : ""}.`,
|
|
11
|
+
raw: file,
|
|
12
|
+
})));
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ExternalAnalyzerResults } from "../types/externalAnalyzer.js";
|
|
2
|
+
interface EslintResult {
|
|
3
|
+
filePath?: string;
|
|
4
|
+
messages?: Array<{
|
|
5
|
+
ruleId?: string | null;
|
|
6
|
+
severity?: number;
|
|
7
|
+
line?: number;
|
|
8
|
+
endLine?: number;
|
|
9
|
+
message?: string;
|
|
10
|
+
}>;
|
|
11
|
+
}
|
|
12
|
+
export declare function normalizeEslintJson(input: EslintResult[]): ExternalAnalyzerResults;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { normalizeGenericExternalResults } from "./normalizeExternal.js";
|
|
2
|
+
function mapSeverity(value) {
|
|
3
|
+
if (value === 2)
|
|
4
|
+
return "medium";
|
|
5
|
+
if (value === 1)
|
|
6
|
+
return "low";
|
|
7
|
+
return "info";
|
|
8
|
+
}
|
|
9
|
+
export function normalizeEslintJson(input) {
|
|
10
|
+
return normalizeGenericExternalResults("eslint", input.flatMap((file) => (file.messages ?? []).map((message, index) => ({
|
|
11
|
+
id: `${file.filePath ?? "unknown"}:${index + 1}`,
|
|
12
|
+
category: "maintainability",
|
|
13
|
+
severity: mapSeverity(message.severity),
|
|
14
|
+
path: file.filePath,
|
|
15
|
+
line_start: message.line,
|
|
16
|
+
line_end: message.endLine,
|
|
17
|
+
summary: message.message,
|
|
18
|
+
rule: message.ruleId ?? undefined,
|
|
19
|
+
raw: message,
|
|
20
|
+
}))));
|
|
21
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ExternalAnalyzerResults } from "../types/externalAnalyzer.js";
|
|
2
|
+
export declare function normalizeGenericExternalResults(tool: string, items: Array<{
|
|
3
|
+
id?: string;
|
|
4
|
+
category?: string;
|
|
5
|
+
severity?: string;
|
|
6
|
+
path?: string;
|
|
7
|
+
line_start?: number;
|
|
8
|
+
line_end?: number;
|
|
9
|
+
summary?: string;
|
|
10
|
+
rule?: string;
|
|
11
|
+
raw?: unknown;
|
|
12
|
+
}>): ExternalAnalyzerResults;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function normalizeGenericExternalResults(tool, items) {
|
|
2
|
+
return {
|
|
3
|
+
tool,
|
|
4
|
+
generated_at: new Date().toISOString(),
|
|
5
|
+
results: items
|
|
6
|
+
.filter((item) => item.path && item.summary)
|
|
7
|
+
.map((item, index) => ({
|
|
8
|
+
id: item.id ?? `${tool}-${index + 1}`,
|
|
9
|
+
category: item.category ?? "unknown",
|
|
10
|
+
severity: item.severity ?? "unknown",
|
|
11
|
+
path: item.path,
|
|
12
|
+
line_start: item.line_start,
|
|
13
|
+
line_end: item.line_end,
|
|
14
|
+
summary: item.summary,
|
|
15
|
+
rule: item.rule,
|
|
16
|
+
raw: item.raw,
|
|
17
|
+
})),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ExternalAnalyzerResults } from "../types/externalAnalyzer.js";
|
|
2
|
+
interface NpmAuditVuln {
|
|
3
|
+
name?: string;
|
|
4
|
+
severity?: string;
|
|
5
|
+
range?: string;
|
|
6
|
+
fixAvailable?: boolean | {
|
|
7
|
+
name?: string;
|
|
8
|
+
version?: string;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
interface NpmAuditJson {
|
|
12
|
+
vulnerabilities?: Record<string, NpmAuditVuln>;
|
|
13
|
+
}
|
|
14
|
+
export declare function normalizeNpmAuditJson(input: NpmAuditJson): ExternalAnalyzerResults;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { normalizeGenericExternalResults } from "./normalizeExternal.js";
|
|
2
|
+
export function normalizeNpmAuditJson(input) {
|
|
3
|
+
return normalizeGenericExternalResults("npm-audit", Object.entries(input.vulnerabilities ?? {}).map(([pkg, vuln], index) => ({
|
|
4
|
+
id: `npm-audit-${index + 1}`,
|
|
5
|
+
category: "dependency_risk",
|
|
6
|
+
severity: vuln.severity ?? "unknown",
|
|
7
|
+
path: "package-lock.json",
|
|
8
|
+
summary: `Package ${pkg} has a ${vuln.severity ?? "unknown"} severity vulnerability in range ${vuln.range ?? "unknown"}.`,
|
|
9
|
+
rule: pkg,
|
|
10
|
+
raw: vuln,
|
|
11
|
+
})));
|
|
12
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ExternalAnalyzerResults } from "../types/externalAnalyzer.js";
|
|
2
|
+
interface SemgrepJson {
|
|
3
|
+
results?: Array<{
|
|
4
|
+
check_id?: string;
|
|
5
|
+
path?: string;
|
|
6
|
+
start?: {
|
|
7
|
+
line?: number;
|
|
8
|
+
};
|
|
9
|
+
end?: {
|
|
10
|
+
line?: number;
|
|
11
|
+
};
|
|
12
|
+
extra?: {
|
|
13
|
+
severity?: string;
|
|
14
|
+
message?: string;
|
|
15
|
+
metadata?: {
|
|
16
|
+
category?: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}>;
|
|
20
|
+
}
|
|
21
|
+
export declare function normalizeSemgrepJson(input: SemgrepJson): ExternalAnalyzerResults;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { normalizeGenericExternalResults } from "./normalizeExternal.js";
|
|
2
|
+
export function normalizeSemgrepJson(input) {
|
|
3
|
+
return normalizeGenericExternalResults("semgrep", (input.results ?? []).map((result) => ({
|
|
4
|
+
id: result.check_id,
|
|
5
|
+
category: result.extra?.metadata?.category ?? "security",
|
|
6
|
+
severity: result.extra?.severity,
|
|
7
|
+
path: result.path,
|
|
8
|
+
line_start: result.start?.line,
|
|
9
|
+
line_end: result.end?.line,
|
|
10
|
+
summary: result.extra?.message,
|
|
11
|
+
rule: result.check_id,
|
|
12
|
+
raw: result,
|
|
13
|
+
})));
|
|
14
|
+
}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function runSample(): Promise<void>;
|