@devries-cameron20 / composio-1 / commits / 2fe9370ae
Fork 0

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 composio config experimental command (#3156)

## Summary - Adds `composio config` as a top-level command with `experimental` subcommand - `composio config experimental` — list all feature flags and their state - `composio config experimental <name> on|off` — toggle a feature and automatically rebuild the composio-cli skill - Updates `composio link --help` to show `--alias` and `--list` flags that were previously missing - Adds `featureOverrides` support to the skill build pipeline so toggled features propagate to the skill ## Test plan - [ ] `composio config experimental` lists features with on/off state - [ ] `composio config experimental multi_account on` enables the feature and rebuilds skill - [ ] `composio config experimental multi_account` shows `on` after enabling - [ ] `composio link --help` shows `--alias` and `--list` flags - [ ] `composio config --help` shows experimental subcommand - [ ] `pnpm typecheck` passes 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Rahul Tarak committed Apr 9, 2026 at 20:57 UTC 2fe9370ae9ba124ab884e7038939a0ca9e4e6885
6 files changed +260 -9
ts/packages/cli/skills-src/composio-cli/index.ts
+20 -6
@@ -296,8 +296,11 @@ const renderCommand = (build: SkillBuildContext, command: SkillCommand) => {
296 return lines.join('\n');
297 };
298
299 -export const renderComposioCliSkill = (channel: SkillReleaseChannel) => {
300 - const build = resolveSkillBuildContext(channel);
299 +export const renderComposioCliSkill = (
300 + channel: SkillReleaseChannel,
301 + featureOverrides?: Partial<Record<SkillFeatureFlag, boolean>>
302 +) => {
303 + const build = resolveSkillBuildContext(channel, featureOverrides);
304 const lines: string[] = [
305 '---',
306 `name: ${frontmatter.name}`,
@@ -331,8 +334,11 @@ export const renderComposioCliSkill = (channel: SkillReleaseChannel) => {
334 return lines.join('\n') + '\n';
335 };
336
334 -export const renderReferenceFiles = (channel: SkillReleaseChannel) => {
335 - const build = resolveSkillBuildContext(channel);
337 +export const renderReferenceFiles = (
338 + channel: SkillReleaseChannel,
339 + featureOverrides?: Partial<Record<SkillFeatureFlag, boolean>>
340 +) => {
341 + const build = resolveSkillBuildContext(channel, featureOverrides);
342 return Object.fromEntries(
343 referenceDocuments.map(document => [
344 `${document.slug}.md`,
@@ -361,15 +367,21 @@ const copyDir = (sourceDir: string, targetDir: string) => {
367 export const buildComposioCliSkill = ({
368 channel,
369 outputRoot,
370 + featureOverrides,
371 }: {
372 channel: SkillReleaseChannel;
373 outputRoot: string;
374 + featureOverrides?: Partial<Record<SkillFeatureFlag, boolean>>;
375 }) => {
376 const skillOutputDir = path.join(outputRoot, 'composio-cli');
377 fs.rmSync(skillOutputDir, { recursive: true, force: true });
378 fs.mkdirSync(skillOutputDir, { recursive: true });
379
372 - fs.writeFileSync(path.join(skillOutputDir, 'SKILL.md'), renderComposioCliSkill(channel), 'utf8');
380 + fs.writeFileSync(
381 + path.join(skillOutputDir, 'SKILL.md'),
382 + renderComposioCliSkill(channel, featureOverrides),
383 + 'utf8'
384 + );
385
386 const agentsSourceDir = path.join(sourceAssetsDir, 'agents');
387 if (fs.existsSync(agentsSourceDir)) {
@@ -378,7 +390,9 @@ export const buildComposioCliSkill = ({
390
391 const referencesOutputDir = path.join(skillOutputDir, 'references');
392 fs.mkdirSync(referencesOutputDir, { recursive: true });
381 - for (const [fileName, markdown] of Object.entries(renderReferenceFiles(channel))) {
393 + for (const [fileName, markdown] of Object.entries(
394 + renderReferenceFiles(channel, featureOverrides)
395 + )) {
396 fs.writeFileSync(path.join(referencesOutputDir, fileName), markdown, 'utf8');
397 }
398
ts/packages/cli/skills-src/composio-cli/reference-schema.ts
+6 -1
@@ -34,6 +34,7 @@ export type ReferenceDocument = {
34
35 const TOP_LEVEL_COMMANDS = new Set([
36 'artifacts',
37 + 'config',
38 'dev',
39 'execute',
40 'link',
@@ -47,11 +48,15 @@ const TOP_LEVEL_COMMANDS = new Set([
48 'whoami',
49 ]);
50
50 -export const resolveSkillBuildContext = (channel: SkillReleaseChannel): SkillBuildContext => ({
51 +export const resolveSkillBuildContext = (
52 + channel: SkillReleaseChannel,
53 + overrides?: Partial<Record<SkillFeatureFlag, boolean>>
54 +): SkillBuildContext => ({
55 channel,
56 experimentalFeatures: {
57 [CLI_EXPERIMENTAL_FEATURES.LISTEN]: channel === 'beta',
58 [CLI_EXPERIMENTAL_FEATURES.MULTI_ACCOUNT]: channel === 'beta',
59 + ...overrides,
60 },
61 });
62
ts/packages/cli/src/commands/config/config.cmd.ts new
+7
@@ -0,0 +1,7 @@
1 +import { Command } from '@effect/cli';
2 +import { configExperimentalCmd } from './config.experimental.cmd';
3 +
4 +export const configCmd = Command.make('config').pipe(
5 + Command.withDescription('View and manage CLI configuration.'),
6 + Command.withSubcommands([configExperimentalCmd])
7 +);
ts/packages/cli/src/commands/config/config.experimental.cmd.ts new
+187
@@ -0,0 +1,187 @@
1 +import * as fs from 'node:fs';
2 +import * as path from 'node:path';
3 +import { Command, Args } from '@effect/cli';
4 +import { Effect, Option } from 'effect';
5 +import { ComposioCliUserConfig } from 'src/services/cli-user-config';
6 +import { TerminalUI } from 'src/services/terminal-ui';
7 +import { NodeOs } from 'src/services/node-os';
8 +import { CLI_EXPERIMENTAL_FEATURES } from 'src/constants';
9 +import { buildComposioCliSkill } from '../../../skills-src/composio-cli/index';
10 +import type { SkillFeatureFlag } from '../../../skills-src/composio-cli/reference-schema';
11 +
12 +const knownFeatures: readonly string[] = Object.values(CLI_EXPERIMENTAL_FEATURES);
13 +
14 +const featureArg = Args.text({ name: 'feature' }).pipe(
15 + Args.withDescription(`Experimental feature name. Known features: ${knownFeatures.join(', ')}`),
16 + Args.optional
17 +);
18 +
19 +const stateArg = Args.text({ name: 'state' }).pipe(
20 + Args.withDescription('Set to "on" or "off"'),
21 + Args.optional
22 +);
23 +
24 +const SKILL_NAME = 'composio-cli';
25 +
26 +/**
27 + * Find every directory where the composio-cli skill is currently installed.
28 + * Known locations:
29 + * ~/.agents/skills/composio-cli (canonical install target)
30 + * ~/.claude/skills/composio-cli (Claude Code — may be a symlink or a real dir)
31 + *
32 + * We resolve symlinks so we don't rebuild the same physical directory twice,
33 + * but we also rebuild any real (non-symlink) copies so everything stays in sync.
34 + */
35 +const discoverSkillRoots = (home: string): string[] => {
36 + const candidates = [path.join(home, '.agents', 'skills'), path.join(home, '.claude', 'skills')];
37 +
38 + const seen = new Set<string>();
39 + const roots: string[] = [];
40 +
41 + for (const parent of candidates) {
42 + const skillDir = path.join(parent, SKILL_NAME);
43 + try {
44 + const stat = fs.lstatSync(skillDir);
45 + if (stat.isSymbolicLink()) {
46 + // Resolve the symlink target — we'll rebuild the real directory it points to
47 + const realDir = fs.realpathSync(skillDir);
48 + const realParent = path.dirname(realDir);
49 + if (!seen.has(realParent)) {
50 + seen.add(realParent);
51 + roots.push(realParent);
52 + }
53 + } else if (stat.isDirectory()) {
54 + if (!seen.has(parent)) {
55 + seen.add(parent);
56 + roots.push(parent);
57 + }
58 + }
59 + } catch {
60 + // Directory doesn't exist — skip
61 + }
62 + }
63 +
64 + // Always include ~/.agents/skills as a fallback so there's at least one target
65 + const agentSkillsRoot = path.join(home, '.agents', 'skills');
66 + if (!seen.has(agentSkillsRoot)) {
67 + roots.push(agentSkillsRoot);
68 + }
69 +
70 + return roots;
71 +};
72 +
73 +const rebuildSkill = Effect.gen(function* () {
74 + const ui = yield* TerminalUI;
75 + const os = yield* NodeOs;
76 + const cliConfig = yield* ComposioCliUserConfig;
77 + const home = os.homedir;
78 +
79 + // Build the feature overrides from the current config
80 + const featureOverrides: Partial<Record<SkillFeatureFlag, boolean>> = {};
81 + for (const name of knownFeatures) {
82 + featureOverrides[name as SkillFeatureFlag] = cliConfig.isExperimentalFeatureEnabled(name);
83 + }
84 +
85 + const roots = discoverSkillRoots(home);
86 + for (const root of roots) {
87 + buildComposioCliSkill({
88 + channel: cliConfig.channel,
89 + outputRoot: root,
90 + featureOverrides,
91 + });
92 + }
93 +
94 + yield* ui.log.step(
95 + roots.length === 1
96 + ? `Rebuilt skill in ${roots[0]}`
97 + : `Rebuilt skill in ${roots.length} locations`
98 + );
99 +});
100 +
101 +export const configExperimentalCmd = Command.make(
102 + 'experimental',
103 + { feature: featureArg, state: stateArg },
104 + ({ feature, state }) =>
105 + Effect.gen(function* () {
106 + const ui = yield* TerminalUI;
107 + const cliConfig = yield* ComposioCliUserConfig;
108 +
109 + // No args: list all experimental features and their state
110 + if (Option.isNone(feature)) {
111 + const features = cliConfig.data.experimentalFeatures;
112 + const lines: string[] = [];
113 + for (const name of knownFeatures) {
114 + const enabled = cliConfig.isExperimentalFeatureEnabled(name);
115 + const configured = name in features;
116 + const suffix = configured ? '' : ` (default, channel: ${cliConfig.channel})`;
117 + lines.push(` ${name}: ${enabled ? 'on' : 'off'}${suffix}`);
118 + }
119 +
120 + // Show any custom features not in the known list
121 + for (const [name, value] of Object.entries(features)) {
122 + if (!knownFeatures.includes(name)) {
123 + lines.push(` ${name}: ${value ? 'on' : 'off'}`);
124 + }
125 + }
126 +
127 + if (lines.length === 0) {
128 + yield* ui.log.info('No experimental features available.');
129 + } else {
130 + yield* ui.note(lines.join('\n'), 'Experimental Features');
131 + yield* ui.output(JSON.stringify(features));
132 + }
133 + return;
134 + }
135 +
136 + const featureName = feature.value;
137 +
138 + // Feature name only: show current state
139 + if (Option.isNone(state)) {
140 + const enabled = cliConfig.isExperimentalFeatureEnabled(featureName);
141 + yield* ui.log.info(`${featureName}: ${enabled ? 'on' : 'off'}`);
142 + yield* ui.output(enabled ? 'on' : 'off');
143 + return;
144 + }
145 +
146 + const stateValue = state.value.toLowerCase();
147 + if (stateValue !== 'on' && stateValue !== 'off') {
148 + yield* ui.log.error(`Invalid state "${state.value}". Use "on" or "off".`);
149 + return yield* Effect.fail(new Error(`Invalid state: ${state.value}`));
150 + }
151 +
152 + const enabled = stateValue === 'on';
153 + yield* cliConfig.update({
154 + experimentalFeatures: {
155 + ...cliConfig.data.experimentalFeatures,
156 + [featureName]: enabled,
157 + },
158 + });
159 +
160 + yield* ui.log.success(`${featureName}: ${stateValue}`);
161 +
162 + // Rebuild the skill so Claude Code picks up the new feature flags
163 + yield* rebuildSkill.pipe(
164 + Effect.catchAll(error =>
165 + Effect.gen(function* () {
166 + yield* Effect.logDebug('Skill rebuild failed:', error);
167 + yield* ui.log.warn('Could not rebuild skill (non-fatal)');
168 + })
169 + )
170 + );
171 +
172 + yield* ui.output(stateValue);
173 + })
174 +).pipe(
175 + Command.withDescription(
176 + [
177 + 'View or toggle experimental feature flags.',
178 + '',
179 + 'Usage:',
180 + ' composio config experimental List all features',
181 + ' composio config experimental <feature> Show current state',
182 + ' composio config experimental <feature> on|off Enable or disable',
183 + '',
184 + `Known features: ${knownFeatures.join(', ')}`,
185 + ].join('\n')
186 + )
187 +);
ts/packages/cli/src/commands/index.ts
+2
@@ -26,6 +26,7 @@ import { rootToolsCmd } from './tools/tools.cmd';
26 import { rootTriggersCmd } from './triggers/root-triggers.cmd';
27 import { rootConnectedAccountsCmd$Link } from './connected-accounts/commands/connected-accounts.link.cmd';
28 import { orgsCmd } from './orgs/orgs.cmd';
29 +import { configCmd } from './config/config.cmd';
30 import { renderCommandHintGraph } from 'src/services/command-hints';
31 import { resetRuntimeDebugFlags, setRuntimeDebugFlags } from 'src/services/runtime-debug-flags';
32 import { ComposioCliUserConfig } from 'src/services/cli-user-config';
@@ -65,6 +66,7 @@ const ROOT_COMMANDS: ReadonlyArray<TaggedValue<Command.Command<any, any, any, an
66 tagged(rootToolsCmd$Execute),
67 tagged(generateCmd),
68 tagged(orgsCmd),
69 + tagged(configCmd),
70 ];
71
72 export const buildRootCommand = (visibility: CommandVisibility) => {
ts/packages/cli/src/commands/root-help.ts
+38 -2
@@ -170,6 +170,7 @@ const ACCOUNT_COMMANDS: ReadonlyArray<TaggedValue<CompactCommand>> = [
170 tagged({ name: 'orgs', description: 'Manage default organization context (list, switch)' }),
171 tagged({ name: 'version', description: 'Display CLI version' }),
172 tagged({ name: 'upgrade', description: 'Upgrade CLI to the latest version' }),
173 + tagged({ name: 'config', description: 'View and manage CLI configuration' }),
174 ];
175
176 // ── Render helpers ─────────────────────────────────────────────────────
@@ -357,20 +358,37 @@ const SUBCOMMAND_HELP: Record<string, SubcommandHelp | TaggedValue<SubcommandHel
358 ],
359 }),
360 link: {
360 - usage: 'composio link [<toolkit>] [--no-wait]',
361 + usage: 'composio link [<toolkit>] [--no-wait] [--alias text] [--list]',
362 description:
363 'Connect an external account (GitHub, Gmail, Slack, etc.) so tools can act on your behalf. Opens a browser for OAuth authorization and waits for confirmation.',
364 args: [{ name: '<toolkit>', description: 'Toolkit slug to link (e.g. "github", "gmail")' }],
365 + options: [
366 + {
367 + name: '--alias <text>',
368 + description:
369 + 'Alias for the connected account. Required when creating an additional account for the same toolkit (requires multi_account experimental feature)',
370 + },
371 + ],
372 flags: [
373 {
374 name: '--no-wait',
375 description: 'Print link info and exit without waiting for authorization',
376 },
377 + {
378 + name: '--list',
379 + description:
380 + 'List existing connected accounts for the toolkit instead of creating a new link',
381 + },
382 + ],
383 + examples: [
384 + 'composio link github',
385 + 'composio link gmail --alias work',
386 + 'composio link github --list',
387 ],
370 - examples: ['composio link github'],
388 seeAlso: [
389 'composio search "<query>" Find tools to use after linking',
390 "composio execute <slug> -d '{ ... }' Execute a tool with your connected account",
391 + 'composio config experimental Manage experimental features',
392 ],
393 },
394 run: {
@@ -927,6 +945,24 @@ const SUBCOMMAND_HELP: Record<string, SubcommandHelp | TaggedValue<SubcommandHel
945 ],
946 flags: [{ name: '--case-sensitive', description: 'Case-sensitive filtering' }],
947 },
948 + config: {
949 + usage: 'composio config <subcommand>',
950 + description: 'View and manage CLI configuration.',
951 + seeAlso: ['composio config experimental'],
952 + },
953 + 'config experimental': {
954 + usage: 'composio config experimental [<feature>] [on|off]',
955 + description: 'View or toggle experimental feature flags.',
956 + args: [
957 + { name: '<feature>', description: 'Feature name (e.g., listen, multi_account)' },
958 + { name: 'on|off', description: 'Enable or disable the feature' },
959 + ],
960 + examples: [
961 + 'composio config experimental # List all features',
962 + 'composio config experimental listen # Show current state',
963 + 'composio config experimental multi_account on # Enable multi_account',
964 + ],
965 + },
966 'dev logs triggers': {
967 usage:
968 'composio dev logs triggers [--trigger text] [--trigger-id text] [--limit integer] [--time 5m|30m|6h|1d|1w] [<log_id>]',