$ show antfu/pnpm-patch-i
pnpm-patch-i is a CLI tool that enhances the `pnpm patch` workflow by providing an interactive, user-friendly experience. It wraps pnpm's native patch command, placing the edit directory locally under `node_modules/.patch-edits/` with a human-readable name, automatically opening the editor, and waiting for user confirmation before committing the patch. The tool also supports applying patches directly from a source directory, with optional build and pack steps, and intelligently resolves `workspace:` and `catalog:` dependency specifiers from the source package's `pnpm-workspace.yaml`. The codebase is a single-module TypeScript application using `cac` for CLI parsing, `execa` for running pnpm commands, and `prompts` for user interaction. It is well-structured, actively maintained, and demonstrates solid engineering practices with clean async/await patterns and proper error handling.
The LLM identified 1 files worth highlighting for reuse:
The core module implementing the patch workflow. It contains the `startPatch` function which orchestrates the entire process, and critically, the `resolveDepValue`, `handleDeps`, and `readSourceCatalogs` functions that resolve `workspace:` and `catalog:` dependency specifiers. This dependency resolution logic is isolated, well-documented, and demonstrates non-obvious skill in handling pnpm's workspace protocol. It could be extracted and reused in any tool that needs to transform dependency versions from a monorepo context to a standalone package context.