/ justfile
justfile
  1  # SPDX-License-Identifier: AGPL-3.0-or-later
  2  # SPDX-FileCopyrightText: 2025 hyperpolymath
  3  #
  4  # justfile for betlang-playground
  5  # BetLang: Ternary Logic & Probabilistic Programming
  6  # See: https://just.systems/
  7  
  8  # Default recipe - show help
  9  default:
 10      @just --list
 11  
 12  # === Building ===
 13  
 14  # Build the playground
 15  build:
 16      deno task check
 17  
 18  # Clean build artifacts
 19  clean:
 20      rm -rf lib/
 21      rm -rf .cache/
 22  
 23  # === Development ===
 24  
 25  # Watch for changes and rebuild
 26  dev:
 27      deno task dev
 28  
 29  # === Testing ===
 30  
 31  # Run all tests
 32  test:
 33      deno task test
 34  
 35  # Run tests with verbose output
 36  test-verbose:
 37      deno test --allow-read -- --reporter=verbose
 38  
 39  # === Linting and Formatting ===
 40  
 41  # Format code
 42  fmt:
 43      deno task fmt
 44  
 45  # Lint code
 46  lint:
 47      deno task lint
 48  
 49  # Run all checks (format + lint + test)
 50  check: fmt lint test
 51      @echo "All checks passed"
 52  
 53  # === Documentation ===
 54  
 55  # Build documentation
 56  docs:
 57      asciidoctor README.adoc -o docs/index.html
 58  
 59  # === Ternary Logic ===
 60  
 61  # Demonstrate ternary logic
 62  ternary-demo:
 63      @echo "=== Ternary Logic Demo ==="
 64      @echo "Values: True (T), False (F), Unknown (U)"
 65      @echo ""
 66      @echo "AND truth table:"
 67      @echo "  T AND T = T"
 68      @echo "  T AND U = U"
 69      @echo "  T AND F = F"
 70      @echo "  U AND U = U"
 71      @echo "  U AND F = F"
 72      @echo "  F AND F = F"
 73      @echo ""
 74      deno run --allow-read src/ternary.ts
 75  
 76  # === Probabilistic Programming ===
 77  
 78  # Run probability examples
 79  probability:
 80      @echo "=== Probabilistic Programming Demo ==="
 81      deno task probability
 82  
 83  # Run uncertainty modeling
 84  uncertainty:
 85      @echo "=== Uncertainty Modeling ==="
 86      deno run --allow-read examples/uncertainty.ts
 87  
 88  # === RSR Compliance ===
 89  
 90  # Run RSR compliance check
 91  rsr-check:
 92      @echo "=== RSR Compliance Check ==="
 93      @echo ""
 94      @test -f README.adoc && echo "  ✓ README.adoc" || echo "  ✗ README.adoc"
 95      @test -f LICENSE.txt && echo "  ✓ LICENSE.txt" || echo "  ✗ LICENSE.txt"
 96      @test -f SECURITY.md && echo "  ✓ SECURITY.md" || echo "  ✗ SECURITY.md"
 97      @test -f CODE_OF_CONDUCT.md && echo "  ✓ CODE_OF_CONDUCT.md" || echo "  ✗ CODE_OF_CONDUCT.md"
 98      @test -f CONTRIBUTING.adoc && echo "  ✓ CONTRIBUTING.adoc" || echo "  ✗ CONTRIBUTING.adoc"
 99      @test -f CHANGELOG.md && echo "  ✓ CHANGELOG.md" || echo "  ✗ CHANGELOG.md"
100      @test -f deno.json && echo "  ✓ deno.json (Deno runtime)" || echo "  ✗ deno.json"
101      @test -f rescript.json && echo "  ✓ rescript.json (ReScript)" || echo "  ✗ rescript.json"
102      @test -f Mustfile && echo "  ✓ Mustfile" || echo "  ✗ Mustfile"
103      @test -d .well-known && echo "  ✓ .well-known/" || echo "  ✗ .well-known/"
104      @echo ""
105      @echo "=== RSR Compliance: Bronze Level ✓ ==="
106  
107  # Run verification script
108  rsr-verify:
109      @./scripts/verify-rsr.sh
110  
111  # === Utility ===
112  
113  # Show project statistics
114  stats:
115      @echo "=== Project Statistics ==="
116      @echo ""
117      @echo "Source files:"
118      @find src/ -name '*.res' -o -name '*.ts' 2>/dev/null | wc -l || echo "0"
119      @echo ""
120      @echo "Test files:"
121      @find test/ -name '*_test.ts' 2>/dev/null | wc -l || echo "0"
122      @echo ""
123      @echo "Examples:"
124      @find examples/ -type f 2>/dev/null | wc -l || echo "0"
125  
126  # Initialize git hooks
127  init-hooks:
128      @echo "#!/bin/sh" > .git/hooks/pre-commit
129      @echo "just check" >> .git/hooks/pre-commit
130      @chmod +x .git/hooks/pre-commit
131      @echo "Git hooks initialized"