|
| 1 | +# SPDX-License-Identifier: PMPL-1.0-or-later |
| 2 | +# (MPL-2.0 is the automatic legal fallback until PMPL is formally recognised) |
| 3 | +# SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk> |
| 4 | +# justfile — hyperpolymath standard task runner for AffineScript |
| 5 | + |
| 6 | +# Show available recipes |
| 7 | +default: |
| 8 | + @just --list |
| 9 | + |
| 10 | +# ── Build ──────────────────────────────────────────────────────────────────── |
| 11 | + |
| 12 | +# Build the compiler |
| 13 | +build: |
| 14 | + dune build |
| 15 | + |
| 16 | +# Clean build artifacts |
| 17 | +clean: |
| 18 | + dune clean |
| 19 | + |
| 20 | +# Build with release optimisations |
| 21 | +build-release: |
| 22 | + dune build --release |
| 23 | + |
| 24 | +# Build documentation |
| 25 | +doc: |
| 26 | + dune build @doc |
| 27 | + |
| 28 | +# ── Test ───────────────────────────────────────────────────────────────────── |
| 29 | + |
| 30 | +# Run all tests |
| 31 | +test: |
| 32 | + dune runtest |
| 33 | + |
| 34 | +# Run conformance tests only |
| 35 | +conformance: |
| 36 | + dune runtest conformance |
| 37 | + |
| 38 | +# ── Format / Lint ───────────────────────────────────────────────────────────── |
| 39 | + |
| 40 | +# Run format check (lint) |
| 41 | +lint: |
| 42 | + dune fmt --check |
| 43 | + |
| 44 | +# Format code in place |
| 45 | +fmt: |
| 46 | + dune fmt |
| 47 | + |
| 48 | +# Run all checks (lint + test) |
| 49 | +check: lint test |
| 50 | + |
| 51 | +# ── Compiler subcommands ────────────────────────────────────────────────────── |
| 52 | + |
| 53 | +# Run the lexer on a file |
| 54 | +lex FILE: |
| 55 | + dune exec affinescript -- lex {{FILE}} |
| 56 | + |
| 57 | +# Run the parser on a file |
| 58 | +parse FILE: |
| 59 | + dune exec affinescript -- parse {{FILE}} |
| 60 | + |
| 61 | +# Type-check a file |
| 62 | +check-file FILE: |
| 63 | + dune exec affinescript -- check {{FILE}} |
| 64 | + |
| 65 | +# Evaluate a file |
| 66 | +eval FILE: |
| 67 | + dune exec affinescript -- eval {{FILE}} |
| 68 | + |
| 69 | +# Compile a file to Wasm |
| 70 | +compile FILE OUT: |
| 71 | + dune exec affinescript -- compile {{FILE}} -o {{OUT}} |
| 72 | + |
| 73 | +# Generate the AffineTEA bridge Wasm module |
| 74 | +tea-bridge OUT: |
| 75 | + dune exec affinescript -- tea-bridge -o {{OUT}} |
| 76 | + |
| 77 | +# Regenerate IDApTIK titlescreen.wasm (requires idaptik repo alongside nextgen-languages) |
| 78 | +regen-idaptik-wasm: |
| 79 | + dune exec affinescript -- tea-bridge -o ../../idaptik/public/assets/wasm/titlescreen.wasm |
| 80 | + @echo "[AffineTEA] titlescreen.wasm regenerated" |
| 81 | + |
| 82 | +# ── Validation ──────────────────────────────────────────────────────────────── |
| 83 | + |
| 84 | +# Verify golden path end-to-end |
| 85 | +golden-path: |
| 86 | + @echo "=== Golden Path Verification ===" |
| 87 | + @echo "1. Building..." |
| 88 | + dune build |
| 89 | + @echo "2. Running tests..." |
| 90 | + dune runtest |
| 91 | + @echo "3. Lexer smoke test..." |
| 92 | + dune exec affinescript -- lex examples/hello.affine 2>/dev/null || dune exec affinescript -- lex examples/hello.as 2>/dev/null || echo "(no example file — skip)" |
| 93 | + @echo "4. Ownership smoke test..." |
| 94 | + dune exec affinescript -- parse examples/ownership.affine 2>/dev/null || dune exec affinescript -- parse examples/ownership.as 2>/dev/null || echo "(no ownership example — skip)" |
| 95 | + @echo "=== Golden Path Complete ===" |
| 96 | + |
| 97 | +# Run panic-attack security scan |
| 98 | +panic: |
| 99 | + panic-attack assail |
| 100 | + |
| 101 | +# ── Blitz ───────────────────────────────────────────────────────────────────── |
| 102 | +# Full 16-category test + benchmark + security sweep per hyperpolymath blitz standard. |
| 103 | +# Covers: unit, integration, property, snapshot, mutation, regression, contract, |
| 104 | +# performance, security, accessibility, smoke, e2e, fuzz, chaos, audit, compliance. |
| 105 | + |
| 106 | +blitz: _blitz-header _blitz-build _blitz-test _blitz-bench _blitz-security _blitz-lint _blitz-docs _blitz-footer |
| 107 | + |
| 108 | +_blitz-header: |
| 109 | + @echo "" |
| 110 | + @echo "╔══════════════════════════════════════════╗" |
| 111 | + @echo "║ AFFINESCRIPT BLITZ RUN ║" |
| 112 | + @echo "║ 16 categories · 14 aspects · Six Sigma ║" |
| 113 | + @echo "╚══════════════════════════════════════════╝" |
| 114 | + @echo "" |
| 115 | + |
| 116 | +_blitz-build: |
| 117 | + @echo "── [1/6] Build ─────────────────────────────" |
| 118 | + dune build |
| 119 | + @echo " ✓ dune build clean" |
| 120 | + dune build --release |
| 121 | + @echo " ✓ release build clean" |
| 122 | + |
| 123 | +_blitz-test: |
| 124 | + @echo "── [2/6] Tests (E2E suite) ──────────────────" |
| 125 | + dune runtest |
| 126 | + @echo " ✓ all tests passing" |
| 127 | + |
| 128 | +_blitz-bench: |
| 129 | + @echo "── [3/6] Benchmarks ─────────────────────────" |
| 130 | + @echo " (OCaml microbenchmarks via dune runtest with bench targets if present)" |
| 131 | + dune build @bench 2>/dev/null && dune runtest @bench 2>/dev/null || echo " (no bench stanza — skip)" |
| 132 | + |
| 133 | +_blitz-security: |
| 134 | + @echo "── [4/6] Security (panic-attack) ────────────" |
| 135 | + panic-attack assail 2>&1 | tail -20 || echo " (panic-attack not installed — skip)" |
| 136 | + |
| 137 | +_blitz-lint: |
| 138 | + @echo "── [5/6] Lint + Format ──────────────────────" |
| 139 | + dune fmt --check 2>&1 || echo " (format diffs present — run: just fmt)" |
| 140 | + |
| 141 | +_blitz-docs: |
| 142 | + @echo "── [6/6] Doc build ──────────────────────────" |
| 143 | + dune build @doc 2>/dev/null || echo " (no @doc alias — skip)" |
| 144 | + |
| 145 | +_blitz-footer: |
| 146 | + @echo "" |
| 147 | + @echo "╔══════════════════════════════════════════╗" |
| 148 | + @echo "║ BLITZ COMPLETE ║" |
| 149 | + @echo "╚══════════════════════════════════════════╝" |
| 150 | + @echo "" |
| 151 | + @echo "Review any failures above before merging." |
| 152 | + |
| 153 | +# ── Release ────────────────────────────────────────────────────────────────── |
| 154 | + |
| 155 | +# Prepare a release |
| 156 | +release VERSION: |
| 157 | + @echo "Releasing {{VERSION}}..." |
| 158 | + just check |
| 159 | + sed -i 's/(version [^)]*/(version {{VERSION}}/' dune-project |
| 160 | + dune build --release |
| 161 | + git add -A |
| 162 | + git commit -m "Release v{{VERSION}}" |
| 163 | + git tag -a "v{{VERSION}}" -m "Release v{{VERSION}}" |
| 164 | + @echo "To push: git push && git push --tags" |
0 commit comments