<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>better-edit-tools Documentation on better-edit-tools 文档</title><link>https://conglinyizhi.github.io/better-edit-tools-mcp/en/</link><description>Recent content in better-edit-tools Documentation on better-edit-tools 文档</description><generator>Hugo</generator><language>en</language><atom:link href="https://conglinyizhi.github.io/better-edit-tools-mcp/en/index.xml" rel="self" type="application/rss+xml"/><item><title>CLI Usage</title><link>https://conglinyizhi.github.io/better-edit-tools-mcp/en/cli/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://conglinyizhi.github.io/better-edit-tools-mcp/en/cli/</guid><description>&lt;h1 id="cli-usage"&gt;CLI Usage&lt;a class="anchor" href="#cli-usage"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;In addition to running as an MCP server, better-edit-tools exposes 8 core editing tools as CLI subcommands. This is useful for shell scripts, Pi Agent, or any workflow that prefers command-line invocation.&lt;/p&gt;
&lt;h2 id="basic-usage"&gt;Basic usage&lt;a class="anchor" href="#basic-usage"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;better-edit-tools &amp;lt;command&amp;gt; &lt;span style="color:#f92672"&gt;[&lt;/span&gt;options&lt;span style="color:#f92672"&gt;]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Running without a subcommand starts the MCP server over stdio.&lt;/p&gt;
&lt;h2 id="subcommands"&gt;Subcommands&lt;a class="anchor" href="#subcommands"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id="file-operations"&gt;File operations&lt;a class="anchor" href="#file-operations"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;read&lt;/code&gt;: Read a line range from a file.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;replace&lt;/code&gt;: Replace a line range.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;insert&lt;/code&gt;: Insert content after a line.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;delete&lt;/code&gt;: Delete a line range.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;write&lt;/code&gt;: Write or overwrite a file.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="content-recognition"&gt;Content recognition&lt;a class="anchor" href="#content-recognition"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;balance&lt;/code&gt;: Check pairing of brackets, quotes, and tags.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;func-range&lt;/code&gt;: Detect the function or &lt;code&gt;{}&lt;/code&gt; block range for a line.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tag-range&lt;/code&gt;: Detect the XML/HTML/Vue tag range for a line.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="common-examples"&gt;Common examples&lt;a class="anchor" href="#common-examples"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Read lines 1-10&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;better-edit-tools read --file main.go --start &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; --end &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; --output json
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Replace a range&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;better-edit-tools replace --file main.go --start &lt;span style="color:#ae81ff"&gt;5&lt;/span&gt; --end &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; --content &lt;span style="color:#e6db74"&gt;&amp;#34;...&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Insert after line 4&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;better-edit-tools insert --file main.go --after-line &lt;span style="color:#ae81ff"&gt;4&lt;/span&gt; --content &lt;span style="color:#e6db74"&gt;&amp;#34;...&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Delete a range&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;better-edit-tools delete --file main.go --start &lt;span style="color:#ae81ff"&gt;5&lt;/span&gt; --end &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Write a file&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;better-edit-tools write --file main.go --content &lt;span style="color:#e6db74"&gt;&amp;#34;package main\n&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# Balance / range detection&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;better-edit-tools balance --file main.go
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;better-edit-tools func-range --file main.go --line &lt;span style="color:#ae81ff"&gt;12&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;better-edit-tools tag-range --file index.html --line &lt;span style="color:#ae81ff"&gt;8&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="pipe-and-stdin-support"&gt;Pipe and stdin support&lt;a class="anchor" href="#pipe-and-stdin-support"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To avoid shell quoting issues, some commands support &lt;code&gt;--content-file&lt;/code&gt; and &lt;code&gt;--old-file&lt;/code&gt;. Set the path to &lt;code&gt;-&lt;/code&gt; to read from stdin.&lt;/p&gt;</description></item><item><title>LLM Self-Setup Guide</title><link>https://conglinyizhi.github.io/better-edit-tools-mcp/en/llm-setup-guide/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://conglinyizhi.github.io/better-edit-tools-mcp/en/llm-setup-guide/</guid><description>&lt;h1 id="llm-self-setup-guide"&gt;LLM Self-Setup Guide&lt;a class="anchor" href="#llm-self-setup-guide"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;This guide is written for AI agents (Kimi Code, Claude Code, Cline, etc.) that need to make the &lt;code&gt;better-edit-tools&lt;/code&gt; binary available on the user&amp;rsquo;s machine.&lt;/p&gt;
&lt;h2 id="goal"&gt;Goal&lt;a class="anchor" href="#goal"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Download the correct release binary, verify it, place it in a stable location, and report the absolute path back to the user or to the calling MCP client configuration step.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Do not modify the user&amp;rsquo;s MCP client configuration file unless the user explicitly asks you to.&lt;/strong&gt; Your job is to get the binary installed and verified.&lt;/p&gt;</description></item><item><title>Go API Reference</title><link>https://conglinyizhi.github.io/better-edit-tools-mcp/en/go-api/readme/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://conglinyizhi.github.io/better-edit-tools-mcp/en/go-api/readme/</guid><description>&lt;h1 id="betools--go-api-reference"&gt;betools — Go API Reference&lt;a class="anchor" href="#betools--go-api-reference"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;h2 id="package"&gt;Package&lt;a class="anchor" href="#package"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;import &amp;#34;github.com/conglinyizhi/better-edit-tools-mcp/pkg/betools&amp;#34;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;code&gt;betools&lt;/code&gt; is the core editing library extracted from better-edit-tools, designed to be embedded directly in Go agent frameworks. It provides read, replace, insert, delete, write, function-range detection, and tag-range detection primitives — all write operations are protected by atomic file writes (temp file + rename).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Minimum Go version&lt;/strong&gt;: Go 1.26+&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="public-functions"&gt;Public Functions&lt;a class="anchor" href="#public-functions"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id="file-operations"&gt;File Operations&lt;a class="anchor" href="#file-operations"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;h4 id="read"&gt;&lt;code&gt;Read&lt;/code&gt;&lt;a class="anchor" href="#read"&gt;#&lt;/a&gt;&lt;/h4&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;func&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;Read&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;path&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;string&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;start&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;int&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;endLine&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;int&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;brief&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;bool&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;opts&lt;/span&gt; &lt;span style="color:#f92672"&gt;...&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;Option&lt;/span&gt;) (&lt;span style="color:#a6e22e"&gt;ShowResult&lt;/span&gt;, &lt;span style="color:#66d9ef"&gt;string&lt;/span&gt;, &lt;span style="color:#66d9ef"&gt;error&lt;/span&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Reads a line range from a file. Returns the content and a &lt;code&gt;viewed_code_id&lt;/code&gt; (second return value) that can be passed to &lt;code&gt;Replace&lt;/code&gt; for line-number validation.&lt;/p&gt;</description></item><item><title/><link>https://conglinyizhi.github.io/better-edit-tools-mcp/en/decisions/chip-design/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://conglinyizhi.github.io/better-edit-tools-mcp/en/decisions/chip-design/</guid><description>&lt;h1 id="chip-mechanism-design-decisions"&gt;Chip Mechanism Design Decisions&lt;a class="anchor" href="#chip-mechanism-design-decisions"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;h2 id="1-motivation"&gt;1. Motivation&lt;a class="anchor" href="#1-motivation"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In the MCP (Model Context Protocol) call chain, tool parameters generated by LLMs often fail due to JSON escaping issues, missing fields, or malformed formatting. Once a failure occurs, the original parameter content may only appear in a one-off error response, making it difficult for the model to reproduce the exact same content in subsequent rounds — especially for large code writes (&lt;code&gt;be-write&lt;/code&gt;) or multi-line replacements.&lt;/p&gt;</description></item></channel></rss>