···22import { command, flag } from "cmd-ts";
33import { log, spinner } from "@clack/prompts";
44import * as path from "node:path";
55-import { findConfig, loadConfig, loadState, saveState } from "../lib/config";
55+import { findConfig, loadConfig, loadState, saveState } from "../lib/config.ts";
66import {
77- loadCredentials,
88- listAllCredentials,
97 getCredentials,
1010-} from "../../../cli/src/lib/credentials";
88+ listAllCredentials,
99+ loadCredentials,
1010+} from "../../../cli/src/lib/credentials.ts";
1111import type { Agent } from "@atproto/api";
1212-import { createAgent, listDocuments } from "../../../cli/src/lib/atproto";
1313-import type { ListDocumentsResult } from "../../../cli/src/lib/atproto";
1414-import type { BlogPost, AppPasswordCredentials } from "../../../cli/src/lib/types";
1212+import { createAgent, listDocuments } from "../../../cli/src/lib/atproto.ts";
1313+import type { ListDocumentsResult } from "../../../cli/src/lib/atproto.ts";
1414+import type {
1515+ AppPasswordCredentials,
1616+ BlogPost,
1717+} from "../../../cli/src/lib/types.ts";
1518import {
1616- scanContentDirectory,
1919+ computeNoteHash,
1720 getContentHash,
1821 getTextContent,
2222+ scanContentDirectory,
1923 updateFrontmatterWithAtUri,
2020- computeNoteHash,
2121-} from "../../../cli/src/lib/markdown";
2222-import { exitOnCancel } from "../../../cli/src/lib/prompts";
2424+} from "../../../cli/src/lib/markdown.ts";
2525+import { exitOnCancel } from "../../../cli/src/lib/prompts.ts";
2626+import process from "node:process";
23272428async function matchesPDS(
2529 localPost: BlogPost,
···6266 });
6367 const noteValue = noteResponse.data.value as Record<string, unknown>;
6468 const localDiscoverable = localPost.frontmatter.discoverable ?? true;
6565- const noteDiscoverable = (noteValue.discoverable as boolean | undefined) ?? true;
6969+ const noteDiscoverable =
7070+ (noteValue.discoverable as boolean | undefined) ?? true;
6671 if (
6772 (localPost.frontmatter.theme || undefined) !==
6873 (noteValue.theme as string | undefined) ||
···156161 process.exit(1);
157162 }
158163159159- const { config, configPath: resolvedConfigPath } =
160160- await loadConfig(configPath);
164164+ const { config, configPath: resolvedConfigPath } = await loadConfig(
165165+ configPath,
166166+ );
161167 const configDir = path.dirname(resolvedConfigPath);
162168163169 log.info(`Publication: ${config.publicationUri}`);
···183189184190 // Create agent
185191 const s = spinner();
186186- s.start(`Connecting as ${(credentials as AppPasswordCredentials).pdsUrl}...`);
192192+ s.start(
193193+ `Connecting as ${(credentials as AppPasswordCredentials).pdsUrl}...`,
194194+ );
187195 let agent: Awaited<ReturnType<typeof createAgent>> | undefined;
188196 try {
189197 agent = await createAgent(credentials);
···214222 const allScanned = await scanContentDirectory(contentDir, {
215223 ignorePatterns: config.ignore,
216224 });
217217- const localPosts = allScanned.filter((p) =>
218218- p.filePath.endsWith(".pub.md"),
219219- );
225225+ const localPosts = allScanned.filter((p) => p.filePath.endsWith(".pub.md"));
220226 s.stop(`Found ${localPosts.length} publishable notes (.pub.md)`);
221227222228 // Build a map from atUri -> local post for matching
···255261 contentHash: contentMatchesPDS
256262 ? await getContentHash(localPost.rawContent)
257263 : "",
258258- noteHash: contentMatchesPDS
259259- ? await computeNoteHash(localPost)
260260- : "",
264264+ noteHash: contentMatchesPDS ? await computeNoteHash(localPost) : "",
261265 atUri: doc.uri,
262266 lastPublished: doc.value.publishedAt,
263267 };
+6-3
packages/remanso-cli/src/lib/config.ts
···11import * as fs from "node:fs/promises";
22import * as path from "node:path";
33-import type { PublisherState } from "../../../cli/src/lib/types";
33+import type { PublisherState } from "../../../cli/src/lib/types.ts";
44+import process from "node:process";
4556export interface RemansoConfig {
67 contentDir: string;
···6465 const content = await fs.readFile(resolvedPath, "utf-8");
6566 const parsed = JSON.parse(content) as RemansoConfigFile;
66676767- if (!parsed.atmosphere)
6868+ if (!parsed.atmosphere) {
6869 throw new Error(
6970 `Invalid config: missing "atmosphere" key in ${resolvedPath}`,
7071 );
7272+ }
71737274 const config = parsed.atmosphere;
73757476 if (!config.contentDir) throw new Error("contentDir is required in config");
7575- if (!config.publicationUri)
7777+ if (!config.publicationUri) {
7678 throw new Error("publicationUri is required in config");
7979+ }
77807881 return { config, configPath: resolvedPath };
7982 } catch (error) {