Cookbook · Reading
List every feature, persona, or any other typed node. Avoid the wrapped-return gotcha.
Recipe
import { UPGClient } from '@unified-product-graph/sdk'
const upg = new UPGClient({ file: './product.upg' })
const { nodes, total } = await upg.nodes.list({ type: 'feature' })
console.log(`${total} features in graph`)
for (const feature of nodes) {
console.log(' ', feature.id, '·', feature.title)
}What it does
nodes.list() returns { nodes, total }, not a bare array. Destructure both: nodes is the page (filtered) and total is the unfiltered count of matches. Filters AND together: pass { type, status, parent_id, tags } to narrow further.
Variations
Filter by status as well
await upg.nodes.list({ type: 'feature', status: 'active' })Children of a specific parent
await upg.nodes.list({ parent_id: persona.id })By tag
await upg.nodes.list({ type: 'feature', tags: ['mvp'] })See also