Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/Aquaticat/Monochromatic. TypeScript and Rust monorepo: Claude Code and Pi coding-agent plugins, a m
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111/** Foreign Git activity that bypasses the wrapper: a real-Git `commit --all` by absolute path whose editor holds `index.lock` until released.
@module */
import { startProcess, } from './process-fixture.ts';import { realGit, } from './repository-fixture.ts';import { attemptToken, readWorktree, type ScenarioActors, type StartedAttempt, trackAttempt,} from './worker-fixture.ts';
//region Foreign commit
/** Starts a real-Git `commit --all` by absolute path that bypasses the wrapper and holds `index.lock` while its editor waits for release.
@param repository - scenario repository
@param ledger - scenario ledger
@param label - unique label
@param paths - tracked paths modified before the start; `commit --all` takes exactly these
@param lockfilePid - whether the foreign Git records its PID beside the lock (`core.lockfilePid=true`, Git 2.54.0 and later), as a user who enabled it would
@returns started attempt
@example ```ts const foreign = await startForeignCommit({ ...actors, label: 'foreign', paths: ['f.txt'], lockfilePid: true }); ``` */export async function startForeignCommit({ repository, ledger, label, paths, lockfilePid,}: ScenarioActors & Readonly<{ label: string; paths: readonly string[]; lockfilePid: boolean;}>,): Promise<StartedAttempt> { /** Message token the editor writes. */ const token = attemptToken(label,); /** Worktree bytes `commit --all` stages. */ const captured = await Promise.all(paths.map(async function capture(path,) { return await readWorktree({ repository, path, },); },),); /** `HEAD` read immediately before start. */ const headBefore = (await realGit({ repository, args: [ 'rev-parse', 'HEAD', ], },)).trim(); return trackAttempt({ ledger, pending: { label, token, mode: 'foreign', selectedPaths: paths, captured, headBefore, expectedBranch: repository.branch, // Real Git never auto-pushes. requiresRemote: false, }, running: startProcess({ command: repository.realGit, args: [ ...(lockfilePid ? [ '-c', 'core.lockfilePid=true', ] : []), 'commit', '--quiet', '--all', ], cwd: repository.worktree, env: { ...repository.realEnv, E2E_TOKEN: token, GIT_EDITOR: repository.editorProgram, }, },), },);}
//endregion Foreign commit