appctx

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindGitRoot

func FindGitRoot(ctx context.Context, rt *toolkit.Runtime, start string) string

findGitRoot attempts to use the git CLI to determine the repository top-level directory starting from 'start'. If that fails (git not available, not a git worktree, or command error), it falls back to the original upward filesystem search for a .git entry.

Types

type AppPaths

type AppPaths struct {
	Appname string

	// Root is the path to the root of the context.
	Root string

	// configRoot is the base directory for user configuration files.
	ConfigRoot string

	// stateRoot holds transient state files for the context.
	StateRoot string

	// dataRoot is for programmatically managed data shipped with the program.
	DataRoot string

	// cacheRoot is for cache artifacts.
	CacheRoot string

	// localConfigRoot is the repo-local override location
	LocalConfigRoot string
}

AppPaths holds paths and configuration roots for a repository-backed app context. Root is the repository root. Other roots default to platform user-scoped locations when not provided.

func NewAppPaths

func NewAppPaths(rt *toolkit.Runtime, root, appname string) (*AppPaths, error)

NewAppPaths constructs app paths and fills missing roots using platform defaults derived from the provided context.

Behavior:

  • If an option sets a value it is used as-is.
  • If Root is not set it is inferred from Runtime.Getwd().
  • ConfigRoot, DataRoot, StateRoot, and CacheRoot use the corresponding user-scoped platform paths and are joined with DefaultAppName.

func NewGitAppPaths

func NewGitAppPaths(ctx context.Context, rt *toolkit.Runtime, appname string) (*AppPaths, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL