import { kody } from 'kody:runtime'
export type ListPackagesResult = {
packages: Array<{
packageId: string
kodyId: string
name: string
description: string
tags: string[]
hasApp: boolean
updatedAt: string
}>
}
/**
* List saved packages for the Pouch inventory.
*
* @returns Saved package summaries with ids, names, and tags.
*/
export default async function listPackages(): Promise<ListPackagesResult> {
const result = await kody.packageList({})
return {
packages: result.packages.map(pkg => ({
packageId: pkg.package_id,
kodyId: pkg.kody_id,
name: pkg.name,
description: pkg.description,
tags: pkg.tags,
hasApp: pkg.has_app,
updatedAt: pkg.updated_at,
})),
}
}