Skip to content

feat: add experimental OpenCode v2 support - #82

Merged
oribarilan merged 4 commits into
mainfrom
feat/opencode-v2-poc
Oct 2, 2026
Merged

oribarilan merged 4 commits into
mainfrom
feat/opencode-v2-poc

Conversation

@oribarilan

@oribarilan oribarilan commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

Summary

Refs #80.

Add experimental OpenCode v2 support without dropping v1 or duplicating the Vim engine.

  • Export both v1 tui(api, options) and v2 setup(context) through the existing ./tui entry. The v2 adapter handles input, commands, storage, forms, permissions and cleanup; the pure Vim engine is unchanged.
  • Keep the renderer-based input hook because public v2 layers cannot capture arbitrary normal-mode or replacement characters. Custom v2 leaders use an explicit experimentalV2Leader option.
  • Normalize visual h/l selection while preserving the native anchor for subsequent word, line and vertical motions, including empty buffers and EOF/EOL boundaries. Re-anchor visual mode when the focused editor changes.
  • Add just dev2 for local development on pinned OpenCode 2.0.15, with isolated .dev2/ settings/history and an optional binary override. just dev remains the v1 route.
  • Add an optional exact-state, installed-package compatibility harness and version-specific installation/options documentation.
  • Address review findings: reject JSON/JSONC project-config ancestors before packaging or launching the harness, test direct and symlinked output paths for both hosts, and forward host-owned selection colors without importing @opentui/core types.

The package remains ./tui-only. No root-export workaround or new package dependency is added. The initial v1 cold-install failure was isolated to a symlink-spelled XDG cache; canonical-cache Git and tarball installations worked.

Validation

Runtime validation was performed at d8050f765b6c2c4e7fdc700d8345c1c5752644cb, whose GitHub CI passed. The 7d791d2 follow-up changes only documentation; local lint and both unit suites passed again. Installed sources and the package manifest are unchanged.

  • just check: lint clean, 337 Bun tests passed.
  • just compat-unit: 16 Python tests passed, including 24 ancestor-config scenarios (six filenames × two host modes × direct/symlinked paths), fresh-observer checks and durable cleanup-failure receipts.
  • git diff --check: passed.
  • Real-host checks on macOS ARM64 tested both tarball and pinned Git installations, with isolated state and byte-for-byte verification of installed source files and the manifest:
Host Install source Cold install Warm install Exact-state checks passed Named known gaps
OpenCode 1.18.33 Tarball Passed Passed 39 2
OpenCode 1.18.33 Git at d8050f7 Passed Passed 39 2
OpenCode 2.0.15 Tarball Passed Passed 48 2
OpenCode 2.0.15 Git at d8050f7 Passed Passed 48 2

The Git runs used vimcode@git+https://github.com/oribarilan/vimcode.git#d8050f765b6c2c4e7fdc700d8345c1c5752644cb. A temporary configure wrapper reused the existing harness, replacing only its install spec. The tarball in each Git receipt was a source/manifest reference, not the installed package.

The host checks cover physical and seeded visual selection, mixed motions, empty-buffer and EOF/EOL handling, Unicode replacement/consumption, custom leader, autocomplete and palette behavior. v2 checks also cover a real editor switch, root/child forms, permission rejection, disable and unload/reload. Tests use synthetic text, with no model requests or permission approvals.

The maintainer also reported successful manual smoke tests through both just dev and just dev2.

Remaining limits

This is experimental compatibility, not a full-parity or all-versions support declaration.

  • v2 input still depends on raw renderer listener ordering and explicit leader mirroring.
  • Inherited tab/wide/combining-character offset issues and snapshot-based redo remain. The harness reports tab-inner-word-offset and snapshot-redo as known gaps, not passes.
  • Native nonhorizontal selection endpoint differences are preserved rather than hidden.
  • OpenCode v2.0.20 and non-macOS runtime behavior have not been validated.
  • A clean-dependency bun run typecheck reports the same eight pre-existing baseline errors; the new unresolved @opentui/core diagnostic was removed.

See docs/opencode-v2-poc.md for launch/test commands and docs/opencode-v2-strategy.md for the evidence and trade-offs. No upstream reports have been posted. This PR does not create a release; the released v0.18.1 tag remains v1-only.

@seth-heinz

Copy link
Copy Markdown

@oribarilan Any idea when you plan to get this merged?

@oribarilan
oribarilan marked this pull request as ready for review October 1, 2026 20:26
@oribarilan

oribarilan commented Oct 2, 2026 •

Copy link
Copy Markdown
Owner Author

@seth-heinz Will be released in in next few days :) just doing some more QA

@oribarilan
oribarilan merged commit 745ffe5 into main Oct 2, 2026
1 check passed
oribarilan added a commit that referenced this pull request Oct 2, 2026
## Summary

Prepare a normal **v0.19.0** release after #82, which is already
squash-merged into `main`.

- Bump `package.json` and `src/version.ts` together to `0.19.0`.
- Move the completed changes into the dated `0.19.0` changelog section
and update comparison links.
- Begin the gradual rollout of OpenCode v2 support as **experimental**.
Future maintenance will move to v2 only; this release still includes v1
compatibility, with no removal date set.
- Recommend **v0.18.1** as the legacy v1 pin. V1 users can opt into
v0.19.0 for shared fixes, or keep the older version and disable update
notifications.
- Replace v2 installation/options/leader examples with the `v0.19.0` Git
tag. Keep the recommended v1 examples pinned to `v0.18.1`.
- Clarify v2 rollback: remove the plugin entry rather than installing
the v1-only v0.18.1 release.

This PR changes release metadata, documentation, and the version
constant only. It does not change the Vim engine or host adapter
behavior from the merged #82 implementation.

## Validation

- `just check`: lint clean, **337 Bun tests passed**.
- `just compat-unit`: **16 Python tests passed**.
- `git diff --check`: passed.
- Version constants, changelog links, v1 legacy pins and v2 release refs
checked for consistency.
- The prepared **vimcode-0.19.0.tgz** was tested through the
installed-package cache on macOS ARM64. Both runs verified source files
and the manifest byte-for-byte:

| Host | Cold install | Warm install | Exact-state checks passed | Named
known gaps |
| --- | --- | --- | ---: | ---: |
| OpenCode 1.18.33 | Passed | Passed | 39 | 2 |
| OpenCode 2.0.15 | Passed | Passed | 48 | 2 |

The remaining probes are `snapshot-redo` and `tab-inner-word-offset`,
both inherited gaps. Tests used isolated HOME/XDG state, a private tmux
socket, synthetic text and clipboard stubs; no model requests or
permission approvals were made.

A clean-dependency typecheck retains the eight baseline errors
documented in #82. No new type diagnostics were introduced by the
version bump.

## Publication gates

This PR does **not** create or publish a release.

After approval and green CI:
1. Squash-merge this release PR.
2. Create and push tag `v0.19.0` on the release commit.
3. Verify the final Git-tag installation on the pinned v1/v2 hosts.
4. Publish a normal GitHub release using the changelog notes.

The `v0.19.0` tag does not exist yet, so its installation examples
become usable only after that gated tag step. Earlier Git-install
validation in #82 used the pinned implementation commit, not this future
tag. The dated changelog heading should match the actual publication
date if release is delayed.

Validation remains bounded to OpenCode 1.18.33/2.0.15 on macOS ARM64;
experimental v2 support is not an all-versions, all-platforms or
full-parity promise.
@oribarilan

Copy link
Copy Markdown
Owner Author

@seth-heinz v0.19.0 is out :) Release notes

v2 support is still experimental. The README has separate install instructions for v1 and v2. thanks for waiting!

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.

2 participants