Conversation
WalkthroughThis PR adds YAML parsing and serialization support for collection presets. Changes enable reading preset request configurations (type and URL) during YAML parsing and writing them back during stringification, with an added .gitignore entry. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
packages/bruno-filestore/src/formats/yml/parseCollection.ts (1)
29-38: Consider adding proper typing for presets.The
anycast on line 31 bypasses type checking. Define a proper interface for the presets structure to improve type safety and maintainability.🔎 Suggested approach:
Define an interface at the top of the file:
interface PresetsExtension { request?: { type?: string[]; url?: string[]; }; }Then update the cast:
- const presets = oc.extensions.presets as any; + const presets = oc.extensions.presets as PresetsExtension;packages/bruno-filestore/src/formats/yml/stringifyCollection.ts (1)
188-199: Consider adding proper typing for presets serialization.The
anytypes on lines 189 and 198 reduce type safety. Define proper interfaces for the presets structure to match the OpenCollection types.🔎 Suggested approach:
Define interfaces for the presets structure:
interface PresetsRequest { type?: string[]; url?: string[]; } interface PresetsExtension { request: PresetsRequest; }Then update the code:
- const presetsRequest: any = {}; + const presetsRequest: PresetsRequest = {}; if (brunoConfig.presets.requestType?.length) { presetsRequest.type = brunoConfig.presets.requestType; } if (brunoConfig.presets.requestUrl?.length) { presetsRequest.url = brunoConfig.presets.requestUrl; } oc.extensions.presets = { request: presetsRequest - } as any; + };
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.gitignore(1 hunks)packages/bruno-filestore/src/formats/yml/parseCollection.ts(1 hunks)packages/bruno-filestore/src/formats/yml/stringifyCollection.ts(2 hunks)
🧰 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()notfunc ()
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-filestore/src/formats/yml/parseCollection.tspackages/bruno-filestore/src/formats/yml/stringifyCollection.ts
🧠 Learnings (2)
📚 Learning: 2025-12-02T07:24:50.311Z
Learnt from: bijin-bruno
Repo: usebruno/bruno PR: 6263
File: packages/bruno-requests/src/auth/oauth2-helper.ts:249-249
Timestamp: 2025-12-02T07:24:50.311Z
Learning: In OAuth2 Basic Auth headers for Bruno, clientSecret is optional and can be omitted. When constructing the Authorization header in `packages/bruno-requests/src/auth/oauth2-helper.ts`, use `clientSecret || ''` instead of `clientSecret!` to properly handle cases where only clientId is provided, per community requests.
Applied to files:
packages/bruno-filestore/src/formats/yml/parseCollection.ts
📚 Learning: 2025-12-16T07:16:08.934Z
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:08.934Z
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-filestore/src/formats/yml/stringifyCollection.ts
🧬 Code graph analysis (1)
packages/bruno-filestore/src/formats/yml/parseCollection.ts (4)
packages/bruno-app/src/components/CollectionSettings/index.js (1)
presets(62-62)packages/bruno-electron/src/app/collections.js (1)
brunoConfig(103-103)packages/bruno-electron/src/app/collection-watcher.js (2)
brunoConfig(212-212)brunoConfig(453-453)packages/bruno-electron/src/utils/collection-import.js (1)
brunoConfig(100-100)
⏰ 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). (7)
- GitHub Check: Agent
- GitHub Check: CLI Tests
- GitHub Check: Unit Tests
- GitHub Check: Playwright E2E Tests
- GitHub Check: SSL Tests - Windows
- GitHub Check: SSL Tests - Linux
- GitHub Check: SSL Tests - macOS
🔇 Additional comments (2)
.gitignore (1)
56-56: LGTM!Adding CLAUDE.md to the development plan files is appropriate.
packages/bruno-filestore/src/formats/yml/stringifyCollection.ts (1)
49-52: LGTM!The
hasPresetshelper correctly detects preset configuration by checking for non-empty requestType or requestUrl arrays.
| }; | ||
|
|
||
| const stringifyCollection = (collectionRoot: any, brunoConfig: any): string => { | ||
| console.log('brunoConfig', brunoConfig); |
There was a problem hiding this comment.
Remove debug console.log statement.
This debug statement should not be in production code.
🔎 Apply this diff:
- console.log('brunoConfig', brunoConfig);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| console.log('brunoConfig', brunoConfig); |
🤖 Prompt for AI Agents
In packages/bruno-filestore/src/formats/yml/stringifyCollection.ts around line
55 there is a leftover debug console.log('brunoConfig', brunoConfig); — remove
this console.log statement from the file so no debug output occurs in
production, and replace with no-op or use logger.debug if structured logging is
required; after removal run lint/tests to ensure no formatting or
unused-variable issues are introduced.
There was a problem hiding this comment.
Pull request overview
This PR introduces preset functionality for opencollection format, allowing configuration of default request types and URLs. The changes enable parsing and stringifying of preset configurations through the opencollection YAML format.
- Adds
hasPresetshelper function to check for preset configuration - Implements preset serialization and deserialization in opencollection YAML format
- Updates .gitignore to exclude Claude development file
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| packages/bruno-filestore/src/formats/yml/stringifyCollection.ts | Adds preset serialization logic, hasPresets helper function, and reorders opencollection version assignment |
| packages/bruno-filestore/src/formats/yml/parseCollection.ts | Implements preset parsing from opencollection extensions |
| .gitignore | Adds CLAUDE.md to ignored development files |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }; | ||
|
|
||
| const stringifyCollection = (collectionRoot: any, brunoConfig: any): string => { | ||
| console.log('brunoConfig', brunoConfig); |
There was a problem hiding this comment.
Debug console.log statement should be removed before merging to production. This will log potentially sensitive collection configuration data to the console.
| console.log('brunoConfig', brunoConfig); |
| return brunoConfig?.presets?.requestType?.length | ||
| || brunoConfig?.presets?.requestUrl?.length; |
There was a problem hiding this comment.
The hasPresets function should use explicit comparison with greater than 0 for consistency with other similar helper functions in this file (e.g., hasCollectionConfig checks length > 0). This makes the intent clearer and follows the established pattern.
| return brunoConfig?.presets?.requestType?.length | |
| || brunoConfig?.presets?.requestUrl?.length; | |
| return (brunoConfig?.presets?.requestType?.length ?? 0) > 0 | |
| || (brunoConfig?.presets?.requestUrl?.length ?? 0) > 0; |
| oc.extensions.ignore = ignoreList; | ||
| } | ||
| if (hasPresets(brunoConfig)) { | ||
| const presetsRequest: any = {}; |
There was a problem hiding this comment.
The variable presetsRequest uses 'any' type. Consider defining a more specific type for better type safety, similar to how other parts of this file use specific types from '@opencollection/types'.
| const presetsRequest: any = {}; | |
| type PresetsRequest = { | |
| type?: string; | |
| url?: string; | |
| }; | |
| const presetsRequest: PresetsRequest = {}; |
| oc.extensions.presets = { | ||
| request: presetsRequest | ||
| } as any; |
There was a problem hiding this comment.
The 'as any' type assertion could be avoided by properly typing the presets structure. Consider defining a proper type for extensions.presets instead of using type assertion.
|
|
||
| // presets | ||
| if (oc.extensions?.presets) { | ||
| const presets = oc.extensions.presets as any; |
There was a problem hiding this comment.
The variable presets uses 'any' type. Consider defining a more specific type for the extensions.presets structure for better type safety.
Opencollection Presets
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.