Skip to content

feat(cli): Implement lazy loading for heavy CLI commands#396

Merged
arockwell merged 4 commits intomainfrom
feat/lazy-loading-cli
Jan 29, 2026
Merged

feat(cli): Implement lazy loading for heavy CLI commands#396
arockwell merged 4 commits intomainfrom
feat/lazy-loading-cli

Conversation

@arockwell
Copy link
Owner

Summary

  • Heavy commands (workflow, cascade, each, ai, gui, etc.) are now only imported when actually invoked
  • Significantly improves CLI startup performance
  • --help shows all commands without loading heavy dependencies

Changes

  • Add LazyTyperGroup that extends Typer's group with lazy loading support
  • Add LazyCommand placeholder that shows help text without importing the actual module
  • Register lazy commands via global registry before app creation
  • Add pre-computed help strings so --help doesn't trigger imports

Lazy-loaded commands

Category Commands
Execution workflow, cascade, each, run, agent, claude
AI/ML ai, similar
External gdoc
TUI gui

Testing

  • 18 new tests covering lazy loading behavior
  • Verified --help doesn't load lazy modules
  • Verified lazy commands work when actually invoked

🤖 Generated with Claude Code

arockwell and others added 4 commits January 29, 2026 01:41
Heavy commands (workflow, cascade, each, ai, gui, etc.) are now only
imported when actually invoked, not on every CLI call. This significantly
improves startup performance.

Changes:
- Add LazyTyperGroup that extends Typer's group with lazy loading
- Add LazyCommand placeholder that shows help without importing
- Register lazy commands via global registry before app creation
- Add pre-computed help strings so --help doesn't trigger imports

Lazy-loaded commands:
- workflow, cascade, each, run, agent, claude (execution)
- ai, similar (ML/embeddings)
- gdoc (external services)
- gui (TUI)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Resolved conflicts:
- emdx/main.py: Keep lazy loading implementation, adopt new run() with help alias
- pyproject.toml: Use newer typer 0.15+ from main
@arockwell arockwell merged commit 5a9f0f0 into main Jan 29, 2026
1 check passed
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