# odahan/textaid architecture

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

- Interactive diagram: https://gitdiagram.com/odahan/textaid
- Repository: https://github.com/odahan/textaid

## Overview

TextAid is a local-first Windows text transformation and translation app. The main workflow captures selected text via the keyboard shortcut, identifies its language, resolves an action and provider profile, requests an AI transformation, then presents the result for review and application. Separate branches cover settings and provider connections, customizable actions, and translation-catalog review and language-pack exchange. The app entry point is the documented orchestrator. Some links use README or source-index evidence because the corresponding implementation was not excerpted; unsampled wiring is not assumed.

Main entry points: [`src/TextAid.App/App.xaml.cs`](https://github.com/odahan/textaid/blob/master/src/TextAid.App/App.xaml.cs) (App workflow), [`src/TextAid.App/Views/MainWindow.xaml.cs`](https://github.com/odahan/textaid/blob/master/src/TextAid.App/Views/MainWindow.xaml.cs) (Result preview), [`src/TextAid.AI/AiClientFactory.cs`](https://github.com/odahan/textaid/blob/master/src/TextAid.AI/AiClientFactory.cs) (AI client selection), [`src/TextAid.App/ViewModels/TranslationReviewViewModel.cs`](https://github.com/odahan/textaid/blob/master/src/TextAid.App/ViewModels/TranslationReviewViewModel.cs) (Translation review)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Capture and results"]
  node_app["App workflow<br/>[App.xaml.cs]"]
  node_mainvm["Main view model<br/>[MainViewModel.cs]"]
  node_mainwindow["Result preview<br/>[MainWindow.xaml.cs]"]
  node_markdown["Markdown rendering"]
end

subgraph group_domain["Actions and configuration"]
  node_session["Invocation state"]
  node_actions["Action definitions"]
  node_actionloader["Action loading<br/>[ActionLoader.cs]"]
  node_settings[("User configuration")]
  node_profiles["Profile resolution<br/>[ProfileResolver.cs]"]
  node_settingsui["Settings editor"]
end

subgraph group_ai["AI providers"]
  node_detection["Language detection"]
  node_transform["Text transformation"]
  node_clientfactory["AI client selection<br/>[AiClientFactory.cs]"]
  node_ollama["Ollama client"]
  node_remote["Compatible provider client"]
  node_account["OpenAI account session"]
end

subgraph group_translation["Translation resources"]
  node_languagecatalog[("Localization catalog")]
  node_languagepacks["Language-pack service"]
  node_review["Translation review"]
  node_reviewwindow["Review window"]
end

subgraph group_windows["Windows integration"]
  node_shortcuts["Shortcut detection"]
  node_keyboard["Keyboard hook<br/>[KeyboardHook.cs]"]
  node_clipboard["Clipboard capture<br/>[ClipboardReader.cs]"]
  node_resultactions["Apply or copy result<br/>[ResultActions.cs]"]
end

node_user(("User"))

node_user -->|"presses shortcut"| node_shortcuts
node_shortcuts -->|"signals sequence"| node_keyboard
node_app -->|"uses hook"| node_keyboard
node_app -->|"captures text"| node_clipboard
node_app -->|"manages invocation"| node_session
node_app -->|"loads actions"| node_actionloader
node_app -->|"resolves provider"| node_profiles
node_app -->|"requests detection"| node_detection
node_app -->|"requests transformation"| node_transform
node_app -->|"opens result UI"| node_mainwindow
node_mainwindow -->|"uses view model"| node_mainvm
node_mainvm -->|"updates invocation"| node_session
node_mainwindow -->|"renders preview"| node_markdown
node_mainwindow -.->|"applies result"| node_resultactions
node_app -->|"loads configuration"| node_settings
node_settingsui -->|"saves settings"| node_settings
node_settingsui -->|"resolves profiles"| node_profiles
node_profiles -->|"reads configuration"| node_settings
node_app -->|"selects client"| node_clientfactory
node_clientfactory -->|"creates local client"| node_ollama
node_clientfactory -->|"creates compatible client"| node_remote
node_clientfactory -->|"creates account client"| node_account
node_transform -.->|"streams inference"| node_ollama
node_detection -->|"uses transformation service"| node_transform
node_reviewwindow -->|"uses review model"| node_review
node_review -->|"reads and updates"| node_languagecatalog
node_review -->|"imports and exports"| node_languagepacks
node_languagepacks -->|"reads and writes catalog"| node_languagecatalog
node_app -->|"opens review"| node_reviewwindow

click node_shortcuts "https://github.com/odahan/textaid/blob/master/src/TextAid.Platform.Windows/ShortcutSequenceDetector.cs"
click node_keyboard "https://github.com/odahan/textaid/blob/master/src/TextAid.Platform.Windows/KeyboardHook.cs"
click node_clipboard "https://github.com/odahan/textaid/blob/master/src/TextAid.Platform.Windows/ClipboardReader.cs"
click node_app "https://github.com/odahan/textaid/blob/master/src/TextAid.App/App.xaml.cs"
click node_session "https://github.com/odahan/textaid/blob/master/src/TextAid.Core/InvocationSession.cs"
click node_mainvm "https://github.com/odahan/textaid/blob/master/src/TextAid.App/ViewModels/MainViewModel.cs"
click node_mainwindow "https://github.com/odahan/textaid/blob/master/src/TextAid.App/Views/MainWindow.xaml.cs"
click node_markdown "https://github.com/odahan/textaid/blob/master/src/TextAid.App/MarkdownPreviewRenderer.cs"
click node_resultactions "https://github.com/odahan/textaid/blob/master/src/TextAid.Platform.Windows/ResultActions.cs"
click node_actions "https://github.com/odahan/textaid/blob/master/src/TextAid.Core/ActionDefinition.cs"
click node_actionloader "https://github.com/odahan/textaid/blob/master/src/TextAid.Core/ActionLoader.cs"
click node_settings "https://github.com/odahan/textaid/blob/master/src/TextAid.Core/UserConfiguration.cs"
click node_profiles "https://github.com/odahan/textaid/blob/master/src/TextAid.Core/ProfileResolver.cs"
click node_settingsui "https://github.com/odahan/textaid/blob/master/src/TextAid.App/ViewModels/SettingsViewModel.cs"
click node_detection "https://github.com/odahan/textaid/blob/master/src/TextAid.AI/AiLanguageDetectionService.cs"
click node_transform "https://github.com/odahan/textaid/blob/master/src/TextAid.AI/MafTextTransformationService.cs"
click node_clientfactory "https://github.com/odahan/textaid/blob/master/src/TextAid.AI/AiClientFactory.cs"
click node_ollama "https://github.com/odahan/textaid/blob/master/src/TextAid.AI/OllamaChatClientFactory.cs"
click node_remote "https://github.com/odahan/textaid/blob/master/src/TextAid.AI/OpenAiCompatibleChatClientFactory.cs"
click node_account "https://github.com/odahan/textaid/blob/master/src/TextAid.AI/OpenAiAccountSession.cs"
click node_languagecatalog "https://github.com/odahan/textaid/blob/master/src/TextAid.Core/LocalizationCatalog.cs"
click node_languagepacks "https://github.com/odahan/textaid/blob/master/src/TextAid.Core/LanguagePackService.cs"
click node_review "https://github.com/odahan/textaid/blob/master/src/TextAid.App/ViewModels/TranslationReviewViewModel.cs"
click node_reviewwindow "https://github.com/odahan/textaid/blob/master/src/TextAid.App/Views/TranslationReviewWindow.xaml.cs"

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_app,node_mainvm,node_mainwindow,node_markdown,node_user toneBlue
class node_session,node_actions,node_actionloader,node_settings,node_profiles,node_settingsui toneAmber
class node_detection,node_transform,node_clientfactory,node_ollama,node_remote,node_account toneMint
class node_languagecatalog,node_languagepacks,node_review,node_reviewwindow toneRose
class node_shortcuts,node_keyboard,node_clipboard,node_resultactions toneIndigo
```

## Components

### Capture and results

- [App workflow](https://github.com/odahan/textaid/blob/master/src/TextAid.App/App.xaml.cs): `src/TextAid.App/App.xaml.cs`
- [Main view model](https://github.com/odahan/textaid/blob/master/src/TextAid.App/ViewModels/MainViewModel.cs): `src/TextAid.App/ViewModels/MainViewModel.cs`
- [Result preview](https://github.com/odahan/textaid/blob/master/src/TextAid.App/Views/MainWindow.xaml.cs): `src/TextAid.App/Views/MainWindow.xaml.cs`
- [Markdown rendering](https://github.com/odahan/textaid/blob/master/src/TextAid.App/MarkdownPreviewRenderer.cs): `src/TextAid.App/MarkdownPreviewRenderer.cs`

### Actions and configuration

- [Invocation state](https://github.com/odahan/textaid/blob/master/src/TextAid.Core/InvocationSession.cs): `src/TextAid.Core/InvocationSession.cs`
- [Action definitions](https://github.com/odahan/textaid/blob/master/src/TextAid.Core/ActionDefinition.cs): `src/TextAid.Core/ActionDefinition.cs`
- [Action loading](https://github.com/odahan/textaid/blob/master/src/TextAid.Core/ActionLoader.cs): `src/TextAid.Core/ActionLoader.cs`
- [User configuration](https://github.com/odahan/textaid/blob/master/src/TextAid.Core/UserConfiguration.cs): `src/TextAid.Core/UserConfiguration.cs`
- [Profile resolution](https://github.com/odahan/textaid/blob/master/src/TextAid.Core/ProfileResolver.cs): `src/TextAid.Core/ProfileResolver.cs`
- [Settings editor](https://github.com/odahan/textaid/blob/master/src/TextAid.App/ViewModels/SettingsViewModel.cs): `src/TextAid.App/ViewModels/SettingsViewModel.cs`

### AI providers

- [Language detection](https://github.com/odahan/textaid/blob/master/src/TextAid.AI/AiLanguageDetectionService.cs): `src/TextAid.AI/AiLanguageDetectionService.cs`
- [Text transformation](https://github.com/odahan/textaid/blob/master/src/TextAid.AI/MafTextTransformationService.cs): `src/TextAid.AI/MafTextTransformationService.cs`
- [AI client selection](https://github.com/odahan/textaid/blob/master/src/TextAid.AI/AiClientFactory.cs): `src/TextAid.AI/AiClientFactory.cs`
- [Ollama client](https://github.com/odahan/textaid/blob/master/src/TextAid.AI/OllamaChatClientFactory.cs): `src/TextAid.AI/OllamaChatClientFactory.cs`
- [Compatible provider client](https://github.com/odahan/textaid/blob/master/src/TextAid.AI/OpenAiCompatibleChatClientFactory.cs): `src/TextAid.AI/OpenAiCompatibleChatClientFactory.cs`
- [OpenAI account session](https://github.com/odahan/textaid/blob/master/src/TextAid.AI/OpenAiAccountSession.cs): `src/TextAid.AI/OpenAiAccountSession.cs`

### Translation resources

- [Localization catalog](https://github.com/odahan/textaid/blob/master/src/TextAid.Core/LocalizationCatalog.cs): `src/TextAid.Core/LocalizationCatalog.cs`
- [Language-pack service](https://github.com/odahan/textaid/blob/master/src/TextAid.Core/LanguagePackService.cs): `src/TextAid.Core/LanguagePackService.cs`
- [Translation review](https://github.com/odahan/textaid/blob/master/src/TextAid.App/ViewModels/TranslationReviewViewModel.cs): `src/TextAid.App/ViewModels/TranslationReviewViewModel.cs`
- [Review window](https://github.com/odahan/textaid/blob/master/src/TextAid.App/Views/TranslationReviewWindow.xaml.cs): `src/TextAid.App/Views/TranslationReviewWindow.xaml.cs`

### Windows integration

- [Shortcut detection](https://github.com/odahan/textaid/blob/master/src/TextAid.Platform.Windows/ShortcutSequenceDetector.cs): `src/TextAid.Platform.Windows/ShortcutSequenceDetector.cs`
- [Keyboard hook](https://github.com/odahan/textaid/blob/master/src/TextAid.Platform.Windows/KeyboardHook.cs): `src/TextAid.Platform.Windows/KeyboardHook.cs`
- [Clipboard capture](https://github.com/odahan/textaid/blob/master/src/TextAid.Platform.Windows/ClipboardReader.cs): `src/TextAid.Platform.Windows/ClipboardReader.cs`
- [Apply or copy result](https://github.com/odahan/textaid/blob/master/src/TextAid.Platform.Windows/ResultActions.cs): `src/TextAid.Platform.Windows/ResultActions.cs`

### Other components

- **User**

## Connections

- User → Shortcut detection: presses shortcut (evidence: `README.md`)
- Shortcut detection → Keyboard hook: signals sequence (evidence: `src/TextAid.Platform.Windows/KeyboardHook.cs`)
- App workflow → Keyboard hook: uses hook (evidence: `src/TextAid.App/App.xaml.cs`)
- App workflow → Clipboard capture: captures text (evidence: `src/TextAid.App/App.xaml.cs`)
- App workflow → Invocation state: manages invocation (evidence: `src/TextAid.App/App.xaml.cs`)
- App workflow → Action loading: loads actions (evidence: `src/TextAid.App/App.xaml.cs`)
- App workflow → Profile resolution: resolves provider (evidence: `src/TextAid.App/App.xaml.cs`)
- App workflow → Language detection: requests detection (evidence: `src/TextAid.App/App.xaml.cs`)
- App workflow → Text transformation: requests transformation (evidence: `src/TextAid.App/App.xaml.cs`)
- App workflow → Result preview: opens result UI (evidence: `src/TextAid.App/App.xaml.cs`)
- Result preview → Main view model: uses view model (evidence: `src/TextAid.App/Views/MainWindow.xaml.cs`)
- Main view model → Invocation state: updates invocation (evidence: `src/TextAid.App/ViewModels/MainViewModel.cs`)
- Result preview → Markdown rendering: renders preview (evidence: `src/TextAid.App/Views/MainWindow.xaml.cs`)
- Result preview → Apply or copy result: applies result
- App workflow → User configuration: loads configuration (evidence: `src/TextAid.App/App.xaml.cs`)
- Settings editor → User configuration: saves settings (evidence: `src/TextAid.App/ViewModels/SettingsViewModel.cs`)
- Settings editor → Profile resolution: resolves profiles (evidence: `src/TextAid.App/ViewModels/SettingsViewModel.cs`)
- Profile resolution → User configuration: reads configuration (evidence: `src/TextAid.Core/ProfileResolver.cs`)
- App workflow → AI client selection: selects client (evidence: `src/TextAid.App/App.xaml.cs`)
- AI client selection → Ollama client: creates local client (evidence: `src/TextAid.AI/AiClientFactory.cs`)
- AI client selection → Compatible provider client: creates compatible client (evidence: `src/TextAid.AI/AiClientFactory.cs`)
- AI client selection → OpenAI account session: creates account client (evidence: `src/TextAid.AI/AiClientFactory.cs`)
- Text transformation → Ollama client: streams inference
- Language detection → Text transformation: uses transformation service (evidence: `src/TextAid.AI/AiLanguageDetectionService.cs`)
- Review window → Translation review: uses review model (evidence: `src/TextAid.App/Views/TranslationReviewWindow.xaml.cs`)
- Translation review → Localization catalog: reads and updates (evidence: `src/TextAid.App/ViewModels/TranslationReviewViewModel.cs`)
- Translation review → Language-pack service: imports and exports (evidence: `src/TextAid.App/ViewModels/TranslationReviewViewModel.cs`)
- Language-pack service → Localization catalog: reads and writes catalog (evidence: `src/TextAid.Core/LanguagePackService.cs`)
- App workflow → Review window: opens review (evidence: `src/TextAid.App/App.xaml.cs`)
