feat: add issues alias to bugs command (#12734)

Add the `issues` alias to the `bugs` command in the TypeScript CLI, so that `pnpm issues <pkg>` behaves identically to `pnpm bugs <pkg>`. 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.
This commit is contained in:
Alessio Attilio
2026-07-04 00:16:08 +02:00
committed by GitHub
parent 1e81761409
commit e2e3c818f2
6 changed files with 33 additions and 5 deletions

View File

@@ -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.

View File

@@ -16,13 +16,16 @@ export function cliOptionsTypes (): Record<string, unknown> {
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 [<pkgname> [<pkgname> ...]]'],
usages: [
'pnpm bugs [<pkgname> [<pkgname> ...]]',
'pnpm issues [<pkgname> [<pkgname> ...]]',
],
})
}

View File

@@ -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 () => {

View File

@@ -5,7 +5,6 @@ import type { CommandDefinition } from './index.js'
const NOT_IMPLEMENTED_COMMANDS = [
'access',
'edit',
'issues',
'profile',
'set-script',
'team',

View File

@@ -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')

View File

@@ -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')
})