From 2235d5b120953d033c3fe9a0cfbd03cd2b45129c Mon Sep 17 00:00:00 2001 From: softmaxe <94467584+softmaxe@users.noreply.github.com> Date: Mon, 16 Nov 2026 22:11:52 +0800 Subject: [PATCH] chore: add ferry verification skill --- .agents/skills/verify-ferry/SKILL.md | 152 ++++++++++++++++++ .../skills/verify-ferry/features/README.md | 76 +++++++++ .agents/skills/verify-ferry/features/cli.md | 38 +++++ .../verify-ferry/features/explicit-window.md | 44 +++++ .../verify-ferry/features/focused-window.md | 48 ++++++ .../skills/verify-ferry/features/follow.md | 44 +++++ .../skills/verify-ferry/features/raycast.md | 55 +++++++ .agents/skills/verify-ferry/scripts/verify.sh | 111 +++++++++++++ 8 files changed, 568 insertions(+) create mode 100644 .agents/skills/verify-ferry/SKILL.md create mode 100644 .agents/skills/verify-ferry/features/README.md create mode 100644 .agents/skills/verify-ferry/features/cli.md create mode 100644 .agents/skills/verify-ferry/features/explicit-window.md create mode 100644 .agents/skills/verify-ferry/features/focused-window.md create mode 100644 .agents/skills/verify-ferry/features/follow.md create mode 100644 .agents/skills/verify-ferry/features/raycast.md create mode 100755 .agents/skills/verify-ferry/scripts/verify.sh diff --git a/.agents/skills/verify-ferry/SKILL.md b/.agents/skills/verify-ferry/SKILL.md new file mode 100644 index 0000000..279546a --- /dev/null +++ b/.agents/skills/verify-ferry/SKILL.md @@ -0,0 +1,152 @@ +--- +name: verify-ferry +description: Build and verify ferry's macOS CLI, window movement and Space following, and Raycast Script Commands using the repository's CLI tests and live desktop harness. Use when proving ferry behavior or checking a change with retained evidence. +--- + +# Verify ferry + +Read [the feature map](features/README.md), then the feature being exercised. +The primary surface is a one-shot CLI that moves macOS windows; Raycast scripts +are a second entry point. There is no daemon, port, auth, database, or seed data. +Never substitute an installed Homebrew binary for the checkout's binary. + +## Launch + +Run from the repository root in a persistent shell: + +```sh +FERRY_VERIFY="$PWD/.agents/skills/verify-ferry/scripts/verify.sh" +FERRY_EVIDENCE="$("$FERRY_VERIFY" launch)" +export FERRY_VERIFY FERRY_EVIDENCE +FERRY_BIN="$FERRY_EVIDENCE/scratch/ferry" +export FERRY_BIN +printf 'Evidence: %s\n' "$FERRY_EVIDENCE" +"$FERRY_VERIFY" doctor "$FERRY_EVIDENCE" +``` + +Launch builds with the existing Makefile into a fresh scratch directory. It needs +Apple silicon, Xcode Command Line Tools or Xcode, and a macOS 26+ SDK. The default +build is arm64, minimum macOS 26.0, version from `Makefile`. Readiness is a matching +source/binary fingerprint, correct `--version`, and passing architecture, minimum +OS, and AppKit linkage checks. A CLI invocation runs once and exits; launch does +not start a service. A failed build retains its logs and removes its scratch. + +The supported runtime is macOS 26. CLI-only checks can run without Accessibility +or a desktop. Results on a newer OS are compatibility observations, not proof on +the supported OS. + +No app data isolation is needed for CLI checks, but **the desktop is shared**. +Never run two movement journeys together or move an existing user window. +The `desktop` helper reserves a per-user lock, uses the existing harness's own +two windows, and restores the prior app. It cannot isolate Mission Control from +the user, yabai, hotkeys, or other tools. Do not drive while they are moving +windows. If a lock already exists, stop; do not remove someone else's lock. +For manual journeys, reserve the same lock and release only the lock you created. + +## Doctor + +```sh +"$FERRY_VERIFY" doctor "$FERRY_EVIDENCE" +``` + +This is read-only with respect to the app and desktop: it validates this run's +build and source without moving windows or requesting permissions. Run it first +when anything looks off. A source edit invalidates the run; launch a new one. +It does not assert desktop readiness. The live harness checks Accessibility +without prompting and requires two normal Spaces on the active display. A skip +returns `77` from `build/follow-test`; `make test-follow` typically returns `2` +instead, so read `desktop/stderr.txt` for `SKIP:` rather than treating it as pass. +Do not silently grant permissions, create Spaces, or alter Mission Control settings. + +## Drive + +CLI discovery and argument validation, in a separate real PTY: + +```sh +/usr/bin/script -q "$FERRY_EVIDENCE/cli.pty.txt" \ + "$FERRY_VERIFY" cli "$FERRY_EVIDENCE" +``` + +Require exit `0` and the `PASS:` line. The helper executes real `--help`, `-h`, +`--version`, and invalid input, verifies stream routing, and reuses `tests/cli.sh`. +All these paths return before WindowServer calls; inspect `main` in `src/ferry.m` +when changing the argument cases. There is **no dry-run flag**: a valid destination +can really move a window. Do not treat `--no-follow` as a dry run. + +Background explicit-window movement, already-there behavior, and no-follow: + +```sh +"$FERRY_VERIFY" desktop "$FERRY_EVIDENCE" +``` + +This executes `make BIN="$FERRY_BIN" test-follow`, reusing `tests/follow.m`. +Require all three `ok:` messages, no `FAIL:` or `SKIP:`, and exit `0`. The test +checks actual WindowServer membership and active Space, including that the other +fixture window stays put. It does not cover focused-window selection or Raycast. +Those journeys require native desktop UI control and the matching feature recipe. +Missing UI control, permission, or suitable Spaces is an unmet precondition; +report it instead of weakening the journey. + +For a further command, preserve its action and streams with a fresh label: + +```sh +"$FERRY_VERIFY" capture "$FERRY_EVIDENCE" binary-contract \ + tests/binary.sh "$FERRY_BIN" arm64 26.0 +``` + +Each label is single-use. This prevents a retry from overwriting failed evidence. + +## Evidence + +`launch` prints the absolute artifact directory, normally under `$TMPDIR` as +`ferry-verification.XXXXXX`. It contains platform, revision, source diff/hashes, +binary hash, and per-action `command.txt`, `stdout.txt`, `stderr.txt`, and +`exit-code.txt`. The PTY transcript records the CLI session. Preserve the directory +and report its absolute path. The binary itself is scratch, not retained evidence. + +Exercise the real CLI or launcher, never replace ferry with a mock or use private +setters to manufacture the result. Capture the action and resulting state. +For movement, a successful exit or `focus requested` is insufficient: observe +the window's destination **and** the active Space independently. The existing +live harness supplies those assertions for its three covered paths. A visual +journey also needs before/after screenshots of the fixture and a short recording +of movement/follow timing using available native UI capture; save them in this +artifact directory. Record the selected window ID and source/destination indexes. +Do not infer animation latency from ferry's verbose internal timing. + +For manual CLI launches there should be no app data files, background service, +network activity, or git-ref changes; compare the relevant filesystem/process +state if the change could introduce them. No journey here mocks an external +boundary. Shell-running a Raycast script proves the script path only; the real +Raycast action/hotkey must be exercised separately for launcher claims. + +## Cleanup + +Run after successful **and failed** iterations: + +```sh +"$FERRY_VERIFY" cleanup "$FERRY_EVIDENCE" +test ! -e "$FERRY_EVIDENCE/scratch" +test -s "$FERRY_EVIDENCE/build/command.txt" +test -s "$FERRY_EVIDENCE/source.sha256" +test -s "$FERRY_EVIDENCE/cleanup.txt" +``` + +The live harness normally closes its own windows and restores the previous app +in `@finally`. Let it finish; do not force-kill it mid-switch. After an abnormal +termination, inspect the exact fixture PID/window IDs from that run and close +only those windows/processes; restore the recorded source Space. Never kill by +process name. `cleanup` removes only the run's scratch, not evidence or the shared +`build/` directory. `make test-follow` may leave its reusable `build/follow-test`. +Manual recipes must stop their recorded fixture PID and release their own lock +before scratch removal. Verify the evidence files for the chosen feature still +exist after cleanup; copy artifacts to durable storage if needed before OS temp +cleanup. Do not commit desktop captures or local evidence by default. + +## Helpers + +[scripts/verify.sh](scripts/verify.sh) is executable and provides `launch`, +`doctor`, `cli`, `desktop`, `capture`, and `cleanup` as invoked above. It requires +the system Bash and existing Makefile/test tools, no package installation. +Feature-specific manual setup is documented in the map, not hidden in the helper. +Keep the map current with `/maintain-verification-skill` as ferry changes. diff --git a/.agents/skills/verify-ferry/features/README.md b/.agents/skills/verify-ferry/features/README.md new file mode 100644 index 0000000..c1c45e2 --- /dev/null +++ b/.agents/skills/verify-ferry/features/README.md @@ -0,0 +1,76 @@ +# Ferry verification map + +This is the maintained map of user-visible verification paths. Read this index +before choosing a journey. One passing journey is not full application coverage. + +## Baseline preconditions + +- Launch and doctor using [the skill](../SKILL.md); use its run-owned `FERRY_BIN`. +- CLI-only checks need no desktop. Live journeys need a local logged-in desktop, + Accessibility for the launcher, two normal Spaces, and stable Space numbering. +- Do not rearrange Spaces or change system permissions automatically. Report a + missing precondition as failure to execute the journey, with its reason. +- For the manual recipes below, confirm Mission Control shows the current Space + as global index 1 and destination as global index 2; both must be normal Spaces + on the active display. Do not assume these indexes from screen position on a + multiple-display system. The automated regression discovers indexes itself. +- Only use disposable fixture windows. Reserve the desktop lock specified in the + skill. Do not double-drive a shared desktop or shared Raycast settings. + +## Driving conventions + +Use the executable helper for command/stream/exit evidence and native UI tools +for visible app focus and launcher actions. Manual desktop recipes share this +setup after `doctor`; the first command reserves the lock: + +```sh +mkdir "${TMPDIR:-/tmp}/ferry-verification-desktop.lock" +make build/follow-test +build/follow-test --fixture > "$FERRY_EVIDENCE/fixture-ids.txt" \ + 2> "$FERRY_EVIDENCE/fixture-stderr.txt" & +FERRY_FIXTURE_PID=$! +printf '%s\n' "$FERRY_FIXTURE_PID" > "$FERRY_EVIDENCE/fixture-pid.txt" +``` + +Wait for `fixture-ids.txt` to contain two nonzero decimal window IDs and for both +windows to appear on source Space 1. Record the original frontmost app and Space +with native UI control before starting. The titles are `Ferry follow test: target` +and `Ferry follow test: other window`. Read IDs only after readiness: + +```sh +read -r FERRY_TARGET FERRY_OTHER < "$FERRY_EVIDENCE/fixture-ids.txt" +export FERRY_TARGET FERRY_OTHER +``` + +Focus windows by their title and owning fixture process, never by coordinates or +guessing a PID as a window ID. Capture the before state, action, resulting window +location and active Space. After each manual journey, close only this fixture: + +```sh +kill -TERM "$FERRY_FIXTURE_PID" +wait "$FERRY_FIXTURE_PID" || true +rmdir "${TMPDIR:-/tmp}/ferry-verification-desktop.lock" +``` + +Restore the original app and Space with native UI control, then run the skill's +cleanup. If fixture startup fails, still stop the PID you started and release +your lock. Do not launch a second fixture to hide a broken first attempt. + +## Proof and skip reporting + +- Record feature ID and entry point, command, stdout, stderr, and exit code. +- UI journeys require before/after screenshots and movement recording; retain + evidence through cleanup. Native UI absence is an unmet precondition. +- `focus requested` does not assert that the active Space changed. Inspect the + actual active Space and the selected window's location. +- `make test-follow` covers explicit IDs, already-there, and no-follow only. +- Report Raycast shell, Raycast action, hotkey, and focused CLI paths separately. +- A missing prerequisite must not turn into a different, easier passing journey. + +## Features + +- [CLI discovery and validation](cli.md): help, version, invalid arguments, streams. +- [Move the focused window](focused-window.md): positional CLI and AX selection. +- [Move an explicit window](explicit-window.md): background selection and already-there. +- [Follow and no-follow](follow.md): active Space behavior and verbose output. +- [Raycast commands](raycast.md): script, action, and hotkey entry points. diff --git a/.agents/skills/verify-ferry/features/cli.md b/.agents/skills/verify-ferry/features/cli.md new file mode 100644 index 0000000..d2ed067 --- /dev/null +++ b/.agents/skills/verify-ferry/features/cli.md @@ -0,0 +1,38 @@ +# CLI discovery and validation + +Users discover the syntax and version without moving windows, and receive useful +argument errors with a distinct exit status. + +## Sub-features + +- `cli-help`: `--help` and `-h` print identical usage to stdout, exit 0. +- `cli-version`: `--version` prints `ferry` and the Makefile version, exit 0. +- `cli-invalid`: absent, nonnumeric, zero, overflowing, duplicate, and unknown + arguments are rejected with exit 2; invalid/missing window IDs are rejected. +- `cli-streams`: success text goes to stdout; argument errors go to stderr. + +## How to get to it (user POV) + +Run `ferry --help`, `ferry -h`, or `ferry --version` from a terminal. Invalid +invocations use the same executable, not a separate validation interface. + +## Driving it with verify.sh + +Preconditions: launch and doctor passed; no live desktop or Accessibility needed. + +- **Drive all mapped CLI cases.** Run `/usr/bin/script -q + "$FERRY_EVIDENCE/cli.pty.txt" "$FERRY_VERIFY" cli "$FERRY_EVIDENCE"`. + Require exit 0 and the final `PASS:` line. +- **Inspect proof.** `help`, `help-short`, `version`, and `invalid-index` action + folders contain separate streams and statuses. `contract/stdout.txt` contains + ten `ok:` messages from the existing CLI tests; the helper additionally checks + identical help aliases and stream routing. +- **Confirm teardown.** Run the skill cleanup. The PTY transcript and all action + folders remain while `scratch/ferry` is removed. + +## Gotchas + +- Valid destination arguments would enter real window-management code. The safe + cases above exit during parsing, before WindowServer access; this is not a mock. +- `tests/cli.sh` merges streams internally, so its pass alone cannot prove routing. +- A `make test` pass does not prove a move or a Space focus change. diff --git a/.agents/skills/verify-ferry/features/explicit-window.md b/.agents/skills/verify-ferry/features/explicit-window.md new file mode 100644 index 0000000..7342116 --- /dev/null +++ b/.agents/skills/verify-ferry/features/explicit-window.md @@ -0,0 +1,44 @@ +# Move an explicit window + +Users select a particular macOS window ID even when its app is in the background. +The selected window moves and follows; another window from the same app stays. + +## Sub-features + +- `explicit-background`: select a background app's non-key window by ID. +- `explicit-already-there`: a repeated destination succeeds without another move. +- `explicit-stale-id`: a nonexistent window ID fails with runtime exit 1. + +## How to get to it (user POV) + +Run `ferry --window 1234 2`, replacing the example ID with a current macOS window +ID. IDs identify windows, not processes, and become stale when windows close. + +## Driving it with verify.sh + +Preconditions: launch/doctor passed; live local desktop, Accessibility, two normal +Spaces on its active display, and no other desktop journey running. + +- **Background selection and repeated destination.** Run `"$FERRY_VERIFY" + desktop "$FERRY_EVIDENCE"`. Require `ok: background --window moves and follows + the selected window` and `ok: --window already on the active destination Space`. + The harness creates two windows, backgrounds them, selects the non-key one, + calls the real CLI, and independently checks selected/sibling Space membership. +- **Inspect action evidence.** `desktop/command.txt` identifies the checkout binary + passed to `make`; `desktop/stdout.txt` includes real IDs, indexes, verbose + results, and assertions. Require overall exit 0 and no `SKIP:`/`FAIL:`. +- **Stale ID.** In a separate manual fixture journey from the index, retain + `FERRY_TARGET`, close that fixture through its recorded PID, and immediately run + `"$FERRY_VERIFY" capture "$FERRY_EVIDENCE" stale-window "$FERRY_BIN" --window + "$FERRY_TARGET" 2`. Require exit 1 and `window N not found` in stderr, with no + other window moved. If the OS reused that ID, fail the setup and use a new run. + +## Gotchas + +- Harness exit 77 or a `SKIP:` message is missing coverage, not success. `make` + can translate it into exit 2. Look at both streams. +- Resolving an ID on an inactive Space may lack AX support: ferry can move + successfully without following. Verify actual active Space independently. +- The regression checks already-there on the active destination. Already-there + on an inactive destination is a distinct precondition and is not covered. +- Existing harness cleanup runs in `@finally`; force termination can bypass it. diff --git a/.agents/skills/verify-ferry/features/focused-window.md b/.agents/skills/verify-ferry/features/focused-window.md new file mode 100644 index 0000000..b24c738 --- /dev/null +++ b/.agents/skills/verify-ferry/features/focused-window.md @@ -0,0 +1,48 @@ +# Move the focused window + +The positional command moves the focused normal window to an existing Space and +follows it. Accessibility identifies the focused window; the visible window list +provides a fallback if the app's focused Accessibility window cannot be read. + +## Sub-features + +- `focused-move`: choose the focused window without passing `--window`. +- `focused-selection`: move the chosen window, leaving its sibling in place. +- `focused-fallback`: use the frontmost app's visible normal window without AX. + +## How to get to it (user POV) + +Run `ferry 2` in a terminal to move that terminal, or bind the same command to a +launcher/hotkey to move another app's focused window. Raycast has its own recipe. + +## Driving it with verify.sh and native UI + +Preconditions: manual desktop baseline and fixture from the index; both windows +start on global Space 1. Capture source state and start a short screen recording. + +- **Choose a window.** With native UI control, activate the fixture and focus + `Ferry follow test: target`. Run commands through the agent's non-GUI shell so + it does not steal focus. If the tool activates another app, stop and fix setup. +- **Move it.** Run `"$FERRY_VERIFY" capture "$FERRY_EVIDENCE" focused-move + "$FERRY_BIN" --verbose 2`. Require exit 0 and a verbose window ID equal to + `FERRY_TARGET`, with `via accessibility` and `focus requested`. +- **Prove the result.** Observe the active destination Space 2 and target window; + visit Space 1 to confirm `Ferry follow test: other window` stayed. Save before, + after, recording, and the observations in the artifact directory. +- **Fallback entry.** Only in a launcher already lacking Accessibility, repeat + a fresh fixture journey. Require `via window list`, the selected visible normal + window's ID, its actual destination, and actual focus outcome. Do not revoke + the user's permissions to manufacture this state. +- **Terminal entry.** If separately claiming interactive terminal coverage, use + a disposable terminal window, type the same positional command there, and + observe that terminal move and follow. The non-GUI fixture route does not prove + terminal launch behavior; close only the disposable window afterward. + +## Gotchas + +- The existing `test-follow` always uses `--window`; it does not cover this path. +- Missing AX or terminal UI access leaves the corresponding entry unverified. +- The focused window at invocation matters. Running in an existing terminal + moves a user's terminal and violates the disposable-window baseline. +- AX fallback may select a different normal window when an app has several; + record the observed window ID rather than assuming it is the key window. diff --git a/.agents/skills/verify-ferry/features/follow.md b/.agents/skills/verify-ferry/features/follow.md new file mode 100644 index 0000000..1ea2089 --- /dev/null +++ b/.agents/skills/verify-ferry/features/follow.md @@ -0,0 +1,44 @@ +# Follow and no-follow + +Default movement requests focus on the destination window. `--no-follow` moves +the window while keeping the active Space unchanged; verbose output explains +what ferry requested and measures its own work. + +## Sub-features + +- `follow-default`: the selected window moves and the active Space follows. +- `follow-disabled`: movement succeeds while the active Space remains unchanged. +- `follow-verbose`: window, selection method, destination and timings are visible. +- `follow-silent`: a successful move without `--verbose` produces no output. + +## How to get to it (user POV) + +Run `ferry 2`, `ferry --no-follow 2`, or add `--verbose` and/or `--window` to either +command. Raycast scripts invoke the default follow path silently. + +## Driving it with verify.sh and native UI + +Preconditions: the desktop harness baseline for the automated route; the manual +fixture baseline from the index for silent output and visual proof. + +- **Automated default and no-follow.** Run `"$FERRY_VERIFY" desktop + "$FERRY_EVIDENCE"` once per run. Require the background-follow assertion and + `ok: --no-follow leaves the active Space unchanged`. The latter returns the + selected window to source while independently checking the active destination + is unchanged. Verbose records must include `focus requested` then `not followed`. +- **Silent no-follow.** In a fresh manual fixture on Space 1 run `"$FERRY_VERIFY" + capture "$FERRY_EVIDENCE" silent-no-follow "$FERRY_BIN" --no-follow --window + "$FERRY_TARGET" 2`. Require exit 0 and empty stdout/stderr. Observe Space 1 + still active and confirm the target is on Space 2, sibling on Space 1. +- **Silent default.** From the same observed fixture, run `"$FERRY_VERIFY" capture + "$FERRY_EVIDENCE" silent-follow "$FERRY_BIN" --window "$FERRY_TARGET" 1`. + Require empty streams, exit 0, target back on source Space 1 and focus there. +- **Visual proof.** Record the complete action and before/after Space/window state. + Use actual visible switching to assess animation; the verbose timer excludes it. + +## Gotchas + +- No-follow really moves the window. It is not a safe no-op or dry-run option. +- `focus requested` alone cannot prove the screen followed. +- On inactive Spaces, missing Accessibility window references can prevent Follow. +- Automated verbose coverage does not cover silent output or focused selection. diff --git a/.agents/skills/verify-ferry/features/raycast.md b/.agents/skills/verify-ferry/features/raycast.md new file mode 100644 index 0000000..6812de5 --- /dev/null +++ b/.agents/skills/verify-ferry/features/raycast.md @@ -0,0 +1,55 @@ +# Raycast commands + +Users move their focused window with the supplied Space 1–5 Script Commands, +optionally assigning a hotkey. Scripts locate ferry or honor `FERRY_BINARY`. + +## Sub-features + +- `raycast-script`: each script selects its documented Space number. +- `raycast-action`: choosing a command in Raycast moves the previously focused window. +- `raycast-hotkey`: an assigned shortcut invokes the same user behavior. +- `raycast-lookup`: explicit override and documented binary search paths work. +- `raycast-missing`: a nonexecutable override reports the installation hint, exit 127. + +## How to get to it (user POV) + +Add this checkout's `raycast/` directory in Raycast Settings > Extensions > + > +Add Script Directory. Search `Ferry Window to Space 2` or invoke its assigned +hotkey. Scripts for Space 1, 3, 4, and 5 are separate user entry points. + +## Driving it with verify.sh and native UI + +Preconditions: native desktop control, manual fixture baseline from the index, +Raycast installed and already configured for these scripts for action/hotkey +coverage. Do not modify the user's extension directory or hotkeys implicitly. + +- **Shell script route.** Focus `Ferry follow test: target` and run `"$FERRY_VERIFY" + capture "$FERRY_EVIDENCE" raycast-shell env FERRY_BINARY="$FERRY_BIN" + /bin/zsh raycast/ferry-to-space-2.sh`. Require exit 0, empty streams, target on + Space 2 and active Space 2, sibling still on Space 1. This proves the real + wrapper and binary, not Raycast UI dispatch. +- **Missing binary.** Run `"$FERRY_VERIFY" capture "$FERRY_EVIDENCE" + raycast-missing env FERRY_BINARY="$FERRY_EVIDENCE/scratch/not-installed" + /bin/zsh raycast/ferry-to-space-2.sh`. Require exit 127 and `ferry binary not + found` plus the Homebrew hint in stderr, without moving anything. +- **Raycast action.** In a fresh fixture source state, invoke Raycast, search the + exact command title above, and choose it. Capture the action, selected target's + destination and active Space. First establish that the script's binary lookup + resolves this build; a terminal export does not propagate into Raycast. If + that cannot be established without changing persistent settings, report the + unmet precondition and keep the shell result separate. +- **Hotkey.** From another fresh source state, focus the fixture target and press + the already assigned shortcut. Require the same target/sibling/focus outcome. +- **Other scripts and lookup paths.** Repeat with each Space's named script only + when that normal destination exists; record each separately. For an unset + override, observe the executable selected by the script's actual search order + and require it to match this run's build before moving a fixture. Do not replace + installed executables just to manufacture lookup coverage. + +## Gotchas + +- Space 3–5 or Raycast configuration may be absent; those paths stay unverified. +- Scripts prefer `FERRY_BINARY`, then PATH and standard install directories, + then the checkout's `build/`. The isolated scratch binary needs the override. +- Homebrew installs the binary but does not install these scripts. +- Testing a wrapper with a fake binary proves neither movement nor real lookup. diff --git a/.agents/skills/verify-ferry/scripts/verify.sh b/.agents/skills/verify-ferry/scripts/verify.sh new file mode 100755 index 0000000..4f8665f --- /dev/null +++ b/.agents/skills/verify-ferry/scripts/verify.sh @@ -0,0 +1,111 @@ +#!/bin/bash +# Build and drive the real CLI while retaining commands, streams, and statuses. +set -euo pipefail + +root="$(cd "$(dirname "$0")/../../../.." && pwd -P)" +self="$root/.agents/skills/verify-ferry/scripts/verify.sh" +mode="${1:-}" + +capture() { + local label="$1" status=0 + shift + local step="$run/$label" + mkdir "$step" + { + printf 'cwd: %s\ncommand: ' "$root" + printf '%q ' "$@" + printf '\n' + } > "$step/command.txt" + "$@" > "$step/stdout.txt" 2> "$step/stderr.txt" || status=$? + printf '%s\n' "$status" > "$step/exit-code.txt" + return "$status" +} + +fingerprint() { + (cd "$root" && shasum -a 256 src/ferry.m Makefile) +} + +if [[ "$mode" == launch ]]; then + run="$(mktemp -d "${TMPDIR:-/tmp}/ferry-verification.XXXXXX")" + printf '%s\n' "$root" > "$run/checkout.txt" + mkdir "$run/scratch" + fingerprint > "$run/source.sha256" + sw_vers > "$run/platform.txt" + git -C "$root" rev-parse HEAD > "$run/revision.txt" + git -C "$root" diff -- src/ferry.m Makefile > "$run/source.diff" + if ! capture build make -C "$root" BIN="$run/scratch/ferry" all; then + rm -rf -- "$run/scratch" + printf 'Build failed; evidence retained at %s\n' "$run" >&2 + exit 1 + fi + shasum -a 256 "$run/scratch/ferry" > "$run/binary.sha256" + printf '%s\n' "$run" + exit 0 +fi + +run="${2:?usage: verify.sh launch | doctor/cli/desktop/cleanup | capture