Skip to content

Migrating from v1 scripts to the CLI ​

Language: 中文 · English

If you still run scripts/pixiv.sh, migrate to the standalone pixivflow command. Users already on the CLI should consult the changelog. This guide preserves the v1→v2 transition while using the current runtime requirement, Node.js 22.13.0+ and npm 9+.

Entry point and config locations ​

bash
npm install -g pixivflow
pixivflow --help
pixivflow dirs

The npm package registers dist/index.js as the executable. It works outside the repository. Shell wrappers remain available for source-based development. Running pixivflow without a command starts the scheduler if scheduler.enabled is true; otherwise it performs one download run.

Configuration selection is explicit --config > PIXIV_DOWNLOADER_CONFIG > detected/default config. The selected absolute path is shared by downstream modules. Explicit missing files are errors, never a reason to select another file silently. Missing implicit defaults can be created automatically.

ContextDefault location
Recognized deployment project root<root>/config/standalone.config.json
Global installation with ~/pixivflow/~/pixivflow/config/
Other installations~/.pixivflow/config/

Run dirs after migration to verify the actual file, credentials, targets and download paths. CLI help/output is predominantly English; older shell wrappers may print Chinese. Unknown commands suggest similar names; failures return a nonzero exit code.

Command mapping ​

v1 operationCurrent CLINotes
./scripts/easy-setup.shpixivflow setupInteractive setup
./scripts/login.shpixivflow login (l)Browser login
login.sh --headless -u ... -p ...pixivflow login-headless (lh)Browser automation without a visible window
Existing refresh tokenpixivflow refresh <token> (r)Token import/validation
./scripts/pixiv.sh oncepixivflow downloadConfigured targets
Direct URLpixivflow download --url <url>No target config change
./scripts/download-with-config.shpixivflow download --targets <json> or a chosen configSimilar purpose, not identical wrapper behavior
./scripts/download-ranking.shKeep the script or configure a ranking targetNo one-to-one command
./scripts/pixiv.sh runpixivflow schedulerForeground scheduler
./scripts/pixiv.sh randompixivflow random--novel selects novels
./scripts/pixiv.sh statuspixivflow status (stats)Counts and recent records
./scripts/pixiv.sh logspixivflow logsRecent logs
./scripts/pixiv.sh stopCtrl+C or process managerNo built-in stop command
config-manager.shpixivflow config show/validate/set/edit/backup/restore/list/diffConfig subcommands
auto-backup.shpixivflow backup (backup-data)Config/data backup
auto-maintain.shpixivflow maintain (cleanup)Logs/database maintenance
auto-monitor.shpixivflow monitor (watch)Process status
health-check.shpixivflow health (check)Health diagnostics
Count files manuallypixivflow dirs (paths)--verbose shows more detail
node dist/index.js --versionpixivflow version (v)Version/build information

Additional CLI tools include normalize for downloaded files and web (webui, w) for the browser interface, supporting --port, --host and --config. See Usage for the full current command set.

Path migration ​

migrate-config (mc) converts four absolute storage paths to relative paths: databasePath, downloadDirectory, illustrationDirectory, novelDirectory. It does not convert a separate v1 schema into v2; both use standalone.config.json.

bash
pixivflow config backup
pixivflow migrate-config --dry-run
pixivflow migrate-config
pixivflow migrate-config --json
pixivflow migrate-config --config ~/pixivflow/config/standalone.config.json

Relative storage paths resolve against the config directory, not the shell's working directory. Config loading can also repair absolute paths that are unavailable in the new environment. Manual migration gives you a preview and a backup opportunity. Use pixivflow config restore to restore the config if necessary. Typical cases are moving an old installation to another machine or replacing host paths with Docker mounts.

Common questions ​

  • Can I reuse the token? Yes; existing refresh tokens remain usable until Pixiv invalidates them. On authentication failure use Login to import or obtain a new token.
  • Must I clone the repository? No for npm CLI use. Yes for source changes, helper scripts and source-built Docker images.
  • Where did my downloads go? Run pixivflow dirs, then check config precedence and storage settings.
  • How do I open the WebUI? Run pixivflow web. npm distributions bundle frontend files; source installations may need a frontend build. See WebUI.
  • Does the old cron still work? Legacy scheduler.cron and scheduler.timezone remain supported. Independent schedules take precedence when configured.

Related: Configuration, Usage, Helper scripts (Chinese), Docker.