Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ prefer_user_local_openshell() {

ensure_cli_shim() {
local cli_bin="${1:-$_CLI_BIN}"
local npm_bin shim_path node_path node_dir cli_path
local npm_bin shim_path node_path node_dir cli_path expected_shim
npm_bin="$(resolve_npm_bin)" || true
shim_path="${NEMOCLAW_SHIM_DIR}/${cli_bin}"

Expand Down Expand Up @@ -1029,12 +1029,22 @@ ensure_cli_shim() {
return 0
fi

mkdir -p "$NEMOCLAW_SHIM_DIR"
cat >"$shim_path" <<EOF
expected_shim="$(
cat <<EOF
#!/usr/bin/env bash
export PATH="$node_dir:\$PATH"
exec "$cli_path" "\$@"
EOF
)"

if [[ -x "$shim_path" ]] && cmp -s "$shim_path" <(printf '%s\n' "$expected_shim"); then
refresh_path
ensure_local_bin_in_profile
return 0
fi

mkdir -p "$NEMOCLAW_SHIM_DIR"
printf '%s\n' "$expected_shim" >"$shim_path"
chmod +x "$shim_path"
refresh_path
ensure_local_bin_in_profile
Expand Down
19 changes: 16 additions & 3 deletions test/install-preflight.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1355,11 +1355,22 @@ exit 99
if [ "\${1:-}" = "-c" ]; then
shift 2
fi
if [ "$1" = "clone" ]; then
if [ "\${1:-}" = "-C" ]; then
shift 2
fi
if [ "$1" = "init" ]; then
target="\${@: -1}"
mkdir -p "$target/nemoclaw"
mkdir -p "$target/nemoclaw" "$target/scripts"
echo '{"name":"nemoclaw","version":"0.1.0","dependencies":{"openclaw":"2026.3.11"}}' > "$target/package.json"
echo '{"name":"nemoclaw-plugin","version":"0.1.0"}' > "$target/nemoclaw/package.json"
cat > "$target/scripts/install-openshell.sh" <<'EOS'
#!/usr/bin/env bash
exit 0
EOS
chmod +x "$target/scripts/install-openshell.sh"
exit 0
fi
if [ "$1" = "remote" ] || [ "$1" = "fetch" ] || [ "$1" = "checkout" ]; then
exit 0
fi
exit 0
Expand Down Expand Up @@ -1448,7 +1459,9 @@ exit 0
expect(result.status).toBe(0);
expect(fs.readFileSync(shimPath, "utf-8")).toContain(`export PATH="${fakeBin}:$PATH"`);
expect(fs.readFileSync(shimPath, "utf-8")).toContain(path.join(prefix, "bin", "nemoclaw"));
expect(`${result.stdout}${result.stderr}`).toMatch(/Created user-local shim/);
expect(`${result.stdout}${result.stderr}`.match(/Created user-local shim/g) ?? []).toHaveLength(
1,
);
});

it("preserves ready output when nemoclaw is already resolvable after install", () => {
Expand Down
Loading