UNPKG

@phren/cli

Version:

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

111 lines (110 loc) • 6.18 kB
import type { RetentionPolicyPatch } from "./governance/policy.js"; import type { DreamingConfig } from "./config/dreaming.js"; export declare const PROJECT_OWNERSHIP_MODES: readonly ["phren-managed", "detached", "repo-managed"]; export type ProjectOwnershipMode = typeof PROJECT_OWNERSHIP_MODES[number]; export interface ProjectMcpServerEntry { command: string; args?: string[]; env?: Record<string, string>; } export interface ProjectConfigOverrides { findingSensitivity?: "minimal" | "conservative" | "balanced" | "aggressive"; proactivity?: "high" | "medium" | "low"; proactivityFindings?: "high" | "medium" | "low"; retentionPolicy?: RetentionPolicyPatch; workflowPolicy?: { lowConfidenceThreshold?: number; riskySections?: Array<"Review" | "Stale" | "Conflicts">; }; /** Per-project overrides of the `dreaming` domain (config/dreaming.ts). */ dreaming?: Partial<DreamingConfig>; } export interface ProjectAccessControl { admins?: string[]; contributors?: string[]; readers?: string[]; } export interface ProjectConfig { ownership?: ProjectOwnershipMode; /** * The folder the project was last added from, on whichever machine that was. * Kept for older CLIs; a synced store shares it across every computer, so * it is only authoritative on the machine that wrote it. */ sourcePath?: string; /** Per-machine source folders, keyed by `getMachineName()`. Wins over `sourcePath`. */ sourcePaths?: Record<string, string>; /** * The repository's clone URL on any host (`https://…`, `ssh://…`, * `git@host:owner/repo.git`). Lets a Git server such as gitboy match one of * its repositories to this project. Optional; never used to fetch. */ remote?: string; /** The forge repository that holds this project's issues. */ issues?: string; skills?: boolean; hooks?: { enabled?: boolean; UserPromptSubmit?: boolean; Stop?: boolean; SessionStart?: boolean; PostToolUse?: boolean; }; mcpServers?: Record<string, ProjectMcpServerEntry>; config?: ProjectConfigOverrides; access?: ProjectAccessControl; /** The account pools whose Claude accounts may do this project's work (bridge/account-pools.ts); none: any. */ allowedPools?: string[]; /** The Claude account and model the `helper` MCP tool runs this project's helper tasks with (bridge/helper.ts). */ helper?: { account?: string; model?: string; }; } export declare const PROJECT_HOOK_EVENTS: readonly ["UserPromptSubmit", "Stop", "SessionStart", "PostToolUse"]; export type ProjectHookEvent = typeof PROJECT_HOOK_EVENTS[number]; type ProjectHookConfig = NonNullable<ProjectConfig["hooks"]>; export declare function parseProjectOwnershipMode(raw: string | undefined | null): ProjectOwnershipMode | undefined; export declare function projectConfigPath(phrenPath: string, project: string): string; /** A project's `phren.project.yaml`, in the primary store or the team store that holds it; null when it escapes. */ export declare function resolveProjectConfigPath(phrenPath: string, project: string): string | null; export declare function clearProjectConfigCache(): void; export declare function readProjectConfig(phrenPath: string, project: string): ProjectConfig; export declare function writeProjectConfig(phrenPath: string, project: string, patch: Partial<ProjectConfig>): ProjectConfig; /** * Sets one top-level field of a project's config, or removes it when `value` is undefined. Refuses a config file * it can't parse rather than replacing it. */ export declare function setProjectConfigField<K extends keyof ProjectConfig>(phrenPath: string, project: string, key: K, value: ProjectConfig[K] | undefined): ProjectConfig; export declare function updateProjectConfigOverrides(phrenPath: string, project: string, updater: (current: ProjectConfigOverrides) => ProjectConfigOverrides): ProjectConfig; /** * Where this project's source lives on this machine. The store syncs between * computers, so the shared `sourcePath` is often another machine's folder: * this machine's `sourcePaths` entry wins, and the shared value is only used * when nothing more specific was recorded. */ export declare function getProjectSourcePath(phrenPath: string, project: string, config?: ProjectConfig, machine?: string): string | undefined; /** Local folders for a project, in the order the code index checks them. */ export declare function projectCheckoutCandidates(project: string, sourcePath: string | undefined, env?: NodeJS.ProcessEnv): string[]; export declare function isGitRepository(directory: string): boolean; /** * The project's `remote:` clone URL, safe to hand to another program: a * string of a known clone form, with any password (and, for http(s), the user * name) removed. Anything else, including local paths, reads as null. */ export declare function getProjectRemote(phrenPath: string, project: string, config?: ProjectConfig): string | null; /** * Record `sourceRoot` as this machine's folder for the project, alongside the * legacy shared `sourcePath` older CLIs read. */ export declare function recordProjectSourcePath(phrenPath: string, project: string, sourceRoot: string, patch?: Partial<ProjectConfig>, machine?: string): ProjectConfig; export declare function getProjectOwnershipDefault(phrenPath: string): ProjectOwnershipMode; export declare function getProjectOwnershipMode(phrenPath: string, project: string, config?: ProjectConfig): ProjectOwnershipMode; export declare function isProjectHookEnabled(phrenPath: string, project: string | null | undefined, event: ProjectHookEvent, config?: ProjectConfig): boolean; /** * Remove a per-project hook override, restoring inheritance from global config. * Pass event to clear a specific event override; omit to clear the whole hooks block. */ export declare function clearProjectHookOverride(phrenPath: string, project: string, event?: string): ProjectConfig; export declare function writeProjectHookConfig(phrenPath: string, project: string, patch: Partial<ProjectHookConfig>): ProjectConfig; export {};