From d3ecd820040ff14a4334a30135620b72dedde501 Mon Sep 17 00:00:00 2001 From: zhangsan <15572837359@163.com> Date: Mon, 15 Jun 2026 21:08:26 +0800 Subject: [PATCH] =?UTF-8?q?fix(config):=20=E4=BF=AE=E5=A4=8D=20shell=20?= =?UTF-8?q?=E8=A7=A3=E9=87=8A=E5=99=A8=E5=88=87=E6=8D=A2=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E6=8C=81=E4=B9=85=E5=8C=96=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RenderTOMLForScope 渲染 [tools] 段时没有输出 [tools.shell], 导致用户切换 shell 后配置保存到磁盘时丢失,重启后回到 auto。 添加 [tools.shell] 的 prefer 和 path 字段序列化。 Fixes #4447 --- internal/config/render.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/internal/config/render.go b/internal/config/render.go index b1b9c74e4..4d1d75989 100644 --- a/internal/config/render.go +++ b/internal/config/render.go @@ -299,6 +299,19 @@ func RenderTOMLForScope(c *Config, scope RenderScope) string { } fmt.Fprintf(&b, "bash_timeout_seconds = %d # foreground safety cap; set 0 for no tool-local cap\n\n", c.BashTimeoutSeconds()) + b.WriteString("[tools.shell]\n") + if c.Tools.Shell.Prefer != "" { + fmt.Fprintf(&b, "prefer = %q\n", c.Tools.Shell.Prefer) + } else { + b.WriteString("# prefer = \"\" # auto | bash | powershell | pwsh\n") + } + if c.Tools.Shell.Path != "" { + fmt.Fprintf(&b, "path = %q\n", c.Tools.Shell.Path) + } else { + b.WriteString("# path = \"\" # empty = probe standard locations\n") + } + b.WriteString("\n") + b.WriteString("[codegraph]\n") fmt.Fprintf(&b, "enabled = %v # built-in MCP server; off by default for first-run sessions\n", c.Codegraph.Enabled) fmt.Fprintf(&b, "auto_install = %v # fetch the runtime when CodeGraph is enabled but missing\n", c.Codegraph.AutoInstall)