// `archilyzer posts import-html … [--dry-run]` — forum // thread pages the operator saved from a browser, imported into a forum-thread // channel (controller/importForumPages.ts). Offline: nothing is fetched. New // posts are appended, a post saved again after an edit is updated, and an // unchanged one is left alone. The index picks them up on its next build. import { isValidChannelSlug } from "../controller/channels"; import { importForumPages } from "../controller/importForumPages"; import { getPaths } from "../lib/paths"; export async function main(opts: { slug: string; inputs: string[]; dryRun: boolean; }): Promise { if (!isValidChannelSlug(opts.slug)) { console.error(`posts import-html: "${opts.slug}" is not a channel slug`); return 2; } const result = await importForumPages({ paths: getPaths(), slug: opts.slug, inputs: opts.inputs, dryRun: opts.dryRun, onLog: (line) => console.log(line), }); if (!result.ok) { console.error(`posts import-html: ${result.error}`); return 1; } for (const p of result.pages) { if (p.skipped) console.log(`skipped ${p.file}: ${p.skipped}`); } return 0; }