@neuralaxis/vibedoctor 0.1.2 → 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 (109) hide show
  1. package/README.md +215 -102
  2. package/dist/adapters/biome.d.ts +1 -1
  3. package/dist/adapters/biome.js +7 -4
  4. package/dist/adapters/coveragePy.js +3 -0
  5. package/dist/adapters/deptry.js +21 -2
  6. package/dist/adapters/dpdp.d.ts +6 -0
  7. package/dist/adapters/dpdp.js +34 -0
  8. package/dist/adapters/index.d.ts +1 -0
  9. package/dist/adapters/index.js +3 -1
  10. package/dist/adapters/knip.js +29 -4
  11. package/dist/adapters/lizard.d.ts +1 -1
  12. package/dist/adapters/lizard.js +51 -2
  13. package/dist/adapters/osvScanner.js +14 -2
  14. package/dist/adapters/presidio.js +3 -1
  15. package/dist/adapters/privacyDetector.d.ts +24 -1
  16. package/dist/adapters/privacyDetector.js +91 -7
  17. package/dist/adapters/ruff.d.ts +1 -1
  18. package/dist/adapters/ruff.js +4 -1
  19. package/dist/adapters/semgrep.d.ts +1 -1
  20. package/dist/adapters/semgrep.js +17 -3
  21. package/dist/adapters/shared.d.ts +7 -0
  22. package/dist/adapters/shared.js +22 -0
  23. package/dist/adapters/tsc.js +43 -18
  24. package/dist/adapters/vulture.d.ts +1 -1
  25. package/dist/adapters/vulture.js +25 -6
  26. package/dist/agentPack/templates/index.js +7 -4
  27. package/dist/agentPack/templates/skills.js +156 -44
  28. package/dist/cli/commands/agentPlan.js +9 -1
  29. package/dist/cli/commands/dpdp.d.ts +35 -0
  30. package/dist/cli/commands/dpdp.js +103 -0
  31. package/dist/cli/commands/init.js +12 -4
  32. package/dist/cli/commands/scan.d.ts +1 -1
  33. package/dist/cli/commands/scan.js +8 -1
  34. package/dist/cli/commands/setup.js +4 -2
  35. package/dist/cli/commands/tool.d.ts +4 -0
  36. package/dist/cli/commands/tool.js +11 -0
  37. package/dist/cli/index.js +96 -0
  38. package/dist/core/config.d.ts +27 -0
  39. package/dist/core/config.js +118 -5
  40. package/dist/core/engine.d.ts +32 -1
  41. package/dist/core/engine.js +195 -30
  42. package/dist/core/finding.d.ts +1 -1
  43. package/dist/core/finding.js +1 -0
  44. package/dist/core/projectDetector.d.ts +1 -1
  45. package/dist/core/projectDetector.js +29 -12
  46. package/dist/core/scanPlanner.js +10 -2
  47. package/dist/core/toolRunner.d.ts +1 -0
  48. package/dist/core/toolRunner.js +73 -11
  49. package/dist/dpdp/artifacts.d.ts +11 -0
  50. package/dist/dpdp/artifacts.js +120 -0
  51. package/dist/dpdp/catalogue.d.ts +14 -0
  52. package/dist/dpdp/catalogue.js +661 -0
  53. package/dist/dpdp/collectors/confidence.d.ts +9 -0
  54. package/dist/dpdp/collectors/confidence.js +25 -0
  55. package/dist/dpdp/collectors/dependencies.d.ts +7 -0
  56. package/dist/dpdp/collectors/dependencies.js +63 -0
  57. package/dist/dpdp/collectors/index.d.ts +24 -0
  58. package/dist/dpdp/collectors/index.js +71 -0
  59. package/dist/dpdp/collectors/lifecycle.d.ts +2 -0
  60. package/dist/dpdp/collectors/lifecycle.js +202 -0
  61. package/dist/dpdp/collectors/optionalScanners.d.ts +14 -0
  62. package/dist/dpdp/collectors/optionalScanners.js +347 -0
  63. package/dist/dpdp/collectors/privacyBridge.d.ts +13 -0
  64. package/dist/dpdp/collectors/privacyBridge.js +152 -0
  65. package/dist/dpdp/collectors/safeguards.d.ts +5 -0
  66. package/dist/dpdp/collectors/safeguards.js +186 -0
  67. package/dist/dpdp/collectors/schema.d.ts +6 -0
  68. package/dist/dpdp/collectors/schema.js +122 -0
  69. package/dist/dpdp/collectors/shared.d.ts +10 -0
  70. package/dist/dpdp/collectors/shared.js +43 -0
  71. package/dist/dpdp/context.d.ts +28 -0
  72. package/dist/dpdp/context.js +195 -0
  73. package/dist/dpdp/dataMap.d.ts +7 -0
  74. package/dist/dpdp/dataMap.js +339 -0
  75. package/dist/dpdp/evaluators.d.ts +20 -0
  76. package/dist/dpdp/evaluators.js +522 -0
  77. package/dist/dpdp/evidence.d.ts +11 -0
  78. package/dist/dpdp/evidence.js +123 -0
  79. package/dist/dpdp/findings.d.ts +14 -0
  80. package/dist/dpdp/findings.js +99 -0
  81. package/dist/dpdp/gates.d.ts +14 -0
  82. package/dist/dpdp/gates.js +47 -0
  83. package/dist/dpdp/index.d.ts +16 -0
  84. package/dist/dpdp/index.js +32 -0
  85. package/dist/dpdp/legalSources.d.ts +10 -0
  86. package/dist/dpdp/legalSources.js +104 -0
  87. package/dist/dpdp/paths.d.ts +25 -0
  88. package/dist/dpdp/paths.js +85 -0
  89. package/dist/dpdp/report.d.ts +6 -0
  90. package/dist/dpdp/report.js +222 -0
  91. package/dist/dpdp/reviewQueue.d.ts +3 -0
  92. package/dist/dpdp/reviewQueue.js +88 -0
  93. package/dist/dpdp/scan.d.ts +26 -0
  94. package/dist/dpdp/scan.js +310 -0
  95. package/dist/dpdp/scoring.d.ts +31 -0
  96. package/dist/dpdp/scoring.js +211 -0
  97. package/dist/dpdp/types.d.ts +294 -0
  98. package/dist/dpdp/types.js +86 -0
  99. package/dist/index.d.ts +1 -0
  100. package/dist/index.js +1 -0
  101. package/dist/mcp/tools/dpdp.d.ts +11 -0
  102. package/dist/mcp/tools/dpdp.js +151 -0
  103. package/dist/mcp/tools/index.js +3 -1
  104. package/dist/mcp/tools/shared.js +8 -1
  105. package/dist/reporters/agent.js +8 -0
  106. package/dist/reporters/html.js +4 -2
  107. package/dist/reporters/json.js +8 -1
  108. package/dist/reporters/markdown.js +8 -1
  109. package/package.json +9 -2
@@ -0,0 +1,31 @@
1
+ import type { Severity } from "../core/finding";
2
+ import type { ControlResult, ControlStatusCounts, DpdpScores } from "./types";
3
+ /**
4
+ * Controls that expect an implementation signal when personal data is processed.
5
+ * NOT_OBSERVED on these is weak posture (missing expected control), not a clean bill of health.
6
+ */
7
+ export declare const POSITIVE_CONTROL_EVALUATORS: Set<string>;
8
+ /**
9
+ * Gap / anti-pattern detectors. NOT_OBSERVED means no gap was seen (good, with uncertainty).
10
+ */
11
+ export declare const GAP_CONTROL_EVALUATORS: Set<string>;
12
+ export declare function isPositiveControl(control: ControlResult): boolean;
13
+ export declare function isGapControl(control: ControlResult): boolean;
14
+ export declare function countStatuses(controls: ControlResult[]): ControlStatusCounts;
15
+ /** Points contributed by one control status toward technical posture (0–1). */
16
+ export declare function posturePointsForControl(control: ControlResult): number;
17
+ /**
18
+ * Technical posture score from applicable technically observable controls only.
19
+ * NOT a legal compliance percentage.
20
+ *
21
+ * Scoring table:
22
+ * - VERIFIED 1.0 · PARTIAL 0.5 · VIOLATED 0.0 · ERROR 0.15 · NEEDS_CONTEXT 0.4
23
+ * - NOT_OBSERVED: 0.25 (positive control), 0.85 (gap detector), 0.7 (other)
24
+ */
25
+ export declare function computeTechnicalPostureScore(controls: ControlResult[]): number;
26
+ /**
27
+ * Evidence completeness: share of applicable controls that have evidence or are verified/violated/partial.
28
+ */
29
+ export declare function computeEvidenceCompleteness(controls: ControlResult[]): number;
30
+ export declare function openRiskBySeverity(controls: ControlResult[]): Record<Severity, number>;
31
+ export declare function buildDpdpScores(controls: ControlResult[]): DpdpScores;
@@ -0,0 +1,211 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GAP_CONTROL_EVALUATORS = exports.POSITIVE_CONTROL_EVALUATORS = void 0;
4
+ exports.isPositiveControl = isPositiveControl;
5
+ exports.isGapControl = isGapControl;
6
+ exports.countStatuses = countStatuses;
7
+ exports.posturePointsForControl = posturePointsForControl;
8
+ exports.computeTechnicalPostureScore = computeTechnicalPostureScore;
9
+ exports.computeEvidenceCompleteness = computeEvidenceCompleteness;
10
+ exports.openRiskBySeverity = openRiskBySeverity;
11
+ exports.buildDpdpScores = buildDpdpScores;
12
+ const catalogue_1 = require("./catalogue");
13
+ /**
14
+ * Controls that expect an implementation signal when personal data is processed.
15
+ * NOT_OBSERVED on these is weak posture (missing expected control), not a clean bill of health.
16
+ */
17
+ exports.POSITIVE_CONTROL_EVALUATORS = new Set([
18
+ "notice-signals",
19
+ "consent-capture",
20
+ "consent-metadata",
21
+ "consent-withdrawal",
22
+ "purpose-binding",
23
+ "retention-mechanism",
24
+ "erasure-path",
25
+ "access-export",
26
+ "correction-path",
27
+ "grievance-handling",
28
+ "nomination-signal",
29
+ "rights-request-tracking",
30
+ "breach-preparedness",
31
+ "audit-signals",
32
+ "guardian-consent",
33
+ "childrens-data"
34
+ ]);
35
+ /**
36
+ * Gap / anti-pattern detectors. NOT_OBSERVED means no gap was seen (good, with uncertainty).
37
+ */
38
+ exports.GAP_CONTROL_EVALUATORS = new Set([
39
+ "api-overfetch",
40
+ "broad-db-select",
41
+ "pii-in-logs",
42
+ "pii-in-llm",
43
+ "pii-in-urls",
44
+ "browser-storage-pii",
45
+ "insecure-http",
46
+ "route-auth",
47
+ "hardcoded-pii",
48
+ "debug-exposure",
49
+ "weak-masking",
50
+ "unprotected-export",
51
+ "third-party-user-object",
52
+ "storage-without-deletion"
53
+ ]);
54
+ function isPositiveControl(control) {
55
+ const definition = (0, catalogue_1.getControlById)(control.controlId);
56
+ const evaluatorId = definition?.evaluatorId;
57
+ if (!evaluatorId) {
58
+ return false;
59
+ }
60
+ return exports.POSITIVE_CONTROL_EVALUATORS.has(evaluatorId);
61
+ }
62
+ function isGapControl(control) {
63
+ const definition = (0, catalogue_1.getControlById)(control.controlId);
64
+ const evaluatorId = definition?.evaluatorId;
65
+ if (!evaluatorId) {
66
+ return false;
67
+ }
68
+ return exports.GAP_CONTROL_EVALUATORS.has(evaluatorId);
69
+ }
70
+ function countStatuses(controls) {
71
+ const counts = {
72
+ verified: 0,
73
+ violated: 0,
74
+ partial: 0,
75
+ notObserved: 0,
76
+ needsContext: 0,
77
+ notApplicable: 0,
78
+ skipped: 0,
79
+ error: 0,
80
+ humanReview: 0,
81
+ unresolved: 0
82
+ };
83
+ for (const control of controls) {
84
+ switch (control.status) {
85
+ case "VERIFIED":
86
+ counts.verified += 1;
87
+ break;
88
+ case "VIOLATED":
89
+ counts.violated += 1;
90
+ break;
91
+ case "PARTIAL":
92
+ counts.partial += 1;
93
+ break;
94
+ case "NOT_OBSERVED":
95
+ counts.notObserved += 1;
96
+ break;
97
+ case "NEEDS_CONTEXT":
98
+ counts.needsContext += 1;
99
+ break;
100
+ case "NOT_APPLICABLE":
101
+ counts.notApplicable += 1;
102
+ break;
103
+ case "SKIPPED":
104
+ counts.skipped += 1;
105
+ break;
106
+ case "ERROR":
107
+ counts.error += 1;
108
+ break;
109
+ default:
110
+ break;
111
+ }
112
+ if (control.verificationClass === "HUMAN_REVIEW" || control.status === "NEEDS_CONTEXT") {
113
+ counts.humanReview += 1;
114
+ }
115
+ }
116
+ // Unresolved = needs attention: violated + partial + needs_context + error
117
+ counts.unresolved = counts.violated + counts.partial + counts.needsContext + counts.error;
118
+ return counts;
119
+ }
120
+ /** Points contributed by one control status toward technical posture (0–1). */
121
+ function posturePointsForControl(control) {
122
+ switch (control.status) {
123
+ case "VERIFIED":
124
+ return 1;
125
+ case "PARTIAL":
126
+ return 0.5;
127
+ case "VIOLATED":
128
+ return 0;
129
+ case "ERROR":
130
+ return 0.15;
131
+ case "NEEDS_CONTEXT":
132
+ return 0.4;
133
+ case "NOT_OBSERVED":
134
+ // Positive controls missing expected signals: low credit.
135
+ // Gap detectors with no bad pattern: mostly good (not VERIFIED).
136
+ if (isPositiveControl(control)) {
137
+ return 0.25;
138
+ }
139
+ if (isGapControl(control)) {
140
+ return 0.85;
141
+ }
142
+ // Inventory, processors, cross-border, SDF, etc. — neutral-good silence
143
+ return 0.7;
144
+ default:
145
+ return 0.5;
146
+ }
147
+ }
148
+ /**
149
+ * Technical posture score from applicable technically observable controls only.
150
+ * NOT a legal compliance percentage.
151
+ *
152
+ * Scoring table:
153
+ * - VERIFIED 1.0 · PARTIAL 0.5 · VIOLATED 0.0 · ERROR 0.15 · NEEDS_CONTEXT 0.4
154
+ * - NOT_OBSERVED: 0.25 (positive control), 0.85 (gap detector), 0.7 (other)
155
+ */
156
+ function computeTechnicalPostureScore(controls) {
157
+ const observable = controls.filter((control) => control.applicable &&
158
+ control.status !== "NOT_APPLICABLE" &&
159
+ control.status !== "SKIPPED" &&
160
+ (control.verificationClass === "DETERMINISTIC" || control.verificationClass === "TECHNICAL_SIGNAL"));
161
+ if (observable.length === 0) {
162
+ return 100;
163
+ }
164
+ let points = 0;
165
+ for (const control of observable) {
166
+ points += posturePointsForControl(control);
167
+ }
168
+ return Math.max(0, Math.min(100, Math.round((points / observable.length) * 100)));
169
+ }
170
+ /**
171
+ * Evidence completeness: share of applicable controls that have evidence or are verified/violated/partial.
172
+ */
173
+ function computeEvidenceCompleteness(controls) {
174
+ const applicable = controls.filter((control) => control.applicable && control.status !== "NOT_APPLICABLE" && control.status !== "SKIPPED");
175
+ if (applicable.length === 0) {
176
+ return 100;
177
+ }
178
+ const withEvidence = applicable.filter((control) => control.evidenceIds.length > 0 ||
179
+ control.status === "VERIFIED" ||
180
+ control.status === "VIOLATED" ||
181
+ control.status === "PARTIAL");
182
+ return Math.round((withEvidence.length / applicable.length) * 100);
183
+ }
184
+ function openRiskBySeverity(controls) {
185
+ const counts = {
186
+ critical: 0,
187
+ high: 0,
188
+ medium: 0,
189
+ low: 0,
190
+ info: 0
191
+ };
192
+ for (const control of controls) {
193
+ if (control.status === "VIOLATED" || control.status === "PARTIAL" || control.status === "ERROR") {
194
+ counts[control.severity] += 1;
195
+ }
196
+ }
197
+ return counts;
198
+ }
199
+ function buildDpdpScores(controls) {
200
+ return {
201
+ technicalPostureScore: computeTechnicalPostureScore(controls),
202
+ evidenceCompletenessPercent: computeEvidenceCompleteness(controls),
203
+ openRiskBySeverity: openRiskBySeverity(controls),
204
+ statusCounts: countStatuses(controls),
205
+ labels: {
206
+ technicalPosture: "DPDP technical posture (not legal compliance)",
207
+ evidenceCompleteness: "Evidence completeness (technical observability)",
208
+ openRisk: "Open technical risk counts by severity"
209
+ }
210
+ };
211
+ }
@@ -0,0 +1,294 @@
1
+ import type { Confidence, Severity } from "../core/finding";
2
+ /** Verification classes for DPDP controls. */
3
+ export declare const VERIFICATION_CLASSES: readonly ["DETERMINISTIC", "TECHNICAL_SIGNAL", "DECLARED_EVIDENCE", "HUMAN_REVIEW"];
4
+ export type VerificationClass = (typeof VERIFICATION_CLASSES)[number];
5
+ /** Control result statuses. Absence of evidence must never become VERIFIED. */
6
+ export declare const CONTROL_STATUSES: readonly ["VERIFIED", "VIOLATED", "PARTIAL", "NOT_OBSERVED", "NEEDS_CONTEXT", "NOT_APPLICABLE", "SKIPPED", "ERROR"];
7
+ export type ControlStatus = (typeof CONTROL_STATUSES)[number];
8
+ export declare const CONTROL_DOMAINS: readonly ["applicability_and_inventory", "notice", "consent", "withdrawal", "purpose_limitation", "data_minimisation", "accuracy", "security_safeguards", "breach_preparedness", "retention", "erasure", "data_principal_access", "correction", "grievance_handling", "nomination", "childrens_data", "guardian_consent", "processors_and_recipients", "cross_border_signals", "significant_data_fiduciary", "exemptions_and_applicability"];
9
+ export type ControlDomain = (typeof CONTROL_DOMAINS)[number];
10
+ export declare const EVIDENCE_KINDS: readonly ["personal_data_category", "field_or_column", "collection_source", "processing_operation", "transformation", "storage_location", "log_or_telemetry", "external_recipient", "protection_control", "retention_mechanism", "deletion_path", "rights_endpoint", "consent_signal", "policy_declaration", "safeguard_gap", "declared_assertion", "skip_or_capability"];
11
+ export type EvidenceKind = (typeof EVIDENCE_KINDS)[number];
12
+ export type ObservationCertainty = "confirmed" | "inferred" | "declared";
13
+ export type DataCategory = "aadhaar" | "pan" | "passport" | "voter_id" | "driving_licence" | "name" | "email" | "phone" | "postal_address" | "date_of_birth" | "age" | "financial_payment" | "health_disability" | "biometric_identity" | "location" | "ip_device_id" | "cookie_ad_id" | "credentials_auth" | "employee_applicant_customer" | "free_text_personal" | "llm_prompt_embedding" | "other_personal" | "unknown";
14
+ export type LegalSourceRef = {
15
+ id: string;
16
+ title: string;
17
+ version: string;
18
+ citation: string;
19
+ notificationId?: string;
20
+ publishedAt?: string;
21
+ effectiveSchedule?: string[];
22
+ sourceStatus?: "enacted" | "notified" | "corrigendum";
23
+ sections?: string[];
24
+ url?: string;
25
+ };
26
+ export type ControlDefinition = {
27
+ id: string;
28
+ title: string;
29
+ domain: ControlDomain;
30
+ technicalIntent: string;
31
+ legalSourceIds: string[];
32
+ legalCitations: string[];
33
+ applicability: {
34
+ when: string;
35
+ requiresPersonalData?: boolean;
36
+ requiresChildren?: boolean;
37
+ requiresSdf?: boolean;
38
+ requiresProcessors?: boolean;
39
+ requiresCrossBorder?: boolean;
40
+ };
41
+ verificationClass: VerificationClass;
42
+ evidenceRequirements: string[];
43
+ /** Stable evaluator key; when absent, only human/declared evaluation applies. */
44
+ evaluatorId?: string;
45
+ possibleStatuses: ControlStatus[];
46
+ severityRules: {
47
+ defaultSeverity: Severity;
48
+ violatedSeverity: Severity;
49
+ partialSeverity?: Severity;
50
+ };
51
+ limitations: string[];
52
+ remediation: string;
53
+ humanReviewQuestions: string[];
54
+ sourceVersion: string;
55
+ };
56
+ export type EvidenceItem = {
57
+ id: string;
58
+ kind: EvidenceKind;
59
+ dataCategory?: DataCategory;
60
+ file?: string;
61
+ line?: number;
62
+ endLine?: number;
63
+ symbol?: string;
64
+ field?: string;
65
+ source?: string;
66
+ destination?: string;
67
+ detectionMethod: string;
68
+ confidence: Confidence;
69
+ confidenceScore?: number;
70
+ provenance: "deterministic" | "technical_signal" | "declared" | "presidio" | "semgrep" | "privacy-detector";
71
+ relatedControls: string[];
72
+ certainty: ObservationCertainty;
73
+ /** Masked/classified summary only — never raw PII. */
74
+ summary: string;
75
+ /** Optional redacted snippet. */
76
+ snippet?: string;
77
+ tags: string[];
78
+ };
79
+ export type DeclaredAssertion = {
80
+ id: string;
81
+ statement: string;
82
+ source: string;
83
+ suppliedRole: string;
84
+ date: string;
85
+ relatedControls: string[];
86
+ verificationStatus: "unverified" | "partially_corroborated" | "contradicted" | "supported_by_signal";
87
+ };
88
+ export type DpdpContext = {
89
+ version: number;
90
+ organization: {
91
+ processesPersonalData: "true" | "false" | "unknown";
92
+ isSignificantDataFiduciary: "true" | "false" | "unknown";
93
+ processesChildrenData: "true" | "false" | "unknown";
94
+ hasCrossBorderTransfer: "true" | "false" | "unknown";
95
+ industry?: string;
96
+ notes?: string;
97
+ };
98
+ purposes?: string[];
99
+ processors?: string[];
100
+ policies?: Array<{
101
+ name: string;
102
+ path?: string;
103
+ version?: string;
104
+ }>;
105
+ };
106
+ export type ControlResult = {
107
+ controlId: string;
108
+ title: string;
109
+ domain: ControlDomain;
110
+ status: ControlStatus;
111
+ verificationClass: VerificationClass;
112
+ confidence: Confidence;
113
+ severity: Severity;
114
+ evidenceIds: string[];
115
+ explanation: string;
116
+ limitations: string[];
117
+ remediation?: string;
118
+ humanReviewQuestion?: string;
119
+ isNew: boolean;
120
+ applicable: boolean;
121
+ };
122
+ /** Node kinds in the personal-data processing graph (classified labels only — never raw PII). */
123
+ export declare const DATA_MAP_NODE_KINDS: readonly ["category", "field", "collection", "store", "external", "lifecycle", "safeguard_gap", "control", "evidence"];
124
+ export type DataMapNodeKind = (typeof DATA_MAP_NODE_KINDS)[number];
125
+ export declare const DATA_MAP_EDGE_RELATIONS: readonly ["instance_of", "collected_at", "stored_in", "sent_to", "protected_by", "lifecycle_of", "related_control", "evidenced_by", "co_located"];
126
+ export type DataMapEdgeRelation = (typeof DATA_MAP_EDGE_RELATIONS)[number];
127
+ export type DataMapNode = {
128
+ id: string;
129
+ kind: DataMapNodeKind;
130
+ /** Classified label only (category name, store kind, control id, etc.). Never raw PII. */
131
+ label: string;
132
+ category?: DataCategory;
133
+ file?: string;
134
+ line?: number;
135
+ evidenceIds?: string[];
136
+ };
137
+ export type DataMapEdge = {
138
+ id: string;
139
+ from: string;
140
+ to: string;
141
+ relation: DataMapEdgeRelation;
142
+ };
143
+ export type PersonalDataMapGraph = {
144
+ nodes: DataMapNode[];
145
+ edges: DataMapEdge[];
146
+ };
147
+ export type PersonalDataMap = {
148
+ version: 1;
149
+ generatedAt: string;
150
+ disclaimer: string;
151
+ categories: Array<{
152
+ category: DataCategory;
153
+ count: number;
154
+ evidenceIds: string[];
155
+ }>;
156
+ collectionPoints: Array<{
157
+ id: string;
158
+ kind: string;
159
+ file?: string;
160
+ line?: number;
161
+ summary: string;
162
+ evidenceIds: string[];
163
+ }>;
164
+ stores: Array<{
165
+ id: string;
166
+ kind: string;
167
+ file?: string;
168
+ summary: string;
169
+ evidenceIds: string[];
170
+ }>;
171
+ externalRecipients: Array<{
172
+ id: string;
173
+ name: string;
174
+ kind: string;
175
+ file?: string;
176
+ summary: string;
177
+ evidenceIds: string[];
178
+ }>;
179
+ lifecycleSignals: Array<{
180
+ id: string;
181
+ kind: string;
182
+ file?: string;
183
+ line?: number;
184
+ summary: string;
185
+ evidenceIds: string[];
186
+ }>;
187
+ safeguardGaps: Array<{
188
+ id: string;
189
+ kind: string;
190
+ file?: string;
191
+ line?: number;
192
+ summary: string;
193
+ evidenceIds: string[];
194
+ }>;
195
+ relatedControls: string[];
196
+ /** Lightweight processing graph; safe for agents. Existing flat lists remain for compat. */
197
+ graph: PersonalDataMapGraph;
198
+ };
199
+ export type ControlMatrix = {
200
+ version: 1;
201
+ generatedAt: string;
202
+ disclaimer: string;
203
+ legalSourceVersion: string;
204
+ controls: ControlResult[];
205
+ summary: ControlStatusCounts;
206
+ };
207
+ export type ControlStatusCounts = {
208
+ verified: number;
209
+ violated: number;
210
+ partial: number;
211
+ notObserved: number;
212
+ needsContext: number;
213
+ notApplicable: number;
214
+ skipped: number;
215
+ error: number;
216
+ humanReview: number;
217
+ unresolved: number;
218
+ };
219
+ export type EvidenceLedger = {
220
+ version: 1;
221
+ generatedAt: string;
222
+ disclaimer: string;
223
+ evidence: EvidenceItem[];
224
+ declared: DeclaredAssertion[];
225
+ };
226
+ export type DpdpScores = {
227
+ /** Technical readiness only — not legal compliance. */
228
+ technicalPostureScore: number;
229
+ evidenceCompletenessPercent: number;
230
+ openRiskBySeverity: Record<Severity, number>;
231
+ statusCounts: ControlStatusCounts;
232
+ labels: {
233
+ technicalPosture: "DPDP technical posture (not legal compliance)";
234
+ evidenceCompleteness: "Evidence completeness (technical observability)";
235
+ openRisk: "Open technical risk counts by severity";
236
+ };
237
+ };
238
+ export type ReviewQueueItem = {
239
+ controlId: string;
240
+ title: string;
241
+ domain: ControlDomain;
242
+ audience: "developer" | "security" | "product" | "legal" | "operations" | "founder";
243
+ question: string;
244
+ status: ControlStatus;
245
+ severity: Severity;
246
+ };
247
+ export type DpdpScanMode = "default" | "changed" | "full";
248
+ export type DpdpCapabilityStatus = {
249
+ id: string;
250
+ status: "available" | "skipped" | "error";
251
+ message?: string;
252
+ };
253
+ export type DpdpScanResult = {
254
+ version: 1;
255
+ generatedAt: string;
256
+ root: string;
257
+ mode: DpdpScanMode;
258
+ disclaimer: string;
259
+ scores: DpdpScores;
260
+ dataMap: PersonalDataMap;
261
+ controlMatrix: ControlMatrix;
262
+ evidenceLedger: EvidenceLedger;
263
+ reviewQueue: ReviewQueueItem[];
264
+ fixNext: Array<{
265
+ controlId: string;
266
+ title: string;
267
+ severity: Severity;
268
+ remediation: string;
269
+ evidenceIds: string[];
270
+ }>;
271
+ capabilities: DpdpCapabilityStatus[];
272
+ findings: import("../core/finding").Finding[];
273
+ legalSourceVersion: string;
274
+ context: DpdpContext;
275
+ baselineApplied: boolean;
276
+ };
277
+ export type TechnicalSignalBag = {
278
+ id: string;
279
+ kind: string;
280
+ file?: string;
281
+ line?: number;
282
+ symbol?: string;
283
+ field?: string;
284
+ category?: DataCategory;
285
+ summary: string;
286
+ snippet?: string;
287
+ confidence: Confidence;
288
+ confidenceScore?: number;
289
+ tags: string[];
290
+ relatedControls?: string[];
291
+ certainty?: ObservationCertainty;
292
+ detectionMethod: string;
293
+ provenance?: EvidenceItem["provenance"];
294
+ };
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DATA_MAP_EDGE_RELATIONS = exports.DATA_MAP_NODE_KINDS = exports.EVIDENCE_KINDS = exports.CONTROL_DOMAINS = exports.CONTROL_STATUSES = exports.VERIFICATION_CLASSES = void 0;
4
+ /** Verification classes for DPDP controls. */
5
+ exports.VERIFICATION_CLASSES = [
6
+ "DETERMINISTIC",
7
+ "TECHNICAL_SIGNAL",
8
+ "DECLARED_EVIDENCE",
9
+ "HUMAN_REVIEW"
10
+ ];
11
+ /** Control result statuses. Absence of evidence must never become VERIFIED. */
12
+ exports.CONTROL_STATUSES = [
13
+ "VERIFIED",
14
+ "VIOLATED",
15
+ "PARTIAL",
16
+ "NOT_OBSERVED",
17
+ "NEEDS_CONTEXT",
18
+ "NOT_APPLICABLE",
19
+ "SKIPPED",
20
+ "ERROR"
21
+ ];
22
+ exports.CONTROL_DOMAINS = [
23
+ "applicability_and_inventory",
24
+ "notice",
25
+ "consent",
26
+ "withdrawal",
27
+ "purpose_limitation",
28
+ "data_minimisation",
29
+ "accuracy",
30
+ "security_safeguards",
31
+ "breach_preparedness",
32
+ "retention",
33
+ "erasure",
34
+ "data_principal_access",
35
+ "correction",
36
+ "grievance_handling",
37
+ "nomination",
38
+ "childrens_data",
39
+ "guardian_consent",
40
+ "processors_and_recipients",
41
+ "cross_border_signals",
42
+ "significant_data_fiduciary",
43
+ "exemptions_and_applicability"
44
+ ];
45
+ exports.EVIDENCE_KINDS = [
46
+ "personal_data_category",
47
+ "field_or_column",
48
+ "collection_source",
49
+ "processing_operation",
50
+ "transformation",
51
+ "storage_location",
52
+ "log_or_telemetry",
53
+ "external_recipient",
54
+ "protection_control",
55
+ "retention_mechanism",
56
+ "deletion_path",
57
+ "rights_endpoint",
58
+ "consent_signal",
59
+ "policy_declaration",
60
+ "safeguard_gap",
61
+ "declared_assertion",
62
+ "skip_or_capability"
63
+ ];
64
+ /** Node kinds in the personal-data processing graph (classified labels only — never raw PII). */
65
+ exports.DATA_MAP_NODE_KINDS = [
66
+ "category",
67
+ "field",
68
+ "collection",
69
+ "store",
70
+ "external",
71
+ "lifecycle",
72
+ "safeguard_gap",
73
+ "control",
74
+ "evidence"
75
+ ];
76
+ exports.DATA_MAP_EDGE_RELATIONS = [
77
+ "instance_of",
78
+ "collected_at",
79
+ "stored_in",
80
+ "sent_to",
81
+ "protected_by",
82
+ "lifecycle_of",
83
+ "related_control",
84
+ "evidenced_by",
85
+ "co_located"
86
+ ];
package/dist/index.d.ts CHANGED
@@ -7,3 +7,4 @@ export * from "./core/finding";
7
7
  export * from "./core/privacyReview";
8
8
  export * from "./core/projectDetector";
9
9
  export * from "./mcp/server";
10
+ export * from "./dpdp";
package/dist/index.js CHANGED
@@ -26,3 +26,4 @@ __exportStar(require("./core/finding"), exports);
26
26
  __exportStar(require("./core/privacyReview"), exports);
27
27
  __exportStar(require("./core/projectDetector"), exports);
28
28
  __exportStar(require("./mcp/server"), exports);
29
+ __exportStar(require("./dpdp"), exports);
@@ -0,0 +1,11 @@
1
+ import type { McpToolDefinition } from "./shared";
2
+ export declare const dpdpScanTool: McpToolDefinition;
3
+ export declare const dpdpScanChangedTool: McpToolDefinition;
4
+ export declare const dpdpGetDataMapTool: McpToolDefinition;
5
+ export declare const dpdpGetControlMatrixTool: McpToolDefinition;
6
+ export declare const dpdpGetReviewQueueTool: McpToolDefinition;
7
+ export declare const dpdpExplainControlTool: McpToolDefinition;
8
+ export declare const dpdpGetEvidenceTool: McpToolDefinition;
9
+ export declare const dpdpVerifyTool: McpToolDefinition;
10
+ export declare const dpdpHandoffTool: McpToolDefinition;
11
+ export declare const dpdpMcpTools: McpToolDefinition[];