5b44318d55
* Refactor cli.py into cli and utils modules Extract constants, enums, Click parameter types, and parse/export utility functions into a new mt5cli/utils.py module, keeping the typer app, commands, and collect-history SQLite helpers in cli.py. https://claude.ai/code/session_016JwSEhPyq6phXySktQ1FGU * Address review comments * Add programmatic SDK layer for read-only MT5 data collection. Expose Mt5CliClient and collect_history through the package API while keeping CLI commands as thin adapters over the SDK. Co-authored-by: Cursor <cursoragent@cursor.com> * Harden SDK connection lifecycle and scope internal helpers as private. Co-authored-by: Cursor <cursoragent@cursor.com> * Export build_config in the public API and bump version to 0.4.0. Co-authored-by: Cursor <cursoragent@cursor.com> * Remove duplicate scripts/ in favor of local-qa skill script. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
3.0 KiB
3.0 KiB
Repository Guidelines
Commands
Development Setup
uv sync
Code Quality and Documentation
Important: Run these before committing or creating a PR.
- format, lint, and test: Use
local-qaskill. - Documentation build (if any public API changes):
uv run mkdocs build
Architecture
Key Dependencies
- pdmt5: Pandas-based data handler for MetaTrader 5 (core library)
- typer: CLI framework for building command-line interfaces
- click: Parameter type customization for CLI options
- pandas: Core data manipulation and analysis
Package Structure
mt5cli/: Main package directory__init__.py: Package initialization and exports (detect_format,export_dataframe)cli.py: CLI application with typer-based commands for data exportutils.py: Constants, enums, parameter types, parsers, and export utilities__main__.py: Entry point forpython -m mt5cli
tests/: Comprehensive test suite (pytest-based)test_cli.py: Tests for CLI commands and collect-history behaviortest_utils.py: Tests for utility constants, parameter types, parsers, and export functions
docs/: MkDocs documentation with API referencedocs/index.md: Main documentationdocs/api/: Auto-generated API documentation for all modules
- Modern Python packaging with
pyproject.tomland uv dependency management
Quality Standards
- Type hints required (pyright strict mode)
- Comprehensive linting with 35+ rule categories (ruff)
- Test coverage tracking with 100% (pytest-cov)
- Parametrized tests for input/result matrices using
pytest.mark.parametrize(pytest) - Test doubles (mocks, stubs) using
pytest_mockfor external dependencies (pytest-mock) - Pydantic models for data validation and configuration
Documentation workflow
- Add Google-style docstrings to functions/classes
- Local preview:
uv run mkdocs serve - Build:
uv run mkdocs build - Deploy:
uv run mkdocs gh-deploy
Commit & Pull Request Guidelines
- Run QA checks using
local-qaskill before committing or creating a PR. - Branch names use appropriate prefixes on creation (e.g.,
feature/...,bugfix/...,refactor/...,docs/...,chore/...). - When instructed to create a PR, create it as a draft with appropriate labels by default.
Code Design Principles
Always prefer the simplest design that works.
- KISS: Choose straightforward solutions and avoid unnecessary abstraction.
- DRY: Remove duplication when it improves clarity and maintainability.
- YAGNI: Do not add features, hooks, or flexibility until they are needed.
- SOLID/Clean Code: Apply these as tools, only when they keep the design simpler and easier to change.
Development Methodology
Keep delivery incremental, test-backed, and easy to review.
- Make small, safe, reversible changes.
- Prefer
Red -> Green -> Refactor. - Do not mix feature work and refactoring in the same commit.
- Refactor when it improves clarity or removes real duplication (Rule of Three).
- Keep tests fast, focused, and self-validating.