seedproject-web/content-pipeline/scripts/list-drafts.mjs
Carlos Arias 1559ce017d chore: scaffold SeedProject base (Phase 1)
Clean-room copy of the reusable engines from comiida, with all
instance data, secrets, dependencies, and build output excluded:
- app/         Astro theme skeleton (no comiida blog posts; hero image -> placeholder)
- api/         SeedProject PHP framework (no vendor/.env/config.php)
- content-pipeline/  engine only (scripts/admin/prompts; empty runtime state)
- astroagent.config.json + app/.astroagent/skills

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SYHWLHihq3v9nxNwoPCKSn
2026-07-04 22:53:10 +00:00

38 lines
1.4 KiB
JavaScript

#!/usr/bin/env node
// List pending drafts awaiting review.
// Usage: node content-pipeline/scripts/list-drafts.mjs
import { readdirSync, existsSync, readFileSync } from "node:fs";
import { dirname, resolve, join } from "node:path";
import { fileURLToPath } from "node:url";
import { loadJson, readFrontmatter, fmString } from "./lib/util.mjs";
const HERE = dirname(fileURLToPath(import.meta.url));
const PIPELINE = resolve(HERE, "..");
const cfg = loadJson(join(PIPELINE, "config.json"));
const draftsRoot = join(cfg.paths.projectRoot, cfg.paths.draftsDir);
if (!existsSync(draftsRoot)) {
console.log("No drafts directory yet.");
process.exit(0);
}
const dirs = readdirSync(draftsRoot, { withFileTypes: true }).filter((d) => d.isDirectory());
if (!dirs.length) {
console.log("No drafts pending.");
process.exit(0);
}
console.log(`Pending drafts (${dirs.length}):\n`);
for (const d of dirs) {
const mdx = join(draftsRoot, d.name, "index.mdx");
const hasCover = existsSync(join(draftsRoot, d.name, "cover.jpg"));
let title = "(no index.mdx)";
let cat = "";
if (existsSync(mdx)) {
const fm = readFrontmatter(readFileSync(mdx, "utf8"));
title = fmString(fm, "title") || d.name;
cat = fmString(fm, "category") || "";
}
console.log(`${d.name}`);
console.log(` ${title}${cat ? ` [${cat}]` : ""} cover:${hasCover ? "yes" : "NO"}`);
console.log(` approve: node content-pipeline/scripts/approve.mjs ${d.name}\n`);
}