packages/cli/src/lib/types.ts 2.5 K raw
1
export interface FrontmatterMapping {
2
	title?: string; // Field name for title (default: "title")
3
	description?: string; // Field name for description (default: "description")
4
	publishDate?: string; // Field name for publish date (default: "publishDate", also checks "pubDate", "date", "createdAt", "created_at")
5
	coverImage?: string; // Field name for cover image (default: "ogImage")
6
	tags?: string; // Field name for tags (default: "tags")
7
	draft?: string; // Field name for draft status (default: "draft")
8
}
9
10
// Strong reference for Bluesky post (com.atproto.repo.strongRef)
11
export interface StrongRef {
12
	uri: string; // at:// URI format
13
	cid: string; // Content ID
14
}
15
16
// Bluesky posting configuration
17
export interface BlueskyConfig {
18
	enabled: boolean;
19
	maxAgeDays?: number; // Only post if published within N days (default: 7)
20
}
21
22
export interface PublisherConfig {
23
	siteUrl: string;
24
	contentDir: string;
25
	imagesDir?: string; // Directory containing cover images
26
	publicDir?: string; // Static/public folder for .well-known files (default: public)
27
	outputDir?: string; // Built output directory for inject command
28
	pathPrefix?: string; // URL path prefix for posts (default: /posts)
29
	publicationUri: string;
30
	pdsUrl?: string;
31
	identity?: string; // Which stored identity to use (matches identifier)
32
	frontmatter?: FrontmatterMapping; // Custom frontmatter field mappings
33
	ignore?: string[]; // Glob patterns for files to ignore (e.g., ["_index.md", "**/drafts/**"])
34
	bluesky?: BlueskyConfig; // Optional Bluesky posting configuration
35
}
36
37
export interface Credentials {
38
	pdsUrl: string;
39
	identifier: string;
40
	password: string;
41
}
42
43
export interface PostFrontmatter {
44
	title: string;
45
	description?: string;
46
	publishDate: string;
47
	tags?: string[];
48
	ogImage?: string;
49
	atUri?: string;
50
	draft?: boolean;
51
}
52
53
export interface BlogPost {
54
	filePath: string;
55
	slug: string;
56
	frontmatter: PostFrontmatter;
57
	content: string;
58
	rawContent: string;
59
}
60
61
export interface BlobRef {
62
	$link: string;
63
}
64
65
export interface BlobObject {
66
	$type: "blob";
67
	ref: BlobRef;
68
	mimeType: string;
69
	size: number;
70
}
71
72
export interface PublisherState {
73
	posts: Record<string, PostState>;
74
}
75
76
export interface PostState {
77
	contentHash: string;
78
	atUri?: string;
79
	lastPublished?: string;
80
	bskyPostRef?: StrongRef; // Reference to corresponding Bluesky post
81
}
82
83
export interface PublicationRecord {
84
	$type: "site.standard.publication";
85
	url: string;
86
	name: string;
87
	description?: string;
88
	icon?: BlobObject;
89
	createdAt: string;
90
	preferences?: {
91
		showInDiscover?: boolean;
92
	};
93
}