How ishaannene/elitecode-brew works
Project Type and Purpose
• This is a Go-based command-line interface (CLI) tool called “Elitecode CLI” built with Cobra.
• It implements commands for user authentication, problem management, solution submission, and stats by calling out to external backend services (Firebase Firestore via Firebase SDK and GitHub).
• It also has support for local Firebase emulators (via Docker) and stores user configuration in a local JSON file.
File Structure Analysis
• cmd/ – entry points for each CLI command (login, logout, problems, submit, run, push, etc.), all hooked into Cobra’s root command (root.go).
• internal/
• auth/ – token management, session handling.
• config/ – load and watch ~/.elitecode/config.json, handle environment overrides.
• firebase/ – wrapper over Firebase SDK for Firestore operations.
• github/ – wrapper over GitHub API for OAuth and repo operations.
• docker/ – client to launch/connect to Firebase emulator (Docker).
• models/ – domain types (Problem, Submission, Ranking).
• problem/ – business logic (fetching problems, setting up, submissions).
• utils/ – helpers (language detection, CLI helpers).
• main.go initializes configuration, sets up clients, and executes the root Cobra command.
• Config files: .firebaserc, firebase.json, firestore.rules/indexes, Dockerfile, docker-compose.yml for emulator setup.
README Insights
• Uses Go 1.21+, Docker, Firebase emulators for development, environment variables to override config.
• Highlights Cobra for CLI framework, Firebase for backend, Docker for container runtime.