tui-checkbox 0.5.3

A customizable checkbox widget for Ratatui TUI applications
Documentation
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
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
# tui-checkbox — task runner
# Install just:      cargo install just
# Install git-cliff: cargo install git-cliff
# Install nu:        cargo install nu
# Usage: just <task>

# ── Default ───────────────────────────────────────────────────────────────────────

default:
    @just --list

# ── Tool checks ───────────────────────────────────────────────────────────────────

_check-git-cliff:
    @command -v git-cliff >/dev/null 2>&1 || { \
        echo "❌ git-cliff not found. Install with: cargo install git-cliff"; exit 1; \
    }

_check-nu:
    @command -v nu >/dev/null 2>&1 || { \
        echo "❌ nu (nushell) not found. Install: https://www.nushell.sh"; exit 1; \
    }

_check-vhs:
    @command -v vhs >/dev/null 2>&1 || { \
        echo "❌ vhs not found."; \
        echo "   macOS:      brew install vhs"; \
        echo "   Any:        go install github.com/charmbracelet/vhs@latest"; \
        exit 1; \
    }

# Install all recommended development tools
install-tools:
    @echo "Installing development tools…"
    @command -v git-cliff >/dev/null 2>&1 || cargo install git-cliff --locked
    @command -v nu >/dev/null 2>&1 || cargo install nu --locked
    @echo "✅ All tools installed!"

# ── Build ─────────────────────────────────────────────────────────────────────────────

# Build the project (dev)
build:
    cargo build

# Build release binary
build-release:
    cargo build --release

# ── Run ───────────────────────────────────────────────────────────────────────────────

# Run the checkbox example
run:
    cargo run --example checkbox --features theme

# Watch and auto-run on file changes (requires cargo-watch)
watch:
    cargo watch -x "run --example checkbox"

# ── Test ──────────────────────────────────────────────────────────────────────────────

# Run the test suite
test:
    cargo test --locked --all-features --all-targets

# Run Nu script tests
test-nu: _check-nu
    nu scripts/tests/run_all.nu

# Run both Rust and Nu tests
test-all: test test-nu
    @echo "✅ All Rust and Nu tests passed!"

# ── Code quality ──────────────────────────────────────────────────────────────────────

# Check without building
check:
    cargo check

# Format all code
fmt:
    cargo fmt

# Check formatting without modifying files
fmt-check:
    cargo fmt -- --check

# Run clippy
clippy:
    cargo clippy --all-targets --all-features -- -D warnings -A deprecated

# Run all quality checks (format, clippy, test, nu) — must pass before a release.
check-all: fmt clippy test test-nu
    @echo "🔍 Verifying formatting is clean…"
    cargo fmt -- --check
    @echo "✅ All checks passed!"

# Full pre-release quality gate — everything in check-all plus a release build.
check-release: check-all build-release
    @echo "✅ Release quality gate passed (fmt + clippy + test + nu + release build)!"

# ── VHS Demo GIFs ─────────────────────────────────────────────────────────────────────

# Run the VHS tape to generate demo GIF
vhs: _check-vhs
    @echo "Running VHS tape to generate demo…"
    vhs examples/checkbox.tape
    @echo "✅ Demo generated!"

# ── Documentation ─────────────────────────────────────────────────────────────────────

# Generate and open docs
doc:
    cargo doc --no-deps --open

# ── Changelog ─────────────────────────────────────────────────────────────────────────

# Regenerate the full CHANGELOG.md from all tags
changelog: _check-git-cliff
    @echo "Generating full changelog…"
    git-cliff --output CHANGELOG.md
    @echo "✅ CHANGELOG.md updated."

# Prepend only unreleased commits to CHANGELOG.md
changelog-unreleased: _check-git-cliff
    git-cliff --unreleased --prepend CHANGELOG.md
    @echo "✅ Unreleased changes prepended."

# Preview changelog for the next release without writing the file
changelog-preview: _check-git-cliff
    @git-cliff --unreleased

# ── Version bump ─────────────────────────────────────────────────────────────────────

# Validate that a version string will produce a valid vX.Y.Z tag.
validate-tag version: _check-nu
    @nu scripts/ci/validate_tag.nu "v{{ version }}" 2>&1 >/dev/null

# Fail fast if the requested version is the same as the current one.
_check-version-changed version: _check-nu
    #!/usr/bin/env sh
    current=$(nu scripts/version.nu)
    if [ "$current" = "{{ version }}" ]; then
        echo "❌ Version {{ version }} is already the current version. Nothing to bump."
        exit 1
    fi
    echo "✅ Version will change: $current → {{ version }}"

# Bump the version, regenerate Cargo.lock + CHANGELOG.md, commit and tag.
bump version: (validate-tag version) (_check-version-changed version) check-release _check-git-cliff
    nu scripts/bump_version.nu --yes {{ version }}

# ── Publish (crates.io) ─────────────────────────────────────────────────────────────

# Run the full pre-publish readiness check (fmt, clippy, tests, docs, dry-run)
check-publish: _check-nu
    nu scripts/check_publish.nu

# Dry-run publish (verifies packaging; skips if version already on crates.io)
publish-dry: check-all _check-nu
    @echo "Dry-run: tui-checkbox"
    nu scripts/ci/publish.nu --dry-run

# Publish to crates.io (idempotent: skips if this version already exists)
publish: check-all _check-nu
    @echo "📦 Publishing tui-checkbox…"
    nu scripts/ci/publish.nu
    @echo "✅ tui-checkbox publish step complete!"

# Show what would be released without making any changes
release-preview: _check-git-cliff
    @echo "Current version: $(just version)"
    @echo ""
    @echo "Unreleased commits:"
    @git-cliff --unreleased
    @echo ""
    @echo "Package version:"
    @grep '^version' Cargo.toml | head -1
    @echo ""
    @echo "Published crate: tui-checkbox"

# ── Housekeeping ──────────────────────────────────────────────────────────────────────

# Remove build artifacts
clean:
    cargo clean

# Update all dependencies (Cargo.lock only)
update:
    cargo update

# Update dependencies, run the full quality gate, then commit and push if all green.
update-deps:
    @echo "⬆️  Updating dependencies…"
    cargo update
    @echo "🔍 Running quality gate…"
    cargo fmt -- --check
    cargo clippy --all-targets --all-features -- -D warnings -A deprecated
    cargo test --locked --all-features --all-targets
    @echo "✅ All checks passed — committing dependency updates…"
    git add Cargo.lock
    git diff --cached --quiet || git commit -m "chore: update dependencies"
    git push origin "$(git branch --show-current)"
    @echo "✅ Dependency updates pushed to GitHub."

# Show outdated dependencies (requires cargo-outdated)
outdated:
    cargo outdated

# Show the current version
version: _check-nu
    @nu scripts/version.nu

# Show all configured remotes
remotes:
    @git remote -v

# Show project info
info:
    @echo "Project: tui-checkbox"
    @echo "Version: $(just version)"
    @echo "Author: Sorin Albu-Irimies"
    @echo "License: MIT"

# ── Git remotes & pushing ────────────────────────────────────────────────────────────

# Push the current branch to GitHub (origin)
push:
    git push origin "$(git branch --show-current)"

# Push the current branch to Gitea Microlab
push-gitea-microlab:
    git push gitea-microlab "$(git branch --show-current)"

# Push the current branch to Gitea Starscream
push-gitea-starscream:
    git push gitea-starscream "$(git branch --show-current)"

# Push the current branch to Gitea (nexus-lab instance)
push-gitea-nexus-lab:
    git push gitea-nexus-lab "$(git branch --show-current)"

# Push the current branch to all remotes (continues on failure)
push-all:
    #!/usr/bin/env sh
    git_try() {
        r=$1; shift
        if git remote get-url "$r" >/dev/null 2>&1; then "$@"; else echo "↷ skipping $r (not configured here; add with: git remote add $r <url>)"; skipped="$skipped $r"; fi
    }
    skipped=""
    failed=""
    git_try origin git push origin "$(git branch --show-current)"             || failed="$failed origin"
    git_try gitea-microlab git push gitea-microlab "$(git branch --show-current)"              || failed="$failed gitea-microlab"
    git_try gitea-starscream git push gitea-starscream "$(git branch --show-current)"   || failed="$failed gitea-starscream"
    git_try gitea-nexus-lab git push gitea-nexus-lab "$(git branch --show-current)"    || failed="$failed gitea-nexus-lab"
    if [ -n "$skipped" ]; then echo "ℹ️  Skipped (not configured):$skipped"; fi
    if [ -n "$failed" ]; then
        echo "⚠️  Failed to push to:$failed"
    else
        echo "✅ Pushed to GitHub, Gitea, Gitea Starscream, and Gitea (nexus-lab)!"
    fi

# Force-push the current branch to all remotes
push-all-force:
    #!/usr/bin/env sh
    git_try() {
        r=$1; shift
        if git remote get-url "$r" >/dev/null 2>&1; then "$@"; else echo "↷ skipping $r (not configured here; add with: git remote add $r <url>)"; skipped="$skipped $r"; fi
    }
    skipped=""
    failed=""
    git_try origin git push --force origin "$(git branch --show-current)"             || failed="$failed origin"
    git_try gitea-microlab git push --force gitea-microlab "$(git branch --show-current)"              || failed="$failed gitea-microlab"
    git_try gitea-starscream git push --force gitea-starscream "$(git branch --show-current)"   || failed="$failed gitea-starscream"
    git_try gitea-nexus-lab git push --force gitea-nexus-lab "$(git branch --show-current)"    || failed="$failed gitea-nexus-lab"
    if [ -n "$skipped" ]; then echo "ℹ️  Skipped (not configured):$skipped"; fi
    if [ -n "$failed" ]; then
        echo "⚠️  Failed to force-push to:$failed"
    else
        echo "✅ Force-pushed to GitHub, Gitea, Gitea Starscream, and Gitea (nexus-lab)!"
    fi

# Pull the current branch from GitHub (origin)
pull:
    git pull origin "$(git branch --show-current)"

# Pull the current branch from Gitea Microlab
pull-gitea-microlab:
    git pull gitea-microlab "$(git branch --show-current)"

# Pull the current branch from Gitea Starscream
pull-gitea-starscream:
    git pull gitea-starscream "$(git branch --show-current)"

# Pull the current branch from Gitea (nexus-lab instance)
pull-gitea-nexus-lab:
    git pull gitea-nexus-lab "$(git branch --show-current)"

# Pull the current branch from all remotes (continues on failure)
pull-all:
    #!/usr/bin/env sh
    git_try() {
        r=$1; shift
        if git remote get-url "$r" >/dev/null 2>&1; then "$@"; else echo "↷ skipping $r (not configured here; add with: git remote add $r <url>)"; skipped="$skipped $r"; fi
    }
    skipped=""
    failed=""
    git_try origin git pull origin "$(git branch --show-current)"             || failed="$failed origin"
    git_try gitea-microlab git pull gitea-microlab "$(git branch --show-current)"              || failed="$failed gitea-microlab"
    git_try gitea-starscream git pull gitea-starscream "$(git branch --show-current)"   || failed="$failed gitea-starscream"
    git_try gitea-nexus-lab git pull gitea-nexus-lab "$(git branch --show-current)"    || failed="$failed gitea-nexus-lab"
    if [ -n "$skipped" ]; then echo "ℹ️  Skipped (not configured):$skipped"; fi
    if [ -n "$failed" ]; then
        echo "⚠️  Failed to pull from:$failed"
    else
        echo "✅ Pulled from GitHub, Gitea, Gitea Starscream, and Gitea (nexus-lab)!"
    fi

# Git: force-push to GitHub (origin)
push-force:
    git push --force origin "$(git branch --show-current)"

# Git: force-push to Gitea Microlab
push-gitea-microlab-force:
    git push --force gitea-microlab "$(git branch --show-current)"

# Git: force-push to Gitea (nexus-lab instance)
push-gitea-nexus-lab-force:
    git push --force gitea-nexus-lab "$(git branch --show-current)"

# Git: force-push to Gitea Starscream
push-gitea-starscream-force:
    git push --force gitea-starscream "$(git branch --show-current)"

# Git: force-push tags to GitHub
push-tags-force:
    git push --force origin --tags

# Git: force-push tags to all remotes (continues on failure)
push-tags-all-force:
    #!/usr/bin/env sh
    git_try() {
        r=$1; shift
        if git remote get-url "$r" >/dev/null 2>&1; then "$@"; else echo "↷ skipping $r (not configured here; add with: git remote add $r <url>)"; skipped="$skipped $r"; fi
    }
    skipped=""
    failed=""
    git_try origin git push --force origin --tags             || failed="$failed origin"
    git_try gitea-microlab git push --force gitea-microlab --tags     || failed="$failed gitea-microlab"
    git_try gitea-starscream git push --force gitea-starscream --tags   || failed="$failed gitea-starscream"
    git_try gitea-nexus-lab git push --force gitea-nexus-lab --tags    || failed="$failed gitea-nexus-lab"
    if [ -n "$skipped" ]; then echo "ℹ️  Skipped (not configured):$skipped"; fi
    if [ -n "$failed" ]; then
        echo "⚠️  Failed to force-push tags to:$failed"
    else
        echo "✅ Tags force-pushed to all remotes!"
    fi

# Git: force-push branch + tags to all remotes (continues on failure)
push-all-force-with-tags: push-all-force push-tags-all-force

# Push all tags to GitHub
push-tags:
    git push origin --tags

# Push all tags to all remotes (continues on failure)
push-tags-all:
    #!/usr/bin/env sh
    git_try() {
        r=$1; shift
        if git remote get-url "$r" >/dev/null 2>&1; then "$@"; else echo "↷ skipping $r (not configured here; add with: git remote add $r <url>)"; skipped="$skipped $r"; fi
    }
    skipped=""
    failed=""
    git_try origin git push origin --tags             || failed="$failed origin"
    git_try gitea-microlab git push gitea-microlab --tags              || failed="$failed gitea-microlab"
    git_try gitea-starscream git push gitea-starscream --tags   || failed="$failed gitea-starscream"
    git_try gitea-nexus-lab git push gitea-nexus-lab --tags    || failed="$failed gitea-nexus-lab"
    if [ -n "$skipped" ]; then echo "ℹ️  Skipped (not configured):$skipped"; fi
    if [ -n "$failed" ]; then
        echo "⚠️  Failed to push tags to:$failed"
    else
        echo "✅ Tags pushed to all remotes!"
    fi

# ── Release workflows ───────────────────────────────────────────────────────────────

# Bump, commit, tag, then push to GitHub — triggers Release workflow.
release version: (bump version)
    @echo "Pushing release v{{ version }} to GitHub…"
    git push --follow-tags origin "$(git branch --show-current)"
    @echo "✅ Release v{{ version }} pushed — Release workflow will trigger automatically."

# Bump, commit, tag, then push to Gitea Microlab only.
release-gitea-microlab version: (bump version)
    @echo "Pushing release v{{ version }} to Gitea Microlab…"
    git push --follow-tags gitea-microlab "$(git branch --show-current)"
    @echo "✅ Release v{{ version }} live on Gitea Microlab."

# Bump, commit, tag, then push to Gitea Starscream only.
release-gitea-starscream version: (bump version)
    @echo "Pushing release v{{ version }} to Gitea Starscream…"
    git push --follow-tags gitea-starscream "$(git branch --show-current)"
    @echo "✅ Release v{{ version }} live on Gitea Starscream."

# Bump, commit, tag, then push to Gitea (nexus-lab instance) only.
release-gitea-nexus-lab version: (bump version)
    @echo "Pushing release v{{ version }} to Gitea (nexus-lab)…"
    git push --follow-tags gitea-nexus-lab "$(git branch --show-current)"
    @echo "✅ Release v{{ version }} live on Gitea (nexus-lab)."

# Bump, commit, tag, then push to all remotes (continues on failure).
release-all version: (bump version)
    #!/usr/bin/env sh
    git_try() {
        r=$1; shift
        if git remote get-url "$r" >/dev/null 2>&1; then "$@"; else echo "↷ skipping $r (not configured here; add with: git remote add $r <url>)"; skipped="$skipped $r"; fi
    }
    skipped=""
    echo "Pushing release v{{ version }} to all remotes…"
    failed=""
    git_try origin git push --follow-tags origin "$(git branch --show-current)"             || failed="$failed origin"
    git_try gitea-microlab git push --follow-tags gitea-microlab "$(git branch --show-current)"              || failed="$failed gitea-microlab"
    git_try gitea-starscream git push --follow-tags gitea-starscream "$(git branch --show-current)"   || failed="$failed gitea-starscream"
    git_try gitea-nexus-lab git push --follow-tags gitea-nexus-lab "$(git branch --show-current)"    || failed="$failed gitea-nexus-lab"
    if [ -n "$skipped" ]; then echo "ℹ️  Skipped (not configured):$skipped"; fi
    if [ -n "$failed" ]; then
        echo "⚠️  Release v{{ version }} failed to push to:$failed"
    else
        echo "✅ Release v{{ version }} pushed to GitHub, Gitea, Gitea Starscream, and Gitea (nexus-lab)!"
    fi

# Push the latest commit and all tags to every remote (no bump, continues on failure).
push-release-all: check-all
    #!/usr/bin/env sh
    git_try() {
        r=$1; shift
        if git remote get-url "$r" >/dev/null 2>&1; then "$@"; else echo "↷ skipping $r (not configured here; add with: git remote add $r <url>)"; skipped="$skipped $r"; fi
    }
    skipped=""
    failed=""
    git_try origin git push --follow-tags origin "$(git branch --show-current)"             || failed="$failed origin"
    git_try gitea-microlab git push --follow-tags gitea-microlab "$(git branch --show-current)"              || failed="$failed gitea-microlab"
    git_try gitea-starscream git push --follow-tags gitea-starscream "$(git branch --show-current)"   || failed="$failed gitea-starscream"
    git_try gitea-nexus-lab git push --follow-tags gitea-nexus-lab "$(git branch --show-current)"    || failed="$failed gitea-nexus-lab"
    if [ -n "$skipped" ]; then echo "ℹ️  Skipped (not configured):$skipped"; fi
    if [ -n "$failed" ]; then
        echo "⚠️  Failed to push to:$failed"
    else
        echo "✅ Latest commit + tags pushed to all remotes."
    fi

# Force-sync Gitea Microlab with GitHub
sync-gitea-microlab:
    git push gitea-microlab "$(git branch --show-current)" --force
    git push gitea-microlab --tags --force
    @echo "✅ Gitea Microlab force-synced with GitHub."

# Force-sync Gitea Starscream with GitHub
sync-gitea-starscream:
    git push gitea-starscream "$(git branch --show-current)" --force
    git push gitea-starscream --tags --force
    @echo "✅ Gitea Starscream force-synced with GitHub."

# Force-sync Gitea (nexus-lab instance) with GitHub
sync-gitea-nexus-lab:
    git push gitea-nexus-lab "$(git branch --show-current)" --force
    git push gitea-nexus-lab --tags --force
    @echo "✅ Gitea (nexus-lab) force-synced with GitHub."

# Force-sync all Gitea instances with GitHub (continues on failure)
sync-all-gitea:
    #!/usr/bin/env sh
    git_try() {
        r=$1; shift
        if git remote get-url "$r" >/dev/null 2>&1; then "$@"; else echo "↷ skipping $r (not configured here; add with: git remote add $r <url>)"; skipped="$skipped $r"; fi
    }
    skipped=""
    failed=""
    git_try gitea-microlab git push gitea-microlab "$(git branch --show-current)" --force                  || failed="$failed gitea-microlab"
    git_try gitea-microlab git push gitea-microlab --tags --force                || failed="$failed gitea-microlab-tags"
    git_try gitea-starscream git push gitea-starscream "$(git branch --show-current)" --force       || failed="$failed gitea-starscream"
    git_try gitea-starscream git push gitea-starscream --tags --force     || failed="$failed gitea-starscream-tags"
    if [ -n "$skipped" ]; then echo "ℹ️  Skipped (not configured):$skipped"; fi
    if [ -n "$failed" ]; then
        echo "⚠️  Failed to sync:$failed"
    else
        echo "✅ All Gitea instances force-synced with GitHub."
    fi

# Add a Gitea remote and optionally push — interactive (nu script)
setup-gitea url: _check-nu
    nu scripts/setup_gitea.nu {{ url }}

# Migrate this project to dual GitHub + Gitea hosting (interactive)
migrate-gitea: _check-nu
    nu scripts/migrate_to_gitea.nu

# Security: dependency vulnerability scan (needs `cargo install cargo-audit`)
audit:
    cargo audit

# Security: license/ban/source/advisory check (needs `cargo install cargo-deny --locked`)
deny:
    cargo deny check

# Fuzz a target (needs nightly + cargo-fuzz): just fuzz render_basic
fuzz target="render_basic":
    cargo +nightly fuzz run {{ target }}

# List fuzz targets
fuzz-list:
    cargo +nightly fuzz list