# mrraj470/keypirinha-jenkins architecture

> Architecture diagram of the GitHub repository mrraj470/keypirinha-jenkins, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mrraj470/keypirinha-jenkins
- Repository: https://github.com/mrraj470/keypirinha-jenkins

## Overview

##### Project type and purpose
- This is a Keypirinha plugin written in Python whose sole responsibility is to let Keypirinha users quickly search and launch Jenkins jobs, agents, or labels in their web browser.
- It is not a full-stack web application but rather a desktop plugin that integrates with an external REST service (Jenkins).

##### File structure
- Top‐level files:
- sample_config_file.ini: example of how to configure one or more Jenkins endpoints and command names
- CHANGELOG.md, LICENSE, README.md: documentation and metadata
- make.cmd: build or packaging script for Windows
- src/ directory: the actual plugin code
- src/jenkins.py: main plugin entrypoint that implements Keypirinha’s plugin interface
- src/helper.py: utility functions (e.g. HTTP request wrappers, parsing)
- src/jenkins.ini: default plugin configuration shipped with the package

##### README for additional insights
- Describes two commands (jobs and agents), how they are named, how multi-section configuration lets you target multiple Jenkins servers
- Shows a GIF of interactive search and browser launching

a. Main components
1. Keypirinha Host (proprietary launcher)
2. Jenkins Plugin (Python scripts in src/)
3. Configuration Store (INI files: sample_config_file.ini, src/jenkins.ini, user overrides)
4. Jenkins Server(s) (one or more HTTP REST endpoints)
5. Web Browser (to open job/agent URLs)
b. Relationships & data flows
- On startup, Keypirinha Host loads the Jenkins Plugin
- Plugin reads configuration from the INI file(s)
- Plugin registers commands (e.g., “Jenkins-<section>:” and “Agent-<section>:”) with the host
- User invokes a command → Plugin issues HTTP GETs to Jenkins Server’s API
- User selects an item → Plugin calls OS “open URL” to launch Web Browser to the selected Jenkins job/agent page
c. Architectural patterns & design principles
- Event-driven plugin pattern: commands are callbacks triggered by Keypirinha
- Single-responsibility modules: jenkins.py for host integration; helper.py for network & parsing logic
- Config-driven behaviour: multi-section INI enables plugging in multiple servers without code changes
d. Key technologies/frameworks/libraries
- Python 3.x (Keypirinha requires 3.x plugin compatibility)
- Keypirinha plugin API
- Standard library modules (configparser, urllib or requests if vendored)
- OS default browser invocation

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Components
    Host["Keypirinha Host"]:::enduser
    subgraph "Plugin Layer"
        Plugin["Jenkins Plugin"]:::internal
        Helper["Network & Parsing Helpers"]:::internal
    end
    Config[(Configuration Store)]:::static
    Icons["Local Icon Assets"]:::static
    Docs["Documentation & Metadata"]:::static
    Script["Build/Packaging Script"]:::static
    Jenkins["Jenkins Server(s)"]:::external
    Browser["Web Browser"]:::enduser

    %% Data Flows
    Host -->|"Load plugin"| Plugin
    Plugin -->|"Read config\n(INI parse)"| Config
    Plugin -->|"Load icons"| Icons
    Plugin -->|"Use helper"| Helper
    Plugin -->|"Register commands"| Host
    Host -->|"User invokes command"| Plugin
    Plugin -->|"GET /api/json"| Jenkins
    Jenkins -->|"JSON/XML response"| Plugin
    Plugin -->|"Show UI items"| Host
    Plugin -->|"open_url"| Browser

    %% Click Events
    click Plugin "https://github.com/mrraj470/keypirinha-jenkins/blob/master/src/jenkins.py"
    click Helper "https://github.com/mrraj470/keypirinha-jenkins/blob/master/src/helper.py"
    click Config "https://github.com/mrraj470/keypirinha-jenkins/blob/master/src/jenkins.ini"
    click Config "https://github.com/mrraj470/keypirinha-jenkins/blob/master/sample_config_file.ini"
    click Icons "https://github.com/mrraj470/keypirinha-jenkins/tree/master/src/icons/"
    click Docs "https://github.com/mrraj470/keypirinha-jenkins/blob/master/README.md"
    click Docs "https://github.com/mrraj470/keypirinha-jenkins/blob/master/CHANGELOG.md"
    click Docs "https://github.com/mrraj470/keypirinha-jenkins/tree/master/LICENSE"
    click Script "https://github.com/mrraj470/keypirinha-jenkins/blob/master/make.cmd"

    %% Styles
    classDef internal fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef external fill:#98FB98,stroke:#000,stroke-width:1px
    classDef static fill:#D3D3D3,stroke:#000,stroke-width:1px
    classDef enduser fill:#FFA500,stroke:#000,stroke-width:1px
```
