Metadata-Version: 2.3
Name: baserow-cli
Version: 0.1.0
Summary: Baserow CLI for AI agents and humans
Keywords: baserow,cli,database
Author: Jamil Zakirov
Author-email: Jamil Zakirov <jamil@zakirov.com>
License: MIT License
         
         Copyright (c) 2025 jzakirov
         
         Permission is hereby granted, free of charge, to any person obtaining a copy
         of this software and associated documentation files (the "Software"), to deal
         in the Software without restriction, including without limitation the rights
         to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         copies of the Software, and to permit persons to whom the Software is
         furnished to do so, subject to the following conditions:
         
         The above copyright notice and this permission notice shall be included in all
         copies or substantial portions of the Software.
         
         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         SOFTWARE.
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: License :: OSI Approved :: MIT License
Classifier: Environment :: Console
Classifier: Topic :: Utilities
Requires-Dist: typer>=0.12.0
Requires-Dist: httpx>=0.27.0
Requires-Dist: tomlkit>=0.13.0
Requires-Python: >=3.10
Project-URL: Homepage, https://github.com/jzakirov/baserow-cli
Project-URL: Source, https://github.com/jzakirov/baserow-cli
Project-URL: Issues, https://github.com/jzakirov/baserow-cli/issues
Description-Content-Type: text/markdown

# baserow-cli

A command-line tool for [Baserow](https://baserow.io) — the open-source Airtable alternative.

Built for AI agents and automation, but works great for humans too. JSON output to stdout, structured errors to stderr, config via file/env/flags.

## Install

```bash
uv tool install baserow-cli
```

Or with pip:

```bash
pip install baserow-cli
```

## Quick start

```bash
# Set your Baserow database token and instance URL
export BASEROW_TOKEN="your-database-token"
export BASEROW_URL="https://your-baserow-instance.com"

# Or run the interactive setup
baserow config init
```

Create a database token in Baserow under Settings > Database tokens. Tokens are scoped per-table — you control exactly what the CLI can access.

## Usage

```bash
# List tables accessible by your token
baserow tables list

# Get table info with field definitions
baserow tables get 42

# List rows (with search, filtering, sorting, pagination)
baserow rows list --table 42
baserow rows list --table 42 --search "quarterly" --size 50
baserow rows list --table 42 --filter "Status__equal=Done" --order-by "-Created"

# Single row operations
baserow rows get 1 --table 42
baserow rows create --table 42 --json '{"Name": "New item", "Status": "Todo"}'
baserow rows update 1 --table 42 --json '{"Status": "Done"}'
baserow rows delete 1 --table 42 --yes

# Batch operations
baserow rows batch-create --table 42 --json '[{"Name": "A"}, {"Name": "B"}]'
baserow rows batch-update --table 42 --json '[{"id": 1, "Status": "Done"}, {"id": 2, "Status": "Done"}]'
baserow rows batch-delete --table 42 --json '[3, 4, 5]' --yes

# Pipe JSON from stdin
cat data.json | baserow rows batch-create --table 42 --json -
```

## Configuration

Config is loaded with priority: **config file < env vars < CLI flags**.

| Source | Token | URL | Default table |
|---|---|---|---|
| Config file | `core.token` | `core.base_url` | `defaults.table` |
| Env var | `BASEROW_TOKEN` | `BASEROW_URL` | `BASEROW_TABLE` |
| CLI flag | `--token` | `--base-url` | `--table` |

Config file location: `~/.config/baserow-cli/config.toml`

```bash
# Manage config
baserow config init          # interactive setup
baserow config show          # print current config (token masked)
baserow config show --reveal # show full token
baserow config set defaults.table 42
```

## Output

All commands output JSON to stdout. Errors go to stderr as structured JSON:

```json
{"error": {"type": "not_found", "message": "...", "status_code": 404}}
```

Exit codes: `0` success, `1` error, `2` rate limited.

## License

MIT
