UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

30 lines • 1.38 kB
/** * Applies the rules reading one source to new lines and folds the captures into the field store. * Ported from oh-my-pi 9df0457b31 (MIT, Copyright Can Boluk et al.). */ import type { FieldStore } from "./field-state.ts"; import { type CompiledLineMatcher, type LineMatcher } from "./matcher.ts"; import type { JobWidgetSpec } from "./spec-types.ts"; /** One rule with its pattern's named groups resolved to positions. */ interface CompiledRule { /** Position of the key group among the pattern's named groups; -1 without a key. */ key: number; captures: { index: number; field: string; text: boolean; }[]; count: string | undefined; scale: number; } /** The rules reading one source, matched over their distinct patterns in one call per refresh. */ export interface SourceMatcher { compiled: CompiledLineMatcher; /** Per pattern, the rules using it, in spec order. */ rules: CompiledRule[][]; } export declare function compileSourceMatcher(spec: JobWidgetSpec, matcher: LineMatcher, sourceId: string): SourceMatcher | undefined; /** Matches `lines` and pushes every capture; returns the indexes of the lines some rule matched. */ export declare function applyMatches(entry: SourceMatcher, lines: readonly string[], t: number, store: FieldStore): Set<number>; export {}; //# sourceMappingURL=rule-match.d.ts.map