Skip to content
Docsv0.7.2

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.

const project = await denvig.projects.retrieve('github:marcqualie/denvig')
const deps = await project.dependencies.list()
// A single dependency by id
const dep = await project.dependencies.retrieve('npm:zod')

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
})
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)
}

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)
}

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()