@httpete/ctab
v0.1.1
Published
Capture the active tab in your everyday Chrome (real logins, real profiles) from a CLI. Built for feeding LLM coding agents a snapshot of what you're looking at. Pairs a Bun CLI with a small Chrome extension.
Maintainers
Readme
ctab
A Bun CLI + Chrome extension that captures the active tab in your everyday Chrome (real logins, real profiles — not headless, not CDP) and writes a PNG to disk. Built for feeding LLM coding agents a snapshot of what you're looking at.
See DECISIONS.md for the architecture rationale and rejected alternatives.
Quick start (no clone, via bunx)
Requires Bun 1.3+ and macOS.
bunx @httpete/ctab setup # installs the extension files to ~/.ctab/extension/Then in Chrome:
- Open
chrome://extensions. - Toggle Developer mode (top right).
- Click Load unpacked and select
~/.ctab/extension/.
That's it. Now run:
bunx @httpete/ctab screenshot # writes /tmp/ctab-<ms>.png, prints path
bunx @httpete/ctab screenshot ./shot.png # writes to ./shot.pngFor a shorter ctab invocation, see "Local install" below.
Local install (CLI on $PATH, plus optional Claude Code skill)
git clone https://github.com/pierregoutheraud/tabli && cd tabli
bun install1. Build and load the extension
bun run build:extIn Chrome → chrome://extensions → Developer mode → Load unpacked → select extension/dist/.
2. Get the ctab command on your $PATH
bun run install:cliThis builds a ~60MB self-contained binary and drops it in ~/.bun/bin/ctab (which Bun's installer already adds to your $PATH). No Bun needed at runtime after that. Re-run after code changes. To remove: bun run uninstall:cli.
If you'd rather symlink the source (skip the rebuild step on every change):
chmod +x cli/index.ts
ln -s "$PWD/cli/index.ts" ~/.bun/bin/ctab3. Install the Claude Code skill (optional)
bun run install:skillSymlinks skill/ to ~/.claude/skills/ctab/. After restarting Claude Code, prompts like "look at my current tab" or "what am I seeing right now?" will auto-trigger ctab screenshot and read the resulting PNG — no need to mention ctab by name. To remove: bun run uninstall:skill.
4. Install the /ctab slash command (optional)
bun run install:commandSymlinks commands/ctab.md to ~/.claude/commands/ctab.md. After restarting Claude Code, you can type /ctab why is this button misaligned? and Claude will capture the active tab and answer in one turn — handy when you want to explicitly attach your current tab to a prompt. Pairs well with the skill: skill for ambient ("look at my tab"), command for explicit (/ctab does this match the design?). To remove: bun run uninstall:command.
Usage
ctab screenshot # writes /tmp/ctab-<ms>.png, prints path
ctab screenshot ./shot.png # writes to ./shot.png
ctab setup # install/refresh the bundled extension files
ctab help # show usageStdout: absolute path of the written PNG, single line. Errors go to stderr; exit 1 on failure.
Capture-and-open in one shot:
open (ctab screenshot) # fishopen "$(ctab screenshot)" # bash/zshOptions
| | |
|---|---|
| Positional arg to screenshot | output path (default: /tmp/ctab-<unix-ms>.png) |
| CTAB_PORT | override the localhost port (default: 47821) |
Limitations
- macOS only (Bun + MV3 work elsewhere; just untested).
- Cannot capture restricted pages:
chrome://, devtools, Chrome Web Store, the PDF viewer,file://. Switch to a normal tab and retry. captureVisibleTabreturns the viewport only — content below the fold is not captured. (Full-page capture is on the deferred list inDECISIONS.md.)- If you run multiple Chrome profiles in parallel, install the extension in each. The CLI auto-picks the most recently focused profile.
Troubleshooting
No Chrome extension responded within 5s — Chrome isn't running, or the extension isn't loaded. Run ctab setup and load ~/.ctab/extension/ in chrome://extensions.
Cannot capture restricted page — switch to a normal https:// tab.
Port 47821 is in use — another ctab screenshot is mid-flight, or the port is taken. Wait a moment, or set CTAB_PORT.
