@pungoyal/kite-cli 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -6
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/@pungoyal/kite-cli)
|
|
5
5
|
[](https://github.com/pungoyal/kite-cli/releases/latest)
|
|
6
6
|
[](https://nodejs.org)
|
|
7
|
-
[](LICENSE)
|
|
7
|
+
[](https://github.com/pungoyal/kite-cli/blob/main/LICENSE)
|
|
8
|
+
[](https://pungoyal.github.io/kite-cli/)
|
|
8
9
|
|
|
9
10
|
An **unofficial**, secure, scriptable command-line interface for the [Zerodha Kite Connect](https://kite.trade/docs/connect/v3/) API.
|
|
10
11
|
|
|
@@ -62,6 +63,8 @@ kite --env sandbox holdings
|
|
|
62
63
|
|
|
63
64
|
## Usage
|
|
64
65
|
|
|
66
|
+
The highlights are below; every command's full flag list is in [the command reference](https://pungoyal.github.io/kite-cli/commands).
|
|
67
|
+
|
|
65
68
|
### Portfolio
|
|
66
69
|
|
|
67
70
|
```bash
|
|
@@ -246,9 +249,11 @@ For scripts and CI, `KITE_API_KEY` / `KITE_API_SECRET` / `KITE_ACCESS_TOKEN` sti
|
|
|
246
249
|
supply credentials directly. As a safeguard, naming a profile explicitly while those
|
|
247
250
|
are set is refused rather than silently overridden.
|
|
248
251
|
|
|
252
|
+
→ Full reference, including credential storage precedence and per-profile inheritance: [the configuration reference](https://pungoyal.github.io/kite-cli/configuration).
|
|
253
|
+
|
|
249
254
|
## Safety
|
|
250
255
|
|
|
251
|
-
This tool spends real money, so the defaults are conservative.
|
|
256
|
+
This tool spends real money, so the defaults are conservative. → Full model, including the order-tag reconciliation flow and why cancels/converts are exempt from the value cap: [the safety model](https://pungoyal.github.io/kite-cli/safety).
|
|
252
257
|
|
|
253
258
|
**Confirmation.** Order commands render the resolved order — the actual instrument token, lot size, and computed value, not an echo of your flags — and wait for confirmation. That's deliberate: a flag echo can't catch "I typed the wrong symbol and it resolved to a different contract," which is the expensive mistake.
|
|
254
259
|
|
|
@@ -287,13 +292,13 @@ Automatic retries are restricted to `GET`/`HEAD` at the transport layer. `POST`,
|
|
|
287
292
|
|
|
288
293
|
Your API secret is never accepted as a command-line argument, because argv is visible to any local process via `ps` and lands in shell history. It's prompted for, or read from the environment.
|
|
289
294
|
|
|
290
|
-
**Redaction.** Access tokens are registered with a scrubber that runs over every log line, error message, and stack trace. The two paths that carry a token — the `Authorization` header and the WebSocket URL, where it's a query parameter — are covered explicitly and [tested](test/redact.test.ts).
|
|
295
|
+
**Redaction.** Access tokens are registered with a scrubber that runs over every log line, error message, and stack trace. The two paths that carry a token — the `Authorization` header and the WebSocket URL, where it's a query parameter — are covered explicitly and [tested](https://github.com/pungoyal/kite-cli/blob/main/test/redact.test.ts).
|
|
291
296
|
|
|
292
297
|
**TOTP.** This CLI will never ask for or store your 2FA seed. Storing it next to your API secret would collapse both authentication factors into one, which is exactly what the SEBI 2FA mandate exists to prevent. Login happens in your browser; the CLI only sees the resulting request token.
|
|
293
298
|
|
|
294
299
|
**Supply chain.** 10 direct runtime dependencies, most of them zero-dependency. Published from GitHub Actions via [npm Trusted Publishing](https://docs.npmjs.com/trusted-publishers/) with OIDC — no long-lived publish token exists. Provenance attestation is generated automatically; verify it with `npm audit signatures`. All CI actions are pinned to full commit SHAs, and dependency lifecycle scripts are disabled.
|
|
295
300
|
|
|
296
|
-
To report a vulnerability, see [SECURITY.md](SECURITY.md).
|
|
301
|
+
To report a vulnerability, see [SECURITY.md](https://github.com/pungoyal/kite-cli/blob/main/SECURITY.md).
|
|
297
302
|
|
|
298
303
|
## Configuration
|
|
299
304
|
|
|
@@ -319,6 +324,8 @@ Config lives at `~/.config/kite/config.json` (`0600`). Override the location wit
|
|
|
319
324
|
(see [Multiple accounts](#multiple-accounts)); the remaining keys are global. The
|
|
320
325
|
account this invocation resolves to is selected by `--profile` / `KITE_PROFILE`.
|
|
321
326
|
|
|
327
|
+
→ Every key and environment variable, with precedence: [the configuration reference](https://pungoyal.github.io/kite-cli/configuration).
|
|
328
|
+
|
|
322
329
|
## Things worth knowing about Kite
|
|
323
330
|
|
|
324
331
|
- **Sessions expire at 6:00 AM IST daily.** This is a regulatory requirement and there's no way around it — you log in once per trading day. Refresh tokens exist in the API but are only issued to exchange-approved platforms, not individual subscribers.
|
|
@@ -329,6 +336,25 @@ account this invocation resolves to is selected by `--profile` / `KITE_PROFILE`.
|
|
|
329
336
|
- **Instruments are cached by `exchange:tradingsymbol`, never by token.** Exchanges reuse numeric instrument tokens after expiry, so a token-keyed cache silently resolves to the wrong contract after a rollover.
|
|
330
337
|
- **Mutual funds are read-only** over the API — placing MF orders requires a bank debit that has no API path.
|
|
331
338
|
|
|
339
|
+
→ Hit one of these? See [the troubleshooting guide](https://pungoyal.github.io/kite-cli/troubleshooting) for the symptom-first version.
|
|
340
|
+
|
|
341
|
+
## Documentation
|
|
342
|
+
|
|
343
|
+
This README covers installation and everyday usage. The full reference is a
|
|
344
|
+
searchable site at **[pungoyal.github.io/kite-cli](https://pungoyal.github.io/kite-cli/)**:
|
|
345
|
+
|
|
346
|
+
- [Safety model](https://pungoyal.github.io/kite-cli/safety) — the full layered safety model (kill
|
|
347
|
+
switch, value cap, confirmation escalation, order-tag reconciliation).
|
|
348
|
+
- [Configuration](https://pungoyal.github.io/kite-cli/configuration) — every config key and
|
|
349
|
+
environment variable, with precedence.
|
|
350
|
+
- [Troubleshooting](https://pungoyal.github.io/kite-cli/troubleshooting) — symptom-first fixes
|
|
351
|
+
for session expiry, rate limits, login issues, and more.
|
|
352
|
+
- [Command reference](https://pungoyal.github.io/kite-cli/commands) — full flag-by-flag reference for
|
|
353
|
+
every command, generated from `--help`.
|
|
354
|
+
- [Library API](https://pungoyal.github.io/kite-cli/api) — the library/programmatic API surface.
|
|
355
|
+
|
|
356
|
+
The same pages are browsable as Markdown in [`docs/`](https://github.com/pungoyal/kite-cli/tree/main/docs).
|
|
357
|
+
|
|
332
358
|
## Library use
|
|
333
359
|
|
|
334
360
|
The client is exported if you want it without the CLI:
|
|
@@ -360,7 +386,7 @@ npm run build
|
|
|
360
386
|
|
|
361
387
|
## Contributing
|
|
362
388
|
|
|
363
|
-
Bug reports, ideas, and pull requests are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for the development workflow and the two non-negotiables (safety defaults and secret redaction), and [CHANGELOG.md](CHANGELOG.md) for release history. Security issues go through [SECURITY.md](SECURITY.md), never a public issue.
|
|
389
|
+
Bug reports, ideas, and pull requests are welcome. See [CONTRIBUTING.md](https://github.com/pungoyal/kite-cli/blob/main/CONTRIBUTING.md) for the development workflow and the two non-negotiables (safety defaults and secret redaction), and [CHANGELOG.md](https://github.com/pungoyal/kite-cli/blob/main/CHANGELOG.md) for release history. Security issues go through [SECURITY.md](https://github.com/pungoyal/kite-cli/blob/main/SECURITY.md), never a public issue.
|
|
364
390
|
|
|
365
391
|
## Disclaimer
|
|
366
392
|
|
|
@@ -370,4 +396,4 @@ Trading involves risk of financial loss. This software is provided as-is under t
|
|
|
370
396
|
|
|
371
397
|
## Licence
|
|
372
398
|
|
|
373
|
-
[MIT](LICENSE)
|
|
399
|
+
[MIT](https://github.com/pungoyal/kite-cli/blob/main/LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pungoyal/kite-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Unofficial command-line interface for the Zerodha Kite Connect API — not affiliated with or endorsed by Zerodha",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"zerodha",
|
|
@@ -53,6 +53,11 @@
|
|
|
53
53
|
"format": "biome format --write",
|
|
54
54
|
"hooks:install": "git config core.hooksPath .githooks",
|
|
55
55
|
"check:deps": "node scripts/check-deps.mjs",
|
|
56
|
+
"docs:commands": "node scripts/generate-command-reference.mjs",
|
|
57
|
+
"docs:commands:check": "node scripts/generate-command-reference.mjs --check",
|
|
58
|
+
"docs:dev": "npm --prefix docs install && npm --prefix docs run dev",
|
|
59
|
+
"docs:build": "npm --prefix docs ci && npm --prefix docs run build",
|
|
60
|
+
"docs:preview": "npm --prefix docs run preview",
|
|
56
61
|
"lint:publish": "publint && attw --pack . --profile esm-only",
|
|
57
62
|
"check:dist": "node -e \"const{existsSync,readFileSync}=require('node:fs');if(!existsSync('dist/cli.js'))throw new Error('dist/ is missing — run npm run build before publishing');if(!readFileSync('dist/cli.js','utf8').startsWith('#!/usr/bin/env node'))throw new Error('dist/cli.js lost its shebang')\"",
|
|
58
63
|
"prepublishOnly": "npm run build && npm run check:dist"
|