{"_id":"@buzzerboyinc/klaai-cli","_rev":"2-2d2f65c5cc816772d7fc32a3bac07e25","name":"@buzzerboyinc/klaai-cli","dist-tags":{"latest":"0.1.8"},"versions":{"0.1.5":{"name":"@buzzerboyinc/klaai-cli","version":"0.1.5","author":{"name":"Buzzerboy"},"license":"UNLICENSED","_id":"@buzzerboyinc/klaai-cli@0.1.5","maintainers":[{"name":"buzzerboy","email":"fjawaid@buzzerboy.com"},{"name":"ajaxarrow","email":"jiu.axl.tabilla@buzzerboy.com"}],"bin":{"klaai":"bin/klaai.js","bookie":"bin/klaai.js"},"dist":{"shasum":"ecec277b5d0ec6584747fb5d454b9c869e2fb7c2","tarball":"https://registry.npmjs.org/@buzzerboyinc/klaai-cli/-/klaai-cli-0.1.5.tgz","fileCount":9,"integrity":"sha512-BdF+n+AP/ImtrP6QXJ9MeVaTtZrtYZo/aqEmC1eCEv2S9mnoqT/HlP0gQKwyRCaoAdaWUeW3zfMzKeMjo93hfg==","signatures":[{"sig":"MEQCID/qj6JQ4VhswgqHYnl/axoJ6RxQWESDWHe2pimnmrb7AiBt32HSSIWnZ2TkIbNxZ2ntH0pM4okP52BivmzTFe4qnQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":71890},"type":"module","engines":{"node":">=18"},"gitHead":"9ebc3e5c8f5bae71e77fe85b782c0e55a554162f","scripts":{"klaai":"node ./bin/klaai.js","publish":"node publish.mjs"},"_npmUser":{"name":"ajaxarrow","email":"jiu.axl.tabilla@buzzerboy.com"},"_npmVersion":"10.8.2","description":"Command-line client for Klaai — double-entry bookkeeping for Canadian small business.","directories":{},"_nodeVersion":"20.20.2","dependencies":{"commander":"^12.1.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/klaai-cli_0.1.5_1785142638796_0.11618892084703658","host":"s3://npm-registry-packages-npm-production"}},"0.1.8":{"name":"@buzzerboyinc/klaai-cli","version":"0.1.8","description":"Command-line client for Klaai — double-entry bookkeeping for Canadian small business.","type":"module","bin":{"klaai":"bin/klaai.js","bookie":"bin/klaai.js"},"engines":{"node":">=18"},"scripts":{"klaai":"node ./bin/klaai.js","publish":"node publish.mjs"},"dependencies":{"commander":"^12.1.0"},"license":"UNLICENSED","author":{"name":"Buzzerboy"},"_id":"@buzzerboyinc/klaai-cli@0.1.8","gitHead":"8e4ca6bb0c3568ba8c5259df33cbcac723a05fa1","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-KzTfQjQ0asPg/2GRF/xrskTQfLqsWRIqrZugxZOsv+YzknTksMlHmpatrjz3bJQSkttn9IfnkJ9uBYmeLMsRAQ==","shasum":"10c16abdd8a4c46848a60a5e16850371b0e1f77b","tarball":"https://registry.npmjs.org/@buzzerboyinc/klaai-cli/-/klaai-cli-0.1.8.tgz","fileCount":9,"unpackedSize":89695,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFnkD8TO9rkBJEJdgO2AgMjlDPyRWutqLN3F5CNmg0kcAiAK6dWE7LYEucYCfO/FY5AVKNbypdpjRl8GtmkSjL+O1g=="}]},"_npmUser":{"name":"ajaxarrow","email":"jiu.axl.tabilla@buzzerboy.com"},"directories":{},"maintainers":[{"name":"buzzerboy","email":"fjawaid@buzzerboy.com"},{"name":"ajaxarrow","email":"jiu.axl.tabilla@buzzerboy.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/klaai-cli_0.1.8_1785800049557_0.4038109674201673"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-27T08:57:18.621Z","modified":"2026-08-03T23:34:09.907Z","0.1.5":"2026-07-27T08:57:18.933Z","0.1.8":"2026-08-03T23:34:09.700Z"},"author":{"name":"Buzzerboy"},"license":"UNLICENSED","description":"Command-line client for Klaai — double-entry bookkeeping for Canadian small business.","maintainers":[{"name":"buzzerboy","email":"fjawaid@buzzerboy.com"},{"name":"ajaxarrow","email":"jiu.axl.tabilla@buzzerboy.com"}],"readme":"# Klaai CLI\n\nCommand-line client for [Klaai](../php) — double-entry bookkeeping for Canadian\nsmall business. Every command speaks to the same REST API the web app uses, and\nevery command supports `--json`, which is how the Claude skill drives it.\n\n## Install\n\n```bash\ncd cli\nnpm install\nnpm link          # puts `klaai` on your PATH\n```\n\nOr run it in place: `node bin/klaai.js <command>`.\n\nRequires Node 18+ (uses the built-in `fetch`).\n\n## Sign in\n\nThe CLI points at production (`https://www.klaai.co`) by default, so you can sign\nin straight away. Only set a URL if you're using a local or dev instance:\n\n```bash\nklaai config set-url http://localhost:8643    # local dev server (optional)\n```\n\n### `klaai login url` — browser flow (recommended)\n\n```bash\n$ klaai login url\n\n  Authorize the Klaai CLI  https://www.klaai.co\n\n  Opening your browser. If it didn't open, use this URL:\n  https://www.klaai.co/cli-auth\n\n  Sign in if asked, click Authorize, then copy the code shown.\n\n  Enter the code: 35AE-D4A8\n\n✓ Signed in as fj@maplemain.ca\n  Company: Maple & Main Consulting Inc. (Owner)\n  Credentials saved to /Users/you/.klaai/config.json — 30 days remaining\n```\n\nThe browser shows a **one-time authorization code**, not your token. The CLI\nexchanges it for the real credential, so the long-lived token never appears on\nscreen or in your shell history. Codes are single-use and expire in 10 minutes.\n\nUse `--no-browser` on a headless machine to just print the URL.\n\n### `klaai login token` — paste a token\n\nCreate one in the web app under **Settings → CLI access**, then:\n\n```bash\nklaai login token                 # prompts for the token\nklaai login token dc4f…9a1        # or pass it directly\n```\n\n### Where credentials live\n\n`~/.klaai/config.json`, mode `0600` — in your **home directory**, never in this\nrepo, so the source is safe to commit and a checkout carries no secrets.\n\n```jsonc\n{\n  \"url\": \"https://www.klaai.co\",\n  \"token\": \"…\",\n  \"expires_at\": \"2026-08-17 16:40\",\n  \"company_id\": \"co_01\",\n  \"user\": { \"id\": \"usr_01\", \"email\": \"fj@maplemain.ca\" }\n}\n```\n\nTokens are valid for **30 days** (well beyond an 8-hour working session). The\nCLI tells you what's left:\n\n```bash\nklaai login status\nklaai logout          # clears locally AND revokes the token server-side\nklaai revoke          # the above, plus deletes the config file and the saved URL\n```\n\n`logout` signs you out but keeps pointing at the same server, so signing back in\nis one command. `revoke` is for leaving nothing behind — handing a laptop back,\nfinishing up on someone else's machine, or resetting a config that has drifted to\na host you'd rather forget:\n\n```bash\n$ klaai revoke\n\n✓ Token revoked and local config deleted.\n  Was signed in as fj@maplemain.ca\n  Removed /Users/you/.klaai/config.json\n\n  Server URL forgotten — the CLI is back to its default. To restore it:\n    klaai config set-url http://localhost:8643\n\n  Sign in again with `klaai login url`.\n```\n\nIt never prompts, so it is safe to script, and it prints the URL back on the way\nout because that is the one thing signing in again won't restore. Running it\nwhile signed out, or twice, is a no-op. If the server can't be reached the local\nstate is still wiped — a machine you're wiping shouldn't keep credentials just\nbecause the network was down — and the failed revoke is reported rather than\nswallowed.\n\nOverride the config location with `KLAAI_CONFIG_DIR`, the server with\n`KLAAI_URL`, or the token with `KLAAI_TOKEN` (handy in CI). Note that `revoke`\nkills a `KLAAI_TOKEN` server-side but cannot unset the variable in your shell —\nit says so when it sees one.\n\n## Choosing company and fiscal year\n\nThe CLI is stateless — it sends the company and year on **every** request, so a\nsession-based selection can't drift.\n\n```bash\nklaai companies list\nklaai companies use co_01           # remembered in config\nklaai reports trial-balance --fy 2025\nklaai invoices list --company co_02\n```\n\n## Commands\n\n```\nklaai dashboard                     headline numbers\n\nklaai companies list|use <id>\n\nklaai accounts list [--group Cash]  chart of accounts with balances\nklaai accounts subtypes             the account types you can create\nklaai accounts create --code 1050 --name \"Cash — USD\" --type cash_chequing\nklaai accounts ledger <accountId>   transactions + running balance\n\nklaai customers list\nklaai customers create --name \"Acme Ltd\" --email ap@acme.ca --industry Technology\nklaai vendors   list\nklaai vendors   create --name \"Adobe\" --category Software\n\nklaai invoices list\nklaai invoices show <invoiceId>\nklaai invoices create --customer <id> --line \"Work|acc_4000|1500\" --tax 195 --terms net_30\nklaai invoices pay <invoiceId> --amount 1695 --account acc_1000 --method e-transfer\n\nklaai receipts list\nklaai receipts create --description \"AWS\" --amount 200 --tax 26 \\\n                       --category acc_5000 --paid-from acc_1000 --vendor <id>\nklaai receipts create --description \"To savings\" --amount 2500 --from acc_1000 --to acc_1010\nklaai receipts approve <receiptId>\n\nklaai inbox list\nklaai inbox process <emailId> --description \"Bell — July\" --amount 92.50 \\\n                     --tax 12.03 --category acc_5000 --paid-from acc_1000\n\nklaai journal list\nklaai journal create --memo \"Bank interest\" \\\n                      --posting \"acc_1000|12.40|0\" --posting \"acc_4000|0|12.40\"\n\nklaai reports balance-sheet|income-statement|cash-flow|trial-balance\nklaai reports gst-hst [--from 2026-07-01 --to 2026-09-30]\nklaai reports ar-aging|ap-aging\n\nklaai config set-url <url>\nklaai config show\n\nklaai logout                        forget credentials, keep the server URL\nklaai revoke                        forget everything, URL included\n```\n\n### Repeatable arguments\n\nInvoice lines and journal postings are pipe-delimited and repeatable:\n\n```\n--line     \"description|account_id|amount\"\n--posting  \"account_id|debit|credit\"\n```\n\n### `--json`\n\nEvery command takes `--json` and prints the raw API response — no colour, no\ntruncation, stable shapes. This is the mode to use from scripts and from Claude:\n\n```bash\nklaai invoices list --json | jq '.[] | select(.balance > 0) | .number'\nklaai customers create --name \"Acme\" --json\n```\n\n## Notes\n\n- **Money in, money out**: an invoice is only *paid* when a payment is recorded\n  (`klaai invoices pay`). Setting a status alone doesn't move cash.\n- **Balancing**: `journal create` is rejected server-side if debits ≠ credits.\n- **Locked years**: writes to a closed fiscal year are refused; reads are fine.\n- **Attribution**: pass `--by claude` on `receipts create` / `inbox process` so\n  the web app's review queue shows who recorded it.\n","readmeFilename":"README.md"}