@neuralaxis/vibedoctor 0.1.1 → 0.1.3
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 +219 -290
- package/dist/adapters/biome.d.ts +1 -1
- package/dist/adapters/biome.js +7 -4
- package/dist/adapters/coveragePy.js +3 -0
- package/dist/adapters/customDeadChain.d.ts +2 -1
- package/dist/adapters/customDeadChain.js +100 -8
- package/dist/adapters/customLeftovers.js +33 -10
- package/dist/adapters/deptry.js +21 -2
- package/dist/adapters/index.d.ts +3 -0
- package/dist/adapters/index.js +7 -1
- package/dist/adapters/jscpd.d.ts +1 -0
- package/dist/adapters/jscpd.js +10 -1
- package/dist/adapters/knip.js +29 -4
- package/dist/adapters/lizard.d.ts +1 -1
- package/dist/adapters/lizard.js +51 -2
- package/dist/adapters/osvScanner.js +14 -2
- package/dist/adapters/presidio.d.ts +2 -0
- package/dist/adapters/presidio.js +158 -0
- package/dist/adapters/privacyDetector.d.ts +10 -0
- package/dist/adapters/privacyDetector.js +600 -0
- package/dist/adapters/ruff.d.ts +1 -1
- package/dist/adapters/ruff.js +4 -1
- package/dist/adapters/semgrep.d.ts +1 -1
- package/dist/adapters/semgrep.js +17 -3
- package/dist/adapters/shared.d.ts +1 -0
- package/dist/adapters/shared.js +22 -0
- package/dist/adapters/telemetryDetector.d.ts +2 -0
- package/dist/adapters/telemetryDetector.js +118 -0
- package/dist/adapters/tsc.js +43 -18
- package/dist/adapters/vulture.d.ts +1 -1
- package/dist/adapters/vulture.js +25 -6
- package/dist/agentPack/generateAgentPack.d.ts +7 -0
- package/dist/agentPack/generateAgentPack.js +89 -1
- package/dist/agentPack/templates/index.js +21 -15
- package/dist/agentPack/templates/skills.js +57 -4
- package/dist/cli/commands/agent.d.ts +5 -0
- package/dist/cli/commands/agent.js +10 -0
- package/dist/cli/commands/agentPlan.js +9 -1
- package/dist/cli/commands/init.js +50 -17
- package/dist/cli/commands/privacyReview.d.ts +9 -0
- package/dist/cli/commands/privacyReview.js +304 -0
- package/dist/cli/commands/scan.d.ts +1 -1
- package/dist/cli/commands/scan.js +31 -1
- package/dist/cli/commands/setup.js +16 -1
- package/dist/cli/commands/tool.d.ts +4 -0
- package/dist/cli/commands/tool.js +11 -0
- package/dist/cli/index.js +36 -0
- package/dist/core/config.d.ts +29 -0
- package/dist/core/config.js +142 -5
- package/dist/core/engine.d.ts +35 -1
- package/dist/core/engine.js +204 -36
- package/dist/core/finding.d.ts +16 -2
- package/dist/core/finding.js +5 -0
- package/dist/core/paths.js +5 -0
- package/dist/core/privacyReview.d.ts +51 -0
- package/dist/core/privacyReview.js +94 -0
- package/dist/core/projectDetector.d.ts +1 -1
- package/dist/core/projectDetector.js +34 -12
- package/dist/core/scanPlanner.js +4 -0
- package/dist/core/scoring.js +6 -0
- package/dist/core/toolRunner.d.ts +1 -0
- package/dist/core/toolRunner.js +73 -11
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -0
- package/dist/mcp/tools/shared.d.ts +1 -1
- package/dist/mcp/tools/shared.js +8 -1
- package/dist/reporters/agent.js +8 -0
- package/dist/reporters/html.js +12 -8
- package/dist/reporters/json.js +5 -5
- package/dist/reporters/markdown.js +15 -1
- package/dist/reporters/sarif.js +6 -0
- package/dist/reporters/terminal.js +1 -5
- package/dist/rules/severityMap.d.ts +1 -0
- package/dist/rules/severityMap.js +1 -0
- package/package.json +6 -2
package/dist/core/config.js
CHANGED
|
@@ -18,8 +18,27 @@ exports.defaultConfig = {
|
|
|
18
18
|
languages: []
|
|
19
19
|
},
|
|
20
20
|
paths: {
|
|
21
|
-
include: [
|
|
22
|
-
|
|
21
|
+
include: [
|
|
22
|
+
"src/**",
|
|
23
|
+
"app/**",
|
|
24
|
+
"packages/**",
|
|
25
|
+
"services/**",
|
|
26
|
+
"tests/**",
|
|
27
|
+
"*.{js,jsx,ts,tsx,py}",
|
|
28
|
+
"**/*.{js,jsx,ts,tsx,py}",
|
|
29
|
+
"*.prisma",
|
|
30
|
+
"**/*.prisma"
|
|
31
|
+
],
|
|
32
|
+
exclude: [
|
|
33
|
+
...paths_1.DEFAULT_EXCLUDES,
|
|
34
|
+
"test/**",
|
|
35
|
+
"tests/**",
|
|
36
|
+
"**/test/**",
|
|
37
|
+
"**/tests/**",
|
|
38
|
+
"**/*.test.*",
|
|
39
|
+
"**/*.spec.*",
|
|
40
|
+
"**/__tests__/**"
|
|
41
|
+
]
|
|
23
42
|
},
|
|
24
43
|
baseline: {
|
|
25
44
|
enabled: true,
|
|
@@ -29,6 +48,15 @@ exports.defaultConfig = {
|
|
|
29
48
|
score: {
|
|
30
49
|
minimum: 80
|
|
31
50
|
},
|
|
51
|
+
runtime: {
|
|
52
|
+
defaultTimeoutSeconds: 120,
|
|
53
|
+
toolTimeouts: {
|
|
54
|
+
biome: 180,
|
|
55
|
+
semgrep: 300
|
|
56
|
+
},
|
|
57
|
+
requiredTools: [],
|
|
58
|
+
failOnIncompleteScan: false
|
|
59
|
+
},
|
|
32
60
|
checks: {
|
|
33
61
|
security: {
|
|
34
62
|
enabled: true,
|
|
@@ -67,13 +95,36 @@ exports.defaultConfig = {
|
|
|
67
95
|
enabled: true,
|
|
68
96
|
failOnMissingDependencies: true,
|
|
69
97
|
failOnNewDirectVulnerabilities: true
|
|
98
|
+
},
|
|
99
|
+
privacy: {
|
|
100
|
+
enabled: true,
|
|
101
|
+
minConfidenceToReport: "medium",
|
|
102
|
+
maskExamples: true,
|
|
103
|
+
maxFileBytes: 1_048_576,
|
|
104
|
+
failOnRegulatedIdentifiers: false,
|
|
105
|
+
failOnSensitiveAttributes: false,
|
|
106
|
+
detectTelemetryOptOut: true,
|
|
107
|
+
detectUnsanitizedLogs: true,
|
|
108
|
+
detectApiOverfetching: true,
|
|
109
|
+
detectMissingRetention: true,
|
|
110
|
+
ai: {
|
|
111
|
+
enabled: false,
|
|
112
|
+
apiKeyEnv: "VIBEDOCTOR_AI_API_KEY",
|
|
113
|
+
baseUrlEnv: "VIBEDOCTOR_AI_BASE_URL",
|
|
114
|
+
modelEnv: "VIBEDOCTOR_AI_MODEL",
|
|
115
|
+
includeRawValues: false
|
|
116
|
+
},
|
|
117
|
+
presidio: {
|
|
118
|
+
enabled: false
|
|
119
|
+
}
|
|
70
120
|
}
|
|
71
121
|
},
|
|
72
122
|
output: {
|
|
73
123
|
terminal: true,
|
|
74
124
|
json: ".vibedoctor/report.json",
|
|
75
125
|
html: ".vibedoctor/report.html",
|
|
76
|
-
agent: ".vibedoctor/agent-plan.md"
|
|
126
|
+
agent: ".vibedoctor/agent-plan.md",
|
|
127
|
+
privacyReview: ".vibedoctor/privacy-review.json"
|
|
77
128
|
}
|
|
78
129
|
};
|
|
79
130
|
const CONFIG_FILES = ["vibedoctor.yml", "vibedoctor.yaml", "vibedoctor.json"];
|
|
@@ -107,9 +158,11 @@ async function findConfigFile(root) {
|
|
|
107
158
|
return undefined;
|
|
108
159
|
}
|
|
109
160
|
function normalizeRawConfig(raw) {
|
|
110
|
-
const { baseline: _baseline, checks: _checks, ...rest } = raw;
|
|
161
|
+
const { baseline: _baseline, checks: _checks, output: _output, runtime: _runtime, ...rest } = raw;
|
|
111
162
|
const rawChecks = raw.checks;
|
|
112
163
|
const rawBaseline = raw.baseline;
|
|
164
|
+
const rawOutput = raw.output;
|
|
165
|
+
const rawRuntime = raw.runtime;
|
|
113
166
|
const rawDeadCode = (rawChecks?.deadCode ?? rawChecks?.dead_code);
|
|
114
167
|
const rawLeftovers = rawChecks?.leftovers;
|
|
115
168
|
const rawRefactor = (rawChecks?.refactorReadiness ?? rawChecks?.refactor_readiness);
|
|
@@ -117,8 +170,42 @@ function normalizeRawConfig(raw) {
|
|
|
117
170
|
const rawCorrectness = rawChecks?.correctness;
|
|
118
171
|
const rawTests = rawChecks?.tests;
|
|
119
172
|
const rawDependencies = rawChecks?.dependencies;
|
|
173
|
+
const rawPrivacy = rawChecks?.privacy;
|
|
174
|
+
const rawPrivacyAi = (rawPrivacy?.ai ?? {});
|
|
175
|
+
const rawPresidio = (rawPrivacy?.presidio ?? {});
|
|
120
176
|
return {
|
|
121
177
|
...rest,
|
|
178
|
+
...(rawRuntime
|
|
179
|
+
? {
|
|
180
|
+
runtime: {
|
|
181
|
+
defaultTimeoutSeconds: rawRuntime.defaultTimeoutSeconds ??
|
|
182
|
+
rawRuntime.default_timeout_seconds ??
|
|
183
|
+
exports.defaultConfig.runtime.defaultTimeoutSeconds,
|
|
184
|
+
toolTimeouts: rawRuntime.toolTimeouts ??
|
|
185
|
+
rawRuntime.tool_timeouts ??
|
|
186
|
+
exports.defaultConfig.runtime.toolTimeouts,
|
|
187
|
+
requiredTools: rawRuntime.requiredTools ??
|
|
188
|
+
rawRuntime.required_tools ??
|
|
189
|
+
exports.defaultConfig.runtime.requiredTools,
|
|
190
|
+
failOnIncompleteScan: rawRuntime.failOnIncompleteScan ??
|
|
191
|
+
rawRuntime.fail_on_incomplete_scan ??
|
|
192
|
+
exports.defaultConfig.runtime.failOnIncompleteScan
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
: {}),
|
|
196
|
+
...(rawOutput
|
|
197
|
+
? {
|
|
198
|
+
output: {
|
|
199
|
+
terminal: rawOutput.terminal ?? exports.defaultConfig.output.terminal,
|
|
200
|
+
json: rawOutput.json ?? exports.defaultConfig.output.json,
|
|
201
|
+
html: rawOutput.html ?? exports.defaultConfig.output.html,
|
|
202
|
+
agent: rawOutput.agent ?? exports.defaultConfig.output.agent,
|
|
203
|
+
privacyReview: rawOutput.privacyReview ??
|
|
204
|
+
rawOutput.privacy_review ??
|
|
205
|
+
exports.defaultConfig.output.privacyReview
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
: {}),
|
|
122
209
|
...(rawBaseline
|
|
123
210
|
? {
|
|
124
211
|
baseline: {
|
|
@@ -218,7 +305,57 @@ function normalizeRawConfig(raw) {
|
|
|
218
305
|
rawDependencies.fail_on_new_direct_vulnerabilities ??
|
|
219
306
|
exports.defaultConfig.checks.dependencies.failOnNewDirectVulnerabilities
|
|
220
307
|
}
|
|
221
|
-
: exports.defaultConfig.checks.dependencies
|
|
308
|
+
: exports.defaultConfig.checks.dependencies,
|
|
309
|
+
privacy: rawPrivacy
|
|
310
|
+
? {
|
|
311
|
+
enabled: rawPrivacy.enabled ?? exports.defaultConfig.checks.privacy.enabled,
|
|
312
|
+
minConfidenceToReport: rawPrivacy.minConfidenceToReport ??
|
|
313
|
+
rawPrivacy.min_confidence_to_report ??
|
|
314
|
+
exports.defaultConfig.checks.privacy.minConfidenceToReport,
|
|
315
|
+
maskExamples: rawPrivacy.maskExamples ??
|
|
316
|
+
rawPrivacy.mask_examples ??
|
|
317
|
+
exports.defaultConfig.checks.privacy.maskExamples,
|
|
318
|
+
maxFileBytes: rawPrivacy.maxFileBytes ??
|
|
319
|
+
rawPrivacy.max_file_bytes ??
|
|
320
|
+
exports.defaultConfig.checks.privacy.maxFileBytes,
|
|
321
|
+
failOnRegulatedIdentifiers: rawPrivacy.failOnRegulatedIdentifiers ??
|
|
322
|
+
rawPrivacy.fail_on_regulated_identifiers ??
|
|
323
|
+
exports.defaultConfig.checks.privacy.failOnRegulatedIdentifiers,
|
|
324
|
+
failOnSensitiveAttributes: rawPrivacy.failOnSensitiveAttributes ??
|
|
325
|
+
rawPrivacy.fail_on_sensitive_attributes ??
|
|
326
|
+
exports.defaultConfig.checks.privacy.failOnSensitiveAttributes,
|
|
327
|
+
detectTelemetryOptOut: rawPrivacy.detectTelemetryOptOut ??
|
|
328
|
+
rawPrivacy.detect_telemetry_opt_out ??
|
|
329
|
+
exports.defaultConfig.checks.privacy.detectTelemetryOptOut,
|
|
330
|
+
detectUnsanitizedLogs: rawPrivacy.detectUnsanitizedLogs ??
|
|
331
|
+
rawPrivacy.detect_unsanitized_logs ??
|
|
332
|
+
exports.defaultConfig.checks.privacy.detectUnsanitizedLogs,
|
|
333
|
+
detectApiOverfetching: rawPrivacy.detectApiOverfetching ??
|
|
334
|
+
rawPrivacy.detect_api_overfetching ??
|
|
335
|
+
exports.defaultConfig.checks.privacy.detectApiOverfetching,
|
|
336
|
+
detectMissingRetention: rawPrivacy.detectMissingRetention ??
|
|
337
|
+
rawPrivacy.detect_missing_retention ??
|
|
338
|
+
exports.defaultConfig.checks.privacy.detectMissingRetention,
|
|
339
|
+
ai: {
|
|
340
|
+
enabled: rawPrivacyAi.enabled ?? exports.defaultConfig.checks.privacy.ai.enabled,
|
|
341
|
+
apiKeyEnv: rawPrivacyAi.apiKeyEnv ??
|
|
342
|
+
rawPrivacyAi.api_key_env ??
|
|
343
|
+
exports.defaultConfig.checks.privacy.ai.apiKeyEnv,
|
|
344
|
+
baseUrlEnv: rawPrivacyAi.baseUrlEnv ??
|
|
345
|
+
rawPrivacyAi.base_url_env ??
|
|
346
|
+
exports.defaultConfig.checks.privacy.ai.baseUrlEnv,
|
|
347
|
+
modelEnv: rawPrivacyAi.modelEnv ??
|
|
348
|
+
rawPrivacyAi.model_env ??
|
|
349
|
+
exports.defaultConfig.checks.privacy.ai.modelEnv,
|
|
350
|
+
includeRawValues: rawPrivacyAi.includeRawValues ??
|
|
351
|
+
rawPrivacyAi.include_raw_values ??
|
|
352
|
+
exports.defaultConfig.checks.privacy.ai.includeRawValues
|
|
353
|
+
},
|
|
354
|
+
presidio: {
|
|
355
|
+
enabled: rawPresidio.enabled ?? exports.defaultConfig.checks.privacy.presidio.enabled
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
: exports.defaultConfig.checks.privacy
|
|
222
359
|
}
|
|
223
360
|
}
|
|
224
361
|
: {})
|
package/dist/core/engine.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { type Finding, type FindingCategory } from "./finding";
|
|
|
3
3
|
import { type ScanMode } from "./scanPlanner";
|
|
4
4
|
import { type ScoreBreakdown } from "./scoring";
|
|
5
5
|
import { type ToolResult } from "./toolRunner";
|
|
6
|
+
import { type PrivacyReviewSummary } from "./privacyReview";
|
|
6
7
|
export type AgentPlanTarget = "generic" | "codex" | "copilot" | "claude" | "cursor";
|
|
7
8
|
export type AgentPlanTask = {
|
|
8
9
|
id: string;
|
|
@@ -16,14 +17,33 @@ export type AgentPlanTask = {
|
|
|
16
17
|
};
|
|
17
18
|
export type AgentPlan = {
|
|
18
19
|
goal: string;
|
|
20
|
+
status: ScanExecutionStatus;
|
|
19
21
|
target: AgentPlanTarget;
|
|
20
22
|
workflow: string[];
|
|
21
23
|
rules: string[];
|
|
22
24
|
allowedActions: string[];
|
|
23
25
|
forbiddenActions: string[];
|
|
24
26
|
doNotTouch: string[];
|
|
27
|
+
recoveryActions: RecoveryAction[];
|
|
25
28
|
tasks: AgentPlanTask[];
|
|
26
29
|
};
|
|
30
|
+
export type ScanExecutionStatus = "complete" | "partial" | "invalid";
|
|
31
|
+
export type RecoveryAction = {
|
|
32
|
+
id: string;
|
|
33
|
+
tool: string;
|
|
34
|
+
command: string;
|
|
35
|
+
successCondition: string;
|
|
36
|
+
onFailure: string;
|
|
37
|
+
};
|
|
38
|
+
export type ScanCompleteness = {
|
|
39
|
+
status: ScanExecutionStatus;
|
|
40
|
+
comparable: boolean;
|
|
41
|
+
planned: number;
|
|
42
|
+
completed: number;
|
|
43
|
+
incompleteTools: string[];
|
|
44
|
+
requiredIncompleteTools: string[];
|
|
45
|
+
reason?: string;
|
|
46
|
+
};
|
|
27
47
|
export type ToolStatusSummary = {
|
|
28
48
|
id: string;
|
|
29
49
|
status: ToolResult["status"];
|
|
@@ -43,11 +63,15 @@ export type ScanOutput = {
|
|
|
43
63
|
topFindings: Finding[];
|
|
44
64
|
blockers: Finding[];
|
|
45
65
|
fixNext: Finding[];
|
|
66
|
+
privacyFindings: Finding[];
|
|
67
|
+
privacyReview?: PrivacyReviewSummary;
|
|
46
68
|
leftovers: Finding[];
|
|
47
69
|
deadCodeCandidates: Finding[];
|
|
48
70
|
refactorCandidates: Finding[];
|
|
49
71
|
toolStatuses: ToolStatusSummary[];
|
|
50
72
|
skippedTools: SkippedToolSummary[];
|
|
73
|
+
completeness: ScanCompleteness;
|
|
74
|
+
recoveryActions: RecoveryAction[];
|
|
51
75
|
testCommands: string[];
|
|
52
76
|
agentPlan: AgentPlan;
|
|
53
77
|
configPath?: string;
|
|
@@ -65,17 +89,27 @@ export type ExplainPayload = {
|
|
|
65
89
|
relatedFindings: Finding[];
|
|
66
90
|
skippedTools: SkippedToolSummary[];
|
|
67
91
|
};
|
|
92
|
+
export type ToolRetryOutput = {
|
|
93
|
+
tool: string;
|
|
94
|
+
status: ToolResult["status"];
|
|
95
|
+
timeoutSeconds: number;
|
|
96
|
+
findings: Finding[];
|
|
97
|
+
message?: string;
|
|
98
|
+
successCondition: string;
|
|
99
|
+
nextAction: string;
|
|
100
|
+
};
|
|
68
101
|
type FilterScanOptions = {
|
|
69
102
|
policy?: AgentPolicy;
|
|
70
103
|
target?: AgentPlanTarget;
|
|
71
104
|
};
|
|
72
|
-
export declare function createAgentPlan(scan: Pick<ScanOutput, "findings" | "score" | "skippedTools"> & {
|
|
105
|
+
export declare function createAgentPlan(scan: Pick<ScanOutput, "findings" | "score" | "skippedTools"> & Partial<Pick<ScanOutput, "toolStatuses" | "completeness" | "recoveryActions">> & {
|
|
73
106
|
testCommands?: string[];
|
|
74
107
|
}, options?: {
|
|
75
108
|
policy?: AgentPolicy;
|
|
76
109
|
target?: AgentPlanTarget;
|
|
77
110
|
}): AgentPlan;
|
|
78
111
|
export declare function runScan(root: string, mode?: ScanMode): Promise<ScanOutput>;
|
|
112
|
+
export declare function retryTool(root: string, toolId: string, timeoutSeconds?: number): Promise<ToolRetryOutput>;
|
|
79
113
|
export declare function filterScanByCategories(scan: ScanOutput, categories: FindingCategory[], options?: FilterScanOptions): ScanOutput;
|
|
80
114
|
export declare function buildSummaryLines(scan: ScanOutput): string[];
|
|
81
115
|
export declare function buildExplainPayload(scan: ScanOutput, findingId: string): ExplainPayload;
|