/** * Pure utilities for the pi-context-optimizer extension. * * The bash-safety classifier and the todo extract/mark helpers are lifted from * pi's bundled `examples/extensions/plan-mode/utils.ts` (same semantics) so the * gate behaves the same as the reference design. They are kept pure and * dependency-free so they can be unit-tested in isolation. */ /** * Directory that holds all plan artifacts for one session. * * /.pi/context-optimizer// * plan.md * tasks.md * walkthrough.md * status.json * knowledge/ (phase 2) * * We derive a folder name from the session JSONL file's basename because pi * exposes no numeric conversation id — `ctx.sessionManager.getSessionFile()` * is the canonical identifier and is a JSONL path. */ export declare function artifactDirFor(cwd: string, sessionFile: string | null | undefined): string; export declare const PLAN_FILE = "plan.md"; export declare const TASKS_FILE = "tasks.md"; export declare const WALKTHROUGH_FILE = "walkthrough.md"; export declare const STATUS_FILE = "status.json"; export declare const KNOWLEDGE_DIR = "knowledge"; /** True only if the command is both non-destructive AND explicitly allowlisted. */ export declare function isSafeReadonlyCommand(command: string): boolean; export interface TaskItem { step: number; text: string; status: "pending" | "in_progress" | "done" | "failed"; dependencies?: number[]; } export declare function extractTaskItems(message: string): TaskItem[]; export declare function markDoneSteps(text: string, items: TaskItem[]): number; /** Render a tasks.md checklist body. */ export declare function renderTasksMd(tasks: TaskItem[]): string; /** * Detect the project's deterministic invariants gate command from its files. * * Returns a shell command string to run before declaring a step done, or null * if no recognized project type was found. The command is defensive: any * read/parse error yields null (the protocol tells the sub-agent to skip the * gate if none was provided). * * Detection order: * - tsconfig.json → npx tsc --noEmit (+ lint script from package.json) * - go.mod → go vet ./... && go build ./... * - pyproject.toml / setup.py → ruff check . (+ mypy . if mypy config exists) */ export declare function detectInvariantsGate(cwd: string): string | null; //# sourceMappingURL=utils.d.ts.map