Repository navigation
Description
Problem
--format is implemented inconsistently across commands. Current state:
polylogue list / stats / export / export-bulkand the root query — accept 8 formats:markdown,json,html,yaml,csv,obsidian,org,plaintext.polylogue neighbors / tags / schema / products— accept JSON only.- Some commands accept
--jsonas a separate boolean flag (legacy); others use--format json.
Users cannot apply a consistent format policy across the CLI ("give me everything as YAML"). Scripts that wrap polylogue have to special-case the JSON-only commands. This is a UX bug visible to anyone who runs the CLI in two consecutive shells.
Target
Decide and document the format profile per command class, then unify:
query-shapedcommands (list,stats,export,export-bulk,tags,neighbors) — all accept the full 8-format set.introspectioncommands (schema,productssubcommands,--list-commands) — JSON + plain-text default; expand only if a specific use case demands.pipelinecommands (run,reset) — output is operational, not data; restrict to the operational format set.
Replace the per-command @click.option("--format", type=...) with shared decorators in cli/click_option_groups.py. Currently --format, --json, --limit are declared 5-10 times each.
Define a canonical JSON envelope (the audit notes there's no shared error/result envelope today):
{
"result": ...,
"errors": [...],
"metadata": { "command": "list", "version": "X.Y.Z", ... }
}Acceptance criteria
- Every
query-shapedcommand accepts the full format set; the JSON-only commands grow to support the rest. --formatand--jsonare unified (one flag, with deprecation note for--jsonif removed).- Shared format decorator in
cli/click_option_groups.py; per-command duplication removed. - All JSON output uses the canonical envelope.
tests/unit/cli/test_format_consistency.py(new) asserts the matrix: every query-shaped command × every format produces output.- Help text for
--formatis identical across commands (cite the decorator). docs/cli-reference.mdregenerates to show the consistent format profile.
Coordinates with
- refactor(cli): factor shared helpers so cli/commands/ has a cohesive boundary #431 (cli/commands cohesion): the shared decorators land in
cli/shared/per refactor(cli): factor shared helpers so cli/commands/ has a cohesive boundary #431's plan, not atcli/root. - refactor: rationalize package-root layout and consolidate facade surface #426 (root + facade): if the JSON envelope wraps data from the facade, ensure the facade returns shaped values, not raw text.
Related
- chore: track post-renewal consolidation and architectural cohesion #401 — post-renewal consolidation umbrella.
- refactor(cli): factor shared helpers so cli/commands/ has a cohesive boundary #431 — cli/commands cohesion (sibling).
Scope fence — no topology moves
This issue is behavioral, not structural. It edits polylogue/cli/** in place to unify format-flag declarations and the JSON envelope; no module moves. Verifiable by:
git diff --stat origin/master..HEAD -- polylogue/cli/
# expected: edits and additions only, no `=>` rename markers
If a fix here produces new shared modules (e.g. expanding cli/click_option_groups.py or adding cli/format_envelope.py), the additions extend docs/plans/topology-target.yaml in the same PR. Coordinates with #431 (cli/commands cohesion) only on shared-helper placement; format unification itself does not require waiting for #431.
Activity
feat(devtools): obligation-diff command and finalize verifiability ar…
Sinity commentedon May 7, 2026
Closed-scope audit found remaining CLI format-profile drift; leaving this issue closed and tracking reconciliation in #944.
Concrete gaps observed:
polylogue/cli/click_option_groups.pyhas the shared format option group, butpolylogue/cli/commands/tags.pyandpolylogue/cli/commands/neighbors.pystill expose JSON-only choices.#944 should make the command surface truthful and either finish the matrix or document/split intentional exceptions.