Documentation
¶
Index ¶
- func AuditLogPath() string
- func AutoSaveTrackerConfig(parsed *tracker.ParsedURL, configDir string) error
- func InstanceFromFlags(cmd *cobra.Command) *tracker.Instance
- func InstanceFromURL(parsed *tracker.ParsedURL) (*tracker.Instance, bool)
- func LoadAllInstances(dir string) ([]tracker.Instance, error)
- func LoadNotionIndexInstances(dir string) ([]index.NotionInstance, error)
- func PrintConnectedTrackers(w io.Writer, loader func() ([]tracker.Instance, error))
- func PrintExamples(w io.Writer)
- func PrintJSON(w io.Writer, v any) error
- func ResolveProvider(cmd *cobra.Command, kind string, deps Deps) (tracker.Provider, func(), error)
- func SetupHelp(rootCmd *cobra.Command, loader func() ([]tracker.Instance, error))
- func SplitIDs(ids string) []string
- func WarnSkippedTrackers(w io.Writer, dir string, loaded []tracker.Instance) bool
- type AutoResult
- type Deps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuditLogPath ¶
func AuditLogPath() string
AuditLogPath returns the path to the audit log file (~/.human/audit.log), creating the directory if needed.
func AutoSaveTrackerConfig ¶ added in v0.13.0
AutoSaveTrackerConfig ensures the parsed tracker URL is represented in .humanconfig.yaml. If the config file doesn't exist, it creates one. If it exists, it appends the tracker entry if not already present.
func InstanceFromFlags ¶
InstanceFromFlags builds a tracker instance from root persistent flags, returning nil when insufficient flags are provided.
func InstanceFromURL ¶ added in v0.13.0
InstanceFromURL attempts to build a tracker Instance from a parsed URL using environment variable credentials. Returns (instance, true) if credentials are available and the instance was built. Returns (zero, false) if credentials are missing.
func LoadAllInstances ¶
LoadAllInstances collects tracker instances from all provider configs.
func LoadNotionIndexInstances ¶ added in v0.13.0
func LoadNotionIndexInstances(dir string) ([]index.NotionInstance, error)
LoadNotionIndexInstances loads Notion instances and converts them to index.NotionInstance for use by the indexer.
func PrintConnectedTrackers ¶
PrintConnectedTrackers appends a "Connected trackers:" section to the help output. Errors are silently ignored so that help always works.
func PrintExamples ¶
PrintExamples prints the quick command and provider examples.
func ResolveProvider ¶
ResolveProvider loads instances, applies CLI flag overrides, and resolves the provider for the given kind using the tracker name from persistent flags.
func SetupHelp ¶
SetupHelp overrides the root command's help function to append examples and connected trackers when showing root-level help.
func WarnSkippedTrackers ¶ added in v0.13.0
WarnSkippedTrackers checks which trackers are configured in .humanconfig but did not produce loaded instances (typically due to missing credentials) and writes diagnostic messages to w. Returns true if any trackers were skipped.
Types ¶
type AutoResult ¶ added in v0.13.0
type AutoResult struct {
Provider tracker.Provider
Kind string
Key string // resolved key (= input if key, = extracted key if URL)
Cleanup func()
}
AutoResult holds the resolved provider and extracted key from ResolveAutoProvider.
func ResolveAutoProvider ¶
func ResolveAutoProvider(ctx context.Context, cmd *cobra.Command, input string, allowFindFallback bool, deps Deps) (*AutoResult, error)
ResolveAutoProvider loads all instances, applies flag overrides, and resolves the provider without requiring a fixed kind. It uses tracker.Resolve for auto-detection and falls back to FindTracker + ResolveByKind for ambiguous get commands.
When input is a URL, it parses the URL to extract kind, base URL, and key, then tries to match an existing config instance or build one from env vars.
type Deps ¶
type Deps struct {
LoadInstances func(dir string) ([]tracker.Instance, error)
InstanceFromFlags func(cmd *cobra.Command) *tracker.Instance
AuditLogPath func() string
}
Deps holds injectable dependencies for command builders that need tracker instance loading and resolution.
func DefaultDeps ¶
func DefaultDeps() Deps
DefaultDeps returns a Deps using the real implementations.