baucli 1.0.2__tar.gz → 1.0.4__tar.gz
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.
- {baucli-1.0.2 → baucli-1.0.4}/PKG-INFO +1 -1
- {baucli-1.0.2 → baucli-1.0.4}/baucli/__init__.py +1 -1
- {baucli-1.0.2 → baucli-1.0.4}/baucli/api.py +5 -0
- {baucli-1.0.2 → baucli-1.0.4}/baucli/cli.py +57 -13
- {baucli-1.0.2 → baucli-1.0.4}/baucli.egg-info/PKG-INFO +1 -1
- {baucli-1.0.2 → baucli-1.0.4}/setup.py +1 -1
- {baucli-1.0.2 → baucli-1.0.4}/README.md +0 -0
- {baucli-1.0.2 → baucli-1.0.4}/baucli/apex_rebuild.py +0 -0
- {baucli-1.0.2 → baucli-1.0.4}/baucli/apexlang.py +0 -0
- {baucli-1.0.2 → baucli-1.0.4}/baucli/config.py +0 -0
- {baucli-1.0.2 → baucli-1.0.4}/baucli/db/__init__.py +0 -0
- {baucli-1.0.2 → baucli-1.0.4}/baucli/db/mssql.py +0 -0
- {baucli-1.0.2 → baucli-1.0.4}/baucli/db/mysql.py +0 -0
- {baucli-1.0.2 → baucli-1.0.4}/baucli/db/oracle.py +0 -0
- {baucli-1.0.2 → baucli-1.0.4}/baucli/db/postgresql.py +0 -0
- {baucli-1.0.2 → baucli-1.0.4}/baucli/docmig.py +0 -0
- {baucli-1.0.2 → baucli-1.0.4}/baucli/git.py +0 -0
- {baucli-1.0.2 → baucli-1.0.4}/baucli/legacy/__init__.py +0 -0
- {baucli-1.0.2 → baucli-1.0.4}/baucli/legacy/delphi.py +0 -0
- {baucli-1.0.2 → baucli-1.0.4}/baucli/mcp_server.py +0 -0
- {baucli-1.0.2 → baucli-1.0.4}/baucli/project.py +0 -0
- {baucli-1.0.2 → baucli-1.0.4}/baucli/rag_embed.py +0 -0
- {baucli-1.0.2 → baucli-1.0.4}/baucli/sample_scan.py +0 -0
- {baucli-1.0.2 → baucli-1.0.4}/baucli/scope_scan.py +0 -0
- {baucli-1.0.2 → baucli-1.0.4}/baucli/screenshot.py +0 -0
- {baucli-1.0.2 → baucli-1.0.4}/baucli/seed_check.py +0 -0
- {baucli-1.0.2 → baucli-1.0.4}/baucli/stress.py +0 -0
- {baucli-1.0.2 → baucli-1.0.4}/baucli/sync.py +0 -0
- {baucli-1.0.2 → baucli-1.0.4}/baucli.egg-info/SOURCES.txt +0 -0
- {baucli-1.0.2 → baucli-1.0.4}/baucli.egg-info/dependency_links.txt +0 -0
- {baucli-1.0.2 → baucli-1.0.4}/baucli.egg-info/entry_points.txt +0 -0
- {baucli-1.0.2 → baucli-1.0.4}/baucli.egg-info/requires.txt +0 -0
- {baucli-1.0.2 → baucli-1.0.4}/baucli.egg-info/top_level.txt +0 -0
- {baucli-1.0.2 → baucli-1.0.4}/setup.cfg +0 -0
|
@@ -822,6 +822,11 @@ class BauApi:
|
|
|
822
822
|
"""GET /quota — Full quota status."""
|
|
823
823
|
return self._request("GET", "quota")
|
|
824
824
|
|
|
825
|
+
def whoami(self) -> dict:
|
|
826
|
+
"""GET /whoami — dono (BAU_USERS) da API key atual: user_email/name/role,
|
|
827
|
+
tenant_code, key_prefix. Usado por `status` e pelo cabeçalho."""
|
|
828
|
+
return self._request("GET", "whoami")
|
|
829
|
+
|
|
825
830
|
# ── DOCAPEX endpoints ──
|
|
826
831
|
|
|
827
832
|
def apex_sync(self, payload: dict) -> dict:
|
|
@@ -55,6 +55,13 @@ def show_db_panel(title: str, db_name: str = None, db_config: dict = None,
|
|
|
55
55
|
lines = [f"[bold red]{__product__} v{__version__}[/bold red] — {title}"]
|
|
56
56
|
lines.append("")
|
|
57
57
|
|
|
58
|
+
# Dono da API key (cacheado por `status`/`init` via GET /whoami).
|
|
59
|
+
if cfg.get("key_user_email"):
|
|
60
|
+
_who = cfg["key_user_email"]
|
|
61
|
+
if cfg.get("key_user_name"):
|
|
62
|
+
_who += f" ({cfg['key_user_name']})"
|
|
63
|
+
lines.append(f" Usuário: [cyan]{_who}[/cyan]")
|
|
64
|
+
|
|
58
65
|
if db_name and db_config:
|
|
59
66
|
engine = db_config.get("engine", "?").upper()
|
|
60
67
|
host = db_config.get("host", "?")
|
|
@@ -80,7 +87,8 @@ def show_db_panel(title: str, db_name: str = None, db_config: dict = None,
|
|
|
80
87
|
if uuid != "—":
|
|
81
88
|
lines.append(f" BAU UUID: {uuid}")
|
|
82
89
|
else:
|
|
83
|
-
|
|
90
|
+
if cfg.get("license_key"):
|
|
91
|
+
lines.append(f" License: [cyan]{cfg['license_key']}[/cyan]")
|
|
84
92
|
lines.append(f" Server: {cfg.get('api_url', '—')}")
|
|
85
93
|
lines.append(f" Tenant: {cfg.get('tenant_code', '—')}")
|
|
86
94
|
lines.append(f" Language: [cyan]{cfg.get('language') or 'en_US (default)'}[/cyan]")
|
|
@@ -394,6 +402,18 @@ def _run_init(license_key: str, api_key_manual: str, api_url: str,
|
|
|
394
402
|
except BauApiError:
|
|
395
403
|
pass
|
|
396
404
|
|
|
405
|
+
# Dono da API key (cacheia p/ o cabeçalho + confirma no init)
|
|
406
|
+
try:
|
|
407
|
+
me = api.whoami()
|
|
408
|
+
if isinstance(me, dict) and me.get("status") == "ok":
|
|
409
|
+
cfg["key_user_email"] = me.get("user_email")
|
|
410
|
+
cfg["key_user_name"] = me.get("user_name")
|
|
411
|
+
save_config(cfg)
|
|
412
|
+
_uname = f" ({me.get('user_name')})" if me.get("user_name") else ""
|
|
413
|
+
console.print(f" Usuário: [green]{me.get('user_email')}[/green]{_uname}")
|
|
414
|
+
except BauApiError:
|
|
415
|
+
pass
|
|
416
|
+
|
|
397
417
|
from .config import CONFIG_FILE
|
|
398
418
|
console.print()
|
|
399
419
|
console.print(f"[green]Config saved to {CONFIG_FILE}[/green]")
|
|
@@ -1969,6 +1989,17 @@ def status():
|
|
|
1969
1989
|
console.print(f"[dim]Perfil ativo:[/dim] [cyan]{cfg['_active_profile']}[/cyan] "
|
|
1970
1990
|
f"· tenant {cfg.get('tenant_code') or '—'}")
|
|
1971
1991
|
|
|
1992
|
+
# Resolve o dono da API key (ao vivo) e cacheia p/ o cabeçalho.
|
|
1993
|
+
if cfg.get("api_key"):
|
|
1994
|
+
try:
|
|
1995
|
+
me = get_api(cfg).whoami()
|
|
1996
|
+
if isinstance(me, dict) and me.get("status") == "ok":
|
|
1997
|
+
cfg["key_user_email"] = me.get("user_email")
|
|
1998
|
+
cfg["key_user_name"] = me.get("user_name")
|
|
1999
|
+
save_config(cfg)
|
|
2000
|
+
except Exception:
|
|
2001
|
+
pass
|
|
2002
|
+
|
|
1972
2003
|
show_db_panel("Status")
|
|
1973
2004
|
|
|
1974
2005
|
# Databases table
|
|
@@ -2041,18 +2072,23 @@ def status():
|
|
|
2041
2072
|
console.print(sync_table)
|
|
2042
2073
|
console.print()
|
|
2043
2074
|
|
|
2044
|
-
# Pending deploys
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2075
|
+
# Pending deploys — só relevantes com uma conexão local segura (sem ela
|
|
2076
|
+
# não há como aplicar). Sem conexão: não lista, só orienta.
|
|
2077
|
+
if not dbs:
|
|
2078
|
+
console.print("\n [dim]Deploys: defina uma conexão de banco "
|
|
2079
|
+
"([cyan]baucli connect[/cyan]) para revisar e aplicar deploys.[/dim]")
|
|
2080
|
+
else:
|
|
2081
|
+
try:
|
|
2082
|
+
deploys = api.deploys_pending()
|
|
2083
|
+
deploy_list = deploys.get("deploys", [])
|
|
2084
|
+
if deploy_list:
|
|
2085
|
+
console.print(f"\n [bold]Pending deploys ({len(deploy_list)}):[/bold]")
|
|
2086
|
+
for d in deploy_list[:5]:
|
|
2087
|
+
console.print(f" #{d.get('id')} {d.get('name', '?')} [{d.get('status', '?')}]")
|
|
2088
|
+
else:
|
|
2089
|
+
console.print(f"\n Pending deploys: 0")
|
|
2090
|
+
except BauApiError:
|
|
2091
|
+
pass
|
|
2056
2092
|
|
|
2057
2093
|
|
|
2058
2094
|
# ═══════════════════════════════════════════════════════════
|
|
@@ -2411,6 +2447,14 @@ def deploy_apply(deploy_ref: str, db_name: str, out_file: str, mark_applied: boo
|
|
|
2411
2447
|
f" Out file: [cyan]{out_file}[/cyan]"])
|
|
2412
2448
|
else:
|
|
2413
2449
|
name, db_config = get_database(cfg, db_name)
|
|
2450
|
+
if not name or not db_config:
|
|
2451
|
+
console.print(
|
|
2452
|
+
"[red]Nenhuma conexão de banco segura definida — não é possível aplicar um deploy.[/red]\n"
|
|
2453
|
+
" Configure uma conexão: [cyan]baucli connect --name <alias> --engine oracle "
|
|
2454
|
+
"--host <host> --port <porta> --service <service> --user <user>[/cyan]\n"
|
|
2455
|
+
" Ou exporte o script para revisar/aplicar manualmente: "
|
|
2456
|
+
f"[cyan]baucli deploy apply {deploy_ref} --out deploy.sql[/cyan]")
|
|
2457
|
+
raise SystemExit(2)
|
|
2414
2458
|
show_db_panel(f"Deploy Apply — {kind.upper()}", db_name=name, db_config=db_config,
|
|
2415
2459
|
extra_lines=[f" Deploy: [cyan]{deploy_ref.upper()}[/cyan]"])
|
|
2416
2460
|
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name="baucli",
|
|
5
|
-
version="1.0.
|
|
5
|
+
version="1.0.4",
|
|
6
6
|
description="BAUCLI — AI-powered database documentation CLI for BAU",
|
|
7
7
|
long_description=open("README.md").read(),
|
|
8
8
|
long_description_content_type="text/markdown",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|