Skip to content

feat: Expose QualitySchema via gaze schema quality and add positional arg support #140

Description

@jflowers

Summary

Wire the existing QualitySchema constant into the gaze schema CLI command by adding positional argument support. This is the core bug fix from #118QualitySchema is a 248-line, tested constant that no user can access.

Parent issue: #118

Problem

  • gaze schema only prints report.Schema (the analyze schema)
  • QualitySchema exists at internal/report/schema.go:196, is maintained and tested (4 test functions), but has no CLI exposure
  • The gaze schema help text is misleading — says "Gaze analysis output" when it only covers analyze
  • README says "JSON output conforms to documented schemas" (line 188) — overstates coverage

Proposed Changes

1. CLI: Add positional arg to newSchemaCmd()

Change cmd/gaze/main.go:412-425:

  • cobra.NoArgscobra.MaximumNArgs(1)
  • Add ValidArgs: []string{"analyze", "quality"} for tab completion
  • Default to analyze when no argument given (backward compatible)
  • Dispatch to report.Schema or report.QualitySchema based on arg

2. Help text updates

  • Short: "Print JSON Schemas for Gaze output formats"
  • Long: List available schema names and explain usage

3. Documentation updates

  • README.md:188 — clarify which outputs have formal schemas
  • docs/reference/cli/schema.md — update synopsis, examples, argument list
  • docs/reference/json-schemas.md:354-362 — remove "not exposed via CLI" note

4. Tests

  • TestSchemaCmd_NoArgs — backward compatibility (prints analyze schema)
  • TestSchemaCmd_AnalyzeArggaze schema analyze returns report.Schema (verify $id)
  • TestSchemaCmd_QualityArggaze schema quality returns report.QualitySchema (verify $id)
  • TestSchemaCmd_InvalidArg — clear error on invalid argument
  • TestSchemaCmd_AllSchemasAreValidJSON — table-driven JSON validity check

Constraints

  • Bare gaze schema MUST continue printing the analyze schema (backward compatibility)
  • No new schema constants needed — QualitySchema already exists
  • Requires a spec (modifies production code + CLI behavior)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions