feat: initial OpenCode configuration with custom commands and skills
This commit is contained in:
81
command/sync-oc-pull.md
Normal file
81
command/sync-oc-pull.md
Normal file
@@ -0,0 +1,81 @@
|
||||
---
|
||||
description: Pull latest OpenCode config changes from remote
|
||||
agent: build
|
||||
---
|
||||
|
||||
# sync-oc-pull
|
||||
|
||||
Pull latest changes for OpenCode configuration from remote repository.
|
||||
|
||||
## Use Cases
|
||||
|
||||
When you updated OpenCode configuration on another device, or team members shared new commands/configurations, use this command to sync to local.
|
||||
|
||||
## Steps
|
||||
|
||||
### 1. Switch to OpenCode Config Directory
|
||||
|
||||
```bash
|
||||
cd ~/.opencode
|
||||
```
|
||||
|
||||
### 2. Check Local Status
|
||||
|
||||
Run `git status` to check if there are uncommitted local changes.
|
||||
|
||||
**If there are uncommitted changes**:
|
||||
- List changed files
|
||||
- Ask user how to handle:
|
||||
- **Stash**: `git stash` to save local changes, restore after pull
|
||||
- **Discard**: `git checkout -- .` to discard local changes
|
||||
- **Cancel**: Terminate operation, let user handle manually
|
||||
|
||||
### 3. Pull Remote Changes
|
||||
|
||||
```bash
|
||||
git pull origin main
|
||||
```
|
||||
|
||||
### 4. Handle Conflicts (if any)
|
||||
|
||||
If conflicts occur during pull:
|
||||
|
||||
1. List conflicting files
|
||||
2. Open conflict files, analyze conflict content
|
||||
3. Ask user to choose:
|
||||
- **Keep local version**: Use `git checkout --ours <file>`
|
||||
- **Use remote version**: Use `git checkout --theirs <file>`
|
||||
- **Manual merge**: Prompt user to manually edit then execute `git add <file>`
|
||||
|
||||
4. After resolving all conflicts, complete merge:
|
||||
|
||||
```bash
|
||||
git add .
|
||||
git commit -m "chore: resolve merge conflicts"
|
||||
```
|
||||
|
||||
### 5. Restore Stashed Changes (if any)
|
||||
|
||||
If `git stash` was used in step 2:
|
||||
|
||||
```bash
|
||||
git stash pop
|
||||
```
|
||||
|
||||
If conflicts occur during restore, handle according to step 4.
|
||||
|
||||
### 6. Show Update Summary
|
||||
|
||||
After pull completes, show update content:
|
||||
|
||||
```bash
|
||||
git log --oneline -5
|
||||
```
|
||||
|
||||
List newly added or modified command files to help user understand what new configurations are available.
|
||||
|
||||
## Notes
|
||||
|
||||
- **Backup important configs**: If there are local modifications before pull, suggest backing up or using `git stash` first.
|
||||
- **Conflict handling**: Config file conflicts usually prioritize keeping local version, unless explicitly needing remote's new config.
|
||||
- **Verify config**: After pull, suggest checking if `opencode.json` and other config files work correctly.
|
||||
Reference in New Issue
Block a user