circle-ir-ai 2.7.0 → 2.7.2
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/CHANGELOG.md +63 -0
- package/dist/llm/ax-client.d.ts.map +1 -1
- package/dist/llm/ax-client.js +36 -10
- package/dist/llm/ax-client.js.map +1 -1
- package/package.json +2 -2
- package/dist/cli/args.d.ts +0 -86
- package/dist/cli/args.d.ts.map +0 -1
- package/dist/cli/args.js +0 -653
- package/dist/cli/args.js.map +0 -1
- package/dist/cli/colors.d.ts +0 -31
- package/dist/cli/colors.d.ts.map +0 -1
- package/dist/cli/colors.js +0 -80
- package/dist/cli/colors.js.map +0 -1
- package/dist/cli/commands/analyze-skill.d.ts +0 -33
- package/dist/cli/commands/analyze-skill.d.ts.map +0 -1
- package/dist/cli/commands/analyze-skill.js +0 -217
- package/dist/cli/commands/analyze-skill.js.map +0 -1
- package/dist/cli/commands/analyze.d.ts +0 -19
- package/dist/cli/commands/analyze.d.ts.map +0 -1
- package/dist/cli/commands/analyze.js +0 -303
- package/dist/cli/commands/analyze.js.map +0 -1
- package/dist/cli/commands/benchmark-runner.d.ts +0 -42
- package/dist/cli/commands/benchmark-runner.d.ts.map +0 -1
- package/dist/cli/commands/benchmark-runner.js +0 -18
- package/dist/cli/commands/benchmark-runner.js.map +0 -1
- package/dist/cli/commands/benchmark.d.ts +0 -11
- package/dist/cli/commands/benchmark.d.ts.map +0 -1
- package/dist/cli/commands/benchmark.js +0 -90
- package/dist/cli/commands/benchmark.js.map +0 -1
- package/dist/cli/commands/cluster.d.ts +0 -12
- package/dist/cli/commands/cluster.d.ts.map +0 -1
- package/dist/cli/commands/cluster.js +0 -203
- package/dist/cli/commands/cluster.js.map +0 -1
- package/dist/cli/commands/compare.d.ts +0 -13
- package/dist/cli/commands/compare.d.ts.map +0 -1
- package/dist/cli/commands/compare.js +0 -109
- package/dist/cli/commands/compare.js.map +0 -1
- package/dist/cli/commands/dead-code.d.ts +0 -11
- package/dist/cli/commands/dead-code.d.ts.map +0 -1
- package/dist/cli/commands/dead-code.js +0 -75
- package/dist/cli/commands/dead-code.js.map +0 -1
- package/dist/cli/commands/generate-spec.d.ts +0 -11
- package/dist/cli/commands/generate-spec.d.ts.map +0 -1
- package/dist/cli/commands/generate-spec.js +0 -120
- package/dist/cli/commands/generate-spec.js.map +0 -1
- package/dist/cli/commands/health.d.ts +0 -11
- package/dist/cli/commands/health.d.ts.map +0 -1
- package/dist/cli/commands/health.js +0 -76
- package/dist/cli/commands/health.js.map +0 -1
- package/dist/cli/commands/index.d.ts +0 -30
- package/dist/cli/commands/index.d.ts.map +0 -1
- package/dist/cli/commands/index.js +0 -36
- package/dist/cli/commands/index.js.map +0 -1
- package/dist/cli/commands/metrics.d.ts +0 -12
- package/dist/cli/commands/metrics.d.ts.map +0 -1
- package/dist/cli/commands/metrics.js +0 -231
- package/dist/cli/commands/metrics.js.map +0 -1
- package/dist/cli/commands/project.d.ts +0 -21
- package/dist/cli/commands/project.d.ts.map +0 -1
- package/dist/cli/commands/project.js +0 -92
- package/dist/cli/commands/project.js.map +0 -1
- package/dist/cli/commands/quality.d.ts +0 -15
- package/dist/cli/commands/quality.d.ts.map +0 -1
- package/dist/cli/commands/quality.js +0 -86
- package/dist/cli/commands/quality.js.map +0 -1
- package/dist/cli/commands/scan.d.ts +0 -11
- package/dist/cli/commands/scan.d.ts.map +0 -1
- package/dist/cli/commands/scan.js +0 -102
- package/dist/cli/commands/scan.js.map +0 -1
- package/dist/cli/commands/secrets.d.ts +0 -11
- package/dist/cli/commands/secrets.d.ts.map +0 -1
- package/dist/cli/commands/secrets.js +0 -79
- package/dist/cli/commands/secrets.js.map +0 -1
- package/dist/cli/commands/spec-diff.d.ts +0 -12
- package/dist/cli/commands/spec-diff.d.ts.map +0 -1
- package/dist/cli/commands/spec-diff.js +0 -150
- package/dist/cli/commands/spec-diff.js.map +0 -1
- package/dist/cli/commands/swarm.d.ts +0 -21
- package/dist/cli/commands/swarm.d.ts.map +0 -1
- package/dist/cli/commands/swarm.js +0 -175
- package/dist/cli/commands/swarm.js.map +0 -1
- package/dist/cli/commands/trust.d.ts +0 -23
- package/dist/cli/commands/trust.d.ts.map +0 -1
- package/dist/cli/commands/trust.js +0 -397
- package/dist/cli/commands/trust.js.map +0 -1
- package/dist/cli/commands/understand.d.ts +0 -12
- package/dist/cli/commands/understand.d.ts.map +0 -1
- package/dist/cli/commands/understand.js +0 -188
- package/dist/cli/commands/understand.js.map +0 -1
- package/dist/cli/config.d.ts +0 -161
- package/dist/cli/config.d.ts.map +0 -1
- package/dist/cli/config.js +0 -383
- package/dist/cli/config.js.map +0 -1
- package/dist/cli/discovery.d.ts +0 -31
- package/dist/cli/discovery.d.ts.map +0 -1
- package/dist/cli/discovery.js +0 -212
- package/dist/cli/discovery.js.map +0 -1
- package/dist/cli/effective-options.d.ts +0 -42
- package/dist/cli/effective-options.d.ts.map +0 -1
- package/dist/cli/effective-options.js +0 -80
- package/dist/cli/effective-options.js.map +0 -1
- package/dist/cli/file-collection.d.ts +0 -49
- package/dist/cli/file-collection.d.ts.map +0 -1
- package/dist/cli/file-collection.js +0 -142
- package/dist/cli/file-collection.js.map +0 -1
- package/dist/cli/formatters/index.d.ts +0 -15
- package/dist/cli/formatters/index.d.ts.map +0 -1
- package/dist/cli/formatters/index.js +0 -51
- package/dist/cli/formatters/index.js.map +0 -1
- package/dist/cli/formatters/json.d.ts +0 -11
- package/dist/cli/formatters/json.d.ts.map +0 -1
- package/dist/cli/formatters/json.js +0 -12
- package/dist/cli/formatters/json.js.map +0 -1
- package/dist/cli/formatters/project-json.d.ts +0 -11
- package/dist/cli/formatters/project-json.d.ts.map +0 -1
- package/dist/cli/formatters/project-json.js +0 -12
- package/dist/cli/formatters/project-json.js.map +0 -1
- package/dist/cli/formatters/project-sarif.d.ts +0 -11
- package/dist/cli/formatters/project-sarif.d.ts.map +0 -1
- package/dist/cli/formatters/project-sarif.js +0 -127
- package/dist/cli/formatters/project-sarif.js.map +0 -1
- package/dist/cli/formatters/project-summary.d.ts +0 -11
- package/dist/cli/formatters/project-summary.d.ts.map +0 -1
- package/dist/cli/formatters/project-summary.js +0 -202
- package/dist/cli/formatters/project-summary.js.map +0 -1
- package/dist/cli/formatters/sarif-shared.d.ts +0 -101
- package/dist/cli/formatters/sarif-shared.d.ts.map +0 -1
- package/dist/cli/formatters/sarif-shared.js +0 -57
- package/dist/cli/formatters/sarif-shared.js.map +0 -1
- package/dist/cli/formatters/sarif.d.ts +0 -12
- package/dist/cli/formatters/sarif.d.ts.map +0 -1
- package/dist/cli/formatters/sarif.js +0 -92
- package/dist/cli/formatters/sarif.js.map +0 -1
- package/dist/cli/formatters/summary.d.ts +0 -11
- package/dist/cli/formatters/summary.d.ts.map +0 -1
- package/dist/cli/formatters/summary.js +0 -240
- package/dist/cli/formatters/summary.js.map +0 -1
- package/dist/cli/formatters/two-phase-summary.d.ts +0 -11
- package/dist/cli/formatters/two-phase-summary.d.ts.map +0 -1
- package/dist/cli/formatters/two-phase-summary.js +0 -188
- package/dist/cli/formatters/two-phase-summary.js.map +0 -1
- package/dist/cli/index.d.ts +0 -10
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js +0 -72
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/program.d.ts +0 -117
- package/dist/cli/program.d.ts.map +0 -1
- package/dist/cli/program.js +0 -825
- package/dist/cli/program.js.map +0 -1
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Effective options helper — merges CLI args with cognium.config.json and
|
|
3
|
-
* .circle-ir.yaml into the values commands actually use.
|
|
4
|
-
*
|
|
5
|
-
* Resolution order (later wins):
|
|
6
|
-
* 1. defaults
|
|
7
|
-
* 2. .circle-ir.yaml (legacy taint config)
|
|
8
|
-
* 3. cognium.config.json (preferred — passes, suppressions, include/exclude)
|
|
9
|
-
* 4. CLI flags
|
|
10
|
-
*/
|
|
11
|
-
import type { AnalyzerOptions } from 'circle-ir';
|
|
12
|
-
import type { CliArgs } from './args.js';
|
|
13
|
-
import { type CogniumConfig, type ResolvedConfig } from './config.js';
|
|
14
|
-
export interface EffectiveOptions {
|
|
15
|
-
/** Glob patterns to include. */
|
|
16
|
-
include: string[];
|
|
17
|
-
/** Glob patterns to exclude. */
|
|
18
|
-
exclude: string[];
|
|
19
|
-
/** Pass names disabled (CLI ∪ cognium.config.passes ∪ trust.disabledPasses). */
|
|
20
|
-
disabledPasses: string[];
|
|
21
|
-
/** Severity threshold (CLI > config > undefined). */
|
|
22
|
-
severity: 'critical' | 'high' | 'medium' | 'low' | undefined;
|
|
23
|
-
/** Categories filter (CLI > config > []). */
|
|
24
|
-
categories: string[];
|
|
25
|
-
/** Trust-specific disabled passes (subset of disabledPasses, source-tracked). */
|
|
26
|
-
trustDisabledPasses: string[];
|
|
27
|
-
/** AnalyzerOptions for circle-ir analyze() — passOptions + disabledPasses. */
|
|
28
|
-
analyzerOptions: AnalyzerOptions | undefined;
|
|
29
|
-
/** The loaded cognium.config.json (or null). */
|
|
30
|
-
cognium: CogniumConfig | null;
|
|
31
|
-
/** The resolved .circle-ir.yaml config (always present, with defaults). */
|
|
32
|
-
circleIr: ResolvedConfig;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Build the effective options for a command.
|
|
36
|
-
*
|
|
37
|
-
* @param args parsed CliArgs
|
|
38
|
-
* @param target the path the command was invoked on (used as starting dir for
|
|
39
|
-
* config search if --config wasn't given)
|
|
40
|
-
*/
|
|
41
|
-
export declare function getEffectiveOptions(args: CliArgs, target: string): EffectiveOptions;
|
|
42
|
-
//# sourceMappingURL=effective-options.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"effective-options.d.ts","sourceRoot":"","sources":["../../src/cli/effective-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,gBAAgB;IAC/B,gCAAgC;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,gCAAgC;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,gFAAgF;IAChF,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,qDAAqD;IACrD,QAAQ,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC;IAC7D,6CAA6C;IAC7C,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,iFAAiF;IACjF,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,8EAA8E;IAC9E,eAAe,EAAE,eAAe,GAAG,SAAS,CAAC;IAC7C,gDAAgD;IAChD,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC;IAC9B,2EAA2E;IAC3E,QAAQ,EAAE,cAAc,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAmEnF"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Effective options helper — merges CLI args with cognium.config.json and
|
|
3
|
-
* .circle-ir.yaml into the values commands actually use.
|
|
4
|
-
*
|
|
5
|
-
* Resolution order (later wins):
|
|
6
|
-
* 1. defaults
|
|
7
|
-
* 2. .circle-ir.yaml (legacy taint config)
|
|
8
|
-
* 3. cognium.config.json (preferred — passes, suppressions, include/exclude)
|
|
9
|
-
* 4. CLI flags
|
|
10
|
-
*/
|
|
11
|
-
import * as fs from 'fs';
|
|
12
|
-
import * as path from 'path';
|
|
13
|
-
import { loadCogniumConfig, loadConfig, convertCogniumConfigToPassOptions, } from './config.js';
|
|
14
|
-
/**
|
|
15
|
-
* Build the effective options for a command.
|
|
16
|
-
*
|
|
17
|
-
* @param args parsed CliArgs
|
|
18
|
-
* @param target the path the command was invoked on (used as starting dir for
|
|
19
|
-
* config search if --config wasn't given)
|
|
20
|
-
*/
|
|
21
|
-
export function getEffectiveOptions(args, target) {
|
|
22
|
-
// Where to start searching for config files
|
|
23
|
-
const startDir = (() => {
|
|
24
|
-
try {
|
|
25
|
-
return fs.statSync(target).isDirectory() ? target : path.dirname(target);
|
|
26
|
-
}
|
|
27
|
-
catch {
|
|
28
|
-
return process.cwd();
|
|
29
|
-
}
|
|
30
|
-
})();
|
|
31
|
-
const cognium = loadCogniumConfig(args.config || undefined, startDir);
|
|
32
|
-
const circleIr = loadConfig(args.config || null, startDir);
|
|
33
|
-
// Include / exclude — CLI overrides config
|
|
34
|
-
const include = args.include.length > 0
|
|
35
|
-
? args.include
|
|
36
|
-
: (cognium?.include?.length ? cognium.include : circleIr.include);
|
|
37
|
-
const exclude = args.exclude.length > 0
|
|
38
|
-
? args.exclude
|
|
39
|
-
: (cognium?.exclude?.length ? cognium.exclude : circleIr.exclude);
|
|
40
|
-
// Disabled passes — union of CLI + cognium.passes (false) + cognium.trust.disabledPasses
|
|
41
|
-
const cogniumPasses = cognium ? convertCogniumConfigToPassOptions(cognium) : { passOptions: {}, disabledPasses: [] };
|
|
42
|
-
const trustDisabled = cognium?.trust?.disabledPasses ?? [];
|
|
43
|
-
const disabledPasses = [...new Set([
|
|
44
|
-
...args.disablePass,
|
|
45
|
-
...cogniumPasses.disabledPasses,
|
|
46
|
-
...trustDisabled,
|
|
47
|
-
])];
|
|
48
|
-
// Severity
|
|
49
|
-
const cliSeverity = args.severity ?? undefined;
|
|
50
|
-
const configSeverityRaw = cognium?.severity ?? circleIr.analysis.severity_threshold;
|
|
51
|
-
const configSeverity = configSeverityRaw === 'critical' || configSeverityRaw === 'high' ||
|
|
52
|
-
configSeverityRaw === 'medium' || configSeverityRaw === 'low'
|
|
53
|
-
? configSeverityRaw
|
|
54
|
-
: undefined;
|
|
55
|
-
const severity = cliSeverity ?? configSeverity;
|
|
56
|
-
// Categories
|
|
57
|
-
const categories = args.categories.length > 0
|
|
58
|
-
? args.categories
|
|
59
|
-
: (cognium?.categories ?? []);
|
|
60
|
-
// AnalyzerOptions
|
|
61
|
-
const hasPassOptions = Object.keys(cogniumPasses.passOptions).length > 0;
|
|
62
|
-
const analyzerOptions = hasPassOptions || disabledPasses.length > 0
|
|
63
|
-
? {
|
|
64
|
-
passOptions: hasPassOptions ? cogniumPasses.passOptions : undefined,
|
|
65
|
-
disabledPasses: disabledPasses.length > 0 ? disabledPasses : undefined,
|
|
66
|
-
}
|
|
67
|
-
: undefined;
|
|
68
|
-
return {
|
|
69
|
-
include,
|
|
70
|
-
exclude,
|
|
71
|
-
disabledPasses,
|
|
72
|
-
severity,
|
|
73
|
-
categories,
|
|
74
|
-
trustDisabledPasses: [...new Set([...args.disablePass, ...trustDisabled])],
|
|
75
|
-
analyzerOptions,
|
|
76
|
-
cognium,
|
|
77
|
-
circleIr,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
//# sourceMappingURL=effective-options.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"effective-options.js","sourceRoot":"","sources":["../../src/cli/effective-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,iCAAiC,GAGlC,MAAM,aAAa,CAAC;AAuBrB;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAa,EAAE,MAAc;IAC/D,4CAA4C;IAC5C,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE;QACrB,IAAI,CAAC;YACH,OAAO,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,C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J,CAAC"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared file collector — used by every command that walks a directory.
|
|
3
|
-
*
|
|
4
|
-
* Honors:
|
|
5
|
-
* - include / exclude glob patterns (minimatch)
|
|
6
|
-
* - per-language ext filters
|
|
7
|
-
* - hard skip dirs (node_modules, .git, target, etc.)
|
|
8
|
-
* - maxFiles / depth caps
|
|
9
|
-
*
|
|
10
|
-
* Glob matching is performed against the path *relative to the root* with
|
|
11
|
-
* forward slashes, so patterns like `**\/test\/**` work cross-platform.
|
|
12
|
-
*/
|
|
13
|
-
export type SupportedLanguage = 'java' | 'javascript' | 'typescript' | 'python' | 'rust' | 'c' | 'cpp' | 'bash' | 'html';
|
|
14
|
-
export interface CollectOptions {
|
|
15
|
-
/** Glob patterns to include (relative to root). Empty = include all matching extensions. */
|
|
16
|
-
include?: string[];
|
|
17
|
-
/** Glob patterns to exclude (relative to root). */
|
|
18
|
-
exclude?: string[];
|
|
19
|
-
/** Restrict to a subset of languages. Default: all supported. */
|
|
20
|
-
languages?: SupportedLanguage[];
|
|
21
|
-
/** Maximum number of files to return. Default: 10_000. */
|
|
22
|
-
maxFiles?: number;
|
|
23
|
-
/** Maximum walk depth. Default: 30. */
|
|
24
|
-
maxDepth?: number;
|
|
25
|
-
/** Additional directory names to never descend into (merged with defaults). */
|
|
26
|
-
extraSkipDirs?: string[];
|
|
27
|
-
/** Skip dotfiles/dotdirs. Default: true. */
|
|
28
|
-
skipDotted?: boolean;
|
|
29
|
-
}
|
|
30
|
-
export interface CollectedFile {
|
|
31
|
-
/** Absolute path. */
|
|
32
|
-
path: string;
|
|
33
|
-
/** Path relative to the root supplied to collectFiles(). */
|
|
34
|
-
relativePath: string;
|
|
35
|
-
/** Detected language. */
|
|
36
|
-
language: SupportedLanguage;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Collect source files under `root`, respecting include/exclude/lang filters.
|
|
40
|
-
*
|
|
41
|
-
* If `root` is a single file, returns a one-element array (or empty if it
|
|
42
|
-
* doesn't match the filters).
|
|
43
|
-
*/
|
|
44
|
-
export declare function collectFiles(root: string, options?: CollectOptions): CollectedFile[];
|
|
45
|
-
export declare const _internal: {
|
|
46
|
-
LANGUAGE_EXTENSIONS: Record<SupportedLanguage, readonly string[]>;
|
|
47
|
-
DEFAULT_SKIP_DIRS: Set<string>;
|
|
48
|
-
};
|
|
49
|
-
//# sourceMappingURL=file-collection.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-collection.d.ts","sourceRoot":"","sources":["../../src/cli/file-collection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,MAAM,MAAM,iBAAiB,GACzB,MAAM,GACN,YAAY,GACZ,YAAY,GACZ,QAAQ,GACR,MAAM,GACN,GAAG,GACH,KAAK,GACL,MAAM,GACN,MAAM,CAAC;AAEX,MAAM,WAAW,cAAc;IAC7B,4FAA4F;IAC5F,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,iEAAiE;IACjE,SAAS,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAChC,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+EAA+E;IAC/E,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,4DAA4D;IAC5D,YAAY,EAAE,MAAM,CAAC;IACrB,yBAAyB;IACzB,QAAQ,EAAE,iBAAiB,CAAC;CAC7B;AAoDD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,aAAa,EAAE,CAkExF;AAED,eAAO,MAAM,SAAS;;;CAA6C,CAAC"}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared file collector — used by every command that walks a directory.
|
|
3
|
-
*
|
|
4
|
-
* Honors:
|
|
5
|
-
* - include / exclude glob patterns (minimatch)
|
|
6
|
-
* - per-language ext filters
|
|
7
|
-
* - hard skip dirs (node_modules, .git, target, etc.)
|
|
8
|
-
* - maxFiles / depth caps
|
|
9
|
-
*
|
|
10
|
-
* Glob matching is performed against the path *relative to the root* with
|
|
11
|
-
* forward slashes, so patterns like `**\/test\/**` work cross-platform.
|
|
12
|
-
*/
|
|
13
|
-
import * as fs from 'fs';
|
|
14
|
-
import * as path from 'path';
|
|
15
|
-
import { minimatch } from 'minimatch';
|
|
16
|
-
const LANGUAGE_EXTENSIONS = {
|
|
17
|
-
java: ['.java'],
|
|
18
|
-
javascript: ['.js', '.jsx', '.mjs', '.cjs'],
|
|
19
|
-
typescript: ['.ts', '.tsx', '.mts', '.cts'],
|
|
20
|
-
python: ['.py'],
|
|
21
|
-
rust: ['.rs'],
|
|
22
|
-
c: ['.c', '.h'],
|
|
23
|
-
cpp: ['.cpp', '.cc', '.cxx', '.hpp', '.hh', '.hxx'],
|
|
24
|
-
bash: ['.sh', '.bash'],
|
|
25
|
-
html: ['.html', '.htm'],
|
|
26
|
-
};
|
|
27
|
-
const DEFAULT_SKIP_DIRS = new Set([
|
|
28
|
-
'node_modules',
|
|
29
|
-
'.git',
|
|
30
|
-
'.svn',
|
|
31
|
-
'.hg',
|
|
32
|
-
'dist',
|
|
33
|
-
'build',
|
|
34
|
-
'target',
|
|
35
|
-
'out',
|
|
36
|
-
'bin',
|
|
37
|
-
'.idea',
|
|
38
|
-
'.vscode',
|
|
39
|
-
'.next',
|
|
40
|
-
'.gradle',
|
|
41
|
-
'.m2',
|
|
42
|
-
'vendor',
|
|
43
|
-
'coverage',
|
|
44
|
-
'__pycache__',
|
|
45
|
-
'.tsbuildinfo',
|
|
46
|
-
]);
|
|
47
|
-
function detectLanguage(ext) {
|
|
48
|
-
for (const [lang, exts] of Object.entries(LANGUAGE_EXTENSIONS)) {
|
|
49
|
-
if (exts.includes(ext))
|
|
50
|
-
return lang;
|
|
51
|
-
}
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
function toForwardSlash(p) {
|
|
55
|
-
return p.split(path.sep).join('/');
|
|
56
|
-
}
|
|
57
|
-
function matchAny(relPath, patterns) {
|
|
58
|
-
if (patterns.length === 0)
|
|
59
|
-
return false;
|
|
60
|
-
const slashed = toForwardSlash(relPath);
|
|
61
|
-
return patterns.some(pat => minimatch(slashed, pat, { dot: true, matchBase: true }));
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Collect source files under `root`, respecting include/exclude/lang filters.
|
|
65
|
-
*
|
|
66
|
-
* If `root` is a single file, returns a one-element array (or empty if it
|
|
67
|
-
* doesn't match the filters).
|
|
68
|
-
*/
|
|
69
|
-
export function collectFiles(root, options = {}) {
|
|
70
|
-
const include = options.include ?? [];
|
|
71
|
-
const exclude = options.exclude ?? [];
|
|
72
|
-
const languages = options.languages ?? Object.keys(LANGUAGE_EXTENSIONS);
|
|
73
|
-
const maxFiles = options.maxFiles ?? 10_000;
|
|
74
|
-
const maxDepth = options.maxDepth ?? 30;
|
|
75
|
-
const skipDotted = options.skipDotted !== false;
|
|
76
|
-
const skipDirs = new Set([...DEFAULT_SKIP_DIRS, ...(options.extraSkipDirs ?? [])]);
|
|
77
|
-
const allowedExts = new Set();
|
|
78
|
-
for (const lang of languages) {
|
|
79
|
-
for (const ext of LANGUAGE_EXTENSIONS[lang])
|
|
80
|
-
allowedExts.add(ext);
|
|
81
|
-
}
|
|
82
|
-
const out = [];
|
|
83
|
-
let stat;
|
|
84
|
-
try {
|
|
85
|
-
stat = fs.statSync(root);
|
|
86
|
-
}
|
|
87
|
-
catch {
|
|
88
|
-
return out;
|
|
89
|
-
}
|
|
90
|
-
if (stat.isFile()) {
|
|
91
|
-
const ext = path.extname(root).toLowerCase();
|
|
92
|
-
const lang = detectLanguage(ext);
|
|
93
|
-
if (lang && languages.includes(lang)) {
|
|
94
|
-
out.push({ path: root, relativePath: path.basename(root), language: lang });
|
|
95
|
-
}
|
|
96
|
-
return out;
|
|
97
|
-
}
|
|
98
|
-
const rootResolved = path.resolve(root);
|
|
99
|
-
const walk = (dir, depth) => {
|
|
100
|
-
if (out.length >= maxFiles || depth > maxDepth)
|
|
101
|
-
return;
|
|
102
|
-
let entries;
|
|
103
|
-
try {
|
|
104
|
-
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
105
|
-
}
|
|
106
|
-
catch {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
for (const entry of entries) {
|
|
110
|
-
if (out.length >= maxFiles)
|
|
111
|
-
return;
|
|
112
|
-
const full = path.join(dir, entry.name);
|
|
113
|
-
const rel = path.relative(rootResolved, full);
|
|
114
|
-
if (entry.isDirectory()) {
|
|
115
|
-
if (skipDirs.has(entry.name))
|
|
116
|
-
continue;
|
|
117
|
-
if (skipDotted && entry.name.startsWith('.'))
|
|
118
|
-
continue;
|
|
119
|
-
if (matchAny(rel, exclude))
|
|
120
|
-
continue;
|
|
121
|
-
walk(full, depth + 1);
|
|
122
|
-
}
|
|
123
|
-
else if (entry.isFile()) {
|
|
124
|
-
const ext = path.extname(entry.name).toLowerCase();
|
|
125
|
-
if (!allowedExts.has(ext))
|
|
126
|
-
continue;
|
|
127
|
-
const lang = detectLanguage(ext);
|
|
128
|
-
if (!lang)
|
|
129
|
-
continue;
|
|
130
|
-
if (matchAny(rel, exclude))
|
|
131
|
-
continue;
|
|
132
|
-
if (include.length > 0 && !matchAny(rel, include))
|
|
133
|
-
continue;
|
|
134
|
-
out.push({ path: full, relativePath: rel, language: lang });
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
walk(rootResolved, 0);
|
|
139
|
-
return out;
|
|
140
|
-
}
|
|
141
|
-
export const _internal = { LANGUAGE_EXTENSIONS, DEFAULT_SKIP_DIRS };
|
|
142
|
-
//# sourceMappingURL=file-collection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-collection.js","sourceRoot":"","sources":["../../src/cli/file-collection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAuCtC,MAAM,mBAAmB,GAAiD;IACxE,IAAI,EAAQ,CAAC,OAAO,CAAC;IACrB,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;IAC3C,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;IAC3C,MAAM,EAAM,CAAC,KAAK,CAAC;IACnB,IAAI,EAAQ,CAAC,KAAK,CAAC;IACnB,CAAC,EAAW,CAAC,IAAI,EAAE,IAAI,CAAC;IACxB,GAAG,EAAS,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC;IAC1D,IAAI,EAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IAC5B,IAAI,EAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IAChC,cAAc;IACd,MAAM;IACN,MAAM;IACN,KAAK;IACL,MAAM;IACN,OAAO;IACP,QAAQ;IACR,KAAK;IACL,KAAK;IACL,OAAO;IACP,SAAS;IACT,OAAO;IACP,SAAS;IACT,KAAK;IACL,QAAQ;IACR,UAAU;IACV,aAAa;IACb,cAAc;CACf,CAAC,CAAC;AAEH,SAAS,cAAc,CAAC,GAAW;IACjC,KAAK,MAAM,CAA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,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;YAC9D,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IAEF,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;IACtB,OAAO,GAAG,CAAC;AACb,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Output Formatters
|
|
3
|
-
*/
|
|
4
|
-
import type { CircleIR, ProjectAnalysis } from 'circle-ir';
|
|
5
|
-
import type { TwoPhaseProjectAnalysis } from '../../project/index.js';
|
|
6
|
-
import type { OutputFormat } from '../args.js';
|
|
7
|
-
/**
|
|
8
|
-
* Format single-file analysis output based on requested format.
|
|
9
|
-
*/
|
|
10
|
-
export declare function formatOutput(result: CircleIR, format: OutputFormat, filePath: string): string;
|
|
11
|
-
/**
|
|
12
|
-
* Format project analysis output based on requested format.
|
|
13
|
-
*/
|
|
14
|
-
export declare function formatProjectOutput(result: ProjectAnalysis | TwoPhaseProjectAnalysis, format: OutputFormat): string;
|
|
15
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/formatters/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAS/C;;GAEG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,QAAQ,EAChB,MAAM,EAAE,YAAY,EACpB,QAAQ,EAAE,MAAM,GACf,MAAM,CAWR;AAWD;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,eAAe,GAAG,uBAAuB,EACjD,MAAM,EAAE,YAAY,GACnB,MAAM,CAgBR"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Output Formatters
|
|
3
|
-
*/
|
|
4
|
-
import { formatJson } from './json.js';
|
|
5
|
-
import { formatSummary } from './summary.js';
|
|
6
|
-
import { formatSarif } from './sarif.js';
|
|
7
|
-
import { formatProjectJson } from './project-json.js';
|
|
8
|
-
import { formatProjectSummary } from './project-summary.js';
|
|
9
|
-
import { formatProjectSarif } from './project-sarif.js';
|
|
10
|
-
import { formatTwoPhaseProjectSummary } from './two-phase-summary.js';
|
|
11
|
-
/**
|
|
12
|
-
* Format single-file analysis output based on requested format.
|
|
13
|
-
*/
|
|
14
|
-
export function formatOutput(result, format, filePath) {
|
|
15
|
-
switch (format) {
|
|
16
|
-
case 'json':
|
|
17
|
-
return formatJson(result);
|
|
18
|
-
case 'summary':
|
|
19
|
-
return formatSummary(result, filePath);
|
|
20
|
-
case 'sarif':
|
|
21
|
-
return formatSarif(result, filePath);
|
|
22
|
-
default:
|
|
23
|
-
return formatSummary(result, filePath);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Check if result is a two-phase analysis result.
|
|
28
|
-
*/
|
|
29
|
-
function isTwoPhaseResult(result) {
|
|
30
|
-
return 'enrichedFiles' in result && 'crossFileFlows' in result;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Format project analysis output based on requested format.
|
|
34
|
-
*/
|
|
35
|
-
export function formatProjectOutput(result, format) {
|
|
36
|
-
// Use two-phase formatter if applicable
|
|
37
|
-
if (isTwoPhaseResult(result) && format === 'summary') {
|
|
38
|
-
return formatTwoPhaseProjectSummary(result);
|
|
39
|
-
}
|
|
40
|
-
switch (format) {
|
|
41
|
-
case 'json':
|
|
42
|
-
return formatProjectJson(result);
|
|
43
|
-
case 'summary':
|
|
44
|
-
return formatProjectSummary(result);
|
|
45
|
-
case 'sarif':
|
|
46
|
-
return formatProjectSarif(result);
|
|
47
|
-
default:
|
|
48
|
-
return formatProjectSummary(result);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/formatters/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAEtE;;GAEG;AACH,MAAM,UAAU,YAAY,CAC1B,MAAgB,EAChB,MAAoB,EACpB,QAAgB;IAEhB,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,MAAM;YACT,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;QAC5B,KAAK,SAAS;YACZ,OAAO,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QACzC,KAAK,OAAO;YACV,OAAO,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QACvC;YACE,OAAO,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC3C,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,gBAAgB,CACvB,MAAiD;IAEjD,OAAO,eAAe,IAAI,MAAM,IAAI,gBAAgB,IAAI,MAAM,CAAC;AACjE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CACjC,MAAiD,EACjD,MAAoB;IAEpB,wCAAwC;IACxC,IAAI,gBAAgB,CAAC,MAAM,CAAC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACrD,OAAO,4BAA4B,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,MAAM;YACT,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;QACnC,KAAK,SAAS;YACZ,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAC;QACtC,KAAK,OAAO;YACV,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC;QACpC;YACE,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../../src/cli/formatters/json.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE1C;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,CAEnD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../../src/cli/formatters/json.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,MAAgB;IACzC,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Project JSON Formatter
|
|
3
|
-
*
|
|
4
|
-
* Outputs the full project analysis as JSON.
|
|
5
|
-
*/
|
|
6
|
-
import type { ProjectAnalysis } from 'circle-ir';
|
|
7
|
-
/**
|
|
8
|
-
* Format project result as JSON.
|
|
9
|
-
*/
|
|
10
|
-
export declare function formatProjectJson(result: ProjectAnalysis): string;
|
|
11
|
-
//# sourceMappingURL=project-json.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"project-json.d.ts","sourceRoot":"","sources":["../../../src/cli/formatters/project-json.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAEjE"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Project JSON Formatter
|
|
3
|
-
*
|
|
4
|
-
* Outputs the full project analysis as JSON.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Format project result as JSON.
|
|
8
|
-
*/
|
|
9
|
-
export function formatProjectJson(result) {
|
|
10
|
-
return JSON.stringify(result, null, 2);
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=project-json.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"project-json.js","sourceRoot":"","sources":["../../../src/cli/formatters/project-json.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAuB;IACvD,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Project SARIF Formatter
|
|
3
|
-
*
|
|
4
|
-
* Outputs project analysis results in SARIF format.
|
|
5
|
-
*/
|
|
6
|
-
import type { ProjectAnalysis } from 'circle-ir';
|
|
7
|
-
/**
|
|
8
|
-
* Format project result as SARIF.
|
|
9
|
-
*/
|
|
10
|
-
export declare function formatProjectSarif(result: ProjectAnalysis): string;
|
|
11
|
-
//# sourceMappingURL=project-sarif.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"project-sarif.d.ts","sourceRoot":"","sources":["../../../src/cli/formatters/project-sarif.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAW,MAAM,WAAW,CAAC;AAa1D;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAqBlE"}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Project SARIF Formatter
|
|
3
|
-
*
|
|
4
|
-
* Outputs project analysis results in SARIF format.
|
|
5
|
-
*/
|
|
6
|
-
import { getRuleInfo, getSarifLevel, SARIF_SCHEMA, SARIF_VERSION, TOOL_INFO, } from './sarif-shared.js';
|
|
7
|
-
/**
|
|
8
|
-
* Format project result as SARIF.
|
|
9
|
-
*/
|
|
10
|
-
export function formatProjectSarif(result) {
|
|
11
|
-
const rules = buildRules(result.findings);
|
|
12
|
-
const results = buildResults(result);
|
|
13
|
-
const sarif = {
|
|
14
|
-
$schema: SARIF_SCHEMA,
|
|
15
|
-
version: SARIF_VERSION,
|
|
16
|
-
runs: [
|
|
17
|
-
{
|
|
18
|
-
tool: {
|
|
19
|
-
driver: {
|
|
20
|
-
...TOOL_INFO,
|
|
21
|
-
rules,
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
results,
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
};
|
|
28
|
-
return JSON.stringify(sarif, null, 2);
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Build SARIF rules from findings.
|
|
32
|
-
*/
|
|
33
|
-
function buildRules(findings) {
|
|
34
|
-
const ruleMap = new Map();
|
|
35
|
-
for (const finding of findings) {
|
|
36
|
-
if (!ruleMap.has(finding.cwe)) {
|
|
37
|
-
ruleMap.set(finding.cwe, buildRule(finding));
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return Array.from(ruleMap.values());
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Build a SARIF rule from a finding.
|
|
44
|
-
*/
|
|
45
|
-
function buildRule(finding) {
|
|
46
|
-
const ruleInfo = getRuleInfo(finding.type, finding.cwe);
|
|
47
|
-
return {
|
|
48
|
-
id: finding.cwe,
|
|
49
|
-
name: ruleInfo.name,
|
|
50
|
-
shortDescription: { text: ruleInfo.shortDescription },
|
|
51
|
-
fullDescription: { text: ruleInfo.fullDescription },
|
|
52
|
-
help: { text: finding.remediation },
|
|
53
|
-
properties: {
|
|
54
|
-
tags: ['security', finding.type],
|
|
55
|
-
security_severity: ruleInfo.severity,
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Build SARIF results from project analysis.
|
|
61
|
-
*/
|
|
62
|
-
function buildResults(result) {
|
|
63
|
-
const sarifResults = [];
|
|
64
|
-
for (const finding of result.findings) {
|
|
65
|
-
const sarifResult = {
|
|
66
|
-
ruleId: finding.cwe,
|
|
67
|
-
level: getSarifLevel(finding.severity),
|
|
68
|
-
message: {
|
|
69
|
-
text: finding.explanation,
|
|
70
|
-
},
|
|
71
|
-
locations: [
|
|
72
|
-
{
|
|
73
|
-
physicalLocation: {
|
|
74
|
-
artifactLocation: {
|
|
75
|
-
uri: finding.sink.file,
|
|
76
|
-
},
|
|
77
|
-
region: {
|
|
78
|
-
startLine: finding.sink.line,
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
],
|
|
83
|
-
};
|
|
84
|
-
// Add code flow if we have path information
|
|
85
|
-
if (finding.path && finding.path.length > 0) {
|
|
86
|
-
sarifResult.codeFlows = [
|
|
87
|
-
{
|
|
88
|
-
threadFlows: [
|
|
89
|
-
{
|
|
90
|
-
locations: [
|
|
91
|
-
// Source
|
|
92
|
-
{
|
|
93
|
-
location: buildLocation(finding.source.file, finding.source.line),
|
|
94
|
-
state: { kind: 'source' },
|
|
95
|
-
},
|
|
96
|
-
// Intermediate hops
|
|
97
|
-
...finding.path.map(hop => ({
|
|
98
|
-
location: buildLocation(hop.file, hop.line),
|
|
99
|
-
state: { kind: 'passthrough' },
|
|
100
|
-
})),
|
|
101
|
-
// Sink
|
|
102
|
-
{
|
|
103
|
-
location: buildLocation(finding.sink.file, finding.sink.line),
|
|
104
|
-
state: { kind: 'sink' },
|
|
105
|
-
},
|
|
106
|
-
],
|
|
107
|
-
},
|
|
108
|
-
],
|
|
109
|
-
},
|
|
110
|
-
];
|
|
111
|
-
}
|
|
112
|
-
sarifResults.push(sarifResult);
|
|
113
|
-
}
|
|
114
|
-
return sarifResults;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Build a SARIF location.
|
|
118
|
-
*/
|
|
119
|
-
function buildLocation(uri, line) {
|
|
120
|
-
return {
|
|
121
|
-
physicalLocation: {
|
|
122
|
-
artifactLocation: { uri },
|
|
123
|
-
region: { startLine: line },
|
|
124
|
-
},
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
//# sourceMappingURL=project-sarif.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"project-sarif.js","sourceRoot":"","sources":["../../../src/cli/formatters/project-sarif.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAKL,WAAW,EACX,aAAa,EACb,YAAY,EACZ,aAAa,EACb,SAAS,GACV,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAuB;IACxD,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC1C,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IAErC,MAAM,KAAK,GAAa;QACtB,OAAO,EAAE,YAAY;QACrB,OAAO,EAAE,aAAa;QACtB,IAAI,EAAE;YACJ;gBACE,IAAI,EAAE;oBACJ,MAAM,EAAE;wBACN,GAAG,SAAS;wBACZ,KAAK;qBACN;iBACF;gBACD,OAAO;aACR;SACF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YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACjC,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;GAEG;AACH,SAAS,aAAa,CAAC,GAAW,EAAE,IAAY;IAC9C,OAAO;QACL,gBAAgB,EAAE;YAChB,gBAAgB,EAAE,EAAE,GAAG,EAAE;YACzB,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE;SAC5B;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Project Summary Formatter
|
|
3
|
-
*
|
|
4
|
-
* Outputs a human-readable summary of project-level analysis.
|
|
5
|
-
*/
|
|
6
|
-
import type { ProjectAnalysis } from 'circle-ir';
|
|
7
|
-
/**
|
|
8
|
-
* Format project analysis as human-readable summary.
|
|
9
|
-
*/
|
|
10
|
-
export declare function formatProjectSummary(result: ProjectAnalysis): string;
|
|
11
|
-
//# sourceMappingURL=project-summary.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"project-summary.d.ts","sourceRoot":"","sources":["../../../src/cli/formatters/project-summary.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAsB,MAAM,WAAW,CAAC;AAErE;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAwKpE"}
|