Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 10 additions & 0 deletions plugins/repos-validate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ Example output:

```console
✅ config.yaml syntax is valid.
42 repositories in config
15 unique tags: api, backend, cli, deprecated, frontend, gh:automation, gh:cli, gh:rust, java, javascript, microservice, python, rust, typescript, web

Validation finished successfully.
```

### Validate syntax and check repository connectivity
Expand All @@ -97,6 +101,8 @@ Example output:

```console
✅ config.yaml syntax is valid.
42 repositories in config
15 unique tags: api, backend, cli, deprecated, frontend, gh:automation, gh:cli, gh:rust, java, javascript, microservice, python, rust, typescript, web

Validating repository connectivity...
✅ codcod/repos: Accessible.
Expand All @@ -118,6 +124,8 @@ Example output:

```console
✅ config.yaml syntax is valid.
42 repositories in config
15 unique tags: api, backend, cli, deprecated, frontend, gh:automation, gh:cli, gh:rust, java, javascript, microservice, python, rust, typescript, web

Validating repository connectivity...
✅ codcod/repos: Accessible.
Expand All @@ -141,6 +149,8 @@ Example output:

```console
✅ config.yaml syntax is valid.
42 repositories in config
15 unique tags: api, backend, cli, deprecated, frontend, gh:automation, gh:cli, gh:rust, java, javascript, microservice, python, rust, typescript, web

Validating repository connectivity...
✅ codcod/repos: Accessible.
Expand Down
29 changes: 29 additions & 0 deletions plugins/repos-validate/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,21 @@ async fn main() -> Result<()> {
}

println!("{}", "✅ config.yaml syntax is valid.".green());

// Display summary information
println!(" {} repositories in config", repos.len());

// Collect and display unique tags
let unique_tags = get_unique_tags(&repos);
if !unique_tags.is_empty() {
println!(
" {} unique tags: {}",
unique_tags.len(),
unique_tags.join(", ")
);
} else {
println!(" No tags defined");
}
println!();

if !args.connect {
Expand Down Expand Up @@ -192,6 +207,20 @@ fn parse_github_url(url: &str) -> Result<(String, String)> {
anyhow::bail!("Unsupported repository URL format: {}", url)
}

fn get_unique_tags(repos: &[Repository]) -> Vec<String> {
let mut tags: HashSet<String> = HashSet::new();

for repo in repos {
for tag in &repo.tags {
tags.insert(tag.clone());
}
}

let mut sorted_tags: Vec<String> = tags.into_iter().collect();
sorted_tags.sort();
sorted_tags
}

fn get_config_path() -> Result<PathBuf> {
// Try to get config path from environment variable set by repos CLI
if let Ok(config) = std::env::var("REPOS_CONFIG_FILE") {
Expand Down
Loading