fix: reflect actual configured list of banned tools in tool description

tauraamui created

Change summary

crush.json                   | 40 --------------------------------------
internal/agent/tools/bash.go |  7 +++--
2 files changed, 4 insertions(+), 43 deletions(-)

Detailed changes

crush.json 🔗

@@ -1,40 +0,0 @@
-{
-  "$schema": "https://charm.land/crush.json",
-  "lsp": {
-    "gopls": {
-      "options": {
-        "gofumpt": true,
-        "codelenses": {
-          "gc_details": true,
-          "generate": true,
-          "run_govulncheck": true,
-          "test": true,
-          "tidy": true,
-          "upgrade_dependency": true
-        },
-        "hints": {
-          "assignVariableTypes": true,
-          "compositeLiteralFields": true,
-          "compositeLiteralTypes": true,
-          "constantValues": true,
-          "functionTypeParameters": true,
-          "parameterNames": true,
-          "rangeVariableTypes": true
-        },
-        "analyses": {
-          "nilness": true,
-          "unusedparams": true,
-          "unusedvariable": true,
-          "unusedwrite": true,
-          "useany": true
-        },
-        "staticcheck": true,
-        "directoryFilters": [
-          "-.git",
-          "-node_modules"
-        ],
-        "semanticTokens": true
-      }
-    }
-  }
-}

internal/agent/tools/bash.go 🔗

@@ -139,8 +139,9 @@ var defaultBannedCommands = []string{
 	"ufw",
 }
 
-func bashDescription(attribution *config.Attribution, modelName string) string {
-	bannedCommandsStr := strings.Join(defaultBannedCommands, ", ")
+func bashDescription(attribution *config.Attribution, modelName string, bashConfig config.ToolBash) string {
+	bannedCommandsList := resolveBannedCommandsList(bashConfig)
+	bannedCommandsStr := strings.Join(bannedCommandsList, ", ")
 	var out bytes.Buffer
 	if err := bashDescriptionTpl.Execute(&out, bashDescriptionData{
 		BannedCommands:  bannedCommandsStr,
@@ -219,7 +220,7 @@ func NewBashTool(
 ) fantasy.AgentTool {
 	return fantasy.NewAgentTool(
 		BashToolName,
-		string(bashDescription(attribution, modelName)),
+		string(bashDescription(attribution, modelName, bashConfig)),
 		func(ctx context.Context, params BashParams, call fantasy.ToolCall) (fantasy.ToolResponse, error) {
 			if params.Command == "" {
 				return fantasy.NewTextErrorResponse("missing command"), nil