gitmeta

package
v0.0.0-...-8ea0922 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package gitmeta is the single helper through which core learns about the git repository containing the task files (ADR 0004). It provides repo identity (the shared git common directory) and worktree discovery, always degrading to inert behavior when git is absent or the directory is not a repository.

Index

Constants

This section is empty.

Variables

View Source
var (
	Debugf = func(_ string, _ ...any) {}
	Warnf  = func(_ string, _ ...any) {}
)

Debugf and Warnf are logging hooks, no-ops by default. The CLI wires them to its --debug and --verbose output at startup; keeping them as injection points lets this package stay free of flag and viper state.

Functions

This section is empty.

Types

type Identity

type Identity struct {
	CommonDir    string // absolute path to the shared .git directory
	WorktreeRoot string // top level of the worktree containing the directory
	IsLinked     bool   // true when the directory is inside a linked worktree
}

Identity describes the repository containing a directory, if any. Two paths with the same CommonDir belong to the same repository.

func Resolve

func Resolve(dir string) (*Identity, error)

Resolve returns the repo identity for dir, backed by a single git invocation. It returns (nil, nil) when git is missing from PATH, dir is not inside a git repository, or git fails for any reason — callers treat a nil identity as "worktree features inert".

type Worktree

type Worktree struct {
	Root     string // worktree top-level path
	Branch   string // e.g. "dnc/042/parser" ("" when detached)
	IsLocal  bool   // true for the worktree the command runs in
	TasksDir string // absolute tasks directory, from the worktree's own .taskmd.yaml
}

Worktree is one checkout of the repository that participates in taskmd coordination (it exists on disk and has a .taskmd.yaml at its root).

func ListWorktrees

func ListWorktrees(id *Identity) ([]Worktree, error)

ListWorktrees enumerates the repository's worktrees via `git worktree list --porcelain`, filtered to checkouts taskmd can use: prunable worktrees, roots missing on disk, and worktrees without a .taskmd.yaml are skipped. A nil identity yields no worktrees.

Jump to

Keyboard shortcuts

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