Skip to content

CLI: add stable JSON output for validate and audit #1

Description

@eun7661010

Problem

validate and audit currently print readable terminal messages. CI jobs and coding agents have to interpret those lines instead of consuming a stable result object.

Proposed change

Add an opt-in --format json flag to both commands. Keep the current human-readable output as the default.

The JSON result should include:

  • a version string for the output contract;
  • the command name and package version;
  • the overall ok value and process exit code;
  • validation issues or audit checks as structured arrays;
  • file names only, never absolute paths.

Write the JSON document to stdout and operational errors to stderr so callers can redirect it safely.

Acceptance criteria

  • exam-hwpx validate INPUT --format json emits one valid JSON document.
  • exam-hwpx audit INPUT OUTPUT --format json does the same for successful and failed audits.
  • Existing commands and exit codes remain backward compatible.
  • Tests cover success, validation failure, audit failure, and a non-UTF-8 Windows console.
  • README and llms.txt include one short example.
  • Output contains no absolute path, even when the caller supplies one.

Useful starting points: src/exam_hwpx_kit/cli.py, src/exam_hwpx_kit/validation.py, src/exam_hwpx_kit/audit.py, and tests/test_cli.py.

Please use only the bundled synthetic fixture. Do not attach real exams, private templates, credentials, or personal file paths.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions