Skip to content

feat: custom display names for projects#52

Open
jakduch wants to merge 1 commit into
josepe98:mainfrom
jakduch:feat/project-rename-ui
Open

feat: custom display names for projects#52
jakduch wants to merge 1 commit into
josepe98:mainfrom
jakduch:feat/project-rename-ui

Conversation

@jakduch
Copy link
Copy Markdown
Collaborator

@jakduch jakduch commented May 23, 2026

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, and Users-me-dev-PPC-freelo all 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.json and 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

  • All calcCost() calls pass 6 arguments: (model, inp, out, cache_read, cache_creation, cache_1h)
  • JavaScript template literals use bare backticks (`), not escaped ones (\`)
  • No JS variables referenced before they are defined
  • No new third-party dependencies introduced

Tests

  • python3 -m unittest discover -s tests -v — all passing
  • python3 -m unittest tests.test_browser -v — all passing
  • New behaviour is covered by at least one test

Scope

  • This is a single concern — one feature or fix per PR
  • Only touches existing files (dashboard.py, scanner.py, cli.py, pricing.py, cowork.py, tests/) — or I've explained below why a new file is needed

The only new file is tests/test_project_aliases.py, which covers the new load/save helpers, the /api/project-name endpoint, and the alias merge into get_dashboard_data / get_session_detail.

@josepe98
Copy link
Copy Markdown
Owner

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 (.github/PULL_REQUEST_TEMPLATE.md). The checklist reflects a few patterns that kept coming up during integration — calcCost arg count, template literal escaping, etc. Filling it out before filing will speed up review considerably.

Looking forward to the collaboration.

@jakduch
Copy link
Copy Markdown
Collaborator Author

jakduch commented May 24, 2026

@josepe98
Thanks for the invite and the template — write access confirmed, really appreciate the trust.
I went back through every open PR (#3#55) and retrofitted them to the new template:

Section 1 — wrote a 150–200-word case for each PR's feature
Checklist — walked every item per PR with concrete evidence rather than ticking blind

From my side, every open PR is now ready for review — all MERGEABLE/CLEAN against current main, no outstanding work.
One ask: would you consider enabling Issues on the repo? Right now everything lives in PR threads, which makes it awkward to file bug reports, discuss roadmap ideas, or track things that aren't tied to a specific patch. Happy to file the first few once it's on.
And — if you ever want a hand with something specific, just say the word. Roadmap ideas, refactor passes, new features, triage, whatever helps the project. I've enjoyed working in this codebase and would love to keep contributing beyond just shipping my own pile of PRs. Feel free to ping me anytime.
Looking forward to working through them together.

@jakduch
Copy link
Copy Markdown
Collaborator Author

jakduch commented May 24, 2026

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.

@josepe98 josepe98 closed this May 25, 2026
@josepe98 josepe98 reopened this May 25, 2026
@josepe98 josepe98 closed this May 25, 2026
@josepe98 josepe98 reopened this May 25, 2026
@josepe98 josepe98 closed this May 25, 2026
@josepe98 josepe98 reopened this May 25, 2026
@josepe98 josepe98 closed this May 25, 2026
@josepe98 josepe98 reopened this May 25, 2026
@jakduch jakduch force-pushed the feat/project-rename-ui branch 2 times, most recently from 61473a3 to 3b5310c Compare May 26, 2026 20:59
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
@jakduch jakduch force-pushed the feat/project-rename-ui branch from 3b5310c to 451e378 Compare May 27, 2026 06:49
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.

2 participants