@phren/cli
Version:
Knowledge layer for AI agents - CLI, MCP server, and data layer
44 lines (43 loc) • 2.83 kB
TypeScript
/** The first sentence of the reply's closing paragraph that announces a next
* step ("Let me…", "I'll…", "Now running…"), else undefined. The closing line
* counts even as a list item; earlier lines only as prose, so a summary list
* that quotes an old step is not one. */
export declare function announcedNextStep(reply: string | undefined): string | undefined;
/** The first sentence of the reply's closing paragraph that waits on work
* still to finish ("Now waiting on the rerun.", "I'll push once it passes."),
* else undefined. */
export declare function awaitedInReply(reply: string | undefined): string | undefined;
/** A checkout git could not read in time (or at all): its work is unknown,
* so a turn there is never closed on the strength of it. */
export declare const UNKNOWN = "unknown";
export type Uncommitted = number | typeof UNKNOWN | undefined;
/** Tracked files with uncommitted changes (staged or not) in the checkout at
* `directory`. Untracked files are left out: a main checkout often holds the
* owner's own (worktree folders, scratch files) and they are not the worker's.
* Undefined when it is not a repository; UNKNOWN when git does not answer in
* time or fails otherwise. */
export declare function uncommittedFiles(directory: string, timeoutMs?: number): Promise<Uncommitted>;
/** `uncommittedFiles` for the returns loop, which asks about a finished
* worker on every poll (15 s) for as long as its receipt is watched: a read
* under a minute old answers. An UNKNOWN read is not kept, so the next poll
* (and the close recheck) asks git again. */
export declare function recentUncommitted(directory: string, now?: number, read?: (directory: string) => Promise<Uncommitted>): Promise<Uncommitted>;
/** The checkout `directory` is in: the nearest folder holding `.git` (a
* linked worktree's is a file), or undefined outside any. */
export declare function checkoutRoot(directory: string): Promise<string | undefined>;
/** Whether any of `folders` (other panes' working folders) is in the same
* checkout as `directory`. Uncommitted files there may be the owner's or a
* sibling worker's, so they say nothing about this worker. */
export declare function sharedCheckout(directory: string, folders: readonly unknown[]): Promise<boolean>;
/** Why a turn that ended is not done: it announced a next step, or it left
* uncommitted work with no PR reported or named in the reply (`unfinished`). `unchecked` when its
* checkout could not be read: the turn may be done, but it is not safe to
* close. Empty when it reads as done. */
export declare function unfinishedTurn(input: {
reply?: string;
prs?: readonly unknown[];
directory?: string;
}, uncommitted?: (directory: string) => Promise<Uncommitted>): Promise<{
unfinished?: string;
unchecked?: true;
}>;