Documentation
¶
Index ¶
- Constants
- Variables
- func BuildVersion() string
- func Execute() error
- func ExecuteContext(ctx context.Context) error
- func ExecuteRootCmd() error
- func FindFeatureCrossBranch(ctx context.Context, cmdCtx *CommandContext, identifier string, ...) (*fogit.Feature, error)
- func FindFeatureCrossBranchWithResult(ctx context.Context, cmdCtx *CommandContext, identifier string, ...) (*features.CrossBranchFindResult, error)
- func FindFeatureForCommand(ctx context.Context, cmdCtx *CommandContext, identifier string, ...) (*fogit.Feature, error)
- func FindFeatureWithSuggestions(ctx context.Context, repo fogit.Repository, identifier string, ...) (*fogit.Feature, error)
- func GetConfig() *fogit.Config
- func ListFeaturesCrossBranch(ctx context.Context, cmdCtx *CommandContext, filter *fogit.Filter) ([]*fogit.Feature, error)
- func RegisterFilterFlags(cmd *cobra.Command, flags *CommonFilterFlags)
- func RegisterFormatFlag(cmd *cobra.Command, format *string)
- func RegisterOrganizationFlags(cmd *cobra.Command, flags *OrganizationFlags)
- func RegisterOutputFlags(cmd *cobra.Command, flags *OutputFlags)
- func ResetFlags()
- func WithExportTimeout(parent context.Context) (context.Context, context.CancelFunc)
- func WithImportTimeout(parent context.Context) (context.Context, context.CancelFunc)
- func WithListTimeout(parent context.Context) (context.Context, context.CancelFunc)
- func WithSearchTimeout(parent context.Context) (context.Context, context.CancelFunc)
- func WithTimeout(parent context.Context, timeout time.Duration) (context.Context, context.CancelFunc)
- func WithValidateTimeout(parent context.Context) (context.Context, context.CancelFunc)
- type CommandContext
- type CommonFilterFlags
- type GitHubUpdater
- type OrganizationFlags
- type OutputFlags
- type RelationshipCategoryExport
- type RelationshipExport
- type RelationshipTypeExport
- type Release
- type Updater
Constants ¶
const ( // DefaultListTimeout is the timeout for listing features. // This operation reads all feature files and could be slow with many features. DefaultListTimeout = 30 * time.Second // DefaultSearchTimeout is the timeout for search operations. // This includes fuzzy matching across all features. DefaultSearchTimeout = 30 * time.Second // DefaultExportTimeout is the timeout for export operations. // This reads all features and converts them to the export format. DefaultExportTimeout = 60 * time.Second // DefaultImportTimeout is the timeout for import operations. // This reads external files and creates features. DefaultImportTimeout = 60 * time.Second // DefaultValidateTimeout is the timeout for validation operations. // This validates all features and their relationships. DefaultValidateTimeout = 60 * time.Second )
Default operation timeouts. These can be overridden via environment variables or config in the future.
Variables ¶
var ( // Version is the semantic version (e.g., "1.0.0") Version = "dev" // Commit is the git commit SHA Commit = "none" // Date is the build date Date = "unknown" )
Build information - injected via ldflags at build time
Functions ¶
func ExecuteContext ¶
ExecuteContext runs the root command with the provided context. This enables signal handling for graceful shutdown - when the context is canceled (e.g., via Ctrl+C), the cancellation propagates to all commands via cmd.Context().
func ExecuteRootCmd ¶ added in v1.0.2
func ExecuteRootCmd() error
ExecuteRootCmd executes the root command with the given arguments. This is for testing purposes - it ensures proper cleanup of directory state. Tests should use this instead of rootCmd.Execute() directly.
func FindFeatureCrossBranch ¶ added in v1.0.8
func FindFeatureCrossBranch(ctx context.Context, cmdCtx *CommandContext, identifier string, suggestCmd string) (*fogit.Feature, error)
FindFeatureCrossBranch finds a feature using cross-branch discovery in branch-per-feature mode. Falls back to current-branch-only search in trunk-based mode or if git is not available.
func FindFeatureCrossBranchWithResult ¶ added in v1.0.8
func FindFeatureCrossBranchWithResult(ctx context.Context, cmdCtx *CommandContext, identifier string, suggestCmd string) (*features.CrossBranchFindResult, error)
FindFeatureCrossBranchWithResult is like FindFeatureCrossBranch but returns the full result including branch information. Use this when you need to know which branch a feature is on.
func FindFeatureForCommand ¶ added in v1.4.1
func FindFeatureForCommand(ctx context.Context, cmdCtx *CommandContext, identifier string, suggestCmd string) (*fogit.Feature, error)
FindFeatureForCommand finds a feature using cross-branch discovery (in branch-per-feature mode) with suggestion support. This is the recommended function for all commands that look up features.
func FindFeatureWithSuggestions ¶
func FindFeatureWithSuggestions(ctx context.Context, repo fogit.Repository, identifier string, cfg *fogit.Config, suggestCmd string) (*fogit.Feature, error)
FindFeatureWithSuggestions finds a feature by ID/name and handles error display with suggestions. DEPRECATED: Use FindFeatureCrossBranch instead for cross-branch discovery support. This function only searches the current branch.
func ListFeaturesCrossBranch ¶ added in v1.0.8
func ListFeaturesCrossBranch(ctx context.Context, cmdCtx *CommandContext, filter *fogit.Filter) ([]*fogit.Feature, error)
ListFeaturesCrossBranch lists all features using cross-branch discovery in branch-per-feature mode. Falls back to current-branch-only listing in trunk-based mode or if git is not available.
func RegisterFilterFlags ¶
func RegisterFilterFlags(cmd *cobra.Command, flags *CommonFilterFlags)
RegisterFilterFlags adds common filter flags to a command. These flags are used by list, search, and other filter-based commands.
Usage:
var filterFlags CommonFilterFlags
func init() {
RegisterFilterFlags(myCmd, &filterFlags)
}
func RegisterFormatFlag ¶
RegisterFormatFlag adds only the format flag to a command. Use this when sort is not needed (e.g., search command).
func RegisterOrganizationFlags ¶
func RegisterOrganizationFlags(cmd *cobra.Command, flags *OrganizationFlags)
RegisterOrganizationFlags adds organization-related flags to a command. These flags are used by list, update, and feature commands.
func RegisterOutputFlags ¶
func RegisterOutputFlags(cmd *cobra.Command, flags *OutputFlags)
RegisterOutputFlags adds output formatting flags to a command. These flags are used by list, search, show, and other output commands.
func ResetFlags ¶ added in v1.0.2
func ResetFlags()
ResetFlags resets global flags to their default values. This is useful for testing where flags may persist between test runs.
func WithExportTimeout ¶
WithExportTimeout creates a context with the default export operation timeout.
func WithImportTimeout ¶
WithImportTimeout creates a context with the default import operation timeout.
func WithListTimeout ¶
WithListTimeout creates a context with the default list operation timeout.
func WithSearchTimeout ¶
WithSearchTimeout creates a context with the default search operation timeout.
func WithTimeout ¶
func WithTimeout(parent context.Context, timeout time.Duration) (context.Context, context.CancelFunc)
WithTimeout creates a child context with the specified timeout. It returns the context, a cancel function that should be deferred, and handles the case where the parent context is nil.
Usage:
ctx, cancel := WithTimeout(cmd.Context(), DefaultListTimeout) defer cancel()
func WithValidateTimeout ¶
WithValidateTimeout creates a context with the default validation operation timeout.
Types ¶
type CommandContext ¶
type CommandContext struct {
FogitDir string
Repo fogit.Repository
Config *fogit.Config
Git *features.GitIntegration // nil if not in git repo
}
CommandContext holds common dependencies for commands
func GetCommandContext ¶
func GetCommandContext() (*CommandContext, error)
GetCommandContext initializes all common dependencies for a command This reduces boilerplate in individual commands
func GetCommandContextWithoutConfig ¶
func GetCommandContextWithoutConfig() (*CommandContext, error)
GetCommandContextWithoutConfig initializes dependencies without loading config Useful for commands that don't need configuration
type CommonFilterFlags ¶
CommonFilterFlags holds values for common filter flags used across commands.
type GitHubUpdater ¶
type GitHubUpdater struct{}
GitHubUpdater is the real implementation using go-selfupdate
func (*GitHubUpdater) DetectLatest ¶
type OrganizationFlags ¶
OrganizationFlags holds values for organization-related flags.
type OutputFlags ¶
OutputFlags holds values for output formatting flags.
type RelationshipCategoryExport ¶
type RelationshipCategoryExport struct {
Description string `json:"description,omitempty" yaml:"description,omitempty"`
AllowCycles bool `json:"allow_cycles" yaml:"allow_cycles"`
CycleDetection string `json:"cycle_detection" yaml:"cycle_detection"`
IncludeInImpact bool `json:"include_in_impact" yaml:"include_in_impact"`
}
RelationshipCategoryExport represents a category in the export format
type RelationshipExport ¶
type RelationshipExport struct {
FogitVersion string `json:"fogit_version" yaml:"fogit_version"`
ExportedAt string `json:"exported_at" yaml:"exported_at"`
Repository string `json:"repository,omitempty" yaml:"repository,omitempty"`
RelationshipCategories map[string]RelationshipCategoryExport `json:"relationship_categories,omitempty" yaml:"relationship_categories,omitempty"`
RelationshipTypes map[string]RelationshipTypeExport `json:"relationship_types,omitempty" yaml:"relationship_types,omitempty"`
}
RelationshipExport represents the export schema for relationship definitions
type RelationshipTypeExport ¶
type RelationshipTypeExport struct {
Category string `json:"category" yaml:"category"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Inverse string `json:"inverse,omitempty" yaml:"inverse,omitempty"`
Bidirectional bool `json:"bidirectional,omitempty" yaml:"bidirectional,omitempty"`
Aliases []string `json:"aliases,omitempty" yaml:"aliases,omitempty"`
}
RelationshipTypeExport represents a type in the export format
type Release ¶
Release holds version info (abstraction over selfupdate.Release)
func (*Release) LessOrEqual ¶
LessOrEqual checks if this release version is less than or equal to the given version
Source Files
¶
- commit.go
- common.go
- config.go
- create.go
- delete.go
- diff.go
- export.go
- feature.go
- files.go
- filter.go
- flags.go
- hooks.go
- impacts.go
- import.go
- init.go
- link.go
- list.go
- log.go
- merge.go
- push.go
- relationship_categories.go
- relationship_category_define.go
- relationship_category_delete.go
- relationship_category_update.go
- relationship_define.go
- relationship_export.go
- relationship_import.go
- relationship_type_delete.go
- relationship_type_update.go
- relationship_types.go
- relationships.go
- root.go
- search.go
- self_update.go
- show.go
- stats.go
- status.go
- switch.go
- tag.go
- timeout.go
- tree.go
- unlink.go
- update.go
- validate.go
- versions.go