Skip to content

Releases

StrEditor v1.10.5

Choose a tag to compare

@delphiprofi delphiprofi released this 12 May 17:53

StrEditor v1.10.5

Bug Fixes

UTF-8 input on MCP stdin (Mojibake in CP1252 files)

When an MCP client sent JSON tool arguments containing raw UTF-8 multibyte sequences (e.g. the two bytes c3 a4 for ä), the server interpreted the incoming bytes through the system ANSI code page (CP1252 on German Windows) instead of UTF-8. This corrupted Non-ASCII characters before they ever reached the JSON parser and resulted in Mojibake being written to CP1252 source files (e.g. ä instead of ä).

Root cause: ReadRequest read stdin via Delphi's TextFile-style ReadLn(Input,…) / Read(Input,…). That path implicitly converts incoming bytes using DefaultSystemCodePage. JSON-RPC over MCP stdio is UTF-8 by spec, so this is wrong whenever the client serializes Non-ASCII as raw UTF-8 (instead of \uXXXX escapes, which is also legal JSON and was the historical default).

Why it stayed latent: Older MCP clients (Anthropic SDK defaults, several ensure_ascii=true-style serializers) escape Non-ASCII as ä — pure ASCII on the wire, which decodes identically under any single-byte code page. The bug only triggers for clients that send raw UTF-8 in JSON strings. Newer clients (including the Codex-style hosts that v1.10.4 was made compatible with) do this.

Fix: ReadRequest now reads stdin as raw bytes from STD_INPUT_HANDLE (via two new helpers ReadLineBytesFromHandle / ReadExactBytesFromHandle) and converts them to a Delphi string via TEncoding.UTF8.GetString. This is symmetric to the existing write side in SendResponse, which already used TEncoding.UTF8.GetBytes. Both ASCII-escape and raw-UTF-8 client behaviors now produce the correct codepoint.

End-to-end effect: rohe UTF-8-Bytes c3 a4 im Tool-Argument → korrekter Codepoint U+00E4 nach Parse → genau ein Byte $E4 in einer CP1252-Datei (statt zwei Mojibake-Bytes).

Tests

  • New test fixture TTestMCPDecoding in Tests\TestStrEditor.MCP.pas with 5 cases:
    • Empty input
    • Pure ASCII pass-through
    • ASCII-escaped umlaut ä (regression guard for the historically-working path)
    • Raw UTF-8 umlaut → must yield single codepoint U+00E4
    • Raw UTF-8 umlaut → end-to-end roundtrip to single CP1252 byte $E4
  • 196/196 tests pass on the fix; the two raw-UTF-8 tests fail on the pre-fix code, confirming the bug repros and the fix lands exactly the missing decode step.

New Files

  • Tests\TestStrEditor.MCP.pas — MCP decoder regression tests
  • build_tests.bat — convenience wrapper to build Tests\Unittests.dproj

Changed Files

  • StrEditor.MCP.pas
    • new public class function DecodeIncomingBytes(TBytes) : string (UTF-8)
    • new private helpers ReadLineBytesFromHandle / ReadExactBytesFromHandle
    • ReadRequest reworked to read raw bytes from STD_INPUT_HANDLE instead of Input
  • StrEditor.Version.pas — bumped to 1.10.5

Downloads

  • StrEditor-v1.10.5-Windows-x86.zip — Windows 32-bit executable with documentation

StrEditor v1.10.4

Choose a tag to compare

@delphiprofi delphiprofi released this 03 Mar 17:28

StrEditor v1.10.4

Bug Fixes

OpenAI Codex MCP compatibility

Codex sends MCP startup messages differently than Claude/Augment. This release fixes compatibility:

  • JSON-RPC batch requests: ReadRequest now accepts both single JSON-RPC objects and JSON-RPC batch arrays. Queued batch elements are processed one-by-one in the main loop. Prevents Ungültige Typumwandlung / transport-close on hosts that send batched startup messages.
  • Initialized notification: Accepts both initialized and notifications/initialized.
  • Version consistency: initialize.result.serverInfo.version now uses shared cStrEditorVersion.

Documentation update

  • Added bilingual MCP quick starts: English and German
  • Clarified the difference between Claude Desktop (chat app) and Claude Code / Claude Desktop Code tab
  • Added a small release checklist and updated packaging so the release ZIP now includes the new MCP docs consistently

Downloads

  • StrEditor-v1.10.4-Windows-x86.zip - Windows 32-bit executable with documentation

v1.10.0 - Native MCP Server

Choose a tag to compare

@delphiprofi delphiprofi released this 02 Mar 18:53

Native MCP Server (JSON-RPC 2.0 over stdio)

New Features

  • MCP Server Mode (--mcp flag): Starts as TSR process, handles requests via stdin/stdout
  • 14 MCP Tools: str_replace, edit_file, show_file, detect_encoding, regex_replace, regex_test, move_lines, indent_lines, unindent_lines, convert_encoding, repair_umlauts, file_compare, undo, restart_server
  • Zero dependencies: Single native Windows EXE - no Node.js, no Python
  • No Base64 needed: Strings passed directly via JSON-RPC (no PowerShell escaping issues)
  • Workspace-relative paths: Automatically resolved from MCP initialize params
  • restart_server tool: Allows updating the EXE without restarting the host

Installation

See MCP-SERVER.md for setup instructions for Augment, Claude Desktop, and Codex CLI.

Legacy CLI

All existing command-line features continue to work as before.

StrEditor v1.9.3

Choose a tag to compare

@delphiprofi delphiprofi released this 27 Feb 19:06

StrEditor v1.9.3

Bug Fixes

WriteFileWithRetry - Retry-Mechanismus war komplett wirkungslos

The retry mechanism for file writes has been completely broken since v1.9.1 when it was introduced.
Two root causes were identified and fixed:

  1. WriteFile swallowed all exceptions - The internal try/except caught every exception and just returned false,
    so no exception ever reached WriteFileWithRetry.
  2. WriteFileWithRetry had an unconditional Exit - After calling WriteFile, an unconditional Exit was placed
    regardless of the return value. This meant the retry loop was never reached even when WriteFile returned false.

Fix: WriteFile now propagates exceptions (try/except → try/finally).
WriteFileWithRetry now only exits early on success (if Result then Exit).

Practical impact: When a file is transiently locked (Windows Indexer, Antivirus, etc.),
StrEditor now correctly retries 3 times with 100ms delay.

replace-line with multi-line text caused file corruption (Workaround)

Using replace-line with a text-lines array caused CRLF sequences to be embedded in a single
TStringList entry. When written to disk, this produced more lines than expected, causing all subsequent
operations to work on wrong line numbers.

Fix: The text is automatically split into multiple lines with a stderr warning:
please use replace-lines with start-line/end-line/text-lines

New Features

JSON Alias "line" for "insert-after-line"

The JSON config now accepts "line" as an alias for "insert-after-line" (Postel's Law).
A warning is emitted to stderr to encourage correct usage.

Downloads

  • StrEditor-v1.9.3-Windows-x86.zip - Windows 32-bit executable with documentation

StrEditor v1.9.1

Choose a tag to compare

@delphiprofi delphiprofi released this 26 Feb 15:28

StrEditor v1.9.1

Bug Fixes

Retry-Mechanismus für File-Access-Errors

Problem: E/A-Fehler 232 ("The pipe is being closed") trat häufig auf, wenn Augment mehrere StrEditor-Instanzen parallel aufrief. Dies führte zu Race-Conditions und Handle-Leaks.

Lösung:

  • Neue Funktionen ReadFileWithRetry() und WriteFileWithRetry() in StrEditor.Encoding.pas
  • 3 Versuche mit 100ms Delay bei File-Access-Errors
  • Exception-Handling für:
    • EInOutError (E/A-Fehler 232)
    • EFOpenError (Datei kann nicht geöffnet werden)
    • EFCreateError (Datei kann nicht erstellt werden)
  • Alle 26 File-Access-Aufrufe in StrEditor.Operations.pas verwenden jetzt Retry-Mechanismus
  • Detaillierte Fehlermeldungen mit Dateiname und "after 3 retries" Info auf stderr

Basierend auf: Log-Analyse vom 2026-02-26 - E/A-Fehler 232 war häufigster Fehler (24x) seit 2026-02-12

Technical Details

  • Modified Files:

    • StrEditor.Encoding.pas - Retry-Funktionen hinzugefügt
    • StrEditor.Operations.pas - Alle File-Access-Aufrufe auf Retry umgestellt
    • StrEditor.CommandLine.pas - Version auf 1.9.1 erhöht
    • CHANGELOG.md - Version 1.9.1 dokumentiert
  • Build Info:

    • Compiler: Embarcadero Delphi for Win32 version 37.0
    • Lines: 9520
    • Build Time: 0.19 seconds
    • Code Size: 1737572 bytes

Downloads

  • StrEditor-v1.9.1-Windows-x86.zip - Windows 32-bit executable with documentation

Previous Version

For changes in v1.9.0, see CHANGELOG.md

StrEditor v1.8.6 - Range Parameter & Deprecation Warning

Choose a tag to compare

@delphiprofi delphiprofi released this 05 Feb 15:18

StrEditor v1.8.6 - Range Parameter & Deprecation Warning

🆕 New Features

--range Parameter for --show

Show specific line ranges with the new --range <start>,<end> parameter:

# Show lines 10-20 with line numbers
StrEditor.exe --file "test.pas" --show --range 10,20 --line-numbers

# Show lines 1-5
StrEditor.exe --file "README.md" --show --range 1,5

# Combine with other options
StrEditor.exe --file "test.pas" --show --range 50,100 --verbose

Features:

  • ✅ Validates format (must be <start>,<end>)
  • ✅ Validates values (both must be > 0, end >= start)
  • ✅ Works with all other --show options (--line-numbers, --verbose, etc.)
  • ✅ Clear error messages for invalid input

⚠️ Deprecation Warning

--keep-config Parameter

The --keep-config parameter now shows a prominent deprecation warning when used:

╔════════════════════════════════════════════════════════════════════════════╗
║ WARNING: --keep-config is DEPRECATED and makes NO SENSE!                  ║
║                                                                            ║
║ JSON config files are TEMPORARY operation instructions, not data files!   ║
║ They should be auto-deleted after successful execution.                   ║
║                                                                            ║
║ This parameter will be REMOVED in a future version.                       ║
╚════════════════════════════════════════════════════════════════════════════╝

Reason: JSON config files are temporary operation instructions and should be auto-deleted after successful execution. Keeping them makes no sense and leads to confusion.


📦 Installation

Download

Download StrEditor-v1.8.6-Windows-x86.zip from this release.

Contents

  • StrEditor.exe - Main executable
  • README.md - English documentation
  • CHANGELOG.md - Full changelog
  • LICENSE.md - MIT License
  • StrEditor.ini - Configuration file
  • DOC/ - Additional documentation

Quick Start

# Extract StrEditor.exe to a directory in your PATH (e.g., C:\Delphi XE16\bin)

# Replace a string in a Delphi file
StrEditor.exe --file "MyUnit.pas" --old-str "TObject" --new-str "TInterfacedObject"

# Show file with line numbers
StrEditor.exe --file "MyUnit.pas" --show --line-numbers

# Show specific range
StrEditor.exe --file "MyUnit.pas" --show --range 10,20 --line-numbers

📝 Full Changelog

Added

  • --range Parameter for --show: Show specific line ranges with --range <start>,<end>
    • Example: StrEditor.exe --file "test.pas" --show --range 10,20 --line-numbers
    • Validates format (must be <start>,<end>)
    • Validates values (both must be > 0, end >= start)
    • Works with all other --show options (--line-numbers, --verbose, etc.)

Changed

  • Deprecation Warning for --keep-config: Parameter now shows prominent warning
    • Displays warning box on stderr when --keep-config is used
    • Explains that JSON config files are temporary operation instructions
    • Warns that parameter will be removed in future version
    • Reason: JSON configs should be auto-deleted after successful execution

Documentation

  • Updated README.md and README.de.md with new features
  • Distributed updated str-replace-editor.md to 12 project locations

🔗 Links


📊 Previous Versions

  • v1.8.5: Bug Fix: --dry-run with JSON config, Command-line flag priority
  • v1.8.4: ChangeReport, ContextLines, SessionLog, INI-Config
  • v1.8.3: Auto-Delete JSON Config, --keep-config
  • v1.8.2: Indent/Unindent Lines
  • v1.8.1: Hex-Dump, Base64, Original Line Numbers
  • v1.8.0: text-lines Array, replace-lines Command

Build Date: 2026-02-05
License: MIT License

StrEditor v1.8.5 - Bug Fix Release

Choose a tag to compare

@delphiprofi delphiprofi released this 01 Feb 19:02

StrEditor v1.8.5 - Bug Fix Release

Fixed

  • --dry-run Bug with JSON Config: The --dry-run parameter now works correctly when used with --config
    • Previously, --dry-run was ignored when loading JSON config files
    • Root cause: LoadFromJSON was overwriting command-line flags with JSON defaults
    • Fix: Command-line flags are now preserved and have priority over JSON defaults
    • Affected flags: --dry-run, --backup, --verbose, --diff, --stats

Technical Details

  • Modified StrEditor.Config.pas: Added command-line flag preservation in LoadFromJSON
  • Modified StrEditor.dpr: Added flag transfer for multiple operations configs

Tests

  • 191 total tests passing

Download

  • StrEditor-v1.8.5-Windows-x86.zip - Windows 32-bit executable with documentation

StrEditor v1.8.4

Choose a tag to compare

@delphiprofi delphiprofi released this 30 Jan 16:32

StrEditor v1.8.4

New Features

ChangeReport - Shows What Was Changed

After each operation, StrEditor now displays what was changed with context lines:

DELETE line 7:        
       5: procedure Test1;       <- Context before
       6: procedure Test2;       <- Context before  
  -    7: procedure Test3;       <- Deleted line
       8: procedure Test4;       <- Context after
       9: procedure Test5;       <- Context after

SessionLog - Logs All Operations

For analyzing AI agent misuse patterns:

  • Logs VIEW requests, JSON configs, errors, and successes
  • Base64-encoded to avoid CRLF issues
  • Format: Timestamp|Type|Base64-Data

Example log entries:

2026-01-30 17:14:55|VIEW|QzpcVGVtcFxTZXNzaW9uTG9nVGVzdC5wYXN8MS01
2026-01-30 17:15:08|CONFIG|eyJvcGVyYXRpb25zIjogWy4uLl19
2026-01-30 17:15:08|ERROR|U3RyaW5nIG5vdCBmb3VuZA==

INI-Config - Configuration via StrEditor.ini

New configuration file StrEditor.ini (placed next to StrEditor.exe):

[ChangeReport]
Enabled=true
ShowContent=true
ContextLinesBefore=2
ContextLinesAfter=2

[SessionLog]
Enabled=true
LogPath=StrEditor.log

Bug Fixes

TIniFile.ReadBool Bug

Delphi's TIniFile.ReadBool only accepts 0 or 1, not true or false strings.
Implemented ReadIniBool() helper function that accepts both formats.

Important Notes

⚠️ INI File Encoding: The INI file must be created without UTF-8 BOM!
Delphi's TIniFile cannot correctly read UTF-8 BOM files. Use ANSI/Windows-1252 or UTF-8 without BOM.

New Files

  • StrEditor.ChangeReport.pas - Change reporting functionality
  • StrEditor.SessionLog.pas - Session logging with Base64 encoding
  • StrEditor.Settings.pas - INI configuration singleton
  • Tests/TestStrEditor.ChangeReport.pas - Unit tests for ChangeReport

Tests

  • 8 new unit tests for ChangeReport feature
  • 191 total tests passing

Downloads

  • StrEditor-v1.8.4-Windows-x86.zip - Windows 32-bit executable with documentation

v1.8.3 - Auto-Delete JSON Config

Choose a tag to compare

@delphiprofi delphiprofi released this 29 Jan 10:32

BREAKING CHANGE

  • JSON config files are now automatically deleted on success
  • Use --keep-config to preserve the config file
  • Removed --delete-config-on-success (now default behavior)

Why this change?

AI agents often forgot to use --delete-config-on-success, leading to JSON files cluttering the workspace. The clean way should be the DEFAULT!

New Features

  • AGENT-RULES-STREDITOR.md: Strict rules file for AI agents
    • Prohibits sequential operations on same file
    • Requires JSON-Config for multiple operations
    • Requires text-lines array for multi-line text (no Base64)
    • Copy-paste templates for common operations
  • Critical warning section at top of str-replace-editor.md

Tests

  • 183 total tests passing (+1 new test for --keep-config)

Migration

Before (v1.7.6 - v1.8.2) After (v1.8.3)
--config ops.json --delete-config-on-success --config ops.json
--config ops.json (keeps file) --config ops.json --keep-config

StrEditor v1.8.2

Choose a tag to compare

@delphiprofi delphiprofi released this 26 Jan 17:23

StrEditor v1.8.2

New Features

Indent Lines (--indent-lines)

Add spaces at the beginning of lines in a specified range.

StrEditor.exe --indent-lines --file "test.pas" --start-line 4 --end-line 8 --spaces 2

Parameters:

  • --file: Target file
  • --start-line: First line to indent (1-based)
  • --end-line: Last line to indent (1-based)
  • --spaces: Number of spaces to add (default: 2)
  • --backup, --dry-run, --diff, --verbose: Standard options

JSON Config:

{
  "command": "indent",
  "file": "test.pas",
  "start-line": 4,
  "end-line": 8,
  "spaces": 2
}

Unindent Lines (--unindent-lines)

Remove spaces from the beginning of lines in a specified range.

StrEditor.exe --unindent-lines --file "test.pas" --start-line 4 --end-line 8 --spaces 2

Features:

  • Partial unindent: If a line has fewer spaces than requested, only available spaces are removed
  • Empty lines are handled gracefully

Bug Fixes

  • Build-StrEditor-Release.bat: Fixed documentation (Release config builds directly to C:\Delphi XE16\bin\)

Tests

  • 13 new unit tests for indent/unindent features
  • 182 total tests passing

Downloads

  • StrEditor-v1.8.2-Windows-x86.zip - Windows 32-bit executable with documentation