From ddf48dc7ac780da1aacdff4e03f1d7da255b8f39 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 31 May 2026 12:19:34 -0500 Subject: feat: add rename-ai-artifact tool and rename the drill-deck family to flashcard Renaming an .ai artifact by hand is the kind of mechanical job that gets done incompletely: the canonical copy moves but the mirror doesn't, a reference in the INDEX is missed, a trigger phrase points at the old name. I'd also assumed a rename was costly because references scatter, when the index update is trivial and the drift check already guards it. So I built the discipline into a script instead of re-deriving it each time. scripts/rename-ai-artifact.sh takes old and new basenames, moves the file in both the canonical and mirror trees, and rewrites every reference repo-wide on a token boundary so renaming "foo" can't corrupt "foobar" or "foo-bar". It rewrites the underscore module-name variant too (a hyphenated script imported as foo_bar via importlib), leaves the archived session records under sessions/ alone because they're history, and runs workflow-integrity + sync-check at the end to prove no drift. rename-artifact.org documents it and indexes the triggers. Then I used the tool to do the rename that prompted it: the org-drill deck workflow and its helpers are now flashcard-named, since "flashcard" is the word you'd actually search for. The renamed set is flashcard-review.org plus flashcard-stats.py, flashcard-sync, flashcard-to-anki.py, and flashcard-diff-ids.py, with their tests, every reference, and the INDEX entry updated. The deck is still an org-drill deck under the hood, so the ":drill:" tag handling and the "drill deck" trigger phrases stay. I added "review/update the flashcards" alongside them. Tests: 9 bats for the rename tool (including the prefix-collision and history-preservation edges), and the renamed script suites all pass under make test. --- .ai/scripts/tests/drill-deck-sync.bats | 38 ---------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 .ai/scripts/tests/drill-deck-sync.bats (limited to '.ai/scripts/tests/drill-deck-sync.bats') diff --git a/.ai/scripts/tests/drill-deck-sync.bats b/.ai/scripts/tests/drill-deck-sync.bats deleted file mode 100644 index e141cab..0000000 --- a/.ai/scripts/tests/drill-deck-sync.bats +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env bats -# Tests for the drill-deck-sync wrapper: argument handling + the stats gate. -# The clean end-to-end path runs drill-to-anki.py (uv-resolved genanki) and is -# not exercised here; these cover the guard paths that stop before that step. - -setup() { - SCRIPT_DIR="$(cd "$(dirname "$BATS_TEST_FILENAME")/.." && pwd)" - SYNC="$SCRIPT_DIR/drill-deck-sync" - TMP="$(mktemp -d)" -} - -teardown() { - rm -rf "$TMP" -} - -@test "drill-deck-sync: no args exits 2" { - run "$SYNC" - [ "$status" -eq 2 ] -} - -@test "drill-deck-sync: missing source file exits 2" { - run "$SYNC" "$TMP/nope.org" - [ "$status" -eq 2 ] -} - -@test "drill-deck-sync: stats gate failure exits 1 and writes no apkg" { - cat > "$TMP/dirty.org" <<'EOF' -#+TITLE: DeepSat Org-Drill Flashcards - -* Section -** DeepSat :drill: -*** Answer -A satellite company. -EOF - run "$SYNC" "$TMP/dirty.org" - [ "$status" -eq 1 ] - [ ! -f "$HOME/sync/phone/anki/dirty.apkg" ] -} -- cgit v1.2.3