Skip to content

refactor(core): narrow public API surface (#85) - #156

Merged
avifenesh merged 4 commits into
mainfrom
feature/narrow-api-surface-85
Feb 4, 2026
Merged

refactor(core): narrow public API surface (#85)#156
avifenesh merged 4 commits into
mainfrom
feature/narrow-api-surface-85

Conversation

@avifenesh

@avifenesh avifenesh commented Feb 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Made parsers, rules, schemas, and file_utils modules private in agnix-core
  • Re-exported Validator trait for custom validator implementations via ValidatorRegistry
  • Removed unused pub use re-exports from private modules
  • Added #[allow(dead_code)] to internal modules to preserve items for future use
  • No breaking changes for agnix-cli or external consumers using the documented API

Changes

  • crates/agnix-core/src/lib.rs:
    • Line 15: pub mod file_utils;mod file_utils;
    • Line 17: pub mod parsers;mod parsers;
    • Line 18: pub mod rules;mod rules;
    • Line 19: pub mod schemas;mod schemas;
    • Line 29: use rules::Validator;pub use rules::Validator;
  • crates/agnix-core/src/parsers/mod.rs: Removed unused re-exports, added #[allow(dead_code)]
  • crates/agnix-core/src/schemas/mod.rs: Removed unused re-exports, added #[allow(dead_code)]
  • crates/agnix-core/src/rules/skill.rs: Fixed import path for SkillSchema

Test Plan

  • cargo check passes
  • cargo clippy -- -D warnings passes
  • cargo test - all 763 tests pass
  • cargo build --release succeeds
  • CLI still works with narrowed API

Related Issues

Closes #85

Copilot AI review requested due to automatic review settings February 4, 2026 11:10
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @avifenesh, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the agnix-core crate by significantly narrowing its public API surface. The primary goal is to improve the internal structure and maintainability of the core library by making several modules private, thus reducing the exposed interface. Concurrently, it ensures that essential functionalities, such as the Validator trait for custom implementations, remain accessible to external users without introducing breaking changes.

Highlights

  • API Surface Narrowing: The parsers, rules, and schemas modules within agnix-core have been changed from public to private, enhancing encapsulation and controlling the crate's external interface.
  • Validator Trait Re-export: The Validator trait has been explicitly re-exported, ensuring that custom validator implementations can still be created and used by external consumers through the ValidatorRegistry.
  • Backward Compatibility: These changes are non-breaking for agnix-cli and other external consumers that adhere to the documented public API, maintaining stability.
Changelog
  • CHANGELOG.md
    • Added a new 'Changed' section detailing the narrowing of the agnix-core public API, including making parsers, rules, and schemas modules private, and re-exporting the Validator trait.
  • crates/agnix-core/src/lib.rs
    • Modified module declarations for parsers, rules, and schemas from pub mod to mod, making them private to the crate.
    • Changed the use rules::Validator; statement to pub use rules::Validator; to explicitly re-export the Validator trait.
Activity
  • The author has confirmed that cargo check passes, ensuring no compilation errors.
  • All 744 cargo test cases pass, indicating no regressions in functionality.
  • A cargo build --release successfully completes, verifying release build integrity.
  • The CLI functionality has been tested and confirmed to work correctly with the narrowed API.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request is a good step towards improving the encapsulation of agnix-core by narrowing its public API. The changes to make parsers, rules, and schemas modules private are correct, and re-exporting the Validator trait is the right approach to allow for custom validator implementations. I have one suggestion to potentially extend this refactoring to another module.

Comment on lines +17 to +19
mod parsers;
mod rules;
mod schemas;

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.

medium

This is a great refactoring to narrow the public API surface. In the same spirit, have you considered also making the file_utils module on line 15 private? It seems to be an internal utility, and making it private would further improve encapsulation. If it's intended to be part of the public API, perhaps it could be documented as such.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good suggestion! Applied in commit 413c841 - file_utils is now also private since it's not used by external consumers.

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 narrows the public API surface of agnix-core by making internal implementation modules private while maintaining the stable public API and extensibility points.

Changes:

  • Made parsers, rules, and schemas modules private to prevent coupling to internal implementation details
  • Re-exported the Validator trait to enable custom validator implementations via ValidatorRegistry
  • Updated CHANGELOG to document the API refinement

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
crates/agnix-core/src/lib.rs Made three internal modules (parsers, rules, schemas) private and re-exported Validator trait for public extensibility
CHANGELOG.md Added entry documenting the API surface narrowing under the "Changed" section

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Make parsers, rules, and schemas modules private
- Re-export Validator trait to maintain extensibility for custom validators
Address review feedback from gemini-code-assist: file_utils is an
internal utility not used by external consumers, so it should be
private alongside parsers, rules, and schemas.
@avifenesh
avifenesh force-pushed the feature/narrow-api-surface-85 branch from 413c841 to 871e36b Compare February 4, 2026 11:16
- Remove unused pub use re-exports from parsers/mod.rs and schemas/mod.rs
- Fix SkillSchema import path to use direct module path
- Add #[allow(dead_code)] to internal modules (parsers, schemas)

The dead code warnings appeared because these modules are now private
and some items were only "used" via the public API surface. The items
are preserved for future use and internal consistency.
Copilot AI review requested due to automatic review settings February 4, 2026 11:19
@claude

claude Bot commented Feb 4, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

Note: Per CLAUDE.md Critical Rule #11, this PR should not be merged until the claude-review workflow completes successfully.

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 5 out of 5 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

pub mod config;
pub mod diagnostics;
pub mod file_utils;
mod file_utils;

Copilot AI Feb 4, 2026

Copy link

Choose a reason for hiding this comment

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

The PR description mentions only making parsers, rules, and schemas modules private, but the diff also shows file_utils being made private (line 15). The CHANGELOG correctly documents this change, but the PR description should be updated to match.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good catch! Updated the PR description to include file_utils. Thanks for the review.

@claude

claude Bot commented Feb 4, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@avifenesh
avifenesh merged commit f5ede8c into main Feb 4, 2026
20 checks passed
@avifenesh
avifenesh deleted the feature/narrow-api-surface-85 branch February 5, 2026 12:48
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.

Narrow agnix-core public API surface

2 participants