Skip to content

feat: --resume on new, manifest-driven restore, send --wait-for-prompt, sessions --json#2

Draft
motin wants to merge 1 commit into
mainfrom
feat/resume-and-manifest
Draft

feat: --resume on new, manifest-driven restore, send --wait-for-prompt, sessions --json#2
motin wants to merge 1 commit into
mainfrom
feat/resume-and-manifest

Conversation

@motin
Copy link
Copy Markdown
Contributor

@motin motin commented May 11, 2026

Summary

Closes four ergonomic gaps surfaced while migrating an 18-session Claude Code fleet from Wave to Tabby.

  1. cctabs new <name> <dir> --resume <session-id> — pass-through to claude --resume <id> --name <name> plus the configured claude.flags from ~/.config/cctabs/config.toml. Validates the session ID against ~/.claude/projects/<slug>/ and warns (but proceeds) if missing. Combines with --worktree. Mutually exclusive with --prompt / --file.
  2. cctabs restore --manifest <file|-> [--create-missing] — drives restore from an explicit {name, dir, session_id?}[] list (plain array, {sessions: […]}, or full {workspaces: [{sessions: […]}]} — accepts cctabs sessions --json output directly). Attaches to existing tabs in the current workspace; with --create-missing also spawns new ones.
  3. cctabs send --wait-for-prompt [--wait-timeout <s>] — polls the buffer until a shell prompt ($ / % / > / ) is visible before sending. Closes a race observed when sending immediately after a Tabby POST /api/tabs/new. Off by default to preserve the existing fast path.
  4. cctabs sessions --json — emits machine-readable JSON (per-workspace, per-session). Includes the resolved Claude session ID when inferable from ~/.claude/projects/<slug>/. Output pipes directly into cctabs restore --manifest -, closing the Wave→Tabby migration loop.

Plus a small infra fix: pass renderHeader: null to gunshi so --json (and any other piped) output isn't prefixed with the package banner.

Design decisions

  • Manifest schema: accepts three shapes (array, {sessions}, or full {workspaces: [{sessions}]}) so callers can roundtrip sessions --json output with no transformation. name + dir (or cwd) are required; session_id is optional — when omitted, restore falls back to a name lookup in ~/.claude/projects/<slug-of-dir>/.
  • --create-missing scope: limited to the current workspace. With Tabby that's the only workspace, and on Wave you almost always want to spawn into the window you're sitting in.
  • --wait-for-prompt opt-in: existing callers don't need the latency; only freshly spawned tabs do. A --no-wait opt-out would be a wider change.
  • --resume validation: warn-and-proceed rather than abort. The user may know better than we do (worktree corner cases, stale slug, etc.), so we don't block.

Test plan

  • npm run typecheck clean
  • npm run build clean
  • cctabs sessions --json | jq '.workspaces[0].sessions | length' returns a number
  • cctabs sessions --json | cctabs restore --manifest - --dry round-trips
  • cctabs sessions --json | cctabs restore --manifest - --create-missing --dry shows spawn intent for the current tab
  • cctabs new --resume <bad-id> warns and proceeds
  • cctabs new --resume <id> --prompt foo errors cleanly
  • End-to-end on Wave Terminal (only smoke-tested on Tabby)
  • cctabs send --wait-for-prompt round-trip against a slow-to-prompt tab

🤖 Generated with Claude Code

…t, sessions --json

Closes ergonomic gaps in the Wave→Tabby fleet-migration flow:

1. `cctabs new <name> <dir> --resume <session-id>` — pass-through to
   `claude --resume <id> --name <name>` plus configured claude.flags.
   Validates the session ID against `~/.claude/projects/`. Combines with
   --worktree. Mutually exclusive with --prompt/--file.

2. `cctabs restore --manifest <file|-> [--create-missing]` — drives
   restore from an explicit `{name, dir, session_id?}[]` list. Accepts
   `cctabs sessions --json` output directly. Attaches to existing tabs in
   the current workspace; with --create-missing also spawns new ones.

3. `cctabs send --wait-for-prompt [--wait-timeout <s>]` — polls the
   buffer until a shell prompt (\$/%/>/❯) is visible before sending.
   Closes a race when sending into a freshly spawned tab.

4. `cctabs sessions --json` — emits machine-readable JSON with resolved
   Claude session IDs. Output is pipeable to `cctabs restore --manifest -`,
   closing the Wave→Tabby migration loop.

Also: pass `renderHeader: null` to gunshi so `--json` output isn't
prefixed with the package banner and stays parseable when piped.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant