Brand Generation & Governance
Status: Draft (stub) β documents
scripts/generate-brand-app.shcapabilities.
Purpose
Section titled βPurposeβDeterministic, guarded creation of brand application shells with validation, tagging, and idempotency.
Features
Section titled βFeaturesβ- Registry key validation (jq)
- Idempotency guard (
--forceto overwrite) - Dry run mode (
--dry-run) - Dynamic tag injection (
brand:<key>+ extras) - Post-generation Nx project registration check
./scripts/generate-brand-app.sh <brand-id> <platform:web|mobile> [options]Options
Section titled βOptionsβ| Flag | Description |
|---|---|
| βdry-run | Show actions without writing |
βfamily <name> | Set family folder under apps/ (default: generated) |
βtags <csv> | Append extra tags (comma separated) |
| βforce | Overwrite existing directory |
| βskip-validate | Skip registry brand key lookup |
Example
Section titled βExampleβ./scripts/generate-brand-app.sh orangeGuest web --tags "status:experimental,owner:team-a"Output Structure
Section titled βOutput Structureβapps/<family>/<brand>/<platform>/ project.json src/ App.tsx (template files)Default base template tags:
- type:app
- platform:web | platform:mobile Injected:
- brand:
<id> - any extra tags provided
Post-Generation Checklist
Section titled βPost-Generation Checklistβ- Commit scaffold
- Run verify gate (
./scripts/verify-repo.sh) - Implement brand-specific customizations
Failure Modes
Section titled βFailure Modesβ| Scenario | Exit Code | Mitigation |
|---|---|---|
| Brand not in registry | 2 | Add to registry.json or βskip-validate |
| Target exists | 3 | Use βforce if intentional |
| jq missing | (warn) | Install jq for validation |
| nx missing | (warn) | Ensure Nx CLI available |
Roadmap
Section titled βRoadmapβPhase 1 (Complete)
Section titled βPhase 1 (Complete)β- β Registry key validation (jq)
- β
Idempotency guard (
--forceto overwrite) - β
Dry run mode (
--dry-run) - β
Dynamic tag injection (
brand:<key>+ extras) - β Post-generation Nx project registration check
Phase 2 (Complete - M3)
Section titled βPhase 2 (Complete - M3)β- β Auto-generate brand README template per scaffold
- β Protected regions for custom content preservation
- β Batch generation mode (matrix input)
- β Post-generation summary table output
Phase 2 Features (M3)
Section titled βPhase 2 Features (M3)βBrand README Generation
Section titled βBrand README GenerationβScript: scripts/generate-brand-readme.mjs
Automatically generates per-brand README files with dual sections:
- Auto-generated section: Registry-driven metadata (regenerated on every run)
- Custom section: Team-specific content preserved across regenerations
Usage:
# Generate/update all brand READMEsnode scripts/generate-brand-readme.mjs
# Check mode (dry-run, shows what would change)node scripts/generate-brand-readme.mjs --check
# Force overwrite (for initial migration)node scripts/generate-brand-readme.mjs --force-overwriteProtected Regions:
<!-- AUTO-GENERATED -->...generated content...<!-- END AUTO-GENERATED SECTION -->
<!-- CUSTOM CONTENT BELOW - Edit freely, this section is preserved -->...team-specific notes, architecture diagrams, etc....Features:
- β Registry-driven content (brand name, description, platforms, features)
- β Automatic sections: Overview, Features, Platforms, Development
- β Protected custom content region (preserved on regeneration)
- β Idempotent: safe to run multiple times
- β Summary table output (brands processed, created, updated, errors)
Output Location:
apps/<family>/<brand>/mobile/README.mdExample Summary:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ Brand README Summary βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Total Brands: 2 Created: 1 Updated: 1 Errors: 0
Duration: 0.234sBatch Generation Mode
Section titled βBatch Generation ModeβCapability: Generate READMEs for all brands in the registry at once.
Default behavior: The script processes all brands by default, making batch mode implicit.
Use cases:
- Initial migration (add READMEs to all existing brands)
- Periodic refresh after registry schema changes
- CI automation (ensure READMEs stay in sync with registry)
Post-Generation Summary
Section titled βPost-Generation SummaryβOutput format: Structured table with status, counts, and timing
Example:
$ node scripts/generate-brand-readme.mjs
[readme-generator] Reading brand registry...[readme-generator] Found 2 brands
Processing: pinkGuest β README updated: apps/stay_match/pinkguest/mobile/README.md
Processing: orangeGuest β README created: apps/stay_match/orangeguest/mobile/README.md
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ Brand README Summary βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Total Brands: 2 Created: 1 Updated: 1 Errors: 0
Duration: 0.234sProtected Content Preservation
Section titled βProtected Content PreservationβWorkflow:
-
First Run (No README exists):
- Creates README with auto-generated section
- Adds custom content placeholder
-
Subsequent Runs (README exists):
- Regenerates auto-generated section (updates brand metadata)
- Preserves everything after
<!-- END AUTO-GENERATED SECTION --> - Maintains team notes, architecture decisions, troubleshooting guides
-
Migration (Existing README, no markers):
- Use
--force-overwriteto establish protected regions - Manually restore custom content from git history
- Future runs will preserve custom section
- Use
Safety Guarantees:
- Custom content is never overwritten (unless
--force-overwriteused) - Auto-generated section always reflects current registry state
- Regeneration is idempotent (safe to run repeatedly)
Check Mode (βcheck)
Section titled βCheck Mode (βcheck)βPurpose: Preview changes without writing files
Usage:
node scripts/generate-brand-readme.mjs --checkOutput:
[readme-generator] Running in CHECK mode (no files will be written)[readme-generator] Reading brand registry...[readme-generator] Found 2 brands
Processing: pinkGuest β Would update: apps/stay_match/pinkguest/mobile/README.md
Processing: orangeGuest β README exists and is up-to-dateUse cases:
- CI validation (ensure READMEs are up-to-date)
- Preview before committing changes
- Troubleshooting generation logic
Integration with Verification Pipeline
Section titled βIntegration with Verification PipelineβBrand README generation can be integrated into the verify pipeline:
# In scripts/verify-repo.shecho "βΊ Brand README Check"node scripts/generate-brand-readme.mjs --check || { echo "β Brand READMEs are out of date. Run: node scripts/generate-brand-readme.mjs" exit 1}This ensures brand documentation stays synchronized with the registry.