Bookmark NPM Scripts Extension
A VSCode and Cursor extension that allows you to bookmark your favorite npm scripts and run them quickly.
CHANGELOG
Version 0.5.0
New Features
- Scripts list storage: Choose where bookmarks are stored:
- workspace (default): Separate bookmark list per workspace — each project keeps its own list.
- global: One shared list across all projects. Scripts that exist in the current project are runnable; others appear at the end as “(not in this workspace)” and cannot be run.
- Import on switch to global: When you change the setting from workspace to global, the extension offers to import this workspace’s bookmarked scripts into your global list (with “Import” or “Skip”).
Improvements
- Clearer setting labels: options are now “workspace” and “global” in the Settings UI.
- Backward compatible: existing “per project” / “per workspace” settings are still supported.
Version 0.4.0
New Features
- Terminal Reuse Option: Added a new setting
bookmarkNpmScripts.reuseExistingTerminal that allows you to reuse existing terminals when running the same script multiple times. When enabled, if a terminal is already running a script, it will automatically be shown instead of creating a new one. You can still create a new terminal via the notification if needed.
- Extension Settings Access: Added a gear icon button in the Extensions view that allows quick access to extension settings.
Improvements
- Terminal tracking system to monitor which terminals are running which scripts
- Automatic cleanup of closed terminals from tracking
- Better user experience when running scripts multiple times
Technical Changes
- Added terminal disposal listener to clean up tracking when terminals are closed
- Improved configuration management for extension settings
Features
- ✅ Bookmark npm scripts from your project
- ✅ Customize names for bookmarked scripts
- ✅ Icon in Status Bar (bottom right) for quick access
- ✅ Dropdown menu to view and run bookmarked scripts
- ✅ Workspace or global storage — Keep bookmarks per workspace or use one list for all projects (see Scripts list storage below)
- ✅ Store bookmark settings per workspace (default) or globally
- ✅ Edit bookmark names individually
- ✅ Terminal reuse option - Reuse existing terminals when running the same script (configurable)
- ✅ Quick settings access - Gear icon in Extensions view for easy access to extension settings
Usage
1. Installation and Setup
# Install dependencies
npm install
# Compile the project
npm run compile
To test the extension:
- Open the project folder in VSCode/Cursor
- Press
F5 to open a new Extension Host window
- In the new window, open a project with
package.json
2. Bookmarking Scripts
Method 1: From Status Bar
- Click on the
$(play) icon in the Status Bar (bottom right)
- If no bookmarks exist, select "Manage Bookmarks"
Method 2: From Command Palette
- Press
Ctrl+Shift+P (or Cmd+Shift+P on Mac)
- Type and select
Bookmark NPM Scripts: Manage Bookmarks
- Select the scripts you want to bookmark (you can select multiple)
- Optionally, set custom names for them
3. Running Scripts
- Click on the
$(play) icon in the Status Bar
- Select the desired script from the dropdown list
- The script will run in a new terminal named
npm run [script-name]
Note: In the dropdown list, you can see the "Manage Bookmarks..." option to manage your bookmarks.
4. Editing Bookmark Names
- From Command Palette:
Bookmark NPM Scripts: Edit Bookmark Name
- Or select "Manage Bookmarks..." from the dropdown list
5. Setting Up Keyboard Shortcuts
You can set up a keyboard shortcut to quickly open the bookmarked scripts list:
Method 1: Using Keyboard Shortcuts UI
- Press
Ctrl+K Ctrl+S (or Cmd+K Cmd+S on Mac) to open Keyboard Shortcuts
- Search for
Bookmark NPM Scripts: Run Bookmarked Script
- Click the
+ icon next to the command
- Press your desired key combination (e.g.,
Ctrl+Shift+R or Cmd+Shift+R)
- Press
Enter to confirm
Method 2: Using keybindings.json
- Press
Ctrl+Shift+P (or Cmd+Shift+P on Mac)
- Type
Preferences: Open Keyboard Shortcuts (JSON)
- Add the following entry:
{
"key": "ctrl+shift+r",
"command": "bookmarkNpmScripts.openBookmarks",
"when": "editorTextFocus || terminalFocus"
}
Available Commands:
bookmarkNpmScripts.openBookmarks - Open bookmarked scripts list
bookmarkNpmScripts.manageBookmarks - Manage bookmarks
bookmarkNpmScripts.editBookmarkName - Edit bookmark names
bookmarkNpmScripts.openSettings - Open extension settings
6. Extension Settings
You can configure the extension behavior through VS Code settings:
bookmarkNpmScripts.reuseExistingTerminal (default: false): When enabled, if a terminal is already running a script, it will be shown instead of creating a new one. You can still create a new terminal via the notification.
bookmarkNpmScripts.scriptsListStorage (default: "workspace"): Where to store the bookmarked scripts list. See Scripts list storage below.
To access settings:
- Click the gear icon (⚙️) next to the extension in the Extensions view
- Or go to
File → Preferences → Settings and search for bookmarkNpmScripts
Scripts list storage
workspace (default): Each workspace has its own bookmark list. Best when you want different scripts per project.
global: One shared list for all projects. The same bookmarks appear in every workspace. Scripts that exist in the current project’s package.json are runnable; others are listed at the end with “(not in this workspace)” and cannot be run.
When you switch from workspace to global, the extension can import this workspace’s bookmarks into your global list. You’ll see a prompt: “Import N bookmarked script(s) from this workspace into your global list?” with Import or Skip.
Building the Extension
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Build .vsix file for distribution
npm install -g vsce
vsce package
Development
# Watch mode for development
npm run watch
Project Structure
.
├── src/
│ └── extension.ts # Main extension code
├── package.json # Extension manifest
├── tsconfig.json # TypeScript configuration
└── README.md # This file
Requirements
- Node.js
- npm
- VSCode or Cursor (version 1.74.0 or higher)
License
MIT