From cbe10a8eb920427639ada12228185dfffb1b3263 Mon Sep 17 00:00:00 2001 From: joshp123 Date: Wed, 6 May 2026 15:54:29 +0200 Subject: [PATCH] Report installed OpenClaw command names Render TOOLS.md from actual package outputs instead of requested tool attrs, and include per-instance runtime packages so agent docs match the commands on PATH. Tests: nix build --accept-flake-config .#checks.aarch64-darwin.ci --no-link --- nix/modules/home-manager/openclaw/files.nix | 45 ++++++++++++++++++--- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/nix/modules/home-manager/openclaw/files.nix b/nix/modules/home-manager/openclaw/files.nix index fab0319..5ba2363 100644 --- a/nix/modules/home-manager/openclaw/files.nix +++ b/nix/modules/home-manager/openclaw/files.nix @@ -143,26 +143,57 @@ let toolsReport = if documentsEnabled then let - toolNames = toolSets.toolNames or [ ]; renderPkgName = pkg: if pkg ? pname then pkg.pname else lib.getName pkg; + renderPkgCommand = + pkg: + let + pkgName = renderPkgName pkg; + commandName = pkg.meta.mainProgram or pkgName; + in + if commandName == pkgName then commandName else "${commandName} (${pkgName})"; + toolPackages = lib.filter (p: p != null) (toolSets.tools or [ ]); renderPlugin = plugin: let - pkgNames = map renderPkgName (lib.filter (p: p != null) plugin.packages); + pkgNames = map renderPkgCommand (lib.filter (p: p != null) plugin.packages); pkgSuffix = if pkgNames == [ ] then "" else " — " + (lib.concatStringsSep ", " pkgNames); in "- " + plugin.name + pkgSuffix + " (" + plugin.source + ")"; + renderPkgList = + packages: + let + actualPackages = lib.filter (p: p != null) packages; + in + if actualPackages == [ ] then + [ "- (none)" ] + else + map (pkg: "- " + renderPkgCommand pkg) actualPackages; pluginLinesFor = instName: inst: let pluginsForInstance = plugins.resolvedPluginsByInstance.${instName} or [ ]; - lines = if pluginsForInstance == [ ] then [ "- (none)" ] else map renderPlugin pluginsForInstance; + pluginLines = + if pluginsForInstance == [ ] then [ "- (none)" ] else map renderPlugin pluginsForInstance; + runtimePackages = lib.unique ( + (lib.optional (openclawLib.qmdPackage != null) openclawLib.qmdPackage) + ++ (cfg.runtimePackages or [ ]) + ++ (inst.runtimePackages or [ ]) + ); in [ "" "### Instance: ${instName}" ] - ++ lines; + ++ [ + "" + "Plugins:" + ] + ++ pluginLines + ++ [ + "" + "Runtime packages:" + ] + ++ renderPkgList runtimePackages; reportLines = [ "" "" @@ -170,7 +201,9 @@ let "" "### Built-in toolchain" ] - ++ (if toolNames == [ ] then [ "- (none)" ] else map (name: "- " + name) toolNames) + ++ ( + if toolPackages == [ ] then [ "- (none)" ] else map (pkg: "- " + renderPkgCommand pkg) toolPackages + ) ++ [ "" "## Nix-managed plugin report" @@ -180,7 +213,7 @@ let ++ lib.concatLists (lib.mapAttrsToList pluginLinesFor enabledInstances) ++ [ "" - "Tools: batteries-included toolchain + plugin-provided CLIs." + "Tools: batteries-included toolchain + runtime packages + plugin-provided CLIs." "" "" ];