Files
2026-09-23 12:29:08 -03:00

97 lines
4.7 KiB
Markdown

---
name: vitruvio-atualizar-manifesto
description: >
Use when the user wants to update, rename, or remove an existing artifact registration
in vitruvio.json. Triggers: "update the category/description/authMode of", "change the name of",
"rename this panel/script/endpoint", "remove this artifact", "unregister", "atualizar manifesto",
"mudar categoria", "remover painel", or any request to modify fields of an already-registered artifact.
Do NOT trigger for creating new artifacts (use vitruvio-criar-* skills) or adding menu entries (use vitruvio-adicionar-menu).
---
# Update Vitruvio Manifest Entry
> All messages shown to the user must be written in Portuguese.
You are modifying an existing entry in `vitruvio.json`. No new files — only manifest changes (and optionally file moves/deletions). 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 — Identify operation and target
Ask the user (in a single message, only ask what is missing):
- **Operation** — one of:
- **A — Update fields**: change metadata on an existing entry (category, description, authMode, allowedGroups, displayOrder, etc.)
- **B — Remove entry**: unregister an artifact from `vitruvio.json`
- **C — Rename key**: change the artifact's key (breaking change — see Operation C below)
- **Target artifact** — the key of the artifact to modify, and its section (panel, script, endpoint, query, report, library, process).
Read `vitruvio.json` and show the user the current entry before proceeding.
---
## Operation A — Update fields
Ask what fields to change and their new values. Then edit `vitruvio.json` with the updated values, preserving all other fields exactly.
### Editable fields by artifact type
**Panel:** `name`, `description`, `category`, `displayOrder`, `showInPresentation`, `openInNewWindow`, `showInMobileList`, `displayTimeInSeconds`, `allowedGroups`, `allowedUsers`, `forms.mobile`, `forms.mobileAlternative`, `defaultState`, `thumbnail`
**Script:** `name`, `description`, `domain` (`USUARIO` / `SISTEMA`)
**Endpoint:** `name`, `description`, `authMode` (`PUBLIC`, `STATIC_TOKEN`, `VITRUVIO_WS_USER_AUTH`, `HTTP_BASIC_AUTH`), `active`
**Query:** `name`, `connection`
**Report:** `name`, `description`, `category`, `owner`, `orientation`, `parameterForm`, `allowedGroups`, `allowedUsers`
**Library:** `name`, `authMode`, `mobileEnabled`
**Process:** `name`, `description`, `forms.mobile`, `forms.mobileAlternative`
After editing, report each field that changed (old value → new value).
---
## Operation B — Remove entry
1. Show the full current entry from `vitruvio.json` to the user.
2. Ask for explicit confirmation before proceeding — do not remove without a yes.
3. Remove the entry from its section array in `vitruvio.json`. If the section array becomes empty, remove the array key entirely.
4. Ask the user: **"Do you also want to delete the artifact's files from disk?"** — list which files/directories would be deleted. Do not delete anything without an explicit yes.
5. If yes, delete the files.
6. Report: entry removed from `vitruvio.json`; files deleted if confirmed.
---
## Operation C — Rename key
> **Warning to show the user before proceeding:**
> Renaming a key is a breaking change. Any code that references the old key — `engine.showPanel('<old-key>')`, `libService.loadScript('<old-key>')`, menu entries, process variables, external integrations — will break. Search the repo for the old key before confirming.
1. Show the warning above and ask the user to confirm they understand.
2. Ask for the new key (kebab-case). Check it is not already used in the same section of `vitruvio.json`.
3. Update the `key` field in `vitruvio.json`.
4. Update any `source`, `bpmn`, `template`, `parameterForm`, `files`, or `forms.*` paths inside the same entry that include the old key in their path.
5. Rename the artifact's directory or file on disk:
- `panels/<old-key>/` → `panels/<new-key>/`
- `scripts/<old-key>.js` → `scripts/<new-key>.js`
- `endpoints/<old-key>.js` → `endpoints/<new-key>.js`
- `queries/<old-key>.sql` → `queries/<new-key>.sql`
- `reports/<old-key>/` → `reports/<new-key>/`
- `libraries/<old-key>/` → `libraries/<new-key>/`
- `processes/<old-key>/` → `processes/<new-key>/`
6. Check if a menu entry references the old key (`panelKey`, `reportKey`, `processKey`) and update it too.
7. Report: what was renamed in `vitruvio.json` and on disk. Remind the user to search the codebase for any remaining hardcoded references to the old key:
```bash
grep -r "<old-key>" --include="*.xml" --include="*.js" --include="*.json" .
```