Skip to content

The gmd CLI monolith is blocking richer render surfaces #3

Closed

Description

@Sinity

Context

The CLI has reached the point where gmd.py is carrying argument parsing, interactive prompts, Drive coordination, Markdown assembly, and output formatting in one place.

The renderer has a similar problem. It effectively returns a string, which means any new output surface has to reverse-engineer metadata, attachments, and derived stats from code that was only written to emit Markdown. That is especially limiting if we want HTML previews or richer summaries, because the current structure encourages copy/paste rather than reuse.

Motivation

We need a command boundary before the next round of features lands. Without one, every CLI enhancement deepens the coupling between argparse parsing, Drive access, attachment collection, and text generation. That makes even small additions costly to review and increases the chance that render and sync drift apart behaviorally.

HTML preview support is the clearest near-term example. If we add HTML directly to the current implementation, we will either duplicate all of the metadata and attachment logic or build another layer that parses already-rendered Markdown back into structured data. Neither is attractive. The better move is to promote a structured document model and let both Markdown and HTML writers consume it.

There is also a UX concern. Interactive use is valuable for browsing files and chats, but it should not be entangled with CI or shell scripting paths. The repo needs a plain-mode story and a small UI abstraction so the code can ask for a choice or a summary without hard-coding one terminal tool everywhere.

Scope

In scope:

  • split gmd.py into a thin CLI adapter plus a reusable command layer
  • introduce typed option/result objects for render, sync, list, and status paths
  • centralize attachment collection and Markdown building so render and sync share one implementation
  • introduce a structured document object that can back both Markdown and HTML outputs
  • add an optional HTML preview writer
  • add a plain-aware interaction layer that can wrap picker and presentation tools cleanly
  • update the dev shell to include the interactive/HTML stack the tool actually expects

Out of scope:

  • provider expansion beyond Gemini in this pass
  • deep visual theming or a full terminal UI framework
  • a large CLI rename or config migration

Acceptance criteria

  • Render and sync both delegate to shared command functions that accept typed option objects and return typed results.
  • The renderer produces a structured document representation that preserves metadata, attachments, and stats for both Markdown and HTML writers.
  • HTML previews can be generated from the same render pipeline with explicit flags and theme selection.
  • Interactive behavior can be disabled cleanly for CI/scripts, and bare CLI invocation can enter a menu without changing scripted subcommand behavior.
  • Attachment handling, pruning logic, and Drive orchestration are no longer duplicated between render and sync code paths.

Activity

  1. added
    type:refactor
    on Apr 7, 2026
  2. added
    faux-pull-request
    on Apr 9, 2026
  3. added a commit that references this issue on May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clifaux-pull-requesttype:refactor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions