Skip to content

chore: a ledger for what we port from upstream, and a tool that ports it - #131

Merged
filipeforattini merged 2 commits into
mainfrom
feat/upstream-ledger
Sep 5, 2026
Merged

filipeforattini merged 2 commits into
mainfrom
feat/upstream-ledger

Conversation

@filipeforattini

@filipeforattini filipeforattini commented Sep 5, 2026 •

Copy link
Copy Markdown

We forked anomalyco/opencode and renamed the product; upstream keeps moving. Since the fork point (2026-08-17) it has 243 commits, 84 of them in packages we track, and we had ported 14 of those by hand in #98 — recorded only in that commit's message. So "are we up to date?" had no answer the repository could give. This PR makes it answerable, and makes the next port cheap.

The convention

Every port carries an Upstream: <full sha> trailer. script/upstream-ported.txt seeds the ledger with the fourteen from #98, and only grows for ports that could not carry the trailer.

bun upstream:status

Lists upstream commits since the fork that touch what we track — packages/opencode (ours: redcode), core, app, tui, ui, sdk, plugin, server and the rest; not console, web, stats, which are their hosted product and site — minus the ledger and their release plumbing (sync release versions, chore: generate). Grouped by scope, oldest first. --fetch fetches first, --json for scripts. Today it says 54.

bun upstream:port <sha…>

For each commit: take its diff, rewrite packages/opencode/ → packages/redcode/, @opencode-ai/* → @reddb-io/redcode-*, OPENCODE_* → REDCODE_*, .opencode → .redcode, then git apply --3way --index. A clean apply is committed at once with upstream's subject, "Ported from anomalyco/opencode ", upstream's body, and the trailer. A conflicted apply stops with diff3 markers in the tree and names the files — what to keep there is a decision, and the script does not make decisions. It deliberately leaves the bare word "opencode" in prose alone for the same reason.

Tried on 7561b4a05 (tui) and 69c172e8a (provider): both apply with three-way and stop at two and one files respectively, every one of them the place where our rename of the product name meets upstream's text. That is the tool working.

Next

The sync tranche, one PR per group, starting with the Anthropic thinking-block binding for Claude 5.1+ (3f39a329c, 9a71624d2, 68abdce1a).

https://claude.ai/code/session_014XwJPDhq1ahcm3rd454WzQ


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

We forked anomalyco/opencode and renamed the product; upstream keeps moving. A merge is
off the table — the package was renamed on disk and in every import, and 95 files have
changed on both sides — so fixes come across by content, and until now the only record
of which ones was the text of one commit message. That is not tracking.

Two scripts and one convention:

- Every port carries an `Upstream: <sha>` trailer. `script/upstream-ported.txt` seeds the
  ledger with the fourteen fixes #98 brought over before the trailer existed.
- `bun upstream:status` lists upstream commits since the fork point that touch what we
  track (not their hosted product or site), minus the ledger and release plumbing, by scope.
  Today: 54.
- `bun upstream:port <sha…>` takes an upstream commit's diff, rewrites paths and package
  names to ours, applies it three-way, and commits it with the trailer. A hunk that no
  longer fits leaves diff3 markers and the script stops: what to keep there is a decision,
  and it does not make decisions. Tried on two commits: both stop where our rename of the
  product name meets upstream's prose, which is exactly the place a person should look.

Claude-Session: https://claude.ai/code/session_014XwJPDhq1ahcm3rd454WzQ
@filipeforattini
filipeforattini merged commit fccf772 into main Sep 5, 2026
13 checks passed
@filipeforattini
filipeforattini deleted the feat/upstream-ledger branch September 18, 2026 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant