Skip to content

Commit ad94ec2

Browse files
committed
feat(docs): enhance installation instructions and clarify plugin registration steps
1 parent c0e181e commit ad94ec2

3 files changed

Lines changed: 102 additions & 12 deletions

File tree

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,32 @@ Sync your OpenCode configuration, sessions, and data across multiple machines us
1414

1515
## Installation
1616

17-
Add to your `opencode.json` config file:
17+
**Step 1:** Install the package in your OpenCode config directory:
18+
19+
```bash
20+
# Linux/macOS
21+
cd ~/.config/opencode && npm install oc-sync
22+
23+
# Windows (PowerShell)
24+
cd $HOME\.config\opencode; npm install oc-sync
25+
```
26+
27+
**Step 2:** Register the plugin in `opencode.json` (in config directory):
1828

1929
```json
2030
{
2131
"plugin": ["oc-sync"]
2232
}
2333
```
2434

35+
**Step 3:** Configure your GitHub token (see [Configuration](#configuration) below)
36+
37+
**Step 4:** Restart OpenCode
38+
2539
Using an AI coding agent? See [LLM Installation Guide](docs/LLM-INSTALL.md) for step-by-step prompts.
2640

41+
> **Note:** OpenCode uses XDG paths on all platforms. See [Sync Paths](docs/SYNC-PATHS.md) for platform-specific locations.
42+
2743
## What Gets Synced
2844

2945
| Category | Data | Default |

docs/CONFIG.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,50 @@
11
# Configuration
22

3+
## Prerequisites
4+
5+
The plugin must be installed in your OpenCode config directory:
6+
7+
```bash
8+
# Linux/macOS
9+
cd ~/.config/opencode && npm install oc-sync
10+
11+
# Windows (PowerShell)
12+
cd $HOME\.config\opencode; npm install oc-sync
13+
```
14+
15+
And registered in `opencode.json` (in config directory):
16+
17+
```json
18+
{
19+
"plugin": ["oc-sync"]
20+
}
21+
```
22+
23+
See [Sync Paths](SYNC-PATHS.md) for platform-specific directory locations.
24+
325
## Quick Start
426

527
1. Create a [GitHub Personal Access Token](https://github.com/settings/tokens) with `repo` scope
628
2. Set environment variable:
729

830
```bash
31+
# Linux/macOS
932
export GITHUB_TOKEN=ghp_your_token_here
33+
34+
# Windows (PowerShell)
35+
$env:GITHUB_TOKEN = "ghp_your_token_here"
1036
```
1137

1238
3. Start OpenCode - the plugin automatically creates a private repo for sync storage
1339

14-
Add to your shell profile (`~/.bashrc`, `~/.zshrc`) for persistence.
40+
Add to your shell profile for persistence:
41+
- Linux: `~/.bashrc` or `~/.zshrc`
42+
- macOS: `~/.zshrc`
43+
- Windows: Use System Environment Variables or PowerShell profile
1544

1645
## Alternative: Config File
1746

18-
Instead of environment variable, create `~/.config/opencode/opencode-sync.json`:
47+
Instead of environment variable, create `opencode-sync.json` in the config directory:
1948

2049
```json
2150
{

docs/LLM-INSTALL.md

Lines changed: 54 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,42 @@ Ask the user:
1515
2. "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
2254
Guide the user step by step:
2355
1. Go to https://github.com/settings/tokens
2456
2. Click "Generate new token (classic)"
@@ -29,26 +61,31 @@ Guide the user step by step:
2961
7. IMPORTANT: Tell user to copy the token immediately (starts with "ghp_")
3062
8. 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
3974
That'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
4580
Tell 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
5390
Expected 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

Comments
 (0)