Skip to content

feat: add update, catalog and remove commands#2

Open
dongguacute wants to merge 7 commits intoLittleSound:mainfrom
dongguacute:main
Open

feat: add update, catalog and remove commands#2
dongguacute wants to merge 7 commits intoLittleSound:mainfrom
dongguacute:main

Conversation

@dongguacute
Copy link

@dongguacute dongguacute commented Mar 11, 2026

Summary

This PR adds four new commands to enhance the package management experience:

  • nai add - Explicit install command (alongside the shorthand nai <package>)
  • nai update - Batch update dependencies to latest versions
  • nai update - Batch update dependencies to latest versions
  • nai catalog - Browse and manage catalog versions
  • nai remove - Remove packages from dependencies

Changes

New Files

File Description
src/npm.ts npm registry API utilities (versions fetch, outdated check)

Modified Files

File Changes
src/cli.ts Added add, update, catalog commands with interactive UI
README.md Documented new commands and usage examples

Features

📦 nai add

Explicit install command for clarity:

nai add                # Interactive mode
nai add react vue      # Install specific packages
nai add vitest -D      # Install as devDependency
nai add react --peer   # Install as peerDependency
nai add zod -C prod    # Specify catalog

Use nai add when installing packages named update, remove, or catalog:

nai add update  # Installs the "update" package
nai update      # Runs the update command

📦 nai update (alias: nai up)

Check and update outdated packages:

nai update              # Check all packages for updates
nai update react lodash # Update specific packages
nai update -i           # Interactive mode - select packages to update
  • Automatically detects outdated dependencies
  • Respects catalog references - updates catalog entries when needed
  • Interactive multi-select for choosing which packages to update
  • Colorful summary showing old → new versions

🗂️ nai catalog

Browse catalogs and change dependency versions:

nai catalog        # Interactive catalog browser
nai catalog --list # List all catalogs with dep counts
  • View all catalogs and their dependencies
  • Select packages within a catalog
  • Fetch available versions from npm
  • Choose new version from a list of recent releases
  • Updates catalog entries and runs install automatically

🗑️ nai remove (alias: nai rm)

Remove packages from dependencies:

nai remove              # Interactive - select packages to remove
nai remove react lodash # Remove specific packages
nai rm axios --clean-catalog # Also remove unused catalog entries
  • Shows all dependencies across workspace packages
  • Multi-select packages to remove
  • Indicates which packages and dep types are affected
  • Optional catalog cleanup with --clean-catalog
  • Updates all relevant package.json files

Technical Details

src/npm.ts

New module providing npm registry interactions:

  • getPackageVersions(packageName) - Fetch all available versions
  • checkOutdated(deps, options) - Compare current versions with latest

UI/UX

All new commands follow the existing design patterns:

  • Uses @clack/prompts for consistent interactive UI
  • Colorful output with ansis
  • Spinner feedback during network operations
  • Summary confirmation before making changes

Test Plan

  • [✅] Build succeeds
  • [✅] nai --help displays all commands correctly
  • [✅] nai add --help shows install options
  • [✅] nai update --help shows update options
  • [✅] nai remove --help / nai rm --help shows remove options
  • [✅] nai catalog --help shows catalog options
  • [✅] nai catalog --list lists catalogs correctly
  • [✅] Command aliases (up, rm) work as expected

(以上就是具体描述,让AI总结的,指令我都试了一遍正常的,基本就是完善了一下基础功能,希望能够合并,谢谢)

dongguacute and others added 3 commits March 12, 2026 02:46
Added a new command to remove packages from dependencies, including options for catalog cleanup. Updated provider interfaces and implementations for bun, pnpm, and yarn to support the new removal feature. Enhanced type definitions and added tests for the new functionality.
Added new commands to the CLI for searching npm packages and updating dependencies. The `search` command allows users to find packages interactively, while the `update` command checks for outdated packages and facilitates their updates. Updated the README to reflect these new features and provided usage examples.
Copy link
Owner

@LittleSound LittleSound left a comment

Choose a reason for hiding this comment

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

  1. I am developing the search.
  2. This PR is too large. It should be broken down into separate features for submission?
  3. Will these command names conflict with the package name?

Regardless, thank you for your help!

The search command and its implementation have been removed from the CLI, along with associated types and functions in the npm module. This streamlines the codebase by eliminating unused features.
@dongguacute dongguacute changed the title feat: add search, update, catalog and remove commands feat: add update, catalog and remove commands Mar 13, 2026
dongguacute and others added 3 commits March 13, 2026 13:22
Introduced a new 'add' command in the CLI to facilitate package installation, allowing users to specify options for dev and peer dependencies, as well as catalog names. Updated README to reflect the new command usage and examples.
@dongguacute dongguacute requested a review from LittleSound March 13, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants