Skip to content

Open source AI coding agent. Designed for large projects and real world tasks.

fix: dev scripts

ZanzyTHEbar29dc28e039a8
diff --git a/app/cli/dev.sh b/app/cli/dev.sh
index 07a9155a..d0a767c3 100755
--- a/app/cli/dev.sh
+++ b/app/cli/dev.sh
@@ -4,8 +4,9 @@ OUT="${PLANDEX_DEV_CLI_OUT_DIR:-/usr/local/bin}"
NAME="${PLANDEX_DEV_CLI_NAME:-plandex-dev}"
ALIAS="${PLANDEX_DEV_CLI_ALIAS:-pdxd}"
-go build -o $NAME && \
-rm -f $OUT/$NAME && \
-cp $NAME $OUT/$NAME && \
-ln -sf $OUT/$NAME $OUT/$ALIAS && \
-echo built $NAME cli and added $ALIAS alias to $OUT
+# Double quote to prevent globbing and word splitting.
+sudo go build -o "$NAME" &&
+ sudo rm -f "$OUT"/"$NAME" &&
+ sudo cp "$NAME" "$OUT"/"$NAME" &&
+ sudo ln -sf "$OUT"/"$NAME" "$OUT"/"$ALIAS" &&
+ echo built "$NAME" cli and added "$ALIAS" alias to "$OUT"
diff --git a/dev.sh b/dev.sh
index 6e21caf3..2cd8259e 100755
--- a/dev.sh
+++ b/dev.sh
@@ -1,5 +1,24 @@
#!/bin/bash
+# Detect zsh and trigger it if its the shell
+if [ -n "$ZSH_VERSION" ]; then
+ # shell is zsh
+ zsh -c "source ~/.zshrc && $*"
+fi
+
+# Detect if reflex is installed and install it if not
+if ! [ -x "$(command -v reflex)" ]; then
+ echo 'Error: reflex is not installed. Installing it now...' >&2
+
+ # Check if the $GOPATH is empty
+ if [ -z "$GOPATH" ]; then
+ echo "Error: $GOPATH is not set. Please set it to continue..." >&2
+ exit 1
+ fi
+
+ go get -u github.com/cespare/reflex
+fi
+
terminate() {
pkill -f 'plandex-server' # Assuming plandex-server is the name of your process
kill -TERM "$pid1" 2>/dev/null
@@ -8,7 +27,8 @@ terminate() {
trap terminate SIGTERM SIGINT
-cd app
+# Incase cd fails, exit the script
+cd app || exit 1
(cd cli && ./dev.sh)
@@ -19,4 +39,4 @@ reflex -r '^(server|shared)/.*\.(go|mod|sum)$' -s -- sh -c 'cd server && go buil
pid2=$!
wait $pid1
-wait $pid2
\ No newline at end of file
+wait $pid2