ultra11y 2.24.0 → 2.26.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/.claude-plugin/marketplace.json +22 -0
- package/.claude-plugin/plugin.json +9 -0
- package/README.md +46 -1
- package/hooks/hooks.json +16 -0
- package/hooks/pre-tool-use.mjs +47 -0
- package/package.json +4 -2
- package/scripts/sync-version.mjs +11 -1
- package/scripts/ultra11y.mjs +3815 -1625
- package/scripts/vendor/wcag-2.2-fr.json +1 -1
- package/scripts/vendor/wcag-2.2-sc-universe.json +1 -1
- package/scripts/verify-skill-bundle.mjs +104 -7
- package/skills/review-a11y/SKILL.md +9 -3
- package/skills/review-a11y/scripts/ultra11y.mjs +3815 -1625
- package/skills/ultra11y/SKILL.md +5 -2
- package/skills/ultra11y/references/automation.md +37 -0
- package/skills/ultra11y/scripts/ultra11y.mjs +3815 -1625
- package/src/cli.ts +31 -0
- package/src/config.ts +4 -0
- package/src/data/wcag-universe.json +1 -1
- package/src/hook.ts +0 -0
- package/src/types.ts +1 -1
- package/src/vendor/codeindex-engine.d.mts +227 -31
- package/src/vendor/codeindex-engine.mjs +3045 -1033
- package/src/vendor/engine.meta.json +5 -5
package/src/cli.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { join, relative, sep, dirname } from "node:path";
|
|
|
3
3
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
4
4
|
import { VERSION, type Lang, type AuditResult, type DynamicResult, type SampleConfig, type Severity } from "./types.js";
|
|
5
5
|
import { runAudit } from "./audit.js";
|
|
6
|
+
import { decide, type PreToolUsePayload } from "./hook.js";
|
|
6
7
|
import { writeReport, untestedNeedsRendering, partialAuditBanner } from "./report.js";
|
|
7
8
|
import { writePrd, prdUnits, type PrdFormat } from "./prd.js";
|
|
8
9
|
import { ghAvailable, pushIssues, pushPrComment, pushSingleIssue } from "./gh.js";
|
|
@@ -81,6 +82,7 @@ Usage:
|
|
|
81
82
|
ultra11y snapshot list [--root <dir>] [--json]
|
|
82
83
|
ultra11y pages --in <audit.json> [--standard <pack>] [--json] [--lang auto|en|fr] (the per-page criterion grid)
|
|
83
84
|
ultra11y mcp [--transport stdio|http] [--cwd <dir>] [--allow-write] [--port <n>] [--bind <addr>] [--allow-remote] [--allow-origin <o>] [--max-response-bytes <n>]
|
|
85
|
+
ultra11y hook --claude-code (internal: the plugin's PreToolUse hook; payload on stdin)
|
|
84
86
|
ultra11y dev [--port <n>] [--root <dir>] [--standard <pack>] [--lang auto|en|fr] (dev side-car: live overlay + per-page dashboard)
|
|
85
87
|
ultra11y dev --next [--port <n>] (write the Next overlay component, then wire one line into your layout)
|
|
86
88
|
|
|
@@ -221,6 +223,13 @@ Commands:
|
|
|
221
223
|
--transport http listens on 127.0.0.1 (--port, --bind), and stays
|
|
222
224
|
loopback-only unless you pass --allow-remote. Read-only by default:
|
|
223
225
|
--allow-write opts into the commands that touch files.
|
|
226
|
+
hook INTERNAL — the decision half of the Claude Code plugin's PreToolUse
|
|
227
|
+
hook. Reads the payload on stdin; when a pending 'git commit', 'git
|
|
228
|
+
push' or 'gh pr create' carries findings >= the threshold, prints the
|
|
229
|
+
hook JSON that gets the review-a11y skill invoked, and prints nothing
|
|
230
|
+
otherwise. Threshold: ULTRA11Y_HOOK_FAIL_ON, else hook.failOn in
|
|
231
|
+
.ultra11yrc.json, else blocking. Disable with ULTRA11Y_HOOK=off or
|
|
232
|
+
SKIP_A11Y=1. Called by hooks/pre-tool-use.mjs, not by hand.
|
|
224
233
|
pages The per-page criterion grid — RGAA is a per-page norm, the engine's
|
|
225
234
|
verdict is scope-wide, and this bridges the two. One row per criterion
|
|
226
235
|
(the pack's own under --standard), one column per page. Rebuilt from a
|
|
@@ -376,6 +385,7 @@ const COMMANDS = [
|
|
|
376
385
|
"init",
|
|
377
386
|
"pack",
|
|
378
387
|
"orchestrate",
|
|
388
|
+
"hook",
|
|
379
389
|
] as const;
|
|
380
390
|
type Command = (typeof COMMANDS)[number];
|
|
381
391
|
|
|
@@ -1079,6 +1089,25 @@ function cmdInit(p: ParsedArgs): number {
|
|
|
1079
1089
|
return 0;
|
|
1080
1090
|
}
|
|
1081
1091
|
|
|
1092
|
+
/** `hook --claude-code` — the decision half of the plugin's PreToolUse hook. Reads the
|
|
1093
|
+
* payload on stdin, prints the hook JSON when the pending commit/push/PR should get an
|
|
1094
|
+
* accessibility review first, and prints NOTHING otherwise. Not meant to be run by hand:
|
|
1095
|
+
* `hooks/pre-tool-use.mjs` is what Claude Code calls, and it only reaches here once its
|
|
1096
|
+
* cheap prefilter has passed. Always exits 0 — see src/hook.ts for why. */
|
|
1097
|
+
async function cmdHook(p: ParsedArgs): Promise<number> {
|
|
1098
|
+
if (p.flags["claude-code"] !== true) {
|
|
1099
|
+
console.error("ultra11y hook: expected `hook --claude-code` (the payload is read on stdin).");
|
|
1100
|
+
return 2;
|
|
1101
|
+
}
|
|
1102
|
+
try {
|
|
1103
|
+
const decision = decide(JSON.parse(await readStdin()) as PreToolUsePayload);
|
|
1104
|
+
if (decision) process.stdout.write(JSON.stringify(decision));
|
|
1105
|
+
} catch {
|
|
1106
|
+
/* unreadable payload, engine failure — stay silent rather than break a git flow */
|
|
1107
|
+
}
|
|
1108
|
+
return 0;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1082
1111
|
function cmdCriteria(p: ParsedArgs): number {
|
|
1083
1112
|
// --generate: emit the bundled WCAG references/criteria.md (no trailing newline; the
|
|
1084
1113
|
// shell redirect / committed file owns that). Used by `pnpm run build:criteria`.
|
|
@@ -2359,6 +2388,8 @@ export async function main(argv: string[]): Promise<number> {
|
|
|
2359
2388
|
return cmdOrchestrate(p);
|
|
2360
2389
|
case "mcp":
|
|
2361
2390
|
return cmdMcp(p);
|
|
2391
|
+
case "hook":
|
|
2392
|
+
return cmdHook(p);
|
|
2362
2393
|
default:
|
|
2363
2394
|
console.error(`ultra11y: "${p.command}" is not implemented yet`);
|
|
2364
2395
|
return 1;
|
package/src/config.ts
CHANGED
|
@@ -31,6 +31,10 @@ export interface Ultra11yConfig {
|
|
|
31
31
|
// `note`. Applied AFTER packs are registered (registry.enableSecondaryMapping): a pack
|
|
32
32
|
// ships the mapping DISABLED; this flips it on (or appends a new enabled one).
|
|
33
33
|
secondaryMappings?: Array<{ standard: string; ruleId: string; criterion: string; note?: LocaleString }>;
|
|
34
|
+
// The Claude Code PreToolUse hook (src/hook.ts), shipped by the plugin. `failOn` is the
|
|
35
|
+
// severity at which a pending commit/push/PR asks the agent for a11y review; "off"
|
|
36
|
+
// disables the hook for this repo. Absent ⇒ "blocking", matching `init --hook`.
|
|
37
|
+
hook?: { failOn?: string };
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
export interface LoadResult {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"wcagVersion": "2.2",
|
|
3
3
|
"source": "https://www.w3.org/TR/WCAG22/",
|
|
4
4
|
"criteriaSource": "https://github.com/w3c/wcag",
|
|
5
|
-
"provenance": "Full WCAG 2.x SC universe (all levels incl. AAA, and the removed 4.1.1 Parsing) fetched from raw.githubusercontent.com/w3c/wcag@main on 2026-07-
|
|
5
|
+
"provenance": "Full WCAG 2.x SC universe (all levels incl. AAA, and the removed 4.1.1 Parsing) fetched from raw.githubusercontent.com/w3c/wcag@main on 2026-07-31 via `node scripts/build-standards.mjs --refresh-universe`. Classification: core-AA = ships in src/data/wcag.json (the shipped WCAG 2.2 AA core); out-of-core = WCAG AAA; removed = obsolete (4.1.1).",
|
|
6
6
|
"criteria": [
|
|
7
7
|
{
|
|
8
8
|
"id": "1.1.1",
|
package/src/hook.ts
ADDED
|
Binary file
|
package/src/types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Single source of truth for shared types + the embedded version. sync-version.mjs
|
|
2
2
|
// rewrites VERSION at release time (kept in lockstep with package.json + SKILL.md).
|
|
3
|
-
export const VERSION = "2.
|
|
3
|
+
export const VERSION = "2.26.0";
|
|
4
4
|
export const SCHEMA_VERSION = 2;
|
|
5
5
|
|
|
6
6
|
// Lang = the UI FRAME's language — the `L` localization tables each module (report,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
declare const ENGINE_VERSION = "2.
|
|
2
|
-
declare const SCHEMA_VERSION =
|
|
3
|
-
declare const EXTRACTOR_VERSION =
|
|
1
|
+
declare const ENGINE_VERSION = "2.22.0";
|
|
2
|
+
declare const SCHEMA_VERSION = 5;
|
|
3
|
+
declare const EXTRACTOR_VERSION = 11;
|
|
4
4
|
type FileKind = "code" | "doc" | "config" | "asset" | "other";
|
|
5
|
-
type EdgeKind = "contains" | "doc-link" | "import" | "call" | "use" | "mention";
|
|
5
|
+
type EdgeKind = "contains" | "doc-link" | "import" | "call" | "extends" | "implements" | "use" | "mention";
|
|
6
6
|
type Tier = 0 | 1 | 2;
|
|
7
7
|
interface CodeSymbol {
|
|
8
8
|
name: string;
|
|
@@ -11,7 +11,9 @@ interface CodeSymbol {
|
|
|
11
11
|
line: number;
|
|
12
12
|
endLine?: number;
|
|
13
13
|
parent?: string;
|
|
14
|
+
parentPath?: string;
|
|
14
15
|
signature?: string;
|
|
16
|
+
doc?: string;
|
|
15
17
|
exported: boolean;
|
|
16
18
|
lang: string;
|
|
17
19
|
}
|
|
@@ -19,6 +21,12 @@ interface RawRef {
|
|
|
19
21
|
kind: "doc-link" | "import";
|
|
20
22
|
spec: string;
|
|
21
23
|
}
|
|
24
|
+
interface RawRelation {
|
|
25
|
+
kind: "extends" | "implements";
|
|
26
|
+
from: string;
|
|
27
|
+
to: string;
|
|
28
|
+
line: number;
|
|
29
|
+
}
|
|
22
30
|
interface FileRecord {
|
|
23
31
|
rel: string;
|
|
24
32
|
ext: string;
|
|
@@ -40,6 +48,9 @@ interface FileRecord {
|
|
|
40
48
|
receiver?: string;
|
|
41
49
|
}[];
|
|
42
50
|
importedNames?: string[];
|
|
51
|
+
truncated?: true;
|
|
52
|
+
relations?: RawRelation[];
|
|
53
|
+
terms?: string[];
|
|
43
54
|
}
|
|
44
55
|
interface FileNode {
|
|
45
56
|
id: string;
|
|
@@ -289,6 +300,7 @@ declare function languageOf(ext: string): string;
|
|
|
289
300
|
interface CodeInfo {
|
|
290
301
|
symbols: CodeSymbol[];
|
|
291
302
|
summary?: string;
|
|
303
|
+
truncated?: true;
|
|
292
304
|
refs: RawRef[];
|
|
293
305
|
pkg?: string;
|
|
294
306
|
idents?: string[];
|
|
@@ -298,6 +310,8 @@ interface CodeInfo {
|
|
|
298
310
|
receiver?: string;
|
|
299
311
|
}[];
|
|
300
312
|
importedNames?: string[];
|
|
313
|
+
terms?: string[];
|
|
314
|
+
relations?: RawRelation[];
|
|
301
315
|
}
|
|
302
316
|
declare function extractCode(rel: string, ext: string, content: string, opts?: {
|
|
303
317
|
maxCallsPerFile?: number;
|
|
@@ -311,12 +325,16 @@ interface MarkdownInfo {
|
|
|
311
325
|
}
|
|
312
326
|
declare function extractMarkdown(content: string): MarkdownInfo;
|
|
313
327
|
|
|
328
|
+
declare const CORE_GRAMMARS: Set<string>;
|
|
329
|
+
declare const EXTENDED_GRAMMARS: Set<string>;
|
|
330
|
+
declare const EXT_GRAMMAR: Record<string, string>;
|
|
314
331
|
declare function grammarKeyForExt(ext: string): string | undefined;
|
|
315
332
|
type GrammarsTierName = "adjacent" | "env" | "cache" | "none";
|
|
316
333
|
interface GrammarsTier {
|
|
317
334
|
tier: GrammarsTierName;
|
|
318
335
|
dir?: string;
|
|
319
336
|
cacheDir: string;
|
|
337
|
+
dirs: string[];
|
|
320
338
|
}
|
|
321
339
|
declare function sharedGrammarsCacheDir(): string;
|
|
322
340
|
declare function resolveGrammarsTier(opts?: {
|
|
@@ -341,13 +359,45 @@ interface AstResult {
|
|
|
341
359
|
receiver?: string;
|
|
342
360
|
}[];
|
|
343
361
|
importedNames: string[];
|
|
362
|
+
relations: RawRelation[];
|
|
363
|
+
terms: string[];
|
|
364
|
+
truncated?: true;
|
|
344
365
|
}
|
|
345
366
|
declare function extractAst(rel: string, ext: string, content: string, opts?: {
|
|
346
367
|
maxCalls?: number;
|
|
347
368
|
imports?: boolean;
|
|
369
|
+
maxSymbols?: number;
|
|
348
370
|
}): AstResult | undefined;
|
|
349
371
|
|
|
350
|
-
|
|
372
|
+
/** One definition a tags query captured. */
|
|
373
|
+
interface TagDefinition {
|
|
374
|
+
/** The `@definition.<kind>` suffix — function, class, method, module, … */
|
|
375
|
+
kind: string;
|
|
376
|
+
name: string;
|
|
377
|
+
line: number;
|
|
378
|
+
}
|
|
379
|
+
/** Whether a vendored query exists for a grammar, and whether it compiled. */
|
|
380
|
+
interface TagsQueryStatus {
|
|
381
|
+
/** A `<key>.tags.scm` was found next to the grammar. */
|
|
382
|
+
present: boolean;
|
|
383
|
+
/** It compiled against the loaded grammar. False means the two are out of step. */
|
|
384
|
+
compiled: boolean;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Report a grammar's query status. `extractTags` degrades to `[]` for a query
|
|
388
|
+
* that does not compile, which is right at runtime but makes a broken query
|
|
389
|
+
* indistinguishable from one that simply matched nothing — so the audit and its
|
|
390
|
+
* tests can check the difference here instead of guessing from an empty result.
|
|
391
|
+
*/
|
|
392
|
+
declare function tagsQueryStatus(key: string): TagsQueryStatus;
|
|
393
|
+
/**
|
|
394
|
+
* Definitions the grammar's own `tags.scm` finds in this source, deduped and
|
|
395
|
+
* sorted. Empty when the grammar publishes no query, when it fails to compile,
|
|
396
|
+
* or when no grammar is loaded for the extension.
|
|
397
|
+
*/
|
|
398
|
+
declare function extractTags(ext: string, content: string): TagDefinition[];
|
|
399
|
+
|
|
400
|
+
declare const DEFAULT_GRAMMARS_URL = "https://github.com/maxgfr/codeindex/releases/download/v2.22.0/grammars-2.22.0.tar.gz";
|
|
351
401
|
interface GrammarsPullTarget {
|
|
352
402
|
url: string;
|
|
353
403
|
sha256Url?: string;
|
|
@@ -480,6 +530,134 @@ declare function buildGraph(scan: RepoScan, ctx: ResolveContext, modules: Module
|
|
|
480
530
|
|
|
481
531
|
declare function resolveCallEdges(scan: RepoScan, importPairs: Set<string>): Edge[];
|
|
482
532
|
|
|
533
|
+
/** One inheritance link with both ends bound to a declaration site. */
|
|
534
|
+
interface ResolvedRelation {
|
|
535
|
+
kind: "extends" | "implements";
|
|
536
|
+
from: string;
|
|
537
|
+
fromFile: string;
|
|
538
|
+
fromLine: number;
|
|
539
|
+
to: string;
|
|
540
|
+
toFile: string;
|
|
541
|
+
toKind: string;
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Every inheritance relation in the repo whose target resolves to a declaration
|
|
545
|
+
* here. Targets that do not (a framework base class, `std::exception`) are
|
|
546
|
+
* omitted — they are reported per-type as `unresolved` by the hierarchy below,
|
|
547
|
+
* so the information is available without inventing an edge to nothing.
|
|
548
|
+
*
|
|
549
|
+
* Deterministic: sorted, and never dependent on Map iteration order.
|
|
550
|
+
*/
|
|
551
|
+
declare function resolveRelations(scan: RepoScan, importPairs: Set<string>): ResolvedRelation[];
|
|
552
|
+
/**
|
|
553
|
+
* File-level `extends`/`implements` edges, aggregated per (from, to, kind) pair.
|
|
554
|
+
* Self-edges are dropped: a type extending another in the same file is a real
|
|
555
|
+
* relation (the hierarchy reports it) but not a dependency between files.
|
|
556
|
+
*/
|
|
557
|
+
declare function resolveRelationEdges(scan: RepoScan, importPairs: Set<string>): Edge[];
|
|
558
|
+
/** One end of a relation, as reported by the hierarchy. */
|
|
559
|
+
interface HierarchyRef {
|
|
560
|
+
name: string;
|
|
561
|
+
file: string;
|
|
562
|
+
line: number;
|
|
563
|
+
kind: string;
|
|
564
|
+
}
|
|
565
|
+
interface TypeHierarchyEntry {
|
|
566
|
+
name: string;
|
|
567
|
+
file: string;
|
|
568
|
+
line: number;
|
|
569
|
+
kind: string;
|
|
570
|
+
/** Base classes/supertraits this type declares, resolved. */
|
|
571
|
+
extends: HierarchyRef[];
|
|
572
|
+
/** Interfaces/traits/mixins this type provides, resolved. */
|
|
573
|
+
implements: HierarchyRef[];
|
|
574
|
+
/** Types that extend THIS one. */
|
|
575
|
+
extendedBy: HierarchyRef[];
|
|
576
|
+
/** Types that implement THIS one — the "who implements this interface" answer. */
|
|
577
|
+
implementedBy: HierarchyRef[];
|
|
578
|
+
/** Declared supertypes with no definition in this repo (a framework base class). */
|
|
579
|
+
unresolved: {
|
|
580
|
+
kind: "extends" | "implements";
|
|
581
|
+
to: string;
|
|
582
|
+
}[];
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* The full type hierarchy, keyed by `name` (and by `name@file` for a homonym
|
|
586
|
+
* declared in more than one file, mirroring how the caller index disambiguates).
|
|
587
|
+
* Insertion order is sorted, so serializing the map is deterministic.
|
|
588
|
+
*/
|
|
589
|
+
declare function buildTypeHierarchy(scan: RepoScan, importPairs: Set<string>): Map<string, TypeHierarchyEntry>;
|
|
590
|
+
/**
|
|
591
|
+
* Everything that implements or extends `name`, TRANSITIVELY — the practical
|
|
592
|
+
* form of "who implements this interface": a class implementing a sub-interface
|
|
593
|
+
* of the one asked about is an implementation too, and a caller should not have
|
|
594
|
+
* to walk the chain itself. Breadth-first, cycle-safe, deterministic.
|
|
595
|
+
*/
|
|
596
|
+
declare function implementationsOf(hierarchy: Map<string, TypeHierarchyEntry>, name: string): HierarchyRef[];
|
|
597
|
+
/** The declaration `name` refers to, for callers that only have a name. */
|
|
598
|
+
declare function typeEntry(hierarchy: Map<string, TypeHierarchyEntry>, name: string): TypeHierarchyEntry | undefined;
|
|
599
|
+
|
|
600
|
+
type SymbolEdgeKind = "calls" | "extends" | "implements";
|
|
601
|
+
interface SymbolNode {
|
|
602
|
+
/** Stable id: `file#Parent/name` for a member, `file#name` otherwise. */
|
|
603
|
+
id: string;
|
|
604
|
+
name: string;
|
|
605
|
+
kind: string;
|
|
606
|
+
file: string;
|
|
607
|
+
line: number;
|
|
608
|
+
endLine?: number;
|
|
609
|
+
exported: boolean;
|
|
610
|
+
doc?: string;
|
|
611
|
+
signature?: string;
|
|
612
|
+
}
|
|
613
|
+
interface SymbolEdge {
|
|
614
|
+
from: string;
|
|
615
|
+
to: string;
|
|
616
|
+
kind: SymbolEdgeKind;
|
|
617
|
+
/** How many distinct call sites back a `calls` edge. Always 1 for inheritance. */
|
|
618
|
+
weight: number;
|
|
619
|
+
}
|
|
620
|
+
interface SymbolGraph {
|
|
621
|
+
nodes: Map<string, SymbolNode>;
|
|
622
|
+
edges: SymbolEdge[];
|
|
623
|
+
/** id → outgoing edges, and id → incoming; both sorted. */
|
|
624
|
+
out: Map<string, SymbolEdge[]>;
|
|
625
|
+
in: Map<string, SymbolEdge[]>;
|
|
626
|
+
/** name → every node id declaring it, for looking a symbol up by bare name. */
|
|
627
|
+
byName: Map<string, string[]>;
|
|
628
|
+
}
|
|
629
|
+
declare function symbolId(s: Pick<CodeSymbol, "file" | "name" | "parent">): string;
|
|
630
|
+
/**
|
|
631
|
+
* Build the symbol graph. `importPairs` is the resolved-import pair set the call
|
|
632
|
+
* binder uses for corroboration — pass the memoised one (derived.ts) so this
|
|
633
|
+
* shares work with the rest of a session.
|
|
634
|
+
*
|
|
635
|
+
* Deterministic: edges are aggregated into a Map keyed by (from, to, kind) and
|
|
636
|
+
* sorted before return, so two builds of one scan agree exactly.
|
|
637
|
+
*/
|
|
638
|
+
declare function buildSymbolGraph(scan: RepoScan, importPairs: Set<string>): SymbolGraph;
|
|
639
|
+
type Direction = "out" | "in" | "both";
|
|
640
|
+
interface Neighborhood {
|
|
641
|
+
/** Every declaration matching the requested name — the walk starts from all of them. */
|
|
642
|
+
root: SymbolNode[];
|
|
643
|
+
/** Reached nodes with the hop count at which each was first seen (root = 0). */
|
|
644
|
+
nodes: (SymbolNode & {
|
|
645
|
+
depth: number;
|
|
646
|
+
})[];
|
|
647
|
+
edges: SymbolEdge[];
|
|
648
|
+
/** True when the node cap stopped the walk short. */
|
|
649
|
+
truncated?: true;
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* The bounded neighborhood of a symbol. Breadth-first, so `depth` is the true
|
|
653
|
+
* hop distance; cycle-safe; capped at MAX_NODES with `truncated` set rather than
|
|
654
|
+
* quietly returning a partial answer.
|
|
655
|
+
*/
|
|
656
|
+
declare function neighborhood(graph: SymbolGraph, name: string, opts?: {
|
|
657
|
+
depth?: number;
|
|
658
|
+
direction?: Direction;
|
|
659
|
+
}): Neighborhood;
|
|
660
|
+
|
|
483
661
|
interface CallerSite {
|
|
484
662
|
file: string;
|
|
485
663
|
line: number;
|
|
@@ -577,7 +755,7 @@ declare function computeSurprises(graph: Graph): SurpriseEdge[];
|
|
|
577
755
|
declare function isSurprising(graph: Graph, from: string, to: string): boolean;
|
|
578
756
|
|
|
579
757
|
declare function computeSymbolRefs(scan: RepoScan): Map<string, Set<string>>;
|
|
580
|
-
declare function buildSymbolIndex(scan: RepoScan, refs?: Map<string, Set<string
|
|
758
|
+
declare function buildSymbolIndex(scan: RepoScan, refs?: Map<string, Set<string>>, schemaVersion?: number): SymbolIndex;
|
|
581
759
|
declare function renderSymbolsJson(index: SymbolIndex): string;
|
|
582
760
|
|
|
583
761
|
declare function renderGraphJson(graph: Graph): string;
|
|
@@ -638,18 +816,59 @@ interface GrepOptions {
|
|
|
638
816
|
}
|
|
639
817
|
declare function grepRepo(root: string, pattern: string, opts?: GrepOptions): SearchHit[];
|
|
640
818
|
|
|
819
|
+
interface ShResult {
|
|
820
|
+
ok: boolean;
|
|
821
|
+
status: number | null;
|
|
822
|
+
stdout: string;
|
|
823
|
+
stderr: string;
|
|
824
|
+
missing: boolean;
|
|
825
|
+
}
|
|
826
|
+
declare function sh(cmd: string, args: string[], opts?: {
|
|
827
|
+
cwd?: string;
|
|
828
|
+
input?: string;
|
|
829
|
+
timeoutMs?: number;
|
|
830
|
+
env?: Record<string, string | undefined>;
|
|
831
|
+
}): ShResult;
|
|
832
|
+
declare function have(cmd: string): boolean;
|
|
833
|
+
declare function slugify(input: string): string;
|
|
834
|
+
declare function clip(s: string, max: number): string;
|
|
835
|
+
declare function clipInline(s: string, max: number): string;
|
|
836
|
+
declare function escapeRegExp(s: string): string;
|
|
837
|
+
declare function foldText(s: string): string;
|
|
838
|
+
declare function keywords(question: string): string[];
|
|
839
|
+
declare function rankedKeywords(question: string): string[];
|
|
840
|
+
declare function rrf<T>(lists: T[][], keyOf: (item: T) => string, k?: number): Map<string, number>;
|
|
841
|
+
declare function subtokens(raw: string): string[];
|
|
842
|
+
|
|
843
|
+
declare const FIELDS: readonly ["name", "path", "heading", "summary", "doc", "body"];
|
|
844
|
+
type Field = (typeof FIELDS)[number];
|
|
845
|
+
type RankMode = "graph" | "lexical";
|
|
641
846
|
interface SearchOptions {
|
|
642
847
|
limit?: number;
|
|
643
848
|
fuzzy?: boolean;
|
|
849
|
+
rank?: RankMode;
|
|
850
|
+
}
|
|
851
|
+
/** A specific declaration a result matched, so a caller can jump straight to it. */
|
|
852
|
+
interface SymbolHit {
|
|
853
|
+
name: string;
|
|
854
|
+
kind: string;
|
|
855
|
+
line: number;
|
|
644
856
|
}
|
|
645
857
|
interface SearchResult {
|
|
646
858
|
file: string;
|
|
647
859
|
score: number;
|
|
648
860
|
matchedTerms: string[];
|
|
649
861
|
topSymbols: string[];
|
|
862
|
+
matchedFields?: Field[];
|
|
863
|
+
line?: number;
|
|
864
|
+
symbolHits?: SymbolHit[];
|
|
650
865
|
fuzzyTerms?: string[];
|
|
651
866
|
}
|
|
652
|
-
|
|
867
|
+
/**
|
|
868
|
+
* Rank the scanned files against a natural-language (or identifier) query.
|
|
869
|
+
* Pure and deterministic: same scan + query + options → the same results,
|
|
870
|
+
* byte-for-byte.
|
|
871
|
+
*/
|
|
653
872
|
declare function searchIndex(scan: RepoScan, query: string, opts?: SearchOptions): SearchResult[];
|
|
654
873
|
|
|
655
874
|
declare const EMBED_VERSION = 1;
|
|
@@ -981,29 +1200,6 @@ declare function shortHash(s: string, n?: number): string;
|
|
|
981
1200
|
declare function byStr(a: string, b: string): number;
|
|
982
1201
|
declare function byKey<T>(keyOf: (x: T) => string): (a: T, b: T) => number;
|
|
983
1202
|
|
|
984
|
-
interface ShResult {
|
|
985
|
-
ok: boolean;
|
|
986
|
-
status: number | null;
|
|
987
|
-
stdout: string;
|
|
988
|
-
stderr: string;
|
|
989
|
-
missing: boolean;
|
|
990
|
-
}
|
|
991
|
-
declare function sh(cmd: string, args: string[], opts?: {
|
|
992
|
-
cwd?: string;
|
|
993
|
-
input?: string;
|
|
994
|
-
timeoutMs?: number;
|
|
995
|
-
env?: Record<string, string | undefined>;
|
|
996
|
-
}): ShResult;
|
|
997
|
-
declare function have(cmd: string): boolean;
|
|
998
|
-
declare function slugify(input: string): string;
|
|
999
|
-
declare function clip(s: string, max: number): string;
|
|
1000
|
-
declare function clipInline(s: string, max: number): string;
|
|
1001
|
-
declare function escapeRegExp(s: string): string;
|
|
1002
|
-
declare function foldText(s: string): string;
|
|
1003
|
-
declare function keywords(question: string): string[];
|
|
1004
|
-
declare function rankedKeywords(question: string): string[];
|
|
1005
|
-
declare function rrf<T>(lists: T[][], keyOf: (item: T) => string, k?: number): Map<string, number>;
|
|
1006
|
-
|
|
1007
1203
|
declare function runCli(rawArgv: string[]): Promise<void>;
|
|
1008
1204
|
|
|
1009
|
-
export { type ArchRule, type BuildIndexOptions, type BuiltinRule, type CallerEntry, type CallerIndex, type CallerIndexOptions, type CallerSite, type ChangeCoupling, type ChangedSymbol, type ClusteredMermaidOptions, type ClusteredMermaidResult, type CodeInfo, type CodeSymbol, type CouplingOptions, DEFAULT_DELTA_DEPTH, DEFAULT_GRAMMARS_URL, DEFAULT_MAX_FILES, type DeadSymbol, type DeltaChange, type DeltaError, type DeltaModule, type DeltaOptions, type DeltaResult, type DiffFile, type DiffSpec, EMBED_VERSION, ENGINE_VERSION, EXTRACTOR_VERSION, type Edge, type EdgeKind, type EditResult, type EmbedEndpointOptions, type EmbedPullTarget, type EmbeddingIndex, type EmbeddingRecord, type EmbeddingUnit, type ExtractedRecord, type FileCategory, type FileKind, type FileNode, type FileRecord, type FindSymbolOptions, type ForbiddenEdgeRule, type GrammarsPullResult, type GrammarsPullTarget, type GrammarsTier, type GrammarsTierName, type Graph, type GrepOptions, type Hotspot, type Hunk, INDEX_DIR, type IgnoreRule, type ImpactResult, type ImpactedFile, type IndexArtifacts, MARKDOWN_EXT, type MarkdownInfo, type McpServerOptions, type MermaidOptions, type ModuleInfo, type ModuleNode, type NeighborLink, type NeighborResult, type PersistedCacheEntry, type PersistedCacheMap, type PersistedMeta, RISK_WEIGHTS, type RawCallerIndex, type RawCallerSite, type RawRef, type RenderScipOptions, type RepoMapOptions, type RepoScan, type Resolution, type ResolveContext, type RiskHotspot, type RuleSeverity, type RuleViolation, SCHEMA_VERSION, type ScanOptions, type ScanSummary, type SearchHit, type SearchOptions, type SearchResult, type SemanticSearchOptions, type SemanticSearchResult, type ShResult, type StaticEmbedModel, type SurpriseEdge, type SymbolComplexity, type SymbolIndex, type SymbolMatch, type SymbolReferences, type TestMap, type Tier, type WalkOptions, type WalkResult, type WalkedFile, type WarmGrammarsOptions, type WarmGrammarsResult, type WorkspaceInfo, type WorkspaceKind, type WorkspacePackage, allGrammarKeys, applyCentrality, basicTokenize, betweennessOf, buildArtifactsFromScan, buildCallerIndex, buildCodeRecord, buildEmbeddingIndex, buildEndpointIndex, buildGraph, buildIndexArtifacts, buildModules, buildRawCallerIndex, buildResolveContext, buildSymbolIndex, byKey, byStr, categorize, changeCoupling, changedSince, checkRules, classify, clip, clipInline, communityOf, compileGlobs, complexityOfSource, computeDelta, computeImportPairs, computeSurprises, computeSymbolRefs, computeTestMap, deleteMemory, deltaFor, deserializeEmbeddings, detectCommunities, detectWorkspaces, diffFiles, diffHunks, embedEndpointUrl, embedViaEndpoint, embeddingUnits, enclosingSymbol, encode, encodeQueryViaEndpoint, ensureGrammars, escapeRegExp, extToLang, extractAst, extractCode, extractGrammarsTarball, extractInParallel, extractMarkdown, extractSymbols, extractTarInto, fetchExpectedSha256, fetchGrammarsTarball, findDeadCode, findReferences, findSymbol, foldText, formatDeltaPanel, gitChurn, grammarKeyForExt, grammarKeysForExts, grammarReady, grepRepo, hasEmbedModel, have, headCommit, healthzUrl, hubThreshold, impactOf, insertAfterSymbol, insertBeforeSymbol, intDot, isCode, isDoc, isGitWorktree, isIgnored, isSurprising, isTestFile, isTestPath, keptCodeFiles, keywords, languageOf, listMemories, loadEmbedModel, neighborsOf, pagerankOf, parseGitignore, parseRules, preloadArtifacts, preloadSession, probeEndpoint, pullGrammars, quantize, rankHotspots, rankedKeywords, readMemory, readPersistedIndex, readText, renderGraphJson, renderMermaid, renderMermaidClustered, renderRepoMap, renderScip, renderSymbolsJson, replaceSymbolBody, resolveBaseRef, resolveCallEdges, resolveDocLink, resolveEmbedEndpoint, resolveEmbedModelDir, resolveEmbedPullUrl, resolveGrammarsDir, resolveGrammarsPullTarget, resolveGrammarsTier, resolveImport, resolveUniqueSymbol, reverseClosure, rewriteCommand, riskHotspots, roundHalfToEven, rrf, runCli, runExtractWorker, runMcpServer, scanRepo, scanRepoParallel, scanSummary, searchIndex, searchSemantic, serializeEmbeddings, sh, sha1, sharedGrammarsCacheDir, shortHash, slugify, subtokens, symbolComplexity, symbolsInHunks, symbolsOverview, testsForModule, tierForPath, toCacheMap, tokenize, uniqueSymbolDefs, untestedModules, untrackedFiles, walk, warmGrammars, wordpiece, workerCount, writeMemory };
|
|
1205
|
+
export { type ArchRule, type BuildIndexOptions, type BuiltinRule, CORE_GRAMMARS, type CallerEntry, type CallerIndex, type CallerIndexOptions, type CallerSite, type ChangeCoupling, type ChangedSymbol, type ClusteredMermaidOptions, type ClusteredMermaidResult, type CodeInfo, type CodeSymbol, type CouplingOptions, DEFAULT_DELTA_DEPTH, DEFAULT_GRAMMARS_URL, DEFAULT_MAX_FILES, type DeadSymbol, type DeltaChange, type DeltaError, type DeltaModule, type DeltaOptions, type DeltaResult, type DiffFile, type DiffSpec, type Direction, EMBED_VERSION, ENGINE_VERSION, EXTENDED_GRAMMARS, EXTRACTOR_VERSION, EXT_GRAMMAR, type Edge, type EdgeKind, type EditResult, type EmbedEndpointOptions, type EmbedPullTarget, type EmbeddingIndex, type EmbeddingRecord, type EmbeddingUnit, type ExtractedRecord, type FileCategory, type FileKind, type FileNode, type FileRecord, type FindSymbolOptions, type ForbiddenEdgeRule, type GrammarsPullResult, type GrammarsPullTarget, type GrammarsTier, type GrammarsTierName, type Graph, type GrepOptions, type HierarchyRef, type Hotspot, type Hunk, INDEX_DIR, type IgnoreRule, type ImpactResult, type ImpactedFile, type IndexArtifacts, MARKDOWN_EXT, type MarkdownInfo, type McpServerOptions, type MermaidOptions, type ModuleInfo, type ModuleNode, type NeighborLink, type NeighborResult, type Neighborhood, type PersistedCacheEntry, type PersistedCacheMap, type PersistedMeta, RISK_WEIGHTS, type RawCallerIndex, type RawCallerSite, type RawRef, type RawRelation, type RenderScipOptions, type RepoMapOptions, type RepoScan, type Resolution, type ResolveContext, type ResolvedRelation, type RiskHotspot, type RuleSeverity, type RuleViolation, SCHEMA_VERSION, type ScanOptions, type ScanSummary, type SearchHit, type SearchOptions, type SearchResult, type SemanticSearchOptions, type SemanticSearchResult, type ShResult, type StaticEmbedModel, type SurpriseEdge, type SymbolComplexity, type SymbolEdge, type SymbolEdgeKind, type SymbolGraph, type SymbolIndex, type SymbolMatch, type SymbolNode, type SymbolReferences, type TagDefinition, type TagsQueryStatus, type TestMap, type Tier, type TypeHierarchyEntry, type WalkOptions, type WalkResult, type WalkedFile, type WarmGrammarsOptions, type WarmGrammarsResult, type WorkspaceInfo, type WorkspaceKind, type WorkspacePackage, allGrammarKeys, applyCentrality, basicTokenize, betweennessOf, buildArtifactsFromScan, buildCallerIndex, buildCodeRecord, buildEmbeddingIndex, buildEndpointIndex, buildGraph, buildIndexArtifacts, buildModules, buildRawCallerIndex, buildResolveContext, buildSymbolGraph, buildSymbolIndex, buildTypeHierarchy, byKey, byStr, categorize, changeCoupling, changedSince, checkRules, classify, clip, clipInline, communityOf, compileGlobs, complexityOfSource, computeDelta, computeImportPairs, computeSurprises, computeSymbolRefs, computeTestMap, deleteMemory, deltaFor, deserializeEmbeddings, detectCommunities, detectWorkspaces, diffFiles, diffHunks, embedEndpointUrl, embedViaEndpoint, embeddingUnits, enclosingSymbol, encode, encodeQueryViaEndpoint, ensureGrammars, escapeRegExp, extToLang, extractAst, extractCode, extractGrammarsTarball, extractInParallel, extractMarkdown, extractSymbols, extractTags, extractTarInto, fetchExpectedSha256, fetchGrammarsTarball, findDeadCode, findReferences, findSymbol, foldText, formatDeltaPanel, gitChurn, grammarKeyForExt, grammarKeysForExts, grammarReady, grepRepo, hasEmbedModel, have, headCommit, healthzUrl, hubThreshold, impactOf, implementationsOf, insertAfterSymbol, insertBeforeSymbol, intDot, isCode, isDoc, isGitWorktree, isIgnored, isSurprising, isTestFile, isTestPath, keptCodeFiles, keywords, languageOf, listMemories, loadEmbedModel, neighborhood, neighborsOf, pagerankOf, parseGitignore, parseRules, preloadArtifacts, preloadSession, probeEndpoint, pullGrammars, quantize, rankHotspots, rankedKeywords, readMemory, readPersistedIndex, readText, renderGraphJson, renderMermaid, renderMermaidClustered, renderRepoMap, renderScip, renderSymbolsJson, replaceSymbolBody, resolveBaseRef, resolveCallEdges, resolveDocLink, resolveEmbedEndpoint, resolveEmbedModelDir, resolveEmbedPullUrl, resolveGrammarsDir, resolveGrammarsPullTarget, resolveGrammarsTier, resolveImport, resolveRelationEdges, resolveRelations, resolveUniqueSymbol, reverseClosure, rewriteCommand, riskHotspots, roundHalfToEven, rrf, runCli, runExtractWorker, runMcpServer, scanRepo, scanRepoParallel, scanSummary, searchIndex, searchSemantic, serializeEmbeddings, sh, sha1, sharedGrammarsCacheDir, shortHash, slugify, subtokens, symbolComplexity, symbolId, symbolsInHunks, symbolsOverview, tagsQueryStatus, testsForModule, tierForPath, toCacheMap, tokenize, typeEntry, uniqueSymbolDefs, untestedModules, untrackedFiles, walk, warmGrammars, wordpiece, workerCount, writeMemory };
|