Commit Graph

15 Commits

Author SHA1 Message Date
marius-kilocode 72a11b02af resolve merge conflicts 2026-06-10 20:03:42 +02:00
marius-kilocode cf08de3f44 resolve merge conflicts 2026-06-08 12:04:21 +02:00
kiloconnect[bot] 8651bdceac test(cli): assert apply_patch returns non-mojibake diff for non-UTF-8 files
The existing apply_patch encoding test only checked final file bytes,
which were correct because Patch.deriveNewContentsFromChunks does its
own encoding-aware read. The diff and additions/deletions counts
returned to the user (and shown in the permission prompt) were
nonetheless garbled because the surrounding tool reused a hard-coded
UTF-8 decoder. Pin the diff metadata to catch that regression.
2026-05-08 18:00:29 +00:00
Mark IJbema 1ea9ad2af0 resolve merge conflicts 2026-05-06 21:32:26 +02: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
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
Mark IJbema 5d5fab36bb fix(cli): repair broken imports and typecheck after opencode v1.14.29 merge
Fixes 257 typecheck errors surfaced after the upstream merge:

- Update imports to new module paths after upstream PR #24554 removed
  module barrel files (@/config, @/session, @/util, etc.) and PR #24309
  renamed @opencode-ai/shared to @opencode-ai/core.
- Migrate loadMode to use Info.zod.safeParse for consistency with
  loadAgents and ConfigCommand (unblocks KilocodeConfig.handleInvalid).
- Drop removed Npm.outdated mock from tests.
- Add missing Config.defaultLayer to bash-permission-metadata test runtime.
- Fix Tips component signature (kilocode drops upstream's 'connected' prop).
- Fix toast.tsx undefined 'duration' reference (should be toastOptions.duration).
- Move filesystem-containment test from deleted shared package to core.
2026-04-30 17:16:31 +02: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
kiloconnect[bot] fd04901452 Merge remote-tracking branch 'origin/main' into feat/encoding-preservation
# Conflicts:
#	packages/opencode/src/patch/patch.ts
#	packages/opencode/src/tool/edit.ts
#	packages/opencode/src/tool/write.ts
2026-04-23 13:38:19 +00:00
kiloconnect[bot] eb52bda015 fix(cli): prevent double BOM when content starts with U+FEFF
Strip a leading U+FEFF from text before prepending a UTF-8/UTF-16 BOM so
round-tripping content that already carries a BOM character emits exactly
one BOM. Also clarifies the changeset that new files default to UTF-8.
2026-04-23 10:04:01 +00:00
kiloconnect[bot] 8c47af8af4 refactor(cli): reapply encoding changes after main merge
Main moved the Patch namespace out of packages/opencode/src/patch/index.ts
into patch/patch.ts and switched tool imports to the new
@opencode-ai/shared/filesystem and ../../src/tool barrels. Reapply the
encoding-aware read/write changes on top of the refactored patch.ts, and
update the integration test imports to match the new module layout.
2026-04-22 15:59:41 +00:00
kiloconnect[bot] cce5e459bc refactor(cli): self-review — tighten markers, fix detection edge cases
- Encoding.detect: lowercase-compare UTF-32 rejection so jschardet's
  uppercase 'UTF-32'/'UTF-32BE'/'UTF-32LE' labels no longer slip through
  (iconv-lite happens to have utf-32 codecs that would then be accepted).
- Encoding.read: drop redundant Buffer.from wrap around readFile's
  already-Buffer return value.
- EncodedIO: switch to Effect.tryPromise so I/O failures surface as
  typed errors that .pipe(Effect.catch(...)) can recover from; the
  apply_patch delete branch relies on this to translate read errors
  into 'apply_patch verification failed'.
- Shrink kilocode_change blocks in edit.ts, write.ts, apply_patch.ts,
  patch/index.ts, and read.ts to per-line inline markers where each
  block was only wrapping 1-3 changed lines.
- Collapse the 'if (exists) { let contentOld; let encoding; ... }'
  blocks in edit.ts and write.ts into a single ternary + destructure
  that keeps all three lines self-contained and each independently
  annotated.
- Remove the unused 'latin1' sample and fix the 'providEncoded' typo
  in the encoding integration test file.
- Strengthen the apply_patch Shift_JIS test to assert exact bytes
  instead of the weak 'does not contain these two UTF-8 bytes' check.
- Drop the stray .kilo/ and .kilocode/ lockfiles that were re-added
  by an upstream 'wip' commit.
2026-04-21 16:18:47 +00:00
kiloconnect[bot] 5538fc9c32 feat(cli): preserve UTF-8 BOM through read/write round-trip
iconv-lite's utf-8 codec strips any leading BOM on decode and never emits
one on encode, so files that started with EF BB BF would lose their BOM
after an edit. Track UTF-8-with-BOM as a distinct synthetic encoding label
and re-prepend the BOM bytes on write so the round-trip keeps the file
byte-identical (modulo any actual edits).
2026-04-21 13:32:48 +00:00
kiloconnect[bot] fa08250d73 refactor(cli): restore streaming line read and tidy markers
- Restore the streaming createInterface loop in the `lines` helper so the
  diff against main stays small; decode bytes with iconv-lite up front and
  feed the resulting text through Readable.from.
- Drop 'new file' kilocode_change markers from files under kilocode/
  directories (those paths are exempt from the annotation check).
- Tighten the changeset copy to sound like a user-facing release note.
2026-04-21 13:15:30 +00:00
kiloconnect[bot] 526f6807ff test(cli): add integration tests for tool encoding preservation
Exercise Read/Write/Edit/ApplyPatch tools directly against files in
UTF-8, UTF-16 LE/BE (with BOM), Shift_JIS, EUC-JP, GB2312, Big5, EUC-KR,
Windows-1251, and KOI8-R to verify the tools decode input correctly and
round-trip bytes back to the original encoding. Also ensure UTF-16
BOMs survive the write pipeline.
2026-04-21 12:40:56 +00:00