> For the complete documentation index, see [llms.txt](https://star-generator.gitbook.io/star-generator-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://star-generator.gitbook.io/star-generator-docs/webui-editor.md).

# webui editor

StarGenerator includes a local WebUI editor for recipe, table, group, and pack YAML files.

Start it with:

```
/sg starteditor
```

Stop it with:

```
/sg stopeditor
```

The start command prints a tokenized URL. Open that URL in a browser on the machine that can access the configured bind address.

## Security

Default config binds the editor to localhost:

```yaml
web-editor:
  bind: "127.0.0.1"
  allow-remote-bind: false
```

Do not expose the WebUI publicly unless you understand the risk. It edits server config files and is controlled by a temporary token in the URL.

## Token Lifetime

The default token lifetime is 900 seconds.

```yaml
web-editor:
  token-ttl-seconds: 900
```

Running `/sg starteditor` again refreshes the token and prints a new link.

## Main Navigation

The WebUI main sections are:

* `Recipe`
* `Table`
* `Group`
* `Wiki`

`Wiki` opens the external GitBook documentation site.

Raw JSON is hidden by default. Use `Show JSON` only when you need to inspect or edit the generated structure directly.

## Editor API

The editor serves these internal endpoints:

| Endpoint      | Purpose                                                              |
| ------------- | -------------------------------------------------------------------- |
| `/`           | WebUI HTML.                                                          |
| `/api/state`  | Loads editable state and cached item catalog metadata.               |
| `/api/icon`   | Serves item preview icons for the editor.                            |
| `/api/save`   | Saves edited content.                                                |
| `/api/delete` | Deletes selected recipe, table, group, or pack content when allowed. |
| `/logo.webp`  | Serves the editor logo.                                              |

All editor endpoints require the active token, except the logo.

## Item Catalog

The item catalog includes:

* StarGenerator groups.
* StarGenerator tables.
* Saved StarLibs items.
* ItemsAdder items.
* Nexo items.
* Oraxen items.
* MMOItems entries where available.
* Minecraft materials.

The catalog is cached asynchronously so resource-pack texture scanning does not block the server main thread. If the catalog is still refreshing, the UI can show stale data or placeholders until the refresh completes.

## Supported Content

The WebUI can edit:

* Recipe YAML.
* Table YAML.
* Item group YAML.
* Pack folders, except the protected root content.
* Table GUI slots and buttons.
* Recipe GUI, recipe list GUI, craft method page, reward GUI, energy settings, and upgrade settings.
* Custom buttons for the main GUI and sub-GUIs.
* Shared progress bar name/lore.
* Shared energy progress name/lore.
* Craft cost modifiers under `craft-cost.time` and `craft-cost.energy`.
* Vanilla crafting registration for normal outputs and StarGenerator table outputs.

## GUI Layout Editor

GUI layouts support:

* Drag and drop between slots.
* Swapping occupied slots.
* Moving a role instead of duplicating the same role into multiple slots.
* Clicking an occupied slot to open small actions such as `Settings` or `Remove`.
* Custom button placement in each GUI page.

If a slot is outside the GUI size, StarGenerator skips that visual item at runtime instead of failing the table load.

## Upgrade Requirement Editor

Upgrade materials can be edited by dragging items from the catalog into the upgrade requirement layout, then setting:

* Requirement key.
* Slot.
* Item path.
* Amount.
* Optional name.
* Optional lore.
* Match-meta behavior.

The WebUI stores this under `upgrade.requirements`.

## Delete Actions

The WebUI supports delete actions for:

* Recipe files.
* Table files.
* Group files.
* Pack folders.

The protected root pack cannot be deleted from the UI or API. Deleting a pack removes `plugins/StarGenerator/pack/<packName>` after validation.

## Validation

The WebUI validates key structure before saving. For example:

* `table.name` is required.
* `table.icon.type` is required.
* `table.gui.size` must be `9`, `18`, `27`, `36`, `45`, or `54`.
* `table.gui.craftingSlot` must contain at least one non-empty column.
* `recipe.items` must contain at least one output.
* `recipe.recipe` must contain at least one ingredient.
* `table.craft-cost.time.unit` and `table.craft-cost.energy.unit` must be `PERCENT` or `FLAT`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://star-generator.gitbook.io/star-generator-docs/webui-editor.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
