declare const NEAT_DIR = ".neat"; declare const PROJECT_FILE = "project.json"; declare const BINDING_FILE = "binding.json"; declare const PROJECT_SCHEMA_VERSION = 1; declare const BINDING_SCHEMA_VERSION = 1; declare const NEAT_DIR_IGNORES: string[]; interface ProjectIdentity { schemaVersion: 1; projectId: string; name: string; } type BindingKind = 'local' | 'hosted'; interface ProjectBinding { schemaVersion: 1; binding: BindingKind; org?: string; daemonHint?: { port: number; }; } declare class ProjectIdentityError extends Error { constructor(message: string); } declare const PROJECT_ID_RE: RegExp; /** * `prj_` + a ULID: 48 bits of millisecond time then 80 random bits, in * Crockford base32 (26 characters). Time-ordered, collision-free in practice, * and readable. No dependency: the encoding is a few lines. */ declare function mintProjectId(now?: number, rand?: Buffer): string; declare function neatDir(root: string): string; declare function projectFilePath(root: string): string; declare function bindingFilePath(root: string): string; /** The project's identity at `root`, or undefined when it has none. */ declare function readProjectIdentity(root: string): Promise; /** * How this machine reaches the project at `root`. A missing binding.json is * `local`, and `absent` says so, so a caller can tell the user instead of * assuming silently. */ declare function readProjectBinding(root: string): Promise; declare function readProjectIdentitySync(root: string): ProjectIdentity | undefined; declare function readBindingSync(root: string): ProjectBinding & { absent: boolean; }; declare function findProjectRootSync(start: string): string | undefined; /** `readProjectBinding` under the name the other Phase 0 work orders use. */ declare const readBinding: typeof readProjectBinding; /** * The nearest directory at or above `start` that holds a `.neat/project.json`, * or undefined. Stops at the filesystem root. */ declare function findProjectRoot(start: string): Promise; interface EnsureIdentityResult { identity: ProjectIdentity; binding: ProjectBinding; createdIdentity: boolean; createdBinding: boolean; renamed: boolean; writtenFiles: string[]; } /** * Give the project at `root` its identity, or keep the one it has (ADR-273). * Mints a projectId only when no .neat/project.json exists; a re-run keeps the id. * `name` sets the display name on first mint; on a re-run it renames only when * `rename` is set (an explicit --project). Writes a local binding.json only when * none exists, and makes sure .neat/.gitignore keeps the per-machine files out of * commits. Idempotent. */ declare function ensureProjectIdentity(root: string, opts: { name: string; rename?: boolean; now?: number; }): Promise; /** * Write .neat/project.json with an identity that already exists elsewhere — a * hosted project being cloned to this machine (Phase 1). The id is validated and * kept as given, never re-minted; `ensureProjectIdentity` is the minting path. * A directory that already holds this id is left as it is; one holding a * different id is refused, so a caller never has to read-compare-write. */ declare function writeProjectIdentity(root: string, id: { projectId: string; name: string; }): Promise; /** * Set how this machine reaches the project at `root` (project-identity.md §2): * `local`, or `hosted` in `org`. The one writer of binding.json besides `init`. */ declare function writeProjectBinding(root: string, b: { binding: BindingKind; org?: string; }): Promise; /** One line for a run's report: what `ensureProjectIdentity` did. */ declare function identityReportLine(r: EnsureIdentityResult): string; /** * What a client is talking to: the resolved project, how it was reached, and the * daemon that answered. `projectId` is absent only for a legacy project that has * no .neat/project.json yet (§3 level 4). */ interface ResolvedIdentity { name: string; projectId?: string; binding: BindingKind | 'pinned'; org?: string; daemon: string; } /** * The one line every daemon response, MCP result and error, `neat://status` and * CLI read verb carries: * `project= () · binding= | pinned> · daemon=`. * One renderer, so every surface prints it the same way (#1373). */ declare function bindingLine(id: ResolvedIdentity): string; export { BINDING_FILE, BINDING_SCHEMA_VERSION, type BindingKind, type EnsureIdentityResult, NEAT_DIR, NEAT_DIR_IGNORES, PROJECT_FILE, PROJECT_ID_RE, PROJECT_SCHEMA_VERSION, type ProjectBinding, type ProjectIdentity, ProjectIdentityError, type ResolvedIdentity, bindingFilePath, bindingLine, ensureProjectIdentity, findProjectRoot, findProjectRootSync, identityReportLine, mintProjectId, neatDir, projectFilePath, readBinding, readBindingSync, readProjectBinding, readProjectIdentity, readProjectIdentitySync, writeProjectBinding, writeProjectIdentity };