Skip to content

YZJ0716/opencode-multi-copilot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

opencode-multi-copilot

OpenCode plugin for multi-account GitHub Copilot workflows.

Features

  • Store multiple Copilot OAuth accounts in multi-copilot.json
  • Switch the global default account (syncs into auth.json)
  • Bind a different account per session (parallel multi-account usage)
  • Preserve core behavior: session switch does not overwrite global active auth
  • Support both GitHub.com and GitHub Enterprise Copilot

Architecture

This plugin extends OpenCode’s auth model with three layers:

  1. Multi-account state in ~/.local/share/opencode/multi-copilot.json
  2. Global active sync into ~/.local/share/opencode/auth.json
  3. Session-level binding via sessionID headers and provider fetch routing

Installation

Local plugin development

OpenCode reads:

  • .opencode/plugins/multi-copilot.js
  • .opencode/commands/*.md

Build once before first use:

npm install
npm run build

multi-copilot.js loads from dist/src/index.js.

npm package usage

After publishing, install and register the plugin in opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["opencode-multi-copilot"]
}

Login flow

Use the native OpenCode command:

opencode auth login -p github-copilot

The plugin intercepts provider auth and will:

  • complete device flow polling
  • normalize enterprise domains
  • persist/update the account in multi-copilot.json
  • set that account as global active
  • sync auth.json for immediate provider use

Better account switching UX

Guided picker flow (Quick Pick style fallback)

/copilot-pick

Shows an indexed list and lets you switch by:

  • index (1 or #1)
  • alias (case-insensitive)
  • full account ID

Direct switching

/copilot-switch work
/copilot-switch #2
/copilot-global personal

If /copilot-switch is run without arguments, it now returns guided pick instructions instead of a raw error.

Status and management

  • /copilot-accounts
  • /copilot-status
  • /copilot-unbind
  • /copilot-import [alias]
  • /copilot-rename <account> <new-alias>
  • /copilot-remove <account>
  • /copilot-sync

Tool API

The plugin exposes copilot_accounts with actions:

  • list
  • pick
  • status
  • switch
  • unbind
  • remove
  • rename
  • import-current
  • sync

switch.account accepts id, alias, or indexed references (1, #1).

Project links

Notes

  • Credentials remain on local disk using OpenCode-native auth storage style
  • This repository does not include real secrets

About

OpenCode plugin for multi-account GitHub Copilot workflows.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors