Skip to content

Commit a10639b

Browse files
authored
Merge pull request #207 from datlechin/feat/plugin-system
feat: plugin system with Settings UI
2 parents ec30ce7 + dd26545 commit a10639b

File tree

292 files changed

+10754
-11035
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

292 files changed

+10754
-11035
lines changed

CHANGELOG.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12-
- ClickHouse database support
13-
- ClickHouse query progress tracking with live rows/bytes display in toolbar
14-
- ClickHouse EXPLAIN variants (Plan, Pipeline, AST, Syntax, Estimate) via dropdown menu
15-
- ClickHouse TLS/HTTPS support for encrypted connections
16-
- ClickHouse server-side query cancellation (KILL QUERY)
17-
- ClickHouse Parts tab in Structure view showing partition/part details
12+
- Plugin system architecture — all 8 database drivers (MySQL, PostgreSQL, SQLite, ClickHouse, MSSQL, MongoDB, Redis, Oracle) extracted into `.tableplugin` bundles loaded at runtime
13+
- Settings > Plugins tab for plugin management — list installed plugins, enable/disable, install from file, uninstall user plugins, view plugin details
14+
- TableProPluginKit framework — shared protocols and types for driver plugins
15+
- ClickHouse database support with query progress tracking, EXPLAIN variants, TLS/HTTPS, server-side cancellation, and Parts view
1816

17+
### Changed
18+
19+
- Reorganized project directory structure: Services, Utilities, Models split into domain-specific subdirectories
20+
- Database driver code moved from monolithic app binary into independent plugin bundles under `Plugins/`
1921

2022
## [0.15.0] - 2026-03-08
2123

CLAUDE.md

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
66

77
TablePro is a native macOS database client (SwiftUI + AppKit) — a fast, lightweight alternative to TablePlus. macOS 14.0+, Swift 5.9, Universal Binary (arm64 + x86_64).
88

9-
- **Source**: `TablePro/``Core/` (business logic, drivers, services), `Views/` (UI), `Models/` (data structures), `ViewModels/`, `Extensions/`, `Theme/`
10-
- **C bridges**: `CMariaDB/` and `CLibPQ/` in `Core/Database/` — bridging headers for MariaDB and PostgreSQL C connectors
11-
- **Static libs**: `Libs/` — pre-built `libmariadb*.a` (Git LFS tracked)
12-
- **SPM deps**: CodeEditSourceEditor (`main` branch, tree-sitter editor), Sparkle (2.8.1, auto-update). Managed via Xcode, no `Package.swift`.
9+
- **Source**: `TablePro/``Core/` (business logic, services), `Views/` (UI), `Models/` (data structures), `ViewModels/`, `Extensions/`, `Theme/`
10+
- **Plugins**: `Plugins/` — 8 `.tableplugin` bundles (MySQL, PostgreSQL, SQLite, ClickHouse, MSSQL, MongoDB, Redis, Oracle) + `TableProPluginKit` shared framework
11+
- **C bridges**: Each plugin contains its own C bridge module (e.g., `Plugins/MySQLDriverPlugin/CMariaDB/`, `Plugins/PostgreSQLDriverPlugin/CLibPQ/`)
12+
- **Static libs**: `Libs/` — pre-built `libmariadb*.a`, `libpq*.a`, etc. (Git LFS tracked)
13+
- **SPM deps**: CodeEditSourceEditor (`main` branch, tree-sitter editor), Sparkle (2.8.1, auto-update), OracleNIO. Managed via Xcode, no `Package.swift`.
1314

1415
## Build & Development Commands
1516

@@ -42,17 +43,32 @@ scripts/create-dmg.sh
4243

4344
## Architecture
4445

45-
### Database Drivers
46+
### Plugin System
4647

47-
All database operations go through the `DatabaseDriver` protocol (`Core/Database/DatabaseDriver.swift`):
48+
All database drivers are `.tableplugin` bundles loaded at runtime by `PluginManager` (`Core/Plugins/`):
4849

49-
- **MySQLDriver** `MariaDBConnection` (C connector via CMariaDB)
50-
- **PostgreSQLDriver** `LibPQConnection` (C connector via CLibPQ)
51-
- **SQLiteDriver** → Foundation's `sqlite3` directly
52-
- **DatabaseManager** — connection pool, lifecycle, primary interface for views/coordinators
50+
- **TableProPluginKit** (`Plugins/TableProPluginKit/`) — shared framework with `PluginDatabaseDriver`, `DriverPlugin`, `TableProPlugin` protocols and transfer types (`PluginQueryResult`, `PluginColumnInfo`, etc.)
51+
- **PluginDriverAdapter** (`Core/Plugins/PluginDriverAdapter.swift`) — bridges `PluginDatabaseDriver``DatabaseDriver` protocol
52+
- **DatabaseDriverFactory** (`Core/Database/DatabaseDriver.swift`) — looks up plugins via `DatabaseType.pluginTypeId`
53+
- **DatabaseManager** (`Core/Database/DatabaseManager.swift`) — connection pool, lifecycle, primary interface for views/coordinators
5354
- **ConnectionHealthMonitor** — 30s ping, auto-reconnect with exponential backoff
5455

55-
When adding a new driver method: add to `DatabaseDriver` protocol, then implement in all three drivers.
56+
Plugin bundles under `Plugins/`:
57+
58+
| Plugin | Database Types | C Bridge |
59+
|--------|---------------|----------|
60+
| MySQLDriverPlugin | MySQL, MariaDB | CMariaDB |
61+
| PostgreSQLDriverPlugin | PostgreSQL, Redshift | CLibPQ |
62+
| SQLiteDriverPlugin | SQLite | (Foundation sqlite3) |
63+
| ClickHouseDriverPlugin | ClickHouse | (URLSession HTTP) |
64+
| MSSQLDriverPlugin | SQL Server | CFreeTDS |
65+
| MongoDBDriverPlugin | MongoDB | CLibMongoc |
66+
| RedisDriverPlugin | Redis | CRedis |
67+
| OracleDriverPlugin | Oracle | OracleNIO (SPM) |
68+
69+
When adding a new driver: create a new plugin bundle under `Plugins/`, implement `DriverPlugin` + `PluginDatabaseDriver`, add target to pbxproj. See `docs/development/plugin-system/` for details.
70+
71+
When adding a new method to the driver protocol: add to `PluginDatabaseDriver` (with default implementation), then update `PluginDriverAdapter` to bridge it to `DatabaseDriver`.
5672

5773
### Editor Architecture (CodeEditSourceEditor)
5874

@@ -73,6 +89,24 @@ When adding a new driver method: add to `DatabaseDriver` protocol, then implemen
7389

7490
`MainContentCoordinator` is the central coordinator, split across 7+ extension files in `Views/Main/Extensions/` (e.g., `+Alerts`, `+Filtering`, `+Pagination`, `+RowOperations`). When adding coordinator functionality, add a new extension file rather than growing the main file.
7591

92+
### Source Organization
93+
94+
`Core/Services/` is split into domain subdirectories:
95+
96+
| Subdirectory | Contents |
97+
|-------------|----------|
98+
| `Export/` | ExportService, ImportService, XLSXWriter |
99+
| `Formatting/` | SQLFormatterService, DateFormattingService |
100+
| `Infrastructure/` | AppNotifications, DeeplinkHandler, WindowOpener, UpdaterBridge, etc. |
101+
| `Licensing/` | LicenseManager, LicenseAPIClient, LicenseSignatureVerifier |
102+
| `Query/` | SQLDialectProvider, TableQueryBuilder, RowParser, RowOperationsManager |
103+
104+
`Models/` is split into: `AI/`, `Connection/`, `Database/`, `Export/`, `Query/`, `Settings/`, `UI/`, `Schema/`, `ClickHouse/`
105+
106+
`Core/Utilities/` is split into: `Connection/`, `SQL/`, `File/`, `UI/`
107+
108+
`Core/QuerySupport/` contains MongoDB and Redis query builders/statement generators (non-driver query logic).
109+
76110
### Storage Patterns
77111

78112
| What | How | Where |

0 commit comments

Comments
 (0)