/** * Write a blob to an arbitrary `/` path on the orphan * branch, preserving every other env/file entry already on the branch. * * Pipeline: hash-object → mktree → commit-tree → update-ref. Factored out of * `writeSnapshot` so the release ledger (#568, epic #551 "Build & deploy * observability") can reuse the identical git-plumbing path for a different * filename (`releases.jsonl`) under the same env directory, rather than a * parallel storage mechanism. * * Exported (not just used internally) so ./build-ledger-store.ts (#609) can * reuse this exact plumbing for a top-level directory that isn't really an * "environment" (`_builds`, keyed by manifest digest rather than env name) — * a build archive is promoted by digest across environments, never owned by * one, so it belongs in its own digest-keyed namespace on the same orphan * branch rather than duplicated per env. The parameter is still named * `environment` because it is literally the first path segment / root-tree * entry name this function's tree-building logic groups by; callers outside * this module that pass a non-env value (like `_builds`) are relying on that * generic behavior, not on any env-specific semantics. */ export declare function writeBlobToPath(environment: string, filename: string, content: string, commitMessage: string, opts?: { cwd?: string; }): Promise; /** * Read a blob from an arbitrary `/` path on the orphan * branch. Returns null when the path doesn't exist (missing branch, env, or * file). Sibling of `writeBlobToPath`. Exported for the same reason * `writeBlobToPath` is — ./build-ledger-store.ts (#609) reads manifests back * from the `_builds` namespace through this identical helper. */ export declare function readBlobFromPath(environment: string, filename: string, opts?: { cwd?: string; }): Promise; /** * Storage key for a snapshot on the orphan branch. Single-stack projects key by * lexicon (`/.json`, unchanged). A multi-stack project (see * `stacks` in ChantConfig, #932) folds the stack in as `__` * (`/__.json`) so sibling stacks that deploy the same * lexicon don't overwrite each other's snapshots. The `__` separator can't * collide with a lexicon name (lexicons are single tokens) and round-trips * through `readSnapshot`/`readEnvironmentSnapshots` unchanged. */ export declare function snapshotStorageKey(lexicon: string, stack?: string): string; /** * Write a state snapshot JSON to the orphan branch. * * Pipeline: hash-object → mktree → commit-tree → update-ref */ export declare function writeSnapshot(environment: string, lexicon: string, json: string, opts?: { cwd?: string; }): Promise; /** * Read a snapshot from the orphan branch. */ export declare function readSnapshot(environment: string, lexicon: string, opts?: { cwd?: string; }): Promise; /** * Read a snapshot at a specific orphan-branch commit (#822). `readSnapshot` reads * the branch tip; this reads `:/.json` for any commit `ref` * (as listed by {@link listSnapshots}), so two historical snapshots can be diffed. * Returns null if that env/lexicon wasn't captured at `ref`. */ export declare function readSnapshotAt(environment: string, lexicon: string, ref: string, opts?: { cwd?: string; }): Promise; /** * Append one immutable release record line to `/releases.jsonl` * on the orphan branch (#568, epic #551 "Build & deploy observability"). Same * git-plumbing path `writeSnapshot` uses, just a different filename under the * env directory and append-only (JSON Lines) instead of replace-whole-file: * each deploy adds one line, never rewrites a previous one, so the ledger * stays a durable, append-only history rather than a point-in-time snapshot. * * Low-level plumbing over an already-serialized line; ../release-ledger.ts's * `appendReleaseRecord` is the typed, validated public API most callers want * — named distinctly here (`ReleaseRecordLine`) to avoid re-export ambiguity * between the two modules. * * Returns the new orphan-branch commit SHA — the caller still owns pushing * via `pushLifecycle` under the same concurrent-write lease `writeSnapshot` * uses. */ export declare function appendReleaseRecordLine(environment: string, recordJson: string, opts?: { cwd?: string; }): Promise; /** * Read every release record line for `environment` from the orphan branch, * oldest first, as raw JSON strings. Returns `[]` when no ledger exists yet * for that env (never throws — a component that has never recorded a deploy * is a normal, expected state). ../release-ledger.ts's `readReleaseLedger` * parses/validates these lines into typed `ReleaseRecord`s. */ export declare function readReleaseLedgerLines(environment: string, opts?: { cwd?: string; }): Promise; /** * List every environment that has a release ledger on the orphan branch — * the root-level directories under `chant/lifecycle` that carry a * `releases.jsonl` entry. Used by `chant components status` (no env arg) to * discover which environments to report on. */ export declare function listLedgerEnvironments(opts?: { cwd?: string; }): Promise; /** * List every filename directly under `/` on the orphan branch (no * recursion), or `[]` when the branch/directory doesn't exist yet. Generic * sibling of `readEnvironmentSnapshots`'s inline file listing, factored out * so ./build-ledger-store.ts (#609) can enumerate every persisted build * manifest (`_builds/.json`) without duplicating this `git ls-tree * --name-only` call. */ export declare function listFilesInDir(dir: string, opts?: { cwd?: string; }): Promise; /** * Read all snapshots for an environment (all lexicons). */ export declare function readEnvironmentSnapshots(environment: string, opts?: { cwd?: string; }): Promise>; /** * List snapshot history from the orphan branch. */ export declare function listSnapshots(opts?: { cwd?: string; environment?: string; }): Promise>; /** * Thrown by pushLifecycle when the remote chant/lifecycle branch has moved since * the local snapshot was prepared — i.e. another snapshot for this or a * different env was pushed concurrently. The caller should fetch and retry. */ export declare class StaleLifecycleBranchError extends Error { readonly expected: string | null; constructor(expected: string | null, stderr: string); } /** * Look up the remote-tracking SHA for chant/lifecycle, if any. Returns null when * the remote ref doesn't exist locally yet (e.g. first-ever snapshot). */ export declare function getRemoteLifecycleBranchSha(remote: string, opts?: { cwd?: string; }): Promise; /** * Push the state branch to remote with --force-with-lease. * * If the remote chant/lifecycle ref has advanced past the local remote-tracking * SHA captured at the start of this push, the push is rejected and we throw * StaleLifecycleBranchError so the caller can surface a recovery hint. * * Returns false (without throwing) only when no remote is configured at all. */ export declare function pushLifecycle(opts?: { cwd?: string; }): Promise; /** * Fetch the state branch from remote. */ export declare function fetchLifecycle(opts?: { cwd?: string; }): Promise; /** * Get the current HEAD commit SHA of the main working branch. */ export declare function getHeadCommit(opts?: { cwd?: string; }): Promise; //# sourceMappingURL=git.d.ts.map