Skip to content

Add --json output for dry-run / preview to enable scripting and inspection #28

@chigichan24

Description

@chigichan24

Why

  • Today the dry-run path emits human-readable text only (via console.error in scripts/cli.ts:177-186).
  • That makes it impossible to pipe crune's candidate list into other tools — e.g. a custom selector, a CI gate, a gh workflow, or an editor plugin.
  • Once --preview (separate issue) exists, the same need applies to the synthesized output: users will want to programmatically inspect candidate Skills before installing.

What

  • A new --json flag (or --format json). Initial scope: dry-run and preview modes.
  • Stable, documented schema. Suggested fields per candidate:
    • topicId, label, keywords, sessionCount, sessionIds
    • reusabilityScore (number) and reusabilityScoreBreakdown (per-signal map; ties into the score-breakdown issue)
    • in preview mode: synthesizedMarkdown
  • Wrap the array under a top-level object that includes a schemaVersion field for future-proofing.

How

  • Centralize candidate serialization in one helper; text and JSON renderers should share the same source of truth.
  • When --json is set, write JSON to stdout; keep all progress logs on stderr (matches today's separation in cli.ts, where info logs already go to console.error).
  • Document the schema in docs/ and link from --help.

Notes

  • Pairs naturally with the --preview and score-breakdown issues. They can be implemented in any order, but if all three land, --json --preview becomes the obvious automation entry point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions