[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

@@ -136,4 +136,26 @@ auto discover(const std::string& name, const std::string& version_spec,
const std::filesystem::path& scratch_root, const BuildFn& build_fn)
-> util::Result<Discovered>;
// Output of devbox's /v1/resolve API. We capture only the fields cargoxx
// uses; the response carries far more metadata (license, summary, per-
// system store hashes) that we deliberately ignore.
struct DevboxResolution {
std::string name;
std::string version;
std::string commit_hash;
std::vector<std::string> attr_paths;
};
// Pure: parse the JSON body of GET https://search.devbox.sh/v1/resolve.
// `commit_hash` must be present and non-empty; other fields tolerate
// absence by leaving themselves blank.
auto parse_devbox_resolve(std::string_view json)
-> util::Result<DevboxResolution>;
// Calls GET https://search.devbox.sh/v1/resolve?name=<n>&version=<v>
// via curl. 404 → ResolutionUnknownPackage; transport / parse errors →
// ResolutionNetworkError.
auto devbox_resolve(const std::string& name, const std::string& version)
-> util::Result<DevboxResolution>;
} // namespace cargoxx::resolver