Phials plugin documentation
User guide
AI Disclosure: This page was generated by an LLM and may contain inaccuracies. Hand-crafted documentation will be implemented over time on the road to 1.0

Command

Since Plugin API: 1.0.0

Signature

interface Command {
    id: string;
    label: string;
    description?: string;
    tooltip?: string;
    icon?: string;
    contextKeys?: CommandContextKey[];
    when?: (ctx: CommandContext) => boolean;
    disabled?: (ctx: CommandContext) => boolean;
    presentation?: (ctx: CommandContext) => CommandPresentation;
    action: (ctx: CommandContext) => void | Promise<void>;
    toastData?: import("phoundry-ui").ToastEntry | ((ctx: CommandContext) => import("phoundry-ui").ToastEntry | null | undefined);
    shortcut?: CommandShortcut;
    defaultPlacements?: CommandPlacement[];
    category?: string;
    searchAliases?: string[];
    menuGroup?: string;
    children?: Command[];
    renderSnippet?: (ctx: CommandContext) => import("svelte").Snippet;
}

Members

NameTypeRequiredDescription
idstringyesUnique command identifier (e.g., ‘core.file.delete’, ‘plugin.terminal.toggle’)
labelstringyesHuman-readable label
descriptionstringnoOptional description for command bar/settings
tooltipstringnoTooltip text shown on hover (defaults to label if not set)
iconstringnoIcon for UI display
contextKeysCommandContextKey[]noContext keys required for this command to be visible. Used for fast pre-filtering before evaluating when(). If omitted or contains ‘always’, command is always considered.
when(ctx:CommandContext) => booleannoFine-grained visibility check. Only called if contextKeys pass (or are not specified). Return false to hide the command.
disabled(ctx:CommandContext) => booleannoWhether the command is disabled (visible but not executable). Return true to disable.
presentation(ctx:CommandContext) => CommandPresentationnoDynamic display metadata for runtime surfaces; never changes availability.
action(ctx:CommandContext) => void | Promise<void>yesThe action to execute
toastDataimport("phoundry-ui").ToastEntry | (ctx:CommandContext) => import("phoundry-ui").ToastEntry | null | undefinednoOptional toast shown after the action completes successfully (no throw). Static entry or a function of the same context passed to action.
shortcutCommandShortcutnoKeyboard shortcut configuration
defaultPlacementsCommandPlacement[]noWhere this command appears by default. Users can override these in settings.
categorystringnoCategory for grouping in command bar. E.g., ‘File’, ‘Edit’, ‘View’, ‘Navigation’, ‘Tabs’
searchAliasesstring[]noAlternative search terms for command bar fuzzy search
menuGroupstringnoOptional group for path bar dropdown separators between sibling child commands
childrenCommand[]noChild commands for dropdown/submenu patterns. When a command has children, its action typically does nothing and the UI shows a dropdown menu of child commands instead.
renderSnippet(ctx:CommandContext) => import("svelte").SnippetnoCustom render snippet for context menu. When provided, the command renders as a custom menu item instead of a standard action item. Useful for inline controls like ratings.