Skip to content

feat(cli): implement 'cougr check' hygiene command #246

Description

@salazarsebas

Part of #238

Background

scripts/enforce_hygiene.sh and scripts/sanitize_readme.py already implement real hygiene checks (no committed build artifacts, correct Cargo.toml descriptions, no hardcoded testnet contract IDs in READMEs, cargo metadata sanity) used internally by maintainers, most recently in the #225 example-hygiene effort. They are not runnable by an external contributor as a discoverable, first-class command.

Objective

Expose the existing hygiene logic as cougr check, runnable by any contributor before opening a PR, with output that maps 1:1 to what CI will enforce.

References

  • scripts/enforce_hygiene.sh and scripts/sanitize_readme.py (the logic being exposed, not reimplemented from scratch)
  • EXAMPLE_STANDARD.md (the standard the check enforces for example directories)
  • .github/workflows/core.yml (the CI gate this command should locally approximate)

In scope

  1. cougr check (run from a project or example root) executes the same checks as scripts/enforce_hygiene.sh: no committed target//.wasm artifacts, .gitignore present, Cargo.toml description field sanity, no hardcoded deployment identifiers in README.md.
  2. Decide and document the implementation approach: either port the bash/Python logic into Rust natively, or have cougr check shell out to the existing scripts where they still make sense (state the tradeoff explicitly in the PR description; both are acceptable, but the choice must be deliberate, not incidental).
  3. cougr check run from examples/<name>/ checks that single example against EXAMPLE_STANDARD.md; run from repo root, it checks every example.
  4. Exit code 0 only if every check passes; non-zero with a clear, itemized failure list otherwise.

Out of scope

  • Auto-fixing violations (cougr check --fix); v1 is diagnostic only.
  • Replacing scripts/enforce_hygiene.sh in CI; that migration, if desired, is a separate decision for maintainers once cougr check is proven equivalent.

Definition of done

  • cougr check run against a known-clean canonical example (e.g. examples/snake) exits 0.
  • cougr check run against a deliberately broken fixture (committed target/, bad Cargo.toml description) fails with a specific, correct diagnostic per violation.
  • Output matches or exceeds the specificity of scripts/enforce_hygiene.sh's current output.

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programclicougr-cli toolingenhancementNew feature or requestintermediateRequires ECS familiarity

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions