@@ -15,10 +15,42 @@ Ask the user:
15152. "Do you have a GitHub account?" - If no, guide them to create one at https://github.com
1616
1717### Step 1: Install the Package
18- Run this command:
19- npm install oc-sync
18+ IMPORTANT: The package must be installed in the OpenCode config directory, NOT globally.
2019
21- ### Step 2: Generate GitHub Personal Access Token
20+ Determine the user's OS and run the appropriate command:
21+
22+ **Linux/macOS:**
23+ cd ~/.config/opencode && npm install oc-sync
24+
25+ **Windows (PowerShell):**
26+ cd $HOME\.config\opencode; npm install oc-sync
27+
28+ **Windows (Command Prompt):**
29+ cd %USERPROFILE%\.config\opencode && npm install oc-sync
30+
31+ This installs the plugin where OpenCode can find it (in the config directory's node_modules/).
32+
33+ NOTE: OpenCode uses XDG paths on ALL platforms. On Windows, this is NOT %APPDATA% - it's %USERPROFILE%\.config\opencode\.
34+
35+ ### Step 2: Register the Plugin
36+ IMPORTANT: Installing the package is NOT enough. You must also register it.
37+
38+ Edit the opencode.json file in the config directory:
39+
40+ **Linux/macOS:** ~/.config/opencode/opencode.json
41+ **Windows:** %USERPROFILE%\.config\opencode\opencode.json
42+
43+ Add the plugin array:
44+
45+ {
46+ "plugin": ["oc-sync"]
47+ }
48+
49+ NOTE: The key is "plugin" (singular), NOT "plugins" (plural).
50+
51+ If opencode.json already exists with other settings, just add "oc-sync" to the existing plugin array.
52+
53+ ### Step 3: Generate GitHub Personal Access Token
2254Guide the user step by step:
23551. Go to https://github.com/settings/tokens
24562. Click "Generate new token (classic)"
@@ -29,26 +61,31 @@ Guide the user step by step:
29617. IMPORTANT: Tell user to copy the token immediately (starts with "ghp_")
30628. Ask user: "Please paste your token here" - Save this as TOKEN
3163
32- ### Step 3: Create Configuration
33- Create the config file at ~/.config/opencode/opencode-sync.json:
64+ ### Step 4: Create Token Configuration
65+ Create the config file opencode-sync.json in the config directory:
66+
67+ **Linux/macOS:** ~/.config/opencode/opencode-sync.json
68+ **Windows:** %USERPROFILE%\.config\opencode\opencode-sync.json
3469
3570{
36- "token": "<TOKEN from Step 2 >"
71+ "token": "<TOKEN from Step 3 >"
3772}
3873
3974That's it! The plugin will automatically:
4075- Detect your GitHub username
4176- Create a private repository (.opencode-sync)
4277- Detect the default branch (main/master)
4378
44- ### Step 4 : Verify Installation
79+ ### Step 5 : Verify Installation
4580Tell user to restart OpenCode. The plugin will:
4681- Auto-create the sync repository if needed
4782- Sync on startup
4883- Watch for file changes
4984- Push/pull automatically
5085
51- Check logs at: ~/.local/share/opencode/log/opencode-sync.log
86+ Check logs at:
87+ **Linux/macOS:** ~/.local/share/opencode/log/opencode-sync.log
88+ **Windows:** %USERPROFILE%\.local\share\opencode\log\opencode-sync.log
5289
5390Expected output:
5491[opencode-sync] Plugin starting...
@@ -58,7 +95,15 @@ Expected output:
5895[opencode-sync] Plugin ready
5996
6097### Troubleshooting
61- If user reports errors:
98+
99+ #### Plugin not loading (no log output)
100+ - Check plugin is installed in correct location:
101+ - Linux/macOS: ls ~/.config/opencode/node_modules/oc-sync
102+ - Windows: dir %USERPROFILE%\.config\opencode\node_modules\oc-sync
103+ - Check plugin is registered in opencode.json with "plugin" (singular) key
104+ - Check opencode.json is valid JSON (no trailing commas, etc.)
105+
106+ #### API Errors
62107- "401 Unauthorized": Token is invalid or expired. Generate a new one.
63108- "403 Forbidden": Token lacks "repo" scope. Recreate with correct permissions.
64109- "Not Found": Check token has repo scope for creating private repositories.
0 commit comments