[M5+] add resolver::devbox_resolve (search.devbox.sh)

This commit is contained in:
2026-05-10 12:09:58 +00:00
parent afe1856e11
commit df2c25b559
7 changed files with 295 additions and 0 deletions

View File

@@ -78,6 +78,19 @@ All notable changes to cargoxx will be documented in this file.
and `[build]` honoring `warnings_as_errors` and `sanitizers`. Source
paths emitted relative to `build/` (i.e. prefixed with `../`).
Output is deterministic. `tests/codegen_cmake.cpp` covers 11 cases.
- `cargoxx.resolver::devbox_resolve(name, version)` and pure parser
`parse_devbox_resolve(json)` — port of devbox's
`internal/searcher/client.go` Resolve method. Hits
`https://search.devbox.sh/v1/resolve?name=<n>&version=<v>` via curl
and pulls out `name`, `version`, `commit_hash`, `attr_paths`. Falls
back to the per-system `systems.<plat>.commit_hash` when the
top-level field is empty (older response shapes). 404 →
`ResolutionUnknownPackage`, missing commit_hash →
`ResolutionVersionNotFound`, transport / parse errors →
`ResolutionNetworkError`. `tests/devbox_resolve_parse.cpp` covers
6 cases against fixtures derived from a real fmt 10.2.1 response;
`tests/devbox_resolve_live.cpp` (gated by `CARGOXX_NETWORK_TESTS=1`)
hits the live API.
- `cargoxx add <pkg>` now auto-resolves packages outside the curated
linkdb. On `LinkdbUnknownPackage`, `cmd_add` invokes
`resolver::discover` which: probes `nixpkgs#<pkg>` to confirm the