Skip to content

feature: open in terminal from manage workspace#7877

Open
prateek-bruno wants to merge 7 commits intousebruno:mainfrom
prateek-bruno:feature/open-in-terminal-for-workspace
Open

feature: open in terminal from manage workspace#7877
prateek-bruno wants to merge 7 commits intousebruno:mainfrom
prateek-bruno:feature/open-in-terminal-for-workspace

Conversation

@prateek-bruno
Copy link
Copy Markdown
Collaborator

@prateek-bruno prateek-bruno commented Apr 28, 2026

Description

Jira

Fixes #6770

Adds "Open in Terminal" in "Manage Workspace" for non-default workspaces.

Screen.Recording.2026-04-29.at.2.00.07.PM.mov

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Summary by CodeRabbit

  • New Features

    • Manage Workspace menu now shows an "Open in Terminal" action for workspaces with a configured path.
  • Improvements

    • "Rename" and "Remove" actions remain hidden for default workspaces; menu items adapt to workspace state.
  • Tests

    • Added end-to-end test that creates a workspace, triggers "Open in Terminal" from the UI, and verifies a terminal session opens for that workspace.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 28, 2026

Walkthrough

Adds an "Open in Terminal" action to ManageWorkspace's actions menu that calls openDevtoolsAndSwitchToTerminal(dispatch, workspace.pathname), and an E2E test verifying the terminal opens at the workspace path.

Changes

Cohort / File(s) Summary
ManageWorkspace Component
packages/bruno-app/src/components/ManageWorkspace/index.js
Prepends an Open in Terminal menu item to the workspace actions dropdown which invokes openDevtoolsAndSwitchToTerminal(dispatch, workspace.pathname).
ManageWorkspace E2E Test
tests/workspace/manage-workspace/manage-workspace.spec.ts
New Electron/Playwright test: creates a workspace on disk, opens Manage Workspaces UI, triggers "Open in Terminal", and asserts a terminal session appears with the workspace directory path.

Sequence Diagram(s)

sequenceDiagram
    participant UI as "ManageWorkspace UI"
    participant Dispatch as "App Dispatch"
    participant Devtools as "Devtools / Terminal"

    UI->>Dispatch: openDevtoolsAndSwitchToTerminal(dispatch, workspace.pathname)
    Dispatch->>Devtools: open/focus devtools and start terminal at workspace.pathname
    Devtools-->>UI: terminal session visible with workspace path
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

size/S

Suggested reviewers

  • helloanoop
  • lohit-bruno
  • bijin-bruno

Poem

A menu click, a tiny spark,
The terminal wakes from the dark,
Paths converge where shells convene,
Workspace opens, prompt is seen,
Small change, big joy — go run your scheme ✨

🚥 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 clearly and concisely summarizes the main feature: adding an 'Open in Terminal' action to the Manage Workspace UI.
Linked Issues check ✅ Passed The PR implements the feature requested in #6770 by adding an 'Open in Terminal' action for workspaces, enabling terminal access at workspace level as specified.
Out of Scope Changes check ✅ Passed All changes are directly related to the 'Open in Terminal' feature for workspaces. No unrelated modifications detected.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
packages/bruno-app/src/components/ManageWorkspace/index.js (1)

173-175: Add a stable test id to the new trigger.

The new Playwright flow still has to target .more-actions-btn, which is brittle. Add a data-testid here so the E2E spec can use a stable locator instead of a styling class. As per coding guidelines, Add data-testid to testable elements for Playwright.

🧪 Proposed fix
-                      <button className="more-actions-btn">
+                      <button
+                        className="more-actions-btn"
+                        data-testid="workspace-actions-button"
+                      >
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/bruno-app/src/components/ManageWorkspace/index.js` around lines 173
- 175, Add a stable test id to the new actions trigger button so Playwright can
target it instead of the styling class; update the button element rendered in
ManageWorkspace (the JSX that currently uses className="more-actions-btn" and
IconDots) to include a data-testid attribute (e.g.,
data-testid="workspace-more-actions-btn") and ensure the prop is added to that
button element so E2E tests can use this stable locator.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/bruno-app/src/components/ManageWorkspace/index.js`:
- Around line 158-170: The actions menu is being shown for the default workspace
when workspace.pathname exists; change the outer conditional so MenuDropdown is
only rendered when !isDefault, and inside MenuDropdown keep the terminal action
gated by workspace.pathname (i.e., render MenuDropdown only when !isDefault, and
inside its items include open-in-terminal via openDevtoolsAndSwitchToTerminal
only if workspace.pathname is truthy while still including rename/remove via
handleRenameClick and handleCloseClick).

In `@tests/workspace/manage-workspace/manage-workspace.spec.ts`:
- Around line 19-58: The test body must ensure the Electron app is always torn
down: wrap the sequence after creating app (the call to launchElectronApp) in a
try/finally, moving the existing closeElectronApp(app) into the finally block;
ensure app is checked for truthiness before calling closeElectronApp to avoid
calling it if launchElectronApp failed. This impacts the test function that
calls launchElectronApp and closeElectronApp (the "should open terminal from the
workspace actions menu" test), so locate that test, introduce try { ... }
finally { if (app) await closeElectronApp(app); } around the steps to guarantee
cleanup.

---

Nitpick comments:
In `@packages/bruno-app/src/components/ManageWorkspace/index.js`:
- Around line 173-175: Add a stable test id to the new actions trigger button so
Playwright can target it instead of the styling class; update the button element
rendered in ManageWorkspace (the JSX that currently uses
className="more-actions-btn" and IconDots) to include a data-testid attribute
(e.g., data-testid="workspace-more-actions-btn") and ensure the prop is added to
that button element so E2E tests can use this stable locator.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 17427256-b02c-4021-b4d1-6099d44971f6

📥 Commits

Reviewing files that changed from the base of the PR and between a688eff and dca372d.

📒 Files selected for processing (2)
  • packages/bruno-app/src/components/ManageWorkspace/index.js
  • tests/workspace/manage-workspace/manage-workspace.spec.ts

Comment thread packages/bruno-app/src/components/ManageWorkspace/index.js Outdated
Comment thread tests/workspace/manage-workspace/manage-workspace.spec.ts Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/bruno-app/src/components/ManageWorkspace/index.js (1)

157-163: ⚠️ Potential issue | 🟡 Minor

Only show “Open in Terminal” when the workspace has a path.

Right now this item still renders for non-default workspaces with no pathname, which makes it open an unscoped terminal instead of a workspace-scoped one. Gate the entry on workspace.pathname so the action only appears when it can actually open the workspace folder.

🔧 Suggested fix
                   {!isDefault && (
                     <MenuDropdown
                       placement="bottom-end"
                       items={[
-                        { id: 'open-in-terminal', label: 'Open in Terminal', onClick: () => openDevtoolsAndSwitchToTerminal(dispatch, workspace.pathname) },
+                        ...(workspace.pathname
+                          ? [{ id: 'open-in-terminal', label: 'Open in Terminal', onClick: () => openDevtoolsAndSwitchToTerminal(dispatch, workspace.pathname) }]
+                          : []),
                         { id: 'rename', label: 'Rename', onClick: () => handleRenameClick(workspace) },
                         { id: 'remove', label: 'Remove', onClick: () => handleCloseClick(workspace) }
                       ]}
                     >
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/bruno-app/src/components/ManageWorkspace/index.js` around lines 157
- 163, The "Open in Terminal" menu item is shown for non-default workspaces even
when workspace.pathname is falsy, causing an unscoped terminal to open; update
the MenuDropdown items array (in the JSX where MenuDropdown is rendered) to
include the "Open in Terminal" entry only when workspace.pathname is truthy—i.e.
gate the item that calls openDevtoolsAndSwitchToTerminal(dispatch,
workspace.pathname) on workspace.pathname so it only appears when a workspace
path exists, leaving rename (handleRenameClick) and remove (handleCloseClick)
items unchanged.
♻️ Duplicate comments (1)
tests/workspace/manage-workspace/manage-workspace.spec.ts (1)

22-26: ⚠️ Potential issue | 🟡 Minor

Keep firstWindow() inside the cleanup guard.

The finally block only protects the code after firstWindow() succeeds. If window creation fails, closeElectronApp(app) is skipped and the Electron app can leak into later specs.

🧹 Suggested fix
     const app = await launchElectronApp({ initUserDataPath, templateVars: { wsLocation } });
-    const page = await app.firstWindow();
-
     try {
+      const page = await app.firstWindow();
       await page.locator('[data-app-state="loaded"]').waitFor({ timeout: 30000 });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/workspace/manage-workspace/manage-workspace.spec.ts` around lines 22 -
26, The call to firstWindow() is outside the try/finally so if window creation
throws the finally doesn't run and the Electron process (app) can leak; to fix,
ensure the Electron app is always cleaned up by moving the call to firstWindow()
inside the try block (or guard in finally) and ensure closeElectronApp(app) runs
only if app is defined — update the flow around launchElectronApp, firstWindow,
and closeElectronApp so app is created, firstWindow is awaited inside the try,
and the finally closes app when non-null.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@packages/bruno-app/src/components/ManageWorkspace/index.js`:
- Around line 157-163: The "Open in Terminal" menu item is shown for non-default
workspaces even when workspace.pathname is falsy, causing an unscoped terminal
to open; update the MenuDropdown items array (in the JSX where MenuDropdown is
rendered) to include the "Open in Terminal" entry only when workspace.pathname
is truthy—i.e. gate the item that calls
openDevtoolsAndSwitchToTerminal(dispatch, workspace.pathname) on
workspace.pathname so it only appears when a workspace path exists, leaving
rename (handleRenameClick) and remove (handleCloseClick) items unchanged.

---

Duplicate comments:
In `@tests/workspace/manage-workspace/manage-workspace.spec.ts`:
- Around line 22-26: The call to firstWindow() is outside the try/finally so if
window creation throws the finally doesn't run and the Electron process (app)
can leak; to fix, ensure the Electron app is always cleaned up by moving the
call to firstWindow() inside the try block (or guard in finally) and ensure
closeElectronApp(app) runs only if app is defined — update the flow around
launchElectronApp, firstWindow, and closeElectronApp so app is created,
firstWindow is awaited inside the try, and the finally closes app when non-null.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f5a82f2a-a00b-46d8-9391-41cc6973c187

📥 Commits

Reviewing files that changed from the base of the PR and between 0398ef8 and b832bb8.

📒 Files selected for processing (2)
  • packages/bruno-app/src/components/ManageWorkspace/index.js
  • tests/workspace/manage-workspace/manage-workspace.spec.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Open terminal at Workspace level

2 participants