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
2 changes: 1 addition & 1 deletion src/feishu/__tests__/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('serializeCard', () => {
it('should handle nested objects with ${...} patterns', () => {
const card = {
config: { wide_screen_mode: true },
header: { title: { tag: 'plain_text', content: '🤖 Claude Code' } },
header: { title: { tag: 'plain_text', content: '🤖 Coding Agent' } },
elements: [
{ tag: 'div', text: { tag: 'lark_md', content: 'line 1' } },
{ tag: 'div', text: { tag: 'lark_md', content: 'const key = `${prefix}:${suffix}`' } },
Expand Down
2 changes: 1 addition & 1 deletion src/feishu/__tests__/message-builder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@

describe('buildProgressCard', () => {
it('should build a card with the given prompt', () => {
const card = buildProgressCard('list files') as any;

Check warning on line 7 in src/feishu/__tests__/message-builder.test.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected any. Specify a different type
expect(card.header.template).toBe('blue');
expect(card.header.title.content).toBe('🤖 Claude Code');
expect(card.header.title.content).toBe('🤖 Coding Agent');
const promptEl = card.elements[0];
expect(promptEl.text.content).toContain('list files');
});

it('should use default status text', () => {
const card = buildProgressCard('test') as any;

Check warning on line 15 in src/feishu/__tests__/message-builder.test.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected any. Specify a different type
const statusEl = card.elements[2];
expect(statusEl.text.content).toContain('正在处理...');
});

it('should use custom status text', () => {
const card = buildProgressCard('test', '排队中...') as any;

Check warning on line 21 in src/feishu/__tests__/message-builder.test.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected any. Specify a different type
const statusEl = card.elements[2];
expect(statusEl.text.content).toContain('排队中...');
});

it('should truncate long prompts to 200 chars', () => {
const longPrompt = 'a'.repeat(300);
const card = buildProgressCard(longPrompt) as any;

Check warning on line 28 in src/feishu/__tests__/message-builder.test.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected any. Specify a different type
const content = card.elements[0].text.content;
// Truncated to 200 + '...'
expect(content).toContain('...');
Expand Down
4 changes: 2 additions & 2 deletions src/feishu/event-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -854,9 +854,9 @@ async function handleSlashCommand(
// /help - 帮助
if (trimmed === '/help') {
const helpText = [
'🤖 **Claude Code Bridge 使用帮助**',
'🤖 **Coding Agent 使用帮助**',
'',
'直接发送文本消息即可让 Claude Code 执行任务。',
'直接发送文本消息即可让 Coding Agent 执行任务。',
'',
'**可用命令:**',
'`/project <path>` - 切换工作目录',
Expand Down
28 changes: 14 additions & 14 deletions src/feishu/message-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function buildProgressCard(prompt: string, statusText: string = '正在
return {
config: { wide_screen_mode: true },
header: {
title: { tag: 'plain_text', content: '🤖 Claude Code' },
title: { tag: 'plain_text', content: '🤖 Coding Agent' },
template: 'blue',
},
elements: [
Expand Down Expand Up @@ -141,7 +141,7 @@ export function buildResultCard(
return {
config: { wide_screen_mode: true },
header: {
title: { tag: 'plain_text', content: `🤖 Claude Code - ${status}` },
title: { tag: 'plain_text', content: `🤖 Coding Agent - ${status}` },
template: headerTemplate,
},
elements,
Expand All @@ -163,7 +163,7 @@ export function buildStreamingCard(
return {
config: { wide_screen_mode: true },
header: {
title: { tag: 'plain_text', content: '🤖 Claude Code - 执行中' },
title: { tag: 'plain_text', content: '🤖 Coding Agent - 执行中' },
template: 'blue',
},
elements: [
Expand Down Expand Up @@ -229,10 +229,10 @@ export function buildPipelineCard(

const headerTemplate = isDone ? 'green' : isFailed ? 'red' : 'blue';
const headerTitle = isDone
? '🤖 Claude Code - 管道完成'
? '🤖 Coding Agent - 管道完成'
: isFailed
? '🤖 Claude Code - 管道失败'
: '🤖 Claude Code - 自动开发管道';
? '🤖 Coding Agent - 管道失败'
: '🤖 Coding Agent - 自动开发管道';

const elements: Record<string, unknown>[] = [
{
Expand Down Expand Up @@ -342,7 +342,7 @@ export function buildStatusCard(
return {
config: { wide_screen_mode: true },
header: {
title: { tag: 'plain_text', content: '🤖 Claude Code - 会话状态' },
title: { tag: 'plain_text', content: '🤖 Coding Agent - 会话状态' },
template: 'indigo',
},
elements: [
Expand Down Expand Up @@ -376,7 +376,7 @@ export function buildPipelineConfirmCard(
return {
config: { wide_screen_mode: true },
header: {
title: { tag: 'plain_text', content: '🤖 Claude Code - 自动开发管道' },
title: { tag: 'plain_text', content: '🤖 Coding Agent - 自动开发管道' },
template: 'blue',
},
elements: [
Expand Down Expand Up @@ -435,7 +435,7 @@ export function buildCancelledCard(prompt: string): Record<string, unknown> {
return {
config: { wide_screen_mode: true },
header: {
title: { tag: 'plain_text', content: '🤖 Claude Code - 已取消' },
title: { tag: 'plain_text', content: '🤖 Coding Agent - 已取消' },
template: 'grey',
},
elements: [
Expand Down Expand Up @@ -465,7 +465,7 @@ export function buildInterruptedCard(
return {
config: { wide_screen_mode: true },
header: {
title: { tag: 'plain_text', content: '🤖 Claude Code - 管道中断' },
title: { tag: 'plain_text', content: '🤖 Coding Agent - 管道中断' },
template: 'orange',
},
elements: [
Expand Down Expand Up @@ -517,8 +517,8 @@ export function buildToolProgressCard(
lines.push(...displayed.map(formatToolCall));

const headerTitle = completed
? '🤖 Claude Code - 活动记录'
: '🤖 Claude Code - 执行中';
? '🤖 Coding Agent - 活动记录'
: '🤖 Coding Agent - 执行中';
const headerTemplate = completed ? 'indigo' : 'blue';

const footerParts: string[] = [];
Expand Down Expand Up @@ -679,7 +679,7 @@ export function buildOverviewCard(
return {
config: { wide_screen_mode: true },
header: {
title: { tag: 'plain_text', content: '🤖 Claude Code' },
title: { tag: 'plain_text', content: '🤖 Coding Agent' },
template: stateConfig.template,
},
elements: [
Expand Down Expand Up @@ -768,7 +768,7 @@ export function buildSimpleResultCard(
return {
config: { wide_screen_mode: true },
header: {
title: { tag: 'plain_text', content: `🤖 Claude Code - ${status}` },
title: { tag: 'plain_text', content: `🤖 Coding Agent - ${status}` },
template: headerTemplate,
},
elements,
Expand Down
Loading