feat(projects): integrate project switcher in app shell + Inspector menu

main.cpp:
- Forward decl + switch_to_project: cierra layout_store, libera grafo,
  aplica nuevos paths, vuelve a cargar.
- apply_project_paths: deriva operations.db/types.yaml/graph_explorer.db
  del slug y los expone a g_app.active_project.
- main: arg --project <slug>; modo legacy si --input/positional dado;
  modo proyecto si no — migra layout legacy, decide target via
  arg/last_active/'default', crea si no existe, abre BDs y carga.
- render(): handler want_switch_project + monta views_new_project_modal.

views.h: AppState gana active_project, want_switch_project,
switch_project_target, show_new_project_modal, new_project_buf,
new_project_error, project_list_cache, project_recent_cache.

views.cpp:
- Toolbar: boton 'Project: <slug>' con popup (New/Recent/Open/Reveal).
  Refresca caches al abrir el menu.
- views_new_project_modal: input slug + validacion + creacion + switch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-30 23:46:47 +02:00
parent c365b1bc43
commit d6f7318c24
3 changed files with 254 additions and 15 deletions
+14
View File
@@ -52,6 +52,16 @@ struct AppState {
bool want_open_file = false; // marcado al confirmar el modal Open
char open_buf[512] = {};
// Project system (issue 0006)
std::string active_project; // slug del proyecto activo
bool want_switch_project = false;
std::string switch_project_target; // slug objetivo del switch
bool show_new_project_modal = false;
char new_project_buf[80] = {};
std::string new_project_error; // mensaje a mostrar en el modal
std::vector<std::string> project_list_cache; // refrescado al abrir el menu Project
std::vector<std::string> project_recent_cache;
// Labels overlay
bool labels_enabled = true;
@@ -108,6 +118,10 @@ bool views_filters_modal(AppState& app);
// Modal Open file — text input + boton Open.
bool views_open_modal(AppState& app);
// Modal "New project..." — slug input con validacion. Devuelve true si el
// usuario confirma con un slug valido.
bool views_new_project_modal(AppState& app);
// Refresca los flags `flags` de cada nodo/arista segun el array
// `type_visible[]` / `rel_type_visible[]`. Lineal en N+M.
void views_apply_visibility(AppState& app);