@@ -21,65 +21,212 @@ reused if publication needs a retry.
2121The package is installed from source; publishing to npm is unnecessary.
2222` private: true ` prevents accidental publication while still allowing ` npm pack ` .
2323
24- ## Global installation: configure projects later
24+ ## 1. Install the plugin globally
2525
26- On macOS or Linux with Bash, clone and build the plugin:
26+ Run these steps on the machine that will run OpenCode 2. You do not need a target
27+ project yet. ` $HOME ` expands to your user's absolute home directory.
28+
29+ 1 . Clone and build the plugin:
30+
31+ ``` bash
32+ git clone https://github.com/d3cker/opencode2-github-automation.git " $HOME /opencode2-github-automation"
33+ cd " $HOME /opencode2-github-automation"
34+ npm ci && npm run build
35+ ```
36+
37+ 2 . Register the plugin and its terminal UI:
38+
39+ ``` bash
40+ mkdir -p " ${XDG_CONFIG_HOME:- $HOME / .config} /opencode/plugins/d3ckerbot"
41+ printf ' export { default } from "%s";\n' " $HOME /opencode2-github-automation/dist/index.js" > " ${XDG_CONFIG_HOME:- $HOME / .config} /opencode/plugins/d3ckerbot/index.js"
42+ printf ' export { default } from "%s";\n' " $HOME /opencode2-github-automation/dist/tui.js" > " ${XDG_CONFIG_HOME:- $HOME / .config} /opencode/plugins/d3ckerbot/tui.js"
43+ ```
44+
45+ Run this registration once; do not overwrite customized loaders.
46+
47+ 3 . Restart the service when sessions are idle, then reopen your OpenCode client:
48+
49+ ``` bash
50+ opencode2 service restart
51+ ```
52+
53+ Installed. No project is automated yet. Keep the plugin source directory:
54+ OpenCode loads the compiled code from its ` dist ` folder.
55+
56+ ## 2. Configure a project
57+
58+ Use an existing Git checkout with a GitHub ` origin ` . Replace
59+ ` /absolute/path/to/your-project ` with its actual absolute path.
60+ Authenticate first with ` gh auth login ` and ` gh auth setup-git ` if needed.
61+
62+ 1 . Enter the target repository and start the wizard:
63+
64+ ``` bash
65+ cd /absolute/path/to/your-project
66+ node " $HOME /opencode2-github-automation/dist/setup.js" init
67+ ```
68+
69+ Enter your OpenCode 2 model (` provider/model ` ). If asked for tests, enter the
70+ project's test command or press Enter to skip. Do not add ` --local ` .
71+
72+ 2 . Review ` /absolute/path/to/your-project/.opencode/automation.json ` .
73+ To allow a colleague to request work, add their GitHub login to ` authors ` :
74+
75+ ``` json
76+ {
77+ "model" : " local/deepseek" ,
78+ "signature" : " d3cker[OpenCode2]" ,
79+ "authors" : [" d3cker" , " COLLEAGUE_LOGIN" ],
80+ "autoMerge" : {
81+ "enabled" : true ,
82+ "method" : " squash"
83+ },
84+ "check" : false
85+ }
86+ ```
87+
88+ Use your actual model and usernames. Without ` authors ` , only the authenticated
89+ GitHub user can request work. Auto-merge also requires the approving user to
90+ have repository write access.
91+
92+ 3 . Restart the idle service and open the target project:
93+
94+ ``` bash
95+ opencode2 service restart
96+ opencode2 /absolute/path/to/your-project
97+ ```
98+
99+ Create an issue containing ` @d3ckerbot ` . The bot checks once a minute; ` /bot `
100+ shows progress. Existing matching issues may also be picked up.
101+
102+ ** Code is global; configuration is per project.** Only repositories containing
103+ ` .opencode/automation.json ` are activated. Run the wizard in another checkout to
104+ add another project. Existing configuration files are never overwritten by ` init ` .
105+
106+ ## 3. Update an existing installation
107+
108+ Run this on the machine with the global installation. Wait for active bot work
109+ to finish first.
110+
111+ 1 . Download updates for the branch you currently use:
112+
113+ ``` bash
114+ cd " $HOME /opencode2-github-automation"
115+ git pull --ff-only
116+ ```
117+
118+ 2 . Install dependencies and rebuild:
119+
120+ ``` bash
121+ npm ci && npm run build
122+ ```
123+
124+ 3 . Reload the service:
125+
126+ ``` bash
127+ opencode2 service restart
128+ ```
129+
130+ Reopen the terminal client if the update changes the UI. Project configuration
131+ and queues remain in place. Do not repeat global registration or run ` init ` again.
132+
133+ ### Switch to the feature branch for testing
134+
135+ Replace update step 1 with:
27136
28137``` bash
29- git clone https://github.com/d3cker/opencode2-github-automation.git " $HOME /opencode2-github-automation"
30138cd " $HOME /opencode2-github-automation"
31- npm ci
32- npm run build
139+ git fetch origin
140+ git switch codex/pr-approval-merge-signatures
141+ git pull --ff-only
33142```
34143
35- Add the server and terminal UI entrypoints to OpenCode's global plugin directory:
144+ Then complete update steps 2 and 3. The approval and signature features described
145+ below are available on this branch (` 0.4.0-beta.1 ` ).
36146
37- ``` bash
38- mkdir -p " ${XDG_CONFIG_HOME:- $HOME / .config} /opencode/plugins/d3ckerbot"
39- printf ' export { default } from "%s";\n' " $HOME /opencode2-github-automation/dist/index.js" > " ${XDG_CONFIG_HOME:- $HOME / .config} /opencode/plugins/d3ckerbot/index.js"
40- printf ' export { default } from "%s";\n' " $HOME /opencode2-github-automation/dist/tui.js" > " ${XDG_CONFIG_HOME:- $HOME / .config} /opencode/plugins/d3ckerbot/tui.js"
41- ```
147+ ## 4. Remove automation from one project
42148
43- These commands create loader files; do not overwrite them if you have customized
44- existing loaders at those paths. Keep the source directory in place: the global
45- installation imports its compiled files directly.
149+ This disables the project configured through ` init ` ; the global plugin remains
150+ available for other projects. Wait for bot sessions to finish first.
46151
47- If OpenCode 's service is running, restart it when sessions are idle :
152+ 1 . Remove that project 's configuration (confirm the deletion when prompted) :
48153
49- ``` bash
50- opencode2 service restart
51- ```
154+ ``` bash
155+ rm -i /absolute/path/to/your-project/.opencode/automation.json
156+ ```
52157
53- Reopen the terminal client to load the UI component. The scheduler remains
54- inactive in projects without ` .opencode/automation.json ` .
158+ 2 . Restart the service:
55159
56- ## Configure a project after global installation
160+ ``` bash
161+ opencode2 service restart
162+ ```
57163
58- Run the wizard from the root of the repository the bot should work on.
59- Replace the example target path with your checkout's absolute path:
164+ 3 . Reopen the client. The bot no longer scans, starts work, or merges PRs for
165+ this project. Other configured projects continue working.
60166
61- ``` bash
62- cd /absolute/path/to/your-project
63- node " $HOME /opencode2-github-automation/dist/setup.js" init
64- ```
167+ Removing the file alone does not stop an already-loaded worker; the restart
168+ applies the change. Queue data, worktrees, branches, and GitHub issues/PRs are
169+ preserved. Running ` init ` again re-enables the project and may resume its saved
170+ queue. If configuration was instead supplied through plugin options in
171+ ` opencode.json ` , remove those options or disable that plugin entry as well.
65172
66- Use ` init ` without ` --local ` for the global installation. The wizard asks for
67- an OpenCode 2 model identifier (` provider/model ` ), detects the GitHub repository,
68- default branch, authenticated account, and supported project test command.
69- If it asks for a test command, press Enter to skip tests.
173+ ## 5. Uninstall the global plugin
70174
71- The wizard creates ` .opencode/automation.json ` and never overwrites an existing
72- configuration. After configuration, restart an already-running service when it
73- is idle and reopen the project:
175+ For the global installation described above, wait for active work to finish.
74176
75- ``` bash
76- opencode2 service restart
77- opencode2 /absolute/path/to/your-project
78- ```
177+ 1 . Remove only this plugin's two global loaders:
178+
179+ ``` bash
180+ rm -i " ${XDG_CONFIG_HOME:- $HOME / .config} /opencode/plugins/d3ckerbot/index.js" " ${XDG_CONFIG_HOME:- $HOME / .config} /opencode/plugins/d3ckerbot/tui.js"
181+ ```
182+
183+ 2 . Restart the service:
184+
185+ ``` bash
186+ opencode2 service restart
187+ ```
188+
189+ 3 . Close and reopen OpenCode clients to unload the terminal UI.
79190
80- Create an issue containing ` @d3ckerbot ` . Polling runs once a minute and also
81- considers existing matching issues. By default, only the authenticated GitHub
82- user can request work.
191+ The source checkout, project settings, and saved work remain on disk. Separate
192+ project-local installations are unaffected; their loaders live under each
193+ project's ` .opencode/plugins/automation/ ` directory.
194+
195+ ## Configuration files and Git branches
196+
197+ - ` .opencode/automation.json ` is a ** file in the target checkout** , not in the
198+ plugin's source repository. Creating it does not automatically upload it.
199+ - With the global installation, ` init ` does ** not** add a Git ignore rule.
200+ An ordinary ` git add . ` can therefore stage it unless your repository already
201+ ignores it. The alternative ` install-local.sh ` installer does add local
202+ exclusions automatically.
203+ - Keep machine-specific configuration untracked. From the target checkout,
204+ add a local ignore rule that is not itself committed:
205+
206+ ``` bash
207+ cd /absolute/path/to/your-project
208+ printf ' \n/.opencode/automation.json\n' >> " $( git rev-parse --git-path info/exclude) "
209+ ```
210+
211+ - Check whether Git already tracks it:
212+
213+ ``` bash
214+ git ls-files -- .opencode/automation.json
215+ ```
216+
217+ No output means it is untracked. If the path appears, ignoring it is not
218+ enough: use ` git rm --cached -- .opencode/automation.json ` and commit that
219+ removal to stop versioning it on the current branch. The local file stays.
220+ - An untracked, ignored file normally stays in place during branch switches.
221+ If another branch tracks that same path, Git can replace it; keep a backup
222+ before switching to such branches. A tracked file follows branch contents
223+ and can change or disappear when you switch. OpenCode does not restore it.
224+ ` git clean -fdx ` also deletes ignored files.
225+ - A separate clone or worktree does not automatically inherit an untracked
226+ configuration. The scheduler only activates in the primary checkout.
227+ Bot-created worktrees are used for implementation, without starting another
228+ scheduler. Queue data lives under the shared Git directory in
229+ ` opencode2-automation/ ` and is not uploaded by Git push.
83230
84231## Configuration
85232
@@ -196,18 +343,6 @@ It prompts for configuration on first installation and preserves existing settin
196343on upgrades. It does not restart OpenCode. Use either global or project-local
197344installation; do not enable both for the same project.
198345
199- ## Updating a global installation
200-
201- ``` bash
202- git -C " $HOME /opencode2-github-automation" pull --ff-only
203- cd " $HOME /opencode2-github-automation"
204- npm ci
205- npm run build
206- ```
207-
208- Restart the service while idle. Reopen terminal clients after UI changes.
209- Project settings and queues are preserved.
210-
211346## Development
212347
213348``` bash
@@ -221,5 +356,6 @@ installation archive. Build artifacts, dependencies, and local credentials are
221356excluded from the source repository.
222357
223358Additional documentation (currently in Polish):
359+
224360- [ Moving the source and installing on another machine] ( docs/installation.md )
225361- [ Advanced configuration, retries, permissions, and separate plugins] ( docs/advanced.md )
0 commit comments