3. Prune Shallow Legacy Script Shims in Favor of Unified CLI
Date: 2026-08-24
Status
Accepted
Context
MailSweep provides a unified command line interface (mailsweep / src/mailsweep/cli.py) and standard module execution (python -m mailsweep).
Previously, eight root-level script shims (scan_mailbox.py, classify_and_plan.py, backup_emails.py, clean_mailbox.py, restore_selected_emails.py, deep_audit.py, rules_updater.py, unsubscribe_hub.py) were maintained in the repository root for backwards compatibility. Each file was a shallow 10-line pass-through modifying sys.argv and delegating to mailsweep.cli:main.
Maintaining these shims introduced architectural drawbacks:
- Scattered root entrypoint surface area confusing both human maintainers and AI navigability.
- Redundant pass-through layers violating the deletion test (deleting the shims concentrates execution in the canonical CLI without moving complexity).
- Divergent invocation patterns across documentation and tooling.
Decision
We pruned all eight root script shims and standardized all CLI execution on the canonical mailsweep package interface:
-
Root Script Removal:
- Deleted
scan_mailbox.py,classify_and_plan.py,backup_emails.py,clean_mailbox.py,restore_selected_emails.py,deep_audit.py,rules_updater.py, andunsubscribe_hub.py.
- Deleted
-
Standardized Execution Surface:
- Standardized documentation and command examples on
uv run mailsweep <subcommand>(e.g.mailsweep scan,mailsweep plan,mailsweep backup,mailsweep clean,mailsweep restore,mailsweep audit,mailsweep unsubscribe,mailsweep rules). python -m mailsweep <subcommand>remains supported viasrc/mailsweep/__main__.py.mailsweepconsole script remains registered inpyproject.toml.
- Standardized documentation and command examples on
-
Domain Vocabulary & Locality:
- Maintained all programmatic domain module interfaces (
MailboxGateway,ClassificationEngine,SafetyAuditor,BackupArchive,UnsubscribeHub,RulesRegistry) untouched for zero-dependency library consumers.
- Maintained all programmatic domain module interfaces (
Consequences
- Clean root directory structure with zero shallow wrapper scripts.
- Single canonical entrypoint for CLI execution, documentation, and automated tooling.
- Full test suite and programmatic API capabilities remain 100% intact.