chore(ui-tui): apply npm run fix formatting pass
Run ui-tui lint autofix + prettier and commit the resulting formatting-only changes for the parity PR branch.
This commit is contained in:
parent
a4cb3ef66c
commit
487da4b72b
@ -1,9 +1,9 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
|
||||
import { createSlashHandler } from '../app/createSlashHandler.js'
|
||||
import { TUI_SESSION_MODEL_FLAG } from '../domain/slash.js'
|
||||
import { getOverlayState, resetOverlayState } from '../app/overlayStore.js'
|
||||
import { getUiState, patchUiState, resetUiState } from '../app/uiStore.js'
|
||||
import { TUI_SESSION_MODEL_FLAG } from '../domain/slash.js'
|
||||
|
||||
describe('createSlashHandler', () => {
|
||||
beforeEach(() => {
|
||||
@ -55,9 +55,7 @@ describe('createSlashHandler', () => {
|
||||
})
|
||||
|
||||
expect(
|
||||
createSlashHandler(ctx)(
|
||||
`/model anthropic/claude-sonnet-4.6 --provider openrouter ${TUI_SESSION_MODEL_FLAG}`
|
||||
)
|
||||
createSlashHandler(ctx)(`/model anthropic/claude-sonnet-4.6 --provider openrouter ${TUI_SESSION_MODEL_FLAG}`)
|
||||
).toBe(true)
|
||||
expect(ctx.gateway.rpc).toHaveBeenCalledWith('config.set', {
|
||||
key: 'model',
|
||||
|
||||
@ -8,14 +8,7 @@ import { SLASH_COMMANDS } from '../app/slash/registry.js'
|
||||
|
||||
type CommandRoute = 'fallback' | 'local' | 'native'
|
||||
|
||||
const NATIVE_MUTATING_COMMANDS = new Set([
|
||||
'browser',
|
||||
'busy',
|
||||
'fast',
|
||||
'reload-mcp',
|
||||
'rollback',
|
||||
'stop'
|
||||
])
|
||||
const NATIVE_MUTATING_COMMANDS = new Set(['browser', 'busy', 'fast', 'reload-mcp', 'rollback', 'stop'])
|
||||
|
||||
const MUTATING_COMMANDS = [
|
||||
'background',
|
||||
@ -57,12 +50,15 @@ const LOCAL_COMMAND_NAMES = new Set(
|
||||
|
||||
const classifyRoute = (name: string): CommandRoute => {
|
||||
const normalized = name.toLowerCase()
|
||||
|
||||
if (NATIVE_MUTATING_COMMANDS.has(normalized)) {
|
||||
return 'native'
|
||||
}
|
||||
|
||||
if (LOCAL_COMMAND_NAMES.has(normalized)) {
|
||||
return 'local'
|
||||
}
|
||||
|
||||
return 'fallback'
|
||||
}
|
||||
|
||||
|
||||
@ -6,8 +6,8 @@ import type {
|
||||
ConfigGetValueResponse,
|
||||
ConfigSetResponse,
|
||||
SessionSaveResponse,
|
||||
SessionTitleResponse,
|
||||
SessionSteerResponse,
|
||||
SessionTitleResponse,
|
||||
SessionUndoResponse
|
||||
} from '../../../gatewayTypes.js'
|
||||
import { writeOsc52Clipboard } from '../../../lib/osc52.js'
|
||||
|
||||
@ -102,6 +102,7 @@ export const opsCommands: SlashCommand[] = [
|
||||
}
|
||||
|
||||
const payload: Record<string, unknown> = { action }
|
||||
|
||||
if (action === 'connect') {
|
||||
payload.url = rest.join(' ').trim() || 'http://localhost:9222'
|
||||
}
|
||||
@ -115,11 +116,13 @@ export const opsCommands: SlashCommand[] = [
|
||||
r.connected ? `browser connected: ${r.url || '(url unavailable)'}` : 'browser not connected'
|
||||
)
|
||||
}
|
||||
|
||||
if (action === 'connect') {
|
||||
return ctx.transcript.sys(
|
||||
r.connected ? `browser connected: ${r.url || '(url unavailable)'}` : 'browser connect failed'
|
||||
)
|
||||
}
|
||||
|
||||
ctx.transcript.sys('browser disconnected')
|
||||
})
|
||||
)
|
||||
@ -143,10 +146,13 @@ export const opsCommands: SlashCommand[] = [
|
||||
if (!r.enabled) {
|
||||
return ctx.transcript.sys('checkpoints are not enabled')
|
||||
}
|
||||
|
||||
const checkpoints = r.checkpoints ?? []
|
||||
|
||||
if (!checkpoints.length) {
|
||||
return ctx.transcript.sys('no checkpoints found')
|
||||
}
|
||||
|
||||
ctx.transcript.panel('Rollback checkpoints', [
|
||||
{
|
||||
rows: checkpoints.map((c, idx) => [
|
||||
@ -162,17 +168,21 @@ export const opsCommands: SlashCommand[] = [
|
||||
|
||||
if (lower === 'diff') {
|
||||
const hash = rest[0]
|
||||
|
||||
if (!hash) {
|
||||
return ctx.transcript.sys('usage: /rollback diff <checkpoint>')
|
||||
}
|
||||
|
||||
return ctx.gateway
|
||||
.rpc<RollbackDiffResponse>('rollback.diff', { hash, session_id: ctx.sid })
|
||||
.then(
|
||||
ctx.guarded<RollbackDiffResponse>(r => {
|
||||
const body = (r.rendered || r.diff || '').trim()
|
||||
|
||||
if (!body && !r.stat) {
|
||||
return ctx.transcript.sys('no changes since this checkpoint')
|
||||
}
|
||||
|
||||
const text = [r.stat || '', body].filter(Boolean).join('\n\n')
|
||||
ctx.transcript.page(text, 'Rollback diff')
|
||||
})
|
||||
@ -182,6 +192,7 @@ export const opsCommands: SlashCommand[] = [
|
||||
|
||||
const hash = first
|
||||
const filePath = rest.join(' ').trim()
|
||||
|
||||
return ctx.gateway
|
||||
.rpc<RollbackRestoreResponse>('rollback.restore', {
|
||||
...(filePath ? { file_path: filePath } : {}),
|
||||
@ -193,9 +204,11 @@ export const opsCommands: SlashCommand[] = [
|
||||
if (!r.success) {
|
||||
return ctx.transcript.sys(`rollback failed: ${r.error || r.message || 'unknown error'}`)
|
||||
}
|
||||
|
||||
const target = filePath || 'workspace'
|
||||
const detail = r.reason || r.message || r.restored_to || 'restored'
|
||||
ctx.transcript.sys(`rollback restored ${target}: ${detail}`)
|
||||
|
||||
if ((r.history_removed ?? 0) > 0) {
|
||||
ctx.transcript.setHistoryItems(prev => ctx.transcript.trimLastExchange(prev))
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { attachedImageNotice, introMsg, toTranscriptMessages } from '../../../domain/messages.js'
|
||||
import { TUI_SESSION_MODEL_FLAG } from '../../../domain/slash.js'
|
||||
import type {
|
||||
BackgroundStartResponse,
|
||||
ConfigGetValueResponse,
|
||||
@ -10,7 +11,6 @@ import type {
|
||||
VoiceToggleResponse
|
||||
} from '../../../gatewayTypes.js'
|
||||
import { fmtK } from '../../../lib/text.js'
|
||||
import { TUI_SESSION_MODEL_FLAG } from '../../../domain/slash.js'
|
||||
import type { PanelSection } from '../../../types.js'
|
||||
import { patchOverlayState } from '../../overlayStore.js'
|
||||
import { patchUiState } from '../../uiStore.js'
|
||||
@ -27,8 +27,7 @@ const persistedModelArg = (arg: string) => {
|
||||
return !trimmed || GLOBAL_MODEL_FLAG_RE.test(trimmed) ? trimmed : `${trimmed} --global`
|
||||
}
|
||||
|
||||
const stripTuiSessionFlag = (trimmed: string) =>
|
||||
trimmed.replace(TUI_SESSION_STRIP_RE, ' ').replace(/\s+/g, ' ').trim()
|
||||
const stripTuiSessionFlag = (trimmed: string) => trimmed.replace(TUI_SESSION_STRIP_RE, ' ').replace(/\s+/g, ' ').trim()
|
||||
|
||||
const modelValueForConfigSet = (arg: string) => {
|
||||
const trimmed = arg.trim()
|
||||
@ -313,6 +312,7 @@ export const sessionCommands: SlashCommand[] = [
|
||||
run: (arg, ctx) => {
|
||||
const mode = arg.trim().toLowerCase()
|
||||
const valid = new Set(['', 'status', 'normal', 'fast', 'on', 'off', 'toggle'])
|
||||
|
||||
if (!valid.has(mode)) {
|
||||
return ctx.transcript.sys('usage: /fast [normal|fast|status]')
|
||||
}
|
||||
@ -356,6 +356,7 @@ export const sessionCommands: SlashCommand[] = [
|
||||
run: (arg, ctx) => {
|
||||
const mode = arg.trim().toLowerCase()
|
||||
const valid = new Set(['', 'status', 'queue', 'steer', 'interrupt'])
|
||||
|
||||
if (!valid.has(mode)) {
|
||||
return ctx.transcript.sys('usage: /busy [queue|steer|interrupt|status]')
|
||||
}
|
||||
|
||||
@ -112,9 +112,7 @@ export function ModelPicker({ gw, onCancel, onSelect, sessionId, t }: ModelPicke
|
||||
const model = models[modelIdx]
|
||||
|
||||
if (provider && model) {
|
||||
onSelect(
|
||||
`${model} --provider ${provider.slug}${persistGlobal ? ' --global' : ` ${TUI_SESSION_MODEL_FLAG}`}`
|
||||
)
|
||||
onSelect(`${model} --provider ${provider.slug}${persistGlobal ? ' --global' : ` ${TUI_SESSION_MODEL_FLAG}`}`)
|
||||
} else {
|
||||
setStage('provider')
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user