nowfound

AI · June 20, 2025

TH

Tree-hugger-JS: CSS selectors for JavaScript AST analysis and MCP

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 - CSS-like…

What it does

In the maker’s words, at launch

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 - CSS-like selectors: function[async], class:has(method), call[text*="fetch"] - Semantic aliases: function matches declarations, expressions, arrows, and methods - Smart transformations: Rename identifiers, remove unused imports, insert code - Built-in queries: functions, classes, imports, React hooks, JSX components - TypeScript support: Full parameter extraction with types - Scope analysis: Track variable bindings and references -- MCP -- I built an MCP server that exposes these capabilities to AI assistants. You can tell Claude: "Find all functions that use console.log and show me their parameters" 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 - Built on tree-sitter for correctness and performance - 13 MCP tools for comprehensive code analysis - Supports JavaScript, TypeScript, JSX, TSX - Pattern parser converts CSS selectors to AST predicates - Stateful MCP server maintains analysis context Links: - Library: https://github.com/qckfx/tree-hugger-js - MCP Server: https://github.com/qckfx/tree-hugger-js-mcp - NPM: npm install tree-hugger-js - Claude Code: claude mcp add tree-hugger-js-mcp npx tree-hugger-js-mcp Would love feedback from the community, especially on the MCP.

Does the same job

all alternatives →

More ai this month

the category →
  • I trained a 125M-parameter transformer to autocomplete piano performances in real time (~108 notes/sec on an iPhone 15). The idea is basically GitHub Copilot or Tabnine, except instead of prompting it with code, you prompt it by playing a few notes on a MIDI piano. The model then continues what you played, entirely on-device. The app is free if anyone wants to try it. Happy to answer questions about the model, training, Core ML, or the many things that didn't work.

    AI · 17d ago · simedw.com

  • Astute585

    Automate your B2B brand going viral, with new media creators

    AI · 18d ago · company-app.joinastute.com

  • Grok Bot547

    AI teammates that you can give real work to

    AI · 25d ago · x.ai

  • Hey HN, Henry from Cactus here! We previously released Cactus Needle, a 14MB agentic LLM for tool call, device use, and structured extraction for phones, wearables, smart homes, small robots and microcontrollers. We got really great feedback here, and have now incorporated the suggestions to release Needle 2. The whole model is a single 14MB binary that runs a full session in 28MB of RAM; 45m parameters at 2bit compression. Needle hits 500 tokens/sec decode speed on a Raspberry Pi 5, sits between 400-1,500 tokens/sec on VR devices like Meta Quest 3S and Apple Vision Pro, and ranges…

    AI · 26d ago · cactuscompute.com

  • Make your software self-driving

    AI · 30d ago · coldtea.ai

  • Soloop472

    Approval-first Agent OS for solo founders

    AI · 30d ago · soloop.io

Launched alongside, June 2025

the whole month →
  • IM

    Hey HN! Pilots everywhere are required to keep a logbook of all their flying hours, aircraft, airports, and so on. Since I track everything digitally (some people still just use paper logbooks!), I put together some data visualizations and a few 3D globes to show my flying history. This globe is probably my favourite so far: https://jameshard.ing/pilot/globes/all If you’ve got ideas for other graphs or ways to show this kind of data, I’d love to hear them!

    Life & fun · 2025 · jameshard.ing

  • Stunning presentations with AI. No design skills required.

    AI · 2025 · chroniclehq.com

  • Build native mobile apps for iOS and Android without code.

    Dev tools · 2025 · bble.io

  • Twenty991

    The #1 open-source CRM

    Dev tools · 2025 · twenty.com

  • All your connections, across all your socials.

    AI · 2025 · pally.com

  • WC

    I was the main contributor to workout.lol, an open-source fitness app to easily build a workout routine. The project had traction (1.4k GitHub stars, 95 forks, ~20K visits/month), but was eventually sold due to video licensing hurdles. The new owner stopped maintaining it, and the repo went abandoned. Over the next 9 months, I sent 15 emails to try to save it : no replies. Feature requests & issues were ignored. The community was left with a "broken" tool let's say. I couldn't just let it die So I built the new version from scratch with the same open-source spirit, but a better…

    Dev tools · 2025 · github.com