• Validate a body-entry shortcode against its siblings' shortcodes.

    The shortcode must be non-blank, use only [\w-] characters, and not collide with any of existing. noun names the entry kind ("body part" / "body location") and scope names where uniqueness is required ("this body" / "this part") so the rejection message reads naturally.

    Pure and Foundry-free.

    Parameters

    • candidate: string

      The proposed shortcode (trimmed here).

    • existing: readonly string[]

      The shortcodes it must not collide with.

    • noun: string

      The entry kind, for the message (e.g. "body part").

    • scope: string

      Where uniqueness applies, for the message (e.g. "this body").

    Returns string | undefined

    A human-readable rejection reason, or undefined if it is valid.