From c6e12310c002304732823d447cf6a9cea09f7e59 Mon Sep 17 00:00:00 2001 From: Ramnivas Laddad Date: Thu, 10 Jul 2025 18:48:26 -0700 Subject: [PATCH] Make shell.sh invocable from the root directory Currently, developers must switch to the scripts directory before invoking shell.sh, which is one extra command. Also, calling ./scripts/shell.sh fails due to the assumption that it is run in the scripts directory. This change makes shell.sh/bat robust against the invoking directory. --- README.md | 3 +-- scripts/shell.cmd | 5 +++-- scripts/shell.sh | 8 +++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e5eebb2..c359214 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,7 @@ Illustrates: Run the shell script to start Embabel under Spring Shell: ```bash -cd scripts -./shell.sh +./scripts/shell.sh ``` There is a single example agent, `WriteAndReviewAgent`. diff --git a/scripts/shell.cmd b/scripts/shell.cmd index 8b6cd0a..39f7c61 100644 --- a/scripts/shell.cmd +++ b/scripts/shell.cmd @@ -1,8 +1,9 @@ @echo off setlocal -set AGENT_APPLICATION=.. +set "script_dir=%~dp0" +set AGENT_APPLICATION=%script_dir%.." -call .\support\agent.bat +call "%script_dir%support\agent.bat" endlocal \ No newline at end of file diff --git a/scripts/shell.sh b/scripts/shell.sh index 6e2baeb..7864ec8 100755 --- a/scripts/shell.sh +++ b/scripts/shell.sh @@ -1,10 +1,12 @@ #!/usr/bin/env bash -export AGENT_APPLICATION=.. +script_dir=$(dirname "$0") + +export AGENT_APPLICATION="${script_dir}/.." #export MAVEN_PROFILE=enable-mcp -./support/check_env.sh || exit 1 +"$script_dir/support/check_env.sh" || exit 1 -cd .. +cd "$AGENT_APPLICATION" mvn -Dmaven.test.skip=true spring-boot:run