-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustfile
More file actions
334 lines (285 loc) · 9.92 KB
/
Copy pathJustfile
File metadata and controls
334 lines (285 loc) · 9.92 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
# SPDX-License-Identifier: MPL-2.0 OR Palimpsest-0.8
# justfile - Modern task runner for DoubleTrack Browser
# https://github.com/casey/just
#
# Install just: cargo install just
# List recipes: just --list
# Run a recipe: just <recipe-name>
# Default recipe (runs when you type `just`)
import? "contractile.just"
default:
@just --list
# === BUILD RECIPES ===
# Build everything (Rust + AffineScript + Extension)
build: build-rust build-affinescript build-extension
@echo "✅ Build complete! Load dist/ folder in chrome://extensions/"
# Build only Rust/WASM core
build-rust:
#!/usr/bin/env bash
set -euo pipefail
echo "🦀 Building Rust core..."
cd rust_core
wasm-pack build --target web --release
echo "✅ Rust core built"
# Build AffineScript code
build-affinescript:
#!/usr/bin/env bash
set -euo pipefail
echo "📦 Building AffineScript..."
npx affinescript build
echo "✅ AffineScript built"
# Build the extension bundle
build-extension:
#!/usr/bin/env bash
set -euo pipefail
echo "📦 Building extension..."
deno run --allow-read --allow-write scripts/build.ts
echo "✅ Extension built"
# Clean build artifacts
clean:
#!/usr/bin/env bash
set -euo pipefail
echo "🧹 Cleaning build artifacts..."
rm -rf dist/
rm -rf rust_core/pkg/
rm -rf rust_core/target/
rm -rf lib/
rm -rf .cache/
echo "✅ Clean complete"
# === INSTALL RECIPES ===
# Install all dependencies
install: check-deno check-rust
@echo "✅ Dependencies checked"
# Check Deno is installed
check-deno:
#!/usr/bin/env bash
set -euo pipefail
echo "🦕 Checking Deno..."
if ! command -v deno &> /dev/null; then
echo "❌ Deno not found. Install from https://deno.land/"
exit 1
fi
echo "✅ Deno ready ($(deno --version | head -1))"
# Check Rust toolchain
check-rust:
#!/usr/bin/env bash
set -euo pipefail
echo "🦀 Checking Rust toolchain..."
if ! command -v cargo &> /dev/null; then
echo "❌ Rust not found. Install from https://rustup.rs/"
exit 1
fi
if ! command -v wasm-pack &> /dev/null; then
echo "❌ wasm-pack not found. Install: cargo install wasm-pack"
exit 1
fi
echo "✅ Rust toolchain ready ($(rustc --version))"
# === TEST RECIPES ===
# Run all tests
test: test-rust test-deno
@echo "✅ All tests passed!"
# Run Rust tests
test-rust:
#!/usr/bin/env bash
set -euo pipefail
echo "🦀 Running Rust tests..."
cd rust_core
cargo test --release
echo "✅ Rust tests passed"
# Run Deno tests
test-deno:
#!/usr/bin/env bash
set -euo pipefail
echo "🦕 Running Deno tests..."
deno test
echo "✅ Deno tests passed"
# === LINT & FORMAT RECIPES ===
# Run all linters
lint: lint-rust lint-deno lint-affinescript
@echo "✅ Linting complete"
# Lint Rust code
lint-rust:
#!/usr/bin/env bash
set -euo pipefail
echo "🦀 Linting Rust..."
cd rust_core
cargo clippy -- -D warnings
cargo fmt -- --check
echo "✅ Rust linting passed"
# Lint with Deno
lint-deno:
#!/usr/bin/env bash
set -euo pipefail
echo "🦕 Linting with Deno..."
deno lint
echo "✅ Deno linting passed"
# Check AffineScript
lint-affinescript:
#!/usr/bin/env bash
set -euo pipefail
echo "📦 Checking AffineScript..."
npx affinescript build 2>&1 | head -50
echo "✅ AffineScript check passed"
# Auto-fix formatting
fix: fix-rust fix-deno
@echo "✅ Auto-fixes applied"
# Fix Rust formatting
fix-rust:
#!/usr/bin/env bash
set -euo pipefail
echo "🦀 Formatting Rust..."
cd rust_core
cargo fmt
echo "✅ Rust formatted"
# Fix Deno formatting
fix-deno:
#!/usr/bin/env bash
set -euo pipefail
echo "🦕 Formatting with Deno..."
deno fmt
echo "✅ Deno formatted"
# === DEVELOPMENT RECIPES ===
# Start development mode (watch for changes)
dev:
#!/usr/bin/env bash
set -euo pipefail
echo "🔄 Starting development mode..."
echo "Press Ctrl+C to stop"
npx affinescript build -w
# Rebuild and reload (for quick iteration)
reload: build
@echo "🔄 Extension rebuilt - reload in browser"
# === VALIDATION RECIPES ===
# Validate RSR compliance
validate-rsr:
#!/usr/bin/env bash
set -euo pipefail
echo "📋 Checking RSR compliance..."
echo ""
echo "Documentation:"
[[ -f README.adoc ]] && echo " ✅ README.adoc" || echo " ❌ README.adoc"
[[ -f LICENSE.txt ]] && echo " ✅ LICENSE.txt" || echo " ❌ LICENSE.txt"
[[ -f SECURITY.md ]] && echo " ✅ SECURITY.md" || echo " ❌ SECURITY.md"
[[ -f CODE_OF_CONDUCT.md ]] && echo " ✅ CODE_OF_CONDUCT.md" || echo " ❌ CODE_OF_CONDUCT.md"
[[ -f CONTRIBUTING.md ]] && echo " ✅ CONTRIBUTING.md" || echo " ❌ CONTRIBUTING.md"
[[ -f MAINTAINERS.md ]] && echo " ✅ MAINTAINERS.md" || echo " ❌ MAINTAINERS.md"
[[ -f CHANGELOG.md ]] && echo " ✅ CHANGELOG.md" || echo " ❌ CHANGELOG.md"
echo ""
echo "Build System:"
[[ -f deno.json ]] && echo " ✅ deno.json" || echo " ❌ deno.json"
[[ -f affinescript.json ]] && echo " ✅ affinescript.json" || echo " ❌ affinescript.json"
[[ -f justfile ]] && echo " ✅ justfile" || echo " ❌ justfile"
[[ -f Mustfile.epx ]] && echo " ✅ Mustfile.epx" || echo " ❌ Mustfile.epx"
echo ""
echo "Policy Enforcement:"
[[ ! -f package.json ]] && echo " ✅ No package.json (Deno enforced)" || echo " ❌ package.json exists"
[[ ! -f tsconfig.json ]] && echo " ✅ No tsconfig.json (AffineScript enforced)" || echo " ❌ tsconfig.json exists"
echo ""
echo "See RSR_COMPLIANCE_AUDIT.md for full audit"
# Check for security vulnerabilities
audit:
#!/usr/bin/env bash
set -euo pipefail
echo "🔒 Auditing dependencies..."
cd rust_core && cargo audit || true
echo "✅ Audit complete"
# === RELEASE RECIPES ===
# Prepare for release (run all checks)
pre-release: clean install build test lint audit validate-rsr
@echo "✅ Pre-release checks passed!"
# Build optimized production bundle
build-release:
#!/usr/bin/env bash
set -euo pipefail
echo "🚀 Building production release..."
just clean
just build-rust
just build-affinescript
just build-extension
echo "✅ Production build complete"
# Package extension for distribution
package: build-release
#!/usr/bin/env bash
set -euo pipefail
echo "📦 Packaging extension..."
cd dist
zip -r ../doubletrack-browser.zip *
cd ..
echo "✅ Package created: doubletrack-browser.zip"
# === DOCUMENTATION RECIPES ===
# Generate documentation
docs:
#!/usr/bin/env bash
set -euo pipefail
echo "📚 Generating documentation..."
cd rust_core && cargo doc --no-deps --open
echo "✅ Rust docs generated"
# === UTILITY RECIPES ===
# Show project statistics
stats:
#!/usr/bin/env bash
set -euo pipefail
echo "📊 Project Statistics"
echo ""
echo "Lines of Code:"
echo " Rust: $(find rust_core/src -name '*.rs' | xargs wc -l 2>/dev/null | tail -1 | awk '{print $1}' || echo '0')"
echo " AffineScript: $(find src -name '*.res' | xargs wc -l 2>/dev/null | tail -1 | awk '{print $1}' || echo '0')"
echo ""
echo "Files:"
echo " Total: $(find . -type f ! -path './.git/*' ! -path './node_modules/*' ! -path './target/*' ! -path './dist/*' | wc -l)"
echo " Rust: $(find rust_core/src -name '*.rs' 2>/dev/null | wc -l || echo '0')"
echo " AffineScript: $(find src -name '*.res' 2>/dev/null | wc -l || echo '0')"
echo ""
echo "Git:"
echo " Commits: $(git rev-list --count HEAD 2>/dev/null || echo 'N/A')"
echo " Branch: $(git branch --show-current 2>/dev/null || echo 'N/A')"
# === CI/CD RECIPES ===
# Run full CI pipeline locally
ci: install build test lint audit
@echo "✅ CI pipeline complete!"
# Check if ready for commit
pre-commit: lint test
@echo "✅ Ready to commit!"
# === HELP RECIPES ===
# Show detailed help
help:
@echo "DoubleTrack Browser - Just Task Runner"
@echo ""
@echo "Common workflows:"
@echo " just install # Check dependencies"
@echo " just build # Build everything"
@echo " just test # Run all tests"
@echo " just dev # Start development mode"
@echo " just lint # Run linters"
@echo " just pre-release # Run all checks"
@echo ""
@echo "See 'just --list' for all recipes"
# Print version information
version:
@echo "DoubleTrack Browser v0.1.0"
@echo "Deno: $(deno --version | head -1)"
@echo "Rust: $(rustc --version)"
@echo "wasm-pack: $(wasm-pack --version)"
@echo "Just: $(just --version)"
# [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"
# 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)"