Documentation
¶
Index ¶
- Constants
- func AppendFooter(msg string) string
- func FormatChangeReason(ctype, scope, subject, body string) string
- func Init(uri string, opts ...Option) (core.Repository, error)
- func IsDevRun() bool
- func New(uri string, opts ...Option) (*core.Service, error)
- func ResolveVaultPath(userPath string, forceTemp bool) string
- func Sync(uri string, opts ...Option) error
- type Option
Constants ¶
const ( CommitTypeFeat = "feat" CommitTypeFix = "fix" CommitTypeDocs = "docs" CommitTypeStyle = "style" CommitTypeRefactor = "refactor" CommitTypePerf = "perf" CommitTypeTest = "test" CommitTypeChore = "chore" )
CommitType constants for semantic commits
Variables ¶
This section is empty.
Functions ¶
func AppendFooter ¶
AppendFooter appends the Loam footer to an arbitrary message if not present. Used for free-form -m "msg" commits.
func FormatChangeReason ¶
FormatChangeReason builds a Conventional Commit message (used as Change Reason). logic:
<type>(<scope>): <subject> <body> Powered-by: Loam
func Init ¶
func Init(uri string, opts ...Option) (core.Repository, error)
Init initializes a new Loam vault based on the provided configuration. The 'uri' argument is adapter-specific (e.g., file path for 'fs', connection string for others).
It returns the configured core.Repository.
func IsDevRun ¶
func IsDevRun() bool
IsDevRun checks if the current process is running via `go run` or `go test`. It relies on the fact that these commands build binaries in temporary directories.
func New ¶
svc, err := loam.New("./path/to/vault", loam.WithVersioning(false)) The URI argument is adapter-specific (e.g., file path for 'fs', connection string for others).
func ResolveVaultPath ¶
ResolveVaultPath determines the actual path for the vault based on safety rules. If isDev is true (or forced), it re-roots the path into a temporary directory to avoid polluting the user's workspace/host repo.
Types ¶
type Option ¶
type Option func(*options)
Option defines a functional option for configuring Loam.
func WithAdapter ¶
WithAdapter allows specifying the storage adapter to use by name (e.g. "fs"). Defaults to "fs".
func WithAutoInit ¶
WithAutoInit enables automatic initialization of the vault (git init).
func WithForceTemp ¶
WithForceTemp forces the use of a temporary directory (useful for testing).
func WithLogger ¶
WithLogger sets the logger for the service.
func WithMustExist ¶
WithMustExist ensures the vault directory must already exist.
func WithRepository ¶
func WithRepository(repo core.Repository) Option
WithRepository allows injecting a custom storage adapter (e.g. mock, s3). If provided, the default filesystem adapter will be skipped.
func WithVersioning ¶
WithVersioning enables or disables version control (e.g. Git). By default, versioning is enabled (gitless = false). Passing false will enable gitless mode (gitless = true).