Files
nih-plug-template/branding.conf
T
mikkeli a46e7eb961 feat: split branding into a checker and a helper over one canonical file
check-branding.sh could say what disagreed but not fix it, and its
canonical block lived in its own header — so renaming meant hand-editing
the checker, which is exactly the fragile step it exists to catch.

branding.conf now holds the identity once. Both scripts read it and
neither contains a branding literal anywhere, so a rename never has to
rewrite its own tooling.

brand-plugin.sh derives the package name and Rust types from the display
name, validates them against what Cargo actually accepts, rewrites every
tracked file longest-value-first (a short name can be a substring of a
longer one), appends the retired spellings to STALE, and finishes by
running the checker. A run that ends green is a rename that landed. Dry
run unless --apply.

It refuses three things worth refusing:

- Package names Cargo rejects — digit-leading (`206 Prototype` derives to
  `206_prototype`), Rust keywords, built-in crate collisions. Verified
  against cargo init rather than assumed.
- Moving CLAP_ID or VST3_CLASS_ID without --allow-identity-change. Hosts
  key saved projects off those; changing either orphans every existing
  session silently. The 16-byte class ID is *proposed*, never derived —
  it is a fixed-width frozen identity, so the choice stays human.
- Development history in CLAP_DESCRIPTION. Hosts show it to users who
  never knew the codename, so any retired name or the repo codename
  appearing there is rejected.

The checker gains the other half of its job: asserting canonical values
are present where they belong, not only that retired ones are gone.
Absence alone would pass a rename to the *wrong* new spelling. New
positive assertions cover Cargo authors, Cargo.lock, the CI bundle
command and NOTICE — every one of which the recent Bari 206 rename had to
touch. Structural checks read their file locations from branding.conf so
a plugin whose params outgrow src/lib.rs can point them elsewhere.

Also fixes NOTICE naming the repo rather than the product, found by the
new assertion, and excludes branding.conf from the stale sweep — it lists
every retired spelling by definition, the same reason check-branding.sh
was already excluded.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WHt4DykxXaQnyaJfyS8KCn
2026-08-31 23:11:47 +09:00

77 lines
4.1 KiB
Plaintext

# SPDX-License-Identifier: GPL-3.0-or-later
# branding.conf - the plugin's canonical identity, in one place.
#
# Sourced by both check-branding.sh (which asserts every copy matches) and
# brand-plugin.sh (which rewrites this file and every copy when you rename).
# Editing a value here and running the checker tells you every place that still
# holds the old one; running the helper changes them for you.
# ---------------------------------------------------------------------------
# Names that move when the plugin is renamed
# ---------------------------------------------------------------------------
PKG="nih_plug_template" # Cargo package name == bundler.toml table key
DISPLAY="Plugin Name" # bundle name -> "<DISPLAY>.vst3" / "<DISPLAY>.clap"
PLUGIN_NAME="Plugin Name" # Plugin::NAME - what the DAW displays
VENDOR="Your Name" # Plugin::VENDOR - the org, not the person
EMAIL="your@email.com" # Plugin::EMAIL
HOMEPAGE="https://github.com/YOUR-USERNAME/YOUR-PLUGIN-NAME" # Cargo homepage -> Plugin::URL
DESCRIPTION="A minimal NIH-plug audio plugin" # Cargo package description
# What the plugin does *now*. Keep development history out of it - no codename,
# no "prototype", no "v2 rewrite". Hosts show this to users, who have no idea
# what any of that meant. check-branding.sh enforces the mechanical half of this
# by rejecting any retired spelling or the repo codename appearing here.
CLAP_DESCRIPTION="Your plugin description"
# ---------------------------------------------------------------------------
# Frozen identity - hosts key saved projects and presets off these two. Changing
# either orphans every existing session silently: the track comes up empty, with
# no error. Choose them once before the first release and never again.
# brand-plugin.sh refuses to touch them without --allow-identity-change.
# ---------------------------------------------------------------------------
CLAP_ID="com.your-domain.plugin-name" # reverse-DNS, lowercase, no spaces
VST3_CLASS_ID="Unique16CharId!!" # MUST be exactly 16 bytes
# ---------------------------------------------------------------------------
# Rust type names. Never reach a host, so renaming them is cosmetic - but
# leaving "MyPlugin" in a shipped plugin is residue that says nobody read the
# file. Leave them alone and the checks simply stay green.
# ---------------------------------------------------------------------------
STRUCT="MyPlugin" # the Plugin impl target
PARAMS_STRUCT="PluginParams" # the Params impl target
# Where those two are defined. A plugin that outgrows one file points these at
# the real locations (e.g. PARAMS_FILE="src/params.rs") - the checker asserts
# definitions here, and the STALE sweep catches every use site elsewhere.
LIB_FILE="src/lib.rs"
PARAMS_FILE="src/lib.rs"
# ---------------------------------------------------------------------------
# The development codename: this repository's own name, fixed when the repo was
# created and deliberately NOT renamed when the plugin is. It keeps its history
# while the plugin gets a product name. Never checked for as branding - it is
# only used to keep it out of user-facing descriptions.
# ---------------------------------------------------------------------------
CODENAME="nih-plug-template"
# ---------------------------------------------------------------------------
# Spellings that must no longer appear in tracked files. Seeded with this
# template's placeholders and with the current values, so renaming is
# self-checking in both directions: an entry is skipped while it is still part
# of a canonical value above, and arms the moment it stops being one.
# brand-plugin.sh appends retired values here automatically.
# ---------------------------------------------------------------------------
STALE="nih_plug_template
MyPlugin
PluginParams
A minimal NIH-plug audio plugin
Your plugin description
Plugin Name
Your Name
your@email.com
com.your-domain.plugin-name
Unique16CharId!!
YOUR-USERNAME
YOUR-PLUGIN-NAME
your-domain"