Skip to content

Refactor init#5

Merged
jnfire merged 14 commits into
mainfrom
refactor_init
Apr 20, 2026
Merged

Refactor init#5
jnfire merged 14 commits into
mainfrom
refactor_init

Conversation

@jnfire

@jnfire jnfire commented Apr 19, 2026

Copy link
Copy Markdown
Owner

This pull request introduces a major new version (v0.2.0) of the time-balance project, 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

  • Full UI translation with automatic language detection (English and Spanish), and all documentation—including README.md and the new README.es.md—migrated to English for broader accessibility. [1] [2] [3]

Architecture and Codebase Refactor

  • Modular architecture introduced, splitting code into core, constants, storage, io, cli, and i18n modules for better maintainability and scalability. All internal code and comments are now in English.

New Features and CLI Enhancements

  • Added new CLI flags: --status, --list, --lang, and --version for direct access to key functionality without using the interactive menu. [1] [2] [3]
  • Each history file now stores its own project name and base workday configuration, supporting multi-project workflows.

Testing and Reliability

  • Introduced a modular test suite with 17 automated tests to validate logic and translations, and improved atomic write operations for cross-filesystem compatibility.

Backward Compatibility and Migration

  • Automatic migration for legacy history files (v0.1.x) to the new v0.2.0 format, ensuring a smooth upgrade path for existing users.

Copilot AI review requested due to automatic review settings April 19, 2026 15:57

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread time_balance/storage.py Outdated
Comment thread time_balance/storage.py Outdated
Comment thread docs/ARCHITECTURE.md Outdated
Comment thread docs/DEVELOPMENT.md Outdated
Comment thread time_balance/i18n.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and i18n, keeping a facade API in time_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.

Comment thread time_balance/storage.py
Comment thread time_balance/cli.py Outdated
Comment thread time_balance/i18n.py Outdated
Comment thread docs/ARCHITECTURE.md
Comment thread docs/DEVELOPMENT.md
Comment thread docs/es/ARCHITECTURE.es.md Outdated
Comment thread time_balance/storage.py Outdated
Comment thread docs/es/DEVELOPMENT.es.md Outdated
Comment thread time_balance/storage.py Outdated
Comment thread time_balance/storage.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread time_balance/storage.py
Comment thread time_balance/io.py Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@jnfire jnfire merged commit ec4707e into main Apr 20, 2026
1 check passed
@jnfire jnfire deleted the refactor_init branch April 20, 2026 14:20
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.

2 participants