Commit Graph

11 Commits

Author SHA1 Message Date
Catriel Müller 2aa1b95074 refactor: resolve comments 2026-05-18 11:45:36 -03:00
nimgrim af902eb359 fix: catch EEXIST from recursive mkdir on Windows (#9794)
* 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>
2026-05-12 13:17:49 +00:00
kiloconnect[bot] 1a3a53f881 Merge remote-tracking branch 'origin/main' into fix/encoding-flat-exports
# Conflicts:
#	packages/opencode/src/kilocode/encoding.ts
2026-05-06 07:01:29 +00:00
kiloconnect[bot] b7172b40f7 refactor(cli): drop normalize entries for labels chardet never emits
jschardet produced labels like "ascii", "gb2312", "MacCyrillic", "IBM855/866",
and "TIS-620". chardet's supported encoding set does not include any of
these (ASCII folds into UTF-8; Chinese is emitted as GB18030), so the
mappings were dead code.
2026-05-05 15:33:20 +00:00
kiloconnect[bot] cedf008ff3 test(cli): document why chardet's short-sample weakness is acceptable 2026-05-05 14:48:57 +00:00
kiloconnect[bot] c662ada566 test(cli): pad Shift_JIS sample so chardet can identify it
chardet is less aggressive than jschardet on short CJK samples; a
12-byte Shift_JIS phrase now collides with the windows-1252 profile.
Reuse the longer Shift_JIS sample the rest of the suite relies on.
2026-05-05 14:43:43 +00:00
kiloconnect[bot] 869088b882 chore(cli): replace jschardet with chardet
Swap jschardet for the actively-maintained chardet library for text
encoding detection. chardet ships with TypeScript definitions, so the
local jschardet module shim is no longer needed.
2026-05-05 14:39:38 +00:00
kiloconnect[bot] 4528aa5cf0 refactor(cli): flatten Encoding/EncodedIO namespaces to module exports
Replace `export namespace Encoding`/`EncodedIO` wrappers with top-level
exports and switch consumers to `import * as Encoding`/`EncodedIO`.
The module itself acts as the namespace, avoiding the TS-namespace
wrapper that tree-shakers and some module resolvers handle awkwardly.
2026-05-05 14:12:51 +00:00
kilo-agent 988d080f96 remove redundant wide-UTF BOM gate from detect()
Users that hand us BOM-less UTF-16/32 are violating the documented
contract; trust jschardet + iconv.encodingExists and let the result
be whatever it is.
2026-05-05 13:06:57 +00:00
kilo-agent 9ffd047962 feat(cli): support UTF-32 with BOM for file encoding detection
UTF-16 and UTF-32 without a BOM remain unsupported (ambiguous).

Aligns with upstream opencode PR chrarnoldus/opencode#1.
2026-05-05 13:02:21 +00:00
kiloconnect[bot] bde1a4ae88 test(cli): expand encoding preservation coverage
Add unit tests for the Encoding namespace and extend the tool integration
suite with ApplyPatch delete and EditTool replaceAll paths for non-UTF-8
files.
2026-04-23 14:49:05 +00:00