initial
This commit is contained in:
@@ -0,0 +1,121 @@
|
||||
---
|
||||
name: vitruvio-adicionar-menu
|
||||
description: >
|
||||
Use ONLY when the user explicitly asks to add a menu item or menu entry in a Vitruvio repository.
|
||||
Triggers: "add menu item", "add to menu", "adicionar ao menu", "criar item de menu",
|
||||
"add panel to menu", "adicionar painel no menu", or any explicit request to register
|
||||
something in the vitruvio.json "menu" array.
|
||||
Do NOT trigger for general panel/process/script creation — menu entries are separate.
|
||||
---
|
||||
|
||||
# Add Vitruvio Menu Item
|
||||
|
||||
> All messages shown to the user must be written in Portuguese.
|
||||
|
||||
You are adding an entry to the `menu` array in `vitruvio.json`. Menu entries are **never created automatically** — only when the user explicitly requests it. Follow these steps in order.
|
||||
|
||||
## Step 1 — Confirm you are inside a Vitruvio repo
|
||||
|
||||
```bash
|
||||
ls vitruvio.json 2>/dev/null && echo "OK" || echo "NOT_A_VITRUVIO_REPO"
|
||||
```
|
||||
|
||||
If `NOT_A_VITRUVIO_REPO`, stop and tell the user to `cd` into the correct repo.
|
||||
|
||||
## Step 2 — Show the current menu structure
|
||||
|
||||
Read `vitruvio.json` and print the menu tree as a readable outline. Example format:
|
||||
|
||||
```
|
||||
menu:
|
||||
[0] menu-root "Meu Módulo" (MENU)
|
||||
[0] menu-panel "Meu Painel" (PAINEL → my-panel)
|
||||
[1] menu-report "Meu Relatório" (RELATORIO → my-report)
|
||||
```
|
||||
|
||||
If the `menu` array is empty or absent, say so.
|
||||
|
||||
## Step 3 — Collect item details
|
||||
|
||||
Ask the user (in a single message, only ask what is missing):
|
||||
|
||||
- **Type** — one of:
|
||||
- `PAINEL` — links to a panel (`panelKey`)
|
||||
- `RELATORIO` — links to a report (`reportKey`)
|
||||
- `PROCESSO` — links to a process (`processKey`)
|
||||
- `MENU` — a submenu/folder (no artifact link, has `children`)
|
||||
- **Target artifact key** — the `key` of the panel/report/process to link (skip if type is `MENU`)
|
||||
- **Name** — the label shown in the menu
|
||||
- **Key** — unique key for this menu entry (suggest `menu-<artifactKey>` as default)
|
||||
- **Parent** — root level, or inside which existing `MENU` item? Show the options from Step 2.
|
||||
- **Order** — integer position within its parent (suggest next available based on existing siblings)
|
||||
- **Icon** — only relevant for root-level `MENU` items. Vitruvio uses FontAwesome numeric codes (e.g. `61441` = fa-adjust). For children, always `null`.
|
||||
|
||||
## Step 4 — Build the JSON entry
|
||||
|
||||
### Type: PAINEL
|
||||
```json
|
||||
{
|
||||
"key": "<key>",
|
||||
"name": "<name>",
|
||||
"icon": null,
|
||||
"order": <order>,
|
||||
"type": "PAINEL",
|
||||
"panelKey": "<panelKey>",
|
||||
"children": []
|
||||
}
|
||||
```
|
||||
|
||||
### Type: RELATORIO
|
||||
```json
|
||||
{
|
||||
"key": "<key>",
|
||||
"name": "<name>",
|
||||
"icon": null,
|
||||
"order": <order>,
|
||||
"type": "RELATORIO",
|
||||
"reportKey": "<reportKey>",
|
||||
"children": []
|
||||
}
|
||||
```
|
||||
|
||||
### Type: PROCESSO
|
||||
```json
|
||||
{
|
||||
"key": "<key>",
|
||||
"name": "<name>",
|
||||
"icon": null,
|
||||
"order": <order>,
|
||||
"type": "PROCESSO",
|
||||
"processKey": "<processKey>",
|
||||
"children": []
|
||||
}
|
||||
```
|
||||
|
||||
### Type: MENU (submenu / root folder)
|
||||
```json
|
||||
{
|
||||
"key": "<key>",
|
||||
"name": "<name>",
|
||||
"icon": <iconCode or null>,
|
||||
"order": <order>,
|
||||
"type": "MENU",
|
||||
"children": []
|
||||
}
|
||||
```
|
||||
|
||||
## Step 5 — Insert into vitruvio.json
|
||||
|
||||
- Read `vitruvio.json`.
|
||||
- If `menu` array does not exist, create it as an empty array first.
|
||||
- If the user chose **root level**: append the entry to the top-level `menu` array.
|
||||
- If the user chose a **parent item**: find the parent entry by key inside `menu` (search recursively if needed) and append to its `children` array.
|
||||
- Check that the chosen `key` is not already used anywhere in the menu tree before inserting.
|
||||
- Write the updated file back preserving formatting (2-space indent).
|
||||
|
||||
## Step 6 — Report
|
||||
|
||||
Tell the user:
|
||||
- Added `<type>` entry `<key>` ("Name") at `<location>` with order `<order>`
|
||||
- Remind them: menu order is relative within siblings — reorder adjacent items if needed
|
||||
- Remind them: `icon` values are FontAwesome numeric codes; use `null` for leaf items
|
||||
Reference in New Issue
Block a user