Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
import { Args, Command, HelpDoc, ValidationError } from '@effect/cli';
import { Effect, Option } from 'effect';
import { ComposioCliUserConfig } from 'src/services/cli-user-config';
import { TerminalUI } from 'src/services/terminal-ui';
import { NodeOs } from 'src/services/node-os';
import { CLI_EXPERIMENTAL_FEATURES } from 'src/constants';
import { discoverSkillRoots } from 'src/effects/discover-skill-roots';
import { buildComposioCliSkill } from '../../../skills-src/composio-cli/index';
import type { SkillFeatureFlag } from '../../../skills-src/composio-cli/reference-schema';
const knownFeatures: ReadonlyArray<SkillFeatureFlag> = Object.values(CLI_EXPERIMENTAL_FEATURES);
const featureArg = Args.text({ name: 'feature' }).pipe(
Args.withDescription(`Experimental feature name. Known features: ${knownFeatures.join(', ')}`),
Args.optional
);
const stateArg = Args.text({ name: 'state' }).pipe(
Args.withDescription('Set to "on" or "off"'),
Args.optional
);
const rebuildSkill = Effect.gen(function* () {
const ui = yield* TerminalUI;
const os = yield* NodeOs;
const cliConfig = yield* ComposioCliUserConfig;
const home = os.homedir;
// Build the feature overrides from the current config
const featureOverrides: Partial<Record<SkillFeatureFlag, boolean>> = {};
for (const name of knownFeatures) {
featureOverrides[name] = cliConfig.isExperimentalFeatureEnabled(name);
}
const roots = yield* discoverSkillRoots(home);
for (const root of roots) {
yield* Effect.try(() =>
buildComposioCliSkill({
channel: cliConfig.channel,
outputRoot: root,
featureOverrides,
})
);
}
yield* ui.log.step(
roots.length === 1
? `Rebuilt skill in ${roots[0]}`
: `Rebuilt skill in ${roots.length} locations`
);
});
export const configExperimentalCmd = Command.make(
'experimental',
{ feature: featureArg, state: stateArg },
({ feature, state }) =>
Effect.gen(function* () {
const ui = yield* TerminalUI;
const cliConfig = yield* ComposioCliUserConfig;
// No args: list all experimental features and their state
if (Option.isNone(feature)) {
const features = cliConfig.data.experimentalFeatures;
const lines: string[] = [];
for (const name of knownFeatures) {
const enabled = cliConfig.isExperimentalFeatureEnabled(name);
const configured = name in features;
const suffix = configured ? '' : ` (default, channel: ${cliConfig.channel})`;
lines.push(` ${name}: ${enabled ? 'on' : 'off'}${suffix}`);
}
// Show any custom features not in the known list
for (const [name, value] of Object.entries(features)) {
if (!knownFeatures.some(feature => feature === name)) {
lines.push(` ${name}: ${value ? 'on' : 'off'}`);
}
}
if (lines.length === 0) {
yield* ui.log.info('No experimental features available.');
} else {
yield* ui.note(lines.join('\n'), 'Experimental Features');
yield* ui.output(JSON.stringify(features));
}
return;
}
const featureName = feature.value;
// Feature name only: show current state
if (Option.isNone(state)) {
const enabled = cliConfig.isExperimentalFeatureEnabled(featureName);
yield* ui.log.info(`${featureName}: ${enabled ? 'on' : 'off'}`);
yield* ui.output(enabled ? 'on' : 'off');
return;
}
const stateValue = state.value.toLowerCase();
if (stateValue !== 'on' && stateValue !== 'off') {
yield* ui.log.error(`Invalid state "${state.value}". Use "on" or "off".`);
return yield* Effect.fail(
ValidationError.invalidValue(HelpDoc.p(`Invalid state: ${state.value}`))
);
}
const enabled = stateValue === 'on';
yield* cliConfig.update({
experimentalFeatures: {
...cliConfig.data.experimentalFeatures,
[featureName]: enabled,
},
});
yield* ui.log.success(`${featureName}: ${stateValue}`);
// Rebuild the skill so Claude Code picks up the new feature flags
yield* rebuildSkill.pipe(
Effect.tapError(error =>
Effect.all([
Effect.logDebug('Skill rebuild failed:', error),
ui.log.warn('Could not rebuild skill (non-fatal)'),
])
),
Effect.ignore
);
yield* ui.output(stateValue);
})
).pipe(
Command.withDescription(
[
'View or toggle experimental feature flags.',
'',
'Usage:',
' composio config experimental List all features',
' composio config experimental <feature> Show current state',
' composio config experimental <feature> on|off Enable or disable',
'',
`Known features: ${knownFeatures.join(', ')}`,
].join('\n')
)
);