Galactica:面向开发者和AI代理的TypeScript代码库地图
来源标题:Galactica, a TypeScript codebase map for developers and agents
Galactica 是一款面向开发者和 AI 代理的 TypeScript 代码库地图工具,帮助用户更直观地理解代码结构。该工具同时服务于开发者与 AI 代理两类使用场景,具体功能与发布时间等细节原文未提及。
以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。
Galactica maps imports in JavaScript and TypeScript repositories. Browse the dependency graph in an offline HTML file, or use the CLI to find what a change affects and which tests cover it.
Requires Node.js 24.1.0 or newer. From a project you trust, open a dependency map with one command.
npx @cognitap/galactica html --open
Galactica writes galactica.html in the current directory and opens it in your browser. Select a folder to see its modules, or select a file to trace what it imports and what depends on it. The map is a single HTML file you can share or open offline.
For regular use, install the CLI globally and run the same commands as galactica.
npm install -g @cognitap/galactica galactica html --open
To inspect an unfamiliar checkout, run Galactica from a trusted directory and pass --root /path/to/checkout. How Galactica reads repositories safely
Run npx @cognitap/galactica init in your own repository (or galactica init after a global install) to install the skill for Codex, Claude Code and Cursor. Ask your agent which files and tests a change could affect. The skill uses the same import graph as the HTML map and points the agent toward feature-name searches for tests loaded at runtime.
Command What it shows
overview Packages, areas and dependency layers
where <name> Definitions of a named symbol
outline <file> A file’s exports and signatures
uses <file> Importers and tests that reach the file
deps <file> The file’s dependencies
cycles Import cycles and where to break them
health Cycles, oversized areas and cross-package private imports
Add --json for structured output. Test reach follows imports, so tests that load code at runtime may need a separate search. Command reference · Configuration
We ran six tasks on Hono, Vite and NestJS with Sonnet and Opus. The clearest benefit came when agents had to name the tests that exercise an edited file in Hono or Vite.
The Hono task shows why following imports matters. Four adapter tests reach the edited function through a package import. Opus missed all four on each baseline run. With the skill instruction, it named all 12 required tests on every run.
All three conditions scored 100% on the other four tasks. Across all six, instructing the models to use Galactica increased average cost per run by 7% for Sonnet and 17% for Opus. The study covered 144 runs, four per task, model and condition. Grading checked edits statically and gave credit for required tests named. Extra tests carried no penalty, and the target test suites were never executed. Full results, method and limitations
The map was inspired by codemap. MIT licensed.
正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。