UNPKG

@phren/cli

Version:

Knowledge layer for AI agents - CLI, MCP server, and data layer

55 lines (54 loc) • 2.75 kB
/** Where the clanker setting came from, for `phren config clanker`. */ export type ClankerSource = "PHREN_CLANKER" | "PHREN_FEATURE_PROGRESSIVE_DISCLOSURE" | "install preferences" | "default"; export declare function resolveClanker(phrenPath: string, env?: NodeJS.ProcessEnv): { on: boolean; source: ClankerSource; }; export declare function clankerEnabled(phrenPath: string, env?: NodeJS.ProcessEnv): boolean; export interface ClankerRow { id: string; project: string; type: string; title: string; keywords: string[]; /** Share of the query's terms the entry contains, 0–1. Absent for plain lists. */ score?: number; } /** Hook rows are few and arrive unasked, so they get room for the entry's point, not just its subject. */ export declare const HOOK_TITLE_CHARS = 140; /** Query terms as the snippet extractor reads them: lowercase, no FTS operators. */ export declare function queryTerms(query: string): string[]; /** Entry text without markers, comments, checkboxes or markdown decoration. */ export declare function plainEntryText(line: string): string; export declare function rowTitle(text: string, max?: number): string; /** * A few words that say what the entry is about: up to two query terms it * contains first, then identifier-looking words (paths, flags, names with dots, * dashes or capitals), then the longest remaining words. */ export declare function rowKeywords(text: string, terms?: string[], count?: number): string[]; export declare function termScore(text: string, terms: string[]): number; /** One row per line: `id [project] title [keywords] score`. */ export declare function formatRow(row: ClankerRow, showProject?: boolean): string; export interface DocEntry { /** `fid:xxxxxxxx` or `bid:xxxxxxxx`. */ id: string; line: string; /** The bullet plus its indented continuation (task Context, citations). */ text: string; } /** The bullets in a findings, task or archive document that carry a stable id. */ export declare function docEntries(content: string): DocEntry[]; /** Find one entry by `fid:`/`bid:` id in a document's content. */ export declare function findEntry(content: string, id: string): DocEntry | null; /** * Rows for one search hit. Findings, tasks and archive topics become one row * per matching entry (best first, at most `max`); other documents are one row * for the matched line under the document's mem: id. */ export declare function rowsForDoc(doc: { project: string; type: string; content: string; }, docId: string, terms: string[], bestLine: string, max: number): ClankerRow[]; export declare const CLANKER_FETCH_HINT = "Rows: id title [keywords], plus a 0-1 score on search hits. Full text: get_memory_detail id=<id>.";