Before (v1.0):
- Sync scripts stored in Infisical as secrets (
SYNC_SCRIPT_UNIX,SYNC_SCRIPT_WINDOWS) - Hard to update scripts
- Infisical cluttered with code
After (v2.0):
- Sync scripts stored in this GitHub repo
- Easy to update (just push to GitHub)
- Infisical only stores credentials
- Bootstrap scripts download sync scripts from GitHub
✅ Nothing! Your setup keeps working.
Optional improvements:
-
Re-run the bootstrap to get the improved scripts:
cd C:\Projects # or your project directory irm https://raw.githubusercontent.com/mattbaylor/opencode-infisical-setup/main/bootstrap-windows.ps1 | iex
-
This will:
- Download the new sync script from GitHub (better error handling)
- Keep your existing Infisical config
- Update the scheduled task
Just run the bootstrap script - it works now!
cd ~/projects # or your project directory
curl -fsSL https://raw.githubusercontent.com/mattbaylor/opencode-infisical-setup/main/bootstrap-unix.sh | bashYou can remove the old sync scripts from Infisical if you want:
-
Go to
https://infisical.thebaylors.org -
Open your "OpenCode" project
-
Delete these secrets (they're not needed anymore):
SYNC_SCRIPT_UNIX❌ (now in GitHub)SYNC_SCRIPT_WINDOWS❌ (now in GitHub)
-
Keep these secrets (still required!):
GITHUB_COPILOT_ACCESS_TOKEN✅GITHUB_COPILOT_REFRESH_TOKEN✅
The sync scripts now automatically extract the expiry timestamp from your access token. No more hardcoded timestamps!
Before:
"expires": 1764799262000 // Hardcoded, needs manual updatesAfter:
"expires": 1764799262000 // Automatically extracted from tokenUnix script (sync-opencode-auth.sh):
- ✅ Color-coded output (green success, red errors, yellow info)
- ✅ Checks for
.infisical.jsonbefore running - ✅ Validates credentials were fetched
- ✅ Sets proper file permissions (600)
- ✅ Shows token expiry date
Windows script (sync-opencode-auth.ps1):
- ✅ Color-coded output
- ✅ Checks for
.infisical.jsonbefore running - ✅ Validates credentials were fetched
- ✅ Shows token expiry date
Both Windows and Linux bootstrap scripts now:
- ✅ Check if already logged in
- ✅ Detect existing project config
- ✅ Download sync scripts from GitHub (not Infisical)
- ✅ Better error messages with troubleshooting hints
- ✅ Create wrapper scripts for cron/Task Scheduler
- ✅ Work from any directory (saves current dir)
-
Check sync script:
& "$env:USERPROFILE\sync-opencode-auth.ps1"
Should show green checkmarks and success message.
-
Check auth file:
Get-Content "$env:USERPROFILE\.local\share\opencode\auth.json"
Should show valid GitHub Copilot credentials.
-
Check scheduled task:
Get-ScheduledTask -TaskName "OpenCode-Sync"
Should show task is Ready.
-
Check sync script:
~/sync-opencode-auth.shShould show green checkmarks and success message.
-
Check auth file:
cat ~/.local/share/opencode/auth.jsonShould show valid GitHub Copilot credentials.
-
Check cron job:
crontab -l | grep sync-opencodeShould show daily 3 AM job.
You need to be in the directory where you ran the bootstrap script.
Fix:
# Find where .infisical.json is
find ~ -name ".infisical.json" 2>/dev/null
# Or re-run bootstrap from your project directory
cd ~/projects
# ... run bootstrap againMake sure the secret names are exactly right in Infisical:
GITHUB_COPILOT_ACCESS_TOKEN(notACCESS_TOKENor anything else)GITHUB_COPILOT_REFRESH_TOKEN(notREFRESH_TOKENor anything else)
Make sure execution policy allows it:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUserWindows: Check task scheduler logs:
Get-Content "$env:USERPROFILE\opencode-sync.log" -Tail 20Linux: Check cron logs:
tail -f ~/opencode-sync.logBefore:
GITHUB_COPILOT_ACCESS_TOKEN
GITHUB_COPILOT_REFRESH_TOKEN
SYNC_SCRIPT_UNIX ← No longer needed
SYNC_SCRIPT_WINDOWS ← No longer needed
After:
GITHUB_COPILOT_ACCESS_TOKEN
GITHUB_COPILOT_REFRESH_TOKEN
Before:
~/sync-opencode-auth.sh (downloaded from Infisical)
~/.local/share/opencode/
└── auth.json
.infisical.json
After:
~/sync-opencode-auth.sh (downloaded from GitHub)
~/sync-opencode-wrapper.sh (for cron)
~/.local/share/opencode/
└── auth.json
.infisical.json
~/opencode-sync.log (automatic sync logs)
If you need to go back to the old way:
- Your credentials are still in Infisical, so you're safe
- The old bootstrap scripts are still in git history
- Just checkout the previous version of this repo
But realistically, the new version is strictly better!
- Do I need to update my Windows machines? No, but recommended for better error handling
- Do my credentials need to change? No! Same credentials work
- Will this break my existing setup? No! Backwards compatible
- Do I need to re-authenticate? No! Uses existing Infisical login
TL;DR:
- Sync scripts moved from Infisical to GitHub
- Better error handling and user experience
- Automatic expiry extraction
- Windows and Linux now work the same way
- Your existing credentials still work fine
- Optional: Clean up old SYNC_SCRIPT_* secrets from Infisical