Repository navigation
Conversation
|
The following comment was made by an LLM, it may be inaccurate: |
There was a problem hiding this comment.
This works as described, and I didn't find anything that should block it.
How I checked: I ran the TUI from source with tabs on and scope: global. On the base the tab shows OpenCode Drive. With this PR, tabs.label: "project" shows files: OpenCode Drive and "path" shows ~/files: OpenCode Drive. I didn't drive the vertical layout or a worktree session in the TUI; your vertical-layout test covers the first. The new and nearby tab tests pass (70 pass), and the packages/tui type check is clean. Renaming still uses the real stored title, and the scrolling and width logic handle the longer displayed title correctly.
Public API: this adds one optional key to the cli.json schema, tabs.label ("title" | "project" | "path", default "title"). It is also shown in the settings dialog. It is backwards compatible: existing configs render exactly as before.
No blocking concerns.
|
Thanks for picking this up, the render-time prefix (leaving the stored title untouched) is exactly what I was after in #56749. One gap I noticed from reading the diff. Please treat it as a suggestion, I haven't run the branch yet. There is no way to show just the session directory's basename. I've been using a plugin that rewrites the session title as a workaround, and it has three modes. Core of it: const mode = String(ctx.options.path ?? "basename") // "basename" | "full" | "home"
const label = (dir: string) => {
if (mode === "full") return dir
if (mode === "home") return home && dir.startsWith(home) ? "~" + dir.slice(home.length) : dir
return basename(dir) || dir
}
const prefix = label(sessionDirectory) + ":"The Suggested change, if it fits your design: add a fourth value, e.g. if (label === "directory" && directory) return path.basename(directory) || directory
if (label === "path" && directory) return abbreviateHome(directory, home)That would keep |
Adds tabs.label (title | project | path | directory, default title) to cli.json. Horizontal tabs prefix the title with the same detail the vertical sidebar shows; path mode swaps the project name for the home-abbreviated session directory, and directory mode keeps just its final segment (split with the same win32/posix rule as the other path helpers). Display only; the stored session title is untouched. Also fills the settings description the new-designs settings list now requires.
2304cd8 to
6c0880a
Compare
|
@callmeusdt pushed — The branch is also rebased onto latest |
There was a problem hiding this comment.
The new commit still works as described, and I have no new concerns.
How I checked: I ran the TUI from source with tabs.scope: global and tabs.label: "directory". The horizontal tab is prefixed with the last part of the session directory (files: …). I didn't re-check project, path or the vertical layout on this head; those code paths only changed through the rebase. The affected tests pass (60 pass), and the packages/tui type check is clean.
Public API: this adds one optional key to the cli.json schema, tabs.label ("title" | "project" | "path" | "directory", default "title"). It is backwards compatible: existing configs render exactly as before.



Issue for this PR
Closes #56749
Type of change
What does this PR do?
With
tabs.scope: global, sessions from different directories share one tab strip and their titles are often identical, so you cannot tell which tab belongs to which repo. This adds atabs.labeloption tocli.json(title|project|path|directory, defaulttitle) that adds project context to tab labels without touching the stored session title.project,path, anddirectoryprefix horizontal tab titles with the project name, the~-shortened session directory, or just the directory's final segment — the same detail text the vertical sidebar already shows on its second line, so worktree tabs getname⎇ branch: titlein both layouts.pathanddirectorymode the vertical sidebar's detail line shows the corresponding directory text instead of the bare project name.directorycame out of review feedback: it tells apart packages of one repository that share both the project name and the parent path.The default
titlekeeps today's rendering exactly; nothing changes unless you opt in. The prefix is composed at render time from the samesessionTabDetaillogic the sidebar uses, so renames, marquee scrolling, and the rename dialog all keep operating on the real stored title.How did you verify your code works?
bun run checkfrom the repo root (34/34 tasks), the fullpackages/tuisuite (1543 pass; the single failure isgo-upsell-art"the art stops every frame", which also fails on cleandev), and the website validation (bun typecheck,bun run check:generated,bun run buildinservices/www) for the docs change. New tests:sessionTabDetailNameandsessionTabLabelunit tests insession-tabs-model.test.ts(path substitution,~-shortening, directory basename including a Windows path, empty fallbacks), aconfig-v2default and settings-dialog assertion, andsession-tabs-label.test.tsx, which renders the strip with two same-titled tabs and checks thatprojectmode prefixes both, an unset option keeps titles plain, and the vertical layout keeps its detail line without prefixing titles. The component test is stable at--rerun-each 10.Screenshots / recordings
TUI frames captured from the test renderer. Two tabs, both titled "Fix login bug", in different projects:
tabs.label: "title"(default, unchanged):tabs.label: "project":tabs.label: "directory"(two packages of one repo):Checklist
Added by the opencode bot (AI-generated).
Related: #50228, #51759, #44589
Public API: adds the optional
tabs.labelcli.json setting (title|project|path|directory, defaulttitle; backwards compatible)