▲ | Show HN: Tree-hugger-JS: CSS selectors for JavaScript AST analysis and MCP | |
4 points by chw9e 2 days ago | ||
I built a library that lets you find code patterns using familiar CSS-like selectors, then connected it to Claude via MCP so AI assistants can understand and refactor codebases. The Approach // Find code patterns with intuitive selectors: const asyncFunctions = tree.findAll('function[async]'); const todoComments = tree.findAll('comment[text="TODO"]'); const reactHooks = tree.hooks(); // Built-in React support // Chain smart transformations: tree.transform() .rename('oldFunction', 'newFunction') .removeUnusedImports() .toString(); Key Features
-- MCP --I built an MCP server that exposes these capabilities to AI assistants. You can tell Claude:
And Claude can:1. Parse your codebase 2. Use find_all_pattern('function:has(call[text="console.log"])') 3. Extract parameter information with types 4. Give you detailed analysis Technical Details
Links:
Would love feedback from the community, especially on the MCP. |