Skip to content

US-1: Single-Command JSON Output (NDJSON) #5

Description

@thm-design

US-1: Single-Command JSON Output (NDJSON)

Parent Epic: #3 (JSON Formatter & Event Schema)

As a developer integrating Cortex into a CI/CD pipeline or another tool,
I want to run cortex "analyze this file" --json and get structured JSON output,
so that I can parse and route the response programmatically.

Acceptance Criteria

  • Running cortex "refactor main.ts" --json produces NDJSON on stdout
  • No ANSI escape codes or Rich formatting in output
  • Pipeline exits with code 0 on success, non-zero on error
  • First event is session_start, last event is say
  • Each event is a complete, valid JSON object on one line
  • Piped input also works: echo "analyze main.ts" | cortex --json

Technical Notes

  • Implements the core --json argparse flag (nargs="?" with const="ndjson")
  • JsonFormatter handles the NDJSON envelope
  • Rich Console.print() skipped when json_mode is set
  • agent.run() accepts json_mode param, returns JSON string

Metadata

Metadata

Assignees

No one assigned

    Labels

    json-flagCortex --json flag featurestoryUser story with acceptance criteria

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions