How vtempest/git0 works
Project Type & Purpose
• This is an open-source CLI tool (“git0”) written in JavaScript/TypeScript (Node.js via Bun).
• Primary purpose: search GitHub repos, download source or releases, auto-install dependencies, and launch the user’s IDE/development server.
File Structure Highlights
• src/: Core modules
• git0.js – CLI entrypoint + command dispatcher
• github-api.js – GitHub REST API client
• fm.js – filesystem utilities & download/decompression logic
• docs-config/ + docs/: Docusaurus static site generator config & generated docs
• package.json, bun.lock, tsconfig.json: language/runtime config
Main Components
a. CLI Frontend (git0 binary)
b. Command Parser / Dispatcher
c. GitHub API Client
d. Download Manager (HTTP fetch → decompression → filesystem)
e. Project Type Detector (checks for package.json, Dockerfile, go.mod, etc.)
f. Installer (bun/npm, cargo, pip, docker, go commands)
g. IDE Launcher (shell commands to open VS Code, Neovim, WebStorm, etc.)
h. Dev Server Starter (for Node.js projects)
i. Logging & Error Handler
j. Config Layer (env vars like GITHUB_TOKEN)
k. External Services
• GitHub REST API
• Package registries (npm, crates.io, PyPI…)
• IDE executables
l. Documentation Pipeline (Docusaurus build → static site)
Relationships & Data Flow
1) User invokes git0 <repo-spec>
2) CLI -> Command Parser calls → GitHub API Client (GET search/repo endpoints)
3) API Client returns metadata -> Download Manager fetches archive → writes to disk via fm.js
4) After unpacking, Project Type Detector runs, picks correct Installer
5) Installer executes external commands (bun, npm, pip, cargo, docker)
6) On success, IDE Launcher spawns user’s preferred editor
7) If Node.js, optionally kick off Dev Server
8) All steps emit events to Logging & Error Handler
9) Separately, developer runs npm run build on docs-config/ to generate docs in docs/
Architectural Patterns & Principles
• Modular SRP: Each src/*.js file does one job.
• Plugin-style Detection: Mapping file globs → installer functions.
• Pipeline Flow: Sequential stages (API → download → detect → install → launch).
• External-integration Adapters: Wrap shell commands and HTTP calls.
• Config-driven: Behavior changes via environment vars (GITHUB_TOKEN, editor prefs).