mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
* chore(ai-workflow): track repo-managed review tooling * fix(ai-workflow): remove repo-specific path assumptions Make shared workflow hooks and APK testing guidance resolve paths from the repo and contributor environment so the tooling works for all contributors, not just one machine.
84 lines
2.6 KiB
Markdown
84 lines
2.6 KiB
Markdown
---
|
|
name: fix-merge-conflicts
|
|
description: Resolve all merge conflicts on the current branch non-interactively, validate the build, and commit. Use when the user says "fix merge conflicts", "resolve conflicts", or when git status shows conflicting files.
|
|
disable-model-invocation: true
|
|
---
|
|
|
|
# Fix Merge Conflicts
|
|
|
|
Resolve all merge conflicts on the current branch non-interactively and leave the repo buildable.
|
|
|
|
## Constraints
|
|
|
|
- Do not ask the user for input. Make best-effort decisions and explain them in a summary.
|
|
- Prefer minimal changes that preserve both sides' intent.
|
|
- Do not push or tag — only commit locally.
|
|
|
|
## Workflow
|
|
|
|
### 1. Detect conflicts
|
|
|
|
```bash
|
|
git status --porcelain
|
|
```
|
|
|
|
Collect files with `U` statuses or containing `<<<<<<<` / `=======` / `>>>>>>>` markers.
|
|
|
|
### 2. Resolve conflicts per file
|
|
|
|
Open each conflicting file and remove conflict markers. Merge both sides logically when feasible.
|
|
|
|
**When sides are mutually exclusive**, pick the variant that:
|
|
1. Compiles and passes type checks
|
|
2. Preserves existing public APIs and behavior
|
|
|
|
**File-type strategies:**
|
|
|
|
| File type | Strategy |
|
|
|-----------|----------|
|
|
| `package.json` | Merge keys conservatively, then `yarn install` to regenerate `yarn.lock` |
|
|
| `yarn.lock` | Never manually edit — regenerate with `yarn install` |
|
|
| Config files (`.json`, `.yaml`) | Preserve union of safe settings; don't delete required fields |
|
|
| Markdown / text | Include both unique sections, deduplicate headings |
|
|
| Binary files | Prefer current branch (ours) |
|
|
| Generated / build artifacts | Prefer current branch (ours), or regenerate |
|
|
|
|
### 3. Validate
|
|
|
|
Run all three checks. Fix any failures before proceeding.
|
|
|
|
```bash
|
|
yarn build && yarn lint && yarn type-check
|
|
```
|
|
|
|
If `package.json` was modified, run `yarn install` first.
|
|
|
|
### 4. Verify no remaining markers
|
|
|
|
```bash
|
|
rg '<<<<<<<|=======|>>>>>>>' --type ts --type tsx --type json
|
|
```
|
|
|
|
If any markers remain, go back and resolve them.
|
|
|
|
### 5. Finalize
|
|
|
|
```bash
|
|
git add -A
|
|
git commit -m "chore: resolve merge conflicts"
|
|
```
|
|
|
|
## Operational Guidance
|
|
|
|
- If a resolution is ambiguous and blocks the build, prefer the variant that compiles.
|
|
- For large refactors causing conflicts, keep consistent imports, types, and module boundaries.
|
|
- Keep edits minimal — don't reformat unrelated code.
|
|
- Format resolved files with `npx oxfmt <file>` if they're `.ts`/`.tsx`/`.js`.
|
|
|
|
## Deliverables
|
|
|
|
- Clean working tree with all conflicts resolved
|
|
- Passing `yarn build && yarn lint && yarn type-check`
|
|
- One local commit: `chore: resolve merge conflicts`
|
|
- Brief summary of files touched and notable resolution choices
|