Metadata-Version: 2.4
Name: baseshift
Version: 3.4.0
Summary: CLI for Baseshift database clones: dubs, snapshots, and local or server clones
Home-page: https://baseshift.com
Author: Baseshift
License: BSD 2-Clause License
Project-URL: Homepage, https://baseshift.com
Keywords: baseshift,database,clone,postgres,mysql,mongodb,cli
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Database
Classifier: Topic :: Software Development :: Testing
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: THIRD-PARTY-NOTICES
License-File: LICENSES-Apache-2.0-Helm.txt
Requires-Dist: requests
Requires-Dist: importlib-metadata; python_version < "3.8"
Requires-Dist: sentry-sdk
Requires-Dist: psycopg[binary]
Requires-Dist: pymysql
Requires-Dist: pymongo
Requires-Dist: httpx
Requires-Dist: mcp<2,>=1.29.1
Requires-Dist: cryptography
Requires-Dist: PyYAML
Provides-Extra: ts
Requires-Dist: baseshift-tailscale==3.4.0; extra == "ts"
Dynamic: license-file

# baseshift

Command-line client for [Baseshift](https://baseshift.com). Create **dubs**
(masked or subsetted copies of a source database), take **snapshots**, and
start **clones** for development and testing.

## Install

```bash
pip install baseshift
```

Platform wheels ship for:

- macOS (Intel and Apple Silicon)
- Linux (`x86_64` and `arm64`)
- Windows (`amd64`)

The default install talks to clones over WireGuard. For Tailscale, install
the companion extra so both packages stay on the same version:

```bash
pip install 'baseshift[ts]'
```

Confirm the install:

```bash
baseshift --version
baseshift --help
```

## Quick start

```bash
# Browser OAuth (default). Use --method=direct for email/password.
baseshift auth login

# Optional: write ~/.baseshift/config (org token and default dub)
baseshift init

# Create a cloud dub with demo data, or point at your own Postgres.
baseshift dub create --name my-dub --use-demo-db --encryption-password MyKey123
baseshift dub list --org-token <org-uuid>

# Snapshot, then start a clone and print connection details.
baseshift snapshot create --dub my-dub --wait
baseshift server-clone start --dub my-dub
baseshift server-clone list --dub my-dub
baseshift server-clone stop
```

`--dub` accepts a name or a UUID. A name is resolved by the API; pass
`--org-token` (or set `BASESHIFT_ORG_TOKEN` / `orgToken` in config) when the
same name exists in more than one org. A UUID never needs `--org-token`.

## Commands

| Command | What it does |
| --- | --- |
| `auth` | Log in, log out, and check authentication status |
| `init` | Create `~/.baseshift/config` with default org and dub |
| `dub` | Create and manage dubs (cloud or self-hosted Helm) |
| `data-env` | Create and manage data environments and their snapshots |
| `server-clone` | Start, stop, and list clones on Baseshift servers |
| `local-clone` | Pull or run a dub's snapshot image with local Docker |
| `snapshot` | Create, check, and list snapshots of a dub |
| `mcp` | Run the Baseshift MCP server on stdio |

Run `baseshift <command> --help` (and `baseshift dub create -h`) for flags.
Common `dub` actions: `create`, `list`, `describe`, `status`, `health-check`,
`validate-values`, `configure-source`, `subset`, `masking`.

### Cloud dub against your database

```bash
baseshift dub create --name my-dub \
  --hostname mydb.example.com --database acme --username app \
  --password-stdin --encryption-password MyKey123
```

### Self-hosted dub (Helm values)

```bash
baseshift dub create --deployment self-hosted --name my-onprem-dub \
  --hostname mydb.example.com --database acme --username dubhub \
  --password-stdin --registry-type none
baseshift dub validate-values --values-file values.yaml
```

### Local Docker clone

```bash
baseshift local-clone pull --dub my-dub
baseshift local-clone run --dub my-dub -- --publish 5432:5432
```

## Configuration

Values resolve as **CLI flag → environment variable → `~/.baseshift/config` → default**.

`baseshift init` writes JSON to `~/.baseshift/config`:

```json
{
    "orgToken": "<org-uuid>",
    "dubUuid": "<dub-uuid>"
}
```

| Setting | Flag | Environment | Config key |
| --- | --- | --- | --- |
| Organization | `--org-token` | `BASESHIFT_ORG_TOKEN` | `orgToken` |
| Default dub | `--dub` / `--dub-uuid` | `BASESHIFT_DUB_UUID` | `dubUuid` |

Useful environment variables:

- `BASESHIFT_VERBOSE=1` — DEBUG logs and full tracebacks (same as `-v`)
- `BASESHIFT_DISABLE_SENTRY=1` — disable error telemetry
- `BASESHIFT_HELM_BIN` — override the bundled Helm binary used by `dub validate-values`

## MCP

`baseshift mcp` runs an MCP server on stdio (start/stop clones and related
tools). Log in with `baseshift auth login` first. Example Cursor config:

```json
{
  "mcpServers": {
    "baseshift": {
      "command": "baseshift",
      "args": ["mcp"]
    }
  }
}
```

## Links

- Product: [baseshift.com](https://baseshift.com)
- App: [app.baseshift.com](https://app.baseshift.com)
- PyPI: [pypi.org/project/baseshift](https://pypi.org/project/baseshift/)

## License

BSD 2-Clause. See `LICENSE`, `THIRD-PARTY-NOTICES`, and
`LICENSES-Apache-2.0-Helm.txt` (bundled Helm).
