refactor(tui): rename link concept to pair

This commit is contained in:
Dax Raad 2026-07-09 13:05:20 -04:00
parent 85fdb3bde6
commit 6fb526741b
5 changed files with 16 additions and 16 deletions

View file

@ -209,7 +209,7 @@ export const Commands = Spec.make(typeof OPENCODE_CLI_NAME === "string" ? OPENCO
}),
],
}),
Spec.make("link", { description: "Show server connection information" }),
Spec.make("pair", { description: "Show server pairing information" }),
Spec.make("serve", {
description: "Start the v2 API server",
params: {

View file

@ -8,8 +8,8 @@ import { Runtime } from "../../framework/runtime"
import { ServiceConfig } from "../../services/service-config"
export default Runtime.handler(
Commands.commands.link,
Effect.fn("cli.link")(function* () {
Commands.commands.pair,
Effect.fn("cli.pair")(function* () {
const endpoint = yield* Service.start(yield* ServiceConfig.options())
const password = yield* ServiceConfig.password()
const server = yield* Effect.tryPromise(() =>
@ -24,7 +24,7 @@ export default Runtime.handler(
` Username ${info.username}`,
` Password ${info.password}`,
"",
" Scan to connect",
" Scan to pair",
"",
renderUnicodeCompact(JSON.stringify(info), { border: 2 })
.split(EOL)

View file

@ -36,7 +36,7 @@ const Handlers = Runtime.handlers(Commands, {
migrate: () => import("./commands/handlers/migrate"),
mini: () => import("./commands/handlers/mini"),
run: () => import("./commands/handlers/run"),
link: () => import("./commands/handlers/link"),
pair: () => import("./commands/handlers/pair"),
service: {
start: () => import("./commands/handlers/service/start"),
restart: () => import("./commands/handlers/service/restart"),

View file

@ -47,7 +47,7 @@ import { useConnected } from "./component/use-connected"
import { DialogMcp } from "./component/dialog-mcp"
import { DialogStatus } from "./component/dialog-status"
import { DialogDebug } from "./component/dialog-debug"
import { DialogLink, type DialogLinkCredentials } from "./component/dialog-link"
import { DialogPair, type DialogPairCredentials } from "./component/dialog-pair"
import { createOpencodeClient } from "@opencode-ai/sdk/v2/client"
import { DialogThemeList } from "./component/dialog-theme-list"
import { DialogHelp } from "./ui/dialog-help"
@ -123,7 +123,7 @@ const appBindingCommands = [
"provider.connect",
"console.org.switch",
"opencode.status",
"server.link",
"server.pair",
"opencode.debug",
"theme.switch",
"theme.switch_mode",
@ -358,7 +358,7 @@ export const run = Effect.fn("Tui.run")(function* (input: TuiInput) {
<App
onSnapshot={input.onSnapshot}
pluginHost={input.pluginHost}
link={
pair={
input.server.endpoint.auth
? input.server.endpoint.auth
: {
@ -414,7 +414,7 @@ export const run = Effect.fn("Tui.run")(function* (input: TuiInput) {
function App(props: {
onSnapshot?: () => Promise<string[]>
pluginHost: TuiPluginHost
link?: DialogLinkCredentials
pair?: DialogPairCredentials
}) {
const log = useLog({ component: "app" })
const startup = useTuiStartup()
@ -849,11 +849,11 @@ function App(props: {
category: "System",
},
{
name: "server.link",
title: "Show server info",
slashName: "link",
name: "server.pair",
title: "Pair device",
slashName: "pair",
run: () => {
dialog.replace(() => <DialogLink credentials={props.link} />)
dialog.replace(() => <DialogPair credentials={props.pair} />)
},
category: "System",
},

View file

@ -7,12 +7,12 @@ import { useTheme } from "../context/theme"
import { useDialog } from "../ui/dialog"
import { errorMessage } from "../util/error"
export type DialogLinkCredentials = {
export type DialogPairCredentials = {
readonly username: string
readonly password: string
}
export function DialogLink(props: { credentials?: DialogLinkCredentials }) {
export function DialogPair(props: { credentials?: DialogPairCredentials }) {
const sdk = useSDK()
const dialog = useDialog()
const dimensions = useTerminalDimensions()
@ -97,7 +97,7 @@ export function DialogLink(props: { credentials?: DialogLinkCredentials }) {
<box paddingLeft={2} paddingRight={2} paddingBottom={1} gap={1}>
<box flexDirection="row" justifyContent="space-between">
<text fg={theme.text} attributes={TextAttributes.BOLD}>
Link
Pair
</text>
<text fg={theme.textMuted} onMouseUp={() => dialog.clear()}>
esc