Files
claudetools/.claude/scripts/tmp-promotion-check.sh
Mike Swanson 9581d87589 harness: scratch graduation pipeline (push side + spec) + flarum first test case
- graduation-push.sh: tar+scp scratch -> BEAST graduation-inbox over Tailscale (decoupled
  from /save, soft-fail if BEAST off). Tested: 241 files -> BEAST.
- docs/graduation-pipeline.md: full spec (push -> Ollama triage on BEAST GPU via API ->
  reviewed sanitize+git-mv). Secrets never enter git; ride the encrypted link to BEAST only.
- tmp-promotion-check.sh: rewritten pure-builtin (0.4s) after the per-file grep/fork loop
  hung /save for 4 min on Windows at ~240 scratch files. Deep triage moves to the pipeline.
- forum-post: GRADUATED the canonical flarum poster from scratch ->
  skills/forum-post/scripts/flarum-post.py (s9e markdown->XML + DB insert machinery), with
  the hardcoded IX SSH + Flarum DB passwords swapped to vault lookups. First pipeline test case.
- Vaulted the Flarum DB cred (services/flarum-community.sops.yaml) + sanitized the two
  plaintext copies in forum-post.md.
- errorlog: logged the WSL-stub correction + BEAST-Ollama-CPU(vram=0) finding + the
  promotion-check hang, all via the new log helper.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 12:55:48 -07:00

50 lines
2.0 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# Purpose: Advisory pre-save/commit check. The scratch dirs (tmp/, temp/, .claude/tmp/)
# are gitignored, so anything in them is INVISIBLE to git and will be lost on
# cleanup. Before a /save or /scc, surface what's sitting there and flag the
# files worth GRADUATING to a permanent home (per .claude/TEMP_GRADUATION.md).
# Usage: bash .claude/scripts/tmp-promotion-check.sh
# Behavior: read-only, never blocks. Always exits 0. Prints nothing when scratch is empty.
# Origin: added 2026-06-12 (wired into /save + /scc). See feedback in TEMP_GRADUATION.md.
set -u
ROOT="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
cd "$ROOT" || exit 0
SCRATCH_DIRS=(tmp temp .claude/tmp)
# Collect files across the scratch dirs (skip the dirs themselves; ignore .gitkeep).
mapfile -t FILES < <(
for d in "${SCRATCH_DIRS[@]}"; do
[ -d "$d" ] || continue
find "$d" -type f ! -name '.gitkeep' 2>/dev/null
done
)
[ "${#FILES[@]}" -eq 0 ] && exit 0 # nothing in scratch — stay silent
echo "[INFO] Promotion check: ${#FILES[@]} file(s) in scratch dirs (gitignored — NOT committed)."
echo " Graduate anything worth keeping before it's lost. Guide: .claude/TEMP_GRADUATION.md"
# PURE-BUILTIN loop (no per-file subprocesses) — `basename`/`wc` forks ×N hung this for
# 20s+ on Windows Git-bash at ~240 scratch files (fork is expensive). Flag scripts by
# extension only; deep triage (doc size, "is it referenced", what's it for) is deferred to
# the async Ollama graduation pass (see TEMP_GRADUATION.md). Keep this O(N) and fork-free.
candidates=0
for f in "${FILES[@]}"; do
case "${f##*/}" in
*.py|*.sh|*.ps1|*.psm1|*.js|*.rb|*.pl|*.php)
echo " [GRADUATE?] $f (script)"
candidates=$((candidates + 1)) ;;
esac
done
if [ "$candidates" -eq 0 ]; then
echo " No graduation candidates (looks like pure scratch — safe to leave or delete)."
else
echo " -> $candidates candidate(s). Move with: git mv <file> <scripts/|clients/<x>/reports/|projects/<p>/tools/>"
fi
exit 0