Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,9 @@ Example: `mcpc @apify logging-set-level debug`

After making any code changes, always run `npm run lint` and fix **all** errors before committing. Do not skip or ignore lint failures. The lint command checks both ESLint rules and Prettier formatting. To auto-fix issues, run `npm run lint:fix`. If auto-fix doesn't resolve everything, manually fix the remaining errors. Never commit code that fails `npm run lint`. **As the very last step of every task**, run `npm run lint` once more and fix any remaining issues before considering the work done.

After lint passes, run `npm test` (unit tests) and fix any failures before committing. If a test fails due to your changes, update the test or fix the code so all tests pass. Never commit code that fails unit tests.
After lint passes, run `npm run build` and fix any TypeScript compilation errors before committing. The CI runs `tsc` with strict settings (including `noUnusedLocals`) that may catch errors not reported by ESLint alone, such as unused imports or type errors. Never commit code that fails `npm run build`.

After build passes, run `npm run test:unit` and fix any failures before committing. If a test fails due to your changes, update the test or fix the code so all tests pass. Never commit code that fails unit tests.

For any non-trivial change (new feature, bug fix, behaviour change, or notable refactor), add an entry to the `[Unreleased]` section of `CHANGELOG.md` before finishing. Use the appropriate category (`Added`, `Changed`, `Fixed`, `Removed`). Skip purely internal changes such as test-only edits, code style fixes, or minor cosmetic/styling tweaks (e.g. changing colors, adjusting whitespace, renaming labels).

Expand Down
25 changes: 1 addition & 24 deletions src/cli/commands/grep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@ import { isProcessAlive } from '../../lib/utils.js';
import { consolidateSessions } from '../../lib/sessions.js';
import { withSessionClient } from '../../lib/session-client.js';
import { withMcpClient } from '../helpers.js';
import {
formatJson,
formatToolParamsInline,
formatToolAnnotations,
grayBacktick,
inBackticks,
} from '../output.js';
import { formatJson, formatToolLine, inBackticks } from '../output.js';
import type { IMcpClient } from '../../lib/types.js';
import { getBridgeStatus, formatBridgeStatus } from './sessions.js';

Expand Down Expand Up @@ -280,23 +274,6 @@ function truncateResult(
};
}

/**
* Format a single tool as a compact bullet line (same style as tools-list)
*/
function formatToolLine(tool: Tool): string {
const bullet = chalk.dim('*');
const params = formatToolParamsInline(tool.inputSchema as Record<string, unknown>);
const parts: string[] = [];
const annotationsStr = formatToolAnnotations(tool.annotations);
if (annotationsStr) parts.push(annotationsStr);
const toolAny = tool as Record<string, unknown>;
const execution = toolAny.execution as Record<string, unknown> | undefined;
const taskSupport = execution?.taskSupport as string | undefined;
if (taskSupport) parts.push(`task:${taskSupport}`);
const suffix = parts.length > 0 ? ` ${chalk.gray(`[${parts.join(', ')}]`)}` : '';
return `${bullet} ${grayBacktick()}${chalk.cyan(tool.name)}${params}${grayBacktick()}${suffix}`;
}

/**
* Format a single resource as a compact bullet line
*/
Expand Down
33 changes: 19 additions & 14 deletions src/cli/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,28 +460,33 @@ export function formatToolParamsInline(schema: Record<string, unknown>): string
* Format tools summary list (shared by compact and full modes)
* Format: * `tool_name(params)` [annotations]
*/
/**
* Format a single tool as a compact bullet line: * `tool_name (params)` [annotations]
*/
export function formatToolLine(tool: Tool): string {
const bullet = chalk.dim('*');
const params = formatToolParamsInline(tool.inputSchema as Record<string, unknown>);
const parts: string[] = [];
const annotationsStr = formatToolAnnotations(tool.annotations);
if (annotationsStr) parts.push(annotationsStr);
// Show task execution mode
const toolAny = tool as Record<string, unknown>;
const execution = toolAny.execution as Record<string, unknown> | undefined;
const taskSupport = execution?.taskSupport as string | undefined;
if (taskSupport) parts.push(`task:${taskSupport}`);
const suffix = parts.length > 0 ? ` ${chalk.gray(`[${parts.join(', ')}]`)}` : '';
return `${bullet} ${grayBacktick()}${chalk.cyan(tool.name)} ${params}${grayBacktick()}${suffix}`;
}

function formatToolsSummary(tools: Tool[]): string[] {
const lines: string[] = [];

// Header with tool count
lines.push(chalk.bold(`Tools (${tools.length}):`));

// Summary list of tools
const bullet = chalk.dim('*');
for (const tool of tools) {
const params = formatToolParamsInline(tool.inputSchema as Record<string, unknown>);
const parts: string[] = [];
const annotationsStr = formatToolAnnotations(tool.annotations);
if (annotationsStr) parts.push(annotationsStr);
// Show task execution mode
const toolAny = tool as Record<string, unknown>;
const execution = toolAny.execution as Record<string, unknown> | undefined;
const taskSupport = execution?.taskSupport as string | undefined;
if (taskSupport) parts.push(`task:${taskSupport}`);
const suffix = parts.length > 0 ? ` ${chalk.gray(`[${parts.join(', ')}]`)}` : '';
lines.push(
`${bullet} ${grayBacktick()}${chalk.cyan(tool.name)} ${params}${grayBacktick()}${suffix}`
);
lines.push(formatToolLine(tool));
}

return lines;
Expand Down
Loading