Skip to content

Commit 800a8fa

Browse files
committed
Refactor: Modularized IdeLayout and centralized Rust workspace dependencies. Fix: Tauri dialog imports.
1 parent 4fe4d3c commit 800a8fa

39 files changed

Lines changed: 445 additions & 647 deletions

ARCHITECTURE.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# MeaCode Studio - Project Architecture
2+
3+
This document describes the organization and architecture of MeaCode Studio to ensure scalability and maintainability.
4+
5+
## Directory Structure
6+
7+
### `/apps` (Planned)
8+
Future entry points for different platforms.
9+
10+
### `/kernel`
11+
Core logic written in Rust. Organized as a Cargo workspace.
12+
- `kernel-core`: Core engine logic.
13+
- `kernel-lsp`: Language Server Protocol integration.
14+
- `kernel-ai`: AI and LLM integration.
15+
16+
### `/src` (Frontend)
17+
The frontend is built with React, TypeScript, and Tailwind CSS. It follows a **Feature-Based Architecture**.
18+
19+
- `api/`: IPC (Inter-Process Communication) wrappers for Tauri commands.
20+
- `core/`: Global state management, context providers, and core application logic.
21+
- `features/`: Isolated feature modules. Each feature contains its own components, hooks, and logic.
22+
- `editor/`: Monaco editor integration and file editing.
23+
- `explorer/`: File system navigation.
24+
- `terminal/`: Integrated terminal.
25+
- `ai/`: AI chat and assistance.
26+
- `settings/`: Application configuration.
27+
- `shared/`: Reusable resources used across multiple features.
28+
- `components/`: Generic UI components (buttons, modals, etc.).
29+
- `hooks/`: Generic React hooks.
30+
- `utils/`: Helper functions.
31+
- `layout/`: Main application shell and layout-specific components.
32+
33+
### `/src-tauri`
34+
The Tauri backend configuration and main entry point for the desktop application.
35+
36+
## Scaling Principles
37+
1. **Isolation**: Keep features as independent as possible.
38+
2. **Shared vs. Feature**: Only put code in `shared/` if it is truly generic. If it's specific to a feature, keep it inside `features/`.
39+
3. **Rust for Heavy Lifting**: Perform performance-critical or system-level tasks in the Rust kernel crates.
40+
4. **Small Components**: Avoid large monolithic files. Break down complex components into smaller ones.

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ members = [
88

99
resolver = "2"
1010

11+
[workspace.dependencies]
12+
anyhow = "1"
13+
serde = { version = "1", features = ["derive"] }
14+
serde_json = "1"
15+
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
16+
1117
[profile.dev]
1218
opt-level = 1 # Optimización ligera para desarrollo más rápido
1319
incremental = true

kernel/kernel-ai/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7-
anyhow = "1"
8-
serde = { version = "1", features = ["derive"] }
9-
serde_json = "1"
10-
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
7+
anyhow.workspace = true
8+
serde.workspace = true
9+
serde_json.workspace = true
10+
tokio.workspace = true
1111
reqwest = { version = "0.11", features = ["json"] }
1212
async-trait = "0.1"
1313

kernel/kernel-core/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7-
anyhow = "1"
8-
serde = { version = "1", features = ["derive"] }
9-
serde_json = "1"
10-
tokio = { version = "1", features = ["rt-multi-thread", "macros", "fs"] }
7+
anyhow.workspace = true
8+
serde.workspace = true
9+
serde_json.workspace = true
10+
tokio = { workspace = true, features = ["fs"] }

kernel/kernel-lsp/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7-
anyhow = "1"
8-
serde = { version = "1", features = ["derive"] }
9-
serde_json = "1"
10-
tokio = { version = "1", features = ["rt-multi-thread", "macros", "io-std", "io-util", "sync"] }
7+
anyhow.workspace = true
8+
serde.workspace = true
9+
serde_json.workspace = true
10+
tokio = { workspace = true, features = ["io-std", "io-util", "sync"] }
1111
tower-lsp = { version = "0.20", features = ["proposed"] }
1212
tracing = "0.1"
1313
tracing-subscriber = { version = "0.3", features = ["fmt", "env-filter"] }

src-tauri/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ edition = "2021"
77
rust-version = "1.70"
88

99
[dependencies]
10-
anyhow = "1"
11-
serde = { version = "1", features = ["derive"] }
12-
serde_json = "1"
10+
anyhow.workspace = true
11+
serde.workspace = true
12+
serde_json.workspace = true
1313
tauri = { version = "1", features = ["dialog"] }
14-
tokio = { version = "1", features = ["rt-multi-thread", "macros", "process"] }
14+
tokio = { workspace = true, features = ["process"] }
1515
kernel-core = { path = "../kernel/kernel-core" }
1616
kernel-lsp = { path = "../kernel/kernel-lsp" }
1717

src-tauri/src/main.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
use tokio::fs;
44
use std::process::Stdio;
55
use tokio::process::Command;
6-
use tauri::api::dialog::blocking::{FileDialogBuilder, MessageDialogBuilder, MessageDialogButtons, MessageDialogKind};
6+
use tauri::api::dialog::blocking::{FileDialogBuilder, MessageDialogBuilder};
7+
use tauri::api::dialog::{MessageDialogButtons, MessageDialogKind};
78
use kernel_lsp::{engine_completions, engine_diagnostics, engine_hover};
89
use serde::Serialize;
910
use tokio::time::{timeout, Duration};
@@ -238,7 +239,7 @@ async fn delete_item(path: String) -> Result<bool, String> {
238239
let name = path_obj.file_name().unwrap_or_default().to_string_lossy();
239240
let is_dir = path_obj.is_dir();
240241
let confirm = MessageDialogBuilder::new("Confirmación", format!("¿Estás seguro de que quieres eliminar {} '{}'?", if is_dir { "la carpeta" } else { "el archivo" }, name))
241-
.buttons(MessageDialogButtons::OkCancelCustom("Eliminar".into(), "Cancelar".into()))
242+
.buttons(MessageDialogButtons::OkCancel)
242243
.kind(MessageDialogKind::Warning)
243244
.show();
244245

src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react'
22
import { IdeLayout } from './layout/IdeLayout'
3-
import { ErrorBoundary } from './components/ErrorBoundary'
3+
import { ErrorBoundary } from './shared/components/ErrorBoundary'
44

55
const App: React.FC = () => {
66
return (
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import {
44
getModelsListUrl,
55
loadAISettings,
66
type AISettings,
7-
} from '../utils/aiSettings'
8-
import { pickBestChatModel, type ModelTaskKind } from '../utils/aiModelPick'
7+
} from '../shared/utils/aiSettings'
8+
import { pickBestChatModel, type ModelTaskKind } from '../shared/utils/aiModelPick'
99

1010
export async function callKernel<T = unknown>(
1111
command: string,

0 commit comments

Comments
 (0)