Closed feature request

Part requests from the CLI: adom-wiki part request / candidates / status

Colby Knox · ·closed by Colby Knox

The wiki can ask Adom's factory (Component Ocean) to build a component page for a part that has none: symbol, footprint and 3D model. The website has offered "Request this part" on search misses since 2026-10-27. The API is live on prod, but the CLI has no command for it, so an AI working from the terminal has to hand-write adom-wiki api calls.

Since 862151b5 (staging now, prod with the next tag), GET /api/search returns a PART_NOT_ON_WIKI hint when an MPN-shaped search finds nothing. Its action currently spells out the raw adom-wiki api command. Once this verb ships I'll switch the action to name it.

Proposed verbs

adom-wiki part request <mpn> [--manufacturer <m>] [--later]
adom-wiki part request --bom <file> [--now] [--ref <board-or-bom-name>]
adom-wiki part candidates <partial-mpn>
adom-wiki part status [<id>]          # no id = all of mine
adom-wiki part status --batch <id>

The noun is up to you (part, or under library). These are just the shapes the routes support.

Route contract

All of these need a signed-in caller. The signed-out path accepts only a same-origin browser POST and refuses anything else with 403 PART_REQUEST_CROSS_SITE. For a signed-out CLI, say "sign in first", or point the user at https://wiki.adom.inc/search?q=<mpn>.

Request one part: POST /api/part-request

  • body {mpn, manufacturer?, urgency?: "now" | "later"}, default now
  • later is the "no rush, anytime today" batch wave, which is cheaper for the factory
  • reply {request: {id, mpn, manufacturer, state, page_url, demand, updated_at, reason}, counted, position, already: "built" | "building" | null, eta_seconds, eta_text, urgency, status_url}
  • already: "built" means a page exists, so print request.page_url. already: "building" means someone asked first.
  • status_url is a path, like /part-request/<token>. Prefix the registry origin to print it.

Request a BOM or board: POST /api/part-request/batch

  • body {mpns: [mpn | {mpn, manufacturer}], ref?, source?: "board" | "bom" | "molecule", urgency?}
  • at most 200 parts; the default urgency for a batch is later
  • reply {batch_id, items: [{mpn_input, request_id, state, message, status_url}]}
  • a name the factory doesn't recognize comes back as state: "unknown" with a message

Batch progress: GET /api/part-request/batch/:id returns the same item shape. Someone else's batch answers as 404.

Candidates: GET /api/part-request/candidates?q=<partial> lists the orderable part numbers behind a partial one. For example, LMR36015 returns LMR36015SFBRNXR and others.

  • reply {q, exact, candidates: [{mpn, alternates, manufacturer, package, description, page_url, mine?}]}
  • mine is {state, status_url} when this caller already asked for that part
  • q must look like a part number, otherwise 400 BAD_PART_REQUEST

One request: GET /api/part-request/:id, for ids this user was handed. Anyone else's id answers as 404.

Mine: GET /api/me/part-requests lists the caller's requests, including any made while signed out with the same email address.

States

  • queued and building: show position and eta_text while queued.
  • needs_footprint: still in progress. The status page words it as "drawing a footprint first, a few minutes more".
  • built: done, page_url is set.
  • review and cannot_build: stopped, and reason explains why in plain words.

Error codes worth mapping

Code Status Meaning
BAD_PART_REQUEST 400 not a part number, or a malformed batch
UNKNOWN_PART 404 the factory doesn't know the part
PART_REQUEST_CAP 429 daily cap reached
PART_REQUESTS_OFF 503 feature not configured on that registry
PART_REQUEST_UPSTREAM 502 anything else from the factory

Rate limits: 30 single requests and 5 batches per minute per user.

Nice to have

  • part request with no flags on an MPN that candidates resolves to exactly one orderable part could offer that part.
  • When search gets back the PART_NOT_ON_WIKI hint, it could print the part request command itself.

2 Replies

Colby Knox ·

Shipped in adom-wiki 1.8.2, under the noun part:

adom-wiki part request <mpn> [--manufacturer <m>] [--later]
adom-wiki part request --bom <file> [--now] [--ref <name>] [--source board|bom|molecule]
adom-wiki part candidates <partial-mpn>
adom-wiki part status [<id>]          # no id = all of mine
adom-wiki part status --batch <id>
  • already: a built part prints its page, and one already building says someone asked first. status_url and page_url are printed as full URLs.
  • UNKNOWN_PART on a single request: it lists the orderable candidates behind the number, and names the command when exactly one matches.
  • --bom: reads a CSV/TSV with an MPN column (Manufacturer optional), a JSON list, or one MPN per line. It drops repeats, caps at 200, and defaults to later.
  • States: shown in words. queued_<wave> from the batch POST reads as "queued ( wave)".
  • Error codes: all six in the table map to hints, including PART_REQUEST_CROSS_SITE (sign in, or use the website).

Checked on staging (same factory): candidates for LMR36015, the "mine" list, a single request for RP2350A (already built), an unknown MPN, status by id, and a BOM batch of two built parts plus one unknown.

The PART_NOT_ON_WIKI hint can now name adom-wiki part request <mpn>.

Colby Knox ·

Shipped in adom-wiki 1.8.2.

adom-wiki part request <mpn> [--manufacturer <m>] [--later]
adom-wiki part request --bom <file> [--now] [--ref <name>] [--source board|bom|molecule]
adom-wiki part candidates <partial>
adom-wiki part status [<id>]          # no id = all of yours
adom-wiki part status --batch <id>
  • An already-built part answers with its page, and a part someone else asked for first says so.
  • UNKNOWN_PART on a single request lists the orderable candidates behind the number.
  • --bom reads a CSV/TSV with an MPN column (Manufacturer optional), a JSON list, or one MPN per line. It removes duplicates, sends at most 200, and defaults to later.
  • All six error codes map to hints, and a signed-out call is told to sign in or use https://wiki.adom.inc/search?q=<mpn>.

The PART_NOT_ON_WIKI hint can name adom-wiki part request <mpn> now.

Checked on staging against the same factory: candidates for LMR36015, the list of my requests, a request for the built RP2350A, a nonsense MPN, status by id, and a three-line BOM batch.

Colby Knox closed this ·

Log in to reply.