Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Merge branch 'feat/mise-style-installer-rollout' into feat/installer-auto-shell-default

jkomyno54258e255142
diff --cc .github/workflows/cli.test-installation.yml
index a20572fdc,27dc9934a..168532a12
--- a/.github/workflows/cli.test-installation.yml
+++ b/.github/workflows/cli.test-installation.yml
@@@ -361,26 -338,6 +361,19 @@@ jobs
exit 1
fi
- if grep -q 'COMPOSIO_INSTALL_DIR' "$config_file"; then
- echo "❌ $config_file still persists COMPOSIO_INSTALL_DIR"
- echo "=== $config_file contents ==="
- cat "$config_file"
- exit 1
- fi
-
+ # Automatic setup ran during the no-argument install and `composio
+ # install --shell` ran again afterwards: setup is idempotent, so the
+ # startup file must hold exactly one managed block.
+ marker_count=$(grep -Fcx '# Composio CLI' "$config_file" || true)
+ if [[ "$marker_count" == "1" ]]; then
+ echo "✅ $config_file contains exactly one managed Composio block"
+ else
+ echo "❌ $config_file contains $marker_count managed Composio blocks (expected 1)"
+ echo "=== $config_file contents ==="
+ cat "$config_file"
+ exit 1
+ fi
+
- name: Test custom install directory
shell: bash
env:
diff --cc test/install-sh-release-resolution.test.sh
index 6fc1a938f,e620c3a45..973ee921f
--- a/test/install-sh-release-resolution.test.sh
+++ b/test/install-sh-release-resolution.test.sh
@@@ -402,35 -327,21 +430,23 @@@ EO
if [[ ${CASE_UNSET_SHELL:-0} == 1 ]]; then
installer_command=("$interpreter" -c 'unset SHELL; script=$1; shift; . "$script"' unset-shell "$repo_root/install.sh")
fi
+ common_env "$home" "$install_dir" "$bin_dir"
env \
- PATH="${CASE_PATH_PREFIX:-}$fake_bin:$PATH" \
- SHELL=/bin/bash \
+ PATH="${CASE_PATH_PREFIX:-}$fake_bin:$ambient_path" \
- HOME="$home" \
+ SHELL="${CASE_SHELL_VALUE:-/bin/bash}" \
- COMPOSIO_INSTALL_DIR="$install_dir" \
- COMPOSIO_BIN_DIR="$bin_dir" \
+ "${common_env_args[@]}" \
COMPOSIO_INSTALL_VERSION="${CASE_INSTALL_VERSION:-}" \
COMPOSIO_INSTALL_SHELL="${CASE_INSTALL_SHELL:-}" \
- COMPOSIO_INSTALL_PLUGINS="${CASE_PLUGINS:-0}" \
COMPOSIO_QUIET="${CASE_QUIET:-0}" \
COMPOSIO_DEBUG="${CASE_DEBUG:-0}" \
COMPOSIO_INSTALL_HELP="${CASE_HELP:-1}" \
COMPOSIO_INSTALL_ALLOW_HTTP_HOST="${CASE_ALLOW_HTTP_HOST:-}" \
- COMPOSIO_GITHUB_URL="${CASE_GITHUB_URL:-$github_url}" \
- COMPOSIO_GITHUB_API_BASE_URL="${CASE_API_BASE:-$api_base}" \
- COMPOSIO_GITHUB_OWNER=FakeOwner \
- COMPOSIO_GITHUB_REPO=fake-repo \
- TEST_CHECKSUM_MODE="${CASE_CHECKSUM_MODE:-missing}" \
TEST_API_ASSET_URL="${CASE_API_ASSET_URL:-}" \
TEST_REDIRECT_DOWNGRADE="${CASE_REDIRECT_DOWNGRADE:-0}" \
- TEST_SHELL_CAPABILITY="${CASE_SHELL_CAPABILITY:-supported}" \
- TEST_INSTALL_EXIT="${CASE_INSTALL_EXIT:-0}" \
+ TEST_INSTALL_HINT="${CASE_INSTALL_HINT:-0}" \
+ TEST_INSTALL_RECONCILE="${CASE_INSTALL_RECONCILE:-1}" \
TEST_SETUP_EXIT="${CASE_SETUP_EXIT:-0}" \
TEST_VERSION_EXIT="${CASE_VERSION_EXIT:-0}" \
- TEST_CURL_DELAY_URL="${CASE_CURL_DELAY_URL:-}" \
- TEST_CURL_DELAY_SECONDS="${CASE_CURL_DELAY_SECONDS:-1}" \
- TEST_CURL_PARENT_PID_FILE="$case_root/curl-parent.pid" \
"${installer_command[@]}" "$@"
}
@@@ -441,26 -352,13 +457,14 @@@
local bin_dir=$4
shift 4
mkdir -p "$home" "$install_dir" "$bin_dir"
+ common_env "$home" "$install_dir" "$bin_dir"
env \
- PATH="$fake_bin:$PATH" \
+ PATH="$fake_bin:$ambient_path" \
- HOME="$home" \
SHELL="/bin/$shell_name" \
- COMPOSIO_INSTALL_DIR="$install_dir" \
- COMPOSIO_BIN_DIR="$bin_dir" \
+ "${common_env_args[@]}" \
COMPOSIO_INSTALL_SCRIPT_URL="$script_url" \
- COMPOSIO_INSTALL_PLUGINS=0 \
- COMPOSIO_GITHUB_URL="$github_url" \
- COMPOSIO_GITHUB_API_BASE_URL="$api_base" \
- COMPOSIO_GITHUB_OWNER=FakeOwner \
- COMPOSIO_GITHUB_REPO=fake-repo \
TEST_BASE_MODE="${CASE_BASE_MODE:-ok}" \
- TEST_CHECKSUM_MODE=missing \
- TEST_SHELL_CAPABILITY="${CASE_SHELL_CAPABILITY:-supported}" \
- TEST_INSTALL_EXIT="${CASE_INSTALL_EXIT:-0}" \
+ TEST_INSTALL_RECONCILE="${CASE_INSTALL_RECONCILE:-1}" \
- TEST_CURL_DELAY_URL="${CASE_CURL_DELAY_URL:-}" \
- TEST_CURL_DELAY_SECONDS="${CASE_CURL_DELAY_SECONDS:-1}" \
- TEST_CURL_PARENT_PID_FILE="$case_root/curl-parent.pid" \
"$interpreter" "$repo_root/install/$shell_name.sh" "$@"
}
@@@ -582,28 -476,34 +600,39 @@@
reset_case
CASE_UNSET_SHELL=1
- run_installer "$case_root/unset-shell-home" "$case_root/unset-shell-install" "$case_root/unset-shell-bin" "$stable_tag" >/dev/null 2>&1 ||
+ unset_shell_install="$case_root/unset-shell-install"
+ unset_shell_output=$(run_installer "$case_root/unset-shell-home" "$unset_shell_install" "$case_root/unset-shell-bin" "$stable_tag" 2>&1) ||
fail "$interpreter_name unset SHELL must not fail after installation"
+ if grep -Fq 'install --shell' "$composio_log"; then
+ fail "$interpreter_name unset SHELL must not run shell setup"
+ fi
+ assert_tail "$unset_shell_output" $'To get started now, run:\n\n '"$unset_shell_install/composio login" "$interpreter_name unset SHELL install-only tail"
+ # Runs the given command in the background, SIGTERMs it once the delayed
+ # download is reached, and asserts the process exits with 128+15.
+ assert_sigterm_143() {
+ local label=$1
+ local output_file=$2
+ shift 2
+ "$@" >"$output_file" 2>&1 &
+ local signal_job=$!
+ wait_for_file "$case_root/curl-parent.pid" "$interpreter_name $label did not reach delayed download"
+ local signal_pid
+ signal_pid=$(<"$case_root/curl-parent.pid")
+ kill -TERM "$signal_pid"
+ local signal_status=0
+ if wait "$signal_job"; then
+ fail "$interpreter_name $label must terminate after SIGTERM"
+ else
+ signal_status=$?
+ fi
+ [[ $signal_status -eq 143 ]] || fail "$interpreter_name $label SIGTERM status (got $signal_status)"
+ }
+
reset_case
CASE_CURL_DELAY_URL="$github_url/FakeOwner/fake-repo/releases/download/$stable_tag/$archive_name"
- signal_output="$case_root/signal-installer.log"
- run_installer "$case_root/signal-home" "$case_root/signal-install" "$case_root/signal-bin" "$stable_tag" >"$signal_output" 2>&1 &
- signal_job=$!
- wait_for_file "$case_root/curl-parent.pid" "$interpreter_name installer did not reach delayed download"
- signal_pid=$(<"$case_root/curl-parent.pid")
- kill -TERM "$signal_pid"
- if wait "$signal_job"; then
- fail "$interpreter_name installer must terminate after SIGTERM"
- else
- signal_status=$?
- fi
- [[ $signal_status -eq 143 ]] || fail "$interpreter_name installer SIGTERM status (got $signal_status)"
+ assert_sigterm_143 'installer' "$case_root/signal-installer.log" \
+ run_installer "$case_root/signal-home" "$case_root/signal-install" "$case_root/signal-bin" "$stable_tag"
reset_case
CASE_CURL_DELAY_URL=$script_url
diff --cc ts/e2e-tests/cli/install/e2e.test.ts
index de5289af1,0e413a23f..f56051f0c
--- a/ts/e2e-tests/cli/install/e2e.test.ts
+++ b/ts/e2e-tests/cli/install/e2e.test.ts
@@@ -298,6 -216,24 +326,24 @@@ test ! -e "$HOME/.local/bin/composio
},
timeout
);
+
+ it(
+ 'rejects a corrupted archive at extraction before creating the entry point',
+ async () => {
+ const result = await run(`
-set -eu
-if output=$(curl -fsSL "$INSTALL_BASE_URL/install" | COMPOSIO_GITHUB_URL="$INSTALL_BASE_URL/corrupt" sh -s -- "$E2E_RELEASE_TAG" 2>&1); then
- echo 'corrupted archive unexpectedly installed' >&2
- exit 1
-fi
-printf '%s\n' "$output" | grep -F 'Checksum verified'
-printf '%s\n' "$output" | grep -F 'Failed to extract archive'
-test ! -e "$HOME/.local/bin/composio"
-`);
++ set -eu
++ if output=$(curl -fsSL "$INSTALL_BASE_URL/install" | SHELL=/bin/${config.shell} COMPOSIO_GITHUB_URL="$INSTALL_BASE_URL/corrupt" sh -s -- "$E2E_RELEASE_TAG" 2>&1); then
++ echo 'corrupted archive unexpectedly installed' >&2
++ exit 1
++ fi
++ printf '%s\n' "$output" | grep -F 'Checksum verified'
++ printf '%s\n' "$output" | grep -F 'Failed to extract archive'
++ test ! -e "$HOME/.local/bin/composio"
++ `);
+ assertSuccess(result);
+ },
+ timeout
+ );
});
}
diff --cc ts/packages/cli/src/commands/install.cmd.ts
index 0f649acd0,7147c4f15..9b45d0e96
--- a/ts/packages/cli/src/commands/install.cmd.ts
+++ b/ts/packages/cli/src/commands/install.cmd.ts
@@@ -498,6 -243,32 +527,38 @@@ const resolveWriteTarget =
Effect.catchAll(() => Effect.succeed(filePath))
);
+ /**
+ * Atomically replace `writeTarget` via a same-directory tmp file. The tmp copy
+ * is created with the target's mode from the start so a private rc's contents
+ * never sit in a default-mode, world-readable tmp file. open(2) masks the
+ * requested mode with the process umask (only ever clearing bits), so a chmod
+ * still follows to pin the exact mode.
+ */
+ const replaceFilePreservingMode = (
+ writeTarget: string,
+ contents: string,
+ fs: FileSystem.FileSystem
+ ): Effect.Effect<void, PlatformError> =>
+ Effect.gen(function* () {
+ const existingTargetInfo = yield* fs.stat(writeTarget).pipe(Effect.option);
+ const preservedMode = Option.map(existingTargetInfo, info => info.mode & 0o7777);
+ const tmpPath = `${writeTarget}.composio-tmp`;
+ yield* Option.match(preservedMode, {
+ onNone: () => fs.writeFileString(tmpPath, contents),
+ onSome: mode => fs.writeFileString(tmpPath, contents, { mode }),
+ });
- if (Option.isSome(preservedMode)) {
- yield* fs.chmod(tmpPath, preservedMode.value);
- }
- yield* fs.rename(tmpPath, writeTarget);
++ // Mirror install.sh's write_path_block: when the chmod or rename step
++ // fails, remove the temp file before propagating the error so no
++ // `.composio-tmp` litter is left next to the target.
++ const promoteTmp = Effect.gen(function* () {
++ if (Option.isSome(preservedMode)) {
++ yield* fs.chmod(tmpPath, preservedMode.value);
++ }
++ yield* fs.rename(tmpPath, writeTarget);
++ });
++ yield* promoteTmp.pipe(Effect.onError(() => fs.remove(tmpPath).pipe(Effect.ignore)));
+ });
+
// ---------------------------------------------------------------------------
// Exported logic (reusable from install.sh post-install delegation)
// ---------------------------------------------------------------------------
@@@ -553,20 -332,13 +622,20 @@@ export const installShellIntegration =
}
if (isUnsafePath(binDir)) {
- yield* failure(
- 'Resolved bin directory contains unsafe characters and cannot be written to shell config.'
- );
+ const message =
+ 'Resolved bin directory contains unsafe characters and cannot be written to shell config.';
+ yield* failure(message);
yield* ui.outro('Aborted.');
- return;
+ return yield* new ShellSetupAbortError({ message });
}
+ // KD7 (final-block contract): when install.sh delegates to this command it
+ // passes COMPOSIO_CLI_INVOCATION_ORIGIN=installer and owns the final action
+ // block itself. Keep the concise per-file status lines but suppress the
+ // boxed restart hint so the CLI never prints a competing instruction.
+ const invocationOrigin = yield* readOptionalEnv('COMPOSIO_CLI_INVOCATION_ORIGIN');
+ const installerOwnsFinalMessaging = invocationOrigin === 'installer';
+
const isExplicitShell = params.shell !== undefined;
const shellEnv = yield* readEnvWithDefault('SHELL', '');
const shell = params.shell ?? detectShellFromEnv(path, shellEnv);