@neuralaxis/vibedoctor 0.1.3 → 0.2.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.
Files changed (78) hide show
  1. package/README.md +213 -116
  2. package/dist/adapters/dpdp.d.ts +6 -0
  3. package/dist/adapters/dpdp.js +34 -0
  4. package/dist/adapters/index.d.ts +1 -0
  5. package/dist/adapters/index.js +3 -1
  6. package/dist/adapters/presidio.js +3 -1
  7. package/dist/adapters/privacyDetector.d.ts +24 -1
  8. package/dist/adapters/privacyDetector.js +86 -2
  9. package/dist/adapters/shared.d.ts +6 -0
  10. package/dist/agentPack/templates/skills.js +159 -53
  11. package/dist/cli/commands/dpdp.d.ts +35 -0
  12. package/dist/cli/commands/dpdp.js +103 -0
  13. package/dist/cli/commands/scan.js +4 -1
  14. package/dist/cli/commands/setup.js +1 -1
  15. package/dist/cli/index.js +84 -0
  16. package/dist/core/config.d.ts +21 -0
  17. package/dist/core/config.js +89 -4
  18. package/dist/core/engine.js +22 -3
  19. package/dist/core/finding.d.ts +1 -1
  20. package/dist/core/finding.js +1 -0
  21. package/dist/core/scanPlanner.js +10 -2
  22. package/dist/dpdp/artifacts.d.ts +11 -0
  23. package/dist/dpdp/artifacts.js +120 -0
  24. package/dist/dpdp/catalogue.d.ts +14 -0
  25. package/dist/dpdp/catalogue.js +661 -0
  26. package/dist/dpdp/collectors/confidence.d.ts +9 -0
  27. package/dist/dpdp/collectors/confidence.js +25 -0
  28. package/dist/dpdp/collectors/dependencies.d.ts +7 -0
  29. package/dist/dpdp/collectors/dependencies.js +63 -0
  30. package/dist/dpdp/collectors/index.d.ts +24 -0
  31. package/dist/dpdp/collectors/index.js +71 -0
  32. package/dist/dpdp/collectors/lifecycle.d.ts +2 -0
  33. package/dist/dpdp/collectors/lifecycle.js +202 -0
  34. package/dist/dpdp/collectors/optionalScanners.d.ts +14 -0
  35. package/dist/dpdp/collectors/optionalScanners.js +347 -0
  36. package/dist/dpdp/collectors/privacyBridge.d.ts +13 -0
  37. package/dist/dpdp/collectors/privacyBridge.js +152 -0
  38. package/dist/dpdp/collectors/safeguards.d.ts +5 -0
  39. package/dist/dpdp/collectors/safeguards.js +186 -0
  40. package/dist/dpdp/collectors/schema.d.ts +6 -0
  41. package/dist/dpdp/collectors/schema.js +122 -0
  42. package/dist/dpdp/collectors/shared.d.ts +10 -0
  43. package/dist/dpdp/collectors/shared.js +43 -0
  44. package/dist/dpdp/context.d.ts +28 -0
  45. package/dist/dpdp/context.js +195 -0
  46. package/dist/dpdp/dataMap.d.ts +7 -0
  47. package/dist/dpdp/dataMap.js +339 -0
  48. package/dist/dpdp/evaluators.d.ts +20 -0
  49. package/dist/dpdp/evaluators.js +522 -0
  50. package/dist/dpdp/evidence.d.ts +11 -0
  51. package/dist/dpdp/evidence.js +123 -0
  52. package/dist/dpdp/findings.d.ts +14 -0
  53. package/dist/dpdp/findings.js +99 -0
  54. package/dist/dpdp/gates.d.ts +14 -0
  55. package/dist/dpdp/gates.js +47 -0
  56. package/dist/dpdp/index.d.ts +16 -0
  57. package/dist/dpdp/index.js +32 -0
  58. package/dist/dpdp/legalSources.d.ts +10 -0
  59. package/dist/dpdp/legalSources.js +104 -0
  60. package/dist/dpdp/paths.d.ts +25 -0
  61. package/dist/dpdp/paths.js +85 -0
  62. package/dist/dpdp/report.d.ts +6 -0
  63. package/dist/dpdp/report.js +222 -0
  64. package/dist/dpdp/reviewQueue.d.ts +3 -0
  65. package/dist/dpdp/reviewQueue.js +88 -0
  66. package/dist/dpdp/scan.d.ts +26 -0
  67. package/dist/dpdp/scan.js +310 -0
  68. package/dist/dpdp/scoring.d.ts +31 -0
  69. package/dist/dpdp/scoring.js +211 -0
  70. package/dist/dpdp/types.d.ts +294 -0
  71. package/dist/dpdp/types.js +86 -0
  72. package/dist/index.d.ts +1 -0
  73. package/dist/index.js +1 -0
  74. package/dist/mcp/tools/dpdp.d.ts +11 -0
  75. package/dist/mcp/tools/dpdp.js +151 -0
  76. package/dist/mcp/tools/index.js +3 -1
  77. package/dist/reporters/json.js +6 -1
  78. package/package.json +4 -1
package/README.md CHANGED
@@ -1,187 +1,288 @@
1
1
  # VibeDoctor
2
2
 
3
- A health check for code you did not write line by line.
3
+ **A local health check for code you did not write line by line.**
4
4
 
5
- VibeDoctor is a local code-health CLI for JS, TS, Python, and mixed repositories. It turns scattered tool output into a ranked health report, safe repair workflow, Privacy Review artifact, MCP server, and reusable agent skills.
5
+ VibeDoctor scans JavaScript, TypeScript, Python, and mixed repositories for code-health, security, privacy, testing, and maintainability problems. It combines repository-local scanner output into one ranked report, one normalized finding format, and a fix-next plan that humans and coding agents can use without interpreting a wall of unrelated logs.
6
6
 
7
7
  ```bash
8
8
  npx @neuralaxis/vibedoctor scan --changed
9
9
  ```
10
10
 
11
- For a stronger first run:
11
+ VibeDoctor runs locally by default. Missing or failed scanners are reported as incomplete evidence, never silently counted as a clean result.
12
+
13
+ ## Start here
14
+
15
+ Choose the shortest path for what you are doing:
16
+
17
+ | Goal | Command |
18
+ | --- | --- |
19
+ | Check files changed in Git | `npx @neuralaxis/vibedoctor scan --changed` |
20
+ | Run a fast repository check | `npx @neuralaxis/vibedoctor scan --quick` |
21
+ | Run the most complete check | `npx @neuralaxis/vibedoctor scan --full` |
22
+ | Prepare local scanner tools | `npx @neuralaxis/vibedoctor setup` |
23
+ | Get a repair plan for an AI agent | `npx @neuralaxis/vibedoctor agent-plan --format markdown` |
24
+ | Check India DPDP technical readiness | `npx @neuralaxis/vibedoctor dpdp scan --full` |
25
+
26
+ For a new repository, initialize the config and review the scanner setup plan:
12
27
 
13
28
  ```bash
14
29
  npx @neuralaxis/vibedoctor init
30
+ npx @neuralaxis/vibedoctor setup
15
31
  npx @neuralaxis/vibedoctor setup --apply
16
32
  npx @neuralaxis/vibedoctor scan --quick
17
33
  ```
18
34
 
19
- Install once if you prefer the short binary:
35
+ `setup --apply` installs supported recommended tools, so review the plan before applying it. To use the shorter `vibedoctor` command everywhere:
20
36
 
21
37
  ```bash
22
38
  npm install -g @neuralaxis/vibedoctor
23
- vibedoctor scan --full
24
39
  ```
25
40
 
26
- ## Release Demos
41
+ ## What you get
27
42
 
28
- <video src="docs/assets/vibedoctor-product-release-demo-v0.1.1.mp4" controls muted playsinline width="100%"></video>
43
+ Every scan reports both repository health and scan completeness. It highlights blockers, the next fixes, privacy findings, skipped or failed tools, and exact recovery commands.
29
44
 
30
- [Direct video link](docs/assets/vibedoctor-product-release-demo-v0.1.1.mp4)
45
+ Default artifacts are written under `.vibedoctor/`:
31
46
 
32
- ## Why VibeDoctor
33
-
34
- - It focuses on the failure modes AI-heavy repos accumulate: dead branches, stale fallbacks, leftovers, weak coverage, and accidental sensitive-data exposure.
35
- - It collapses many tool results into one finding model, one score, and a ranked fix list instead of a wall of unrelated warnings.
36
- - It is agent-native without locking you into a hosted service: reports stay local and output remains plain JSON, HTML, Markdown, and SARIF.
37
- - It tells agents whether a scan is complete, provides exact recovery commands for failed tools, and prevents partial scores from masquerading as authoritative health checks.
47
+ ```text
48
+ .vibedoctor/
49
+ ├── report.json # automation and agents
50
+ ├── report.html # human review
51
+ └── agent-plan.md # ordered repair work
52
+ ```
38
53
 
39
- ## What VibeDoctor Checks
54
+ Use the terminal report for quick triage, HTML for review, JSON for automation, and `agent-plan.md` for a coding agent.
40
55
 
41
- VibeDoctor detects the project shape, discovers local tool binaries, runs the checks that make sense for the repo, and reports missing tools as skipped instead of pretending they passed.
56
+ ## What VibeDoctor checks
42
57
 
43
58
  - Type and lint failures from TypeScript, Pyright, Ruff, Biome, and similar local tools.
44
- - Secrets and dependency risk from Gitleaks, OSV-Scanner, Semgrep, deptry, Knip, and project-native scanners when available.
45
- - Privacy and PII exposure from VibeDoctor's deterministic detector, with optional Presidio support.
46
- - Dead code from Vulture, Knip, and VibeDoctor's dead-chain detector.
47
- - AI and legacy leftovers such as commented-out blocks, stale TODOs, fallback flags, and half-removed code.
48
- - Refactor-readiness hotspots, duplication, complexity, and coverage gaps.
49
- - Test and coverage signal from local JS and Python tooling.
59
+ - Secrets, vulnerable dependencies, and insecure patterns from Gitleaks, OSV-Scanner, Semgrep, and project-native scanners when available.
60
+ - Dead or unused code from Knip, Vulture, deptry, and VibeDoctor's dead-chain detector.
61
+ - AI and legacy leftovers such as stale TODOs, commented-out code, fallback flags, and half-removed features.
62
+ - Refactor-readiness hotspots, duplication, complexity, tests, and coverage signals.
63
+ - Regulated identifiers, personal-data fields, sensitive attributes, and risky combinations through deterministic privacy checks and optional Presidio support.
50
64
 
51
- After a scan, VibeDoctor writes machine-readable and human-readable artifacts under `.vibedoctor/`, including `report.json`, `report.html`, and `agent-plan.md`.
65
+ VibeDoctor detects the repository shape and discovers applicable local tools. A missing optional tool is marked `SKIPPED`; a failed or timed-out required tool can make the result `PARTIAL` or `INVALID`.
52
66
 
53
- ## Tool Setup Philosophy
67
+ ## Understand the result before fixing code
54
68
 
55
- VibeDoctor prefers repository-local tools and config so the scan matches the versions you actually use in development and CI. Missing tools are reported as skipped with install guidance instead of being counted as clean.
69
+ | Status | Meaning | What to do |
70
+ | --- | --- | --- |
71
+ | `COMPLETE` | All required checks completed. | Work through the ranked findings. |
72
+ | `PARTIAL` | Some checks were skipped, failed, or timed out. | Follow `recoveryActions`; do not rely on the score alone. |
73
+ | `INVALID` | There is not enough trustworthy evidence for an authoritative result. | Recover the required scanners and scan again before editing. |
56
74
 
57
- ## Common CLI Workflows
75
+ CLI exit codes let people, agents, and CI distinguish health failures from missing evidence:
58
76
 
59
- | Goal | Command |
77
+ | Code | Meaning |
60
78
  | --- | --- |
61
- | Initialize config | `vibedoctor init` |
62
- | Plan scanner setup | `vibedoctor setup` |
63
- | Install automatable recommended tools | `vibedoctor setup --apply` |
64
- | Fast local triage | `vibedoctor scan --quick` |
65
- | Review changed files | `vibedoctor scan --changed` |
66
- | Full repository scan | `vibedoctor scan --full` |
67
- | Scan selected categories | `vibedoctor scan --category dead_code,leftovers --report json` |
68
- | Scan privacy findings only | `vibedoctor scan --category privacy --report json` |
69
- | Render reports | `vibedoctor report --html`, `--markdown`, `--sarif`, or `--agent` |
70
- | Apply safe tool fixes | `vibedoctor fix --safe` |
71
- | Create a baseline | `vibedoctor baseline create` |
72
- | Explain a finding | `vibedoctor explain <finding-id>` |
73
- | Verify after edits | `vibedoctor verify` |
74
- | Retry a timed-out scanner | `vibedoctor tool retry <tool-id> [--timeout 600]` |
75
- | Generate an agent repair plan | `vibedoctor agent-plan --format markdown` |
79
+ | `0` | The scan completed and configured gates passed. |
80
+ | `1` | One or more configured health gates failed. |
81
+ | `2` | Required checks were incomplete. |
76
82
 
77
- `scan` and `verify` return exit code `1` when completed health gates fail and exit code `2` when required checks are incomplete. Reports label incomplete scores as `PARTIAL` or `INVALID` and include machine-readable `recoveryActions`.
83
+ Skipped scanners are never treated as clean results. Privacy findings affect the privacy category score by default, but do not lower the overall score or fail CI unless you opt into privacy gates.
78
84
 
79
- Timeouts and required checks are configurable:
85
+ If a scanner times out or fails, run the recovery command shown in the report. For example:
80
86
 
81
- ```yaml
82
- runtime:
83
- default_timeout_seconds: 120
84
- tool_timeouts:
85
- biome: 180
86
- semgrep: 300
87
- required_tools:
88
- - biome
89
- - semgrep
90
- fail_on_incomplete_scan: true
87
+ ```bash
88
+ vibedoctor tool retry semgrep --timeout 600
91
89
  ```
92
90
 
93
- ## Privacy Review
94
-
95
- Privacy Review is deterministic-first and advisory by default. The built-in privacy detector finds regulated identifiers, personal-data fields, sensitive attributes, and combination-risk patterns while storing masked evidence in reports.
91
+ ## A fast, safe repair loop
96
92
 
97
93
  ```bash
98
- vibedoctor scan --category privacy --report json
99
- vibedoctor privacy-review --refresh --format markdown
94
+ # 1. Establish the current state
95
+ vibedoctor scan --changed --report json
96
+
97
+ # 2. Generate ordered work
98
+ vibedoctor agent-plan --format markdown
99
+
100
+ # 3. Optionally apply supported safe tool fixes
101
+ vibedoctor fix --safe
102
+
103
+ # 4. Review every change, then verify
104
+ vibedoctor verify
100
105
  ```
101
106
 
102
- By default, privacy findings affect the privacy category score but do not lower the overall health score or fail CI. To make privacy findings blocking, opt in through config:
107
+ Use `vibedoctor explain <finding-id>` when a finding needs more context. Always review generated changes before committing them.
108
+
109
+ For an inherited repository, baseline existing debt and fail only on new findings:
110
+
111
+ ```bash
112
+ vibedoctor baseline create
113
+ ```
103
114
 
104
- - `checks.privacy.fail_on_regulated_identifiers`
105
- - `checks.privacy.fail_on_sensitive_attributes`
115
+ ```yaml
116
+ baseline:
117
+ fail_only_on_new_issues: true
118
+ ```
106
119
 
107
- The `privacy-review` command writes `.vibedoctor/privacy-review.json` with structured review decisions and merge-back metadata. Optional AI adjudication only runs when `checks.privacy.ai.enabled` is true and the configured API-key environment variables are present.
120
+ ## Using VibeDoctor with AI agents
108
121
 
109
- ## Agent Skills And Plugins
122
+ The quickest one-off handoff is `.vibedoctor/agent-plan.md`. An agent should follow this protocol:
110
123
 
111
- VibeDoctor has two agent surfaces.
124
+ 1. Run the appropriate scan.
125
+ 2. Read `completeness.status`, `toolStatuses`, `skippedTools`, and `recoveryActions` in `.vibedoctor/report.json`.
126
+ 3. Recover required scanners before treating findings or scores as authoritative.
127
+ 4. Fix only the ranked, in-scope findings and preserve unrelated user changes.
128
+ 5. Run `vibedoctor verify` after edits.
129
+ 6. Report remaining findings and any incomplete evidence; never claim success from a `PARTIAL` or `INVALID` scan.
112
130
 
113
- Repo-local install:
131
+ For repeated agent use, install repository-scoped instructions, skills, policy, and supported editor wiring:
114
132
 
115
133
  ```bash
116
134
  vibedoctor agent init --targets all
117
135
  vibedoctor agent doctor --targets all
118
136
  ```
119
137
 
120
- This writes repository-scoped guidance and skills:
138
+ This can generate `AGENTS.md`, `.agents/skills/`, target-specific skills for Claude and GitHub, Cursor rules and MCP config, and `.vibedoctor/agent-policy.yml`.
121
139
 
122
- - `AGENTS.md`
123
- - `.agents/skills/<skill>/SKILL.md`
124
- - `.agents/skills/<skill>/agents/openai.yaml`
125
- - `.claude/skills/<skill>/SKILL.md`
126
- - `.github/skills/<skill>/SKILL.md`
127
- - `.github/copilot-instructions.md`
128
- - `.cursor/rules/vibedoctor.mdc`
129
- - `.cursor/mcp.json`
130
- - `.vibedoctor/agent-policy.yml`
131
-
132
- Plugin bundle:
140
+ To create installable Codex and Claude plugin bundles under `plugins/vibedoctor/`:
133
141
 
134
142
  ```bash
135
- vibedoctor agent plugin --target codex
136
- vibedoctor agent plugin --target claude
137
143
  vibedoctor agent plugin --targets all --force
138
144
  ```
139
145
 
140
- This materializes an installable bundle under `plugins/vibedoctor/`:
146
+ ### MCP server
141
147
 
142
- - `plugins/vibedoctor/.codex-plugin/plugin.json`
143
- - `plugins/vibedoctor/.claude-plugin/plugin.json`
144
- - `plugins/vibedoctor/skills/<skill>/SKILL.md`
148
+ Start the MCP server over standard input/output:
145
149
 
146
- Codex discovers the plugin from `.codex-plugin/plugin.json`, which points to `./skills/`. Claude Code uses the plugin namespace for skill commands, for example:
150
+ ```bash
151
+ vibedoctor mcp
152
+ ```
147
153
 
148
- ```text
149
- /vibedoctor:vibedoctor-health-scan
150
- /vibedoctor:vibedoctor-privacy-review
154
+ It exposes structured operations for changed and full scans, report retrieval, finding explanations, safe fixes, repair plans, verification, privacy review, and DPDP technical readiness. Generated agent configs include MCP wiring where the target supports it.
155
+
156
+ ## Privacy Review
157
+
158
+ Privacy Review is deterministic-first and advisory by default. Evidence stored in reports is masked or classified instead of preserving raw PII.
159
+
160
+ ```bash
161
+ vibedoctor scan --category privacy --report json
162
+ vibedoctor privacy-review --refresh --format markdown
151
163
  ```
152
164
 
153
- The canonical skill catalog is exported from the package root as `AGENT_SKILLS`, `DEFAULT_SKILL_NAMES`, and `SkillTemplate`, and the same templates generate repo skills, Claude skills, Copilot/Cursor shims, and packaged plugin skills.
165
+ The second command writes a structured review artifact to `.vibedoctor/privacy-review.json`. Optional AI adjudication runs only when explicitly enabled and the configured API-key environment variables are present.
154
166
 
155
- ## MCP Server
167
+ To make high-confidence privacy findings blocking, opt in:
156
168
 
157
- Start the MCP server over stdio:
169
+ ```yaml
170
+ checks:
171
+ privacy:
172
+ fail_on_regulated_identifiers: true
173
+ fail_on_sensitive_attributes: true
174
+ ```
175
+
176
+ ## DPDP technical readiness
177
+
178
+ VibeDoctor includes an engineering-focused module for India's Digital Personal Data Protection framework. It maps apparent personal-data processing, evaluates visible technical controls, identifies deterministic technical risks, and creates a human-review queue.
179
+
180
+ It provides **technical readiness evidence, not legal compliance or certification**. Static analysis cannot establish legal applicability, production behavior, contractual adequacy, notice quality, or organisational policy implementation.
158
181
 
159
182
  ```bash
160
- vibedoctor mcp
183
+ vibedoctor dpdp init
184
+ vibedoctor dpdp scan --full
185
+ ```
186
+
187
+ Common commands:
188
+
189
+ | Goal | Command |
190
+ | --- | --- |
191
+ | Scaffold optional context and evidence | `vibedoctor dpdp init` |
192
+ | Full technical-readiness scan | `vibedoctor dpdp scan --full` |
193
+ | Collect evidence from changed files | `vibedoctor dpdp scan --changed` |
194
+ | Print the personal-data map | `vibedoctor dpdp map` |
195
+ | Print questions requiring human review | `vibedoctor dpdp review-queue` |
196
+ | Render a report | `vibedoctor dpdp report --json`, `--html`, or `--markdown` |
197
+ | Generate an agent handoff | `vibedoctor dpdp handoff` |
198
+ | Verify after changes | `vibedoctor dpdp verify` |
199
+ | Explain a control or finding | `vibedoctor dpdp explain <id>` |
200
+
201
+ Artifacts are stored in `.vibedoctor/dpdp/`:
202
+
203
+ ```text
204
+ data-map.json
205
+ control-matrix.json
206
+ evidence-ledger.json
207
+ review-queue.md
208
+ agent-handoff.md
209
+ readiness-report.json
210
+ readiness-report.md
211
+ readiness-report.html
161
212
  ```
162
213
 
163
- The MCP server exposes structured tools for changed scans, full scans, safe fixes, report retrieval, agent-plan retrieval, finding explanations, and verification. Agent configs generated by `vibedoctor agent init --targets all` include target-specific MCP wiring where supported.
214
+ Controls distinguish repeatable `DETERMINISTIC` checks, uncertain `TECHNICAL_SIGNAL`s, human-supplied `DECLARED_EVIDENCE`, and `HUMAN_REVIEW`. Absence of evidence is never marked `VERIFIED`, and skipped optional scanners are never passes.
215
+
216
+ `dpdp scan` always refreshes the artifacts. `map`, `report`, `review-queue`, `handoff`, and `explain` reuse cached artifacts unless passed `--refresh`; `verify` always performs a live changed-scope scan. If Git has no changed-file delta, changed-scope collection falls back to the full repository and records a capability warning.
217
+
218
+ Presidio and Semgrep evidence collection are on by default and can be independently disabled under `checks.dpdp`. Normal scans also include DPDP privacy findings when `checks.dpdp.enabled` is true.
164
219
 
165
220
  ## Configuration
166
221
 
167
- `vibedoctor init` writes `vibedoctor.yml`. Editing is optional, but these are the most common controls:
222
+ `vibedoctor init` writes `vibedoctor.yml`. Editing is optional. The most useful settings are:
168
223
 
169
- - `score.minimum`: health score required for `scan` and `verify` to pass.
170
- - `baseline.fail_only_on_new_issues`: fail only on debt introduced after the baseline.
171
- - `checks.*`: enable categories and fail-fast gates for secrets, type errors, test failures, and vulnerabilities.
172
- - `checks.privacy.*`: tune deterministic privacy detection, masking, optional Presidio support, optional AI review, and CI blocking behavior.
173
- - `paths.include` and `paths.exclude`: scope scanned files.
224
+ ```yaml
225
+ score:
226
+ minimum: 80
174
227
 
175
- Use `vibedoctor baseline create` to snapshot existing debt, then fail builds only on new problems while you pay down the rest.
228
+ baseline:
229
+ fail_only_on_new_issues: true
176
230
 
177
- ## Development And Release
231
+ runtime:
232
+ default_timeout_seconds: 120
233
+ tool_timeouts:
234
+ biome: 180
235
+ semgrep: 300
236
+ required_tools:
237
+ - biome
238
+ - semgrep
239
+ fail_on_incomplete_scan: true
240
+
241
+ paths:
242
+ include:
243
+ - src/**
244
+ exclude:
245
+ - dist/**
246
+ - coverage/**
247
+ ```
178
248
 
179
- Requirements:
249
+ - `score.minimum` sets the passing health score.
250
+ - `baseline.fail_only_on_new_issues` limits gates to debt introduced after the baseline.
251
+ - `runtime.required_tools` defines which scanners must complete.
252
+ - `runtime.tool_timeouts` sets scanner-specific deadlines.
253
+ - `checks.*` enables categories and their gates.
254
+ - `checks.privacy.*` controls privacy detection, masking, optional AI review, and blocking behavior.
255
+ - `checks.dpdp.*` controls technical-readiness evidence, organisation context, optional scanners, and deterministic gates.
256
+ - `paths.include` and `paths.exclude` scope the scan.
180
257
 
181
- - Node.js 18 or newer
182
- - npm 10.x
258
+ Human-review-only DPDP items do not fail CI. Configure `checks.dpdp.fail_on_severity` or `checks.dpdp.fail_on_violated_controls` when deterministic DPDP findings should block a build.
183
259
 
184
- Run the local verification set:
260
+ ## Command reference
261
+
262
+ | Goal | Command |
263
+ | --- | --- |
264
+ | Initialize configuration | `vibedoctor init` |
265
+ | Plan or apply scanner setup | `vibedoctor setup` / `vibedoctor setup --apply` |
266
+ | Quick, changed, or full scan | `vibedoctor scan --quick` / `--changed` / `--full` |
267
+ | Scan selected categories | `vibedoctor scan --category dead_code,leftovers` |
268
+ | Render a fresh full report | `vibedoctor report --json`, `--html`, `--markdown`, `--sarif`, or `--agent` |
269
+ | Apply supported safe fixes | `vibedoctor fix --safe` |
270
+ | Verify changed files | `vibedoctor verify` |
271
+ | Create a baseline | `vibedoctor baseline create` |
272
+ | Explain a finding | `vibedoctor explain <finding-id>` |
273
+ | Retry a scanner | `vibedoctor tool retry <tool-id> [--timeout 600]` |
274
+ | Generate an agent plan | `vibedoctor agent-plan --format markdown` |
275
+ | Start MCP | `vibedoctor mcp` |
276
+
277
+ `scan --report` supports `terminal`, `json`, `html`, `agent`, and `agent-json`. The separate `report` command performs a fresh full scan and can also render Markdown or SARIF to standard output.
278
+
279
+ ## Network and data behavior
280
+
281
+ Core scanning and report generation run locally and do not require a hosted VibeDoctor service. Setup commands may download tools, dependency scanners may query their own data sources, and optional AI integrations may contact the configured service. Review an integration before enabling it if source code or findings may leave the machine.
282
+
283
+ ## Development
284
+
285
+ Requirements: Node.js 18 or newer and npm 10.x.
185
286
 
186
287
  ```bash
187
288
  npm test
@@ -190,7 +291,7 @@ npm run build
190
291
  npm pack --dry-run
191
292
  ```
192
293
 
193
- Useful development commands:
294
+ Useful local commands:
194
295
 
195
296
  ```bash
196
297
  npm run dev -- scan --quick
@@ -198,20 +299,16 @@ npm run dev -- agent init --targets all
198
299
  npm run dev -- agent plugin --targets all --force
199
300
  ```
200
301
 
201
- `npm run build` emits production files into `dist/`. Plugin bundles under `plugins/` are generated on demand by `vibedoctor agent plugin ...` and are ignored in this repository by default.
202
-
203
- ## Project Layout
204
-
205
302
  | Path | Purpose |
206
303
  | --- | --- |
207
- | `src/adapters` | Tool adapters and parsers |
208
- | `src/core` | Project detection, scan planning, scoring, baselines, and command execution |
304
+ | `src/adapters` | Scanner adapters and parsers |
305
+ | `src/core` | Project detection, scan planning, scoring, baselines, and execution |
209
306
  | `src/cli` | Command-line interface |
210
- | `src/agentPack` | Agent instructions, skills, policy, shims, and plugin generation |
211
- | `src/mcp` | MCP server and tools |
307
+ | `src/agentPack` | Agent instructions, skills, policies, and plugin generation |
308
+ | `src/dpdp` | DPDP evidence collection, controls, and reports |
309
+ | `src/mcp` | MCP server and tool definitions |
212
310
  | `src/reporters` | Terminal, JSON, Markdown, HTML, SARIF, and agent reports |
213
- | `plugins/vibedoctor` | Generated Codex and Claude plugin bundle |
214
- | `fixtures` | Sample projects for tests |
311
+ | `fixtures` | Sample repositories used by tests |
215
312
  | `tests` | Unit, integration, and snapshot tests |
216
313
 
217
314
  ## License
@@ -0,0 +1,6 @@
1
+ import type { ToolAdapter } from "./shared";
2
+ /**
3
+ * DPDP technical readiness adapter.
4
+ * Produces findings from the deterministic DPDP package and writes DPDP artifacts.
5
+ */
6
+ export declare const dpdpAdapter: ToolAdapter;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dpdpAdapter = void 0;
4
+ const scan_1 = require("../dpdp/scan");
5
+ /**
6
+ * DPDP technical readiness adapter.
7
+ * Produces findings from the deterministic DPDP package and writes DPDP artifacts.
8
+ */
9
+ exports.dpdpAdapter = {
10
+ id: "dpdp",
11
+ category: "privacy",
12
+ async detect(_project, config) {
13
+ return config.checks.dpdp.enabled;
14
+ },
15
+ async runStandalone(ctx) {
16
+ const mode = ctx.scanMode === "changed" ? "changed" : ctx.scanMode === "quick" ? "default" : "full";
17
+ const result = await (0, scan_1.runDpdpScan)(ctx.root, mode, {
18
+ context: ctx,
19
+ optionalScannersEnabled: ctx.scanMode !== "quick"
20
+ });
21
+ return {
22
+ findings: result.findings,
23
+ status: {
24
+ command: "dpdp",
25
+ stdout: `DPDP technical posture ${result.scores.technicalPostureScore}/100`,
26
+ stderr: "",
27
+ exitCode: 0,
28
+ durationMs: 0,
29
+ status: "ok"
30
+ }
31
+ };
32
+ },
33
+ installHint: "Built-in DPDP technical readiness module. No external install needed."
34
+ };
@@ -16,4 +16,5 @@ export { tscAdapter } from "./tsc";
16
16
  export { vitestAdapter } from "./vitest";
17
17
  export { vultureAdapter } from "./vulture";
18
18
  export { privacyDetectorAdapter } from "./privacyDetector";
19
+ export { dpdpAdapter } from "./dpdp";
19
20
  export { telemetryDetectorAdapter } from "./telemetryDetector";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.telemetryDetectorAdapter = exports.privacyDetectorAdapter = exports.vultureAdapter = exports.vitestAdapter = exports.tscAdapter = exports.semgrepAdapter = exports.ruffAdapter = exports.radonAdapter = exports.pyrightAdapter = exports.presidioAdapter = exports.osvScannerAdapter = exports.lizardAdapter = exports.knipAdapter = exports.jscpdAdapter = exports.jestAdapter = exports.gitleaksAdapter = exports.deptryAdapter = exports.coveragePyAdapter = exports.biomeAdapter = void 0;
3
+ exports.telemetryDetectorAdapter = exports.dpdpAdapter = exports.privacyDetectorAdapter = exports.vultureAdapter = exports.vitestAdapter = exports.tscAdapter = exports.semgrepAdapter = exports.ruffAdapter = exports.radonAdapter = exports.pyrightAdapter = exports.presidioAdapter = exports.osvScannerAdapter = exports.lizardAdapter = exports.knipAdapter = exports.jscpdAdapter = exports.jestAdapter = exports.gitleaksAdapter = exports.deptryAdapter = exports.coveragePyAdapter = exports.biomeAdapter = void 0;
4
4
  var biome_1 = require("./biome");
5
5
  Object.defineProperty(exports, "biomeAdapter", { enumerable: true, get: function () { return biome_1.biomeAdapter; } });
6
6
  var coveragePy_1 = require("./coveragePy");
@@ -37,5 +37,7 @@ var vulture_1 = require("./vulture");
37
37
  Object.defineProperty(exports, "vultureAdapter", { enumerable: true, get: function () { return vulture_1.vultureAdapter; } });
38
38
  var privacyDetector_1 = require("./privacyDetector");
39
39
  Object.defineProperty(exports, "privacyDetectorAdapter", { enumerable: true, get: function () { return privacyDetector_1.privacyDetectorAdapter; } });
40
+ var dpdp_1 = require("./dpdp");
41
+ Object.defineProperty(exports, "dpdpAdapter", { enumerable: true, get: function () { return dpdp_1.dpdpAdapter; } });
40
42
  var telemetryDetector_1 = require("./telemetryDetector");
41
43
  Object.defineProperty(exports, "telemetryDetectorAdapter", { enumerable: true, get: function () { return telemetryDetector_1.telemetryDetectorAdapter; } });
@@ -114,6 +114,8 @@ exports.presidioAdapter = {
114
114
  id: "presidio",
115
115
  category: "privacy",
116
116
  async detect(_project, config) {
117
+ // This adapter belongs to the normal privacy scan. DPDP has an independent
118
+ // opt-out switch and invokes/reuses this adapter through its collector.
117
119
  return config.checks.privacy.enabled && config.checks.privacy.presidio.enabled;
118
120
  },
119
121
  async runStandalone(ctx) {
@@ -154,5 +156,5 @@ exports.presidioAdapter = {
154
156
  status
155
157
  };
156
158
  },
157
- installHint: "Optional privacy scanner. Enable checks.privacy.presidio.enabled and install presidio-analyzer."
159
+ installHint: "Optional privacy scanner (on by default). Install: python -m pip install presidio-analyzer. Opt out of normal privacy scans with checks.privacy.presidio.enabled: false."
158
160
  };
@@ -5,6 +5,29 @@ export declare function confidenceFromScore(score: number): Confidence;
5
5
  export declare function passesLuhn(value: string): boolean;
6
6
  export declare function isValidAadhaar(value: string): boolean;
7
7
  export declare function maskPiiValue(value: string, entityType: string, maskExamples?: boolean): string;
8
- export declare function detectPiiFindings(ctx: ToolAdapterContext): Promise<Finding[]>;
8
+ export type DetectPiiFindingsOptions = {
9
+ /**
10
+ * When set, only these files are scanned (already path-normalized preferred).
11
+ * Used by DPDP changed-scope collection so privacy reuse the same allowlist.
12
+ */
13
+ fileAllowlist?: string[];
14
+ /** Override include patterns (defaults to config.paths.include). Ignored when fileAllowlist is set. */
15
+ include?: string[];
16
+ /** Override exclude patterns (defaults to config.paths.exclude). Ignored when fileAllowlist is set. */
17
+ exclude?: string[];
18
+ /** Bypass process-lifetime cache (tests / forced refresh). */
19
+ skipCache?: boolean;
20
+ };
21
+ export declare function clearPrivacyFindingsCache(): void;
22
+ export declare function getPrivacyFindingsCacheStats(): {
23
+ size: number;
24
+ hits: number;
25
+ misses: number;
26
+ };
27
+ /**
28
+ * Deterministic privacy scan with process-lifetime cache.
29
+ * Concurrent callers with the same key share one in-flight computation (dedupes privacy + DPDP double walks).
30
+ */
31
+ export declare function detectPiiFindings(ctx: ToolAdapterContext, options?: DetectPiiFindingsOptions): Promise<Finding[]>;
9
32
  export declare const privacyDetectorAdapter: ToolAdapter;
10
33
  export declare function normalizeExternalFile(file: string | undefined, root: string): string | undefined;