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): ensure colors have proper contrast
jkomyno committed
Jul 29, 2025 at 03:41 UTC
fe5acc7d7929493947a0c24d061c424418fa23b2
17 files changed
+44
-30
ts/packages/cli/README.md
+1
@@ -52,6 +52,7 @@ By default, this file is stored in `~/.composio`, but you can specify a custom l
52
| COMPOSIO_CACHE_DIR | - | The directory where the Composio CLI stores cache files | ~/.composio |
53
| COMPOSIO_LOG_LEVEL | - | The log level for the Composio CLI | None |
54
| DEBUG_OVERRIDE_VERSION | - | The version to use when upgrading the Composio CLI (for debugging) | None |
55
+| NO_COLOR | - | If set, disables color output in the CLI (https://no-color.org/) | None |
56
57
Additionally, `composio upgrade` supports the following environment variables:
58
ts/packages/cli/src/effect-errors/pretty-print-from-captured-errors.ts
+3
-1
@@ -1,3 +1,4 @@
1
+import * as color from 'src/ui/colors';
2
import { formatCapturedError, formatTitle, interruptedMessage } from 'effect-errors/pretty-print';
3
import { type PrettyPrintOptions, prettyPrintOptionsDefault } from 'effect-errors/types';
4
@@ -14,5 +15,6 @@ export const prettyPrintFromCapturedErrors = (
15
const title = formatTitle(errors.length);
16
const formattedFailures = errors.map(formatCapturedError(errors.length, options));
17
17
- return [...title, ...formattedFailures].join('\r\n');
18
+ const message = [...title, ...formattedFailures].join('\r\n');
19
+ return color.bgBlack(message);
20
};
ts/packages/cli/src/effect-errors/pretty-print/captured-errors/maybe-advice-spans-usage.ts
+1
-1
@@ -1,4 +1,4 @@
1
-import color from 'picocolors';
1
+import * as color from 'src/ui/colors';
2
3
import type { ErrorSpan } from 'effect-errors/types';
4
ts/packages/cli/src/effect-errors/pretty-print/captured-errors/maybe-advise-spans-usage.ts
+2
-2
@@ -1,10 +1,10 @@
1
-import color from 'picocolors';
1
+import * as color from 'src/ui/colors';
2
3
import type { ErrorSpan } from 'effect-errors/types';
4
5
export const maybeAdviseSpansUsage = (spans: ErrorSpan[] | undefined): string[] => {
6
if (spans === undefined || spans.length === 0) {
7
- return ['', color.gray('ℹ️ Consider using spans to improve errors reporting.')];
7
+ return [' ', color.gray('ℹ️ Consider using spans to improve errors reporting.')];
8
}
9
10
return [];
ts/packages/cli/src/effect-errors/pretty-print/captured-errors/maybe-print-node-stacktrace.ts
+5
-5
@@ -1,4 +1,4 @@
1
-import color from 'picocolors';
1
+import * as color from 'src/ui/colors';
2
3
import { stripCwdPath } from 'effect-errors/logic/path';
4
import type { PrettyPrintOptions } from 'effect-errors/types';
@@ -17,16 +17,16 @@ export const maybePrintNodeStacktrace = (
17
const nodes = stack.map(el => `│ ${stripCwd ? stripCwdPath(el) : el}`).join('\r\n');
18
19
return [
20
- '',
20
+ ' ',
21
`${color.bold(color.red('◯'))} ${color.redBright(color.underline('Node Stacktrace 🚨'))}`,
22
- color.red(nodes),
23
- color.red('┴'),
22
+ color.redBright(nodes),
23
+ color.redBright('┴'),
24
];
25
}
26
27
if (!isPlainString) {
28
return [
29
- '',
29
+ ' ',
30
color.gray(
31
'ℹ️ Consider using a yieldable error such as Data.TaggedError and Schema.TaggedError to get a stacktrace.'
32
),
ts/packages/cli/src/effect-errors/pretty-print/captured-errors/maybe-print-spans-timeline.ts
+2
-2
@@ -1,4 +1,4 @@
1
-import color from 'picocolors';
1
+import * as color from 'src/ui/colors';
2
3
import { stripCwdPath } from 'effect-errors/logic/path';
4
import {
@@ -15,7 +15,7 @@ export const maybePrintSpansTimeline = (
15
{ stripCwd }: PrettyPrintOptions
16
): string[] => {
17
if (spans === undefined) {
18
- return isPlainString === false ? ['', missingSpansWarning, ''] : [];
18
+ return isPlainString === false ? [' ', missingSpansWarning, ' '] : [];
19
}
20
21
return spans.reduce<string[]>((output, { name, durationInMilliseconds, attributes }, index) => {
ts/packages/cli/src/effect-errors/pretty-print/captured-errors/print-effect-stacktrace.ts
+4
-4
@@ -1,4 +1,4 @@
1
-import color from 'picocolors';
1
+import * as color from 'src/ui/colors';
2
3
import { stripCwdPath } from 'effect-errors/logic/path';
4
import type { ErrorRelatedSources } from 'effect-errors/sourcemaps';
@@ -21,10 +21,10 @@ export const printEffectStacktrace = (
21
});
22
23
return [
24
- `${color.bold(color.red('◯'))} ${color.red('Sources')} 🕵️`,
24
+ `${color.bold(color.redBright('◯'))} ${color.redBright('Sources')} 🕵️`,
25
...paths.map(({ path, name }) =>
26
- color.red(`│ at ${name.length === 0 ? 'module code' : color.underline(name)} (${path})`)
26
+ color.redBright(`│ at ${name.length === 0 ? 'module code' : color.underline(name)} (${path})`)
27
),
28
- color.red('┴'),
28
+ color.redBright('┴'),
29
];
30
};
ts/packages/cli/src/effect-errors/pretty-print/common/constants/missing-spans-warning.ts
+1
-1
@@ -1,3 +1,3 @@
1
-import color from 'picocolors';
1
+import * as color from 'src/ui/colors';
2
3
export const missingSpansWarning = `\r\n${color.gray('ℹ️ Consider using spans to improve errors reporting.')}`;
ts/packages/cli/src/effect-errors/pretty-print/common/format-error-title.ts
+1
-1
@@ -1,4 +1,4 @@
1
-import color from 'picocolors';
1
+import * as color from 'src/ui/colors';
2
3
export const formatErrorTitle = (
4
errorType: unknown,
ts/packages/cli/src/effect-errors/pretty-print/common/format-span-duration.ts
+1
-1
@@ -1,4 +1,4 @@
1
-import color from 'picocolors';
1
+import * as color from 'src/ui/colors';
2
3
export const formatSpanDuration = (durationInMs: number | bigint, isLastEntry: boolean) =>
4
`\r\n${isLastEntry ? ' ' : color.gray('│')} ~ ${durationInMs}ms`;
ts/packages/cli/src/effect-errors/pretty-print/common/format-spans-attribute.ts
+2
-2
@@ -1,4 +1,4 @@
1
-import color from 'picocolors';
1
+import * as color from 'src/ui/colors';
2
3
const maybePrintPipe = (isLastEntry: boolean) => (isLastEntry ? ' ' : color.gray('│'));
4
@@ -10,7 +10,7 @@ export const formatSpanAttributes = (attributes: Record<string, unknown>, isLast
10
11
const lines = Array.from(entries).map(
12
([key, value]) =>
13
- `${maybePrintPipe(isLastEntry)} ${color.blue(key)}${color.gray(':')} ${value}`
13
+ `${maybePrintPipe(isLastEntry)} ${color.white(key)}${color.gray(':')} ${value}`
14
);
15
16
return `\r\n${lines.join('\r\n')}`;
ts/packages/cli/src/effect-errors/pretty-print/common/format-title.ts
+1
-1
@@ -1,4 +1,4 @@
1
-import color from 'picocolors';
1
+import * as color from 'src/ui/colors';
2
3
export const formatTitle = (errorsCount: number): string[] => {
4
if (errorsCount === 1) {
ts/packages/cli/src/effect-errors/pretty-print/common/maybe-warn-about-plain-strings.ts
+2
-2
@@ -1,4 +1,4 @@
1
-import color from 'picocolors';
1
+import * as color from 'src/ui/colors';
2
3
export const maybeWarnAboutPlainStrings = (isPlainString: boolean): string[] => {
4
if (!isPlainString) {
@@ -6,7 +6,7 @@ export const maybeWarnAboutPlainStrings = (isPlainString: boolean): string[] =>
6
}
7
8
return [
9
- '',
9
+ ' ',
10
color.gray(
11
'ℹ️ You used a plain string to represent a failure in the error channel (E). You should consider using tagged objects (with a _tag field), or yieldable errors such as Data.TaggedError and Schema.TaggedError for better handling experience.'
12
),
ts/packages/cli/src/effect-errors/pretty-print/common/spans-stack-trailing-char.ts
+1
-1
@@ -1,4 +1,4 @@
1
-import color from 'picocolors';
1
+import * as color from 'src/ui/colors';
2
3
export const spanStackTrailingChar = (isLastEntry: boolean) =>
4
isLastEntry ? color.gray('╰') : color.gray('├');
ts/packages/cli/src/effect-errors/pretty-print/format-captured-error.ts
+1
-1
@@ -29,5 +29,5 @@ export const formatCapturedError =
29
...effectStacktrace,
30
...nodeStacktrace,
31
'',
32
- ].join('\r\n');
32
+ ].join(' \r\n');
33
};
ts/packages/cli/src/services/composio-clients.ts
+1
-5
@@ -197,11 +197,7 @@ export class ComposioClientLive extends Effect.Service<ComposioClientLive>()(
197
* Generates a new CLI session with a random 6-character code.
198
*/
199
createSession: () =>
200
- callClient(
201
- clientSingleton,
202
- client => client.cli.createSession(),
203
- CliCreateSessionResponse
204
- ),
200
+ callClient(clientSingleton, client => client.cli.createSession(), TriggerTypesResponse),
201
202
/**
203
* Retrieves the current state of a CLI session using either the session ID (UUID) or the 6-character code.
ts/packages/cli/src/ui/colors.ts
new
+15
@@ -0,0 +1,15 @@
1
+import color from 'picocolors';
2
+
3
+export const {
4
+ bold,
5
+ underline,
6
+ bgWhite,
7
+ bgBlack,
8
+ bgRed,
9
+ gray,
10
+ red,
11
+ redBright,
12
+ white,
13
+ blue,
14
+ cyanBright,
15
+} = color.createColors(!Boolean(process.env.NO_COLOR));