roster

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package roster manages the global registry of tracked repositories. The roster is stored at ~/.knowing/roster.json and maps repo paths to database paths and repo URLs. It is the canonical source of cross-repo identity: the indexer reads it to compute correct target hashes for cross-repo edges.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(absPath, repoURL string) (string, error)

Add registers a repo if not already present. Returns the DB path.

func DBForCurrentDir

func DBForCurrentDir() string

DBForCurrentDir finds the DB for the current directory by walking up to find a registered repo root.

func DBForPath

func DBForPath(absPath string) string

DBForPath looks up the DB path for a repo by its absolute path.

func DBPath

func DBPath(repoURL string) string

DBPath returns the per-repo database path for a repo URL.

func Dir

func Dir() string

Dir returns the ~/.knowing directory, creating it if needed.

func ModuleMap

func ModuleMap() map[string]string

ModuleMap returns a map from Go module paths to repo URLs for all registered repos. This is the cross-repo identity map: it tells the indexer which repo URL to use when computing target hashes for cross-repo edges.

The module path is read from go.mod in each repo's path. Repos without a go.mod (non-Go repos) are included with their URL as the key.

func Path

func Path() string

Path returns the path to the roster file.

func Remove

func Remove(absPath string) error

Remove removes a repo from the roster by path.

func Save

func Save(r *Roster) error

Save writes the roster to disk.

Types

type Entry

type Entry struct {
	Path string `json:"path"` // absolute path to repo root
	URL  string `json:"url"`  // repo URL (for graph identity)
	DB   string `json:"db"`   // path to this repo's database file
}

Entry represents a tracked repository.

type Roster

type Roster struct {
	Repos []Entry `json:"repos"`
}

Roster is the list of tracked repositories.

func Load

func Load() (*Roster, error)

Load reads the roster from disk. Returns empty roster if file doesn't exist.

Jump to

Keyboard shortcuts

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