Skip to content

Chrome DevTools for coding agents

chore: change text format to md in CLI (#1102)

Alex Rudenkoa02a5671f9eb
diff --git a/src/bin/chrome-devtools.ts b/src/bin/chrome-devtools.ts
index 663b619a..f951928a 100644
--- a/src/bin/chrome-devtools.ts
+++ b/src/bin/chrome-devtools.ts
@@ -110,8 +110,8 @@ for (const [commandName, commandDef] of Object.entries(commands)) {
commandDef.description,
y => {
y.option('format', {
- choices: ['text', 'json'],
- default: 'text',
+ choices: ['md', 'json'],
+ default: 'md',
});
for (const [argName, opt] of Object.entries(args)) {
const type =
@@ -173,7 +173,7 @@ for (const [commandName, commandDef] of Object.entries(commands)) {
console.log(
handleResponse(
JSON.parse(response.result) as unknown as CallToolResult,
- argv['format'] as 'json' | 'text',
+ argv['format'] as 'json' | 'md',
),
);
} else {
diff --git a/src/daemon/client.ts b/src/daemon/client.ts
index 3400268c..40e50c5f 100644
--- a/src/daemon/client.ts
+++ b/src/daemon/client.ts
@@ -146,7 +146,7 @@ export async function stopDaemon() {
export function handleResponse(
response: CallToolResult,
- format: 'json' | 'text',
+ format: 'json' | 'md',
): string {
if (response.isError) {
return JSON.stringify(response.content);
@@ -165,5 +165,5 @@ export function handleResponse(
throw new Error('Not supported response content type');
}
}
- return format === 'text' ? chunks.join('') : JSON.stringify(chunks);
+ return format === 'md' ? chunks.join('') : JSON.stringify(chunks);
}
diff --git a/tests/daemon/client.test.ts b/tests/daemon/client.test.ts
index 1a11fcff..97e302e8 100644
--- a/tests/daemon/client.test.ts
+++ b/tests/daemon/client.test.ts
@@ -55,7 +55,7 @@ describe('daemon client', () => {
describe('parsing', () => {
it('handles MCP response with text format', async () => {
const textResponse = {content: [{type: 'text' as const, text: 'test'}]};
- assert.strictEqual(handleResponse(textResponse, 'text'), 'test');
+ assert.strictEqual(handleResponse(textResponse, 'md'), 'test');
});
it('handles JSON response', async () => {
@@ -78,7 +78,7 @@ describe('daemon client', () => {
content: [{type: 'text' as const, text: 'Something went wrong'}],
};
assert.strictEqual(
- handleResponse(errorResponse, 'text'),
+ handleResponse(errorResponse, 'md'),
JSON.stringify(errorResponse.content),
);
});
@@ -108,7 +108,7 @@ describe('daemon client', () => {
structuredContent: {},
};
assert.throws(
- () => handleResponse(unsupportedContentResponse, 'text'),
+ () => handleResponse(unsupportedContentResponse, 'md'),
new Error('Not supported response content type'),
);
});