@@ -68,100 +68,16 @@ Configure in `opencode-sync.json`:
6868
6969## Configuration
7070
71- ### Quick Start
72-
73711 . Create a [ GitHub Personal Access Token] ( https://github.com/settings/tokens ) with ` repo ` scope
74- 2 . Set the environment variable:
72+ 2 . Set environment variable:
7573
7674``` bash
7775export GITHUB_TOKEN=ghp_your_token_here
7876```
7977
80- 3 . Start OpenCode - the plugin will automatically create a private repo for sync storage
81-
82- Add to your shell profile (` ~/.bashrc ` , ` ~/.zshrc ` ) for persistence.
83-
84- ### What Happens on First Run
85-
86- When the plugin starts with a valid token but no storage configured:
87- 1 . Detects your GitHub username automatically
88- 2 . Creates a new ** private** repository called ` .opencode-sync `
89- 3 . Initializes the ` .opencode-sync/ ` directory with a manifest
90- 4 . Saves the repo info to ` ~/.config/opencode/opencode-sync.json `
91- 5 . Future runs will use the same repository
92-
93- ### Alternative: Config File
94-
95- Instead of environment variable, create ` ~/.config/opencode/opencode-sync.json ` :
96-
97- ``` json
98- {
99- "token" : " ghp_your_token_here"
100- }
101- ```
102-
103- ### Token Priority
104-
105- Config file token takes precedence over environment variable.
106-
107- ### Verifying Configuration
108-
109- After starting OpenCode, check the logs for:
110- ```
111- [opencode-sync] Token loaded from: environment variable
112- [opencode-sync] Setting up sync storage...
113- [opencode-sync] Creating sync repository...
114- [opencode-sync] Linked to repo: username/.opencode-sync
115- [opencode-sync] Repo saved to config
116- [opencode-sync] Plugin ready
117- ```
118-
119- On subsequent runs:
120- ```
121- [opencode-sync] Token loaded from: environment variable
122- [opencode-sync] Linked to repo: username/.opencode-sync
123- [opencode-sync] Plugin ready
124- ```
125-
126- ### Full Configuration Options
127-
128- ``` json
129- {
130- "token" : " ghp_your_token_here" ,
131- "repoOwner" : " auto-detected-username" ,
132- "repoName" : " .opencode-sync" ,
133- "autoSyncOnStartup" : true ,
134- "continuousSync" : true ,
135- "syncIntervalMinutes" : 5 ,
136- "fileWatcherDebounceMs" : 5000 ,
137- "maxDebounceMs" : 30000 ,
138- "sync" : {
139- "config" : true ,
140- "state" : true ,
141- "credentials" : true ,
142- "sessions" : true ,
143- "messages" : true ,
144- "projects" : true ,
145- "todos" : true
146- },
147- "conflictStrategy" : " auto-merge"
148- }
149- ```
150-
151- ** Note:** All categories are enabled by default. Disable ` messages ` if you have very large conversation history (8MB+) and want to reduce sync size.
152-
153- ## Sync Timing
154-
155- The plugin uses ** activity-aware batching** to prevent excessive syncs during heavy IO:
78+ 3 . Start OpenCode - the plugin automatically creates a private repo for sync storage
15679
157- | Trigger | Default | Description |
158- | ---------| ---------| -------------|
159- | ** Startup** | Enabled | Immediately when OpenCode starts |
160- | ** File Changes** | 5s debounce | Wait for inactivity before syncing |
161- | ** Max Delay** | 30s cap | Force sync even during heavy activity |
162- | ** Interval** | 5 minutes | Periodic sync regardless of changes |
163-
164- During heavy activity, syncs are batched and fire at most every 30 seconds.
80+ See [ Configuration Guide] ( docs/CONFIG.md ) for all options.
16581
16682## Security
16783
@@ -175,66 +91,14 @@ During heavy activity, syncs are batched and fire at most every 30 seconds.
17591
17692| Guide | Description |
17793| -------| -------------|
94+ | [ Configuration] ( docs/CONFIG.md ) | All configuration options |
17895| [ Architecture] ( docs/ARCHITECTURE.md ) | Code structure and modules |
17996| [ Sync Architecture] ( docs/SYNC.md ) | Sync triggers, batching, data categories |
18097| [ Sync Paths] ( docs/SYNC-PATHS.md ) | OpenCode file locations by platform |
18198| [ Development Setup] ( docs/DEV-SETUP.md ) | Local development environment |
18299| [ Publishing] ( docs/PUBLISH.md ) | npm release process |
183100| [ LLM Installation] ( docs/LLM-INSTALL.md ) | Instructions for AI coding agents |
184101
185- ## Development
186-
187- ``` bash
188- # Install dependencies
189- npm install
190-
191- # Build
192- npm run build
193-
194- # Watch mode
195- npm run dev
196-
197- # Run all checks (typecheck + lint + format)
198- npm run check
199-
200- # Lint only
201- npm run lint
202-
203- # Lint and fix
204- npm run lint:fix
205-
206- # Type check only
207- npm run typecheck
208-
209- # Format code
210- npm run format
211- ```
212-
213- ## Code Quality
214-
215- This project uses strict linting rules optimized for LLM readability and maintainability:
216-
217- ### File & Function Limits
218- - Max ** 200 lines** per file (excluding blanks/comments)
219- - Max ** 60 lines** per function
220- - Max ** 4 levels** of nesting
221- - Max ** 5 parameters** per function
222- - Max ** 20 statements** per function
223- - Cyclomatic complexity limit of ** 15**
224-
225- ### TypeScript Strictness
226- - Explicit return types required
227- - Explicit member accessibility required
228- - No ` any ` types allowed
229- - No floating promises
230- - Consistent type imports/exports
231-
232- ### Pre-commit Hooks
233- Husky + lint-staged runs automatically on commit:
234- 1 . Full TypeScript type checking
235- 2 . ESLint with auto-fix on staged files
236- 3 . Prettier formatting on staged files
237-
238102## License
239103
240- MIT
104+ AGPL-3.0
0 commit comments