npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

automatic-lovart

v0.1.0

Published

Lovart browser automation agent for isolated prompt-to-image tasks.

Readme

Automatic Lovart Agent

这个项目用 Playwright 控制浏览器访问 Lovart,把多个 prompt 当成相互隔离的任务执行。每个任务使用独立 browser context,最多和 Lovart 交互 6 轮,并把检测到的图片保存到 ./picture_lovart/<task_id>/

准备

运行这个工具需要安装本机 Google Chrome。Lovart/登录校验可能会拒绝 Playwright 自带的 Chromium,所以不要只依赖 npm run install:browsers 下载的浏览器。

从 npm 安装后初始化当前目录:

npm install -g automatic-lovart
automatic-lovart-init

本地源码开发:

npm install
cp prompts.example.json prompts.json

编辑 prompts.json,每个任务只需要写 prompt。任务 id 会由程序自动按 task_001task_002 的格式自增生成,并记录在 .auth/task-state.json

保存 Lovart 登录态

使用真实 Google Chrome 保存登录态,避免 Google OAuth 或 Lovart 校验拦截 Chrome for Testing:

npm run auth:chrome

如果是 npm 全局安装,也可以运行:

automatic-lovart-auth

脚本会用你本机安装的 Google Chrome 打开 Lovart。你手动登录完成后,回到终端按 Enter,登录态会保存到 .auth/lovart.storage.json。脚本不会保存账号密码。

旧的 Playwright Chromium 登录方式保留在脚本里,但如果遇到校验失败,不建议用于分享部署:

npm run auth

运行任务

npm run run:headed

无头运行:

npm run run

如果是 npm 全局安装,在初始化后的项目目录运行:

automatic-lovart

定时运行。下面的命令会等到本地时间 23:30 再开始执行;如果当前时间已经晚于 23:30,则预约到明天 23:30:

npm run run -- --start-at 23:30
automatic-lovart --start-at 23:30

定时等待和任务运行期间,程序会尝试阻止系统休眠,直到本次进程结束。macOS 使用系统自带的 caffeinate;Linux 使用 systemd-inhibit。如果当前系统不支持,会在终端打印警告并继续执行。

输出结构:

picture_lovart/
  task_001/
    task_001_001.png
    manifest.json
  task_002/
    task_002_001.jpg
    manifest.json
run-report.json

manifest.jsonrun-report.json 会记录任务 id、轮次、图片文件路径、来源 URL 或截图来源。交付检测标准是:对应任务 id 目录下至少存在 1 个通过文件头校验的图片文件。

配置

主要配置在 lovart.config.json

  • maxRounds: 最大交互轮数,默认 6。
  • generationWaitMs: 每轮等待图片生成的最长时间。
  • taskStatePath: 自动任务 id 的本地状态文件路径,默认 .auth/task-state.json
  • selectors: Lovart 页面选择器。如果 Lovart 改版,优先调整这里。
  • followUpPrompt: 当 Lovart 询问更多信息或未生成图片时,agent 发送的追问。

如果 Lovart 入口页登录后没有自动进入创作界面,可以把 lovartUrl 改成你登录后实际使用的创作页 URL。