circle-ir-ai 4.41.0 → 4.43.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/CHANGELOG.md +28 -0
- package/dist/command-module/contract.d.ts +121 -0
- package/dist/command-module/contract.d.ts.map +1 -0
- package/dist/command-module/contract.js +40 -0
- package/dist/command-module/contract.js.map +1 -0
- package/dist/command-module/findings-commands.d.ts +56 -0
- package/dist/command-module/findings-commands.d.ts.map +1 -0
- package/dist/command-module/findings-commands.js +178 -0
- package/dist/command-module/findings-commands.js.map +1 -0
- package/dist/command-module/index.d.ts +46 -0
- package/dist/command-module/index.d.ts.map +1 -0
- package/dist/command-module/index.js +136 -0
- package/dist/command-module/index.js.map +1 -0
- package/dist/command-module/legacy/args.d.ts +263 -0
- package/dist/command-module/legacy/args.d.ts.map +1 -0
- package/dist/command-module/legacy/args.js +5 -0
- package/dist/command-module/legacy/args.js.map +1 -0
- package/dist/command-module/legacy/cache-telemetry.d.ts +45 -0
- package/dist/command-module/legacy/cache-telemetry.d.ts.map +1 -0
- package/dist/command-module/legacy/cache-telemetry.js +74 -0
- package/dist/command-module/legacy/cache-telemetry.js.map +1 -0
- package/dist/command-module/legacy/cluster-policies.d.ts +73 -0
- package/dist/command-module/legacy/cluster-policies.d.ts.map +1 -0
- package/dist/command-module/legacy/cluster-policies.js +91 -0
- package/dist/command-module/legacy/cluster-policies.js.map +1 -0
- package/dist/command-module/legacy/commands/analyze-skill.d.ts +57 -0
- package/dist/command-module/legacy/commands/analyze-skill.d.ts.map +1 -0
- package/dist/command-module/legacy/commands/analyze-skill.js +251 -0
- package/dist/command-module/legacy/commands/analyze-skill.js.map +1 -0
- package/dist/command-module/legacy/commands/bom.d.ts +12 -0
- package/dist/command-module/legacy/commands/bom.d.ts.map +1 -0
- package/dist/command-module/legacy/commands/bom.js +92 -0
- package/dist/command-module/legacy/commands/bom.js.map +1 -0
- package/dist/command-module/legacy/commands/cluster.d.ts +12 -0
- package/dist/command-module/legacy/commands/cluster.d.ts.map +1 -0
- package/dist/command-module/legacy/commands/cluster.js +295 -0
- package/dist/command-module/legacy/commands/cluster.js.map +1 -0
- package/dist/command-module/legacy/commands/generate-spec.d.ts +22 -0
- package/dist/command-module/legacy/commands/generate-spec.d.ts.map +1 -0
- package/dist/command-module/legacy/commands/generate-spec.js +216 -0
- package/dist/command-module/legacy/commands/generate-spec.js.map +1 -0
- package/dist/command-module/legacy/commands/init.d.ts +69 -0
- package/dist/command-module/legacy/commands/init.d.ts.map +1 -0
- package/dist/command-module/legacy/commands/init.js +134 -0
- package/dist/command-module/legacy/commands/init.js.map +1 -0
- package/dist/command-module/legacy/commands/quality.d.ts +21 -0
- package/dist/command-module/legacy/commands/quality.d.ts.map +1 -0
- package/dist/command-module/legacy/commands/quality.js +136 -0
- package/dist/command-module/legacy/commands/quality.js.map +1 -0
- package/dist/command-module/legacy/commands/scan.d.ts +33 -0
- package/dist/command-module/legacy/commands/scan.d.ts.map +1 -0
- package/dist/command-module/legacy/commands/scan.js +556 -0
- package/dist/command-module/legacy/commands/scan.js.map +1 -0
- package/dist/command-module/legacy/commands/secrets.d.ts +25 -0
- package/dist/command-module/legacy/commands/secrets.d.ts.map +1 -0
- package/dist/command-module/legacy/commands/secrets.js +211 -0
- package/dist/command-module/legacy/commands/secrets.js.map +1 -0
- package/dist/command-module/legacy/commands/spec-diff.d.ts +12 -0
- package/dist/command-module/legacy/commands/spec-diff.d.ts.map +1 -0
- package/dist/command-module/legacy/commands/spec-diff.js +199 -0
- package/dist/command-module/legacy/commands/spec-diff.js.map +1 -0
- package/dist/command-module/legacy/commands/understand.d.ts +12 -0
- package/dist/command-module/legacy/commands/understand.d.ts.map +1 -0
- package/dist/command-module/legacy/commands/understand.js +195 -0
- package/dist/command-module/legacy/commands/understand.js.map +1 -0
- package/dist/command-module/legacy/config.d.ts +340 -0
- package/dist/command-module/legacy/config.d.ts.map +1 -0
- package/dist/command-module/legacy/config.js +383 -0
- package/dist/command-module/legacy/config.js.map +1 -0
- package/dist/command-module/legacy/effective-options.d.ts +355 -0
- package/dist/command-module/legacy/effective-options.d.ts.map +1 -0
- package/dist/command-module/legacy/effective-options.js +717 -0
- package/dist/command-module/legacy/effective-options.js.map +1 -0
- package/dist/command-module/legacy/file-collection.d.ts +89 -0
- package/dist/command-module/legacy/file-collection.d.ts.map +1 -0
- package/dist/command-module/legacy/file-collection.js +282 -0
- package/dist/command-module/legacy/file-collection.js.map +1 -0
- package/dist/command-module/legacy/finding-paths.d.ts +7 -0
- package/dist/command-module/legacy/finding-paths.d.ts.map +1 -0
- package/dist/command-module/legacy/finding-paths.js +48 -0
- package/dist/command-module/legacy/finding-paths.js.map +1 -0
- package/dist/command-module/legacy/findings-cap.d.ts +65 -0
- package/dist/command-module/legacy/findings-cap.d.ts.map +1 -0
- package/dist/command-module/legacy/findings-cap.js +188 -0
- package/dist/command-module/legacy/findings-cap.js.map +1 -0
- package/dist/command-module/legacy/flow-backed.d.ts +36 -0
- package/dist/command-module/legacy/flow-backed.d.ts.map +1 -0
- package/dist/command-module/legacy/flow-backed.js +58 -0
- package/dist/command-module/legacy/flow-backed.js.map +1 -0
- package/dist/command-module/legacy/formatters/scan-sarif-enrich.d.ts +27 -0
- package/dist/command-module/legacy/formatters/scan-sarif-enrich.d.ts.map +1 -0
- package/dist/command-module/legacy/formatters/scan-sarif-enrich.js +64 -0
- package/dist/command-module/legacy/formatters/scan-sarif-enrich.js.map +1 -0
- package/dist/command-module/legacy/inner-scan-options.d.ts +82 -0
- package/dist/command-module/legacy/inner-scan-options.d.ts.map +1 -0
- package/dist/command-module/legacy/inner-scan-options.js +100 -0
- package/dist/command-module/legacy/inner-scan-options.js.map +1 -0
- package/dist/command-module/legacy/llm-degraded.d.ts +34 -0
- package/dist/command-module/legacy/llm-degraded.d.ts.map +1 -0
- package/dist/command-module/legacy/llm-degraded.js +12 -0
- package/dist/command-module/legacy/llm-degraded.js.map +1 -0
- package/dist/command-module/legacy/parse-failure-gate.d.ts +68 -0
- package/dist/command-module/legacy/parse-failure-gate.d.ts.map +1 -0
- package/dist/command-module/legacy/parse-failure-gate.js +87 -0
- package/dist/command-module/legacy/parse-failure-gate.js.map +1 -0
- package/dist/command-module/legacy/product-scope.d.ts +25 -0
- package/dist/command-module/legacy/product-scope.d.ts.map +1 -0
- package/dist/command-module/legacy/product-scope.js +67 -0
- package/dist/command-module/legacy/product-scope.js.map +1 -0
- package/dist/command-module/legacy/program.d.ts +222 -0
- package/dist/command-module/legacy/program.d.ts.map +1 -0
- package/dist/command-module/legacy/program.js +707 -0
- package/dist/command-module/legacy/program.js.map +1 -0
- package/dist/command-module/legacy/progress.d.ts +76 -0
- package/dist/command-module/legacy/progress.d.ts.map +1 -0
- package/dist/command-module/legacy/progress.js +135 -0
- package/dist/command-module/legacy/progress.js.map +1 -0
- package/dist/command-module/legacy/project-profile.d.ts +41 -0
- package/dist/command-module/legacy/project-profile.d.ts.map +1 -0
- package/dist/command-module/legacy/project-profile.js +27 -0
- package/dist/command-module/legacy/project-profile.js.map +1 -0
- package/dist/command-module/legacy/scan-watchdog.d.ts +68 -0
- package/dist/command-module/legacy/scan-watchdog.d.ts.map +1 -0
- package/dist/command-module/legacy/scan-watchdog.js +127 -0
- package/dist/command-module/legacy/scan-watchdog.js.map +1 -0
- package/dist/command-module/legacy/severity-policy.d.ts +92 -0
- package/dist/command-module/legacy/severity-policy.d.ts.map +1 -0
- package/dist/command-module/legacy/severity-policy.js +190 -0
- package/dist/command-module/legacy/severity-policy.js.map +1 -0
- package/dist/command-module/legacy/source-check.d.ts +291 -0
- package/dist/command-module/legacy/source-check.d.ts.map +1 -0
- package/dist/command-module/legacy/source-check.js +762 -0
- package/dist/command-module/legacy/source-check.js.map +1 -0
- package/dist/command-module/legacy/test-tree-excludes.d.ts +6 -0
- package/dist/command-module/legacy/test-tree-excludes.d.ts.map +1 -0
- package/dist/command-module/legacy/test-tree-excludes.js +38 -0
- package/dist/command-module/legacy/test-tree-excludes.js.map +1 -0
- package/dist/command-module/register.d.ts +23 -0
- package/dist/command-module/register.d.ts.map +1 -0
- package/dist/command-module/register.js +384 -0
- package/dist/command-module/register.js.map +1 -0
- package/dist/specifica/evidence-extractor.d.ts.map +1 -1
- package/dist/specifica/evidence-extractor.js +14 -0
- package/dist/specifica/evidence-extractor.js.map +1 -1
- package/dist/specifica/generator.d.ts +4 -0
- package/dist/specifica/generator.d.ts.map +1 -1
- package/dist/specifica/generator.js +136 -5
- package/dist/specifica/generator.js.map +1 -1
- package/dist/specifica/spec-tree.d.ts +24 -0
- package/dist/specifica/spec-tree.d.ts.map +1 -1
- package/dist/specifica/spec-tree.js +12 -4
- package/dist/specifica/spec-tree.js.map +1 -1
- package/dist/specifica/ts-rule-sources.d.ts +3 -0
- package/dist/specifica/ts-rule-sources.d.ts.map +1 -1
- package/dist/specifica/ts-rule-sources.js +119 -9
- package/dist/specifica/ts-rule-sources.js.map +1 -1
- package/dist/specifica/types.d.ts +27 -1
- package/dist/specifica/types.d.ts.map +1 -1
- package/dist/specifica/use-cases.d.ts.map +1 -1
- package/dist/specifica/use-cases.js +5 -1
- package/dist/specifica/use-cases.js.map +1 -1
- package/dist/utils/file-skip.d.ts +93 -0
- package/dist/utils/file-skip.d.ts.map +1 -1
- package/dist/utils/file-skip.js +321 -0
- package/dist/utils/file-skip.js.map +1 -1
- package/package.json +8 -2
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `circle-ir-ai/cli` — this library's commands as a module for the one CLI,
|
|
3
|
+
* `cognium` 5 (one-CLI plan, design §2; spec §3).
|
|
4
|
+
*
|
|
5
|
+
* The CLI looks for this entry when it starts and, if the package is
|
|
6
|
+
* installed and built against the same `circle-ir` minor, registers these
|
|
7
|
+
* commands next to its own. This package ships no binary and never imports
|
|
8
|
+
* the CLI: the module describes itself (contract.ts, a structural copy of the
|
|
9
|
+
* CLI's `module-contract.ts`) and registers handlers over this library's own
|
|
10
|
+
* functions.
|
|
11
|
+
*
|
|
12
|
+
* Licence states (design §3, OC5/OC6):
|
|
13
|
+
* - state 1 (`circle-ir-ai` installed): the deterministic commands run with no
|
|
14
|
+
* licence and no endpoint, under this package's non-commercial terms, with
|
|
15
|
+
* one notice on stderr the first time one runs;
|
|
16
|
+
* - model-backed paths (`--llm` on any command, and `cognium scan --llm`) run
|
|
17
|
+
* only when asked for by flag and only with an endpoint: `COGNIUM_ENDPOINT`
|
|
18
|
+
* (the CLI's enablement), `--llm-base-url` or `LLM_BASE_URL`, or a verified
|
|
19
|
+
* commercial licence. Without one they refuse with one line and exit 2.
|
|
20
|
+
*/
|
|
21
|
+
import { createRequire } from 'node:module';
|
|
22
|
+
import * as fs from 'node:fs';
|
|
23
|
+
import { COMMAND_NAMES, registerAiCommands } from './register.js';
|
|
24
|
+
import { applyEnvOverrides, buildCliArgs } from './legacy/program.js';
|
|
25
|
+
import { executeScan } from './legacy/commands/scan.js';
|
|
26
|
+
// From the manifest, so the module never announces a version or a `circle-ir`
|
|
27
|
+
// pin other than the one it was published with.
|
|
28
|
+
const manifest = createRequire(import.meta.url)('../../package.json');
|
|
29
|
+
/** `major.minor` of a version or range (`4.24.0`, `^4.24.0` → `4.24`). */
|
|
30
|
+
export function majorMinor(version) {
|
|
31
|
+
const m = /(\d+)\.(\d+)/.exec(version);
|
|
32
|
+
return m ? `${m[1]}.${m[2]}` : null;
|
|
33
|
+
}
|
|
34
|
+
/** True when both name the same `circle-ir` `major.minor`. */
|
|
35
|
+
export function sameCircleIrMinor(a, b) {
|
|
36
|
+
const x = majorMinor(a);
|
|
37
|
+
return x !== null && x === majorMinor(b);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Whether a model may be called for this run: the CLI's endpoint or a
|
|
41
|
+
* commercial licence, or an endpoint the user named on this run.
|
|
42
|
+
*/
|
|
43
|
+
export function modelEndpointConfigured(ctx, opts = {}, env = process.env) {
|
|
44
|
+
return (Boolean(ctx.enablement.endpoint) ||
|
|
45
|
+
ctx.enablement.state === 'commercial' ||
|
|
46
|
+
Boolean(opts.llmBaseUrl) ||
|
|
47
|
+
Boolean(env.LLM_BASE_URL));
|
|
48
|
+
}
|
|
49
|
+
export const MODEL_REFUSAL = 'cognium: --llm needs a model endpoint: set COGNIUM_ENDPOINT, pass --llm-base-url <url> or set LLM_BASE_URL. ' +
|
|
50
|
+
'Nothing was sent anywhere; run without --llm for the deterministic result.';
|
|
51
|
+
let noticeShown = false;
|
|
52
|
+
/** The one state-1 notice, the first time a module command runs (OC6). */
|
|
53
|
+
export function stateNotice(ctx, quiet) {
|
|
54
|
+
if (noticeShown || quiet || ctx.enablement.state === 'commercial')
|
|
55
|
+
return;
|
|
56
|
+
noticeShown = true;
|
|
57
|
+
process.stderr.write(`circle-ir-ai/cli ${manifest.version}: AI commands under ${manifest.license} (non-commercial use); licence state ${ctx.enablement.state}.\n`);
|
|
58
|
+
}
|
|
59
|
+
/** Test seam: forget that the notice was shown. */
|
|
60
|
+
export function __resetNotice() {
|
|
61
|
+
noticeShown = false;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Wrap each command this module registered: the state notice first, and the
|
|
65
|
+
* model refusal when `--llm` is given with no endpoint. Done with commander's
|
|
66
|
+
* `preAction` hook on each command, so the handlers stay as they are.
|
|
67
|
+
*/
|
|
68
|
+
function guardCommands(program, ctx) {
|
|
69
|
+
for (const cmd of program.commands) {
|
|
70
|
+
if (!COMMAND_NAMES.includes(cmd.name()))
|
|
71
|
+
continue;
|
|
72
|
+
cmd.hook('preAction', (_this, actionCmd) => {
|
|
73
|
+
const opts = { ...program.opts(), ...actionCmd.opts() };
|
|
74
|
+
stateNotice(ctx, Boolean(opts.quiet));
|
|
75
|
+
if (opts.llm === true && !modelEndpointConfigured(ctx, { llmBaseUrl: opts.llmBaseUrl })) {
|
|
76
|
+
process.stderr.write(`${MODEL_REFUSAL}\n`);
|
|
77
|
+
process.exit(ctx.exitCodes.usage);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/** Engine option record (keys as typed, e.g. `llm-verify`) → commander-style camelCase opts. */
|
|
83
|
+
export function camelOpts(options) {
|
|
84
|
+
const out = {};
|
|
85
|
+
for (const [k, v] of Object.entries(options)) {
|
|
86
|
+
const key = k.replace(/^-+/, '').replace(/-([a-z])/g, (_m, c) => c.toUpperCase());
|
|
87
|
+
out[key] = v;
|
|
88
|
+
}
|
|
89
|
+
return out;
|
|
90
|
+
}
|
|
91
|
+
export const commandModule = {
|
|
92
|
+
id: 'circle-ir-ai/cli',
|
|
93
|
+
version: manifest.version,
|
|
94
|
+
licence: manifest.license,
|
|
95
|
+
circleIrRange: manifest.dependencies['circle-ir'],
|
|
96
|
+
commands: COMMAND_NAMES,
|
|
97
|
+
// Every command parses the project itself today; none reads ctx.analysis yet
|
|
98
|
+
// (design §2's recorded gap, "wrap only"; not a 5.0 gate).
|
|
99
|
+
gaps: COMMAND_NAMES,
|
|
100
|
+
register(program, ctx) {
|
|
101
|
+
if (!sameCircleIrMinor(ctx.analysis.circleIrVersion, manifest.dependencies['circle-ir'])) {
|
|
102
|
+
// The CLI's loader checks this first; this is the module's own guard.
|
|
103
|
+
throw new Error(`circle-ir-ai/cli ${manifest.version} is built on circle-ir ${manifest.dependencies['circle-ir']}, ` +
|
|
104
|
+
`the CLI runs circle-ir ${ctx.analysis.circleIrVersion}: install the circle-ir-ai release on the same minor`);
|
|
105
|
+
}
|
|
106
|
+
const host = program;
|
|
107
|
+
registerAiCommands(host);
|
|
108
|
+
guardCommands(host, ctx);
|
|
109
|
+
},
|
|
110
|
+
scanLlm: {
|
|
111
|
+
async run(path, options, ctx) {
|
|
112
|
+
const opts = camelOpts(options);
|
|
113
|
+
stateNotice(ctx, Boolean(opts.quiet));
|
|
114
|
+
if (!modelEndpointConfigured(ctx, { llmBaseUrl: opts.llmBaseUrl })) {
|
|
115
|
+
process.stderr.write(`${MODEL_REFUSAL}\n`);
|
|
116
|
+
process.exitCode = ctx.exitCodes.usage;
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
let isDir = true;
|
|
120
|
+
try {
|
|
121
|
+
isDir = fs.statSync(path).isDirectory();
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
// a missing path is the handler's to report
|
|
125
|
+
}
|
|
126
|
+
const args = buildCliArgs({ command: 'scan', target: path, targetIsDirectory: isDir, opts: { ...opts, llm: true } });
|
|
127
|
+
args.noLlm = false;
|
|
128
|
+
applyEnvOverrides(args);
|
|
129
|
+
const code = await executeScan(args);
|
|
130
|
+
process.exitCode = typeof code === 'number' ? code : 0;
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
export default commandModule;
|
|
135
|
+
export { COMMAND_NAMES } from './register.js';
|
|
136
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/command-module/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAG5C,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAsB,MAAM,qBAAqB,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAQxD,8EAA8E;AAC9E,gDAAgD;AAChD,MAAM,QAAQ,GAAG,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,oBAAoB,CAAa,CAAC;AAElF,0EAA0E;AAC1E,MAAM,UAAU,UAAU,CAAC,OAAe;IACxC,MAAM,CAAC,GAAG,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,C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YACT,CAAC;YACD,IAAI,KAAK,GAAG,IAAI,CAAC;YACjB,IAAI,CAAC;gBACH,KAAK,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;YAC1C,CAAC;YAAC,MAAM,CAAC;gBACP,4CAA4C;YAC9C,CAAC;YACD,MAAM,IAAI,GAAG,YAAY,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;YACrH,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;YACnB,iBAAiB,CAAC,IAAI,CAAC,CAAC;YACxB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC;YACrC,OAAO,CAAC,QAAQ,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACzD,CAAC;KACF;CACF,CAAC;AAEF,eAAe,aAAa,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Argument Parser
|
|
3
|
+
*/
|
|
4
|
+
export type OutputFormat = 'json' | 'summary' | 'sarif' | 'markdown' | 'csv';
|
|
5
|
+
export type Command = 'analyze' | 'benchmark' | 'scan' | 'health' | 'secrets' | 'dead-code' | 'generate-spec' | 'analyze-skill' | 'metrics' | 'trust' | 'compare' | 'quality' | 'understand' | 'spec-diff' | 'cluster' | 'bom' | 'selectors' | 'grid' | 'blast-radius';
|
|
6
|
+
export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
7
|
+
/** analyze-skill --fail-on (cognium-ai#584): severity floor for a non-zero exit; `none` disables. */
|
|
8
|
+
export type SkillFailOn = 'critical' | 'high' | 'medium' | 'low' | 'none';
|
|
9
|
+
export declare const SKILL_FAIL_ON_VALUES: readonly SkillFailOn[];
|
|
10
|
+
export type BundleType = 'jr-dev' | 'sr-dev' | 'architect' | 'security-review' | 'full-review';
|
|
11
|
+
export interface CliArgs {
|
|
12
|
+
command: Command;
|
|
13
|
+
file: string | null;
|
|
14
|
+
directory: string | null;
|
|
15
|
+
format: OutputFormat;
|
|
16
|
+
output: string | null;
|
|
17
|
+
config: string | null;
|
|
18
|
+
include: string[];
|
|
19
|
+
exclude: string[];
|
|
20
|
+
exitCode: boolean;
|
|
21
|
+
quiet: boolean;
|
|
22
|
+
help: boolean;
|
|
23
|
+
version: boolean;
|
|
24
|
+
logLevel: LogLevel | null;
|
|
25
|
+
discoverPatterns: boolean;
|
|
26
|
+
patternThreshold: number;
|
|
27
|
+
noLlm: boolean;
|
|
28
|
+
/** cognium-ai#116 — output tier: 'static' | 'enriched' (default) | 'all'. */
|
|
29
|
+
tier?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Tristate `--llm-verify` / `--no-llm-verify` (cognium-ai#124).
|
|
32
|
+
* `null` = user passed neither (effective-options resolves the
|
|
33
|
+
* cognium.config.json#llm.verify field or the built-in default of
|
|
34
|
+
* `true` when LLM is enabled).
|
|
35
|
+
* `true` / `false` = explicit user opt-in / opt-out.
|
|
36
|
+
*/
|
|
37
|
+
llmVerify: boolean | null;
|
|
38
|
+
llmBaseUrl: string | null;
|
|
39
|
+
llmApiKey: string | null;
|
|
40
|
+
llmModel: string | null;
|
|
41
|
+
/**
|
|
42
|
+
* cognium-ai#151 — per-phase model overrides for the two-model split.
|
|
43
|
+
* Each maps onto an engine env var:
|
|
44
|
+
* llmDiscoveryModel → LLM_DISCOVERY_MODEL (source/sink enrichment)
|
|
45
|
+
* llmVerificationModel → LLM_VERIFICATION_MODEL (exploitability check)
|
|
46
|
+
* llmComponentModel → LLM_COMPONENT_MODEL (component understanding;
|
|
47
|
+
* drives both `cluster`
|
|
48
|
+
* Phase 1 + Phase 2 and
|
|
49
|
+
* `generate-spec`)
|
|
50
|
+
* If a phase-specific flag is unset, the engine falls back to the
|
|
51
|
+
* universal `--llm-model` / `LLM_DISCOVERY_MODEL`. All three null =
|
|
52
|
+
* legacy single-model behaviour.
|
|
53
|
+
*/
|
|
54
|
+
llmDiscoveryModel: string | null;
|
|
55
|
+
llmVerificationModel: string | null;
|
|
56
|
+
llmComponentModel: string | null;
|
|
57
|
+
/**
|
|
58
|
+
* cognium-ai#152 — opinionated preset bundle. Currently:
|
|
59
|
+
* `fast` → OpenRouter base URL + gemma-3-12b-it discovery +
|
|
60
|
+
* gpt-4o-mini verification (the Arm C config validated in
|
|
61
|
+
* SPLIT-PARITY-2026-06-29.md: +0.7% findings, -12.3% input
|
|
62
|
+
* tokens, -31% output tokens, -55% wall-clock vs Arm A).
|
|
63
|
+
* Preset env-var assignments are *non-clobbering*: explicit
|
|
64
|
+
* `--llm-base-url` / `--llm-discovery-model` / `--llm-verification-model`
|
|
65
|
+
* always win, so users can layer overrides on top of the preset.
|
|
66
|
+
* `LLM_API_KEY` and `LLM_COMPONENT_MODEL` are intentionally left alone.
|
|
67
|
+
* Null = user did not pass `--preset`.
|
|
68
|
+
*/
|
|
69
|
+
preset: string | null;
|
|
70
|
+
/** Per-call LLM timeout in seconds (#15). Maps to LLM_TIMEOUT_MS. */
|
|
71
|
+
llmTimeout: number | null;
|
|
72
|
+
/** Completion token budget (#717). Maps to LLM_MAX_TOKENS. */
|
|
73
|
+
llmMaxTokens: number | null;
|
|
74
|
+
/**
|
|
75
|
+
* `--deep`: enable verbose per-attempt LLM debug logging (cognium-ai#87).
|
|
76
|
+
* When true, effective-options wires `LLM_LOG_JSONL` (if unset) to a
|
|
77
|
+
* timestamped path under `.cognium/` and sets `LLM_DEEP=1` so the engine
|
|
78
|
+
* emits `[LLM-deep]` lines to stderr in addition to JSONL.
|
|
79
|
+
*/
|
|
80
|
+
deep: boolean;
|
|
81
|
+
language: string | null;
|
|
82
|
+
threads: number;
|
|
83
|
+
bomNoUsage?: boolean;
|
|
84
|
+
bomCoverage?: boolean;
|
|
85
|
+
selectorsUsage?: boolean;
|
|
86
|
+
gridSha?: string;
|
|
87
|
+
gridPacks?: string[];
|
|
88
|
+
blastItems?: string;
|
|
89
|
+
blastBatch?: string;
|
|
90
|
+
blastMaxHops?: number;
|
|
91
|
+
blastTests?: boolean;
|
|
92
|
+
threadsExplicit?: boolean;
|
|
93
|
+
bundle: BundleType | null;
|
|
94
|
+
expectedResults: string | null;
|
|
95
|
+
limit: number | null;
|
|
96
|
+
categories: string[];
|
|
97
|
+
parallel: number | null;
|
|
98
|
+
cache: boolean;
|
|
99
|
+
cacheDir: string | null;
|
|
100
|
+
clearCache: boolean;
|
|
101
|
+
streamOutput: string | null;
|
|
102
|
+
memoryEfficient: boolean;
|
|
103
|
+
specModel: string | null;
|
|
104
|
+
specOverwrite: boolean;
|
|
105
|
+
specSkip: boolean;
|
|
106
|
+
specNoBackup: boolean;
|
|
107
|
+
specDesign: boolean;
|
|
108
|
+
specPrinciples: boolean;
|
|
109
|
+
specTasks: boolean;
|
|
110
|
+
specDesignLLM: boolean;
|
|
111
|
+
specPrinciplesLLM: boolean;
|
|
112
|
+
specTasksLLM: boolean;
|
|
113
|
+
specDir: string | null;
|
|
114
|
+
crossArtifact?: boolean;
|
|
115
|
+
verification?: boolean;
|
|
116
|
+
minConfidence?: number;
|
|
117
|
+
minSeverity?: 'critical' | 'high' | 'medium' | 'low' | 'info';
|
|
118
|
+
severity: 'critical' | 'high' | 'medium' | 'low' | null;
|
|
119
|
+
excludeTests: boolean;
|
|
120
|
+
disablePass: string[];
|
|
121
|
+
fileTimeout: number;
|
|
122
|
+
maxScanTime: number | null;
|
|
123
|
+
isolateParse: boolean;
|
|
124
|
+
maxFiles: number | null;
|
|
125
|
+
/**
|
|
126
|
+
* #114: opt-in switch that excludes demo/sample/playground sub-trees
|
|
127
|
+
* from file collection. Null = "user did not pass the CLI flag"
|
|
128
|
+
* (effective-options merges cognium.config.json#scan.excludeDemos
|
|
129
|
+
* then built-in default false). Bool fields go through Commander's
|
|
130
|
+
* `--no-foo` synthesizer so we keep the tristate to distinguish
|
|
131
|
+
* "explicit false" from "missing".
|
|
132
|
+
*/
|
|
133
|
+
excludeDemos: boolean | null;
|
|
134
|
+
/**
|
|
135
|
+
* #114: glob patterns that mark a file as "demo / sample / playground".
|
|
136
|
+
* Empty = "user did not override on the CLI" (effective-options uses
|
|
137
|
+
* cognium.config.json#scan.demoPathPatterns then the built-in
|
|
138
|
+
* `DEFAULT_DEMO_PATH_PATTERNS` set).
|
|
139
|
+
*/
|
|
140
|
+
demoPathPatterns: string[];
|
|
141
|
+
/**
|
|
142
|
+
* cognium-ai#173 (2.28.3): opt-out switch for dev-tooling / build /
|
|
143
|
+
* CI path exclusion. Null = "user did not pass the CLI flag"
|
|
144
|
+
* (effective-options merges cognium.config.json#scan.excludeDevTooling
|
|
145
|
+
* then the built-in default `true`). Bool goes through Commander's
|
|
146
|
+
* `--no-foo` synthesizer so we keep the tristate to distinguish
|
|
147
|
+
* "explicit false" from "missing".
|
|
148
|
+
*/
|
|
149
|
+
excludeDevTooling: boolean | null;
|
|
150
|
+
/**
|
|
151
|
+
* Product scope (circle-ir-ai's rule): `--all-paths` turns it off, so scan,
|
|
152
|
+
* quality, trust and generate-spec read tests, fixtures, examples,
|
|
153
|
+
* harnesses, benchmarks, tooling, vendored and generated code too. Same as
|
|
154
|
+
* `SCOPE_ALL_PATHS=1`. Optional so older CliArgs builders still resolve.
|
|
155
|
+
*/
|
|
156
|
+
allPaths?: boolean;
|
|
157
|
+
/**
|
|
158
|
+
* cognium-ai#1090 (review of #1094): `--allow-empty` → true, `--no-allow-empty`
|
|
159
|
+
* → false, neither → undefined (cognium.config.json#allowEmpty, then false).
|
|
160
|
+
* When true, scan / quality / trust / generate-spec exit 0 with the normal
|
|
161
|
+
* empty report when there is nothing to scan, instead of exit 2.
|
|
162
|
+
*/
|
|
163
|
+
allowEmpty?: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* cognium-ai#614: cap `flow_backed: false` findings (a source and a sink
|
|
166
|
+
* paired without a taint flow) at `medium`. Null = "user did not pass the
|
|
167
|
+
* CLI flag" (effective-options merges cognium.config.json#scan.capUnbacked,
|
|
168
|
+
* then the built-in default `true`). `--no-cap-unbacked` → false.
|
|
169
|
+
* Optional so test-only CliArgs builders that pre-date it still resolve.
|
|
170
|
+
*/
|
|
171
|
+
capUnbacked?: boolean | null;
|
|
172
|
+
/**
|
|
173
|
+
* cognium-ai#173 (2.28.3): glob patterns that mark a file as
|
|
174
|
+
* build / CI / dev-tooling. Empty = "user did not override on the
|
|
175
|
+
* CLI" (effective-options uses cognium.config.json#scan.devToolingPathPatterns
|
|
176
|
+
* then the built-in `DEFAULT_DEV_TOOLING_PATH_PATTERNS` set).
|
|
177
|
+
*/
|
|
178
|
+
devToolingPathPatterns: string[];
|
|
179
|
+
/**
|
|
180
|
+
* cognium-ai#173 (2.28.3): `--exclude-paths` extra glob patterns for
|
|
181
|
+
* corpus runners. Additive on top of user `--exclude`, config
|
|
182
|
+
* `exclude`, dev-tooling defaults, and CP_EXCLUDE_PATHS env var.
|
|
183
|
+
* Empty = user did not pass the CLI flag.
|
|
184
|
+
*/
|
|
185
|
+
excludePaths: string[];
|
|
186
|
+
/**
|
|
187
|
+
* #113: per-(file, finding.type) cap applied after scanDirectory()
|
|
188
|
+
* returns and before serialization. Null = "user did not pass the
|
|
189
|
+
* CLI flag" — effective-options resolves
|
|
190
|
+
* cognium.config.json#scan.maxFindingsPerFilePerType then the
|
|
191
|
+
* built-in default (5). Set to `0` to disable the cap entirely.
|
|
192
|
+
*/
|
|
193
|
+
maxFindingsPerFilePerType: number | null;
|
|
194
|
+
pathB: string | null;
|
|
195
|
+
history: boolean | null;
|
|
196
|
+
maxCommits: number | null;
|
|
197
|
+
includeCategory: string[];
|
|
198
|
+
excludeCategory: string[];
|
|
199
|
+
llmVerifyBudget: number | null;
|
|
200
|
+
historyBudgetMs: number | null;
|
|
201
|
+
perCommitTimeoutMs: number | null;
|
|
202
|
+
maxDiffBytes: number | null;
|
|
203
|
+
includeTests: boolean;
|
|
204
|
+
publicAsEntry: boolean;
|
|
205
|
+
top: number | null;
|
|
206
|
+
full: boolean;
|
|
207
|
+
metricCategory: string[];
|
|
208
|
+
role: string[];
|
|
209
|
+
securityOnly: boolean;
|
|
210
|
+
healthSecurity: boolean;
|
|
211
|
+
healthSecrets: boolean;
|
|
212
|
+
healthDeadCode: boolean;
|
|
213
|
+
healthQuality: boolean;
|
|
214
|
+
healthPerformance: boolean;
|
|
215
|
+
threshold: number;
|
|
216
|
+
/** trust: cognium-ai#580 — false only with --no-fail-on-blocked. */
|
|
217
|
+
failOnBlocked?: boolean;
|
|
218
|
+
/** analyze-skill (cognium-ai#584, default critical) / compare (cognium-ai#585, new findings in B, default high): severity floor for a non-zero exit. */
|
|
219
|
+
failOn?: SkillFailOn;
|
|
220
|
+
/**
|
|
221
|
+
* cognium-ai#130: forced ProjectProfile (ADR-008 5×5 matrix, e.g.
|
|
222
|
+
* `library/production`, `application/sample`). Highest-precedence
|
|
223
|
+
* input — overrides cognium.config.json#profile and the
|
|
224
|
+
* `@cognium/project-profile-detect` walker.
|
|
225
|
+
*
|
|
226
|
+
* `null` = user did not pass `--profile`; effective-options falls
|
|
227
|
+
* through to config → walker auto-detect → engine fallback
|
|
228
|
+
* (`undefined`, which makes circle-ir-ai 2.19.0 auto-detect itself).
|
|
229
|
+
*
|
|
230
|
+
* Only consumed by the 5 LLM-eligible commands that ship
|
|
231
|
+
* SastFinding output: scan, trust, quality, health, dead-code.
|
|
232
|
+
*/
|
|
233
|
+
profile: string | null;
|
|
234
|
+
/**
|
|
235
|
+
* cognium-ai#130: repeatable `<glob>=<shape/env>` per-path overrides
|
|
236
|
+
* (e.g. `--profile-override "samples/**=application/sample"`).
|
|
237
|
+
* Each entry is parsed in effective-options into the
|
|
238
|
+
* `Record<string, ProjectProfile>` map forwarded to the walker.
|
|
239
|
+
*
|
|
240
|
+
* Empty = user did not pass `--profile-override`; effective-options
|
|
241
|
+
* falls through to cognium.config.json#profileOverrides.
|
|
242
|
+
*/
|
|
243
|
+
profileOverrides: string[];
|
|
244
|
+
/**
|
|
245
|
+
* cognium-ai#154 (L5c) — cluster policy profile applied to the scan.
|
|
246
|
+
* One of `application` | `library` | `framework` | `tool`.
|
|
247
|
+
*
|
|
248
|
+
* When set, the CLI loads the matching preset from
|
|
249
|
+
* `cluster-policies.ts` and forwards it verbatim as
|
|
250
|
+
* `ScanOptions.contextProfile` (uniform per-cluster policy). The
|
|
251
|
+
* engine consumes it in `applyClusterPolicies()` post-hoc filter and
|
|
252
|
+
* echoes it into `ScanMeta.contextProfile` for sweep telemetry (P2).
|
|
253
|
+
*
|
|
254
|
+
* `null` = user did not pass `--cluster-policy`; the engine falls
|
|
255
|
+
* through to `DEFAULT_CLUSTER_POLICY` (byte-identical to pre-2.28.0
|
|
256
|
+
* cognium-ai behavior).
|
|
257
|
+
*
|
|
258
|
+
* Only consumed by the `scan` command in this sprint (L5c).
|
|
259
|
+
* Extension to trust/quality/health/dead-code is L5d.
|
|
260
|
+
*/
|
|
261
|
+
clusterPolicy: string | null;
|
|
262
|
+
}
|
|
263
|
+
//# sourceMappingURL=args.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../../src/command-module/legacy/args.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,UAAU,GAAG,KAAK,CAAC;AAC7E,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,WAAW,GAAG,eAAe,GAAG,eAAe,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,YAAY,GAAG,WAAW,GAAG,SAAS,GAAG,KAA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CAAC;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"args.js","sourceRoot":"","sources":["../../../src/command-module/legacy/args.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,MAAM,CAAC,MAAM,oBAAoB,GAA2B,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache I/O telemetry for `scan` output (cognium-ai#572).
|
|
3
|
+
*
|
|
4
|
+
* The engine counts cache writes, write failures and read errors per
|
|
5
|
+
* namespace (`getCacheFailureCounters()`, circle-ir-ai 4.24.0). This puts them
|
|
6
|
+
* in the scan result as `meta.cache`, so a scan whose cache writes all failed
|
|
7
|
+
* no longer produces the same artifact as one whose writes all landed.
|
|
8
|
+
*
|
|
9
|
+
* An engine that already reports `meta.cache` itself is taken at its word.
|
|
10
|
+
* Otherwise the block is built here from the process-wide counters, which for
|
|
11
|
+
* the CLI (one scan per process) are the scan's own.
|
|
12
|
+
*/
|
|
13
|
+
import { getCacheFailureCounters } from '../../index.js';
|
|
14
|
+
export interface CacheNamespaceTelemetry {
|
|
15
|
+
backend: string;
|
|
16
|
+
sets: number;
|
|
17
|
+
setFailures: number;
|
|
18
|
+
getErrors: number;
|
|
19
|
+
lastError?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface CacheTelemetry {
|
|
22
|
+
/** Backend kind(s) in use. Comma-joined when namespaces differ. */
|
|
23
|
+
backend: string;
|
|
24
|
+
/** Successful cache writes, all namespaces. */
|
|
25
|
+
writes: number;
|
|
26
|
+
/** Failed cache writes. Non-zero means results were not persisted. */
|
|
27
|
+
writeFailures: number;
|
|
28
|
+
/** Failed cache reads (not misses). */
|
|
29
|
+
readErrors: number;
|
|
30
|
+
lastError?: string;
|
|
31
|
+
byNamespace: Record<string, CacheNamespaceTelemetry>;
|
|
32
|
+
}
|
|
33
|
+
type Counters = ReturnType<typeof getCacheFailureCounters>;
|
|
34
|
+
/** Totals and per-namespace counters since process start; idle namespaces are left out. */
|
|
35
|
+
export declare function cacheTelemetryFromCounters(counters: Counters): CacheTelemetry;
|
|
36
|
+
/**
|
|
37
|
+
* The cache block for a scan result, or `undefined` when there is nothing to
|
|
38
|
+
* report: present on an LLM scan, and on a static scan only when a cache read
|
|
39
|
+
* or write failed (so static output is unchanged while the cache is healthy).
|
|
40
|
+
*/
|
|
41
|
+
export declare function resolveScanCacheTelemetry(meta: unknown, llmEnabled: boolean, counters?: Counters): CacheTelemetry | undefined;
|
|
42
|
+
/** One stderr line for a scan whose cache writes failed. */
|
|
43
|
+
export declare function cacheWriteFailureWarning(cache: CacheTelemetry): string;
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=cache-telemetry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-telemetry.d.ts","sourceRoot":"","sources":["../../../src/command-module/legacy/cache-telemetry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,mEAAmE;IACnE,OAAO,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,aAAa,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;CACtD;AAED,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE3D,2FAA2F;AAC3F,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,QAAQ,GAAG,cAAc,CAkC7E;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,OAAO,EACb,UAAU,EAAE,OAAO,EACnB,QAAQ,GAAE,QAAoC,GAC7C,cAAc,GAAG,SAAS,CAK5B;AAED,4DAA4D;AAC5D,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,CAYtE"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache I/O telemetry for `scan` output (cognium-ai#572).
|
|
3
|
+
*
|
|
4
|
+
* The engine counts cache writes, write failures and read errors per
|
|
5
|
+
* namespace (`getCacheFailureCounters()`, circle-ir-ai 4.24.0). This puts them
|
|
6
|
+
* in the scan result as `meta.cache`, so a scan whose cache writes all failed
|
|
7
|
+
* no longer produces the same artifact as one whose writes all landed.
|
|
8
|
+
*
|
|
9
|
+
* An engine that already reports `meta.cache` itself is taken at its word.
|
|
10
|
+
* Otherwise the block is built here from the process-wide counters, which for
|
|
11
|
+
* the CLI (one scan per process) are the scan's own.
|
|
12
|
+
*/
|
|
13
|
+
import { getCacheFailureCounters } from '../../index.js';
|
|
14
|
+
/** Totals and per-namespace counters since process start; idle namespaces are left out. */
|
|
15
|
+
export function cacheTelemetryFromCounters(counters) {
|
|
16
|
+
const byNamespace = {};
|
|
17
|
+
const backends = new Set();
|
|
18
|
+
let writes = 0;
|
|
19
|
+
let writeFailures = 0;
|
|
20
|
+
let readErrors = 0;
|
|
21
|
+
let lastError;
|
|
22
|
+
for (const ns of Object.keys(counters).sort()) {
|
|
23
|
+
const c = counters[ns];
|
|
24
|
+
if (c.sets === 0 && c.setFailures === 0 && c.getErrors === 0)
|
|
25
|
+
continue;
|
|
26
|
+
const failed = c.setFailures > 0 || c.getErrors > 0;
|
|
27
|
+
byNamespace[ns] = {
|
|
28
|
+
backend: c.backend,
|
|
29
|
+
sets: c.sets,
|
|
30
|
+
setFailures: c.setFailures,
|
|
31
|
+
getErrors: c.getErrors,
|
|
32
|
+
...(failed && c.lastError ? { lastError: c.lastError } : {}),
|
|
33
|
+
};
|
|
34
|
+
backends.add(c.backend);
|
|
35
|
+
writes += c.sets;
|
|
36
|
+
writeFailures += c.setFailures;
|
|
37
|
+
readErrors += c.getErrors;
|
|
38
|
+
if (failed && c.lastError)
|
|
39
|
+
lastError = c.lastError;
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
backend: [...backends].sort().join(','),
|
|
43
|
+
writes,
|
|
44
|
+
writeFailures,
|
|
45
|
+
readErrors,
|
|
46
|
+
...(lastError ? { lastError } : {}),
|
|
47
|
+
byNamespace,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The cache block for a scan result, or `undefined` when there is nothing to
|
|
52
|
+
* report: present on an LLM scan, and on a static scan only when a cache read
|
|
53
|
+
* or write failed (so static output is unchanged while the cache is healthy).
|
|
54
|
+
*/
|
|
55
|
+
export function resolveScanCacheTelemetry(meta, llmEnabled, counters = getCacheFailureCounters()) {
|
|
56
|
+
const fromEngine = meta?.cache;
|
|
57
|
+
if (fromEngine && typeof fromEngine.writeFailures === 'number')
|
|
58
|
+
return fromEngine;
|
|
59
|
+
const built = cacheTelemetryFromCounters(counters);
|
|
60
|
+
return llmEnabled || built.writeFailures > 0 || built.readErrors > 0 ? built : undefined;
|
|
61
|
+
}
|
|
62
|
+
/** One stderr line for a scan whose cache writes failed. */
|
|
63
|
+
export function cacheWriteFailureWarning(cache) {
|
|
64
|
+
const namespaces = Object.entries(cache.byNamespace)
|
|
65
|
+
.filter(([, c]) => c.setFailures > 0)
|
|
66
|
+
.map(([ns, c]) => `${ns}=${c.setFailures}`)
|
|
67
|
+
.join(', ');
|
|
68
|
+
const detail = [namespaces, cache.backend ? `backend ${cache.backend}` : ''].filter(Boolean).join('; ');
|
|
69
|
+
return (`[warn] cognium-ai#572: ${cache.writeFailures} cache write(s) failed` +
|
|
70
|
+
(detail ? ` (${detail})` : '') +
|
|
71
|
+
(cache.lastError ? `: ${cache.lastError}` : '') +
|
|
72
|
+
' — results were not cached, so the next scan repeats this work (meta.cache).');
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=cache-telemetry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-telemetry.js","sourceRoot":"","sources":["../../../src/command-module/legacy/cache-telemetry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAyBzD,2FAA2F;AAC3F,MAAM,UAAU,0BAA0B,CAAC,QAAkB;IAC3D,MAAM,WAAW,GAA4C,EAAE,CAAC;IAChE,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;IACnC,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAI,aAAa,GAAG,CAAC,CAAC;IACtB,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,IAAI,SAA6B,CAAC;IAElC,KAAK,MAAM,EAAE,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QAC9C,MAAM,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;QACvB,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,WAAW,KAAK,CAAC,IAAI,CAAC,CAAC,SAAS,KAAK,CAAC;YAAE,SAAS;QACvE,MAAM,MAAM,GAAG,CAAC,CAAC,WAAW,GAAG,CAAC,IAAI,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC;QACpD,WAAW,CAAC,EAAE,CAAC,GAAG;YAChB,OAAO,EAAE,CAAC,CAAC,OAAO;YAClB,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,WAAW,EAAE,CAAC,CAAC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AAC,KAAqB;IAC5D,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC;SACjD,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,GAAG,CAAC,CAAC;SACpC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;SAC1C,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,MAAM,MAAM,GAAG,CAAC,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxG,OAAO,CACL,0BAA0B,KAAK,CAAC,aAAa,wBAAwB;QACrE,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9B,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/C,8EAA8E,CAC/E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cognium-ai#154 (Sprint L5c) — cluster policy presets.
|
|
3
|
+
*
|
|
4
|
+
* Maps the `--cluster-policy <profile>` CLI flag to a
|
|
5
|
+
* `ContextProfile` value plus (in the future) a per-cluster
|
|
6
|
+
* `ClusterPolicy` map. Currently ships only the uniform-per-scan
|
|
7
|
+
* shape; per-cluster overrides are deferred to L5d.
|
|
8
|
+
*
|
|
9
|
+
* The engine (circle-ir-ai 2.33.0) consumes `contextProfile` via
|
|
10
|
+
* `ScanOptions.contextProfile` and:
|
|
11
|
+
* 1. Echoes it into `ScanMeta.contextProfile` for sweep telemetry
|
|
12
|
+
* (P2 of the operating principles locked 2026-06-24).
|
|
13
|
+
* 2. Applies it as the uniform `ClusterPolicy` in
|
|
14
|
+
* `applyClusterPolicies()` post-hoc filter — sink-whitelist only
|
|
15
|
+
* today; sourceWhitelist + llmEnabled hooks are documented no-ops
|
|
16
|
+
* until L5d wires them into workflow.ts pre-LLM.
|
|
17
|
+
*
|
|
18
|
+
* Preset rationale (from the L5c plan):
|
|
19
|
+
*
|
|
20
|
+
* - `application` (default) — DEFAULT_CLUSTER_POLICY verbatim:
|
|
21
|
+
* `sourceWhitelist=[]` (accept every discovered source),
|
|
22
|
+
* `sinkWhitelist=[]` (accept every discovered sink),
|
|
23
|
+
* `llmEnabled=true`. Byte-identical to pre-2.28.0 behavior.
|
|
24
|
+
*
|
|
25
|
+
* - `library` — tighten source narrowing for library-typed repos.
|
|
26
|
+
* Drops JavaBeans introspection, annotation processors, IDL/DSL
|
|
27
|
+
* parsers, JPQL rewriters, classpath config readers (the dominant
|
|
28
|
+
* FP class in the 2026-06-24 top-100 Java baseline). Uses
|
|
29
|
+
* `contextProfile='library'` so downstream consumers can key off
|
|
30
|
+
* the label.
|
|
31
|
+
*
|
|
32
|
+
* - `framework` — hybrid. Application defaults today; L5d layer will
|
|
33
|
+
* flag reflective/DI sinks as low-confidence.
|
|
34
|
+
*
|
|
35
|
+
* - `tool` — application-like but drops test-utility sources
|
|
36
|
+
* (mock fixtures, benchmark harness inputs). Same shape as
|
|
37
|
+
* application today; the `contextProfile` label distinguishes it
|
|
38
|
+
* for future sweep-diff attribution.
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
* Valid values for the `--cluster-policy` flag. Matches
|
|
42
|
+
* `ContextProfile` in circle-ir-ai/src/cluster/cluster.ts.
|
|
43
|
+
*/
|
|
44
|
+
export type ClusterPolicyName = 'application' | 'library' | 'framework' | 'tool';
|
|
45
|
+
/**
|
|
46
|
+
* Resolves a CLI-supplied policy name to the `ContextProfile` value
|
|
47
|
+
* forwarded to `ScanOptions.contextProfile`.
|
|
48
|
+
*
|
|
49
|
+
* Returns `undefined` for `null` / unknown input so the caller can
|
|
50
|
+
* cleanly skip the `ScanOptions.contextProfile` field (which in turn
|
|
51
|
+
* skips the `ScanMeta.contextProfile` echo — matching the "user did
|
|
52
|
+
* not pass the flag" contract documented in scanner.ts).
|
|
53
|
+
*/
|
|
54
|
+
export declare function resolveContextProfile(policy: string | null): ClusterPolicyName | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* cognium-ai#205 — derive a `ContextProfile` from a resolved
|
|
57
|
+
* ProjectProfile string (`'library/production'` → `'library'`).
|
|
58
|
+
*
|
|
59
|
+
* Bridges the two repo-kind systems: `--profile <shape>/<env>` (L3
|
|
60
|
+
* findings-cap + ADR-008) and `--cluster-policy <shape>` (L5c →
|
|
61
|
+
* `ScanOptions.contextProfile` → the #200 verifier prompt guidance).
|
|
62
|
+
* Before this bridge, `--profile library/production` never reached
|
|
63
|
+
* the LLM verifier, which then reasoned with the neutral fallback and
|
|
64
|
+
* kept library-param findings an explicit `--cluster-policy library`
|
|
65
|
+
* would have dropped (measured on gson: 18 crit → 0, see #205).
|
|
66
|
+
*
|
|
67
|
+
* The ADR-008 shape vocabulary is a superset of the four
|
|
68
|
+
* ClusterPolicy names; shapes outside the four (e.g. `unknown`)
|
|
69
|
+
* return `undefined` — engine default, no warning, since the user
|
|
70
|
+
* never asked for a cluster policy by name.
|
|
71
|
+
*/
|
|
72
|
+
export declare function contextProfileFromProjectProfile(profile: string | undefined): ClusterPolicyName | undefined;
|
|
73
|
+
//# sourceMappingURL=cluster-policies.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cluster-policies.d.ts","sourceRoot":"","sources":["../../../src/command-module/legacy/cluster-policies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,MAAM,CAAC;AAEjF;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,GAAG,IAAI,GACpB,iBAAiB,GAAG,SAAS,CAe/B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,iBAAiB,GAAG,SAAS,CAW/B"}
|