# oliclice/vmtool architecture

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

- Interactive diagram: https://gitdiagram.com/oliclice/vmtool
- Repository: https://github.com/oliclice/vmtool

## Overview

VM-TOOL is a Chinese input-method dictionary-table manager with CLI and PyQt interfaces. Users add, query, edit, delete, import, and export entries; they can also generate codes, calculate weights, deduplicate/filter entries, and inspect statistics. The main runtime path is an interface calling application services, which use repositories and the SQLite persistence layer. GUI background threads create thread-local services. The README documents additional export targets and plugin support; some subsystem wiring is not present in the sampled source, so uncertain links are omitted.

Main entry points: [`vm-tool/app/services/dict.py`](https://github.com/oliclice/vmtool/blob/main/vm-tool/app/services/dict.py) (Dictionary service), [`vm-tool/ui/cli/__main__.py`](https://github.com/oliclice/vmtool/blob/main/vm-tool/ui/cli/__main__.py) (CLI commands), [`vm-tool/ui/gui/tabs`](https://github.com/oliclice/vmtool/tree/main/vm-tool/ui/gui/tabs) (GUI feature tabs), [`vm-tool/ui/gui/threads`](https://github.com/oliclice/vmtool/tree/main/vm-tool/ui/gui/threads) (GUI workers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_cli["CLI commands<br/>[__main__.py]"]
  node_gui["GUI application<br/>[pyqt_app.py]"]
  node_gui_tabs["GUI feature tabs"]
  node_gui_settings["GUI settings"]
  node_gui_threads["GUI workers"]
end

subgraph group_dictionary["Dictionary operations"]
  node_dict_service["Dictionary service<br/>[dict.py]"]
  node_codegen["Code generator<br/>[code_generator.py]"]
end

subgraph group_analysis["Processing and reporting"]
  node_weight["Weight calculator<br/>[weight.py]"]
  node_filter["Filter and transfer<br/>[filter.py]"]
  node_stats["Statistics service<br/>[stats.py]"]
  node_frequency["Frequency data<br/>[thuocl.py]"]
end

subgraph group_storage["Persistence"]
  node_repository["Word repository<br/>[repositories.py]"]
  node_models["Entry model<br/>[models.py]"]
  node_database[("SQLite database<br/>[database.py]")]
end

subgraph group_platform["Configuration and extensions"]
  node_config["Runtime configuration<br/>[config_manager.py]"]
  node_cache["Application cache<br/>[cache.py]"]
  node_plugins["Plugin manager<br/>[manager.py]"]
  node_plugin_api["Plugin API<br/>[base.py]"]
end

node_user(("User"))
node_rime["Rime export directories"]

node_user -->|"runs commands"| node_cli
node_user -->|"uses application"| node_gui
node_cli -->|"calls dictionary operations"| node_dict_service
node_cli -->|"requests weight calculation"| node_weight
node_cli -->|"requests code generation"| node_codegen
node_cli -->|"imports and exports"| node_filter
node_cli -->|"requests statistics"| node_stats
node_gui -->|"presents features"| node_gui_tabs
node_gui -->|"presents settings"| node_gui_settings
node_gui_tabs -->|"manages entries"| node_dict_service
node_gui_tabs -->|"requests statistics"| node_stats
node_gui_tabs -->|"starts background work"| node_gui_threads
node_gui_settings -->|"reads and saves settings"| node_config
node_gui_threads -->|"creates thread-local service"| node_dict_service
node_gui_threads -->|"creates thread-local calculator"| node_weight
node_gui_threads -->|"creates thread-local service"| node_filter
node_dict_service -->|"reads and writes entries"| node_repository
node_dict_service -->|"generates missing codes"| node_codegen
node_weight -->|"uses frequency data"| node_frequency
node_repository -->|"queries entry model"| node_models
node_repository -->|"persists entries"| node_database
node_dict_service -->|"uses operation cache"| node_cache
node_plugins -->|"loads plugin implementations"| node_plugin_api
node_dict_service -.->|"exports dictionary files"| node_rime

click node_cli "https://github.com/oliclice/vmtool/blob/main/vm-tool/ui/cli/__main__.py"
click node_gui "https://github.com/oliclice/vmtool/blob/main/vm-tool/ui/gui/pyqt_app.py"
click node_gui_tabs "https://github.com/oliclice/vmtool/tree/main/vm-tool/ui/gui/tabs"
click node_gui_settings "https://github.com/oliclice/vmtool/tree/main/vm-tool/ui/gui/settings"
click node_gui_threads "https://github.com/oliclice/vmtool/tree/main/vm-tool/ui/gui/threads"
click node_dict_service "https://github.com/oliclice/vmtool/blob/main/vm-tool/app/services/dict.py"
click node_codegen "https://github.com/oliclice/vmtool/blob/main/vm-tool/app/services/code_generator.py"
click node_weight "https://github.com/oliclice/vmtool/blob/main/vm-tool/app/services/weight.py"
click node_filter "https://github.com/oliclice/vmtool/blob/main/vm-tool/app/services/filter.py"
click node_stats "https://github.com/oliclice/vmtool/blob/main/vm-tool/app/services/stats.py"
click node_frequency "https://github.com/oliclice/vmtool/blob/main/vm-tool/app/services/thuocl.py"
click node_repository "https://github.com/oliclice/vmtool/blob/main/vm-tool/app/dal/repositories.py"
click node_models "https://github.com/oliclice/vmtool/blob/main/vm-tool/app/dal/models.py"
click node_database "https://github.com/oliclice/vmtool/blob/main/vm-tool/app/dal/database.py"
click node_config "https://github.com/oliclice/vmtool/blob/main/vm-tool/app/core/config_manager.py"
click node_cache "https://github.com/oliclice/vmtool/blob/main/vm-tool/app/core/cache.py"
click node_plugins "https://github.com/oliclice/vmtool/blob/main/vm-tool/app/plugins/manager.py"
click node_plugin_api "https://github.com/oliclice/vmtool/blob/main/vm-tool/app/plugins/base.py"

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_gui_tabs,node_gui_settings,node_gui_threads,node_user toneBlue
class node_dict_service,node_codegen toneAmber
class node_weight,node_filter,node_stats,node_frequency toneMint
class node_repository,node_models,node_database toneRose
class node_config,node_cache,node_plugins,node_plugin_api,node_rime toneIndigo
```

## Components

### User interfaces

- [CLI commands](https://github.com/oliclice/vmtool/blob/main/vm-tool/ui/cli/__main__.py): `vm-tool/ui/cli/__main__.py`
- [GUI application](https://github.com/oliclice/vmtool/blob/main/vm-tool/ui/gui/pyqt_app.py): `vm-tool/ui/gui/pyqt_app.py`
- [GUI feature tabs](https://github.com/oliclice/vmtool/tree/main/vm-tool/ui/gui/tabs): `vm-tool/ui/gui/tabs`
- [GUI settings](https://github.com/oliclice/vmtool/tree/main/vm-tool/ui/gui/settings): `vm-tool/ui/gui/settings`
- [GUI workers](https://github.com/oliclice/vmtool/tree/main/vm-tool/ui/gui/threads): `vm-tool/ui/gui/threads`

### Dictionary operations

- [Dictionary service](https://github.com/oliclice/vmtool/blob/main/vm-tool/app/services/dict.py): `vm-tool/app/services/dict.py`
- [Code generator](https://github.com/oliclice/vmtool/blob/main/vm-tool/app/services/code_generator.py): `vm-tool/app/services/code_generator.py`

### Processing and reporting

- [Weight calculator](https://github.com/oliclice/vmtool/blob/main/vm-tool/app/services/weight.py): `vm-tool/app/services/weight.py`
- [Filter and transfer](https://github.com/oliclice/vmtool/blob/main/vm-tool/app/services/filter.py): `vm-tool/app/services/filter.py`
- [Statistics service](https://github.com/oliclice/vmtool/blob/main/vm-tool/app/services/stats.py): `vm-tool/app/services/stats.py`
- [Frequency data](https://github.com/oliclice/vmtool/blob/main/vm-tool/app/services/thuocl.py): `vm-tool/app/services/thuocl.py`

### Persistence

- [Word repository](https://github.com/oliclice/vmtool/blob/main/vm-tool/app/dal/repositories.py): `vm-tool/app/dal/repositories.py`
- [Entry model](https://github.com/oliclice/vmtool/blob/main/vm-tool/app/dal/models.py): `vm-tool/app/dal/models.py`
- [SQLite database](https://github.com/oliclice/vmtool/blob/main/vm-tool/app/dal/database.py): `vm-tool/app/dal/database.py`

### Configuration and extensions

- [Runtime configuration](https://github.com/oliclice/vmtool/blob/main/vm-tool/app/core/config_manager.py): `vm-tool/app/core/config_manager.py`
- [Application cache](https://github.com/oliclice/vmtool/blob/main/vm-tool/app/core/cache.py): `vm-tool/app/core/cache.py`
- [Plugin manager](https://github.com/oliclice/vmtool/blob/main/vm-tool/app/plugins/manager.py): `vm-tool/app/plugins/manager.py`
- [Plugin API](https://github.com/oliclice/vmtool/blob/main/vm-tool/app/plugins/base.py): `vm-tool/app/plugins/base.py`

### Other components

- **User**
- **Rime export directories**

## Connections

- User → CLI commands: runs commands
- User → GUI application: uses application
- CLI commands → Dictionary service: calls dictionary operations
- CLI commands → Weight calculator: requests weight calculation
- CLI commands → Code generator: requests code generation
- CLI commands → Filter and transfer: imports and exports
- CLI commands → Statistics service: requests statistics
- GUI application → GUI feature tabs: presents features
- GUI application → GUI settings: presents settings
- GUI feature tabs → Dictionary service: manages entries
- GUI feature tabs → Statistics service: requests statistics
- GUI feature tabs → GUI workers: starts background work
- GUI settings → Runtime configuration: reads and saves settings
- GUI workers → Dictionary service: creates thread-local service
- GUI workers → Weight calculator: creates thread-local calculator
- GUI workers → Filter and transfer: creates thread-local service
- Dictionary service → Word repository: reads and writes entries
- Dictionary service → Code generator: generates missing codes
- Weight calculator → Frequency data: uses frequency data
- Word repository → Entry model: queries entry model
- Word repository → SQLite database: persists entries
- Dictionary service → Application cache: uses operation cache
- Plugin manager → Plugin API: loads plugin implementations
- Dictionary service → Rime export directories: exports dictionary files
