66 lines
1.6 KiB
Markdown
66 lines
1.6 KiB
Markdown
# Menu providers (drop-in menu customization)
|
|
|
|
Providers let you add/override menu entries without editing the core menu patch.
|
|
|
|
Default entries directory (on robot):
|
|
- `/opt/jibo/Jibo/Skills/@be/menu-entries.d/`
|
|
|
|
Legacy fallback (yea ik its the same stop talking):
|
|
- `/opt/jibo/Jibo/Skills/@be/menu-providers.d/`
|
|
|
|
## Provider file types
|
|
|
|
### JSON provider (`*.json`)
|
|
Supported shapes:
|
|
|
|
- An array of entries: `[ { ... }, { ... } ]`
|
|
- Or `{ "entries": [ ... ] }`
|
|
|
|
Entry schema (same as `menuEntry.json` scan output):
|
|
|
|
- `id` (string, required)
|
|
- `type` (`skill` or `submenu`)
|
|
- `title`
|
|
- `icon`
|
|
- `color`
|
|
- `description`
|
|
- `order` (number)
|
|
- `skillId` (for type `skill`)
|
|
- `submenuTitle` (for type `submenu`)
|
|
- `children` (array of skill entries, for type `submenu`)
|
|
- `childrenDir` (for type `submenu`, optional):
|
|
- Absolute path (starts with `/`) or relative to `skillsRoot`
|
|
- If provided and `children` is missing/empty, the patch will scan this directory for child skills (subfolders containing `menuEntry.json`).
|
|
|
|
Example submenu that lists a directory:
|
|
|
|
```json
|
|
[
|
|
{
|
|
"id": "fun_stuff",
|
|
"type": "submenu",
|
|
"title": "Fun Stuff",
|
|
"icon": "resources/icons/fun-stuff.png",
|
|
"order": 20,
|
|
"childrenDir": "FunStuff"
|
|
}
|
|
]
|
|
```
|
|
|
|
### JS provider (`*.js`)
|
|
Exports one of:
|
|
|
|
- `module.exports = function(ctx) { return [ ...entries... ]; }`
|
|
- `exports.getEntries = function(ctx) { return [ ...entries... ]; }`
|
|
- `exports.entries = [ ...entries... ]`
|
|
|
|
`ctx` includes:
|
|
- `skillsRoot`
|
|
- `providersDir`
|
|
- `log` (function)
|
|
|
|
## Conflict rules
|
|
|
|
- If a provider entry has the same `id` as a scanned entry, the provider entry wins.
|
|
- Sorting: by `order` then by title.
|