import { executeRpcCommand } from '@open-pencil/core/rpc' import { isAppMode, requireFile, rpc } from '#cli/app-client' import { loadDocument } from '#cli/headless' export async function loadRpcData( file: string | undefined, command: string, args?: unknown ): Promise { if (isAppMode(file)) return rpc(command, args) const graph = await loadDocument(requireFile(file)) return executeRpcCommand(graph, command, args) as Result }