GitHub仓库克隆与索引工具

GitNexus Fleet是一个本地运行脚本,用于批量克隆GitHub仓库并自动索引,提供MCP服务器和Web UI仪表盘以便查询和分析源代码。

  • by sw30labs
  • HTML
  • 本地部署
  • 更新于
在 GitHub 查看 ai-agents-cybersecurity/gitnexus_fleet

使用说明

GitNexus舰队

GitNexus Fleet是一个本地运行器脚本,旨在积极克隆整个GitHub存储库舰队,自动为所有存储库建立索引 Git纽带,并启动MCP服务器和Web UI仪表板,以便您可以在本地查询、分析和获得源代码上下文的AI理解。

截图

Repo Discovery & Authentication
Phase 1 — Parallel Cloning
Phase 2 — Indexing with GitNexus
Phase 3 — MCP Server & Dashboard Ready
Web UI — Query Your Entire Fleet

运作原理

  ┌─────────────┐
  │  GitHub API  │
  └──────┬──────┘
         │  fetch repo list
         ▼
  ┌─────────────┐     ┌──────────────────────────────────────┐
  │  Phase 1:   │     │  ~/.gitnexus_fleet/repos/            │
  │  Clone      ├────▶│    ├── repo-1/                       │
  │  (5 workers)│     │    ├── repo-2/                       │
  └──────┬──────┘     │    └── repo-n/                       │
         │            └──────────────────────────────────────┘
         ▼
  ┌─────────────┐     ┌──────────────────────────────────────┐
  │  Phase 2:   │     │  Each repo gets a .gitnexus/ dir     │
  │  Index      ├────▶│  containing a KuzuDB graph database  │
  │  (3 workers)│     │  with functions, classes, files,     │
  └──────┬──────┘     │  calls, imports, and communities     │
         │            └──────────────────────────────────────┘
         ▼
  ┌─────────────┐        ┌───────────────┐
  │  Phase 3:   │  stdio │  gitnexus     │
  │  MCP Server ├───────▶│  mcp process  │
  └──────┬──────┘        └───────┬───────┘
         │                       │ reads .gitnexus/ dirs
         ▼                       ▼
  ┌─────────────┐     ┌──────────────────────────────────────┐
  │  Dashboard  │     │  query · impact · context · cypher   │
  │  :8765      │◀───▶│  (MCP tools over JSON-RPC)           │
  └─────────────┘     └──────────────────────────────────────┘
         ▲
         │
    Browser / LLM

文件结构

gitnexus_fleet/
├── run.py                    # Entry point: python run.py
├── gitnexus_fleet/           # Python package
│   ├── __init__.py           # Auto-installs missing dependencies
│   ├── __main__.py           # Allows: python -m gitnexus_fleet
│   ├── config.py             # Constants and shared console
│   ├── github.py             # GitHub API client
│   ├── mcp.py                # MCP stdio client for gitnexus
│   ├── repos.py              # Clone/index logic and status tracking
│   ├── server.py             # HTTP dashboard server
│   ├── cli.py                # Rich TUI and main orchestration
│   └── static/
│       └── dashboard.html    # Web UI dashboard
├── requirements.txt          # Python dependencies (rich, requests, python-dotenv)
├── QUICKSTART.md             # Explains basic GitNexus usage options
└── .env.gitnexus             # Standardized ENV file for your API credentials

生成的目录(运行时)

当车队扫描仪运行时,它会自动管理一个完全本地的索引和存储:

~/.gitnexus_fleet/repos/                   # Cloned directories live here
    ├── <repository-name-1>/
    │   └── .gitnexus/                     # Local KuzuDB database generated by running 'gitnexus analyze'
    └── <repository-name-2>/
        └── .gitnexus/                     # The index, properties, edges, and embeddings for repo 2

设置和配置

编排器脚本本机支持,而不是每次处理内联导出 .env.gitnexus.

创建 .env.gitnexus 在您的工作目录中,并提供:

GITHUB_TOKEN=ghp_your_github_token_here

# (Optional) Provide OpenAI key if you want to use cloud-based text-embedding-3
# Note: Requires manual script modification to run `analyze --embeddings` if desired.
OPENAI_API_KEY=sk-your_openai_key_here

然后只需安装需求并启动编排器:

pip install -r requirements.txt
python run.py
# Or: python -m gitnexus_fleet

数据库的工作原理

GitNexus不会为你的代码基础设施使用后台守护进程或云存储。 相反,它利用 填充 (高度优化的嵌入式图形数据库)。

当时 gitnexus_fleet.py 脚本运行 gitnexus analyze 针对您的存储库,它将图形数据库直接生成为 .gitnexus/ 该存储库根目录下的隐藏文件夹。

这意味着您的数据库位于: ~/.gitnexus_fleet/repos/<repository-name>/.gitnexus/

当您查询Web UI或通过MCP服务器连接LLM时,它只是指向那些本地 .gitnexus/ 目录并直接读取图形数据。

嵌入模型

在为语义搜索功能创建嵌入时,GitNexus依赖于 transformers.js 包,在不离开机器的情况下本机运行嵌入逻辑。默认情况下,它使用 Snowflake/snowflake-arctic-embed-xs 使用本地CPU或WebGPU设置。

如果您希望获得最先进的(SOTA)嵌入质量,可以导出 OPENAI_API_KEY (或者把它放在你的 .env.gitnexus).GitNexus将动态检测它,并将嵌入生成卸载到OpenAI强大的云产品中。

致谢

该项目建立在 Git纽带 Abhigyan Patwari——索引引擎、KuzuDB图形数据库和MCP服务器,为所有代码分析功能提供动力。

许可证

此项目根据Apache License 2.0获得许可——请参阅 许可证 文件以获取详细信息。


由...建造 尼克·克拉维诺