# Debug commands of @ferret/inspector, @ferret/core

Call with `world.commands.execute(name, args)`; `world.commands.list()` on the running game is the authority. Read from the sources of these packages.

- `anim.graph` — the graph state of an entity: {entity} -> state, parameters, montages
- `anim.list` — animation groups of the scene, or of an entity's Animator: {entity?}
- `anim.montage` — play a one-shot clip on an entity: {entity, clip, mask?, blendIn?, blendOut?, loop?}
- `anim.play` — play a clip on a model or entity, outside any graph: {group, clip, loop?: true, speed?: 1}
- `anim.scrub` — show a clip at a time on a model, with the graph not driving it: {group: model/entity name, clip, time}
- `anim.set` — set graph parameters or fire a trigger: {entity, params?: {name: number|bool}, trigger?}
- `anim.stop` — stop a clip started with anim.play: {group}
- `asset.list` — models loaded with asset.load
- `asset.load` — load a glTF/GLB into the scene: {url, name?, position?, scale?} -> the model's nodes and clips
- `asset.remove` — remove a model loaded with asset.load: {name}
- `camera.get` — the active camera
- `camera.set` — move the camera: {position?, target?, fov?, radius?, alpha?, beta?}
- `camera.view` — named view of the scene or a node: {name: "front"|"back"|"left"|"right"|"top"|"iso"|"fit", node?, margin?}
- `input.actions` — the actions the game binds: [{name, kind, bindings: {keyboard|gamepad|touch: [...]}}]
- `input.hold` — press actions as a player would, hold them for `seconds` of game time, then let go: {actions: [{action, down?: true, x?, y?}], seconds?: 0.5 (max 30)} or one {action, down?, x?, y?, seconds?}. A button is down:true; an axis takes x (-1 left … 1 right) and y (-1 … 1, up/forward is usually +1 or -1: read the game). Several actions are held together (reverse and turn at once). Returns after the hold, with each action's value. Look at the result with screenshot and scene.node / scene.entities afterwards.
- `input.release` — let go of every action input.hold still holds: {}
- `physics.bodies` — the rigid bodies of the physics host: [{entity, node, kind, shape, mass, material, position, speed}], with the level's constraints and fractured bodies
- `record.pause` — pause the recording
- `record.resume` — resume a paused recording
- `record.start` — start recording the scene: {fps?, audio?, videoBitsPerSecond?} -> {mime, audio}; audio is false while the sound is still locked
- `record.state` — the recorder: {state: idle|recording|paused, elapsedMs, supported}
- `record.stop` — end the recording: {dataUrl?: false to leave the file out} -> {mime, bytes, durationMs, audio, dataUrl}
- `scene.bounds` — world bounds of the scene or of one node and its children: {node?}
- `scene.entities` — list entities: {tag?, name?} -> id, name, position, components
- `scene.exportStep` — the visible meshes (or one node and its children) as a STEP file for CAD (ISO 10303-21, AP214): an assembly, one faceted part per mesh, world coordinates, Z up: {node?, name?, units?: "mm"|"m", hidden?, maxTriangles?} -> {file, text, bytes, parts, solids, surfaces, triangles, skipped}
- `scene.node` — details of one node: {name} -> transform, bounds, material, skeleton
- `scene.nodes` — list scene nodes: {filter?, kind?: "mesh"|"transform"|"light"|"camera", limit?}
- `scene.stats` — counts and frame stats
- `scene.validate` — check the level: meshes without collision, without material, nodes with bad transforms, skeletons without animation
- `view.set` — debug views: {wireframe?, bounds?, skeletons?, colliders?, triggers?} -> current flags
- `commands.list` — every command of this world: -> [{name, description}]
- `host.show` — show a world by name ("main" or one a game created): {name}
- `host.worlds` — the worlds on the shared engine and which one is shown
- `perf.bound` — which side holds the frame: -> {by: cpu|gpu|?, frameMs, gpuMs}
- `perf.enable` — switch the frame profiler on or off: {on} -> enabled
- `perf.report` — where a frame goes, ms a frame by system, the most expensive first: {top?, prefix?} -> {frameMs, frameWorst, rows}
- `perf.reset` — clear the profiler
- `perf.trace` — the recorded frames, long tasks and marks: -> {frames, longTasks, marks, done} or null
- `perf.trace.start` — record every frame for a while (the start of a game): {seconds?, minMs?}
- `quality.auto` — switch the regulator on or off: {on} -> on
- `quality.preset` — every knob at a share of its range: {share 0 (richest) .. 1 (cheapest)}
- `quality.report` — the quality regulator: target, measured frame, which side holds it, the knobs and the last decisions
- `quality.set` — put a knob at a level and keep it there ({id, level}), or give it back to the regulator ({id, auto: true})
- `quality.target` — the flat-screen frame rate to hold: {hz}
- `snapshot.audit` — reads of fields the snapshot spec does not declare (needs the replica made with audit on)
- `world.info` — time, tick count, entity and service counts
- `world.pause` — pause or resume the simulation: {paused}
- `world.step` — run n fixed steps (use while paused): {n}
- `world.timeScale` — set the time scale: {scale}
