feat(registry,daemon): patch package metadata; report workspace info
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 3s
VoidBuildSystem CI / signing-openssl-gcc16 (push) Failing after 10s

This commit is contained in:
faumaray committed 2026-12-04 06:13:13 +03:00
1 parent 85ff7a8c75
commit e7698a411d
8 files changed
+250 -4

No files matched your search

+49
View File
@@ -1481,6 +1481,52 @@ std::string workspace_members_project(const DaemonOptions &options) {
return serialize_response(JsonValue{std::move(object)});
}
// Reports workspace membership plus the root lockfile state (presence and size). Non-workspace
// roots report no members and a null lockfile; workspace roots stat <lock root>/vbs.lock.
std::string workspace_info_project(const DaemonOptions &options) {
JsonValue::Object object;
object.emplace("ok", JsonValue{true});
object.emplace("op", JsonValue{std::string{"workspace_info"}});
if (!Config::is_workspace_root(options.project_root)) {
object.emplace("workspace", JsonValue{false});
object.emplace("members", JsonValue{JsonValue::Array{}});
object.emplace("lockfile", JsonValue{nullptr});
return serialize_response(JsonValue{std::move(object)});
}
auto members = evaluate_workspace_members(options);
if (!members) {
return error_response(members.error());
}
JsonValue::Array member_array;
for (const auto &member : *members) {
JsonValue::Object entry;
entry.emplace("name", JsonValue{member.name});
entry.emplace("path", JsonValue{member.path.string()});
member_array.emplace_back(std::move(entry));
}
const auto lock_root = options.lock_root.empty() ? options.project_root : options.lock_root;
const auto lockfile_path = lock_root / "vbs.lock";
std::error_code ec;
const bool lockfile_exists = std::filesystem::is_regular_file(lockfile_path, ec);
std::int64_t lockfile_size = 0;
if (lockfile_exists) {
const auto size = std::filesystem::file_size(lockfile_path, ec);
if (!ec) {
lockfile_size = static_cast<std::int64_t>(size);
}
}
JsonValue::Object lockfile;
lockfile.emplace("path", JsonValue{lockfile_path.string()});
lockfile.emplace("exists", JsonValue{lockfile_exists});
lockfile.emplace("size_bytes", JsonValue{lockfile_size});
object.emplace("workspace", JsonValue{true});
object.emplace("members", JsonValue{std::move(member_array)});
object.emplace("lockfile", JsonValue{std::move(lockfile)});
return serialize_response(JsonValue{std::move(object)});
}
// Returns bounded compile_commands entries from the active compilation database, optionally
// filtered by a path suffix. Editor extensions use this instead of parsing the file themselves.
std::string compdb_entries_project(const DaemonOptions &options, std::string_view file_filter,
@@ -2021,6 +2067,9 @@ DaemonServer::Impl::DispatchResult DaemonServer::Impl::dispatch(std::string_view
if (*name == "workspace_members") {
return {workspace_members_project(options), false};
}
if (*name == "workspace_info") {
return {workspace_info_project(options), false};
}
if (*name == "ide_configs") {
return {ide_configs_project(options), false};
}