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
37 lines
1.4 KiB
JavaScript
37 lines
1.4 KiB
JavaScript
import { spawn } from "node:child_process";
|
|
|
|
function run(cmd, args, opts = {}) {
|
|
return new Promise((resolve, reject) => {
|
|
let out = "";
|
|
let err = "";
|
|
const child = spawn(cmd, args, { stdio: ["ignore", "pipe", "pipe"], ...opts });
|
|
child.stdout.on("data", (b) => (out += b));
|
|
child.stderr.on("data", (b) => (err += b));
|
|
child.on("error", reject);
|
|
child.on("close", (code) =>
|
|
code === 0
|
|
? resolve(out)
|
|
: reject(new Error(`git ${args.join(" ")} exited ${code}: ${err.trim()}`))
|
|
);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Stage the given paths (relative to projectRoot) and commit if anything changed.
|
|
* Best-effort: never throws, so a git hiccup can't block a live publish. Returns
|
|
* the new commit hash, or null if nothing was staged / git failed.
|
|
* Keeping the working tree committed is what lets the console's git worktree +
|
|
* `merge --ff-only` operations run against a clean tree.
|
|
*/
|
|
export async function gitCommitPaths(projectRoot, paths, message) {
|
|
try {
|
|
await run("git", ["-C", projectRoot, "add", "--", ...paths]);
|
|
const staged = await run("git", ["-C", projectRoot, "diff", "--cached", "--name-only"]);
|
|
if (!staged.trim()) return null;
|
|
await run("git", ["-C", projectRoot, "commit", "-q", "-m", message]);
|
|
return (await run("git", ["-C", projectRoot, "rev-parse", "HEAD"])).trim();
|
|
} catch (e) {
|
|
console.warn(`[git] commit skipped: ${e.message}`);
|
|
return null;
|
|
}
|
|
}
|