Add missing lockfiles to skip list and show fallback for empty stderr

Several ecosystem lockfiles (Nix flake, Gradle, npm-shrinkwrap, Swift PM)
were missing from SKIP_RESOLVE, causing unnecessary conflict resolution
attempts. Empty stderr on failure produced confusing error messages.
This commit is contained in:
Chris Wanstrath 2026-04-10 08:44:17 -07:00
parent cbb6bac1b9
commit 374454f0fb
2 changed files with 10 additions and 3 deletions

View File

@ -96,6 +96,10 @@ const SKIP_RESOLVE = new Set([
"Podfile.lock",
"poetry.lock",
"pubspec.lock",
"flake.lock",
"gradle.lockfile",
"npm-shrinkwrap.json",
"Package.resolved",
"uv.lock",
"yarn.lock",
])
@ -124,7 +128,8 @@ export async function resolveConflicts(
)
if (resolved.exitCode !== 0) {
throw new Error(`Claude failed to resolve ${file}: ${resolved.stderr.toString().trim()}`)
const stderr = resolved.stderr.toString().trim()
throw new Error(`Claude failed to resolve ${file}: ${stderr || "(no output)"}`)
}
await Bun.write(join(cwd, file), resolved.stdout.trimEnd() + "\n")

View File

@ -137,7 +137,8 @@ export async function commit(message: string, cwd: string): Promise<void> {
export async function checkoutTheirs(file: string, cwd: string): Promise<void> {
const result = await $`git checkout --theirs -- ${file}`.cwd(cwd).nothrow().quiet()
if (result.exitCode !== 0) {
throw new Error(`Failed to checkout theirs for ${file}: ${result.stderr.toString().trim()}`)
const stderr = result.stderr.toString().trim()
throw new Error(`Failed to checkout theirs for ${file}: ${stderr || "(no output)"}`)
}
}
@ -145,7 +146,8 @@ export async function checkoutTheirs(file: string, cwd: string): Promise<void> {
export async function stageFile(file: string, cwd: string): Promise<void> {
const result = await $`git add ${file}`.cwd(cwd).nothrow().quiet()
if (result.exitCode !== 0) {
throw new Error(`Failed to stage ${file}: ${result.stderr.toString().trim()}`)
const stderr = result.stderr.toString().trim()
throw new Error(`Failed to stage ${file}: ${stderr || "(no output)"}`)
}
}