Files
rtk-ai__rtk/.claude/commands/tech/worktree-status.md
Florian BRUNIAUX 7b7a5ae4b6 feat: Claude Code tooling — 2 agents, 7 commands, 2 rules, 4 skills (#491)
* feat: add Claude Code tooling — agents, commands, rules, skills

Port and adapt 15 Claude Code artifacts from MethodeAristote/ccboard
to RTK's Rust/CLI context. All TypeScript/web-specific references
replaced with Rust idioms, cargo toolchain, and RTK constraints.

## Agents (2)

- **code-reviewer** (rewrite): RTK-specific red flags table
  (Regex::new in fn, unwrap in prod, async deps, no fallback, no savings
  test), defensive patterns with before/after examples, adversarial
  questions for RTK (savings ≥60%, fallback, startup, exit code,
  cross-platform, ANSI, fixtures)

- **system-architect** (new): RTK architecture map, filter module
  pattern (Pattern 1-4), TOML DSL vs Rust decision guide, performance
  budget (<10ms startup, <5MB binary), module boundary definitions

## Commands (7, under .claude/commands/tech/)

- **worktree**: Creates git worktrees with background `cargo check
  --all-targets`, `--fast`/`--no-check` flags, branch naming
  `feature/xxx` → `.worktrees/feature-xxx`

- **worktree-status**: Checks background cargo check log
  (`/tmp/worktree-cargo-check-{branch}.log`)

- **remove-worktree**: Removes worktree + git ref + branch, protected
  branches: `master`/`main`

- **clean-worktrees**: Auto-removes worktrees on branches merged into
  master (`git branch --merged master`)

- **clean-worktree**: Interactive cleanup with `y/N` prompt

- **codereview**: Pre-PR review, base `master`, 🔴 checks for
  `unwrap()`, non-lazy regex, missing `.context()`, async deps, missing
  token savings tests; `--auto` mode runs `cargo fmt + clippy + test`

- **audit-codebase**: 7-category health audit scored 0-10 (secrets,
  security, deps via cargo audit, structure, tests, perf <10ms, AI
  patterns), weighted global score

## Rules (2, under .claude/rules/)

- **search-strategy**: Navigation codebase RTK — module map, priority
  order (Grep > Glob > Read > Explore), patterns for finding commands,
  filter functions, lazy_static regexes, test coverage, TOML filters

- **rust-patterns**: RTK non-negotiables (no async, lazy_static
  mandatory, fallback pattern, exit code propagation) + idiomatic Rust
  (iterators, ownership, error handling, module structure template,
  anti-patterns table)

## Skills (4, under .claude/skills/)

- **code-simplifier**: Rust simplification patterns (iterator chains,
  string joining, Option/Result chaining, early returns, clone removal),
  RTK guard-rails (never simplify away lazy_static, .context(), fallback)

- **performance**: Startup benchmark (hyperfine), binary size
  (cargo-bloat), memory profiling (/usr/bin/time), regex compilation
  audit, forbidden deps table, before/after regression template

- **design-patterns**: Rust patterns for RTK — Newtype (type safety),
  Builder (complex config), State Machine (multi-phase output parsing),
  Trait Object (command dispatch), RAII, Extension Trait; selection guide
  + anti-patterns

- **tdd-rust**: Full Red-Green-Refactor workflow — real fixtures capture,
  snapshot tests (insta), count_tokens() savings assertion (≥60%),
  fallback test, ANSI stripping test, Arrange-Act-Assert pattern,
  "done" checklist

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>

* chore: update version references to 0.28.2

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>

---------

Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 09:43:38 +01:00

3.1 KiB

model, description
model description
haiku Worktree Cargo Check Status

Worktree Status Check

Check the status of background cargo check for a git worktree.

Usage

/tech:worktree-status feature/new-filter
/tech:worktree-status fix/session-bug

Implementation

Execute this script with branch name from $ARGUMENTS:

#!/bin/bash
set -euo pipefail

BRANCH_NAME="$ARGUMENTS"
LOG_FILE="/tmp/worktree-cargo-check-${BRANCH_NAME//\//-}.log"

if [ ! -f "$LOG_FILE" ]; then
  echo "❌ No cargo check found for branch: $BRANCH_NAME"
  echo ""
  echo "Possible reasons:"
  echo "1. Worktree was created with --fast / --no-check flag"
  echo "2. Branch name mismatch (use exact branch name)"
  echo "3. Cargo check hasn't started yet (wait a few seconds)"
  echo ""
  echo "Available logs:"
  ls -1 /tmp/worktree-cargo-check-*.log 2>/dev/null || echo "  (none)"
  exit 1
fi

LOG_CONTENT=$(head -n 1000 "$LOG_FILE")

if echo "$LOG_CONTENT" | grep -q "✅ Cargo check passed"; then
  TIMESTAMP=$(echo "$LOG_CONTENT" | grep "Cargo check passed" | sed 's/.*at //')
  echo "✅ Cargo check passed"
  echo "   Completed at: $TIMESTAMP"
  echo ""
  echo "Worktree is ready for development!"

elif echo "$LOG_CONTENT" | grep -q "❌ Cargo check failed"; then
  TIMESTAMP=$(echo "$LOG_CONTENT" | grep "Cargo check failed" | sed 's/.*at //')
  echo "❌ Cargo check failed"
  echo "   Completed at: $TIMESTAMP"
  echo ""
  ERROR_COUNT=$(grep -v "Cargo check" "$LOG_FILE" | grep -c "^error" || echo "0")
  echo "Errors:"
  echo "─────────────────────────────────────"
  grep "^error" "$LOG_FILE" | head -20
  echo "─────────────────────────────────────"
  echo ""
  echo "Full log: cat $LOG_FILE"
  echo ""
  echo "⚠️  You can still work on the worktree - fix errors as you go."

elif echo "$LOG_CONTENT" | grep -q "⏳ Cargo check started"; then
  START_TIME=$(echo "$LOG_CONTENT" | grep "Cargo check started" | sed 's/.*at //')
  CURRENT_TIME=$(date +%H:%M:%S)
  echo "⏳ Cargo check still running..."
  echo "   Started at: $START_TIME"
  echo "   Current time: $CURRENT_TIME"
  echo ""
  echo "Check again in a few seconds or view live progress:"
  echo "  tail -f $LOG_FILE"

else
  echo "⚠️  Cargo check in unknown state"
  echo ""
  echo "Log content:"
  cat "$LOG_FILE"
fi

Output Examples

Success

✅ Cargo check passed
   Completed at: 14:23:45

Worktree is ready for development!

Failed

❌ Cargo check failed
   Completed at: 14:24:12

Errors:
─────────────────────────────────────
error[E0308]: mismatched types
  --> src/git.rs:45:12
─────────────────────────────────────

Full log: cat /tmp/worktree-cargo-check-feature-new-filter.log

Still Running

⏳ Cargo check still running...
   Started at: 14:22:30
   Current time: 14:22:45

Check again in a few seconds or view live progress:
  tail -f /tmp/worktree-cargo-check-feature-new-filter.log