@devries-cameron20 / composio Mirror · read-only / commits / 62643f18c
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.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 22, 08:15 UTC

fix(cli): add tip when a flag is passed without its required value

When @effect/cli reports "Received unknown argument: '--query'" (because the user wrote `--query` without a value), append a tip explaining that the flag requires a value, e.g. `--query "value"`.

jkomyno committed Feb 18, 2026 at 20:44 UTC 62643f18c5964b959a5a6234678b6940428cef20
1 file changed +12 -3
ts/packages/cli/src/bin.ts
+12 -3
@@ -1,7 +1,7 @@
1 import process from 'node:process';
2 import { Cause, Console, Effect, Exit, Layer, Logger } from 'effect';
3 import { captureErrors, prettyPrintFromCapturedErrors } from 'effect-errors/index';
4 -import { CliConfig, ValidationError } from '@effect/cli';
4 +import { CliConfig, HelpDoc, ValidationError } from '@effect/cli';
5 import { FetchHttpClient } from '@effect/platform';
6 import { BunContext, BunRuntime, BunFileSystem } from '@effect/platform-bun';
7 import type { Teardown } from '@effect/platform/Runtime';
@@ -101,9 +101,18 @@ const runWithArgs = Effect.flatMap(runWithConfig, run => run(process.argv)) sati
101 runWithArgs.pipe(
102 Effect.scoped,
103 // @effect/cli already prints validation errors (missing args, invalid flags, etc.)
104 - // via its own printDocs before re-failing. Swallow the error here to avoid
104 + // via its own printDocs before re-failing. Swallow the re-thrown error to avoid
105 // routing it through the generic error box which would dump raw JSON.
106 - Effect.catchIf(ValidationError.isValidationError, () => Effect.void),
106 + // When a flag is passed without its required value (e.g. `--query` instead of
107 + // `--query "text"`), @effect/cli reports it as "unknown argument" — add a tip.
108 + Effect.catchIf(ValidationError.isValidationError, error => {
109 + const text = HelpDoc.toAnsiText(error.error).trim();
110 + const flagMatch = text.match(/Received unknown argument: '(--\w+)'/);
111 + if (flagMatch) {
112 + return Console.error(`Tip: ${flagMatch[1]} requires a value, e.g. ${flagMatch[1]} "value"`);
113 + }
114 + return Effect.void;
115 + }),
116 Effect.withSpan('composio-cli', {
117 attributes: {
118 name: constants.APP_NAME,