feat(cline): support .clinerules/*.txt files in detection and validation - #572
Merged
Conversation
Extend the ClineRulesFolder detection to accept .txt files alongside .md files inside the .clinerules directory. This mirrors the CursorRule pattern which accepts both .md and .mdc extensions. Update doc comments in types.rs, cline.rs schema, and cline.rs rules to document the new .txt support.
Add .clinerules/example.md and .clinerules/example.txt entries to the WASM get_supported_file_types list. Update SPEC.md file support table and VALIDATION-RULES.md rule descriptions for CLN-002, CLN-003, and CLN-004 to mention .txt files alongside .md.
…tures Add test fixtures for .clinerules/*.txt files (valid and invalid cases mirroring the existing .md fixtures). Add detection tests verifying .txt files are classified as ClineRulesFolder and .json files are rejected. Add validation tests for CLN-001 through CLN-004 using .txt paths. Add benchmark entries for .clinerules folder detection.
- Add message content assertions to CLN-001/002/003/004 .txt tests - CLN-003 .txt test now uses two unknown keys with fix/safety assertions - CLN-004 .txt test now verifies autofix presence, safety, and format - Remove duplicate test_txt_file_detection (covered in detection.rs) - Add .yaml and .toml to negative detection test - Fix comment on line 112 to mention CLN-004
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends Cline rules file detection and validation to support .txt files alongside the existing .md files in the .clinerules/ directory. The implementation follows the established multi-extension pattern used for Cursor rules (which support both .md and .mdc files).
Changes:
- File detection now recognizes
.clinerules/*.txtasClineRulesFolderfile type - All four CLN rules (CLN-001 through CLN-004) now automatically apply to
.txtfiles since validation dispatches onFileType, not extension - Documentation, tests, fixtures, benchmarks, and WASM bindings updated to reflect
.txtsupport
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| crates/agnix-core/src/file_types/detection.rs | Added || name.ends_with(".txt") to ClineRulesFolder detection pattern, plus detection tests for .txt files and negative tests for rejected extensions |
| crates/agnix-core/src/file_types/types.rs | Updated doc comment to reflect .txt support |
| crates/agnix-core/src/schemas/cline.rs | Updated doc comments to be extension-agnostic ("folder files" instead of "*.md") |
| crates/agnix-core/src/rules/cline.rs | Updated doc comments and added 6 new tests covering all CLN rules (001-004) with .txt paths |
| crates/agnix-wasm/src/lib.rs | Added .clinerules/example.txt to WASM file type examples |
| tests/fixtures/cline/.clinerules/03-python.txt | Valid .txt fixture with proper frontmatter and content |
| tests/fixtures/cline-invalid/.clinerules/*.txt | Three invalid .txt fixtures testing CLN-002 (bad glob), CLN-003 (unknown keys), and CLN-004 (scalar paths) |
| crates/agnix-core/benches/validation.rs | Added benchmark entries for .clinerules/rules.txt detection |
| SPEC.md | Updated Cline row to show .clinerules/*.txt support |
| knowledge-base/VALIDATION-RULES.md | Updated CLN-002, CLN-003, CLN-004 descriptions to include .txt files |
| CHANGELOG.md | Added entry documenting .txt file support (but missing CLN-001 mention) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ClineRulesFolderfile type detection to accept.txtfiles alongside.mdin.clinerules/directory.txtfiles automatically since validators dispatch onFileType, not extensionChanges
detection.rs: Add|| name.ends_with(".txt")to ClineRulesFolder match armtypes.rs,schemas/cline.rs,rules/cline.rs: Update doc commentswasm/lib.rs: Add ClineRulesFolder examples to WASM bindingsSPEC.md,VALIDATION-RULES.md: Update documentation.txttest fixtures (valid + 3 invalid).txtpaths.clinerules/*.txtdetectionTest Plan
cargo test --workspacepasses (3674 tests, 0 failures).clinerules/*.txt-> ClineRulesFolder.json,.yaml,.tomlrejected.txtpaths including message content, fix presence, and safety assertionsCloses #565