Repository navigation
Expand file tree
/
Copy pathJustfile
More file actions
418 lines (336 loc) · 15.4 KB
/
Copy pathJustfile
File metadata and controls
418 lines (336 loc) · 15.4 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
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
# SPDX-License-Identifier: MPL-2.0
# justfile for bitfuckit - Bitbucket CLI tool
#
# Combinatoric recipe system:
# - Recipes can be composed: `just build+test` → build then test
# - Parameterized variants: `just build-release`, `just build-debug`
# - Forge targets: `just forge-sync-gitlab`, `just forge-sync-codeberg`
#
# Recipe Cookbook:
# Quick start: just build install test
# Full CI: just ci
# Release: just release-all v0.1.0
# Forge sync: just forge-all
set shell := ["bash", "-euo", "pipefail", "-c"]
# ============================================================================
# Variables & Configuration
# ============================================================================
project := "bitfuckit"
version := `grep -m1 'version' STATE.scm 2>/dev/null | sed 's/.*"\(.*\)".*/\1/' || echo "0.1.0"`
gpr_file := "bitfuckit.gpr"
bin_dir := "bin"
binary := bin_dir / project
# Build modes
build_mode := env_var_or_default("BUILD_MODE", "development")
# Forge targets (combinatoric)
forges := "github gitlab bitbucket codeberg sourcehut gitea disroot radicle"
# ============================================================================
# Default & Help
# ============================================================================
# Show available recipes
default:
@just --list --unsorted
# Show recipe cookbook/examples
cookbook:
@echo "╔══════════════════════════════════════════════════════════════════╗"
@echo "║ bitfuckit Recipe Cookbook ║"
@echo "╠══════════════════════════════════════════════════════════════════╣"
@echo "║ ║"
@echo "║ QUICK START ║"
@echo "║ just build # Build debug binary ║"
@echo "║ just build install # Build and install to ~/.local ║"
@echo "║ just test # Run smoke tests ║"
@echo "║ ║"
@echo "║ BUILD VARIANTS (combinatoric) ║"
@echo "║ just build-debug # Debug build (default) ║"
@echo "║ just build-release # Optimized release build ║"
@echo "║ just build-spark # Build with SPARK proofs ║"
@echo "║ just build-all # All variants ║"
@echo "║ ║"
@echo "║ INSTALL TARGETS ║"
@echo "║ just install # User install (~/.local/bin) ║"
@echo "║ just install-system # System install (/usr/local) ║"
@echo "║ just install-completions # Shell completions only ║"
@echo "║ just install-man # Man page only ║"
@echo "║ just install-full # Everything ║"
@echo "║ ║"
@echo "║ FORGE OPERATIONS (permutative) ║"
@echo "║ just forge-health # Check all forge health ║"
@echo "║ just forge-sync REPO DEST # Sync to specific forge ║"
@echo "║ just forge-all # Sync to all forges ║"
@echo "║ just forge-gitlab REPO # Sync to GitLab only ║"
@echo "║ just forge-codeberg REPO # Sync to Codeberg only ║"
@echo "║ ║"
@echo "║ CI/CD PIPELINES ║"
@echo "║ just ci # Full CI pipeline ║"
@echo "║ just ci-quick # Quick CI (build+test) ║"
@echo "║ just ci-security # Security checks only ║"
@echo "║ ║"
@echo "║ RELEASE WORKFLOW ║"
@echo "║ just release-prep 0.2.0 # Prepare release ║"
@echo "║ just release-tag 0.2.0 # Tag release ║"
@echo "║ just release-all 0.2.0 # Full release (tag+push+forges) ║"
@echo "║ ║"
@echo "║ CONCATENATIVE RECIPES (chain with &&) ║"
@echo "║ just clean build test # Clean → Build → Test ║"
@echo "║ just verify build release # Verify → Build → Release ║"
@echo "║ ║"
@echo "╚══════════════════════════════════════════════════════════════════╝"
# ============================================================================
# Build Recipes (Combinatoric variants)
# ============================================================================
# Build with current mode (default: debug)
build:
gprbuild -P {{gpr_file}}
# Build debug variant
build-debug:
gprbuild -P {{gpr_file}} -XBUILD_MODE=development
# Build release variant (optimized)
build-release:
gprbuild -P {{gpr_file}} -XBUILD_MODE=release
# Build with SPARK proofs
build-spark: verify
gprbuild -P {{gpr_file}} -XBUILD_MODE=release
# Build all variants
build-all: build-debug build-release
# Clean build artifacts
clean:
gprclean -P {{gpr_file}}
# Deep clean (including generated files)
clean-deep: clean
rm -rf obj/ bin/ lib/
find . -name "*.ali" -delete
find . -name "*.o" -delete
# Rebuild from scratch
rebuild: clean build
# ============================================================================
# Verification & Testing
# ============================================================================
# Run SPARK verification
verify:
gnatprove -P {{gpr_file}} --mode=check
# Run SPARK proofs (full)
prove:
gnatprove -P {{gpr_file}} --mode=prove --level=2
# Run smoke tests
test: build
{{binary}} --help
{{binary}} auth status || true
@echo "✓ Smoke tests passed"
# Run unit tests
test-unit: build
@echo "Running unit tests..."
@# Ada unit test framework would go here
@echo "✓ Unit tests passed (placeholder)"
# Run integration tests
test-integration: build
@echo "Running integration tests..."
{{binary}} repo list 2>/dev/null || echo "⚠ Integration requires auth"
@echo "✓ Integration tests complete"
# Run all tests
test-all: test test-unit test-integration
# ============================================================================
# Installation (Permutative targets)
# ============================================================================
# Install to ~/.local/bin (user)
install: build
mkdir -p ~/.local/bin
cp {{binary}} ~/.local/bin/
# Install system-wide
install-system: build
sudo cp {{binary}} /usr/local/bin/
# Install shell completions
install-completions:
mkdir -p ~/.local/share/bash-completion/completions
mkdir -p ~/.local/share/zsh/site-functions
mkdir -p ~/.config/fish/completions
cp completions/bitfuckit.bash ~/.local/share/bash-completion/completions/bitfuckit
cp completions/bitfuckit.zsh ~/.local/share/zsh/site-functions/_bitfuckit
cp completions/bitfuckit.fish ~/.config/fish/completions/bitfuckit.fish
# Install man page
install-man:
mkdir -p ~/.local/share/man/man1
cp doc/bitfuckit.1 ~/.local/share/man/man1/
mandb ~/.local/share/man 2>/dev/null || true
# Full installation (binary + completions + man)
install-full: install install-completions install-man
# Uninstall from user directories
uninstall:
rm -f ~/.local/bin/bitfuckit
rm -f ~/.local/share/bash-completion/completions/bitfuckit
rm -f ~/.local/share/zsh/site-functions/_bitfuckit
rm -f ~/.config/fish/completions/bitfuckit.fish
rm -f ~/.local/share/man/man1/bitfuckit.1
# ============================================================================
# Forge Mesh Operations (Permutative forge targets)
# ============================================================================
# Check health of all forges
forge-health:
@echo "Checking forge health..."
@for forge in github gitlab bitbucket codeberg sourcehut gitea disroot; do \
if ./scripts/forge-mesh.sh ping $$forge 2>/dev/null; then \
echo "✓ $$forge: healthy"; \
else \
echo "✗ $$forge: unreachable"; \
fi; \
done
# Mirror to all forges
forge-all: (forge-mirror project)
# Mirror specific repo to all forges
forge-mirror repo:
./scripts/forge-mesh.sh mirror {{repo}}
# Sync to specific forge
forge-sync repo dest:
./scripts/forge-mesh.sh sync {{repo}} {{dest}}
# Recover from degraded mode
forge-recover repo:
./scripts/forge-mesh.sh recover {{repo}}
# Per-forge shortcuts (permutative expansion)
forge-github repo:
./scripts/forge-mesh.sh sync {{repo}} github
forge-gitlab repo:
./scripts/forge-mesh.sh sync {{repo}} gitlab
forge-bitbucket repo:
./scripts/forge-mesh.sh sync {{repo}} bitbucket
forge-codeberg repo:
./scripts/forge-mesh.sh sync {{repo}} codeberg
forge-sourcehut repo:
./scripts/forge-mesh.sh sync {{repo}} sourcehut
forge-gitea repo:
./scripts/forge-mesh.sh sync {{repo}} gitea
forge-disroot repo:
./scripts/forge-mesh.sh sync {{repo}} disroot
forge-radicle repo:
./scripts/forge-mesh.sh sync {{repo}} radicle
# Mirror self to all forges
mirror-self:
./scripts/forge-mesh.sh mirror {{project}}
# ============================================================================
# CI/CD Pipelines (Concatenative workflows)
# ============================================================================
# Full CI pipeline
ci: clean verify build-release test-all
@echo "✓ CI pipeline complete"
# Quick CI (fast feedback)
ci-quick: build test
@echo "✓ Quick CI complete"
# Security-focused CI
ci-security: verify
@echo "Checking for hardcoded secrets..."
@! grep -rn "password\s*=" src/ || echo "⚠ Potential hardcoded credentials found"
@echo "✓ Security CI complete"
# Pre-commit checks
pre-commit: ci-quick
@echo "Running pre-commit checks..."
@test -f README.adoc || (echo "✗ Missing README.adoc" && exit 1)
@test -f LICENSE || (echo "✗ Missing LICENSE" && exit 1)
@test -f SECURITY.md || (echo "✗ Missing SECURITY.md" && exit 1)
@echo "✓ Pre-commit checks passed"
# ============================================================================
# Release Workflow
# ============================================================================
# Prepare release (update versions, changelog)
release-prep version:
@echo "Preparing release v{{version}}..."
@sed -i 's/version = "[^"]*"/version = "{{version}}"/' config.ncl
@echo "✓ Updated config.ncl"
@echo "TODO: Update CHANGELOG.adoc manually"
# Create release tag
release-tag version:
git tag -s v{{version}} -m "Release v{{version}}"
@echo "✓ Created tag v{{version}}"
# Push release tag
release-push:
git push --tags
@echo "✓ Pushed tags"
# Full release workflow
release-all version: ci (release-prep version) (release-tag version) release-push mirror-self
@echo "╔══════════════════════════════════════════════════════════════════╗"
@echo "║ Release v{{version}} complete! ║"
@echo "║ - Tag pushed to GitHub ║"
@echo "║ - Mirrored to all forges ║"
@echo "╚══════════════════════════════════════════════════════════════════╝"
# ============================================================================
# Package Building
# ============================================================================
# Build Arch package
package-arch: build-release
cd packaging && makepkg -sf
# Build RPM package
package-rpm: build-release
@echo "Building RPM..."
rpmbuild -ba packaging/bitfuckit.spec 2>/dev/null || echo "rpmbuild not available"
# Build Debian package
package-deb: build-release
@echo "Building .deb..."
dpkg-buildpackage -us -uc 2>/dev/null || echo "dpkg-buildpackage not available"
# Build all packages
package-all: package-arch package-rpm package-deb
# ============================================================================
# Documentation
# ============================================================================
# Show version
version:
@echo "{{project}} v{{version}}"
# Generate documentation
docs:
@echo "Man page: doc/bitfuckit.1"
@echo "README: README.adoc"
@echo "API: graphql/schema.graphql"
# Show man page
man:
man doc/bitfuckit.1 2>/dev/null || cat doc/bitfuckit.1
# ============================================================================
# Development Utilities
# ============================================================================
# Format check (Ada style guide compliance)
fmt:
@echo "Ada formatting is manual - following GNAT style guide"
@echo "Checking line lengths..."
@find src/ -name "*.adb" -o -name "*.ads" | xargs -I{} sh -c 'awk "length > 79" {} && echo "Lines > 79 chars in {}"' || true
# Lint Ada code
lint:
@echo "Running Ada style checks..."
@gcc -c -gnatyw -gnatyM79 src/*.ads 2>&1 || true
@echo "✓ Lint complete"
# Watch for changes and rebuild
watch:
@echo "Watching for changes... (Ctrl+C to stop)"
@while true; do \
inotifywait -qr -e modify src/ && just build; \
done
# Start GraphQL server (development)
graphql-dev: build
{{binary}} graphql serve --playground --port 4060
# ============================================================================
# TUI Development
# ============================================================================
# Run TUI
tui: build
{{binary}} tui
# Run TUI with debug output
tui-debug: build
BITFUCKIT_DEBUG=1 {{binary}} tui
# ============================================================================
# CLI Arity Combinatorics
# ============================================================================
# Repository operations with full arity
repo-create name *args:
{{binary}} repo create {{name}} {{args}}
repo-list *args:
{{binary}} repo list {{args}}
repo-delete name:
{{binary}} repo delete {{name}}
repo-exists name:
{{binary}} repo exists {{name}}
# Pull request operations
pr-list repo *args:
{{binary}} pr list {{repo}} {{args}}
# Auth operations
auth-login:
{{binary}} auth login
auth-status:
{{binary}} auth status
# Mirror operations
mirror-repo source target:
{{binary}} mirror {{source}} {{target}}