~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/hud

A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts

0
0
26 lines · 1.2 KB Raw History
// The operator's apps the harnesses serve HUD with (`HUD_APPS`): Grain's,
// as its own repository serves them to HUD, the copy hud-core's tests load
// (crates/hud-core/src/testdata/grain/apps: its app file and its views).
// HUD bundles no view of Grain's, so whatever draws Grain's answers here
// (`hud resolve`, `hud serve`) is given these.

import { readdirSync, readFileSync } from 'node:fs';
import { dirname, join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';

/** The directory, as `HUD_APPS` names it. */
export const apps = resolve(dirname(fileURLToPath(import.meta.url)), '../crates/hud-core/src/testdata/grain/apps');

/** Its views, `[id, document]` by their files' names, sorted. */
export const appViews = () =>
	readdirSync(join(apps, 'views'))
		.filter((f) => f.endsWith('.json'))
		.sort()
		.map((f) => [f.slice(0, -5), JSON.parse(readFileSync(join(apps, 'views', f), 'utf8'))]);

/** Its app files (`<domain>.json` at its top), `[domain, document]`, sorted. */
export const appFiles = () =>
	readdirSync(apps)
		.filter((f) => f.endsWith('.json') && f.slice(0, -5).includes('.'))
		.sort()
		.map((f) => [f.slice(0, -5), JSON.parse(readFileSync(join(apps, f), 'utf8'))]);