sfscanner 0.0.0-stage → 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.
- package/LICENSE +21 -0
- package/README.md +131 -3
- package/THIRD_PARTY_NOTICES.md +48 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +10766 -0
- package/dist/index.js.map +7 -0
- package/dist/main.js +11941 -0
- package/dist/main.js.map +7 -0
- package/dist/mcp.js +10468 -0
- package/dist/mcp.js.map +7 -0
- package/dist/scan-worker.js +11800 -0
- package/dist/scan-worker.js.map +7 -0
- package/dist/v2/arguments.d.ts +87 -0
- package/dist/v2/arguments.js +403 -0
- package/dist/v2/arguments.js.map +7 -0
- package/dist/v2/atomic-output.d.ts +34 -0
- package/dist/v2/batch-runner.d.ts +50 -0
- package/dist/v2/cli-runner-internal.d.ts +28 -0
- package/dist/v2/cli-runner.d.ts +22 -0
- package/dist/v2/cli-runner.js +10037 -0
- package/dist/v2/cli-runner.js.map +7 -0
- package/dist/v2/commands.d.ts +155 -0
- package/dist/v2/config.d.ts +16 -0
- package/dist/v2/contracts.d.ts +97 -0
- package/dist/v2/exit-reducer.d.ts +23 -0
- package/dist/v2/help.d.ts +33 -0
- package/dist/v2/help.js +325 -0
- package/dist/v2/help.js.map +7 -0
- package/dist/v2/input-read.d.ts +26 -0
- package/dist/v2/input-selection.d.ts +38 -0
- package/dist/v2/json-output.d.ts +97 -0
- package/dist/v2/metadata-output.d.ts +37 -0
- package/dist/v2/metadata-output.js +7523 -0
- package/dist/v2/metadata-output.js.map +7 -0
- package/dist/v2/metadata-validation.d.ts +4 -0
- package/dist/v2/ndjson-output.d.ts +3 -0
- package/dist/v2/path-admission.d.ts +8 -0
- package/dist/v2/scan-config-load.d.ts +21 -0
- package/dist/v2/scan-worker-host.d.ts +29 -0
- package/dist/v2/table-output.d.ts +2 -0
- package/dist/v2/worker-host.d.ts +24 -0
- package/package.json +74 -6
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type ScannerLimitsV2 } from '@hub/contracts';
|
|
2
|
+
import type { ScanWorkflowV2FailureCode, ScanWorkflowV2Result } from '@hub/scanner-core/v2';
|
|
3
|
+
import { type ScanConfigV2 } from './config';
|
|
4
|
+
import { type CliStdin, type InputReadHost, type ReadInputResult } from './input-read';
|
|
5
|
+
import type { SelectedInputV2 } from './input-selection';
|
|
6
|
+
import { type ScanWorkerFactory } from './scan-worker-host';
|
|
7
|
+
import { type SigintSource } from './worker-host';
|
|
8
|
+
export type BatchErrorCodeV2 = ScanWorkflowV2FailureCode | 'INPUT_READ_FAILED';
|
|
9
|
+
export type BatchItemStatusV2 = 'COMPLETED' | 'FAILED' | 'CANCELLED' | 'TIMEOUT';
|
|
10
|
+
export type BatchItemV2 = Readonly<{
|
|
11
|
+
label: string;
|
|
12
|
+
status: BatchItemStatusV2;
|
|
13
|
+
result?: ScanWorkflowV2Result;
|
|
14
|
+
error?: Readonly<{
|
|
15
|
+
code: BatchErrorCodeV2;
|
|
16
|
+
}>;
|
|
17
|
+
}>;
|
|
18
|
+
export type BatchResultV2 = Readonly<{
|
|
19
|
+
ok: true;
|
|
20
|
+
items: readonly BatchItemV2[];
|
|
21
|
+
cancelled: boolean;
|
|
22
|
+
completed: number;
|
|
23
|
+
failed: number;
|
|
24
|
+
concurrency: number;
|
|
25
|
+
}> | Readonly<{
|
|
26
|
+
ok: false;
|
|
27
|
+
code: 'INVALID_CONFIG' | 'CANCELLED';
|
|
28
|
+
message: string;
|
|
29
|
+
}>;
|
|
30
|
+
export type BatchScanV2 = (bytes: Uint8Array, item: SelectedInputV2) => ScanWorkflowV2Result | PromiseLike<ScanWorkflowV2Result>;
|
|
31
|
+
export type BatchReadV2 = (item: SelectedInputV2) => Uint8Array | ReadInputResult | PromiseLike<Uint8Array | ReadInputResult>;
|
|
32
|
+
export type BatchRunnerInput = Readonly<{
|
|
33
|
+
items: readonly SelectedInputV2[];
|
|
34
|
+
config: ScanConfigV2;
|
|
35
|
+
scan?: BatchScanV2;
|
|
36
|
+
read?: BatchReadV2;
|
|
37
|
+
stdin?: CliStdin;
|
|
38
|
+
readHost?: InputReadHost;
|
|
39
|
+
baseDirectory?: string;
|
|
40
|
+
maxInputBytes?: number;
|
|
41
|
+
limitsDocument?: ScannerLimitsV2;
|
|
42
|
+
targetDocument?: unknown;
|
|
43
|
+
approvedDomains?: readonly string[];
|
|
44
|
+
scanWorker?: ScanWorkerFactory;
|
|
45
|
+
timeoutMs?: number;
|
|
46
|
+
signal?: AbortSignal;
|
|
47
|
+
sigint?: SigintSource;
|
|
48
|
+
now?: () => number;
|
|
49
|
+
}>;
|
|
50
|
+
export declare function runBatchV2(input: BatchRunnerInput): Promise<BatchResultV2>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { CliStdin, InputReadHost } from './input-read';
|
|
2
|
+
import { type InputSelectionHost } from './input-selection';
|
|
3
|
+
import type { CliCommandV2 } from './arguments';
|
|
4
|
+
import { type BatchReadV2, type BatchScanV2 } from './batch-runner';
|
|
5
|
+
import { type CliEnvelopeV2 } from './json-output';
|
|
6
|
+
import { type ExitCodeV2 } from './exit-reducer';
|
|
7
|
+
import type { SigintSource } from './worker-host';
|
|
8
|
+
export type V2CliRunOptions = Readonly<{
|
|
9
|
+
cwd?: string;
|
|
10
|
+
stdin?: CliStdin;
|
|
11
|
+
signal?: AbortSignal;
|
|
12
|
+
read?: BatchReadV2;
|
|
13
|
+
scan?: BatchScanV2;
|
|
14
|
+
readHost?: InputReadHost;
|
|
15
|
+
selectionHost?: InputSelectionHost;
|
|
16
|
+
sigint?: SigintSource;
|
|
17
|
+
}>;
|
|
18
|
+
export type V2CliRunResult = Readonly<{
|
|
19
|
+
exitCode: ExitCodeV2;
|
|
20
|
+
stdout: string;
|
|
21
|
+
stderr: string;
|
|
22
|
+
document?: CliEnvelopeV2 | string;
|
|
23
|
+
}>;
|
|
24
|
+
type ScanCommand = Extract<CliCommandV2, {
|
|
25
|
+
kind: 'scan';
|
|
26
|
+
}>;
|
|
27
|
+
export declare function runCliV2Internal(command: ScanCommand, options?: V2CliRunOptions): Promise<V2CliRunResult>;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CliCommandV2 } from './arguments.js';
|
|
2
|
+
/** The scan member only: the internal runner does not dispatch metadata commands. */
|
|
3
|
+
export type PublicScanCommandV2 = Extract<CliCommandV2, {
|
|
4
|
+
kind: 'scan';
|
|
5
|
+
}>;
|
|
6
|
+
export type PublicRunOptionsV2 = Readonly<{
|
|
7
|
+
cwd?: string;
|
|
8
|
+
stdin?: string | Uint8Array | AsyncIterable<Uint8Array | string>;
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
}>;
|
|
11
|
+
export type PublicRunResultV2 = Readonly<{
|
|
12
|
+
exitCode: number;
|
|
13
|
+
stdout: string;
|
|
14
|
+
stderr: string;
|
|
15
|
+
document?: unknown;
|
|
16
|
+
}>;
|
|
17
|
+
/**
|
|
18
|
+
* Library entry. The `sfscanner` bin remains the side-effecting CLI; this wrapper forwards only
|
|
19
|
+
* the three consumer options, so an internal read/scan/selection hook is never part of the
|
|
20
|
+
* published surface.
|
|
21
|
+
*/
|
|
22
|
+
export declare function runCliV2(command: PublicScanCommandV2, options?: PublicRunOptionsV2): Promise<PublicRunResultV2>;
|