Documentation
¶
Index ¶
- type BumpType
- type Changeset
- type ChangesetSummary
- type FilterType
- type Project
- type ProjectContext
- type ProjectType
- type PullRequest
- type Version
- func (v *Version) Bump(bumpType BumpType) *Version
- func (v *Version) Compare(other *Version) int
- func (v *Version) IsPrerelease() bool
- func (v *Version) String() string
- func (v *Version) StripPrerelease() *Version
- func (v *Version) Tag() string
- func (v *Version) WithPrerelease(prerelease string) *Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BumpType ¶
type BumpType string
BumpType represents the type of version bump
func ParseBumpType ¶
ParseBumpType parses a string into a BumpType
type Changeset ¶
type Changeset struct {
// ID is the unique identifier for this changeset (filename without extension)
ID string
// Projects maps project names to their bump types
Projects map[string]BumpType
// Message is the markdown content describing the change
Message string
// FilePath is the path to the changeset file
FilePath string
// PR contains optional pull request metadata (populated via GitHub API)
PR *PullRequest
}
Changeset represents a changeset file with its metadata
func NewChangeset ¶
NewChangeset creates a new Changeset instance
func (*Changeset) AffectsProject ¶
AffectsProject checks if this changeset affects a specific project
func (*Changeset) FormatPRSuffix ¶
FormatPRSuffix returns a formatted PR reference string for use in changelogs Returns empty string if no PR is associated Format: "(#123 by @author)" or "[#123](url) by @author" if includeLink is true
type ChangesetSummary ¶
type ChangesetSummary struct {
// ID is the changeset identifier (filename without extension)
ID string `json:"id"`
// BumpType is the semantic version bump type for this project
BumpType BumpType `json:"bumpType"`
// Message is the changeset description
Message string `json:"message"`
}
ChangesetSummary is a simplified changeset representation for context
type FilterType ¶
type FilterType string
FilterType represents a filter for selecting projects
const ( // FilterAll selects all projects FilterAll FilterType = "all" // FilterOpenChangesets selects projects with changesets in .changeset/ FilterOpenChangesets FilterType = "open-changesets" // FilterOutdatedVersions selects projects where version.txt > latest git tag FilterOutdatedVersions FilterType = "outdated-versions" // FilterHasVersion selects projects with a version.txt file FilterHasVersion FilterType = "has-version" // FilterNoVersion selects projects without a version.txt file FilterNoVersion FilterType = "no-version" // FilterUnchanged selects projects with no changesets FilterUnchanged FilterType = "unchanged" )
func ParseFilterType ¶
func ParseFilterType(s string) (FilterType, error)
ParseFilterType parses a string into a FilterType
func (FilterType) IsValid ¶
func (f FilterType) IsValid() bool
IsValid checks if the filter type is valid
func (FilterType) MatchesContext ¶
func (f FilterType) MatchesContext(ctx *ProjectContext) bool
MatchesContext checks if a ProjectContext matches this filter
func (FilterType) String ¶
func (f FilterType) String() string
String returns the string representation of FilterType
type Project ¶
type Project struct {
// Name is the project identifier (unique within the workspace)
Name string
// RootPath is the absolute path to the project root
RootPath string
// ModulePath is the full module path from go.mod (Go projects only)
ModulePath string
// ManifestPath is the path to the manifest (go.mod).
ManifestPath string
// Type indicates the project type.
Type ProjectType
}
Project represents a project/module in the workspace.
func NewProject ¶
func NewProject(name, rootPath, modulePath, manifestPath string, projectType ProjectType) *Project
NewProject creates a new Project instance
type ProjectContext ¶
type ProjectContext struct {
// Project is the project name
Project string `json:"project"`
// ProjectPath is the absolute path to the project root
ProjectPath string `json:"projectPath"`
// ModulePath is the full module path from go.mod
ModulePath string `json:"modulePath"`
// Changesets contains summaries of all changesets affecting this project
Changesets []ChangesetSummary `json:"changesets"`
// CurrentVersion is the parsed project version (defaults to "0.0.0")
CurrentVersion string `json:"currentVersion"`
// HasVersionFile indicates whether `version.txt` exists for this project.
HasVersionFile bool `json:"hasVersionFile"`
// LatestTag is the latest git tag for this project (or "0.0.0" if none)
LatestTag string `json:"latestTag"`
// HasChangesets indicates if there are any changesets for this project
HasChangesets bool `json:"hasChangesets"`
// IsOutdated indicates if CurrentVersion > LatestTag
IsOutdated bool `json:"isOutdated"`
// ChangelogPreview contains the markdown that will be added to CHANGELOG.md
// Empty string if no changesets
ChangelogPreview string `json:"changelogPreview"`
}
ProjectContext represents the context passed to commands via STDIN when executed through 'changeset each'
type ProjectType ¶
type ProjectType string
ProjectType represents the kind of project.
Today go-changeset supports Go workspaces only.
const (
ProjectTypeGo ProjectType = "go"
)
type PullRequest ¶
type PullRequest struct {
// Number is the PR number (e.g., 123)
Number int
// Title is the PR title
Title string
// URL is the full URL to the PR (e.g., https://github.com/owner/repo/pull/123)
URL string
// Author is the GitHub username of the PR author
Author string
// Labels are the labels assigned to the PR
Labels []string
}
PullRequest represents GitHub pull request metadata
type Version ¶
Version represents a semantic version
func ParseVersion ¶
ParseVersion parses a version string (e.g., "1.2.3", "v1.2.3", "1.2.3-rc0")
func (*Version) Compare ¶
Compare compares two versions Returns -1 if v < other, 0 if v == other, 1 if v > other Prerelease versions are ordered before release versions (e.g., 1.2.3-rc0 < 1.2.3)
func (*Version) IsPrerelease ¶
IsPrerelease returns true if this version has a prerelease suffix
func (*Version) StripPrerelease ¶
StripPrerelease returns a new version without the prerelease suffix
func (*Version) WithPrerelease ¶
WithPrerelease returns a new version with the specified prerelease suffix