claude-code: read and remove the person's own home items through the mesh
Hand-written items in an account's ~/.claude could only be removed over a shell on the machine. claude_code_home_show reads one in full (memory, ~/.claude/CLAUDE.md, included); claude_code_home_remove removes one on the person's word, with a required reason, refusing what the mesh placed and symbolic links, keeping a dated copy in the module's state and logging it.
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
stdio "git.novox.be/novox/mesh-sdk/go"
|
||||
)
|
||||
@@ -247,7 +248,7 @@ func configTools(p Paths, state ConfigState, view *ConfigView) []stdio.Tool {
|
||||
Input: map[string]any{"key": str("the key")},
|
||||
Run: func(a map[string]any) (any, error) { return Show(state, strArg(a, "key")) }},
|
||||
stdio.Tool{Name: "claude_code_config_status",
|
||||
Description: "Claude Code's configuration on this node: what was registered and applies here (mesh, node, home), the plugin as written, and the home's own skills, subagents, commands, output styles and rule files — which the mesh placed, which share a name with a mesh item, and which call tools of a tool server not loaded here (stale).",
|
||||
Description: "Claude Code's configuration on this node: what was registered and applies here (mesh, node, home), the plugin as written, and the home's own skills, subagents, commands, output styles, rule files and memory (CLAUDE.md) — which the mesh placed, which share a name with a mesh item, and which call tools of a tool server not loaded here (stale).",
|
||||
Run: func(map[string]any) (any, error) {
|
||||
c := ConfigOf(view.Items())
|
||||
names := func(items []Item) []string {
|
||||
@@ -301,6 +302,33 @@ func configTools(p Paths, state ConfigState, view *ConfigView) []stdio.Tool {
|
||||
}
|
||||
return Register(p, it, nodes, false, state, view, writeManaged)
|
||||
}},
|
||||
stdio.Tool{Name: "claude_code_home_show",
|
||||
Description: "One item of this node's operator account's own ~/.claude in full, as the status tool lists it — a skill (every file in its folder), subagent, command, output style or rule file — or the account's own memory, ~/.claude/CLAUDE.md: where it is, whether the mesh placed it, and its content.",
|
||||
Input: map[string]any{
|
||||
"kind": str("skill, agent, command, output-style, instructions (a rule file) or memory (~/.claude/CLAUDE.md)"),
|
||||
"name": str("its name in the home: the skill's folder, or the file without .md; absent for memory"),
|
||||
},
|
||||
Run: func(a map[string]any) (any, error) { return ShowHome(p, strArg(a, "kind"), strArg(a, "name")) }},
|
||||
stdio.Tool{Name: "claude_code_home_remove",
|
||||
Description: "Remove one item the person made in this node's operator account's own ~/.claude — a skill, subagent, command, output style, rule file, or the memory ~/.claude/CLAUDE.md — on the person's word: removing it is the person's act, and this tool is that act made explicit. Called only when the person asked for that item to go, never on the agent's own judgement. `why` is required. An item the mesh placed is refused (its unregister owns it). A copy is kept first in the module's state, under removed-from-home/<date>/, and the removal and its reason are logged there; the answer says where the copy is, so it can be put back.",
|
||||
Input: map[string]any{
|
||||
"kind": str("skill, agent, command, output-style, instructions (a rule file) or memory (~/.claude/CLAUDE.md)"),
|
||||
"name": str("its name in the home: the skill's folder, or the file without .md; absent for memory"),
|
||||
"why": str("the person's reason for removing it, kept in the log"),
|
||||
},
|
||||
Run: func(a map[string]any) (any, error) {
|
||||
answer, err := RemoveHome(p, strArg(a, "kind"), strArg(a, "name"), strArg(a, "why"), time.Now())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// A home registration of the same name was held back by the person's file; it is placed now.
|
||||
for _, it := range ConfigOf(view.Items()).Home {
|
||||
if it.Kind == answer["kind"] && it.Name == answer["name"] {
|
||||
answer["then"] = "the mesh registers a " + it.Kind + " of this name for this home; it is placed at the next render"
|
||||
}
|
||||
}
|
||||
return answer, nil
|
||||
}},
|
||||
)
|
||||
return out
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user