function removeArchetype()

in script.js [87:102]


  function removeArchetype(archetype) {
    if (!selectedMgId || !currentData) return;

    const index = currentData.management_groups.findIndex(mg => mg.id === selectedMgId);
    if (index === -1) return;

    // Remove the archetype
    currentData.management_groups[index].archetypes =
      currentData.management_groups[index].archetypes.filter(a => a !== archetype);

    // Update the UI
    renderArchetypeTags(currentData.management_groups[index].archetypes);

    // Only update the JSON preview, no need to re-render the entire tree
    updateJsonPreview();
  }