lovpen-cli

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

公众号排版 · WeChat Typesetter

公众号排版 · WeChat Typesetter

把用户的 Markdown 交给 Lovpen 已验收的真实渲染链。默认生成与
LovpenReact → 微信公众号 → extractWechatClipboardHTML
相同契约的内联 HTML;只有用户明确要求独立网页时才输出带
<style>
的完整文档。
Public identifier:
lovpen-cli
intentionally matches the Lovpen product and installed command. Do not rewrite it as
lov-lovpen-cli
; that would break the existing
$lovpen-cli
trigger and installation paths.
将用户的 Markdown 交给 Lovpen 已验收的真实渲染链。默认生成与
LovpenReact → 微信公众号 → extractWechatClipboardHTML
相同契约的内联 HTML;只有用户明确要求独立网页时才输出带
<style>
的完整文档。
公共标识符:
lovpen-cli
有意与 Lovpen 产品和已安装命令保持一致。请勿将其改写为
lov-lovpen-cli
;那会破坏现有的
$lovpen-cli
触发和安装路径。

Triggers

触发条件

Activate when

以下情况激活

  • “/lovpen-cli 把这篇 Markdown 用 Typora 套装排版成微信公众号 HTML”。
  • “列出 Lovpen 可用的主题、代码高亮和模板”。
  • “检查 lovpen-cli 能不能用”“用 JSON 返回 Lovpen 渲染证据”。
  • “Use /lovpen-cli to render this Markdown with Lovpen.”
  • “Render this Markdown with the Typora Newsprint kit for WeChat.”
  • “Render this Markdown as a self-contained Lovpen HTML file.”
  • “/lovpen-cli 把这篇 Markdown 用 Typora 套装排版成微信公众号 HTML”。
  • “列出 Lovpen 可用的主题、代码高亮和模板”。
  • “检查 lovpen-cli 能不能用”“用 JSON 返回 Lovpen 渲染证据”。
  • “使用 /lovpen-cli 让 Lovpen 渲染这篇 Markdown。”
  • “使用 Typora Newsprint 套装将这篇 Markdown 渲染为微信公众号内容。”
  • “将这篇 Markdown 渲染为自包含的 Lovpen HTML 文件。”

Do not activate when

以下情况不激活

  • 用户要创建、重构或修复 CLI 本身;交给
    lov-cli-creator
    或目标项目开发流程。
  • 用户要发布、上传或上架这个 Skill;交给
    lov-skill-publisher
    。
  • 用户要直接发布到微信公众号、知乎、小红书或 Twitter;本 Skill 只生成 HTML,平台发布由对应产品能力负责。
  • 用户只要润色 Markdown 文本而不需要 Lovpen 渲染;使用写作或编辑能力。
  • “给 Lovpen 项目新增一个 React 组件”属于应用开发,不触发本 Skill。
  • 用户要创建、重构或修复 CLI 本身;交给
    lov-cli-creator
    或目标项目开发流程。
  • 用户要发布、上传或上架这个 Skill;交给
    lov-skill-publisher
    。
  • 用户要直接发布到微信公众号、知乎、小红书或 Twitter;本 Skill 只生成 HTML,平台发布由对应产品能力负责。
  • 用户只需要润色 Markdown 文本而不需要 Lovpen 渲染;使用写作或编辑能力。
  • “给 Lovpen 项目新增一个 React 组件”属于应用开发,不触发本 Skill。

User Profile (cross-session)

用户 Profile(跨会话)

Every invocation reads the shared
user-profile/v1
contract declared in
skill.yaml
. Resolve the CLI path, Lovpen project root, output directory, default template kit, theme, and highlight in this order: current request, project context,
skills.lovpen-cli.records
, shared preferences, workspace Profile, then safe defaults.
Persist only a directly stated durable preference. For example, when the user explicitly says to always use one theme:
bash
python3 "$SKILL_DIR/scripts/profile_store.py" record \
  --skill-id lovpen-cli \
  --path records.default_theme \
  --value '"wabi-sabi"' \
  --confirm
Report the saved Profile path. Never persist inferred project paths, document contents, credentials, or tokens. Read
references/user-profile.md
for the complete contract.
每次调用都会读取
skill.yaml
中声明的共享
user-profile/v1
契约。按以下顺序解析 CLI 路径、Lovpen 项目根目录、输出目录、默认模板套装、主题和高亮:当前请求、项目上下文、
skills.lovpen-cli.records
、共享偏好、工作区 Profile,然后使用安全默认值。
仅持久化用户直接明确说明的长期偏好。例如,当用户明确表示始终使用某个主题时:
bash
python3 "$SKILL_DIR/scripts/profile_store.py" record \
  --skill-id lovpen-cli \
  --path records.default_theme \
  --value '"wabi-sabi"' \
  --confirm
报告已保存的 Profile 路径。绝不持久化推断得到的项目路径、文档内容、凭据或令牌。完整契约见
references/user-profile.md
。

Skill Group Composition

Skill 组合

Read
references/skill-composition.md
before invoking an adjacent Skill.
lovpen-cli
owns intent routing and verified use of the existing CLI. The CLI is the product backend, not an embedded Skill module or copied implementation.
调用相邻 Skill 前阅读
references/skill-composition.md
。
lovpen-cli
负责意图路由以及对现有 CLI 的经验证使用。CLI 是产品后端,不是嵌入式 Skill 模块,也不是复制出来的实现。

Workflow (MANDATORY)

工作流(必须执行)

Follow these steps in order.
严格按以下顺序执行这些步骤。

Step 0: Resolve the Skill, Profile, and CLI

步骤 0:解析 Skill、Profile 和 CLI

  1. Resolve
    SKILL_DIR
    from the active Skill context.
  2. Read
    skill.yaml
    ,
    references/skill-composition.md
    , and
    references/cli-contract.md
    completely.
  3. Confirm
    $SKILL_DIR/scripts/run_lovpen_cli.py
    exists.
  4. Resolve the backend through the wrapper. It accepts an explicit CLI,
    LOVPEN_CLI
    , an installed
    lovpen-cli
    on
    PATH
    , or a ready project root from the request,
    LOVPEN_PROJECT_ROOT
    , Profile, or current directory.
  5. Do not store a machine-specific resolved path in this Skill source.
Manual resolution check:
bash
python3 "$SKILL_DIR/scripts/run_lovpen_cli.py" \
  --project-root PROJECT_ROOT \
  --resolve-only
  1. 从当前 Skill 上下文解析
    SKILL_DIR
    。
  2. 完整读取
    skill.yaml
    、
    references/skill-composition.md
    和
    references/cli-contract.md
    。
  3. 确认
    $SKILL_DIR/scripts/run_lovpen_cli.py
    存在。
  4. 通过包装器解析后端。它接受显式指定的 CLI、
    LOVPEN_CLI
    、
    PATH
    中已安装的
    lovpen-cli
    ,或者从请求、
    LOVPEN_PROJECT_ROOT
    、Profile 或当前目录解析出的可用项目根目录。
  5. 不要在此 Skill 的源代码中存储机器特定的解析路径。
手动解析检查:
bash
python3 "$SKILL_DIR/scripts/run_lovpen_cli.py" \
  --project-root PROJECT_ROOT \
  --resolve-only

Step 1: Map the user task to the narrowest command

步骤 1:将用户任务映射到最窄的命令

  • Runtime health and dependencies:
    doctor
    .
  • CLI identity and readiness:
    info
    .
  • Machine-readable command discovery:
    capabilities
    .
  • Available themes, highlights, templates, and template kits:
    resources
    .
  • Markdown to WeChat-copy HTML or a self-contained HTML artifact:
    render
    .
For
render
, resolve the input Markdown, output HTML, format, template kit or individual resources, title, and author. The safe format default is
wechat
. If the output is omitted, use
INPUT_STEM.lovpen.wechat.html
; use
INPUT_STEM.lovpen.html
only for explicitly requested
standalone
output. Without a named kit, safe resource defaults are theme
wabi-sabi
, highlight
default
, and no HTML template.
  • 运行时健康状态和依赖项:
    doctor
    。
  • CLI 身份和就绪状态:
    info
    。
  • 机器可读的命令发现:
    capabilities
    。
  • 可用的主题、高亮、模板和模板套装:
    resources
    。
  • 将 Markdown 转换为微信复制 HTML 或自包含 HTML 文件:
    render
    。
对于
render
,解析输入 Markdown、输出 HTML、格式、模板套装或单项资源、标题和作者。安全的格式默认值为
wechat
。如果省略输出,则使用
INPUT_STEM.lovpen.wechat.html
;只有明确请求
standalone
输出时才使用
INPUT_STEM.lovpen.html
。未指定套装时,安全的资源默认值为主题
wabi-sabi
、高亮
default
,且不使用 HTML 模板。

Step 2: Run doctor before a material render

步骤 2:在实质性渲染前运行 doctor

Use global
--json
before the subcommand:
bash
python3 "$SKILL_DIR/scripts/run_lovpen_cli.py" \
  --project-root PROJECT_ROOT \
  -- --json doctor
Continue only when the JSON envelope has
ok: true
and
data.ready: true
. For WeChat format, confirm the
browser
,
clipboard_renderer
, and
article_transforms
checks are also true. On failure, return the CLI or wrapper
context_id
, failed check, and hint.
在子命令之前使用全局
--json
:
bash
python3 "$SKILL_DIR/scripts/run_lovpen_cli.py" \
  --project-root PROJECT_ROOT \
  -- --json doctor
仅当 JSON 封装中包含
ok: true
和
data.ready: true
时继续。对于微信格式,还要确认
browser
、
clipboard_renderer
和
article_transforms
检查也均为 true。失败时,返回 CLI 或包装器的
context_id
、失败检查项和提示。

Step 3: Inspect resources when selection is unresolved

步骤 3:当资源选择尚未确定时检查 resources

Run
resources
before choosing an unverified theme, highlight, or template:
bash
python3 "$SKILL_DIR/scripts/run_lovpen_cli.py" \
  --project-root PROJECT_ROOT \
  -- --json resources
Match theme names or
class_name
exactly. Match highlight and HTML template names exactly. Match a template kit by its exact
id
or
name
; for example, the UI's “Typora Newsprint” selection is
--template-kit typora-newsprint
, not
--template typora
. A kit atomically resolves its theme, highlight, optional HTML layout, and theme color. Do not combine
--template-kit
with
--theme
,
--highlight
, or
--template
.
在选择未经验证的主题、高亮或模板前运行
resources
:
bash
python3 "$SKILL_DIR/scripts/run_lovpen_cli.py" \
  --project-root PROJECT_ROOT \
  -- --json resources
主题名称或
class_name
必须精确匹配。高亮和 HTML 模板名称必须精确匹配。模板套装按其精确的
id
或
name
匹配;例如,UI 中的“Typora Newsprint”选项对应
--template-kit typora-newsprint
,而不是
--template typora
。套装会原子化地解析其主题、高亮、可选的 HTML 布局和主题颜色。不要将
--template-kit
与
--theme
、
--highlight
或
--template
组合使用。

Step 4: Render through the real Lovpen backend

步骤 4:通过真实的 Lovpen 后端渲染

bash
python3 "$SKILL_DIR/scripts/run_lovpen_cli.py" \
  --project-root PROJECT_ROOT \
  -- --json render INPUT.md \
  --output OUTPUT.html \
  --format wechat \
  --template-kit typora-newsprint
For an explicitly requested independent document, pass
--format standalone
and select
--theme
,
--highlight
, and optionally
--template
. Add
--title
or
--author
only when requested or resolved from the current document context. Use
--dry-run
when the user asks to preview the planned write. Never reconstruct a shell command from untrusted input; pass arguments as an array through the supplied wrapper.
bash
python3 "$SKILL_DIR/scripts/run_lovpen_cli.py" \
  --project-root PROJECT_ROOT \
  -- --json render INPUT.md \
  --output OUTPUT.html \
  --format wechat \
  --template-kit typora-newsprint
对于明确请求的独立文档,传入
--format standalone
,并选择
--theme
、
--highlight
和可选的
--template
。仅当用户请求或能够从当前文档上下文中解析到时,才添加
--title
或
--author
。当用户要求预览计划写入的内容时,使用
--dry-run
。绝不根据不可信输入重建 shell 命令;应通过提供的包装器以数组形式传递参数。

Step 5: Validate and report the artifact

步骤 5:验证并报告产物

For a successful render, verify all of the following from the JSON response and filesystem:
  1. ok
    and
    data.written
    are true, unless this was a dry run.
  2. data.renderer_source
    identifies Lovpen's standalone renderer.
  3. The absolute output path exists as a regular file.
  4. data.bytes
    is positive and
    data.sha256
    is a 64-character digest.
  5. data.format
    ,
    renderer_mode
    , theme, highlight, template kit/template, and
    disabled_preview_plugins
    are reported without hiding limitations.
  6. For
    wechat
    ,
    renderer_mode
    is
    wechat-browser-copy
    ,
    clipboard_source
    identifies
    extractWechatClipboardHTML
    , the output root is
    <section class="lovpen-renderer">
    , inline styles are present, and no
    <style>
    tag remains.
  7. For
    standalone
    ,
    renderer_mode
    is
    standalone-headless-core
    , the document contains its embedded
    <style>
    , and browser-only disabled plugins remain explicit.
Lead with the output file, then report resource choices and verification. Do not blur the two contracts. WeChat format runs Lovpen's shared preview-plugin and clipboard extractors in Chromium using the same built-in defaults and resolved kit as the UI; standalone format intentionally remains the DOM-free document path. If the UI has additional persisted per-document settings that were not provided to the CLI, report that scope instead of claiming those settings were reproduced.
对于成功完成的渲染,从 JSON 响应和文件系统中验证以下所有项目:
  1. ok
    和
    data.written
    均为 true,除非此次执行是 dry run。
  2. data.renderer_source
    标识 Lovpen 的独立渲染器。
  3. 绝对输出路径存在,且是常规文件。
  4. data.bytes
    大于零,
    data.sha256
    是长度为 64 个字符的摘要。
  5. 如实报告
    data.format
    、
    renderer_mode
    、主题、高亮、模板套装或模板,以及
    disabled_preview_plugins
    ,不得隐藏相关限制。
  6. 对于
    wechat
    ,
    renderer_mode
    应为
    wechat-browser-copy
    ,
    clipboard_source
    应标识
    extractWechatClipboardHTML
    ,输出根节点应为
    <section class="lovpen-renderer">
    ,存在内联样式,并且不残留
    <style>
    标签。
  7. 对于
    standalone
    ,
    renderer_mode
    应为
    standalone-headless-core
    ,文档应包含内嵌的
    <style>
    ,并且仅支持浏览器的禁用插件仍需明确列出。
先给出输出文件,然后报告资源选择和验证结果。不要混淆这两种契约。微信格式会在 Chromium 中运行 Lovpen 共享的预览插件和剪贴板提取器,使用与 UI 相同的内置默认值和解析后的套装;独立格式则有意保持 DOM-free 文档路径。如果 UI 中存在未提供给 CLI 的其他持久化逐文档设置,请报告该范围,而不要声称这些设置已被复现。

Dependencies

依赖项

  • Python 3.9+
  • Node.js 20+
  • Chrome or Chromium 109+ for WeChat format
  • lovpen-cli
    0.2.0 on
    PATH
    , or a Lovpen source checkout whose
    agent-harness/lov-cli.json
    status is
    ready
  • Installed Lovpen workspace dependencies, including Vite, for source-checkout mode
No credentials are required for local rendering.
  • Python 3.9+
  • Node.js 20+
  • 微信格式需要 Chrome 或 Chromium 109+
  • PATH
    中包含
    lovpen-cli
    0.2.0,或者使用
    agent-harness/lov-cli.json
    状态为
    ready
    的 Lovpen 源码检出
  • 源码检出模式需要已安装的 Lovpen 工作区依赖项,包括 Vite
本地渲染不需要任何凭据。

Validation

验证

bash
python3 "$SKILL_DIR/scripts/validate_skill.py" "$SKILL_DIR"
python3 "$SKILL_DIR/scripts/run_lovpen_cli.py" \
  --project-root PROJECT_ROOT \
  -- --json doctor
bash
python3 "$SKILL_DIR/scripts/validate_skill.py" "$SKILL_DIR"
python3 "$SKILL_DIR/scripts/run_lovpen_cli.py" \
  --project-root PROJECT_ROOT \
  -- --json doctor