The kamakiri CLI
kamakiri is the command-line client for Kamakiri Pages, and the whole interface to the service.
Install
Run the install script, in a terminal on Linux and macOS or in PowerShell on Windows.
$ curl -fsSL https://get.kamakiri-labs.jp/install.sh | sh
PS> irm https://get.kamakiri-labs.jp/install.ps1 | iex
The script verifies the download against the checksum published with the release, then installs it to ~/.local/bin/kamakiri, or to %USERPROFILE%\.local\bin on Windows. To install somewhere else, set KAMAKIRI_INSTALL_DIR to a directory you own: kamakiri upgrade replaces the binary in place without administrator rights, so it cannot update a copy in a directory owned by root.
On macOS and Linux the script edits no shell profile. If the install directory is not on your PATH, the run ends by printing the line to add and the file to add it to. On Windows the script adds the directory to your user PATH and to the current session, so kamakiri version works straight away.
The client is also published on npm and Homebrew:
npm install -g kamakiri, on macOS, Linux and Windows.brew install kamakiri-labs/tap/kamakiri, on macOS, and on Linux with Homebrew 4.5.0 or later.
The binary for each platform is linked from get.kamakiri-labs.jp.
Update
Run the install command again, or kamakiri upgrade. A copy installed with npm or Homebrew updates through that package manager. When a newer release is out, a command that succeeded on a terminal ends with one line on stderr saying so, at most once a day. When the server stops supporting your version, every command that talks to it is refused with a line telling you to run kamakiri upgrade.
Uninstall
Run the uninstall script.
$ curl -fsSL https://get.kamakiri-labs.jp/uninstall.sh | sh
Removed ~/.local/bin/kamakiri.
Removed the config directory ~/.config/kamakiri.
It held your saved API key. Only this copy is gone: the key itself stays valid on your account, and nothing here revokes it.
kamakiri is uninstalled.
If you added ~/.local/bin to your PATH for kamakiri alone, that line in ~/.bashrc can come out now.
PS> irm https://get.kamakiri-labs.jp/uninstall.ps1 | iex
Removed C:\Users\you\.local\bin\kamakiri.exe.
Removed the config directory C:\Users\you\.config\kamakiri.
It held your saved API key. Only this copy is gone: the key itself stays valid on your account, and nothing here revokes it.
Removed C:\Users\you\.local\bin from your user PATH.
kamakiri is uninstalled.
The script removes the binary and the whole config directory, including your saved API key and settings. If you installed with KAMAKIRI_INSTALL_DIR, set it again for the uninstall. A copy from npm or Homebrew is removed with npm uninstall -g kamakiri or brew uninstall kamakiri.
The usage message
kamakiri with no command prints this to stderr and exits 1. There is no help command and no --help flag.
$ kamakiri
Usage: kamakiri <command>
Commands:
login Log in with your email
status Show current status (--verbose shows DNS records inline; --recheck asks the server to check DNS now)
init Create a new site
deploy Deploy a directory or archive
deploys List recent deploys
rollback Roll back to a previous deploy
teardown Delete the linked site
cdn Manage CDN (cloudflare/webaccel/none/cleanup/verify/credentials/status/purge)
domain Manage custom domains (register/unregister/verify/set/unset/add/remove/list)
subdomain Get or set the site subdomain
version Print the CLI version (--version, -v)
language Show or set the CLI language (en/ja)
upgrade Update the CLI to the latest release
Environment variables:
KAMAKIRI_API_KEY
The API key every command that needs a credential uses, for CI runners
with no credentials file. While it is set, the credentials file is not
read. Take the key from the file `kamakiri login` saves on your machine.
KAMAKIRI_CDN_TOKEN, KAMAKIRI_CDN_SECRET
WebAccel API credentials for `kamakiri cdn webaccel`. Prefer these
over --token/--secret flags in CI: command-line arguments are visible
in `ps`, while env vars are not.
$ kamakiri
使い方: kamakiri <command>
コマンド:
login メールアドレスでログインします
status 現在の状態を表示します(--verbose はDNSレコードも表示し、--recheck はサーバーにDNSの再確認を要求します)
init 新しいサイトを作成します
deploy ディレクトリまたはアーカイブをデプロイします
deploys 最近のデプロイを一覧表示します
rollback 以前のデプロイにロールバックします
teardown リンクされているサイトを削除します
cdn CDNを管理します (cloudflare/webaccel/none/cleanup/verify/credentials/status/purge)
domain カスタムドメインを管理します (register/unregister/verify/set/unset/add/remove/list)
subdomain サイトのサブドメインを表示・設定します
version CLIのバージョンを表示します (--version, -v)
language CLIの言語を表示・設定します (en/ja)
upgrade CLIを最新リリースに更新します
環境変数:
KAMAKIRI_API_KEY
認証情報が必要なすべてのコマンドが使うAPIキーです。認証情報ファイルの
ないCIランナー向けで、設定されている間はそのファイルを読みません。
キーは、手元のマシンで `kamakiri login` が保存したファイルにあります。
KAMAKIRI_CDN_TOKEN, KAMAKIRI_CDN_SECRET
`kamakiri cdn webaccel` で使う WebAccel API の認証情報です。CIでは
--token/--secret フラグより環境変数を推奨します。コマンドライン
引数は `ps` から見えますが、環境変数は見えません。
Files
The config directory is $XDG_CONFIG_HOME/kamakiri when that variable is set, and ~/.config/kamakiri otherwise, on every platform. On Windows that is %USERPROFILE%\.config\kamakiri. It holds:
credentials.json: the API keykamakiri loginsaved, and the email address it belongs to. Never commit it.settings.json: the language preference, once you set one.install.json: how and where the script installed the client, whichkamakiri upgradereads.update-check.json: when the update reminder was last shown, which keeps it to once a day.
Your project holds .kamakiri/config.json, written by kamakiri init. It holds the id of the linked site and nothing secret. Commit it, so a collaborator or a CI job deploys the same site.
Authentication
kamakiri login saves an API key in credentials.json, in the config directory. Every command that talks to the API uses it.
While KAMAKIRI_API_KEY holds a value that is not blank, commands use it and do not read the credentials file. Deploy covers setting it up in CI.
A command that finds no credential prints not logged in and exits 1. A key the server rejects prints invalid API key: log in again, or, when the key came from KAMAKIRI_API_KEY, check the value the variable holds.
What a command waits for
A command that starts work on the service returns when the result is true for a visitor to your site, not when the request is accepted. kamakiri deploy, kamakiri rollback and kamakiri cdn purge return once a visitor gets the current deploy, through the CDN as well when one is configured.
- The wait has no timeout. A live line says what it is waiting on, and each completed step stays on screen as a
✓line. - It stops early only when something you must fix is in the way. It says what is wrong and exits 1. Once you fix it, a deploy, a rollback or a purge completes on its own. Run any other command again.
- Ctrl-C stops the watching, not the work, and exits 130. Run kamakiri status to pick the view back up.
--no-waitreturns as soon as the request is accepted. Check the result later withkamakiri status.deploy,rollbackandcdn purgewait in CI exactly as they do on your machine. Pass--no-waitif a job should not wait.- On a terminal that is not interactive,
domain register,set,addandverifyprint the DNS records to publish and return, because only you can publish them. See kamakiri domain.
Language
The CLI speaks English and Japanese, chosen from KAMAKIRI_LANG, then the preference saved with kamakiri language, then your locale. Text from the server is always English, so a Japanese transcript can carry an English line.
The commands
- kamakiri login: log in with your email address.
- kamakiri status: show where your account and the linked site stand.
- kamakiri init: create a site and link the current directory to it.
- kamakiri deploy: deploy a directory or an archive.
- kamakiri deploys: list the deploys kept for the site.
- kamakiri rollback: put a previous deploy back online.
- kamakiri teardown: delete the linked site.
- kamakiri cdn: manage the CDN in front of a site.
- kamakiri domain: manage custom domains.
- kamakiri subdomain: show or change the site’s subdomain.
- kamakiri version: print the version you are running.
- kamakiri language: show or set the language the client speaks.
- kamakiri upgrade: update the client to the latest release.