# silent-this-sonder/sb3-bulk-downloader architecture

> Architecture diagram of the GitHub repository silent-this-sonder/sb3-bulk-downloader, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/silent-this-sonder/sb3-bulk-downloader
- Repository: https://github.com/silent-this-sonder/sb3-bulk-downloader

## Overview

1. **Repository shape**
   - This is a small Python tool with two top-level entry points: `main.py` and `gui.py`.
   - The rest of the repo is mostly support files: `downloads/` for generated output, and GitHub Actions workflows for CI.

2. **Primary purpose**
   - The tool automates downloading Scratch projects from a user’s own Scratch account.
   - The core domain boundary is between the local client and the external Scratch service, which provides project identity, sharing status, and downloadable project files.

3. **User-facing modes**
   - The README describes two interfaces: a CLI and a GUI.
   - The CLI is the operationally complete path today; the GUI exists as an alternate front end but is not yet the main supported workflow.

4. **Likely architecture split**
   - `main.py` appears to be the command-line orchestration layer: login, project selection/filtering, and triggering downloads.
   - `gui.py` is a separate presentation layer that likely reuses the same underlying download logic or mirrors the CLI flow with UI controls.
   - The repository layout suggests there is not a deep package hierarchy; instead, the app is organized as a lightweight script-based utility.

5. **External dependency boundary**
   - Scratch is the critical external system. The app needs to authenticate as the user, enumerate projects, and retrieve project data.
   - The README explicitly notes that logging in enables downloading unshared projects too, so authentication is not just optional convenience; it changes what data the client can access.

6. **Data flow**
   - User starts the program.
   - The app authenticates against Scratch.
   - The app retrieves the project list and applies a user-selected filter: all, shared only, or unshared only.
   - The app downloads each selected project to local storage, presumably as `.sb3` files or equivalent Scratch project archives.
   - Output is written under `downloads/`, which is treated as generated content rather than source code.

7. **Local output boundary**
   - `downloads/.gitignore` indicates the downloaded project files are intentionally excluded from version control.
   - This directory is the main persistence boundary inside the repo: source code stays in the root, generated artifacts accumulate under `downloads/`.

8. **Operational constraints**
   - The README warns that the process must remain running and connected; interruption can corrupt or abort the batch download.
   - That implies the application is a batch-oriented client rather than a background sync service or resumable queue.

9. **CI / quality gates**
   - `.github/workflows/pylint.yml` suggests static analysis is enforced in CI.
   - `.github/workflows/prtest.yml` suggests pull requests get automated checks, likely basic validation and lint/test gating.
   - This repo therefore has lightweight automation around code quality, even if the app itself is minimal.

10. **Architecture summary for a diagram**
   - The best diagram is a simple client-centric one: user interacts with either CLI or GUI, which both drive the same Scratch-auth-and-download workflow, and the resulting files are stored locally in `downloads/`.
   - The only major external integration is Scratch; there are no visible databases, message queues, or backend services in the repository tree.

Main entry points: [`main.py`](https://github.com/silent-this-sonder/sb3-bulk-downloader/blob/main/main.py) (CLI), [`gui.py`](https://github.com/silent-this-sonder/sb3-bulk-downloader/blob/main/gui.py) (GUI), [`.github/workflows/prtest.yml`](https://github.com/silent-this-sonder/sb3-bulk-downloader/blob/main/.github/workflows/prtest.yml) (PR checks), [`.github/workflows/pylint.yml`](https://github.com/silent-this-sonder/sb3-bulk-downloader/blob/main/.github/workflows/pylint.yml) (Lint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_cli["CLI<br/>entry point<br/>[main.py]"]
  node_gui["GUI<br/>entry point<br/>[gui.py]"]
  node_auth{{"Login<br/>flow step"}}
  node_projects["Project list<br/>flow step"]
  node_download["Downloader<br/>flow step"]
end

subgraph group_external["External"]
  node_scratch[("Scratch<br/>external service")]
end

subgraph group_ci["CI"]
  node_prtest["PR checks<br/>workflow<br/>[prtest.yml]"]
  node_pylint["Lint<br/>workflow<br/>[pylint.yml]"]
end

subgraph group_output["Output"]
  node_downloads[("Downloads<br/>local store<br/>[.gitignore]")]
end

node_user(("User<br/>operator"))

node_user -->|"uses"| node_cli
node_user -->|"uses"| node_gui
node_cli -->|"starts"| node_auth
node_gui -->|"starts"| node_auth
node_auth -->|"authenticates"| node_scratch
node_auth -->|"enables"| node_projects
node_projects -->|"queries"| node_scratch
node_projects -->|"selects"| node_download
node_download -->|"fetches"| node_scratch
node_download -->|"writes"| node_downloads
node_prtest -.->|"checks"| node_cli
node_prtest -.->|"checks"| node_gui
node_pylint -.->|"analyzes"| node_cli
node_pylint -.->|"analyzes"| node_gui

click node_cli "https://github.com/silent-this-sonder/sb3-bulk-downloader/blob/main/main.py"
click node_gui "https://github.com/silent-this-sonder/sb3-bulk-downloader/blob/main/gui.py"
click node_downloads "https://github.com/silent-this-sonder/sb3-bulk-downloader/blob/main/downloads/.gitignore"
click node_prtest "https://github.com/silent-this-sonder/sb3-bulk-downloader/blob/main/.github/workflows/prtest.yml"
click node_pylint "https://github.com/silent-this-sonder/sb3-bulk-downloader/blob/main/.github/workflows/pylint.yml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_gui,node_auth,node_projects,node_download toneBlue
class node_scratch toneAmber
class node_prtest,node_pylint toneMint
class node_downloads toneRose
class node_user toneNeutral
```

## Components

### Application

User-facing script entry points and batch download flow

- [CLI](https://github.com/silent-this-sonder/sb3-bulk-downloader/blob/main/main.py): entry point · Command-line interface for the supported workflow · `main.py`
- [GUI](https://github.com/silent-this-sonder/sb3-bulk-downloader/blob/main/gui.py): entry point · Alternate graphical interface · `gui.py`
- **Login**: flow step · Authenticates the account to unlock project access
- **Project list**: flow step · Retrieves Scratch projects and applies shared/unshared filters
- **Downloader**: flow step · Fetches selected Scratch projects in batch

### External

Remote service boundary

- **Scratch**: external service · Source of project identity, sharing status, and project files

### CI

Automated checks in GitHub Actions

- [PR checks](https://github.com/silent-this-sonder/sb3-bulk-downloader/blob/main/.github/workflows/prtest.yml): workflow · Pull request validation pipeline · `.github/workflows/prtest.yml`
- [Lint](https://github.com/silent-this-sonder/sb3-bulk-downloader/blob/main/.github/workflows/pylint.yml): workflow · Static analysis gate for Python code · `.github/workflows/pylint.yml`

### Output

Generated local download artifacts

- [Downloads](https://github.com/silent-this-sonder/sb3-bulk-downloader/blob/main/downloads/.gitignore): local store · Generated project archives written under downloads/ · `downloads/.gitignore`

### Other components

- **User**: operator · Starts the downloader and chooses a mode

## Connections

- User → CLI: uses · Primary operational path
- User → GUI: uses · Alternative interface
- CLI → Login: starts · Begins the authenticated batch flow
- GUI → Login: starts · Triggers the same login-driven workflow
- Login → Scratch: authenticates · Establishes access to the Scratch account
- Login → Project list: enables · Unlocked account can enumerate projects
- Project list → Scratch: queries · Reads project identity and shared state
- Project list → Downloader: selects · Applies all/shared/unshared filtering
- Downloader → Scratch: fetches · Downloads project archives from Scratch
- Downloader → Downloads: writes · Stores generated files locally
- PR checks → CLI: checks · Validates the script-based app
- PR checks → GUI: checks · Validates the alternate front end
- Lint → CLI: analyzes · Lint gate for core orchestration
- Lint → GUI: analyzes · Lint gate for UI entry point
