Skip to content
← Public packages

@kentcdodds/raycast

Raycast launcher: stored execute commands via webhooks (canonical; do not use raycast-shortcuts).

src/list-packages.ts

38 lines · 954 B · TypeScript
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 a Raycast (or other external) command builder.
 *
 * @returns Saved package summaries with ids, names, and tags.
 *
 * @example
 * import listPackages from 'kody:@kentcdodds/raycast/list-packages'
 * const result = await listPackages()
 * // => { packages: [{ packageId: '...', kodyId: 'discord', name: '@scope/discord', ... }] }
 */
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,
		})),
	}
}