Skip to content

refactor(service): extract getDesignName helper#62

Open
valentinozegna wants to merge 1 commit into
mainfrom
claude/design-name-helper
Open

refactor(service): extract getDesignName helper#62
valentinozegna wants to merge 1 commit into
mainfrom
claude/design-name-helper

Conversation

@valentinozegna

Copy link
Copy Markdown
Contributor

Summary

path.basename(design, path.extname(design)) was duplicated across 5 service tool files (8 call sites). Add a getDesignName() helper to src/paths.ts and use it everywhere, dropping the now-unused path imports.

Touched files:

  • src/paths.ts — new getDesignName(design) helper
  • src/service/tools/query-component.ts
  • src/service/tools/list-components.ts
  • src/service/tools/query-xnet.ts (2 sites)
  • src/service/tools/search-nets.ts
  • src/service/tools/search-components.ts (3 sites)

cadence-export.ts keeps its path import (uses path.join/dirname for real path work — out of scope).

Scope note

Per request, the three search functions in search-components.ts were left structurally intact — only the design-name expression was swapped, no collapsing/merging of those functions.

Verification

  • npm run type-check
  • npm run lint
  • npm test ✅ (404/404)

Context

Found during a codebase audit. No behavior change.

https://claude.ai/code/session_01LGUEJTmg3MJDiCSZqzL5ED


Generated by Claude Code

The expression path.basename(design, path.extname(design)) was repeated
across 5 service tool files (8 call sites). Add a getDesignName() helper to
src/paths.ts and use it everywhere, dropping the now-unused path imports.
No behavior change.

Per request, the three search functions in search-components.ts were left
structurally intact (only the design-name expression was swapped).
@valentinozegna valentinozegna marked this pull request as ready for review June 7, 2026 14:17
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