Skip to content

feat: add generic repository validation commands#2

Merged
smiggleworth merged 1 commit into
mainfrom
feat/repository-validation-commands
Jul 25, 2026
Merged

feat: add generic repository validation commands#2
smiggleworth merged 1 commit into
mainfrom
feat/repository-validation-commands

Conversation

@smiggleworth

Copy link
Copy Markdown
Contributor

Summary

  • replace downstream Python repository-check implementations with Rust cntryl-tools commands
  • add validate-docs, validate-benchmarks, check-module-sizes, and test-watchdog
  • keep project-specific policy in .cntryl/repository.toml
  • document installation, commands, and configuration

Verification

  • cargo fmt --check
  • cargo test
  • cargo clippy --all-targets -- -D warnings
  • cargo run -- validate-docs --root /Users/jrepanich/Code/cntryl/midge
  • cargo run -- validate-benchmarks --root /Users/jrepanich/Code/cntryl/midge
  • cargo run -- check-module-sizes --root /Users/jrepanich/Code/cntryl/midge

Consumers

Closes #1.

Copilot AI review requested due to automatic review settings July 25, 2026 16:34
@smiggleworth
smiggleworth merged commit 1ceecf1 into main Jul 25, 2026
1 check passed
@smiggleworth
smiggleworth deleted the feat/repository-validation-commands branch July 25, 2026 16:36

Copilot AI left a comment

Copy link
Copy Markdown

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 a set of generic repository validation subcommands to cntryl-tools, intended to replace downstream, repo-specific Python checks with shared Rust implementations configured via .cntryl/repository.toml.

Changes:

  • Introduces new CLI subcommands: validate-docs, validate-benchmarks, check-module-sizes, and test-watchdog.
  • Implements repository policy loading via .cntryl/repository.toml (using the toml crate) to keep project-specific rules out of the binary.
  • Documents the new commands and configuration in the README.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/repository_checks.rs Adds implementations for doc/link validation, benchmark contract validation, module size checks, and an integration-test watchdog runner.
src/main.rs Wires new repository-check commands into the Clap CLI.
README.md Documents new commands and provides a sample .cntryl/repository.toml policy configuration.
Cargo.toml Adds the toml dependency needed for repository policy parsing.
Cargo.lock Locks new transitive dependencies for toml.

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

Comment thread src/repository_checks.rs
Comment on lines +104 to +124
for (target, anchor) in markdown_links(&text) {
if target.is_empty() || target.contains("://") || target.starts_with("mailto:") {
continue;
}
let target_path = path.parent().unwrap_or(&root).join(&target);
let target_path = target_path.canonicalize().unwrap_or(target_path);
if !target_path.is_file()
&& !(target_path.is_dir() && target_path.join("README.md").is_file())
{
errors.push(format!("{name}: broken local link {target}"));
}
if let Some(anchor) = anchor {
let target_name = relative(&root, &target_path);
if !headings
.get(&target_name)
.is_some_and(|ids| ids.contains(&slug(&anchor)))
{
errors.push(format!("{name}: broken anchor {target}#{anchor}"));
}
}
}
Comment thread src/repository_checks.rs
Comment on lines +385 to +406
fn production_lines(text: &str) -> usize {
let mut count = 0;
let mut skip = false;
let mut depth = 0i32;
for line in text.lines() {
let trimmed = line.trim();
if !skip && trimmed.contains("#[cfg(test)]") {
skip = true;
continue;
}
if skip {
depth += line.matches('{').count() as i32;
depth -= line.matches('}').count() as i32;
if depth <= 0 && (line.contains('{') || line.contains(';')) {
skip = false;
}
} else if !trimmed.is_empty() && !trimmed.starts_with("//") {
count += 1;
}
}
count
}
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.

feat: move repository validation helpers into cntryl-tools

2 participants