Documentation
¶
Index ¶
- func FormatOutput(repoResults []RepoSettingResult, labelResults []LabelResult, ...) string
- func Run(cfg *config.Config, dir string, mode ApplyMode, client *api.RESTClient) error
- type ApplyMode
- type LabelCategory
- type LabelResult
- type RepoSettingCategory
- type RepoSettingResult
- type SwatchCategory
- type SwatchResult
- type TokenContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatOutput ¶
func FormatOutput(repoResults []RepoSettingResult, labelResults []LabelResult, swatchResults []SwatchResult) string
FormatOutput produces the alter command output from repo settings results, label results, and swatch results (including licence).
Types ¶
type ApplyMode ¶
type ApplyMode int
ApplyMode controls whether changes are written to disk.
func (ApplyMode) ShouldWrite ¶
ShouldWrite reports whether the mode permits writing to disk.
type LabelCategory ¶
type LabelCategory string
LabelCategory classifies the outcome of processing a single label entry.
const ( WouldCreate LabelCategory = "would create" WouldUpdate LabelCategory = "would update" LabelNoChange LabelCategory = "no change" LabelSkipScope LabelCategory = "would skip (insufficient scope)" LabelSkipRole LabelCategory = "would skip (insufficient role)" )
type LabelResult ¶
type LabelResult struct {
Name string
Category LabelCategory
Value string
Annotation string
}
LabelResult records the label name, category, and display value for one label entry. Annotation carries optional context for skip categories, embedded in the label (e.g. "token missing required scope").
func ProcessLabels ¶
func ProcessLabels(cfg *config.Config, mode ApplyMode, client *api.RESTClient, owner, name string, hasRepo bool) ([]LabelResult, error)
ProcessLabels compares declared labels against live labels and optionally applies them. Returns results for output formatting.
type RepoSettingCategory ¶
type RepoSettingCategory string
RepoSettingCategory classifies the outcome of processing a single repository setting.
const ( WouldSet RepoSettingCategory = "would set" RepoNoChange RepoSettingCategory = "no change" WouldSkipScope RepoSettingCategory = "would skip (insufficient scope)" WouldSkipRole RepoSettingCategory = "would skip (insufficient role)" )
type RepoSettingResult ¶
type RepoSettingResult struct {
Field string
Category RepoSettingCategory
Value string
Annotation string
}
RepoSettingResult records the field name, category, and display value for one repository setting. Annotation carries optional context for skip categories, embedded in the label (e.g. "token missing required scope").
func ProcessRepoSettings ¶
func ProcessRepoSettings(cfg *config.Config, mode ApplyMode, client *api.RESTClient, owner, name string, hasRepo bool) ([]RepoSettingResult, error)
ProcessRepoSettings compares declared settings against live settings and optionally applies them. Returns results for output formatting.
type SwatchCategory ¶
type SwatchCategory string
SwatchCategory classifies the outcome of processing a single swatch entry.
const ( WouldCopy SwatchCategory = "would copy" WouldOverwrite SwatchCategory = "would overwrite" WouldDeploy SwatchCategory = "would deploy" WouldRemove SwatchCategory = "would remove" Removed SwatchCategory = "removed" NoChange SwatchCategory = "no change" SkippedFirstFit SwatchCategory = "skipped (first-fit, exists)" SkippedNever SwatchCategory = "skip (never)" )
type SwatchResult ¶
type SwatchResult struct {
Path string
Category SwatchCategory
Annotation string
}
SwatchResult records the path and categorised outcome for one swatch entry. Annotation carries optional context such as the trigger condition name, appended to the category label in formatted output.
func ProcessLicence ¶
func ProcessLicence(cfg *config.Config, dir string, mode ApplyMode, client *api.RESTClient) (*SwatchResult, error)
ProcessLicence evaluates and optionally writes the LICENSE file. Returns a SwatchResult (reusing the same type for consistent formatting) and an error.
func ProcessSwatches ¶
func ProcessSwatches(cfg *config.Config, dir string, mode ApplyMode, tokens *TokenContext) ([]SwatchResult, error)
ProcessSwatches evaluates each swatch entry in cfg and returns results. When mode is Apply or Recut, it writes files to disk.
type TokenContext ¶
type TokenContext struct {
GitHubUsername string // from GET /user
Owner string // from repo context; empty if no context
Name string // from repo context; empty if no context
Repository *model.RepositorySettings // from config; nil if absent
}
TokenContext holds resolved values for template substitution.
func (*TokenContext) AdvisoryURL ¶
func (tc *TokenContext) AdvisoryURL() string
AdvisoryURL returns the constructed advisory URL, or the raw token if no repo context.
func (*TokenContext) HasRepoContext ¶
func (tc *TokenContext) HasRepoContext() bool
HasRepoContext reports whether owner and name are set.
func (*TokenContext) HomepageURL ¶
func (tc *TokenContext) HomepageURL() string
HomepageURL returns the constructed homepage URL, or the raw token if no repo context.
func (*TokenContext) MergeStrategy ¶
func (tc *TokenContext) MergeStrategy() string
MergeStrategy returns the highest-preference enabled method (squash > rebase > merge), defaulting to --squash.
func (*TokenContext) Substitute ¶
func (tc *TokenContext) Substitute(content []byte, path string) []byte
Substitute replaces tokens in content based on the swatch path.
func (*TokenContext) SupportURL ¶
func (tc *TokenContext) SupportURL() string
SupportURL returns the constructed support URL, or the raw token if no repo context.