Skip to content

Commit a55bfc0

Browse files
motinclaude
andauthored
fix(tabby): install a pinned tabby-cctabs, never the latest (#30)
The Tabby plugin runs inside Tabby with the user's full rights, and `install-tabby-plugin`, the doctor hint and the skill all installed whatever `tabby-cctabs` was newest on npm. A compromised or broken plugin release would reach every machine that ran the command. They now all install one pinned version: `TABBY_PLUGIN` in `src/core/tabby-plugin-dir.ts`, currently `tabby-cctabs@0.1.5`. A new plugin release is taken on by changing that line, in the same PR as the CLI change that needs it. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent 3b0efa9 commit a55bfc0

7 files changed

Lines changed: 54 additions & 8 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ page lives at [cctabs.com/changelog](https://cctabs.com/changelog).
55

66
## Unreleased
77

8+
- **The Tabby plugin is now installed at a pinned version, never "whatever is newest".** `install-tabby-plugin`, the install line printed when the plugin can't be reached, and the skill's install reference all ran a bare `npm install tabby-cctabs`. That plugin runs inside Tabby with the user's full rights, so a compromised or broken release would have reached every machine that ran the command, with no review in between. All three now install `tabby-cctabs@0.1.5`, from one constant (`TABBY_PLUGIN` in `src/core/tabby-plugin-dir.ts`). A new plugin release reaches users only when a PR changes that line — in the same PR as the CLI change that needs it. A test fails if the skill's hand-written install lines disagree with the constant, because the agent following that doc by hand never sees the constant, and nothing else would notice the drift.
9+
810
## 0.5.8 — 2026-09-23
911

1012
- **Suspended tabs.** `cctabs suspend <tab>` stops the Claude in a tab and leaves a small placeholder that keeps the tab's name, place and session: `⏸ cctabs suspended — <name> · <size> · <dir> / press Enter to resume`. `cctabs restore --manifest … -c --suspended` brings a whole fleet back this way in about a second per tab with no Claude started (a 66-session restore took minutes, hit the plugin's spawn timeouts, and pushed live sessions out of claude.ai's remote-control top 20); `cctabs new <name> -r <id> --suspended` opens one directly. A suspended tab wakes on Enter, on `cctabs wake`/`resume`, or — the point of it — **when `cctabs send` targets it**: send wakes the tab, waits until Claude is at a ready prompt, then delivers and checks the delivery against the transcript, so the sender never has to know. `sessions --json` reports `status: "suspended"` with the session id and dir; `manifest` keeps suspended tabs (`suspended: true`) so they restore asleep; `restore` and `restart` leave them asleep. The state lives in a registry (`~/.config/cctabs/suspended/`) and in the placeholder's own argv, never only on screen — Tabby captures nothing for a background tab. **Trade-off: a suspended tab is not on Remote Control until woken.** Needs bash or zsh as the tab shell.

‎CLAUDE.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,14 @@ version already exists with different contents, bump — don't reuse it.
117117
The no-gaps rule above applies here too: a `tabby-v*` tag whose run was never
118118
approved should be re-pointed, not abandoned for the next number.
119119

120+
**Publishing a plugin release does not ship it to anyone.** The CLI installs a pinned
121+
version — `TABBY_PLUGIN` in `src/core/tabby-plugin-dir.ts` — never the latest, because
122+
the plugin runs inside Tabby with the user's full rights and a release should be taken
123+
on deliberately. So a plugin release is two steps: publish `tabby-v<version>`, then bump
124+
`TABBY_PLUGIN` in the same PR as the CLI change that needs it, and cut a CLI release.
125+
Also update the version spelled out in `skills/cctabs/references/install.md`;
126+
`src/core/tabby-plugin-pin.test.ts` fails until you do.
127+
120128
To build locally (for `sideload`, or to check a change before tagging):
121129

122130
```bash

‎skills/cctabs/references/install.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ cctabs install-tabby-plugin --yes
3131
```
3232

3333
What it does, in order:
34-
1. `npm install --legacy-peer-deps --prefix <tabby-plugins-dir> tabby-cctabs`
34+
1. `npm install --legacy-peer-deps --prefix <tabby-plugins-dir> tabby-cctabs@0.1.5`
3535
2. Captures the current claude session id from `~/.claude/projects/<slug>/`
3636
3. Spawns a detached background worker that quits Tabby, waits for it to die, reopens it, then opens a new tab running `claude --resume <id> --fork-session` in your current cwd.
3737

@@ -43,7 +43,7 @@ What it does, in order:
4343
TABBY_PLUGINS="$HOME/Library/Application Support/tabby/plugins"
4444
mkdir -p "$TABBY_PLUGINS"
4545
[ -f "$TABBY_PLUGINS/package.json" ] || echo '{"private":true}' > "$TABBY_PLUGINS/package.json"
46-
npm install --legacy-peer-deps --prefix "$TABBY_PLUGINS" tabby-cctabs
46+
npm install --legacy-peer-deps --prefix "$TABBY_PLUGINS" tabby-cctabs@0.1.5
4747
# then ask the user to quit + reopen Tabby
4848
```
4949

‎src/commands/install-tabby-plugin.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { define } from 'gunshi'
66
import { consola } from 'consola'
77
import { detectTerminal } from '../core/terminal.js'
88
import { findLatestSessionId } from '../core/session.js'
9-
import { tabbyPluginsDir as pluginsDir } from '../core/tabby-plugin-dir.js'
9+
import { TABBY_PLUGIN, tabbyPluginsDir as pluginsDir } from '../core/tabby-plugin-dir.js'
1010

1111
function shellQuote(s: string): string {
1212
return `'${s.replace(/'/g, `'\\''`)}'`
@@ -48,10 +48,10 @@ export const installTabbyPluginCommand = define({
4848
const pkgPath = join(dir, 'package.json')
4949
if (!existsSync(pkgPath)) writeFileSync(pkgPath, '{"private":true}\n')
5050

51-
consola.info('Installing tabby-cctabs from npm…')
51+
consola.info(`Installing ${TABBY_PLUGIN} from npm…`)
5252
const npm = spawnSync(
5353
'npm',
54-
['install', '--legacy-peer-deps', '--silent', '--prefix', dir, 'tabby-cctabs'],
54+
['install', '--legacy-peer-deps', '--silent', '--prefix', dir, TABBY_PLUGIN],
5555
{ stdio: 'inherit' },
5656
)
5757
if (npm.status !== 0) {

‎src/core/tabby-plugin-dir.ts‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ export function tabbyPluginsDir(): string {
2626
throw new Error(`unsupported platform: ${platform()}`)
2727
}
2828

29+
/**
30+
* The Tabby plugin release this CLI installs. Pinned, never the latest: the plugin runs
31+
* inside Tabby with the user's full rights, so a new release is taken on deliberately,
32+
* by changing this line.
33+
*/
34+
export const TABBY_PLUGIN = 'tabby-cctabs@0.1.5'
35+
2936
/**
3037
* The by-hand install line for this platform, for when the automated path is
3138
* unavailable. `--legacy-peer-deps` is required: the plugin's peer deps
@@ -34,6 +41,6 @@ export function tabbyPluginsDir(): string {
3441
export function manualInstallSnippet(): string {
3542
const dir = tabbyPluginsDir()
3643
return platform() === 'win32'
37-
? `npm install --legacy-peer-deps --prefix "${dir}" tabby-cctabs`
38-
: `npm install --legacy-peer-deps --prefix "${dir.replace(homedir(), '$HOME')}" tabby-cctabs`
44+
? `npm install --legacy-peer-deps --prefix "${dir}" ${TABBY_PLUGIN}`
45+
: `npm install --legacy-peer-deps --prefix "${dir.replace(homedir(), '$HOME')}" ${TABBY_PLUGIN}`
3946
}

‎src/core/tabby-plugin-pin.test.ts‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { describe, it, expect } from 'bun:test'
2+
import { readFileSync } from 'fs'
3+
import { fileURLToPath } from 'url'
4+
import { TABBY_PLUGIN } from './tabby-plugin-dir.js'
5+
6+
/**
7+
* The plugin pin lives in code, but the skill's install reference spells the same
8+
* version out by hand — for the agent following it manually, who never sees
9+
* TABBY_PLUGIN. Bumping the constant without the doc would leave the skill telling
10+
* every agent to install the release the CLI just moved off. Nothing would fail,
11+
* which is the same reason PLUGIN_VERSION drifted twice; hence a test.
12+
*/
13+
describe('tabby-cctabs pin', () => {
14+
const read = (rel: string) => readFileSync(fileURLToPath(new URL(rel, import.meta.url)), 'utf-8')
15+
16+
it('is an exact version, never a range or a tag', () => {
17+
expect(TABBY_PLUGIN).toMatch(/^tabby-cctabs@\d+\.\d+\.\d+$/)
18+
})
19+
20+
it('is the version the skill install reference tells agents to install', () => {
21+
const doc = read('../../skills/cctabs/references/install.md')
22+
const mentions = [...doc.matchAll(/tabby-cctabs(@[^\s`"']*)?/g)]
23+
.filter((m) => /npm install/.test(doc.slice(doc.lastIndexOf('\n', m.index!), m.index!)))
24+
.map((m) => m[0])
25+
expect(mentions.length).toBeGreaterThan(0)
26+
for (const m of mentions) expect(m).toBe(TABBY_PLUGIN)
27+
})
28+
})

‎src/core/tabby.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import type {
88
} from '../types/index.js'
99
import type { TerminalAdapter } from './adapter.js'
1010
import { classifyTerminalBuffer } from './session-status.js'
11+
import { TABBY_PLUGIN } from './tabby-plugin-dir.js'
1112
import { matchTabsByName, normalizeTabName, type TabMatchOptions } from './tab-match.js'
1213

1314
/**
@@ -27,7 +28,7 @@ export class TabbyPluginUnreachableError extends Error {
2728
' cctabs install-tabby-plugin',
2829
'',
2930
'Or do it by hand:',
30-
` npm install --legacy-peer-deps --prefix "$HOME/Library/Application Support/tabby/plugins" tabby-cctabs`,
31+
` npm install --legacy-peer-deps --prefix "$HOME/Library/Application Support/tabby/plugins" ${TABBY_PLUGIN}`,
3132
' # then quit Tabby (Cmd+Q) and reopen it.',
3233
'',
3334
'Verify with: cctabs doctor',

0 commit comments

Comments
 (0)