fix: harden client detection and Windows auth handling - #1
Merged
Merged
Conversation
- detect host by executable basename (kilo first) to avoid parent-dir false positives - prefer ~/.local/share for auth.json, fall back to the other client's store - atomic state writes with temp-dir fallback when the plugin dir is read-only - install.ps1: -LiteralPath, legacy cleanup, duplicate-plugin warning, UTF-8 BOM - docs: Windows env examples; tests: regression coverage; add .gitattributes
moyu-by
added a commit
that referenced
this pull request
Sep 15, 2026
OpenCode's plugin loader scans every module export and throws
`TypeError("Plugin export is not a function")` for anything that is not a
plugin factory, then swallows the error — so the `_internal` export added in
#1 silently dropped the whole plugin on OpenCode (Kilo only skips such
exports). Move the test-only helpers onto `CommandCode._internal` so index.js
exports nothing but functions.
- detectClient: split on `\` and `/`, so Windows paths are analysed the same
on every platform (the previous test asserted this but failed on Linux)
- use a single writable state dir for reads and writes, so a plugin dir that
later turns read-only can no longer shadow fresh caches in the temp dir;
the temp dir is per-uid and created with mode 0700
- document the intentional cross-client credential fallback in the comment and
README (the old comment claimed the two stores must stay separate)
- install.ps1: match the quoted npm package name exactly (a file:// reference
to this repo was reported as an npm plugin), warn on such references too,
only delete the known legacy plugin file names, fix the kilo.json path
- tests: isolate the credential store from the developer machine, cover the
export shape and the read-only state-dir fallback
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Windows-focused hardening, split from review of the plugin.
Changes
~/.local/shareforauth.json, fall back to the other client's storeinstall.ps1:-LiteralPath, legacy cleanup, duplicate-plugin warning, UTF-8 BOM (PS 5.1 needs it for non-ASCII comments).gitattributesVerification
node --check index.jsnpm test-> 11 passedParser::ParseFile-> 0 errors