feat(cli): implement cougr check hygiene command (#246) - #277
Conversation
Port the hygiene checks from scripts/verify_hygiene.sh and scripts/enforce_hygiene.sh into a native Rust CLI binary. Implementation: ported to Rust for cross-platform operation (no bash/python deps). Shells out only for git ls-files and cargo metadata. Checks: root .gitignore Cargo.lock, tracked artifacts, contract IDs in READMEs, example .gitignore presence/content, Cargo.toml descriptions, cargo metadata. Closes salazarsebas#246.
|
@victor-134 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Add canonical-quality verification to cougr check --verified that evaluates examples against every criterion in EXAMPLE_STANDARD.md. Extends the existing CLI with: --verified flag for full checklist, --json for machine-readable output, --full for heavy build checks, --canonical-only to filter to 10 canonical examples. Checks: dependencies (path dep annotation, wildcard versions), module structure (components.rs/systems.rs, lib.rs separation), README completeness (all 8 required sections with line-start matching), test coverage (file existence, test count, testutils usage), classification markers, Cargo.lock committed, and optional cargo test/stellar build. Wired into CI.
|
The 8 hygiene checks map cleanly to
Also flagging for visibility: this PR creates |
|
The check logic looks right, but the branch predates the |
|
Closing — CI is failing: |
Summary
Implements
cougr check— a first-class CLI hygiene command that exposes the existing hygiene logic fromscripts/enforce_hygiene.shandscripts/verify_hygiene.shas a discoverable, contributor-facing tool.Closes #246. Part of #238.
Background
scripts/enforce_hygiene.shandscripts/verify_hygiene.shalready implement real hygiene checks used internally by maintainers, most recently in the #225 example-hygiene effort. However, they are not runnable by external contributors as a first-class command. This PR exposes that logic ascougr check.Implementation approach
Decision: Ported to native Rust rather than shelling out to the existing bash/Python scripts.
Tradeoff rationale:
The native Rust approach makes
cougr checka self-contained binary with no external script dependencies. It shells out only forgit ls-files(tracked artifact detection) andcargo metadata --no-deps(build validation), which are required regardless of implementation language.Checks implemented
All 8 checks from
verify_hygiene.shand the relevant diagnostic checks fromenforce_hygiene.sh:.gitignoremust NOT ignoreCargo.lockverify_hygiene.shL16target/artifacts in gitverify_hygiene.shL20.wasmartifacts in gitverify_hygiene.shL24C[A-Z2-7]{55}) in example READMEsverify_hygiene.shL28.gitignorewithtarget/ignoredverify_hygiene.shL32-37.gitignoremust NOT ignoreCargo.lockverify_hygiene.shL35Cargo.tomlhas non-emptydescriptionfieldenforce_hygiene.sh§3cargo metadata --no-depspasses for each exampleverify_hygiene.shL39-41Usage
Exit code 0 only if every check passes. Non-zero with an itemized failure list otherwise.
Files changed
cli/Cargo.tomlclap,regex,anyhowcli/src/main.rscougr checksubcommandcli/src/check.rsCargo.tomlclito workspace membersOut of scope (v1)
cougr check --fix(auto-correction mode) — v1 is diagnostic onlyscripts/enforce_hygiene.shin CI — that migration is a separate decision for maintainersverify_hygiene.sh)Definition of done
cougr checkrun against a known-clean canonical example exits 0cougr checkrun against a deliberately broken fixture fails with specific diagnosticsscripts/verify_hygiene.shexamples/<name>/checks one