Enforce canonical plugin manifest ordering (#1601)

* Enforce canonical plugin manifest ordering

Sort existing plugin manifest spec arrays so plugin:clean no longer creates noisy diffs from out-of-order entries. Add validation to require alphabetical ordering and teach plugin:clean to normalize manifest arrays when cleaning materialized plugin content.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Aaron Powell
2026-05-04 12:00:50 +10:00
committed by GitHub
parent fb71887136
commit a1197525bd
26 changed files with 112 additions and 85 deletions

View File

@@ -64,6 +64,18 @@ function validateKeywords(keywords) {
return null;
}
function arraysEqual(left, right) {
if (!Array.isArray(left) || !Array.isArray(right) || left.length !== right.length) {
return false;
}
return left.every((value, index) => value === right[index]);
}
function sortPluginEntries(entries) {
return [...entries].sort((left, right) => left.localeCompare(right));
}
function validateSpecPaths(plugin) {
const errors = [];
const specs = {
@@ -78,6 +90,9 @@ function validateSpecPaths(plugin) {
errors.push(`${field} must be an array`);
continue;
}
if (!arraysEqual(arr, sortPluginEntries(arr))) {
errors.push(`${field} must be sorted alphabetically`);
}
for (let i = 0; i < arr.length; i++) {
const p = arr[i];
if (typeof p !== "string") {