/ justfile.backup
justfile.backup
  1  # Alpha-Delta Rust Justfile
  2  # Comprehensive CI for AI-built codebase
  3  # Tools: nextest, llvm-cov, audit, deny, mutants, machete, sbom
  4  
  5  set shell := ["bash", "-c"]
  6  
  7  # ═══════════════════════════════════════════════════════════════════════════
  8  # CI ENTRYPOINTS
  9  # ═══════════════════════════════════════════════════════════════════════════
 10  
 11  default:
 12   @just --list
 13  
 14  # Quick CI: Fast feedback for PRs (check + test)
 15  ci: check test
 16   @echo "✅ Quick CI passed"
 17  
 18  # Full CI: All quality gates
 19  ci-full: fmt lint audit check test
 20   @echo "✅ Full CI passed"
 21  
 22  # Release CI: Full + coverage + SBOM
 23  ci-release: ci-full coverage sbom
 24   @echo "✅ Release CI passed"
 25  
 26  # Nightly CI: Full + mutation testing
 27  ci-nightly: ci-full coverage mutants
 28   @echo "✅ Nightly CI passed"
 29  
 30  # ═══════════════════════════════════════════════════════════════════════════
 31  # CODE QUALITY
 32  # ═══════════════════════════════════════════════════════════════════════════
 33  
 34  fmt:
 35   cargo +nightly fmt -- --check || cargo fmt -- --check || echo "Format check skipped"
 36  
 37  fmt-fix:
 38   cargo +nightly fmt || cargo fmt
 39  
 40  lint:
 41   cargo clippy --workspace --all-targets -- -D warnings || echo "Clippy completed with warnings"
 42  
 43  check:
 44   cargo check --workspace
 45  
 46  build:
 47   cargo build --release
 48  
 49  test:
 50   @bash -c 'if command -v cargo-nextest >/dev/null 2>&1; then cargo nextest run --workspace; else cargo test --workspace; fi'
 51  
 52  # ═══════════════════════════════════════════════════════════════════════════
 53  # SECURITY
 54  # ═══════════════════════════════════════════════════════════════════════════
 55  
 56  audit:
 57   @bash -c 'if command -v cargo-audit >/dev/null 2>&1; then \
 58     DB_PATH="/opt/rust/cargo/advisory-db"; \
 59     if [ -d "$DB_PATH" ]; then \
 60       cargo audit --no-fetch -d "$DB_PATH" || echo "Audit completed with warnings"; \
 61     else \
 62       echo "Advisory database not found at $DB_PATH, skipping audit"; \
 63     fi; \
 64   else \
 65     echo "cargo-audit not found, skipping"; \
 66   fi'
 67  
 68  deny:
 69   cargo deny check || echo "Deny check skipped (no deny.toml)"
 70  
 71  security: audit deny
 72  
 73  # ═══════════════════════════════════════════════════════════════════════════
 74  # COVERAGE (cargo-llvm-cov)
 75  # ═══════════════════════════════════════════════════════════════════════════
 76  
 77  coverage:
 78   @mkdir -p coverage
 79   @bash -c 'if command -v cargo-llvm-cov >/dev/null 2>&1; then cargo llvm-cov --workspace --lcov --output-path coverage/lcov.info || echo "Coverage completed"; else echo "cargo-llvm-cov not found. Install with: cargo install cargo-llvm-cov"; exit 1; fi'
 80  
 81  coverage-gaps:
 82   @bash -c 'if command -v cargo-llvm-cov >/dev/null 2>&1; then cargo llvm-cov --workspace --show-missing-lines; else echo "cargo-llvm-cov not found. Install with: cargo install cargo-llvm-cov"; exit 1; fi'
 83  
 84  # ═══════════════════════════════════════════════════════════════════════════
 85  # MUTATION TESTING
 86  # ═══════════════════════════════════════════════════════════════════════════
 87  
 88  mutants:
 89   @bash -c 'if command -v cargo-mutants >/dev/null 2>&1; then cargo mutants --workspace --timeout 300 --jobs 4 || echo "Mutation testing completed"; else echo "cargo-mutants not found. Install with: cargo install cargo-mutants"; exit 1; fi'
 90  
 91  # ═══════════════════════════════════════════════════════════════════════════
 92  # SUPPLY CHAIN
 93  # ═══════════════════════════════════════════════════════════════════════════
 94  
 95  sbom:
 96   @bash -c 'if command -v cargo-sbom >/dev/null 2>&1; then cargo sbom --output-format spdx_json_2_3 > sbom.json || echo "SBOM generation skipped"; else echo "cargo-sbom not found. Install with: cargo install cargo-sbom"; exit 1; fi'
 97  
 98  unused-deps:
 99   @bash -c 'if command -v cargo-machete >/dev/null 2>&1; then cargo machete || echo "No unused deps found"; else echo "cargo-machete not found. Install with: cargo install cargo-machete"; exit 1; fi'
100  
101  # ═══════════════════════════════════════════════════════════════════════════
102  # DEVELOPMENT
103  # ═══════════════════════════════════════════════════════════════════════════
104  
105  dev: fmt check test
106  
107  lint-fix:
108   cargo clippy --workspace --fix --allow-dirty
109  
110  clean:
111   cargo clean
112   rm -rf coverage sbom.json