feat: custom display names for projects#52
Conversation
|
Hey @jakduch — I've sent you a collaborator invite on the fork. Once you accept, you'll be able to push branches, manage issues, and merge approved PRs yourself. Main is branch-protected so everything needs one approval before merging — I'll work through the queue at my own pace. I've also added a PR template ( Looking forward to the collaboration. |
|
@josepe98 Section 1 — wrote a 150–200-word case for each PR's feature From my side, every open PR is now ready for review — all MERGEABLE/CLEAN against current main, no outstanding work. |
|
P.S. Once you've gone through the queue and merged whatever you decide to keep (all, some, your call), I'll send a follow-up docs-only PR updating the README to cover whatever landed. |
61473a3 to
3b5310c
Compare
Lets the user override the filesystem-derived project name shown in the
dashboard (e.g. 'PhpstormProjects/PPC freelo' -> 'PPC.cz') without
touching the underlying data or aggregation keys.
Storage
- ~/.claude/project-names.json maps raw_name -> display_name
- _load_project_aliases / _save_project_aliases are tolerant: missing
file, malformed JSON, non-object payloads and non-string pairs all
fall back to an empty mapping rather than blowing up the dashboard
- Saves are atomic (write to .tmp + os.replace), strip whitespace, and
drop entries with empty display_name (clearing the alias)
API
- get_dashboard_data attaches display_name to every entry in sessions_all
- get_session_detail returns display_name on the session detail payload
- POST /api/project-name {raw, display} sets/updates/clears one alias
(empty display clears). Returns the updated map. 400 on bad input.
UI
- projDisplay(raw) and projCellHTML(raw) helpers funnel every project
label through display_name || project
- Tiny inline pencil button next to the project name in the sessions
table, cost-by-project table, cost-by-project-and-branch table and
the session detail panel -> prompt() -> POST -> reload
- Project bar chart labels and Pareto note also use the pretty name
- CSV exports gain a 'Project Display' column alongside the raw name
Tests
- tests/test_project_aliases.py: 25 tests covering helpers, data shape,
endpoint flow (set/update/clear/400) and the HTML template wiring
3b5310c to
451e378
Compare
What does this add and why do you believe it belongs in this dashboard?
Project labels in the dashboard come straight from the directory name Claude Code recorded when each session started, so the same codebase can show up under several disguises:
PhpstormProjects/PPC-freelo,dev/PPC-freelo, andUsers-me-dev-PPC-freeloall sit in the projects table as separate rows, splitting the cost concentration view and the per-project bar chart. Worse, the raw labels are noisy paths, not the names a human would pick when scanning a list.This PR adds an inline rename affordance — a small pencil button next to every project cell — that lets you assign a human-friendly display name (
PPC.cz) to a raw project key. Names are stored as a raw -> display map in~/.claude/project-aliases.jsonand replayed on every render, so the override survives restarts and rescans. Filtering, grouping, and CSV export still use the raw key (display name is exported as a separate column), so analytics stay correct while the UI becomes legible. A blank display name clears the alias.Checklist
Code correctness
calcCost()calls pass 6 arguments:(model, inp, out, cache_read, cache_creation, cache_1h)`), not escaped ones (\`)Tests
python3 -m unittest discover -s tests -v— all passingpython3 -m unittest tests.test_browser -v— all passingScope
dashboard.py,scanner.py,cli.py,pricing.py,cowork.py,tests/) — or I've explained below why a new file is neededThe only new file is
tests/test_project_aliases.py, which covers the new load/save helpers, the/api/project-nameendpoint, and the alias merge intoget_dashboard_data/get_session_detail.