Phase 6, the last of the fresh-install spec. 159 scripts lose their .sh: 110 contracts, 47 Vicinae commands, 2 compositor contracts. A shebang and the executable bit already select the interpreter. The extension only ever added something that had to stay in sync, and the rename proved the point twice over in the space of an hour. The spec's stated risk was Vicinae's script discovery. One script was renamed and reloaded on its own before the other 46 followed; it came back as scripts:panama.capture and all 47 resolve. What the probe turned up instead is that the extension was never only a filename: Vicinae's command IDs embed it, so every ID changed. Nothing in this repository refers to them, so nothing breaks. The only trace is Vicinae's metadata.json, whose visited map had two Panama entries that are now orphaned -- two commands lost their usage ranking and will earn it back. Worth knowing before anyone renames these again on a machine that has a keybind pointing at one. Rewriting the references by exact filename missed two things it structurally could not see: a name built from a variable, settings-$page.sh, and a glob, -name '*.sh'. Both were in the contract that counts the generated commands, which promptly reported 47 expected and 0 found. The mechanical part of a rename is the part that looks finished. The three subcommands. panama doctor fronts a health check that already existed and already ran at the end of every install but could not be reached from a terminal. panama upgrade re-runs the installer from anywhere. panama test runs the suite, which had no entry point at all -- 121 files that were the main safety net in this repository and were invisible in it. Writing that runner found three tests nothing was running. calendar_agenda_bridge_test, home_assistant_bridge_test and kdeconnect_bridge_test are unittest suites without the executable bit, so no contract invoked them and the first draft of the runner skipped them silently. All three pass, and have passed unobserved for weeks. The runner collects *_test.py as well now, because a runner with a blind spot is worse than no runner for the same reason a dependency checker with one is: it reports PASS. Six worktrees pruned. Each was re-checked rather than trusted to the spec's list, and two needed it: panama-commands is not on feat/panama-commands but on feat/gnome-tweaks-parity, and fix/panama-displays-review reads [ahead 3] -- ahead of its remote, not of main, with every commit patch-equivalent to landed work. roadmap-completion stays; it has five commits that are genuinely unlanded. The branches are left alone: pruning a worktree costs nothing, deleting a branch is a decision. 121 contracts pass. Claude-Session: https://claude.ai/code/session_01NvgBuSWB5sE43yWmg21ozj
120 lines
5.0 KiB
Bash
Executable File
120 lines
5.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
repo_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
commands_dir="$repo_dir/config/local/share/vicinae/scripts"
|
|
work="$(mktemp -d /tmp/panama-commands.XXXXXX)"
|
|
dispatch_log="$work/dispatch.log"
|
|
|
|
fail() {
|
|
printf 'Panama commands contract: %s\n' "$1" >&2
|
|
exit 1
|
|
}
|
|
|
|
cleanup() {
|
|
rm -rf "$work"
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
declare -A expected=(
|
|
[open-control-center]=control-center
|
|
[open-notifications]=notifications
|
|
[open-calendar]=calendar
|
|
[open-clipboard]=clipboard
|
|
[open-mission-control]=overview
|
|
[open-settings]=settings
|
|
[check-system-health]=health
|
|
[toggle-dnd]=dnd
|
|
[toggle-caffeine]=caffeine
|
|
[toggle-night-light]=night-light
|
|
[start-focus]=focus-start
|
|
[end-focus]=focus-end
|
|
[capture]=capture
|
|
[screen-intelligence]=intelligence
|
|
[quick-screenshot]=screenshot
|
|
[toggle-microphone]=microphone
|
|
[open-prism-gallery]=gallery
|
|
[restart-shell]=restart-shell
|
|
)
|
|
|
|
# The per-page settings commands are generated from the settings page list, so
|
|
# they are enumerated from that list rather than restated here -- a hand-written
|
|
# copy would have to be edited every time a page is added, which is exactly the
|
|
# kind of second list this generator exists to avoid.
|
|
sidebar="$repo_dir/config/dot/quickshell/modules/settings/SettingsSidebar.qml"
|
|
while read -r page; do
|
|
[[ -n "$page" ]] || continue
|
|
[[ "$page" == "home" ]] && continue
|
|
expected[settings-$page]="settings-page $page"
|
|
done < <(grep -oE '\{ page: "[a-z-]+"' "$sidebar" | sed 's/.*"\([a-z-]*\)"/\1/')
|
|
|
|
(( ${#expected[@]} > 18 )) || fail 'no generated per-page commands were found; run scripts/panama-settings-commands'
|
|
|
|
# Generated commands must match their source. A stale command dispatches to a
|
|
# page that has been renamed or removed, and the launcher reports nothing wrong.
|
|
"$repo_dir/config/dot/quickshell/scripts/panama-settings-commands" --check >/dev/null \
|
|
|| fail 'the generated per-page commands are stale; run scripts/panama-settings-commands'
|
|
|
|
mkdir -p "$work/home/.config/quickshell/scripts"
|
|
cat >"$work/home/.config/quickshell/scripts/panama-action" <<'EOF'
|
|
#!/usr/bin/env bash
|
|
printf '%s\n' "$*" >>"$PANAMA_COMMAND_TEST_LOG"
|
|
EOF
|
|
chmod +x "$work/home/.config/quickshell/scripts/panama-action"
|
|
|
|
[[ -d "$commands_dir" ]] || fail 'Vicinae command directory is missing'
|
|
|
|
# Every file in the directory, not a glob on an extension. These scripts carry
|
|
# none: a shebang and the executable bit already select the interpreter, and an
|
|
# extension is one more thing that has to stay in sync -- which it did not.
|
|
mapfile -t actual_files < <(find "$commands_dir" -maxdepth 1 -type f -printf '%f\n' | sort)
|
|
[[ ${#actual_files[@]} -eq ${#expected[@]} ]] \
|
|
|| fail "expected ${#expected[@]} commands, found ${#actual_files[@]}"
|
|
|
|
declare -A seen_titles=()
|
|
for script_name in "${!expected[@]}"; do
|
|
script="$commands_dir/$script_name"
|
|
[[ -x "$script" ]] || fail "$script_name is missing or not executable"
|
|
|
|
vicinae script check "$script" >/dev/null \
|
|
|| fail "$script_name is rejected by Vicinae"
|
|
|
|
title="$(sed -n 's/^# @vicinae.title //p' "$script")"
|
|
# No product prefix: this is the desktop's own settings, not a third-party
|
|
# add-on announcing itself in someone else's launcher. Uniqueness still
|
|
# matters, because two commands with one title are indistinguishable there.
|
|
[[ -n $title ]] || fail "$script_name has no title"
|
|
[[ $title != Panama* ]] || fail "$script_name still carries the product prefix: $title"
|
|
[[ -z ${seen_titles[$title]+x} ]] || fail "duplicate launcher title: $title"
|
|
seen_titles[$title]=1
|
|
|
|
grep -Fxq '# @vicinae.mode silent' "$script" \
|
|
|| fail "$script_name does not close quietly after success"
|
|
grep -Fq '# @vicinae.description ' "$script" \
|
|
|| fail "$script_name has no searchable description"
|
|
grep -Fq '# @vicinae.keywords ' "$script" \
|
|
|| fail "$script_name has no search vocabulary"
|
|
grep -Fxq '# @vicinae.icon ../../icons/hicolor/scalable/apps/panama-settings.svg' "$script" \
|
|
|| fail "$script_name does not use the Panama application identity"
|
|
|
|
if [[ $script_name == check-system-health ]]; then
|
|
[[ $title == 'Check System Health' ]] \
|
|
|| fail "health command has the wrong title: $title"
|
|
grep -Fxq '# @vicinae.schemaVersion 1' "$script" \
|
|
|| fail 'health command does not use schema version 1'
|
|
grep -Fxq '# @vicinae.keywords ["health", "doctor", "repair", "services"]' "$script" \
|
|
|| fail 'health command has the wrong search vocabulary'
|
|
grep -Fxq 'exec "$HOME/.config/quickshell/scripts/panama-action" health' "$script" \
|
|
|| fail 'health command bypasses the stable dispatcher path'
|
|
fi
|
|
|
|
: >"$dispatch_log"
|
|
HOME="$work/home" PANAMA_COMMAND_TEST_LOG="$dispatch_log" "$script"
|
|
dispatched="$(cat "$dispatch_log")"
|
|
[[ $dispatched == "${expected[$script_name]}" ]] \
|
|
|| fail "$script_name dispatched [$dispatched], expected [${expected[$script_name]}]"
|
|
done
|
|
|
|
printf 'Panama commands contract: PASS (%d commands)\n' "${#expected[@]}"
|