Skip to content

Refactor: expose public Python API layer#4

Merged
Jscoats merged 3 commits intomainfrom
refactor/api-layer
Feb 26, 2026
Merged

Refactor: expose public Python API layer#4
Jscoats merged 3 commits intomainfrom
refactor/api-layer

Conversation

@Jscoats
Copy link
Copy Markdown
Owner

@Jscoats Jscoats commented Feb 26, 2026

Summary

  • Extract data functions from all 15 command files, separating data retrieval from CLI presentation
  • New src/mxctl/api.py with 56 importable functions across 13 categories
  • Zero CLI behavior changes — all existing commands work identically

What this enables

from mxctl.api import get_messages, read_message, get_triage

messages = get_messages(account="iCloud", mailbox="INBOX", limit=10)
msg = read_message(account="iCloud", mailbox="INBOX", message_id=123)
triage = get_triage()

Any Python project can now import mxctl as a library, not just use it as a CLI.

Test plan

  • 675/675 tests passing
  • ruff lint clean
  • ruff format clean
  • Pre-commit hooks passing

🤖 Generated with Claude Code

Jscoats and others added 3 commits February 27, 2026 00:28
Extract data functions from every CLI handler in commands/mail/,
separating data retrieval from presentation. Each cmd_* function
now calls a standalone data function that takes plain Python args
and returns structured data — no printing, no argparse dependency.

New src/mxctl/api.py provides 56 importable functions:
  from mxctl.api import get_messages, read_message, get_triage

All 675 tests pass. Zero CLI behavior changes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add tests for api.py (all 56 exports), analytics.py empty stats
  branch, and system.py get_headers data function
- Update ARCHITECTURE.md test count 675 → 678
- Update README test count 675 → 678
- Add API refactor entry to CHANGELOG [Unreleased]

678 tests, 100% coverage.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ection

- Replace real email with fake in example output
- "50 commands" → "50+ commands" throughout
- Remove redundant JSON Output for Automation section
- Replace 20-line manual AI setup snippet with one-liner
- Remove Acknowledgments section (duplicated tagline)
- Reformat Claude Code examples as blockquotes
- Condense Local AI section from 15 to 6 lines
- Remove unnecessary --to footnote on export
- Fix jq examples to match actual JSON structure

488 → 434 lines.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Jscoats Jscoats merged commit 6b7f65d into main Feb 26, 2026
4 checks passed
@Jscoats Jscoats deleted the refactor/api-layer branch February 26, 2026 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant