Skip to main content

apply_structural_edit

Function apply_structural_edit 

Source
pub fn apply_structural_edit(src: &str, edit_json: &str) -> JsValue
Expand description

Apply a structural edit to a VibeScript program and project the result.

The edit is specified as a JSON object with an op field and operation-specific fields. This enables LLMs and browsers to edit program structure without text patching.

Supported ops:

  • add_field: { op, name, ty, unit?, support?, representation? }
  • add_material: { op, name, properties: [{name, value}] }
  • add_law: { op, name, condition, consequence }
  • remove_item: { op, index }
  • rename_item: { op, index, new_name }
  • set_field_unit: { op, index, unit? }
  • set_field_support: { op, index, support }
  • set_field_representation: { op, index, representation }
  • add_material_property: { op, index, name, value }
  • remove_material_property: { op, index, name }
  • add_prefix: { op, prefix, iri }
  • remove_prefix: { op, prefix }