Skip to content

Commit 2281559

Browse files
committed
style: fix prettier formatting in 7 files
1 parent 24ca2f5 commit 2281559

7 files changed

Lines changed: 68 additions & 15 deletions

File tree

src/cli/commands/dev/command.tsx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { findConfigRoot, getWorkingDirectory, readEnvFile } from '../../../lib';
2-
import { parseHeaderFlags } from '../shared/header-utils';
32
import { getErrorMessage } from '../../errors';
43
import { ExecLogger } from '../../logging';
54
import {
@@ -21,6 +20,7 @@ import { FatalError } from '../../tui/components';
2120
import { LayoutProvider } from '../../tui/context';
2221
import { COMMAND_DESCRIPTIONS } from '../../tui/copy';
2322
import { requireProject } from '../../tui/guards';
23+
import { parseHeaderFlags } from '../shared/header-utils';
2424
import type { Command } from '@commander-js/extra-typings';
2525
import { Text, render } from 'ink';
2626
import React from 'react';
@@ -30,7 +30,12 @@ const ENTER_ALT_SCREEN = '\x1B[?1049h\x1B[H';
3030
const EXIT_ALT_SCREEN = '\x1B[?1049l';
3131
const SHOW_CURSOR = '\x1B[?25h';
3232

33-
async function invokeDevServer(port: number, prompt: string, stream: boolean, headers?: Record<string, string>): Promise<void> {
33+
async function invokeDevServer(
34+
port: number,
35+
prompt: string,
36+
stream: boolean,
37+
headers?: Record<string, string>
38+
): Promise<void> {
3439
try {
3540
if (stream) {
3641
// Stream response to stdout
@@ -70,7 +75,13 @@ async function invokeA2ADevServer(port: number, prompt: string, headers?: Record
7075
}
7176
}
7277

73-
async function handleMcpInvoke(port: number, invokeValue: string, toolName?: string, input?: string, headers?: Record<string, string>): Promise<void> {
78+
async function handleMcpInvoke(
79+
port: number,
80+
invokeValue: string,
81+
toolName?: string,
82+
input?: string,
83+
headers?: Record<string, string>
84+
): Promise<void> {
7485
try {
7586
if (invokeValue === 'list-tools') {
7687
const { tools } = await listMcpTools(port, undefined, headers);
@@ -133,7 +144,12 @@ export const registerDev = (program: Command) => {
133144
.option('-l, --logs', 'Run dev server with logs to stdout [non-interactive]')
134145
.option('--tool <name>', 'MCP tool name (used with --invoke call-tool)')
135146
.option('--input <json>', 'MCP tool arguments as JSON (used with --invoke call-tool)')
136-
.option('-H, --header <header>', 'Custom header to forward to the agent (format: "Name: Value", repeatable)', (val: string, prev: string[]) => [...prev, val], [] as string[])
147+
.option(
148+
'-H, --header <header>',
149+
'Custom header to forward to the agent (format: "Name: Value", repeatable)',
150+
(val: string, prev: string[]) => [...prev, val],
151+
[] as string[]
152+
)
137153
.action(async opts => {
138154
try {
139155
const port = parseInt(opts.port, 10);

src/cli/commands/invoke/action.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,12 @@ export async function handleInvoke(context: InvokeContext, options: InvokeOption
168168
if (agentSpec.protocol === 'A2A') {
169169
try {
170170
const a2aResult = await invokeA2ARuntime(
171-
{ region: targetConfig.region, runtimeArn: agentState.runtimeArn, userId: options.userId, headers: options.headers },
171+
{
172+
region: targetConfig.region,
173+
runtimeArn: agentState.runtimeArn,
174+
userId: options.userId,
175+
headers: options.headers,
176+
},
172177
options.prompt
173178
);
174179
let response = '';

src/cli/commands/invoke/command.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,12 @@ export const registerInvoke = (program: Command) => {
104104
.option('--stream', 'Stream response in real-time (TUI streams by default) [non-interactive]')
105105
.option('--tool <name>', 'MCP tool name (use with "call-tool" prompt) [non-interactive]')
106106
.option('--input <json>', 'MCP tool arguments as JSON (use with --tool) [non-interactive]')
107-
.option('-H, --header <header>', 'Custom header to forward to the agent (format: "Name: Value", repeatable)', (val: string, prev: string[]) => [...prev, val], [] as string[])
107+
.option(
108+
'-H, --header <header>',
109+
'Custom header to forward to the agent (format: "Name: Value", repeatable)',
110+
(val: string, prev: string[]) => [...prev, val],
111+
[] as string[]
112+
)
108113
.action(
109114
async (
110115
positionalPrompt: string | undefined,

src/cli/commands/shared/__tests__/header-utils.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
import { normalizeHeaderName, parseAndNormalizeHeaders, parseHeaderFlag, parseHeaderFlags, validateHeaderAllowlist } from '../header-utils';
1+
import {
2+
normalizeHeaderName,
3+
parseAndNormalizeHeaders,
4+
parseHeaderFlag,
5+
parseHeaderFlags,
6+
validateHeaderAllowlist,
7+
} from '../header-utils';
28
import { describe, expect, it } from 'vitest';
39

410
describe('normalizeHeaderName', () => {

src/cli/commands/shared/header-utils.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,7 @@ export function parseHeaderFlags(rawHeaders: string[]): Record<string, string> {
9999
for (const raw of rawHeaders) {
100100
const parsed = parseHeaderFlag(raw);
101101
if (!parsed) {
102-
throw new Error(
103-
`Invalid header format: "${raw}". Expected "Header-Name: value" or "Header-Name:value".`
104-
);
102+
throw new Error(`Invalid header format: "${raw}". Expected "Header-Name: value" or "Header-Name:value".`);
105103
}
106104
result[parsed.name] = parsed.value;
107105
}

src/cli/operations/dev/invoke-mcp.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ export interface McpToolsResult {
2020
* Sends initialize + tools/list JSON-RPC requests to the MCP endpoint.
2121
* Returns tools and the session ID needed for subsequent calls.
2222
*/
23-
export async function listMcpTools(port: number, logger?: SSELogger, customHeaders?: Record<string, string>): Promise<McpToolsResult> {
23+
export async function listMcpTools(
24+
port: number,
25+
logger?: SSELogger,
26+
customHeaders?: Record<string, string>
27+
): Promise<McpToolsResult> {
2428
const maxRetries = 5;
2529
const baseDelay = 500;
2630
let lastError: Error | null = null;
@@ -43,7 +47,11 @@ export async function listMcpTools(port: number, logger?: SSELogger, customHeade
4347

4448
const initRes = await fetch(`http://localhost:${port}/mcp`, {
4549
method: 'POST',
46-
headers: { 'Content-Type': 'application/json', Accept: 'application/json, text/event-stream', ...customHeaders },
50+
headers: {
51+
'Content-Type': 'application/json',
52+
Accept: 'application/json, text/event-stream',
53+
...customHeaders,
54+
},
4755
body: JSON.stringify(initBody),
4856
});
4957

@@ -84,7 +92,11 @@ export async function listMcpTools(port: number, logger?: SSELogger, customHeade
8492

8593
const listRes = await fetch(`http://localhost:${port}/mcp`, {
8694
method: 'POST',
87-
headers: { 'Content-Type': 'application/json', Accept: 'application/json, text/event-stream', ...sessionHeaders },
95+
headers: {
96+
'Content-Type': 'application/json',
97+
Accept: 'application/json, text/event-stream',
98+
...sessionHeaders,
99+
},
88100
body: JSON.stringify(listBody),
89101
});
90102

src/cli/tui/hooks/useDevServer.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ export interface ConversationMessage {
4141

4242
const MAX_LOG_ENTRIES = 50;
4343

44-
export function useDevServer(options: { workingDir: string; port: number; agentName?: string; onReady?: () => void; headers?: Record<string, string> }) {
44+
export function useDevServer(options: {
45+
workingDir: string;
46+
port: number;
47+
agentName?: string;
48+
onReady?: () => void;
49+
headers?: Record<string, string>;
50+
}) {
4551
const [logs, setLogs] = useState<LogEntry[]>([]);
4652
const [status, setStatus] = useState<ServerStatus>('starting');
4753
const [isStreaming, setIsStreaming] = useState(false);
@@ -326,7 +332,12 @@ export function useDevServer(options: { workingDir: string; port: number; agentN
326332
onStatus: setA2aStatus,
327333
headers: options.headers,
328334
})
329-
: invokeAgentStreaming({ port: actualPort, message, logger: loggerRef.current ?? undefined, headers: options.headers });
335+
: invokeAgentStreaming({
336+
port: actualPort,
337+
message,
338+
logger: loggerRef.current ?? undefined,
339+
headers: options.headers,
340+
});
330341

331342
for await (const chunk of streamFn) {
332343
responseContent += chunk;

0 commit comments

Comments
 (0)