Compare commits

...

2 Commits

Author SHA1 Message Date
James Long e19e6fb6a3 fix(tui): show external worktree session labels 2026-08-07 21:21:59 +00:00
opencode-agent[bot] 0b84e24e65 fix(tui): standardize compact terminology (#41141) 2026-08-07 16:26:14 -04:00
7 changed files with 18 additions and 8 deletions
@@ -141,7 +141,12 @@ export function DialogSessionList() {
const option = (session: SessionInfo, category: string) => {
const directory = session.location.directory
const project = data.project.get(session.projectID)
const footer = allProjects() ? Locale.truncate(projectName(project, directory) ?? "", 20) : undefined
const relative = path.relative(data.location.info()?.project.directory ?? directory, directory)
const footer = allProjects()
? Locale.truncate(projectName(project, directory) ?? "", 20)
: relative.startsWith("..") || path.isAbsolute(relative)
? Locale.truncate(path.basename(directory), 20)
: undefined
const slot = sessionTabs.enabled() ? undefined : slotByID.get(session.id)
const deleting = toDelete() === session.id
return {
+1 -1
View File
@@ -407,7 +407,7 @@ export function RunCommandMenuBody(props: {
name: "compact",
display: "Compact session",
footer: "/compact",
keywords: "compact summarize session context",
keywords: "compact session context",
},
{
action: "slash",
+1 -1
View File
@@ -406,7 +406,7 @@ export function createPromptState(input: PromptInput): PromptState {
kind: "slash",
name: "compact",
display: "/compact",
description: "summarize the session to reduce context usage",
description: "compact older session context to free space",
} satisfies SlashOption,
{ kind: "slash", name: "exit", display: "/exit", description: "close OpenCode" } satisfies SlashOption,
]
+1 -2
View File
@@ -54,8 +54,7 @@ export function isNewCommand(input: string): boolean {
}
export function isCompactCommand(input: string): boolean {
const text = input.trim().toLowerCase()
return text === "/compact" || text === "/summarize"
return input.trim().toLowerCase() === "/compact"
}
export function createPromptHistory(items?: RunPrompt[]): PromptHistoryState {
@@ -635,7 +635,6 @@ export function Session() {
group: "Session",
slash: {
name: "compact",
aliases: ["summarize"],
},
run: () => {
void client.api.session.compact({ sessionID: route.sessionID })
@@ -1,6 +1,7 @@
import { describe, expect, test } from "bun:test"
import {
createPromptHistory,
isCompactCommand,
isExitCommand,
isNewCommand,
movePromptHistory,
@@ -98,4 +99,10 @@ describe("run prompt shared", () => {
expect(isNewCommand(" /NEW ")).toBe(true)
expect(isNewCommand("/new now")).toBe(false)
})
test("recognizes only the compact command", () => {
expect(isCompactCommand("/compact")).toBe(true)
expect(isCompactCommand(" /COMPACT ")).toBe(true)
expect(isCompactCommand("/summarize")).toBe(false)
})
})
+2 -2
View File
@@ -80,7 +80,7 @@ describe("run runtime queue", () => {
])
})
test.each(["/compact", "/summarize"])("treats %s as a local compaction command", async (command) => {
test("treats /compact as a local compaction command", async () => {
const ui = createFooterApiFixture()
const seen: string[] = []
let compacted = 0
@@ -96,7 +96,7 @@ describe("run runtime queue", () => {
},
})
ui.submit(command)
ui.submit("/compact")
ui.submit("hello")
await task