Skip to content

Add openAsChatView tab context action for terminal tabs - #144

Closed
lawrencecchen wants to merge 1 commit into
mainfrom
feat-open-as-chat-view
Closed

lawrencecchen wants to merge 1 commit into
mainfrom
feat-open-as-chat-view

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Jun 10, 2026 •

Copy link
Copy Markdown

Adds an "Open as Chat View" item to the tab context menu, shown only for terminal tabs (state.isTerminal), mirroring the forkConversation gating pattern. The action flows through the existing requestTabContextAction → splitTabBar(_:didRequestTabContextAction:for:inPane:) delegate path, so the host app decides what opening a chat view means.

New TabContextAction.openAsChatView case, menu construction in TabContextMenuBuilder.makeMenu, and localized titles (en + ja) via the existing Bundle.module strings tables.

Consumed by cmux in manaflow-ai/cmux#5576 follow-up (open agent chat as a tab in the pane instead of a separate window).

🤖 Generated with Claude Code


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.


Summary by cubic

Add an “Open as Chat View” option to terminal tab context menus. It sends a new openAsChatView action through the existing delegate so host apps decide how to open the chat view.

  • New Features
    • New TabContextAction.openAsChatView.
    • Show “Open as Chat View” only when state.isTerminal.
    • Uses requestTabContextAction → splitTabBar(_:didRequestTabContextAction:for:inPane:).
    • Added tabContext.openAsChatView strings in en and ja.

Written for commit ea86dfe. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features
    • Added "Open as Chat View" option to the context menu for terminal tabs, making it available alongside other existing menu options.
    • Context menu interface enhanced with improved visual separators for better organization and menu readability.
    • New menu option fully localized with language translations provided for English and Japanese users.

Adds an 'Open as Chat View' item to the tab context menu, shown only for
terminal tabs (state.isTerminal), mirroring how forkConversation items are
gated. The action flows through the existing requestTabContextAction ->
splitTabBar(_:didRequestTabContextAction:for:inPane:) delegate path so the
host app decides what opening a chat view means.

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

coderabbitai Bot commented Jun 10, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 618dae4d-4f90-40f2-b6b8-d6eaf0a745fb

📥 Commits

Reviewing files that changed from the base of the PR and between 5728c21 and ea86dfe.

📒 Files selected for processing (4)
  • Sources/Bonsplit/Internal/Views/TabItemView.swift
  • Sources/Bonsplit/Public/Types/TabContextAction.swift
  • Sources/Bonsplit/Resources/en.lproj/Localizable.strings
  • Sources/Bonsplit/Resources/ja.lproj/Localizable.strings

📝 Walkthrough

Walkthrough

This PR adds a new "Open as Chat View" context menu item for terminal tabs. The change defines a new action type, provides localized UI labels in English and Japanese, and updates the tab context menu construction logic to conditionally show the item and manage separator placement.

Changes

Terminal Tab Chat View Menu

Layer / File(s) Summary
Action type and localization definition
Sources/Bonsplit/Public/Types/TabContextAction.swift, Sources/Bonsplit/Resources/en.lproj/Localizable.strings, Sources/Bonsplit/Resources/ja.lproj/Localizable.strings
TabContextAction enum case openAsChatView is added; localization entries provide English "Open as Chat View" and Japanese equivalent labels.
Terminal tab context menu enhancement
Sources/Bonsplit/Internal/Views/TabItemView.swift
Context menu construction adds a separator when the tab is terminal or conversation forking is available; inserts the new "Open as Chat View" action for terminal tabs; refactors the conversation fork section to display only when forking is available.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • manaflow-ai/bonsplit#138: Also modifies tab context menu construction in TabItemView.swift around conversation forking; may interact with separator/conditional insertion logic.
  • manaflow-ai/bonsplit#137: Extends both TabItemView.swift menu construction and TabContextAction.swift enum; new separator and "Open as Chat View" insertion could interact with prior menu item additions.
  • manaflow-ai/bonsplit#135: Introduces the canForkConversation condition and conversation forking menu logic that this PR refactors and builds upon.

Poem

🐰 A terminal tab now chats with ease,
A menu item added to please,
In English and Japanese, strings align,
Context menus now divide just fine—
One small action, one bright design! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and clearly describes the main change: adding a new 'openAsChatView' tab context action specifically for terminal tabs, which aligns with the primary modifications across all changed files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat-open-as-chat-view

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps

greptile-apps Bot commented Jun 10, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds an "Open as Chat View" tab context menu action for terminal tabs, flowing through the existing requestTabContextAction → splitTabBar(_:didRequestTabContextAction:for:inPane:) delegate path so the host app handles the actual behavior.

  • Adds TabContextAction.openAsChatView to the public enum and gates the menu item on state.isTerminal, mirroring how forkConversation is gated on state.canForkConversation.
  • Splits the pre-existing single separator condition from canForkConversation-only to isTerminal || canForkConversation, avoiding a dangling separator while keeping both groups visually separated from the items above.
  • Adds tabContext.openAsChatView localization strings in both en.lproj and ja.lproj.

Confidence Score: 5/5

Safe to merge — the change is additive and purely delegates to the host app; no library-internal logic is affected.

All four changed files follow the established patterns precisely: the new enum case slots in alongside the fork-conversation cases, the menu-builder refactor is a clean split of one conditional into two without introducing any new state, and both localization files are updated consistently. There are no exhaustive switches on TabContextAction inside the library that would need updating, and the action is always enabled when shown, matching the forkConversation precedent.

No files require special attention.

Important Files Changed

Filename Overview
Sources/Bonsplit/Public/Types/TabContextAction.swift Adds openAsChatView case to the public TabContextAction enum; consistent position and no exhaustive switch statements in the library require updating.
Sources/Bonsplit/Internal/Views/TabItemView.swift Refactors separator logic and adds the new menu item behind state.isTerminal; mirrors the existing forkConversation gating pattern correctly with no double-separator risk.
Sources/Bonsplit/Resources/en.lproj/Localizable.strings Adds tabContext.openAsChatView = "Open as Chat View" in the correct position alongside the fork-conversation strings.
Sources/Bonsplit/Resources/ja.lproj/Localizable.strings Adds Japanese localization tabContext.openAsChatView = "チャットビューで開く", correctly mirroring the English entry.

Sequence Diagram

sequenceDiagram
    participant User
    participant TabContextMenuBuilder
    participant TabItemView
    participant BonsplitController
    participant Delegate as BonsplitDelegate (host app)

    User->>TabItemView: Right-click terminal tab
    TabItemView->>TabContextMenuBuilder: makeMenu(snapshot:, target:)
    Note over TabContextMenuBuilder: state.isTerminal == true
    TabContextMenuBuilder-->>TabItemView: NSMenu with "Open as Chat View" item
    TabItemView-->>User: Show context menu

    User->>TabItemView: Select "Open as Chat View"
    TabItemView->>BonsplitController: requestTabContextAction(.openAsChatView, for: tabId, inPane:)
    BonsplitController->>Delegate: splitTabBar(_:didRequestTabContextAction: .openAsChatView, for: tab, inPane:)
    Delegate-->>BonsplitController: (host app handles: open agent chat as tab)
Loading

Reviews (1): Last reviewed commit: "Add openAsChatView tab context action fo..." | Re-trigger Greptile

@lawrencecchen

Copy link
Copy Markdown
Author

Closing: this existed only to support the chat-as-tab entrypoint in manaflow-ai/cmux PR 5772, which was superseded by the workspace-pane direction in manaflow-ai/cmux#5736.

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