Skip to content

Implement --json flag (documented but not implemented) #1

@TheTrustedAdvisor

Description

@TheTrustedAdvisor

Problem

The SKILL.md and references/commands.md prominently document a --json flag:

  • commands.md line 3: "All commands support --json for machine-readable output"
  • SKILL.md line 20: "Use --json when parsing output programmatically"
  • Every command example in SKILL.md uses --json

However, the --json flag is never defined in build_parser() and does not exist in the CLI. Running any command with --json produces an argparse error.

This is a broken API contract that affects all programmatic consumers, especially AI agents (Claude, Codex, OpenClaw) that rely on SKILL.md for tool usage.

Proposed Solution

Add a global --json flag to the top-level parser in build_parser():

parser.add_argument("--json", action="store_true", help="Output as JSON")

Then modify each cmd_* function to check args.json and output structured JSON instead of formatted text. The JSON output should include all data that the human-readable output shows.

Affected commands

  • plan show → JSON weekplan with days/recipes
  • search → JSON array of results with id, title, time, rating, url
  • recipe show → JSON recipe object
  • today → JSON array of today's recipes
  • shopping show → JSON shopping list
  • favorites show → JSON array of favorites
  • status → JSON status object
  • categories show → JSON categories map

Impact

  • Severity: CRITICAL for AI agent integration
  • Effort: Medium (each command needs a JSON code path)

Workaround

Currently none — programmatic consumers must parse the human-readable CLI output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions