ragfly-cli 1.16.0__tar.gz → 1.17.0__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.
Files changed (23) hide show
  1. {ragfly_cli-1.16.0 → ragfly_cli-1.17.0}/PKG-INFO +2 -1
  2. {ragfly_cli-1.16.0 → ragfly_cli-1.17.0}/README.md +1 -0
  3. {ragfly_cli-1.16.0 → ragfly_cli-1.17.0}/pyproject.toml +1 -1
  4. ragfly_cli-1.17.0/ragfly_cli/__init__.py +1 -0
  5. {ragfly_cli-1.16.0 → ragfly_cli-1.17.0}/ragfly_cli/cli.py +102 -0
  6. {ragfly_cli-1.16.0 → ragfly_cli-1.17.0}/ragfly_cli/cloud_commands.py +14 -0
  7. {ragfly_cli-1.16.0 → ragfly_cli-1.17.0}/ragfly_cli.egg-info/PKG-INFO +2 -1
  8. ragfly_cli-1.16.0/ragfly_cli/__init__.py +0 -1
  9. {ragfly_cli-1.16.0 → ragfly_cli-1.17.0}/ragfly_cli/__main__.py +0 -0
  10. {ragfly_cli-1.16.0 → ragfly_cli-1.17.0}/ragfly_cli/_http.py +0 -0
  11. {ragfly_cli-1.16.0 → ragfly_cli-1.17.0}/ragfly_cli/config.py +0 -0
  12. {ragfly_cli-1.16.0 → ragfly_cli-1.17.0}/ragfly_cli/grupo_activo.py +0 -0
  13. {ragfly_cli-1.16.0 → ragfly_cli-1.17.0}/ragfly_cli/keyring_store.py +0 -0
  14. {ragfly_cli-1.16.0 → ragfly_cli-1.17.0}/ragfly_cli/oop/__init__.py +0 -0
  15. {ragfly_cli-1.16.0 → ragfly_cli-1.17.0}/ragfly_cli/oop/cli_command.py +0 -0
  16. {ragfly_cli-1.16.0 → ragfly_cli-1.17.0}/ragfly_cli/oop/http_client.py +0 -0
  17. {ragfly_cli-1.16.0 → ragfly_cli-1.17.0}/ragfly_cli/version_check.py +0 -0
  18. {ragfly_cli-1.16.0 → ragfly_cli-1.17.0}/ragfly_cli.egg-info/SOURCES.txt +0 -0
  19. {ragfly_cli-1.16.0 → ragfly_cli-1.17.0}/ragfly_cli.egg-info/dependency_links.txt +0 -0
  20. {ragfly_cli-1.16.0 → ragfly_cli-1.17.0}/ragfly_cli.egg-info/entry_points.txt +0 -0
  21. {ragfly_cli-1.16.0 → ragfly_cli-1.17.0}/ragfly_cli.egg-info/requires.txt +0 -0
  22. {ragfly_cli-1.16.0 → ragfly_cli-1.17.0}/ragfly_cli.egg-info/top_level.txt +0 -0
  23. {ragfly_cli-1.16.0 → ragfly_cli-1.17.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ragfly-cli
3
- Version: 1.16.0
3
+ Version: 1.17.0
4
4
  Summary: RAGfly CLI — operate RAGfly from the terminal and CI (login + cloud API). Lightweight, no desktop dependencies.
5
5
  Author: CAB Ltda
6
6
  License: Proprietary
@@ -52,6 +52,7 @@ ragfly
52
52
  └── cloud ← operations against api.ragfly.ai
53
53
  ├── me
54
54
  ├── grupo listar | cambiar | limpiar
55
+ ├── api-key crear | listar | revocar
55
56
  ├── documento listar | ver
56
57
  ├── espacio listar | ver
57
58
  ├── cola ver | ejecuciones
@@ -34,6 +34,7 @@ ragfly
34
34
  └── cloud ← operations against api.ragfly.ai
35
35
  ├── me
36
36
  ├── grupo listar | cambiar | limpiar
37
+ ├── api-key crear | listar | revocar
37
38
  ├── documento listar | ver
38
39
  ├── espacio listar | ver
39
40
  ├── cola ver | ejecuciones
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ragfly-cli"
7
- version = "1.16.0"
7
+ version = "1.17.0"
8
8
  description = "RAGfly CLI — operate RAGfly from the terminal and CI (login + cloud API). Lightweight, no desktop dependencies."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -0,0 +1 @@
1
+ __version__ = "1.17.0"
@@ -236,6 +236,108 @@ def cloud_grupo_limpiar():
236
236
  console.print(" El cliente usará el grupo por defecto del usuario en la próxima request.")
237
237
 
238
238
 
239
+ # ── cloud api-key ─────────────────────────────────────────────────────────────
240
+
241
+ @cloud.group("api-key")
242
+ def cloud_api_key():
243
+ """Gestionar API Keys de larga duración (CI / automatización, sin expiración)."""
244
+ pass
245
+
246
+
247
+ @cloud_api_key.command("crear")
248
+ @click.option("--nombre", required=True, help="Nombre descriptivo de la key (ej. pipeline-ci)")
249
+ @click.option("--rol", default=None, help="Rol solicitado (ej. DOC-ADMIN, DOCS-USUARIO-FINAL). Por defecto: rol principal del dueño")
250
+ @click.option("--area", default=None, help="Acotar la key a un subárbol de área (por defecto hereda la del usuario)")
251
+ @click.option("--usuario-destino", default=None, help="(admin) crear la key para otro usuario del grupo")
252
+ @click.option("-o", "--output", type=click.Choice(["texto", "json"]), default="texto")
253
+ def cloud_api_key_crear(nombre: str, rol: str | None, area: str | None, usuario_destino: str | None, output: str):
254
+ """Crear una API Key. El secreto se muestra UNA sola vez."""
255
+ from .cloud_commands import cloud_post
256
+ from .oop import CliCommand
257
+
258
+ body: dict = {"nombre": nombre}
259
+ if rol:
260
+ body["rol_solicitado"] = rol
261
+ if area:
262
+ body["codigo_area"] = area
263
+ if usuario_destino:
264
+ body["codigo_usuario_destino"] = usuario_destino
265
+
266
+ cmd = CliCommand()
267
+ data = cmd.protegido(cloud_post, "/auth/api-key", body)
268
+
269
+ if output == "json":
270
+ console.print(json.dumps(data, indent=2, ensure_ascii=False, default=str))
271
+ return
272
+
273
+ console.print()
274
+ console.print(f"[green]✓ API Key creada:[/green] [bold]{data.get('nombre')}[/bold]")
275
+ console.print(Panel(
276
+ f"[bold yellow]{data.get('api_key')}[/bold yellow]",
277
+ title="Guardala AHORA — no se vuelve a mostrar",
278
+ border_style="yellow",
279
+ ))
280
+ console.print(f" Prefijo: [dim]{data.get('prefijo')}[/dim] Rol: {data.get('codigo_rol') or '—'} Grupo: {data.get('codigo_grupo')}")
281
+ console.print(f" Uso: [dim]export RAGFLY_TOKEN={data.get('api_key')}[/dim]")
282
+ console.print()
283
+
284
+
285
+ @cloud_api_key.command("listar")
286
+ @click.option("-o", "--output", type=click.Choice(["tabla", "json"]), default="tabla")
287
+ def cloud_api_key_listar(output: str):
288
+ """Listar las API Keys del usuario (sin el secreto, solo prefijo)."""
289
+ from .cloud_commands import cloud_get
290
+ from .oop import CliCommand
291
+
292
+ cmd = CliCommand()
293
+ data = cmd.protegido(cloud_get, "/auth/api-key")
294
+ items = data if isinstance(data, list) else data.get("items", [])
295
+
296
+ if output == "json":
297
+ console.print(json.dumps(items, indent=2, ensure_ascii=False, default=str))
298
+ return
299
+
300
+ console.print()
301
+ if not items:
302
+ console.print("[yellow]No tenés API Keys.[/yellow] Creá una con `ragfly cloud api-key crear --nombre ...`.")
303
+ return
304
+
305
+ t = Table(title="API Keys", border_style="dim")
306
+ t.add_column("Prefijo", style="bold")
307
+ t.add_column("Nombre")
308
+ t.add_column("Rol", style="dim")
309
+ t.add_column("Área", style="dim")
310
+ t.add_column("Creada")
311
+ t.add_column("Último uso")
312
+ t.add_column("Estado")
313
+ for k in items:
314
+ revocada = k.get("revocada_en")
315
+ estado = "[red]revocada[/red]" if revocada else "[green]activa[/green]"
316
+ t.add_row(
317
+ k.get("prefijo") or "—",
318
+ k.get("nombre") or "—",
319
+ k.get("codigo_rol") or "—",
320
+ k.get("codigo_area") or "—",
321
+ (k.get("creada_en") or "—")[:10],
322
+ (k.get("ultimo_uso") or "—")[:10],
323
+ estado,
324
+ )
325
+ console.print(t)
326
+ console.print()
327
+
328
+
329
+ @cloud_api_key.command("revocar")
330
+ @click.argument("prefijo")
331
+ def cloud_api_key_revocar(prefijo: str):
332
+ """Revocar una API Key por su prefijo (deja de autenticar de inmediato)."""
333
+ from .cloud_commands import cloud_delete
334
+ from .oop import CliCommand
335
+
336
+ cmd = CliCommand()
337
+ cmd.protegido(cloud_delete, f"/auth/api-key/{prefijo}")
338
+ console.print(f"[green]✓ API Key revocada:[/green] [bold]{prefijo}[/bold]")
339
+
340
+
239
341
  # ── cloud documento ──────────────────────────────────────────────────────────
240
342
 
241
343
  @cloud.group("documento")
@@ -155,6 +155,20 @@ def cloud_post(
155
155
  return CloudHttpClient(timeout_write=timeout).post(path, body=body, params=params, token=token)
156
156
 
157
157
 
158
+ def cloud_delete(
159
+ path: str,
160
+ params: dict | None = None,
161
+ token: str | None = None,
162
+ timeout: int = 30,
163
+ ) -> Any:
164
+ """DELETE autenticado contra CLOUD_URL/path. Retorna JSON parseado.
165
+
166
+ Wrapper retrocompatible sobre `CloudHttpClient` (ragfly_cli.oop).
167
+ """
168
+ from ragfly_cli.oop import CloudHttpClient
169
+ return CloudHttpClient().delete(path, params=params, token=token, timeout=timeout)
170
+
171
+
158
172
  def _manejar_http_error(e: httpx.HTTPStatusError) -> None:
159
173
  status = e.response.status_code
160
174
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ragfly-cli
3
- Version: 1.16.0
3
+ Version: 1.17.0
4
4
  Summary: RAGfly CLI — operate RAGfly from the terminal and CI (login + cloud API). Lightweight, no desktop dependencies.
5
5
  Author: CAB Ltda
6
6
  License: Proprietary
@@ -52,6 +52,7 @@ ragfly
52
52
  └── cloud ← operations against api.ragfly.ai
53
53
  ├── me
54
54
  ├── grupo listar | cambiar | limpiar
55
+ ├── api-key crear | listar | revocar
55
56
  ├── documento listar | ver
56
57
  ├── espacio listar | ver
57
58
  ├── cola ver | ejecuciones
@@ -1 +0,0 @@
1
- __version__ = "1.16.0"
File without changes