I need to understand the full command structure of this CLI tool and assess naming consistency. Please do a thorough exploration:
First, find all command modules under desloppify/app/commands/ - list all directories and key files
Read the CLI parser setup to understand what commands are exposed and how they're described (check desloppify/app/cli_support/parser.py, parser_groups.py, parser_groups_admin.py)
Read the command registry (desloppify/app/commands/registry.py)
For each command, read its cmd.py to understand what it actually does - look at the main entry function names, docstrings, and help text
Also check desloppify/app/commands/resolve/, desloppify/app/commands/next/, desloppify/app/commands/show/, desloppify/app/commands/status/, desloppify/app/commands/scan/, desloppify/app/commands/plan/, desloppify/app/commands/review/, desloppify/app/commands/autofix/
Look at function names within commands - especially public-facing entry points and key helpers
For each command, note:
The command name as exposed to users
The help text / description
What it actually does (from reading the code)
Key function names within it
Any naming that seems inconsistent with what the thing actually does
Be very thorough - read broadly across all commands.
Assistant
I'll systematically explore the CLI command structure. Let me start with broad file discovery and reading the core infrastructure files in parallel.
Assistant
Good, I have the full parser and registry structure. Now let me read all the individual command entry points in parallel.
Assistant
Now let me read the plan parser (which is separate) and the resolve parser setup, plus check the autofix/options.py for fixer loading logic.
Assistant
Now I have a complete picture. Let me also check whether resolve is exposed as a standalone CLI command (it appears in the registry but not the parser).
Assistant
So resolve is NOT a top-level command -- it only exists as plan resolve. Good. Now let me check _autofix_preview.py and the __init__ files for the command packages that export entry points.
Assistant
User
I need to deeply understand the resolve/suppress/plan command relationships to plan a restructuring. Please explore:
Read ALL files in desloppify/app/commands/resolve/ — every .py file. Understand what each does and what imports what.
Read desloppify/app/commands/plan/override_handlers.py fully — understand how plan resolve dispatches to cmd_resolve
Read desloppify/app/commands/plan/cmd.py fully — understand all subcommand dispatching, especially resolve and done
Check the parser: in parser_groups_plan.py, how is plan resolve defined? What args does it take?
In parser_groups.py, how is suppress defined? What args?
Check if plan done exists as a subcommand alias or concept anywhere
Look at desloppify/app/commands/_autofix_preview.py — what does it export and who imports it?
Look at parser_groups_admin.py for the p_fix variable and surrounding context for autofix
Check desloppify/app/commands/review/cmd.py to understand the flag-based mode pattern
For each file, note the key functions, imports, and how they connect to each other. I need to understand the full dependency graph to plan safe moves.
Assistant
I'll systematically explore all the requested files. Let me start by reading them in parallel batches.
Assistant
Now let me read all the resolve/ files and the parser files in parallel.
Assistant
Now let me read the remaining files I need: the plan parser and check for "plan done" references.
Assistant
Now let me check the autofix/cmd.py and the registry to complete the picture.
Assistant
Now I have a comprehensive picture. Let me also check where resolve is registered as a top-level command (it's not -- only suppress is at the top level, and resolve lives inside plan resolve).
Assistant
I now have a thorough understanding of the entire command structure. Here is my complete analysis.
Full CLI Command Structure Analysis
Overview
The CLI is built with argparse. The top-level parser is in /Users/user_c042661f/Documents/desloppify/desloppify/app/cli_support/parser.py. Commands are registered in /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/registry.py which maps command name strings to handler functions. The parser groups are split across three files:
/Users/user_c042661f/Documents/desloppify/desloppify/app/cli_support/parser_groups_plan.py -- plan (with all subcommands)
The registry maps 18 top-level command names to handler functions.
Command-by-Command Breakdown
1. scan
Help text: "Run all detectors, update state, show diff"
Handler: cmd_scan in /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/scan/cmd.py
What it does: Runs all language detectors, merges results into persistent state, shows a diff summary, dimension deltas, score changes, post-scan analysis/narrative, writes query.json, emits scorecard badge.
Help text: "Score dashboard with per-tier progress"
Handler: cmd_status in /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/status/cmd.py
What it does: Loads state, computes scores/dimensions/narrative, shows a full dashboard with score summary, scan metrics, dimension table, tier progress, structural areas, review summary, agent plan, and writes query output.
Naming notes: Consistent. The help says "per-tier progress" but the code also shows dimension health, score model breakdown, structural areas, etc. -- it's really a full dashboard, not just "per-tier progress."
3. next
Help text: "Show next highest-priority open issue"
Handler: cmd_next in /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/next/cmd.py
What it does: Builds a prioritized work queue, shows the top N items (default 1), supports filtering by scope/cluster/status, grouping, and multiple output formats.
Naming notes: _get_items is a generic name for the core logic function that does queue building, rendering, and output. It could be more descriptive. Otherwise consistent.
4. plan
Help text: "Living plan: generate, reorder, cluster, skip, note"
Handler: cmd_plan in /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/plan/cmd.py
What it does: Dispatches to subcommands. With no subcommand, generates a full prioritized markdown plan. Subcommands: show, queue, reset, reorder, describe, resolve, note, focus, skip, unskip, reopen, cluster (with sub-sub-commands: create/add/remove/delete/reorder/show/list/merge/update), triage, commit-log (with sub-sub-commands: record/history/pr).
cmd_plan_output is the public name, but _cmd_plan_generate is a private wrapper that just calls it. The indirection is odd -- _cmd_plan_generate could be removed.
The _PLAN_ACTION_HANDLERS dict is clean.
plan resolve is different from resolve -- plan resolve marks issues as fixed within the plan workflow (via cmd_plan_resolve in override_handlers.py), while resolve is not a top-level command at all.
5. show
Help text: "Dig into issues by file, directory, detector, or ID"
Handler: cmd_show in /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/show/cmd.py
What it does: Shows issues filtered by pattern (file path, directory, detector name, issue ID, glob). Supports dimension views, concerns view, code snippets, chronic reopener filtering, noise budget.
Handler: cmd_suppress_pattern in /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/resolve/suppress.py
What it does: Adds a pattern to the ignore/suppress list in config, removes matching issues from state, requires attestation.
Key functions: cmd_suppress_pattern
Naming notes: The handler is named cmd_suppress_pattern but the command is just suppress. The handler lives inside the resolve/ package, which is a bit surprising since suppress is its own top-level command, not a subcommand of resolve. The function name cmd_suppress_pattern includes "pattern" which is redundant with the command semantics (suppress always operates on patterns).
7. exclude
Help text: "Add path pattern to exclude list"
Handler: cmd_exclude in /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/exclude.py
What it does: Adds a path pattern to the exclusion list in config, prunes matching issues from state and plan, marks config as needing rescan.
Naming notes: Consistent. Note the semantic overlap between exclude and suppress -- exclude removes path patterns from scanning entirely, suppress ignores specific issue patterns. The help text could be clearer on the distinction.
8. autofix
Help text: "Auto-fix mechanical issues"
Handler: cmd_autofix in /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/autofix/cmd.py
What it does: Runs a named fixer (from the language plugin's fixer registry) to auto-fix mechanical issues. Detects issues, applies fixes (or dry-runs), auto-resolves matching issues in state, runs optional post-fix cascades.
Key functions: cmd_autofix, _load_fixer (in options.py), _detect, _print_fix_summary, _apply_and_report, _report_dry_run, _warn_uncommitted_changes, _resolve_fixer_results, _cascade_unused_import_cleanup, _print_fix_retro (all in apply_flow.py)
Naming notes:
The internal variable in the parser builder is p_fix (line 381 of parser_groups_admin.py), not p_autofix. This is a minor inconsistency.
_print_fix_retro -- "retro" is jargon for retrospective/post-mortem. Could be clearer as _print_fix_post_report or similar.
The file _autofix_preview.py sits at the commands root level (not inside autofix/), exporting show_fix_dry_run_samples. This is a minor structural inconsistency.
9. detect
Help text: "Run a single detector directly (bypass state)"
Handler: cmd_detect in /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/detect.py
What it does: Runs a single named detector without updating state. Useful for debugging/investigation. Supports fix mode for log detector only.
Key functions: cmd_detect, _resolve_detector_key
Naming notes: Consistent.
10. tree
Help text: "Annotated codebase tree (text)"
Handler: cmd_tree in /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/viz.py
What it does: Prints an annotated codebase tree to the terminal. Thin wrapper delegating to desloppify.app.output.visualize.cmd_tree.
Key functions: cmd_tree (wrapper)
Naming notes: Consistent. Both tree and viz share the same source file (viz.py), which makes organizational sense since they're both visualization.
11. viz
Help text: "Generate interactive HTML treemap"
Handler: cmd_viz in /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/viz.py
What it does: Generates an interactive HTML treemap visualization. Thin wrapper.
Key functions: cmd_viz (wrapper)
Naming notes: Consistent.
12. move
Help text: "Move a file or directory and update all import references"
Handler: cmd_move in /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/move/cmd.py
What it does: Moves a file or directory, computes import reference changes, applies them. Supports dry-run.
Key functions: cmd_move, _cmd_move_dir
Naming notes: Consistent.
13. review
Help text: "Prepare or import holistic subjective review"
Handler: cmd_review in /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/review/cmd.py
What it does: Multi-mode command for LLM-based subjective code review. Modes: --prepare (generate review data), --import (import review results), --run-batches (run batches with subagents), --merge (deduplicate review issues), --external-start/--external-submit (cloud review sessions), --validate-import. Default mode is prepare.
Naming notes: This is the most complex command. The mode selection via boolean flags (--merge, --run-batches, --external-start, etc.) rather than subcommands is unusual compared to how plan, zone, config, and dev use subcommands. This creates a different UX pattern. The help text is accurate but understates the command's scope.
14. zone
Help text: "Show/set/clear zone classifications"
Handler: cmd_zone in /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/zone.py
What it does: Shows, sets, or clears file zone classifications (production/test/config/generated/script/vendor). Uses subcommands (show, set, clear).
Help text: "Install or update the desloppify skill/agent document"
Handler: cmd_update_skill in /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/update_skill.py
What it does: Downloads and installs/updates the desloppify skill document for various AI agent interfaces (claude, codex, cursor, copilot, windsurf, gemini, opencode).
Naming notes: Consistent. File is update_skill.py (underscore) but command is update-skill (hyphen). This follows Python module naming convention vs CLI convention, which is fine.
Naming Consistency Issues Identified
suppress lives inside resolve/ package: The cmd_suppress_pattern handler is at /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/resolve/suppress.py, but suppress is a top-level command, not a subcommand of resolve. The resolve/ package is otherwise about the plan resolve flow (resolve cmd.py, apply.py, persist.py, queue_guard.py, render.py, selection.py). suppress is conceptually separate from issue resolution.
Handler name cmd_suppress_pattern vs command name suppress: The handler has "pattern" in its name, which is redundant. Other handlers follow the pattern cmd_{command_name} -- cmd_scan, cmd_status, cmd_next, etc. This one is cmd_suppress_pattern rather than cmd_suppress.
Parser variable p_fix for autofix: In parser_groups_admin.py line 381, the parser variable is p_fix rather than p_autofix. Minor but inconsistent with how other parsers are named (p_scan, p_status, p_show, p_next, etc.).
_autofix_preview.py at commands root: The file /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/_autofix_preview.py sits at the commands/ root level rather than inside the autofix/ subdirectory where the rest of the autofix code lives.
review uses flag-based mode selection while similar commands use subcommands: zone, config, dev, and plan all use argparse subcommands for their actions. review uses mutually exclusive boolean flags (--merge, --run-batches, --prepare, --import, --external-start, --external-submit). This creates an inconsistent user experience pattern.
_cmd_plan_generate is a pointless wrapper: In /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/plan/cmd.py lines 78-80, _cmd_plan_generate just calls . The indirection adds no value.
Here is the full dependency analysis you requested.
Note: This is registered at top level in the command registry as "suppress": cmd_suppress_pattern -- imported directly from resolve.suppress, NOT through resolve.cmd.
The key function is cmd_plan_resolve(args) (line 486). The flow:
Extracts patterns, attestation, note from args
--confirm shortcut: If --confirm flag is set and --note exists, auto-generates attestation text from the note
Synthetic IDs: Separates triage::*, workflow::*, subjective::* patterns. These are resolved directly in the plan via purge_ids() -- they never go to cmd_resolve because they are not real state issues
Validates: note length, attestation keywords, cluster guard (blocks small clusters from bulk resolution)
Logs: Appends a "done" log entry to the plan
Delegates: Builds a new argparse.Namespace with status="fixed" and calls cmd_resolve(resolve_args) (line 583)
The resolve_args Namespace translation (lines 570-581):
So plan resolve is essentially a "fixed"-only wrapper with extra plan-aware behavior (synthetic ID handling, cluster guards, --confirm shortcut) that delegates to the same cmd_resolve used by the core resolve flow.
Other handlers in this file: cmd_plan_describe, cmd_plan_note, cmd_plan_skip, cmd_plan_unskip, cmd_plan_reopen, cmd_plan_focus.
cmd_plan(args) dispatches: if plan_action is None, generates markdown plan; otherwise looks up handler from the dict.
There is NO "done" key in _PLAN_ACTION_HANDLERS. The concept of "done" appears only as a log entry action (append_log_entry(plan, "done", ...)) inside cmd_plan_resolve.
Note: suppress is a top-level command (desloppify suppress), not a plan subcommand. It is registered in the command registry as "suppress": cmd_suppress_pattern, importing from resolve.suppress.
6. "plan done" -- Does it exist?
No. There is no "done" subcommand in the plan parser or handler map. The variable name p_done in the parser file is a historical artifact (it defines the "resolve" subcommand). The string "done" appears only:
As a log entry action: append_log_entry(plan, "done", ...) in cmd_plan_resolve
In the plan log schema: action: "done" is one of the allowed values
show_fix_dry_run_samples(entries, results) -- prints sampled before/after context for autofix --dry-run
_print_fix_file_sample(result, entries) -- (private) prints per-file sample
Imported by:
/Users/user_c042661f/Documents/desloppify/desloppify/app/commands/autofix/cmd.py line 8: from desloppify.app.commands._autofix_preview import show_fix_dry_run_samples
/Users/user_c042661f/Documents/desloppify/desloppify/tests/commands/test_transitive_modules.py -- test coverage (imports both show_fix_dry_run_samples and patches _print_fix_file_sample)
This is a standalone utility module at the commands/ level, consumed only by the autofix/cmd.py command.
The command name is "autofix" (matching the registry key). The _fixer_help_lines(langs) helper (line 368) generates per-language fixer lists for the epilog.
_get_items in next/cmd.py: The core logic function for the next command is named _get_items (line 209), which is extremely generic. Compare with _cmd_plan_show, _zone_show, _config_set -- all more descriptive.
resolve is NOT a top-level command but has its own package: The resolve/ package at /Users/user_c042661f/Documents/desloppify/desloppify/app/commands/resolve/ exists and contains cmd.py with a cmd_resolve function. However, resolve is not registered as a top-level command in the registry -- it is only accessible as plan resolve. Despite this, the resolve package is imported by the plan override handlers. This means there is a full cmd_resolve function and resolve/cmd.py that looks like a standalone command but is actually called internally by plan resolve. The naming/structure suggests it was or was meant to be a top-level command.
status help text undersells: "Score dashboard with per-tier progress" -- but it actually shows dimension health, score model breakdown, structural areas, review summary, commit tracking, narrative/headline, focus suggestions, subjective followup. The help text is from an older era.
plan help text inconsistency: The parser help says "Living plan: generate, reorder, cluster, skip, note" but the description and actual subcommand list also includes resolve, focus, unskip, reopen, triage, commit-log, show, queue, reset. The help text only names a subset of the subcommands.