{"modulePath":"github.com/newstack-cloud/deploy-cli-sdk","version":"v0.10.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package shared\n\nPackage shared provides common types and utilities for deployment TUI components.\n\nThis file defines the abstract resource grouping mechanism used to group concrete cloud resources under their abstract source types when a transformer plugin has expanded abstract resources.\n\n## Constants\n\n```go\nconst (\n\t// AnnotationSourceAbstractName is the annotation key set by transformer plugins\n\t// to record the original abstract resource name that a concrete resource was\n\t// expanded from.\n\tAnnotationSourceAbstractName = \"bluelink.transform.source.abstractName\"\n\n\t// AnnotationSourceAbstractType is the annotation key set by transformer plugins\n\t// to record the original abstract resource type that a concrete resource was\n\t// expanded from.\n\tAnnotationSourceAbstractType = \"bluelink.transform.source.abstractType\"\n\n\t// AnnotationResourceCategory is the annotation key set by transformer plugins\n\t// to classify a concrete resource as either \"code-hosting\" or \"infrastructure\".\n\t// Used by the code-only auto-approval mechanism.\n\tAnnotationResourceCategory = \"bluelink.transform.resourceCategory\"\n\n\t// ResourceCategoryCodeHosting indicates a resource that hosts application code\n\t// (e.g. Lambda function, ECS task, API Gateway).\n\tResourceCategoryCodeHosting = \"code-hosting\"\n\n\t// ResourceCategoryInfrastructure indicates an infrastructure dependency\n\t// (e.g. DynamoDB table, S3 bucket, IAM role, VPC).\n\tResourceCategoryInfrastructure = \"infrastructure\"\n\n\t// AnnotationResourceRole is the annotation key set by transformer plugins to\n\t// describe the part an abstract resource plays in a deployment, as opposed\n\t// to what it is made of, which is what AnnotationResourceCategory records.\n\t// Absent means \"component\".\n\tAnnotationResourceRole = \"bluelink.transform.resourceRole\"\n\n\t// ResourceRoleComponent indicates an abstract resource that is part of the\n\t// application, such as an API, a handler or a datastore.\n\tResourceRoleComponent = \"component\"\n\n\t// ResourceRoleAmbient indicates an abstract resource that most of a\n\t// deployment sits inside or depends on, such as a VPC. Links out of it\n\t// describe the environment rather than the application, so the tree shows\n\t// them against the resource at the other end.\n\tResourceRoleAmbient = \"ambient\"\n)\n```\n\n```go\nconst (\n\tIconPending          = \"○\"\n\tIconInProgress       = \"◐\"\n\tIconSuccess          = \"✓\"\n\tIconFailed           = \"✗\"\n\tIconRollingBack      = \"↺\"\n\tIconRollbackFailed   = \"⚠\"\n\tIconRollbackComplete = \"⟲\"\n\tIconInterrupted      = \"⏹\"\n\tIconSkipped          = \"⊘\"\n\tIconNoChange         = \"─\"\n\tIconRetained         = \"⊙\"\n\tIconDegraded         = \"!\"\n)\n```\nIcon characters used across deploy and destroy UIs.\n\n```go\nconst LinkNameSeparator = \"::\"\n```\nLinkNameSeparator joins the two resources of a link in its logical name, which is the identifier the engine uses: \"{resourceA}::{resourceB}\".\n\n## Functions\n\n```go\nfunc ActionIcon(action ActionType) string\n```\nActionIcon returns the icon character for an action type.\n\n```go\nfunc BlueprintSourceFromPath(blueprintFile string) string\n```\nBlueprintSourceFromPath determines where a blueprint is loaded from, returning one of the consts.BlueprintSource\\* constants.\n\n```go\nfunc BuildDocumentInfo(source, blueprintFile string) (types.BlueprintDocumentInfo, error)\n```\nBuildDocumentInfo creates BlueprintDocumentInfo based on the source type.\n\n```go\nfunc BuildElementPath(parentPath, elementType, elementName string) string\n```\nBuildElementPath constructs a full path like \"children.notifications::resources.queue\".\n\n```go\nfunc BuildHTTPSDocumentInfo(blueprintFile string) (types.BlueprintDocumentInfo, error)\n```\nBuildHTTPSDocumentInfo creates document info for HTTPS sources.\n\n```go\nfunc BuildIntermediaryActions(\n\tchanges map[string]*container.IntermediaryReconcileResult,\n) map[string]*types.IntermediaryReconcileActionPayload\n```\nBuildIntermediaryActions converts intermediary reconciliation results to action payloads.\n\n```go\nfunc BuildLinkActions(links []container.LinkReconcileResult) []types.LinkReconcileActionPayload\n```\nBuildLinkActions converts link reconciliation results to action payloads.\n\n```go\nfunc BuildLocalFileDocumentInfo(blueprintFile string) (types.BlueprintDocumentInfo, error)\n```\nBuildLocalFileDocumentInfo creates document info for local file sources.\n\n```go\nfunc BuildMapKey(prefix, name string) string\n```\nBuildMapKey builds a path-based key for map lookups.\n\n```go\nfunc BuildObjectStorageDocumentInfo(blueprintFile, scheme string) types.BlueprintDocumentInfo\n```\nBuildObjectStorageDocumentInfo creates a BlueprintDocumentInfo for object storage sources. It strips the scheme prefix before extracting directory and file components, since path.Dir doesn't handle scheme-prefixed paths correctly.\n\n```go\nfunc BuildResourceActions(resources []container.ResourceReconcileResult) []types.ResourceReconcileActionPayload\n```\nBuildResourceActions converts resource reconciliation results to action payloads.\n\n```go\nfunc DispatchBlueprintEvent(event *types.BlueprintInstanceEvent, handlers BlueprintEventHandlers) bool\n```\nDispatchBlueprintEvent dispatches a blueprint instance event to the appropriate handler. Returns true if the event was handled, false otherwise.\n\n```go\nfunc ExtractResourceCategory(meta *state.ResourceMetadataState) string\n```\nExtractResourceCategory reads the resource category annotation from resource metadata. Returns an empty string if not set.\n\n```go\nfunc FileLocationFromPath(filePath string) string\n```\nFileLocationFromPath returns the consts.FileLocation\\* constant for a path's URL scheme (https://, s3://, gcs:// or azureblob://), or consts.FileLocationLocal when it has none.\n\n```go\nfunc FindChildInstanceIDByPath(instanceState *state.InstanceState, path string) string\n```\nFindChildInstanceIDByPath finds a child blueprint's instance ID by traversing the instance state hierarchy. The path format is \"childA/childB\" where each segment is a child blueprint name.\n\n```go\nfunc FindLinkIDByPath(instanceState *state.InstanceState, path, linkName string) string\n```\nFindLinkIDByPath finds a link's ID by traversing the instance state hierarchy. The path format is \"childA/childB/linkName\" where the preceding segments are child blueprint names.\n\n```go\nfunc FindResourceIDByPath(instanceState *state.InstanceState, path, resourceName string) string\n```\nFindResourceIDByPath finds a resource ID by traversing the instance state hierarchy. The path format is \"childA/childB/resourceName\" where the preceding segments are child blueprint names.\n\n```go\nfunc FindResourceStateByName(instanceState *state.InstanceState, name string) *state.ResourceState\n```\nFindResourceStateByName finds a resource state by name using the instance state's ResourceIDs map to look up the resource ID, then retrieves the state from Resources.\n\n```go\nfunc FormatLinkName(resourceA, resourceB string) string\n```\nFormatLinkName renders a link for display. The logical name stays the identifier used for lookups and expansion; this is only what a person reads.\n\n```go\nfunc FormatLinkStatus(status core.LinkStatus) string\n```\nFormatLinkStatus returns a lowercase human-readable status string for a link.\n\n```go\nfunc FormatLogicalLinkName(linkName string) string\n```\nFormatLogicalLinkName renders a link given its logical \"a::b\" name, leaving anything that is not in that form untouched.\n\n```go\nfunc FormatPreciseLinkStatus(status core.PreciseLinkStatus) string\n```\nFormatPreciseLinkStatus returns a human-readable string for a precise link status.\n\n```go\nfunc FormatPreciseResourceStatus(status core.PreciseResourceStatus) string\n```\nFormatPreciseResourceStatus returns a human-readable string for a precise resource status.\n\n```go\nfunc GetEffectiveInstanceID(instanceID, instanceName string) string\n```\nGetEffectiveInstanceID returns the instance ID, falling back to instance name if ID is empty.\n\n```go\nfunc GroupHeadlessResources(\n\tresources []HeadlessResourceInfo,\n) ([]HeadlessResourceGroup, []HeadlessResourceInfo)\n```\nGroupHeadlessResources partitions resources by abstract group. Resources whose metadata contains grouping annotations are placed in groups; others are returned as ungrouped. Group order is preserved (first seen).\n\n```go\nfunc InstanceStatusHeadlessIcon(status core.InstanceStatus) string\n```\nInstanceStatusHeadlessIcon returns the icon for an instance status in headless mode.\n\n```go\nfunc InstanceStatusHeadlessText(status core.InstanceStatus) string\n```\nInstanceStatusHeadlessText returns the text for an instance status in headless mode.\n\n```go\nfunc InstanceStatusIcon(status core.InstanceStatus) string\n```\nInstanceStatusIcon returns an icon character for the given instance status. This handles all instance statuses (deploy, update, destroy).\n\n```go\nfunc IsPendingChildStatus(status core.InstanceStatus) bool\n```\nIsPendingChildStatus returns true if the child status is a pending/initial state.\n\n```go\nfunc IsPendingLinkStatus(status core.LinkStatus) bool\n```\nIsPendingLinkStatus returns true if the link status is a pending/initial state.\n\n```go\nfunc IsPendingResourceStatus(status core.ResourceStatus) bool\n```\nIsPendingResourceStatus returns true if the resource status is a pending/initial state.\n\n```go\nfunc JoinPath(parts []string) string\n```\nJoinPath joins path parts with \"/\" separator.\n\n```go\nfunc KnownStatusKeywords() []string\n```\nKnownStatusKeywords lists every word a status filter accepts, sorted for a stable hint line.\n\n```go\nfunc LinkFromName(resourceA string) string\n```\nLinkFromName renders a link as seen from its destination: \"← source\".\n\n```go\nfunc LinkStatusHeadlessIcon(status core.LinkStatus) string\n```\nLinkStatusHeadlessIcon returns the icon for a link status in headless mode.\n\n```go\nfunc LinkStatusHeadlessText(status core.LinkStatus) string\n```\nLinkStatusHeadlessText returns the text for a link status in headless mode.\n\n```go\nfunc LinkStatusIcon(status core.LinkStatus) string\n```\nLinkStatusIcon returns an icon character for the given link status. This handles all link statuses (create, update, destroy).\n\n```go\nfunc LinkToName(resourceB string) string\n```\nLinkToName renders a link as seen from its source: \"→ destination\".\n\n```go\nfunc LookupByKey[T any](m map[string]*T, pathKey, name string) *T\n```\nLookupByKey looks up an item by path-based key, falling back to simple name. This is a generic helper used by the result collectors.\n\n```go\nfunc LookupInstanceID(ctx context.Context, lookup InstanceLookup, instanceName string) (string, error)\n```\nLookupInstanceID returns the ID of the instance with the given name, or an empty ID when no instance has that name. Any other lookup failure is returned as an error, so that an engine that cannot be reached is never mistaken for an instance that does not exist yet.\n\n```go\nfunc MarkPendingChildrenAsSkipped[T SkippableChild](children map[string]T)\n```\nMarkPendingChildrenAsSkipped marks children that were never attempted as skipped.\n\n```go\nfunc MarkPendingLinksAsSkipped[T SkippableLink](links map[string]T)\n```\nMarkPendingLinksAsSkipped marks links that were never attempted as skipped.\n\n```go\nfunc MarkPendingResourcesAsSkipped[T SkippableResource](resources map[string]T)\n```\nMarkPendingResourcesAsSkipped marks resources that were never attempted as skipped.\n\n```go\nfunc NewAutoApproveGroup(valuePtr *bool, stageFirstPtr *bool, negativeLabel string) *huh.Group\n```\nNewAutoApproveGroup creates an auto-approve confirm group that shows when stageFirst is true.\n\n```go\nfunc NewChangesetIDGroup(valuePtr *string, stageFirstPtr *bool, description string) *huh.Group\n```\nNewChangesetIDGroup creates a changeset ID input group that hides when stageFirst is true.\n\n```go\nfunc NewInstanceIDNote(instanceID string) *huh.Note\n```\nNewInstanceIDNote creates a read-only note displaying an instance ID.\n\n```go\nfunc NewInstanceNameInput(valuePtr *string, description string) *huh.Input\n```\nNewInstanceNameInput creates a standard instance name input field.\n\n```go\nfunc NewStageFirstConfirm(valuePtr *bool, title, description string) *huh.Confirm\n```\nNewStageFirstConfirm creates a stage-first confirm field.\n\n```go\nfunc NewThemedForm(styles *stylespkg.Styles, groups ...*huh.Group) *huh.Form\n```\nNewThemedForm creates a new form with the standard theme applied.\n\n```go\nfunc OverviewEntryIndent(base string, group *ResourceGroup) string\n```\nOverviewEntryIndent returns the indent for an entry in an overview list, adding a level of nesting for entries that sit under a group header.\n\n```go\nfunc ParentElementPath(path, elementType, elementName string) string\n```\nParentElementPath returns the path of an element's parent, derived from a path previously built by BuildElementPath. It returns an empty string for top-level elements.\n\n```go\nfunc ReconciliationConfig(operationConfig *types.BlueprintOperationConfig) *types.BlueprintOperationConfig\n```\nReconciliationConfig returns the operation config to send with a reconciliation request. The deploy engine requires a config on reconciliation requests, while the operation config is nil when no deploy config file is configured, so an empty config is sent then.\n\n```go\nfunc RenderActionBadge(action ActionType, s *styles.Styles) string\n```\nRenderActionBadge renders an action badge with appropriate styling.\n\n```go\nfunc RenderBreadcrumb(sb *strings.Builder, navigationPath []string, s *styles.Styles)\n```\nRenderBreadcrumb renders navigation breadcrumb for drill-down views.\n\n```go\nfunc RenderChangesetTypeMismatchError(params ChangesetTypeMismatchParams, s *styles.Styles) string\n```\nRenderChangesetTypeMismatchError renders an error when attempting to use a changeset with the wrong command (e.g., using a destroy changeset with deploy command).\n\n```go\nfunc RenderConfirmationPrompt(sb *strings.Builder, promptText string, s *styles.Styles)\n```\nRenderConfirmationPrompt renders a y/n confirmation prompt.\n\n```go\nfunc RenderDiagnostic(diag *core.Diagnostic, s *styles.Styles) string\n```\nRenderDiagnostic renders a single diagnostic with level styling and suggested actions.\n\n```go\nfunc RenderElementFailures(sb *strings.Builder, failures []ElementFailure, contentWidth int, showElementType bool, s *styles.Styles)\n```\nRenderElementFailures renders a list of element failures with text wrapping. Set showElementType to true to display the element type for resources (used by destroy).\n\n```go\nfunc RenderElementSummary(sb *strings.Builder, summary ElementSummary, s *styles.Styles)\n```\nRenderElementSummary renders a summary line of element counts (successful/destroyed, failures, interrupted, retained).\n\n```go\nfunc RenderErrorFooter(s *styles.Styles) string\n```\nRenderErrorFooter renders a standard \"Press q to quit\" footer.\n\n```go\nfunc RenderExportsFooterNavigation(sb *strings.Builder, s *styles.Styles)\n```\nRenderExportsFooterNavigation renders navigation hints for exports overlay views.\n\n```go\nfunc RenderFailureReasons(sb *strings.Builder, reasons []string, width int, s *styles.Styles)\n```\nRenderFailureReasons renders failure reasons with word wrapping.\n\n```go\nfunc RenderFooterNavigation(sb *strings.Builder, s *styles.Styles, extraKeys ...KeyHint)\n```\nRenderFooterNavigation renders standard keyboard navigation hints.\n\n```go\nfunc RenderGenericError(err error, operationFailedHeader string, s *styles.Styles) string\n```\nRenderGenericError renders a generic error with the operation context.\n\n```go\nfunc RenderGroupDetails(group *ResourceGroupItem, width int, s *styles.Styles) string\n```\nRenderGroupDetails renders the right-pane detail view for a ResourceGroupItem.\n\n```go\nfunc RenderInstanceDurations(durations *state.InstanceCompletionDuration, s *styles.Styles) string\n```\nRenderInstanceDurations renders how long a blueprint instance took to deploy.\n\n```go\nfunc RenderInstanceStatus(status core.InstanceStatus, s *styles.Styles) string\n```\nRenderInstanceStatus renders a styled instance status string.\n\n```go\nfunc RenderLabelValue(sb *strings.Builder, label, value string, s *styles.Styles)\n```\nRenderLabelValue renders a label-value pair with muted label styling.\n\n```go\nfunc RenderLinkAction(sb *strings.Builder, action string, s *styles.Styles)\n```\nRenderLinkAction renders the action badge for a link if action is non-empty.\n\n```go\nfunc RenderLinkDetailsBase(sb *strings.Builder, link LinkDetailsBase, width int, s *styles.Styles)\n```\nRenderLinkDetailsBase renders the common link details header and metadata. Returns after writing the metadata section, allowing callers to add UI-specific content.\n\n```go\nfunc RenderLinkDurations(durations *state.LinkCompletionDurations, s *styles.Styles) string\n```\nRenderLinkDurations renders how long a link took to deploy, broken down by the components the engine reports separately.\n\n```go\nfunc RenderLinkStatus(status core.LinkStatus, s *styles.Styles) string\n```\nRenderLinkStatus renders a styled link status string.\n\n```go\nfunc RenderOutboundLinksSection(resourceName string, links map[string]*state.LinkState, s *styles.Styles) string\n```\nRenderOutboundLinksSection renders the outbound links from a resource. It searches the provided links map for links that originate from the given resourceName.\n\n```go\nfunc RenderOverviewGroupHeader(sb *strings.Builder, group *ResourceGroup, indent string, s *styles.Styles)\n```\nRenderOverviewGroupHeader writes the header line for an abstract resource group in an overview list. Nothing is written for the ungrouped bucket.\n\n```go\nfunc RenderResourceDurations(durations *state.ResourceCompletionDurations, s *styles.Styles) string\n```\nRenderResourceDurations renders how long a resource took to deploy.\n\n```go\nfunc RenderResourceMetadata(sb *strings.Builder, meta ResourceMetadata, resourceState *state.ResourceState, s *styles.Styles)\n```\nRenderResourceMetadata renders the common resource metadata fields (ID, name, type).\n\n```go\nfunc RenderResourceStatus(status core.ResourceStatus, s *styles.Styles) string\n```\nRenderResourceStatus renders a styled resource status string.\n\n```go\nfunc RenderSectionHeader(sb *strings.Builder, headerText string, width int, s *styles.Styles)\n```\nRenderSectionHeader renders a styled section header with a separator line.\n\n```go\nfunc RenderStagingCompleteHeader(sb *strings.Builder, changesetID string, s *styles.Styles)\n```\nRenderStagingCompleteHeader renders the \"Staging complete. Changeset: X\" header line.\n\n```go\nfunc RenderStagingDrillDownFooter(sb *strings.Builder, model SplitPaneModel, s *styles.Styles) bool\n```\nRenderStagingDrillDownFooter renders the common drill-down footer for staging views. Returns true if footer was rendered (i.e., model is in drill-down), false otherwise.\n\n```go\nfunc RenderStreamError(streamErr *engineerrors.StreamError, ctx ErrorContext, s *styles.Styles) string\n```\nRenderStreamError renders a stream error with diagnostics.\n\n```go\nfunc RenderStreamingFooter(sb *strings.Builder, params StreamingFooterParams, s *styles.Styles)\n```\nRenderStreamingFooter renders a footer for an in-progress streaming operation.\n\n```go\nfunc RenderTimingSection(sb *strings.Builder, content string, s *styles.Styles)\n```\nRenderTimingSection renders a labelled timing block, or nothing when there are no durations to show.\n\n```go\nfunc RenderValidationError(clientErr *engineerrors.ClientError, ctx ErrorContext, s *styles.Styles) string\n```\nRenderValidationError renders a validation error with diagnostics.\n\n```go\nfunc RenderViewportOverlayFooter(sb *strings.Builder, toggleKey string, s *styles.Styles)\n```\nRenderViewportOverlayFooter renders a footer for viewport overlay views (overview, spec, etc.). The toggleKey is the key that toggles the overlay (e.g., \"o\" for overview, \"s\" for spec).\n\n```go\nfunc RenderViewportScrollHints(sb *strings.Builder, toggleKey string, s *styles.Styles)\n```\nRenderViewportScrollHints renders just the scroll/return/quit key hints for viewport overlays. Use this when you don't want the separator line (e.g., for inspect model).\n\n```go\nfunc RenderWrappedFailureReasons(sb *strings.Builder, reasons []string, width int, s *styles.Styles)\n```\nRenderWrappedFailureReasons renders failure reasons with bullet points and text wrapping.\n\n```go\nfunc ResolveInstance(\n\tctx context.Context,\n\tlookup InstanceLookup,\n\tinstanceID string,\n\tinstanceName string,\n) (string, string, error)\n```\nResolveInstance returns the ID and name of the instance a command targets. An instance ID that is already known is returned as it is. Otherwise the instance is looked up by name, and empty strings are returned when no instance has that name, meaning a new deployment. Any other lookup failure is returned as an error, as LookupInstanceID does.\n\n```go\nfunc ResolveInstanceIdentifiers(ctx context.Context, resolver InstanceResolver) (instanceID, instanceName string)\n```\nResolveInstanceIdentifiers looks up instance identifiers, returning the resolved ID and name. If an instance ID is already provided, it's returned as-is. If only a name is provided, it looks up the instance to get its ID. If the instance doesn't exist, empty strings are returned (indicating new deployment).\n\nDeprecated: a failed lookup is also returned as empty strings, so a network or authentication failure is taken for an instance that does not exist. Use ResolveInstance, which returns the error.\n\n```go\nfunc ResourceDegraded(status core.ResourceStatus, failureReasons []string) bool\n```\nResourceDegraded reports whether a resource reached a successful status but still carries failure reasons.\n\nA resource whose links could not apply what they contribute is recorded with its own status, which is the deployment the blueprint asked for and did succeed, and the reason is attached alongside. Reading the status alone therefore shows it as healthy, and the only account of what went wrong sits in a detail view nobody has been given a reason to open.\n\n```go\nfunc ResourceGroupLabel(group *ResourceGroup) string\n```\nResourceGroupLabel returns the display label for an abstract resource group, matching the \"\\[type] name\" format used by group headers in the tree.\n\n```go\nfunc ResourceStatusHeadlessIcon(status core.ResourceStatus) string\n```\nResourceStatusHeadlessIcon returns the icon for a resource status in headless mode.\n\n```go\nfunc ResourceStatusHeadlessText(status core.ResourceStatus) string\n```\nResourceStatusHeadlessText returns the text for a resource status in headless mode.\n\n```go\nfunc ResourceStatusIcon(status core.ResourceStatus) string\n```\nResourceStatusIcon returns an icon character for the given resource status. This handles all resource statuses (create, update, destroy).\n\n```go\nfunc SortItems(items []splitpane.Item)\n```\nSortItems sorts items alphabetically by name.\n\n```go\nfunc StatusKeywordsForIcon(icon string) []string\n```\nStatusKeywordsForIcon returns the filter words matching a status icon.\n\n```go\nfunc StatusKeywordsForItem(item splitpane.Item) []string\n```\nStatusKeywordsForItem returns the filter words for an item, taken from the status icon it renders. Wire it into a split pane through splitpane.Config.StatusKeywords.\n\nA group header reports the most severe status among its contents rather than one of its own, so it is deliberately given no keywords, filtering by \"failed\" should show the failures inside a group, not every resource that happens to sit alongside them. The header is still shown, kept as the parent of what matched, with its aggregate icon marking the group as the one to look at.\n\n```go\nfunc StripObjectStorageScheme(blueprintFile, scheme string) string\n```\nStripObjectStorageScheme removes the scheme prefix from an object storage path. For example, \"s3://bucket/file.yaml\" becomes \"bucket/file.yaml\". If the path doesn't have the expected scheme prefix, it's returned unchanged.\n\n```go\nfunc StyleInstanceIcon(icon string, status core.InstanceStatus, s *styles.Styles) string\n```\nStyleInstanceIcon returns a styled icon string for the given instance status.\n\n```go\nfunc StyleLinkIcon(icon string, status core.LinkStatus, s *styles.Styles) string\n```\nStyleLinkIcon returns a styled icon string for the given link status.\n\n```go\nfunc StyleResourceIcon(icon string, status core.ResourceStatus, s *styles.Styles) string\n```\nStyleResourceIcon returns a styled icon string for the given resource status.\n\n```go\nfunc StyledActionIcon(action ActionType, s *styles.Styles, applyStyle bool) string\n```\nStyledActionIcon returns a styled icon for an action type.\n\n```go\nfunc UnwrapItem(item splitpane.Item) splitpane.Item\n```\nUnwrapItem returns the item underneath any display wrappers the navigation tree has put around it. Items nested under an abstract resource group are wrapped to adjust their depth and name, so a type assertion against the concrete item type fails unless it goes through here.\n\n```go\nfunc ValidateChangesetID(value string) error\n```\nValidateChangesetID validates a changeset ID. Returns an error if the ID is empty.\n\n```go\nfunc ValidateInstanceName(value string) error\n```\nValidateInstanceName validates an instance name. Returns an error if the name is empty, too short (\\\u003c 3), or too long (\u003e 128).\n\n## Types\n\n```go\ntype ActionType string\n```\nActionType represents the action to be taken on an item.\n\n```go\nconst (\n\tActionCreate   ActionType = \"CREATE\"\n\tActionUpdate   ActionType = \"UPDATE\"\n\tActionDelete   ActionType = \"DELETE\"\n\tActionRecreate ActionType = \"RECREATE\"\n\tActionRetain   ActionType = \"RETAIN\"\n\tActionNoChange ActionType = \"NO CHANGE\"\n\t// ActionInspect indicates the item is being viewed in inspect mode.\n\t// The icon will be rendered based on the item's actual status rather than its action.\n\tActionInspect ActionType = \"\"\n)\n```\n\n```go\nfunc DetermineResourceAction(isNew, isRemoved, mustRecreate bool, changes *provider.Changes) ActionType\n```\nDetermineResourceAction determines the appropriate action based on item state and changes.\n\n```go\ntype BlueprintEventHandlers struct {\n\tOnResourceUpdate func(data *container.ResourceDeployUpdateMessage)\n\tOnChildUpdate    func(data *container.ChildDeployUpdateMessage)\n\tOnLinkUpdate     func(data *container.LinkDeployUpdateMessage)\n\tOnInstanceUpdate func(data *container.DeploymentUpdateMessage)\n\t// OnPreRollbackState is optional - only used by deploy model\n\tOnPreRollbackState func(data *container.PreRollbackStateMessage)\n}\n```\nBlueprintEventHandlers holds callback functions for handling blueprint instance events.\n\n```go\ntype ChangesetTypeMismatchParams struct {\n\t// IsDestroyChangeset indicates whether the changeset is a destroy changeset (true)\n\t// or a deploy changeset (false). This determines the error message direction.\n\tIsDestroyChangeset bool\n\tInstanceName       string\n\tChangesetID        string\n}\n```\nChangesetTypeMismatchParams holds the parameters for rendering a changeset type mismatch error.\n\n```go\ntype CodeOnlyResult struct {\n\t// Eligible is true when all changes are modifications to code-hosting resources only.\n\tEligible bool\n\t// Reasons lists why auto-approval was denied (empty when eligible).\n\tReasons []string\n}\n```\nCodeOnlyResult holds the outcome of a code-only eligibility check.\n\n```go\nfunc CheckCodeOnlyEligibility(\n\tbpChanges *changes.BlueprintChanges,\n\tinstanceState *state.InstanceState,\n) CodeOnlyResult\n```\nCheckCodeOnlyEligibility analyses a changeset to determine if it contains only modifications to code-hosting resources with no structural changes. A nil or empty changeset is considered eligible.\n\n```go\ntype DepthAdjustedItem struct {\n\tsplitpane.Item\n\tAdjustedDepth int\n\t// DisplayName overrides the name for this position in the tree. A link\n\t// shown inside the group that owns it names only its far end, since the\n\t// near end is the group you are already looking at.\n\tDisplayName string\n}\n```\nDepthAdjustedItem wraps a splitpane.Item to report a different depth, and optionally a different name, while preserving all other behavior.\n\n```go\nfunc (d *DepthAdjustedItem) GetDepth() int\n```\n\n```go\nfunc (d *DepthAdjustedItem) GetName() string\n```\n\n```go\nfunc (d *DepthAdjustedItem) Unwrap() splitpane.Item\n```\nUnwrap returns the underlying item for type assertions in detail renderers.\n\n```go\ntype ElementFailure struct {\n\tElementName    string\n\tElementPath    string // Full path like \"children.notifications::resources.notificationQueue\"\n\tElementType    string // \"resource\", \"child\", or \"link\"\n\tFailureReasons []string\n\t// AbstractGroup holds the abstract resource this element was expanded from,\n\t// used to group the element under its source type in overview listings.\n\tAbstractGroup *ResourceGroup\n}\n```\nElementFailure represents a failure for a specific element with its root cause reasons.\n\n```go\ntype ElementSummary struct {\n\tSuccessCount     int\n\tSuccessLabel     string // e.g., \"successful\" or \"destroyed\"\n\tFailureCount     int\n\tInterruptedCount int\n\tRetainedCount    int\n}\n```\nElementSummary holds counts of successful, failed, and interrupted elements for footer rendering.\n\n```go\ntype ErrorContext struct {\n\tOperationName     string // e.g., \"deployment\", \"change staging\"\n\tFailedHeader      string // e.g., \"Failed to start deployment\"\n\tErrorDuringHeader string // e.g., \"Error during deployment\"\n\tIssuesPreamble    string // e.g., \"The following issues must be resolved before deployment can proceed:\"\n}\n```\nErrorContext provides context-specific strings for error rendering.\n\n```go\nfunc DeployErrorContext() ErrorContext\n```\nDeployErrorContext returns the error context for deployment operations.\n\n```go\nfunc DestroyErrorContext() ErrorContext\n```\nDestroyErrorContext returns the error context for destroy operations.\n\n```go\nfunc StageErrorContext() ErrorContext\n```\nStageErrorContext returns the error context for staging operations.\n\n```go\ntype ExportsKeyAction int\n```\nExportsKeyAction indicates what action to take after handling an exports view key.\n\n```go\nconst (\n\t// ExportsKeyActionDelegate means the key should be delegated to the exports model.\n\tExportsKeyActionDelegate ExportsKeyAction = iota\n\t// ExportsKeyActionClose means the exports view should be closed.\n\tExportsKeyActionClose\n\t// ExportsKeyActionQuit means the application should quit.\n\tExportsKeyActionQuit\n)\n```\n\n```go\nfunc CheckExportsKeyMsg(msg tea.KeyMsg) ExportsKeyAction\n```\nCheckExportsKeyMsg checks if a key message should close/quit the exports view. Returns the action to take. If ExportsKeyActionDelegate is returned, the caller should delegate the key to the exports model.\n\n```go\ntype GroupableItem interface {\n\tGetResourceGroup() *ResourceGroup\n}\n```\nGroupableItem is an optional interface that splitpane.Item implementations can implement to indicate they belong to an abstract resource group. The SectionGrouper uses this to nest concrete resources under their abstract type parent in the navigation tree.\n\n```go\ntype HeadlessResourceGroup struct {\n\tGroup     ResourceGroup\n\tResources []HeadlessResourceInfo\n}\n```\nHeadlessResourceGroup holds resources that share the same abstract group.\n\n```go\ntype HeadlessResourceInfo struct {\n\t// Path is the full path key (e.g. \"childA/myFunc\" or \"myFunc\" for top-level).\n\tPath string\n\t// Name is the resource name (last path segment).\n\tName string\n\t// Metadata holds resource metadata with annotations for grouping.\n\tMetadata *state.ResourceMetadataState\n}\n```\nHeadlessResourceInfo carries the data needed to group and print a resource in headless (non-interactive) output.\n\n```go\nfunc SplitResourcesByPathLevel(\n\tresources []HeadlessResourceInfo,\n\tpathPrefix string,\n) (atLevel, nested []HeadlessResourceInfo)\n```\nSplitResourcesByPathLevel separates resources into those at the given path level (direct children of pathPrefix) and those nested deeper. For top-level resources, pass pathPrefix = \"\".\n\n```go\ntype InstanceLookup interface {\n\tGetBlueprintInstance(ctx context.Context, instanceIDOrName string) (*state.InstanceState, error)\n}\n```\nInstanceLookup is the interface for looking up blueprint instances.\n\n```go\ntype InstanceResolver interface {\n\tGetInstanceID() string\n\tGetInstanceName() string\n\tGetEngine() InstanceLookup\n}\n```\nInstanceResolver provides the fields needed to resolve instance identifiers.\n\n```go\ntype InterruptedElement struct {\n\tElementName string\n\tElementPath string // Full path like \"children.notifications::resources.notificationQueue\"\n\tElementType string // \"resource\", \"child\", or \"link\"\n\t// AbstractGroup holds the abstract resource this element was expanded from,\n\t// used to group the element under its source type in overview listings.\n\tAbstractGroup *ResourceGroup\n}\n```\nInterruptedElement represents an element that was interrupted during an operation.\n\n```go\ntype ItemType string\n```\nItemType represents the type of item in a stage or deploy list.\n\n```go\nconst (\n\tItemTypeResource ItemType = \"resource\"\n\tItemTypeChild    ItemType = \"child\"\n\tItemTypeLink     ItemType = \"link\"\n)\n```\n\n```go\ntype KeyHint struct {\n\tKey  string\n\tDesc string\n}\n```\nKeyHint represents a keyboard shortcut hint for footer navigation.\n\n```go\ntype LinkClassifiable interface {\n\tGetLinkResourceNames() (resourceA, resourceB string)\n}\n```\nLinkClassifiable is an optional interface that splitpane.Item implementations for links can implement to enable link classification into internal (within one abstract group) and cross-group categories.\n\n```go\ntype LinkDetailsBase struct {\n\tLinkName      string\n\tResourceAName string\n\tResourceBName string\n\tLinkID        string\n\tAction        string\n}\n```\nLinkDetailsBase holds the common fields for rendering link details across UIs.\n\n```go\ntype OverviewGroup[T any] struct {\n\t// Group is the abstract resource the entries were expanded from,\n\t// or nil for the bucket of entries that belong to no group.\n\tGroup *ResourceGroup\n\t// Entries holds the bucket's entries in their original order.\n\tEntries []T\n}\n```\nOverviewGroup buckets overview entries that share one abstract resource group.\n\n```go\nfunc GroupOverviewEntries[T any](entries []T, groupOf func(T) *ResourceGroup) []OverviewGroup[T]\n```\nGroupOverviewEntries buckets entries by abstract resource group for the overview screens, mirroring the nesting used in the navigation tree. Buckets are ordered by group label with the ungrouped bucket last, and entry order is preserved within each bucket.\n\nWhen no entry belongs to a group, a single ungrouped bucket is returned so callers can render a flat list without special-casing.\n\n```go\ntype PathBuilder struct {\n\tRootInstanceID        string\n\tInstanceIDToChildName map[string]string\n\tInstanceIDToParentID  map[string]string\n}\n```\nPathBuilder provides path building utilities for hierarchical item paths. It tracks the mapping between instance IDs and child names to construct full paths like \"parentChild/childName/resourceName\".\n\n```go\nfunc NewPathBuilder(rootInstanceID string) *PathBuilder\n```\nNewPathBuilder creates a new PathBuilder with the given root instance ID.\n\n```go\nfunc (p *PathBuilder) BuildInstancePath(parentInstanceID, childName string) string\n```\nBuildInstancePath builds a path from instance ID to the child name. For root instance children, returns just the name. For nested children, returns a path like \"parentChild/childName\".\n\n```go\nfunc (p *PathBuilder) BuildItemPath(instanceID, itemName string) string\n```\nBuildItemPath builds a path for an item (resource or link) based on its instance ID. For root instance items, returns just the item name. For nested items, returns a path like \"parentChild/childName/itemName\".\n\n```go\nfunc (p *PathBuilder) BuildParentChain(startInstanceID string) []string\n```\nBuildParentChain constructs the path parts from the root to the given instance ID.\n\n```go\nfunc (p *PathBuilder) TrackChildInstance(childInstanceID, childName, parentInstanceID string)\n```\nTrackChildInstance records the mapping from a child instance ID to its name and parent.\n\n```go\ntype ResourceGroup struct {\n\t// GroupName is the original abstract resource name (e.g. \"myFunction\").\n\tGroupName string\n\t// GroupType is the original abstract resource type (e.g. \"celerity/function\").\n\tGroupType string\n\t// Role is the part the abstract resource plays in the deployment, as the\n\t// transformer declared it. Empty means ResourceRoleComponent.\n\tRole string\n}\n```\nResourceGroup holds the abstract resource grouping information for a concrete resource that was produced by a transformer plugin.\n\n```go\nfunc ExtractGrouping(meta *state.ResourceMetadataState) *ResourceGroup\n```\nExtractGrouping reads standard Bluelink transform annotations from resource metadata to determine if a concrete resource was expanded from an abstract type. Returns nil if the resource was not produced by a transformer or if the required annotations are missing.\n\n```go\nfunc ExtractGroupingFromResolved(resolved *provider.ResolvedResource) *ResourceGroup\n```\nExtractGroupingFromResolved reads the same transform annotations from the resolved resource in a change set rather than from persisted state. This is the only source available for resources that are being created, which have no current resource state to read annotations from. Returns nil if the annotations are absent.\n\n```go\nfunc (g *ResourceGroup) IsAmbient() bool\n```\nIsAmbient reports whether nearly everything in the deployment links out of this abstract resource, which decides where those links are shown.\n\n```go\ntype ResourceGroupItem struct {\n\tGroup ResourceGroup\n\t// Children holds the concrete resources expanded from the abstract resource.\n\tChildren []splitpane.Item\n\t// Links holds the links that belong under this group, including those between two of\n\t// its own resources, and those running out of one of them to a resource\n\t// elsewhere.\n\tLinks []splitpane.Item\n}\n```\nResourceGroupItem is a synthetic navigation tree item that groups concrete cloud resources under their abstract type parent.\n\n```go\nfunc (g *ResourceGroupItem) CanDrillDown() bool\n```\n\n```go\nfunc (g *ResourceGroupItem) GetAction() string\n```\nGetAction reports the most significant action among everything the group holds, links included, for the same reason as GetIcon.\n\n```go\nfunc (g *ResourceGroupItem) GetChildren() []splitpane.Item\n```\n\n```go\nfunc (g *ResourceGroupItem) GetCollapsedSummary() string\n```\nGetCollapsedSummary reports what the group holds while it is collapsed, so that resources and links folded into a group are still discoverable without expanding every group in the tree. The R and L markers match the type indicators the tree already uses for nested items, and it is kept terse because it shares the line with the group name.\n\n```go\nfunc (g *ResourceGroupItem) GetDepth() int\n```\n\n```go\nfunc (g *ResourceGroupItem) GetID() string\n```\n\n```go\nfunc (g *ResourceGroupItem) GetIcon(selected bool) string\n```\nGetIcon reports the most severe status among everything the group holds. Links count as a link that failed on the way out of this abstract resource is a failure of it, and reporting only the resources would show the group as healthy while it is not.\n\n```go\nfunc (g *ResourceGroupItem) GetItemType() string\n```\n\n```go\nfunc (g *ResourceGroupItem) GetName() string\n```\n\n```go\nfunc (g *ResourceGroupItem) GetParentID() string\n```\n\n```go\nfunc (g *ResourceGroupItem) IsExpandable() bool\n```\n\n```go\ntype ResourceMetadata struct {\n\tResourceID   string\n\tDisplayName  string\n\tName         string\n\tResourceType string\n}\n```\nResourceMetadata holds basic resource information for rendering.\n\n```go\ntype RetainedElement struct {\n\tElementName string\n\tElementPath string // Full path like \"children.notifications::resources.ordersTable\"\n\tElementType string // The resource type, e.g. \"aws/dynamodb/table\"\n}\n```\nRetainedElement represents a resource whose state was removed but whose underlying infrastructure was preserved due to a \"retain\" removal policy.\n\n```go\ntype SectionGrouper struct {\n\tMaxExpandDepth int\n}\n```\nSectionGrouper provides a generic implementation for grouping items into Resources, Child Blueprints, and Links sections. It works with any type implementing splitpane.Item. When items implement GroupableItem, resources are grouped under abstract type headers and each link is nested under the group it belongs to, leaving only links between two ungrouped resources in a section of their own.\n\n```go\nfunc (g *SectionGrouper) GroupItems(items []splitpane.Item, isExpanded func(id string) bool) []splitpane.Section\n```\nGroupItems organizes items into sections using the splitpane.Item interface.\n\n```go\ntype SkippableChild interface {\n\tGetAction() ActionType\n\tGetChildStatus() core.InstanceStatus\n\tSetSkipped(skipped bool)\n}\n```\nSkippableChild is an interface for child items that can be marked as skipped.\n\n```go\ntype SkippableLink interface {\n\tGetAction() ActionType\n\tGetLinkStatus() core.LinkStatus\n\tSetSkipped(skipped bool)\n}\n```\nSkippableLink is an interface for link items that can be marked as skipped.\n\n```go\ntype SkippableResource interface {\n\tGetAction() ActionType\n\tGetResourceStatus() core.ResourceStatus\n\tSetSkipped(skipped bool)\n}\n```\nSkippableResource is an interface for resource items that can be marked as skipped.\n\n```go\ntype SplitPaneModel interface {\n\tIsInDrillDown() bool\n\tNavigationPath() []string\n}\n```\nSplitPaneModel is the interface for split pane model methods needed by footer rendering.\n\n```go\ntype StreamingFooterParams struct {\n\tSpinnerView      string\n\tActionVerb       string // e.g., \"Deploying\" or \"Destroying\"\n\tInstanceName     string\n\tChangesetID      string\n\tHasInstanceState bool\n\tStateHintKey     string // e.g., \"e\" for exports or \"s\" for pre-destroy state\n\tStateHintLabel   string // e.g., \"exports\" or \"pre-destroy state\"\n}\n```\nStreamingFooterParams holds parameters for rendering a streaming operation footer.\n\n```go\ntype SuccessfulElement struct {\n\tElementName string\n\tElementPath string // Full path like \"children.notifications::resources.notificationQueue\"\n\tElementType string // \"resource\", \"child\", or \"link\"\n\tAction      string // \"created\", \"updated\", \"destroyed\", etc.\n\t// AbstractGroup holds the abstract resource this element was expanded from,\n\t// used to group the element under its source type in overview listings.\n\tAbstractGroup *ResourceGroup\n}\n```\nSuccessfulElement represents an element that completed successfully.\n\n```go\ntype ViewportKeyResult struct {\n\tShouldClose bool\n\tShouldQuit  bool\n\tViewport    viewport.Model\n\tCmd         tea.Cmd\n}\n```\nViewportKeyResult contains the result of handling a viewport key event.\n\n```go\nfunc HandleViewportKeyMsg(msg tea.KeyMsg, vp viewport.Model, toggleKeys ...string) ViewportKeyResult\n```\nHandleViewportKeyMsg handles key messages for viewport overlay views. toggleKeys are the keys that close the overlay (e.g., \"o\", \"O\" for overview). Always handles \"esc\" for closing and \"q\"/\"ctrl+c\" for quitting.\n\n","path":"github.com/newstack-cloud/deploy-cli-sdk/tui/shared","name":"shared","synopsis":"Package shared provides common types and utilities for deployment TUI components.","isRedistributable":true}
