@devries-cameron20 / composio-1 / commits / a72466f4c
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.

refactor(cli): extract shared truncate utility from format modules

jkomyno committed Feb 19, 2026 at 12:44 UTC a72466f4c289055d7261f8a505e3e68eebe292f2
3 files changed +9 -16
ts/packages/cli/src/commands/toolkits/format.ts
+1 -8
@@ -1,13 +1,6 @@
1 import type { Toolkit } from 'src/models/toolkits';
2 import { bold, gray } from 'src/ui/colors';
3 -
4 -/**
5 - * Truncate a string to the given max length, appending "..." if truncated.
6 - */
7 -function truncate(str: string, max: number): string {
8 - if (str.length <= max) return str;
9 - return str.slice(0, max - 3) + '...';
10 -}
3 +import { truncate } from 'src/ui/truncate';
4
5 /**
6 * Format a list of toolkits as a human-readable table.
ts/packages/cli/src/commands/tools/format.ts
+1 -8
@@ -1,14 +1,7 @@
1 import type { Tool } from 'src/models/tools';
2 import type { ToolDetailedResponse } from 'src/services/composio-clients';
3 import { bold, gray } from 'src/ui/colors';
4 -
5 -/**
6 - * Truncate a string to the given max length, appending "..." if truncated.
7 - */
8 -function truncate(str: string, max: number): string {
9 - if (str.length <= max) return str;
10 - return str.slice(0, max - 3) + '...';
11 -}
4 +import { truncate } from 'src/ui/truncate';
5
6 /**
7 * Format a list of tools as a human-readable table.
ts/packages/cli/src/ui/truncate.ts new
+7
@@ -0,0 +1,7 @@
1 +/**
2 + * Truncate a string to the given max length, appending "..." if truncated.
3 + */
4 +export function truncate(str: string, max: number): string {
5 + if (str.length <= max) return str;
6 + return str.slice(0, max - 3) + '...';
7 +}