depcheck

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package depcheck periodically checks registered anvils for outdated dependencies, starting with Go and designed to support additional ecosystems (.NET, npm) in the future. When updates are found it creates beads so a Smith agent can apply them. Patch/minor updates produce auto-dispatch beads; major version bumps produce "needs attention" beads.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BeadTitle

func BeadTitle(ecosystem, packageName, oldVersion, newVersion string) string

BeadTitle returns the standardized bead title for a dependency update. Format: "Deps(<ecosystem>): update <package> <old> → <new>"

func DedupCheck

func DedupCheck(ctx context.Context, db *state.DB, anvilPath, anvilName, packageName, ecosystem string) bool

DedupCheck returns true if a bead for the given package already exists (open, in-progress, or recently closed within 7 days), or if an open PR references a bead that mentions the package. This prevents duplicate dependency update beads from accumulating.

For checking many packages in a single cycle, prefer building a DedupCache with BuildDedupCache and calling DedupCheckWithCache to avoid per-package external-command fanout.

func DedupCheckWithCache

func DedupCheckWithCache(cache *DedupCache, packageName string) bool

DedupCheckWithCache checks whether a package already has an existing bead using pre-fetched data from BuildDedupCache.

Types

type CheckResult

type CheckResult struct {
	Anvil     string
	Path      string
	Ecosystem string         // e.g. "Go", ".NET", "npm"
	Patch     []ModuleUpdate // patch updates (auto-bead)
	Minor     []ModuleUpdate // minor updates (auto-bead)
	Major     []ModuleUpdate // major version bumps (needs attention)
	Error     error
	Checked   time.Time
}

CheckResult holds the depcheck results for a single anvil.

type DedupCache

type DedupCache struct {
	// contains filtered or unexported fields
}

DedupCache holds pre-fetched bead and PR data for a single anvil. Build once per depcheck cycle with BuildDedupCache, then query cheaply with DedupCheckWithCache instead of spawning external commands per module.

func BuildDedupCache

func BuildDedupCache(ctx context.Context, db *state.DB, anvilPath, anvilName string) *DedupCache

BuildDedupCache fetches bead state once for an anvil, avoiding per-module external-command fanout in DedupCheckWithCache.

type ModuleUpdate

type ModuleUpdate struct {
	Path      string // module/package path
	Current   string // current version
	Latest    string // latest available version
	Kind      string // "patch", "minor", or "major"
	SourceDir string // directory containing the manifest file (e.g. package.json)
}

ModuleUpdate describes a single outdated dependency.

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

Scanner checks anvils for outdated dependencies across all supported ecosystems.

func New

func New(db *state.DB, interval, timeout time.Duration, anvilPaths map[string]string) *Scanner

New creates a dependency check scanner.

func (*Scanner) Run

func (s *Scanner) Run(ctx context.Context) error

Run starts the periodic check loop. Blocks until ctx is canceled.

func (*Scanner) ScanAll

func (s *Scanner) ScanAll(ctx context.Context)

ScanAll runs dependency checks on all anvils across all supported ecosystems.

func (*Scanner) ScanAnvilDeps added in v0.10.0

func (s *Scanner) ScanAnvilDeps(ctx context.Context, name, path string) []*CheckResult

ScanAnvilDeps runs all applicable ecosystem scanners for a single anvil and returns the results without creating beads. This is used by the update-deps CLI command where bead creation is not desired. Unlike scanAnvil, it does not pull from the remote — the CLI should scan the working tree as-is.

func (*Scanner) UpdateAnvilPaths

func (s *Scanner) UpdateAnvilPaths(paths map[string]string)

UpdateAnvilPaths replaces the set of anvils to scan. This is safe to call while Run is active and takes effect on the next scan cycle.

Jump to

Keyboard shortcuts

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