Add support for JS/TS entry point detection for LLMs#1
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TypeScript/JavaScript Entry Point Detection
Added src/agent_scan/ts_entry_points.py — a new module that detects LLM-callable functions in TypeScript and JavaScript source files using regex-based
pattern matching, without requiring a Node.js runtime. Wired into scanner.py and text_reporter.py so results appear in every scan.
Four detection patterns are covered:
after the opening parenthesis)
schema objects (Zod ToolSchema<> pattern) or returned as arrays from a factory function
File filtering skips node_modules, dist, build, .d.ts declaration files, .test.ts/.spec.ts files, and .min.js bundles. The multi-line variants for
server.tool( and setRequestHandler( use a strict 1-line lookahead — if the first argument isn't a string literal on the very next line, it's treated as
dynamic and skipped, which prevents picking up description strings as tool names.
Validated against 8 real-world TypeScript MCP repos: exa-mcp-server (9 tools), mcp-server-cloudflare (122 tools across a monorepo), mcp-server-browserbase
(9 tools), mcp-playwright (33 tools), tavily-mcp (5 tools). No false positives found in spot-checking the full 122-entry cloudflare results.
Unsupported Language Detection
When a scan finds no Python or TypeScript files, the report now detects what languages are actually present and names them. A map of 28 languages (Go,
Rust, Ruby, Java, Kotlin, Scala, C#, C++, Swift, Elixir, and more) is checked against file extensions, with standard noise directories excluded. The
output looks like:
No Python or TypeScript files were found for analysis.
Detected: Go (146 files)
agent-scan currently supports Python (full analysis) and TypeScript (entry points).
Previously the message was the same whether you scanned a Go repo or an empty directory. Now it's actionable.