2026-07-04 22:53:10 +00:00
|
|
|
#!/usr/bin/env node
|
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 20:33:48 +00:00
|
|
|
/**
|
|
|
|
|
* @agent-manifest
|
|
|
|
|
* name: approve
|
|
|
|
|
* title: Draft Approver
|
|
|
|
|
* class: plumbing
|
|
|
|
|
* trigger: manual <slug> [--force]
|
|
|
|
|
* description: Approve a draft: SEO gate, then promote it into the blog, build, go live. No LLM.
|
|
|
|
|
* model: -
|
|
|
|
|
* prompt: -
|
|
|
|
|
* skills: -
|
|
|
|
|
* tools: lib/publish.mjs
|
|
|
|
|
* reads: -
|
|
|
|
|
* writes: -
|
|
|
|
|
* created: 2026-07-04
|
|
|
|
|
* @end
|
|
|
|
|
*/
|
2026-07-04 22:53:10 +00:00
|
|
|
// Manually approve a draft: SEO gate, then promote it into the blog, build, go live.
|
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 20:33:48 +00:00
|
|
|
// Usage: node agents/scripts/approve.mjs <slug> [--force]
|
2026-07-04 22:53:10 +00:00
|
|
|
import { existsSync } from "node:fs";
|
|
|
|
|
import { dirname, resolve, join } from "node:path";
|
|
|
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
|
import { loadJson } from "./lib/util.mjs";
|
|
|
|
|
import { promoteDraft } from "./lib/publish.mjs";
|
|
|
|
|
import { runSeoReview } from "./seo-review.mjs";
|
|
|
|
|
|
|
|
|
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
|
|
|
const PIPELINE = resolve(HERE, "..");
|
|
|
|
|
const cfg = loadJson(join(PIPELINE, "config.json"));
|
|
|
|
|
const root = cfg.paths.projectRoot;
|
|
|
|
|
|
|
|
|
|
const args = process.argv.slice(2);
|
|
|
|
|
const force = args.includes("--force");
|
|
|
|
|
const slug = args.find((a) => !a.startsWith("--"));
|
|
|
|
|
if (!slug) {
|
|
|
|
|
console.error("Usage: approve.mjs <slug> [--force]");
|
|
|
|
|
process.exit(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const draftDir = join(root, cfg.paths.draftsDir, slug);
|
|
|
|
|
if (!existsSync(join(draftDir, "index.mdx"))) {
|
|
|
|
|
console.error(`[approve] no draft at ${join(draftDir, "index.mdx")}`);
|
|
|
|
|
process.exit(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SEO Specialist gate.
|
|
|
|
|
if (cfg.seo?.blockApproveOnFail && !force) {
|
|
|
|
|
const auditPath = join(draftDir, "seo-review.json");
|
|
|
|
|
let audit = existsSync(auditPath) ? loadJson(auditPath) : null;
|
|
|
|
|
if (!audit) {
|
|
|
|
|
console.log("[approve] no SEO audit found — running the SEO Specialist now…");
|
|
|
|
|
audit = await runSeoReview(slug, { published: false });
|
|
|
|
|
}
|
|
|
|
|
if (!audit) {
|
|
|
|
|
console.error("[approve] could not obtain an SEO audit. Re-run, or use --force to override.");
|
|
|
|
|
process.exit(1);
|
|
|
|
|
}
|
|
|
|
|
const minScore = cfg.seo.minScore ?? 85;
|
|
|
|
|
if (audit.verdict === "fail" || (audit.overall ?? 0) < minScore) {
|
|
|
|
|
console.error(
|
|
|
|
|
`[approve] BLOCKED by SEO gate: ${audit.verdict} · ${audit.overall}/${minScore} min.\n` +
|
|
|
|
|
(audit.blocking?.length ? " blocking:\n - " + audit.blocking.join("\n - ") + "\n" : "") +
|
|
|
|
|
` Review ${auditPath}, revise the draft, then re-approve (or use --force to override).`
|
|
|
|
|
);
|
|
|
|
|
process.exit(1);
|
|
|
|
|
}
|
|
|
|
|
console.log(`[approve] SEO gate passed: ${audit.verdict} · ${audit.overall}`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
console.log("[approve] publishing…");
|
|
|
|
|
const { url, taxonomyAdded } = await promoteDraft(cfg, slug);
|
|
|
|
|
if (taxonomyAdded.length) console.log(`[approve] registered in blog-data.js: ${taxonomyAdded.join(", ")}`);
|
|
|
|
|
console.log(`[approve] LIVE → ${url}`);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error(`[approve] ${e.message}`);
|
|
|
|
|
process.exit(1);
|
|
|
|
|
}
|