feat(daemon): expose environment info for editor extensions
This commit is contained in:
1 parent
ad3f4725ef
commit
9a6f209f5b
8 files changed
+67
-2
No files matched your search
@@ -1670,6 +1670,22 @@ DaemonServer::Impl::DispatchResult DaemonServer::Impl::dispatch(std::string_view
|
||||
object.emplace("rescan_required", JsonValue{batch->rescan_required});
|
||||
return {serialize_response(JsonValue{std::move(object)}), false};
|
||||
}
|
||||
if (*name == "info") {
|
||||
JsonValue::Object object;
|
||||
object.emplace("ok", JsonValue{true});
|
||||
object.emplace("op", JsonValue{std::string{"info"}});
|
||||
object.emplace("version", JsonValue{std::string{Bootstrap::version}});
|
||||
object.emplace("os", JsonValue{std::string{Bootstrap::os}});
|
||||
object.emplace("architecture", JsonValue{std::string{Bootstrap::architecture}});
|
||||
object.emplace("project_root", JsonValue{options.project_root.string()});
|
||||
object.emplace("build_root", JsonValue{options.build_root.string()});
|
||||
object.emplace(
|
||||
"lock_root",
|
||||
JsonValue{
|
||||
(options.lock_root.empty() ? options.project_root : options.lock_root).string()});
|
||||
object.emplace("socket", JsonValue{socket_path.string()});
|
||||
return {serialize_response(JsonValue{std::move(object)}), false};
|
||||
}
|
||||
if (*name == "editor_status") {
|
||||
return {editor_status_project(options), false};
|
||||
}
|
||||
|
||||
@@ -1563,6 +1563,8 @@ int execute_daemon_command(std::string_view sub, const DaemonCmdOptions &opts) {
|
||||
request_json = std::format(R"({{"op":"graph","profile":{},"format":{}}})",
|
||||
Util::json_quote(opts.profile_arg),
|
||||
Util::json_quote(opts.graph_format_arg));
|
||||
} else if (sub == "info") {
|
||||
request_json = R"({"op":"info"})";
|
||||
} else if (sub == "editor_status") {
|
||||
request_json = R"({"op":"editor_status"})";
|
||||
} else if (sub == "workspace_members") {
|
||||
@@ -2683,6 +2685,9 @@ int main(int argc, char **argv) {
|
||||
.option_default("--profile", "-p", "Profile to export", daemon_opts.profile_arg, "debug")
|
||||
.option("--member", "", "Workspace member (required for workspace roots)",
|
||||
daemon_opts.member_arg);
|
||||
auto &daemon_info_cmd =
|
||||
daemon_cmd.subcommand("info", "Show daemon paths, version, and host facts");
|
||||
configure_daemon_common(daemon_info_cmd);
|
||||
auto &daemon_deps_cmd =
|
||||
daemon_cmd.subcommand("deps", "Resolve and materialize dependencies via the daemon");
|
||||
configure_daemon_common(daemon_deps_cmd);
|
||||
|
||||
Reference in new issue
Block a user