Skip to content

Add Kiro file type detection surfaces#611

Merged
avifenesh merged 7 commits intomainfrom
feature/add-kiro-file-type-detection-594
Mar 2, 2026
Merged

Add Kiro file type detection surfaces#611
avifenesh merged 7 commits intomainfrom
feature/add-kiro-file-type-detection-594

Conversation

@avifenesh
Copy link
Collaborator

@avifenesh avifenesh commented Mar 2, 2026

Summary

  • add KiroPower, KiroAgent, KiroHook, and KiroMcp file types to the core enum and registry coverage
  • implement Kiro detection routing in detect_file_type with case-insensitive path handling and MCP/agent guardrails
  • expand detection + contract tests and update Kiro fixture inventory baselines to assert representative exact file-type mapping
  • move Kiro power fixtures to realistic .kiro/powers/... paths and add .kiro/settings/mcp.json fixture coverage
  • document the change in changelog and fixture README

Testing

  • cargo build -p agnix-cli
  • cargo test -p agnix-core --test api_contract file_type_enum_covers_all_variants
  • cargo test -p agnix-core file_types::detection::tests::detect_kiro
  • cargo test -p agnix-core registry::tests::every_validatable_file_type_has_at_least_one_validator
  • cargo test -p agnix-cli --test kiro_fixture_inventory

Closes #594

Summary by CodeRabbit

  • New Features

    • Added detection support for four new Kiro file types: Kiro Power, Kiro Agent, Kiro Hook, and Kiro MCP servers, enabling proper routing through the validation pipeline.
    • Updated fixture organization to reflect new Kiro file type structures.
  • Tests

    • Expanded test coverage for Kiro file type detection and validator routing with updated fixtures.

Copilot AI review requested due to automatic review settings March 2, 2026 15:01
@coderabbitai
Copy link

coderabbitai bot commented Mar 2, 2026

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

📥 Commits

Reviewing files that changed from the base of the PR and between e0ac56e and fde1e1c.

📒 Files selected for processing (2)
  • crates/agnix-core/src/file_types/detection.rs
  • crates/agnix-core/src/registry.rs
 _____________________________________________________________
< All programming is an exercise in caching. - Terje Mathisen >
 -------------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ

✏️ Tip: You can disable in-progress messages and the fortune message in your review settings.

📝 Walkthrough

Walkthrough

This PR adds four new Kiro file type detection variants (KiroPower, KiroAgent, KiroHook, KiroMcp) to expand file type coverage. Detection logic recognizes patterns for power definitions, agent configs, hook files, and MCP settings. New types are registered in the validation registry with appropriate validators and tested against updated fixtures.

Changes

Cohort / File(s) Summary
Type Definitions
crates/agnix-core/src/file_types/types.rs, crates/agnix-core/tests/api_contract.rs
Added four new FileType enum variants (KiroPower, KiroAgent, KiroHook, KiroMcp) with Display implementations and updated exhaustive tests to include new variants (variant count: 38→42).
Detection Logic
crates/agnix-core/src/file_types/detection.rs
Introduced case-insensitive string helpers and new private detection helper is_kiro_power(). Expanded detect_file_type() to recognize Kiro-related file types with pattern matching for .kiro/ subdirectories and POWER.md files.
Registry & Validation
crates/agnix-core/src/registry.rs
Registered KiroPower, KiroAgent, KiroHook with ImportsValidator and KiroMcp with McpValidator in MiscProvider. Updated test counts to reflect new mappings (validatable types: 37→41, builtin count: 62→66).
Test Fixtures & Inventory
crates/agnix-cli/tests/kiro_fixture_inventory.rs
Updated fixture paths to .kiro-prefixed locations, adjusted expected file counts for detection baselines, and added new test kiro_fixture_representatives_map_to_expected_file_types() mapping fixture paths to FileType enums.
Fixture Files & Documentation
tests/fixtures/README.md, tests/fixtures/kiro-mcp/.kiro/settings/mcp.json
Updated fixture path references in documentation table (e.g., kiro-powers/.kiro/powers/...) and added new MCP configuration fixture file with mcpServers definition.
Changelog
CHANGELOG.md
Added entry documenting new Kiro file type detection expansion with dedicated detectors and registry coverage.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Four new Kiro types hop into the fold,
Powers, agents, hooks—a story retold,
Detection patterns guide the registry's way,
Each fixture dances in .kiro/ array,
Validation routes flow—the schema stays bright! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'Add Kiro file type detection surfaces' accurately summarizes the main change—adding four new Kiro file types (KiroPower, KiroAgent, KiroHook, KiroMcp) to the detection system.
Linked Issues check ✅ Passed All objectives from issue #594 are met: four new FileType variants added, detection logic implemented with case-insensitive handling, validators registered in registry with proper routing, and comprehensive test coverage added.
Out of Scope Changes check ✅ Passed All changes are directly related to issue #594 objectives. Modifications include the three targeted files plus fixtures, tests, documentation, and changelog updates aligned with the scope.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/add-kiro-file-type-detection-594

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 significantly enhances the system's ability to recognize and validate various Kiro-related configuration files. By introducing dedicated file types and precise detection logic, it ensures that Kiro powers, agents, hooks, and MCP settings are correctly identified and routed through the appropriate validation pipelines. This improvement is supported by comprehensive test updates and fixture reorganizations, laying a solid foundation for future Kiro-specific tooling and checks.

Highlights

  • New Kiro File Types: Added KiroPower, KiroAgent, KiroHook, and KiroMcp file types to the core enum and registry, enabling specific validation for these new Kiro-related configurations.
  • Enhanced File Type Detection: Implemented robust detection logic for the new Kiro file types within detect_file_type, incorporating case-insensitive path handling and specific guardrails for MCP and agent files.
  • Fixture Updates and Testing: Expanded detection and contract tests to cover the new Kiro file types, updated Kiro fixture inventory baselines, and moved Kiro power fixtures to a more realistic .kiro/powers/... directory structure. A new .kiro/settings/mcp.json fixture was also added.
  • Changelog and Documentation: Documented the addition of Kiro file type detection in the CHANGELOG.md and updated the fixture README.md to reflect the new paths and testing coverage.
Changelog
  • CHANGELOG.md
    • Added an entry documenting the expansion of Kiro file type detection.
  • crates/agnix-cli/tests/kiro_fixture_inventory.rs
    • Imported FileType enum for use in tests.
    • Updated required_paths to reflect new .kiro/powers fixture locations and added a new mcp.json fixture.
    • Adjusted expected file counts for Kiro fixture families.
    • Modified should_be_detected logic to include new Kiro agent, hook, and MCP paths.
    • Added a new test kiro_fixture_representatives_map_to_expected_file_types to assert explicit file type mapping for Kiro fixtures.
  • crates/agnix-core/src/file_types/detection.rs
    • Introduced ends_with_ignore_ascii_case and starts_with_ignore_ascii_case helper functions for case-insensitive string comparisons.
    • Updated is_under_agents_checks to use path_contains_consecutive_components for consistency.
    • Added is_kiro_power function to detect Kiro power definition paths.
    • Implemented new detection rules for KiroPower, KiroAgent, KiroHook, and KiroMcp based on file names and directory structure, including case-insensitive checks.
    • Updated existing detection logic for CursorAgent and KiroSteering to use ends_with_ignore_ascii_case.
    • Modified various parent_eq_ignore_ascii_case checks to ensure case-insensitivity for GitHub Copilot and Roo Code related file types.
    • Added extensive new test cases to verify the correct detection of KiroPower, KiroAgent, KiroHook, and KiroMcp file types, including scenarios for correct and incorrect paths and case variations.
  • crates/agnix-core/src/file_types/types.rs
    • Added new FileType enum variants: KiroPower, KiroAgent, KiroHook, and KiroMcp.
    • Updated the fmt::Display implementation to include string representations for the new Kiro file types.
    • Modified internal test arrays to include the newly added Kiro file types.
  • crates/agnix-core/src/registry.rs
    • Updated EXPECTED_BUILTIN_COUNT to reflect the addition of new validators.
    • Registered ImportsValidator for KiroPower, KiroAgent, and KiroHook file types.
    • Registered McpValidator for the KiroMcp file type.
    • Adjusted test arrays (validatable_types) to include the new Kiro file types.
    • Added a new test kiro_file_types_route_to_expected_validators to verify that Kiro file types are correctly routed to their assigned validators.
    • Updated misc_provider_count test to reflect the increased number of named validators.
  • crates/agnix-core/tests/api_contract.rs
    • Updated the file_type_enum_covers_all_variants test to include the new KiroPower, KiroAgent, KiroHook, and KiroMcp variants and adjusted the expected variant count from 38 to 42.
  • tests/fixtures/README.md
    • Updated the table for Kiro Powers and Kiro MCP to reflect the new .kiro/powers and .kiro/settings directory structures for example paths.
    • Revised the note about Kiro fixture packs to mention detection baselines and representative file-type assertions.
  • tests/fixtures/kiro-mcp/.kiro/settings/mcp.json
    • Added a new Kiro MCP settings fixture file.
  • tests/fixtures/kiro-powers/.kiro/powers/bad-mcp/POWER.md
    • Renamed Kiro power fixture to conform to the new .kiro/powers directory structure.
  • tests/fixtures/kiro-powers/.kiro/powers/bad-mcp/mcp.json
    • Renamed Kiro power fixture to conform to the new .kiro/powers directory structure.
  • tests/fixtures/kiro-powers/.kiro/powers/empty-body/POWER.md
    • Renamed Kiro power fixture to conform to the new .kiro/powers directory structure.
  • tests/fixtures/kiro-powers/.kiro/powers/empty-keywords/POWER.md
    • Renamed Kiro power fixture to conform to the new .kiro/powers directory structure.
  • tests/fixtures/kiro-powers/.kiro/powers/missing-frontmatter/POWER.md
    • Renamed Kiro power fixture to conform to the new .kiro/powers directory structure.
  • tests/fixtures/kiro-powers/.kiro/powers/valid-power/POWER.md
    • Renamed Kiro power fixture to conform to the new .kiro/powers directory structure.
  • tests/fixtures/kiro-powers/.kiro/powers/valid-power/mcp.json
    • Renamed Kiro power fixture to conform to the new .kiro/powers directory structure.
Activity
  • The author provided a detailed summary of the changes in the pull request description.
  • The author outlined specific testing steps, including cargo build -p agnix-cli, cargo test -p agnix-core --test api_contract file_type_enum_covers_all_variants, cargo test -p agnix-core file_types::detection::tests::detect_kiro, cargo test -p agnix-core registry::tests::every_validatable_file_type_has_at_least_one_validator, and cargo test -p agnix-cli --test kiro_fixture_inventory.
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.

Copy link
Contributor

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

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 effectively expands Kiro file type support by adding KiroPower, KiroAgent, KiroHook, and KiroMcp to the core FileType enum and implementing their detection logic. The changes are well-supported by new and updated tests, including more realistic fixture paths and contract tests to ensure correct file type mapping. The introduction of case-insensitive path helpers is a nice touch for robustness. I have one suggestion to improve the readability of the new detection logic. Overall, this is a solid contribution.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
crates/agnix-core/src/file_types/detection.rs (1)

1344-1468: Add explicit uppercase .KIRO/... test cases for all new Kiro detectors.

The current tests validate the main paths, but Line 1344 onward would be more regression-resistant with direct uppercase directory assertions for power/agent/hook/mcp routes.

Suggested test hardening
@@ fn detect_kiro_power_from_dot_kiro_powers_path() {
         assert_eq!(
             detect_file_type(Path::new(".kiro/powers/deploy/POWER.md")),
             FileType::KiroPower
         );
+        assert_eq!(
+            detect_file_type(Path::new(".KIRO/POWERS/deploy/POWER.md")),
+            FileType::KiroPower
+        );
@@ fn detect_kiro_agent_json() {
         assert_eq!(
             detect_file_type(Path::new("home/.kiro/agents/reviewer.JSON")),
             FileType::KiroAgent
         );
+        assert_eq!(
+            detect_file_type(Path::new("home/.KIRO/AGENTS/reviewer.json")),
+            FileType::KiroAgent
+        );
@@ fn detect_kiro_hook_file() {
         assert_eq!(
             detect_file_type(Path::new(".kiro/hooks/on-save.kiro.hook")),
             FileType::KiroHook
         );
+        assert_eq!(
+            detect_file_type(Path::new(".KIRO/HOOKS/on-save.kiro.hook")),
+            FileType::KiroHook
+        );
@@ fn detect_kiro_mcp_settings_file() {
         assert_eq!(
             detect_file_type(Path::new(".kiro/settings/mcp.json")),
             FileType::KiroMcp
         );
+        assert_eq!(
+            detect_file_type(Path::new(".KIRO/SETTINGS/MCP.JSON")),
+            FileType::KiroMcp
+        );
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/agnix-core/src/file_types/detection.rs` around lines 1344 - 1468,
Tests for the various Kiro detectors (functions calling detect_file_type and
expecting FileType::KiroPower, KiroAgent, KiroHook, KiroMcp) are missing
explicit uppercase-directory cases; add assertions mirroring the existing tests
but using uppercase ".KIRO/..." paths (e.g., extend
detect_kiro_power_from_dot_kiro_powers_path, detect_kiro_agent_json,
detect_kiro_hook_file, detect_kiro_mcp_settings_file) to assert
detect_file_type(Path::new(".KIRO/powers/..."),
Path::new("HOME/.KIRO/agents/..."), Path::new(".KIRO/hooks/..."),
Path::new(".KIRO/settings/mcp.json")) return the same FileType variants, and
where appropriate add negative assertions ensuring non-matching names still do
not return those FileType variants.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@crates/agnix-core/src/file_types/detection.rs`:
- Around line 1344-1468: Tests for the various Kiro detectors (functions calling
detect_file_type and expecting FileType::KiroPower, KiroAgent, KiroHook,
KiroMcp) are missing explicit uppercase-directory cases; add assertions
mirroring the existing tests but using uppercase ".KIRO/..." paths (e.g., extend
detect_kiro_power_from_dot_kiro_powers_path, detect_kiro_agent_json,
detect_kiro_hook_file, detect_kiro_mcp_settings_file) to assert
detect_file_type(Path::new(".KIRO/powers/..."),
Path::new("HOME/.KIRO/agents/..."), Path::new(".KIRO/hooks/..."),
Path::new(".KIRO/settings/mcp.json")) return the same FileType variants, and
where appropriate add negative assertions ensuring non-matching names still do
not return those FileType variants.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 665f5fb and e0ac56e.

📒 Files selected for processing (15)
  • CHANGELOG.md
  • crates/agnix-cli/tests/kiro_fixture_inventory.rs
  • crates/agnix-core/src/file_types/detection.rs
  • crates/agnix-core/src/file_types/types.rs
  • crates/agnix-core/src/registry.rs
  • crates/agnix-core/tests/api_contract.rs
  • tests/fixtures/README.md
  • tests/fixtures/kiro-mcp/.kiro/settings/mcp.json
  • tests/fixtures/kiro-powers/.kiro/powers/bad-mcp/POWER.md
  • tests/fixtures/kiro-powers/.kiro/powers/bad-mcp/mcp.json
  • tests/fixtures/kiro-powers/.kiro/powers/empty-body/POWER.md
  • tests/fixtures/kiro-powers/.kiro/powers/empty-keywords/POWER.md
  • tests/fixtures/kiro-powers/.kiro/powers/missing-frontmatter/POWER.md
  • tests/fixtures/kiro-powers/.kiro/powers/valid-power/POWER.md
  • tests/fixtures/kiro-powers/.kiro/powers/valid-power/mcp.json

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e0ac56e879

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Contributor

Copilot AI left a comment

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 adds four new Kiro file type detection surfaces (KiroPower, KiroAgent, KiroHook, KiroMcp) to the file type enum and validator registry, enabling the validation pipeline to route these Kiro configuration surfaces correctly. It closes issue #594 and is part of a broader Kiro feature series (preceding dedicated rule validation PRs).

Changes:

  • Adds 4 new FileType enum variants (KiroPower, KiroAgent, KiroHook, KiroMcp) with Display and test coverage
  • Implements path-based detection guards in detect_file_type with case-insensitive matching and MCP/agent filename guardrails; removes a now-redundant path_contains_consecutive_components_ci alias
  • Registers the new file types with placeholder validators (ImportsValidator for Power/Agent/Hook, McpValidator for MCP), adds a fixture inventory, contract and routing tests, and moves Kiro power fixtures to realistic .kiro/powers/… paths

Reviewed changes

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

Show a summary per file
File Description
crates/agnix-core/src/file_types/types.rs Adds 4 new FileType variants with Display impl and updated tests
crates/agnix-core/src/file_types/detection.rs New helper functions (ends_with_ignore_ascii_case, starts_with_ignore_ascii_case) and early-return detection guards for all 4 Kiro file types; removes dead CI alias
crates/agnix-core/src/registry.rs Registers 4 new Kiro file types with validators, updates count constants, adds routing test
crates/agnix-core/tests/api_contract.rs Updates variant list count and exhaustive match arms
crates/agnix-cli/tests/kiro_fixture_inventory.rs Updates fixture paths to new .kiro/powers/… structure; adds explicit file-type assertion tests
tests/fixtures/kiro-powers/.kiro/powers/*/POWER.md Moves existing fixture files to realistic path structure
tests/fixtures/kiro-powers/.kiro/powers/*/mcp.json Moves/adds MCP fixture files alongside POWER.md fixtures
tests/fixtures/kiro-mcp/.kiro/settings/mcp.json New KiroMcp representative fixture file
tests/fixtures/README.md Updates fixture paths and description to match restructured corpus
CHANGELOG.md Adds entry for the new detection feature

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

Copilot AI review requested due to automatic review settings March 2, 2026 15:15
@avifenesh
Copy link
Collaborator Author

Addressed follow-up review suggestions in commit df461f7:

  • added explicit uppercase .KIRO/... detector assertions for power, agent, hook, and mcp tests
  • kept detector behavior and regression coverage aligned with case-insensitive path handling

Also addressed earlier review threads in commit 2dff8ba (readability refactor plus restored KiroPower generic-markdown validator coverage).

Copy link
Contributor

Copilot AI left a comment

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


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

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fde1e1c3c3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copilot AI review requested due to automatic review settings March 2, 2026 16:09
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2b06d4713f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Contributor

Copilot AI left a comment

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


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

@avifenesh avifenesh merged commit 9e9263b into main Mar 2, 2026
15 checks passed
@avifenesh avifenesh deleted the feature/add-kiro-file-type-detection-594 branch March 2, 2026 16:28
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.

Add Kiro file type detection for skills, hooks, specs, and powers

2 participants