Skip to content

CLI: add --version flag #7

Description

@alloevil

Background

The CLI entry (bin/agentxray.js) currently understands --port, --host and --help. There is no way to ask which version is installed — which matters once the package is on npm and people report bugs against npx agent-xray: "what version are you on?" is the first triage question and right now the only answer is digging through npm ls.

Motivation

  • Standard CLI convention; every bug report template will ask for it.
  • Trivial to implement, no dependencies: the version is already in package.json and the CLI already has a flag-parsing loop to extend.

What to do

  • In bin/agentxray.js, handle --version / -v: print the version field from ../package.json (plain require is fine) and process.exit(0).
  • Mention the flag in the --help output line.
  • Add a small test in test/ following the existing style (Node built-in test runner) that spawns the bin with --version and asserts the output matches package.json.

Acceptance criteria

  • node bin/agentxray.js --version prints the current version (e.g. 1.12.0) and exits 0.
  • --help output documents the new flag.
  • npm test passes with the new test included.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions