import { listCommandRecords, toSummary, type RaycastCommandSummary } from './commands-store.ts' export type ListCommandsInput = { /** When true, include full `code` for each command (larger payload). */ includeCode?: boolean } /** * List Raycast execute commands stored in this package's storage. * Use from the Raycast extension (cache) or agents reviewing what exists. * * @param input.includeCode - Include full ESM source for each command * @returns Command summaries (or full records when includeCode is true) * * @example * import listCommands from 'kody:@kody/raycast/list-commands' * const { commands } = await listCommands() */ export default async function listCommands(input: ListCommandsInput = {}) { const records = await listCommandRecords() if (input.includeCode) { return { commands: records, count: records.length } } const commands: RaycastCommandSummary[] = records.map(toSummary) return { commands, count: commands.length } }