Add optional `escapeJson` parameter to `ConfigPaths.substitute` to control
whether file content should be JSON-escaped. When `false`, multiline content
and special characters are preserved as-is, which is required for agent
markdown prompts that need raw file content rather than escaped strings.
Update agent config processing to pass `escapeJson: false` when substituting
file content into markdown prompts, ensuring proper handling of multiline
files without unwanted escape sequences.
Add comprehensive test coverage for the new parameter and existing
substitution functionality.
Enable file content substitution in agent configuration prompts using the
existing `ConfigPaths.substitute` utility. This allows agent markdown files
to reference external file contents via `{file:path}` syntax, with missing
files resolving to empty strings.
Export `substitute` function from ConfigPaths to support agent config
processing.
* fix: catch EEXIST from recursive mkdir on Windows
fs.mkdir with { recursive: true } can still throw EEXIST on Windows
when the target directory is backed by an NTFS reparse point (OneDrive),
a directory junction, or a WSL-served path. libuv's recursive walk
doesn't treat these as regular directories, so mkdir with recursive:true
attempts to create an already-existing path segment and fails.
This adds a defensive EEXIST catch at both directory-creation origins:
- AppFileSystem.ensureDir / writeWithDirs (snapshots, config, plans)
- Encoding.write (all tool writes and edits)
No functional change on Linux/macOS where EEXIST is never thrown from
recursive mkdir.
Fixes#9618, #9755
* fix: remove extra arg from mkdirSafe call, add unit tests
* docs(kilo-docs): update auto-generated source links
Add 2 new GitHub issue references (9618, 9755) from encoding.ts
and update URL count from 84 to 86.
---------
Co-authored-by: nimgrim <nimgrim@users.noreply.github.com>
Co-authored-by: Imanol Maiztegui <imanol.mzd@gmail.com>