Skip to content

feat(cli): add --title flag for a custom browser tab title - #464

Open
ariel-greenfeld wants to merge 1 commit into
yoshiko-pg:mainfrom
ariel-greenfeld:feat-cli-title-flag
Open

ariel-greenfeld wants to merge 1 commit into
yoshiko-pg:mainfrom
ariel-greenfeld:feat-cli-title-flag

Conversation

@ariel-greenfeld

Copy link
Copy Markdown

Motivation

When several difit instances are open at once (e.g. reviewing multiple branches across worktrees), every browser tab shows the same hardcoded title, so the tabs are indistinguishable. The port isn't a reliable identifier either, since difit silently auto-bumps to the next port when the preferred one is busy.

This adds an opt-in --title <title> flag so each review session can name its own tab (e.g. a ticket id or branch name). Without the flag, behavior is unchanged.

Implementation notes

  • src/cli/index.ts: new --title <title> option, passed to startServer() in both the stdin/PR path and the Git revision path.
  • src/server/server.ts: title added to ServerOptions and included in the /api/diff response.
  • src/types/diff.ts: optional title field on DiffResponse.
  • src/client/App.tsx: sets document.title when the diff response carries a title; the static <title> stays the fallback.

Manual verification

pnpm build
node dist/cli/index.js HEAD main --merge-base --title 'DEV-6687 workspace review'
# second instance, default title for contrast
node dist/cli/index.js HEAD main --merge-base --port 4981

Tabs from three instances — no --title (default), --title 'DEV-5678 hub review', and --title 'DEV-6687 workspace review' (active tab, showing this PR's own diff):

difit tabs with custom titles

Tests

  • Server: /api/diff includes title when the option is set (src/server/server.test.ts).
  • Client: document.title is set from the diff response (src/client/App.test.tsx).
  • pnpm check, pnpm test, and pnpm build pass locally.

🤖 Generated with Claude Code

Every difit instance renders the same hardcoded tab title, so with
several review servers open the tabs are indistinguishable. Pass the
title through the CLI -> server -> /api/diff response, and set
document.title on the client when present.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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