Skip to content

Commit dc0e32b

Browse files
authored
refactor module structure (#100)
* refactor module structure * Fix clippy warnings and update doctests after refactoring - Remove unused import AnalysisCommands from main.rs - Mark unused helper functions with #[allow(dead_code)] - print_getting_started, print_import_help, print_supported_formats, print_environment_config, print_full_getting_started in help.rs - handle_init_command in init.rs - needs_setup in setup.rs - Update doctests to use new crate names - retrochat::* -> retrochat_core::* in message.rs - retrochat::tui::* -> retrochat_tui::* in text.rs and layout.rs All tests passing (203 tests). Clippy clean with -D warnings. * Exclude retrochat-gui from CI workspace checks The GUI package requires platform-specific system dependencies (glib, gtk) that are not available in the Ubuntu CI environment. GUI builds are handled separately by the release-tauri.yml workflow which sets up the necessary dependencies for each platform. This change excludes retrochat-gui from: - cargo test --workspace - cargo clippy --workspace - cargo check --workspace The GUI package will continue to be built and tested in its dedicated release workflow with proper system dependencies installed.
1 parent baa83b9 commit dc0e32b

File tree

252 files changed

+17866
-5917
lines changed

Some content is hidden

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

252 files changed

+17866
-5917
lines changed

.cargo/config.toml

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
[alias]
2-
# Development aliases
3-
t = "test --verbose"
4-
c = "check --verbose"
5-
b = "build"
6-
br = "build --release"
2+
# Test aliases
3+
t = "test --workspace --verbose"
4+
tc = "test -p retrochat-core --verbose"
5+
tt = "test -p retrochat-tui --verbose"
6+
tcli = "test -p retrochat-cli --verbose"
7+
tgui = "test -p retrochat-gui --verbose"
78

8-
# Code quality aliases
9+
# Build aliases
10+
c = "check --workspace --verbose"
11+
b = "build --workspace"
12+
br = "build --release --workspace"
13+
14+
# Code quality
915
fmt-check = "fmt --all -- --check"
1016
fmt-fix = "fmt --all"
11-
clippy-strict = "clippy -- -D warnings"
17+
clippy-strict = "clippy --workspace -- -D warnings"
18+
19+
# Package-specific run commands
20+
core = "run -p retrochat-core"
21+
cli = "run -p retrochat-cli"
22+
tui = "run -p retrochat-cli" # TUI is embedded in CLI
23+
gui = "run -p retrochat-gui"
1224

13-
# Application run aliases
14-
tui = "run"
25+
# Clean commands
26+
clean-all = "clean --workspace"

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- uses: dtolnay/rust-toolchain@1.88.0
2121
- uses: Swatinem/rust-cache@v2
2222
- name: Run tests
23-
run: cargo test --verbose
23+
run: cargo test --workspace --exclude retrochat-gui --verbose
2424

2525
clippy:
2626
name: Clippy
@@ -32,7 +32,7 @@ jobs:
3232
components: clippy
3333
- uses: Swatinem/rust-cache@v2
3434
- name: Run clippy
35-
run: cargo clippy -- -D warnings
35+
run: cargo clippy --workspace --exclude retrochat-gui -- -D warnings
3636

3737
fmt:
3838
name: Rustfmt
@@ -53,7 +53,7 @@ jobs:
5353
- uses: dtolnay/rust-toolchain@1.91.1
5454
- uses: Swatinem/rust-cache@v2
5555
- name: Check compilation
56-
run: cargo check --verbose
56+
run: cargo check --workspace --exclude retrochat-gui --verbose
5757

5858
biome:
5959
name: Biome (UI React)

CLAUDE.md

Lines changed: 60 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,36 @@
1717
- pnpm for package management
1818

1919
## Project Structure
20+
21+
The project uses a Cargo workspace with 4 separate packages:
22+
2023
```
21-
src/
22-
├── models/ # Data structures and database models
23-
├── services/ # Business logic and file processing
24-
├── cli/ # Command-line interface
25-
├── tui/ # Terminal user interface
26-
└── lib/ # Shared utilities
27-
28-
src-tauri/ # Tauri desktop application backend
29-
├── src/ # Tauri Rust application code
30-
├── Cargo.toml # Tauri dependencies
31-
└── tauri.conf.json # Tauri configuration
32-
33-
ui-react/ # React frontend for Tauri desktop app
34-
├── src/ # React components and application code
35-
├── package.json # Frontend dependencies
36-
├── biome.json # Biome configuration for linting/formatting
37-
└── vite.config.js # Vite build configuration
38-
39-
tests/
40-
├── contract/ # API contract tests
41-
├── integration/ # Integration tests
42-
└── unit/ # Unit tests
24+
crates/
25+
├── retrochat-core/ # Core library
26+
│ ├── src/ # Database, models, services, parsers, tools, utils
27+
│ ├── migrations/ # SQL migrations
28+
│ ├── .sqlx/ # SQLx metadata
29+
│ └── tests/ # Unit and integration tests
30+
31+
├── retrochat-tui/ # Terminal UI library
32+
│ └── src/ # TUI components, events, state
33+
34+
├── retrochat-cli/ # CLI binary (default, includes TUI)
35+
│ ├── src/
36+
│ │ ├── main.rs # Entry point (launches TUI or CLI)
37+
│ │ └── commands/ # CLI command handlers
38+
│ └── tests/contract/ # CLI contract tests
39+
40+
└── retrochat-gui/ # Tauri desktop application
41+
├── src/ # Tauri Rust backend
42+
├── icons/ # App icons
43+
└── tauri.conf.json # Tauri configuration
44+
45+
ui-react/ # React frontend for Tauri desktop app
46+
├── src/ # React components and application code
47+
├── package.json # Frontend dependencies
48+
├── biome.json # Biome configuration
49+
└── vite.config.js # Vite build configuration
4350
```
4451

4552
## Commands
@@ -48,19 +55,25 @@ tests/
4855

4956
#### Cargo Aliases (defined in .cargo/config.toml)
5057
```bash
51-
# Short aliases for common commands
52-
cargo t # Run test suite (test --verbose)
53-
cargo c # Cargo check (check --verbose)
54-
cargo b # Cargo build
55-
cargo br # Cargo build --release
58+
# Test aliases
59+
cargo t # Run test suite (test --workspace --verbose)
60+
cargo tc # Test core package (test -p retrochat-core --verbose)
61+
cargo tcli # Test CLI package (test -p retrochat-cli --verbose)
62+
63+
# Build aliases
64+
cargo c # Cargo check (check --workspace --verbose)
65+
cargo b # Cargo build (build --workspace)
66+
cargo br # Cargo build --release (build --release --workspace)
5667

5768
# Code quality
5869
cargo fmt-check # Check formatting (fmt --all -- --check)
5970
cargo fmt-fix # Apply formatting (fmt --all)
60-
cargo clippy-strict # Run clippy with -D warnings
71+
cargo clippy-strict # Run clippy with -D warnings (clippy --workspace -- -D warnings)
6172

62-
# Application shortcuts
63-
cargo tui # Launch TUI interface (run -- same as cargo run)
73+
# Package-specific run commands
74+
cargo cli # Run CLI (run -p retrochat-cli)
75+
cargo tui # Launch TUI (run -p retrochat-cli, same as cli)
76+
cargo gui # Run GUI (run -p retrochat-gui)
6477
```
6578

6679
#### Shell Scripts (in ./scripts)
@@ -73,31 +86,31 @@ cargo tui # Launch TUI interface (run -- same as cargo run)
7386
### Direct Cargo Commands
7487
```bash
7588
# Build and test commands
76-
cargo check && cargo test && cargo clippy
77-
cargo run # Launch TUI interface (default)
89+
cargo check --workspace && cargo test --workspace && cargo clippy --workspace
90+
cargo run -p retrochat-cli # Launch TUI interface (default)
7891

7992
# Sync commands
80-
cargo run -- sync claude gemini # Import from provider directories
81-
cargo run -- sync all # Import from all providers
82-
cargo run -- sync --path /path/to/files # Import from specific path
83-
cargo run -- sync --path /path/to/file.jsonl # Import a single file
84-
cargo run -- sync claude -w --verbose # Watch mode with detailed output
85-
cargo run -- sync all --watch --verbose # Watch all providers
93+
cargo run -p retrochat-cli -- sync claude gemini # Import from provider directories
94+
cargo run -p retrochat-cli -- sync all # Import from all providers
95+
cargo run -p retrochat-cli -- sync --path /path/to/files # Import from specific path
96+
cargo run -p retrochat-cli -- sync --path /path/to/file.jsonl # Import a single file
97+
cargo run -p retrochat-cli -- sync claude -w --verbose # Watch mode with detailed output
98+
cargo run -p retrochat-cli -- sync all --watch --verbose # Watch all providers
8699

87100
# Query commands
88-
cargo run -- list # List all sessions
89-
cargo run -- list --provider claude # List sessions by provider
90-
cargo run -- show SESSION_ID # Show session details
91-
cargo run -- search "query" # Search messages
101+
cargo run -p retrochat-cli -- list # List all sessions
102+
cargo run -p retrochat-cli -- list --provider claude # List sessions by provider
103+
cargo run -p retrochat-cli -- show SESSION_ID # Show session details
104+
cargo run -p retrochat-cli -- search "query" # Search messages
92105

93106
# Analysis commands (requires GOOGLE_AI_API_KEY env var)
94-
cargo run -- analysis run [SESSION_ID] [--all] # Analyze sessions
95-
cargo run -- analysis show [SESSION_ID] [--all] [--format text|json|markdown] # View results
96-
cargo run -- analysis status [--all|--history|--watch] # Check analysis status
97-
cargo run -- analysis cancel [REQUEST_ID] [--all] # Cancel operations
107+
cargo run -p retrochat-cli -- analysis run [SESSION_ID] [--all] # Analyze sessions
108+
cargo run -p retrochat-cli -- analysis show [SESSION_ID] [--all] # View results
109+
cargo run -p retrochat-cli -- analysis status [--all|--history|--watch] # Check status
110+
cargo run -p retrochat-cli -- analysis cancel [REQUEST_ID] [--all] # Cancel operations
98111

99112
# Export commands
100-
cargo run -- export --format json # Export to JSON
113+
cargo run -p retrochat-cli -- export --format json # Export to JSON
101114
cargo run -- export --format jsonl # Export to JSONL
102115
```
103116

0 commit comments

Comments
 (0)