ワンクリックで
gitnexus-explorer
Serve an interactive codebase knowledge graph web UI.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Serve an interactive codebase knowledge graph web UI.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Query and edit a SiYuan knowledge base via its API.
Create, read, edit Excel .xlsx spreadsheets and CSVs.
Create, read, edit Excel .xlsx spreadsheets and CSVs.
Curate LLM training data: dedupe, filter, PII redaction.
Scrape sites with stealth browsing and Cloudflare bypass.
Clean training loops with built-in distributed support.
| name | gitnexus-explorer |
| description | Serve an interactive codebase knowledge graph web UI. |
| version | 1.0.0 |
| author | Hermes Agent + Teknium |
| license | MIT |
| platforms | ["linux","macos","windows"] |
| metadata | {"hermes":{"tags":["gitnexus","code-intelligence","knowledge-graph","visualization"],"related_skills":["native-mcp","codebase-inspection"]}} |
可将任意代码库索引到知识图中,并提供一个交互式网页界面,用于查看符号、调用链、聚类以及执行流程。通过 Cloudflare 建立隧道以实现远程访问。
.git 目录网页界面会在浏览器中渲染所有节点。文件数量在 5,000 个以内的代码仓库使用效果最佳。对于大型代码仓库(节点数超过 30,000 个),页面加载速度会变慢,甚至可能导致浏览器标签页崩溃。CLI/MCP 工具则不受此限制,可处理任意规模的代码库——仅有网页可视化存在该限制。
GITNEXUS_DIR="${GITNEXUS_DIR:-$HOME/.local/share/gitnexus}"
if [ ! -d "$GITNEXUS_DIR/gitnexus-web/dist" ]; then
git clone https://github.com/abhigyanpatwari/GitNexus.git "$GITNEXUS_DIR"
cd "$GITNEXUS_DIR/gitnexus-shared" && npm install && npm run build
cd "$GITNEXUS_DIR/gitnexus-web" && npm install
fi
Web UI 在进行 API 调用时默认使用 localhost:4747。需对其进行修改,使其遵循同源策略,从而能够通过隧道/代理正常工作:
**文件路径:`$
export const DEFAULT_BACKEND_URL = 'http://localhost:4747';
收件人:
export const DEFAULT_BACKEND_URL = typeof window !== 'undefined' && window.location.hostname !== 'localhost' ? window.location.origin : 'http://localhost:4747';
**文件:`$
server: {
allowedHosts: true,
// ... existing config
},
接着构建生产环境版本包:
cd "$GITNEXUS_DIR/gitnexus-web" && npx vite build
cd /path/to/target-repo
npx gitnexus analyze --skip-agents-md
rm -rf .claude/ # remove Claude Code-specific artifacts
如需进行语义搜索,请添加 --embeddings 参数(但速度会变慢,从秒级变为分钟级)。
索引文件存储在仓库内的 .gitnexus/ 目录中,并会被自动标记为忽略文件。
将该脚本内容写入一个文件中(例如 $GITNEXUS_DIR/proxy.mjs)。该脚本用于提供正式版网页界面,同时将 /api/* 路由转发至 GitNexus 后端——由于同源策略的保障,无需处理 CORS 问题,也不需要使用 sudo 权限或 nginx 服务器。
import http from 'node:http';
import fs from 'node:fs';
import path from 'node:path';
const API_PORT = parseInt(process.env.API_PORT || '4747');
const DIST_DIR = process.argv[2] || './dist';
const PORT = parseInt(process.argv[3] || '8888');
const MIME = {
'.html': 'text/html', '.js': 'application/javascript', '.css': 'text/css',
'.json': 'application/json', '.png': 'image/png', '.svg': 'image/svg+xml',
'.ico': 'image/x-icon', '.woff2': 'font/woff2', '.woff': 'font/woff',
'.wasm': 'application/wasm',
};
function proxyToApi(req, res) {
const opts = {
hostname: '127.0.0.1', port: API_PORT,
path: req.url, method: req.method, headers: req.headers,
};
const proxy = http.request(opts, (upstream) => {
res.writeHead(upstream.statusCode, upstream.headers);
upstream.pipe(res, { end: true });
});
proxy.on('error', () => { res.writeHead(502); res.end('Backend unavailable'); });
req.pipe(proxy, { end: true });
}
function serveStatic(req, res) {
let filePath = path.join(DIST_DIR, req.url === '/' ? 'index.html' : req.url.split('?')[0]);
if (!fs.existsSync(filePath)) filePath = path.join(DIST_DIR, 'index.html');
const ext = path.extname(filePath);
const mime = MIME[ext] || 'application/octet-stream';
try {
const data = fs.readFileSync(filePath);
res.writeHead(200, { 'Content-Type': mime, 'Cache-Control': 'public, max-age=3600' });
res.end(data);
} catch { res.writeHead(404); res.end('Not found'); }
}
http.createServer((req, res) => {
if (req.url.startsWith('/api')) proxyToApi(req, res);
else serveStatic(req, res);
}).listen(PORT, () => console.log(`GitNexus proxy on http://localhost:${PORT}`));
# Terminal 1: GitNexus backend API
npx gitnexus serve &
# Terminal 2: Proxy (web UI + API on one port)
node "$GITNEXUS_DIR/proxy.mjs" "$GITNEXUS_DIR/gitnexus-web/dist" 8888 &
验证方法:执行命令 curl -s http://localhost:8888/api/repos,应能返回已索引的仓库列表。
# Install cloudflared if needed (no sudo)
if ! command -v cloudflared &>/dev/null; then
mkdir -p ~/.local/bin
curl -sL https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 \
-o ~/.local/bin/cloudflared
chmod +x ~/.local/bin/cloudflared
export PATH="$HOME/.local/bin:$PATH"
fi
# Start tunnel (--config /dev/null avoids conflicts with existing named tunnels)
cloudflared tunnel --config /dev/null --url http://localhost:8888 --no-autoupdate --protocol http2
隧道地址(例如 https://random-words.trycloudflare.com)会输出到标准错误流中。请将此地址分享出去——拥有该链接的任何人都可以查看对应的图结构。
# Stop services
pkill -f "gitnexus serve"
pkill -f "proxy.mjs"
pkill -f cloudflared
# Remove index from the target repo
cd /path/to/target-repo
npx gitnexus clean
rm -rf .claude/
对于 cloudflared,必须使用 --config /dev/null 参数。 如果用户在 ~/.cloudflared/config.yml 中已存在命名的隧道配置文件,就会导致此问题。否则,配置文件中的通用接入规则会对所有快速隧道请求返回 404 错误。
进行隧道连接时必须使用生产环境构建版本。 Vite 开发服务器默认会通过 allowedHosts 设置阻止非本机主机访问。而使用生产环境构建版本结合 Node 代理则完全可以避免这一问题。
Web 界面不会自动创建 .claude/ 目录或 CLAUDE.md 文件。 这些文件是由 npx gitnexus analyze 命令生成的。如需跳过生成 Markdown 文件,可使用 --skip-agents-md 参数,随后再通过 rm -rf .claude/ 删除该目录中的内容。这些文件属于 Claude Code 的集成功能,Hermes Agent 用户无需使用。
浏览器内存限制。 Web 界面会将整个项目结构加载到浏览器内存中。文件数量超过 5,000 个的仓库可能会导致运行缓慢,而超过 30,000 个文件的仓库很可能会使浏览器标签页崩溃。
嵌入向量是可选功能。 使用 --embeddings 参数可启用语义搜索,但在大型仓库中处理该功能可能需要数分钟时间。如需快速浏览项目,可跳过此选项;若希望通过 AI 聊天面板进行自然语言查询,则可添加该参数。
管理多个仓库。 gitnexus serve 命令会加载所有已索引的仓库。只需先为多个仓库建立索引,然后一次性启动服务,Web 界面即可方便地切换不同仓库。