Documentation
¶
Index ¶
- Constants
- func BuildChangelog(commitHistory []*model.Commit, progressChan chan *model.ProgressUpdate, ...) ([]*model.Commit, []error)
- func BuildRevisionDocumentConfiguration(ctx *RevisionDocumentContext, revision string, ...) (*datamodel.DocumentConfiguration, error)
- func CanonicalizePath(path string) (string, error)
- func CheckLocalRepoAvailable(dir string) bool
- func ExtractHistoryFromFile(repoDirectory, filePath string, progressChan chan *model.ProgressUpdate, ...) ([]*model.Commit, []error)
- func ExtractPathAndFile(location string) (string, string)
- func GetTopLevel(dir string) (string, error)
- func NewRepoRelativeDocumentPathRewriter(repoRoot, basePath string) model.DocumentPathRewriter
- func PopulateHistory(commitHistory []*model.Commit, progressChan chan *model.ProgressUpdate, ...) ([]*model.Commit, []error)
- func ProcessGithubRepo(username, repo, filePath string, progressChan chan *model.ProgressUpdate, ...) ([]*model.Commit, []error)
- func ReadFileAtRevision(repoDir, revision, filePath string) ([]byte, error)
- func ResolveBaseOverride(base string) (string, *url.URL, error)
- type GitRevisionFS
- type HistoryOptions
- type RevisionDocumentContext
Constants ¶
const ( GIT = "git" LOG = "log" SHOW = "show" REVPARSE = "rev-parse" TOPLEVEL = "--show-toplevel" NOPAGER = "--no-pager" FOLLOW = "--follow" LOGFORMAT = "--pretty=%cD||%h||%s||%an||%ae" NUMBER = "-n" DIV = "--" )
const GithubToken = "GH_TOKEN"
Variables ¶
This section is empty.
Functions ¶
func BuildChangelog ¶ added in v0.1.0
func BuildChangelog(commitHistory []*model.Commit, progressChan chan *model.ProgressUpdate, errorChan chan model.ProgressError, opts HistoryOptions, breakingConfig *whatChangedModel.BreakingRulesConfig, ) ([]*model.Commit, []error)
BuildChangelog compares consecutive commits and populates each with parsed documents and change data. Set opts.KeepComparable to preserve revisions even when the legacy libopenapi diff is empty.
func BuildRevisionDocumentConfiguration ¶ added in v0.2.2
func BuildRevisionDocumentConfiguration(ctx *RevisionDocumentContext, revision string, baseDocConfig *datamodel.DocumentConfiguration, ) (*datamodel.DocumentConfiguration, error)
func CanonicalizePath ¶ added in v0.2.2
func CheckLocalRepoAvailable ¶
func ExtractHistoryFromFile ¶
func ExtractHistoryFromFile(repoDirectory, filePath string, progressChan chan *model.ProgressUpdate, errorChan chan model.ProgressError, opts HistoryOptions, ) ([]*model.Commit, []error)
func ExtractPathAndFile ¶
func GetTopLevel ¶
func NewRepoRelativeDocumentPathRewriter ¶ added in v0.2.2
func NewRepoRelativeDocumentPathRewriter(repoRoot, basePath string) model.DocumentPathRewriter
func PopulateHistory ¶ added in v0.1.0
func PopulateHistory(commitHistory []*model.Commit, progressChan chan *model.ProgressUpdate, errorChan chan model.ProgressError, opts HistoryOptions, breakingConfig *whatChangedModel.BreakingRulesConfig, ) ([]*model.Commit, []error)
PopulateHistory reads file data from git for each commit, then builds the changelog. Set opts.KeepComparable to preserve revisions even when the legacy libopenapi diff is empty (used by the doctor/changerator-based commands).
func ProcessGithubRepo ¶
func ProcessGithubRepo(username, repo, filePath string, progressChan chan *model.ProgressUpdate, errorChan chan model.ProgressError, opts HistoryOptions, breakingConfig *whatChangedModel.BreakingRulesConfig, ) ([]*model.Commit, []error)
ProcessGithubRepo fetches file history from GitHub and builds the commit changelog. Set opts.KeepComparable to preserve revisions even when the legacy libopenapi diff is empty.
func ReadFileAtRevision ¶ added in v0.2.2
ReadFileAtRevision reads a file from a git repository at the given revision.
Types ¶
type GitRevisionFS ¶ added in v0.2.2
type GitRevisionFS struct {
// contains filtered or unexported fields
}
func NewGitRevisionFS ¶ added in v0.2.2
func NewGitRevisionFS(repoRoot, baseDir, revision string, docConfig *datamodel.DocumentConfiguration) (*GitRevisionFS, error)
func (*GitRevisionFS) GetFiles ¶ added in v0.2.2
func (g *GitRevisionFS) GetFiles() map[string]index.RolodexFile
func (*GitRevisionFS) Open ¶ added in v0.2.2
func (g *GitRevisionFS) Open(name string) (fs.File, error)
func (*GitRevisionFS) SetLogger ¶ added in v0.2.2
func (g *GitRevisionFS) SetLogger(logger *slog.Logger)
func (*GitRevisionFS) SetRolodex ¶ added in v0.2.2
func (g *GitRevisionFS) SetRolodex(rolodex *index.Rolodex)
type HistoryOptions ¶ added in v0.1.0
type HistoryOptions struct {
Base string
Remote bool
ExtRefs bool
KeepComparable bool // true = preserve Documents on commits even when legacy diff is empty
Limit int
LimitTime int
ForceCutoff bool // GitHub only
GlobalRevisions bool // ExtractHistoryFromFile only
BaseCommit string
}
HistoryOptions controls how git history is fetched, traversed, and compared. BreakingConfig is intentionally kept as a separate parameter in function signatures — it controls comparison semantics, not history traversal.
type RevisionDocumentContext ¶ added in v0.2.2
type RevisionDocumentContext struct {
RepoRoot string
RepoFilePath string
SpecFilePath string
BasePath string
BaseURL *url.URL
DocumentRewriter model.DocumentPathRewriter
}
func BuildRevisionDocumentContext ¶ added in v0.2.2
func BuildRevisionDocumentContext(repoDir, filePath, basePathOverride string, baseURLOverride *url.URL) (*RevisionDocumentContext, error)