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
- func BeadTitle(ecosystem, packageName, oldVersion, newVersion string) string
- func DedupCheck(ctx context.Context, db *state.DB, ...) bool
- func DedupCheckWithCache(cache *DedupCache, packageName string) bool
- func FindOrCreateBeadID(ctx context.Context, db *state.DB, anvilName, anvilPath string) (string, error)
- type CheckResult
- type DedupCache
- type ModuleUpdate
- type Scanner
Constants ¶
const DepsUpdateLabel = "deps-update"
DepsUpdateLabel is the label applied to dependency-update beads so that downstream consumers (e.g. worktree setup) can identify them and skip behaviours that conflict with npm install (such as node_modules junctions).
Variables ¶
This section is empty.
Functions ¶
func BeadTitle ¶
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.
func FindOrCreateBeadID ¶ added in v0.12.0
func FindOrCreateBeadID(ctx context.Context, db *state.DB, anvilName, anvilPath string) (string, error)
FindOrCreateBeadID locates any existing open consolidated dependency-update bead for the given anvil (prefix-based match), running a fresh scan and creating the bead if none exists yet. An existing bead from a previous day is reused rather than creating a new one each time the date changes.
Returns:
- (beadID, nil) when a bead was found or created successfully
- ("", nil) when no outdated packages were detected (nothing to dispatch)
- ("", err) when the scan or bead-creation step failed
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 ¶
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 (*Scanner) ScanAll ¶
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. Unlike scanAnvil, it does not pull from the remote — the caller should scan the working tree as-is.
func (*Scanner) UpdateAnvilPaths ¶
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.
func (*Scanner) UpdateAnvilTags ¶ added in v0.12.0
UpdateAnvilTags is a no-op kept for API compatibility. Consolidated dependency beads are no longer auto-tagged on creation; the user applies the anvil's configured auto-dispatch label (auto_dispatch_tag) manually when ready to dispatch the update.