import type { MessengerAdapter } from "../messenger/base.js"; import type { MessengerWorkspaceConfig } from "../util/config.js"; /** * v1.2.9 Part B — `git-` VCS event feed. * * Formats + emits a push notification to a user's `git-` channel. * The event source is the dev-confirm gate's *approval* moment (B.3.2): * when an agent-driven `git push` is approved (`y`), we record it here. * * NOTE (v1.2.9 scope — "1안"): the dev-confirm gate is still DORMANT (defined * but not wired into the live spawn path). This module is complete and * unit-tested, and `createDevConfirm`'s `onApproved` hook is ready to call * `notifyGitPush`, but no production code creates a gate yet — so no * notification actually fires until the gate goes live (designed in the * v1.3.0 PRD). Channel creation / config / migration ARE live. */ export interface PushEvent { /** Repo slug the push targets (from spawn target_repo, else "(unknown)"). */ repoSlug: string; /** Remote name, e.g. "origin". "(default)" when omitted on the cmd line. */ remote: string; /** Branch ref. "(default)" when omitted. */ branch: string; /** Messenger handle of the user whose agent pushed. */ userHandle: string; /** ISO timestamp of approval. */ ts: string; /** Best-effort `git log --oneline /..HEAD` summary lines. */ commits?: string[]; } /** * Parse `git push [flags] [ []]` into `{ remote, branch }`, * defaulting to "(default)" when a positional is omitted. Flags (tokens * starting with "-") are ignored when locating the positionals. */ export declare function parsePushCommand(cmd: string): { remote: string; branch: string; }; /** * v1.2.9 Part B — git_events defaults ON; only an explicit `enabled: false` * disables the sink. */ export declare function isGitEventsEnabled(cfg: MessengerWorkspaceConfig | undefined): boolean; /** Format a push-approval notification for the `git-` channel. */ export declare function formatPushNotification(ev: PushEvent): string; /** * Emit the push notification to `git-`. No-op (returns false) when * git_events is disabled or delivery fails. Best-effort — never throws, so a * notification failure can't poison the push-approval flow. */ export declare function notifyGitPush(adapter: Pick, productConfig: Record, handle: string, ev: PushEvent, workspaceMessengerConfig?: MessengerWorkspaceConfig): Promise;