naming

package
v2.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CurrentCLISuffix = "-pp-cli"
	LegacyCLISuffix  = "-cli"
	MCPSuffix        = "-pp-mcp"
)

Variables

This section is empty.

Functions

func CLI

func CLI(name string) string

func DogfoodBinary

func DogfoodBinary(name string) string

func EnvPrefix

func EnvPrefix(name string) string

EnvPrefix returns an ASCII-only shell-safe environment variable prefix. API display names and OpenAPI titles can contain accents or punctuation ("PokéAPI", "Cal.com", "1Password"); generated env vars must not.

func EnvVarPlaceholder

func EnvVarPlaceholder(envVar string) string

EnvVarPlaceholder derives the placeholder name from an environment variable. DUB_TOKEN -> token, STYTCH_PROJECT_ID -> project_id.

func IsCLIDirName

func IsCLIDirName(name string) bool

func IsValidLibraryDirName

func IsValidLibraryDirName(name string) bool

IsValidLibraryDirName returns true if name is a valid library directory name. It accepts both legacy CLI directory names (e.g. "dub-pp-cli", "dub-pp-cli-2") and slug-keyed names (e.g. "dub", "cal-com", "dub-2"). It rejects empty strings, path separators, ".." components, and dotfiles. This is Layer 1 input validation; callers that use the name in filepath.Join must still apply Layer 2 containment.

func LegacyCLI

func LegacyCLI(name string) string

func LibraryDirName

func LibraryDirName(name string) string

LibraryDirName maps a CLI-style name to the corresponding library directory key while preserving rerun suffixes. Examples:

  • "dub-pp-cli" -> "dub"
  • "dub-pp-cli-2" -> "dub-2"
  • "dub-2-pp-cli" -> "dub-2"

Bare slug-keyed names are returned unchanged.

func MCP

func MCP(name string) string

func MCPDescription

func MCPDescription(desc string, noAuth bool, authType string, publicCount, totalCount int) string

MCPDescription builds an MCP tool description with optional minority-side auth annotation. It annotates only when an API has a mix of public and auth-required tools, and only the minority side gets annotated.

func OneLine

func OneLine(s string) string

OneLine normalizes generated descriptions for compact template and manifest output.

func Snake

func Snake(s string) string

Snake converts CamelCase to snake_case for generated tool name segments. Hyphens are intentionally preserved to match the historical MCP template helper behavior.

func TrimCLISuffix

func TrimCLISuffix(name string) string

func ValidationBinary

func ValidationBinary(name string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL