codegate-ai 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/LICENSE +22 -0
- package/README.md +390 -0
- package/dist/cli-prompts.d.ts +6 -0
- package/dist/cli-prompts.js +94 -0
- package/dist/cli.d.ts +64 -0
- package/dist/cli.js +443 -0
- package/dist/commands/run-policy.d.ts +27 -0
- package/dist/commands/run-policy.js +39 -0
- package/dist/commands/scan-command/helpers.d.ts +28 -0
- package/dist/commands/scan-command/helpers.js +233 -0
- package/dist/commands/scan-command.d.ts +90 -0
- package/dist/commands/scan-command.js +403 -0
- package/dist/commands/undo.d.ts +5 -0
- package/dist/commands/undo.js +14 -0
- package/dist/config.d.ts +50 -0
- package/dist/config.js +187 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/knowledge-base/claude-code.json +152 -0
- package/dist/knowledge-base/cline.json +224 -0
- package/dist/knowledge-base/codex.json +162 -0
- package/dist/knowledge-base/copilot.json +132 -0
- package/dist/knowledge-base/cursor.json +134 -0
- package/dist/knowledge-base/gemini-cli.json +112 -0
- package/dist/knowledge-base/jetbrains-junie.json +208 -0
- package/dist/knowledge-base/kiro.json +102 -0
- package/dist/knowledge-base/opencode.json +128 -0
- package/dist/knowledge-base/roo-code.json +116 -0
- package/dist/knowledge-base/schema.json +77 -0
- package/dist/knowledge-base/windsurf.json +80 -0
- package/dist/knowledge-base/zed.json +88 -0
- package/dist/layer1-discovery/config-parser.d.ts +12 -0
- package/dist/layer1-discovery/config-parser.js +52 -0
- package/dist/layer1-discovery/file-walker.d.ts +13 -0
- package/dist/layer1-discovery/file-walker.js +77 -0
- package/dist/layer1-discovery/knowledge-base.d.ts +36 -0
- package/dist/layer1-discovery/knowledge-base.js +58 -0
- package/dist/layer1-discovery/tool-detector.d.ts +20 -0
- package/dist/layer1-discovery/tool-detector.js +138 -0
- package/dist/layer2-static/detectors/command-exec.d.ts +11 -0
- package/dist/layer2-static/detectors/command-exec.js +343 -0
- package/dist/layer2-static/detectors/consent-bypass.d.ts +8 -0
- package/dist/layer2-static/detectors/consent-bypass.js +330 -0
- package/dist/layer2-static/detectors/env-override.d.ts +8 -0
- package/dist/layer2-static/detectors/env-override.js +132 -0
- package/dist/layer2-static/detectors/git-hooks.d.ts +11 -0
- package/dist/layer2-static/detectors/git-hooks.js +61 -0
- package/dist/layer2-static/detectors/ide-settings.d.ts +8 -0
- package/dist/layer2-static/detectors/ide-settings.js +66 -0
- package/dist/layer2-static/detectors/plugin-manifest.d.ts +9 -0
- package/dist/layer2-static/detectors/plugin-manifest.js +1943 -0
- package/dist/layer2-static/detectors/rule-file.d.ts +7 -0
- package/dist/layer2-static/detectors/rule-file.js +299 -0
- package/dist/layer2-static/detectors/symlink.d.ts +9 -0
- package/dist/layer2-static/detectors/symlink.js +45 -0
- package/dist/layer2-static/engine.d.ts +28 -0
- package/dist/layer2-static/engine.js +83 -0
- package/dist/layer2-static/evidence.d.ts +12 -0
- package/dist/layer2-static/evidence.js +128 -0
- package/dist/layer2-static/rule-engine.d.ts +24 -0
- package/dist/layer2-static/rule-engine.js +138 -0
- package/dist/layer2-static/state/scan-state.d.ts +32 -0
- package/dist/layer2-static/state/scan-state.js +296 -0
- package/dist/layer3-dynamic/command-builder.d.ts +15 -0
- package/dist/layer3-dynamic/command-builder.js +39 -0
- package/dist/layer3-dynamic/local-text-analysis.d.ts +19 -0
- package/dist/layer3-dynamic/local-text-analysis.js +73 -0
- package/dist/layer3-dynamic/meta-agent.d.ts +17 -0
- package/dist/layer3-dynamic/meta-agent.js +33 -0
- package/dist/layer3-dynamic/prompt-templates/local-text-analysis.md +32 -0
- package/dist/layer3-dynamic/prompt-templates/security-analysis.md +13 -0
- package/dist/layer3-dynamic/prompt-templates/tool-poisoning.md +15 -0
- package/dist/layer3-dynamic/resource-fetcher.d.ts +25 -0
- package/dist/layer3-dynamic/resource-fetcher.js +119 -0
- package/dist/layer3-dynamic/sandbox.d.ts +13 -0
- package/dist/layer3-dynamic/sandbox.js +40 -0
- package/dist/layer3-dynamic/tool-description-acquisition.d.ts +22 -0
- package/dist/layer3-dynamic/tool-description-acquisition.js +76 -0
- package/dist/layer3-dynamic/tool-description-scanner.d.ts +11 -0
- package/dist/layer3-dynamic/tool-description-scanner.js +53 -0
- package/dist/layer3-dynamic/toxic-flow.d.ts +12 -0
- package/dist/layer3-dynamic/toxic-flow.js +57 -0
- package/dist/layer4-remediation/actions/quarantine.d.ts +1 -0
- package/dist/layer4-remediation/actions/quarantine.js +8 -0
- package/dist/layer4-remediation/actions/remove-field.d.ts +5 -0
- package/dist/layer4-remediation/actions/remove-field.js +53 -0
- package/dist/layer4-remediation/actions/replace-value.d.ts +5 -0
- package/dist/layer4-remediation/actions/replace-value.js +26 -0
- package/dist/layer4-remediation/actions/strip-unicode.d.ts +5 -0
- package/dist/layer4-remediation/actions/strip-unicode.js +8 -0
- package/dist/layer4-remediation/backup-manager.d.ts +32 -0
- package/dist/layer4-remediation/backup-manager.js +138 -0
- package/dist/layer4-remediation/diff-generator.d.ts +6 -0
- package/dist/layer4-remediation/diff-generator.js +29 -0
- package/dist/layer4-remediation/remediation-runner.d.ts +36 -0
- package/dist/layer4-remediation/remediation-runner.js +230 -0
- package/dist/layer4-remediation/remediator.d.ts +36 -0
- package/dist/layer4-remediation/remediator.js +117 -0
- package/dist/path-display.d.ts +1 -0
- package/dist/path-display.js +20 -0
- package/dist/pipeline.d.ts +34 -0
- package/dist/pipeline.js +259 -0
- package/dist/report-summary.d.ts +6 -0
- package/dist/report-summary.js +48 -0
- package/dist/reporter/html.d.ts +2 -0
- package/dist/reporter/html.js +103 -0
- package/dist/reporter/json.d.ts +2 -0
- package/dist/reporter/json.js +3 -0
- package/dist/reporter/markdown.d.ts +2 -0
- package/dist/reporter/markdown.js +52 -0
- package/dist/reporter/sarif.d.ts +2 -0
- package/dist/reporter/sarif.js +84 -0
- package/dist/reporter/terminal.d.ts +5 -0
- package/dist/reporter/terminal.js +94 -0
- package/dist/runtime/signal-handlers.d.ts +10 -0
- package/dist/runtime/signal-handlers.js +17 -0
- package/dist/scan-target/helpers.d.ts +20 -0
- package/dist/scan-target/helpers.js +268 -0
- package/dist/scan-target/staging.d.ts +5 -0
- package/dist/scan-target/staging.js +114 -0
- package/dist/scan-target/types.d.ts +18 -0
- package/dist/scan-target/types.js +1 -0
- package/dist/scan-target.d.ts +3 -0
- package/dist/scan-target.js +31 -0
- package/dist/scan.d.ts +54 -0
- package/dist/scan.js +593 -0
- package/dist/tui/app.d.ts +10 -0
- package/dist/tui/app.js +21 -0
- package/dist/tui/theme.d.ts +8 -0
- package/dist/tui/theme.js +7 -0
- package/dist/tui/views/dashboard.d.ts +6 -0
- package/dist/tui/views/dashboard.js +8 -0
- package/dist/tui/views/deep-scan-consent.d.ts +5 -0
- package/dist/tui/views/deep-scan-consent.js +6 -0
- package/dist/tui/views/progress.d.ts +4 -0
- package/dist/tui/views/progress.js +6 -0
- package/dist/tui/views/summary.d.ts +5 -0
- package/dist/tui/views/summary.js +16 -0
- package/dist/types/discovery.d.ts +12 -0
- package/dist/types/discovery.js +1 -0
- package/dist/types/finding.d.ts +46 -0
- package/dist/types/finding.js +15 -0
- package/dist/types/report.d.ts +25 -0
- package/dist/types/report.js +23 -0
- package/dist/wrapper.d.ts +35 -0
- package/dist/wrapper.js +220 -0
- package/package.json +97 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
import { renderHtmlReport } from "../../reporter/html.js";
|
|
3
|
+
import { renderJsonReport } from "../../reporter/json.js";
|
|
4
|
+
import { renderMarkdownReport } from "../../reporter/markdown.js";
|
|
5
|
+
import { renderSarifReport } from "../../reporter/sarif.js";
|
|
6
|
+
import { renderTerminalReport } from "../../reporter/terminal.js";
|
|
7
|
+
function isRecord(value) {
|
|
8
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9
|
+
}
|
|
10
|
+
export function metadataSummary(metadata) {
|
|
11
|
+
let raw;
|
|
12
|
+
if (typeof metadata === "string") {
|
|
13
|
+
raw = metadata;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
try {
|
|
17
|
+
raw = JSON.stringify(metadata, null, 2);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
raw = String(metadata);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const maxLength = 5000;
|
|
24
|
+
if (raw.length <= maxLength) {
|
|
25
|
+
return raw;
|
|
26
|
+
}
|
|
27
|
+
return `${raw.slice(0, maxLength)}\n...[truncated ${raw.length - maxLength} chars]`;
|
|
28
|
+
}
|
|
29
|
+
function parseJsonCandidate(value) {
|
|
30
|
+
return JSON.parse(value);
|
|
31
|
+
}
|
|
32
|
+
function unwrapMetaAgentEnvelope(parsed) {
|
|
33
|
+
if (!isRecord(parsed)) {
|
|
34
|
+
return parsed;
|
|
35
|
+
}
|
|
36
|
+
const result = parsed.result;
|
|
37
|
+
if (typeof result !== "string") {
|
|
38
|
+
return parsed;
|
|
39
|
+
}
|
|
40
|
+
const nested = parseMetaAgentOutput(result);
|
|
41
|
+
return nested ?? parsed;
|
|
42
|
+
}
|
|
43
|
+
export function parseMetaAgentOutput(stdout) {
|
|
44
|
+
const trimmed = stdout.trim();
|
|
45
|
+
if (trimmed.length === 0) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
return unwrapMetaAgentEnvelope(parseJsonCandidate(trimmed));
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
// Fall back to extracting a JSON block from markdown or mixed CLI output.
|
|
53
|
+
}
|
|
54
|
+
const fenced = /```(?:json)?\s*([\s\S]*?)```/giu;
|
|
55
|
+
let match = fenced.exec(trimmed);
|
|
56
|
+
while (match) {
|
|
57
|
+
try {
|
|
58
|
+
return parseJsonCandidate(match[1] ?? "");
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
// Continue parsing additional fenced blocks.
|
|
62
|
+
}
|
|
63
|
+
match = fenced.exec(trimmed);
|
|
64
|
+
}
|
|
65
|
+
const candidates = [trimmed.match(/\{[\s\S]*\}/u)?.[0], trimmed.match(/\[[\s\S]*\]/u)?.[0]];
|
|
66
|
+
for (const candidate of candidates) {
|
|
67
|
+
if (!candidate) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
return unwrapMetaAgentEnvelope(parseJsonCandidate(candidate));
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
// Continue trying fallback candidates.
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
export function withMetaAgentFinding(metadata, finding) {
|
|
80
|
+
const findingPayload = {
|
|
81
|
+
id: finding.id,
|
|
82
|
+
severity: finding.severity,
|
|
83
|
+
category: "PARSE_ERROR",
|
|
84
|
+
description: finding.description,
|
|
85
|
+
field: "layer3.meta_agent",
|
|
86
|
+
confidence: "HIGH",
|
|
87
|
+
evidence: finding.evidence,
|
|
88
|
+
};
|
|
89
|
+
if (!isRecord(metadata)) {
|
|
90
|
+
return { findings: [findingPayload] };
|
|
91
|
+
}
|
|
92
|
+
const existing = Array.isArray(metadata.findings) ? metadata.findings : [];
|
|
93
|
+
return {
|
|
94
|
+
...metadata,
|
|
95
|
+
findings: [...existing, findingPayload],
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export function mergeMetaAgentMetadata(baseMetadata, agentMetadata) {
|
|
99
|
+
if (!isRecord(baseMetadata)) {
|
|
100
|
+
return agentMetadata;
|
|
101
|
+
}
|
|
102
|
+
if (!isRecord(agentMetadata)) {
|
|
103
|
+
return baseMetadata;
|
|
104
|
+
}
|
|
105
|
+
const baseFindings = Array.isArray(baseMetadata.findings) ? baseMetadata.findings : [];
|
|
106
|
+
const agentFindings = Array.isArray(agentMetadata.findings) ? agentMetadata.findings : [];
|
|
107
|
+
return {
|
|
108
|
+
...baseMetadata,
|
|
109
|
+
...agentMetadata,
|
|
110
|
+
findings: [...baseFindings, ...agentFindings],
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
export function noEligibleDeepResourceNotes() {
|
|
114
|
+
return [
|
|
115
|
+
"Deep scan skipped: no eligible external resources were discovered.",
|
|
116
|
+
"Deep scan analyzes only remote MCP URLs (http/sse) and package-backed commands (npx/uvx/pipx).",
|
|
117
|
+
"Local stdio commands (for example `bash`) are still detected by Layer 2 but are never executed by deep scan.",
|
|
118
|
+
];
|
|
119
|
+
}
|
|
120
|
+
export function parseLocalTextFindings(filePath, metadata) {
|
|
121
|
+
if (!isRecord(metadata) || !Array.isArray(metadata.findings)) {
|
|
122
|
+
return [];
|
|
123
|
+
}
|
|
124
|
+
return metadata.findings
|
|
125
|
+
.filter((item) => isRecord(item))
|
|
126
|
+
.map((item, index) => ({
|
|
127
|
+
rule_id: typeof item.id === "string" ? item.id : "layer3-local-text-analysis-finding",
|
|
128
|
+
finding_id: typeof item.id === "string" ? item.id : `L3-local-${filePath}-${index}`,
|
|
129
|
+
severity: item.severity === "CRITICAL" ||
|
|
130
|
+
item.severity === "HIGH" ||
|
|
131
|
+
item.severity === "MEDIUM" ||
|
|
132
|
+
item.severity === "LOW"
|
|
133
|
+
? item.severity
|
|
134
|
+
: "INFO",
|
|
135
|
+
category: item.category === "ENV_OVERRIDE" ||
|
|
136
|
+
item.category === "COMMAND_EXEC" ||
|
|
137
|
+
item.category === "CONSENT_BYPASS" ||
|
|
138
|
+
item.category === "RULE_INJECTION" ||
|
|
139
|
+
item.category === "IDE_SETTINGS" ||
|
|
140
|
+
item.category === "SYMLINK_ESCAPE" ||
|
|
141
|
+
item.category === "GIT_HOOK" ||
|
|
142
|
+
item.category === "CONFIG_PRESENT" ||
|
|
143
|
+
item.category === "CONFIG_CHANGE" ||
|
|
144
|
+
item.category === "NEW_SERVER" ||
|
|
145
|
+
item.category === "TOXIC_FLOW"
|
|
146
|
+
? item.category
|
|
147
|
+
: "PARSE_ERROR",
|
|
148
|
+
layer: "L3",
|
|
149
|
+
file_path: typeof item.file_path === "string" ? item.file_path : filePath,
|
|
150
|
+
location: { field: typeof item.field === "string" ? item.field : "content" },
|
|
151
|
+
description: typeof item.description === "string" ? item.description : "Local text analysis finding",
|
|
152
|
+
affected_tools: [],
|
|
153
|
+
cve: null,
|
|
154
|
+
owasp: Array.isArray(item.owasp)
|
|
155
|
+
? item.owasp.filter((value) => typeof value === "string")
|
|
156
|
+
: [],
|
|
157
|
+
cwe: typeof item.cwe === "string" ? item.cwe : "CWE-20",
|
|
158
|
+
confidence: item.confidence === "HIGH" || item.confidence === "MEDIUM" ? item.confidence : "LOW",
|
|
159
|
+
evidence: typeof item.evidence === "string" ? item.evidence : null,
|
|
160
|
+
fixable: false,
|
|
161
|
+
remediation_actions: [],
|
|
162
|
+
suppressed: false,
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
165
|
+
function remediationModeLabel(options) {
|
|
166
|
+
if (options.fixSafe) {
|
|
167
|
+
return "fix-safe";
|
|
168
|
+
}
|
|
169
|
+
if (options.remediate && options.dryRun) {
|
|
170
|
+
return "remediate (dry-run)";
|
|
171
|
+
}
|
|
172
|
+
if (options.remediate) {
|
|
173
|
+
return "remediate";
|
|
174
|
+
}
|
|
175
|
+
if (options.patch && options.dryRun) {
|
|
176
|
+
return "patch (dry-run)";
|
|
177
|
+
}
|
|
178
|
+
if (options.patch) {
|
|
179
|
+
return "patch";
|
|
180
|
+
}
|
|
181
|
+
if (options.dryRun) {
|
|
182
|
+
return "dry-run";
|
|
183
|
+
}
|
|
184
|
+
return "remediation";
|
|
185
|
+
}
|
|
186
|
+
export function remediationSummaryLines(input) {
|
|
187
|
+
const planned = typeof input.result.plannedCount === "number" ? input.result.plannedCount : 0;
|
|
188
|
+
const applied = typeof input.result.appliedCount === "number" ? input.result.appliedCount : 0;
|
|
189
|
+
const lines = [];
|
|
190
|
+
lines.push("Remediation summary:");
|
|
191
|
+
lines.push(`Mode: ${remediationModeLabel(input.options)}`);
|
|
192
|
+
lines.push(`Planned changes: ${planned}`);
|
|
193
|
+
lines.push(`Applied changes: ${applied}`);
|
|
194
|
+
lines.push(`Findings before remediation: ${input.before.summary.total}`);
|
|
195
|
+
lines.push(`Findings after remediation: ${input.result.report.summary.total}`);
|
|
196
|
+
if (input.options.dryRun) {
|
|
197
|
+
lines.push("No files were changed (dry-run).");
|
|
198
|
+
}
|
|
199
|
+
else if (applied === 0) {
|
|
200
|
+
lines.push("No files were changed.");
|
|
201
|
+
}
|
|
202
|
+
if (input.result.backupSessionId) {
|
|
203
|
+
const backupPath = resolve(input.scanTarget, ".codegate-backup", input.result.backupSessionId);
|
|
204
|
+
lines.push(`Backup session: ${backupPath}`);
|
|
205
|
+
lines.push(`Undo: codegate undo ${input.scanTarget}`);
|
|
206
|
+
}
|
|
207
|
+
const actionLines = input.result.appliedActions ?? input.result.plannedActions ?? [];
|
|
208
|
+
if (actionLines.length > 0) {
|
|
209
|
+
lines.push("Remediation actions:");
|
|
210
|
+
for (const action of actionLines.slice(0, 10)) {
|
|
211
|
+
lines.push(`- ${action.action} -> ${resolve(input.scanTarget, action.filePath)} (${action.findingId})`);
|
|
212
|
+
}
|
|
213
|
+
if (actionLines.length > 10) {
|
|
214
|
+
lines.push(`- ...and ${actionLines.length - 10} more`);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return lines;
|
|
218
|
+
}
|
|
219
|
+
export function renderByFormat(format, report, options) {
|
|
220
|
+
if (format === "json") {
|
|
221
|
+
return renderJsonReport(report);
|
|
222
|
+
}
|
|
223
|
+
if (format === "sarif") {
|
|
224
|
+
return renderSarifReport(report);
|
|
225
|
+
}
|
|
226
|
+
if (format === "markdown") {
|
|
227
|
+
return renderMarkdownReport(report);
|
|
228
|
+
}
|
|
229
|
+
if (format === "html") {
|
|
230
|
+
return renderHtmlReport(report);
|
|
231
|
+
}
|
|
232
|
+
return renderTerminalReport(report, { verbose: options?.verbose === true });
|
|
233
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { type CodeGateConfig, type OutputFormat } from "../config.js";
|
|
2
|
+
import { type MetaAgentCommand, type MetaAgentTool } from "../layer3-dynamic/command-builder.js";
|
|
3
|
+
import type { LocalTextAnalysisTarget } from "../layer3-dynamic/local-text-analysis.js";
|
|
4
|
+
import type { ResourceFetchResult } from "../layer3-dynamic/resource-fetcher.js";
|
|
5
|
+
import { type DeepScanResource } from "../pipeline.js";
|
|
6
|
+
import type { ScanDiscoveryCandidate, ScanDiscoveryContext } from "../scan.js";
|
|
7
|
+
import type { CodeGateReport } from "../types/report.js";
|
|
8
|
+
import type { RemediationRunnerInput, RemediationRunnerResult } from "../layer4-remediation/remediation-runner.js";
|
|
9
|
+
export interface ScanCommandOptions {
|
|
10
|
+
deep?: boolean;
|
|
11
|
+
remediate?: boolean;
|
|
12
|
+
fixSafe?: boolean;
|
|
13
|
+
dryRun?: boolean;
|
|
14
|
+
patch?: boolean;
|
|
15
|
+
noTui?: boolean;
|
|
16
|
+
format?: OutputFormat;
|
|
17
|
+
output?: string;
|
|
18
|
+
verbose?: boolean;
|
|
19
|
+
config?: string;
|
|
20
|
+
force?: boolean;
|
|
21
|
+
resetState?: boolean;
|
|
22
|
+
includeUserScope?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface ScanRunnerInput {
|
|
25
|
+
version: string;
|
|
26
|
+
scanTarget: string;
|
|
27
|
+
config: CodeGateConfig;
|
|
28
|
+
flags: ScanCommandOptions;
|
|
29
|
+
discoveryContext?: ScanDiscoveryContext;
|
|
30
|
+
}
|
|
31
|
+
export interface DeepAgentOption {
|
|
32
|
+
id: "claude" | "codex" | "opencode";
|
|
33
|
+
label: string;
|
|
34
|
+
metaTool: MetaAgentTool;
|
|
35
|
+
binary: string;
|
|
36
|
+
detectedTool: string;
|
|
37
|
+
}
|
|
38
|
+
export interface MetaAgentCommandConsentContext {
|
|
39
|
+
resource?: DeepScanResource;
|
|
40
|
+
localFile?: LocalTextAnalysisTarget;
|
|
41
|
+
agent: DeepAgentOption;
|
|
42
|
+
command: MetaAgentCommand;
|
|
43
|
+
}
|
|
44
|
+
export interface MetaAgentCommandRunResult {
|
|
45
|
+
command: MetaAgentCommand;
|
|
46
|
+
code: number;
|
|
47
|
+
stdout: string;
|
|
48
|
+
stderr: string;
|
|
49
|
+
}
|
|
50
|
+
export interface RemediationConsentContext {
|
|
51
|
+
scanTarget: string;
|
|
52
|
+
totalFindings: number;
|
|
53
|
+
fixableFindings: number;
|
|
54
|
+
criticalFindings: number;
|
|
55
|
+
}
|
|
56
|
+
export interface ExecuteScanCommandInput {
|
|
57
|
+
version: string;
|
|
58
|
+
cwd: string;
|
|
59
|
+
scanTarget: string;
|
|
60
|
+
displayTarget?: string;
|
|
61
|
+
explicitCandidates?: ScanDiscoveryCandidate[];
|
|
62
|
+
config: CodeGateConfig;
|
|
63
|
+
options: ScanCommandOptions;
|
|
64
|
+
}
|
|
65
|
+
export interface ExecuteScanCommandDeps {
|
|
66
|
+
isTTY: () => boolean;
|
|
67
|
+
runScan: (input: ScanRunnerInput) => Promise<CodeGateReport>;
|
|
68
|
+
prepareScanDiscovery?: (scanTarget: string, config?: CodeGateConfig, options?: {
|
|
69
|
+
explicitCandidates?: ScanDiscoveryCandidate[];
|
|
70
|
+
}) => Promise<ScanDiscoveryContext> | ScanDiscoveryContext;
|
|
71
|
+
discoverDeepResources?: (scanTarget: string, config?: CodeGateConfig, discoveryContext?: ScanDiscoveryContext) => Promise<DeepScanResource[]> | DeepScanResource[];
|
|
72
|
+
discoverLocalTextTargets?: (scanTarget: string, config?: CodeGateConfig, discoveryContext?: ScanDiscoveryContext) => Promise<LocalTextAnalysisTarget[]> | LocalTextAnalysisTarget[];
|
|
73
|
+
requestDeepScanConsent?: (resource: DeepScanResource) => Promise<boolean> | boolean;
|
|
74
|
+
requestDeepAgentSelection?: (options: DeepAgentOption[]) => Promise<DeepAgentOption | null> | DeepAgentOption | null;
|
|
75
|
+
requestMetaAgentCommandConsent?: (context: MetaAgentCommandConsentContext) => Promise<boolean> | boolean;
|
|
76
|
+
runMetaAgentCommand?: (context: MetaAgentCommandConsentContext) => Promise<MetaAgentCommandRunResult> | MetaAgentCommandRunResult;
|
|
77
|
+
requestRemediationConsent?: (context: RemediationConsentContext) => Promise<boolean> | boolean;
|
|
78
|
+
executeDeepResource?: (resource: DeepScanResource) => Promise<ResourceFetchResult>;
|
|
79
|
+
runRemediation?: (input: RemediationRunnerInput) => Promise<RemediationRunnerResult> | RemediationRunnerResult;
|
|
80
|
+
stdout: (message: string) => void;
|
|
81
|
+
stderr: (message: string) => void;
|
|
82
|
+
writeFile: (path: string, content: string) => void;
|
|
83
|
+
setExitCode: (code: number) => void;
|
|
84
|
+
renderTui?: (props: {
|
|
85
|
+
view: "dashboard" | "summary";
|
|
86
|
+
report: CodeGateReport;
|
|
87
|
+
notices?: string[];
|
|
88
|
+
}) => void;
|
|
89
|
+
}
|
|
90
|
+
export declare function executeScanCommand(input: ExecuteScanCommandInput, deps: ExecuteScanCommandDeps): Promise<void>;
|