openpencil/packages/cli/src/rpc-data.ts
Danila Poyarkov c3f5189f8f style: tighten import grouping
- Configure oxfmt custom import groups for workspace, app, package, and test aliases
- Keep type imports grouped with their matching source category instead of one global tail group
- Expand the format script to cover formatter config, Vite files, and scripts
2026-05-06 02:22:08 +03:00

15 lines
467 B
TypeScript

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