@dataparade/cli 0.0.28 → 0.0.29
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 +4 -1
- package/dist/package.json +2 -2
- package/dist/src/cli.d.ts +3 -0
- package/dist/src/cli.js +65 -31
- package/dist/src/platform-api/fetch-failure.d.ts +5 -0
- package/dist/src/platform-api/fetch-failure.js +13 -0
- package/dist/src/platform-api/upload-client.d.ts +5 -0
- package/dist/src/platform-api/upload-client.js +11 -1
- package/dist/src/ui/scan-progress-renderer.d.ts +14 -0
- package/dist/src/ui/scan-progress-renderer.js +19 -3
- package/dist/tests/unit/cli/scan-ai-session-fallback.spec.d.ts +1 -0
- package/dist/tests/unit/cli/scan-ai-session-fallback.spec.js +156 -0
- package/dist/tests/unit/ui/scan-progress-renderer.spec.js +21 -0
- package/dist/vendor/scanner/dist/src/pii-signals/match-pii-signals.d.ts +24 -0
- package/dist/vendor/scanner/dist/src/pii-signals/match-pii-signals.js +19 -6
- package/dist/vendor/scanner/dist/src/pii-signals/occurrence-group.js +5 -2
- package/dist/vendor/scanner/dist/src/pii-signals/pii-signal-aliases.js +5 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -32,6 +32,7 @@ A scan reads the source and config files under the folder (skipping dependencies
|
|
|
32
32
|
- In a TTY: brand header, staged progress (spinner → checkmarks), a short **What we found** summary (routes, databases, outbound services), and a clear next-step note.
|
|
33
33
|
- In CI / non-TTY (or with `NO_COLOR`): the same content as plain logs — no spinners or ANSI.
|
|
34
34
|
- On success: `[scan] dataflow.json written to /absolute/path/to/dataflow.json` (always printed for scripts/tests).
|
|
35
|
+
- If AI enrichment cannot start (no network, anonymous per-IP limit, server error), the CLI prints `AI enrichment unavailable (<reason>); continuing with a structural scan.` and still writes the output. Use `--no-ai-inference` to skip AI.
|
|
35
36
|
- When auto-upload runs: `[scan] Preview ready: <URL>` (plus a friendly next-step note with the same URL).
|
|
36
37
|
- By default, the output goes to a **`.dataparade/`** folder in the current working directory (override the path of `dataflow.json` with `-o` / `--output`; the other files sit next to it).
|
|
37
38
|
|
|
@@ -50,7 +51,9 @@ After a scan, the CLI **auto-uploads** `dataflow.json` and the Facts next to it
|
|
|
50
51
|
- **With a workspace API key** (`DATAPARADE_WORKSPACE_API_KEY` from **Workspace → Access keys**): prints a dashboard link (`?importDraft=`) for that workspace.
|
|
51
52
|
- **Without a workspace key**: prints a sign-up link (`/preview/cli/<token>`). Create an account to open **Preview & Edit** on your dashboard.
|
|
52
53
|
- Opt out: `--skip-auto-upload` or `DATAPARADE_SKIP_AUTO_UPLOAD=true`
|
|
53
|
-
-
|
|
54
|
+
- With a workspace API key, an upload does **not** use scan quota.
|
|
55
|
+
- Without a key, uploads count toward a small per-IP limit on anonymous scans. A default scan (AI on) counts once, when its AI session starts, and its auto-upload does not count again. A scan with `--no-ai-inference`, or a separate `dataparade upload`, counts once when it uploads. When the limit is reached, the scan still writes `.dataparade/`; set `DATAPARADE_WORKSPACE_API_KEY` and run `dataparade upload .dataparade/dataflow.json`.
|
|
56
|
+
- If the upload fails, the scan output stays on disk and the CLI prints the `dataparade upload` command to retry.
|
|
54
57
|
|
|
55
58
|
```bash
|
|
56
59
|
npx @dataparade/cli upload .dataparade/dataflow.json --project-name "My service"
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dataparade/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.29",
|
|
4
4
|
"description": "dataPARADE CLI — scan codebases for privacy and security data flows",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"zod": "^4.3.5"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@dataparade/scanner": "github:DataParade-io/scanner#
|
|
69
|
+
"@dataparade/scanner": "github:DataParade-io/scanner#6a5a95897fe9ccd60230b0636f3a91b2e21a1ab1",
|
|
70
70
|
"@eslint/js": "^9.18.0",
|
|
71
71
|
"@types/jest": "^30.0.0",
|
|
72
72
|
"@types/node": "^22.0.0",
|
package/dist/src/cli.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import './config/load-cli-env';
|
|
2
|
+
import { type ScanUploadFailure } from './ui/scan-progress-renderer';
|
|
3
|
+
/** Retry command and advice shown when the scan's auto-upload fails. */
|
|
4
|
+
export declare function describeAutoUploadFailure(uploadError: unknown, dataflowOutputPath: string, hasWorkspaceApiKey: boolean): ScanUploadFailure;
|
|
2
5
|
export declare function run(argv?: string[]): Promise<void>;
|
package/dist/src/cli.js
CHANGED
|
@@ -36,6 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.describeAutoUploadFailure = describeAutoUploadFailure;
|
|
39
40
|
exports.run = run;
|
|
40
41
|
require("./config/load-cli-env");
|
|
41
42
|
const path_1 = __importDefault(require("path"));
|
|
@@ -124,6 +125,24 @@ function formatAiInferenceVerbose(details) {
|
|
|
124
125
|
}
|
|
125
126
|
return lines;
|
|
126
127
|
}
|
|
128
|
+
/** Retry command and advice shown when the scan's auto-upload fails. */
|
|
129
|
+
function describeAutoUploadFailure(uploadError, dataflowOutputPath, hasWorkspaceApiKey) {
|
|
130
|
+
const relative = path_1.default.relative(process.cwd(), dataflowOutputPath);
|
|
131
|
+
const target = relative && !relative.startsWith('..') ? relative : dataflowOutputPath;
|
|
132
|
+
const quoted = /\s/.test(target) ? `"${target}"` : target;
|
|
133
|
+
const status = uploadError && typeof uploadError === 'object' && 'status' in uploadError
|
|
134
|
+
? uploadError.status
|
|
135
|
+
: undefined;
|
|
136
|
+
const message = uploadError instanceof Error ? uploadError.message : '';
|
|
137
|
+
const rateLimited = status === 429 || /too many anonymous cli scans/i.test(message);
|
|
138
|
+
return {
|
|
139
|
+
reason: (0, fetch_failure_1.describeUnavailableReason)(uploadError),
|
|
140
|
+
retryCommand: `dataparade upload ${quoted}`,
|
|
141
|
+
hint: rateLimited && !hasWorkspaceApiKey
|
|
142
|
+
? 'Anonymous uploads are limited per IP address. To avoid the limit, set DATAPARADE_WORKSPACE_API_KEY (from Workspace → Access keys in DataParade) and run the upload again.'
|
|
143
|
+
: undefined,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
127
146
|
function formatUsd(value) {
|
|
128
147
|
if (typeof value !== 'number' || !Number.isFinite(value))
|
|
129
148
|
return 'n/a';
|
|
@@ -321,6 +340,16 @@ function createProgram() {
|
|
|
321
340
|
sentryScanRoot = scanEntry.scanRootDir;
|
|
322
341
|
sentryAiMode = aiMode;
|
|
323
342
|
sentryAiProvider = config.aiProvider;
|
|
343
|
+
// AI enrichment is optional. When its platform setup fails (no
|
|
344
|
+
// network, anonymous per-IP cap, server error), say so once and
|
|
345
|
+
// run the structural scan so the local output is still written.
|
|
346
|
+
const continueWithoutAi = (setupError) => {
|
|
347
|
+
config.enableAiInference = false;
|
|
348
|
+
config.cliQuotaJobId = undefined;
|
|
349
|
+
config.anonSessionToken = undefined;
|
|
350
|
+
sentryAiMode = 'none';
|
|
351
|
+
progressUi.warn(`AI enrichment unavailable (${(0, fetch_failure_1.describeUnavailableReason)(setupError)}); continuing with a structural scan. Use --no-ai-inference to skip this step.`);
|
|
352
|
+
};
|
|
324
353
|
// Quota preflight for platform billing. Structural-only scans (AI off) do not use quota API.
|
|
325
354
|
if (workspaceApiKey && !usesByok && config.enableAiInference) {
|
|
326
355
|
const [{ cliScanPreflight }, { estimateScanFootprint }] = await Promise.all([
|
|
@@ -334,27 +363,38 @@ function createProgram() {
|
|
|
334
363
|
projectName: config.projectName,
|
|
335
364
|
fileCount: footprint.fileCount,
|
|
336
365
|
bytesIngested: footprint.bytesIngested,
|
|
366
|
+
}).catch(async (preflightError) => {
|
|
367
|
+
const { CliScanQuotaExceededError, CliScanAlreadyRunningError } = await Promise.resolve().then(() => __importStar(require('./platform-api/scan-quota-client')));
|
|
368
|
+
// Workspace quota and concurrency answers stay blocking.
|
|
369
|
+
if (preflightError instanceof CliScanQuotaExceededError ||
|
|
370
|
+
preflightError instanceof CliScanAlreadyRunningError) {
|
|
371
|
+
throw preflightError;
|
|
372
|
+
}
|
|
373
|
+
continueWithoutAi(preflightError);
|
|
374
|
+
return undefined;
|
|
337
375
|
});
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
if (preflight.aiDelivery === 'platform_proxy') {
|
|
349
|
-
config.aiMode = 'platform';
|
|
350
|
-
}
|
|
351
|
-
if (isInteractive) {
|
|
352
|
-
const quotaLine = `[scan] quota: scans_remaining=${preflight.scansRemaining} ai_tokens_remaining=${preflight.aiTokensRemaining} job_id=${preflight.jobId} working_budget=${config.aiBudgetTokens ?? 0}`;
|
|
353
|
-
if (friendlyTty) {
|
|
354
|
-
technicalLines.push(quotaLine);
|
|
376
|
+
if (preflight) {
|
|
377
|
+
cliQuotaJobId = preflight.jobId;
|
|
378
|
+
platformQuotaApiKey = workspaceApiKey;
|
|
379
|
+
config.cliQuotaJobId = preflight.jobId;
|
|
380
|
+
if (config.enableAiInference &&
|
|
381
|
+
preflight.suggestedAiBudgetTokens > 0) {
|
|
382
|
+
// suggestedAiBudgetTokens is a server ceiling (remaining quota /
|
|
383
|
+
// per-job cap), not a spend target. Never raise the CLI working
|
|
384
|
+
// budget above the configured default (or user override).
|
|
385
|
+
config.aiBudgetTokens = Math.min(config.aiBudgetTokens ?? 12_000, preflight.suggestedAiBudgetTokens);
|
|
355
386
|
}
|
|
356
|
-
|
|
357
|
-
|
|
387
|
+
if (preflight.aiDelivery === 'platform_proxy') {
|
|
388
|
+
config.aiMode = 'platform';
|
|
389
|
+
}
|
|
390
|
+
if (isInteractive) {
|
|
391
|
+
const quotaLine = `[scan] quota: scans_remaining=${preflight.scansRemaining} ai_tokens_remaining=${preflight.aiTokensRemaining} job_id=${preflight.jobId} working_budget=${config.aiBudgetTokens ?? 0}`;
|
|
392
|
+
if (friendlyTty) {
|
|
393
|
+
technicalLines.push(quotaLine);
|
|
394
|
+
}
|
|
395
|
+
else {
|
|
396
|
+
console.log(quotaLine);
|
|
397
|
+
}
|
|
358
398
|
}
|
|
359
399
|
}
|
|
360
400
|
}
|
|
@@ -389,18 +429,9 @@ function createProgram() {
|
|
|
389
429
|
}
|
|
390
430
|
}
|
|
391
431
|
catch (anonSessionError) {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
: 'Anonymous AI session failed.';
|
|
396
|
-
reportedFailure = {
|
|
397
|
-
code: 'anonymous_ai_session_failed',
|
|
398
|
-
message: (0, cli_scan_failure_report_1.truncateFailureMessage)(message),
|
|
399
|
-
};
|
|
400
|
-
console.error(`[scan] ${message}`);
|
|
401
|
-
process.exitCode =
|
|
402
|
-
anonSessionError instanceof CliAnonymousIpLimitError ? 2 : 1;
|
|
403
|
-
return;
|
|
432
|
+
// AI is optional: keep scanning without it so the user still
|
|
433
|
+
// gets the local .dataparade/ output.
|
|
434
|
+
continueWithoutAi(anonSessionError);
|
|
404
435
|
}
|
|
405
436
|
}
|
|
406
437
|
const configValidation = (0, scan_config_schema_1.validateScanConfiguration)(config);
|
|
@@ -606,6 +637,9 @@ function createProgram() {
|
|
|
606
637
|
else {
|
|
607
638
|
console.error(`[scan] Auto-upload failed: ${uploadMessage}`);
|
|
608
639
|
}
|
|
640
|
+
// The scan itself succeeded (exit 0), but do not close with
|
|
641
|
+
// the success line: say the upload failed and how to retry.
|
|
642
|
+
progressUi.onUploadFailed(describeAutoUploadFailure(uploadError, dataflowOutputPath, Boolean(workspaceApiKey)));
|
|
609
643
|
}
|
|
610
644
|
}
|
|
611
645
|
progressUi.finish();
|
|
@@ -9,3 +9,8 @@ export declare function toApiReachabilityError(err: unknown, url: string, method
|
|
|
9
9
|
* already attach the request target.
|
|
10
10
|
*/
|
|
11
11
|
export declare function describeThrownError(err: unknown): string;
|
|
12
|
+
/**
|
|
13
|
+
* Short reason for an optional platform step (AI session, upload) that failed,
|
|
14
|
+
* for a one-line "… unavailable (<reason>)" message.
|
|
15
|
+
*/
|
|
16
|
+
export declare function describeUnavailableReason(err: unknown): string;
|
|
@@ -5,6 +5,7 @@ exports.fetchFailureDetail = fetchFailureDetail;
|
|
|
5
5
|
exports.describeRequestTarget = describeRequestTarget;
|
|
6
6
|
exports.toApiReachabilityError = toApiReachabilityError;
|
|
7
7
|
exports.describeThrownError = describeThrownError;
|
|
8
|
+
exports.describeUnavailableReason = describeUnavailableReason;
|
|
8
9
|
const TRANSIENT_CAUSE_CODES = new Set([
|
|
9
10
|
'ECONNRESET',
|
|
10
11
|
'ECONNREFUSED',
|
|
@@ -83,3 +84,15 @@ function describeThrownError(err) {
|
|
|
83
84
|
}
|
|
84
85
|
return `Could not reach the DataParade API: ${detail}. Run the scan again.`;
|
|
85
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Short reason for an optional platform step (AI session, upload) that failed,
|
|
89
|
+
* for a one-line "… unavailable (<reason>)" message.
|
|
90
|
+
*/
|
|
91
|
+
function describeUnavailableReason(err) {
|
|
92
|
+
if (!(err instanceof Error))
|
|
93
|
+
return 'unknown error';
|
|
94
|
+
if (isTransientFetchError(err)) {
|
|
95
|
+
return `could not reach the DataParade API: ${fetchFailureDetail(err)}`;
|
|
96
|
+
}
|
|
97
|
+
return err.message.trim().replace(/\.$/, '') || 'unknown error';
|
|
98
|
+
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { ScanUploadFile } from '../upload/collect-scan-sidecars';
|
|
2
2
|
import type { CliAnonymousUploadPreviewResponse, CliUploadPreviewInput, CliUploadPreviewResponse } from './upload.types';
|
|
3
3
|
export type { CliAnonymousUploadPreviewResponse, CliUploadPreviewInput, CliUploadPreviewResponse, } from './upload.types';
|
|
4
|
+
/** Upload rejected by the API; `status` is the HTTP status (429 = rate limit). */
|
|
5
|
+
export declare class CliUploadError extends Error {
|
|
6
|
+
readonly status: number;
|
|
7
|
+
constructor(message: string, status: number);
|
|
8
|
+
}
|
|
4
9
|
export declare function cliUploadAnonymousPreview(input: {
|
|
5
10
|
dataflow: unknown;
|
|
6
11
|
projectName?: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CliUploadError = void 0;
|
|
3
4
|
exports.cliUploadAnonymousPreview = cliUploadAnonymousPreview;
|
|
4
5
|
exports.cliUploadPreview = cliUploadPreview;
|
|
5
6
|
const pack_scan_upload_1 = require("../upload/pack-scan-upload");
|
|
@@ -10,6 +11,15 @@ function buildAuthHeaders(apiKey) {
|
|
|
10
11
|
'Content-Type': 'application/json',
|
|
11
12
|
};
|
|
12
13
|
}
|
|
14
|
+
/** Upload rejected by the API; `status` is the HTTP status (429 = rate limit). */
|
|
15
|
+
class CliUploadError extends Error {
|
|
16
|
+
constructor(message, status) {
|
|
17
|
+
super(message);
|
|
18
|
+
this.status = status;
|
|
19
|
+
this.name = 'CliUploadError';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.CliUploadError = CliUploadError;
|
|
13
23
|
async function parseUploadError(res) {
|
|
14
24
|
let message = `Upload failed (${res.status})`;
|
|
15
25
|
try {
|
|
@@ -24,7 +34,7 @@ async function parseUploadError(res) {
|
|
|
24
34
|
catch {
|
|
25
35
|
// ignore
|
|
26
36
|
}
|
|
27
|
-
throw new
|
|
37
|
+
throw new CliUploadError(message, res.status);
|
|
28
38
|
}
|
|
29
39
|
async function cliUploadAnonymousPreview(input) {
|
|
30
40
|
const res = await fetch(`${(0, dataparade_api_base_url_1.getDataparadeApiBaseUrl)()}/api/scans/cli/preview`, {
|
|
@@ -12,6 +12,14 @@ export declare function formatAiStepResult(result: ScanAiStepResult): string;
|
|
|
12
12
|
export declare function formatOutputPath(outputPath: string): string;
|
|
13
13
|
/** Prefer a short, human path in the header (home → ~). */
|
|
14
14
|
export declare function formatProjectLabel(projectPath: string): string;
|
|
15
|
+
export type ScanUploadFailure = {
|
|
16
|
+
/** Why the upload failed, without a trailing period. */
|
|
17
|
+
reason: string;
|
|
18
|
+
/** Exact command to retry the upload. */
|
|
19
|
+
retryCommand: string;
|
|
20
|
+
/** Optional extra advice, e.g. how to avoid the anonymous per-IP cap. */
|
|
21
|
+
hint?: string;
|
|
22
|
+
};
|
|
15
23
|
/**
|
|
16
24
|
* Staged scan progress for TTY (Clack) and plain logs for non-TTY / NO_COLOR.
|
|
17
25
|
*/
|
|
@@ -34,6 +42,7 @@ export declare class ScanProgressRenderer {
|
|
|
34
42
|
private teachingSummaryLines;
|
|
35
43
|
private previewUrl;
|
|
36
44
|
private previewNotice;
|
|
45
|
+
private uploadFailure;
|
|
37
46
|
constructor(options: ScanProgressRendererOptions, clack: ClackPrompts | null);
|
|
38
47
|
/** Test helper: true when Clack chrome is active. */
|
|
39
48
|
get usesClackChrome(): boolean;
|
|
@@ -45,6 +54,11 @@ export declare class ScanProgressRenderer {
|
|
|
45
54
|
onWroteDataflow(outputPath?: string): void;
|
|
46
55
|
/** Store preview URL for the "What to do next" note. Machine line stays in upload. */
|
|
47
56
|
onPreviewUrl(previewUrl: string, notice?: string): void;
|
|
57
|
+
/**
|
|
58
|
+
* Auto-upload failed after the local output was written. finish() then
|
|
59
|
+
* says so and prints the retry command instead of the success closing.
|
|
60
|
+
*/
|
|
61
|
+
onUploadFailed(failure: ScanUploadFailure): void;
|
|
48
62
|
/** One plain informational line, e.g. how many files the scan walks. */
|
|
49
63
|
info(message: string): void;
|
|
50
64
|
/**
|
|
@@ -228,6 +228,13 @@ class ScanProgressRenderer {
|
|
|
228
228
|
this.previewUrl = previewUrl;
|
|
229
229
|
this.previewNotice = notice;
|
|
230
230
|
}
|
|
231
|
+
/**
|
|
232
|
+
* Auto-upload failed after the local output was written. finish() then
|
|
233
|
+
* says so and prints the retry command instead of the success closing.
|
|
234
|
+
*/
|
|
235
|
+
onUploadFailed(failure) {
|
|
236
|
+
this.uploadFailure = failure;
|
|
237
|
+
}
|
|
231
238
|
/** One plain informational line, e.g. how many files the scan walks. */
|
|
232
239
|
info(message) {
|
|
233
240
|
this.start();
|
|
@@ -273,7 +280,16 @@ class ScanProgressRenderer {
|
|
|
273
280
|
finish() {
|
|
274
281
|
this.completeActiveStep();
|
|
275
282
|
const nextSteps = [];
|
|
276
|
-
|
|
283
|
+
let closing = 'All done — nice work.';
|
|
284
|
+
if (this.uploadFailure) {
|
|
285
|
+
const { reason, retryCommand, hint } = this.uploadFailure;
|
|
286
|
+
nextSteps.push(`The upload did not complete: ${reason}.`);
|
|
287
|
+
nextSteps.push(`Your scan is saved locally. To upload it, run:\n ${retryCommand}`);
|
|
288
|
+
if (hint)
|
|
289
|
+
nextSteps.push(hint);
|
|
290
|
+
closing = 'Scan finished. The upload did not complete.';
|
|
291
|
+
}
|
|
292
|
+
else if (this.previewUrl) {
|
|
277
293
|
nextSteps.push(`Open your diagram:\n${formatPreviewLink(this.previewUrl, this.colorEnabled)}`);
|
|
278
294
|
// Plain mode already got the notice from the upload's own log line.
|
|
279
295
|
if (this.useClack && this.previewNotice) {
|
|
@@ -288,7 +304,7 @@ class ScanProgressRenderer {
|
|
|
288
304
|
// preview URLs and breaks click-to-open.
|
|
289
305
|
this.prompts().log.step('What to do next');
|
|
290
306
|
this.prompts().log.message(nextSteps.join('\n\n'));
|
|
291
|
-
this.prompts().outro(
|
|
307
|
+
this.prompts().outro(closing);
|
|
292
308
|
}
|
|
293
309
|
else {
|
|
294
310
|
this.writePlain('What to do next');
|
|
@@ -301,7 +317,7 @@ class ScanProgressRenderer {
|
|
|
301
317
|
this.writePlain(` ${line}`);
|
|
302
318
|
}
|
|
303
319
|
}
|
|
304
|
-
this.writePlain(
|
|
320
|
+
this.writePlain(closing);
|
|
305
321
|
}
|
|
306
322
|
}
|
|
307
323
|
transitionTo(step) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const fs_1 = __importDefault(require("fs"));
|
|
7
|
+
const os_1 = __importDefault(require("os"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const cli_1 = require("../../../src/cli");
|
|
10
|
+
function jsonResponse(body, status = 200) {
|
|
11
|
+
return {
|
|
12
|
+
ok: status >= 200 && status < 300,
|
|
13
|
+
status,
|
|
14
|
+
statusText: status === 200 ? 'OK' : 'Error',
|
|
15
|
+
json: async () => body,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const IP_CAP_MESSAGE = 'Too many anonymous CLI scans from this IP (max 3). Create an account or use a workspace API key.';
|
|
19
|
+
describe('scan keeps going when AI enrichment or upload is unavailable', () => {
|
|
20
|
+
let tempRoot;
|
|
21
|
+
let projectDir;
|
|
22
|
+
let outputPath;
|
|
23
|
+
let fetchMock;
|
|
24
|
+
let logSpy;
|
|
25
|
+
let warnSpy;
|
|
26
|
+
let errorSpy;
|
|
27
|
+
const printed = () => [logSpy, warnSpy, errorSpy]
|
|
28
|
+
.flatMap((spy) => spy.mock.calls.map((call) => call.join(' ')))
|
|
29
|
+
.join('\n');
|
|
30
|
+
beforeEach(() => {
|
|
31
|
+
tempRoot = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), 'dp-scan-fallback-'));
|
|
32
|
+
projectDir = path_1.default.join(tempRoot, 'project');
|
|
33
|
+
fs_1.default.mkdirSync(projectDir);
|
|
34
|
+
fs_1.default.writeFileSync(path_1.default.join(projectDir, 'index.ts'), "export const handler = () => fetch('https://api.stripe.com/v1/charges');\n");
|
|
35
|
+
outputPath = path_1.default.join(tempRoot, 'out', 'dataflow.json');
|
|
36
|
+
fetchMock = jest.fn();
|
|
37
|
+
global.fetch = fetchMock;
|
|
38
|
+
logSpy = jest.spyOn(console, 'log').mockImplementation(() => { });
|
|
39
|
+
warnSpy = jest.spyOn(console, 'warn').mockImplementation(() => { });
|
|
40
|
+
errorSpy = jest.spyOn(console, 'error').mockImplementation(() => { });
|
|
41
|
+
delete process.env.DATAPARADE_WORKSPACE_API_KEY;
|
|
42
|
+
delete process.env.SCAN_HOSTED_INFER_PROXY_URL;
|
|
43
|
+
process.exitCode = 0;
|
|
44
|
+
});
|
|
45
|
+
afterEach(() => {
|
|
46
|
+
logSpy.mockRestore();
|
|
47
|
+
warnSpy.mockRestore();
|
|
48
|
+
errorSpy.mockRestore();
|
|
49
|
+
fs_1.default.rmSync(tempRoot, { recursive: true, force: true });
|
|
50
|
+
delete process.env.DATAPARADE_SKIP_AUTO_UPLOAD;
|
|
51
|
+
process.exitCode = 0;
|
|
52
|
+
});
|
|
53
|
+
it('runs a structural scan when the anonymous AI session cannot reach the API', async () => {
|
|
54
|
+
process.env.DATAPARADE_SKIP_AUTO_UPLOAD = 'true';
|
|
55
|
+
fetchMock.mockRejectedValue(Object.assign(new TypeError('fetch failed'), {
|
|
56
|
+
cause: { code: 'ECONNREFUSED', message: 'connect ECONNREFUSED' },
|
|
57
|
+
}));
|
|
58
|
+
await (0, cli_1.run)([
|
|
59
|
+
'node',
|
|
60
|
+
'cli',
|
|
61
|
+
'scan',
|
|
62
|
+
projectDir,
|
|
63
|
+
'--ai-inference',
|
|
64
|
+
'--output',
|
|
65
|
+
outputPath,
|
|
66
|
+
]);
|
|
67
|
+
expect(String(fetchMock.mock.calls[0][0])).toContain('/api/scans/cli/ai/anonymous-session');
|
|
68
|
+
expect(process.exitCode ?? 0).toBe(0);
|
|
69
|
+
expect(fs_1.default.existsSync(outputPath)).toBe(true);
|
|
70
|
+
expect(fs_1.default.existsSync(path_1.default.join(tempRoot, 'out', 'facts.json'))).toBe(true);
|
|
71
|
+
const output = printed();
|
|
72
|
+
expect(output).toContain('AI enrichment unavailable (could not reach the DataParade API: ECONNREFUSED: connect ECONNREFUSED); continuing with a structural scan. Use --no-ai-inference to skip this step.');
|
|
73
|
+
expect(output).not.toContain('Scan failed');
|
|
74
|
+
});
|
|
75
|
+
it('runs a structural scan when the anonymous per-IP cap is reached', async () => {
|
|
76
|
+
process.env.DATAPARADE_SKIP_AUTO_UPLOAD = 'true';
|
|
77
|
+
fetchMock.mockResolvedValue(jsonResponse({ statusCode: 429, message: IP_CAP_MESSAGE }, 429));
|
|
78
|
+
await (0, cli_1.run)([
|
|
79
|
+
'node',
|
|
80
|
+
'cli',
|
|
81
|
+
'scan',
|
|
82
|
+
projectDir,
|
|
83
|
+
'--ai-inference',
|
|
84
|
+
'--output',
|
|
85
|
+
outputPath,
|
|
86
|
+
]);
|
|
87
|
+
expect(fetchMock).toHaveBeenCalledTimes(1);
|
|
88
|
+
expect(process.exitCode ?? 0).toBe(0);
|
|
89
|
+
expect(fs_1.default.existsSync(outputPath)).toBe(true);
|
|
90
|
+
expect(printed()).toContain(`AI enrichment unavailable (${IP_CAP_MESSAGE.replace(/\.$/, '')}); continuing with a structural scan.`);
|
|
91
|
+
});
|
|
92
|
+
it('runs a structural scan when the workspace preflight cannot reach the API', async () => {
|
|
93
|
+
process.env.DATAPARADE_WORKSPACE_API_KEY = 'dp_live_test';
|
|
94
|
+
process.env.DATAPARADE_SKIP_AUTO_UPLOAD = 'true';
|
|
95
|
+
fetchMock.mockRejectedValue(new TypeError('fetch failed'));
|
|
96
|
+
await (0, cli_1.run)([
|
|
97
|
+
'node',
|
|
98
|
+
'cli',
|
|
99
|
+
'scan',
|
|
100
|
+
projectDir,
|
|
101
|
+
'--ai-inference',
|
|
102
|
+
'--output',
|
|
103
|
+
outputPath,
|
|
104
|
+
]);
|
|
105
|
+
expect(String(fetchMock.mock.calls[0][0])).toContain('/api/scans/cli/preflight');
|
|
106
|
+
expect(process.exitCode ?? 0).toBe(0);
|
|
107
|
+
expect(fs_1.default.existsSync(outputPath)).toBe(true);
|
|
108
|
+
expect(printed()).toContain('AI enrichment unavailable (');
|
|
109
|
+
});
|
|
110
|
+
it('says the upload did not complete and how to retry when it is refused', async () => {
|
|
111
|
+
fetchMock.mockImplementation(async (url) => {
|
|
112
|
+
if (String(url).includes('/api/scans/cli/preview')) {
|
|
113
|
+
return jsonResponse({ statusCode: 429, message: IP_CAP_MESSAGE }, 429);
|
|
114
|
+
}
|
|
115
|
+
throw new Error(`unexpected fetch ${String(url)}`);
|
|
116
|
+
});
|
|
117
|
+
await (0, cli_1.run)([
|
|
118
|
+
'node',
|
|
119
|
+
'cli',
|
|
120
|
+
'scan',
|
|
121
|
+
projectDir,
|
|
122
|
+
'--no-ai-inference',
|
|
123
|
+
'--output',
|
|
124
|
+
outputPath,
|
|
125
|
+
]);
|
|
126
|
+
expect(process.exitCode ?? 0).toBe(0);
|
|
127
|
+
expect(fs_1.default.existsSync(outputPath)).toBe(true);
|
|
128
|
+
const output = printed();
|
|
129
|
+
expect(output).toContain(`[scan] Auto-upload failed: ${IP_CAP_MESSAGE}`);
|
|
130
|
+
expect(output).toContain('The upload did not complete:');
|
|
131
|
+
const relative = path_1.default.relative(process.cwd(), outputPath);
|
|
132
|
+
const expectedTarget = relative.startsWith('..') ? outputPath : relative;
|
|
133
|
+
expect(output).toContain(`dataparade upload ${expectedTarget}`);
|
|
134
|
+
expect(output).toContain('DATAPARADE_WORKSPACE_API_KEY');
|
|
135
|
+
expect(output).toContain('Scan finished. The upload did not complete.');
|
|
136
|
+
expect(output).not.toContain('All done — nice work.');
|
|
137
|
+
});
|
|
138
|
+
it('gives the retry command without the API key hint on a network failure', async () => {
|
|
139
|
+
fetchMock.mockRejectedValue(new TypeError('fetch failed'));
|
|
140
|
+
await (0, cli_1.run)([
|
|
141
|
+
'node',
|
|
142
|
+
'cli',
|
|
143
|
+
'scan',
|
|
144
|
+
projectDir,
|
|
145
|
+
'--no-ai-inference',
|
|
146
|
+
'--output',
|
|
147
|
+
outputPath,
|
|
148
|
+
]);
|
|
149
|
+
expect(process.exitCode ?? 0).toBe(0);
|
|
150
|
+
const output = printed();
|
|
151
|
+
expect(output).toContain('The upload did not complete: could not reach the DataParade API');
|
|
152
|
+
expect(output).toContain('dataparade upload ');
|
|
153
|
+
expect(output).not.toContain('DATAPARADE_WORKSPACE_API_KEY');
|
|
154
|
+
expect(output).not.toContain('All done — nice work.');
|
|
155
|
+
});
|
|
156
|
+
});
|
|
@@ -129,6 +129,27 @@ describe('ScanProgressRenderer', () => {
|
|
|
129
129
|
expect(joined).not.toContain('Your preview is ready whenever you are');
|
|
130
130
|
expect(ui.usesClackChrome).toBe(false);
|
|
131
131
|
});
|
|
132
|
+
it('plain finish reports a failed upload instead of the success line', async () => {
|
|
133
|
+
const { lines, writeLine } = captureLines();
|
|
134
|
+
const ui = await (0, scan_progress_renderer_1.createScanProgressRenderer)({
|
|
135
|
+
isTTY: false,
|
|
136
|
+
noColor: true,
|
|
137
|
+
writeLine,
|
|
138
|
+
});
|
|
139
|
+
ui.onUploadFailed({
|
|
140
|
+
reason: 'Too many anonymous CLI scans from this IP (max 3)',
|
|
141
|
+
retryCommand: 'dataparade upload .dataparade/dataflow.json',
|
|
142
|
+
hint: 'Set DATAPARADE_WORKSPACE_API_KEY.',
|
|
143
|
+
});
|
|
144
|
+
ui.finish();
|
|
145
|
+
const joined = lines.join('\n');
|
|
146
|
+
expect(joined).toContain('The upload did not complete: Too many anonymous CLI scans from this IP (max 3).');
|
|
147
|
+
expect(joined).toContain('dataparade upload .dataparade/dataflow.json');
|
|
148
|
+
expect(joined).toContain('Set DATAPARADE_WORKSPACE_API_KEY.');
|
|
149
|
+
expect(joined).toContain('Scan finished. The upload did not complete.');
|
|
150
|
+
expect(joined).not.toContain('All done — nice work.');
|
|
151
|
+
expect(joined).not.toContain('Jump into DataParade');
|
|
152
|
+
});
|
|
132
153
|
it('formats the preview link with ANSI when color is on', () => {
|
|
133
154
|
const plain = (0, scan_progress_renderer_1.formatPreviewLink)('https://example.test/preview', false);
|
|
134
155
|
expect(plain).toBe('https://example.test/preview');
|
|
@@ -102,5 +102,29 @@ export { piiSignalIdentity, rawHitIdentity, occurrenceIdentity, dataItemIdentity
|
|
|
102
102
|
* field declaration a few lines below; span evidence through the annotation block.
|
|
103
103
|
*/
|
|
104
104
|
export declare function javaAnnotationBlockStartLine(lines: readonly string[], fieldLineIndex: number): number;
|
|
105
|
+
/**
|
|
106
|
+
* A module path or URL path (`'../../services/email-service'`) or a prose message
|
|
107
|
+
* (`'Email not found.'`): it names a file or tells a person something, not a value.
|
|
108
|
+
* SQL, other strings and messages that interpolate a value (`"Logout failed for
|
|
109
|
+
* #{channel.email}."`) keep matching.
|
|
110
|
+
*
|
|
111
|
+
* A prose message starts with a capital, holds at least two whitespace characters and
|
|
112
|
+
* ends in `.`, `!` or `?`. The first two runs exclude whitespace, so the two `\s` are
|
|
113
|
+
* always the first two whitespace characters and each run has one way to match. Runs
|
|
114
|
+
* that also matched whitespace backtracked O(n^3) on a long capitalised string that is
|
|
115
|
+
* not prose (an inline SVG path `d="M1.5 2.5 ..."`). Matches on a single line are the
|
|
116
|
+
* same as before.
|
|
117
|
+
*/
|
|
118
|
+
export declare const PATH_OR_PROSE_STRING: RegExp;
|
|
119
|
+
/**
|
|
120
|
+
* A whole import statement (`const mail = require('../mail');`, `import { isEmail } from
|
|
121
|
+
* 'validator';`, `from email.mime.text import MIMEText`, `require 'mail'`): its names are
|
|
122
|
+
* modules and bindings, not values.
|
|
123
|
+
*
|
|
124
|
+
* Whitespace runs never sit next to another run that also takes whitespace (`\s[^=]+`,
|
|
125
|
+
* `(?:\s*;)?`, `import\s(?:...)`): `from a import` followed by a long run of spaces
|
|
126
|
+
* backtracked O(n^3). Same matches as before.
|
|
127
|
+
*/
|
|
128
|
+
export declare const IMPORT_LINE: RegExp;
|
|
105
129
|
export declare function matchPiiSignalsInFile(input: MatchPiiSignalsFileInput, rules?: PiiSignalRule[]): PiiSignalHit[];
|
|
106
130
|
export declare function matchPiiSignalsInFiles(files: MatchPiiSignalsFileInput[], rules?: PiiSignalRule[]): PiiSignalHit[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dataItemIdentity = exports.occurrenceIdentity = exports.rawHitIdentity = exports.piiSignalIdentity = void 0;
|
|
3
|
+
exports.IMPORT_LINE = exports.PATH_OR_PROSE_STRING = exports.dataItemIdentity = exports.occurrenceIdentity = exports.rawHitIdentity = exports.piiSignalIdentity = void 0;
|
|
4
4
|
exports.javaAnnotationBlockStartLine = javaAnnotationBlockStartLine;
|
|
5
5
|
exports.matchPiiSignalsInFile = matchPiiSignalsInFile;
|
|
6
6
|
exports.matchPiiSignalsInFiles = matchPiiSignalsInFiles;
|
|
@@ -15,7 +15,9 @@ function ruleById(rules) {
|
|
|
15
15
|
return new Map(rules.map((rule) => [rule.id, rule]));
|
|
16
16
|
}
|
|
17
17
|
function isJavaFieldDeclarationLine(line) {
|
|
18
|
-
|
|
18
|
+
// Single `\s` around the type: the type class takes whitespace too, and `\s+` there
|
|
19
|
+
// backtracked O(n^3) on `private` followed by a long run of spaces. Same matches.
|
|
20
|
+
return /\b(?:private|protected)\s[\w<>,\s\[\]]+\s\w+\s*;/.test(line);
|
|
19
21
|
}
|
|
20
22
|
/**
|
|
21
23
|
* Gold often anchors on the leading @Column line while token matching fires on the
|
|
@@ -98,8 +100,15 @@ const TRANSLATION_KEY = /(\b(?:I18n\.t|i18n\.t|translate|t|__|\$t)\(\s*)(['"`])[
|
|
|
98
100
|
* (`'Email not found.'`): it names a file or tells a person something, not a value.
|
|
99
101
|
* SQL, other strings and messages that interpolate a value (`"Logout failed for
|
|
100
102
|
* #{channel.email}."`) keep matching.
|
|
103
|
+
*
|
|
104
|
+
* A prose message starts with a capital, holds at least two whitespace characters and
|
|
105
|
+
* ends in `.`, `!` or `?`. The first two runs exclude whitespace, so the two `\s` are
|
|
106
|
+
* always the first two whitespace characters and each run has one way to match. Runs
|
|
107
|
+
* that also matched whitespace backtracked O(n^3) on a long capitalised string that is
|
|
108
|
+
* not prose (an inline SVG path `d="M1.5 2.5 ..."`). Matches on a single line are the
|
|
109
|
+
* same as before.
|
|
101
110
|
*/
|
|
102
|
-
|
|
111
|
+
exports.PATH_OR_PROSE_STRING = /(['"`])(?:[\w.@-]*\/[\w./@-]*|[A-Z](?:(?![$#]\{)[^'"`\s])*\s(?:(?![$#]\{)[^'"`\s])*\s(?:(?![$#]\{)[^'"`\n])*[.!?])\1/g;
|
|
103
112
|
/**
|
|
104
113
|
* A capitalized Email or Mail class reference (`Channel::Email`, `models.Email.findOne`,
|
|
105
114
|
* `Email::Cleaner`): a model or module, not an address. Lowercase members (`user.email`)
|
|
@@ -111,8 +120,12 @@ const EMAIL_NAMESPACE = /\b(?:Email|Mail)(?=::)/g;
|
|
|
111
120
|
* A whole import statement (`const mail = require('../mail');`, `import { isEmail } from
|
|
112
121
|
* 'validator';`, `from email.mime.text import MIMEText`, `require 'mail'`): its names are
|
|
113
122
|
* modules and bindings, not values.
|
|
123
|
+
*
|
|
124
|
+
* Whitespace runs never sit next to another run that also takes whitespace (`\s[^=]+`,
|
|
125
|
+
* `(?:\s*;)?`, `import\s(?:...)`): `from a import` followed by a long run of spaces
|
|
126
|
+
* backtracked O(n^3). Same matches as before.
|
|
114
127
|
*/
|
|
115
|
-
|
|
128
|
+
exports.IMPORT_LINE = /^\s*(?:(?:const|let|var)\s[^=]+=\s*require\(\s*(['"`])[^'"`]*\1\s*\)(?:\(\s*(['"`])[^'"`]*\2\s*\))?(?:\.\w+)*(?:\s*;)?|import\b[^'"`]*\bfrom\s*(['"`])[^'"`]*\3(?:\s*;)?|import\s*(['"`])[^'"`]*\4(?:\s*;)?|from\s+[\w.]+\s+import\s(?:[\w\s,()*]*[\w,()*]|\s)|import\s+[\w.]+(?:\s+as\s+\w+)?|require(?:_relative)?\s+(['"])[^'"]*\5)\s*$/;
|
|
116
129
|
const NEVER = /(?!)/g;
|
|
117
130
|
/** A Ruby predicate (`inbox.email?`, `mail?`) asks a yes/no question; it is not an address. */
|
|
118
131
|
const EMAIL_PREDICATE = /(\.|\b)e?mails?\?(?!\?)/g;
|
|
@@ -125,9 +138,9 @@ function matchPiiSignalsInFile(input, rules = (0, pii_signal_rules_1.loadPiiSign
|
|
|
125
138
|
for (let lineIndex = 0; lineIndex < lines.length; lineIndex += 1) {
|
|
126
139
|
// A translation key names a message, not a value: it is blanked before matching.
|
|
127
140
|
const raw = lines[lineIndex] ?? "";
|
|
128
|
-
const line = (IMPORT_LINE.test(raw) ? "" : raw)
|
|
141
|
+
const line = (exports.IMPORT_LINE.test(raw) ? "" : raw)
|
|
129
142
|
.replace(TRANSLATION_KEY, '$1""')
|
|
130
|
-
.replace(PATH_OR_PROSE_STRING, '""')
|
|
143
|
+
.replace(exports.PATH_OR_PROSE_STRING, '""')
|
|
131
144
|
.replace(EMAIL_CLASS_REFERENCE, "$1Klass")
|
|
132
145
|
.replace(EMAIL_NAMESPACE, "Klass")
|
|
133
146
|
.replace(rubyFile ? EMAIL_PREDICATE : NEVER, "$1kind?");
|
|
@@ -89,7 +89,8 @@ function qualify(line, signalId) {
|
|
|
89
89
|
// Also a function defined by assignment: `findOneByEmail = async (email) => ...`,
|
|
90
90
|
// `sendEmail: async (to) => ...`, `x = function (...)`.
|
|
91
91
|
const isFunctionName = (/^\s*(\(|:\s*(async\s+)?function\b)/.test(after) ||
|
|
92
|
-
|
|
92
|
+
// `:[^=]+` matches what `:\s*[^=]+` did (`[^=]` takes whitespace) in linear time.
|
|
93
|
+
/^\s*[:=]\s*(async\s+)?(function\b|\([^)]*\)\s*(:[^=]+)?=>|[A-Za-z_$][\w$]*\s*=>)/.test(after)) &&
|
|
93
94
|
!assignsConcept;
|
|
94
95
|
const words = identifierWords(identifier);
|
|
95
96
|
// A getter named for whose value it returns keeps its qualifier:
|
|
@@ -130,7 +131,9 @@ function qualify(line, signalId) {
|
|
|
130
131
|
// `const verificationEmail = user?.email ?? input.email` -> user. Only true locals;
|
|
131
132
|
// `gift_card.used_by_email = user.email` stores a copy in another entity and keeps
|
|
132
133
|
// its own name.
|
|
133
|
-
|
|
134
|
+
// The type annotation's runs never meet another run that takes the same whitespace
|
|
135
|
+
// (`: ` followed by a long run of spaces backtracked O(n^3)); same matches and groups.
|
|
136
|
+
const localCopy = new RegExp(`^\\s*(?:(?:const|let|var)\\s+)?([A-Za-z_]\\w*)\\s*(?::(?:\\s*[\\w<>\\[\\]|](?:[\\w<>\\[\\]| ]*[\\w<>\\[\\]|])?|[^\\S ]* )\\s*)?=\\s*(?:await\\s+)?(?:[\\w.]+\\s*\\?\\?\\s*)?([A-Za-z_]\\w*)\\s*(?:\\?\\.|\\.|\\[\\s*['"]|\\.get\\(\\s*['"])${conceptWords.map(escapeRegExp).join("_?")}\\b`, "i").exec(line);
|
|
134
137
|
if (localCopy && conceptWords.every((word) => identifierWords(localCopy[1]).includes(word))) {
|
|
135
138
|
const source = /^users?$/i.test(localCopy[2])
|
|
136
139
|
? "user"
|
|
@@ -117,7 +117,9 @@ function isBareAddressFieldDeclaration(line, tokenStartIndex) {
|
|
|
117
117
|
/\b(?:String|CharField|TextField|varchar|text)\s+address\b/i.test(line) ||
|
|
118
118
|
/\baddress\s*=\s*models\./i.test(line) ||
|
|
119
119
|
/\bprivate\s+\w+\s+address\s*;/.test(line) ||
|
|
120
|
-
|
|
120
|
+
// `(?:_\w+)?` matches what `(?:_\w+)*` did (`_` is a word character) without
|
|
121
|
+
// exponential backtracking on `validates_a_a_a...`.
|
|
122
|
+
/\bvalidates(?:_\w+)?\s+:\w*address\b/i.test(line));
|
|
121
123
|
}
|
|
122
124
|
/** Extract identifier tokens from a source line (supports optional `$` prefix). */
|
|
123
125
|
function extractLineIdentifierTokens(line) {
|
|
@@ -230,7 +232,8 @@ function resolveAliasRuleIdsForToken(token, line, tokenStartIndex, filePath) {
|
|
|
230
232
|
// class, never a phone value; ALL_CAPS constants (`ATTENDEE_PHONE_NUMBER_FIELD`) still count.
|
|
231
233
|
if (ruleId === "phone_number" &&
|
|
232
234
|
(NOT_PHONE_LAST_WORD.has(splitCamelCaseParts(token).slice(-1)[0] ?? "") ||
|
|
233
|
-
|
|
235
|
+
// `[A-Z0-9]*` stops at the first lowercase letter: same matches, linear time.
|
|
236
|
+
(/^[A-Z][A-Z0-9]*[a-z][A-Za-z0-9]*$/.test(token) && splitCamelCaseParts(token).length > 1))) {
|
|
234
237
|
continue;
|
|
235
238
|
}
|
|
236
239
|
// A multi-word name that starts with a flag or action word names a flag or a function
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dataparade/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.29",
|
|
4
4
|
"description": "dataPARADE CLI — scan codebases for privacy and security data flows",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"zod": "^4.3.5"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@dataparade/scanner": "github:DataParade-io/scanner#
|
|
69
|
+
"@dataparade/scanner": "github:DataParade-io/scanner#6a5a95897fe9ccd60230b0636f3a91b2e21a1ab1",
|
|
70
70
|
"@eslint/js": "^9.18.0",
|
|
71
71
|
"@types/jest": "^30.0.0",
|
|
72
72
|
"@types/node": "^22.0.0",
|