scaffolder: auto-wire fn_table_viz in new C++ apps (issue 0081-M)
- CMakeLists.txt template: adds target_link_libraries fn_table_viz with if(TARGET fn_table_viz) guard (compiles even without vendor/lua). - main.cpp template: adds commented include + data_table::render() panel block in render(). Also fixes include to use app_base.h + panel_menu.h (matching convention of chart_demo, shaders_lab). - app.md template: uses_functions lists all 12 fn_table_viz stack IDs commented out; uncomment when activating data_table::render(). - Bump version 0.1.0 -> 1.1.0. Add capability growth log entry. - Tag cpp-tables added to capability group. - Verified: test app test_scaffolder_default compiled clean, residues removed (dir + CMakeLists entry). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,11 +3,11 @@ name: init_cpp_app
|
||||
kind: pipeline
|
||||
lang: bash
|
||||
domain: pipelines
|
||||
version: "0.1.0"
|
||||
version: "1.1.0"
|
||||
purity: impure
|
||||
signature: "init_cpp_app(name: string, [--project <p>] [--domain <d>] [--desc <s>] [--tags <csv>]) -> void"
|
||||
description: "Scaffolder estandar de apps C++ del registry. Genera main.cpp + CMakeLists.txt + app.md siguiendo el patron canonico (cfg.about/log/panels, sin app_menubar manual, dockspace via framework), registra la app en cpp/CMakeLists.txt, inicializa repo Gitea dataforge/<name> y ejecuta fn index."
|
||||
tags: [cpp, imgui, scaffold, pipeline, bash, launcher]
|
||||
tags: [cpp, imgui, scaffold, pipeline, bash, launcher, cpp-tables]
|
||||
uses_functions:
|
||||
- ensure_repo_synced_bash_infra
|
||||
uses_types: []
|
||||
@@ -47,9 +47,9 @@ fn run init_cpp_app finance_panel --project budget --desc "Panel de finanzas" --
|
||||
|
||||
```
|
||||
<dir>/
|
||||
main.cpp # Plantilla canonica: panels[] + cfg.about + cfg.log + run_app(cfg, render)
|
||||
CMakeLists.txt # add_imgui_app(<name> main.cpp)
|
||||
app.md # Frontmatter completo (lang:cpp, framework:imgui, dir_path, repo_url)
|
||||
main.cpp # Plantilla canonica: panels[] + cfg.about + cfg.log + run_app(cfg, render) + data_table comentado
|
||||
CMakeLists.txt # add_imgui_app(<name> main.cpp) + target_link_libraries fn_table_viz (con guard)
|
||||
app.md # Frontmatter completo (lang:cpp, framework:imgui, dir_path, repo_url) + uses_functions comentados
|
||||
```
|
||||
|
||||
Y ademas:
|
||||
@@ -66,9 +66,31 @@ La plantilla cumple `cpp/PATTERNS.md`:
|
||||
- NO llama `DockSpaceOverViewport` (auto_dockspace=true por defecto).
|
||||
- Declara `panels[]` con un panel "Main" toggleable.
|
||||
- Setea `cfg.about` (window About) y `cfg.log` (logger + ventana Logs).
|
||||
- Include `viz/data_table.h` comentado + panel "Data" comentado en `render()` — descomentar para activar `data_table::render()`.
|
||||
|
||||
## Activar data_table::render()
|
||||
|
||||
1. En `main.cpp`: descomentar `#include "viz/data_table.h"` y el bloque del panel Data en `render()`.
|
||||
2. En `app.md`: descomentar los 12 IDs del stack `fn_table_viz` en `uses_functions`.
|
||||
3. El `CMakeLists.txt` ya linka `fn_table_viz` via guard `if(TARGET fn_table_viz)` — sin cambio manual.
|
||||
4. Poblar `data_tables` con tus `data_table::TableInput` y el panel aparece en el DockSpace.
|
||||
|
||||
## Cuando usarla
|
||||
|
||||
Cuando necesites crear una app C++ nueva que siga el patron canonico del registry. Es el unico camino autorizado para crear apps en `cpp/apps/` o `projects/*/apps/` — nunca escribir `main.cpp` + `CMakeLists.txt` a mano.
|
||||
|
||||
## Gotchas
|
||||
|
||||
- Si `GITEA_URL`/`GITEA_TOKEN` no estan seteados, solo hace `git init` local (no crea repo remoto).
|
||||
- `fn_table_viz` requiere que `vendor/lua` este presente en `cpp/`; el guard `if(TARGET fn_table_viz)` evita errores de link si no esta disponible.
|
||||
- El bloque de `uses_functions` en `app.md` queda comentado intencionalmente — descomenta solo las funciones que la app realmente use para mantener el grafo de dependencias limpio.
|
||||
|
||||
## Despues de crear
|
||||
|
||||
1. Editar `app.md` y completar `uses_functions` cuando la app consuma funciones del registry.
|
||||
2. Anadir las funciones del registry al `CMakeLists.txt` como paths absolutos: `${CMAKE_SOURCE_DIR}/functions/<dom>/<func>.cpp`.
|
||||
1. Si usas `data_table::render()`: descomentar include + panel en `main.cpp`, descomentar IDs en `app.md`, ejecutar `fn index`.
|
||||
2. Para otras funciones del registry: anadir paths absolutos en `CMakeLists.txt` y los IDs en `uses_functions` de `app.md`.
|
||||
3. Build: `cd cpp && cmake --build build --target <name> -j`.
|
||||
|
||||
## Capability growth log
|
||||
|
||||
v1.1.0 (2026-05-15) — Auto-wires fn_table_viz; new apps get target_link_libraries + commented data_table template.
|
||||
|
||||
Reference in New Issue
Block a user