claude-code: drop what was removed while away, render one at a time, refuse an empty settings set

Review of the nox-mesh plugin: a watch hands over what is there, not what
went, so the view is pruned to the state's keys before it starts; the
watches and the tools render one at a time, as the home's record is read
and written whole; the register answer names how an item is offered.
This commit is contained in:
jochen
2026-10-05 14:25:10 +02:00
parent dd1035a27d
commit 1d8f1ceff8
5 changed files with 70 additions and 2 deletions
@@ -157,6 +157,9 @@ func configTools(p Paths, state ConfigState, view *ConfigView) []stdio.Tool {
},
Run: func(a map[string]any) (any, error) {
given, _ := a["settings"].(map[string]any)
if len(given) == 0 {
return nil, errors.New("no settings given; to remove a scope's settings, claude_code_settings_clear")
}
return SetSettings(p, scopeOf(a), nodesOf(a["nodes"]), func(held map[string]any) map[string]any {
if boolArg(a, "replace") {
return given
@@ -191,6 +194,9 @@ func configTools(p Paths, state ConfigState, view *ConfigView) []stdio.Tool {
return SetSettings(p, scopeOf(a), nodesOf(a["nodes"]), func(held map[string]any) map[string]any {
perms, _ := held["permissions"].(map[string]any)
rules, _ := perms[list].([]any)
if len(rules) == 0 {
return held // nothing to remove: what the scope holds stays as it is
}
kept := []any{}
for _, r := range rules {
if r != rule {