/** * Opt-in commit of an increment's own bookkeeping files right after the CLI * writes them, so specs, ledgers and claims reach other machines with a plain * `git pull` instead of drifting as untracked folders. * * Off unless `.specweave/config.json` sets `git.autoCommitIncrement: true`; * `--no-commit` turns it off for one command. Only `spec.md`, `ledger.jsonl` * and `metadata.json` at the top of the increment folder (plus `handoff.md` * when the repo already tracks it) are committed, through a pathspec * (`git commit --only -- `), so anything else staged in a shared index * stays staged and out of the commit. The names are fixed files, so * `evidence/` and `reports/` can never match, and ignored files are never * added. The repo's hooks run. * * Every failure is one warning: the ledger write already happened and is the * source of truth, and the ledger is cumulative, so the next successful * command commits whatever this one missed. * * `git.autoPushIncrement: true` then pushes the branch to its upstream with a * plain (fast-forward only) push, through the upstream's remote as git config * has it, so the remote URL (HTTPS or SSH) is whatever the checkout uses. It * pushes only to a same-named branch on a real remote, and only when every * unpushed commit is one of these auto-commits, so it never publishes other * work or lands a feature branch on the branch it was cut from. * * @module core/increment/auto-commit */ /** Always committed when present. */ export declare const AUTO_COMMIT_FILES: readonly ["spec.md", "ledger.jsonl", "metadata.json"]; /** Committed only when the repo already tracks them (handoff docs are often gitignored). */ export declare const TRACKED_ONLY_FILES: readonly ["handoff.md"]; export interface AutoCommitConfig { commit: boolean; push: boolean; } /** `git.autoCommitIncrement` / `git.autoPushIncrement`, both off unless exactly `true`. */ export declare function readAutoCommitConfig(projectRoot: string): AutoCommitConfig; export interface AutoCommitRequest { /** Increment folder name; its number starts the subject. */ incrementId: string; /** claim, done, skip, block, release, create, handoff or accept-skip. */ action: 'claim' | 'done' | 'skip' | 'block' | 'release' | 'create' | 'handoff' | 'accept-skip'; /** Task ids the action recorded. */ tasks?: string[]; /** `--no-commit` passes false. */ commit?: boolean; /** false: never push here (the caller pushes, or `--no-push`). Default: `git.autoPushIncrement`. */ push?: boolean; /** Other increment folders the command changed (an increment it superseded). */ alsoDirs?: string[]; /** * The caller pushes the branch to its upstream right after (`handoff`): * commit only when that upstream is a same-named branch on a remote, or when * there is none yet (the caller then pushes to a same-named branch). */ callerPushesBranch?: boolean; } export interface AutoCommitResult { /** `off`: not enabled. `nothing`: no change to commit. `skipped`: the repo state does not allow it. */ status: 'off' | 'nothing' | 'committed' | 'skipped' | 'failed'; sha?: string; subject?: string; /** Repo-relative paths in the commit. */ files?: string[]; /** `origin/develop` when the push went through. */ pushed?: string; warnings: string[]; } /** * Subjects {@link autoCommitIncrement} writes, as a POSIX extended regex that * `git log -E --grep` and JavaScript read the same way. */ export declare const AUTO_COMMIT_SUBJECT_ERE = "^[0-9]{3,}[A-Za-z]?: (((claim|done|skip|block|release) T-[A-Za-z0-9_.-]+(, T-[A-Za-z0-9_.-]+)*( and [0-9]+ more)?)|accept-skip AC-[A-Za-z0-9_.-]+|create increment|handoff)$"; /** Is this a subject {@link autoCommitIncrement} writes? */ export declare function isAutoCommitSubject(subject: string): boolean; /** `1058: done T-02`, `1058: release T-01, T-03`, `1058: accept-skip AC-03`, `1058: create increment`, `1058: handoff`. */ export declare function autoCommitSubject(incrementId: string, action: AutoCommitRequest['action'], tasks?: string[]): string; /** Top of the checkout holding `dir`, or null outside Git. */ export declare function gitTopFor(dir: string): string | null; /** Commit (and optionally push) the increment's own files. Never throws. */ export declare function autoCommitIncrement(projectRoot: string, incDir: string, req: AutoCommitRequest): AutoCommitResult; /** * Why `handoff` should hold its branch push: the branch is ahead of a local * or differently named upstream by auto-commits alone, so the push would land * only this bookkeeping there. Undefined otherwise, including when other * commits are unpushed (the branch push is then the user's, as before). */ export declare function autoCommitPushHold(dir: string): string | undefined; /** One line for the user, or undefined when nothing happened. */ export declare function describeAutoCommit(r: AutoCommitResult): string | undefined; //# sourceMappingURL=auto-commit.d.ts.map