Skip to content

feat(search): add jlcpcb-prefixed identifiers to JLC search results#3118

Open
techmannih wants to merge 1 commit into
tscircuit:mainfrom
techmannih:codex/search-jlcpcb-prefix
Open

feat(search): add jlcpcb-prefixed identifiers to JLC search results#3118
techmannih wants to merge 1 commit into
tscircuit:mainfrom
techmannih:codex/search-jlcpcb-prefix

Conversation

@techmannih
Copy link
Copy Markdown
Member

@techmannih techmannih commented May 27, 2026

Summary

This change makes JLCPCB search output use an explicit provider-prefixed identifier, similar to the existing KiCad search output.

Before:

$ tsci search --jlcpcb RP2040
1. RP2040 (C2040) - RP2040

After:

$ tsci search --jlcpcb RP2040
1. jlcpcb:C2040 - RP2040

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

  • updated human-readable JLCPCB search output to print jlcpcb:C... first
  • extracted JLCPCB identifier/label formatting into a dedicated helper for clearer behavior
  • normalized existing C... or jlcpcb:C... values to a single output shape
  • avoided repeating the same label twice when manufacturer and description are effectively identical
  • added focused tests for both the formatter and the search --jlcpcb command output

User impact

  • tsci search resistor still defaults to JLCPCB search
  • tsci search --kicad resistor is unchanged
  • tsci search --jlcpcb RP2040 now prints a copy-paste-friendly jlcpcb: identifier
  • search behavior and JSON output are unchanged; this only affects the displayed CLI formatting

Validation

  • bun test tests/cli/search/search-jlcpcb-format.test.ts tests/cli/search/search-jlcpcb-command.test.ts
  • bunx @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

@techmannih techmannih marked this pull request as ready for review May 27, 2026 12:45
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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)}`
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@techmannih techmannih changed the title [codex] feat(search): add jlcpcb-prefixed identifiers to JLC search results [codex] support jlcpcb identifiers across search and import May 27, 2026
@techmannih techmannih changed the title [codex] support jlcpcb identifiers across search and import support jlcpcb identifiers across search and import May 27, 2026
@techmannih techmannih force-pushed the codex/search-jlcpcb-prefix branch from 313b916 to 9ecfa00 Compare May 27, 2026 13:10
@techmannih techmannih changed the title support jlcpcb identifiers across search and import [codex] feat(search): add jlcpcb-prefixed identifiers to JLC search results May 27, 2026
@techmannih techmannih changed the title [codex] feat(search): add jlcpcb-prefixed identifiers to JLC search results feat(search): add jlcpcb-prefixed identifiers to JLC search results May 27, 2026
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.

1 participant