Skip to content

feat(cline): support .clinerules/*.txt files in detection and validation - #572

Merged
avifenesh merged 9 commits into
mainfrom
feature/clinerules-txt-support-565
Feb 26, 2026
Merged

feat(cline): support .clinerules/*.txt files in detection and validation#572
avifenesh merged 9 commits into
mainfrom
feature/clinerules-txt-support-565

Conversation

@avifenesh

Copy link
Copy Markdown
Collaborator

Summary

  • Extend ClineRulesFolder file type detection to accept .txt files alongside .md in .clinerules/ directory
  • All CLN rules (CLN-001 through CLN-004) now apply to .txt files automatically since validators dispatch on FileType, not extension
  • Follows the existing CursorRule multi-extension pattern

Changes

  • detection.rs: Add || name.ends_with(".txt") to ClineRulesFolder match arm
  • types.rs, schemas/cline.rs, rules/cline.rs: Update doc comments
  • wasm/lib.rs: Add ClineRulesFolder examples to WASM bindings
  • SPEC.md, VALIDATION-RULES.md: Update documentation
  • New .txt test fixtures (valid + 3 invalid)
  • 9 new tests covering detection and CLN-001 through CLN-004 for .txt paths
  • Benchmark entries for .clinerules/*.txt detection

Test Plan

  • cargo test --workspace passes (3674 tests, 0 failures)
  • Detection tests verify .clinerules/*.txt -> ClineRulesFolder
  • Negative tests verify .json, .yaml, .toml rejected
  • CLN-001/002/003/004 validated with .txt paths including message content, fix presence, and safety assertions
  • All pre-existing tests unchanged

Closes #565

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
Copilot AI review requested due to automatic review settings February 26, 2026 15:16

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 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/*.txt as ClineRulesFolder file type
  • All four CLN rules (CLN-001 through CLN-004) now automatically apply to .txt files since validation dispatches on FileType, not extension
  • Documentation, tests, fixtures, benchmarks, and WASM bindings updated to reflect .txt support

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.

Comment thread CHANGELOG.md Outdated
Copilot AI review requested due to automatic review settings February 26, 2026 15:23

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 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.

@avifenesh
avifenesh merged commit ef5cc75 into main Feb 26, 2026
9 checks passed
@avifenesh
avifenesh deleted the feature/clinerules-txt-support-565 branch February 26, 2026 15:32
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.

Cline: support .clinerules/*.txt files in detection and validation

2 participants