lovpen-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese公众号排版 · WeChat Typesetter
公众号排版 · WeChat Typesetter
把用户的 Markdown 交给 Lovpen 已验收的真实渲染链。默认生成与
相同契约的内联
HTML;只有用户明确要求独立网页时才输出带 的完整文档。
LovpenReact → 微信公众号 → extractWechatClipboardHTML<style>Public identifier: intentionally matches the Lovpen product and
installed command. Do not rewrite it as ; that would break the
existing trigger and installation paths.
lovpen-clilov-lovpen-cli$lovpen-cli将用户的 Markdown 交给 Lovpen 已验收的真实渲染链。默认生成与
相同契约的内联
HTML;只有用户明确要求独立网页时才输出带 的完整文档。
LovpenReact → 微信公众号 → extractWechatClipboardHTML<style>公共标识符: 有意与 Lovpen 产品和已安装命令保持一致。请勿将其改写为 ;那会破坏现有的 触发和安装路径。
lovpen-clilov-lovpen-cli$lovpen-cliTriggers
触发条件
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 contract declared in
. Resolve the CLI path, Lovpen project root, output directory,
default template kit, theme, and highlight in this order: current request,
project context, , shared preferences, workspace
Profile, then safe defaults.
user-profile/v1skill.yamlskills.lovpen-cli.recordsPersist 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"' \
--confirmReport the saved Profile path. Never persist inferred project paths, document
contents, credentials, or tokens. Read for the
complete contract.
references/user-profile.md每次调用都会读取 中声明的共享 契约。按以下顺序解析 CLI 路径、Lovpen 项目根目录、输出目录、默认模板套装、主题和高亮:当前请求、项目上下文、、共享偏好、工作区 Profile,然后使用安全默认值。
skill.yamluser-profile/v1skills.lovpen-cli.records仅持久化用户直接明确说明的长期偏好。例如,当用户明确表示始终使用某个主题时:
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.mdSkill Group Composition
Skill 组合
Read before invoking an adjacent Skill.
owns intent routing and verified use of the existing CLI. The CLI
is the product backend, not an embedded Skill module or copied implementation.
references/skill-composition.mdlovpen-cli调用相邻 Skill 前阅读 。 负责意图路由以及对现有 CLI 的经验证使用。CLI 是产品后端,不是嵌入式 Skill 模块,也不是复制出来的实现。
references/skill-composition.mdlovpen-cliWorkflow (MANDATORY)
工作流(必须执行)
Follow these steps in order.
严格按以下顺序执行这些步骤。
Step 0: Resolve the Skill, Profile, and CLI
步骤 0:解析 Skill、Profile 和 CLI
- Resolve from the active Skill context.
SKILL_DIR - Read ,
skill.yaml, andreferences/skill-composition.mdcompletely.references/cli-contract.md - Confirm exists.
$SKILL_DIR/scripts/run_lovpen_cli.py - Resolve the backend through the wrapper. It accepts an explicit CLI,
, an installed
LOVPEN_CLIonlovpen-cli, or a ready project root from the request,PATH, Profile, or current directory.LOVPEN_PROJECT_ROOT - 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- 从当前 Skill 上下文解析 。
SKILL_DIR - 完整读取 、
skill.yaml和references/skill-composition.md。references/cli-contract.md - 确认 存在。
$SKILL_DIR/scripts/run_lovpen_cli.py - 通过包装器解析后端。它接受显式指定的 CLI、、
LOVPEN_CLI中已安装的PATH,或者从请求、lovpen-cli、Profile 或当前目录解析出的可用项目根目录。LOVPEN_PROJECT_ROOT - 不要在此 Skill 的源代码中存储机器特定的解析路径。
手动解析检查:
bash
python3 "$SKILL_DIR/scripts/run_lovpen_cli.py" \
--project-root PROJECT_ROOT \
--resolve-onlyStep 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 , resolve the input Markdown, output HTML, format, template kit or
individual resources, title, and author. The safe format default is .
If the output is omitted, use ; use
only for explicitly requested output.
Without a named kit, safe resource defaults are theme , highlight
, and no HTML template.
renderwechatINPUT_STEM.lovpen.wechat.htmlINPUT_STEM.lovpen.htmlstandalonewabi-sabidefault- 运行时健康状态和依赖项:。
doctor - CLI 身份和就绪状态:。
info - 机器可读的命令发现:。
capabilities - 可用的主题、高亮、模板和模板套装:。
resources - 将 Markdown 转换为微信复制 HTML 或自包含 HTML 文件:。
render
对于 ,解析输入 Markdown、输出 HTML、格式、模板套装或单项资源、标题和作者。安全的格式默认值为 。如果省略输出,则使用 ;只有明确请求 输出时才使用 。未指定套装时,安全的资源默认值为主题 、高亮 ,且不使用 HTML 模板。
renderwechatINPUT_STEM.lovpen.wechat.htmlstandaloneINPUT_STEM.lovpen.htmlwabi-sabidefaultStep 2: Run doctor before a material render
步骤 2:在实质性渲染前运行 doctor
Use global before the subcommand:
--jsonbash
python3 "$SKILL_DIR/scripts/run_lovpen_cli.py" \
--project-root PROJECT_ROOT \
-- --json doctorContinue only when the JSON envelope has and .
For WeChat format, confirm the , , and
checks are also true. On failure, return the CLI or wrapper
, failed check, and hint.
ok: truedata.ready: truebrowserclipboard_rendererarticle_transformscontext_id在子命令之前使用全局 :
--jsonbash
python3 "$SKILL_DIR/scripts/run_lovpen_cli.py" \
--project-root PROJECT_ROOT \
-- --json doctor仅当 JSON 封装中包含 和 时继续。对于微信格式,还要确认 、 和 检查也均为 true。失败时,返回 CLI 或包装器的 、失败检查项和提示。
ok: truedata.ready: truebrowserclipboard_rendererarticle_transformscontext_idStep 3: Inspect resources when selection is unresolved
步骤 3:当资源选择尚未确定时检查 resources
Run before choosing an unverified theme, highlight, or template:
resourcesbash
python3 "$SKILL_DIR/scripts/run_lovpen_cli.py" \
--project-root PROJECT_ROOT \
-- --json resourcesMatch theme names or exactly. Match highlight and HTML template
names exactly. Match a template kit by its exact or ; for example,
the UI's “Typora Newsprint” selection is , not
. A kit atomically resolves its theme, highlight, optional
HTML layout, and theme color. Do not combine with ,
, or .
class_nameidname--template-kit typora-newsprint--template typora--template-kit--theme--highlight--template在选择未经验证的主题、高亮或模板前运行 :
resourcesbash
python3 "$SKILL_DIR/scripts/run_lovpen_cli.py" \
--project-root PROJECT_ROOT \
-- --json resources主题名称或 必须精确匹配。高亮和 HTML 模板名称必须精确匹配。模板套装按其精确的 或 匹配;例如,UI 中的“Typora Newsprint”选项对应 ,而不是 。套装会原子化地解析其主题、高亮、可选的 HTML 布局和主题颜色。不要将 与 、 或 组合使用。
class_nameidname--template-kit typora-newsprint--template typora--template-kit--theme--highlight--templateStep 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-newsprintFor an explicitly requested independent document, pass
and select , , and optionally . Add
or only when requested or resolved from the current document
context. Use 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.
--format standalone--theme--highlight--template--title--author--dry-runbash
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对于明确请求的独立文档,传入 ,并选择 、 和可选的 。仅当用户请求或能够从当前文档上下文中解析到时,才添加 或 。当用户要求预览计划写入的内容时,使用 。绝不根据不可信输入重建 shell 命令;应通过提供的包装器以数组形式传递参数。
--format standalone--theme--highlight--template--title--author--dry-runStep 5: Validate and report the artifact
步骤 5:验证并报告产物
For a successful render, verify all of the following from the JSON response and
filesystem:
- and
okare true, unless this was a dry run.data.written - identifies Lovpen's standalone renderer.
data.renderer_source - The absolute output path exists as a regular file.
- is positive and
data.bytesis a 64-character digest.data.sha256 - ,
data.format, theme, highlight, template kit/template, andrenderer_modeare reported without hiding limitations.disabled_preview_plugins - For ,
wechatisrenderer_mode,wechat-browser-copyidentifiesclipboard_source, the output root isextractWechatClipboardHTML, inline styles are present, and no<section class="lovpen-renderer">tag remains.<style> - For ,
standaloneisrenderer_mode, the document contains its embeddedstandalone-headless-core, and browser-only disabled plugins remain explicit.<style>
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 响应和文件系统中验证以下所有项目:
- 和
ok均为 true,除非此次执行是 dry run。data.written - 标识 Lovpen 的独立渲染器。
data.renderer_source - 绝对输出路径存在,且是常规文件。
- 大于零,
data.bytes是长度为 64 个字符的摘要。data.sha256 - 如实报告 、
data.format、主题、高亮、模板套装或模板,以及renderer_mode,不得隐藏相关限制。disabled_preview_plugins - 对于 ,
wechat应为renderer_mode,wechat-browser-copy应标识clipboard_source,输出根节点应为extractWechatClipboardHTML,存在内联样式,并且不残留<section class="lovpen-renderer">标签。<style> - 对于 ,
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
- 0.2.0 on
lovpen-cli, or a Lovpen source checkout whosePATHstatus isagent-harness/lov-cli.jsonready - 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+
- 中包含
PATH0.2.0,或者使用lovpen-cli状态为agent-harness/lov-cli.json的 Lovpen 源码检出ready - 源码检出模式需要已安装的 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 doctorbash
python3 "$SKILL_DIR/scripts/validate_skill.py" "$SKILL_DIR"
python3 "$SKILL_DIR/scripts/run_lovpen_cli.py" \
--project-root PROJECT_ROOT \
-- --json doctor