@@ -12,11 +12,12 @@ set -euo pipefail
1212BINARY=" ${1:? usage: smoke-test.sh <binary-path>} "
1313REPO_ROOT=" $( cd " $( dirname " ${BASH_SOURCE[0]:- $0 } " ) /.." && pwd) "
1414TMPDIR=$( mktemp -d)
15+ DRYRUN_HOME=" "
1516# On MSYS2/Windows, convert POSIX path to native Windows path for the binary
1617if command -v cygpath & > /dev/null; then
1718 TMPDIR=$( cygpath -m " $TMPDIR " )
1819fi
19- trap ' rm -rf "$TMPDIR"' EXIT
20+ trap ' rm -rf "$TMPDIR" "${DRYRUN_HOME:-}" ' EXIT
2021
2122CLI_STDERR=$( mktemp)
2223cli () { " $BINARY " cli " $@ " 2> " $CLI_STDERR " ; }
@@ -679,9 +680,27 @@ rm -f "$MCP_CL_INPUT" "$MCP_CL_OUTPUT" "$MCP_TOOL_INPUT" "$MCP_TOOL_OUTPUT"
679680echo " "
680681echo " === Phase 6: CLI subcommands ==="
681682
683+ DRYRUN_HOME=$( mktemp -d)
684+ DRYRUN_CACHE=" $DRYRUN_HOME /.cache/codebase-memory-mcp"
685+ mkdir -p " $DRYRUN_CACHE " \
686+ " $DRYRUN_HOME /.local/bin" \
687+ " $DRYRUN_HOME /.config" \
688+ " $DRYRUN_HOME /AppData/Roaming" \
689+ " $DRYRUN_HOME /AppData/Local"
690+
691+ run_dryrun_env () {
692+ HOME=" $DRYRUN_HOME " \
693+ XDG_CONFIG_HOME=" $DRYRUN_HOME /.config" \
694+ APPDATA=" $DRYRUN_HOME /AppData/Roaming" \
695+ LOCALAPPDATA=" $DRYRUN_HOME /AppData/Local" \
696+ CBM_CACHE_DIR=" $DRYRUN_CACHE " \
697+ PATH=" $DRYRUN_HOME /.local/bin:$PATH " \
698+ " $@ "
699+ }
700+
682701# 6a: install --dry-run -y
683702echo " --- Phase 6a: install --dry-run ---"
684- INSTALL_OUT=$( " $BINARY " install --dry-run -y 2>&1 )
703+ INSTALL_OUT=$( run_dryrun_env " $BINARY " install --dry-run -y 2>&1 )
685704if ! echo " $INSTALL_OUT " | grep -qi ' install\|skill\|mcp\|agent' ; then
686705 echo " FAIL: install --dry-run produced unexpected output"
687706 echo " $INSTALL_OUT "
@@ -695,7 +714,7 @@ echo "OK: install --dry-run completed"
695714
696715# 6b: uninstall --dry-run -y
697716echo " --- Phase 6b: uninstall --dry-run ---"
698- UNINSTALL_OUT=$( " $BINARY " uninstall --dry-run -y 2>&1 )
717+ UNINSTALL_OUT=$( run_dryrun_env " $BINARY " uninstall --dry-run -y 2>&1 )
699718if ! echo " $UNINSTALL_OUT " | grep -qi ' uninstall\|remov' ; then
700719 echo " FAIL: uninstall --dry-run produced unexpected output"
701720 echo " $UNINSTALL_OUT "
@@ -705,7 +724,7 @@ echo "OK: uninstall --dry-run completed"
705724
706725# 6c: update --dry-run --standard -y
707726echo " --- Phase 6c: update --dry-run ---"
708- UPDATE_OUT=$( " $BINARY " update --dry-run --standard -y 2>&1 )
727+ UPDATE_OUT=$( run_dryrun_env " $BINARY " update --dry-run --standard -y 2>&1 )
709728if ! echo " $UPDATE_OUT " | grep -qi ' dry-run' ; then
710729 echo " FAIL: update --dry-run did not indicate dry-run mode"
711730 echo " $UPDATE_OUT "
@@ -730,13 +749,13 @@ echo "OK: update --dry-run --standard completed"
730749
731750# 6d: config set/get/reset round-trip
732751echo " --- Phase 6d: config set/get/reset ---"
733- " $BINARY " config set auto_index true 2> /dev/null
734- CONFIG_VAL=$( " $BINARY " config get auto_index 2> /dev/null)
752+ run_dryrun_env " $BINARY " config set auto_index true 2> /dev/null
753+ CONFIG_VAL=$( run_dryrun_env " $BINARY " config get auto_index 2> /dev/null)
735754if ! echo " $CONFIG_VAL " | grep -q ' true' ; then
736755 echo " FAIL: config get auto_index returned '$CONFIG_VAL ', expected 'true'"
737756 exit 1
738757fi
739- " $BINARY " config reset auto_index 2> /dev/null
758+ run_dryrun_env " $BINARY " config reset auto_index 2> /dev/null
740759echo " OK: config set/get/reset round-trip"
741760
742761# 6e: Simulated binary replacement (update flow without network)
0 commit comments