@brimveyn/aimux 1.22.9 → 1.22.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/git/gh-auth.ts +11 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brimveyn/aimux",
3
- "version": "1.22.9",
3
+ "version": "1.22.10",
4
4
  "description": "A terminal multiplexer for AI CLIs. Run Claude, Codex, OpenCode, Kimi side-by-side with tabbed navigation, split panes, and persistent sessions.",
5
5
  "keywords": [
6
6
  "ai",
@@ -34,11 +34,19 @@ export async function listGhAccounts(): Promise<GhAccount[]> {
34
34
  return parseGhAuthStatus(`${result.stdout}\n${result.stderr}`)
35
35
  }
36
36
 
37
- /** Where a "switch account" button goes next: the following account, cycling. */
37
+ /**
38
+ * Where a "switch account" button goes next: the following account, cycling.
39
+ * The order has to come from the names, not from `gh auth status`, which lists
40
+ * the active account first — cycling that puts you back on the account you just
41
+ * left, so a third account is never reachable.
42
+ */
38
43
  export function nextGhAccount(accounts: readonly GhAccount[]): GhAccount | null {
39
44
  if (accounts.length < 2) return null
40
- const index = accounts.findIndex((account) => account.active)
41
- return accounts[(index + 1) % accounts.length] ?? null
45
+ const sorted = [...accounts].sort(
46
+ (a, b) => a.host.localeCompare(b.host) || a.user.localeCompare(b.user)
47
+ )
48
+ const index = sorted.findIndex((account) => account.active)
49
+ return sorted[(index + 1) % sorted.length] ?? null
42
50
  }
43
51
 
44
52
  /** Returns an error message, or null when the switch landed. */