Skip to content

Brand Generation & Governance

Status: Draft (stub) β€” documents scripts/generate-brand-app.sh capabilities.

Deterministic, guarded creation of brand application shells with validation, tagging, and idempotency.

  • Registry key validation (jq)
  • Idempotency guard (--force to overwrite)
  • Dry run mode (--dry-run)
  • Dynamic tag injection (brand:<key> + extras)
  • Post-generation Nx project registration check
Terminal window
./scripts/generate-brand-app.sh <brand-id> <platform:web|mobile> [options]
FlagDescription
β€”dry-runShow actions without writing
β€”family <name>Set family folder under apps/ (default: generated)
β€”tags <csv>Append extra tags (comma separated)
β€”forceOverwrite existing directory
β€”skip-validateSkip registry brand key lookup
Terminal window
./scripts/generate-brand-app.sh orangeGuest web --tags "status:experimental,owner:team-a"
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
  • Commit scaffold
  • Run verify gate (./scripts/verify-repo.sh)
  • Implement brand-specific customizations
ScenarioExit CodeMitigation
Brand not in registry2Add to registry.json or β€”skip-validate
Target exists3Use β€”force if intentional
jq missing(warn)Install jq for validation
nx missing(warn)Ensure Nx CLI available
  • βœ… Registry key validation (jq)
  • βœ… Idempotency guard (--force to overwrite)
  • βœ… Dry run mode (--dry-run)
  • βœ… Dynamic tag injection (brand:<key> + extras)
  • βœ… Post-generation Nx project registration check
  • βœ… Auto-generate brand README template per scaffold
  • βœ… Protected regions for custom content preservation
  • βœ… Batch generation mode (matrix input)
  • βœ… Post-generation summary table output

Script: scripts/generate-brand-readme.mjs

Automatically generates per-brand README files with dual sections:

  1. Auto-generated section: Registry-driven metadata (regenerated on every run)
  2. Custom section: Team-specific content preserved across regenerations

Usage:

Terminal window
# Generate/update all brand READMEs
node 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-overwrite

Protected 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.md

Example Summary:

╔══════════════════════════════════════════════════════════════╗
β•‘ Brand README Summary β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
Total Brands: 2
Created: 1
Updated: 1
Errors: 0
Duration: 0.234s

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)

Output format: Structured table with status, counts, and timing

Example:

Terminal window
$ 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.234s

Workflow:

  1. First Run (No README exists):

    • Creates README with auto-generated section
    • Adds custom content placeholder
  2. 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
  3. Migration (Existing README, no markers):

    • Use --force-overwrite to establish protected regions
    • Manually restore custom content from git history
    • Future runs will preserve custom section

Safety Guarantees:

  • Custom content is never overwritten (unless --force-overwrite used)
  • Auto-generated section always reflects current registry state
  • Regeneration is idempotent (safe to run repeatedly)

Purpose: Preview changes without writing files

Usage:

Terminal window
node scripts/generate-brand-readme.mjs --check

Output:

[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-date

Use cases:

  • CI validation (ensure READMEs are up-to-date)
  • Preview before committing changes
  • Troubleshooting generation logic

Brand README generation can be integrated into the verify pipeline:

Terminal window
# In scripts/verify-repo.sh
echo "⏺ 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.