Skip to content

feat(cli): composable analyze run command with --modules flag#14

Merged
ShuhaoQing merged 5 commits intomainfrom
feat/composable-analyze-run
Apr 7, 2026
Merged

feat(cli): composable analyze run command with --modules flag#14
ShuhaoQing merged 5 commits intomainfrom
feat/composable-analyze-run

Conversation

@ShuhaoQing
Copy link
Copy Markdown
Owner

@ShuhaoQing ShuhaoQing commented Apr 7, 2026

Summary

  • Add composable analyze run <symbol> --modules fundamental,risk,peer,... command that runs multiple analysis modules in a single CLI call (replaces 6+ separate invocations)
  • Extract shared utilities (analysis/cache.py, cli/_shared.py) to eliminate code duplication across 6 CLI modules
  • Add module registry (analysis/registry.py) with 7 pluggable modules: fundamental, technical, risk, volume, signals, peer, checklist

Test plan

  • 29 new tests covering cache logic, registry parsing, and analyze run command (module selection, JSON output, batch mode, checklist with/without deps, technical module)
  • All 346 existing + new tests pass (pytest -m "not integration")
  • Ruff lint + format clean
  • Manual verification: uv run haoinvest analyze run 600519 with live API
  • Manual verification: uv run haoinvest analyze run 600519 --modules fundamental,risk --json

🤖 Generated with Claude Code

Shuhao Qing and others added 5 commits April 7, 2026 19:45
…_shared.py

Move _ensure_prices_cached (with gap-fill logic) to analysis/cache.py as a
shared function. Extract _init_db and _fetch_current_prices to cli/_shared.py.
Update all CLI modules and tests to use the shared imports.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
New `analyze run <symbol> --modules fundamental,technical,risk,...` command
that composes analysis modules in a single CLI call. Supports:
- Module selection via --modules (default: all)
- Batch mode with comma-separated symbols
- JSON output with --json
- Checklist post-processing from fundamental + risk + signals

Also adds analysis/registry.py (module registry), section_header() formatter,
and compute_checklist_from_parts() in report.py.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- test_analysis_cache: gap-fill, skip-when-cached, fetch-when-empty
- test_analysis_registry: parse_modules, max_lookback, needs_prices, module count
- test_cli/test_analyze_run: module selection, JSON output, batch mode,
  checklist with/without deps, technical module

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update workflows 1, 3, 4 to use composable `analyze run` instead of
multiple individual commands. Add `analyze run` to command reference.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- CLAUDE.md: add cache.py, registry.py, _shared.py, guardrails.py to structure
- README.md: add composable analysis feature, analyze run examples

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ShuhaoQing ShuhaoQing merged commit 453689a into main Apr 7, 2026
1 check passed
@ShuhaoQing ShuhaoQing deleted the feat/composable-analyze-run branch April 7, 2026 14:05
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