agent-file-tools 0.52.1

Agent File Tools — tree-sitter powered code analysis for AI agents
Documentation
{
  "tool": "edit",
  "dual_mode": true,
  "selection": "session_effective_hashline",
  "arms": {
    "legacy": {
      "arm": "legacy",
      "description": "Edit a file by finding and replacing text, or by targeting named symbols. To write or overwrite a whole file, use the `write` tool — `edit` requires an explicit edit mode and will not silently overwrite a file from `content` alone.",
      "schema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "filePath": {
            "description": "Path to the file to edit (absolute or relative to project root)",
            "type": "string"
          },
          "symbol": {
            "description": "Named symbol to replace (function, class, type)",
            "type": "string"
          },
          "content": {
            "description": "Replacement content for symbol mode. For whole-file writes, use the `write` tool.",
            "type": "string"
          },
          "appendContent": {
            "description": "Text to append to the end of path; creates the file if needed",
            "type": "string"
          },
          "edits": {
            "description": "Batch edits — non-empty array of { oldString, newString }, { oldString, newString, replaceAll: true }, or { startLine, endLine, content } objects",
            "minItems": 1,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "oldString": {
                  "description": "Text to find for a batch find/replace edit",
                  "type": "string"
                },
                "newString": {
                  "description": "Replacement text for a batch find/replace edit",
                  "type": "string"
                },
                "replaceAll": {
                  "description": "Replace every occurrence for this batch item",
                  "type": "boolean"
                },
                "occurrence": {
                  "description": "1-based occurrence for this batch item (1 = first match)",
                  "type": "integer",
                  "minimum": 1
                },
                "startLine": {
                  "description": "1-based start line for a batch line-range edit",
                  "type": "integer",
                  "minimum": 1
                },
                "endLine": {
                  "description": "1-based end line for a batch line-range edit",
                  "type": "integer",
                  "minimum": 1
                },
                "content": {
                  "description": "Replacement text for a batch line-range edit",
                  "type": "string"
                }
              }
            }
          }
        },
        "required": [
          "filePath"
        ],
        "description": "Edit a file by finding and replacing text, or by targeting named symbols. To write or overwrite a whole file, use the `write` tool — `edit` requires an explicit edit mode and will not silently overwrite a file from `content` alone."
      },
      "supports_tool": true,
      "hoisted": true,
      "lane": "mutation",
      "command": "edit"
    },
    "hashline": {
      "arm": "hashline",
      "description": "Apply a hashline patch. Arguments are exactly `{patch}` where `patch` is a non-empty string. Server-owned preview control is outside this schema.\n\nQuick reference:\n- Header: `[path#TAG]`; TAG is exactly four hexadecimal digits from a current tagged read. Read every addressed row and gap boundary; REM and MV require a whole-file tagged read. Re-read after an edit before chaining: an edit-response tag can retain only changed context.\n- Same canonical path: multiple sections compose in patch order against pre-request coordinates.\n- Addresses: `0` (BOF), `N` (one line), `N.=M` (range; `N..=M`/`N..M` also work), `<N`/`>N` (gap before/after), `N*`/`<N*`/`>N*` (block), and `$`/`$-K` (EOF-relative). A plain `N` PUT replaces; use `<N` or `>N` to insert.\n- PUT text: `PUT <address>:` followed by one or more `+` body rows (`+` alone is blank). A final patch newline is allowed. PUT without `:` copies `@name` (or the anonymous register) and takes no body; names use `@` plus ASCII letters, digits, `_`, or `-`.\n- CUT: `CUT <address> [@name]`. REM: bare `REM` only, removing the whole file. MV: `MV <destination>` (one whitespace-free path, optional matching quotes), once and after any line operations. `*** Begin Patch`/`*** End Patch` is an optional envelope.",
      "schema": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "patch": {
            "type": "string",
            "minLength": 1,
            "description": "Hashline patch text with one or more [path#TAG] sections and PUT/CUT/REM/MV operations"
          }
        },
        "required": [
          "patch"
        ],
        "description": "Apply a hashline patch. Arguments are exactly `{patch}` where `patch` is a non-empty string. Server-owned preview control is outside this schema.\n\nQuick reference:\n- Header: `[path#TAG]`; TAG is exactly four hexadecimal digits from a current tagged read. Read every addressed row and gap boundary; REM and MV require a whole-file tagged read. Re-read after an edit before chaining: an edit-response tag can retain only changed context.\n- Same canonical path: multiple sections compose in patch order against pre-request coordinates.\n- Addresses: `0` (BOF), `N` (one line), `N.=M` (range; `N..=M`/`N..M` also work), `<N`/`>N` (gap before/after), `N*`/`<N*`/`>N*` (block), and `$`/`$-K` (EOF-relative). A plain `N` PUT replaces; use `<N` or `>N` to insert.\n- PUT text: `PUT <address>:` followed by one or more `+` body rows (`+` alone is blank). A final patch newline is allowed. PUT without `:` copies `@name` (or the anonymous register) and takes no body; names use `@` plus ASCII letters, digits, `_`, or `-`.\n- CUT: `CUT <address> [@name]`. REM: bare `REM` only, removing the whole file. MV: `MV <destination>` (one whitespace-free path, optional matching quotes), once and after any line operations. `*** Begin Patch`/`*** End Patch` is an optional envelope."
      },
      "supports_tool": true,
      "hoisted": true,
      "lane": "mutation",
      "command": "hashline_edit",
      "preflight_command": "hashline_preflight"
    }
  },
  "invariant": "a session never exposes both edit schemas"
}