shared

package
v1.260322.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LocalizationTypeVersion = "version"
	LocalizationTypeAppInfo = "app-info"
)
View Source
const (
	PrivateKeyEnvVar       = privateKeyEnvVar
	PrivateKeyBase64EnvVar = privateKeyBase64EnvVar
)
View Source
const PublishDefaultPollInterval = 30 * time.Second

PublishDefaultPollInterval is the default polling interval for build discovery.

View Source
const (
	ReportFormatJUnit = "junit"
)

CI report format types

Variables

View Source
var ErrMissingAuth = errors.New("missing authentication")

Functions

func ApplyRootLoggingOverrides

func ApplyRootLoggingOverrides()

ApplyRootLoggingOverrides applies root-level logging flag overrides (--retry-log, --debug, --api-debug) into the shared ASC runtime.

func BindCIFlags

func BindCIFlags(fs *flag.FlagSet)

BindCIFlags registers CI-related flags for report output. These are separate from BindRootFlags to keep CI concerns isolated.

func BindPrettyJSONFlag

func BindPrettyJSONFlag(fs *flag.FlagSet) *bool

BindPrettyJSONFlag registers a --pretty flag for JSON rendering.

func BindRootFlags

func BindRootFlags(fs *flag.FlagSet)

BindRootFlags registers root-level flags that affect shared CLI behavior.

func Bold

func Bold(s string) string

Bold returns the string wrapped in ANSI bold codes

func BuildAppKeywordsResponse

func BuildAppKeywordsResponse(keywords []string) *asc.AppKeywordsResponse

BuildAppKeywordsResponse converts a keyword list into the standard appKeywords response shape used by multiple keyword mutation commands.

func BuildConfirmDeleteCommand

func BuildConfirmDeleteCommand(config ConfirmDeleteCommandConfig) *ffcli.Command

BuildConfirmDeleteCommand builds a standard delete command requiring --id and --confirm and printing a caller-provided result payload.

func BuildIDGetCommand

func BuildIDGetCommand(config IDGetCommandConfig) *ffcli.Command

BuildIDGetCommand builds a standard "get by ID" command.

func BuildPaginatedListCommand

func BuildPaginatedListCommand(config PaginatedListCommandConfig) *ffcli.Command

BuildPaginatedListCommand builds a list command that supports --next and --paginate semantics shared by many resources.

func CleanupTempPrivateKeys

func CleanupTempPrivateKeys()

CleanupTempPrivateKeys removes any temporary private key files created during this run.

func ContextWithResolvedTimeout

func ContextWithResolvedTimeout(ctx context.Context, defaultTimeout time.Duration) (context.Context, context.CancelFunc)

ContextWithResolvedTimeout returns a context with ASC timeout resolution and a package-provided default fallback duration.

func ContextWithTimeout

func ContextWithTimeout(ctx context.Context) (context.Context, context.CancelFunc)

func ContextWithTimeoutDuration

func ContextWithTimeoutDuration(ctx context.Context, timeout time.Duration) (context.Context, context.CancelFunc)

ContextWithTimeoutDuration creates a context with a specific timeout.

func ContextWithUploadTimeout

func ContextWithUploadTimeout(ctx context.Context) (context.Context, context.CancelFunc)

func ContextWithoutTimeout

func ContextWithoutTimeout(ctx context.Context) context.Context

func CopyVersionMetadataFromSource

func CopyVersionMetadataFromSource(
	ctx context.Context,
	client *asc.Client,
	opts VersionMetadataCopyOptions,
) (*asc.AppStoreVersionMetadataCopySummary, error)

CopyVersionMetadataFromSource copies selected localization metadata from one version into another.

func DecompressGzipFile

func DecompressGzipFile(sourcePath, destPath string) (int64, error)

DecompressGzipFile inflates a gzip file to the destination path.

func DefaultOutputFormat

func DefaultOutputFormat() string

DefaultOutputFormat returns the default output format for CLI commands. It checks ASC_DEFAULT_OUTPUT first. When unset, interactive terminals default to table output and non-interactive contexts default to JSON. Valid ASC_DEFAULT_OUTPUT values are "json", "table", "markdown", and "md".

func DefaultUsageFunc

func DefaultUsageFunc(c *ffcli.Command) string

DefaultUsageFunc returns a usage string with bold section headers

func DeprecatedAliasLeafCommand

func DeprecatedAliasLeafCommand(cmd *ffcli.Command, name, shortUsage, newCommand, warning string) *ffcli.Command

DeprecatedAliasLeafCommand clones a canonical leaf command into a deprecated compatibility alias that warns and then delegates to the canonical Exec.

func DeprecatedUsageFunc

func DeprecatedUsageFunc(c *ffcli.Command) string

DeprecatedUsageFunc returns a compact usage string for compatibility aliases. It intentionally omits flags and subcommands so help output only points callers to the canonical command path.

func GetASCClient

func GetASCClient() (*asc.Client, error)

Exported wrappers for shared helpers.

func HasInclude

func HasInclude(values []string, include string) bool

HasInclude returns true when include is present in values.

func HideFlagFromHelp

func HideFlagFromHelp(f *flag.Flag)

HideFlagFromHelp hides a flag from command help output while keeping it accepted at runtime.

func IsAppAvailabilityMissing

func IsAppAvailabilityMissing(err error) bool

func ListAllBetaGroups

func ListAllBetaGroups(ctx context.Context, client betaGroupsClient, appID string) (*asc.BetaGroupsResponse, error)

ListAllBetaGroups fetches and paginates all beta groups for an app.

func MapTerritoryAvailabilityIDs

func MapTerritoryAvailabilityIDs(resp *asc.TerritoryAvailabilitiesResponse) (map[string]string, error)

MapTerritoryAvailabilityIDs maps territory IDs to territory-availability IDs.

func MapVersionLocalizationStrings

func MapVersionLocalizationStrings(attrs asc.AppStoreVersionLocalizationAttributes) map[string]string

MapVersionLocalizationStrings converts version localization attributes into .strings keys.

func MissingSubmitRequiredLocalizationFields

func MissingSubmitRequiredLocalizationFields(attrs asc.AppStoreVersionLocalizationAttributes) []string

MissingSubmitRequiredLocalizationFields returns missing metadata fields that block App Store submission for a version localization.

func MissingSubmitRequiredLocalizationFieldsWithOptions

func MissingSubmitRequiredLocalizationFieldsWithOptions(attrs asc.AppStoreVersionLocalizationAttributes, opts SubmitReadinessOptions) []string

MissingSubmitRequiredLocalizationFieldsWithOptions returns missing metadata fields that block App Store submission, with configurable checks.

func NewAvailabilitySetCommand

func NewAvailabilitySetCommand(config AvailabilitySetCommandConfig) *ffcli.Command

NewAvailabilitySetCommand builds a shared availability set command.

func NewCategoriesSetCommand

func NewCategoriesSetCommand(config CategoriesSetCommandConfig) *ffcli.Command

NewCategoriesSetCommand builds a categories set command with shared behavior.

func NewPricingSetCommand

func NewPricingSetCommand(config PricingSetCommandConfig) *ffcli.Command

NewPricingSetCommand builds a pricing set command with shared behavior.

func NewReportedError

func NewReportedError(err error) error

NewReportedError wraps an error that has already been printed.

func NormalizeAppStoreVersionPlatform

func NormalizeAppStoreVersionPlatform(value string) (string, error)

NormalizeAppStoreVersionPlatform validates a single platform value.

func NormalizeAppStoreVersionPlatforms

func NormalizeAppStoreVersionPlatforms(values []string) ([]string, error)

NormalizeAppStoreVersionPlatforms validates multiple platform values.

func NormalizeAppStoreVersionStates

func NormalizeAppStoreVersionStates(values []string) ([]string, error)

NormalizeAppStoreVersionStates validates multiple state values.

func NormalizeBuildProcessingStateFilter

func NormalizeBuildProcessingStateFilter(raw string, options BuildProcessingStateFilterOptions) ([]string, error)

NormalizeBuildProcessingStateFilter parses and validates CSV processing-state filters (including "all"), deduplicates values, and applies optional aliases.

func NormalizeDate

func NormalizeDate(value, flagName string) (string, error)

func NormalizeEnumToken

func NormalizeEnumToken(value string) string

NormalizeEnumToken normalizes enum-like flag values by uppercasing and converting separators to underscore form.

func NormalizeLocalizationType

func NormalizeLocalizationType(value string) (string, error)

func NormalizeOutputFormat

func NormalizeOutputFormat(format string) string

NormalizeOutputFormat lowercases format and canonicalizes aliases.

func NormalizePlatform

func NormalizePlatform(value string) (asc.Platform, error)

NormalizePlatform validates and normalizes a platform string.

func NormalizeReviewSubmissionStates

func NormalizeReviewSubmissionStates(values []string) ([]string, error)

NormalizeReviewSubmissionStates validates multiple review submission state values.

func NormalizeSelection

func NormalizeSelection(value string, allowed []string, flagName string) ([]string, error)

NormalizeSelection validates comma-separated values against an allow-list.

func NormalizeVersionMetadataCopyFields

func NormalizeVersionMetadataCopyFields(value, flagName string) ([]string, error)

NormalizeVersionMetadataCopyFields validates a comma-separated field list against version localization keys.

func OpenExistingNoFollow

func OpenExistingNoFollow(path string) (*os.File, error)

OpenExistingNoFollow opens an existing file without following symlinks.

func OpenNewFileNoFollow

func OpenNewFileNoFollow(path string, perm os.FileMode) (*os.File, error)

OpenNewFileNoFollow creates a new file without following symlinks. Uses O_EXCL to prevent overwriting existing files and O_NOFOLLOW to prevent symlink attacks.

func OrNA

func OrNA(value string) string

OrNA trims a string and returns "n/a" when empty.

func PaginateWithSpinner

func PaginateWithSpinner(ctx context.Context, fetch FetchFunc, next asc.PaginateFunc) (asc.PaginatedResponse, error)

PaginateWithSpinner fetches all pages with a spinner on stderr. It wraps both the initial fetch and the pagination loop so the spinner is visible even for single-page results.

func ParseBoolFlag

func ParseBoolFlag(value, flagName string) (bool, error)

ParseBoolFlag parses common bool-like flag values and returns a usage-style error with the provided flagName when parsing fails.

func ParseOptionalBoolFlag

func ParseOptionalBoolFlag(name, raw string) (*bool, error)

ParseOptionalBoolFlag parses an optional boolean flag value.

func PlatformList

func PlatformList() []string

PlatformList returns the allowed platform values.

func PrintOutput

func PrintOutput(data any, format string, pretty bool) error

func PrintOutputWithRenderers

func PrintOutputWithRenderers(data any, format string, pretty bool, tableRenderer, markdownRenderer func() error) error

func PrintStreamPage

func PrintStreamPage(data any) error

PrintStreamPage writes a single page of data as a JSON line to stdout. Used with --stream --paginate to emit results page-by-page as NDJSON instead of buffering all pages in memory.

func ProgressEnabled

func ProgressEnabled() bool

ProgressEnabled reports whether it's safe/appropriate to emit progress messages. Progress must be stderr-only and must not appear when stderr is non-interactive.

func ReadJSONFilePayload

func ReadJSONFilePayload(path string) (json.RawMessage, error)

ReadJSONFilePayload loads a JSON object from a file path for commands that accept raw payload documents.

func ReadLocalizationStrings

func ReadLocalizationStrings(inputPath string, locales []string) (map[string]map[string]string, error)

func RecoverBoolFlagTailArgs

func RecoverBoolFlagTailArgs(original *flag.FlagSet, args []string, currentValue *bool) error

RecoverBoolFlagTailArgs reparses leftover args when the standard flag parser stops after a space-separated boolean value for a bool flag. This preserves support for `--flag`, `--flag=true`, and `--flag=false` while also recovering `--flag true` / `--flag false` for commands that don't accept positional args.

func RenderSection

func RenderSection(title string, headers []string, rows [][]string, markdown bool)

RenderSection renders a titled section as markdown or table output.

func ReportFile

func ReportFile() string

ReportFile returns the configured report file path.

func ReportFormat

func ReportFormat() string

ReportFormat returns the configured report format.

func ResetDefaultOutputFormat

func ResetDefaultOutputFormat()

ResetDefaultOutputFormat clears the cached default output format so that DefaultOutputFormat() re-reads ASC_DEFAULT_OUTPUT on its next call. Tests only.

func ResolveAppID

func ResolveAppID(appID string) string

func ResolveAppIDWithExactLookup

func ResolveAppIDWithExactLookup(ctx context.Context, client appLookupClient, appID string) (string, error)

ResolveAppIDWithExactLookup takes an already-resolved app identifier and looks it up by exact bundle ID and exact app name only. If no exact match exists and the value is numeric, it falls back to treating it as an App Store Connect app ID.

func ResolveAppIDWithLookup

func ResolveAppIDWithLookup(ctx context.Context, client appLookupClient, appID string) (string, error)

ResolveAppIDWithLookup takes an already-resolved app identifier and, when non-numeric, looks it up by exact bundle ID, exact app name, then legacy fuzzy-name matching when unique.

func ResolveAppInfoID

func ResolveAppInfoID(ctx context.Context, client *asc.Client, appID, appInfoID string) (string, error)

ResolveAppInfoID resolves the app info ID, optionally using a provided override.

func ResolveAppStoreVersionID

func ResolveAppStoreVersionID(ctx context.Context, client *asc.Client, appID, version, platform string) (string, error)

ResolveAppStoreVersionID finds a version ID by version string and platform.

func ResolveAppStoreVersionIDAndState

func ResolveAppStoreVersionIDAndState(ctx context.Context, client *asc.Client, appID, version, platform string) (string, string, error)

ResolveAppStoreVersionIDAndState finds a version ID and state by version string and platform.

func ResolveAppStoreVersionState

func ResolveAppStoreVersionState(attrs asc.AppStoreVersionAttributes) string

ResolveAppStoreVersionState prefers the app version state when available.

func ResolvePricePointByPrice

func ResolvePricePointByPrice(tiers []TierEntry, price string) (string, error)

ResolvePricePointByPrice finds the price point ID for a given customer price.

func ResolvePricePointByTier

func ResolvePricePointByTier(tiers []TierEntry, tier int) (string, error)

ResolvePricePointByTier finds the price point ID for a given tier number.

func ResolveProfileName

func ResolveProfileName() string

func ResolveReportOutputPaths

func ResolveReportOutputPaths(outputPath, defaultCompressed, decompressedExt string, decompress bool) (string, string)

ResolveReportOutputPaths returns compressed/decompressed paths for reports.

func ResolveVendorNumber

func ResolveVendorNumber(value string) string

ResolveVendorNumber resolves the vendor number for reports.

func ResolveVersionMetadataCopyFields

func ResolveVersionMetadataCopyFields(copyFields, excludeFields []string) ([]string, error)

ResolveVersionMetadataCopyFields applies explicit includes/excludes to the supported metadata field set.

func RewriteCommandTreePath

func RewriteCommandTreePath(cmd *ffcli.Command, currentPrefix, replacementPrefix string) *ffcli.Command

RewriteCommandTreePath rewrites usage/help path prefixes for an existing command tree.

func SafeWriteFileNoSymlink(path string, perm os.FileMode, overwrite bool, tempPattern string, backupPattern string, write func(*os.File) (int64, error)) (int64, error)

SafeWriteFileNoSymlink writes a file to path without following symlinks and with an optional overwrite mode that preserves the original destination until the new file is fully written.

When overwrite is false, the destination must not already exist. When overwrite is true, we refuse to overwrite symlinks and we use temp+rename; if rename fails because the destination exists (notably on Windows), we fall back to a safe replace that uses a backup file to preserve the original if the final move fails.

func SanitizeTerminal

func SanitizeTerminal(input string) string

SanitizeTerminal strips ASCII control characters to prevent terminal escape injection.

func SaveTierCache

func SaveTierCache(appID, territory string, tiers []TierEntry) error

SaveTierCache writes tier data to the cache file.

func SelectBestAppInfoID

func SelectBestAppInfoID(appInfos *asc.AppInfosResponse) string

SelectBestAppInfoID chooses the most editable app info for updates.

func SelectedProfile

func SelectedProfile() string

SelectedProfile returns the current profile override.

func SetBuildUploadFailureDiagnosticsForTesting

func SetBuildUploadFailureDiagnosticsForTesting(fn func(context.Context, *asc.Client, string, *asc.BuildUploadResponse) (string, error)) func()

SetBuildUploadFailureDiagnosticsForTesting overrides build failure enrichment. Tests only.

func SetNoProgress

func SetNoProgress(value bool)

SetNoProgress sets progress suppression (tests only).

func SetReportFile

func SetReportFile(path string)

SetReportFile sets the report file path (for testing).

func SetReportFormat

func SetReportFormat(format string)

SetReportFormat sets the report format (for testing).

func SetSelectedProfile

func SetSelectedProfile(value string)

SetSelectedProfile sets the current profile override (tests only).

func SpinnerEnabled

func SpinnerEnabled() bool

SpinnerEnabled reports whether the CLI should render an indeterminate spinner on stderr for the current run.

Requirements:

  • stderr-only (handled by WithSpinner)
  • TTY-gated (stdout + stderr)
  • opt-out via ASC_SPINNER_DISABLED (invalid => disabled)
  • disabled when stderr is expected to be noisy (debug/retry logs)

func SplitCSV

func SplitCSV(value string) []string

func SplitCSVUpper

func SplitCSVUpper(value string) []string

func SplitUniqueCSV

func SplitUniqueCSV(value string) []string

func UploadAppInfoLocalizations

func UploadAppInfoLocalizations(ctx context.Context, client appInfoLocalizationClient, appInfoID string, valuesByLocale map[string]map[string]string, dryRun bool) ([]asc.LocalizationUploadLocaleResult, error)

func UploadVersionLocalizations

func UploadVersionLocalizations(ctx context.Context, client versionLocalizationClient, versionID string, valuesByLocale map[string]map[string]string, dryRun bool) ([]asc.LocalizationUploadLocaleResult, error)

func UpsertBetaBuildLocalization

func UpsertBetaBuildLocalization(ctx context.Context, client *asc.Client, buildID, locale, notes string) (*asc.BetaBuildLocalizationResponse, error)

UpsertBetaBuildLocalization creates or updates a beta build localization.

func UsageError

func UsageError(message string) error

UsageError prints a CLI validation error and returns flag.ErrHelp so callers map the failure to usage exit code semantics.

func UsageErrorf

func UsageErrorf(format string, args ...any) error

UsageErrorf formats and returns a usage-class validation error.

func ValidateAppInfoLocalizationKeys

func ValidateAppInfoLocalizationKeys(locale string, values map[string]string) error

ValidateAppInfoLocalizationKeys validates .strings keys for an app-info localization locale.

func ValidateBoundOutputFlags

func ValidateBoundOutputFlags(fs *flag.FlagSet) error

ValidateBoundOutputFlags validates any output-format flags bound via the shared output helpers on the provided flagset.

func ValidateBuildLocalizationLocale

func ValidateBuildLocalizationLocale(locale string) error

ValidateBuildLocalizationLocale validates a locale string.

func ValidateBuildLocalizationLocales

func ValidateBuildLocalizationLocales(locales []string) error

ValidateBuildLocalizationLocales validates multiple locale strings.

func ValidateFinitePriceFlag

func ValidateFinitePriceFlag(flagName, value string) error

ValidateFinitePriceFlag validates a numeric flag value that must be finite.

func ValidateNextURL

func ValidateNextURL(next string) error

func ValidateOutputFormat

func ValidateOutputFormat(format string, pretty bool) (string, error)

func ValidateOutputFormatAllowed

func ValidateOutputFormatAllowed(format string, pretty bool, allowed ...string) (string, error)

func ValidatePriceSelectionFlags

func ValidatePriceSelectionFlags(pricePoint string, tier int, price string) error

ValidatePriceSelectionFlags checks that --price-point, --tier, and --price are mutually exclusive. Returns a usage-style error if more than one is set.

func ValidateReportFlags

func ValidateReportFlags() error

ValidateReportFlags validates the CI report flags and returns an error if invalid.

func ValidateSort

func ValidateSort(value string, allowed ...string) error

func ValidateVersionLocalizationKeys

func ValidateVersionLocalizationKeys(locale string, values map[string]string) error

ValidateVersionLocalizationKeys validates .strings keys for a version localization locale.

func VerifyBuildUploadAfterCommit

func VerifyBuildUploadAfterCommit(ctx context.Context, client *asc.Client, appID, uploadID string, pollInterval, verifyTimeout time.Duration) error

VerifyBuildUploadAfterCommit briefly watches a newly committed upload for immediate App Store Connect failures. It returns nil on timeout so the caller can keep the default asynchronous success behavior when no failure is observed during the bounded verification window.

func VersionLocalizationKeys

func VersionLocalizationKeys() []string

VersionLocalizationKeys returns the supported app store version localization keys.

func VisibleHelpFlags

func VisibleHelpFlags(fs *flag.FlagSet) []*flag.Flag

VisibleHelpFlags returns the flags that should appear in help output.

func VisibleUsageFunc

func VisibleUsageFunc(c *ffcli.Command) string

VisibleUsageFunc renders command help while omitting deprecated aliases from nested subcommand listings. Root-level deprecated commands are already hidden elsewhere; this keeps nested canonical help focused on current surfaces.

func WaitForBuildByNumberOrUploadFailure

func WaitForBuildByNumberOrUploadFailure(ctx context.Context, client *asc.Client, appID, uploadID, version, buildNumber, platform string, pollInterval time.Duration) (*asc.BuildResponse, error)

WaitForBuildByNumberOrUploadFailure waits for a build matching version/build number to appear while also watching the originating build upload for early failure states. This prevents long hangs when App Store Connect rejects the uploaded artifact before a build record is created.

func WithSpinner

func WithSpinner(label string, fn func() error) (err error)

WithSpinner runs fn while rendering a gh-style indeterminate spinner on stderr. It is a no-op when SpinnerEnabled() is false.

func WithSpinnerDelayed

func WithSpinnerDelayed(label string, delay time.Duration, fn func() error) (err error)

WithSpinnerDelayed runs fn while rendering a gh-style indeterminate spinner on stderr, but only starts the spinner after delay has elapsed.

This avoids spinner “flicker” for fast operations while still providing feedback for slower operations (e.g., keychain prompts).

func WrapCommandOutputValidation

func WrapCommandOutputValidation(cmd *ffcli.Command)

WrapCommandOutputValidation ensures shared output flags are validated before command execution so invalid format combinations fail before side effects.

func WriteAppInfoLocalizationStrings

func WriteAppInfoLocalizationStrings(outputPath string, items []asc.Resource[asc.AppInfoLocalizationAttributes]) ([]asc.LocalizationFileResult, error)

func WriteFileNoSymlinkOverwrite

func WriteFileNoSymlinkOverwrite(path string, reader io.Reader, perm os.FileMode, tempPattern string, backupPattern string) (int64, error)

WriteFileNoSymlinkOverwrite writes reader to path via temp+rename. It refuses to overwrite symlinks and uses a Windows-safe replace when needed.

func WriteProfileFile

func WriteProfileFile(path string, content []byte) error

WriteProfileFile writes provisioning profile data to disk securely.

func WriteStreamToFile

func WriteStreamToFile(path string, reader io.Reader) (int64, error)

WriteStreamToFile writes a reader to a file securely.

func WriteVersionLocalizationStrings

func WriteVersionLocalizationStrings(outputPath string, items []asc.Resource[asc.AppStoreVersionLocalizationAttributes]) ([]asc.LocalizationFileResult, error)

Types

type AddBuildBetaGroupsOptions

type AddBuildBetaGroupsOptions struct {
	SkipInternal              bool
	SkipInternalWithAllBuilds bool
	Notify                    bool
}

AddBuildBetaGroupsOptions controls how resolved groups are assigned to a build.

type AddBuildBetaGroupsResult

type AddBuildBetaGroupsResult struct {
	AddedGroupIDs                  []string
	SkippedInternalGroups          []ResolvedBetaGroup
	SkippedInternalAllBuildsGroups []ResolvedBetaGroup
	NotificationAction             asc.BuildBetaGroupsNotificationAction
}

AddBuildBetaGroupsResult reports the final add/skipped group sets.

func AddBuildBetaGroups

func AddBuildBetaGroups(ctx context.Context, client buildBetaGroupsMutationClient, buildID string, groups []ResolvedBetaGroup, opts AddBuildBetaGroupsOptions) (*AddBuildBetaGroupsResult, error)

AddBuildBetaGroups applies resolved beta groups to a build, optionally skipping internal groups.

type AvailabilitySetCommandConfig

type AvailabilitySetCommandConfig struct {
	FlagSetName                      string
	CommandName                      string
	ShortUsage                       string
	ShortHelp                        string
	LongHelp                         string
	ErrorPrefix                      string
	IncludeAvailableInNewTerritories bool
}

AvailabilitySetCommandConfig configures the availability set command.

type BuildProcessingStateFilterOptions

type BuildProcessingStateFilterOptions struct {
	FlagName          string
	AllowedValuesHelp string
	Aliases           map[string]string
}

BuildProcessingStateFilterOptions customizes state normalization behavior for command-specific flag names/help text and optional aliases.

type CategoriesSetCommandConfig

type CategoriesSetCommandConfig struct {
	FlagSetName    string
	ShortUsage     string
	ShortHelp      string
	LongHelp       string
	ErrorPrefix    string
	IncludeAppInfo bool
}

CategoriesSetCommandConfig configures the categories set command.

type ConfirmDeleteCommandConfig

type ConfirmDeleteCommandConfig struct {
	FlagSetName string
	Name        string
	ShortUsage  string
	ShortHelp   string
	LongHelp    string

	IDFlag  string
	IDUsage string

	ErrorPrefix string

	ContextTimeout func(context.Context) (context.Context, context.CancelFunc)
	Delete         func(context.Context, *asc.Client, string) error
	Result         func(string) any
}

ConfirmDeleteCommandConfig configures a standard delete command requiring --id and --confirm.

type FetchFunc

type FetchFunc func(ctx context.Context) (asc.PaginatedResponse, error)

FetchFunc fetches the first page of a paginated resource.

type IDGetCommandConfig

type IDGetCommandConfig struct {
	FlagSetName string
	Name        string
	ShortUsage  string
	ShortHelp   string
	LongHelp    string

	IDFlag  string
	IDUsage string

	ErrorPrefix string

	ContextTimeout func(context.Context) (context.Context, context.CancelFunc)
	Fetch          func(context.Context, *asc.Client, string) (any, error)
}

IDGetCommandConfig configures a standard "get by ID" command.

type IPABundleInfo

type IPABundleInfo struct {
	Version     string
	BuildNumber string
}

func ExtractBundleInfoFromIPA

func ExtractBundleInfoFromIPA(ipaPath string) (IPABundleInfo, error)

ExtractBundleInfoFromIPA reads CFBundleVersion info from an IPA.

type JUnitReport

type JUnitReport struct {
	Tests     []JUnitTestCase // Test cases in this report
	Timestamp time.Time       // Report generation time
	Name      string          // Test suite name (default: "asc")
}

JUnitReport represents a JUnit XML test report.

func (*JUnitReport) Marshal

func (r *JUnitReport) Marshal() ([]byte, error)

Marshal marshals the JUnit report to XML. Note: xml.Encoder handles escaping automatically, so we don't pre-escape.

func (*JUnitReport) Write

func (r *JUnitReport) Write(path string) error

Write writes the JUnit report to the specified file path.

func (*JUnitReport) WriteTo

func (r *JUnitReport) WriteTo(w io.Writer) (int64, error)

WriteTo writes the JUnit report to the specified writer.

type JUnitTestCase

type JUnitTestCase struct {
	Name      string        // Test name (e.g., build-123)
	Classname string        // Test class/category (e.g., builds)
	Time      time.Duration // Test duration
	Failure   string        // Failure type (empty if passed)
	Message   string        // Failure message
	SystemOut string        // Standard output
	SystemErr string        // Standard error
}

JUnitTestCase represents a single test case in a JUnit report.

type ListCommandConfig

type ListCommandConfig struct {
	Name              string
	ShortUsage        string
	ShortHelp         string
	LongHelp          string
	ErrorPrefix       string
	DeprecatedWarning string
	UsageFunc         func(*ffcli.Command) string
}

ListCommandConfig describes common help/output behavior for list-style CLI commands.

type MetadataOutputFlags

type MetadataOutputFlags struct {
	OutputFormat *string
	Pretty       *bool
}

MetadataOutputFlags stores pointers to metadata output-related flag values.

func BindMetadataOutputFlags

func BindMetadataOutputFlags(fs *flag.FlagSet) MetadataOutputFlags

BindMetadataOutputFlags registers --output-format and --pretty flags on the provided flagset.

type OptionalBool

type OptionalBool struct {
	// contains filtered or unexported fields
}

OptionalBool tracks whether a boolean flag was explicitly set.

func (*OptionalBool) EnableBoolFlag

func (b *OptionalBool) EnableBoolFlag()

EnableBoolFlag allows bare --flag syntax for this OptionalBool instance.

func (*OptionalBool) IsBoolFlag

func (b *OptionalBool) IsBoolFlag() bool

IsBoolFlag tells the standard flag parser whether bare --flag is allowed.

func (OptionalBool) IsSet

func (b OptionalBool) IsSet() bool

func (*OptionalBool) Set

func (b *OptionalBool) Set(value string) error

func (*OptionalBool) String

func (b *OptionalBool) String() string

func (OptionalBool) Value

func (b OptionalBool) Value() bool

type OutputFlags

type OutputFlags struct {
	Output *string
	Pretty *bool
}

OutputFlags stores pointers to output-related flag values.

func BindOutputFlags

func BindOutputFlags(fs *flag.FlagSet) OutputFlags

BindOutputFlags registers --output and --pretty flags on the provided flagset.

func BindOutputFlagsWith

func BindOutputFlagsWith(fs *flag.FlagSet, flagName, defaultValue, usage string) OutputFlags

BindOutputFlagsWith registers a custom output-format flag and --pretty.

func BindOutputFlagsWithAllowed

func BindOutputFlagsWithAllowed(fs *flag.FlagSet, flagName, defaultValue, usage string, allowed ...string) OutputFlags

BindOutputFlagsWithAllowed registers a custom output-format flag and --pretty with an explicit allowed format set.

type PaginatedListCommandConfig

type PaginatedListCommandConfig struct {
	FlagSetName string
	Name        string
	ShortUsage  string
	ShortHelp   string
	LongHelp    string

	ParentFlag  string
	ParentUsage string

	LimitMax int

	ErrorPrefix string

	ContextTimeout func(context.Context) (context.Context, context.CancelFunc)
	FetchPage      func(context.Context, *asc.Client, string, int, string) (asc.PaginatedResponse, error)
}

PaginatedListCommandConfig configures a standard list command with --limit/--next/--paginate and a required parent resource ID.

type PriceFilter

type PriceFilter struct {
	Price    string
	MinPrice string
	MaxPrice string
}

PriceFilter holds parsed price filter criteria.

func (PriceFilter) HasFilter

func (pf PriceFilter) HasFilter() bool

HasFilter returns true if any price filter is set.

func (PriceFilter) MatchesPrice

func (pf PriceFilter) MatchesPrice(customerPrice string) bool

MatchesPrice returns true if the given customerPrice string passes the filter.

func (PriceFilter) Validate

func (pf PriceFilter) Validate() error

Validate checks that filter values are valid numbers and not contradictory.

type PricingSetCommandConfig

type PricingSetCommandConfig struct {
	FlagSetName           string
	CommandName           string
	ShortUsage            string
	ShortHelp             string
	LongHelp              string
	ErrorPrefix           string
	StartDateHelp         string
	StartDateDefaultToday bool
	RequireBaseTerritory  bool
	ResolveBaseTerritory  bool
}

PricingSetCommandConfig configures pricing set commands.

type ReportedError

type ReportedError interface {
	error
	Reported() bool
}

ReportedError marks an error as already reported to the user. The main entrypoint should exit non-zero without duplicating output.

type ResolveBetaGroupsOptions

type ResolveBetaGroupsOptions struct {
	SkipInternal            bool
	IncludeSkipInternalHint bool
}

ResolveBetaGroupsOptions controls beta-group name resolution behavior.

type ResolvedAuthCredentials

type ResolvedAuthCredentials struct {
	KeyID    string
	IssuerID string
	KeyPath  string
	KeyPEM   string
	Profile  string
}

ResolvedAuthCredentials contains the concrete auth inputs selected for a command.

func ResolveAuthCredentials

func ResolveAuthCredentials(profile string) (ResolvedAuthCredentials, error)

ResolveAuthCredentials resolves the signing credentials for a command. A non-empty profile override takes precedence over root-level profile selection.

type ResolvedBetaGroup

type ResolvedBetaGroup struct {
	ID                   string
	Name                 string
	IsInternalGroup      bool
	HasAccessToAllBuilds bool
}

ResolvedBetaGroup captures the canonical ID and metadata for a beta group.

func ResolveBetaGroups

func ResolveBetaGroups(ctx context.Context, client betaGroupsClient, appID string, groups []string, opts ResolveBetaGroupsOptions) ([]ResolvedBetaGroup, error)

ResolveBetaGroups lists an app's beta groups and resolves the provided IDs or names.

func ResolveBetaGroupsFromList

func ResolveBetaGroupsFromList(inputGroups []string, groups *asc.BetaGroupsResponse, opts ResolveBetaGroupsOptions) ([]ResolvedBetaGroup, error)

ResolveBetaGroupsFromList resolves IDs or names against a provided beta-groups payload.

func (ResolvedBetaGroup) NameForDisplay

func (g ResolvedBetaGroup) NameForDisplay() string

type SubmitReadinessIssue

type SubmitReadinessIssue struct {
	Locale        string
	MissingFields []string
}

SubmitReadinessIssue describes submission-blocking missing fields for a locale.

func SubmitReadinessIssuesByLocale

func SubmitReadinessIssuesByLocale(localizations []asc.Resource[asc.AppStoreVersionLocalizationAttributes]) []SubmitReadinessIssue

SubmitReadinessIssuesByLocale evaluates all localizations and returns per-locale missing submit-required fields.

func SubmitReadinessIssuesByLocaleWithOptions

func SubmitReadinessIssuesByLocaleWithOptions(localizations []asc.Resource[asc.AppStoreVersionLocalizationAttributes], opts SubmitReadinessOptions) []SubmitReadinessIssue

SubmitReadinessIssuesByLocaleWithOptions evaluates all localizations with configurable checks and returns per-locale missing submit-required fields.

type SubmitReadinessOptions

type SubmitReadinessOptions struct {
	// RequireWhatsNew enables whatsNew validation. This should be set for
	// app updates (when a READY_FOR_SALE version already exists) because
	// App Store Connect requires whatsNew for every locale on updates.
	RequireWhatsNew bool
}

SubmitReadinessOptions controls optional submit-readiness checks.

type TierEntry

type TierEntry struct {
	Tier          int    `json:"tier"`
	PricePointID  string `json:"pricePointId"`
	CustomerPrice string `json:"customerPrice"`
	Proceeds      string `json:"proceeds"`
}

TierEntry represents a single tier in a territory's price point list.

func LoadTierCache

func LoadTierCache(appID, territory string) ([]TierEntry, error)

LoadTierCache loads cached tier data. Returns an error if the cache is missing or expired.

func ResolveIAPTiers

func ResolveIAPTiers(ctx context.Context, client *asc.Client, iapID, territory string, refresh bool) ([]TierEntry, error)

ResolveIAPTiers resolves in-app purchase price point tiers for an IAP and territory.

func ResolveSubscriptionTiers

func ResolveSubscriptionTiers(ctx context.Context, client *asc.Client, subscriptionID, territory string, refresh bool) ([]TierEntry, error)

ResolveSubscriptionTiers resolves subscription price point tiers for a subscription and territory.

func ResolveTiers

func ResolveTiers(ctx context.Context, client *asc.Client, appID, territory string, refresh bool) ([]TierEntry, error)

ResolveTiers fetches all price points for a territory, sorts by customerPrice ascending, and assigns tier numbers starting at 1. Free (0.00) price points are excluded.

type VersionMetadataCopyOptions

type VersionMetadataCopyOptions struct {
	AppID                string
	Platform             string
	SourceVersion        string
	DestinationVersionID string
	SelectedFields       []string
	DryRun               bool
}

VersionMetadataCopyOptions defines a metadata carry-forward operation between App Store versions.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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