Skip to content

CLI launcher for claude-code-history-viewer -- csb view (Alpha #3) #14

@djdarcy

Description

@djdarcy

CLI launcher for claude-code-history-viewer -- csb view <id> (Alpha #3)

Epic

One of four alpha-release criteria. Users need to be able to open a session's full transcript in a readable viewer without navigating through GUIs. This issue tracks adding csb view <id> that launches claude-code-history-viewer (or another reader) on the exact JSONL file, analogous to how typora file.md opens a markdown file directly.

Why

Current reality:

  • csb list shows session metadata (folders, dates, message counts)
  • csb show <id> shows structured metadata details
  • Neither reads the actual conversation

To read a conversation today, you either:

  1. Open claude-code-history-viewer GUI, navigate to the project, click the session (many clicks)
  2. Open the JSONL in a text editor (barely human-readable)
  3. Run claude --resume <id> which requires being in the right project directory

None of these are "just show me the conversation." csb view <id> should be that one-liner.

Approach

Two parts:

Part 1 (upstream): history-viewer CLI mode

claude-code-history-viewer is a Tauri app at C:\code-ext\claude-code-history-viewer. Tauri apps can accept CLI args via the tauri.conf.json CLI plugin. Add:

  • claude-code-history-viewer --jsonl /path/to/session.jsonl opens the app focused on that file
  • claude-code-history-viewer --session-id <uuid> opens the app focused on that session (resolves path internally)
  • claude-code-history-viewer --project <project> --session-id <uuid> for disambiguation

This is an upstream change to the history-viewer repo (owned by @jhlee0409, per the README acknowledgements). We'd need to either:

  • Fork, implement, PR upstream (preferred)
  • Or file an issue requesting the feature and wait

Part 2 (csb-side): csb view command

# commands.py
def cmd_view(args):
    config = _get_config(args)
    conn = open_db(config["index_path"])
    session = get_session(conn, args.session_id)
    if not session:
        print(f"No session found matching '{args.session_id}'")
        return 1

    jsonl_path = Path(config["claude_dir"]) / session["jsonl_path"]

    # Try viewer commands in order of preference
    viewers = [
        ["claude-code-history-viewer", "--jsonl", str(jsonl_path)],
        # Fallbacks could go here -- open in default app, etc.
    ]

    for cmd in viewers:
        if shutil.which(cmd[0]):
            subprocess.Popen(cmd)
            return 0

    print(f"No viewer found. JSONL path: {jsonl_path}")
    return 1

Config key to override the viewer: config["viewer_command"] = "claude-code-history-viewer --jsonl {path}"

Simpler fallback (if upstream CLI mode delays)

If we can't get claude-code-history-viewer CLI mode in time for alpha, the fallback is:

csb view <id>
# -> opens the directory containing the JSONL in the OS file manager
# -> or prints the path so the user can double-click

Not ideal, but it's still one command vs. many clicks.

Even simpler: csb view <id> pipes the JSONL through a distillation filter (reusing #12's code) and outputs markdown to stdout, which can be piped to less or glow:

csb view 916441e6 | less
csb view 916441e6 | glow -   # rich markdown rendering

This is probably the best alpha approach because it doesn't depend on upstream changes and gives immediate value. The history-viewer CLI integration can come in a later release.

Acceptance criteria

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    alpha-blockerMust be resolved before alpha releaseenhancementNew feature or requestepicLarge multi-part feature or effort

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions