seedproject-web/agents/scripts/list-drafts.mjs
Carlos Arias 2c969c0753 feat: content-pipeline/ → agents/ — formalize the agent system in the seed
Adopt the agents/ architecture proven on medellin.co (reference impl):

- Move the content engine to a top-level agents/ dir: orchestrators, prompts,
  config, run.sh, admin console, shared libs. All content-pipeline literals
  repointed (config paths, scripts, admin, LLM-facing prompts/image.md string,
  configure.mjs, new-site.sh, astroagent tokenFile, .gitignore runtime block).
- Every script carries a parseable @agent-manifest header: name, title, class
  (content|operational|runtime|plumbing), trigger, model, prompts, skills (MCP),
  tools, reads/writes tables. 5 content agents + 3 plumbing scripts.
- New agents/catalog.mjs generates the catalog from the headers:
  agents/AGENTS.md (human, grouped by class) + agents/agents.json (machine
  manifest — a clone diffs it against a source to find missing tools/tables/MCP
  before running). configure.mjs regenerates the catalog on every identity
  stamp. No DB table, no watcher.
- config.json gains paths.stateDir/newsDir; publish-tick, write-daily, and
  news-radar read them instead of hardcoding.
- Full cut: content-pipeline/ deleted (the seed has no live crons, so no
  hybrid period needed). Docs updated (AGENTS.md structure + pipeline section,
  README paths).

Clones migrating from content-pipeline/: see medellin.co's
.memory/handoffs/agents-directory-migration.md for the cutover playbook
(one cron set active at a time; migrate drafts/state after repointing cron).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FMQeUnUrAeexcZ7P2Hxa6G
2026-07-11 17:09:15 -05:00

54 lines
1.7 KiB
JavaScript

#!/usr/bin/env node
/**
* @agent-manifest
* name: list-drafts
* title: Draft Lister
* class: plumbing
* trigger: manual
* description: List pending drafts awaiting review. No LLM.
* model: -
* prompt: -
* skills: -
* tools: -
* reads: -
* writes: -
* created: 2026-07-04
* @end
*/
// List pending drafts awaiting review.
// Usage: node agents/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 agents/scripts/approve.mjs ${d.name}\n`);
}