chore(goose2): just goose2 <command> with the addition of just goose2 kill (#8570)

Signed-off-by: Matt Toohey <contact@matttoohey.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Matt Toohey
2026-04-16 10:08:58 +10:00
committed by GitHub
parent 23755aa458
commit bae26d6302
2 changed files with 30 additions and 6 deletions
+2
View File
@@ -1,5 +1,7 @@
# Justfile
mod goose2 'ui/goose2'
# list all tasks
default:
@just --list
+28 -6
View File
@@ -1,3 +1,7 @@
# Derive a stable port from the working directory so the same worktree
# always gets the same port.
vite_port := `python3 -c "import hashlib,os; h=int(hashlib.sha256(os.getcwd().encode()).hexdigest(),16); print(10000 + h % 55000)"`
# Default recipe
default:
@just --list
@@ -74,11 +78,7 @@ dev:
#!/usr/bin/env bash
set -euo pipefail
# Derive a stable port from the working directory so the same worktree
# always gets the same port. This avoids changing TAURI_CONFIG between
# runs, which would invalidate Cargo's build cache and trigger a full
# Rust rebuild every time.
VITE_PORT=$(python3 -c "import hashlib,os; h=int(hashlib.sha256(os.getcwd().encode()).hexdigest(),16); print(10000 + h % 55000)")
VITE_PORT={{ vite_port }}
export VITE_PORT
PROJECT_DIR=$(pwd)
TAURI_CONFIG="{\"build\":{\"devUrl\":\"http://localhost:${VITE_PORT}\",\"beforeDevCommand\":{\"script\":\"cd ${PROJECT_DIR} && exec pnpm exec vite --port ${VITE_PORT} --strictPort\",\"cwd\":\".\",\"wait\":false}}}"
@@ -108,7 +108,7 @@ dev-debug:
#!/usr/bin/env bash
set -euo pipefail
VITE_PORT=$(python3 -c "import hashlib,os; h=int(hashlib.sha256(os.getcwd().encode()).hexdigest(),16); print(10000 + h % 55000)")
VITE_PORT={{ vite_port }}
export VITE_PORT
EXTRA_CONFIG="--config {\"build\":{\"devUrl\":\"http://localhost:${VITE_PORT}\",\"beforeDevCommand\":{\"script\":\"exec ./node_modules/.bin/vite --port ${VITE_PORT} --strictPort\",\"cwd\":\"..\",\"wait\":false}}}"
@@ -136,6 +136,28 @@ dev-debug:
dev-frontend:
pnpm dev
# Kill the dev process (if running)
kill:
#!/usr/bin/env bash
set -euo pipefail
VITE_PORT={{ vite_port }}
PID=$(lsof -ti :"$VITE_PORT" 2>/dev/null | head -1) || true
if [[ -z "$PID" ]]; then
echo "No process found on port $VITE_PORT"
exit 0
fi
PROC_NAME=$(ps -p "$PID" -o comm= 2>/dev/null) || true
if [[ "$PROC_NAME" != "node" ]]; then
echo "Process on port $VITE_PORT is '$PROC_NAME', not 'node' — refusing to kill"
exit 1
fi
echo "Killing node (PID $PID) on port $VITE_PORT"
kill -9 "$PID"
# ── Utilities ────────────────────────────────────────────────
# Clean build artifacts