Repository navigation
fix(goal): OpenCode 2.1 native TUI peers with strict 0.5/0.7 clean consumer matrix (#284) #287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b89e6a4
fix(goal): allow native OpenTUI 0.6/0.7 optional peers for OpenCode 2…
ByBrawe d1fbd3a
test(goal): native packed TUI rendering in strict standalone npm cons…
ByBrawe f7f11b0
ci(goal): strict Windows/Linux clean packed TUI install with pinned O…
ByBrawe 2d69894
ci(goal): expand strict native TUI matrix to all four host/OS combina…
ByBrawe f263fdb
test(goal): verify established native TUI plugin id, not npm scope (#…
ByBrawe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| import assert from "node:assert/strict" | ||
| import { testRender } from "@opentui/solid" | ||
| import { createSignal } from "solid-js" | ||
| import plugin from "@bybrawe/opencode-goal/tui" | ||
|
|
||
| // This file runs only after a fresh strict npm installation of the packed | ||
| // candidate into a *different* directory. None of the checkout's dev | ||
| // dependencies should resolve from this consumer location. | ||
| let slot | ||
| let listener | ||
| let unregistered = 0 | ||
| let unsubscribed = 0 | ||
| const requests = [] | ||
| const [selected, select] = createSignal("ses_first") | ||
| const project = (id) => "/remote/project/" + id | ||
|
|
||
| const ctx = { | ||
| client: { rpc: (definition) => { | ||
| assert.equal(definition.id, "opencode-goal-status") | ||
| return { read: async ({ sessionID }, options) => { | ||
| requests.push({ sessionID, location: options.location }) | ||
| return { | ||
| schemaVersion: 1, sessionID, | ||
| directory: options.location.directory, | ||
| text: "OpenCode Goals\nACTIVE " + sessionID, | ||
| } | ||
| } } | ||
| } }, | ||
| theme: { text: { base: "#ffffff" } }, | ||
| data: { | ||
| session: { get: (id) => ({ id, location: { directory: project(id), workspaceID: "w1" } }) }, | ||
| listen: (callback) => { listener = callback; return () => { unsubscribed++ } }, | ||
| }, | ||
| ui: { slot: (contribution) => { | ||
| assert.equal(contribution.append, "sidebar.content") | ||
| slot = contribution | ||
| return () => { unregistered++ } | ||
| } }, | ||
| } | ||
|
|
||
| assert.equal(plugin.id, "opencode-goal", "native TUI plugin identity must match its established public registration") | ||
| const close = await plugin.setup(ctx) | ||
| assert.ok(slot) | ||
| const rendered = await testRender( | ||
| () => slot.render({ get sessionID() { return selected() } }), | ||
| { width: 60, height: 12 }, | ||
| ) | ||
|
|
||
| try { | ||
| await new Promise((r) => setTimeout(r, 120)) | ||
| await rendered.renderOnce() | ||
| assert.match(rendered.captureCharFrame(), /OpenCode Goals/) | ||
| assert.match(rendered.captureCharFrame(), /ACTIVE ses_first/) | ||
| select("ses_second") | ||
| await new Promise((r) => setTimeout(r, 120)) | ||
| await rendered.renderOnce() | ||
| assert.match(rendered.captureCharFrame(), /ACTIVE ses_second/) | ||
| assert.doesNotMatch(rendered.captureCharFrame(), /ACTIVE ses_first/) | ||
| assert.equal(requests.at(-1).location.directory, project("ses_second")) | ||
| assert.equal(requests.at(-1).location.workspaceID, "w1") | ||
|
|
||
| close() | ||
| close() | ||
| const previous = requests.length | ||
| listener({ details: { type: "server.connected" } }) | ||
| await new Promise((r) => setTimeout(r, 135)) | ||
| assert.equal(requests.length, previous, "disposed sidebar must not keep polling") | ||
| assert.equal(unregistered, 1, "slot unregisters exactly once") | ||
| assert.equal(unsubscribed, 1, "listener unsubscribes exactly once") | ||
| console.log("Packed Goal strict npm consumer: OpenTUI visible sidebar, session switch and teardown PASS") | ||
| } finally { | ||
| close() | ||
| rendered.renderer.destroy() | ||
| } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.