source dump of claude code
at main 19 lines 688 B view raw
1import { relative } from 'path' 2import type { ToolUseContext } from '../../Tool.js' 3import type { LocalCommandResult } from '../../types/command.js' 4import { getCwd } from '../../utils/cwd.js' 5import { cacheKeys } from '../../utils/fileStateCache.js' 6 7export async function call( 8 _args: string, 9 context: ToolUseContext, 10): Promise<LocalCommandResult> { 11 const files = context.readFileState ? cacheKeys(context.readFileState) : [] 12 13 if (files.length === 0) { 14 return { type: 'text' as const, value: 'No files in context' } 15 } 16 17 const fileList = files.map(file => relative(getCwd(), file)).join('\n') 18 return { type: 'text' as const, value: `Files in context:\n${fileList}` } 19}