peaks-loop 4.1.10 → 4.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +78 -0
  3. package/README-en.md +1 -1
  4. package/README.md +1 -1
  5. package/dist/cli/commands/code-review-commands.d.ts +1 -1
  6. package/dist/cli/commands/code-review-commands.js +23 -37
  7. package/dist/cli/commands/code-review-ocr-delegate-record.d.ts +3 -0
  8. package/dist/cli/commands/code-review-ocr-delegate-record.js +73 -0
  9. package/dist/cli/commands/code-review-ocr-delegate.d.ts +12 -0
  10. package/dist/cli/commands/code-review-ocr-delegate.js +140 -0
  11. package/dist/cli/commands/code-review-run-ocr-18.d.ts +11 -0
  12. package/dist/cli/commands/code-review-run-ocr-18.js +127 -0
  13. package/dist/services/code/orchestrator-can-do-probes.d.ts +10 -0
  14. package/dist/services/code/orchestrator-can-do-probes.js +12 -2
  15. package/dist/services/lint/detect-ocr-18.js +1 -1
  16. package/dist/services/lint/ocr-18-acquire.d.ts +1 -1
  17. package/dist/services/lint/ocr-18-acquire.js +2 -2
  18. package/dist/services/lint/ocr-18-allowlist.d.ts +30 -0
  19. package/dist/services/lint/ocr-18-allowlist.js +165 -0
  20. package/dist/services/lint/ocr-18-delegate-packet.d.ts +84 -0
  21. package/dist/services/lint/ocr-18-delegate-packet.js +175 -0
  22. package/dist/services/lint/ocr-18-delegate-payload.d.ts +67 -0
  23. package/dist/services/lint/ocr-18-delegate-payload.js +208 -0
  24. package/dist/services/lint/ocr-18-delegate-record.d.ts +42 -0
  25. package/dist/services/lint/ocr-18-delegate-record.js +223 -0
  26. package/dist/services/lint/ocr-18-language-routing.d.ts +96 -0
  27. package/dist/services/lint/ocr-18-language-routing.js +148 -0
  28. package/dist/services/lint/ocr-18-multi.d.ts +54 -0
  29. package/dist/services/lint/ocr-18-multi.js +184 -0
  30. package/dist/services/lint/ocr-multilang-adapter.d.ts +45 -7
  31. package/dist/services/lint/ocr-multilang-adapter.js +133 -94
  32. package/dist/services/scan/archetype-service.js +24 -8
  33. package/dist/services/scan/frontend-evidence.d.ts +19 -0
  34. package/dist/services/scan/frontend-evidence.js +142 -0
  35. package/dist/services/scan/scan-types.d.ts +8 -1
  36. package/package.json +10 -10
  37. package/skills/bee/peaks-rd/SKILL.md +32 -0
  38. package/skills/bee/peaks-rd/references/ocr-multilang-1.8.md +314 -111
@@ -0,0 +1,208 @@
1
+ /**
2
+ * OCR 1.x delegation — the pinned CLI's payloads, parsed at their boundary.
3
+ *
4
+ * `ocr delegate preview` returns the file selection; `ocr delegate rule` returns
5
+ * the resolved rule text per pattern. Neither calls an LLM and neither reads a
6
+ * key. These parsers are strict on purpose: a `comments[]` review payload is NOT
7
+ * a delegation spec, and reading one as the other is the defect this slice fixes.
8
+ */
9
+ import { invokeOcr, OCR_18_PACKAGE, rangeArgs } from './ocr-multilang-adapter.js';
10
+ export function buildDelegatePreviewArgs(range) {
11
+ return [
12
+ '--package',
13
+ OCR_18_PACKAGE,
14
+ '--',
15
+ 'ocr',
16
+ 'delegate',
17
+ 'preview',
18
+ ...rangeArgs(range),
19
+ '--format',
20
+ 'json'
21
+ ];
22
+ }
23
+ export function buildDelegateRuleArgs(paths, range) {
24
+ return [
25
+ '--package',
26
+ OCR_18_PACKAGE,
27
+ '--',
28
+ 'ocr',
29
+ 'delegate',
30
+ 'rule',
31
+ ...paths,
32
+ ...rangeArgs(range),
33
+ '--format',
34
+ 'json'
35
+ ];
36
+ }
37
+ function asRecord(value) {
38
+ return value !== null && typeof value === 'object' && !Array.isArray(value)
39
+ ? value
40
+ : null;
41
+ }
42
+ function asText(value) {
43
+ return typeof value === 'string' && value.length > 0 ? value : null;
44
+ }
45
+ function asCount(value) {
46
+ return typeof value === 'number' && Number.isInteger(value) && value >= 0 ? value : null;
47
+ }
48
+ function parseFile(value) {
49
+ const record = asRecord(value);
50
+ if (record === null)
51
+ return null;
52
+ const path = asText(record['path']);
53
+ const status = asText(record['status']);
54
+ const insertions = asCount(record['insertions']);
55
+ const deletions = asCount(record['deletions']);
56
+ if (path === null || status === null || insertions === null || deletions === null)
57
+ return null;
58
+ const reason = asText(record['exclude_reason']);
59
+ return {
60
+ path,
61
+ status,
62
+ insertions,
63
+ deletions,
64
+ ...(reason !== null ? { exclude_reason: reason } : {})
65
+ };
66
+ }
67
+ function parseFiles(value, field) {
68
+ if (!Array.isArray(value))
69
+ return `${field} is not an array`;
70
+ const files = [];
71
+ for (const [index, entry] of value.entries()) {
72
+ const file = parseFile(entry);
73
+ if (file === null)
74
+ return `${field}[${String(index)}] is not a file entry`;
75
+ files.push(file);
76
+ }
77
+ return files;
78
+ }
79
+ function optionalText(record, key) {
80
+ const value = record[key];
81
+ return typeof value === 'string' ? value : undefined;
82
+ }
83
+ function previewCost(record) {
84
+ const totalFiles = asCount(record['total_files']);
85
+ const reviewableCount = asCount(record['reviewable_count']);
86
+ const excludedCount = asCount(record['excluded_count']);
87
+ const insertions = asCount(record['total_insertions']);
88
+ const deletions = asCount(record['total_deletions']);
89
+ if (totalFiles === null ||
90
+ reviewableCount === null ||
91
+ excludedCount === null ||
92
+ insertions === null ||
93
+ deletions === null) {
94
+ return null;
95
+ }
96
+ return {
97
+ total_files: totalFiles,
98
+ reviewable_count: reviewableCount,
99
+ excluded_count: excludedCount,
100
+ total_insertions: insertions,
101
+ total_deletions: deletions
102
+ };
103
+ }
104
+ /** The parsed preview, or the reason a file list is malformed. */
105
+ function previewFrom(record, cost) {
106
+ const reviewable = parseFiles(record['reviewable_files'], 'reviewable_files');
107
+ if (typeof reviewable === 'string')
108
+ return reviewable;
109
+ const excluded = parseFiles(record['excluded_files'], 'excluded_files');
110
+ if (typeof excluded === 'string')
111
+ return excluded;
112
+ const from = optionalText(record, 'from');
113
+ const to = optionalText(record, 'to');
114
+ const mergeBase = optionalText(record, 'merge_base');
115
+ return {
116
+ schema_version: optionalText(record, 'schema_version') ?? '1',
117
+ mode: optionalText(record, 'mode') ?? 'range',
118
+ repository: optionalText(record, 'repository') ?? '',
119
+ ...(from !== undefined ? { from } : {}),
120
+ ...(to !== undefined ? { to } : {}),
121
+ ...(mergeBase !== undefined ? { merge_base: mergeBase } : {}),
122
+ ...cost,
123
+ reviewable_files: reviewable,
124
+ excluded_files: excluded
125
+ };
126
+ }
127
+ export function parseDelegatePreview(stdout) {
128
+ let raw;
129
+ try {
130
+ raw = JSON.parse(stdout);
131
+ }
132
+ catch {
133
+ return { ok: false, reason: 'stdout is not JSON' };
134
+ }
135
+ const record = asRecord(raw);
136
+ if (record === null)
137
+ return { ok: false, reason: 'stdout is not a JSON object' };
138
+ if (!Array.isArray(record['reviewable_files'])) {
139
+ return {
140
+ ok: false,
141
+ reason: 'no reviewable_files[] — a review payload is not a delegate preview'
142
+ };
143
+ }
144
+ const cost = previewCost(record);
145
+ if (cost === null)
146
+ return { ok: false, reason: 'preview cost fields are missing' };
147
+ const preview = previewFrom(record, cost);
148
+ if (typeof preview === 'string')
149
+ return { ok: false, reason: preview };
150
+ return { ok: true, preview };
151
+ }
152
+ function parseRuleGroup(value) {
153
+ const record = asRecord(value);
154
+ if (record === null)
155
+ return null;
156
+ const groupId = asCount(record['group_id']);
157
+ const source = asText(record['source']);
158
+ const pattern = asText(record['pattern']);
159
+ const rule = typeof record['rule'] === 'string' ? record['rule'] : null;
160
+ if (groupId === null || source === null || pattern === null || rule === null)
161
+ return null;
162
+ if (!Array.isArray(record['files']))
163
+ return null;
164
+ const files = record['files'].map(asText);
165
+ if (files.some((file) => file === null))
166
+ return null;
167
+ return { group_id: groupId, source, pattern, files: files, rule };
168
+ }
169
+ export function parseDelegateRules(stdout) {
170
+ let raw;
171
+ try {
172
+ raw = JSON.parse(stdout);
173
+ }
174
+ catch {
175
+ return { ok: false, state: 'execution-failed', rawOutput: 'delegate rule output is not JSON' };
176
+ }
177
+ const record = asRecord(raw);
178
+ if (record === null || !Array.isArray(record['groups'])) {
179
+ return {
180
+ ok: false,
181
+ state: 'execution-failed',
182
+ rawOutput: 'delegate rule output has no groups[]'
183
+ };
184
+ }
185
+ const groups = [];
186
+ for (const [index, entry] of record['groups'].entries()) {
187
+ const group = parseRuleGroup(entry);
188
+ if (group === null) {
189
+ return {
190
+ ok: false,
191
+ state: 'execution-failed',
192
+ rawOutput: `groups[${String(index)}] is not a rule group`
193
+ };
194
+ }
195
+ groups.push(group);
196
+ }
197
+ return { ok: true, groups };
198
+ }
199
+ /** One `delegate preview` invocation — the selection only. No review runs. */
200
+ export function runDelegatePreview(cwd, range = {}, timeoutMs) {
201
+ const invoked = invokeOcr(buildDelegatePreviewArgs(range), cwd, timeoutMs);
202
+ if (!invoked.ok)
203
+ return { ok: false, state: invoked.state, rawOutput: invoked.rawOutput };
204
+ const parsed = parseDelegatePreview(invoked.stdout);
205
+ if (!parsed.ok)
206
+ return { ok: false, state: 'execution-failed', rawOutput: parsed.reason };
207
+ return { ok: true, preview: parsed.preview };
208
+ }
@@ -0,0 +1,42 @@
1
+ import { type Ocr18Finding, type Ocr18Summary } from './ocr-multilang-adapter.js';
2
+ export type DelegateFinding = Ocr18Finding & {
3
+ readonly attribution: 'ocr-delegate';
4
+ };
5
+ export type DelegateFindingsDocument = {
6
+ readonly schema_version: '1';
7
+ readonly mode: 'delegate';
8
+ readonly state: 'recorded';
9
+ readonly attribution: 'ocr-delegate';
10
+ readonly rid: string;
11
+ readonly session: string;
12
+ readonly packet: string;
13
+ readonly findings: readonly DelegateFinding[];
14
+ readonly summary: Ocr18Summary;
15
+ };
16
+ export type EnvelopeResult = {
17
+ readonly ok: true;
18
+ readonly packet: string;
19
+ readonly findings: readonly DelegateFinding[];
20
+ } | {
21
+ readonly ok: false;
22
+ readonly message: string;
23
+ };
24
+ /** Validate the envelope. Pure: no filesystem, so every refusal is unit-testable. */
25
+ export declare function parseEnvelope(text: string): EnvelopeResult;
26
+ export type RecordRefusalCode = 'ENVELOPE_INVALID' | 'PACKET_INVALID' | 'PACKET_MISMATCH';
27
+ export type RecordDelegateOptions = {
28
+ readonly projectRoot: string;
29
+ readonly packetPath: string;
30
+ readonly envelopeText: string;
31
+ };
32
+ export type RecordDelegateResult = {
33
+ readonly ok: true;
34
+ readonly document: DelegateFindingsDocument;
35
+ readonly findingsPath: string;
36
+ readonly replaced: boolean;
37
+ } | {
38
+ readonly ok: false;
39
+ readonly code: RecordRefusalCode;
40
+ readonly message: string;
41
+ };
42
+ export declare function recordDelegateFindings(options: RecordDelegateOptions): RecordDelegateResult;
@@ -0,0 +1,223 @@
1
+ /**
2
+ * OCR 1.x delegation — phase 2: validate the host agent's findings and record them.
3
+ *
4
+ * The envelope is authored by the agent, so it is untrusted input: a malformed
5
+ * entry is refused with the offending index named, never coerced. A finding is
6
+ * mapped onto `Ocr18Finding` through the same `severityFor` map the API path uses,
7
+ * and carries `ocr-delegate` attribution so it is never mistaken for an OCR
8
+ * finding.
9
+ *
10
+ * The packet is the other half of the binding: findings are recorded only against
11
+ * an existing packet in state `awaiting-envelope`, so a packet cannot be invented
12
+ * by submitting an envelope. Recording does not advance the packet — the findings
13
+ * document is the record of phase 2 — so recording again replaces the earlier
14
+ * findings file and reports `replaced: true`.
15
+ */
16
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
17
+ import { basename, dirname, isAbsolute, join, resolve } from 'node:path';
18
+ import { isInsidePath, pathsEqual, stableRealPath } from '../../shared/path-utils.js';
19
+ import { languageForPath } from './ocr-18-language-routing.js';
20
+ import { emptyByLanguage, severityFor, summarize } from './ocr-multilang-adapter.js';
21
+ /** The vocabulary the envelope may use; anything else is refused, not mapped to `info`. */
22
+ const ENVELOPE_SEVERITIES = new Set([
23
+ 'error',
24
+ 'critical',
25
+ 'high',
26
+ 'warn',
27
+ 'warning',
28
+ 'medium',
29
+ 'info',
30
+ 'low'
31
+ ]);
32
+ const PACKET_STATES = new Set([
33
+ 'no-routed-language',
34
+ 'unsupported-files-only',
35
+ 'ocr-unavailable',
36
+ 'awaiting-envelope'
37
+ ]);
38
+ function asRecord(value) {
39
+ return value !== null && typeof value === 'object' && !Array.isArray(value)
40
+ ? value
41
+ : null;
42
+ }
43
+ function textProblem(record, key, at) {
44
+ const value = record[key];
45
+ return typeof value === 'string' && value.trim().length > 0
46
+ ? null
47
+ : `${at}.${key} must be a non-empty string`;
48
+ }
49
+ function lineProblem(record, at) {
50
+ const start = record['start_line'];
51
+ if (typeof start !== 'number' || !Number.isInteger(start) || start < 1) {
52
+ return `${at}.start_line must be a positive integer`;
53
+ }
54
+ const end = record['end_line'];
55
+ if (end === undefined)
56
+ return null;
57
+ return typeof end === 'number' && Number.isInteger(end) && end >= start
58
+ ? null
59
+ : `${at}.end_line must be an integer at or after start_line`;
60
+ }
61
+ function severityProblem(record, at) {
62
+ const severity = record['severity'];
63
+ return typeof severity === 'string' && ENVELOPE_SEVERITIES.has(severity)
64
+ ? null
65
+ : `${at}.severity must be one of ${[...ENVELOPE_SEVERITIES].join('|')} — got ${JSON.stringify(severity)}`;
66
+ }
67
+ function categoryProblem(record, at) {
68
+ const category = record['category'];
69
+ if (category === undefined || category === null)
70
+ return null;
71
+ return typeof category === 'string' && category.trim().length > 0
72
+ ? null
73
+ : `${at}.category must be a non-empty string when present`;
74
+ }
75
+ function parseEntry(value, index) {
76
+ const at = `findings[${String(index)}]`;
77
+ const record = asRecord(value);
78
+ if (record === null)
79
+ return `${at} is not an object`;
80
+ const problem = textProblem(record, 'path', at) ??
81
+ textProblem(record, 'content', at) ??
82
+ lineProblem(record, at) ??
83
+ severityProblem(record, at) ??
84
+ categoryProblem(record, at);
85
+ if (problem !== null)
86
+ return problem;
87
+ const category = record['category'];
88
+ return {
89
+ filePath: record['path'].trim(),
90
+ line: record['start_line'],
91
+ ruleId: typeof category === 'string' ? category : null,
92
+ severity: severityFor(record['severity']),
93
+ message: record['content'].trim(),
94
+ attribution: 'ocr-delegate'
95
+ };
96
+ }
97
+ /** Validate the envelope. Pure: no filesystem, so every refusal is unit-testable. */
98
+ export function parseEnvelope(text) {
99
+ let raw;
100
+ try {
101
+ raw = JSON.parse(text);
102
+ }
103
+ catch {
104
+ return { ok: false, message: 'envelope is not JSON' };
105
+ }
106
+ const record = asRecord(raw);
107
+ if (record === null)
108
+ return { ok: false, message: 'envelope is not a JSON object' };
109
+ const version = record['schema_version'];
110
+ if (version !== '1') {
111
+ return { ok: false, message: 'envelope.schema_version must be the string "1"' };
112
+ }
113
+ const packet = record['packet'];
114
+ if (typeof packet !== 'string' || packet.trim().length === 0) {
115
+ return { ok: false, message: 'envelope.packet must name the packet the findings belong to' };
116
+ }
117
+ const entries = record['findings'];
118
+ if (!Array.isArray(entries)) {
119
+ return { ok: false, message: 'envelope.findings must be an array (use [] for a clean review)' };
120
+ }
121
+ const findings = [];
122
+ for (const [index, entry] of entries.entries()) {
123
+ const finding = parseEntry(entry, index);
124
+ if (typeof finding === 'string')
125
+ return { ok: false, message: finding };
126
+ findings.push(finding);
127
+ }
128
+ return { ok: true, packet, findings };
129
+ }
130
+ function readPacket(packetPath) {
131
+ let raw;
132
+ try {
133
+ raw = JSON.parse(readFileSync(packetPath, 'utf8'));
134
+ }
135
+ catch {
136
+ return `packet is not readable JSON: ${packetPath}`;
137
+ }
138
+ const record = asRecord(raw);
139
+ if (record === null)
140
+ return `packet is not a JSON object: ${packetPath}`;
141
+ if (record['schema_version'] !== '1' || record['mode'] !== 'delegate') {
142
+ return `not a delegation packet (schema_version 1, mode delegate): ${packetPath}`;
143
+ }
144
+ const state = record['state'];
145
+ if (typeof state !== 'string' || !PACKET_STATES.has(state)) {
146
+ return `packet has no recognised state: ${packetPath}`;
147
+ }
148
+ const rid = record['rid'];
149
+ const session = record['session'];
150
+ if (typeof rid !== 'string' || typeof session !== 'string') {
151
+ return `packet is missing rid/session: ${packetPath}`;
152
+ }
153
+ // A packet is a phase-1 document. A findings ARRAY here means the file is a
154
+ // findings document, not a packet; an omitted key is not a claim about findings.
155
+ if (Array.isArray(record['findings'])) {
156
+ return `packet carries findings; it is not a phase-1 packet: ${packetPath}`;
157
+ }
158
+ return { rid, session, state };
159
+ }
160
+ function absoluteFrom(projectRoot, value) {
161
+ return isAbsolute(value) ? resolve(value) : resolve(projectRoot, value);
162
+ }
163
+ function summaryOf(findings) {
164
+ const counts = { ...emptyByLanguage() };
165
+ for (const finding of findings) {
166
+ const language = languageForPath(finding.filePath);
167
+ if (language !== null)
168
+ counts[language] += 1;
169
+ }
170
+ return summarize(findings, counts);
171
+ }
172
+ /** The packet is the other half of the binding: it must exist, be this file, and await a review. */
173
+ function bindPacket(projectRoot, packetPath, declared) {
174
+ if (!existsSync(projectRoot)) {
175
+ return { code: 'PACKET_INVALID', message: `project root does not exist: ${projectRoot}` };
176
+ }
177
+ if (!pathsEqual(packetPath, declared)) {
178
+ return {
179
+ code: 'PACKET_MISMATCH',
180
+ message: `envelope names ${declared}, which is not the packet given (${packetPath})`
181
+ };
182
+ }
183
+ if (!existsSync(packetPath)) {
184
+ return { code: 'PACKET_INVALID', message: `packet does not exist: ${packetPath}` };
185
+ }
186
+ if (!isInsidePath(stableRealPath(packetPath), stableRealPath(projectRoot))) {
187
+ return { code: 'PACKET_INVALID', message: `packet is outside the project root: ${packetPath}` };
188
+ }
189
+ const packet = readPacket(packetPath);
190
+ if (typeof packet === 'string')
191
+ return { code: 'PACKET_INVALID', message: packet };
192
+ if (packet.state !== 'awaiting-envelope') {
193
+ return {
194
+ code: 'PACKET_INVALID',
195
+ message: `packet state is ${packet.state}: there was no delegated review to record`
196
+ };
197
+ }
198
+ return { packetPath, packet };
199
+ }
200
+ export function recordDelegateFindings(options) {
201
+ const envelope = parseEnvelope(options.envelopeText);
202
+ if (!envelope.ok)
203
+ return { ok: false, code: 'ENVELOPE_INVALID', message: envelope.message };
204
+ const bound = bindPacket(options.projectRoot, absoluteFrom(options.projectRoot, options.packetPath), absoluteFrom(options.projectRoot, envelope.packet));
205
+ if ('code' in bound)
206
+ return { ok: false, ...bound };
207
+ const findingsPath = join(dirname(bound.packetPath), `${basename(bound.packetPath).replace(/\.json$/i, '')}.findings.json`);
208
+ const document = {
209
+ schema_version: '1',
210
+ mode: 'delegate',
211
+ state: 'recorded',
212
+ attribution: 'ocr-delegate',
213
+ rid: bound.packet.rid,
214
+ session: bound.packet.session,
215
+ packet: bound.packetPath,
216
+ findings: envelope.findings,
217
+ summary: summaryOf(envelope.findings)
218
+ };
219
+ const replaced = existsSync(findingsPath);
220
+ mkdirSync(dirname(findingsPath), { recursive: true });
221
+ writeFileSync(findingsPath, `${JSON.stringify(document, null, 2)}\n`, 'utf8');
222
+ return { ok: true, document, findingsPath, replaced };
223
+ }
@@ -0,0 +1,96 @@
1
+ export declare const LANGUAGE_EXTENSIONS: {
2
+ readonly typescript: readonly [".ts", ".tsx"];
3
+ readonly javascript: readonly [".js", ".jsx", ".mjs", ".cjs"];
4
+ readonly python: readonly [".py", ".pyi"];
5
+ readonly go: readonly [".go"];
6
+ readonly java: readonly [".java"];
7
+ readonly kotlin: readonly [".kt", ".kts"];
8
+ readonly rust: readonly [".rs"];
9
+ readonly c: readonly [".c"];
10
+ readonly cpp: readonly [".cpp", ".cc", ".cxx", ".h", ".hpp", ".hxx"];
11
+ readonly csharp: readonly [".cs"];
12
+ readonly fsharp: readonly [".fs", ".fsi", ".fsx"];
13
+ readonly vbnet: readonly [".vb"];
14
+ readonly ruby: readonly [".rb", ".rake", ".gemspec"];
15
+ readonly php: readonly [".php", ".phtml"];
16
+ readonly swift: readonly [".swift"];
17
+ readonly objc: readonly [".m", ".mm"];
18
+ readonly scala: readonly [".scala"];
19
+ readonly groovy: readonly [".groovy", ".gradle"];
20
+ readonly shell: readonly [".sh", ".bash", ".zsh", ".fish"];
21
+ readonly powershell: readonly [".ps1"];
22
+ readonly sql: readonly [".sql"];
23
+ readonly r: readonly [".r"];
24
+ readonly lua: readonly [".lua"];
25
+ readonly perl: readonly [".pl", ".pm"];
26
+ readonly elixir: readonly [".ex", ".exs"];
27
+ readonly erlang: readonly [".erl", ".hrl"];
28
+ readonly dart: readonly [".dart"];
29
+ readonly julia: readonly [".jl"];
30
+ readonly haskell: readonly [".hs", ".lhs"];
31
+ readonly nim: readonly [".nim", ".nims", ".nimble"];
32
+ readonly ocaml: readonly [".ml", ".mli"];
33
+ readonly reasonml: readonly [".re", ".rei"];
34
+ readonly elm: readonly [".elm"];
35
+ readonly zig: readonly [".zig"];
36
+ readonly solidity: readonly [".sol"];
37
+ readonly vyper: readonly [".vy"];
38
+ readonly rego: readonly [".rego"];
39
+ readonly verilog: readonly [".v", ".sv", ".vh"];
40
+ readonly vhdl: readonly [".vhd", ".vhdl"];
41
+ readonly terraform: readonly [".tf", ".tfvars", ".hcl"];
42
+ readonly protobuf: readonly [".proto"];
43
+ readonly graphql: readonly [".graphql", ".gql"];
44
+ readonly prisma: readonly [".prisma"];
45
+ readonly thrift: readonly [".thrift"];
46
+ readonly capnp: readonly [".capnp"];
47
+ readonly jsonnet: readonly [".jsonnet", ".libsonnet"];
48
+ readonly nix: readonly [".nix"];
49
+ readonly bicep: readonly [".bicep"];
50
+ readonly cmake: readonly [".cmake"];
51
+ readonly arkts: readonly [".ets"];
52
+ readonly astro: readonly [".astro"];
53
+ readonly vue: readonly [".vue"];
54
+ readonly svelte: readonly [".svelte"];
55
+ readonly pug: readonly [".pug"];
56
+ readonly freemarker: readonly [".ftl", ".ftlh", ".ftlx"];
57
+ readonly handlebars: readonly [".hbs", ".mustache"];
58
+ readonly jinja: readonly [".jinja2", ".j2"];
59
+ };
60
+ export type Ocr18Language = keyof typeof LANGUAGE_EXTENSIONS;
61
+ export declare const OCR_18_LANGUAGES: readonly Ocr18Language[];
62
+ /**
63
+ * The routed language `filePath` belongs to, or `null` when it is not a routed
64
+ * format. Three deliberate decisions, all documented rather than assumed:
65
+ *
66
+ * - `.mts` / `.cts` are TypeScript to the PRD, but the pinned 1.13.1 allowlist
67
+ * omits them and `ocr review --preview` reports them `unsupported_ext`.
68
+ * Routing them would report "typescript: 0 findings" for files the CLI never
69
+ * read, so they surface as unsupported files instead.
70
+ * - `.h` is genuinely ambiguous between C and C++. It stays under `cpp` because
71
+ * that is the surface this slice inherited: at `194eccf5`, `--language cpp`
72
+ * matched `.h`, and moving it would silently change a single-language result
73
+ * (the PRD's preserved-behaviour clause). Reassigning it is a deliberate
74
+ * breaking change and needs its own decision, not a "fix" in passing. One file
75
+ * maps to one language on purpose: a double assignment would count the same
76
+ * comment in two `byLanguage` buckets and make the outcome shapes dishonest.
77
+ * - `.m` is claimed by both Objective-C and MATLAB upstream and cannot be told
78
+ * apart by extension; it routes to Objective-C, the far more common reading.
79
+ */
80
+ export declare function languageForPath(filePath: string): Ocr18Language | null;
81
+ export declare function isSupportedLanguage(value: string): value is Ocr18Language;
82
+ /**
83
+ * Parse a `--languages` value: `auto`, or a comma-separated list of language
84
+ * names / extensions (`ts,js,go` or `.ts,.js,go`). Extensions are resolved
85
+ * through the same routing table, so a token cannot name a language the table
86
+ * does not route.
87
+ *
88
+ * @throws Error with `code: 'LANGUAGE_UNSUPPORTED'` on an unknown or empty token.
89
+ */
90
+ export declare function parseLanguageSelection(spec: string): {
91
+ readonly auto: true;
92
+ readonly languages: null;
93
+ } | {
94
+ readonly auto: false;
95
+ readonly languages: readonly Ocr18Language[];
96
+ };