page.ts
This file
Path
packages/agent-kit/src/docs/page.ts
49 lines · 1.1 KiB · TypeScript
Last changed by
Merge build/comments-packages-rest into mainoscabrielbefore adoption38cd503
History of this fileTake it
Merge build/1313-docs into mainoscabrielbefore adoption9000f4e
lines 1–49why, one step back1import { Brand } from "@repo/brand";23import type { CommandDoc } from "../command-doc.ts";4import { code, page } from "../text.ts";5import type { DocEntry, DocSlug } from "./entries.ts";67export interface DocInput {8 readonly commands: readonly CommandDoc[];9 readonly platformUrl: string;10 readonly webUrl: string;11}1213export interface DocPage extends DocEntry {14 readonly markdown: string;15}1617export interface DocSource {18 readonly slug: DocSlug;19 readonly body: (input: DocInput) => readonly string[];20}2122export const written = (23 entry: DocEntry,24 source: DocSource,25 input: DocInput26): DocPage => ({27 ...entry,28 markdown: page([29 `# ${entry.title}`,30 "",31 entry.summary,32 "",33 ...source.body(input),34 ]),35});3637export const cli = (words: string) => code(`${Brand.cli} ${words}`);3839export const shell = (...lines: readonly string[]) => [40 "```sh",41 ...lines,42 "```",43];4445export const withoutHeading = (lines: readonly string[]) => {46 const [first, blank, ...rest] = lines;4748 return first?.startsWith("## ") === true && blank === "" ? rest : lines;49};