workdir

package
v0.61.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package workdir resolves the td database root directory, supporting git worktree redirection via .td-root files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadAssociations added in v0.36.0

func LoadAssociations() (map[string]string, error)

LoadAssociations reads the directory associations from ~/.config/td/associations.json. Returns an empty map if the file does not exist.

func LookupAssociation added in v0.36.0

func LookupAssociation(dir string) (string, bool)

LookupAssociation checks if dir has a directory association configured. Returns the target path and true if found, empty string and false otherwise.

func ResolveBaseDir

func ResolveBaseDir(baseDir string) string

ResolveBaseDir resolves td's project root with conservative heuristics:

  1. Honor .td-root in the current directory.
  2. Use current directory if it already has a .todos directory.
  3. If inside git, check git root for .td-root or .todos.

If no td markers are found, it returns the original baseDir unchanged.

func SaveAssociations added in v0.36.0

func SaveAssociations(assoc map[string]string) error

SaveAssociations writes the directory associations to ~/.config/td/associations.json using atomic write.

Types

type WorktreeInfo added in v0.51.0

type WorktreeInfo struct {
	RepoRoot     string
	WorktreeRoot string
	WorktreeID   string
}

WorktreeInfo describes the current checkout and the shared td repo root.

func CurrentWorktree added in v0.51.0

func CurrentWorktree() (WorktreeInfo, error)

CurrentWorktree returns worktree metadata for the current directory.

func WorktreeForPath added in v0.51.0

func WorktreeForPath(dir string) (WorktreeInfo, error)

WorktreeForPath returns worktree metadata for dir. RepoRoot is the resolved td base directory, while WorktreeRoot is the actual checkout root for dir.

Jump to

Keyboard shortcuts

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