mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 22:35:51 +00:00
style: 完成所有文件的lint
This commit is contained in:
@@ -1,5 +1,13 @@
|
||||
import { describe, expect, test } from 'bun:test'
|
||||
import type { CoreTool, Tool, Tools, AnyObject, ToolResult, ValidationResult, PermissionResult } from '@claude-code-best/agent-tools'
|
||||
import type {
|
||||
CoreTool,
|
||||
Tool,
|
||||
Tools,
|
||||
AnyObject,
|
||||
ToolResult,
|
||||
ValidationResult,
|
||||
PermissionResult,
|
||||
} from '@claude-code-best/agent-tools'
|
||||
import type { Tool as HostTool } from '../../../../src/Tool.js'
|
||||
|
||||
describe('agent-tools compatibility', () => {
|
||||
@@ -12,17 +20,29 @@ describe('agent-tools compatibility', () => {
|
||||
aliases: [],
|
||||
searchHint: 'test tool',
|
||||
inputSchema: {} as any,
|
||||
async call() { return { data: 'ok' } as any },
|
||||
async description() { return 'test' },
|
||||
async prompt() { return 'test prompt' },
|
||||
async call() {
|
||||
return { data: 'ok' } as any
|
||||
},
|
||||
async description() {
|
||||
return 'test'
|
||||
},
|
||||
async prompt() {
|
||||
return 'test prompt'
|
||||
},
|
||||
isConcurrencySafe: () => false,
|
||||
isEnabled: () => true,
|
||||
isReadOnly: () => false,
|
||||
async checkPermissions() { return { behavior: 'allow' as const, updatedInput: {} } },
|
||||
async checkPermissions() {
|
||||
return { behavior: 'allow' as const, updatedInput: {} }
|
||||
},
|
||||
toAutoClassifierInput: () => '',
|
||||
userFacingName: () => 'test',
|
||||
maxResultSizeChars: 100000,
|
||||
mapToolResultToToolResultBlockParam: () => ({ type: 'tool_result', tool_use_id: '1', content: 'ok' }),
|
||||
mapToolResultToToolResultBlockParam: () => ({
|
||||
type: 'tool_result',
|
||||
tool_use_id: '1',
|
||||
content: 'ok',
|
||||
}),
|
||||
renderToolUseMessage: () => null,
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,12 @@ describe('toolMatchesName', () => {
|
||||
})
|
||||
|
||||
test('matches alias', () => {
|
||||
expect(toolMatchesName({ name: 'bash', aliases: ['shell', 'sh'] }, 'shell')).toBe(true)
|
||||
expect(toolMatchesName({ name: 'bash', aliases: ['shell', 'sh'] }, 'sh')).toBe(true)
|
||||
expect(
|
||||
toolMatchesName({ name: 'bash', aliases: ['shell', 'sh'] }, 'shell'),
|
||||
).toBe(true)
|
||||
expect(
|
||||
toolMatchesName({ name: 'bash', aliases: ['shell', 'sh'] }, 'sh'),
|
||||
).toBe(true)
|
||||
})
|
||||
|
||||
test('handles empty aliases', () => {
|
||||
|
||||
@@ -186,10 +186,7 @@ export interface CoreTool<
|
||||
// ── Output ──
|
||||
maxResultSizeChars: number
|
||||
userFacingName(input: Partial<z.infer<Input>> | undefined): string
|
||||
mapToolResultToToolResultBlockParam(
|
||||
content: Output,
|
||||
toolUseID: string,
|
||||
): any
|
||||
mapToolResultToToolResultBlockParam(content: Output, toolUseID: string): any
|
||||
|
||||
// ── Optional output helpers ──
|
||||
isResultTruncated?(output: Output): boolean
|
||||
|
||||
Reference in New Issue
Block a user