Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
run: cargo fmt --check --all

- name: Clippy
run: cargo clippy --workspace -- -D warnings
run: cargo clippy --workspace --all-targets --all-features -- -D warnings

- name: Test
run: cargo test --workspace
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **Playground state in URL** - playground configs are now shareable by link via `?file=`, `?tool=`, and `?code=` querystring params (URL-safe base64 for UTF-8 content, debounced writes, capped at 6 KB to stay URL-safe).

### Changed
- **Clippy gate now covers tests and benches** - `cargo clippy` in `.github/workflows/ci.yml` and `scripts/pre-push-rust` now runs with `--all-targets --all-features`, so warnings in test, bench, and example code fail the build instead of slipping through. Surfaced and fixed 8 latent warnings: `items_after_test_module` in `agnix-cli/src/main.rs`, `unnecessary_literal_unwrap` and `Ok(...).unwrap()` in `agnix-cli/src/sarif.rs` and `agnix-core/tests/api_contract.rs` (both intentional contract tests, marked `#[allow]`), needless `<'a>` lifetime in `agnix-cli/tests/kiro_fixture_inventory.rs`, deprecated `criterion::black_box` -> `std::hint::black_box` in `agnix-core/benches/validation.rs`, `needless_borrows_for_generic_args` in `agnix-core/src/rules/cross_platform.rs` and `agnix-core/src/rules/project_level.rs` (3 sites), `unnecessary_cast` in `agnix-lsp/src/backend/tests.rs`, and unused `DiagnosticLevel` / `LintConfig` imports in `agnix-lsp/tests/lsp_integration.rs`.
- **Tool-tier list reorganised** in `CLAUDE.md` / `AGENTS.md` - split into "Validated" (the 11 tools with a per-tool validator in `crates/agnix-core/src/rules/`) and "Watchlist" (8 aspirational entries with no validator yet) so a reader can tell at a glance what agnix actually supports today. `knowledge-base/RESEARCH-TRACKING.md` aligned: Kiro CLI moved B-tier -> S-tier (matches the canonical tier list), Roo Code repo URL updated (`RooVetGit/Roo-Code` -> `RooCodeInc/Roo-Code` after upstream rename), and watchlist entries removed from the per-tier tables since they have no rules to track.
- **Search UX** - the top-right search now shows 8 inline preview hits as you type (via `searchResultLimits` on `docusaurus-search-local`) instead of only a "See all results" link.
- **Docs drift** - updated validation rule count from 385 to 399 across 20+ user-facing locations: `CLAUDE.md`, `AGENTS.md`, `README.md`, `SPEC.md`, `npm/README.md`, `crates/agnix-lsp/README.md`, `docs/EDITOR-SETUP.md`, Neovim and VS Code editor READMEs, `editors/vscode/package.json`, `editors/zed/README.md`, `knowledge-base/INDEX.md` (5 places), `knowledge-base/README.md`, `plugin/.claude-plugin/plugin.json`, `plugin/commands/agnix.md`, `plugin/skills/agnix/SKILL.md`, `skills/agnix/SKILL.md`, `crates/agnix-mcp/src/main.rs` server instructions (3 places), and website docs (intro, getting-started, contributing). `rules.json` is the source of truth; these human-written references had drifted.
- **CONTRIBUTING tone** - `CONTRIBUTING.md` and `website/docs/contributing.md` use first-person singular ("I welcome", "I want to know") since agnix is single-maintainer. Previously used "we" which implied a team.
- **Docusaurus** - bumped `@docusaurus/core` and `@docusaurus/preset-classic` from 3.9.2 to 3.10.0.

### Fixed
- **Claude Code v2.1.90 -> v2.1.117 catch-up** (#745) - `Monitor` (the new built-in tool added in v2.1.98 for streaming events from background scripts) is now in `KNOWN_AGENT_TOOLS`, so `tools: [Monitor]` in agent frontmatter no longer false-positives CC-AG-009/CC-AG-010. `xhigh` (the new effort level for Opus 4.7, added in v2.1.111) is now in `VALID_EFFORT_VALUES` and `VALID_EFFORT_LEVELS`, so `effort: xhigh` no longer false-positives CC-AG-014/CC-SK-018. The agent `color` field (display color for the task list and transcript) is now a typed field on `AgentSchema` and listed in `KNOWN_AGENT_FIELDS`, so `color: blue` no longer false-positives CC-AG-019. Documentation: bumped `verified_on` for CC-AG-009/010/011/014/019 and CC-SK-018 to 2026-04-22; added a note on CC-AG-011 and CC-AG-019 that those agent fields now also fire/load for `--agent` main-thread sessions (v2.1.116/v2.1.117); bumped `RESEARCH-TRACKING.md` "Last Reviewed" for Claude Code from 2026-02-05 to 2026-04-22.

Copilot AI Apr 22, 2026

Copy link

Choose a reason for hiding this comment

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

CHANGELOG entry mentions xhigh being added to VALID_EFFORT_VALUES, but the implementation now uses schemas::skill::VALID_EFFORT_LEVELS for both agent and skill effort validation (and there is no VALID_EFFORT_VALUES symbol left in the codebase). Update this line to reference the actual constant(s) used so the changelog stays accurate.

Copilot uses AI. Check for mistakes.
- **Clippy errors under Rust 1.95** - collapsed nested `if` blocks into match guards in `kiro_steering.rs`, `roo.rs`, and `windsurf.rs`, and switched `fixes.rs` to `sort_by_key` with `Reverse`. Resolves `collapsible_match` and `unnecessary_sort_by` lints newly enforced on stable 1.95, unblocking CI on `main` and all open PRs.
- **`[files].exclude` silently half-worked** (#722) - previously this filter ran at `resolve_file_type`, which skipped per-file validators but left project-level rules (AGM-006, XP-004/005/006) collecting vendored paths by filename during the walk. A vendored `AGENTS.md` would still fire "Nested AGENTS.md" even when excluded. `[files].exclude` now joins the walker filter alongside top-level `exclude`, so both filters share one "don't look at this path" semantic and cross-file rules honour it too.
- **Pre-commit hook rescanned the whole repo** (#723) - `agnix` now accepts multiple positional paths, and `.pre-commit-hooks.yaml` no longer forces `pass_filenames: false` + trailing `.`. pre-commit's built-in optimisation works again: only the changed files get checked, not every eligible file in the repo.
Expand Down
82 changes: 41 additions & 41 deletions crates/agnix-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -962,47 +962,6 @@ fn resolve_fix_mode(cli: &Cli) -> FixApplyMode {
}
}

#[cfg(test)]
mod resolve_fix_mode_tests {
use super::*;

#[test]
fn fix_safe_selects_safe_only_mode() {
let cli = Cli::parse_from(["agnix", "--fix-safe"]);
assert_eq!(resolve_fix_mode(&cli), FixApplyMode::SafeOnly);
}

#[test]
fn fix_unsafe_selects_all_mode() {
let cli = Cli::parse_from(["agnix", "--fix-unsafe"]);
assert_eq!(resolve_fix_mode(&cli), FixApplyMode::All);
}

#[test]
fn fix_selects_safe_and_medium_mode() {
let cli = Cli::parse_from(["agnix", "--fix"]);
assert_eq!(resolve_fix_mode(&cli), FixApplyMode::SafeAndMedium);
}

#[test]
fn dry_run_selects_safe_and_medium_mode() {
let cli = Cli::parse_from(["agnix", "--dry-run"]);
assert_eq!(resolve_fix_mode(&cli), FixApplyMode::SafeAndMedium);
}

#[test]
fn dry_run_with_fix_safe_selects_safe_only_mode() {
let cli = Cli::parse_from(["agnix", "--dry-run", "--fix-safe"]);
assert_eq!(resolve_fix_mode(&cli), FixApplyMode::SafeOnly);
}

#[test]
fn dry_run_with_fix_unsafe_selects_all_mode() {
let cli = Cli::parse_from(["agnix", "--dry-run", "--fix-unsafe"]);
assert_eq!(resolve_fix_mode(&cli), FixApplyMode::All);
}
}

fn confidence_tier_label(tier: FixConfidenceTier) -> &'static str {
match tier {
FixConfidenceTier::High => "HIGH",
Expand Down Expand Up @@ -1321,3 +1280,44 @@ fn telemetry_command(action: TelemetryAction) -> anyhow::Result<()> {

Ok(())
}

#[cfg(test)]
mod resolve_fix_mode_tests {
use super::*;

#[test]
fn fix_safe_selects_safe_only_mode() {
let cli = Cli::parse_from(["agnix", "--fix-safe"]);
assert_eq!(resolve_fix_mode(&cli), FixApplyMode::SafeOnly);
}

#[test]
fn fix_unsafe_selects_all_mode() {
let cli = Cli::parse_from(["agnix", "--fix-unsafe"]);
assert_eq!(resolve_fix_mode(&cli), FixApplyMode::All);
}

#[test]
fn fix_selects_safe_and_medium_mode() {
let cli = Cli::parse_from(["agnix", "--fix"]);
assert_eq!(resolve_fix_mode(&cli), FixApplyMode::SafeAndMedium);
}

#[test]
fn dry_run_selects_safe_and_medium_mode() {
let cli = Cli::parse_from(["agnix", "--dry-run"]);
assert_eq!(resolve_fix_mode(&cli), FixApplyMode::SafeAndMedium);
}

#[test]
fn dry_run_with_fix_safe_selects_safe_only_mode() {
let cli = Cli::parse_from(["agnix", "--dry-run", "--fix-safe"]);
assert_eq!(resolve_fix_mode(&cli), FixApplyMode::SafeOnly);
}

#[test]
fn dry_run_with_fix_unsafe_selects_all_mode() {
let cli = Cli::parse_from(["agnix", "--dry-run", "--fix-unsafe"]);
assert_eq!(resolve_fix_mode(&cli), FixApplyMode::All);
}
}
4 changes: 2 additions & 2 deletions crates/agnix-cli/src/sarif.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,8 @@ mod tests {
fn test_find_git_root_none_fallback_to_cwd() {
// When find_git_root returns None (no git repo), callers fall back
// to CWD canonicalization. Verify the fallback pattern works.
let result: Option<PathBuf> = None;
let fallback = result
#[allow(clippy::unnecessary_literal_unwrap)] // intentional: pinning the fallback shape
let fallback: PathBuf = Option::<PathBuf>::None
.unwrap_or_else(|| std::fs::canonicalize(".").unwrap_or_else(|_| PathBuf::from(".")));
assert!(
fallback.is_absolute(),
Expand Down
2 changes: 1 addition & 1 deletion crates/agnix-cli/tests/kiro_fixture_inventory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ fn run_agnix_json(target: &Path) -> Value {
})
}

fn json_u64<'a>(json: &'a Value, key: &str, fixture_path: &Path) -> u64 {
fn json_u64(json: &Value, key: &str, fixture_path: &Path) -> u64 {
json.get(key).and_then(Value::as_u64).unwrap_or_else(|| {
panic!(
"Expected numeric {} in JSON output for {}",
Expand Down
3 changes: 2 additions & 1 deletion crates/agnix-core/benches/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

mod fixtures;

use criterion::{BenchmarkId, Criterion, Throughput, black_box, criterion_group, criterion_main};
use criterion::{BenchmarkId, Criterion, Throughput, criterion_group, criterion_main};
use std::hint::black_box;
use std::path::Path;
use tempfile::TempDir;

Expand Down
20 changes: 10 additions & 10 deletions crates/agnix-core/src/fixes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ mod tests {

// Sort descending by start_byte (as apply_fixes does)
let mut sorted = fix_refs.clone();
sorted.sort_by(|a, b| b.start_byte.cmp(&a.start_byte));
sorted.sort_by_key(|b| std::cmp::Reverse(b.start_byte));

let (result, applied) = apply_fixes_to_content(content, &sorted);

Expand All @@ -409,7 +409,7 @@ mod tests {

// Sort descending (8-11 first, then 0-3)
let mut sorted: Vec<&Fix> = fixes.iter().collect();
sorted.sort_by(|a, b| b.start_byte.cmp(&a.start_byte));
sorted.sort_by_key(|b| std::cmp::Reverse(b.start_byte));

let (result, _) = apply_fixes_to_content(content, &sorted);

Expand Down Expand Up @@ -511,7 +511,7 @@ mod tests {
let diagnostics = [&diagnostic];
let selected = select_fixes(&diagnostics, FixApplyMode::All);
let mut refs = selected;
refs.sort_by(|a, b| b.start_byte.cmp(&a.start_byte));
refs.sort_by_key(|b| std::cmp::Reverse(b.start_byte));
let (selected_fixed, selected_applied) = apply_fixes_to_content(content, &refs);

assert_eq!(fixed, "hello?!");
Expand All @@ -528,13 +528,13 @@ mod tests {
let orphan = Fix::replace(0, 3, "XXX", "orphan", true).with_dependency("missing");

let mut refs = vec![&prerequisite, &dependent];
refs.sort_by(|a, b| b.start_byte.cmp(&a.start_byte));
refs.sort_by_key(|b| std::cmp::Reverse(b.start_byte));
let (fixed, applied) = apply_fixes_to_content(content, &refs);
assert_eq!(fixed, "FOO BAR");
assert_eq!(applied, vec!["normalize-head", "normalize-tail"]);

let mut orphan_refs = vec![&orphan];
orphan_refs.sort_by(|a, b| b.start_byte.cmp(&a.start_byte));
orphan_refs.sort_by_key(|b| std::cmp::Reverse(b.start_byte));
let (orphan_fixed, orphan_applied) = apply_fixes_to_content(content, &orphan_refs);
assert_eq!(orphan_fixed, content);
assert!(orphan_applied.is_empty());
Expand All @@ -548,7 +548,7 @@ mod tests {

// Descending sort puts dependent first, but dependency should still be satisfied.
let mut refs = vec![&prerequisite, &dependent];
refs.sort_by(|a, b| b.start_byte.cmp(&a.start_byte));
refs.sort_by_key(|b| std::cmp::Reverse(b.start_byte));
let (fixed, applied) = apply_fixes_to_content(content, &refs);

assert_eq!(fixed, "FOO BAR");
Expand All @@ -563,7 +563,7 @@ mod tests {
Fix::replace(4, 7, "BAR", "normalize-tail", true).with_dependency("normalize-head");

let mut refs = vec![&prerequisite, &dependent];
refs.sort_by(|a, b| b.start_byte.cmp(&a.start_byte));
refs.sort_by_key(|b| std::cmp::Reverse(b.start_byte));
let (fixed, applied) = apply_fixes_to_content(content, &refs);

assert_eq!(fixed, "FOO BAR");
Expand All @@ -578,7 +578,7 @@ mod tests {
let dependent = Fix::replace(4, 7, "BAR", "normalize-tail", true).with_dependency("step1");

let mut refs = vec![&prerequisite, &dependent];
refs.sort_by(|a, b| b.start_byte.cmp(&a.start_byte));
refs.sort_by_key(|b| std::cmp::Reverse(b.start_byte));
let (fixed, applied) = apply_fixes_to_content(content, &refs);

assert_eq!(fixed, content);
Expand Down Expand Up @@ -715,7 +715,7 @@ mod tests {
];

let mut sorted: Vec<&Fix> = fixes.iter().collect();
sorted.sort_by(|a, b| b.start_byte.cmp(&a.start_byte));
sorted.sort_by_key(|b| std::cmp::Reverse(b.start_byte));

let (result, applied) = apply_fixes_to_content(content, &sorted);

Expand Down Expand Up @@ -975,7 +975,7 @@ mod tests {
];
let mut fix_refs: Vec<&Fix> = fixes.iter().collect();
// `apply_fixes_to_content` expects fixes to be sorted descending by start_byte.
fix_refs.sort_by(|a, b| b.start_byte.cmp(&a.start_byte));
fix_refs.sort_by_key(|b| std::cmp::Reverse(b.start_byte));

let (result, applied) = apply_fixes_to_content(content, &fix_refs);

Expand Down
73 changes: 51 additions & 22 deletions crates/agnix-core/src/rules/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use crate::{
rules::{Validator, ValidatorMetadata},
schemas::agent::AgentSchema,
schemas::hooks::HooksSchema,
schemas::skill::VALID_EFFORT_LEVELS,
validation::is_valid_mcp_tool_format,
};
use rust_i18n::t;
Expand Down Expand Up @@ -74,8 +75,9 @@ const VALID_PERMISSION_MODES: &[&str] = &[
/// Valid memory scopes per CC-AG-008
const VALID_MEMORY_SCOPES: &[&str] = &["user", "project", "local"];

/// Valid effort values per CC-AG-014
const VALID_EFFORT_VALUES: &[&str] = &["low", "medium", "high", "max"];
// Valid effort values per CC-AG-014: shared with CC-SK-018 via
// schemas::skill::VALID_EFFORT_LEVELS so agent and skill effort lists
// stay in lock-step (Claude Code uses the same set for both).

/// Valid isolation values per CC-AG-015
const VALID_ISOLATION_VALUES: &[&str] = &["worktree"];
Expand All @@ -98,6 +100,7 @@ const KNOWN_AGENT_FIELDS: &[&str] = &[
"skills",
"hooks",
"mode",
"color",
];

/// Known Claude Code tools for CC-AG-009 and CC-AG-010
Expand All @@ -121,6 +124,7 @@ const KNOWN_AGENT_TOOLS: &[&str] = &[
"Skill",
"StatusBarMessageTool",
"TaskOutput",
"Monitor",
];

const RULE_IDS: &[&str] = &[
Expand Down Expand Up @@ -915,8 +919,8 @@ impl Validator for AgentValidator {
// CC-AG-014: Invalid effort value
if config.is_rule_enabled("CC-AG-014") {
if let Some(effort) = &schema.effort {
if !VALID_EFFORT_VALUES.contains(&effort.as_str()) {
let valid_display = VALID_EFFORT_VALUES.join(", ");
if !VALID_EFFORT_LEVELS.contains(&effort.as_str()) {
let valid_display = VALID_EFFORT_LEVELS.join(", ");
let mut diagnostic = Diagnostic::error(
path.to_path_buf(),
1,
Expand All @@ -931,7 +935,7 @@ impl Validator for AgentValidator {

// Unsafe auto-fix: replace with closest valid effort value
if let Some(closest) =
super::find_closest_value(effort.as_str(), VALID_EFFORT_VALUES)
super::find_closest_value(effort.as_str(), VALID_EFFORT_LEVELS)
{
if let Some((start, end)) =
frontmatter_value_byte_range_from_parts(&parts, "effort")
Expand Down Expand Up @@ -3774,25 +3778,50 @@ Body";
}

#[test]
fn test_effort_valid_values() {
for e in &["low", "medium", "high", "max"] {
let c = format!(
"---
fn test_monitor_tool_accepted() {
// tools: list (CC-AG-009)
let c = "---
name: a
description: b
effort: {}
tools: [Monitor]
---
Body",
e
);
let d = validate(&c);
assert_eq!(
d.iter().filter(|x| x.rule == "CC-AG-014").count(),
0,
"Valid effort '{}' should not trigger CC-AG-014",
e
);
}
Body";
let d = validate(c);
assert_eq!(
d.iter().filter(|x| x.rule == "CC-AG-009").count(),
0,
"Monitor tool should not trigger CC-AG-009 (added in Claude Code v2.1.98)"
);
Comment on lines +3790 to +3794

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

The PR description mentions that the Monitor tool should no longer trigger CC-AG-009 or CC-AG-010. This test only verifies CC-AG-009. Consider adding a check for CC-AG-010 to ensure both conditions are covered.

        assert_eq!(
            d.iter().filter(|x| x.rule == "CC-AG-009").count(),
            0,
            "Monitor tool should not trigger CC-AG-009 (added in Claude Code v2.1.98)"
        );
        assert_eq!(
            d.iter().filter(|x| x.rule == "CC-AG-010").count(),
            0,
            "Monitor tool should not trigger CC-AG-010"
        );


// disallowedTools list (CC-AG-010) - same KNOWN_AGENT_TOOLS list
let c2 = "---
name: a
description: b
disallowedTools: [Monitor]
---
Body";
let d2 = validate(c2);
assert_eq!(
d2.iter().filter(|x| x.rule == "CC-AG-010").count(),
0,
"Monitor tool should not trigger CC-AG-010 in disallowedTools"
);
}

#[test]
fn test_color_field_accepted() {
let c = "---
name: a
description: b
color: blue
---
Body";
let d = validate(c);
assert_eq!(
d.iter().filter(|x| x.rule == "CC-AG-019").count(),
0,
"color field should not trigger CC-AG-019 unknown-field"
);
}

#[test]
Expand Down Expand Up @@ -3898,7 +3927,7 @@ Agent instructions"#;

#[test]
fn test_cc_ag_014_all_valid_effort_values() {
for effort in VALID_EFFORT_VALUES {
for effort in VALID_EFFORT_LEVELS {
let content = format!(
"---\nname: test\ndescription: Test agent\neffort: {}\n---\nBody",
effort
Expand Down
2 changes: 1 addition & 1 deletion crates/agnix-core/src/rules/cross_platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,7 @@ Use context: fork for subagents.
let content = "# Project\n\nShort content.";
let validator = CrossPlatformValidator;
let diagnostics =
validator.validate(Path::new("AGENTS.md"), &content, &LintConfig::default());
validator.validate(Path::new("AGENTS.md"), content, &LintConfig::default());

let xp_007: Vec<_> = diagnostics.iter().filter(|d| d.rule == "XP-007").collect();
assert!(xp_007.is_empty());
Expand Down
4 changes: 2 additions & 2 deletions crates/agnix-core/src/rules/project_level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,14 +440,14 @@ mod tests {
assert!(
nested_diag
.message
.contains(&root_agents.to_string_lossy().as_ref()),
.contains(root_agents.to_string_lossy().as_ref()),
"Nested file's message should list the root AGENTS.md path, got: {}",
nested_diag.message
);
assert!(
root_diag
.message
.contains(&nested_agents.to_string_lossy().as_ref()),
.contains(nested_agents.to_string_lossy().as_ref()),
"Root file's message should list the nested AGENTS.md path, got: {}",
root_diag.message
);
Expand Down
Loading
Loading