Skip to content

Vibe coding a plugin? 😎 Teach your agent Modlumi first. Works with Claude Code, Codex, Cursor and more.

CommandDefinition

A command a plugin adds to Modlumi’s menus. See PluginContext.registerCommand.

optional contextMenu?: boolean

Also list the command in the viewport’s right-click menu while something is selected.


optional icon?: string

An SVG file in the plugin folder, such as "icons/stairs.svg", drawn on the toolbar. It is drawn as a single-color mask in the toolbar’s colors, so only the opacity of its shapes counts. Draw on a 24-unit square with 1.5-unit strokes to match Modlumi’s icons. Files up to 256 KiB; a missing or unreadable icon throws TypeError.


id: string

Identifies the command within its plugin: letters, digits, dots, dashes or underscores.


optional shortcut?: string

A keyboard shortcut, such as "Ctrl+Shift+K": Ctrl, Alt or Shift with a letter, digit or F1 to F12. Letters and digits need Ctrl or Alt, because plain keys choose tools and type measurements. Ctrl is Cmd on macOS. A shortcut that Modlumi or another plugin already uses is dropped and logged; one with the wrong form throws TypeError.


optional tip?: string

One sentence about what the command does, shown as its tooltip.


title: string

The menu entry’s text, in title case, such as "Select Coplanar Faces".


optional toolbar?: boolean

Also show the command as a toolbar button, in a group for the plugin. Needs an icon.


optional when?: "always" | "selection"

When the command can run: "always" (the default), or only while something is selected ("selection"). Unavailable commands are shown disabled.

optional isChecked(): boolean

Shows the command with a check mark while this returns true, for commands that toggle something. Asked at the same times as CommandDefinition.isEnabled.

boolean


optional isEnabled(): boolean

Whether the command can run now, beyond when. Unavailable commands are shown disabled. Modlumi asks after the plugin activates, after each of its commands, and after the model, selection, active context or document changes, so base the answer on those. It must return synchronously and only read, like a change listener; a command whose isEnabled throws is disabled.

boolean


run(): void | Promise<void>

Runs the command. Edit the model inside Model.operation, so each run is one undo step. Errors are shown to the user and logged.

void | Promise<void>