From 56e27fef1d121972311de6d164a94d9cafdee2bc Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Thu, 26 Mar 2026 15:43:42 +0100 Subject: [PATCH] chore: make pi-test.sh runnable from any directory --- README.md | 2 +- packages/coding-agent/docs/development.md | 4 +++- pi-test.sh | 8 +++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b2d416c6..6001a5b7 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ npm install # Install all dependencies npm run build # Build all packages npm run check # Lint, format, and type check ./test.sh # Run tests (skips LLM-dependent tests without API keys) -./pi-test.sh # Run pi from sources (must be run from repo root) +./pi-test.sh # Run pi from sources (can be run from any directory) ``` > **Note:** `npm run check` requires `npm run build` to be run first. The web-ui package uses `tsc` which needs compiled `.d.ts` files from dependencies. diff --git a/packages/coding-agent/docs/development.md b/packages/coding-agent/docs/development.md index f0e6b6a0..304bbc40 100644 --- a/packages/coding-agent/docs/development.md +++ b/packages/coding-agent/docs/development.md @@ -14,9 +14,11 @@ npm run build Run from source: ```bash -./pi-test.sh +/path/to/pi-mono/pi-test.sh ``` +The script can be run from any directory. Pi keeps the caller's current working directory. + ## Forking / Rebranding Configure via `package.json`: diff --git a/pi-test.sh b/pi-test.sh index 665e6408..c4479af9 100755 --- a/pi-test.sh +++ b/pi-test.sh @@ -53,4 +53,10 @@ if [[ "$NO_ENV" == "true" ]]; then echo "Running without API keys..." fi -npx tsx "$SCRIPT_DIR/packages/coding-agent/src/cli.ts" ${ARGS[@]+"${ARGS[@]}"} +TSX_BIN="$SCRIPT_DIR/node_modules/.bin/tsx" +if [[ ! -x "$TSX_BIN" ]]; then + echo "tsx not found at $TSX_BIN. Run npm install from the repo root first." >&2 + exit 1 +fi + +"$TSX_BIN" "$SCRIPT_DIR/packages/coding-agent/src/cli.ts" ${ARGS[@]+"${ARGS[@]}"}