mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-08-30 17:14:40 +08:00
docs(upstream): keep manual merge prompt only
This commit is contained in:
@@ -68,8 +68,9 @@ again after verification. Be especially cautious when a decision is destructive,
|
||||
changes auth, billing, data deletion, public API compatibility, config schema
|
||||
behavior, migrations, provider routing, or security posture.
|
||||
|
||||
Read `script/upstream/README.md` -> `Common Pitfalls` before resolving. Watch
|
||||
for auto-merged code referencing conflict-block declarations, related sibling
|
||||
files that need edits but are not unmerged, when to prefer `hybrid` over
|
||||
`renamed`, function signatures drifting across a conflict boundary, and why
|
||||
full turbo typecheck is the right catch-all.
|
||||
Common pitfalls to watch for:
|
||||
- auto-merged code can reference declarations that still live inside conflict blocks
|
||||
- related sibling files can need edits even when they are not listed as unmerged
|
||||
- `renamed` should be used only when behavior moves to a different file
|
||||
- function signatures can drift across conflict boundaries
|
||||
- full repo typecheck is the catch-all for non-conflicted call-site breakage
|
||||
|
||||
@@ -304,70 +304,13 @@ After running the merge script, you may have remaining conflicts. To resolve:
|
||||
|
||||
1. Open each conflicted file
|
||||
2. Look for `kilocode_change` markers to identify Kilo-specific code
|
||||
3. Review `upstream-merge-report-<version>.md` when present for the conflict
|
||||
summary and manual-resolution guidance.
|
||||
4. From the merge branch worktree, optionally start the project slash command:
|
||||
```bash
|
||||
kilo run --command upstream-manual-merge v1.1.50
|
||||
```
|
||||
The command is defined in `.kilo/command/upstream-manual-merge.md` and is
|
||||
discovered from the repository root. It is available when Kilo is started in
|
||||
the merge worktree; it will not appear if Kilo is started from one of the
|
||||
reference worktrees under `.worktrees/opencode-merge/`.
|
||||
5. Resolve conflicts one file at a time. For each manual file, first present
|
||||
the intended strategy and wait for user approval. Keep Kilo-specific changes
|
||||
and favor upstream code and architecture when it is compatible with Kilo
|
||||
behavior.
|
||||
6. Verify each resolved file before moving on: confirm conflict markers are
|
||||
gone, compare against the reference worktrees when present, run the smallest
|
||||
practical check for the touched area, summarize the tradeoff and result, and
|
||||
get user approval for the resolved file.
|
||||
7. Stage and commit:
|
||||
3. Resolve conflicts, keeping Kilo-specific changes
|
||||
4. Stage and commit:
|
||||
```bash
|
||||
git add -A
|
||||
git commit -m "resolve merge conflicts"
|
||||
```
|
||||
|
||||
During merge runs, the script sets `merge.conflictStyle=zdiff3` in the local
|
||||
repo config so conflicts include the `|||||||` base section. Keep using those
|
||||
base-aware markers for manual resolution: they help compare Kilo's side,
|
||||
upstream's side, and the common ancestor without reconstructing the merge.
|
||||
|
||||
### Common Pitfalls
|
||||
|
||||
These come up repeatedly during manual resolution and are easy to miss. Read
|
||||
through before starting:
|
||||
|
||||
1. **Auto-merged code outside the conflict can depend on declarations inside
|
||||
it.** When picking between ours / theirs / hybrid, scan the non-conflicting
|
||||
parts of the same file for references whose declaration lives in the
|
||||
conflict block. A naive resolution can leave callers pointing at removed or
|
||||
renamed symbols. Always run typecheck after each decision batch to catch
|
||||
these.
|
||||
|
||||
2. **Related files can need edits even when they are not listed as unmerged.**
|
||||
Upstream refactors sometimes split logic across sibling files or move the
|
||||
relevant behavior to a new location. Kilo behavior may need to be ported into
|
||||
the new shape even though git only reports the original file as conflicted.
|
||||
Mention every touched sibling in the final summary so reviewers can find the
|
||||
diff.
|
||||
|
||||
3. **`renamed` is stricter than it sounds.** Treat a resolution as `renamed`
|
||||
only when the Kilo behavior moves from the conflicted file to a different
|
||||
file. If git already recorded the rename during automerge and the work is
|
||||
just adapting content at the new path, use `hybrid`.
|
||||
|
||||
4. **Function signatures can drift across a conflict boundary.** Automerge can
|
||||
pick one side of a paired change without noticing that a non-conflicting
|
||||
consumer relied on the other side's shape. Re-read call sites and exported
|
||||
contracts after resolving, not only the conflict block itself.
|
||||
|
||||
5. **Always run full turbo typecheck before declaring done.** Visually clean
|
||||
resolutions can still break typing at an unrelated call site. `bun run
|
||||
typecheck` from the repo root is the cheapest catch-all. Targeted per-package
|
||||
typechecks are not enough -- the failing call site can live in a
|
||||
non-conflicted file.
|
||||
|
||||
## Rollback
|
||||
|
||||
If something goes wrong:
|
||||
|
||||
@@ -253,9 +253,6 @@ async function main() {
|
||||
await git.ensureRerere()
|
||||
logger.info("git rerere enabled (resolutions will be recorded and reused automatically)")
|
||||
|
||||
await git.ensureConflictStyle()
|
||||
logger.info("merge.conflictStyle set to zdiff3 (conflicts will include the merge base)")
|
||||
|
||||
// Train rerere from past upstream merge commits so the cache is populated
|
||||
// even on a fresh clone. This replays past merges to learn their resolutions.
|
||||
// The grep covers both the current convention ("merge: upstream vX.Y.Z") and the
|
||||
@@ -744,7 +741,7 @@ async function main() {
|
||||
|
||||
logger.divider()
|
||||
logger.info("Next steps:")
|
||||
logger.info(" 1. Resolve remaining conflicts manually or with /upstream-manual-merge")
|
||||
logger.info(" 1. Resolve remaining conflicts manually")
|
||||
logger.info(" 2. git add -A && git commit -m 'resolve merge conflicts'")
|
||||
logger.info(` 3. git push ${config.originRemote} ${kiloBranch}`)
|
||||
logger.info(" 4. Create PR from " + kiloBranch + " to " + config.baseBranch)
|
||||
|
||||
@@ -267,14 +267,6 @@ export async function ensureRerere(): Promise<void> {
|
||||
await $`git config rerere.autoupdate true`.quiet()
|
||||
}
|
||||
|
||||
/**
|
||||
* Force zdiff3 conflict markers at the repo level so every git op during the
|
||||
* merge run writes conflicts with a ||||||| base block.
|
||||
*/
|
||||
export async function ensureConflictStyle(): Promise<void> {
|
||||
await $`git config merge.conflictStyle zdiff3`.quiet()
|
||||
}
|
||||
|
||||
/**
|
||||
* Train the rerere cache from past merge commits in the repo history.
|
||||
* Implements the same logic as git's contrib/rerere-train.sh:
|
||||
|
||||
Reference in New Issue
Block a user