Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ jobs:
- name: Test
run: bun test

- name: TUI browser runtime tests
run: bun run test:tui

- name: Build
run: bun run build

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"lint": "bunx biome lint src/",
"typecheck": "tsc --noEmit",
"test": "bun test",
"test:tui": "bun --conditions=browser test test/tui.test.ts",
"eval:smoke": "bun eval/smoke.ts",
"build": "bun build src/index.ts --outdir dist --target node",
"prepublishOnly": "bun run typecheck && bun test && bun run build"
Expand All @@ -61,4 +62,4 @@
"@opencode-ai/sdk": "^1.17.18",
"@opencode/plugin": "2.0.3"
}
}
}
26 changes: 26 additions & 0 deletions src/tui-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,32 @@ export interface SidebarSummary {
lines: string[]
}

/** Mouse-up events that should activate a dashboard link. */
export interface LinkActivationEvent {
button: number
isDragging?: boolean
}

/**
* Accept only an un-dragged primary-button release as a link activation.
*/
export function isPrimaryLinkActivation(event: LinkActivationEvent): boolean {
return event.button === 0 && event.isDragging !== true
}

/** Cross-version layout measurement surface for OpenTUI renderables. */
export interface LayoutMeasureNode {
getLayout?: () => { width: number }
getLayoutNode?: () => { getComputedWidth: () => number }
}

/** Read a renderable width across OpenTUI versions. */
export function getLayoutWidth(node: LayoutMeasureNode | undefined): number | undefined {
const layoutWidth = node?.getLayout?.().width
if (layoutWidth && layoutWidth > 0) return layoutWidth
return node?.getLayoutNode?.().getComputedWidth()
}

/** Glyph per member status (paired with text elsewhere — never color-only). */
function glyph(status: string): string {
switch (status) {
Expand Down
Loading