Skip to content

feat: add default .gitignore file creation in workspace and collection - #6778

Merged
sid-bruno merged 2 commits into
usebruno:mainfrom
naman-bruno:create/gitignore
Jan 12, 2026
Merged

sid-bruno merged 2 commits into
usebruno:mainfrom
naman-bruno:create/gitignore

Conversation

@naman-bruno

@naman-bruno naman-bruno commented Jan 12, 2026 •

Copy link
Copy Markdown
Collaborator

Description

JIRA: https://usebruno.atlassian.net/browse/BRU-1441

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
    • Collections and workspaces now automatically generate a default .gitignore when created, using pre-configured ignore patterns to reduce accidental commits and simplify setup.
    • The default ignore patterns are now part of the app’s configuration so new projects consistently receive the same baseline .gitignore.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Jan 12, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

Adds a default .gitignore constant and writes a .gitignore file during collection and workspace creation flows in the Electron IPC handlers (renderer:collection and renderer:create-workspace), inserting an awaited write operation after config generation and before collection/workspace-open signaling.

Changes

Cohort / File(s) Summary
Collection & Workspace IPC
packages/bruno-electron/src/ipc/collection.js, packages/bruno-electron/src/ipc/workspace.js
Import DEFAULT_GITIGNORE and call writeFile to create a .gitignore in the new collection/workspace directory after writing config; operation is awaited with no new error handling.
Filesystem Utilities
packages/bruno-electron/src/utils/filesystem.js
Add and export DEFAULT_GITIGNORE constant containing default gitignore patterns and comments.

Sequence Diagram(s)

sequenceDiagram
  participant Renderer
  participant MainIPC as Electron IPC (main)
  participant FS as Filesystem

  Renderer->>MainIPC: request create collection / workspace
  MainIPC->>FS: write config (writeCollectionConfig / writeWorkspaceConfig)
  FS-->>MainIPC: config written
  MainIPC->>FS: write .gitignore (DEFAULT_GITIGNORE)
  FS-->>MainIPC: .gitignore written
  MainIPC->>MainIPC: compute stats / open collection
  MainIPC-->>Renderer: reply collectionOpened / workspaceCreated
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

size/XS

Suggested reviewers

  • helloanoop
  • lohit-bruno
  • bijin-bruno

Poem

A tiny file placed where projects grow,
Ignoring noise so clean trees show,
Config then gitignore, written in line,
Repos breathe easier, one write at a time. 🌱

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 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 change: adding default .gitignore file creation across workspace and collection contexts.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 03a4d15 and 837bd4f.

📒 Files selected for processing (1)
  • packages/bruno-electron/src/utils/filesystem.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/bruno-electron/src/utils/filesystem.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: SSL Tests - Linux
  • GitHub Check: SSL Tests - Windows
  • GitHub Check: SSL Tests - macOS
  • GitHub Check: Playwright E2E Tests
  • GitHub Check: CLI Tests
  • GitHub Check: 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

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: 0

🧹 Nitpick comments (1)
packages/bruno-electron/src/utils/filesystem.js (1)

8-18: Add trailing newline to the gitignore content.

The file content should end with a newline character per POSIX convention. Without it, Git will show "No newline at end of file" when viewing diffs.

Suggested fix
 const DEFAULT_GITIGNORE = [
   '# Secrets',
   '.env',
   '',
   '# Dependencies',
   'node_modules',
   '',
   '# OS files',
   '.DS_Store',
-  'Thumbs.db'
-].join('\n');
+  'Thumbs.db',
+  ''
+].join('\n');
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 734ee16 and 03a4d15.

📒 Files selected for processing (3)
  • packages/bruno-electron/src/ipc/collection.js
  • packages/bruno-electron/src/ipc/workspace.js
  • packages/bruno-electron/src/utils/filesystem.js
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (CODING_STANDARDS.md)

**/*.{js,jsx,ts,tsx}: Use 2 spaces for indentation. No tabs, just spaces
Stick to single quotes for strings. For JSX/TSX attributes, use double quotes (e.g., )
Always add semicolons at the end of statements
No trailing commas
Always use parentheses around parameters in arrow functions, even for single params
For multiline constructs, put opening braces on the same line, and ensure consistency. Minimum 2 elements for multiline
No newlines inside function parentheses
Space before and after the arrow in arrow functions. () => {} is good
No space between function name and parentheses. func() not func ()
Semicolons go at the end of the line, not on a new line
Names for functions need to be concise and descriptive
Add in JSDoc comments to add more details to the abstractions if needed
Add in meaningful comments instead of obvious ones where complex code flow is explained properly

Files:

  • packages/bruno-electron/src/utils/filesystem.js
  • packages/bruno-electron/src/ipc/workspace.js
  • packages/bruno-electron/src/ipc/collection.js
🧠 Learnings (2)
📚 Learning: 2025-12-17T21:41:24.730Z
Learnt from: naman-bruno
Repo: usebruno/bruno PR: 6407
File: packages/bruno-app/src/components/Environments/ConfirmCloseEnvironment/index.js:5-41
Timestamp: 2025-12-17T21:41:24.730Z
Learning: Do not suggest PropTypes validation for React components in the Bruno codebase. The project does not use PropTypes, so reviews should avoid proposing PropTypes and rely on the existing typing/validation approach (e.g., TypeScript or alternative runtime checks) if applicable. This guideline applies broadly to all JavaScript/JSX components in the repo.

Applied to files:

  • packages/bruno-electron/src/utils/filesystem.js
  • packages/bruno-electron/src/ipc/workspace.js
  • packages/bruno-electron/src/ipc/collection.js
📚 Learning: 2025-12-16T07:16:23.647Z
Learnt from: sanish-bruno
Repo: usebruno/bruno PR: 6090
File: tests/scripting/hooks/init-user-data/ui-state-snapshot.json:1-8
Timestamp: 2025-12-16T07:16:23.647Z
Learning: For e2e tests in the bruno repository: Collections that are shared between CLI and UI tests (comprehensive test suites testing core functionality) should be placed in `packages/bruno-tests/` to avoid duplication. The `tests/**/fixtures/collection` pattern should be used for test-specific collections that test particular UI behaviors or are specific to a single test file.

Applied to files:

  • packages/bruno-electron/src/ipc/collection.js
🧬 Code graph analysis (2)
packages/bruno-electron/src/ipc/workspace.js (1)
packages/bruno-electron/src/utils/filesystem.js (3)
  • writeFile (96-105)
  • path (1-1)
  • DEFAULT_GITIGNORE (8-18)
packages/bruno-electron/src/ipc/collection.js (1)
packages/bruno-electron/src/utils/filesystem.js (3)
  • writeFile (96-105)
  • path (1-1)
  • DEFAULT_GITIGNORE (8-18)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Unit Tests
  • GitHub Check: CLI Tests
  • GitHub Check: Playwright E2E Tests
  • GitHub Check: SSL Tests - Windows
  • GitHub Check: SSL Tests - macOS
  • GitHub Check: SSL Tests - Linux
🔇 Additional comments (5)
packages/bruno-electron/src/utils/filesystem.js (1)

471-471: LGTM!

Export addition is correctly placed and follows the existing pattern.

packages/bruno-electron/src/ipc/collection.js (2)

27-52: LGTM!

Import addition is correct and follows the existing destructuring pattern.


164-165: LGTM!

The .gitignore creation is correctly placed after config generation. Error handling via the outer try-catch is appropriate.

Consider whether renderer:clone-collection and renderer:import-collection should also create a .gitignore if one doesn't already exist in the source. Currently only renderer:create-collection initializes it.

packages/bruno-electron/src/ipc/workspace.js (2)

8-8: LGTM!

Import extension is correct. The destructured imports follow the existing pattern.


89-89: LGTM!

The .gitignore creation mirrors the collection creation flow, maintaining consistency. Placement after writeWorkspaceConfig is appropriate.

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