From 3f181dc24126b12382527ef17641e815fe8d1f84 Mon Sep 17 00:00:00 2001 From: "Aleksei (Faumaray) Selikhov" Date: Fri, 4 Dec 2026 03:00:02 +0300 Subject: [PATCH] feat(cli): list registry releases --- README.md | 1 + docs/agent-workflow/STATE.md | 2 +- docs/agent-workflow/TASKS.md | 1 + docs/agent-workflow/VERIFICATION.md | 15 ++++++++++ src/Main.cpp | 43 +++++++++++++++++++++++++++++ tests/CliContracts.cmake | 2 ++ tests/RegistryTests.cpp | 12 ++++++++ 7 files changed, 75 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 69c2651..25fc863 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,7 @@ All CLI help text (`vbs --help`, `vbs --help`, `vbs compdb --help`, `v - `vbs publish --registry URL --name PKG --version X.Y.Z [--project DIR] [--description TEXT] [--token-env VAR] [--signing-key FILE] [--private]` - `vbs publish-binary --registry URL --name PKG --version X.Y.Z --variant ID --file ARTIFACT [--signing-key FILE] [--token-env VAR]` - `vbs binaries list|fetch --registry URL --name PKG --version X.Y.Z [--variant ID --output FILE] [--token-env VAR]` +- `vbs releases list --registry URL --name PKG [--token-env VAR]` - `vbs bridge --request FILE --output FILE` (backend for [cmake/bridge/VbsDeps.cmake](cmake/bridge/VbsDeps.cmake)) - `vbs gc [--build-dir DIR] [--max-bytes N]` - `vbs daemon run|status|stop|gc|recover|describe|build|ide query|ide generate|ide poll|ide wait|ide status|compdb use|compdb export|compdb entries [--file PATH] [--limit N]|graph [--format dot|json]|test [--target NAME] [--project DIR] [--member NAME]` [--build-dir DIR] [--socket PATH]` (Unix-socket daemon holding a warm state store and project watcher; `run` serves in the foreground, the rest are client requests) diff --git a/docs/agent-workflow/STATE.md b/docs/agent-workflow/STATE.md index a607ec8..b60793b 100644 --- a/docs/agent-workflow/STATE.md +++ b/docs/agent-workflow/STATE.md @@ -179,7 +179,7 @@ Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B - Tests: `Daemon.actions_lists_lowered_actions` and extended registry binary-variant assertions; Daemon suite is now 26 cases. - Note: a swarm retried for the daemon half stalled on its planning step again and was stopped; the work was then implemented directly. -- **Wave 61 (Registry Package Ownership API)**:\n - Added `GET/PUT/DELETE /api/v1/packages//owners[/]`: listing honors read permissions, mutations require authentication, CSRF for browser sessions, and ownership/publish authority; unknown users return 404 and removing the last owner returns 409. Owner changes are audited (`package.owner_add`/`package.owner_remove`) and persisted.\n - Extended the registry RBAC test with a dedicated package: list, add, unknown user, reader-with-ownership still denied (403), remove, and last-owner rejection.\n\n## Remaining future scope"}"}"}"}"}"}"}, {"oldString": "Track E4 (the `Void::Net` registry-client transport and `Void::Sqlite` StateStore are adopted; further Net surfaces such as the registry HTTP server remain planned scope).", "newString": "Track E4 (`Void::Net` now backs both the registry client transport and the registry HTTP server when enabled, and `Void::Sqlite` backs the StateStore; the POSIX fallbacks remain for minimal toolchains)."}]"}, {"oldString": "Track E4 (`Void::Net` alignment; `Void::Sqlite` is now used by the StateStore when SQLite3 is available) remain planned scope.", "newString": "Track E4 (the `Void::Net` registry-client transport and `Void::Sqlite` StateStore are adopted; further Net surfaces such as the registry HTTP server remain planned scope)."}, {"oldString": "Live `conan` CLI verification (Track B3), Track C", "newString": "Track C"}"}, {"oldString": "Track E4 (`Void::Net`/`Void::Sqlite` alignment) remain planned scope.", "newString": "Track E4 (`Void::Net` alignment; `Void::Sqlite` is now used by the StateStore when SQLite3 is available) remain planned scope."} +- **Wave 61 (Registry Package Ownership API)**:\n - Added `GET/PUT/DELETE /api/v1/packages//owners[/]`: listing honors read permissions, mutations require authentication, CSRF for browser sessions, and ownership/publish authority; unknown users return 404 and removing the last owner returns 409. Owner changes are audited (`package.owner_add`/`package.owner_remove`) and persisted.\n - Extended the registry RBAC test with a dedicated package: list, add, unknown user, reader-with-ownership still denied (403), remove, and last-owner rejection.\n\n- **Wave 62 (`vbs releases list`)**:\n - Added `vbs releases list --registry URL --name PKG [--token-env VAR]` over `Package::fetch_package_releases`, printing `version sha256 active|yanked binaries=N` per release.\n - Covered by CLI contracts (help + required-argument error) and the live registry E2E (both published versions listed as active).\n\n## Remaining future scope"}"}"}"}"}"}"}"}, {"oldString": "Track E4 (the `Void::Net` registry-client transport and `Void::Sqlite` StateStore are adopted; further Net surfaces such as the registry HTTP server remain planned scope).", "newString": "Track E4 (`Void::Net` now backs both the registry client transport and the registry HTTP server when enabled, and `Void::Sqlite` backs the StateStore; the POSIX fallbacks remain for minimal toolchains)."}]"}, {"oldString": "Track E4 (`Void::Net` alignment; `Void::Sqlite` is now used by the StateStore when SQLite3 is available) remain planned scope.", "newString": "Track E4 (the `Void::Net` registry-client transport and `Void::Sqlite` StateStore are adopted; further Net surfaces such as the registry HTTP server remain planned scope)."}, {"oldString": "Live `conan` CLI verification (Track B3), Track C", "newString": "Track C"}"}, {"oldString": "Track E4 (`Void::Net`/`Void::Sqlite` alignment) remain planned scope.", "newString": "Track E4 (`Void::Net` alignment; `Void::Sqlite` is now used by the StateStore when SQLite3 is available) remain planned scope."} - **Post-v1 Expansion Roadmap ([21-expansion-roadmap.md](../roadmap/21-expansion-roadmap.md) & [20-future-translation-platforms.md](../roadmap/20-future-translation-platforms.md))**: Live `conan` CLI verification (Track B3), Track C (macOS/Windows ports + dual-profile cross-compilation), Track D3 signing (SBOM, Ed25519 primitives, trusted-key enforcement and distribution, binary-variant signing and distribution materialization, the #52 built-in-backend capability probe, and the VoidLibrary pin bump to `0002e74` done), Track E3 (daemon core, bounded `describe`, build-serving, dependency materialization, daemon-backed IDE metadata, compdb export, IDE config generation, editor watch poll and bounded long-poll done; dedicated external editor plugins remain), and Track E4 (`Void::Net`/`Void::Sqlite` alignment) remain planned scope. diff --git a/docs/agent-workflow/TASKS.md b/docs/agent-workflow/TASKS.md index 56ffbfa..b6341eb 100644 --- a/docs/agent-workflow/TASKS.md +++ b/docs/agent-workflow/TASKS.md @@ -66,4 +66,5 @@ Base HEAD: `fe0d1a6` | Wave 59 (Daemon pack request) | `pack` daemon request + `vbs daemon pack --output`: deterministic archive confined to the build root, returns path and SHA-256 | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Daemon 25/25, full CTest 8/8) | `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `tests/DaemonTests.cpp`, `tests/CliContracts.cmake`, docs | | Wave 60 (Daemon actions + binary detail) | `actions` daemon request with target filter and limit; `GET .../binaries/` detail endpoint | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Daemon 26/26, Registry 7/7, full CTest 8/8) | `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `registry/service/RegistryService.cpp`, `tests/DaemonTests.cpp`, `tests/RegistryTests.cpp`, `tests/CliContracts.cmake`, docs | | Wave 61 (Registry ownership API) | `GET/PUT/DELETE .../owners[/]` with authority, CSRF, audit, 404/409 handling | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Registry 7/7, full CTest 8/8) | `registry/service/RegistryService.cpp`, `tests/RegistryTests.cpp`, docs | +| Wave 62 (`vbs releases list`) | Registry client release listing CLI over `fetch_package_releases` | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Registry 7/7, full CTest 8/8) | `src/Main.cpp`, `tests/RegistryTests.cpp`, `tests/CliContracts.cmake`, docs | | Future (Plan 20 Slice 3 / Tracks C, E3 editor extensions) |"}] Live `conan` CLI verification; macOS/Windows/cross-compile; binary-variant signing and key distribution; daemon-side dependency materialization and editor plugins; `Void::Net`/`Void::Sqlite` alignment | PLANNED (unimplemented) | [21-expansion-roadmap.md](../roadmap/21-expansion-roadmap.md), [20-future-translation-platforms.md](../roadmap/20-future-translation-platforms.md) | diff --git a/docs/agent-workflow/VERIFICATION.md b/docs/agent-workflow/VERIFICATION.md index efa1fe9..fe1ee7a 100644 --- a/docs/agent-workflow/VERIFICATION.md +++ b/docs/agent-workflow/VERIFICATION.md @@ -1010,6 +1010,21 @@ dev cpp-gcc -c ctest --test-dir build/pinned --output-on-failure - Full CTest: **8 / 8 passed** in 239.25 s. - `clang-format --dry-run --Werror` passes on the changed C++ files. +## `vbs releases list` (GCC 16.2, pin `0002e74`) + +```sh +dev cpp-gcc -c cmake --build build/pinned --parallel 8 +dev cpp-gcc -c build/pinned/bin/vbs_registry_tests --no-color +dev cpp-gcc -c ctest --test-dir build/pinned --output-on-failure +``` + +- Build: exit 0. Registry suite: **7 / 7 passed** in 12.72 s; the live E2E runs + `vbs releases list --registry ... --name hello-pkg` and sees both `1.0.0` and `1.1.0` marked + `active`. +- `vbs_cli_contract` covers `releases list --help` and the missing-argument error. +- Full CTest: **8 / 8 passed** in 238.94 s. +- `clang-format --dry-run --Werror` passes on `src/Main.cpp` and `tests/RegistryTests.cpp`. + ## Limits and Unrun Checks 1. **HTTPS git fetch**: the host shell is proxy-restricted, but the Docker container could clone `https://git.faumaray.com/Void/VoidLibrary.git`; the pinned commit `3e254055e081a104f08df68dde39711bc7813518` was fetched directly for the verification above. A separate configure against the local `/home/faumaray/Projects/Library` checkout via `VBS_VOID_SOURCE_DIR` also succeeded (development-only override, checkout unmodified). diff --git a/src/Main.cpp b/src/Main.cpp index fa17c39..f23ec36 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -1154,6 +1154,34 @@ int execute_publish_binary_command(const PublishBinaryCmdOptions &opts) { return 0; } +struct ReleasesCmdOptions { + std::optional registry_arg; + std::optional name_arg; + std::string token_env{"VBS_REGISTRY_TOKEN"}; +}; + +int execute_releases_list_command(const ReleasesCmdOptions &opts) { + const std::string registry_url = opts.registry_arg + ? *opts.registry_arg + : Void::Configuration::get_env_or("VBS_REGISTRY_URL", ""); + if (registry_url.empty() || !opts.name_arg) { + std::cerr << "vbs releases list: --registry and --name are required\n"; + return 2; + } + Package::RegistryAuth auth{Void::Configuration::get_env_or(opts.token_env, "")}; + auto releases = Package::fetch_package_releases(registry_url, *opts.name_arg, auth); + if (!releases) { + std::cerr << "vbs releases: " << releases.error().message() << '\n'; + return 1; + } + for (const auto &release : *releases) { + std::cout << release.version.to_string() << ' ' << release.source_sha256 << ' ' + << (release.yanked ? "yanked" : "active") + << " binaries=" << release.binaries.size() << '\n'; + } + return 0; +} + struct BinariesCmdOptions { std::optional registry_arg; std::optional name_arg; @@ -2360,6 +2388,7 @@ int main(int argc, char **argv) { PublishCmdOptions publish_opts; PublishBinaryCmdOptions publish_binary_opts; BinariesCmdOptions binaries_opts; + ReleasesCmdOptions releases_opts; publish_opts.project_arg = cwd; BridgeCmdOptions bridge_opts; GcCmdOptions gc_opts; @@ -2523,6 +2552,17 @@ int main(int argc, char **argv) { publish_binary_opts.token_env, "VBS_REGISTRY_TOKEN"); add_log_flags(publish_binary_cmd, false); // `-v` is `--version` on publish-binary. + auto &releases_cmd = + root.subcommand("releases", "List published releases in a package registry"); + auto &releases_list_cmd = releases_cmd.subcommand("list", "List a package's releases"); + releases_list_cmd + .option("--registry", "-r", "Registry base URL (or VBS_REGISTRY_URL)", + releases_opts.registry_arg) + .option("--name", "-n", "Package name", releases_opts.name_arg) + .option_default("--token-env", "", "Environment variable holding bearer token", + releases_opts.token_env, "VBS_REGISTRY_TOKEN"); + add_log_flags(releases_list_cmd); + auto &binaries_cmd = root.subcommand("binaries", "Inspect prebuilt binary variants in a package registry"); auto configure_binaries = [&](Void::Argparse::Parser &p) { @@ -2861,6 +2901,9 @@ int main(int argc, char **argv) { if (cmd == "binaries") { return execute_binaries_command(parsed.matched_command_path.at(1), binaries_opts); } + if (cmd == "releases") { + return execute_releases_list_command(releases_opts); + } if (cmd == "bridge") { return execute_bridge_command(bridge_opts); } diff --git a/tests/CliContracts.cmake b/tests/CliContracts.cmake index 57caff3..7dd41b9 100644 --- a/tests/CliContracts.cmake +++ b/tests/CliContracts.cmake @@ -49,6 +49,8 @@ check_process(0 "Usage: vbs publish " "" publish --help) check_process(0 "Usage: vbs publish-binary " "" publish-binary --help) check_process(0 "Usage: vbs binaries .*Commands:.*list.*fetch" "" binaries --help) check_process(0 "Usage: vbs binaries list " "" binaries list --help) +check_process(0 "Usage: vbs releases list " "" releases list --help) +check_process(2 "" "--registry and --name are required" releases list) check_process(0 "Usage: vbs binaries fetch " "" binaries fetch --help) check_process(2 "" "--registry, --name, and --version are required" binaries list) check_process(2 "" "--variant and --output are required" binaries fetch --registry http://127.0.0.1:1 --name p --version 1.0.0) diff --git a/tests/RegistryTests.cpp b/tests/RegistryTests.cpp index 6d1c7b8..3e4bdd9 100644 --- a/tests/RegistryTests.cpp +++ b/tests/RegistryTests.cpp @@ -1004,6 +1004,18 @@ target_include_directories(hello_pkg PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include Void::Testing::require(fetched_bytes.has_value()); Void::Testing::expect(*fetched_bytes == "CLI_BINARY_VARIANT_BYTES"); + Platform::ProcessRequest releases_list; + releases_list.executable = vbs_bin; + releases_list.arguments = {"releases", "list", "--registry", reg_url, "--name", "hello-pkg"}; + releases_list.environment.set_vars["VBS_REGISTRY_TOKEN"] = *tok; + auto releases_res = Platform::run_supervised(releases_list); + Void::Testing::expect(releases_res.has_value() && releases_res->succeeded()); + if (releases_res) { + Void::Testing::expect(releases_res->stdout_data.find("1.0.0") != std::string::npos); + Void::Testing::expect(releases_res->stdout_data.find("1.1.0") != std::string::npos); + Void::Testing::expect(releases_res->stdout_data.find("active") != std::string::npos); + } + // 2. Create a consumer project declaring `.package("hello-pkg", "^1.0").registry(reg_url)`. const auto cons_dir = tmp / "consumer"; const auto cons_build = tmp / "consumer_build";