Skip to content
← Public packages

@kentcdodds/raycast

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

src/list-commands.ts

26 lines · 973 B · TypeScript
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:@kentcdodds/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 }
}