-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustfile
More file actions
291 lines (234 loc) · 11.2 KB
/
Justfile
File metadata and controls
291 lines (234 loc) · 11.2 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
# justfile for vext
# https://github.com/casey/just
# SPDX-License-Identifier: MIT OR MPL-2.0
# Default recipe (show help)
default:
@just --list
# ══════════════════════════════════════════════════════════════════════════════
# Development Setup
# ══════════════════════════════════════════════════════════════════════════════
# Set up development environment
setup:
#!/usr/bin/env bash
set -euo pipefail
echo "Setting up vext development environment..."
# Check Rust
if command -v cargo &> /dev/null; then
echo "✓ Rust: $(rustc --version)"
else
echo "✗ Rust not found. Install from https://rustup.rs"
exit 1
fi
# Check Deno
if command -v deno &> /dev/null; then
echo "✓ Deno: $(deno --version | head -1)"
else
echo "✗ Deno not found. Install from https://deno.land"
exit 1
fi
echo ""
echo "Building Rust components..."
cargo build
echo ""
echo "Caching Deno dependencies..."
cd vext-tools && deno cache src/hooks/git.ts
echo ""
echo "✅ Setup complete!"
# Install just the runtime (not dev deps)
install:
cargo build --release
# ══════════════════════════════════════════════════════════════════════════════
# Building
# ══════════════════════════════════════════════════════════════════════════════
# Build all components
build: build-rust build-tools
@echo "✅ Build complete!"
# Build Rust daemon
build-rust:
@echo "Building vext-core (Rust)..."
cargo build --release
# Build tools (ReScript)
build-tools:
@echo "Building vext-tools (ReScript)..."
cd vext-tools && deno task build
# Build debug versions
build-debug:
cargo build
# Clean build artifacts
clean:
@echo "Cleaning build artifacts..."
cargo clean
rm -rf vext-tools/node_modules vext-tools/.rescript
rm -f rsr_compliance.json
@echo "✅ Cleaned!"
# ══════════════════════════════════════════════════════════════════════════════
# Testing
# ══════════════════════════════════════════════════════════════════════════════
# Run all tests
test: test-rust test-tools
@echo "✅ All tests passed!"
# Run Rust tests
test-rust:
@echo "Running Rust tests..."
cargo test
# Run Rust tests with output
test-rust-verbose:
cargo test -- --nocapture
# Run tools tests
test-tools:
@echo "Running Deno tests..."
cd vext-tools && deno test --allow-read --allow-write --allow-net || echo "No tests yet"
# Run tests with coverage
test-coverage:
cargo tarpaulin --out Html
# ══════════════════════════════════════════════════════════════════════════════
# Code Quality
# ══════════════════════════════════════════════════════════════════════════════
# Run all linters
lint: lint-rust lint-tools
@echo "✅ All linters passed!"
# Lint Rust code
lint-rust:
@echo "Linting Rust..."
cargo clippy -- -D warnings
cargo fmt --check
# Lint ReScript code
lint-tools:
@echo "Linting tools (ReScript)..."
cd vext-tools && deno lint || true
cd vext-tools && deno fmt --check || true
# Format all code
format: format-rust format-tools
@echo "✅ Formatted!"
# Format Rust code
format-rust:
cargo fmt
# Format tools code
format-tools:
cd vext-tools && deno fmt
# Security audit
security:
@echo "Running security audit..."
cargo audit || echo "Install cargo-audit: cargo install cargo-audit"
# ══════════════════════════════════════════════════════════════════════════════
# Running
# ══════════════════════════════════════════════════════════════════════════════
# Run daemon in foreground
run *ARGS:
cargo run --release --bin vextd -- {{ARGS}}
# Run daemon with debug logging
run-debug *ARGS:
cargo run --bin vextd -- -vv {{ARGS}}
# Run the send CLI
send *ARGS:
cargo run --release --bin vext-send -- {{ARGS}}
# Install hook in a git repo
hook-install REPO_PATH:
cd vext-tools && deno run --allow-read --allow-write src/hooks/install.ts --git-dir "{{REPO_PATH}}/.git"
# ══════════════════════════════════════════════════════════════════════════════
# Container (Podman/nerdctl)
# ══════════════════════════════════════════════════════════════════════════════
# Build container image
container-build:
podman build -t vext:latest -f Containerfile .
# Run container
container-run:
podman run -d --name vext -p 6659:6659/udp -p 6659:6659/tcp vext:latest
# Stop container
container-stop:
podman stop vext || true
podman rm vext || true
# Container logs
container-logs:
podman logs -f vext
# Run container interactively (for debugging)
container-shell:
podman run -it --rm --entrypoint /bin/sh vext:latest
# ══════════════════════════════════════════════════════════════════════════════
# Release
# ══════════════════════════════════════════════════════════════════════════════
# Prepare a new release
release VERSION:
@echo "Preparing release {{VERSION}}..."
@echo "1. Updating version numbers..."
sed -i 's/^version = .*/version = "{{VERSION}}"/' Cargo.toml
sed -i 's/^version = .*/version = "{{VERSION}}"/' vext-core/Cargo.toml
@echo "2. Updating CHANGELOG.md..."
@echo " (Manual step: Update CHANGELOG.md with release notes)"
@echo "3. Creating git tag..."
git add Cargo.toml vext-core/Cargo.toml CHANGELOG.md
git commit -m "chore: bump version to {{VERSION}}"
git tag -a "v{{VERSION}}" -m "Release v{{VERSION}}"
@echo "✅ Release prepared!"
@echo " Review changes, then run: git push && git push --tags"
# Build release binaries for distribution
dist:
@echo "Building release binaries..."
cargo build --release
mkdir -p dist
cp target/release/vextd dist/
cp target/release/vext-send dist/
@echo "✅ Binaries in dist/"
# ══════════════════════════════════════════════════════════════════════════════
# RSR Compliance
# ══════════════════════════════════════════════════════════════════════════════
# Check RSR compliance (legacy Python tool)
rsr-check:
@echo "Checking RSR compliance..."
@if command -v python3 &> /dev/null && [ -f tools/rsr_checker.py ]; then \
python3 tools/rsr_checker.py .; \
else \
echo "RSR checker requires Python (legacy tool)"; \
fi
# ══════════════════════════════════════════════════════════════════════════════
# Validation
# ══════════════════════════════════════════════════════════════════════════════
# Run all validation checks (CI equivalent)
validate: lint test security
@echo ""
@echo "✅ All validation checks passed!"
# Pre-commit checks
pre-commit: format lint test
@echo "✅ Pre-commit checks passed!"
# Full CI check
ci: clean build lint test security
@echo "✅ Full CI validation passed!"
# ══════════════════════════════════════════════════════════════════════════════
# Utilities
# ══════════════════════════════════════════════════════════════════════════════
# Show project information
info:
@echo "Project: vext"
@echo "Description: IRC notification daemon (Rhodium Standard Edition)"
@echo "License: MIT OR MPL-2.0"
@echo "Repository: https://github.com/Hyperpolymath/vext"
@echo ""
@echo "Components:"
@echo " vext-core: Rust daemon"
@echo " vext-tools: Deno hooks & utilities"
@echo ""
@echo "Toolchain versions:"
@rustc --version 2>/dev/null || echo " Rust: not installed"
@deno --version 2>/dev/null | head -1 || echo " Deno: not installed"
# Count lines of code
loc:
@echo "Lines of code:"
@echo "Rust:"
@find vext-core/src -name "*.rs" | xargs wc -l | tail -1
@echo "ReScript:"
@find vext-tools/src -name "*.res" | xargs wc -l 2>/dev/null | tail -1 || echo "0"
# ══════════════════════════════════════════════════════════════════════════════
# Nix Integration
# ══════════════════════════════════════════════════════════════════════════════
# Build with Nix
nix-build:
nix build
# Run with Nix
nix-run:
nix run
# Enter Nix development shell
nix-shell:
nix develop
# Update Nix flake lock
nix-update:
nix flake update