A scheduler and GitHub dispatcher in one package, built for OpenCode 2.
@opencodebot in an issue → acknowledgement → questions if needed → implementation → tests → PR.
The bot waits for answers in the issue, handles follow-up comments, chooses PR titles, and can merge after an authorized approval. The TUI is optional.
- OpenCode 2 with a working model; tested with
0.0.0-beta-19398. - Node.js 22+, npm, and Git on macOS/Linux.
- GitHub authentication (
gh auth loginandgh auth setup-git, or a token in the service environment) and permission to comment, push, and create PRs. - When configuring a project: a primary Git checkout with a GitHub
origin, a pushed commit, and issues enabled.
Choose one installation method below. No target repository is needed yet.
Nothing needs to be published to npm. $HOME expands to your home directory.
Run this command on the machine running OpenCode 2:
Latest stable release: v0.6.3.
Download the .tgz package · SHA-256 checksum
npm install --global --prefix "$HOME/.local" "https://github.com/d3cker/opencode2-github-automation/releases/download/v0.6.3/opencode2-automation-0.6.3.tgz"postinstall registers both the plugin and TUI automatically. No sudo,
source checkout, or manual config editing is needed. Do not add
--ignore-scripts; npm needs network access to install dependencies.
You can also download the archive and pass its local path to the same command.
Restart the service when its sessions are idle:
opencode2 service restartThe CLI is now at $HOME/.local/bin/opencode2-automation. If $HOME/.local/bin
is on your PATH, you can use the shorter opencode2-automation command.
Configure a project below when ready.
-
Clone and build:
git clone https://github.com/d3cker/opencode2-github-automation.git "$HOME/opencode2-github-automation" cd "$HOME/opencode2-github-automation" npm ci && npm run build
-
Register the plugin and TUI:
node "$HOME/opencode2-github-automation/dist/setup.js" install -
Restart the idle service:
opencode2 service restart
Keep the source directory: OpenCode loads its compiled code. npm ci in a
source checkout does not register a global plugin automatically.
Both installers reuse recognized older loaders and refuse to overwrite custom
code. Registration defaults to ~/.config/opencode/plugins/opencode-automation/
and respects XDG_CONFIG_HOME and OPENCODE_CONFIG_DIR.
-
Enter your target repository and run the wizard:
cd /absolute/path/to/your-project "$HOME/.local/bin/opencode2-automation" init
Source installation: use
node "$HOME/opencode2-github-automation/dist/setup.js" initinstead. -
Answer the prompts. Enter accepts the value in brackets. The wizard asks about the model and capabilities, a vision helper if needed, base branch, trigger, signature, allowed authors, polling, auto-merge, and tests. Use
provider/modelfor model IDs andskipto skip automated tests. -
Load the project with the headless command below, or open it with
opencode2 /absolute/path/to/your-project.
Settings are saved to /absolute/path/to/your-project/.opencode/automation.json.
If it already exists, edit it directly and skip init. Repeat setup for each
repository; the plugin is installed only once. After editing settings, restart
the idle service and reload the project.
Create an issue containing @opencodebot (or your configured trigger). The bot
checks every 60 seconds by default and may also pick up existing matching issues.
Only the authenticated GitHub user is allowed by default; add colleagues to
authors in the JSON to let them request work.
Run once for each configured primary checkout, with its absolute path:
opencode2 api v2.plugin.awaitActivation --param 'location[directory]=/absolute/path/to/your-project'This starts the shared service if needed and loads the project's plugins. The command exits; the bot keeps running without a TUI or extra monitoring process. Repeat it after every service restart.
For automatic startup after a machine reboot, put one invocation per project in
your operating system's startup mechanism, under the same user, after networking
is available. Use absolute executable/repository paths (command -v opencode2
finds the executable) and provide the usual PATH and GitHub authentication.
A reboot-only task does not handle later opencode2 service restart calls.
Wait for active bot work to finish, then:
-
Run the versioned command in Install from a .tgz package using the same prefix as before. After publication, the README on
releaselinks to the new stable package;mainreceives that link through the promotion PR.postinstallrefreshes registration; project settings and queues are preserved. Do not runinitagain. -
Reload the service:
opencode2 service restart
-
Run the headless command for each project, or open each in the TUI. Reopen existing TUI clients when the update changes the UI.
Switching from a source installation to .tgz uses the same procedure; recognized
source loaders are repointed to the installed package instead of duplicated.
Wait for active bot work to finish, then:
-
Download changes for your current branch:
cd "$HOME/opencode2-github-automation" git pull --ff-only
-
Rebuild:
npm ci && npm run build -
Restart and reload each project:
opencode2 service restart
Settings and queues remain in place. Do not run init again. If switching back
from .tgz to source, also run the source install command after rebuilding.
For a fresh source installation, add --branch codex/issue-dialogue-capabilities
to the clone command. For an existing source checkout, replace update step 1 with:
cd "$HOME/opencode2-github-automation"
git fetch origin
git switch codex/issue-dialogue-capabilities
git pull --ff-onlyThen complete source installation or update as appropriate. A .tgz contains
the code from the branch used to build it; there is no Git branch to switch on
the receiving machine.
Wait for its bot sessions to finish, then:
-
Remove that project's settings:
rm -i /absolute/path/to/your-project/.opencode/automation.json
-
Restart the service:
opencode2 service restart
-
Reload the other projects you still want automated.
Removing the file alone does not stop an already-loaded worker. Queues, worktrees,
branches, and GitHub issues/PRs are preserved. Running init again can resume
saved work. If you configured the plugin through opencode.json options instead,
remove those options or disable its entry too.
Wait for active work to finish. Use the loader directory reported during install; older installations may use a different name. With the default directory:
-
Remove the two loaders:
rm -i "${OPENCODE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/opencode}/plugins/opencode-automation/index.js" "${OPENCODE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/opencode}/plugins/opencode-automation/tui.js"
-
For a
.tgzinstallation, remove the package:npm uninstall --global --prefix "$HOME/.local" opencode2-automation -
Run
opencode2 service restartand reopen any TUI clients.
Project settings and saved work remain on disk. Source and project-local
installations are not removed by npm uninstall --global.
- Questions: answer in the issue using an account in
authors. The bot waits for your answer; the bot and human can share a GitHub account. - Branches: write naturally, e.g. "use branch develop".
baseBranchsets the default for new work; existing tasks keep their chosen base. - Media: the wizard can configure a separate vision model. Set actual model
capabilities (
text,vision,audio); helpers run in separate sessions. - Instructions: prompts/bot.md is always loaded. Append your
own Markdown with
"systemPromptFile": ".opencode/bot.md". - Merging: approve the bot's PR or post a configured merge phrase. The author
must be allowed and have repository write access. Set
autoMerge.enabledtofalseto disable this.signaturecontrols the signature on new bot messages. - Progress: use
/botin the TUI, or the CLI'sstatus,scan,pause, andresumecommands from the target repository. Closing a PR closes its bot tabs while retaining session history. Authorized issue comments can continue work on an open PR without another mention.
Keep machine-specific .opencode/automation.json files out of Git: global init
does not add an ignore rule. See configuration and Git branches
for ignore instructions, branch-switch behavior, and all JSON options.
More details: runtime behavior, installation troubleshooting and project-local installs, and advanced settings.
For a project without a global installation, use the existing source installer:
bash "$HOME/opencode2-github-automation/scripts/install-local.sh" /absolute/path/to/your-projectIt configures the project on first install and preserves settings on updates. Do not combine it with a global installation for the same project.
cd "$HOME/opencode2-github-automation"
npm ci
npm run check
npm packUse Node 22.13+ or 24+ for development. npm run check runs ESLint, type checking,
tests, and a build. npm run package:check additionally packs and verifies a
global install in a temporary directory, including postinstall and the CLI.
npm pack creates
opencode2-automation-<version>.tgz using the version in package.json, with compiled code and the installer;
copy it to another machine and follow the .tgz instructions above.
private: true prevents accidental npm publication.
- Work on a feature branch and add release notes under
Unreleasedin CHANGELOG.md. Ordinary branch pushes do not run CI or publish packages. - Open a PR into the long-lived
releasebranch. CI runs lint, type checking, tests, a build, and an installation check on Node 22 and 24. New commits to the open PR rerun these checks. Review and merge after they pass. - The merge starts Release. It increments the patch version on
release, moves the unreleased notes into that version's changelog section, and pushes the version commit and tag atomically. It builds and verifies the tagged package, then publishes the GitHub Release with.tgz, SHA-256, and exact version notes. No package is published to npm. - Only after publication succeeds, automation commits the versioned README link
on
releaseand opens or updates a PR fromreleaseintomain. - Review and merge that PR with a merge commit. All code, version metadata,
release notes, and README changes reach protected
mainthrough this PR. The automation never pushes tomainor writes its files through the API.
To choose a version manually, prepare and commit its exact changelog section on
release, then use npm version, for example:
git switch release
git pull --ff-only origin release
# Prepare and commit the CHANGELOG.md section for 1.0.0 first.
npm version 1.0.0
git push --atomic origin release v1.0.0The pushed tag publishes exactly 1.0.0, without another version bump. Both
v1.0.0 and 1.0.0 tag names are accepted. The next automatic patch is 1.0.1.
Version tags must point to code on release; ordinary pushes to that branch
never start publication. Finish the active release before merging another feature.
The README on release is updated after publication; the README on main changes
when the promotion PR is merged. The tag and packaged README remain snapshots
from before the later README commit.
See Release process for required repository permissions, branch protection, CI approval for bot PRs, concurrency, and safe retry procedures.
