From b47720d8dac5562f817a57dd5867e91fe553551e Mon Sep 17 00:00:00 2001 From: voson Date: Wed, 7 Jan 2026 08:57:12 +0800 Subject: [PATCH] chore: remove sensitive env.sh and add setup documentation --- .gitignore | 3 +- README.md | 124 +++++++++++++++++++++++++++++++++++++++++++++++++++++ env.sh | 11 ----- 3 files changed, 126 insertions(+), 12 deletions(-) create mode 100644 README.md delete mode 100644 env.sh diff --git a/.gitignore b/.gitignore index 4154681..b17d3ef 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ node_modules/ package.json bun.lock -*.log \ No newline at end of file +*.log +env.sh \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..9542537 --- /dev/null +++ b/README.md @@ -0,0 +1,124 @@ +# OpenCode Configuration + +This repository contains custom OpenCode configuration including commands, skills, and MCP services. + +## Structure + +``` +. +├── opencode.json # MCP services configuration +├── command/ # Custom commands +│ ├── auto-commit.md +│ ├── commit-push.md +│ ├── create-gitea-repo.md +│ ├── review.md +│ ├── sync-oc-pull.md +│ └── sync-oc-push.md +└── skill/ # Agent skills + ├── android-developer/ + ├── electron-developer/ + ├── go-developer/ + └── ios-developer/ +``` + +## Setup + +### 1. Clone Configuration + +```bash +git clone https://git.digitevents.com/ai/opencode.git ~/.config/opencode +``` + +### 2. Configure Environment Variables + +Create `env.sh` file (not tracked in git) or use the one from iCloud: + +```bash +# Option 1: Create manually +cat > ~/.config/opencode/env.sh << 'EOF' +# OpenCode Environment Variables +export REF_API_KEY="your-ref-api-key" +export FIGMA_API_KEY="your-figma-api-key" +export GITEA_API_TOKEN="your-gitea-token" +EOF + +# Option 2: Use iCloud (macOS only) +# File location: ~/Library/Mobile Documents/com~apple~CloudDocs/opencode-env.sh +``` + +### 3. Load Environment Variables + +Add to your `~/.zshrc` or `~/.bashrc`: + +```bash +# Load from iCloud (macOS) +[[ -f ~/Library/Mobile\ Documents/com~apple~CloudDocs/opencode-env.sh ]] && \ + source ~/Library/Mobile\ Documents/com~apple~CloudDocs/opencode-env.sh + +# Or load from local file +[[ -f ~/.config/opencode/env.sh ]] && source ~/.config/opencode/env.sh +``` + +Then reload your shell: +```bash +source ~/.zshrc +``` + +## Usage + +### Commands + +Run custom commands in OpenCode TUI: + +- `/auto-commit` - Auto-generate commit and create tag +- `/commit-push` - Commit, tag and push to remote +- `/create-gitea-repo` - Create repository on Gitea +- `/sync-oc-pull` - Pull OpenCode config changes +- `/sync-oc-push` - Push OpenCode config changes +- `/review` - Review code or documentation + +### Skills + +Skills are automatically loaded by agents when needed: + +- `android-developer` - Android development with Kotlin/Compose +- `electron-developer` - Electron desktop app development +- `ios-developer` - iOS development with Swift/SwiftUI +- `go-developer` - Go backend development + +### MCP Services + +Configure MCP services in `opencode.json`: + +- `ref` - Ref.tools API (requires `REF_API_KEY`) +- `figma` - Figma Developer MCP (requires `FIGMA_API_KEY`) + +## Sync Across Devices + +### Push Changes + +```bash +cd ~/.config/opencode +git add . +git commit -m "chore: update config" +git push +``` + +### Pull Changes + +```bash +cd ~/.config/opencode +git pull +``` + +Or use the built-in commands: +- `/sync-oc-push` - Push changes +- `/sync-oc-pull` - Pull changes + +## Security + +**Important**: Never commit sensitive information like API keys to git. + +- `env.sh` is ignored by git +- Store credentials in iCloud or use a secure password manager +- Use environment variables instead of hardcoding secrets diff --git a/env.sh b/env.sh deleted file mode 100644 index e71cb56..0000000 --- a/env.sh +++ /dev/null @@ -1,11 +0,0 @@ -# OpenCode Environment Variables -# Usage: source ~/.config/opencode/env.sh - -# MCP - Ref API -export REF_API_KEY="ref-f1dacf4d649a0c397e31" - -# MCP - Figma Developer -export FIGMA_API_KEY="figd_NhTo0NOrNETV2HDLbFIzlhXk9aPSxsWRV_dm-Lj-" - -# Gitea API Token (for create-gitea-repo command) -export GITEA_API_TOKEN="b4673f9bf59ca5780216f61906b860fcecfce2c7"