# shouxtech/wally-to-rbxmx architecture

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

- Interactive diagram: https://gitdiagram.com/shouxtech/wally-to-rbxmx
- Repository: https://github.com/shouxtech/wally-to-rbxmx

## Overview

##### Project type and purpose
- This is a standalone, command-line Go tool (“wally-to-rbxmx”) that converts Wally packages (and their dependencies) into a single, importable RBXMX file for Roblox Studio. It is not a multi-service or full-stack web app, but an open-source utility.

##### File structure
- Top level:
- main.go – entry point containing the CLI logic
- go.mod/go.sum – dependency manifest
- build.ps1 – Windows build script
- LICENSE.md, README.md, .gitignore
- No subdirectories: all functionality is implemented in Go packages imported by main.go or inlined in main.go.

##### README for additional insights
- Usage pattern: `wally-to-rbxmx <scope/name@version> [output.rbxmx]`
- Relies on Wally registry (HTTP API) to fetch package data.
- Produces an RBXMX file (XML format) for Roblox Studio.

a. Main components
1. CLI Interface (main.go)
2. Package Resolver / Fetcher
3. Package Parser (parses downloaded archive or manifest)
4. Dependency Resolver (handles transitive dependencies)
5. RBXMX Generator (transforms Go data structures to XML format)
6. File I/O (writes the .rbxmx file)
7. External Service: Wally Registry API
b. Relationships & data flow
- User invokes CLI → arguments parsed by CLI Interface.
- CLI calls Package Resolver → HTTP GET to Wally Registry → download package .zip/.tar.
- Package Parser reads archive → extracts module files & metadata.
- Dependency Resolver recurses through package’s dependencies → repeat fetch & parse.
- Once full dependency graph is in memory, RBXMX Generator constructs an XML tree.
- File I/O writes the RBXMX XML to disk at the given path.
c. Architectural patterns & principles
- Pipeline pattern: sequential stages (fetch → parse → transform → output).
- Modularity: each stage can be factored into its own Go package or function.
- Single binary, minimal external dependencies.
d. Key technologies/frameworks
- Go standard library (net/http, archive/zip, encoding/xml, os, flag)
- External Wally Registry HTTP API
- RBXMX XML schema

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Internal Modules"
        CLI["CLI Interface"]:::internal
        Resolver["Package Resolver/Fetcher"]:::internal
        Parser["Package Parser"]:::internal
        DepResolver["Dependency Resolver"]:::internal
        Generator["RBXMX Generator"]:::internal
        FileIO["File I/O (RBXMX Writer)"]:::internal
    end

    External["Wally Registry API"]:::external
    Output["RBXMX File (.rbxmx)"]:::output

    CLI -->|"parsed args"| Resolver
    Resolver -->|"HTTP GET package"| External
    External -->|"package archive"| Resolver
    Resolver -->|"archive data"| Parser
    Parser -->|"module tree & metadata"| DepResolver
    DepResolver -->|"dependency list"| Resolver
    DepResolver -->|"full dependency graph"| Generator
    Generator -->|"XML document"| FileIO
    FileIO -->|"writes file"| Output

    click CLI "https://github.com/shouxtech/wally-to-rbxmx/blob/main/main.go"
    click Resolver "https://github.com/shouxtech/wally-to-rbxmx/blob/main/main.go"
    click Parser "https://github.com/shouxtech/wally-to-rbxmx/blob/main/main.go"
    click DepResolver "https://github.com/shouxtech/wally-to-rbxmx/blob/main/main.go"
    click Generator "https://github.com/shouxtech/wally-to-rbxmx/blob/main/main.go"
    click FileIO "https://github.com/shouxtech/wally-to-rbxmx/blob/main/main.go"

    classDef internal fill:#ADD8E6,stroke:#0000FF,color:#000
    classDef external fill:#90EE90,stroke:#008000,color:#000
    classDef output fill:#FFFACD,stroke:#DAA520,color:#000
```
