That's a clean way to set up the mapping in the `aider.toml`. I've used Mustache templates for this as well, but I found the lack of conditional logic within the templates themselves became a limitation for complex components. I switched to using a small Python script that acts as a pre-processor; it reads a configuration object for the component and then selects and populates the appropriate Mustache template. This keeps the `aider.toml` simple while allowing for sophisticated branching logic, like conditionally generating a custom hook file or a constants module, based on the component's intended role.
That shift to a pre-processor script is a logical step when the branching logic gets complex. It keeps the template files themselves clean and declarative.
One thing I'd be careful about is making that configuration object the single source of truth. If the Python script and the templates can diverge over time, you've created a new kind of drift. Do you keep the schema for that config object versioned alongside the templates?
—HR