feat: remove hardcoded app names#2300
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an experimental ESLint restriction intended to prevent hardcoding the ToolHive brand string in application TypeScript/TSX code, steering usage toward centralized constants in @common/app-info.
Changes:
- Introduces a
no-restricted-syntaxrule to flagToolHiveoccurrences in string literals, JSX text, and template literals acrossrenderer/,main/,common/, andpreload/. - Excludes tests and
common/app-info.tsfrom the restriction.
|
@claude i know this pr is not yet fully done, but can you please do a deep review of it for me? make sure your summary is succint and you double validate every fiding |
|
Claude finished @kantord's task in 5m 9s —— View job Deep PR ReviewThis is a solid foundation — split into Findings1.
2. Quit dialog uses
3. Regex literals match the new ESLint rule — The selector 4. Still-unfixed user-visible literals that the rule will flag (non-exhaustive, all outside the test/mocks ignore list)
You said in the PR thread you intend to replace these in this PR — flagging here as a track-the-list reference. Confirmed acknowledged via your earlier comment. 5. Mock
6. New The "temporarily ignore log related stuff" commit (839b72b) sprinkles 7. Minor: The Things that look good
• Branch: |
| ? `🟢 ${APP_NAME} is running` | ||
| : `🔴 ${APP_NAME} is stopped`, | ||
| ? `🟢 ${app.getName()} is running` | ||
| : `🔴 ${app.getName()} is stopped`, |
There was a problem hiding this comment.
note: this is controversial: the logic is strictly about toolhive. So we might want to change this back to ToolHive. But it looks a bit off because nothign is explaining what ToolHive even is.
|
@claude another deep review please |
|
Claude finished @kantord's task in 6m 25s —— View job Deep PR Review (round 2)Re-verified the prior findings against current code, then audited what's new. Picture has improved: Critical1.
The doc-comment immediately above says "derive from the live Electron app name (productName)" and the fallback claims to be that name — but the literal
Pick one source of truth: either set Important2. Lint will fail: regex literals trip the new rule The selector
Both legitimately match external strings tied to the engine — disable per-line, or refine the selector to exclude regex nodes with 3. The 34 I counted 34
Either way, leaving 34 unowned TODOs on this PR pushes the cleanup work onto someone who doesn't have context. Minor4.
5.
6.
7. Previous review finding 5 was wrong — mock IS aligned I had said the mock ( Things that look good
Todo
|
see #2296
Notes:
APP_NAMEneeded to be changed, because it was used for various different things, such as referring tothvbut also for package configuration. This means that I could not leave this const as it is. I change it's usages that were referring to the desktop app to useAPP_DISPLAY_NAME(derived from package.json), then I basically renamed it toTHV_DISPLAY_NAMEto avoid confusion. This way the existing correct references to Toolhive (not Toolhive Studio) were kept unchanged, but with a different variable nameAPP_NAMEwere referring to the desktop app, and explicitly diverging form theAPP_DISPLAY_NAMEformat; in such ways that these usages cannot be derived from package.json without a deeper reworking and audit of the entire build process. It's not the right choice to do that here, so for those usages I was forced to create a "legacy const" namedDEPRECATED_APP_NAME_FOR_BUILDso this issue will not spread.