resolve
Resolve merge conflicts in generated files by regenerating them from the spec.
resolve fixes merge conflicts in _generated/ by regenerating those files from the spec. Generated code isn't meaningfully text-mergeable — the only correct post-merge content is a fresh regeneration. One command turns an unreadable multi-thousand-line conflict into a clean, staged resolution.
Usage
chowbea-axios resolve [flags]Requires a git repository. Non-git projects (or projects with no conflicts) exit cleanly with a message.
What it does
- Detects if you're in a git repository
- Lists all unmerged (conflicted) files
- Partitions them —
_generated/files vs. everything else - Regenerates the conflicted generated files from the cached/pinned spec (via
generate) - Stages the regenerated
_generated/directory, clearing its unmerged state - Reports any other conflicted files that still need manual resolution
Generated files are a pure projection of the OpenAPI spec, so regenerating them is always the correct resolution. Hand-editing conflict markers in a 2,000-line api.operations.ts is never the right move.
When to use it
- After a merge leaves
_generated/with conflict markers (<<<<<<<,=======,>>>>>>>) - When
git statusshows unmerged paths under_generated/ - Before committing a merge — CI will reject a merge commit with unmerged files
Not useful outside git repos or when there are no conflicts.
Flags
| Flag | Short | Description | Default |
|---|---|---|---|
--config | -c | Path to api.config.toml | Auto-detected |
--quiet | -q | Suppress non-error output | false |
--verbose | -v | Show detailed output | false |
Examples
Basic usage
# After a merge with conflicts in _generated/
git merge feature-branch
# CONFLICT (content): Merge conflict in src/api/_generated/api.operations.ts
# Automatic merge failed; fix conflicts and then commit the result.
chowbea-axios resolve
# Regenerating 3 conflicted generated file(s) from the spec...
# Generated-file conflicts resolved and staged.The regenerated files are staged automatically — commit them when ready.
With other conflicts
chowbea-axios resolve
# Regenerating 2 conflicted generated file(s) from the spec...
# Generated files resolved. 1 other conflicted file(s) still need manual resolution:
# src/api/api.client.tsHand-editable files (api.client.ts, api.instance.ts, etc.) still need manual resolution. resolve only handles the generated projection.
No generated conflicts, but other files are conflicted
chowbea-axios resolve
# No generated-file conflicts. 2 other conflicted file(s) need manual resolution.Exit code 1 — resolve cannot help with these conflicts. Fix them manually.
Exit codes
| Code | Meaning |
|---|---|
0 | Success — all generated conflicts resolved and no other conflicts exist, or no generated conflicts to begin with |
1 | Error — failed to regenerate, or non-generated conflicts remain (even if generated conflicts were resolved successfully) |
The exit code is 1 when conflicted non-generated files remain (even if resolve successfully fixed the generated conflicts), so CI knows the merge isn't fully resolved yet. resolve doesn't touch those files — you must resolve them manually, then commit everything together.
How it works
Under the hood, resolve:
- Checks if you're in a git repository (
git rev-parse --is-inside-work-tree) - Lists unmerged (conflicted) paths with
git diff --name-only --diff-filter=U - Partitions them into files under
_generated/vs. everything else - Calls
generate(which overwrites the conflict-marked files with clean, regenerated code) - Stages the regenerated directory with
git add -- <path-to-_generated>
Non-generated conflicts (api.client.ts, config files, app code) are reported but not touched — those are yours to resolve.
In pinned-inputs mode, generate reads the committed pins (openapi.json, chowbea.bus.json), so resolve always uses the spec both branches agreed on — no ambiguity about which version to regenerate from.
Error cases
Not a git repository
chowbea-axios resolve
# Not a git repository — nothing to resolve.Exit code 0. Nothing to do.
No conflicts
chowbea-axios resolve
# No generated-file conflicts to resolve.Exit code 0. The working tree is clean (or the only conflicts are outside _generated/).
Regeneration fails
If the spec is invalid or generate fails for any reason, resolve exits non-zero and the conflicts remain unresolved. Fix the underlying issue (run validate, check your spec source), then re-run resolve.
Related commands
generate— whatresolvecalls internally to regenerate the outputfetch— updates the cached spec from the endpointsync— updates the pinned spec in pinned-inputs modedoctor— checks for tracked cache files that can cause conflicts
Workflow example
# Start a merge
git merge feature-branch
# CONFLICT in _generated/api.operations.ts
# Resolve generated conflicts
chowbea-axios resolve
# Resolve any hand-editable conflicts manually
# (e.g., fix api.client.ts if it's also conflicted)
# Verify everything looks good
git status
npm run typecheck
# Commit the merge
git commitNever hand-edit conflict markers in _generated/ files. They're regenerated from the spec on every build, so any manual fix will be overwritten the next time someone runs fetch or generate. If the generated code itself is wrong, fix the OpenAPI spec — the source of truth.