/** * Detect .gitmodules and write `submodules.targets` for the change (one line per * submodule: ` . origin`; "." = resolve to base branch at finish time). * Existing targets file is never overwritten. * * @param {string} gitRoot * @param {string} changeDir * @param {{ * pathExists: (path: string) => Promise, * writeText: (path: string, content: string) => Promise, * runCommand: typeof import("../exec.js").runCommand * }} deps * @returns {Promise} number of submodules written (0 = skipped/none) */ export declare function maybeWriteSubmoduleTargets(gitRoot: string, changeDir: string, deps: any): Promise; /** * @param {string} changeDir * @param {string} baseBranch * @param {string} changeBranch * @param {{ * nowIsoUtc: () => string, * pathExists: (path: string) => Promise, * readText: (path: string) => Promise, * writeText: (path: string, content: string) => Promise * }} deps */ export declare function maybeRecordBaseBranch(changeDir: string, baseBranch: string, changeBranch: string, deps: any): Promise; /** * @param {string} gitRoot * @param {{ branch: string, hasBranch: boolean, hasGitmodules: boolean }} options * @param {{ * runCommand: typeof import("../exec.js").runCommand, * UserError: typeof import("../errors.js").UserError * }} deps */ export declare function switchOrCreateStartBranch(gitRoot: string, options: any, deps: any): Promise; /** * @param {string} gitRoot * @param {{ branch: string, hasBranch: boolean, headReady: boolean }} options * @param {{ * runCommand: typeof import("../exec.js").runCommand, * UserError: typeof import("../errors.js").UserError * }} deps */ export declare function prepareNoSwitchBranch(gitRoot: string, options: any, deps: any): Promise; /** * Enforce the active brand's submodule target branches at change start. * * For each submodule listed in aiws/brands.yml (active brand): * - dirty working tree → abort with UserError * - target branch missing locally → `git switch` (auto-tracks remote if present) * - after switching, verify `branch --show-current` equals the target * * Submodules not present in the active brand are left untouched. Returns the * enforced snapshot { : } (empty when no * brands.yml or no submodules). * * @param {string} gitRoot * @param {{ * runCommand: typeof import("../exec.js").runCommand, * pathExists: (path: string) => Promise, * UserError: typeof import("../errors.js").UserError * }} deps */ export declare function maybeCheckoutSubmodulesToActiveBrand(gitRoot: string, deps: any): Promise>; /** * Persist the active-brand submodule snapshot into .ws-change.json * (`submodule_branches: { : }` + set-at timestamp). No-op when * the meta file is missing or the snapshot is empty. * * @param {string} changeDir * @param {Record} snapshot * @param {{ * nowIsoUtc: () => string, * pathExists: (path: string) => Promise, * readText: (path: string) => Promise, * writeText: (path: string, content: string) => Promise * }} deps */ export declare function snapshotSubmoduleBranches(changeDir: string, snapshot: Record, deps: any): Promise; /** * Abort change start when any submodule in `snapshot` is already claimed by * another active (non-finished, non-archived) change's submodule_branches. * Enforces the serial-only constraint: one submodule, one change at a time. * * @param {string} gitRoot * @param {string} changeId * @param {Record} snapshot * @param {{ * pathExists: (path: string) => Promise, * readText: (path: string) => Promise, * readDir: (path: string) => Promise, * UserError: typeof import("../errors.js").UserError * }} deps */ export declare function assertSubmodulesUnclaimed(gitRoot: string, changeId: string, snapshot: Record, deps: any): Promise;