ragfly-cli 1.16.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.
@@ -0,0 +1,73 @@
1
+ Metadata-Version: 2.4
2
+ Name: ragfly-cli
3
+ Version: 1.16.0
4
+ Summary: RAGfly CLI — operate RAGfly from the terminal and CI (login + cloud API). Lightweight, no desktop dependencies.
5
+ Author: CAB Ltda
6
+ License: Proprietary
7
+ Project-URL: Homepage, https://ragfly.ai
8
+ Project-URL: Documentation, https://api.ragfly.ai/docs
9
+ Keywords: ragfly,rag,cli,retrieval,ai,mcp
10
+ Requires-Python: >=3.10
11
+ Description-Content-Type: text/markdown
12
+ Requires-Dist: click>=8.1
13
+ Requires-Dist: rich>=13.0
14
+ Requires-Dist: httpx>=0.27
15
+ Requires-Dist: keyring>=25.0
16
+ Requires-Dist: pydantic>=2.0
17
+ Requires-Dist: pydantic-settings>=2.6
18
+
19
+ # RAGfly CLI
20
+
21
+ Operate RAGfly from the terminal and CI — `login` + the full `cloud` API surface
22
+ against `api.ragfly.ai`. Lightweight: depends only on `click`, `rich`, `httpx`
23
+ and `keyring`. **No desktop / PySide6 / OCR dependencies.**
24
+
25
+ ```bash
26
+ pip install ragfly-cli
27
+ ragfly version
28
+ ragfly login
29
+ ragfly cloud me
30
+ ```
31
+
32
+ > This package ships the **`ragfly` binary** for scripting and automation.
33
+ > It is distinct from `pip install ragfly` (the **Python SDK**, import `import ragfly`)
34
+ > and from **RAGfly Desktop** (the DMG/exe that bundles the local file worker for
35
+ > `ragfly local scan/sync/daemon`).
36
+
37
+ ## Authentication
38
+
39
+ ```bash
40
+ # Interactive (JWT, stored in the OS keyring)
41
+ ragfly login
42
+
43
+ # Non-interactive / CI (API key, no expiry)
44
+ export RAGFLY_TOKEN=slm_live_xxxxxxxxxx
45
+ ```
46
+
47
+ ## Command surface
48
+
49
+ ```
50
+ ragfly
51
+ ├── login / logout / version
52
+ └── cloud ← operations against api.ragfly.ai
53
+ ├── me
54
+ ├── grupo listar | cambiar | limpiar
55
+ ├── documento listar | ver
56
+ ├── espacio listar | ver
57
+ ├── cola ver | ejecuciones
58
+ ├── habilidad listar | ver | ejecutar
59
+ ├── catalogo
60
+ ├── buscar
61
+ └── chat preguntar
62
+ ```
63
+
64
+ Full reference: <https://api.ragfly.ai/docs> and `docs/integradores/CLI.md`.
65
+
66
+ > **Local operations** (`ragfly local scan/sync/daemon`) require the local file
67
+ > worker and ship with **RAGfly Desktop**, not with this package.
68
+
69
+ ## Source
70
+
71
+ The command logic is extracted from the RAGfly Desktop client
72
+ (`cliente/ragfly/`). Canonical source of each module lives there; keep this
73
+ package's copies in sync when the cloud command surface changes.
@@ -0,0 +1,55 @@
1
+ # RAGfly CLI
2
+
3
+ Operate RAGfly from the terminal and CI — `login` + the full `cloud` API surface
4
+ against `api.ragfly.ai`. Lightweight: depends only on `click`, `rich`, `httpx`
5
+ and `keyring`. **No desktop / PySide6 / OCR dependencies.**
6
+
7
+ ```bash
8
+ pip install ragfly-cli
9
+ ragfly version
10
+ ragfly login
11
+ ragfly cloud me
12
+ ```
13
+
14
+ > This package ships the **`ragfly` binary** for scripting and automation.
15
+ > It is distinct from `pip install ragfly` (the **Python SDK**, import `import ragfly`)
16
+ > and from **RAGfly Desktop** (the DMG/exe that bundles the local file worker for
17
+ > `ragfly local scan/sync/daemon`).
18
+
19
+ ## Authentication
20
+
21
+ ```bash
22
+ # Interactive (JWT, stored in the OS keyring)
23
+ ragfly login
24
+
25
+ # Non-interactive / CI (API key, no expiry)
26
+ export RAGFLY_TOKEN=slm_live_xxxxxxxxxx
27
+ ```
28
+
29
+ ## Command surface
30
+
31
+ ```
32
+ ragfly
33
+ ├── login / logout / version
34
+ └── cloud ← operations against api.ragfly.ai
35
+ ├── me
36
+ ├── grupo listar | cambiar | limpiar
37
+ ├── documento listar | ver
38
+ ├── espacio listar | ver
39
+ ├── cola ver | ejecuciones
40
+ ├── habilidad listar | ver | ejecutar
41
+ ├── catalogo
42
+ ├── buscar
43
+ └── chat preguntar
44
+ ```
45
+
46
+ Full reference: <https://api.ragfly.ai/docs> and `docs/integradores/CLI.md`.
47
+
48
+ > **Local operations** (`ragfly local scan/sync/daemon`) require the local file
49
+ > worker and ship with **RAGfly Desktop**, not with this package.
50
+
51
+ ## Source
52
+
53
+ The command logic is extracted from the RAGfly Desktop client
54
+ (`cliente/ragfly/`). Canonical source of each module lives there; keep this
55
+ package's copies in sync when the cloud command surface changes.
@@ -0,0 +1,33 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "ragfly-cli"
7
+ version = "1.16.0"
8
+ description = "RAGfly CLI — operate RAGfly from the terminal and CI (login + cloud API). Lightweight, no desktop dependencies."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { text = "Proprietary" }
12
+ authors = [{ name = "CAB Ltda" }]
13
+ keywords = ["ragfly", "rag", "cli", "retrieval", "ai", "mcp"]
14
+
15
+ dependencies = [
16
+ "click>=8.1",
17
+ "rich>=13.0",
18
+ "httpx>=0.27",
19
+ # JWT en el keyring del SO (Keychain macOS, Credential Manager Windows, libsecret Linux)
20
+ "keyring>=25.0",
21
+ "pydantic>=2.0",
22
+ "pydantic-settings>=2.6",
23
+ ]
24
+
25
+ [project.urls]
26
+ Homepage = "https://ragfly.ai"
27
+ Documentation = "https://api.ragfly.ai/docs"
28
+
29
+ [project.scripts]
30
+ ragfly = "ragfly_cli.cli:app"
31
+
32
+ [tool.setuptools.packages.find]
33
+ include = ["ragfly_cli*"]
@@ -0,0 +1 @@
1
+ __version__ = "1.16.0"
@@ -0,0 +1,5 @@
1
+ """Permite `python -m ragfly_cli`."""
2
+ from ragfly_cli.cli import app
3
+
4
+ if __name__ == "__main__":
5
+ app()
@@ -0,0 +1,67 @@
1
+ """
2
+ Helpers HTTP comunes para todo el cliente.
3
+
4
+ `default_headers()` — Headers que TODA request al backend cloud debe llevar:
5
+ - `Authorization: Bearer <token>` (opcional; solo si token presente)
6
+ - `Content-Type: application/json` (opcional, para writes)
7
+ - `X-Client-Version: <__version__>` (siempre — el backend loggea y, en el
8
+ futuro, puede rechazar versiones incompatibles si ENFORCE_CLIENT_VERSION=true)
9
+
10
+ Para usar:
11
+
12
+ from ragfly_cli._http import default_headers
13
+ headers = default_headers(token=jwt, content_type=True)
14
+ httpx.post(url, headers=headers, json=...)
15
+
16
+ Notas:
17
+ - Si tu request va a un servicio que NO es el backend cloud (ej: LLM externo
18
+ como Anthropic/Google/Ollama), NO uses esta función — usa los headers que
19
+ pida el proveedor.
20
+ """
21
+
22
+ from __future__ import annotations
23
+
24
+ from typing import Optional
25
+
26
+
27
+ def default_headers(
28
+ *,
29
+ token: Optional[str] = None,
30
+ content_type: bool = False,
31
+ grupo_override: Optional[str] = None,
32
+ ) -> dict[str, str]:
33
+ """Construye los headers estándar para una request al backend cloud.
34
+
35
+ Args:
36
+ token: JWT (sin "Bearer " prefix). Si None, no agrega Authorization.
37
+ content_type: Si True, agrega Content-Type: application/json (writes).
38
+ grupo_override: Override explícito del grupo activo. Si None, se lee
39
+ de `ClienteConfig.codigo_grupo` (si está seteado).
40
+
41
+ Returns:
42
+ dict de headers listo para pasar a httpx.
43
+
44
+ El header `X-Override-Grupo` se envía cuando hay grupo activo configurado
45
+ o explícito. El backend lo respeta como override de sesión (mismo patrón
46
+ que el dropdown de grupo del frontend web).
47
+ """
48
+ from ragfly_cli import __version__ as _client_version
49
+
50
+ headers: dict[str, str] = {"X-Client-Version": _client_version}
51
+ if token:
52
+ headers["Authorization"] = f"Bearer {token}"
53
+ if content_type:
54
+ headers["Content-Type"] = "application/json"
55
+
56
+ # Resolver grupo activo: explícito > config
57
+ grupo = grupo_override
58
+ if grupo is None:
59
+ try:
60
+ from .config import get_config
61
+ grupo = get_config().codigo_grupo or None
62
+ except Exception:
63
+ grupo = None
64
+ if grupo:
65
+ headers["X-Override-Grupo"] = grupo
66
+
67
+ return headers