Skip to content

Commit c354a92

Browse files
committed
docs: add fork development, build, and orw documentation
1 parent 5de928b commit c354a92

3 files changed

Lines changed: 123 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,36 @@
22
- The default branch in this repo is `dev`.
33
- Local `main` ref may not exist; use `dev` or `origin/dev` for diffs.
44

5+
## Fork Development
6+
7+
This repo is a private fork of `anomalyco/opencode` using a **two-branch model**:
8+
9+
- **`dev`** — clean mirror of `upstream/dev`. Never commit fork changes here. Updated via `git sync-upstream`.
10+
- **`fork/local`** — the customization layer. All local development happens here.
11+
12+
### Syncing with upstream
13+
14+
```bash
15+
git sync-upstream # fetch upstream → FF dev → rebase fork/local → push both
16+
```
17+
18+
The alias lives in `.git/config`. If `rebase` conflicts during the `fork/local` step the chain halts before pushing — resolve conflicts manually, then `git rebase --continue` and re-run the push.
19+
20+
### Standalone build
21+
22+
```bash
23+
./packages/opencode/script/build.ts --single
24+
# Output: packages/opencode/dist/opencode-<platform>/bin/opencode
25+
```
26+
27+
Run `bun typecheck` from `packages/opencode` (never `tsc` directly) before building.
28+
29+
### Release watcher (orw)
30+
31+
`@cortexkit/orw` runs at `~/opencode-release-watch/` via launchd (30-min poll). On each new upstream release it AI-merges `fork/local` onto the release tag using `claude-opus-4-8`, builds a native CLI, and auto-installs to `~/.opencode/bin/opencode`. The Homebrew binary at `/opt/homebrew/bin/opencode` stays as a fallback.
32+
33+
Operator runbook: `agent-harness/docs/runbooks/OpenCode-Release-Watcher.md`
34+
535
## Commits and PR Titles
636

737
Use conventional commit-style messages and PR titles: `type(scope): summary`.

CONTRIBUTING.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,55 @@ Some debug methods that can be problematic:
175175

176176
With that said, you may want to try these methods, as they might work for you.
177177

178+
## Fork Development
179+
180+
> **This section applies only to the private fork (`rustybret/opencode`), not to upstream contributors.**
181+
182+
### Branch model
183+
184+
| Branch | Purpose |
185+
|--------|---------|
186+
| `dev` | Clean mirror of `upstream/dev`. Never commit here. |
187+
| `fork/local` | Customization layer rebased on top of `dev`. All work goes here. |
188+
189+
### Syncing with upstream
190+
191+
```bash
192+
git sync-upstream
193+
```
194+
195+
This repo-local alias (`.git/config`) fetches upstream, fast-forwards `dev` to `upstream/dev`, pushes `origin/dev`, rebases `fork/local` onto `dev`, syncs submodules, runs `bun install`, then pushes `fork/local`. If the rebase conflicts the chain stops before the push — resolve manually, then `git rebase --continue` and re-run the push.
196+
197+
### Building a standalone binary
198+
199+
```bash
200+
./packages/opencode/script/build.ts --single
201+
# Output: packages/opencode/dist/opencode-<platform>/bin/opencode
202+
```
203+
204+
Always typecheck first:
205+
206+
```bash
207+
bun typecheck # from packages/opencode — never tsc directly
208+
```
209+
210+
### Release watcher (orw)
211+
212+
`@cortexkit/orw` runs at `~/opencode-release-watch/` via launchd (every 30 min). It AI-merges `fork/local` onto each new upstream release using `claude-opus-4-8` and auto-installs to `~/.opencode/bin/opencode`.
213+
214+
```bash
215+
# Manual build + verify
216+
cd ~/opencode-release-watch && bunx @cortexkit/orw check --force
217+
218+
# Status
219+
bunx @cortexkit/orw status
220+
221+
# Rollback
222+
~/opencode-release-watch/rollback.sh
223+
```
224+
225+
Operator runbook: `agent-harness/docs/runbooks/OpenCode-Release-Watcher.md`
226+
178227
## Pull Request Expectations
179228

180229
### Issue First Policy

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,50 @@
4343

4444
---
4545

46+
## Fork
47+
48+
> This is a private fork of [`anomalyco/opencode`](https://github.com/anomalyco/opencode) maintained on the `fork/local` branch. The `dev` branch is a clean mirror of upstream — never carry fork commits there.
49+
50+
### Branch model
51+
52+
```
53+
upstream/dev ─────────────────────────────────►
54+
55+
origin/dev ──── (clean mirror, FF-only) ──────►
56+
57+
fork/local ──── our patches on top ───────────►
58+
```
59+
60+
### Syncing with upstream
61+
62+
```bash
63+
git sync-upstream
64+
```
65+
66+
### Building from this fork
67+
68+
```bash
69+
# Standalone native binary (canonical fork build)
70+
./packages/opencode/script/build.ts --single
71+
72+
# Output
73+
packages/opencode/dist/opencode-<platform>/bin/opencode
74+
```
75+
76+
### Automated release tracking (orw)
77+
78+
Uses [`@cortexkit/orw`](https://github.com/cortexkit/orw) to stay current with upstream releases. Polls every 30 min, AI-merges `fork/local` onto each new release tag, builds a native CLI, and installs automatically.
79+
80+
```bash
81+
# Manual check/build
82+
cd ~/opencode-release-watch && bunx @cortexkit/orw check --force
83+
84+
# Rollback
85+
~/opencode-release-watch/rollback.sh
86+
```
87+
88+
---
89+
4690
### Installation
4791

4892
```bash

0 commit comments

Comments
 (0)