Refactor init#5
Conversation
…tadata and registros
There was a problem hiding this comment.
Code Review
This pull request upgrades the project to version 0.2.0, introducing a modular architecture, globalization support (English and Spanish), and new CLI arguments. The codebase has been refactored into specialized modules (core, storage, io, cli, i18n), and the internal data schema has been updated to include project metadata. Feedback focuses on a potential infinite recursion bug in the data loading logic, missing automatic migration for legacy files, and naming inconsistencies between the documentation and the implementation. Additionally, the use of a deprecated locale function was noted.
There was a problem hiding this comment.
Pull request overview
This PR bumps time-balance to v0.2.0 and refactors the codebase from a single-module implementation into a modular package, adding i18n support (EN/ES), new CLI flags, structured JSON storage, and refreshed documentation/tests.
Changes:
- Split functionality into
core,constants,storage,io,cli, andi18n, keeping a facade API intime_balance/__init__.py. - Introduce structured on-disk JSON format with metadata + records, plus import/export helpers and CLI flags (
--status,--list,--lang,--version). - Rewrite docs (English + Spanish set) and add/refresh a modular unittest suite.
Reviewed changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 19 comments.
Show a summary per file
| File | Description |
|---|---|
| time_balance/storage.py | Implements history path resolution and atomic save/load for the new structured JSON format. |
| time_balance/io.py | Adds schema validation plus import/export workflows (merge/overwrite). |
| time_balance/i18n.py | Adds translation dictionary and system-language detection helpers. |
| time_balance/core.py | Provides pure functions for time formatting and balance calculation. |
| time_balance/constants.py | Centralizes version, defaults, and import mode constants. |
| time_balance/cli.py | Adds interactive menu + argparse-based direct commands and uses i18n strings. |
| time_balance/main.py | Enables python -m time_balance entry point. |
| time_balance/init.py | Re-exports public API from the new modules (package facade). |
| tests/test_storage.py | Adds tests for storage path resolution and round-trip persistence. |
| tests/test_io.py | Adds tests for import/export workflows and backup creation. |
| tests/test_import_export.py | Removes legacy import/export tests tied to the old flat format API. |
| tests/test_core.py | Adds unit tests for time formatting and total balance computation. |
| tests/test_control_horas.py | Removes legacy monolithic tests for the old __init__.py implementation. |
| tests/test_cli.py | Adds tests for overwrite confirmation, history output, and --status. |
| setup.py | Bumps packaged version to 0.2.0. |
| plan-timeBalance.prompt.md | Adds refactor plan/checklist document used during the split. |
| migrate_v1_to_v2.py | Adds a standalone migration utility script for legacy histories. |
| examples/historial_horas.json | Updates example data file to the new structured format. |
| docs/es/DEVELOPMENT.es.md | Adds Spanish developer guide for the new modular architecture. |
| docs/es/CONTRIBUTING.es.md | Adds Spanish contributing guide aligned to new structure/i18n. |
| docs/es/CLI-GUIDE.es.md | Adds Spanish CLI usage guide including the new flags. |
| docs/es/ARCHITECTURE.es.md | Adds Spanish architecture overview of the new modules and schema. |
| docs/DEVELOPMENT.md | Adds English developer guide for modules, testing, and schema. |
| docs/CONTRIBUTING.md | Rewrites contributing guide in English with new project guidance. |
| docs/CLI-GUIDE.md | Rewrites CLI guide in English and documents new CLI flags. |
| docs/ARCHITECTURE.md | Rewrites architecture doc in English to reflect new module split. |
| docs/API-GUIDE.md | Removes legacy API guide (previously Spanish-focused and pre-refactor). |
| README.md | Rewrites main README in English, updates usage/installation, links Spanish README. |
| README.es.md | Adds new Spanish README aligned to v0.2.0. |
| CHANGELOG.md | Adds v0.2.0 changelog entry describing the refactor and new features. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 31 out of 31 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This pull request introduces a major new version (v0.2.0) of the
time-balanceproject, with a strong focus on internationalization, modularity, and user experience. The documentation has been fully rewritten in English, with a new Spanish README added. The project structure and codebase have been refactored for maintainability and global collaboration, and several new features and CLI options have been introduced.Major features and improvements:
Internationalization and Documentation
README.mdand the newREADME.es.md—migrated to English for broader accessibility. [1] [2] [3]Architecture and Codebase Refactor
core,constants,storage,io,cli, andi18nmodules for better maintainability and scalability. All internal code and comments are now in English.New Features and CLI Enhancements
--status,--list,--lang, and--versionfor direct access to key functionality without using the interactive menu. [1] [2] [3]Testing and Reliability
Backward Compatibility and Migration