From ba682e8bd1387b667f230a223f75e6ff720600ad Mon Sep 17 00:00:00 2001 From: "Aleksei (Faumaray) Selikhov" Date: Thu, 3 Dec 2026 23:34:42 +0300 Subject: [PATCH] feat(daemon): report editor configuration file presence --- docs/agent-workflow/STATE.md | 2 +- docs/agent-workflow/TASKS.md | 1 + docs/agent-workflow/VERIFICATION.md | 14 ++++++ docs/roadmap/21-expansion-roadmap.md | 2 +- src/Daemon/Daemon.cpp | 34 ++++++++++++++ src/Main.cpp | 8 ++++ tests/CliContracts.cmake | 1 + tests/DaemonTests.cpp | 67 ++++++++++++++++++++++++++++ 8 files changed, 127 insertions(+), 2 deletions(-) diff --git a/docs/agent-workflow/STATE.md b/docs/agent-workflow/STATE.md index dd21e69..0d3c107 100644 --- a/docs/agent-workflow/STATE.md +++ b/docs/agent-workflow/STATE.md @@ -173,7 +173,7 @@ Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B - Added the `compdb_entries` daemon request (`vbs daemon compdb entries [--file SUFFIX] [--limit N]`): reads the active published compilation database (selection state or root alias), returns bounded projected entries (`file`, `directory`, `output`, `command`, bounded `arguments`), reports `total`/`returned`, and errors explicitly when nothing is published. - Added `Daemon.compdb_entries_queries_published_database` (unpublished → error, then all entries, a `main.cpp` filter with `limit:1`, and an invalid limit) and a CLI help contract; Daemon suite is now 18 cases. -- **Wave 40 (Authenticated Binary-Variant Downloads)**:\n - `download_binary_artifact` now accepts `RegistryAuth` and sends the bearer token, so private registry binary artifacts can be fetched; `BinaryFetchOptions` gained `bearer_token` and `materialize_binary_variant` forwards it; `vbs binaries fetch` passes the configured token.\n - Added `RegistryTests.private_binary_variant_download_requires_auth`: anonymous download of a private binary → 401, authenticated client download and signed materialization succeed.\n\n- **Wave 41 (Yanked Binary Variants in Listing)**:\n - `fetch_binary_variants` gained `include_yanked` (default false, so selection/materialization still never sees yanked variants); `vbs binaries list` opts in and marks yanked entries while `binaries fetch` keeps the filtered view.\n - Extended the registry binary-variant test to assert the yanked variant is returned with `yanked=true` only when requested.\n\n- **Wave 42 (Registry Binary-Variant Listing Endpoint)**:\n - Added `GET /api/v1/packages///binaries` returning the release's binary variants (`variant_id`, `sha256`, `size_bytes`, `yanked`, optional signature/public key) under normal read permissions; `RegistryClient::fetch_binary_variants` now queries this endpoint directly instead of parsing package detail JSON.\n - The registry binary-variant test asserts the listing endpoint returns the published variant with `yanked:false`.\n\n- **Wave 43 (Workspace Members Request)**:\n - Added the `workspace_members` daemon request (`vbs daemon workspace members`): lists declared workspace members (`name`, canonical `path`) without evaluating member build descriptions; non-workspace roots return `workspace:false` with an empty list.\n - Added `Daemon.workspace_members_lists_declared_members` and a CLI help contract; Daemon suite is now 19 cases.\n\n## Remaining future scope +- **Wave 40 (Authenticated Binary-Variant Downloads)**:\n - `download_binary_artifact` now accepts `RegistryAuth` and sends the bearer token, so private registry binary artifacts can be fetched; `BinaryFetchOptions` gained `bearer_token` and `materialize_binary_variant` forwards it; `vbs binaries fetch` passes the configured token.\n - Added `RegistryTests.private_binary_variant_download_requires_auth`: anonymous download of a private binary → 401, authenticated client download and signed materialization succeed.\n\n- **Wave 41 (Yanked Binary Variants in Listing)**:\n - `fetch_binary_variants` gained `include_yanked` (default false, so selection/materialization still never sees yanked variants); `vbs binaries list` opts in and marks yanked entries while `binaries fetch` keeps the filtered view.\n - Extended the registry binary-variant test to assert the yanked variant is returned with `yanked=true` only when requested.\n\n- **Wave 42 (Registry Binary-Variant Listing Endpoint)**:\n - Added `GET /api/v1/packages///binaries` returning the release's binary variants (`variant_id`, `sha256`, `size_bytes`, `yanked`, optional signature/public key) under normal read permissions; `RegistryClient::fetch_binary_variants` now queries this endpoint directly instead of parsing package detail JSON.\n - The registry binary-variant test asserts the listing endpoint returns the published variant with `yanked:false`.\n\n- **Wave 43 (Workspace Members Request)**:\n - Added the `workspace_members` daemon request (`vbs daemon workspace members`): lists declared workspace members (`name`, canonical `path`) without evaluating member build descriptions; non-workspace roots return `workspace:false` with an empty list.\n - Added `Daemon.workspace_members_lists_declared_members` and a CLI help contract; Daemon suite is now 19 cases.\n\n- **Wave 44 (IDE Configs Request)**:\n - Added the `ide_configs` daemon request (`vbs daemon ide configs`): reports presence of `.clangd`, `.vscode/tasks.json`, `.zed/tasks.json`, and `.idea/customTargets.xml` so editor extensions can see what is configured.\n - Added `Daemon.ide_configs_reports_generated_files` (absent before generation, present after `ide_generate`) and a CLI help contract; Daemon suite is now 20 cases.\n\n## 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))**: 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 126e383..87207be 100644 --- a/docs/agent-workflow/TASKS.md +++ b/docs/agent-workflow/TASKS.md @@ -50,4 +50,5 @@ Base HEAD: `fe0d1a6` | Wave 41 (Yanked binary listing) | `fetch_binary_variants(include_yanked)`, `vbs binaries list` marks yanked entries, fetch stays filtered | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Registry 7/7, full CTest 8/8) | `include/Void/Build/Package/RegistryClient.hpp`, `src/Package/RegistryClient.cpp`, `src/Main.cpp`, `tests/RegistryTests.cpp`, docs | | Wave 42 (Registry binary listing endpoint) | `GET .../binaries` listing endpoint; client queries it directly | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Registry 7/7, full CTest 8/8) | `registry/service/RegistryService.cpp`, `src/Package/RegistryClient.cpp`, `tests/RegistryTests.cpp`, docs | | Wave 43 (Workspace members request) | `workspace_members` daemon request + `vbs daemon workspace members`: lightweight member listing | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Daemon 19/19, full CTest 8/8) | `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `tests/DaemonTests.cpp`, `tests/CliContracts.cmake`, docs | +| Wave 44 (IDE configs request) | `ide_configs` daemon request + `vbs daemon ide configs`: presence of editor config files | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Daemon 20/20, full CTest 8/8) | `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `tests/DaemonTests.cpp`, `tests/CliContracts.cmake`, docs | | Future (Plan 20 Slice 3 / Tracks C, E3 editor extensions, E4, live `conan`) | 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 04e7aa6..ef8ef31 100644 --- a/docs/agent-workflow/VERIFICATION.md +++ b/docs/agent-workflow/VERIFICATION.md @@ -745,6 +745,20 @@ dev cpp-gcc -c ctest --test-dir build/pinned --output-on-failure - Full CTest: **8 / 8 passed** in 222.06 s. - `clang-format --dry-run --Werror` passes on the changed C++ files. +## IDE Configs Request (GCC 16.2, pin `0002e74`) + +```sh +dev cpp-gcc -c cmake --build build/pinned --parallel 8 +dev cpp-gcc -c build/pinned/bin/vbs_v1_tests --suite Daemon --no-color +dev cpp-gcc -c ctest --test-dir build/pinned --output-on-failure +``` + +- Build: exit 0. Daemon suite: **20 / 20 passed** in 41.45 s, including + `ide_configs_reports_generated_files`: `.clangd` is reported absent before generation and + `exists:true` after `ide_generate`. +- Full CTest: **8 / 8 passed** in 228.03 s. +- `clang-format --dry-run --Werror` passes on the changed C++ files. + ## 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 4cb4e75..3005a09 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, `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 daemon compdb entries` serves bounded per-file compile arguments to editor extensions, and `vbs daemon workspace members` lists workspace members cheaply. 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, `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 daemon compdb entries` serves bounded per-file compile arguments to editor extensions, `vbs daemon workspace members` lists workspace members cheaply, and `vbs daemon ide configs` reports which editor configuration files exist. 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** | 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. | All `vbs_registry_tests` and `vbs_core_tests` pass on both minimal and full toolchains. | --- diff --git a/src/Daemon/Daemon.cpp b/src/Daemon/Daemon.cpp index 5a33964..2e21e56 100644 --- a/src/Daemon/Daemon.cpp +++ b/src/Daemon/Daemon.cpp @@ -950,6 +950,37 @@ std::string graph_project(const DaemonOptions &options, std::string_view profile ",\"graph\":" + Util::json_quote(rendered) + '}'; } +// Reports which editor configuration files are present for the project. +std::string ide_configs_project(const DaemonOptions &options) { + struct ConfigEntry { + std::string_view editor; + std::string_view relative_path; + }; + constexpr ConfigEntry entries[] = { + {"clangd", ".clangd"}, + {"vscode", ".vscode/tasks.json"}, + {"zed", ".zed/tasks.json"}, + {"clion", ".idea/customTargets.xml"}, + }; + + JsonValue::Array configs; + for (const auto &entry : entries) { + std::error_code ec; + const bool exists = std::filesystem::exists(options.project_root / entry.relative_path, ec); + JsonValue::Object item; + item.emplace("editor", JsonValue{std::string{entry.editor}}); + item.emplace("path", JsonValue{std::string{entry.relative_path}}); + item.emplace("exists", JsonValue{exists}); + configs.emplace_back(std::move(item)); + } + + JsonValue::Object object; + object.emplace("ok", JsonValue{true}); + object.emplace("op", JsonValue{std::string{"ide_configs"}}); + object.emplace("configs", JsonValue{std::move(configs)}); + return serialize_response(JsonValue{std::move(object)}); +} + // Lists declared workspace members without evaluating their build descriptions. std::string workspace_members_project(const DaemonOptions &options) { JsonValue::Object object; @@ -1468,6 +1499,9 @@ DaemonServer::Impl::DispatchResult DaemonServer::Impl::dispatch(std::string_view if (*name == "workspace_members") { return {workspace_members_project(options), false}; } + if (*name == "ide_configs") { + return {ide_configs_project(options), false}; + } if (*name == "compdb_entries") { std::string file_filter; if (const auto entry = object->find("file"); entry != object->end()) { diff --git a/src/Main.cpp b/src/Main.cpp index aa06611..686963d 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -1567,6 +1567,8 @@ int execute_daemon_command(std::string_view sub, const DaemonCmdOptions &opts) { request_json = R"({"op":"editor_status"})"; } else if (sub == "workspace_members") { request_json = R"({"op":"workspace_members"})"; + } else if (sub == "ide_configs") { + request_json = R"({"op":"ide_configs"})"; } else if (sub == "compdb_entries") { request_json = std::format(R"({{"op":"compdb_entries","limit":{}{}}})", opts.limit_arg, @@ -2690,6 +2692,9 @@ int main(int argc, char **argv) { auto &daemon_ide_status_cmd = daemon_ide_cmd.subcommand("status", "Report the active editor selection and compdb state"); configure_daemon_common(daemon_ide_status_cmd); + auto &daemon_ide_configs_cmd = + daemon_ide_cmd.subcommand("configs", "Report which editor configuration files exist"); + configure_daemon_common(daemon_ide_configs_cmd); auto &daemon_ide_poll_cmd = daemon_ide_cmd.subcommand( "poll", "Poll pending project file changes (editor extension protocol)"); configure_daemon_common(daemon_ide_poll_cmd); @@ -2831,6 +2836,9 @@ int main(int argc, char **argv) { } else if (daemon_sub == "workspace" && parsed.matched_command_path.size() > 2 && parsed.matched_command_path[2] == "members") { daemon_sub = "workspace_members"; + } else if (daemon_sub == "ide" && parsed.matched_command_path.size() > 2 && + parsed.matched_command_path[2] == "configs") { + daemon_sub = "ide_configs"; } return execute_daemon_command(daemon_sub, daemon_opts); } diff --git a/tests/CliContracts.cmake b/tests/CliContracts.cmake index 2e1ca9f..73d830f 100644 --- a/tests/CliContracts.cmake +++ b/tests/CliContracts.cmake @@ -66,6 +66,7 @@ check_process(0 "Usage: vbs daemon ide status " "" daemon ide status --help) check_process(0 "Usage: vbs daemon graph .*--format" "" daemon graph --help) check_process(0 "Usage: vbs daemon test .*--profile.*--target.*--jobs" "" daemon test --help) check_process(0 "Usage: vbs daemon workspace members " "" daemon workspace members --help) +check_process(0 "Usage: vbs daemon ide configs " "" daemon ide configs --help) check_process(0 "Usage: vbs daemon ide wait .*--timeout-ms" "" daemon ide wait --help) check_process(2 "" "missing subcommand for 'vbs daemon'" daemon) diff --git a/tests/DaemonTests.cpp b/tests/DaemonTests.cpp index c414396..b178c2e 100644 --- a/tests/DaemonTests.cpp +++ b/tests/DaemonTests.cpp @@ -1021,6 +1021,73 @@ VOID_TEST(Daemon, workspace_members_lists_declared_members) { Void::Testing::expect(raw->find("packages/lib") != std::string::npos); } +VOID_TEST(Daemon, ide_configs_reports_generated_files) { + auto temp = Void::FileSystem::TempDir::open("vbs_daemon_"); + Void::Testing::require(temp.has_value()); + const auto options = make_options(temp->path()); + + { + std::ofstream descriptor{options.project_root / "build.cpp"}; + descriptor << R"cpp(#include + +void build(Void::Build::Project &project) { + auto app = project.executable("app"); + app.sources({"main.cpp"}); +} +)cpp"; + Void::Testing::require(descriptor.good()); + } + { + std::ofstream source{options.project_root / "main.cpp"}; + source << "int main() { return 0; }\n"; + Void::Testing::require(source.good()); + } + + auto server = Void::Build::Daemon::DaemonServer::create(options); + Void::Testing::require(server.has_value()); + const auto socket = server->socket_path(); + + Void::Result::Result run_result; + std::jthread worker{[&] { run_result = server->run(); }}; + Void::Testing::require(wait_for_path(socket, std::chrono::seconds{5})); + + auto before = request_object(socket, R"({"op":"ide_configs"})"); + Void::Testing::require(before.has_value()); + Void::Testing::expect(bool_field(*before, "ok")); + Void::Testing::expect(!std::filesystem::exists(options.project_root / ".clangd")); + + auto generated = + request_object(socket, R"({"op":"ide_generate","editor":"clangd","force":true})", + std::chrono::seconds{120}); + Void::Testing::require(generated.has_value()); + Void::Testing::expect(bool_field(*generated, "ok")); + + auto after = request_object(socket, R"({"op":"ide_configs"})"); + Void::Testing::require(after.has_value()); + Void::Testing::expect(bool_field(*after, "ok")); + const auto *configs = field(*after, "configs"); + Void::Testing::require(configs != nullptr); + const auto *config_array = std::get_if(&configs->value); + Void::Testing::require(config_array != nullptr); + bool saw_clangd = false; + for (const auto &item : *config_array) { + const auto *entry = std::get_if(&item.value); + if (entry == nullptr) { + continue; + } + if (str_field(*entry, "editor") == "clangd") { + saw_clangd = true; + Void::Testing::expect(bool_field(*entry, "exists")); + } + } + Void::Testing::expect(saw_clangd); + + auto shutdown = Void::Build::Daemon::request(socket, R"({"op":"shutdown"})"); + Void::Testing::expect(shutdown.has_value()); + worker.join(); + Void::Testing::expect(run_result.has_value()); +} + VOID_TEST(Daemon, describe_empty_project_reports_zero_targets) { auto temp = Void::FileSystem::TempDir::open("vbs_daemon_"); Void::Testing::require(temp.has_value());