codeMapDoc

tcmts.share.codeMapDoc · #lqxuy32z · function · runs on the server

uses tcmts.share.shareNow, which uses process

A definition's doc, its first paragraph as plain text ("" if it has none), for the graph's panel: by name.

import { HttpError } from "#codebase/tcmts/atproto/lib/server";
import { docSummary } from "#codebase/tcmts/cli/pages";
import { namesNow, shareNow } from "#codebase/tcmts/share";

export async function codeMapDoc(path: string): Promise<string> {
  const s = shareNow();
  if (!s.signedIn) throw new HttpError(401, "Sign in to see this server's code.");
  const row = namesNow(s).find((r) => r.path === path);
  const rec = row && s.cb.store.getDef(row.hash);
  return (rec && docSummary(rec)) ?? "";
}

uses

used by