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>
\S+ was greedily consuming trailing punctuation (. ! , ;) into the URL
match, causing new URL() to mutate clean ASCII URLs — e.g.
"see https://example.com." became "see https://example.com./".
Fix: strip trailing sentence punctuation before parsing, extract and
replace only the hostname (not href) to avoid adding trailing slashes to
bare origins, and restore the stripped tail afterward.
Move Kilo-specific URL normalization logic out of shared upstream files
and into a mirror file under src/kilocode/, with kilocode_change markers
at each call site per the fork merge minimization convention.
Prevent homograph attacks where visually identical Unicode characters
(e.g. Cyrillic а vs Latin a) could trick users into approving malicious
URLs in bash and webfetch permission prompts.
* fix(tool): clarify semantic_search returns snippets not file paths
The first description bullet read "Find files most relevant to the
search query using semantic search.", which led an AI agent to tell a
user that the tool returns file paths only. The tool actually returns
matching content with file paths, line ranges, and relevance scores.
Updates the first two description bullets to name the output shape
directly. No runtime change.
Closes#9767.
* test(cli): cover semantic_search description
---------
Co-authored-by: marius-kilocode <marius@kilocode.ai>
This flag currently does nothing. Presumably, it was recently added by
OpenCode upstream, but since Kilo already has the `--auto` flag, the
code that would handle `--dangerously-skip-permissions` is wired into
`--auto` instead.
Removing this useless flag avoids confusion for users.