Skip to content

feat(sidebar): rename a project's display name from its group menu (#1047) - #1125

Open
agegr wants to merge 1 commit into
mainfrom
feat/project-display-names
Open

agegr wants to merge 1 commit into
mainfrom
feat/project-display-names

Conversation

@agegr

@agegr agegr commented Oct 8, 2026

Copy link
Copy Markdown
Owner

Deep project paths make poor labels (#1047, also asked in #568). A project group's ⋯ menu now has Rename… and Reset name (the latter only while a name is set). The name is only a label: it never touches the folder, the sessions, the order, pins or expansion, and renaming never selects the project.

Storage and rule

  • Kept in pi-web-session-state.json next to the pins, as an optional top-level projectNames: { <projectKey>: name } (absent while empty). Old files load unchanged; a malformed field reads as no names without the file being set aside. Names are server-side, so they reach other browsers too.
  • One shared rule, projectDisplayName() in lib/session-ui-state-shared.ts, serves the request parser, the optimistic apply and the file reader: trimmed, one line (control characters and line breaks refused), at most 80 code points; empty or null clears.
  • Limits: 1000 names and 256 KiB as JSON, like the project order. A new name with no room is not stored and the route answers 409 { reason: "full" }, which shows the existing "Couldn't save" toast; no other project's name is dropped.
  • New request: { action: "rename-project", projectKey, name: string | null }.

UI

  • Rename… turns the group header into the same inline field session rows use: Enter or blur saves, Escape cancels, focus returns to the header; the header can't be dragged while editing. An unchanged field saves nothing; clearing it, or typing the folder's own name, removes the custom name.
  • The name shows in group headers, the drag ghost, pinned rows' project label, the archive view's group headers and the menu title; in both project pickers (files tab, new-session bar) the box shows the name instead of the path, and their menus show the name with the folder name as the note. The full path stays the tooltip everywhere, and the picker filter matches name, folder or path. Duplicate names are allowed; names render as plain text.
  • Strings (Rename…, Reset name, Project name) in en, zh-CN, zh-TW. File map in AGENTS.md and docs/agents/sessions.md updated.

Left out of #1047: naming a folder while adding it (needs a form in the directory picker and a project whose identity isn't known yet), Copy path (the path is the tooltip), the window title (it shows the cwd folder, not the project).

Checks: unit tests for the rule, request check, apply, clearing, limits and file reading (lib/session-ui-state-shared.test.mjs), the write path and route incl. 409, tree naming, picker naming, menu entries and rendering; tsc, eslint, full npm test (2694 pass). Also driven in headless Chrome against a scratch server and agent dir: API refusals, save/read/clear, Enter/Escape/blur, focus, no change to URL/current project/order, files-tab box and menu, Reset, reload persistence.

Closes #1047

🤖 Generated with Claude Code

…1047)

Deep project paths make poor labels. A project group's menu now offers
Rename… (the header becomes the session row's inline field: Enter or blur
saves, Escape cancels) and Reset name while one is set. The name is a
label only, kept in pi-web-session-state.json as projectNames, keyed by
projectKey like the pins: it never touches the folder, the sessions, the
order, pins or expansion, and never selects the project.

One shared rule (projectDisplayName) serves the request parser, the
optimistic apply and the file: trimmed, one line, at most 80 code points;
empty or null clears. The names keep to 1000 entries and 256 KiB as JSON;
a new name with no room left is not stored and the route answers 409
"full". Old files load unchanged; a malformed field reads as none.

The name replaces the folder name in group headers, the drag ghost,
pinned rows and the archive's group headers, and the path in the project
pickers' box (files tab and the new-session bar); their menus show it
with the folder as the note. The full path stays the tooltip, so the
filter matches name, folder and path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Persistent project display aliases, editable in the selector and when adding a directory

1 participant