@begryp/blog-automation-core

中文文档
0.2.11发布于 2026/11/03MITTypeScriptES Module近 30 天下载 1772

Core orchestrator, Zod contracts, and hexagonal ports for the Begryp blog automation engine.

原始使用文档
文档目录4 节
  1. Features
  2. Usage
  3. Quick wiring (recommended)
  4. Manual wiring

@begryp/blog-automation-core

Framework-agnostic domain engine for autonomous blog generation, quality gate evaluation, deduplication, and stage checkpointing.

Features

  • Zod Domain Contracts: Pure schema definitions for Tenants, Topics, Drafts, QA Reports, and Runs.
  • LLM Provider Adapters: OpenAIClient, AnthropicClient, GoogleGeminiClient, and OpenAICompatibleClient implementing the LLMClient port with transient-error retry (max 3, exponential backoff), Zod-validated structured output, and invalid-output retry with the validation error appended to the prompt. API keys are never logged or included in error messages.
  • LLMDrafter: Drafts and revises posts via versioned prompts from @begryp/blog-automation-prompts, validated against DraftPostSchema.
  • TopicSource Implementations: LLMTopicSource (proposes topics via LLM, hydrates full Topic objects) and StaticTopicSource (host-provided list for provided/import modes).
  • createEngineFromSettings: One-call wiring factory that selects the provider client, builds the drafter/topic source, and returns a configured AutomationEngine from a tenant profile and host adapters.
  • Pure QA Rule Registry: Deterministic SEO rules (meta limits, banned phrases, alt text, internal links), GEO rules (summary, citations, direct answers), and Risk rules (YMYL medical claims).
  • Topic Deduplication: Jaccard similarity engine with strict tenant isolation (rejection threshold) and cross-tenant duplicate flagging.
  • Stage-Checkpointing Orchestrator: Idempotent state machine with pause/resume, automatic revision loop (max 1), and YMYL safety enforcement.
  • Safety Invariants: Enforced in code and schema (1 post/day ceiling, YMYL review mandate, keyRef security).

Usage

import { createEngineFromSettings } from '@begryp/blog-automation-core';

const engine = createEngineFromSettings({
  tenant,                          // TenantProfile
  apiKey: await keyVault.resolveKey(tenant.llm.keyRef),
  publisher: payloadPublisher,     // Publisher port adapter
  runStore: payloadRunStore,       // RunStore port adapter
  keyVault: payloadKeyVault        // KeyVault port adapter
});

const run = await engine.runPipeline(tenant);

Manual wiring

import {
  AnthropicClient,
  LLMDrafter,
  LLMTopicSource,
  DefaultClock,
  DefaultIdGenerator,
  DefaultQAGate,
  AutomationEngine
} from '@begryp/blog-automation-core';

const idGen = new DefaultIdGenerator();
const llm = new AnthropicClient({ apiKey, model: 'claude-sonnet-4-20250514' });

const engine = new AutomationEngine({
  topicSource: new LLMTopicSource({ llm, idGen }),
  drafter: new LLMDrafter({ llm }),
  qaGate: new DefaultQAGate(),
  publisher,
  runStore,
  keyVault,
  clock: new DefaultClock(),
  idGen
});

版本与发布记录

@begryp/blog-automation-core 共发布 12 个版本,首次发布于 2026/10/15;过去 12 个月发布了 12 个版本。

版本发布日期距今
0.2.11latest2026/11/036 天前
0.2.102026/11/036 天前
0.2.92026/10/1623 天前
0.2.72026/10/1623 天前
0.2.62026/10/1623 天前
0.2.52026/10/1623 天前

关于 @begryp/blog-automation-core 的常见问题

@begryp/blog-automation-core 是什么?

Core orchestrator, Zod contracts, and hexagonal ports for the Begryp blog automation engine.

如何安装 @begryp/blog-automation-core?

在项目目录运行 npm install @begryp/blog-automation-core,或使用 pnpm add / yarn add / bun add。

@begryp/blog-automation-core 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@begryp/blog-automation-core 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@begryp/blog-automation-core 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.9.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@begryp/blog-automation-core 可以商用吗?

@begryp/blog-automation-core 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@begryp/blog-automation-core 的下载量有多少?

根据 npm 官方下载统计,@begryp/blog-automation-core 在 2026/10/08 – 2026/11/06 这 30 天内被下载 1,772 次,日均约 59 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@begryp/blog-automation-core 还在维护吗?

最新版本 0.2.11 发布于 2026/11/03(6 天前);至今共发布 12 个版本,其中过去 12 个月发布了 12 个;首次发布于 2026/10/15。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。