πŸ“„ File detail

components/permissions/FilePermissionDialog/ideDiffConfig.ts

🧩 .tsπŸ“ 43 linesπŸ’Ύ 858 bytesπŸ“ text
← Back to All Files

🎯 Use case

This file lives under β€œcomponents/”, which covers shared React UI pieces. On the API surface it exposes FileEdit, IDEDiffConfig, IDEDiffChangeInput, IDEDiffSupport, and createSingleEditDiffConfig β€” mainly types, interfaces, or factory objects. It composes internal code from useFilePermissionDialog (relative imports).

Generated from folder role, exports, dependency roots, and inline comments β€” not hand-reviewed for every path.

🧠 Inline summary

import type { ToolInput } from './useFilePermissionDialog.js' export interface FileEdit { old_string: string new_string: string

πŸ“€ Exports (heuristic)

  • FileEdit
  • IDEDiffConfig
  • IDEDiffChangeInput
  • IDEDiffSupport
  • createSingleEditDiffConfig

πŸ–₯️ Source preview

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',
  }
}