-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjustfile
More file actions
229 lines (175 loc) · 5.76 KB
/
Copy pathjustfile
File metadata and controls
229 lines (175 loc) · 5.76 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
# tmz justfile (Rust workspace)
# Default recipe - show help
default:
@just --list
# === Development ===
# Data directory for installed resources
data_dir := env("XDG_DATA_HOME", env("HOME", "~") / ".local/share") / "tmz"
# Install all binaries + auth script
install: install-all
# Install all binaries from workspace and supporting files
install-all:
@for crate in $(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.targets[] | .kind[] == "bin") | .manifest_path | split("/") | .[-2]'); do \
echo "Installing $crate..."; \
cargo install --path crates/$crate --force; \
done
@just install-scripts
# Install a specific crate
install-crate CRATE:
cargo install --path crates/{{CRATE}} --force
# Install auth script and Node dependencies to data dir
install-scripts:
@echo "Installing auth scripts to {{data_dir}}..."
@mkdir -p "{{data_dir}}"
@cp scripts/teams-auth.mjs "{{data_dir}}/teams-auth.mjs"
@cp scripts/package.json "{{data_dir}}/package.json"
@cd "{{data_dir}}" && npm install --silent 2>/dev/null && npx playwright install chromium 2>/dev/null
@echo "Auth script installed to {{data_dir}}/teams-auth.mjs"
# Uninstall all binaries
uninstall:
@for crate in $(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.targets[] | .kind[] == "bin") | .name'); do \
echo "Uninstalling $crate..."; \
cargo uninstall $crate 2>/dev/null || true; \
done
# === Building ===
# Debug build (all crates)
build:
cargo build --workspace
# Release build (all crates)
build-release:
cargo build --workspace --release
# Build a specific crate
build-crate CRATE:
cargo build -p {{CRATE}}
# Build with all features
build-all:
cargo build --workspace --all-features
# Fast compile check
check:
cargo check --workspace
# Check a specific crate
check-crate CRATE:
cargo check -p {{CRATE}}
# Clean build artifacts
clean:
cargo clean
# === Testing ===
# Run all tests
test:
cargo test --workspace
# Run tests for a specific crate
test-crate CRATE:
cargo test -p {{CRATE}}
# Run tests with all features
test-all:
cargo test --workspace --all-features
# Run tests verbosely
test-v:
cargo test --workspace -- --nocapture
# Run a specific test
test-one TEST:
cargo test --workspace {{TEST}}
# === Code Quality ===
# Format all code
fmt:
cargo fmt --all
# Check formatting
fmt-check:
cargo fmt --all -- --check
# Run clippy on all crates
clippy:
cargo clippy --workspace -- -D warnings
# Alias for clippy + ast-grep Rust guardrails
lint: clippy lint-rust-ai-guardrails
# Install ast-grep (advanced structural linting)
install-ast-grep:
cargo install ast-grep --locked
# Rust AI guardrails via ast-grep
lint-rust-ai-guardrails:
./scripts/lint/rust-ai-guardrails.sh
# Clippy on a specific crate
clippy-crate CRATE:
cargo clippy -p {{CRATE}} -- -D warnings
# Auto-fix clippy warnings
fix:
cargo clippy --workspace --fix --allow-dirty
# Run all checks
check-all: fmt-check clippy lint-rust-ai-guardrails test
# === Auth Setup ===
# Install Playwright and Chromium for browser-based auth
setup-auth:
./scripts/setup-auth.sh
# === Config Generation ===
# Generate config.toml and schema from Rust structs
generate-config:
cargo run -p tmz-core --example generate_config
# Validate that examples/ config files are up to date
validate-config:
cargo test -p tmz-core validate_examples_are_up_to_date
# === Documentation ===
# Generate docs for all crates
docs:
cargo doc --workspace --no-deps
# Generate and open docs
docs-open:
cargo doc --workspace --no-deps --open
# Docs for a specific crate
docs-crate CRATE:
cargo doc -p {{CRATE}} --no-deps --open
# === Dependencies ===
# Update all dependencies
update:
cargo update
# Check for outdated dependencies
outdated:
cargo outdated --workspace
# === Workspace Info ===
# List all crates in workspace
list:
@cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | "\(.name) (\(.version))"'
# List binary crates
list-bins:
@cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.targets[] | .kind[] == "bin") | .name'
# List library crates
list-libs:
@cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.targets[] | .kind[] == "lib") | .name'
# === Release ===
# Release build and show binary sizes
release: build-release
@echo "Binary sizes:"
@find target/release -maxdepth 1 -type f -perm +111 ! -name "*.d" -exec ls -lh {} \; 2>/dev/null || true
# Bump version: just bump patch|minor|major
bump LEVEL:
#!/usr/bin/env bash
set -euo pipefail
current=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/')
IFS='.' read -r major minor patch <<< "$current"
case "{{LEVEL}}" in
patch) patch=$((patch + 1)) ;;
minor) minor=$((minor + 1)); patch=0 ;;
major) major=$((major + 1)); minor=0; patch=0 ;;
*) echo "Usage: just bump patch|minor|major"; exit 1 ;;
esac
new="${major}.${minor}.${patch}"
sed -i '' "s/^version = \"${current}\"/version = \"${new}\"/" Cargo.toml
cargo check --workspace 2>/dev/null
git add -A
git commit -m "chore: bump to ${new}"
echo "Bumped ${current} -> ${new}"
# Tag and push a release
release-tag VERSION:
git tag v{{VERSION}}
git push --tags
# Bump, tag, and push in one step: just release-bump patch|minor|major
release-bump LEVEL:
#!/usr/bin/env bash
set -euo pipefail
just bump {{LEVEL}}
version=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/')
git tag "v${version}"
git push origin main
git push origin "v${version}"
echo "Released v${version}"
# Set up GitHub secrets for automated releases (requires byt)
setup-secrets:
byt secrets setup tmz