Metadata-Version: 2.4
Name: baucli
Version: 1.0.36
Summary: Extracts verified business-logic and schema context from Oracle, PostgreSQL, MySQL and SQL Server
Home-page: https://www.begcloud.com
Author: BEG Support
Author-email: contato@begcloud.com
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Database
Classifier: Topic :: Documentation
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: click>=8.0
Requires-Dist: requests>=2.28
Requires-Dist: rich>=13.0
Requires-Dist: oracledb>=2.0
Requires-Dist: mysql-connector-python>=8.0
Requires-Dist: psycopg>=3.0
Requires-Dist: python-tds>=1.12
Requires-Dist: mcp>=1.2
Provides-Extra: keyring
Requires-Dist: keyring>=24.0; extra == "keyring"
Provides-Extra: screenshot
Requires-Dist: playwright>=1.40; extra == "screenshot"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# BAUCLI

**Business-logic context for your databases — kept true to production.**

BAUCLI runs on the developer's machine. It connects to Oracle, PostgreSQL, MySQL and
SQL Server, extracts the real structure and PL/SQL logic, and turns it into documentation
that is reviewed by people and consumed by AI — then writes it back where it belongs:
`COMMENT ON` in the database and context files in your repository.

Because the context is extracted from the live database on every sync, it does not drift
away from what is actually deployed. That is the difference between documentation you
trust and documentation you stopped reading.

It is the local component of the **BAU** platform (BEG Application Utilities), which stores
the catalog, runs the AI drafting and holds the approval workflow.

## Quick Start

```bash
# Install
pip install baucli

# or with all database drivers
pip install baucli[all]

# Activate license
baucli init --license BAU-XXXX-XXXX-XXXX-XXXX

# Add a database
baucli connect --name dev_oracle --engine oracle \
  --host localhost --port 1521 --service XEPDB1 --user DEMO_HR \
  --schemas DEMO_HR

# Sync objects to BAU Server
baucli sync

# Download AI context for your IDE
baucli context
```

## Commands

| Command | Description |
|---------|-------------|
| `baucli init --license <key>` | Activate license, receive API key |
| `baucli connect --name <alias> ...` | Add and test a database connection |
| `baucli sync [--db name \| --all]` | Sync objects to BAU Server |
| `baucli context [--db name]` | Download AI context (CLAUDE.md) |
| `baucli status` | Show config, quota, pending deploys |
| `baucli deploy list` | List pending deploys |
| `baucli deploy approve <id>` | Approve a deploy |
| `baucli deploy apply <id>` | Download and apply deploy script |
| `baucli db list` | List configured databases |
| `baucli db remove <name>` | Remove a database |
| `baucli db default <name>` | Set default database |

## Multi-Database Support

Configure multiple databases in `~/.baucli/config.json`:

```bash
# Add Oracle dev
baucli connect --name dev_oracle --engine oracle --host localhost --port 1521 --service XEPDB1 --user HR

# Add PostgreSQL staging
baucli connect --name staging_pg --engine postgresql --host pg-staging --port 5432 --database erp --user app_user

# Add SQL Server production
baucli connect --name prod_mssql --engine mssql --host sql-prod --port 1433 --database erp --user bau_reader

# Sync specific database
baucli sync --db staging_pg

# Sync all
baucli sync --all

# Set default
baucli db default dev_oracle
```

## Supported Databases

| Engine | Driver | Install |
|--------|--------|---------|
| Oracle 19c+ | oracledb (thin mode) | `pip install baucli` (included) |
| PostgreSQL 14+ | psycopg | `pip install baucli` (included) |
| SQL Server 2019+ | python-tds | `pip install baucli` (included) |
| MySQL 8.0+ | mysql-connector | `pip install baucli` (included) |

## Configuration

Config file: `~/.baucli/config.json`

```json
{
  "license_key": "BAU-XXXX-XXXX-XXXX-XXXX",
  "api_url": "https://begbrokerdev.begcloud.com/ords/bauctx/api/v1",
  "api_key": "bau_cli_xxxx",
  "tenant_code": "ACME_CORP",
  "default_db": "dev_oracle",
  "databases": {
    "dev_oracle": {
      "engine": "oracle",
      "host": "localhost",
      "port": 1521,
      "service": "XEPDB1",
      "user": "DEMO_HR",
      "schemas": ["DEMO_HR"]
    },
    "staging_pg": {
      "engine": "postgresql",
      "host": "pg-staging.internal",
      "port": 5432,
      "database": "erp_hml",
      "user": "app_user",
      "schemas": ["public", "hr"]
    }
  },
  "sync_interval_min": 30,
  "context_output": "CLAUDE.md"
}
```

Passwords are stored separately in `~/.baucli/.credentials` (restricted permissions).

Override config dir with `BAUCLI_HOME=~/.baucli-tenant2` to keep multiple isolated profiles on the same machine.

## Security

- Database credentials **never leave the developer's machine**
- Only extracted metadata and source code are sent to BAU Server via HTTPS
- API key uses SHA256 hash — plain token shown once at `baucli init`
- Passwords stored in `~/.baucli/.credentials` with mode 600 (or OS keychain when available)
- BAU Server **never executes DDL** on your database

## Requirements

- Python 3.9+
- Network access to BAU Server (HTTPS)
- Database access (read-only on DBA_SOURCE, DBA_TABLES, etc.)

## License

Proprietary — BEG Support © 2025-2026
www.begcloud.com
