diff --git a/flick.sh b/flick.sh new file mode 100755 index 000000000..358166d09 --- /dev/null +++ b/flick.sh @@ -0,0 +1,82 @@ +#!/bin/bash +# flick.sh — Ralph cleanup utility +# Finds and deletes Ralph intermediary files (prd.json, progress.txt). +# Run this from your project directory after a successful Ralph run. +# +# Usage: bash /path/to/ralph/flick.sh [--nuke|--all] +# --nuke Skip confirmation prompts and delete all files immediately +# --all Alias for --nuke + +nuke=false +project_dir="${PWD}" + +[[ "$1" == "--nuke" || "$1" == "--all" ]] && nuke=true + +search_dirs=( + "${project_dir}" + "${project_dir}/tasks" + "${project_dir}/ralph" + "${project_dir}/.agents/ralph" + "${project_dir}/.agents/skills/ralph" + "${project_dir}/.claude/ralph" + "${project_dir}/.claude/skills/ralph" + "${HOME}/.agents/ralph" + "${HOME}/.agents/skills/ralph" + "${HOME}/.claude/ralph" + "${HOME}/.claude/skills/ralph" +) + +found_any=false + +for dir in "${search_dirs[@]}"; do + dir_files=() + for fname in prd.json progress.txt; do + [[ -f "${dir}/${fname}" ]] && dir_files+=("${dir}/${fname}") + done + + [[ ${#dir_files[@]} -eq 0 ]] && continue + found_any=true + + echo "" + echo "════════════════════════════════════════" + echo "Location: ${dir}" + + filenames=() + for f in "${dir_files[@]}"; do + filenames+=("$(basename "$f")") + done + echo "Files: $(IFS=', '; echo "${filenames[*]}")" + + prd="${dir}/prd.json" + if [[ -f "$prd" ]]; then + echo "" + echo "── prd.json (first 15 lines) ──────────" + head -15 "$prd" + fi + + echo "" + + if $nuke; then + for f in "${dir_files[@]}"; do + rm "$f" && echo " Deleted: $f" + done + else + read -p "Delete these files? (y/n) " reply + echo "" + if [[ "$reply" =~ ^[Yy]$ ]]; then + for f in "${dir_files[@]}"; do + rm "$f" && echo " Deleted: $f" + done + else + echo " Skipped." + fi + fi +done + +if ! $found_any; then + echo "No Ralph files found in any expected location." +else + echo "" + echo "════════════════════════════════════════" + echo "Done." +fi diff --git a/ralph.sh b/ralph.sh index baff052ac..372d76605 100755 --- a/ralph.sh +++ b/ralph.sh @@ -100,6 +100,10 @@ for i in $(seq 1 $MAX_ITERATIONS); do echo "" echo "Ralph completed all tasks!" echo "Completed at iteration $i of $MAX_ITERATIONS" + echo "" + echo "Tip: clean up Ralph's intermediary files when you're ready:" + echo " Via your AI coding tool : /flick" + echo " Via script (from project): path/to/ralph/flick.sh" exit 0 fi diff --git a/skills/flick/SKILL.md b/skills/flick/SKILL.md new file mode 100644 index 000000000..f8cbc799a --- /dev/null +++ b/skills/flick/SKILL.md @@ -0,0 +1,54 @@ +--- +name: flick +description: "Clean up Ralph intermediary files (prd.json, progress.txt) after a completed run. Triggers on: flick, flick booger, clean up ralph files, remove prd.json, delete progress.txt, ralph cleanup." +user-invocable: true +--- + +# Flick — Ralph Cleanup + +Finds and removes `prd.json` and `progress.txt` left behind by a Ralph run. + +--- + +## The Job + +Search for Ralph intermediary files in the following locations (relative to the current project directory, and at the user level): + +1. `{project_root}/` +2. `{project_root}/tasks/` +3. `{project_root}/ralph/` +4. `{project_root}/.agents/ralph/` +5. `{project_root}/.agents/skills/ralph/` +6. `{project_root}/.claude/ralph/` +7. `{project_root}/.claude/skills/ralph/` +8. `~/.agents/ralph/` +9. `~/.agents/skills/ralph/` +10. `~/.claude/ralph/` +11. `~/.claude/skills/ralph/` + +Where `{project_root}` is the root of the current project (the working directory). + +--- + +## Steps + +1. **Find all instances** of `prd.json` and `progress.txt` across every location above. + +2. **If nothing is found**, tell the user: no Ralph files found. + +3. **For each location that has files:** + - Show the location path and which files were found there + - If a `prd.json` exists at that location, show its first 15 lines + - Ask the user: "Delete these files? (y/n)" + - If yes, delete them and confirm each deletion + - If no, skip and move to the next location + +4. **When all locations are processed**, give a brief summary of what was deleted vs skipped. + +--- + +## Notes + +- Be precise about paths when reporting — show the full path of each file found and deleted. +- Do not delete any files without confirmation. +- If the user passes `--nuke`, `--all`, or says "nuke it" / "delete everything" / "delete all", skip the per-location prompts and delete all found files immediately.