···44 genFileDiff,
55 printFileDiff,
66 readAllLexicons,
77-} from "../util.ts";
88-import { genClientApi } from "../codegen/client.ts";
99-import { formatGeneratedFiles } from "../codegen/util.ts";
77+} from "../../util.ts";
88+import { genClientApi } from "../../codegen/client.ts";
99+import { formatGeneratedFiles } from "../../codegen/util.ts";
10101111const command = new Command()
1212 .description("Generate a TS client API")
+2-2
lex-cli/cmd/gen-md.ts
cli/commands/lex/gen-md.ts
···11import { Command } from "@cliffy/command";
22-import { readAllLexicons } from "../util.ts";
33-import * as mdGen from "../mdgen/index.ts";
22+import { readAllLexicons } from "../../util.ts";
33+import * as mdGen from "../../mdgen/index.ts";
44import process from "node:process";
5566const isDeno = typeof Deno !== "undefined";
···11import { Command } from "@cliffy/command";
22-import { genTsObj, readAllLexicons } from "../util.ts";
22+import { genTsObj, readAllLexicons } from "../../util.ts";
3344const command = new Command()
55 .description("Generate a TS file that exports an array of lexicons")
···11-/**
22- * # AT Protocol Lexicon CLI
33- *
44- * A command-line interface for generating docs, servers, and clients
55- * from AT Protocol lexicon files.
66- *
77- * Turn lexicon files into:
88- * - Markdown documentation
99- * - Server implementation
1010- * - TypeScript objects
1111- * - Client implementation
1212- *
1313- * ## Installation
1414- * ```bash
1515- * deno install -g jsr:@atp/lex-cli@latest --name lex-cli
1616- * ```
1717- * Alternatively, you can use it without installation by referring to
1818- * it as `jsr:@atp/lex-cli` instead of `lex-cli`.
1919- *
2020- * @example Generate Server
2121- * ```bash
2222- * lex-cli gen-server -i <path/to/lexicon/dir> -o <output/path>
2323- * ```
2424- *
2525- * @example Generate Client
2626- * ```bash
2727- * lex-cli gen-api -i <path/to/lexicon/dir> -o <output/path>
2828- * ```
2929- *
3030- * @module
3131- */
3232-import { Command } from "@cliffy/command";
3333-import { genApi, genMd, genServer, genTsObj } from "./cmd/index.ts";
3434-import process from "node:process";
3535-3636-const isDeno = typeof Deno !== "undefined";
3737-3838-await new Command()
3939- .name("lex-cli")
4040- .description("Lexicon CLI")
4141- .command("gen-api", genApi)
4242- .command("gen-md", genMd)
4343- .command("gen-server", genServer)
4444- .command("gen-ts-obj", genTsObj)
4545- .parse(isDeno ? Deno.args : process.argv.slice(2));
lex-cli/types.ts
cli/types.ts
lex-cli/util.ts
cli/util.ts
+2
xrpc/util.ts
···2323 }
2424 } as typeof globalThis.ReadableStream);
25252626+/** Check whether an XRPC response object is an error */
2627export function isErrorResponseBody(v: unknown): v is ErrorResponseBody {
2728 return errorResponseBody.safeParse(v).success;
2829}
29303131+/** Get the HTTP method of lexicon procedure or query schema */
3032export function getMethodSchemaHTTPMethod(
3133 schema: LexXrpcProcedure | LexXrpcQuery,
3234): "post" | "get" {