@phren/cli
Version:
Knowledge layer for AI agents - CLI, MCP server, and data layer
39 lines (38 loc) • 2.36 kB
TypeScript
/** Git processes started here; citation checks count them against their per-run cap. */
export declare function checkoutGitCallCount(): number;
/**
* A remote URL as `host/owner/repo`: `git@github.com:owner/repo.git`,
* `ssh://git@GitHub.com:22/owner/repo` and `https://user:token@github.com/owner/repo`
* all give `github.com/owner/repo`. User names, passwords, ports, query strings and
* `.git` are dropped, and the host is lower-cased; the path keeps its case, and
* remotes are compared without it. A local path or anything else that is not a clone
* URL is undefined.
*/
export declare function citationRemote(url: string): string | undefined;
/** A checkout's `origin` remote as `citationRemote` gives it, from `git remote get-url origin`; undefined when it has none. */
export declare function originRemote(dir: string): string | undefined;
/**
* The commit a checkout has out, read from its git files without starting git: HEAD, then loose refs
* (following symbolic ones a few levels, as git does), then packed refs. Undefined for anything it
* does not understand, and the caller asks git.
*/
export declare function checkedOutCommit(dir: string): string | undefined;
/**
* This computer's checkout of a project: the first of its candidate folders that is a git repository.
* When the project's config names its `remote:`, only a checkout of that remote counts, so a folder
* that merely has the project's name never puts another repo in its citations.
*/
export declare function projectCheckout(storePath: string, project: string, env?: NodeJS.ProcessEnv): string | undefined;
/**
* This computer's checkout of a remote: a folder named after the repo first,
* then every store project's checkout. Only a folder whose `origin` is the same
* remote counts, so a folder that merely shares the name is never used.
*/
export declare function checkoutForRemote(phrenPath: string, remote: string, env?: NodeJS.ProcessEnv): string | undefined;
/**
* Checkouts here that may hold a repo cited by another computer's absolute path:
* git repositories with the same folder name, among the named folders and the
* store projects' checkouts. The caller proves one is the same repo by finding
* the cited commit in it.
*/
export declare function checkoutsNamedLike(phrenPath: string, repoPath: string, env?: NodeJS.ProcessEnv): string[];