Skip to content

fix(cli): parse arguments before starting the peer and REST facade - #59

Merged
Mearman merged 1 commit into
mainfrom
fix/cli-help
Oct 5, 2026
Merged

Mearman merged 1 commit into
mainfrom
fix/cli-help

Conversation

@Mearman

@Mearman Mearman commented Oct 5, 2026

Copy link
Copy Markdown
Member

npx cc-peer --help ignored the flag and started the REST facade, registering a peer and printing a bearer token, because the CLI only picked out the options it knew and created the peer first. Arguments are now parsed up front by a pure function: --help and -h print usage and exit 0, and an unknown flag, a value flag with no value or an invalid port exits 2 with a hint, all before any peer or socket exists. test/cli.integration.test.ts spawns the real entry with an empty home and checks the exit codes, the absence of a token and that nothing was registered, and src/bin/main.unit.test.ts covers the parser.

Fixes #58

`cc-peer --help` and `-h` now print usage and exit 0, and an unknown flag, a value flag with no
value or an invalid port exits 2 with a usage hint. Parsing is a pure function that runs before
any peer is created, socket bound or token minted, so none of these paths have side effects.
@Mearman
Mearman marked this pull request as ready for review October 5, 2026 11:59
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-10-05T12:05:18.462125Z 9d6abf8 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Mearman
Mearman merged commit 9b4f46a into main Oct 5, 2026
9 checks passed
@Mearman
Mearman deleted the fix/cli-help branch October 5, 2026 12:06
@exadev

exadev Bot commented Oct 5, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 1.6.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@exadev exadev Bot added the released label Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

npx cc-peer --help starts the REST facade instead of printing help

1 participant