Skip to content

Let npx run the CLI without installing it - #359

Merged
bmesuere merged 1 commit into
mainfrom
feat/npx-support
Aug 19, 2026
Merged

Let npx run the CLI without installing it#359
bmesuere merged 1 commit into
mainfrom
feat/npx-support

Conversation

@bmesuere

@bmesuere bmesuere commented Aug 19, 2026

Copy link
Copy Markdown
Member

This pull request makes npx unipept-cli work, and releases it as 4.2.2.

npx runs the binary named after the package, and only falls back to the sole binary when a package ships exactly one. This package ships four, none of them called unipept-cli, so the obvious invocation failed:

$ npx unipept-cli --version
npm error could not determine executable to run

The natural second guess is worse. npx unipept looks for a package called unipept, which does not exist on npm and returns a 404 that points nowhere useful. That was the name of the old Ruby gem, so it is exactly what someone coming from the old documentation would type.

Adding unipept-cli as an alias for the unipept binary makes the obvious form work, while the other three commands stay reachable with -p, which is the normal way to run a named binary out of a package:

$ npx unipept-cli pept2lca AALTER
peptide,cutoff_used,taxon_id,taxon_name,taxon_rank
AALTER,1,1,root,no rank

$ echo "AALTERSVKAAPKR" | npx -p unipept-cli prot2pept
AALTER
SVK
AAPK
R

Why this is worth more than convenience. Pinning a version through npx makes an analysis reproducible without asking anyone to install anything, which is a better thing to put in a methods section than "we used the Unipept CLI":

$ npx unipept-cli@4.2.2 --version
4.2.2 (UniProt 2026.02)

Patch rather than minor. The alias points at the same script as unipept and adds no capability: the command was already reachable through npx -p unipept-cli unipept, so nothing a user could do before changes. The counter argument is that bin is public surface and the documentation now says the short form needs a given version, but that gate is on an alias rather than on anything the tool can do.

Manual testing instructions

  • npx unipept-cli pept2lca AALTER returns the usual CSV
  • npx -p unipept-cli prot2pept, peptfilter and uniprot still work
  • A global install still provides unipept, peptfilter, prot2pept and uniprot unchanged
  • unipept-cli --help reports its own name in the usage line, since npm's shim path is what commander reads
Verification run

Verified against a packed tarball installed into a scratch project, rather than from source, so the bin wiring is the real thing:

node_modules/.bin: peptfilter prot2pept unipept unipept-cli uniprot

$ npx unipept-cli --version
4.2.2 (UniProt 2026.02)
$ npx unipept-cli pept2lca AALTER
peptide,cutoff_used,taxon_id,taxon_name,taxon_rank
AALTER,1,1,root,no rank

The version pinned form npx unipept-cli@4.2.2 cannot be exercised until this is published, but the equivalent npx -p unipept-cli@4.2.0 unipept --version was confirmed to print 4.2.0, so version resolution itself works.

Test Files  25 passed (25)
     Tests  111 passed (111)

Lint, typecheck and build pass.

Checklist

  • Tests: two added, checking that every declared bin has a source file and that a bin exists matching the package name, which is the condition npx depends on
  • Docs: README gains a "Running without installing" section; the website docs get the same in Bring the CLI documentation up to date with 4.2.2 unipept#1872
  • Announcement: 🚀 The CLI can now be run without installing it, with npx unipept-cli
  • AI: Claude Code found that npx did not work, then made the change, the tests and the docs

npx runs the binary named after the package, and only falls back to the
sole binary when a package ships exactly one. This package ships four,
none of them called unipept-cli, so the obvious invocation failed:

  $ npx unipept-cli --version
  npm error could not determine executable to run

The natural second guess is worse: `npx unipept` looks for a package
named unipept, which does not exist on npm, so it fails with a 404 that
points nowhere useful. That was the name of the old Ruby gem.

Adding unipept-cli as an alias for the unipept binary makes the obvious
form work. The other three commands stay reachable with -p, which is the
normal way to run a named binary from a package:

  $ npx unipept-cli pept2lca AALTER
  $ echo "AALTERSVKAAPKR" | npx -p unipept-cli prot2pept

Running through npx is worth documenting beyond convenience: pinning a
version with npx unipept-cli@4.2.2 makes an analysis reproducible
without asking anyone to install anything.

Patch rather than minor: the alias points at the same script as unipept
and adds no capability, since the command was already reachable through
npx -p. Nothing a user could do before changes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@bmesuere
bmesuere marked this pull request as ready for review August 19, 2026 15:19
Copilot AI lite review requested due to automatic review settings August 19, 2026 15:19
@bmesuere
bmesuere merged commit da11169 into main Aug 19, 2026
4 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@bmesuere
bmesuere deleted the feat/npx-support branch August 19, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants