Skip to content

feat: add pnpm docs command and home alias#11244

Merged
zkochan merged 7 commits into
pnpm:mainfrom
kairosci:feat/pnpm-docs
Apr 14, 2026
Merged

feat: add pnpm docs command and home alias#11244
zkochan merged 7 commits into
pnpm:mainfrom
kairosci:feat/pnpm-docs

Conversation

@kairosci

@kairosci kairosci commented Apr 11, 2026

Copy link
Copy Markdown
Contributor

This PR adds the 'pnpm docs' command and its alias 'pnpm home'. This command fetches package metadata from the registry and opens the homepage or documentation URL in the default browser. When the package has no valid homepage, it falls back to https://npmx.dev/package/.

Copilot AI review requested due to automatic review settings April 11, 2026 22:15
@kairosci kairosci requested a review from zkochan as a code owner April 11, 2026 22:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the pnpm CLI with new registry/inspection commands, primarily introducing pnpm docs (alias pnpm home) to open a package URL in the browser, and also adding native registry “starring” commands (star, unstar, stars, whoami).

Changes:

  • Add pnpm docs / pnpm home command that looks up registry metadata and opens a derived URL.
  • Add native star, unstar, stars, and whoami commands and wire them into the pnpm CLI.
  • Refactor pnpm view to reuse shared registry metadata fetching logic (fetchPackageInfo).

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
deps/inspection/commands/src/docs/index.ts Implements the new docs/home command.
deps/inspection/commands/test/docs.ts Adds tests for docs command behavior (mocking open).
deps/inspection/commands/src/fetchPackageInfo.ts Introduces shared helper to fetch/shape registry package info.
deps/inspection/commands/src/view/index.ts Refactors view to use fetchPackageInfo.
deps/inspection/commands/src/index.ts Exports the new docs command module.
deps/inspection/commands/package.json Adds open dependency for browser launching.
registry-access/commands/src/star.ts Implements star, unstar, stars, and whoami handlers.
registry-access/commands/test/star.ts Adds integration tests for whoami and star/unstar.
registry-access/commands/src/index.ts Exports the new registry-access command definitions.
pnpm/src/cmd/index.ts Registers docs, star, unstar, stars, whoami in the CLI.
pnpm/src/cmd/notImplemented.ts Removes star-related commands from the “not implemented” list.
package.json Adds Verdaccio plugin dependencies at repo root.
pnpm-workspace.yaml Adds Verdaccio plugin versions to the catalog.
pnpm-lock.yaml Lockfile updates for new dependencies/plugins.
.changeset/fast-cars-find.md Changeset for docs/home.
.changeset/feat-star-commands.md Changeset for star-related commands.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread deps/inspection/commands/src/fetchPackageInfo.ts
Comment thread deps/inspection/commands/src/view/index.ts
Comment thread deps/inspection/commands/src/docs/index.ts Outdated
Comment thread deps/inspection/commands/package.json Outdated
Comment thread package.json Outdated
Comment thread registry-access/commands/src/star.ts Outdated
Comment thread registry-access/commands/test/star.ts Outdated
Comment thread pnpm/src/cmd/index.ts
Comment thread pnpm/src/cmd/index.ts
zkochan added 2 commits April 12, 2026 23:05
- Remove 'docs' and 'home' from NOT_IMPLEMENTED_COMMANDS to prevent
  not-implemented handlers from overriding the real implementations
- Change fallback URL from npmjs.com to npmx.dev
- Remove bugs URL as a docs fallback (it's an issue tracker, not docs)
- Fix ESM mock in tests: use jest.unstable_mockModule instead of jest.mock
Replace the hand-rolled platform-specific execFile logic with the open
npm package, which handles WSL, Docker-in-WSL, and Windows edge cases
better. This removes the execFile dependency injection from
promptBrowserOpen, OtpContext, LoginContext, and SharedContext.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 19 out of 20 changed files in this pull request and generated 4 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread network/web-auth/src/promptBrowserOpen.ts Outdated
Comment thread network/web-auth/test/promptBrowserOpen.test.ts
Comment thread deps/inspection/commands/src/docs/index.ts
Comment thread deps/inspection/commands/src/docs/index.ts
zkochan added 3 commits April 14, 2026 15:45
- docs: use www.npmjs.com fallback (not npmx.dev) and validate homepage
  URL is http(s) before opening
- promptBrowserOpen: validate authUrl protocol before passing to open(),
  and guard against synchronous throws from open()
Comment thread deps/inspection/commands/src/docs/index.ts Outdated
Comment thread deps/inspection/commands/src/docs/index.ts Outdated
@zkochan zkochan merged commit 2410cf4 into pnpm:main Apr 14, 2026
4 of 5 checks passed
kairosci added a commit to kairosci/pnpm that referenced this pull request Apr 22, 2026
* feat: add pnpm docs command and home alias

* chore: update manifests

* fix: address review comments for pnpm docs command

- Remove 'docs' and 'home' from NOT_IMPLEMENTED_COMMANDS to prevent
  not-implemented handlers from overriding the real implementations
- Change fallback URL from npmjs.com to npmx.dev
- Remove bugs URL as a docs fallback (it's an issue tracker, not docs)
- Fix ESM mock in tests: use jest.unstable_mockModule instead of jest.mock

* refactor: use open package for browser opening in promptBrowserOpen

Replace the hand-rolled platform-specific execFile logic with the open
npm package, which handles WSL, Docker-in-WSL, and Windows edge cases
better. This removes the execFile dependency injection from
promptBrowserOpen, OtpContext, LoginContext, and SharedContext.

* fix: address copilot review comments

- docs: use www.npmjs.com fallback (not npmx.dev) and validate homepage
  URL is http(s) before opening
- promptBrowserOpen: validate authUrl protocol before passing to open(),
  and guard against synchronous throws from open()

* fix: restore npmx.dev fallback for pnpm docs

* chore: expand changeset with web-auth refactor impact

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
zkochan added a commit that referenced this pull request May 6, 2026
…geset issue link

normalizeRepositoryUrl now strips trailing slashes so a repository URL
like `https://github.com/foo/bar/` becomes `https://github.com/foo/bar/issues`
rather than `...//issues`. Added a regression test.

The changeset previously linked to #11244, which is the docs-command PR,
not bugs — removed the bogus reference.
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.

3 participants