Skip to content

Commit f5ede8c

Browse files
authored
refactor(core): narrow public API surface (#85) (#156)
* refactor(core): narrow public API surface (#85) - Make parsers, rules, and schemas modules private - Re-export Validator trait to maintain extensibility for custom validators * docs: add changelog entry for API surface narrowing (#85) * refactor(core): also make file_utils module private 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. * fix: address clippy warnings after making modules private - 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.
1 parent 0602856 commit f5ede8c

5 files changed

Lines changed: 22 additions & 15 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Changed
11+
- Narrowed agnix-core public API surface (#85)
12+
- Made `parsers`, `rules`, `schemas`, and `file_utils` modules private
13+
- Re-exported `Validator` trait for custom validator implementations
14+
- No breaking changes for agnix-cli or external consumers using documented API
15+
1016
### Removed
1117
- Removed unused config flags `tool_names` and `required_fields` from `.agnix.toml`
1218
- These flags were never referenced in the codebase

crates/agnix-core/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
1313
pub mod config;
1414
pub mod diagnostics;
15-
pub mod file_utils;
15+
mod file_utils;
1616
pub mod fixes;
17-
pub mod parsers;
18-
pub mod rules;
19-
pub mod schemas;
17+
mod parsers;
18+
mod rules;
19+
mod schemas;
2020

2121
use std::collections::HashMap;
2222
use std::path::{Path, PathBuf};
@@ -26,7 +26,7 @@ use rayon::prelude::*;
2626
pub use config::LintConfig;
2727
pub use diagnostics::{Diagnostic, DiagnosticLevel, Fix, LintError, LintResult};
2828
pub use fixes::{apply_fixes, FixResult};
29-
use rules::Validator;
29+
pub use rules::Validator;
3030

3131
/// Result of validating a project, including diagnostics and metadata.
3232
#[derive(Debug, Clone)]

crates/agnix-core/src/parsers/mod.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
//! File parsers for different config formats
2+
//!
3+
//! This module is internal to agnix-core. Some items may not be used
4+
//! directly but are preserved for potential future use or extensibility.
5+
6+
#![allow(dead_code)]
27

38
pub mod frontmatter;
49
pub mod json;
510
pub mod markdown;
6-
7-
pub use frontmatter::{parse_frontmatter, split_frontmatter, FrontmatterParts};
8-
pub use json::parse_json_config;

crates/agnix-core/src/rules/skill.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::{
55
diagnostics::{Diagnostic, Fix},
66
parsers::frontmatter::{split_frontmatter, FrontmatterParts},
77
rules::Validator,
8-
schemas::SkillSchema,
8+
schemas::skill::SkillSchema,
99
};
1010
use regex::Regex;
1111
use serde::Deserialize;
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
//! Schema definitions for agent config files
2+
//!
3+
//! This module is internal to agnix-core. Some items may not be used
4+
//! directly but are preserved for potential future use or extensibility.
5+
6+
#![allow(dead_code)]
27

38
pub mod agent;
49
pub mod agents_md;
@@ -10,9 +15,3 @@ pub mod mcp;
1015
pub mod plugin;
1116
pub mod prompt;
1217
pub mod skill;
13-
14-
pub use agent::AgentSchema;
15-
pub use hooks::HooksSchema;
16-
pub use mcp::McpToolSchema;
17-
pub use plugin::PluginSchema;
18-
pub use skill::SkillSchema;

0 commit comments

Comments
 (0)