Skip to content

Refactor to Library-First Architecture - #7

Merged
LimaniBhavik merged 1 commit into
mainfrom
refactor-library-first-arch-15744564153439444297
Jan 30, 2026
Merged

LimaniBhavik merged 1 commit into
mainfrom
refactor-library-first-arch-15744564153439444297

Conversation

@LimaniBhavik

Copy link
Copy Markdown
Owner

This massive refactoring aligns the gananayantra-rusting crate with the "Library-first" philosophy.

Key Changes:

  1. Pure Functions: All calculator logic (ROI, BMI, Loans, Physics, etc.) has been extracted from interactive run() menus into public, pure functions that take arguments and return Result<T, String>.
  2. Removal of I/O: All println! and stdin calls have been removed from src/.
  3. Module Cleanup:
    • Deleted src/auto (migrated logic to finance).
    • Deleted src/calculators (internal utils no longer needed for library).
    • Updated mod.rs files to flatten the API (e.g., use gananayantra::finance::business_loan).
  4. Examples: Updated examples/ to demonstrate the new API usage without CLI interactions.

Verification:

  • cargo check passes.
  • cargo test passes (43 tests).
  • Examples compile and run successfully.

PR created automatically by Jules for task 15744564153439444297 started by @LimaniBhavik

- Removed all CLI/IO logic (println!, read_input) from library modules.
- Converted all calculators in `finance`, `health`, `energy`, `geo`, `water`, `space`, `math`, `specialized`, `utilities`, and `utility_lifestyle` to pure functions returning `Result`.
- Deleted legacy `src/auto` and `src/calculators` directories.
- Moved auto loan logic to `src/finance/auto_loans.rs`.
- Updated `src/lib.rs` to export modules correctly.
- Updated all `examples/` to use the new pure API.
- Fixed compilation errors and verified with tests.
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@LimaniBhavik
LimaniBhavik merged commit e386f84 into main Jan 30, 2026
1 check passed
@LimaniBhavik
LimaniBhavik deleted the refactor-library-first-arch-15744564153439444297 branch January 30, 2026 16:35
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