Skip to content

feat: integrate Git remote for collections - #7879

Merged
sid-bruno merged 3 commits into
usebruno:mainfrom
naman-bruno:feat/workspace-remote
May 4, 2026
Merged

sid-bruno merged 3 commits into
usebruno:mainfrom
naman-bruno:feat/workspace-remote

Conversation

@naman-bruno

@naman-bruno naman-bruno commented Apr 28, 2026 •

Copy link
Copy Markdown
Collaborator

JIRA

Description

Add remote backed collection support for workspaces

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.

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

Publishing to New Package Managers

Please see here for more information.

Summary by CodeRabbit

  • New Features
    • Git remote management for collections: connect/disconnect remotes with URL validation, new modals, and sidebar/collection UI for Git-backed and remote-only ("ghost") entries.
    • Context menu actions: clone from Git, copy Git URL, and manage remotes with clipboard/toast feedback.
  • Bug Fixes
    • Prevents auto-opening collections that are missing locally.
  • Style
    • Improved sidebar row and inline remote styling for better truncation, hover actions, and visual badges.
  • Tests
    • Added end-to-end and unit tests covering Git-remote wiring and .gitignore management.

@coderabbitai

coderabbitai Bot commented Apr 28, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

Adds Git-remote support for workspace collections: UI components and modals, Redux thunks, Electron IPC handlers, and workspace-config utilities to persist/clear remotes and manage per-collection .gitignore entries; sidebar shows “ghost” remote-only collections.

Changes

Git Remote integration

Layer / File(s) Summary
Data Shape / Config API
packages/bruno-electron/src/utils/workspace-config.js
Adds setCollectionGitRemote, clearCollectionGitRemote, and resolveAndFilterWorkspaceCollections; refactors collection path resolution and notFoundLocally annotation; manages a dedicated managed block in .gitignore.
IPC Handlers
packages/bruno-electron/src/ipc/workspace.js
Adds renderer:connect-collection-to-git and renderer:disconnect-collection-from-git endpoints; delegates to workspace-config helpers and emits main:workspace-config-updated.
Redux Thunks
packages/bruno-app/src/providers/ReduxStore/slices/workspaces/actions.js
Adds connectCollectionToGit and disconnectCollectionFromGit thunks that call IPC, show toasts on error, and return success; tweaks collection-loading/opening behavior to avoid auto-opening notFoundLocally entries.
Sidebar UI
packages/bruno-app/src/components/Sidebar/Collections/GitRemoteCollectionRow/StyledWrapper.js, packages/bruno-app/src/components/Sidebar/Collections/GitRemoteCollectionRow/index.js
New styled Wrapper and GitRemoteCollectionRow component rendering ghost remote rows with hover styles, click to open Clone modal, and context-menu dropdown (Clone / Copy URL / Remove).
Workspace Home UI
packages/bruno-app/src/components/WorkspaceHome/WorkspaceOverview/CollectionsList/index.js, .../ConnectGitRemote/index.js, .../RemoveGitRemote/index.js, .../StyledWrapper.js
Integrates Connect/Remove modals, adds git status badge and inline remote display, wiring for copy/remove/connect actions, and conditional rendering of ghost rows in the collections list.
Sidebar integration
packages/bruno-app/src/components/Sidebar/Collections/index.js
Changes rendering to iterate workspace-ordered sidebarEntries, rendering loaded collections or ghost GitRemoteCollectionRow for remote-only entries.
Tests & Fixtures
packages/bruno-electron/tests/utils/workspace-config.spec.js, tests/workspace/git-backed-collections/*
Adds tests for set/clearCollectionGitRemote, .gitignore management, getWorkspaceCollections behavior, Playwright spec verifying connect/disconnect flows, modal validation, and sidebar ghost-row behavior; adds fixtures and test init data.

Sequence Diagram(s)

sequenceDiagram
    participant UI as CollectionsList UI
    participant Redux as Redux Store
    participant IPC as Electron IPC
    participant Config as Workspace Config
    participant FS as File System
    participant Broadcast as Workspace Broadcast

    rect rgba(100, 150, 200, 0.5)
        Note over UI,Broadcast: Connect Collection to Git
        UI->>Redux: Dispatch connectCollectionToGit(workspaceUid, collectionPath, remoteUrl)
        Redux->>IPC: Invoke renderer:connect-collection-to-git
        IPC->>Config: Validate remoteUrl & locate workspace
        Config->>FS: Write remote to workspace.yml
        Config->>FS: Add collection path to .gitignore
        Config->>Broadcast: Emit main:workspace-config-updated
        Broadcast->>Redux: Update workspace config in store
        IPC-->>Redux: Resolve thunk success
        Redux-->>UI: Show toast "Git remote connected"
    end
Loading
sequenceDiagram
    participant UI as CollectionsList UI
    participant Redux as Redux Store
    participant IPC as Electron IPC
    participant Config as Workspace Config
    participant FS as File System
    participant Broadcast as Workspace Broadcast

    rect rgba(200, 100, 100, 0.5)
        Note over UI,Broadcast: Disconnect Collection from Git
        UI->>Redux: Dispatch disconnectCollectionFromGit(workspaceUid, collectionPath)
        Redux->>IPC: Invoke renderer:disconnect-collection-from-git
        IPC->>Config: Locate workspace & collection
        Config->>FS: Clear remote from workspace.yml
        Config->>FS: Remove collection path from .gitignore
        Config->>Broadcast: Emit main:workspace-config-updated
        Broadcast->>Redux: Update workspace config in store
        IPC-->>Redux: Resolve thunk success
        Redux-->>UI: Show toast "Git remote removed"
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

size/XL

Suggested reviewers

  • lohit-bruno
  • bijin-bruno
  • helloanoop
  • sid-bruno

Poem

🌱 A remote whispered into workspace night,
Modal opens, thunks march into the light,
.gitignore learns a tidy, guarded song,
IPC hums while Redux humbers along,
Ghost rows wait, ready for a clone’s delight.

🚥 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 'feat: integrate Git remote for collections' clearly and concisely summarizes the main change—adding Git remote support for workspace collections—and aligns with the substantial feature work across the codebase.
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 unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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-electron/src/ipc/workspace.js (1)

583-600: Consider: The regex validation may be redundant with the frontend validation.

The frontend already validates via isGitRepositoryUrl (which uses git-url-parse). This backend regex is a simpler pattern check. While defense-in-depth is good, the two validations use different logic:

  • Frontend: git-url-parse library with protocol/owner/source checks
  • Backend: Regex pattern match

This could lead to edge cases where one accepts a URL the other rejects. If intentional as a basic sanity check, that's fine. Otherwise, consider aligning validation logic.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/bruno-electron/src/ipc/workspace.js` around lines 583 - 600, The
backend regex in the ipcMain handler for 'renderer:connect-collection-to-git'
can disagree with the frontend's isGitRepositoryUrl; instead of the ad-hoc regex
in that handler, either remove the regex check entirely (rely on frontend +
setCollectionGitRemote errors) or align validation by using the same
logic/library: import or reimplement the frontend's isGitRepositoryUrl (or use
git-url-parse) in this module, trim remoteUrl, validate with that function, and
throw the same error message when invalid; keep the surrounding try/catch and
calls to setCollectionGitRemote and broadcastWorkspaceConfig unchanged.
🤖 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/providers/ReduxStore/slices/workspaces/actions.js`:
- Around line 339-342: The workspace can get stuck because cached
updatedWorkspace.collections retain notFoundLocally and get filtered out; update
loadWorkspaceCollections() so cached collections are revalidated before
filtering: for each item in updatedWorkspace.collections check the current
filesystem (e.g., fs.existsSync or the existing path-exists helper) and clear or
ignore notFoundLocally when the path now exists, then build collectionPaths (the
logic around collectionPaths, normalizePath and alreadyOpenCollections) from
that revalidated list; alternatively, if any cached collection has
notFoundLocally true but its path now exists, invalidate/refresh the cache so
the collection is included.

In `@packages/bruno-electron/src/utils/workspace-config.js`:
- Around line 379-396: The removeCollectionFromWorkspaceGitignore function
currently removes any matching collection line unconditionally; change it to
only remove entries that Bruno created by (1) marking Bruno-managed entries when
adding them (use addCollectionToWorkspaceGitignore / getCollectionGitignoreEntry
to write entries wrapped in clear start/end markers or a per-entry comment
token) and (2) when removing in removeCollectionFromWorkspaceGitignore, only
delete lines within that managed marker/block or lines that contain the
Bruno-specific token; if no managed marker/token is found, leave the user's
lines untouched. Update both add and remove code paths (and the logic used in
the similar block at 426-445) to use the same marker/token convention so only
Bruno-owned entries are modified.

---

Nitpick comments:
In `@packages/bruno-electron/src/ipc/workspace.js`:
- Around line 583-600: The backend regex in the ipcMain handler for
'renderer:connect-collection-to-git' can disagree with the frontend's
isGitRepositoryUrl; instead of the ad-hoc regex in that handler, either remove
the regex check entirely (rely on frontend + setCollectionGitRemote errors) or
align validation by using the same logic/library: import or reimplement the
frontend's isGitRepositoryUrl (or use git-url-parse) in this module, trim
remoteUrl, validate with that function, and throw the same error message when
invalid; keep the surrounding try/catch and calls to setCollectionGitRemote and
broadcastWorkspaceConfig unchanged.
🪄 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: a1f00461-729c-4476-a3be-fd06c0be6ce3

📥 Commits

Reviewing files that changed from the base of the PR and between ff6ec4a and f808be0.

📒 Files selected for processing (11)
  • packages/bruno-app/src/components/Sidebar/Collections/GitRemoteCollectionRow/StyledWrapper.js
  • packages/bruno-app/src/components/Sidebar/Collections/GitRemoteCollectionRow/index.js
  • packages/bruno-app/src/components/Sidebar/Collections/index.js
  • packages/bruno-app/src/components/WorkspaceHome/WorkspaceOverview/CollectionsList/ConnectGitRemote/index.js
  • packages/bruno-app/src/components/WorkspaceHome/WorkspaceOverview/CollectionsList/RemoveGitRemote/index.js
  • packages/bruno-app/src/components/WorkspaceHome/WorkspaceOverview/CollectionsList/StyledWrapper.js
  • packages/bruno-app/src/components/WorkspaceHome/WorkspaceOverview/CollectionsList/index.js
  • packages/bruno-app/src/providers/ReduxStore/slices/workspaces/actions.js
  • packages/bruno-electron/src/ipc/workspace.js
  • packages/bruno-electron/src/utils/workspace-config.js
  • packages/bruno-electron/tests/utils/workspace-config.spec.js

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
tests/workspace/git-backed-collections/git-backed-collections.spec.ts (1)

157-172: ⚡ Quick win

Replace Tailwind utility class .text-red-500 with a data-testid locator.

These selectors can break when the DOM structure changes — and a Tailwind colour class is particularly fragile since any styling change (e.g., switching to a different error shade) would silently break these assertions without touching any logic. The ConnectGitRemote component renders the error as <div className="text-red-500"> with no data-testid.

Add data-testid="remote-url-error" to that <div> in ConnectGitRemote/index.js and update both assertions here:

♻️ Proposed fix (test + component)

In packages/bruno-app/src/components/WorkspaceHome/WorkspaceOverview/CollectionsList/ConnectGitRemote/index.js:

-          <div className="text-red-500">{formik.errors.remoteUrl}</div>
+          <div className="text-red-500" data-testid="remote-url-error">{formik.errors.remoteUrl}</div>

In git-backed-collections.spec.ts (apply to both occurrences):

-        await expect(modal.locator('.text-red-500').first()).toBeVisible({ timeout: 2000 });
+        await expect(modal.getByTestId('remote-url-error')).toBeVisible({ timeout: 2000 });

As per coding guidelines, data-testid should be added to testable elements for Playwright.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/workspace/git-backed-collections/git-backed-collections.spec.ts` around
lines 157 - 172, Add a stable test id to the error element in the
ConnectGitRemote component and update the two failing assertions in the
git-backed-collections.spec.ts to use it: modify the error div rendered by
ConnectGitRemote (currently has class "text-red-500") to include
data-testid="remote-url-error", then in the test replace
modal.locator('.text-red-500').first() with
modal.locator('[data-testid="remote-url-error"]').first() for both the "Empty
URL..." and "Malformed URL..." steps so assertions no longer rely on Tailwind
classes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/workspace/git-backed-collections/git-backed-collections.spec.ts`:
- Around line 30-34: The helper readGitignoreLines currently splits on '\n'
which leaves a trailing '\r' on Windows; update readGitignoreLines to split
using a CRLF-safe pattern (e.g., split on /\r?\n/) or normalize line endings
(replace CRLF with LF) before splitting, and optionally trim or filter empty
lines so comparisons like toContain('collections/sample-coll/') match reliably;
locate and modify the readGitignoreLines function to implement this change.

---

Nitpick comments:
In `@tests/workspace/git-backed-collections/git-backed-collections.spec.ts`:
- Around line 157-172: Add a stable test id to the error element in the
ConnectGitRemote component and update the two failing assertions in the
git-backed-collections.spec.ts to use it: modify the error div rendered by
ConnectGitRemote (currently has class "text-red-500") to include
data-testid="remote-url-error", then in the test replace
modal.locator('.text-red-500').first() with
modal.locator('[data-testid="remote-url-error"]').first() for both the "Empty
URL..." and "Malformed URL..." steps so assertions no longer rely on Tailwind
classes.
🪄 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: 947d3fe7-0405-49b2-96b4-ce686833a032

📥 Commits

Reviewing files that changed from the base of the PR and between 75e333c and 976936b.

📒 Files selected for processing (7)
  • tests/workspace/git-backed-collections/fixtures/workspace-with-collection/.gitignore
  • tests/workspace/git-backed-collections/fixtures/workspace-with-collection/collections/sample-coll/bruno.json
  • tests/workspace/git-backed-collections/fixtures/workspace-with-collection/workspace.yml
  • tests/workspace/git-backed-collections/fixtures/workspace-with-ghost/.gitignore
  • tests/workspace/git-backed-collections/fixtures/workspace-with-ghost/workspace.yml
  • tests/workspace/git-backed-collections/git-backed-collections.spec.ts
  • tests/workspace/git-backed-collections/init-user-data/preferences.json
✅ Files skipped from review due to trivial changes (5)
  • tests/workspace/git-backed-collections/fixtures/workspace-with-collection/.gitignore
  • tests/workspace/git-backed-collections/init-user-data/preferences.json
  • tests/workspace/git-backed-collections/fixtures/workspace-with-collection/collections/sample-coll/bruno.json
  • tests/workspace/git-backed-collections/fixtures/workspace-with-ghost/.gitignore
  • tests/workspace/git-backed-collections/fixtures/workspace-with-collection/workspace.yml

@sid-bruno
sid-bruno merged commit 47a1186 into usebruno:main May 4, 2026
11 checks passed
sharan-bruno pushed a commit to sharan-bruno/bruno that referenced this pull request Jun 4, 2026
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.

2 participants