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:
@@ -1,5 +1,7 @@
|
|||||||
# Justfile
|
# Justfile
|
||||||
|
|
||||||
|
mod goose2 'ui/goose2'
|
||||||
|
|
||||||
# list all tasks
|
# list all tasks
|
||||||
default:
|
default:
|
||||||
@just --list
|
@just --list
|
||||||
|
|||||||
+28
-6
@@ -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 recipe
|
||||||
default:
|
default:
|
||||||
@just --list
|
@just --list
|
||||||
@@ -74,11 +78,7 @@ dev:
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# Derive a stable port from the working directory so the same worktree
|
VITE_PORT={{ vite_port }}
|
||||||
# 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)")
|
|
||||||
export VITE_PORT
|
export VITE_PORT
|
||||||
PROJECT_DIR=$(pwd)
|
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}}}"
|
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
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
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
|
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}}}"
|
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:
|
dev-frontend:
|
||||||
pnpm dev
|
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 ────────────────────────────────────────────────
|
# ── Utilities ────────────────────────────────────────────────
|
||||||
|
|
||||||
# Clean build artifacts
|
# Clean build artifacts
|
||||||
|
|||||||
Reference in New Issue
Block a user