mirror of
https://github.com/rtk-ai/rtk.git
synced 2026-09-19 07:33:17 +08:00
7b7a5ae4b6
* 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>
3.7 KiB
3.7 KiB
model, description
| model | description |
|---|---|
| haiku | Remove a specific worktree (directory + git reference + branch) |
Remove Worktree
Remove a specific worktree, cleaning up directory, git references, and optionally the branch.
Usage
/tech:remove-worktree feature/new-filter
/tech:remove-worktree fix/session-bug
Implementation
Execute this script with branch name from $ARGUMENTS:
#!/bin/bash
set -euo pipefail
BRANCH_NAME="$ARGUMENTS"
if [ -z "$BRANCH_NAME" ]; then
echo "❌ Usage: /tech:remove-worktree <branch-name>"
echo ""
echo "Example:"
echo " /tech:remove-worktree feature/new-filter"
exit 1
fi
echo "🔍 Checking worktree: $BRANCH_NAME"
echo ""
# Check if worktree exists in git
if ! git worktree list | grep -q "$BRANCH_NAME"; then
echo "❌ Worktree not found: $BRANCH_NAME"
echo ""
echo "Available worktrees:"
git worktree list
exit 1
fi
# Get worktree path from git
WORKTREE_FULL_PATH=$(git worktree list | grep "$BRANCH_NAME" | awk '{print $1}')
# Safety check: never remove main repo
if [ "$WORKTREE_FULL_PATH" = "$(pwd)" ]; then
echo "❌ Cannot remove main repository worktree"
exit 1
fi
# Safety check: never remove master or main
if [ "$BRANCH_NAME" = "master" ] || [ "$BRANCH_NAME" = "main" ]; then
echo "❌ Cannot remove $BRANCH_NAME (protected branch)"
exit 1
fi
echo "📂 Worktree path: $WORKTREE_FULL_PATH"
echo "🌿 Branch: $BRANCH_NAME"
echo ""
# Check if branch is merged
IS_MERGED=false
if git branch --merged master | grep -q "^[* ] ${BRANCH_NAME}$"; then
IS_MERGED=true
echo "✅ Branch is merged into master (safe to delete)"
else
echo "⚠️ Branch is NOT merged into master"
fi
echo ""
# Ask confirmation if not merged
if [ "$IS_MERGED" = false ]; then
echo "⚠️ This will DELETE unmerged work. Continue? [y/N]"
read -r confirm
if [ "$confirm" != "y" ] && [ "$confirm" != "Y" ]; then
echo "Aborted."
exit 0
fi
fi
# Remove worktree
echo "🗑️ Removing worktree..."
if git worktree remove "$WORKTREE_FULL_PATH" 2>/dev/null; then
echo "✅ Worktree removed: $WORKTREE_FULL_PATH"
else
echo "⚠️ Git remove failed, forcing removal..."
rm -rf "$WORKTREE_FULL_PATH"
git worktree prune
echo "✅ Worktree forcefully removed"
fi
# Delete branch
echo ""
echo "🌿 Deleting branch..."
if [ "$IS_MERGED" = true ]; then
if git branch -d "$BRANCH_NAME" 2>/dev/null; then
echo "✅ Branch deleted (local): $BRANCH_NAME"
else
echo "⚠️ Local branch already deleted or not found"
fi
else
if git branch -D "$BRANCH_NAME" 2>/dev/null; then
echo "✅ Branch force-deleted (local): $BRANCH_NAME"
else
echo "⚠️ Local branch already deleted or not found"
fi
fi
# Delete remote branch (if exists)
echo ""
echo "🌐 Checking remote branch..."
if git ls-remote --heads origin "$BRANCH_NAME" | grep -q "$BRANCH_NAME"; then
echo "⚠️ Remote branch exists. Delete it? [y/N]"
read -r confirm_remote
if [ "$confirm_remote" = "y" ] || [ "$confirm_remote" = "Y" ]; then
if git push origin --delete "$BRANCH_NAME" --no-verify 2>/dev/null; then
echo "✅ Remote branch deleted: $BRANCH_NAME"
else
echo "❌ Failed to delete remote branch (may require permissions)"
fi
else
echo "⏭️ Skipped remote branch deletion"
fi
else
echo "ℹ️ No remote branch found"
fi
echo ""
echo "✅ Cleanup complete!"
echo ""
echo "📊 Remaining worktrees:"
git worktree list
Safety Features
- ✅ Never removes
masterormain - ✅ Asks confirmation for unmerged branches
- ✅ Cleans git references, directory, and branch
- ✅ Optional remote branch deletion
- ✅ Fallback to force removal if git fails
Manual Override
git worktree remove --force <path>
git branch -D <branch>
git push origin --delete <branch> --no-verify