read and edit a Wikibase instance from the command line
  • JavaScript 99.4%
  • Shell 0.5%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-04 18:10:37 +01:00
.github fix .github/README.md 2026-05-09 19:22:38 +02:00
.vscode + .vscode/settings.json 2025-10-02 13:45:59 +02:00
assets readme: update userbox 2020-05-22 11:19:22 +02:00
bin wb data: add cirrus format 2026-05-19 11:04:18 +02:00
docker Dockerfile: use the latest available LTS NodeJS version 2022-05-24 17:19:54 +02:00
docs update repo urls 2026-05-14 17:35:47 +02:00
eslint eslint: add custom rules 2026-02-10 20:31:36 +01:00
lib request lib: make more resilient to incomplete response 2026-11-04 08:55:20 +01:00
metadata metadata: sparql: add named function example 2026-07-13 23:47:26 +02:00
scripts eslint: upgrade to v9 2025-10-21 10:36:07 +02:00
tests changelog: update 2026-11-04 17:28:44 +01:00
.gitignore docker: move context files to a dedicated folder 2019-10-01 21:25:24 +02:00
CHANGELOG.md changelog: better link to wikibase-edit changelog 2026-11-04 18:10:37 +01:00
eslint.config.js eslint: add custom rules 2026-02-10 20:31:36 +01:00
index.js convert from CommonJS to ESM 2023-07-17 21:55:08 +02:00
jsconfig.json move ./test directory to ./tests 2025-10-21 10:36:07 +02:00
LICENSE.md added a license.md file 2017-11-08 13:30:38 +01:00
package-lock.json 21.0.0 2026-11-04 17:29:21 +01:00
package.json 21.0.0 2026-11-04 17:29:21 +01:00
README.md docs: update links 2026-03-27 21:09:20 +01:00

wikibase-cli

The Command-line interface interface to Wikibase instances.

This tool is mostly a CLI interface to the JS modules wikibase-edit and wikibase-sdk, + some treats for the CLI lovers. And a batch mechanism to process millions of edits.

It was primarily developed to target Wikidata, but as then been decoupled to support any Wikibase instance.

Supported systems: any system that can run NodeJS (Linux, Mac OS, Windows, and more)

This project received a Wikimedia Project Grant.


wikibase           wikidata

NPM DockerHub Badge

License Node JavaScript Style Guide

Download stats

Show your support by adding {{#babel:Wikibase CLI}} to your Wikidata user page

userbox_wikibase_cli

Summary

Changelog

See CHANGELOG.md for version info

Dependencies

General

  • NodeJS >= v20.12.0 (Older NodeJS versions can be used for older wikibase-cli version, see changelogs. Recommendable way to install NodeJS: you may use NVM to install the latest LTS version nvm install --lts)
  • Git

Per feature

  • to use the clipboard option: see copy-paste dependencies

Installation

via npm

npm install -g wikibase-cli

Installing globally allows to make the command wb (and wd, the Wikidata-bound verion of wb) accessible from your shell $PATH.

If you later need to update the package to a different version, you can run the same command but specifying the version you want (here 12.2.0)

npm install -g wikibase-cli@12.2.0

or just request the latest version

npm install -g wikibase-cli@latest

via docker

# Might require to be run with sudo depending on your Docker installation
docker run --rm -t maxlath/wikibase-cli
# You can make an alias out of it:
alias wb="docker run --rm -it maxlath/wikibase-cli"
# You're then ready to use it as in the documentation examples
wb label Q1

That would work, but all operations cached data (such as the list of all properties) would need to re-fetch those data for each operations, and all write operations would require you to re-enter your credentials everytime. To work around this, you can allow this container to persist some files on your system, using shared volumes:

mkdir -p $HOME/.config/wikibase-cli $HOME/.cache/wikibase-cli
alias wb='docker run --rm -v "$HOME/.config/wikibase-cli:/root/.config/wikibase-cli" -v "$HOME/.cache/wikibase-cli:/root/.cache/wikibase-cli" -it maxlath/wikibase-cli'

NB: Beware that using wikibase-cli through a Docker container has a performance cost of something like 1s per command, so if you need to run many commands (for instance in a script to make mass edit on the desired Wikibase instance), you should probably rather use the NPM package directly

Commands

Read operations

See Read operations

wd summary Q1

Write operations

See Write operations

Config

Allows to persist options

See Config

Debug

To get debugging informations, set the DEBUG environment variable:

# Print all wikibase-cli-specific debugging information
export DEBUG=wikibase-cli ; wb
# Also print wikibase-edit debugging information
export DEBUG=wikibase-* ; wb
# Print only request debugging information
export DEBUG=wikibase-cli:request ; wd label Q1

See Also

You may also like

inventaire banner

Do you know Inventaire? It's a web app to share books with your friends, built on top of Wikidata! And its libre software too.

License

MIT