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.

feat(cli): add plugin uninstall flow

Kshitij Jhunjhunwala82341643a424
diff --git a/ts/e2e-tests/cli/setup-plugins/e2e.test.ts b/ts/e2e-tests/cli/setup-plugins/e2e.test.ts
index 70611c623..b033de8a1 100644
--- a/ts/e2e-tests/cli/setup-plugins/e2e.test.ts
+++ b/ts/e2e-tests/cli/setup-plugins/e2e.test.ts
@@ -31,10 +31,12 @@ composio setup --target ${host} --yes
cp /tmp/host-state/commands.log first-run.log
: > /tmp/host-state/commands.log
composio setup --target ${host} --yes
+composio setup --uninstall --target ${host} --yes
+composio setup --uninstall --target ${host} --yes
${
host === 'claude'
- ? `test -L /tmp/.claude/skills/composio-cli
-test -r /tmp/.claude/skills/composio-cli/SKILL.md`
+ ? `test ! -L /tmp/.claude/skills/composio-cli
+test ! -e /tmp/.agents/skills/composio-cli`
: ''
}
cp /tmp/host-state/commands.log second-run.log
@@ -49,6 +51,7 @@ e2e(import.meta.url, {
let codex: E2ETestResultWithFiles<'first-run.log' | 'second-run.log'>;
let unavailable: E2ETestResult;
let skippedUnavailable: E2ETestResult;
+ let skippedUnavailableUninstall: E2ETestResult;
beforeAll(async () => {
// The shared E2E runner derives container names from Date.now(), so keep
@@ -63,6 +66,9 @@ e2e(import.meta.url, {
});
unavailable = await runCmd('composio setup --target auto --yes');
skippedUnavailable = await runCmd('composio setup --target auto --yes --if-present');
+ skippedUnavailableUninstall = await runCmd(
+ 'composio setup --uninstall --target auto --yes --if-present'
+ );
}, TIMEOUTS.FIXTURE);
describe.each([
@@ -73,6 +79,7 @@ e2e(import.meta.url, {
'claude plugin marketplace add https://github.com/ComposioHQ/composio-plugin-cc.git --scope user',
installCommand: 'claude plugin install composio@composio --scope user',
additionalMutationCommands: ['claude plugin enable composio@composio --scope user'],
+ uninstallCommand: 'claude plugin uninstall composio@composio --scope user --yes',
},
{
host: 'codex' as const,
@@ -81,11 +88,18 @@ e2e(import.meta.url, {
'codex plugin marketplace add https://github.com/ComposioHQ/composio-plugin-openai.git --json',
installCommand: 'codex plugin add composio@composio --json',
additionalMutationCommands: [],
+ uninstallCommand: 'codex plugin remove composio@composio --json',
},
])(
'$host setup',
- ({ result, marketplaceCommand, installCommand, additionalMutationCommands }) => {
- it('configures the plugin on the first run and is idempotent', () => {
+ ({
+ result,
+ marketplaceCommand,
+ installCommand,
+ additionalMutationCommands,
+ uninstallCommand,
+ }) => {
+ it('installs once and uninstalls once with idempotent reruns', () => {
const execution = result();
expect(execution.exitCode).toBe(0);
expect(execution.stdout).toBe('');
@@ -108,6 +122,7 @@ e2e(import.meta.url, {
mutationCommands.some(mutation => mutation === command)
)
).toEqual([]);
+ expect(secondRunCommands.filter(command => command === uninstallCommand)).toHaveLength(1);
});
}
);
@@ -124,6 +139,12 @@ e2e(import.meta.url, {
expect(skippedUnavailable.stdout).toBe('');
expect(skippedUnavailable.stderr).toBe('');
});
+
+ it('can skip uninstall cleanly when no host is present', () => {
+ expect(skippedUnavailableUninstall.exitCode).toBe(0);
+ expect(skippedUnavailableUninstall.stdout).toBe('');
+ expect(skippedUnavailableUninstall.stderr).toBe('');
+ });
});
},
});
diff --git a/ts/e2e-tests/cli/setup-plugins/fixtures/fake-agent-host.sh b/ts/e2e-tests/cli/setup-plugins/fixtures/fake-agent-host.sh
index 8c156d8e1..af7b75fe4 100644
--- a/ts/e2e-tests/cli/setup-plugins/fixtures/fake-agent-host.sh
+++ b/ts/e2e-tests/cli/setup-plugins/fixtures/fake-agent-host.sh
@@ -35,6 +35,9 @@ case "$host:$command" in
"claude:plugin enable composio@composio --scope user")
touch "$state_dir/claude-plugin"
;;
+ "claude:plugin uninstall composio@composio --scope user --yes")
+ rm -f "$state_dir/claude-plugin"
+ ;;
"codex:--version")
printf '%s\n' 'codex-cli 0.144.1'
;;
@@ -58,6 +61,9 @@ case "$host:$command" in
"codex:plugin add composio@composio --json")
touch "$state_dir/codex-plugin"
;;
+ "codex:plugin remove composio@composio --json")
+ rm -f "$state_dir/codex-plugin"
+ ;;
*)
printf 'Unexpected fake host command: %s %s\n' "$host" "$command" >&2
exit 64
diff --git a/ts/packages/cli/src/commands/root-help.ts b/ts/packages/cli/src/commands/root-help.ts
index e6958d763..94482e56a 100644
--- a/ts/packages/cli/src/commands/root-help.ts
+++ b/ts/packages/cli/src/commands/root-help.ts
@@ -162,7 +162,7 @@ const GENERATE_COMMAND: TaggedValue<CompactCommand> = tagged({
// ── Account commands ───────────────────────────────────────────────────
const ACCOUNT_COMMANDS: ReadonlyArray<TaggedValue<CompactCommand>> = [
- tagged({ name: 'setup', description: 'Install agent plugins' }),
+ tagged({ name: 'setup', description: 'Install or uninstall agent plugins' }),
tagged({ name: 'login', description: 'Log in to Composio' }),
tagged({ name: 'logout', description: 'Log out from Composio' }),
tagged({ name: 'whoami', description: 'Show current account info' }),
@@ -874,16 +874,21 @@ const SUBCOMMAND_HELP: Record<string, SubcommandHelp | TaggedValue<SubcommandHel
description: 'Display your account information.',
},
setup: {
- usage: 'composio setup [--target auto|claude|codex|all] [--yes] [--if-present]',
- description: 'Install plugins for supported agent hosts.',
+ usage: 'composio setup [--target auto|claude|codex|all] [--uninstall] [--yes] [--if-present]',
+ description: 'Install or uninstall plugins for supported agent hosts.',
examples: [
'composio setup',
'composio setup --target auto --yes',
+ 'composio setup --uninstall --target auto --yes',
'composio setup --target all',
],
options: [
{ name: '--target <target>', description: 'auto, claude, codex, or all' },
{ name: '-y, --yes', description: 'Accept setup changes without prompting' },
+ {
+ name: '--uninstall',
+ description: 'Uninstall Composio plugins instead of installing them',
+ },
{
name: '--if-present',
description: 'Exit successfully when automatic detection finds no supported host',
diff --git a/ts/packages/cli/src/commands/setup.cmd.ts b/ts/packages/cli/src/commands/setup.cmd.ts
index f7c42b5b9..92de2fb0f 100644
--- a/ts/packages/cli/src/commands/setup.cmd.ts
+++ b/ts/packages/cli/src/commands/setup.cmd.ts
@@ -7,6 +7,7 @@ import {
isSetupPluginReady,
isSetupReady,
SETUP_TARGETS,
+ uninstallSetupTargets,
type AgentHost,
type SetupTarget,
} from 'src/services/setup';
@@ -29,6 +30,11 @@ const ifPresent = Options.boolean('if-present').pipe(
Options.withDescription('Exit successfully when automatic detection finds no supported host')
);
+const uninstall = Options.boolean('uninstall').pipe(
+ Options.withDefault(false),
+ Options.withDescription('Uninstall Composio plugins instead of installing them')
+);
+
const TARGET_LABELS: Readonly<Record<AgentHost, string>> = {
claude: 'Claude Code',
codex: 'Codex',
@@ -39,11 +45,11 @@ const formatTargets = (targets: ReadonlyArray<AgentHost>): string =>
const setupBaseCmd = Command.make(
'setup',
- { target, yes, ifPresent },
- ({ target, yes, ifPresent }) =>
+ { target, yes, ifPresent, uninstall },
+ ({ target, yes, ifPresent, uninstall }) =>
Effect.gen(function* () {
const ui = yield* TerminalUI;
- yield* ui.intro('composio setup');
+ yield* ui.intro(uninstall ? 'composio setup --uninstall' : 'composio setup');
const detections = yield* detectSetupTargets(target);
const detected = detections.filter(result => result.available).map(result => result.target);
@@ -61,15 +67,61 @@ const setupBaseCmd = Command.make(
if (!ifPresent || target !== 'auto') {
return yield* Effect.fail(
new Error(
- 'No supported agent host was detected. Install Claude Code or Codex, then rerun `composio setup`.'
+ `No supported agent host was detected. Install Claude Code or Codex, then rerun \`composio setup${uninstall ? ' --uninstall' : ''}\`.`
)
);
}
- yield* ui.outro('No supported agent host detected; plugin setup skipped.');
+ yield* ui.outro(
+ `No supported agent host detected; plugin ${uninstall ? 'uninstall' : 'setup'} skipped.`
+ );
+ return;
+ }
+
+ const inspected = yield* inspectSetupTargets(detections, {
+ allowMarketplaceConflict: uninstall,
+ });
+ if (uninstall) {
+ const installed = inspected.filter(status => status.plugin_installed);
+ const notInstalled = inspected.filter(status => !status.plugin_installed);
+
+ for (const status of installed) {
+ yield* ui.log.success(
+ `The Composio plugin for ${TARGET_LABELS[status.target]} is installed.`
+ );
+ }
+ for (const status of notInstalled) {
+ yield* ui.log.info(
+ `The Composio plugin for ${TARGET_LABELS[status.target]} is not installed.`
+ );
+ }
+
+ if (!yes && installed.length > 0) {
+ if (!isInteractiveTerminal()) {
+ return yield* Effect.fail(
+ new Error('Non-interactive uninstall requires `--yes` to approve local changes.')
+ );
+ }
+ const confirmed = yield* ui.confirm(
+ `Uninstall the Composio plugin for ${formatTargets(installed.map(status => status.target))}?`,
+ { defaultValue: false }
+ );
+ if (!confirmed) {
+ yield* ui.outro('Uninstall cancelled.');
+ return;
+ }
+ }
+
+ const results = yield* uninstallSetupTargets(inspected);
+ for (const result of results) {
+ if (!result.plugin_changed) continue;
+ yield* ui.log.success(
+ `Successfully uninstalled the Composio plugin for ${TARGET_LABELS[result.target]}.`
+ );
+ }
+ yield* ui.outro('Composio plugin uninstall complete.');
return;
}
- const inspected = yield* inspectSetupTargets(detections);
for (const status of inspected.filter(isSetupPluginReady)) {
yield* ui.log.success(
`The Composio plugin for ${TARGET_LABELS[status.target]} is already installed and enabled.`
@@ -116,5 +168,5 @@ const setupBaseCmd = Command.make(
);
export const setupCmd = setupBaseCmd.pipe(
- Command.withDescription('Install Composio plugins for supported agent hosts.')
+ Command.withDescription('Install or uninstall Composio plugins for supported agent hosts.')
);
diff --git a/ts/packages/cli/src/services/setup-skill-installer.ts b/ts/packages/cli/src/services/setup-skill-installer.ts
index 9d58cc878..18f5c5100 100644
--- a/ts/packages/cli/src/services/setup-skill-installer.ts
+++ b/ts/packages/cli/src/services/setup-skill-installer.ts
@@ -44,6 +44,43 @@ export const isClaudeSkillCurrent = (home: string, releaseTag: string) =>
return yield* checkClaudeSkillCurrent(fs, path, home, releaseTag);
});
+const isLinkedTo = (fs: FileSystem.FileSystem, path: Path.Path, source: string, target: string) =>
+ fs.readLink(source).pipe(
+ Effect.map(link => path.resolve(path.dirname(source), link) === target),
+ Effect.catchAll(() => Effect.succeed(false))
+ );
+
+export const removeManagedClaudeSkill = (home: string) =>
+ Effect.gen(function* () {
+ const fs = yield* FileSystem.FileSystem;
+ const path = yield* Path.Path;
+ const skillName = resolveInstalledSkillName();
+ const canonicalSkill = path.join(home, '.agents', 'skills', skillName);
+ const claudeSkill = resolveTargetSkillPath({ home, path, skillName, target: 'claude' });
+
+ let changed = false;
+ if (yield* isLinkedTo(fs, path, claudeSkill, canonicalSkill)) {
+ yield* fs.remove(claudeSkill, { recursive: true, force: true });
+ changed = true;
+ }
+
+ const isManaged = yield* fs.exists(path.join(canonicalSkill, SKILL_RELEASE_TAG_FILENAME));
+ if (!isManaged) return changed;
+
+ const otherTargets = (['codex', 'openclaw'] as const).map(target =>
+ resolveTargetSkillPath({ home, path, skillName, target })
+ );
+ const references = yield* Effect.all(
+ otherTargets.map(target => isLinkedTo(fs, path, target, canonicalSkill))
+ );
+ const stillReferenced = references.some(Boolean);
+ if (!stillReferenced) {
+ yield* fs.remove(canonicalSkill, { recursive: true, force: true });
+ changed = true;
+ }
+ return changed;
+ }).pipe(Effect.uninterruptible);
+
export class SetupSkillInstaller extends Effect.Service<SetupSkillInstaller>()(
'services/SetupSkillInstaller',
{
@@ -67,6 +104,7 @@ export class SetupSkillInstaller extends Effect.Service<SetupSkillInstaller>()(
});
return true;
}),
+ removeClaudeSkill: removeManagedClaudeSkill(os.homedir),
};
}),
dependencies: [],
diff --git a/ts/packages/cli/src/services/setup.ts b/ts/packages/cli/src/services/setup.ts
index 540567dcb..63e7028ad 100644
--- a/ts/packages/cli/src/services/setup.ts
+++ b/ts/packages/cli/src/services/setup.ts
@@ -44,6 +44,7 @@ interface SetupTargetAdapter {
readonly marketplaceAddArgs: ReadonlyArray<string>;
readonly pluginInstallArgs: ReadonlyArray<string>;
readonly pluginEnableArgs: ReadonlyArray<string>;
+ readonly pluginUninstallArgs: ReadonlyArray<string>;
readonly marketplaceRecordsKey?: string;
readonly pluginRecordsKey?: string;
readonly pluginScope?: string;
@@ -72,6 +73,14 @@ const ADAPTERS: Readonly<Record<AgentHost, SetupTargetAdapter>> = {
],
pluginInstallArgs: ['plugin', 'install', CLAUDE_PLUGIN_MARKETPLACE.plugin, '--scope', 'user'],
pluginEnableArgs: ['plugin', 'enable', CLAUDE_PLUGIN_MARKETPLACE.plugin, '--scope', 'user'],
+ pluginUninstallArgs: [
+ 'plugin',
+ 'uninstall',
+ CLAUDE_PLUGIN_MARKETPLACE.plugin,
+ '--scope',
+ 'user',
+ '--yes',
+ ],
pluginScope: 'user',
marketplaceRemoveCommand: 'claude plugin marketplace remove composio --scope user',
skillSource: 'standalone',
@@ -86,6 +95,7 @@ const ADAPTERS: Readonly<Record<AgentHost, SetupTargetAdapter>> = {
pluginInstallArgs: ['plugin', 'add', CODEX_PLUGIN_MARKETPLACE.plugin, '--json'],
// Codex has no separate enable command. Re-adding is its native install/repair path.
pluginEnableArgs: ['plugin', 'add', CODEX_PLUGIN_MARKETPLACE.plugin, '--json'],
+ pluginUninstallArgs: ['plugin', 'remove', CODEX_PLUGIN_MARKETPLACE.plugin, '--json'],
marketplaceRecordsKey: 'marketplaces',
pluginRecordsKey: 'installed',
marketplaceRemoveCommand: 'codex plugin marketplace remove composio --json',
@@ -416,6 +426,46 @@ const installAdapter = (adapter: SetupTargetAdapter, initial: InspectedSetupTarg
} satisfies SetupTargetResult;
});
+const uninstallAdapter = (adapter: SetupTargetAdapter, initial: InspectedSetupTarget) =>
+ Effect.gen(function* () {
+ let pluginChanged = false;
+ if (initial.plugin_installed) {
+ yield* runRequired(
+ adapter,
+ adapter.pluginUninstallArgs,
+ `Uninstalling the ${adapter.target} plugin`
+ );
+ pluginChanged = true;
+ }
+
+ const skillInstaller = yield* SetupSkillInstaller;
+ let skillChanged = false;
+ if (adapter.skillSource === 'standalone') {
+ skillChanged = yield* skillInstaller.removeClaudeSkill;
+ }
+
+ const final = yield* inspectAdapter(adapter);
+ if (final.plugin_installed || (adapter.skillSource === 'standalone' && final.cli_skill_ready)) {
+ return yield* Effect.fail(
+ new Error(
+ `Uninstall commands completed, but ${adapter.target} still reports Composio as installed. Rerun \`composio setup --uninstall --target ${adapter.target}\` or inspect the native ${adapter.target} plugin configuration.`
+ )
+ );
+ }
+
+ return {
+ target: adapter.target,
+ available: final.available,
+ marketplace_configured: final.marketplace_configured,
+ plugin_installed: final.plugin_installed,
+ plugin_enabled: final.plugin_enabled,
+ cli_skill_ready: final.cli_skill_ready,
+ changed: pluginChanged || skillChanged,
+ plugin_changed: pluginChanged,
+ skill_changed: skillChanged,
+ } satisfies SetupTargetResult;
+ });
+
const FIXED_TARGETS: Readonly<Partial<Record<SetupTarget, ReadonlyArray<AgentHost>>>> = {
claude: ['claude'],
codex: ['codex'],
@@ -439,15 +489,20 @@ export const detectSetupTargets = (target: SetupTarget) =>
);
});
-export const inspectSetupTargets = (detections: ReadonlyArray<SetupTargetDetection>) =>
+export const inspectSetupTargets = (
+ detections: ReadonlyArray<SetupTargetDetection>,
+ options: { readonly allowMarketplaceConflict?: boolean } = {}
+) =>
Effect.gen(function* () {
const inspected = yield* Effect.forEach(
detections.filter(detection => detection.available),
detection => inspectAdapter(ADAPTERS[detection.target], true)
);
- yield* Effect.forEach(inspected, status =>
- validateInitialState(ADAPTERS[status.target], status)
- );
+ if (!options.allowMarketplaceConflict) {
+ yield* Effect.forEach(inspected, status =>
+ validateInitialState(ADAPTERS[status.target], status)
+ );
+ }
return inspected;
});
@@ -468,3 +523,21 @@ export const installSetupTargets = (inspected: ReadonlyArray<InspectedSetupTarge
}
return completed;
});
+
+export const uninstallSetupTargets = (inspected: ReadonlyArray<InspectedSetupTarget>) =>
+ Effect.gen(function* () {
+ const completed: SetupTargetResult[] = [];
+ for (const status of inspected) {
+ const result = yield* uninstallAdapter(ADAPTERS[status.target], status).pipe(
+ Effect.mapError(error => {
+ if (completed.length === 0) return error;
+ const targets = completed.map(item => item.target).join(', ');
+ return new Error(
+ `Uninstall completed for ${targets} before a later target failed: ${errorMessage(error)}`
+ );
+ })
+ );
+ completed.push(result);
+ }
+ return completed;
+ });
diff --git a/ts/packages/cli/test/__utils__/services/test-layer.ts b/ts/packages/cli/test/__utils__/services/test-layer.ts
index 8e85b4d54..8bfb5fbde 100644
--- a/ts/packages/cli/test/__utils__/services/test-layer.ts
+++ b/ts/packages/cli/test/__utils__/services/test-layer.ts
@@ -1258,6 +1258,7 @@ export const TestLayer = (input?: TestLiveInput) =>
new SetupSkillInstaller({
isClaudeSkillReady: Effect.succeed(false),
ensureClaudeSkill: Effect.succeed(false),
+ removeClaudeSkill: Effect.succeed(false),
})
);
diff --git a/ts/packages/cli/test/src/commands/setup.cmd.test.ts b/ts/packages/cli/test/src/commands/setup.cmd.test.ts
index 564c7ebc0..d5ad8ff2c 100644
--- a/ts/packages/cli/test/src/commands/setup.cmd.test.ts
+++ b/ts/packages/cli/test/src/commands/setup.cmd.test.ts
@@ -100,6 +100,11 @@ const makeSkillInstaller = (initiallyReady = false, failInstall = false) => {
return new SetupSkillInstaller({
isClaudeSkillReady: Effect.sync(() => ready),
ensureClaudeSkill: ensureClaudeSkill(),
+ removeClaudeSkill: Effect.sync(() => {
+ const changed = ready;
+ ready = false;
+ return changed;
+ }),
});
};
@@ -166,6 +171,14 @@ const makeFakeHosts = (
if (!options.noOp && command.includes('plugin marketplace add')) {
state[host].marketplace = 'canonical';
}
+ if (
+ !options.noOp &&
+ (command === 'claude plugin uninstall composio@composio --scope user --yes' ||
+ command === 'codex plugin remove composio@composio --json')
+ ) {
+ state[host].plugin = 'missing';
+ return {};
+ }
if (
!options.noOp &&
(command.includes('plugin install') ||
@@ -256,6 +269,11 @@ describe('CLI: composio setup', () => {
staleSkillReady = true;
return true;
}),
+ removeClaudeSkill: Effect.sync(() => {
+ const changed = staleSkillReady;
+ staleSkillReady = false;
+ return changed;
+ }),
});
layer(
TestLive({
@@ -409,6 +427,142 @@ describe('CLI: composio setup', () => {
);
});
+ const uninstallBoth = makeFakeHosts({
+ claude: { available: true, marketplace: 'canonical', plugin: 'enabled' },
+ codex: { available: true, marketplace: 'canonical', plugin: 'enabled' },
+ });
+ layer(
+ TestLive({
+ commandRunner: uninstallBoth.runner,
+ setupSkillInstaller: makeSkillInstaller(true),
+ })
+ )('uninstall from both hosts', it => {
+ it.scoped('uses native removal commands and is idempotent', () =>
+ Effect.gen(function* () {
+ yield* cli(['setup', '--uninstall', '--target', 'all', '--yes']);
+ yield* cli(['setup', '--uninstall', '--target', 'all', '--yes']);
+
+ expect(uninstallBoth.commands).toContainEqual([
+ 'claude',
+ 'plugin',
+ 'uninstall',
+ 'composio@composio',
+ '--scope',
+ 'user',
+ '--yes',
+ ]);
+ expect(uninstallBoth.commands).toContainEqual([
+ 'codex',
+ 'plugin',
+ 'remove',
+ 'composio@composio',
+ '--json',
+ ]);
+ expect(
+ uninstallBoth.commands.filter(
+ parts =>
+ parts.join(' ') === 'claude plugin uninstall composio@composio --scope user --yes'
+ )
+ ).toHaveLength(1);
+ expect(
+ uninstallBoth.commands.filter(
+ parts => parts.join(' ') === 'codex plugin remove composio@composio --json'
+ )
+ ).toHaveLength(1);
+ expect(uninstallBoth.state.claude.plugin).toBe('missing');
+ expect(uninstallBoth.state.codex.plugin).toBe('missing');
+
+ const output = (yield* MockConsole.getLines()).join('\n');
+ expect(output).toContain('Successfully uninstalled the Composio plugin for Claude Code.');
+ expect(output).toContain('Successfully uninstalled the Composio plugin for Codex.');
+ expect(output).not.toContain('skill');
+ })
+ );
+ });
+
+ const uninstallMissing = makeFakeHosts({
+ claude: { available: true, marketplace: 'canonical', plugin: 'missing' },
+ codex: { available: true, marketplace: 'canonical', plugin: 'missing' },
+ });
+ layer(TestLive({ commandRunner: uninstallMissing.runner }))(
+ 'uninstall when plugins are absent',
+ it => {
+ it.scoped('reports the idempotent state without requiring approval', () =>
+ Effect.gen(function* () {
+ yield* cli(['setup', '--uninstall', '--target', 'all']);
+
+ const output = (yield* MockConsole.getLines()).join('\n');
+ expect(output).toContain('The Composio plugin for Claude Code is not installed.');
+ expect(output).toContain('The Composio plugin for Codex is not installed.');
+ })
+ );
+ }
+ );
+
+ const nonInteractiveUninstall = makeFakeHosts({
+ claude: { available: true, marketplace: 'canonical', plugin: 'enabled' },
+ });
+ layer(
+ TestLive({
+ commandRunner: nonInteractiveUninstall.runner,
+ setupSkillInstaller: makeSkillInstaller(true),
+ })
+ )('non-interactive uninstall approval', it => {
+ it.scoped('requires --yes before removing an installed plugin', () =>
+ Effect.gen(function* () {
+ const exit = yield* Effect.exit(cli(['setup', '--uninstall', '--target', 'claude']));
+
+ expect(Exit.isFailure(exit)).toBe(true);
+ expect(nonInteractiveUninstall.commands.some(parts => parts.includes('uninstall'))).toBe(
+ false
+ );
+ })
+ );
+ });
+
+ const conflictingUninstall = makeFakeHosts({
+ claude: { available: true, marketplace: 'conflict', plugin: 'enabled' },
+ });
+ layer(
+ TestLive({
+ commandRunner: conflictingUninstall.runner,
+ setupSkillInstaller: makeSkillInstaller(true),
+ })
+ )('uninstall with a conflicting marketplace', it => {
+ it.scoped('removes the installed plugin without replacing the marketplace', () =>
+ Effect.gen(function* () {
+ yield* cli(['setup', '--uninstall', '--target', 'claude', '--yes']);
+
+ expect(conflictingUninstall.state.claude.plugin).toBe('missing');
+ expect(conflictingUninstall.state.claude.marketplace).toBe('conflict');
+ })
+ );
+ });
+
+ const failedUninstall = makeFakeHosts(
+ { claude: { available: true, marketplace: 'canonical', plugin: 'enabled' } },
+ { failOn: 'plugin uninstall' }
+ );
+ layer(
+ TestLive({
+ commandRunner: failedUninstall.runner,
+ setupSkillInstaller: makeSkillInstaller(true),
+ })
+ )('native uninstall failure', it => {
+ it.scoped('fails without reporting the plugin as removed', () =>
+ Effect.gen(function* () {
+ const exit = yield* Effect.exit(
+ cli(['setup', '--uninstall', '--target', 'claude', '--yes'])
+ );
+
+ expect(Exit.isFailure(exit)).toBe(true);
+ expect(failedUninstall.state.claude.plugin).toBe('enabled');
+ const output = (yield* MockConsole.getLines()).join('\n');
+ expect(output).not.toContain('Successfully uninstalled');
+ })
+ );
+ });
+
const projectScopedClaude = makeFakeHosts({
claude: {
available: true,
diff --git a/ts/packages/cli/test/src/services/setup-skill-installer.test.ts b/ts/packages/cli/test/src/services/setup-skill-installer.test.ts
index bec1fcb3d..4af98711a 100644
--- a/ts/packages/cli/test/src/services/setup-skill-installer.test.ts
+++ b/ts/packages/cli/test/src/services/setup-skill-installer.test.ts
@@ -6,6 +6,7 @@ import * as tempy from 'tempy';
import { SKILL_RELEASE_TAG_FILENAME } from 'src/effects/install-skill';
import {
isClaudeSkillCurrent,
+ removeManagedClaudeSkill,
resolveSetupSkillReleaseTag,
} from 'src/services/setup-skill-installer';
@@ -88,5 +89,51 @@ describe('SetupSkillInstaller', () => {
expect(yield* isClaudeSkillCurrent(home, '@composio/[email protected]')).toBe(false);
})
);
+
+ it.effect('removes the CLI-managed Claude skill and canonical copy', () =>
+ Effect.gen(function* () {
+ const fs = yield* FileSystem.FileSystem;
+ const path = yield* Path.Path;
+ const home = tempy.temporaryDirectory();
+ const canonical = path.join(home, '.agents', 'skills', 'composio-cli');
+ const claude = path.join(home, '.claude', 'skills', 'composio-cli');
+ yield* fs.makeDirectory(canonical, { recursive: true });
+ yield* fs.writeFileString(
+ path.join(canonical, SKILL_RELEASE_TAG_FILENAME),
+ '@composio/[email protected]\n'
+ );
+ yield* fs.makeDirectory(path.dirname(claude), { recursive: true });
+ yield* fs.symlink(path.relative(path.dirname(claude), canonical), claude);
+
+ expect(yield* removeManagedClaudeSkill(home)).toBe(true);
+ expect(yield* fs.exists(claude)).toBe(false);
+ expect(yield* fs.exists(canonical)).toBe(false);
+ })
+ );
+
+ it.effect('keeps the canonical skill while another agent references it', () =>
+ Effect.gen(function* () {
+ const fs = yield* FileSystem.FileSystem;
+ const path = yield* Path.Path;
+ const home = tempy.temporaryDirectory();
+ const canonical = path.join(home, '.agents', 'skills', 'composio-cli');
+ const claude = path.join(home, '.claude', 'skills', 'composio-cli');
+ const openclaw = path.join(home, '.openclaw', 'skills', 'composio-cli');
+ yield* fs.makeDirectory(canonical, { recursive: true });
+ yield* fs.writeFileString(
+ path.join(canonical, SKILL_RELEASE_TAG_FILENAME),
+ '@composio/[email protected]\n'
+ );
+ yield* fs.makeDirectory(path.dirname(claude), { recursive: true });
+ yield* fs.makeDirectory(path.dirname(openclaw), { recursive: true });
+ yield* fs.symlink(path.relative(path.dirname(claude), canonical), claude);
+ yield* fs.symlink(path.relative(path.dirname(openclaw), canonical), openclaw);
+
+ expect(yield* removeManagedClaudeSkill(home)).toBe(true);
+ expect(yield* fs.exists(claude)).toBe(false);
+ expect(yield* fs.exists(canonical)).toBe(true);
+ expect(yield* fs.exists(openclaw)).toBe(true);
+ })
+ );
});
});