
Status.pudu
Pudu33 lines1.5 KB
1/** @App.Tools.Status.Handler — reports the toolchain and server state */2module PuduLangMcp.App.Tools.Status34import Std.Option as Option5import Std.Result as Result6import Std.Sync as Sync7import PuduLangMcp.App.Context as Context8import PuduLangMcp.Constants.Server as Server9import PuduLangMcp.Domain.Catalog.Arguments as Arguments10import PuduLangMcp.Errors.ToolError as ToolError111213export fn toolchain(context: &Context.Context, args: &Arguments.Args) -> Result[Str, ToolError.ToolFailure] {14 let compiler = match context.toolchain.compiler {15 case Some(path) => path + " (" + (if context.toolchain.version.isEmpty() { "version unknown" } else { "pudu " + context.toolchain.version }) + ")"16 case None => "not found. " + ToolError.explain(&ToolError.ToolchainMissing)17 }18 let index = match Result.unwrapOr(Sync.get(&context.index), Context.Broken("unreadable")) {19 case Context.Building => "building"20 case Context.Ready(entries) => "ready, " + show(entries.length()) + " public declarations"21 case Context.Broken(reason) => "unavailable: " + reason22 }23 Ok([24 "server: " + Server.SERVER_NAME + " " + Server.SERVER_VERSION,25 "compiler: " + compiler,26 "standard library: " + Option.unwrapOr(context.toolchain.library, "not found"),27 "workspace: " + context.workspace.root,28 "importable modules: " + show(context.moduleFiles.length()),29 "reference index: " + index,30 "documentation: " + show(context.chapters.length()) + " documents, revision " + context.docsRevision31 ].join("\n"))32}33