06a1ca11ce
Rename clean del proyecto astrológico antes de empezar el módulo
web (fase 2 = server axum, fase 3 = cliente WASM). Hacerlo ahora
ahorra refactor de URLs, package.json, paths de assets HTML y
deploy configs que aparecerían con el nombre en cuanto exista el
server.
Mecánica:
- `git mv` de los 10 crates de módulo + 2 apps:
* `crates/modules/tahuantinsuyu/` → `cosmobiologia/`
* `crates/modules/tahuantinsuyu/tahuantinsuyu-*` →
`cosmobiologia/cosmobiologia-*`
* `crates/apps/tahuantinsuyu` y `tahuantinsuyu-cli` análogos.
- Sed sobre todos los `.rs` y `.toml`: `tahuantinsuyu` →
`cosmobiologia` (cubre crate names, deps paths, use
statements, ProjectDirs literals, binary names).
- Workspace `Cargo.toml`: members con paths nuevos.
- Memoria del proyecto (`~/.claude/.../memory/project_*.md`)
actualizada.
Cero leftovers: `grep -rn tahuantinsuyu --include="*.rs"
--include="*.toml" crates/` devuelve vacío.
DB & XDG: clean slate. La nueva app arranca con DB vacía en
`$XDG_DATA_HOME/cosmobiologia/charts.db`. Si tenías cartas
guardadas, viven todavía en `~/.local/share/tahuantinsuyu/` —
las podés migrar manualmente con un `cp`.
IDs UI inalterados: el prefijo `tts-` de gpui ElementIds queda
igual (cosmético, no afecta funcionalidad). Cambiarlo a `cb-`
ahora sería 3-4 líneas más de sed pero ningún beneficio
operativo.
Tests: 20 verdes (10 shell + 10 render math). Compila full:
`cargo check -p cosmobiologia` OK.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
96 lines
3.8 KiB
Rust
96 lines
3.8 KiB
Rust
//! Tahuantinsuyu — binario standalone.
|
|
//!
|
|
//! Boot:
|
|
//! 1. `cosmobiologia_card::spawn_sidecar()` se presenta al Init brahman
|
|
//! (fire-and-forget; si no hay Init, la app sigue standalone).
|
|
//! 2. Abre la DB SQLite en `$XDG_DATA_HOME/cosmobiologia/charts.db`
|
|
//! (fallback a `~/.local/share/cosmobiologia/charts.db`).
|
|
//! 3. Levanta GPUI con [`yahweh_theme::Theme::install_default`].
|
|
//! 4. Compone el shell: [`Shell`] dueño del tree (izq), canvas (centro)
|
|
//! y panel (abajo). Cablea las suscripciones cross-widget.
|
|
//!
|
|
//! ## Layout
|
|
//!
|
|
//! ```text
|
|
//! ┌───────────┬────────────────────────────────────────┐
|
|
//! │ │ │
|
|
//! │ tree │ canvas │
|
|
//! │ (groups, │ (rueda / thumbnails) │
|
|
//! │ contacts,│ │
|
|
//! │ charts) │ │
|
|
//! │ │ │
|
|
//! ├───────────┴────────────────────────────────────────┤
|
|
//! │ control panel (módulos) │
|
|
//! └─────────────────────────────────────────────────────┘
|
|
//! ```
|
|
|
|
mod shell;
|
|
|
|
use std::path::PathBuf;
|
|
|
|
use gpui::{
|
|
App, AppContext, Application, Bounds, SharedString, TitlebarOptions, WindowBounds,
|
|
WindowOptions, px, size,
|
|
};
|
|
|
|
use cosmobiologia_store::Store;
|
|
use yahweh_theme::Theme;
|
|
|
|
use crate::shell::Shell;
|
|
|
|
const DB_FILENAME: &str = "charts.db";
|
|
const APP_TITLE: &str = "Tahuantinsuyu";
|
|
|
|
fn main() {
|
|
// Sidecar brahman primero — si el Init está corriendo, nos presentamos.
|
|
cosmobiologia_card::spawn_sidecar();
|
|
// Service socket: thread separado escuchando ComputeRequest. Otros
|
|
// módulos brahman pueden conectar y pedir cómputos de cartas
|
|
// natales sin GUI. Si el bind falla (socket ya tomado, sin
|
|
// permisos), loggea warn y la app sigue corriendo standalone.
|
|
let service_socket = cosmobiologia_card::service::default_service_socket();
|
|
eprintln!("[cosmobiologia] service socket → {}", service_socket.display());
|
|
cosmobiologia_card::service::spawn_service_thread(service_socket);
|
|
|
|
// DB en directorio de datos del usuario.
|
|
let db_path = resolve_db_path();
|
|
let store = match Store::open(&db_path) {
|
|
Ok(s) => s,
|
|
Err(e) => {
|
|
eprintln!(
|
|
"[cosmobiologia] no se pudo abrir la DB en {:?}: {} — usando memoria",
|
|
db_path, e
|
|
);
|
|
Store::in_memory().expect("in-memory store")
|
|
}
|
|
};
|
|
|
|
Application::new().run(move |cx: &mut App| {
|
|
Theme::install_default(cx);
|
|
|
|
let bounds = Bounds::centered(None, size(px(1400.0), px(900.0)), cx);
|
|
cx.open_window(
|
|
WindowOptions {
|
|
window_bounds: Some(WindowBounds::Windowed(bounds)),
|
|
titlebar: Some(TitlebarOptions {
|
|
title: Some(SharedString::from(APP_TITLE)),
|
|
..Default::default()
|
|
}),
|
|
..Default::default()
|
|
},
|
|
move |_w, cx| cx.new(|cx| Shell::new(store.clone(), cx)),
|
|
)
|
|
.expect("open window");
|
|
cx.activate(true);
|
|
});
|
|
}
|
|
|
|
fn resolve_db_path() -> PathBuf {
|
|
if let Some(dirs) = directories::ProjectDirs::from("net", "gioser", "cosmobiologia") {
|
|
let dir = dirs.data_dir().to_path_buf();
|
|
let _ = std::fs::create_dir_all(&dir);
|
|
return dir.join(DB_FILENAME);
|
|
}
|
|
PathBuf::from(DB_FILENAME)
|
|
}
|