# ali-furkan/wo architecture

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

- Interactive diagram: https://gitdiagram.com/ali-furkan/wo
- Repository: https://github.com/ali-furkan/wo

## Overview

##### Main Components
- CLI Frontend: At the heart of the project is the CLI interface (see files under the cmd/wo directory and main.go). This component is responsible for parsing user commands and routing requests to specific subcommands (for authentication, editor management, work-related operations, version updates, etc.).
- Command Handling & Subcommands: Under cmd/wo you have multiple sub-folders (auth, editor, works, update, version, etc.). Each acts as a separate module handling a specific domain of functionality.
- Core Business Logic (Internal Packages): The internal/ directory encapsulates the core functionality and domain logic:
- internal/auth contains the authentication logic (including support for GitHub and GitLab).
- internal/editor handles editor-related functionality.
- internal/cycle, internal/config, and internal/space represent additional domain-specific processes (like managing state cycles, configuration parsing, and workspace operations).
- internal/update and internal/version manage update mechanisms and version handling.
- External Services Integration: Some components (especially within auth) are built to integrate with external systems (GitHub, GitLab).
- Build & Deployment: The build/ directory includes scripts for packaging and building binaries, hinting at the system’s support for continuous integration and different platform architectures.
- Ancillary Documentation & DevOps Components: The .github folder and related files (codeql-analysis, commit/lint, release scripts) indicate integration with CI/CD and automated quality checks.

##### Depicting Relationships and Interactions
- For each subcommand, indicate the flow from the command handler (cmd/) down to the corresponding internal packages where the actual business logic is implemented. For example:
- The “auth” component in cmd/wo/auth calls functions from internal/auth and, in particular, the GitHub/GitLab packages to handle authentication.
- The “editor” module in cmd/wo/editor flows into internal/editor for the core editing functions.
- The “works” related commands (create, list, move, open, remove, run) interact with both internal/space and additional supporting files in the cmd/wo/works folder.
- A clear data flow between:
- User inputs (via CLI) → Command Parsing → Internal Business Logic → External Service integration (if applicable).

##### Architectural Patterns and Design Principles
- Layered Architecture: Distinguish between the “CLI Layer” (command parsing and input handling), the “Service/Business Logic Layer” (internal packages for auth, config, editor, etc.), and the “Integration Layer” (external integration and build systems).

##### Relevant Technologies and Frameworks
- Go (Golang) is the primary language.
- GitHub and GitLab integrations are signaled in the auth packages.
- CI/CD tool integrations (GitHub Actions, codeql, release management) are visible from the .github/workflows directory.
- The build system uses shell scripts (binary-builder.sh, package-builder.sh, etc.) which can be represented as a “Build & Packaging” component.

- CLI branching into subcommands (auth, editor, works, update, version) that connect with their respective internal modules.
- A “Documentation/Configuration” side note pointing to the docs folder and configuration files, as documentation is critical for understanding the usage and extension points.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% CLI Layer
    subgraph "CLI Layer"
        U["User Input"]:::cli
        CLI["CLI Entry Point (main.go)"]:::cli
        AC["Auth Command"]:::command
        EC["Editor Command"]:::command
        WC["Works Command"]:::command
        UC["Update Command"]:::command
        VC["Version Command"]:::command
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        AB["Auth Business Logic"]:::business
        EB["Editor Business Logic"]:::business
        WB["Works Business Logic"]:::business
        UB["Update Logic"]:::business
        VB["Version Logic"]:::business
        CM["Cycle Manager"]:::business
        CP["Config Parser"]:::business
    end

    %% External Integration
    subgraph "External Integration"
        GHA["GitHub Auth"]:::integration
        GLA["GitLab Auth"]:::integration
    end

    %% Build & Deployment
    subgraph "Build & Deployment"
        BS["Build Scripts & Packaging"]:::build
        CAD["CI/CD & Automated Checks"]:::build
    end

    %% Supporting Components
    subgraph "Supporting Components"
        DOC["Documentation"]:::support
        DM["Dependency Management"]:::support
    end

    %% Connections for CLI Layer
    U -->|"inputs"| CLI
    CLI -->|"routes"| AC
    CLI -->|"routes"| EC
    CLI -->|"routes"| WC
    CLI -->|"routes"| UC
    CLI -->|"routes"| VC
    CLI -->|"parses"| CP

    %% Connections from Subcommands to Business Logic
    AC -->|"calls"| AB
    EC -->|"calls"| EB
    WC -->|"calls"| WB
    UC -->|"calls"| UB
    VC -->|"calls"| VB
    WC -->|"manages"| CM

    %% External Integration Relationships
    AB -->|"integrates"| GHA
    AB -->|"integrates"| GLA

    %% Build & Deployment Relationships
    CAD -->|"triggers"| BS
    BS -->|"references"| DM
    BS -->|"references"| DOC

    %% Click Events
    click CLI "https://github.com/ali-furkan/wo/blob/main/cmd/wo/main.go"
    click AC "https://github.com/ali-furkan/wo/tree/main/cmd/wo/auth"
    click EC "https://github.com/ali-furkan/wo/tree/main/cmd/wo/editor"
    click WC "https://github.com/ali-furkan/wo/tree/main/cmd/wo/works"
    click UC "https://github.com/ali-furkan/wo/tree/main/cmd/wo/update"
    click VC "https://github.com/ali-furkan/wo/tree/main/cmd/wo/version"
    click AB "https://github.com/ali-furkan/wo/tree/main/internal/auth"
    click GHA "https://github.com/ali-furkan/wo/blob/main/cmd/wo/auth/github/github.go"
    click GLA "https://github.com/ali-furkan/wo/blob/main/cmd/wo/auth/gitlab/gitlab.go"
    click EB "https://github.com/ali-furkan/wo/tree/main/internal/editor"
    click WB "https://github.com/ali-furkan/wo/tree/main/internal/space"
    click CM "https://github.com/ali-furkan/wo/tree/main/internal/cycle"
    click CP "https://github.com/ali-furkan/wo/tree/main/internal/config"
    click UB "https://github.com/ali-furkan/wo/tree/main/internal/update"
    click VB "https://github.com/ali-furkan/wo/tree/main/internal/version"
    click BS "https://github.com/ali-furkan/wo/tree/main/build"
    click CAD "https://github.com/ali-furkan/wo/blob/main/.github"
    click DOC "https://github.com/ali-furkan/wo/tree/main/docs"
    click DM "https://github.com/ali-furkan/wo/blob/main/go.mod"

    %% Styles
    classDef cli fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef command fill:#87CEFA,stroke:#000,stroke-width:2px;
    classDef business fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef integration fill:#FFB6C1,stroke:#000,stroke-width:2px;
    classDef build fill:#FFA500,stroke:#000,stroke-width:2px;
    classDef support fill:#D3D3D3,stroke:#000,stroke-width:2px;
```
