Add 15 new MCP tools to sx-tree: project-wide search, smart editing, dev workflow
New comprehension tools: - sx_find_across: search pattern across all .sx files in a directory - sx_comp_list: list all definitions (defcomp/defisland/defmacro/defpage/define) - sx_comp_usage: find all uses of a component across files - sx_diff: structural diff between two .sx files (ADDED/REMOVED/CHANGED) - sx_eval: REPL — evaluate SX expressions in the MCP server env Smart read_tree enhancements: - Auto-summarise large files (>200 lines) - focus param: expand only matching subtrees, collapse rest - max_depth/max_lines/offset for depth limiting and pagination Smart editing tools: - sx_rename_symbol: rename all occurrences of a symbol in a file - sx_replace_by_pattern: find+replace first/all pattern matches - sx_insert_near: insert before/after a pattern match (top-level) - sx_rename_across: rename symbol across all .sx files (with dry_run) - sx_write_file: create .sx files with parse validation Development tools: - sx_pretty_print: reformat .sx files with indentation (also used by all edit tools) - sx_build: build JS bundle or OCaml binary - sx_test: run test suites with structured pass/fail results - sx_format_check: lint for empty bindings, missing bodies, duplicate params - sx_macroexpand: evaluate expressions with a file's macro definitions loaded Also: updated hook to block Write on .sx files, added custom explore agent. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
27
.claude/agents/explore.md
Normal file
27
.claude/agents/explore.md
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
name: explore
|
||||
description: Explore codebase using sx-tree MCP tools for .sx files
|
||||
tools: Read, Grep, Glob, Bash, mcp__sx-tree__sx_summarise, mcp__sx-tree__sx_read_tree, mcp__sx-tree__sx_read_subtree, mcp__sx-tree__sx_find_all, mcp__sx-tree__sx_get_context, mcp__sx-tree__sx_get_siblings, mcp__sx-tree__sx_validate
|
||||
hooks:
|
||||
PreToolUse:
|
||||
- matcher: "Read"
|
||||
hooks:
|
||||
- type: command
|
||||
command: "bash .claude/hooks/block-sx-edit.sh"
|
||||
---
|
||||
|
||||
Fast codebase exploration agent. Use for finding files, searching code, and answering questions about the codebase.
|
||||
|
||||
## Critical rule for .sx and .sxc files
|
||||
|
||||
NEVER use Read on .sx or .sxc files. The hook will block it. Instead use the sx-tree MCP tools:
|
||||
|
||||
- `mcp__sx-tree__sx_summarise` — structural overview at configurable depth
|
||||
- `mcp__sx-tree__sx_read_tree` — full annotated tree with path labels
|
||||
- `mcp__sx-tree__sx_read_subtree` — expand a specific subtree by path
|
||||
- `mcp__sx-tree__sx_find_all` — search for nodes matching a pattern
|
||||
- `mcp__sx-tree__sx_get_context` — enclosing chain from root to target
|
||||
- `mcp__sx-tree__sx_get_siblings` — siblings of a node with target marked
|
||||
- `mcp__sx-tree__sx_validate` — structural integrity checks
|
||||
|
||||
For all other file types, use Read, Grep, Glob, and Bash as normal.
|
||||
7
.claude/hooks/block-sx-edit.sh
Executable file
7
.claude/hooks/block-sx-edit.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
# Block Edit/Read/Write on .sx/.sxc files — force use of sx-tree MCP tools
|
||||
FILE=$(jq -r '.tool_input.file_path // .tool_input.file // empty' 2>/dev/null)
|
||||
if [ -n "$FILE" ] && echo "$FILE" | grep -qE '\.(sx|sxc)$'; then
|
||||
printf '{"decision":"block","reason":"Use sx-tree MCP tools instead of Edit/Read/Write on .sx/.sxc files. For new files use sx_write_file, for reading use sx_read_tree/sx_summarise, for editing use sx_replace_node/sx_rename_symbol/etc. See CLAUDE.md for the protocol."}'
|
||||
exit 2
|
||||
fi
|
||||
Reference in New Issue
Block a user