feat(cli): add --tag flag to hyperframes add for bulk install

Install all registry blocks matching a tag in one command:

  hyperframes add --tag vfx       # installs all 7 VFX blocks
  hyperframes add --tag captions  # installs all 5 caption blocks

The resolver loads each item's full manifest to check tags, then
installs matching blocks sequentially. Failed items are skipped
with a warning so one broken block doesn't abort the batch.

Also supports JSON output for CI: hyperframes add --tag vfx --json
This commit is contained in:
Miguel Ángel
2026-05-06 00:52:23 -07:00
parent da95f6c7ad
commit d9d4df4265
3 changed files with 93 additions and 3 deletions
+7 -1
View File
@@ -5,7 +5,13 @@ export {
fetchItemFile,
} from "./remote.js";
export { listRegistryItems, loadAllItems, resolveItem, type ResolveOptions } from "./resolver.js";
export {
listRegistryItems,
loadAllItems,
resolveItem,
resolveItemsByTag,
type ResolveOptions,
} from "./resolver.js";
export {
installItem,
+16
View File
@@ -87,3 +87,19 @@ export async function resolveItem(
}
return fetchItemManifest(entry.name, entry.type, options.baseUrl);
}
/**
* Resolve all items matching a tag. Loads each item's full manifest to check
* tags (the top-level registry.json only has name+type, not tags). Items that
* fail to load are silently skipped.
*/
export async function resolveItemsByTag(
tag: string,
options: ResolveOptions = {},
): Promise<RegistryItem[]> {
const entries = await listRegistryItems(undefined, options);
const allItems = await loadAllItems(entries, { ...options, onWarn: () => {} });
return allItems.filter(
(item) => "tags" in item && Array.isArray(item.tags) && item.tags.includes(tag),
);
}