Skip to content

Commit c191881

Browse files
sync from internal repository
1 parent 16f6a25 commit c191881

File tree

5 files changed

+70
-36
lines changed

5 files changed

+70
-36
lines changed

README.md

Lines changed: 66 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,96 @@
11
# dkdc-md-cli
22

3-
CLI for the [MotherDuck](https://motherduck.com) REST API.
3+
CLI for the [MotherDuck REST API](https://motherduck.com/docs/sql-reference/rest-api/motherduck-rest-api/).
44

5-
## install
5+
## Install
6+
7+
Pre-built binaries are available for Linux and macOS via Python. Windows users should install via `cargo` or use macOS/Linux.
68

79
```bash
8-
# from source (Rust binary)
9-
cargo install --path dkdc-md-cli
10+
# Python (PyPI) — includes pre-built wheels for Linux and macOS
11+
uv tool install dkdc-md-cli
12+
uvx --from dkdc-md-cli md
1013

11-
# from source (Python)
12-
uv tool install .
14+
# Rust (crates.io)
15+
cargo install dkdc-md-cli
1316
```
1417

15-
## authentication
18+
## Authentication
1619

17-
Set one of the following environment variables:
20+
Set a MotherDuck API token via environment variable:
1821

1922
```bash
2023
export MOTHERDUCK_TOKEN="your-token-here"
2124
```
2225

23-
Also accepted: `motherduck_token`, `MOTHERDUCK_API_KEY`, `motherduck_api_key`.
26+
Token resolution order (first non-empty wins):
27+
28+
1. `--token` flag (pass `-` to read from stdin)
29+
2. `motherduck_token`
30+
3. `MOTHERDUCK_TOKEN`
31+
4. `motherduck_api_key`
32+
5. `MOTHERDUCK_API_KEY`
33+
34+
You can also pass in `--token` to commands.
35+
36+
## Usage
37+
38+
```
39+
md [--output text|json] [--token TOKEN] [--yes] <command>
40+
```
41+
42+
### Global flags
2443

25-
## usage
44+
| Flag | Short | Description |
45+
|------|-------|-------------|
46+
| `--output` | `-o` | Output format: `text` (default) or `json` |
47+
| `--token` | | API token (overrides env vars; `-` reads from stdin) |
48+
| `--yes` | `-y` | Skip confirmation prompts |
49+
50+
### `service-account`
2651

2752
```bash
28-
# service accounts
29-
md service-account create myaccount
30-
md service-account delete myaccount
53+
# Create a service account
54+
md service-account create <username>
3155

32-
# duckling configuration
33-
md duckling get myaccount
34-
md duckling set myaccount --rw-size pulse --rs-size pulse --flock-size 1
56+
# Delete a service account (prompts for confirmation)
57+
md service-account delete <username>
58+
```
3559

36-
# access tokens
37-
md token list myaccount
38-
md token create myaccount --name my-token --ttl 3600
39-
md token delete myaccount <token-id>
60+
### `token`
4061

41-
# active accounts
42-
md account list-active
62+
```bash
63+
# List tokens for a user
64+
md token list <username>
65+
66+
# Create a new token
67+
md token create <username> --name <name> [--ttl <seconds>] [--token-type <type>]
4368

44-
# JSON output (for piping to jq, etc.)
45-
md token list myaccount -o json
69+
# Delete a token (prompts for confirmation)
70+
md token delete <username> <token_id>
4671
```
4772

48-
## development
73+
`--ttl`: time-to-live in seconds (300–31536000). Omit for no expiration.
74+
75+
`--token-type`: `read-write` (default) or `read-scaling`.
76+
77+
### `duckling`
4978

5079
```bash
51-
bin/setup # install rustup + uv
52-
bin/build # build Rust + Python
53-
bin/check # lint + test
54-
bin/format # auto-format
55-
bin/install # install locally
80+
# Get current duckling config
81+
md duckling get <username>
82+
83+
# Set duckling config (at least one override required)
84+
md duckling set <username> [--rw-size <size>] [--rs-size <size>] [--flock-size <n>]
5685
```
5786

58-
Integration tests (requires `MOTHERDUCK_TOKEN`):
87+
Instance sizes: `pulse`, `standard`, `jumbo`, `mega`, `giga`.
88+
89+
Flock size: 0–64. `duckling set` fetches the current config and merges your overrides, so you only need to specify what you're changing.
90+
91+
### `account`
5992

6093
```bash
61-
tests/integration-test
94+
# List active accounts and their ducklings
95+
md account list-active
6296
```

dkdc-md-cli-py/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[package]
44
name = "dkdc-md-cli-py"
5-
version = "0.1.1"
5+
version = "0.1.2"
66
edition = "2024"
77
authors = ["Cody <cody@dkdc.dev>"]
88
license = "MIT"

dkdc-md-cli/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dkdc-md-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[package]
44
name = "dkdc-md-cli"
5-
version = "0.1.1"
5+
version = "0.1.2"
66
edition = "2024"
77
rust-version = "1.93"
88
authors = ["Cody <cody@dkdc.dev>"]

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "dkdc-md-cli"
3-
version = "0.1.1"
3+
version = "0.1.2"
44
description = "CLI for the MotherDuck REST API"
55
requires-python = ">=3.11"
66
license = "MIT"

0 commit comments

Comments
 (0)