-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
282 lines (232 loc) · 7.29 KB
/
justfile
File metadata and controls
282 lines (232 loc) · 7.29 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
# Justfile for Mobile AI Orchestrator
# Usage: just <recipe>
# List all recipes: just --list
# Default recipe (runs when you just type 'just')
default: check
# Display this help message
help:
@just --list
# Build the project in debug mode
build:
cargo build
# Build the project in release mode (optimized)
release:
cargo build --release
# Build with network features enabled
build-network:
cargo build --release --features network
# Run the project in interactive mode
run *ARGS:
cargo run -- {{ARGS}}
# Run in interactive mode
interactive:
cargo run -- --interactive
# Run with a single query
query QUERY:
cargo run -- "{{QUERY}}"
# Run all tests
test:
cargo test
# Run tests with output
test-verbose:
cargo test -- --nocapture
# Run tests with coverage (requires cargo-tarpaulin)
coverage:
cargo tarpaulin --out Html --output-dir target/coverage
# Run benchmarks (when available)
bench:
cargo bench
# Check code without building
check:
cargo check
# Format code using rustfmt
fmt:
cargo fmt
# Check if code is formatted correctly
fmt-check:
cargo fmt --check
# Lint code with Clippy
clippy:
cargo clippy --all-targets --all-features -- -D warnings
# Lint with Clippy (strict mode)
clippy-strict:
cargo clippy --all-targets --all-features -- -D warnings -D clippy::pedantic
# Build documentation
doc:
cargo doc --no-deps
# Build and open documentation in browser
doc-open:
cargo doc --no-deps --open
# Clean build artifacts
clean:
cargo clean
# Full validation suite (formatting, linting, tests)
validate: fmt-check clippy test
@echo "✅ All validation checks passed!"
# Pre-commit checks (run before committing)
pre-commit: validate
@echo "✅ Ready to commit!"
# Install development dependencies
install-deps:
@echo "Installing development dependencies..."
cargo install cargo-tarpaulin
cargo install cargo-audit
cargo install cargo-outdated
@echo "✅ Dependencies installed!"
# Security audit of dependencies
audit:
cargo audit
# Check for outdated dependencies
outdated:
cargo outdated
# Update dependencies
update:
cargo update
# Run the binary directly (after building)
run-binary *ARGS:
./target/release/mobile-ai {{ARGS}}
# Build and run release version
run-release *ARGS:
cargo run --release -- {{ARGS}}
# Generate RSR compliance report
rsr-compliance:
@echo "=== RSR Compliance Check ==="
@echo ""
@echo "✅ Type Safety: Rust compile-time guarantees"
@echo "✅ Memory Safety: Zero unsafe blocks"
@grep -r "unsafe" src/ && echo "❌ Found unsafe blocks!" || echo "✅ No unsafe blocks found"
@echo "✅ Offline-First: Network is optional feature"
@echo "✅ Documentation: Complete"
@echo "✅ Tests: Running..."
@cargo test --quiet
@echo "✅ Build System: justfile, flake.nix, CI/CD"
@echo "✅ Security: SECURITY.md, .well-known/security.txt"
@echo "✅ License: Dual MIT + Palimpsest-0.8"
@echo "✅ Community: CODE_OF_CONDUCT.md, CONTRIBUTING.md"
@echo ""
@echo "RSR Compliance Level: Bronze ✅"
# Count lines of code
loc:
@echo "=== Lines of Code ==="
@find src -name '*.rs' -exec wc -l {} + | tail -1
@echo ""
@echo "By file:"
@wc -l src/*.rs
# Check dependency count (Bronze RSR requires minimal deps)
dep-count:
@echo "=== Dependency Count ==="
@cargo tree --depth 1 | grep -v "mobile-ai-orchestrator" | wc -l
@echo ""
@echo "Direct dependencies:"
@cargo tree --depth 1
# Generate a new release (update version, tag, etc.)
release-prepare VERSION:
@echo "Preparing release {{VERSION}}..."
@# Update Cargo.toml version
@sed -i 's/^version = .*/version = "{{VERSION}}"/' Cargo.toml
@# Update CHANGELOG.md (manual step reminder)
@echo "⚠️ Don't forget to update CHANGELOG.md!"
@echo "✅ Version updated to {{VERSION}}"
# Git commit with conventional commit message
commit MESSAGE:
@git add .
@git commit -m "{{MESSAGE}}"
# Git commit and push
push MESSAGE:
@git add .
@git commit -m "{{MESSAGE}}"
@git push origin $(git branch --show-current)
# Create a git tag for release
tag VERSION:
@git tag -a v{{VERSION}} -m "Release v{{VERSION}}"
@git push origin v{{VERSION}}
# Full release workflow
release VERSION MESSAGE: (release-prepare VERSION) validate
@echo "Running full test suite..."
@cargo test
@echo "Building release binary..."
@cargo build --release
@echo "Committing version bump..."
just commit "chore: bump version to {{VERSION}}"
just tag {{VERSION}}
@echo "✅ Release {{VERSION}} prepared!"
@echo "⚠️ Review CHANGELOG.md and push to remote"
# Profile the application (requires cargo-flamegraph)
profile *ARGS:
cargo flamegraph -- {{ARGS}}
# Watch for changes and re-run tests
watch:
cargo watch -x test
# Run rustfmt, clippy, and tests in sequence
ci: fmt-check clippy test
@echo "✅ CI checks passed!"
# Install pre-commit hook
install-hook:
@echo '#!/bin/sh\njust pre-commit' > .git/hooks/pre-commit
@chmod +x .git/hooks/pre-commit
@echo "✅ Pre-commit hook installed!"
# Uninstall pre-commit hook
uninstall-hook:
@rm -f .git/hooks/pre-commit
@echo "✅ Pre-commit hook removed!"
# Build for Android (cross-compilation)
build-android:
@echo "Building for Android (aarch64-linux-android)..."
cargo build --target aarch64-linux-android --release
# Build for RISC-V (for testing constrained platforms)
build-riscv:
@echo "Building for RISC-V (riscv64gc-unknown-linux-gnu)..."
cargo build --target riscv64gc-unknown-linux-gnu --release
# Setup development environment
setup: install-deps install-hook
@echo "✅ Development environment ready!"
# Create a new component (usage: just new-component <name>)
new-component NAME:
@echo "Creating new component: {{NAME}}"
@touch src/{{NAME}}.rs
@echo "// {{NAME}} component" > src/{{NAME}}.rs
@echo "" >> src/{{NAME}}.rs
@echo "pub mod {{NAME}};" >> src/lib.rs
@echo "✅ Component {{NAME}} created!"
# Stress test (run tests repeatedly to find flaky tests)
stress-test N="100":
@echo "Running tests {{N}} times..."
@for i in $(seq 1 {{N}}); do \
echo "Iteration $i/{{N}}"; \
cargo test --quiet || exit 1; \
done
@echo "✅ All {{N}} iterations passed!"
# Create a backup of the project
backup:
@tar -czf ../mobile-ai-orchestrator-backup-$(date +%Y%m%d-%H%M%S).tar.gz \
--exclude='target' \
--exclude='.git' \
.
@echo "✅ Backup created in parent directory"
# Experimental: Run with miri (Rust's interpreter for detecting undefined behavior)
miri:
cargo +nightly miri test
# Show project statistics
stats:
@echo "=== Project Statistics ==="
@echo ""
@echo "Lines of Rust code:"
@find src -name '*.rs' -exec cat {} + | wc -l
@echo ""
@echo "Number of files:"
@find src -name '*.rs' | wc -l
@echo ""
@echo "Number of tests:"
@grep -r "#\[test\]" src/ | wc -l
@echo ""
@echo "Direct dependencies:"
@cargo tree --depth 1 | grep -v "mobile-ai-orchestrator" | wc -l
@echo ""
@echo "TODO count:"
@grep -r "TODO" src/ | wc -l
@echo ""
@echo "FIXME count:"
@grep -r "FIXME" src/ | wc -l
# Complete workflow: format, lint, test, build
all: fmt clippy test release
@echo "✅ Complete build successful!"