-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustfile
More file actions
356 lines (313 loc) Β· 16.6 KB
/
Copy pathJustfile
File metadata and controls
356 lines (313 loc) Β· 16.6 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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
# SPDX-License-Identifier: MPL-2.0
# RSR Standard Justfile for DotMatrix-FilePrinter
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
set shell := ["bash", "-uc"]
set dotenv-load := true
set positional-arguments := true
# Project metadata
import? "contractile.just"
project := "dotmatrix-fileprinter"
version := "1.0.0"
tier := "infrastructure"
# Gforth is in toolbox
gforth := "toolbox run gforth"
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# DEFAULT & HELP
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Show all available recipes
default:
@just --list --unsorted
# Show project info and current STATE.scm phase
info:
@echo "Project: {{project}}"
@echo "RSR Tier: {{tier}}"
@echo "Version: {{version}}"
@echo "Phase: $(just state-phase)"
@echo ""
@echo "Stack:"
@echo " Neural: AffineScript + TEA"
@echo " Symbolic: Nickel"
@echo " Physical: Forth (Gforth)"
@echo " Bridge: Tauri 2.0 (Rust)"
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# DEVELOPMENT
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Install dependencies (run once)
setup:
@echo "Checking dependencies..."
@command -v deno >/dev/null || (echo "ERROR: Deno not found. Install from https://deno.land" && exit 1)
@toolbox run command -v gforth >/dev/null || (echo "WARNING: Gforth not found in toolbox. Install with: toolbox run sudo dnf install gforth" && exit 0)
@command -v cargo >/dev/null || (echo "ERROR: Rust/Cargo not found. Install from https://rustup.rs" && exit 1)
@echo "Installing npm packages via Deno..."
@deno install
@echo "Setup complete!"
# Start development server (hot-reload)
dev:
@echo "Starting development server..."
@deno task dev
# Build AffineScript only
build-res:
@echo "Compiling Neural Layer (AffineScript)..."
@deno run -A npm:affinescript build
# Build frontend (AffineScript + Vite)
build-frontend:
@echo "Building frontend..."
@deno task build
# Build Tauri app (full release)
build: build-frontend
@echo "Building Tauri application..."
@cd src-tauri && cargo build --release
@echo "Build complete: src-tauri/target/release/{{project}}"
# Run Tauri in development mode
tauri-dev: build-res
@echo "Starting Tauri development mode..."
@cargo tauri dev
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# FORTH KERNEL
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Test the Forth kernel directly
test-forth:
@echo "Testing Forth kernel..."
@cd {{justfile_directory()}} && {{gforth}} kernel/striker.fth -e 'test-strike bye'
@echo ""
@echo "Verifying output..."
@hexdump -C test.bin
@rm -f test.bin
# Interactive Forth session
forth-repl:
@echo "Starting Forth REPL (type 'bye' to exit)..."
@cd {{justfile_directory()}} && {{gforth}} kernel/striker.fth
# Execute a Deterministic Byte-Strike via Forth directly
# Usage: just strike-direct "72,101,108,108,111" output.bin
strike-direct bytes output="dist/substrate.bin":
@echo "Preparing strike data..."
@mkdir -p $(dirname {{output}})
@echo "CREATE STRIKE-DATA {{bytes}} ," > kernel/data.fth
@echo "Executing Forth strike..."
@cd {{justfile_directory()}} && {{gforth}} kernel/striker.fth kernel/data.fth -e 's" {{output}}" strike-init STRIKE-DATA $(echo "{{bytes}}" | tr "," "\n" | wc -l) strike-sequence strike-close bye'
@echo "Strike complete. Verifying..."
@hexdump -C {{output}}
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# VERIFICATION
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Verify the Physical Truth of the substrate (ASCII-clean, no 0xA0)
verify target="dist/substrate.bin":
@echo "Verifying Physical Byte Truth for {{target}}..."
@hexdump -C {{target}}
@echo ""
@if grep -obUaP '\xa0' {{target}} 2>/dev/null; then \
echo "FAIL: NBSP (0xA0) CONTAMINATION DETECTED"; \
exit 1; \
elif grep -obUaP '\xc2' {{target}} 2>/dev/null; then \
echo "WARN: UTF-8 marker (0xC2) detected"; \
else \
echo "PASS: Substrate is ASCII-pure."; \
fi
# Check for any non-ASCII bytes
verify-strict target="dist/substrate.bin":
@echo "Strict ASCII verification for {{target}}..."
@if LC_ALL=C grep -P '[^\x00-\x7F]' {{target}} 2>/dev/null; then \
echo "FAIL: Non-ASCII bytes detected"; \
exit 1; \
else \
echo "PASS: File is strictly ASCII (0x00-0x7F)"; \
fi
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# RSR COMPLIANCE & STATE
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Generate the RSR Cookbook documentation
cookbook:
@just --list --unsorted > docs/just-cookbook.adoc
@echo "Generated: docs/just-cookbook.adoc"
# Validate RSR structure (Files & .well-known)
validate-rsr:
#!/usr/bin/env bash
echo "=== RSR Compliance Check ==="
MISSING=""
for f in .editorconfig .gitignore Justfile RSR_COMPLIANCE.adoc README.adoc; do
[ -f "$f" ] || MISSING="$MISSING $f"
done
if [ -n "$MISSING" ]; then echo "MISSING:$MISSING"; exit 1; fi
echo "RSR compliance: PASS"
# Show current phase from STATE.scm
state-phase:
@grep -oP '\(phase\s+\.\s+\K[^)]+' STATE.scm 2>/dev/null | head -1 || echo "unknown"
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# CONTAINERS & DEPLOYMENT
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Build container (nerdctl > podman > docker)
container-build:
#!/usr/bin/env bash
CTR=$(command -v nerdctl || command -v podman || command -v docker)
$CTR build -t {{project}}:latest .
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# UTILITIES
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Count lines of deterministic code
loc:
@echo "Lines of code by language:"
@echo " AffineScript: $(find . -name '*.res' -not -path './node_modules/*' | xargs wc -l 2>/dev/null | tail -1 | awk '{print $1}')"
@echo " Forth: $(find . -name '*.fth' | xargs wc -l 2>/dev/null | tail -1 | awk '{print $1}')"
@echo " Rust: $(find . -name '*.rs' | xargs wc -l 2>/dev/null | tail -1 | awk '{print $1}')"
@echo " Nickel: $(find . -name '*.ncl' | xargs wc -l 2>/dev/null | tail -1 | awk '{print $1}')"
# Show TODOs in the substrate
todos:
@grep -rn "TODO\|FIXME" --include="*.res" --include="*.rs" --include="*.fth" --include="*.ncl" . 2>/dev/null || echo "No TODOs found"
# Clean build artifacts
clean:
@echo "Cleaning build artifacts..."
@rm -rf dist/ node_modules/ .affinescript/
@rm -rf src-tauri/target/
@rm -f kernel/data.fth test.bin
@echo "Clean complete"
# Format all code
fmt:
@echo "Formatting code..."
@deno run -A npm:affinescript format src/*.res
@cd src-tauri && cargo fmt
@echo "Format complete"
# Check types without building
check:
@echo "Type checking..."
@deno run -A npm:affinescript build
@cd src-tauri && cargo check
@echo "Type check complete"
# 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"
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# ONBOARDING & DIAGNOSTICS
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# Check all required toolchain dependencies and report health
doctor:
#!/usr/bin/env bash
echo "βββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo " Dotmatrix Fileprinter Doctor β Toolchain Health Check"
echo "βββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo ""
PASS=0; FAIL=0; WARN=0
check() {
local name="$1" cmd="$2" min="$3"
if command -v "$cmd" >/dev/null 2>&1; then
VER=$("$cmd" --version 2>&1 | head -1)
echo " [OK] $name β $VER"
PASS=$((PASS + 1))
else
echo " [FAIL] $name β not found (need $min+)"
FAIL=$((FAIL + 1))
fi
}
check "just" just "1.25"
check "git" git "2.40"
check "Rust (cargo)" cargo "1.80"
check "Deno" deno "2.0"
check "AffineScript (resc)" affinescript "12.0"
check "Zig" zig "0.13"
# Optional tools
if command -v panic-attack >/dev/null 2>&1; then
echo " [OK] panic-attack β available"
PASS=$((PASS + 1))
else
echo " [WARN] panic-attack β not found (pre-commit scanner)"
WARN=$((WARN + 1))
fi
echo ""
echo " Result: $PASS passed, $FAIL failed, $WARN warnings"
if [ "$FAIL" -gt 0 ]; then
echo " Run 'just heal' to attempt automatic repair."
exit 1
fi
echo " All required tools present."
# Attempt to automatically install missing tools
heal:
#!/usr/bin/env bash
echo "βββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo " Dotmatrix Fileprinter Heal β Automatic Tool Installation"
echo "βββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo ""
if ! command -v deno >/dev/null 2>&1; then
echo "Installing Deno..."
curl -fsSL https://deno.land/install.sh | sh
fi
# Install Deno dependencies
echo "Installing Deno dependencies..."
deno install 2>/dev/null || true
if ! command -v cargo >/dev/null 2>&1; then
echo "Installing Rust via rustup..."
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source "$HOME/.cargo/env"
fi
if ! command -v just >/dev/null 2>&1; then
echo "Installing just..."
cargo install just 2>/dev/null || echo "Install just from https://just.systems"
fi
echo ""
echo "Heal complete. Run 'just doctor' to verify."
# Guided tour of the project structure and key concepts
tour:
#!/usr/bin/env bash
echo "βββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo " Dotmatrix Fileprinter β Guided Tour"
echo "βββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo ""
echo 'A Neurosymbolic approach to filesystem manipulation. This tool treats the filesystem as a 24-pin dot-matrix substrate for deterministic, byte-level injection, eliminating encoding drift and NBSP contamination.'
echo ""
echo "Key directories:"
echo " src/ Source code"
echo " lib/ Library modules"
echo " ffi/ Foreign function interface (Zig)"
echo " src/abi/ Idris2 ABI definitions"
echo " docs/ Documentation"
echo " tests/ Test suite"
echo " .github/workflows/ CI/CD workflows"
echo " contractiles/ Must/Trust/Dust contracts"
echo " .machine_readable/ Machine-readable metadata"
echo " examples/ Usage examples"
echo ""
echo "Quick commands:"
echo " just doctor Check toolchain health"
echo " just heal Fix missing tools"
echo " just help-me Common workflows"
echo " just default List all recipes"
echo ""
echo "Read more: README.adoc, EXPLAINME.adoc"
# Show help for common workflows
help-me:
#!/usr/bin/env bash
echo "βββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo " Dotmatrix Fileprinter β Common Workflows"
echo "βββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo ""
echo "FIRST TIME SETUP:"
echo " just doctor Check toolchain"
echo " just heal Fix missing tools"
echo ""
echo "DEVELOPMENT:"
echo " cargo build Build the project"
echo " cargo test Run tests"
echo " deno task dev Development server"
echo " deno test Run tests"
echo ""
echo "PRE-COMMIT:"
echo " just assail Run panic-attacker scan"
echo ""
echo "LEARN:"
echo " just tour Guided project tour"
echo " just default List all recipes"
# Print the current CRG grade (reads from READINESS.md '**Current Grade:** X' line)
crg-grade:
@grade=$$(grep -oP '(?<=\*\*Current Grade:\*\* )[A-FX]' READINESS.md 2>/dev/null | head -1); \
[ -z "$$grade" ] && grade="X"; \
echo "$$grade"
# Generate a shields.io badge markdown for the current CRG grade
# Looks for '**Current Grade:** X' in READINESS.md; falls back to X
crg-badge:
@grade=$$(grep -oP '(?<=\*\*Current Grade:\*\* )[A-FX]' READINESS.md 2>/dev/null | head -1); \
[ -z "$$grade" ] && grade="X"; \
case "$$grade" in \
A) color="brightgreen" ;; B) color="green" ;; C) color="yellow" ;; \
D) color="orange" ;; E) color="red" ;; F) color="critical" ;; \
*) color="lightgrey" ;; esac; \
echo "[](https://github.com/hyperpolymath/standards/tree/main/component-readiness-grades)"
secret-scan-trufflehog:
@command -v trufflehog >/dev/null && trufflehog filesystem . --only-verified || true