How do I show generated files for a codegen entity?

Table of Contents

For background on entity metatypes and profiles, see ores.codegen.

Question

How do I see which files codegen produces for an entity and whether they are up to date?

Answer

Run compass codegen entity show <name-or-id> from the project root:

./compass.sh codegen entity show country

The entity can be resolved by name or by org-roam UUID prefix (≥ 6 hex chars, as returned by entity list):

./compass.sh codegen entity show 9F2A1B3C

Each output file is shown with:

  • A staleness icon: ✅ (current), ⚠️ (stale — output older than template or model file), ❌ (missing), ❓ (stat error)
  • The archetype template that generates it (← template.mustache)
country  (domain_entity, refdata)

  ✅  projects/ores.refdata/api/include/ores.refdata.api/domain/country_json_io.hpp  ←  cpp_domain_type_json_io.hpp.mustache
  ⚠️   projects/ores.refdata/api/include/ores.refdata.api/domain/country.hpp  ←  cpp_domain_type_class.hpp.mustache
  ⚠️   projects/ores.qt/refdata/include/ores.qt/CountryController.hpp  ←  cpp_qt_controller.hpp.mustache
  ⚠️   projects/ores.sql/create/refdata/refdata_countries_create.sql  ←  sql_schema_non_temporal_create.mustache
  ...

Staleness is determined as output mtime < max(template mtime, model mtime). A file is stale if either the template or the model file is newer than the last generated output.

To restrict to a single profile (facet):

./compass.sh codegen entity show country --profile sql

Script

compass codegen entity show is the _cmd_show handler in projects/ores.compass/src/compass_codegen_entity.py.

Tested by

Run ./compass.sh codegen entity show country and verify the output lists all 36 generated files with icons and template names.

See also

Emacs 29.1 (Org mode 9.6.6)