About

/*{
"type": "action",
"targets": ["omnifocus"],
"author": "Kaitlin Salzke",
"identifier": "com.KaitlinSalzke.reorderTags",
"version": "1.0",
"description": "Reorders the tags of the selected task(s) based on the order in 'Tags'.",
"label": "Reorder Tags",
"shortLabel": "Reorder Tags"
}*/
var _ = (function() {
var action = new PlugIn.Action(function(selection, sender) {
// action code
// selection options: tasks, projects, folders, tags

// ***CONFIGURATION:*** set up items here. Tags will be sorted based on order in Omnifocus unless otherwise specified here.
firstTags = [];
lastTags = [
"This Week",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
"Sunday",
"Do",
"🎯 MIT",
"☀️ MIT (Tomorrow)"
];

// if called externally (from script) generate selection object
if (typeof selection == "undefined") {
selection = document.windows[0].selection;
}

// create array of all tag names
tagNames = [];
tags.apply(tag => tagNames.push(tag));

// iterate through selected tasks
selection.tasks.forEach(function(task) {
// get assigned tags
assignedTags = task.tags;

// sort assigned tags based on tag index
sortedAssignedTags = assignedTags.sort(function(a, b) {
if (firstTags.includes(a.name)) {
aTagOrder = firstTags.indexOf(a.name);
} else if (lastTags.includes(a.name)) {
aTagOrder = tagNames.length + lastTags.indexOf(a.name) + 1;
} else {
aTagOrder = firstTags.length + tagNames.indexOf(a);
}

if (firstTags.includes(b.name)) {
bTagOrder = firstTags.indexOf(b.name);
} else if (lastTags.includes(b.name)) {
bTagOrder = tagNames.length + lastTags.indexOf(b.name) + 1;
} else {
bTagOrder = firstTags.length + tagNames.indexOf(b);
}

return aTagOrder > bTagOrder;
});

// remove all tags from task
task.removeTags(assignedTags);

// re-apply tags in order
task.addTags(sortedAssignedTags);
});
});

action.validate = function(selection, sender) {
// validation code
// selection options: tasks, projects, folders, tags
return selection.tasks.length > 0;
};

return action;
})();
_;

Blah blah