commands.ts
62 lines · make-pdf/src/commands.ts at 3f79d81
1/**
2 * Command registry for make-pdf — single source of truth.
3 *
4 * Dependency graph:
5 * commands.ts ──▶ cli.ts (runtime dispatch)
6 * ──▶ gen-skill-docs.ts (generates usage table in SKILL.md)
7 * ──▶ tests (validation)
8 *
9 * Zero side effects. Safe to import from build scripts.
10 */
12export const COMMANDS = new Map<string, {
13 description: string;
14 usage: string;
15 flags?: string[];
16 category: "Primary" | "Setup";
17}>([
18 ["generate", {
19 description: "Render a markdown file to a publication-quality PDF",
20 usage: "generate <input.md> [output.pdf] [options]",
21 category: "Primary",
22 flags: [
23 // Page layout
24 "--margins", "--margin-top", "--margin-right", "--margin-bottom", "--margin-left",
25 "--page-size", "--format",
26 // Structure
27 "--cover", "--toc", "--no-chapter-breaks",
28 // Branding
29 "--watermark", "--header-template", "--footer-template", "--no-confidential",
30 // Output
31 "--page-numbers", "--no-page-numbers", "--tagged", "--no-tagged",
32 "--outline", "--no-outline", "--quiet", "--verbose",
33 // Network
34 "--allow-network",
35 // Metadata
36 "--title", "--author", "--date",
37 ],
38 }],
39 ["preview", {
40 description: "Render markdown to HTML and open it in the browser (fast iteration)",
41 usage: "preview <input.md> [options]",
42 category: "Primary",
43 flags: [
44 "--cover", "--toc", "--no-chapter-breaks", "--watermark",
45 "--no-confidential", "--allow-network",
46 "--title", "--author", "--date",
47 "--quiet", "--verbose",
48 ],
49 }],
50 ["setup", {
51 description: "Verify the browser (Aside, or gstack's own fallback) + pdftotext, then run a smoke test",
52 usage: "setup",
53 category: "Setup",
54 flags: [],
55 }],
56 ["version", {
57 description: "Print make-pdf version",
58 usage: "version",
59 category: "Setup",
60 flags: [],
61 }],
62]);