WaniKani CLI + Typescript API library

Hi,

Any interest in a command line interface for Wanikani? I could easily make commands for any of the API endpoints.
I’m not sure if there is a use case for this. Maybe someone out there wants to write batch scripts or an electron app or VSCode plugin or something. Obviously you wouldn’t use a CLI to do reviews, but maybe you could set it up so that whenever you open a terminal it tells you how many wanikani reviews you have, or something like that. Might be a dumb idea but I figured I’d throw it out there to gauge interest

Help text example

Short/alias form of an example wanikani list reviews command

Github repo

6 Likes

I’d be interested in a shell script that dumped performance stats, with various options.

I’m thinking, an option to count only last day, last week, last month, etc.
An option to count only kanji, vocab, radicals, or some combination of those
And then breakdown chart options, like time of day, item type, SRS level.

Example:

$ wkperf -t last_week -i all -b srs
Performance data for last week
All item types
By SRS level

Apprentice 1: 40 items tested, 37 correct, 92.5%
Apprentice 2: 40 items tested, 38 correct, 95.0%
[etc.]
.
.
.
Total: [totals]

$

Breaking down by hour of the day the review was done is pretty interesting sometimes. I feel like I do way better first thing in the morning. Does that data support that?

Or maybe if there’s a way to get a single item’s performance history:

$ wkitem [item number]
Item number [number]
Kanji 導
On-Yomi:
Kun-Yomi:
Meaning:

[Date] Lesson
[Date] Reviewed [SRS level] passed
[Date] Reviewed [SRS level] passed
[Date] Reviewed [SRS level] failed reading

etc.

1 Like

Interesting. I think this is doable. I’ll let you know if I implement a command like this

1 Like

Hi @dogboydog - I’d be interested in playing around with this, if the repo is still available. I notice the repo is currently unavailable

Hey I’ll see if I can dredge it up again.

1 Like

Hey I’m sorry, I don’t have the code anymore apparently but I can make a one-command example of what I did before this weekend and upload it again.

Okay I threw something together. Right now it just lists reviews. It doesn’t follow any of the best practices for a client or anything like that, but it’s a starting point if anyone else wants to fork it and mess around with it. I used the generated typescript code from @MainLoop with some modifications (it didn’t compile out of the box).


Just a few fields are printed in the table now but it could be changed if anyone picks it up.

Same link as before, but here it is.

You can build it from source if you have npm installed with “npm install && npm run build”. Then you can do “npm link” to install it as a CLI. After that you can do “wanikani” to get the basic help. You can save your token in a profile on disk (there is a way to use windows credential manager too but I didn’t do it for this POC) with a command like “wanikani profiles create wanikani default --token abcdef123”. Or you can specify it on the command with --token abcfwioj123. or you can set the environmental variable WANIKANI_CLI_TOKEN.

Other links
https://docs.api.wanikani.com/20170710/#best-practices
Home · zowe/imperative Wiki · GitHub This is the library I used for the CLI. I like the help text and it lets you save user details. You could convert it to another library like https://oclif.io/ if you prefer that.

1 Like