xn-intenton-z2a / repository0

A template for a self-evolving repository featuring LLM driven GitHub Actions Workflows.
MIT License
3 stars 0 forks source link

Implement CLI argument parsing with Version and Diagnostics support #2302

Open github-actions[bot] opened 1 month ago

github-actions[bot] commented 1 month ago

Overview: The CLI entrypoint currently logs only raw arguments. We need to implement robust argument parsing to support the core flags --help, --version, and --diagnostics. This will improve usability and ensure users can quickly access usage information, version data, and environment diagnostics.

Acceptance Criteria:

  1. parseArgs(args: string[]): { help: boolean; version: boolean; diagnostics: boolean } must return correct boolean flags for no args, each supported flag alone, and exit with code 1 for any unrecognized flag.
  2. printUsage() prints a clear usage string that lists supported flags and exits with code 0.
  3. printVersion() reads the version field from package.json, prints it exactly, and exits with code 0.
  4. printDiagnostics() collects and prints JSON with keys nodeVersion (string), platform (string), cwd (string), and env (object of filtered environment variables), then exits with code 0.
  5. main(args) dispatches in order: --help → printUsage, --version → printVersion, --diagnostics → printDiagnostics, otherwise falls back to console.log('Options:', options) without exiting.
  6. Unit tests cover: • parseArgs behavior (all flags false by default, each flag true when provided, exit on unknown flag). • printUsage, printVersion, and printDiagnostics output to console.log and appropriate process.exit codes (use spies/mocks). • main dispatch logic issuing the correct function calls and exit codes.
  7. README.md under CLI Usage includes descriptions and inline examples for npm run start --help, npm run start --version, and npm run diagnostics.

Implementation Steps:

Verification:

github-actions[bot] commented 1 month ago

This issue has been reviewed and marked as 'ready'. The description has been updated with testable acceptance criteria, and relevant library documents ([], 0 in total) have been added as comments.

github-actions[bot] commented 1 month ago

Implement CLI argument parsing with version and diagnostics support and update tests and docs

github-actions[bot] commented 1 month ago

https://github.com/xn-intenton-z2a/repository0/tree/agentic-lib-issue-2302

github-actions[bot] commented 1 month ago

Workflow name: transformation-07.1-in-progress-issue-to-ready-issue Workflow run URL: https://github.com/xn-intenton-z2a/repository0/actions/runs/15281617991 Workflow event: schedule Workflow inputs: null HEAD of main URL: https://github.com/xn-intenton-z2a/repository0/commit/bda6a4fe08c3f5d139d9c512eedd67fa775058b1