diff --git a/docs/agent-workflow/STATE.md b/docs/agent-workflow/STATE.md index 49166ed..ac8aa07 100644 --- a/docs/agent-workflow/STATE.md +++ b/docs/agent-workflow/STATE.md @@ -261,6 +261,8 @@ Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B - **Wave 84 (Daemon Install CLI Options & Registry Users Pagination)**: `vbs daemon install` now exposes `--component`, `--no-cmake-export`, and `--no-native-export` (matching the daemon protocol). A swarm worker paginated the admin `GET /api/v1/users` route (limit/offset envelope, 400 validation) with RegistryTests coverage (4/4 substantive tasks; build task stopped and re-run). +- **Wave 85 (`vbs lock show` & Daemon Mermaid Graphs)**: added `vbs lock show [--project DIR]` printing the pinned lock revision, contexts, and entries (package/version/source/digest/signed state). A swarm worker added a `mermaid` format to the daemon `graph` request (flowchart nodes/links/prerequisites) with test coverage (4/5 substantive tasks; the final build/help tasks were stopped and completed by the orchestrator). + ## Remaining future 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))**: Track C (macOS/Windows ports + dual-profile cross-compilation) and dedicated external editor plugins remain planned; Track D3 signing (SBOM, Ed25519 primitives, trusted-key enforcement/distribution, binary-variant signing/distribution) and Track E3 daemon capabilities are implemented, and Track E4 now uses `Void::Net` for the registry client/server and remote cache plus `Void::Sqlite` for the StateStore when available. diff --git a/docs/agent-workflow/TASKS.md b/docs/agent-workflow/TASKS.md index e5e7343..2567521 100644 --- a/docs/agent-workflow/TASKS.md +++ b/docs/agent-workflow/TASKS.md @@ -88,4 +88,5 @@ Base HEAD: `fe0d1a6` | Wave 82 (Tokens list + target_list) | `fetch_tokens`/`vbs tokens list`; swarm added daemon `target_list` | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Registry 9/9, Daemon suite passes, full CTest 8/8) | `include/Void/Build/Package/RegistryClient.hpp`, `src/Package/RegistryClient.cpp`, `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `tests/{RegistryTests,DaemonTests}.cpp`, `tests/CliContracts.cmake`, docs | | Wave 83 (Tokens revoke + deps update) | `revoke_token`/`vbs tokens revoke`; swarm added daemon `deps` `update` flag | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Registry 9/9, Daemon suite passes, full CTest 8/8) | `include/Void/Build/Package/RegistryClient.hpp`, `src/Package/RegistryClient.cpp`, `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `tests/{RegistryTests,DaemonTests}.cpp`, `tests/CliContracts.cmake`, docs | | Wave 84 (Install CLI options + users pagination) | `daemon install --component/--no-cmake-export/--no-native-export`; swarm paginated `/api/v1/users` | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Registry 9/9, full CTest 8/8) | `src/Main.cpp`, `registry/service/RegistryService.cpp`, `tests/{RegistryTests,CliContracts}.cmake/cpp`, docs | +| Wave 85 (Lock show + mermaid graph) | `vbs lock show`; swarm added daemon `graph --format mermaid` | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; CLI contract passes, Daemon suite passes, full CTest 8/8) | `src/Main.cpp`, `src/Daemon/Daemon.cpp`, `tests/{DaemonTests,CliContracts}.cpp/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 579f574..8b9d3a0 100644 --- a/docs/agent-workflow/VERIFICATION.md +++ b/docs/agent-workflow/VERIFICATION.md @@ -1261,6 +1261,15 @@ dev cpp-gcc -c build/pinned/bin/vbs_v1_tests --suite Daemon --no-color re-run by the orchestrator). - Registry suite: **9 / 9 passed** (11.23 s); full CTest: **8 / 8 passed** in 265.14 s. +## `vbs lock show` & Daemon Mermaid Graphs (GCC 16.2, pin `0002e74`) + +- `vbs lock show --project ` prints `no vbs.lock in ` when absent (CLI contract passes, + 8.59 s). +- Swarm `swarm_mx8hsdzr_gixq` (one worker) added the daemon `graph` `mermaid` format and test + coverage (4/5 substantive tasks; the final build/help tasks were stopped and finished by the + orchestrator); `graph_exports_target_dependencies_as_json_and_dot` passes (2.38 s). +- Full CTest: **8 / 8 passed** in 262.82 s. + ## 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/docs/roadmap/21-expansion-roadmap.md b/docs/roadmap/21-expansion-roadmap.md index 03efe06..ce8ba5f 100644 --- a/docs/roadmap/21-expansion-roadmap.md +++ b/docs/roadmap/21-expansion-roadmap.md @@ -73,7 +73,7 @@ flowchart LR | --- | --- | --- | | **E1 — Everyday CLI Ergonomics (Implemented in Wave 8)** | `vbs init` project scaffolding, `vbs clean`, `vbs doctor` environment diagnostics, `vbs graph --format dot|json`, and `vbs build --native-foreign`. | End-to-end CLI & integration tests passing in `vbs_cli_contract` and `vbs_v1_tests`. | | **E2 — Multi-Package Workspaces (`workspace.cpp`)** *(verified in Docker GCC 16)* | Shared root `vbs.lock` and `build/.vbs` CAS, `workspace_dependency()` cross-member native linking, and affected-member selection (`vbs build/test --member ` / `--changed-since `). | 3-package workspace fixture (shared library + app + tests) builds/tests with one root lockfile; member selection and `--changed-since` verified in `FullV1Tests.workspace_members_shared_build_and_member_selection`. | -| **E3 — IDE Config/Query & Background Daemon** | `build.cpp`/`build.profiles.cpp`/`build-support/` SDK entries in `compile_commands.json` + `vbs ide generate` (`.clangd`, `.vscode/`, `.zed/`, `.idea/customTargets.xml`) & `vbs ide query` (**Implemented & Verified in Wave 10**); Unix-socket daemon core holding a warm `StateStore` + project `DirectoryWatcher` with `vbs daemon run\|status\|stop\|gc\|recover\|describe` (**Implemented & Verified in Wave 14; bounded `describe` added in the post-v1 daemon follow-up**). `describe` returns a bounded graph summary (`target_names` ≤ 128 entries × 200 bytes, `profile` ≤ 128 bytes, 10 s evaluation timeout); `vbs daemon build` executes the lowered graph in-process against the warm state store with bounded `profile`/`targets`/`jobs`, including daemon-side dependency resolution/materialization and provider import via `Package::resolve_and_materialize_dependencies`; `vbs daemon ide query` publishes/selects the profile compilation database and serves the IDE workspace/target metadata JSON over the socket, `vbs daemon compdb export` returns the published compilation-database path and entry count, `vbs daemon ide generate` writes the editor presets over the socket, `vbs daemon ide poll` exposes a bounded editor-extension watch protocol (changed paths, sequence, overflow state), `vbs daemon ide wait` adds a bounded long-poll variant, `vbs daemon ide status` reports the active editor selection and compdb state, watch requests can be filtered by path prefix, registry endpoints answer OPTIONS with an Allow header and expose admin stats, the daemon serves structured `doctor` diagnostics, `vbs daemon compdb use` switches the active editor profile under the selection lock, `vbs daemon graph` exports the target dependency graph (DOT/JSON), `vbs daemon test` builds and runs declared test targets, `vbs tokens list|revoke` manages registry token metadata, `vbs daemon clean` removes generated outputs while preserving the shared cache, `vbs daemon target info` reports per-target sources/outputs, `vbs daemon actions` lists bounded lowered actions, `vbs daemon pack` creates a confined deterministic source archive, `vbs daemon install` stages an install prefix (and `uninstall` removes only manifest-owned files), `vbs daemon gen-tests` generates the native test registration unit, `vbs daemon init` scaffolds confined projects, `vbs daemon compdb entries` serves bounded per-file compile arguments to editor extensions, `vbs daemon workspace members` lists workspace members cheaply, `vbs daemon ide configs` reports which editor configuration files exist, `vbs daemon compdb generations` lists editor generation history with the active selection, `vbs daemon info` exposes the daemon environment, `vbs daemon deps` resolves/materializes dependencies over the socket, registry package search, user listings, and audit queries support bounded pagination/filters, releases expose a version-specific detail endpoint, package ownership and mutable metadata are managed through audited APIs, and `RegistryClient::fetch_package_owners` reads owners. Daemon workspace support describes members, builds all members in order (or a selected member) with the shared root lock, and serves member-scoped IDE query/generate/compdb requests via `--member`. Dedicated editor extensions remain planned. | `vbs ide` & `build.cpp` syntax-check verified in `FullV1Tests.cpp`; daemon lifecycle/status/gc/shutdown/describe verified in `DaemonTests.cpp` (6/6 under `dev cpp-gcc`); the live `vbs daemon describe` CLI round-trip is verified in `vbs_cli_contract`. | +| **E3 — IDE Config/Query & Background Daemon** | `build.cpp`/`build.profiles.cpp`/`build-support/` SDK entries in `compile_commands.json` + `vbs ide generate` (`.clangd`, `.vscode/`, `.zed/`, `.idea/customTargets.xml`) & `vbs ide query` (**Implemented & Verified in Wave 10**); Unix-socket daemon core holding a warm `StateStore` + project `DirectoryWatcher` with `vbs daemon run\|status\|stop\|gc\|recover\|describe` (**Implemented & Verified in Wave 14; bounded `describe` added in the post-v1 daemon follow-up**). `describe` returns a bounded graph summary (`target_names` ≤ 128 entries × 200 bytes, `profile` ≤ 128 bytes, 10 s evaluation timeout); `vbs daemon build` executes the lowered graph in-process against the warm state store with bounded `profile`/`targets`/`jobs`, including daemon-side dependency resolution/materialization and provider import via `Package::resolve_and_materialize_dependencies`; `vbs daemon ide query` publishes/selects the profile compilation database and serves the IDE workspace/target metadata JSON over the socket, `vbs daemon compdb export` returns the published compilation-database path and entry count, `vbs daemon ide generate` writes the editor presets over the socket, `vbs daemon ide poll` exposes a bounded editor-extension watch protocol (changed paths, sequence, overflow state), `vbs daemon ide wait` adds a bounded long-poll variant, `vbs daemon ide status` reports the active editor selection and compdb state, watch requests can be filtered by path prefix, registry endpoints answer OPTIONS with an Allow header and expose admin stats, the daemon serves structured `doctor` diagnostics, `vbs daemon compdb use` switches the active editor profile under the selection lock, `vbs daemon graph` exports the target dependency graph (DOT/JSON/Mermaid), `vbs lock show` prints lockfile contexts, `vbs daemon test` builds and runs declared test targets, `vbs tokens list|revoke` manages registry token metadata, `vbs daemon clean` removes generated outputs while preserving the shared cache, `vbs daemon target info` reports per-target sources/outputs, `vbs daemon actions` lists bounded lowered actions, `vbs daemon pack` creates a confined deterministic source archive, `vbs daemon install` stages an install prefix (and `uninstall` removes only manifest-owned files), `vbs daemon gen-tests` generates the native test registration unit, `vbs daemon init` scaffolds confined projects, `vbs daemon compdb entries` serves bounded per-file compile arguments to editor extensions, `vbs daemon workspace members` lists workspace members cheaply, `vbs daemon ide configs` reports which editor configuration files exist, `vbs daemon compdb generations` lists editor generation history with the active selection, `vbs daemon info` exposes the daemon environment, `vbs daemon deps` resolves/materializes dependencies over the socket, registry package search, user listings, and audit queries support bounded pagination/filters, releases expose a version-specific detail endpoint, package ownership and mutable metadata are managed through audited APIs, and `RegistryClient::fetch_package_owners` reads owners. Daemon workspace support describes members, builds all members in order (or a selected member) with the shared root lock, and serves member-scoped IDE query/generate/compdb requests via `--member`. Dedicated editor extensions remain planned. | `vbs ide` & `build.cpp` syntax-check verified in `FullV1Tests.cpp`; daemon lifecycle/status/gc/shutdown/describe verified in `DaemonTests.cpp` (6/6 under `dev cpp-gcc`); the live `vbs daemon describe` CLI round-trip is verified in `vbs_cli_contract`. | | **E4 — Transport & Storage Upstream Alignment** *(Sqlite and Net client adopted)* | Adopt `Void::Net` (`VL-004`/`VL-005`) and `Void::Sqlite` (`VL-011b`) when lightweight/bundled builds become available in minimal Nix toolchains, reducing VBS transport code further. `Void::Sqlite` backs the `StateStore` when SQLite3 is present, `Void::Net` backs the `RegistryClient`, remote-cache, and registry-server HTTP transports (TLS-verifying `HttpClient`/`HttpServer`) when `Net` is enabled (`-p openssl -p boost`), keeping the pure-POSIX fallbacks. | All `vbs_registry_tests` and `vbs_core_tests` pass on both minimal and full toolchains (verified: registry 7/7 on the Net transport; default and SQLite builds 8/8). | --- diff --git a/src/Daemon/Daemon.cpp b/src/Daemon/Daemon.cpp index 3daaa5d..e8c3fc0 100644 --- a/src/Daemon/Daemon.cpp +++ b/src/Daemon/Daemon.cpp @@ -1031,13 +1031,13 @@ std::string compdb_export_project(const DaemonOptions &options, std::string_view return serialize_response(JsonValue{std::move(object)}); } -// Renders the evaluated target dependency graph as Graphviz DOT or JSON. +// Renders the evaluated target dependency graph as Graphviz DOT, JSON or Mermaid. std::string graph_project(const DaemonOptions &options, std::string_view profile_name, std::optional compiler_override, std::string_view member, std::string_view format) { - if (format != "dot" && format != "json") { + if (format != "dot" && format != "json" && format != "mermaid") { return error_response( - std::format("graph: unsupported format '{}' (expected dot or json)", format)); + std::format("graph: unsupported format '{}' (expected dot, json or mermaid)", format)); } auto effective_result = resolve_member_options(options, member); if (!effective_result) { @@ -1070,6 +1070,28 @@ std::string graph_project(const DaemonOptions &options, std::string_view profile '}'; }); rendered += '}'; + } else if (format == "mermaid") { + // Mermaid has no escaping for quotes inside node ids/labels, so replace them. + const auto mermaid_name = [](std::string_view name) { + std::string safe{name}; + std::replace(safe.begin(), safe.end(), '"', '\''); + return safe; + }; + rendered = "flowchart LR\n"; + for (const auto &target : description.targets) { + rendered += " \"" + mermaid_name(target.name) + "\"[\"" + mermaid_name(target.name) + + " (" + std::string{target_kind_name(target.kind)} + ")\"]\n"; + } + for (const auto &target : description.targets) { + for (const auto &prerequisite : target.prerequisites) { + rendered += " \"" + mermaid_name(target.name) + "\" -.-> \"" + + mermaid_name(prerequisite) + "\"\n"; + } + for (const auto &link : target.links) { + rendered += " \"" + mermaid_name(target.name) + "\" --> \"" + + mermaid_name(link_name(link)) + "\"\n"; + } + } } else { rendered = "digraph vbs_targets {\n rankdir=LR;\n"; for (const auto &target : description.targets) { diff --git a/src/Main.cpp b/src/Main.cpp index af331cd..2494b57 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -1200,6 +1200,44 @@ int execute_tokens_command(std::string_view sub, const TokensCmdOptions &opts) { return 0; } +struct LockCmdOptions { + std::string project_arg; +}; + +int execute_lock_show_command(const LockCmdOptions &opts) { + const auto lock_path = std::filesystem::path{opts.project_arg} / "vbs.lock"; + auto pinned = Package::load_pinned_lock(lock_path); + if (!pinned) { + std::cerr << "vbs lock: " << pinned.error().message() << '\n'; + return 1; + } + if (!pinned->has_value()) { + std::cout << "no vbs.lock in " << opts.project_arg << '\n'; + return 0; + } + std::cout << "revision " << (*pinned)->revision_hash << '\n'; + for (const auto &[key, context] : (*pinned)->document.contexts) { + std::cout << "context " << key << " (profile=" << context.profile_name + << " role=" << context.machine_role << ", " << context.entries.size() + << " entrie(s))\n"; + for (const auto &entry : context.entries) { + std::cout << " " << entry.alias; + if (!entry.package_name.empty()) { + std::cout << " -> " << entry.package_name << '@' << entry.version; + } + std::cout << " [" << entry.source_kind << ']'; + if (!entry.sha256.empty()) { + std::cout << " sha256=" << entry.sha256.substr(0, 12); + } + if (entry.signature && entry.public_key) { + std::cout << " signed"; + } + std::cout << '\n'; + } + } + return 0; +} + struct ReleasesCmdOptions { std::optional registry_arg; std::optional name_arg; @@ -2441,6 +2479,7 @@ int main(int argc, char **argv) { BinariesCmdOptions binaries_opts; ReleasesCmdOptions releases_opts; TokensCmdOptions tokens_opts; + LockCmdOptions lock_opts; publish_opts.project_arg = cwd; BridgeCmdOptions bridge_opts; GcCmdOptions gc_opts; @@ -2604,6 +2643,12 @@ 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 &lock_cmd = root.subcommand("lock", "Inspect the project's vbs.lock"); + auto &lock_show_cmd = lock_cmd.subcommand("show", "Print lockfile contexts and entries"); + lock_show_cmd.option_default("--project", "-C", "Project directory", lock_opts.project_arg, + cwd); + add_log_flags(lock_show_cmd); + auto &tokens_cmd = root.subcommand("tokens", "Inspect API tokens in a package registry"); auto configure_tokens = [&](Void::Argparse::Parser &parser) { parser @@ -2920,8 +2965,8 @@ int main(int argc, char **argv) { configure_daemon_common(daemon_graph_cmd); daemon_graph_cmd .option_default("--profile", "-p", "Profile to evaluate", daemon_opts.profile_arg, "debug") - .option_default("--format", "-f", "Output format (dot|json)", daemon_opts.graph_format_arg, - "dot") + .option_default("--format", "-f", "Output format (dot|json|mermaid)", + daemon_opts.graph_format_arg, "dot") .option("--member", "", "Workspace member (required for workspace roots)", daemon_opts.member_arg); auto &daemon_ide_cmd = daemon_cmd.subcommand("ide", "Editor/IDE metadata served by the daemon"); @@ -3044,6 +3089,9 @@ int main(int argc, char **argv) { if (cmd == "tokens") { return execute_tokens_command(parsed.matched_command_path.at(1), tokens_opts); } + if (cmd == "lock") { + return execute_lock_show_command(lock_opts); + } if (cmd == "bridge") { return execute_bridge_command(bridge_opts); } diff --git a/tests/CliContracts.cmake b/tests/CliContracts.cmake index b962c68..d6e3be7 100644 --- a/tests/CliContracts.cmake +++ b/tests/CliContracts.cmake @@ -51,6 +51,8 @@ check_process(0 "Usage: vbs binaries .*Commands:.*list.*fetch" "" binar check_process(0 "Usage: vbs binaries list " "" binaries list --help) check_process(0 "Usage: vbs releases list " "" releases list --help) check_process(0 "Usage: vbs tokens list " "" tokens list --help) +check_process(0 "Usage: vbs lock show " "" lock show --help) +check_process(0 "no vbs.lock in" "" lock show --project "${CMAKE_CURRENT_BINARY_DIR}/no-lock-project") check_process(2 "" "vbs tokens: --registry is required" tokens list) check_process(0 "Usage: vbs tokens revoke .*--token-id" "" tokens revoke --help) check_process(2 "" "--registry and --name are required" releases list) diff --git a/tests/DaemonTests.cpp b/tests/DaemonTests.cpp index db88734..82fae76 100644 --- a/tests/DaemonTests.cpp +++ b/tests/DaemonTests.cpp @@ -1074,8 +1074,11 @@ VOID_TEST(Daemon, graph_exports_target_dependencies_as_json_and_dot) { descriptor << R"cpp(#include void build(Void::Build::Project &project) { + auto core = project.static_library("core"); + core.sources({"core.cpp"}); auto app = project.executable("app"); app.sources({"main.cpp"}); + app.link(core); } )cpp"; Void::Testing::require(descriptor.good()); @@ -1085,6 +1088,11 @@ void build(Void::Build::Project &project) { source << "int main() { return 0; }\n"; Void::Testing::require(source.good()); } + { + std::ofstream source{options.project_root / "core.cpp"}; + source << "int core_value() { return 0; }\n"; + Void::Testing::require(source.good()); + } auto server = Void::Build::Daemon::DaemonServer::create(options); Void::Testing::require(server.has_value()); @@ -1098,6 +1106,8 @@ void build(Void::Build::Project &project) { std::chrono::seconds{120}); auto dot_raw = Void::Build::Daemon::request(socket, R"({"op":"graph"})", std::chrono::seconds{120}); + auto mermaid_raw = Void::Build::Daemon::request(socket, R"({"op":"graph","format":"mermaid"})", + std::chrono::seconds{120}); auto invalid = request_object(socket, R"({"op":"graph","format":"xml"})", std::chrono::seconds{120}); auto shutdown = Void::Build::Daemon::request(socket, R"({"op":"shutdown"})"); @@ -1123,8 +1133,23 @@ void build(Void::Build::Project &project) { const std::string dot_graph = str_field(*dot_object, "graph"); Void::Testing::expect(dot_graph.find("digraph vbs_targets") != std::string::npos); Void::Testing::expect(dot_graph.find("\"app\"") != std::string::npos); + + Void::Testing::require(mermaid_raw.has_value()); + const auto mermaid_parsed = parse_json(*mermaid_raw); + Void::Testing::require(mermaid_parsed.has_value()); + const auto *mermaid_object = as_object(*mermaid_parsed); + Void::Testing::require(mermaid_object != nullptr); + Void::Testing::expect(bool_field(*mermaid_object, "ok")); + Void::Testing::expect_eq(str_field(*mermaid_object, "format"), std::string{"mermaid"}); + const std::string mermaid_graph = str_field(*mermaid_object, "graph"); + Void::Testing::expect(mermaid_graph.starts_with("flowchart LR")); + Void::Testing::expect(mermaid_graph.find("\"app\"[\"app (executable)\"]") != std::string::npos); + Void::Testing::expect(mermaid_graph.find("\"app\" --> \"core\"") != std::string::npos); + Void::Testing::require(invalid.has_value()); Void::Testing::expect(!bool_field(*invalid, "ok", true)); + Void::Testing::expect(str_field(*invalid, "error").find("unsupported format") != + std::string::npos); } VOID_TEST(Daemon, test_builds_and_runs_declared_tests) {