Editing a level by commands
Skill ferret-level-editor · download all skills · SKILL.md
When to use#
Putting entities in a level, adding zones, spawns, animation graphs, physics settings, or fixing a manifest without hand-editing JSON.
The model#
@ferret/editor edits a draft of a level's manifest through commands on world.commands. Every edit is a JSON-pointer patch (add, replace, remove) with its undo; a person in the editor and an agent share one undo history. Nothing is written until edit.save, which is refused while the draft is invalid.
Steps#
edit.open {level}(draft;livereloads the level after each edit).- Read with
edit.get {path?}(a JSON pointer such as/entities/0/params). - Change with the typed commands:
edit.entity.add|set|remove|duplicate,edit.spawn.*,edit.zone.*,edit.collider.set,edit.navmesh.rebuild,edit.anim.*,edit.physics.*(material, constraint, fracture, set). Useedit.patch {ops}only when no typed command fits. edit.validate, thenedit.diffto see exactly what changed.- Look: the model viewer (
pnpm viewer,pnpm viewer:headless) relays commands and serves screenshots of the active camera. edit.save.edit.undo/edit.redo/edit.historywhile working.
Check afterwards#
edit.validate is empty; edit.colliders.missing lists no large non-solid mesh you meant to be solid; a screenshot shows the level; the level plays.
What usually goes wrong#
- Node names that do not exist in the glTF (the loader cannot wire them:
edit.validatereports it). - Removing a state or graph still used.
- Forgetting
edit.navmesh.rebuildafter moving solid meshes. - Editing with
liveoff and not callingedit.reload.
Files#
reference/levels.md— The level manifest, the level registry and travel, environment, and the .ferret package format.reference/commands.md— The debug command channel: how a tool, the inspector or an AI agent drives a running game, and the commands each package registers.reference/api-editor.md— every export of@ferret/editorwith signature and doc commentreference/commands.md— 76 commands of these packages with their arguments