Documentation
¶
Index ¶
- func BucketKey(tokens []Token, requested []TokenKind, v Values) (string, error)
- func BucketPattern(tokens []Token, requested []TokenKind, v Values) (string, error)
- func RenderToken(kind TokenKind, v Values) string
- func RenderVersion(tokens []Token, v Values) string
- func ValidateRotationTokens(tokens []Token, requested []TokenKind) error
- type Resolver
- type Token
- type TokenKind
- type Values
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BucketKey ¶ added in v0.59.0
BucketKey returns a key that uniquely identifies which rotation bucket v belongs to, given the tokens a rotating changelog output/tag pattern groups by. requested must be a valid, non-empty prefix of tokens' own token order (see ValidateRotationTokens, which BucketKey calls internally). The key always renders in the format's own token order, regardless of the order requested was given in, so two callers who spell the same rotation differently still agree on the bucket.
func BucketPattern ¶ added in v0.59.0
BucketPattern returns a regular expression matching any bare version string in the same rotation bucket as v, given the tokens a rotating changelog output/tag pattern groups by. The pattern is anchored at the start (^) only — callers compose their own tag_prefix quoting and decide whether to anchor the end. requested must be a valid, non-empty prefix of tokens' own token order (see ValidateRotationTokens, which BucketPattern calls internally — this also guarantees the token immediately after the rotation boundary is a literal separator, so the match can never partial-match into the next token's digits).
func RenderToken ¶ added in v0.59.0
RenderToken formats the value v holds for a single non-literal token kind — the same per-token-kind formatting RenderVersion and the bucket helpers use internally, exported so a caller substituting individual {TOKEN} placeholders (rather than rendering a whole version string) doesn't need to duplicate the padding rules (e.g. "%04d" for YYYY).
func RenderVersion ¶
RenderVersion formats a version string from tokens and values.
func ValidateRotationTokens ¶ added in v0.59.0
ValidateRotationTokens checks that requested — the set of format tokens a rotating changelog output or tag-scope pattern groups by — forms a contiguous, non-empty prefix of tokens' own non-PATCH, non-literal token order, immediately followed by a literal separator in the format. A changelog can only rotate by dimensions the version format itself already tracks, in the order it tracks them, with an unambiguous boundary — so tag-scoping stays derivable from the version string alone, with no risk of a partial-digit false match (see docs/superpowers/specs/2026-08-28-changelog-rotation-design.md §1, §4).
Types ¶
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver resolves the next CalVer version from the current date and git tags.
func (*Resolver) BumpAuto ¶
BumpAuto is not used by the CalVer calculator; it satisfies the VersionCalculator interface for internal/versioning/perenv.
func (*Resolver) BumpFromDate ¶
BumpFromDate computes the next CalVer version from date only, without querying git. tags is a caller-provided slice of bare version strings (no prefix), newest first. Implements the VersionCalculator interface consumed by internal/versioning/perenv.
type Token ¶
Token is one component of a parsed CalVer format string.
func ParseFormat ¶
ParseFormat parses a CalVer format string (e.g. "YYYY.MM.PATCH") into tokens. Returns an error if PATCH is absent or not the last non-literal token.
type TokenKind ¶
type TokenKind int
TokenKind identifies a CalVer format token.
func TokenKindFromName ¶ added in v0.59.0
TokenKindFromName returns the TokenKind for a format-token spelling (e.g. "YYYY"), or false if name isn't a recognized token — the inverse of TokenKind.String(). Used by callers (e.g. internal/app's changelog-rotation decorator) that parse {TOKEN} placeholders out of a user-authored string and need the typed value BucketKey/BucketPattern/ValidateRotationTokens expect.