Set up TCR (Test && Commit || Revert) for the current project
Sets up TCR (Test && Commit || Revert) workflow with automated test and commit cycle.
/plugin marketplace add colek42/claude-plugins/plugin install nk-dev-practices@nkennedy-personalSet up TCR (Test && Commit || Revert) for practicing baby-step programming.
git init
cat > tcr.sh << 'EOF'
#!/bin/bash
# TCR: Test && Commit || Revert
# Replace with your actual test command
TEST_CMD="go test -v ./... || npm test"
echo "Running TCR..."
if $TEST_CMD; then
git add -A
git commit -m "TCR $(date +%H:%M:%S)"
echo "✅ Tests passed - Changes committed"
else
git restore .
echo "❌ Tests failed - Changes reverted"
fi
EOF
chmod +x tcr.sh
./tcr.sh
After making a tiny code change:
./tcr.sh
Auto-run TCR on file changes:
# macOS with fswatch
fswatch -o src/ test/ | xargs -n1 -I{} ./tcr.sh
# Linux with inotifywait
while inotifywait -r -e modify src/ test/; do ./tcr.sh; done
Ask which test command to use, then create the TCR script and explain how to use it.