From e2e3c818f2c8ade81d302096fa011ffc60cfa64a Mon Sep 17 00:00:00 2001 From: Alessio Attilio Date: Sat, 4 Jul 2026 00:16:08 +0200 Subject: [PATCH] feat: add `issues` alias to `bugs` command (#12734) Add the `issues` alias to the `bugs` command in the TypeScript CLI, so that `pnpm issues ` behaves identically to `pnpm bugs `. The alias is registered via the bugs command's commandNames, removed from the not-implemented command list, shown in the help output, and covered by a CLI-level alias-resolution test. The pacquet CLI already ships the same alias. --- .changeset/bugs-issues-alias.md | 6 ++++++ pnpm11/deps/inspection/commands/src/bugs/index.ts | 7 +++++-- pnpm11/deps/inspection/commands/test/bugs.ts | 4 +++- pnpm11/pnpm/src/cmd/notImplemented.ts | 1 - pnpm11/pnpm/test/dlx.ts | 7 ++++++- pnpm11/pnpm/test/parseCliArgs.test.ts | 13 +++++++++++++ 6 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 .changeset/bugs-issues-alias.md create mode 100644 pnpm11/pnpm/test/parseCliArgs.test.ts diff --git a/.changeset/bugs-issues-alias.md b/.changeset/bugs-issues-alias.md new file mode 100644 index 0000000000..7fbeb315f4 --- /dev/null +++ b/.changeset/bugs-issues-alias.md @@ -0,0 +1,6 @@ +--- +"@pnpm/deps.inspection.commands": minor +"pnpm": minor +--- + +Added the `issues` command as an alias of `bugs`, so `pnpm issues` opens the package's bug tracker URL in the browser. diff --git a/pnpm11/deps/inspection/commands/src/bugs/index.ts b/pnpm11/deps/inspection/commands/src/bugs/index.ts index 78c28da19c..9e0f3c8758 100644 --- a/pnpm11/deps/inspection/commands/src/bugs/index.ts +++ b/pnpm11/deps/inspection/commands/src/bugs/index.ts @@ -16,13 +16,16 @@ export function cliOptionsTypes (): Record { return rcOptionsTypes() } -export const commandNames = ['bugs'] +export const commandNames = ['bugs', 'issues'] export function help (): string { return renderHelp({ description: "Opens the URL of the package's bug tracker in a browser.", url: docsUrl('bugs'), - usages: ['pnpm bugs [ [ ...]]'], + usages: [ + 'pnpm bugs [ [ ...]]', + 'pnpm issues [ [ ...]]', + ], }) } diff --git a/pnpm11/deps/inspection/commands/test/bugs.ts b/pnpm11/deps/inspection/commands/test/bugs.ts index 1a0b6c8d17..2e46d8f440 100644 --- a/pnpm11/deps/inspection/commands/test/bugs.ts +++ b/pnpm11/deps/inspection/commands/test/bugs.ts @@ -22,7 +22,9 @@ const BASE_OPTIONS = { test('bugs: command should be available', () => { expect(bugs.handler).toBeDefined() expect(bugs.help).toBeDefined() - expect(bugs.commandNames).toEqual(['bugs']) + expect(bugs.commandNames).toEqual(['bugs', 'issues']) + expect(bugs.help()).toContain('pnpm bugs') + expect(bugs.help()).toContain('pnpm issues') }) test('bugs: opens bugs.url from local manifest', async () => { diff --git a/pnpm11/pnpm/src/cmd/notImplemented.ts b/pnpm11/pnpm/src/cmd/notImplemented.ts index b6436fc2d1..56e8748208 100644 --- a/pnpm11/pnpm/src/cmd/notImplemented.ts +++ b/pnpm11/pnpm/src/cmd/notImplemented.ts @@ -5,7 +5,6 @@ import type { CommandDefinition } from './index.js' const NOT_IMPLEMENTED_COMMANDS = [ 'access', 'edit', - 'issues', 'profile', 'set-script', 'team', diff --git a/pnpm11/pnpm/test/dlx.ts b/pnpm11/pnpm/test/dlx.ts index 3bb593a67d..123dbdf5f9 100644 --- a/pnpm11/pnpm/test/dlx.ts +++ b/pnpm11/pnpm/test/dlx.ts @@ -337,7 +337,12 @@ test('dlx creates cache and store prune cleans cache', async () => { '--allow-build=shx', '--allow-build=shx@https://codeload.github.com/shelljs/shx/tar.gz/61aca968cd7afc712ca61a4fc4ec3201e3770dc7', ] - await Promise.all(Object.entries(commands).map(([cmd, args]) => execPnpm([...settings, ...allowBuilds, 'dlx', cmd, ...args]))) + + /* eslint-disable no-await-in-loop */ + for (const [cmd, args] of Object.entries(commands)) { + await execPnpm([...settings, ...allowBuilds, 'dlx', cmd, ...args]) + } + /* eslint-enable no-await-in-loop */ // ensure that the dlx cache has certain structure const dlxBaseDir = path.resolve('cache', 'dlx') diff --git a/pnpm11/pnpm/test/parseCliArgs.test.ts b/pnpm11/pnpm/test/parseCliArgs.test.ts new file mode 100644 index 0000000000..1b779a804e --- /dev/null +++ b/pnpm11/pnpm/test/parseCliArgs.test.ts @@ -0,0 +1,13 @@ +import { expect, test } from '@jest/globals' + +import { getCliOptionsTypes, getCommandFullName, pnpmCmds } from '../src/cmd/index.js' +import { parseCliArgs } from '../src/parseCliArgs.js' + +test('the "issues" alias resolves to the "bugs" command', async () => { + expect(getCommandFullName('issues')).toBe('bugs') + expect(pnpmCmds.issues).toBe(pnpmCmds.bugs) + expect(getCliOptionsTypes('issues')).toHaveProperty(['registry']) + + const { cmd } = await parseCliArgs(['issues', 'is-positive']) + expect(cmd).toBe('bugs') +})