Implementation Plan: Alphabetical Command Listing

Branch: alphabetical-command-listing-01KW6N8W | Date: 2026-06-28 | Spec: spec.md Input: Feature specification from /kitty-specs/alphabetical-command-listing-01KW6N8W/spec.md

Summary

Ensure root command listings shown by a bare spec-kitty invocation are alphabetically ordered by displayed command name. The implementation should preserve command names and behavior while sorting the user-facing command collection used by root help/listing output.

Technical Context

Language/Version: Python 3.11+ Primary Dependencies: Typer, Click, Rich, pytest Storage: N/A; no persisted data changes Testing: Focused CLI tests inspecting root command listing order Target Platform: Cross-platform command-line interface on macOS, Linux, and Windows Project Type: Single Python CLI package Performance Goals: Sorting has negligible overhead for the current root command count Constraints: Do not rename commands or change command hierarchy Scale/Scope: Root command listing for bare spec-kitty

Charter Check

GATE: Must pass before Phase 0 research. Re-check after Phase 1 design.

  • Python 3.11+ and Typer/Rich CLI stack are preserved.
  • Tests are required for new output ordering behavior.
  • No storage, migration, or security-sensitive behavior changes are introduced.

Project Structure

Documentation (this mission)

kitty-specs/alphabetical-command-listing-01KW6N8W/
├── spec.md
├── plan.md
├── tasks.md
└── tasks/
    └── WP01-alphabetical-command-listing.md

Source Code (repository root)

src/
└── specify_cli/
    └── cli/
        └── commands/
            └── __init__.py

tests/
└── specify_cli/
    └── cli/
        └── commands/
            └── test_root_command_order.py

Structure Decision: Sort command metadata in the centralized root command registration helper and test the generated root command list.

Implementation Concern Map

IC-01 — Root Command Ordering

  • Purpose: Make the root command listing predictable and alphabetically sorted without altering behavior.
  • Relevant requirements: FR-001, FR-002, FR-003, FR-004, NFR-001, NFR-002, NFR-003, C-001, C-002, C-003
  • Affected surfaces: src/specify_cli/cli/commands/__init__.py, tests/specify_cli/cli/commands/test_root_command_order.py
  • Sequencing/depends-on: none
  • Risks: Typer may keep commands and groups in separate metadata lists; tests should verify the rendered/generated root command order rather than assuming internal list structure.