# musheer360/swiftslate-desktop architecture

> Architecture diagram of the GitHub repository musheer360/swiftslate-desktop, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/musheer360/swiftslate-desktop
- Repository: https://github.com/musheer360/swiftslate-desktop

## Overview

SwiftSlate Desktop is a Windows-wide inline text transformation app. The main workflow is typing a trigger in another application, processing the preceding text through an AI or local command, and replacing the text in place. The README also documents key rotation, clipboard commands, undo, and hot reload. Source excerpts were unavailable, so relationships below rely on the README; the single runtime file is assigned to the documented runtime responsibilities without claiming its internal structure was inspected.

Main entry points: [`SwiftSlate.pyw`](https://github.com/musheer360/swiftslate-desktop/blob/master/SwiftSlate.pyw) (Trigger dispatch), [`commands.json`](https://github.com/musheer360/swiftslate-desktop/blob/master/commands.json) (Command definitions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Input and replacement"]
  node_input_capture["System input capture<br/>[SwiftSlate.pyw]"]
  node_text_context["Preceding text<br/>[SwiftSlate.pyw]"]
  node_progress_indicator["Spinner feedback<br/>[SwiftSlate.pyw]"]
  node_text_replacement["Inline replacement<br/>[SwiftSlate.pyw]"]
end

subgraph group_commands["Command processing"]
  node_trigger_dispatch["Trigger dispatch<br/>[SwiftSlate.pyw]"]
  node_command_catalog["Command definitions<br/>[commands.json]"]
  node_ai_transform["AI transformation<br/>[SwiftSlate.pyw]"]
  node_local_replacers["Local replacers<br/>[SwiftSlate.pyw]"]
  node_clipboard_commands["Clipboard commands<br/>[SwiftSlate.pyw]"]
  node_undo["Undo replacement<br/>[SwiftSlate.pyw]"]
end

subgraph group_services["Providers and state"]
  node_key_rotation["API key rotation<br/>[SwiftSlate.pyw]"]
  node_configuration["Runtime configuration"]
  node_hot_reload["Hot reload<br/>[SwiftSlate.pyw]"]
end

node_user(("User"))
node_target_app["Target app"]
node_ai_provider["AI provider endpoint"]
node_public_ip["Public IP service"]
node_system_clipboard["System clipboard"]

node_user -->|"types into"| node_target_app
node_target_app -->|"provides system input"| node_input_capture
node_input_capture -->|"detects trigger"| node_trigger_dispatch
node_trigger_dispatch -->|"selects preceding text"| node_text_context
node_trigger_dispatch -->|"resolves commands"| node_command_catalog
node_trigger_dispatch -->|"shows progress"| node_progress_indicator
node_trigger_dispatch -->|"dispatches AI command"| node_ai_transform
node_trigger_dispatch -->|"dispatches replacer"| node_local_replacers
node_trigger_dispatch -->|"dispatches clipboard command"| node_clipboard_commands
node_trigger_dispatch -->|"dispatches undo"| node_undo
node_ai_transform -->|"obtains API key"| node_key_rotation
node_key_rotation -->|"reads configured keys"| node_configuration
node_ai_transform -->|"sends text for transformation"| node_ai_provider
node_ai_provider -->|"returns transformed text"| node_ai_transform
node_local_replacers -->|"looks up public IP"| node_public_ip
node_clipboard_commands -->|"uses fallback clipboard"| node_system_clipboard
node_ai_transform -->|"returns transformed text"| node_text_replacement
node_local_replacers -->|"returns replacement text"| node_text_replacement
node_text_replacement -->|"replaces inline text"| node_target_app
node_undo -->|"restores prior text"| node_text_replacement
node_user -->|"edits settings"| node_configuration
node_user -->|"edits commands"| node_command_catalog
node_hot_reload -->|"watches for changes"| node_configuration
node_hot_reload -->|"watches for changes"| node_command_catalog

click node_input_capture "https://github.com/musheer360/swiftslate-desktop/blob/master/SwiftSlate.pyw"
click node_trigger_dispatch "https://github.com/musheer360/swiftslate-desktop/blob/master/SwiftSlate.pyw"
click node_text_context "https://github.com/musheer360/swiftslate-desktop/blob/master/SwiftSlate.pyw"
click node_progress_indicator "https://github.com/musheer360/swiftslate-desktop/blob/master/SwiftSlate.pyw"
click node_command_catalog "https://github.com/musheer360/swiftslate-desktop/blob/master/commands.json"
click node_ai_transform "https://github.com/musheer360/swiftslate-desktop/blob/master/SwiftSlate.pyw"
click node_local_replacers "https://github.com/musheer360/swiftslate-desktop/blob/master/SwiftSlate.pyw"
click node_clipboard_commands "https://github.com/musheer360/swiftslate-desktop/blob/master/SwiftSlate.pyw"
click node_undo "https://github.com/musheer360/swiftslate-desktop/blob/master/SwiftSlate.pyw"
click node_text_replacement "https://github.com/musheer360/swiftslate-desktop/blob/master/SwiftSlate.pyw"
click node_key_rotation "https://github.com/musheer360/swiftslate-desktop/blob/master/SwiftSlate.pyw"
click node_hot_reload "https://github.com/musheer360/swiftslate-desktop/blob/master/SwiftSlate.pyw"

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_input_capture,node_text_context,node_progress_indicator,node_text_replacement,node_user toneBlue
class node_trigger_dispatch,node_command_catalog,node_ai_transform,node_local_replacers,node_clipboard_commands,node_undo toneAmber
class node_key_rotation,node_configuration,node_hot_reload toneMint
class node_target_app,node_ai_provider,node_public_ip,node_system_clipboard toneIndigo
```

## Components

### Input and replacement

- [System input capture](https://github.com/musheer360/swiftslate-desktop/blob/master/SwiftSlate.pyw): `SwiftSlate.pyw`
- [Preceding text](https://github.com/musheer360/swiftslate-desktop/blob/master/SwiftSlate.pyw): `SwiftSlate.pyw`
- [Spinner feedback](https://github.com/musheer360/swiftslate-desktop/blob/master/SwiftSlate.pyw): `SwiftSlate.pyw`
- [Inline replacement](https://github.com/musheer360/swiftslate-desktop/blob/master/SwiftSlate.pyw): `SwiftSlate.pyw`

### Command processing

- [Trigger dispatch](https://github.com/musheer360/swiftslate-desktop/blob/master/SwiftSlate.pyw): `SwiftSlate.pyw`
- [Command definitions](https://github.com/musheer360/swiftslate-desktop/blob/master/commands.json): `commands.json`
- [AI transformation](https://github.com/musheer360/swiftslate-desktop/blob/master/SwiftSlate.pyw): `SwiftSlate.pyw`
- [Local replacers](https://github.com/musheer360/swiftslate-desktop/blob/master/SwiftSlate.pyw): `SwiftSlate.pyw`
- [Clipboard commands](https://github.com/musheer360/swiftslate-desktop/blob/master/SwiftSlate.pyw): `SwiftSlate.pyw`
- [Undo replacement](https://github.com/musheer360/swiftslate-desktop/blob/master/SwiftSlate.pyw): `SwiftSlate.pyw`

### Providers and state

- [API key rotation](https://github.com/musheer360/swiftslate-desktop/blob/master/SwiftSlate.pyw): `SwiftSlate.pyw`
- **Runtime configuration**
- [Hot reload](https://github.com/musheer360/swiftslate-desktop/blob/master/SwiftSlate.pyw): `SwiftSlate.pyw`

### Other components

- **User**
- **Target app**
- **AI provider endpoint**
- **Public IP service**
- **System clipboard**

## Connections

- User → Target app: types into (evidence: `README.md`)
- Target app → System input capture: provides system input (evidence: `README.md`)
- System input capture → Trigger dispatch: detects trigger (evidence: `README.md`)
- Trigger dispatch → Preceding text: selects preceding text (evidence: `README.md`)
- Trigger dispatch → Command definitions: resolves commands (evidence: `README.md`)
- Trigger dispatch → Spinner feedback: shows progress (evidence: `README.md`)
- Trigger dispatch → AI transformation: dispatches AI command (evidence: `README.md`)
- Trigger dispatch → Local replacers: dispatches replacer (evidence: `README.md`)
- Trigger dispatch → Clipboard commands: dispatches clipboard command (evidence: `README.md`)
- Trigger dispatch → Undo replacement: dispatches undo (evidence: `README.md`)
- AI transformation → API key rotation: obtains API key (evidence: `README.md`)
- API key rotation → Runtime configuration: reads configured keys (evidence: `README.md`)
- AI transformation → AI provider endpoint: sends text for transformation (evidence: `README.md`)
- AI provider endpoint → AI transformation: returns transformed text (evidence: `README.md`)
- Local replacers → Public IP service: looks up public IP (evidence: `README.md`)
- Clipboard commands → System clipboard: uses fallback clipboard (evidence: `README.md`)
- AI transformation → Inline replacement: returns transformed text (evidence: `README.md`)
- Local replacers → Inline replacement: returns replacement text (evidence: `README.md`)
- Inline replacement → Target app: replaces inline text (evidence: `README.md`)
- Undo replacement → Inline replacement: restores prior text (evidence: `README.md`)
- User → Runtime configuration: edits settings (evidence: `README.md`)
- User → Command definitions: edits commands (evidence: `README.md`)
- Hot reload → Runtime configuration: watches for changes (evidence: `README.md`)
- Hot reload → Command definitions: watches for changes (evidence: `README.md`)
