mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-04 07:19:52 +00:00
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:
@@ -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,
|
||||
|
||||
@@ -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),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user