Skip to content

feat(adaptation): enhance platform detection and cache path handling …#376

Open
mikij wants to merge 2 commits intomksglu:nextfrom
mikij:opencode-update
Open

feat(adaptation): enhance platform detection and cache path handling …#376
mikij wants to merge 2 commits intomksglu:nextfrom
mikij:opencode-update

Conversation

@mikij
Copy link
Copy Markdown
Contributor

@mikij mikij commented Apr 28, 2026

…for OpenCode/KiloCode

What / Why / How

  • I want to add new argument to CLI for upgrade so it will make OpenCode/KiloCode plugin development/testing much easier allowing it to update itself from local git branch. CLI should support local upgrade (context-mode upgrade local) which copies current git branch instead of cloning latest GH published version.
  • Plugin needs to support new cache folder location. OpenCode silently changed (not documented) where is plugin stored inside of .cache folder (before .cache/opencode/node_modules/context-mode, now .cache/opencode/packages/context-mode@latest/node_modules/context-mode), so doctor or upgrade will not properly work for new versions of OpenCode/KiloCode. KiloCode also has a bug that uses OpenCode folder location instead of own. So `context-mode upgrade/doctor' will not work until that is resolved for KiloCode.

This fails in doctor:

■  Hook script exists: FAIL — not found at /Users/mickey/.cache/kilo/packages/context-mode@latest/node_modules/context-mode/hooks/pretooluse.mjs

Addition:

  1. OpenCode now has SessionStart (via experimental.chat.messages.transform) — no longer "not yet available"
  2. Both OpenCode and KiloCode now have high continuity (all 4 hooks working)
  3. The AGENTS.md copy step is now optional rather than required for routing awareness

Affected platforms

  • Claude Code
  • Cursor
  • VS Code Copilot (GitHub Copilot)
  • JetBrains Copilot
  • Gemini CLI
  • Qwen Code
  • OpenCode
  • KiloCode
  • Codex CLI
  • OpenClaw (Pi Agent)
  • Pi
  • Kiro
  • Antigravity
  • Zed
  • All platforms

Test plan

Checklist

  • Tests added/updated (TDD: red → green)
  • npm test passes
  • npm run typecheck passes
  • Docs updated if needed (README, platform-support.md)
  • No Windows path regressions (forward slashes only)
  • Targets next branch (unless hotfix)
Cross-platform notes

Our CI runs on Ubuntu, macOS, and Windows.

  • If touching file paths, verify forward-slash normalization on Windows
  • If touching hook paths, verify no backslash separators
  • Use path.join() / path.resolve(), never hardcode / separators
  • Use event-based stdin reading — readFileSync(0) breaks on Windows
  • Use os.tmpdir(), never hardcode /tmp

@mikij mikij marked this pull request as draft April 28, 2026 13:39
@mikij mikij force-pushed the opencode-update branch 3 times, most recently from ccdd4b3 to 8dbb2c4 Compare April 28, 2026 13:58
@mikij
Copy link
Copy Markdown
Contributor Author

mikij commented Apr 28, 2026

@mksglu this is test run result from main
image

@mikij mikij force-pushed the opencode-update branch 2 times, most recently from 862e570 to 23fdc97 Compare April 28, 2026 16:19
@mikij
Copy link
Copy Markdown
Contributor Author

mikij commented Apr 28, 2026

image from next

@mikij mikij marked this pull request as ready for review April 28, 2026 16:26
@mikij mikij force-pushed the opencode-update branch from 23fdc97 to 81292e7 Compare April 28, 2026 17:36
@mikij mikij force-pushed the opencode-update branch 4 times, most recently from f9a0908 to 5406a20 Compare April 29, 2026 22:37
…jection for OpenCode/KiloCode

Extract tool-naming and routing-block logic into dedicated source modules (src/tool-naming.ts, src/routing-block.ts) and update OpenCode adapter to enable sessionStart and canInjectSessionContext capabilities. Implement experimental.chat.messages.transform hook to automatically inject context window protection routing block into user messages, replacing the previous static hook approach. Update hook files to import from build outputs.
@mikij mikij force-pushed the opencode-update branch from 5406a20 to c1a9ae4 Compare April 29, 2026 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant