Parent: #158
Objective
Set up automated upstream sync infrastructure modeled on shuvcode's proven 4-layer system, so upstream releases flow into our fork with ≤30% manual intervention.
Architecture (adapted from shuvcode)
Layer 1: Release Watcher
- GitHub Action triggered on upstream release tags (or scheduled polling)
- Detects new upstream versions via GitHub API
Layer 2: Merge Workflow (upstream-sync.yml)
- Fetches upstream tag, resolves to SHA
- Attempts
git merge --no-commit --no-ff into integration branch
- Runs auto-resolution rules (see below)
- If clean: commits, runs validation, pushes
- If conflicts: categorizes and triages
Layer 3: Auto-Resolution Rules
| Pattern |
Resolution |
bun.lock |
Accept upstream |
*.md (docs) |
Accept upstream |
.gitignore, configs |
Accept upstream |
Our additive files (rg.ts, task.ts, check_task.ts, async-tasks.ts, tools.ts, tasks.ts) |
Preserve ours |
Our deleted files (glob.ts, glob.txt, grep.ts, grep.txt) |
Ensure deleted |
registry.ts |
Attempt auto-merge (8 lines) |
session/index.ts, session/prompt.ts |
Flag for manual review |
Layer 4: Failure Handling
- Create GitHub issue with conflict details and categorization
- Include diff context for manual resolution
- Optional: AI agent fallback (like shuvcode's
/opencode comment trigger)
Key Files to Create
script/sync/fork-features.json
Manifest tracking our fork-specific features:
{
"features": [
{
"name": "async-task-tool",
"files": {
"additive": ["session/async-tasks.ts", "tool/task.ts", "tool/check_task.ts", "session/tools.ts", "util/tasks.ts"],
"modified": ["session/index.ts", "session/prompt.ts", "tool/registry.ts"]
},
"criticalCode": ["AsyncTaskManager", "check_task", "TaskSlot"]
},
{
"name": "rg-tool",
"files": {
"additive": ["tool/rg.ts", "tool/rg.txt"],
"modified": ["tool/registry.ts"],
"deleted": ["tool/glob.ts", "tool/glob.txt", "tool/grep.ts", "tool/grep.txt"]
},
"criticalCode": ["RgTool", "files_only"]
}
]
}
script/sync/fork-features.test.ts
Automated test verifying all criticalCode markers exist in codebase after any merge. Catches silent feature deletions.
.github/workflows/upstream-sync.yml
The main sync workflow.
.github/last-synced-tag
State file tracking last successfully synced upstream version.
Acceptance Criteria
References
Parent: #158
Objective
Set up automated upstream sync infrastructure modeled on shuvcode's proven 4-layer system, so upstream releases flow into our fork with ≤30% manual intervention.
Architecture (adapted from shuvcode)
Layer 1: Release Watcher
Layer 2: Merge Workflow (
upstream-sync.yml)git merge --no-commit --no-ffintointegrationbranchLayer 3: Auto-Resolution Rules
bun.lock*.md(docs).gitignore, configsrg.ts,task.ts,check_task.ts,async-tasks.ts,tools.ts,tasks.ts)glob.ts,glob.txt,grep.ts,grep.txt)registry.tssession/index.ts,session/prompt.tsLayer 4: Failure Handling
/opencodecomment trigger)Key Files to Create
script/sync/fork-features.jsonManifest tracking our fork-specific features:
{ "features": [ { "name": "async-task-tool", "files": { "additive": ["session/async-tasks.ts", "tool/task.ts", "tool/check_task.ts", "session/tools.ts", "util/tasks.ts"], "modified": ["session/index.ts", "session/prompt.ts", "tool/registry.ts"] }, "criticalCode": ["AsyncTaskManager", "check_task", "TaskSlot"] }, { "name": "rg-tool", "files": { "additive": ["tool/rg.ts", "tool/rg.txt"], "modified": ["tool/registry.ts"], "deleted": ["tool/glob.ts", "tool/glob.txt", "tool/grep.ts", "tool/grep.txt"] }, "criticalCode": ["RgTool", "files_only"] } ] }script/sync/fork-features.test.tsAutomated test verifying all criticalCode markers exist in codebase after any merge. Catches silent feature deletions.
.github/workflows/upstream-sync.ymlThe main sync workflow.
.github/last-synced-tagState file tracking last successfully synced upstream version.
Acceptance Criteria
References
script/sync/directory