From 5d83ff561e911c181f72125da5df84455f8bb8b2 Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Thu, 19 Nov 2026 20:50:20 +0100 Subject: [PATCH] deploy.sh pulls and runs from ~/src/todo Revert the AGENTS.md deploy line: kuhy has an uncommitted edit there, so changing the file blocked the pull. deploy.sh itself now redirects a worktree run to the main checkout, past phone_deploy's exit-49 guard. Todo: 2556952d Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 3 +-- pubspec.yaml | 2 +- scripts/deploy.sh | 26 +++++++++++++++++++++++--- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index abf01eb..539b00d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -50,8 +50,7 @@ and sync peer-to-peer through a GitHub repo used as dumb storage. - lint: `flutter analyze` - coverage: `flutter test --coverage --reporter=compact` - coverage-gaps: `coverage-gaps coverage/lcov.info` -- deploy: `git -C ~/src/todo pull --ff-only && ~/src/todo/scripts/deploy.sh` (MCP service, desktop pacman package, phone release; - exits non-zero unless every health check passes; runs from the main checkout because phone_deploy refuses a worktree, exit 49) +- deploy: `scripts/deploy.sh` (MCP service, desktop pacman package, phone release; exits non-zero unless every health check passes) ## Architecture diff --git a/pubspec.yaml b/pubspec.yaml index ed0a828..3841bb6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.0.102+1 +version: 1.0.103+1 environment: sdk: ^3.12.2 diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 785fa10..9077e9f 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -22,15 +22,18 @@ # version means equal code); the MCP binary is cheap and always rebuilt. # # Nothing live runs from ~/src/todo (the MCP is a frozen binary, the desktop -# app lives in /opt/todo), so this deploys the checkout it sits in. The -# declared deploy (CLAUDE.md) fast-forwards ~/src/todo and runs from there: -# phone_deploy refuses a production install from a worktree (exit 49). +# app lives in /opt/todo), but phone_deploy refuses a production install +# from a worktree (exit 49). So a run from anywhere else (the board runs it +# in its worktree) fast-forwards ~/src/todo, checks it now holds this +# commit, and re-executes from there. A pull blocked by kuhy's own edits +# fails with git's message, which the board recognises and reports. # ============================================================================ set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" readonly ROOT +readonly CHECKOUT="${TODO_CHECKOUT:-${HOME}/src/todo}" readonly SERIAL="${ADB_SERIAL:-23181JEGR08034}" readonly APP_ID="dev.kuhy.todo" readonly MCP_UNIT="todo-mcp.service" @@ -165,6 +168,22 @@ deploy_phone() { phone_health "$want" } +# Deploy from kuhy's main checkout, never from a worktree (see header). +run_from_checkout() { + local here want have + here="$(realpath -m -- "$ROOT")" + [[ $here == "$(realpath -m -- "$CHECKOUT")" ]] && return 0 + want="$(git -C "$ROOT" rev-parse HEAD)" + echo "[deploy] running from $CHECKOUT, not $here" + git -C "$CHECKOUT" pull --ff-only + have="$(git -C "$CHECKOUT" rev-parse HEAD)" + if [[ $have != "$want" ]]; then + echo "[deploy] FAILED: $CHECKOUT is at $have after the pull, not $want" >&2 + exit 1 + fi + exec "$CHECKOUT/scripts/deploy.sh" "$@" +} + main() { local targets=("$@") t ((${#targets[@]})) || targets=(mcp desktop phone) @@ -181,4 +200,5 @@ main() { echo "[deploy] all healthy: ${targets[*]} at $(pubspec_version)" } +run_from_checkout "$@" main "$@"