import { kody } from 'kody:runtime'
export type ListPackagesResult = {
packages: Array<{
packageId: string
kodyId: string
name: string
description: string
tags: string[]
hasApp: boolean
hidden: boolean
updatedAt: string
}>
}
/**
* List saved packages for a Raycast (or other external) command builder.
*
* Live `@kody/raycast` lists the official kody-scope packages. Fork or install
* this listing into the caller's account so HTTP clients see *their* packages.
*
* @returns Saved package summaries with ids, names, and tags.
*
* @example
* import listPackages from 'kody:@kody/raycast/list-packages'
* const { packages } = await listPackages()
*/
export default async function listPackages(): Promise<ListPackagesResult> {
const result = await kody.package_list({})
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,
hidden: pkg.hidden,
updatedAt: pkg.updated_at,
})),
}
}