# mykolaharmash/git-jump architecture

> Architecture diagram of the GitHub repository mykolaharmash/git-jump, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mykolaharmash/git-jump
- Repository: https://github.com/mykolaharmash/git-jump

## Overview

##### Project Type and Purpose
- Project Type: A command-line interface (CLI) tool built in TypeScript.
- Purpose: To provide a user-friendly, fuzzy search–enabled interface to view and switch Git branches. It leverages the native “git switch” command and adds an interactive UI along with additional features (like sorting by recent usage, renaming, creating, and deleting branches).

##### File Structure
- Top-Level Components:
- .github/ directory: Contains issue and feature request templates for contributors.
- package.json and package-lock.json: Define project dependencies and scripts.
- tsconfig.json: Indicates the project is developed in TypeScript.
- src/ directory: Holds the main source files:
▸ index.ts – Likely the entry point of the CLI tool.
▸ fuzzy.ts – Contains the fuzzy search logic.
▸ parseKeys.ts – Handles key parsing and shortcuts (e.g., handling Option/Alt+<number> input).
- exec/ directory: Contains executable scripts (e.g., git-jump) that likely serve as the command entry point.
- Other files (e.g., how-to-release.md, LICENSE, README.md, help.txt): Provide documentation and ancillary information.

##### README Insights
- The README explains the use cases and instructions, emphasizing the interactive UI for branch operations and how the tool proxies commands to native “git switch.”
- It also documents how to enable certain terminal shortcuts, suggesting that the UX for key handling is an integral part of the application.

- Main Components:
▸ CLI Entry Point: Represents the executable script (in exec/ and src/index.ts) that starts the application.
▸ Fuzzy Search Engine: Encapsulated in src/fuzzy.ts, which handles the algorithm for filtering branches based on partial input.
▸ Input Parsing and Key Mapping: Managed in src/parseKeys.ts to interpret keystrokes (including Option/Alt shortcuts for branch selection).
▸ Command Proxy: The logic that takes the selected branch and/or additional flags and delegates execution to the native ‘git switch’ or other related Git commands.
▸ External Git: While not part of the codebase, the dependency on native Git commands stands as an external system component.
- Relationships & Data Flow:
- User inputs (keystrokes/command arguments) -> CLI Entry Point.
- The CLI then delegates to the Interactive UI and Fuzzy Search Engine to render and filter branch lists.
- Input Parsing translates special key combinations (via src/parseKeys.ts) and passes the intended branch selection.
- The Command Proxy takes that input and invokes Git commands (native ‘git switch’, etc.) as external processes.
- Architectural Patterns & Principles:
- Modular design: Separation of concerns among command parsing, UI rendering, fuzzy logic, and command execution.
- Extension and integration: The tool acts as a proxy or wrapper around native Git commands while introducing additional logic.

##### Final Remarks
- Be as detailed as possible: clearly illustrate the data paths and the relationships among user input, internal processing, and the execution of Git commands.

Happy diagramming!

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["User Terminal"]:::user
    B["CLI Entry Point (Executable Script)"]:::cli
    C["Interactive UI Module (src/index.ts)"]:::core
    D["Fuzzy Search Engine (src/fuzzy.ts)"]:::core
    E["Input Parsing & Key Mapping (src/parseKeys.ts)"]:::core
    F["Command Proxy (src/index.ts)"]:::core
    G["Git (Native)"]:::external

    A -->|"input"| B
    B -->|"launches"| C
    C -->|"renders_branch_list"| D
    C -->|"processes_keystrokes"| E
    D -->|"sends_filtered_data"| F
    E -->|"sends_parsed_keys"| F
    F -->|"delegates_command"| G

    click B "https://github.com/mykolaharmash/git-jump/tree/main/exec/git-jump"
    click C "https://github.com/mykolaharmash/git-jump/blob/main/src/index.ts"
    click F "https://github.com/mykolaharmash/git-jump/blob/main/src/index.ts"
    click D "https://github.com/mykolaharmash/git-jump/blob/main/src/fuzzy.ts"
    click E "https://github.com/mykolaharmash/git-jump/blob/main/src/parseKeys.ts"

    classDef user fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef cli fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef core fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef external fill:#f8d7da,stroke:#721c24,stroke-width:2px;
```
