• Stars
    star
    206
  • Rank 190,504 (Top 4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

read and edit a Wikibase instance from the command line

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 >= v14 (recommended way to install it: use the awesome 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 [email protected]

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

More Repositories

1

wikibase-sdk

JS utils functions to query a Wikibase instance and simplify its results
TypeScript
304
star
2

wikibase-dump-filter

Filter and format a newline-delimited JSON stream of Wikibase entities
JavaScript
90
star
3

wikibase-edit

a lib to edit Wikibase from NodeJS
JavaScript
64
star
4

hub

Web hub based on Wikidata
JavaScript
36
star
5

backup-github-repo

Backup all the issues and pull requests of a Github repo, including the comments, events, and labels, as JSON and as HTML
JavaScript
36
star
6

time-capsule

A WebExtension to send links to your future self
JavaScript
27
star
7

wikidata-properties-dumper

a script to get a JSON file listing wikidata properties ids and their label in a given language
CoffeeScript
27
star
8

fix-utf8

Fix Unicode encoding errors
JavaScript
26
star
9

ipfs-add-from-url

A command line executable to add a file to IPFS from a URL instead of a file path
JavaScript
25
star
10

import-wikidata-dump-to-couchdb

import a subset or a full Wikidata dump into a CouchDB database
JavaScript
20
star
11

jsondepth

a small command-line tool to walk through the depth levels of a JSON objects
JavaScript
10
star
12

website-history-browser

a WebExtension to browse your history per website
Svelte
10
star
13

wikidata-agent

A single-user server to communicate with the Wikidata API in a simple, minimalist way
JavaScript
9
star
14

text-transform-cli

A collection of CLI tools to operate frequently needed text transformations
JavaScript
8
star
15

load-balance-lines

Parallelize newline-delimited data processing by load balancing lines between multiple processes
JavaScript
5
star
16

hashtags-hub

A web service to get links to hashtag pages on different web platforms. The main purpose of this tool is to be used on Wikidata as the 'formatter URL' (P1630) value of 'hashtag' (P2572)
JavaScript
5
star
17

irc-logger

super-tiny IRC bot to log channels
JavaScript
4
star
18

os-health-report

A micro server reporting simple information on its (Linux) host machine
JavaScript
4
star
19

wikidata-rank

[WIP] Attributing scores to Wikidata items, making those available via a web API and dumps, under a CC0 license
JavaScript
3
star
20

couch-init2

Opiniated CouchDB databases initializer
JavaScript
3
star
21

maximize-telegram-web

maximize Telegram Web so that large messages (like code samples) can be easily read
CSS
3
star
22

ndjson-2-json

minimal CLI converter from newline-delimited JSON to a JSON array
JavaScript
2
star
23

maxlath.github.io

my personal web hub
HTML
2
star
24

blog

my personal website in Meteor
HTML
2
star
25

wikidata-links-enhancer

browser script to display wikidata links under any wikimedia projects pages, just after the header
JavaScript
2
star
26

wikibase-dump-formatter

Extends Wikibase dump prefixed URIs with a custom domain
JavaScript
1
star
27

youtube-auto-ld

A WebExtension to automatically set Youtube video resolution to a low definition, to save resources
JavaScript
1
star
28

unicode-scripts-finder

find which unicode scripts a text is using
JavaScript
1
star
29

ouisharelabs

labs.ouishare.net
1
star
30

couchdb-view-by-keys

A command-line tool to query CouchDB views, focused on easing queries with complex JSON keys
JavaScript
1
star
31

wikibase-token

a promises-based lib abstracting authentification for write actions on the Wikidata API
JavaScript
1
star
32

wikibase-cli-template-collection

A collection of wikibase-cli templates
JavaScript
1
star
33

vscode-only-test

A minimalist vscode extension that adds a command to toggle Mocha `it.only` to the test the cursor is in
JavaScript
1
star
34

ndjson-apply

apply a JS function to a stream of newline-delimited JSON
JavaScript
1
star
35

quickstatements-to-wikibase-edit

Tools to convert QuickStatements commands into wikibase-edit format
JavaScript
1
star
36

json-apply

A CLI tool to transform JSON files with custom JS functions
JavaScript
1
star
37

couchdb-blazegraph-sync

[unstable] Keep a CouchDB database and a BlazeGraph namespace in sync
JavaScript
1
star