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): ignore blank plugin host paths
Kshitij Jhunjhunwala committed
Jul 30, 2026 at 11:42 UTC
faaed16fa94116dbc336e5b5c5023ffbb0ee2aea
2 files changed
+45
-2
ts/packages/cli/src/services/plugin-hint.ts
+5
-2
@@ -24,6 +24,9 @@ export interface HostEnvMarkers {
24
const isPresent = (value: string | undefined): boolean =>
25
value !== undefined && value.trim().length > 0;
26
27
+const nonBlankOrUndefined = (value: string | undefined): string | undefined =>
28
+ value === undefined || value.trim().length === 0 ? undefined : value;
29
+
30
export function detectPluginHost(markers: HostEnvMarkers): AgentHost | undefined {
31
if (isPresent(markers.claudeCode)) return 'claude';
32
if (isPresent(markers.codexThreadId) || isPresent(markers.codexSandbox)) return 'codex';
@@ -155,8 +158,8 @@ const rawEnvironment = Effect.gen(function* () {
158
const codexThreadId = yield* readOptionalEnv('CODEX_THREAD_ID');
159
const codexSandbox = yield* readOptionalEnv('CODEX_SANDBOX');
160
const invocationOrigin = yield* readOptionalEnv('COMPOSIO_CLI_INVOCATION_ORIGIN');
158
- const claudeConfigDir = yield* readOptionalEnv('CLAUDE_CONFIG_DIR');
159
- const codexHome = yield* readOptionalEnv('CODEX_HOME');
161
+ const claudeConfigDir = nonBlankOrUndefined(yield* readOptionalEnv('CLAUDE_CONFIG_DIR'));
162
+ const codexHome = nonBlankOrUndefined(yield* readOptionalEnv('CODEX_HOME'));
163
return {
164
claudeCode,
165
codexThreadId,
ts/packages/cli/test/src/services/plugin-hint.test.ts
+40
@@ -105,6 +105,46 @@ describe('resolvePluginHintConfig', () => {
105
)
106
);
107
});
108
+
109
+ it.effect('falls back to host defaults for blank path overrides', () => {
110
+ vi.stubEnv('CLAUDE_CONFIG_DIR', '');
111
+ vi.stubEnv('CODEX_HOME', ' ');
112
+
113
+ return Effect.gen(function* () {
114
+ const config = yield* resolvePluginHintConfig(['/bin/bun', '/cli/bin.ts', 'version']);
115
+
116
+ expect(config.claudeInstalledPluginsFile).toBe(
117
+ join(tempDir, '.claude', 'plugins', 'installed_plugins.json')
118
+ );
119
+ expect(config.codexConfigFile).toBe(join(tempDir, '.codex', 'config.toml'));
120
+ }).pipe(
121
+ Effect.withConfigProvider(extendConfigProvider(ConfigProvider.fromEnv())),
122
+ Effect.provide(
123
+ Layer.merge(PlatformLayers, Layer.succeed(NodeOs, defaultNodeOs({ homedir: tempDir })))
124
+ )
125
+ );
126
+ });
127
+
128
+ it.effect('preserves nonblank path overrides', () => {
129
+ const claudeConfigDir = ` ${join(tempDir, 'claude profile')} `;
130
+ const codexHome = ` ${join(tempDir, 'codex profile')} `;
131
+ vi.stubEnv('CLAUDE_CONFIG_DIR', claudeConfigDir);
132
+ vi.stubEnv('CODEX_HOME', codexHome);
133
+
134
+ return Effect.gen(function* () {
135
+ const config = yield* resolvePluginHintConfig(['/bin/bun', '/cli/bin.ts', 'version']);
136
+
137
+ expect(config.claudeInstalledPluginsFile).toBe(
138
+ join(claudeConfigDir, 'plugins', 'installed_plugins.json')
139
+ );
140
+ expect(config.codexConfigFile).toBe(join(codexHome, 'config.toml'));
141
+ }).pipe(
142
+ Effect.withConfigProvider(extendConfigProvider(ConfigProvider.fromEnv())),
143
+ Effect.provide(
144
+ Layer.merge(PlatformLayers, Layer.succeed(NodeOs, defaultNodeOs({ homedir: tempDir })))
145
+ )
146
+ );
147
+ });
148
});
149
150
describe('findRootCommandName', () => {