-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustfile
More file actions
183 lines (162 loc) · 6.1 KB
/
Justfile
File metadata and controls
183 lines (162 loc) · 6.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# SPDX-License-Identifier: PMPL-1.0-or-later
# panic-attack justfile
# Default recipe: build and test
default: build test
# Build release binary
build:
cargo build --release
# Run all tests
test:
cargo test
# Run only the readiness tests (machine-verifiable CRG grades)
readiness:
@echo "Running Component Readiness Grade verification..."
cargo test --test readiness -- --nocapture 2>&1 | tee /tmp/panic-attack-readiness.log
@echo ""
@echo "Results saved to /tmp/panic-attack-readiness.log"
@echo "Grade D tests = component runs without crashing"
@echo "Grade C tests = component produces correct output"
@echo "Grade B tests = edge cases and multi-input support"
# Run readiness tests and summarise pass/fail per grade
readiness-summary:
#!/usr/bin/env bash
set -euo pipefail
echo "=== Component Readiness Grade Verification ==="
echo ""
output=$(cargo test --test readiness 2>&1)
d_pass=$(echo "$output" | grep -c "readiness_d.*ok" || true)
d_fail=$(echo "$output" | grep -c "readiness_d.*FAILED" || true)
c_pass=$(echo "$output" | grep -c "readiness_c.*ok" || true)
c_fail=$(echo "$output" | grep -c "readiness_c.*FAILED" || true)
b_pass=$(echo "$output" | grep -c "readiness_b.*ok" || true)
b_fail=$(echo "$output" | grep -c "readiness_b.*FAILED" || true)
total_pass=$((d_pass + c_pass + b_pass))
total_fail=$((d_fail + c_fail + b_fail))
echo "Grade D (Alpha): $d_pass passed, $d_fail failed"
echo "Grade C (Beta): $c_pass passed, $c_fail failed"
echo "Grade B (RC): $b_pass passed, $b_fail failed"
echo "---"
echo "Total: $total_pass passed, $total_fail failed"
if [ "$total_fail" -eq 0 ]; then
echo ""
echo "All readiness tests pass."
else
echo ""
echo "Some readiness tests failed. Review output above."
exit 1
fi
# Clean build artifacts
clean:
cargo clean
# Install to system
install: build
cp target/release/panic-attack ~/.local/bin/
# Scan self (dogfood)
dogfood:
cargo run --release -- assail .
# Run assemblyline on all repos
assemblyline:
cargo run --release -- assemblyline ~/Documents/hyperpolymath-repos/
# Lint (clippy)
lint:
cargo clippy --all-targets
# Format check
fmt:
cargo fmt -- --check
# Check formatting without modifying
fmt-check:
cargo fmt --all --check
# Full CI check (fmt + lint + test)
ci: fmt lint test
# Tag and push a release (usage: just release 2.1.0)
release version:
#!/usr/bin/env bash
set -euo pipefail
echo "Preparing release v{{version}}..."
cargo test --verbose
cargo build --release --verbose
echo "Tagging v{{version}}..."
git tag -a "v{{version}}" -m "Release v{{version}}"
echo "Push with: git push origin v{{version}}"
# E2E integration test against VeriSimDB V-lang REST gateway
e2e-verisimdb:
#!/usr/bin/env bash
set -euo pipefail
echo "Running VeriSimDB E2E integration test..."
echo "Gateway: ${VERISIM_API_URL:-http://localhost:9090}"
exec bash tests/verisimdb_e2e.sh
# Generate shell completions for bash, zsh, fish, and nushell
completions: build
#!/usr/bin/env bash
set -euo pipefail
mkdir -p completions
SPDX_AUTHOR="# Author: Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>"
SPDX_LIC="# SPDX-License-Identifier: PMPL-1.0-or-later"
echo "Generating shell completions..."
for shell in bash zsh fish nushell; do
case "$shell" in
nushell) out="completions/_panic-attack" ;;
*) out="completions/panic-attack.$shell" ;;
esac
{
echo "$SPDX_LIC"
echo "# panic-attack shell completions for $shell"
echo "# Generated by: panic-attack completions $shell"
echo "$SPDX_AUTHOR"
echo ""
target/release/panic-attack completions "$shell"
} > "$out"
done
echo "Completions written to completions/"
echo " completions/panic-attack.bash"
echo " completions/panic-attack.zsh"
echo " completions/panic-attack.fish"
echo " completions/_panic-attack (nushell)"
# [AUTO-GENERATED] Multi-arch / RISC-V target
build-riscv:
@echo "Building for RISC-V..."
cross build --target riscv64gc-unknown-linux-gnu
# Run panic-attacker pre-commit scan
assail:
@command -v panic-attack >/dev/null 2>&1 && panic-attack assail . || echo "panic-attack not found — install from https://github.com/hyperpolymath/panic-attacker"
# Self-diagnostic — checks dependencies, permissions, paths
doctor:
@echo "Running diagnostics for panic-attacker..."
@echo "Checking required tools..."
@command -v just >/dev/null 2>&1 && echo " [OK] just" || echo " [FAIL] just not found"
@command -v git >/dev/null 2>&1 && echo " [OK] git" || echo " [FAIL] git not found"
@echo "Checking for hardcoded paths..."
@grep -rn '$HOME\|$ECLIPSE_DIR' --include='*.rs' --include='*.ex' --include='*.res' --include='*.gleam' --include='*.sh' . 2>/dev/null | head -5 || echo " [OK] No hardcoded paths"
@echo "Diagnostics complete."
# Auto-repair common issues
heal:
@echo "Attempting auto-repair for panic-attacker..."
@echo "Fixing permissions..."
@find . -name "*.sh" -exec chmod +x {} \; 2>/dev/null || true
@echo "Cleaning stale caches..."
@rm -rf .cache/stale 2>/dev/null || true
@echo "Repair complete."
# Guided tour of key features
tour:
@echo "=== panic-attacker Tour ==="
@echo ""
@echo "1. Project structure:"
@ls -la
@echo ""
@echo "2. Available commands: just --list"
@echo ""
@echo "3. Read README.adoc for full overview"
@echo "4. Read EXPLAINME.adoc for architecture decisions"
@echo "5. Run 'just doctor' to check your setup"
@echo ""
@echo "Tour complete! Try 'just --list' to see all available commands."
# Open feedback channel with diagnostic context
help-me:
@echo "=== panic-attacker Help ==="
@echo "Platform: $(uname -s) $(uname -m)"
@echo "Shell: $SHELL"
@echo ""
@echo "To report an issue:"
@echo " https://github.com/hyperpolymath/panic-attacker/issues/new"
@echo ""
@echo "Include the output of 'just doctor' in your report."