Repository navigation
feat: npm package report and installation support - #8143
Conversation
WalkthroughConverter detects npm packages in Postman scripts, produces a packageReport, the app shows a styled modal prompting install or Developer Mode changes, installs via an IPC handler that runs npm, and a hook queues prompts for bulk imports. ChangesPostman Package Detection and Installation
Sequence DiagramsequenceDiagram
participant User
participant UI as PostmanPackageReport
participant Redux
participant IPC as MainIPC
participant InstallUtil as runNpmInstall
participant Child as npmProcess
User->>UI: click Install
UI->>IPC: invoke('renderer:install-postman-packages', path, packages)
IPC->>InstallUtil: runNpmInstall(...)
InstallUtil->>Child: spawn npm install
Child-->>InstallUtil: stdout/stderr or error/exit
InstallUtil-->>IPC: result
IPC-->>UI: install result
UI->>User: show success or error + logs
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 (1)
packages/bruno-app/src/components/Sidebar/Sections/CollectionsSection/index.js (1)
120-126: ⚡ Quick winConsider a
.catchon the import dispatch.
handleImportResolvednow runs in the success path, but a rejectedimportActionleavesimportCollectionLocationModalOpen/importDataun-reset and surfaces an unhandled rejection. If this predates the PR feel free to defer, but it's adjacent to the touched lines.♻️ Suggested handling
dispatch(importAction) .then((importedItem) => { setImportCollectionLocationModalOpen(false); setImportData(null); handleImportResolved(convertedCollection, importedItem); - }); + }) + .catch((err) => { + console.error(err); + toast.error('Failed to import collection'); + });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/bruno-app/src/components/Sidebar/Sections/CollectionsSection/index.js` around lines 120 - 126, dispatch(importAction) currently only handles the success path which calls setImportCollectionLocationModalOpen(false), setImportData(null) and handleImportResolved(convertedCollection, importedItem); add a .catch handler on the dispatched promise to reset UI state on failure (call setImportCollectionLocationModalOpen(false) and setImportData(null)), and surface/log the error (or show an error toast) so the rejection is handled and no unhandled promise remains; ensure handleImportResolved is invoked only on success.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/bruno-converters/src/postman/postman-package-detector.js`:
- Around line 24-37: normalizePackageName should strip any leading "node:"
prefix and drop subpaths so imports like "node:crypto" or "lodash/get" normalize
to their package roots; update normalizePackageName to first remove a "node:"
prefix (if present), then after existing version-stripping logic remove path
segments: for non-scoped names cut at the first '/' and for scoped names (name
starting with '@') keep up through the first two path segments (i.e. strip after
the second '/'); keep the existing handling of "npm:" and version "@" separators
and return null for non-strings or local paths as before.
---
Nitpick comments:
In
`@packages/bruno-app/src/components/Sidebar/Sections/CollectionsSection/index.js`:
- Around line 120-126: dispatch(importAction) currently only handles the success
path which calls setImportCollectionLocationModalOpen(false),
setImportData(null) and handleImportResolved(convertedCollection, importedItem);
add a .catch handler on the dispatched promise to reset UI state on failure
(call setImportCollectionLocationModalOpen(false) and setImportData(null)), and
surface/log the error (or show an error toast) so the rejection is handled and
no unhandled promise remains; ensure handleImportResolved is invoked only on
success.
🪄 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: 503ef866-ee07-4819-a6bb-7490e9115785
📒 Files selected for processing (14)
packages/bruno-app/src/components/Sidebar/PostmanPackageReport/StyledWrapper.jspackages/bruno-app/src/components/Sidebar/PostmanPackageReport/index.jspackages/bruno-app/src/components/Sidebar/PostmanPackageReport/index.spec.jsxpackages/bruno-app/src/components/Sidebar/Sections/CollectionsSection/index.jspackages/bruno-app/src/components/WorkspaceHome/WorkspaceOverview/index.jspackages/bruno-app/src/hooks/usePostmanPackagePrompt/index.jspackages/bruno-app/src/hooks/usePostmanPackagePrompt/index.spec.jspackages/bruno-converters/src/postman/postman-package-detector.jspackages/bruno-converters/src/postman/postman-to-bruno.jspackages/bruno-converters/tests/postman/postman-translations/postman-package-detector-integration.spec.jspackages/bruno-converters/tests/postman/postman-translations/postman-package-detector.spec.jspackages/bruno-electron/src/ipc/collection.jspackages/bruno-electron/src/utils/install-packages.jspackages/bruno-electron/tests/utils/install-packages.spec.js
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/bruno-app/src/components/Sidebar/PostmanPackageReport/index.spec.jsx (1)
100-141: ⚡ Quick winApply semicolons in the changed statements to match repo JS rules.
The updated lines still omit statement-ending semicolons.
As per coding guidelines, "Always add semicolons at the end of statements."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/bruno-app/src/components/Sidebar/PostmanPackageReport/index.spec.jsx` around lines 100 - 141, Add missing statement-ending semicolons in the test: terminate the mockCollection assignment, the const onClose = jest.fn() declaration, and any standalone statements in the affected tests (e.g., the renderModal(...) call results/assignments and expect(...) lines) with semicolons so they follow the repo JS rule; specifically update the mockCollection initializer, the onClose declaration, and the surrounding statements in the "auto-dismisses..." test and related renderModal usages to end with a semicolon.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@packages/bruno-app/src/components/Sidebar/PostmanPackageReport/index.spec.jsx`:
- Around line 122-141: The test "auto-dismisses when only dev-mode libs..."
should be made async-safe: mark the spec callback async, import and use waitFor
from `@testing-library/react`, and replace the immediate assertions on onClose and
container with awaited waitFor assertions (e.g., await waitFor(() =>
expect(onClose).toHaveBeenCalled()) and await waitFor(() =>
expect(container).toBeEmptyDOMElement())). Update the test that calls
renderModal to use these awaited waitFor checks so the assertions run after any
effects/state updates.
---
Nitpick comments:
In
`@packages/bruno-app/src/components/Sidebar/PostmanPackageReport/index.spec.jsx`:
- Around line 100-141: Add missing statement-ending semicolons in the test:
terminate the mockCollection assignment, the const onClose = jest.fn()
declaration, and any standalone statements in the affected tests (e.g., the
renderModal(...) call results/assignments and expect(...) lines) with semicolons
so they follow the repo JS rule; specifically update the mockCollection
initializer, the onClose declaration, and the surrounding statements in the
"auto-dismisses..." test and related renderModal usages to end with a semicolon.
🪄 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: 1e985181-8d5c-4717-95bc-840c3058f5c8
📒 Files selected for processing (4)
packages/bruno-app/src/components/Sidebar/PostmanPackageReport/index.jspackages/bruno-app/src/components/Sidebar/PostmanPackageReport/index.spec.jsxpackages/bruno-converters/src/postman/postman-package-detector.jspackages/bruno-converters/tests/postman/postman-translations/postman-package-detector.spec.js
🚧 Files skipped from review as they are similar to previous changes (3)
- packages/bruno-converters/src/postman/postman-package-detector.js
- packages/bruno-converters/tests/postman/postman-translations/postman-package-detector.spec.js
- packages/bruno-app/src/components/Sidebar/PostmanPackageReport/index.js
* feat: npm package report and installation support (usebruno#8143) * feat: show scripted requests in timeline (usebruno#8047) * fix(proxy): proxy config export from v2 to import in v3 (usebruno#8112) * FIXED regression for proxy config from v2 to v3 * REMOVED console.log * ADDED test case with fixture to test proxy import * ADDED proxy handling for older brunoConfig in packages/bruno-electron/src/utils/collection-import.js * RESOLVED githiub converstation changed afterAll --> afterEach * ADDED guard to transformProxyConfig(brunoConfig.proxy) function * fix: route runner scripted-request/oauth2-debug timeline entries Use the enterprise per-iteration runner shape in the reducers, propagate iterationIndex on all run-folder-event emits, and fix the bruno-js test argument positions. --------- Co-authored-by: naman-bruno <[email protected]> Co-authored-by: Pooja <[email protected]> Co-authored-by: Abhishek Patil <[email protected]> Co-authored-by: lohit <[email protected]>
Description
JIRA
Contribution Checklist:
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
Tests