Skip to content

Rename to cross-port-kill and release 2.0.0 - #4

Open
Majid-Ali-Watto wants to merge 1 commit into
mainfrom
release-2.0.0
Open

Majid-Ali-Watto wants to merge 1 commit into
mainfrom
release-2.0.0

Conversation

@Majid-Ali-Watto

Copy link
Copy Markdown
Member

Renames the package to the unscoped cross-port-kill and prepares the 2.0.0 release. npm can't rename packages, so this continues the 1.x line of @majidev-org/port-kill-cli as a new package. The old one gets deprecated after the first publish.

Changes

Commands. Ten in total. cpk, ckp, cross-port-kill and cross-kill-port join pk, kp, port-kill and kill-port. pk-udp and pk-tcp preset the protocol. They are separate entry files because npm's Windows shims drop the typed command name.

UDP support.

  • New flags --udp / -u and --tcp / -t, plus a protocol on the port itself (5353/udp, udp:5353).
  • TCP stays the default, so a plain port never touches a UDP socket.
  • lsof is now called once per protocol. Combining -sTCP:LISTEN with -iUDP made it drop every UDP socket, so macOS never saw UDP ports.

Bug fix. docker ps mappings like 5455->53/udp were read as TCP. pk 5455 could stop a container that only published UDP.

Forgiving input.

  • Ports written as :3000, localhost:3000, [::1]:3000, :::3000 (from EADDRINUSE errors) or a pasted URL.
  • Lists and ranges: 3000,5173 and 3000..3005.
  • Combined short flags (-ui) and case-insensitive options.
  • kill-port's --port / --method syntax.
  • Did-you-mean suggestions for typos.

Plain words.

  • pk kill 3000 frees the port. pk port 3000 shows info.
  • pk udp and pk tcp udp ports list those ports.
  • Questions (pk what is on 3000, pk is 3000 free) only ever show info, even when a kill word is present.

--info hint. It now ends with the command that frees what it showed, e.g. To free it: pk 3000.

Docs.

  • README reordered by priority.
  • New USAGE.md guide with a cheat sheet.
  • Nine animated terminal SVGs, generated by scripts/make-demo.mjs from the CLI's own output helpers.
  • Images use relative paths. Check the npm page after publishing in case they need absolute URLs.

Testing

  • npm test: 44 pass on Linux, 1 Windows-only test skipped.
  • New unit tests cover every input format, word and protocol combination.
  • New end-to-end tests cover:
    • UDP: a plain port leaves the socket alone, /udp frees it.
    • pk-udp and pk-tcp.
    • Freeing via localhost:PORT and a URL.
    • pk port N / pk what is on N / pk is N free never kill, and pk kill N does.
  • Manual checks:
    • The lsof fallback path, run with ss hidden.
    • A real UDP-published Docker container.
    • The packed tarball installed through npm's shims, confirming all ten commands.
  • The CI matrix still needs to confirm macOS (lsof) and Windows (netstat UDP rows).

Release steps after merge

Also documented in CONTRIBUTING.md under "The rename to cross-port-kill":

  1. Create a 1-day npm token with write access to all packages, and store it as NPM_TOKEN. The current token is limited to the old package and can't create a new one.
  2. Tag v2.0.0 on main and push it. The workflow publishes with provenance.
  3. Replace the token with one limited to cross-port-kill.
  4. Run npm deprecate @majidev-org/port-kill-cli "Renamed to cross-port-kill: …".

🤖 Generated with Claude Code

The package is now published unscoped as cross-port-kill, so
`npx cross-port-kill 3000` replaces `npx @majidev-org/port-kill-cli 3000`.
It continues the 1.x line of @majidev-org/port-kill-cli at 2.0.0.

- Commands: add cpk, ckp, cross-port-kill and cross-kill-port next to
  pk, kp, port-kill and kill-port, plus pk-udp and pk-tcp, which preset
  the protocol (separate entry files, since npm's Windows shims lose the
  typed name).
- UDP: --udp / -u and --tcp / -t flags, and a protocol on the port
  (5353/udp, udp:5353). TCP stays the default, so a plain port never
  touches a UDP socket. Listing covers ss, lsof (one call per protocol,
  as a TCP state filter drops UDP files) and netstat.
- Fix: docker ps mappings such as 5455->53/udp were read as TCP ports, so
  pk 5455 could stop a container that only published UDP 5455.
- Forgiving input: :3000, host:port, [::1]:3000, :::3000, pasted URLs,
  3000,5173 lists, 3000..3005 ranges, combined short flags, case-insensitive
  options, kill-port's --port/--method syntax, and did-you-mean
  suggestions for mistyped options and words.
- Plain words: pk kill 3000 frees, pk port 3000 shows info, questions
  (pk what is on 3000, pk is 3000 free) only ever look, and pk udp /
  pk tcp udp ports list those ports.
- --info now ends with the command that frees what it showed.
- Docs: README reordered by priority, new USAGE.md guide with a cheat
  sheet, and nine animated terminal SVGs generated from the CLI's own
  output helpers by scripts/make-demo.mjs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant