project_scaffold.h Header
Types
| struct | ProjectSpec | What a new project should be. parent_slug empty scaffolds a standalone (a new family root); non-empty scaffolds a member of that root's family. |
Functions
| bool | valid_project_slug(const std::string & slug) |
| bool | scaffold_project(const std::filesystem::path & site_config, const ProjectSpec & spec, std::string * config_path_out = nullptr, std::string * error = nullptr) |
| bool | promote_to_family(const std::filesystem::path & site_config, const std::filesystem::path & project_config, const std::string & member_slug, const std::string & member_label, std::string * umbrella_config_out = nullptr, std::string * member_config_out = nullptr, std::string * error = nullptr) |
Function Documentation
bool valid_project_slug(const std::string & slug)
Slugs are lowercase letters/digits in dash-separated runs ("profile-api").
bool scaffold_project(const std::filesystem::path & site_config, const ProjectSpec & spec, std::string * config_path_out = nullptr, std::string * error = nullptr)
Create projects/
site_config's site and
register it in the site config's projects[] (members are inserted right
after their family's last entry, keeping families contiguous; standalones
append). Never clobbers an existing config. Returns false — and sets *error when given — on invalid input, slug collisions, or write failures. On success *config_path_out (when given) receives the new config's absolute path.
bool promote_to_family(const std::filesystem::path & site_config, const std::filesystem::path & project_config, const std::string & member_slug, const std::string & member_label, std::string * umbrella_config_out = nullptr, std::string * member_config_out = nullptr, std::string * error = nullptr)
Promote a standalone project to a project family. The umbrella takes over
the project's identity (slug, name, tagline, logo) AND its directory; the
existing project is demoted to the family's first member: its directory is
renamed to member_slug, and the site config re-points its entry with the umbrella
registered just before it.
The project must be registered in site_config and not already be a family
root or member. Returns false — and sets *error when given — leaving the
site untouched (a partially-applied rename is rolled back). On success the
out params (when given) receive the umbrella's and the member's absolute
config paths.