Skip to content

feat: auto-discover per-view JSON schemas by convention #225

@flyingrobots

Description

@flyingrobots

Context

The view progress --json output is validated against view-progress.schema.json (added in #222). Currently the schema filename is hardcoded in the contracts table and test samples. As more views gain --json support, each will need a manual schema entry.

Proposal

Auto-discover per-view schema files by convention: view-{name}.schema.json in docs/contracts/cli/. When view <name> --json is invoked, the CLI (or test harness) could resolve the schema file automatically:

const schemaFile = `view-${viewName}.schema.json`;

This would apply to:

  • Contract test discovery (contracts.test.js — scan for view-*.schema.json)
  • Integration canary generation (one canary per discovered view schema)
  • CLI outputJson routing (optional — could validate output before emitting)

Acceptance Criteria

  • contracts.test.js auto-discovers view-*.schema.json files
  • Adding a new view schema doesn't require updating VALID_SAMPLES manually (or at least fails clearly)
  • Existing views without schemas are unaffected

Originated from PR #223 agent reflection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions