Skip to content

Add --output json flag for init and add commands #123

@lloydrichards

Description

@lloydrichards

Parent

What to build

Add an --output json flag to both init and add commands. When provided (alongside --yes), the command runs the full pipeline silently (no interactive prompts, no terminal rendering), writes files to disk, and returns a structured ApplyResult as JSON on stdout.

This is the deterministic execution path for LLMs — used for greenfield scaffolding where conflicts aren't expected and the LLM just wants the CLI to do its thing and report back.

Output Shape (example)

{
  "ok": true,
  "created": ["src/db/index.ts", "src/server/main.ts"],
  "modified": [],
  "skipped": [],
  "failed": [],
  "finalize": [
    { "label": "Install dependencies", "command": "bun install" }
  ]
}

LLM Workflow Context

schema (#109) → construct Selection → plan (#102) → apply with own judgment
                                    OR
schema (#109) → construct Selection → add --yes --output json (this) → done

Acceptance criteria

  • --output json flag accepted on both init and add
  • When combined with --yes, runs full pipeline with no interactive prompts
  • All terminal rendering suppressed (no Ink output)
  • Structured ApplyResult JSON printed to stdout
  • Finalize scripts included in output (not executed unless --trust also passed)
  • Exit code reflects success/failure

Blocked by

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