import type { SourceMeta } from "./types"; /** * Parsed frontmatter from rule files. */ export interface RuleFrontmatter { description?: string; globs?: string[]; alwaysApply?: boolean; /** New key for TTSR match conditions. */ condition?: string | string[]; /** New key for TTSR stream scope. */ scope?: string | string[]; /** Per-rule TTSR interrupt mode override. */ interruptMode?: "never" | "prose-only" | "tool-only" | "always"; [key: string]: unknown; } /** * A rule providing project-specific guidance and constraints. */ export interface Rule { /** Rule name (derived from filename) */ name: string; /** Absolute path to rule file */ path: string; /** Rule content (after frontmatter stripped) */ content: string; /** Globs this rule applies to (if any) */ globs?: string[]; /** Whether to always include this rule */ alwaysApply?: boolean; /** Description (for agent-requested rules) */ description?: string; /** Regex condition(s) that can trigger TTSR interruption. */ condition?: string[]; /** Optional stream scope tokens (for example: text, thinking, tool:edit(*.ts)). */ scope?: string[]; /** Per-rule TTSR interrupt mode override (falls back to global ttsr.interruptMode). */ interruptMode?: "never" | "prose-only" | "tool-only" | "always"; /** Source metadata */ _source: SourceMeta; } /** * Parse `condition` + `scope` from rule frontmatter. * * - `condition` accepts string or string[] * - `scope` accepts string or string[] * - legacy `ttsr_trigger` / `ttsrTrigger` are accepted as a `condition` fallback * - condition tokens that look like file globs become scope shorthands: * `*.rs` => `tool:edit(*.rs)`, `tool:write(*.rs)` and a catch-all condition `.*` */ export declare function parseRuleConditionAndScope(frontmatter: RuleFrontmatter): Pick; /** * Process-global snapshot of rules the active session loaded. * Read by internal URL protocol handlers (rule://). */ export declare function getActiveRules(): readonly Rule[]; /** Replace the active rule snapshot. Called once per top-level session. */ export declare function setActiveRules(value: readonly Rule[]): void; /** Reset the active rule snapshot. Test-only. */ export declare function resetActiveRulesForTests(): void; export declare const ruleCapability: import("./types").Capability;