Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 17:15 UTC
fix(cli): detect setup after root flags
Kshitij Jhunjhunwala committed
Jul 30, 2026 at 11:13 UTC
533bfb44b9efb3917556968744f4ce14e77dc75b
2 files changed
+30
-1
ts/packages/cli/src/services/plugin-hint.ts
+17
-1
@@ -132,6 +132,22 @@ const DefaultConfigLayers = Layer.mergeAll(Path.layer, NodeOs.Default, BunFileSy
132
const readOptionalEnv = (name: string) =>
133
Effect.orDie(Config.option(Config.string(name)).pipe(Config.map(Option.getOrUndefined)));
134
135
+export function findRootCommandName(argv: ReadonlyArray<string>): string | undefined {
136
+ const args = argv.slice(2);
137
+ for (let index = 0; index < args.length; index += 1) {
138
+ const token = args[index];
139
+ if (token === '--log-level') {
140
+ index += 1;
141
+ continue;
142
+ }
143
+ if (token?.startsWith('--log-level=') || token?.startsWith('-')) {
144
+ continue;
145
+ }
146
+ return token;
147
+ }
148
+ return undefined;
149
+}
150
+
151
// Host-owned variables must bypass the CLI ConfigProvider, which prefixes
152
// application keys with COMPOSIO_.
153
const rawEnvironment = Effect.gen(function* () {
@@ -161,7 +177,7 @@ export const resolvePluginHintConfig = (argv: ReadonlyArray<string>) =>
177
stateDirectory: path.join(cacheDir, 'plugin-hints'),
178
host: detectPluginHost(env),
179
invocationOrigin: env.invocationOrigin,
164
- commandName: argv[2],
180
+ commandName: findRootCommandName(argv),
181
claudeInstalledPluginsFile: path.join(
182
env.claudeConfigDir ?? path.join(os.homedir, '.claude'),
183
'plugins',
ts/packages/cli/test/src/services/plugin-hint.test.ts
+13
@@ -10,6 +10,7 @@ import { defaultNodeOs, NodeOs } from 'src/services/node-os';
10
import {
11
createPluginHint,
12
detectPluginHost,
13
+ findRootCommandName,
14
resolvePluginHintConfig,
15
type PluginHintConfig,
16
} from 'src/services/plugin-hint';
@@ -106,6 +107,18 @@ describe('resolvePluginHintConfig', () => {
107
});
108
});
109
110
+describe('findRootCommandName', () => {
111
+ it('skips root log-level flags before the subcommand', () => {
112
+ expect(findRootCommandName(['/bin/bun', '/cli/bin.ts', 'setup'])).toBe('setup');
113
+ expect(findRootCommandName(['/bin/bun', '/cli/bin.ts', '--log-level', 'debug', 'setup'])).toBe(
114
+ 'setup'
115
+ );
116
+ expect(findRootCommandName(['/bin/bun', '/cli/bin.ts', '--log-level=debug', 'setup'])).toBe(
117
+ 'setup'
118
+ );
119
+ });
120
+});
121
+
122
describe('showPluginHint', () => {
123
let output: string[];
124