Repository navigation
Description
Context
The current CLI has grown broad without gaining much structure. A large number of top-level commands now mix primary workflows (sync, search, render) with secondary utilities (status, env, attachments, compare, prefs, open, maintenance subcommands). The result is noisy help output and a completion engine that has to special-case command paths rather than infer them from a coherent tree.
At the same time, the interactive console layer still depends heavily on external helper binaries for prompt and formatting behavior. That makes packaging and test automation harder than it should be, especially in Nix-managed or CI environments where shelling out to helper binaries is either awkward or brittle.
Two adjacent concerns keep colliding with that design:
- OCR support exists, but it is not provisioned as a defaulted capability with clear runtime dependencies and language validation.
- Declarative config management is becoming more common, but config mutation commands still behave as though every config file is locally editable.
Claude Code session handling is also showing strain: agent sidecar logs and summary-only files are not represented cleanly in the current import path.
Motivation
The immediate symptom is usability: polylogue --help is getting harder to scan, and shell completions have to encode too much command-specific knowledge manually.
The deeper issue is maintainability. A flat command tree plus external prompt/render helpers creates coupling in three places at once:
- packaging has to provision more binaries than the core product really needs
- tests have to fake terminal behavior at a very high fidelity just to cover basic prompt flows
- changes to command grouping or option semantics ripple into completion logic and documentation because the tree itself is not expressing enough structure
This matters now because OCR provisioning and declarative config support both need the CLI to be more explicit about state and defaults. Without that cleanup, every new operator-facing improvement gets hidden inside a command surface that is already too hard to navigate.
Scope
In scope:
- replace shell-out prompt/format flows in the console facade with Python-native questionary/Rich behavior where possible
- regroup the CLI into task-oriented command families (
doctor, groupedimport, groupedverify, richerbrowse,config prefs) - make shell completions understand the new command tree and option values without per-command duplication
- add OCR as a default-on capability with runtime dependency and Nix-module support
- surface declarative / immutable config state in inspection commands and block mutation when appropriate
- improve Claude Code session ingestion so agent sidecar logs and summary-only files are handled as one logical session
Out of scope:
- preserving every old command path as a compatibility alias
- redesigning non-interactive archive semantics
- full elimination of every helper tool used in packaging or preview workflows
Acceptance criteria
- interactive prompt flows for config and common command selection work without requiring gum/delta-style prompt helpers
- the public CLI is reorganized into grouped command families and help/completion output reflects that structure
- completion suggestions use the Click tree plus option metadata rather than a large set of hardcoded command-specific cases
- OCR defaults on, can be disabled explicitly, and is provisioned/validated in the Nix stack
- config inspection commands report declarative/immutable state clearly and mutation commands refuse to edit such configs
- Claude Code imports merge sidecar agent logs and skip summary-only transcripts instead of emitting empty archive entries
Activity