#!/usr/bin/env bats # The "Colloquialisms and Expansions" convention and its "the list" before-close # queue must stay wired into the synced template: the protocols.org reference # section, and the wrap-it-up.org Step 1 sub-step that drains the queue before # the Summary. Guards against either being dropped in a future edit or sync. setup() { REPO_ROOT="$(cd "$(dirname "$BATS_TEST_FILENAME")/../.." && pwd)" PROTO="$REPO_ROOT/claude-templates/.ai/protocols.org" WRAP="$REPO_ROOT/claude-templates/.ai/workflows/wrap-it-up.org" PROTO_MIRROR="$REPO_ROOT/.ai/protocols.org" WRAP_MIRROR="$REPO_ROOT/.ai/workflows/wrap-it-up.org" } @test "protocols.org documents the Colloquialisms and Expansions convention" { grep -qF '* Colloquialisms and Expansions' "$PROTO" grep -q 'the list' "$PROTO" grep -q 'Before-Close Queue' "$PROTO" grep -qF 'tell ' "$PROTO" grep -q 'inbox-send' "$PROTO" } @test "the colloquialisms reference scopes the queue to the session anchor" { grep -q 'session-context.org' "$PROTO" # A must-outlive item is a todo.org task, not a list item. grep -q 'must outlive the session' "$PROTO" } @test "wrap-it-up Step 1 works the Before-Close Queue before the Summary" { grep -qF 'Work the Before-Close Queue' "$WRAP" grep -q 'oldest-first' "$WRAP" grep -q 'silent no-op' "$WRAP" # The queue must be worked before the Summary is written, so its edits ride # this wrap's commit. Assert it sits ahead of the first Summary sub-step. local queue_line kb_line queue_line=$(grep -n 'Work the Before-Close Queue' "$WRAP" | head -1 | cut -d: -f1) kb_line=$(grep -n 'Early KB reflection' "$WRAP" | head -1 | cut -d: -f1) [ "$queue_line" -lt "$kb_line" ] } @test "the convention is mirrored to the committed .ai copy" { diff -q "$PROTO" "$PROTO_MIRROR" diff -q "$WRAP" "$WRAP_MIRROR" }