Download src/components/permissions/FilePermissionDialog/ideDiffConfig.ts from chenbhao/codev: direct link, hf CLI and curl.
- Browser
- Download file 858 Bytes
-
https://huggingface.co/chenbhao/codev/resolve/main/src/components/permissions/FilePermissionDialog/ideDiffConfig.ts
- Command line
-
hf download hf://chenbhao/codev/src/components/permissions/FilePermissionDialog/ideDiffConfig.ts
-
curl -L -o ideDiffConfig.ts https://huggingface.co/chenbhao/codev/resolve/main/src/components/permissions/FilePermissionDialog/ideDiffConfig.ts
858 Bytes
| import type { ToolInput } from './useFilePermissionDialog.js' | |
| export interface FileEdit { | |
| old_string: string | |
| new_string: string | |
| replace_all?: boolean | |
| } | |
| export interface IDEDiffConfig { | |
| filePath: string | |
| edits?: FileEdit[] | |
| editMode?: 'single' | 'multiple' | |
| } | |
| export interface IDEDiffChangeInput { | |
| file_path: string | |
| edits: FileEdit[] | |
| } | |
| export interface IDEDiffSupport<TInput extends ToolInput> { | |
| getConfig(input: TInput): IDEDiffConfig | |
| applyChanges(input: TInput, modifiedEdits: FileEdit[]): TInput | |
| } | |
| export function createSingleEditDiffConfig( | |
| filePath: string, | |
| oldString: string, | |
| newString: string, | |
| replaceAll?: boolean, | |
| ): IDEDiffConfig { | |
| return { | |
| filePath, | |
| edits: [ | |
| { | |
| old_string: oldString, | |
| new_string: newString, | |
| replace_all: replaceAll, | |
| }, | |
| ], | |
| editMode: 'single', | |
| } | |
| } | |