feat(search): add jlcpcb-prefixed identifiers to JLC search results#3118
feat(search): add jlcpcb-prefixed identifiers to JLC search results#3118techmannih wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9ecfa00438
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
|
|
||
| export const getJlcpcbSearchResultIdentifier = (lcsc: number | string) => | ||
| `jlcpcb:C${normalizeJlcpcbPartNumber(lcsc)}` |
There was a problem hiding this comment.
Support importing the emitted JLC identifier
When someone copies the new leading token into tsci import jlcpcb:C2040, the import command's direct-part parser only matches raw C/numeric part numbers (^C?(\d+)$ in cli/import/parse-direct-lcsc-part-number.ts), so this identifier is not treated as the exact part it points to and falls through to a text search/no-results path. Since this line makes provider-prefixed IDs the primary copyable search result, either teach import to accept the same prefix or keep the emitted token in an importable form.
Useful? React with 👍 / 👎.
313b916 to
9ecfa00
Compare
Summary
This change makes JLCPCB search output use an explicit provider-prefixed identifier, similar to the existing KiCad search output.
Before:
After:
Why
KiCad search results already return namespaced identifiers such as
kicad:Resistor_SMD/R_0402_1005Metric, but JLCPCB results only exposed the LCSC part number inside descriptive text. That made the output less consistent and harder to copy directly into workflows that expect provider-prefixed component references.What changed
jlcpcb:C...firstC...orjlcpcb:C...values to a single output shapesearch --jlcpcbcommand outputUser impact
tsci search resistorstill defaults to JLCPCB searchtsci search --kicad resistoris unchangedtsci search --jlcpcb RP2040now prints a copy-paste-friendlyjlcpcb:identifierValidation
bun test tests/cli/search/search-jlcpcb-format.test.ts tests/cli/search/search-jlcpcb-command.test.tsbunx @biomejs/biome check cli/search/register.ts cli/search/format-jlcpcb-search-result.ts tests/cli/search/search-jlcpcb-command.test.ts tests/cli/search/search-jlcpcb-format.test.ts