# gallardos/skilluncapped-assistant architecture

> Architecture diagram of the GitHub repository gallardos/skilluncapped-assistant, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gallardos/skilluncapped-assistant
- Repository: https://github.com/gallardos/skilluncapped-assistant

## Overview

#### Purpose and runtime
Chrome extension that enhances SkillUncapped course/video navigation. It runs content-side automation on SkillUncapped pages and includes extension-level request handling to relax CORS constraints needed for video playback. Core extension metadata and permissions are defined in `manifest.json`.

#### Entry points
Two page-oriented scripts partition behavior:
- `src/automator-main.js` starts player-page automation and UI injection.
- `src/scanner-main.js` starts course-page scanning and navigation detection.
- `manifest.json` binds these scripts and extension capabilities to browser lifecycle/page contexts.

#### Course scanning and redirect flow
`src/scanners/CardScanner.js` identifies course/video card links on SkillUncapped browse pages. `src/scanners/NavigationHandler.js` handles detected navigation targets, enabling automatic transition from course links into the player experience. `src/scanner-main.js` coordinates these scanning stages.

Boundary: scanner code operates against the course/browse page DOM and produces navigation actions rather than player control directly.

#### Playlist extraction and episode navigation
When a video is reached from the course browse flow, scanner-derived course context supports playlist extraction and episode traversal. `src/scanners/components/PlayButtonComponent.js` represents the relevant playable-card/page control, while player-side UI modules expose the resulting navigation affordances:
- `src/automator/ui/ControlsInjector.js`
- `src/automator/ui/SidebarInjector.js`
- `src/automator/ui/SidebarTransformer.js`

The transformed/injected sidebar and controls let users move through course episodes without returning to the browse page.

#### Player automation layer
`src/automator/VideoController.js` is the main abstraction over the embedded/native video player. It receives page-level control intent and applies playback/navigation behavior. `src/automator-main.js` composes this controller with the UI injectors.

`src/automator/WindowOverrides.js` provides a deliberate browser-page boundary: it modifies or intercepts window-level behavior required for the automation to coexist with the host site/player.

#### UI and styling boundary
Injected controls are isolated in the automator UI layer rather than mixed into scanning logic. `src/content.css` supplies the extension’s page-applied styling. This separates host-page discovery (`src/scanners`) from player interaction and rendered extension controls (`src/automator`).

#### Network/CORS capability
The extension advertises a built-in CORS disabler, implemented through browser extension configuration/runtime behavior centered on `manifest.json`; this is required to permit cross-origin video-related requests that normal page CORS policy would block. `src/rules.json` is the repository’s likely declarative rules artifact and should be treated as part of that browser-policy boundary.

#### Primary control flow
1. Browser loads the extension on a SkillUncapped course page.
2. `src/scanner-main.js` invokes card scanning and navigation handling.
3. A selected/detected course video opens in the player context.
4. `src/automator-main.js` initializes window overrides, video control, and injected UI.
5. Playlist context is rendered as sidebar/controls; user actions route to `VideoController`.
6. Extension network policy allows required cross-origin playback resources.

Main entry points: [`src/automator-main.js`](https://github.com/gallardos/skilluncapped-assistant/blob/main/src/automator-main.js) (Automator entry), [`src/automator/ui/SidebarInjector.js`](https://github.com/gallardos/skilluncapped-assistant/blob/main/src/automator/ui/SidebarInjector.js) (Sidebar injector), [`src/automator/VideoController.js`](https://github.com/gallardos/skilluncapped-assistant/blob/main/src/automator/VideoController.js) (Video controller), [`manifest.json`](https://github.com/gallardos/skilluncapped-assistant/blob/main/manifest.json) (Extension manifest)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_extension["Extension runtime"]
  node_manifest["Extension manifest<br/>extension metadata<br/>[manifest.json]"]
  node_rules["CORS rules<br/>declarative rules<br/>[rules.json]"]
end

subgraph group_browse["Course browse context"]
  node_scanner_main["Scanner entry<br/>content entry<br/>[scanner-main.js]"]
  node_card_scanner["Card scanner<br/>DOM discovery<br/>[CardScanner.js]"]
  node_navigation_handler["Navigation handler<br/>navigation flow"]
  node_play_button["Playable card control<br/>scanner component"]
end

subgraph group_player["Player automation context"]
  node_automator_main["Automator entry<br/>content entry<br/>[automator-main.js]"]
  node_window_overrides["Window overrides<br/>page boundary<br/>[WindowOverrides.js]"]
  node_video_controller["Video controller<br/>player abstraction<br/>[VideoController.js]"]
  node_controls_injector["Controls injector<br/>UI injector"]
  node_sidebar_injector["Sidebar injector<br/>UI injector<br/>[SidebarInjector.js]"]
  node_sidebar_transformer["Sidebar transformer<br/>UI transform"]
  node_content_css["Injected styles<br/>content stylesheet<br/>[content.css]"]
end

node_manifest -->|"loads on browse pages"| node_scanner_main
node_manifest -->|"loads on player pages"| node_automator_main
node_manifest -->|"enables policy"| node_rules
node_rules -.->|"permits playback requests"| node_video_controller
node_scanner_main -->|"scans"| node_card_scanner
node_scanner_main -->|"coordinates"| node_navigation_handler
node_card_scanner -->|"identifies playable cards"| node_play_button
node_card_scanner -->|"navigation targets"| node_navigation_handler
node_navigation_handler -->|"transitions to player"| node_automator_main
node_play_button -.->|"playlist context"| node_sidebar_transformer
node_automator_main -->|"initializes"| node_window_overrides
node_automator_main -->|"initializes"| node_video_controller
node_automator_main -->|"injects"| node_controls_injector
node_automator_main -->|"injects"| node_sidebar_injector
node_sidebar_transformer -->|"renders playlist"| node_sidebar_injector
node_controls_injector -->|"user control intent"| node_video_controller
node_sidebar_injector -->|"episode selection"| node_video_controller
node_content_css -.->|"styles"| node_controls_injector
node_content_css -.->|"styles"| node_sidebar_injector

click node_manifest "https://github.com/gallardos/skilluncapped-assistant/blob/main/manifest.json"
click node_rules "https://github.com/gallardos/skilluncapped-assistant/blob/main/src/rules.json"
click node_scanner_main "https://github.com/gallardos/skilluncapped-assistant/blob/main/src/scanner-main.js"
click node_card_scanner "https://github.com/gallardos/skilluncapped-assistant/blob/main/src/scanners/CardScanner.js"
click node_navigation_handler "https://github.com/gallardos/skilluncapped-assistant/blob/main/src/scanners/NavigationHandler.js"
click node_play_button "https://github.com/gallardos/skilluncapped-assistant/blob/main/src/scanners/components/PlayButtonComponent.js"
click node_automator_main "https://github.com/gallardos/skilluncapped-assistant/blob/main/src/automator-main.js"
click node_window_overrides "https://github.com/gallardos/skilluncapped-assistant/blob/main/src/automator/WindowOverrides.js"
click node_video_controller "https://github.com/gallardos/skilluncapped-assistant/blob/main/src/automator/VideoController.js"
click node_controls_injector "https://github.com/gallardos/skilluncapped-assistant/blob/main/src/automator/ui/ControlsInjector.js"
click node_sidebar_injector "https://github.com/gallardos/skilluncapped-assistant/blob/main/src/automator/ui/SidebarInjector.js"
click node_sidebar_transformer "https://github.com/gallardos/skilluncapped-assistant/blob/main/src/automator/ui/SidebarTransformer.js"
click node_content_css "https://github.com/gallardos/skilluncapped-assistant/blob/main/src/content.css"

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_manifest,node_rules toneBlue
class node_scanner_main,node_card_scanner,node_navigation_handler,node_play_button toneAmber
class node_automator_main,node_window_overrides,node_video_controller,node_controls_injector,node_sidebar_injector,node_sidebar_transformer,node_content_css toneMint
```

## Components

### Extension runtime

Browser registration and network policy.

- [Extension manifest](https://github.com/gallardos/skilluncapped-assistant/blob/main/manifest.json): extension metadata · Registers page scripts, permissions, and browser capabilities. · `manifest.json`
- [CORS rules](https://github.com/gallardos/skilluncapped-assistant/blob/main/src/rules.json): declarative rules · Supports cross-origin video resource access. · `src/rules.json`

### Course browse context

Discovers course cards and transitions into playback.

- [Scanner entry](https://github.com/gallardos/skilluncapped-assistant/blob/main/src/scanner-main.js): content entry · `src/scanner-main.js`
- [Card scanner](https://github.com/gallardos/skilluncapped-assistant/blob/main/src/scanners/CardScanner.js): DOM discovery · Finds course and video card links. · `src/scanners/CardScanner.js`
- [Navigation handler](https://github.com/gallardos/skilluncapped-assistant/blob/main/src/scanners/NavigationHandler.js): navigation flow · Routes detected course targets into the player experience. · `src/scanners/NavigationHandler.js`
- [Playable card control](https://github.com/gallardos/skilluncapped-assistant/blob/main/src/scanners/components/PlayButtonComponent.js): scanner component · Represents the course playback control used for playlist context. · `src/scanners/components/PlayButtonComponent.js`

### Player automation context

Controls playback and injects episode navigation UI.

- [Automator entry](https://github.com/gallardos/skilluncapped-assistant/blob/main/src/automator-main.js): content entry · Composes player automation and injected UI. · `src/automator-main.js`
- [Window overrides](https://github.com/gallardos/skilluncapped-assistant/blob/main/src/automator/WindowOverrides.js): page boundary · Intercepts host window behavior needed by automation. · `src/automator/WindowOverrides.js`
- [Video controller](https://github.com/gallardos/skilluncapped-assistant/blob/main/src/automator/VideoController.js): player abstraction · Applies playback and episode navigation intent to the host player. · `src/automator/VideoController.js`
- [Controls injector](https://github.com/gallardos/skilluncapped-assistant/blob/main/src/automator/ui/ControlsInjector.js): UI injector · Adds player-side navigation controls. · `src/automator/ui/ControlsInjector.js`
- [Sidebar injector](https://github.com/gallardos/skilluncapped-assistant/blob/main/src/automator/ui/SidebarInjector.js): UI injector · Renders the course episode sidebar. · `src/automator/ui/SidebarInjector.js`
- [Sidebar transformer](https://github.com/gallardos/skilluncapped-assistant/blob/main/src/automator/ui/SidebarTransformer.js): UI transform · Transforms playlist context into sidebar content. · `src/automator/ui/SidebarTransformer.js`
- [Injected styles](https://github.com/gallardos/skilluncapped-assistant/blob/main/src/content.css): content stylesheet · `src/content.css`

## Connections

- Extension manifest → Scanner entry: loads on browse pages
- Extension manifest → Automator entry: loads on player pages
- Extension manifest → CORS rules: enables policy
- CORS rules → Video controller: permits playback requests
- Scanner entry → Card scanner: scans
- Scanner entry → Navigation handler: coordinates
- Card scanner → Playable card control: identifies playable cards
- Card scanner → Navigation handler: navigation targets
- Navigation handler → Automator entry: transitions to player
- Playable card control → Sidebar transformer: playlist context
- Automator entry → Window overrides: initializes
- Automator entry → Video controller: initializes
- Automator entry → Controls injector: injects
- Automator entry → Sidebar injector: injects
- Sidebar transformer → Sidebar injector: renders playlist
- Controls injector → Video controller: user control intent
- Sidebar injector → Video controller: episode selection
- Injected styles → Controls injector: styles
- Injected styles → Sidebar injector: styles
