feat(editor): add --catalog-id-range for ID-allocation planning

New utility scans every catalog file under a directory
tree and reports the primary-key id range, gap count,
first gap, and recommended next id (smallest gap if any,
else max+1). Useful when adding new entries without
conflicts: instead of opening the file in --info to read
the current max id, run --catalog-id-range and pick the
recNext value.

Optional --magic <WXXX> filter narrows to one format
family. Output is sorted by file path for deterministic
shell-pipeline behavior.

Skips files whose format has no --info-* surface
(asset formats like .wom/.wob/.whm). Permission-denied
subdirs handled gracefully via skip_permission_denied.
Reuses the same primary-key heuristic + foreign-key
filter as --catalog-pluck and --catalog-find.

CLI flag count 1198 -> 1199.
This commit is contained in:
Kelsi 2026-05-10 02:06:49 -07:00
parent cf886ec94b
commit cbc4991305
6 changed files with 318 additions and 0 deletions

View file

@ -138,6 +138,7 @@ const char* const kArgRequired[] = {
"--bulk-rename-by-magic", "--touch-tree", "--tree-summary-md",
"--catalog-grep", "--diff-headers", "--audit-tree",
"--catalog-pluck", "--catalog-find", "--catalog-by-name",
"--catalog-id-range",
"--magic-fix", "--bulk-validate",
"--bulk-export-json", "--bulk-import-json",
"--diff-tree", "--orphan-jsons", "--list-by-magic",