claudegoodies
Command

worktree-status

From rtk-ai

Check background cargo check status for a git worktree

Install

/worktree-status

Facts

Repository
rtk-ai/rtk
Status
Actively maintained
Last commit
Model
haiku

Source preview

The instructions Claude Code reads when this command runs.

# Worktree Status Check

Check the status of the background `cargo check` started by `/worktree`.

## Usage

```bash
/worktree-status feature/new-filter
/worktree-status fix/bug-name
```

## Implementation

Execute this script with branch name from `$ARGUMENTS`:

```bash
#!/bin/bash
set -euo pipefail

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

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

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

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

elif echo "$LOG_CONTENT" | grep -q "^FAILED"; then
  TIMESTAMP=$(echo "$LOG_CONTENT" | grep "^FAILED" | sed 's/FAILED at //')
  echo "cargo check failed"
  echo "   Completed at: $TIMESTAMP"
  echo ""
  echo "Errors:"
  echo "-------------------------------------"
  grep -v "^PASSED\|^FAILED\|^cargo check started
View full source on GitHub →

Other slash commands