Dependencies
The dependencies namespace on a project surfaces the dependencies detected by
plugins across every ecosystem (npm, RubyGems, and more) — the logic behind the
deps CLI command.
Listing dependencies
Section titled “Listing dependencies”const project = await denvig.projects.retrieve('github:marcqualie/denvig')
const deps = await project.dependencies.list()
// A single dependency by idconst dep = await project.dependencies.retrieve('npm:zod')The dependency tree
Section titled “The dependency tree”Direct dependencies are the roots; pass depth to walk transitive dependencies:
const tree = await project.dependencies.tree({ depth: 1, // 0 = direct only ecosystem: 'npm', // restrict to one ecosystem})Outdated dependencies
Section titled “Outdated dependencies”const outdated = await project.dependencies.outdated({ ecosystem: 'npm', semver: 'minor', // 'patch' | 'minor' | 'major' releaseLatency: '7d', // only updates released longer ago than this worktree: 'feature/x', // resolve in a sibling worktree noCache: false, // skip the cache and fetch fresh})
for (const dep of outdated) { console.log(dep.name, dep.current, dep.latest)}Registry information
Section titled “Registry information”Look up registry information for a dependency by <ecosystem>:<name>. Returns
null when the package can’t be found:
const info = await project.dependencies.info('npm:redis')
if (info) { console.log(info.latest, info.versions, info.versionDates)}Working at the worktree level
Section titled “Working at the worktree level”Each worktree exposes its own dependency helpers, useful when you’ve already resolved a specific checkout:
const wt = project.worktrees.retrieve('feature/x')
await wt.dependencies()await wt.outdatedDependencies({ semver: 'patch' })await wt.deduplicateDependencies()