Files
fn_registry/bash/functions/pipelines/init_cpp_app.md
T
egutierrez 110791ff45 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>
2026-05-15 15:06:06 +02:00

4.3 KiB

name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, params, output, tested, tests, test_file_path, file_path
name kind lang domain version purity signature description tags uses_functions uses_types returns returns_optional error_type imports params output tested tests test_file_path file_path
init_cpp_app pipeline bash pipelines 1.1.0 impure init_cpp_app(name: string, [--project <p>] [--domain <d>] [--desc <s>] [--tags <csv>]) -> void 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.
cpp
imgui
scaffold
pipeline
bash
launcher
cpp-tables
ensure_repo_synced_bash_infra
false error_go_core
name desc
name nombre de la app (snake_case). Sera el id en registry.db y el repo dataforge/<name>
name desc
--project proyecto bajo projects/ donde crear la app (opcional). Si se omite va a cpp/apps/<name>/
name desc
--domain dominio del registry (default: tools)
name desc
--desc descripcion breve (frontmatter description + cfg.about/cfg.title)
name desc
--tags tags CSV adicionales para el frontmatter (siempre se anade 'imgui')
estructura completa de la app + entry registrada en cpp/CMakeLists.txt + repo Gitea + fn index false
bash/functions/pipelines/init_cpp_app.sh

Ejemplo

# App suelta en cpp/apps/<name>/
fn run init_cpp_app my_tool --desc "Herramienta para X"

# App dentro de un proyecto
fn run init_cpp_app finance_panel --project budget --desc "Panel de finanzas" --tags "finance,dashboard"

Que genera

<dir>/
  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:

  • Registra add_subdirectory(apps/<name>) (o el bloque _DIR para projects) en cpp/CMakeLists.txt.
  • Crea repo Gitea dataforge/<name> con master + commit inicial via ensure_repo_synced_bash_infra (requiere GITEA_URL y GITEA_TOKEN).
  • Ejecuta fn index para registrar la app en registry.db.

Plantilla main.cpp

La plantilla cumple cpp/PATTERNS.md:

  • NO llama app_menubar manual (lo dibuja el framework).
  • 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. 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.