ragfly-cli 2.0.0__tar.gz → 2.1.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 (29) hide show
  1. {ragfly_cli-2.0.0/ragfly_cli.egg-info → ragfly_cli-2.1.0}/PKG-INFO +2 -2
  2. {ragfly_cli-2.0.0 → ragfly_cli-2.1.0}/README.md +1 -1
  3. {ragfly_cli-2.0.0 → ragfly_cli-2.1.0}/pyproject.toml +1 -1
  4. ragfly_cli-2.1.0/ragfly_cli/__init__.py +1 -0
  5. {ragfly_cli-2.0.0 → ragfly_cli-2.1.0}/ragfly_cli/cli.py +21 -3
  6. {ragfly_cli-2.0.0 → ragfly_cli-2.1.0}/ragfly_cli/config.py +0 -1
  7. {ragfly_cli-2.0.0 → ragfly_cli-2.1.0/ragfly_cli.egg-info}/PKG-INFO +2 -2
  8. {ragfly_cli-2.0.0 → ragfly_cli-2.1.0}/ragfly_cli.egg-info/SOURCES.txt +1 -0
  9. ragfly_cli-2.1.0/tests/test_login_summary_cli.py +34 -0
  10. {ragfly_cli-2.0.0 → ragfly_cli-2.1.0}/tests/test_surface_parity_cli.py +12 -0
  11. ragfly_cli-2.0.0/ragfly_cli/__init__.py +0 -1
  12. {ragfly_cli-2.0.0 → ragfly_cli-2.1.0}/LICENSE +0 -0
  13. {ragfly_cli-2.0.0 → ragfly_cli-2.1.0}/ragfly_cli/__main__.py +0 -0
  14. {ragfly_cli-2.0.0 → ragfly_cli-2.1.0}/ragfly_cli/_http.py +0 -0
  15. {ragfly_cli-2.0.0 → ragfly_cli-2.1.0}/ragfly_cli/_runtime.py +0 -0
  16. {ragfly_cli-2.0.0 → ragfly_cli-2.1.0}/ragfly_cli/cloud_commands.py +0 -0
  17. {ragfly_cli-2.0.0 → ragfly_cli-2.1.0}/ragfly_cli/grupo_activo.py +0 -0
  18. {ragfly_cli-2.0.0 → ragfly_cli-2.1.0}/ragfly_cli/keyring_store.py +0 -0
  19. {ragfly_cli-2.0.0 → ragfly_cli-2.1.0}/ragfly_cli/oop/__init__.py +0 -0
  20. {ragfly_cli-2.0.0 → ragfly_cli-2.1.0}/ragfly_cli/oop/cli_command.py +0 -0
  21. {ragfly_cli-2.0.0 → ragfly_cli-2.1.0}/ragfly_cli/oop/http_client.py +0 -0
  22. {ragfly_cli-2.0.0 → ragfly_cli-2.1.0}/ragfly_cli/version_check.py +0 -0
  23. {ragfly_cli-2.0.0 → ragfly_cli-2.1.0}/ragfly_cli.egg-info/dependency_links.txt +0 -0
  24. {ragfly_cli-2.0.0 → ragfly_cli-2.1.0}/ragfly_cli.egg-info/entry_points.txt +0 -0
  25. {ragfly_cli-2.0.0 → ragfly_cli-2.1.0}/ragfly_cli.egg-info/requires.txt +0 -0
  26. {ragfly_cli-2.0.0 → ragfly_cli-2.1.0}/ragfly_cli.egg-info/top_level.txt +0 -0
  27. {ragfly_cli-2.0.0 → ragfly_cli-2.1.0}/setup.cfg +0 -0
  28. {ragfly_cli-2.0.0 → ragfly_cli-2.1.0}/tests/test_agent_context_cli.py +0 -0
  29. {ragfly_cli-2.0.0 → ragfly_cli-2.1.0}/tests/test_api_key_group_override.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ragfly-cli
3
- Version: 2.0.0
3
+ Version: 2.1.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: MIT
@@ -76,7 +76,7 @@ ragfly
76
76
  ├── login / logout / version
77
77
  └── cloud ← the English REST /v1 contract of api.ragfly.ai
78
78
  ├── me
79
- ├── workspace set [WORKSPACE_CODE] | set --clear
79
+ ├── workspace set [WORKSPACE_CODE] | set --clear | unset
80
80
  ├── area set [AREA_CODE] | set --release | list
81
81
  ├── location list
82
82
  ├── group list | switch | clear (signed-in person)
@@ -55,7 +55,7 @@ ragfly
55
55
  ├── login / logout / version
56
56
  └── cloud ← the English REST /v1 contract of api.ragfly.ai
57
57
  ├── me
58
- ├── workspace set [WORKSPACE_CODE] | set --clear
58
+ ├── workspace set [WORKSPACE_CODE] | set --clear | unset
59
59
  ├── area set [AREA_CODE] | set --release | list
60
60
  ├── location list
61
61
  ├── group list | switch | clear (signed-in person)
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ragfly-cli"
7
- version = "2.0.0"
7
+ version = "2.1.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__ = "2.1.0"
@@ -179,9 +179,15 @@ def login(email: str | None, password_stdin: bool):
179
179
 
180
180
  console.print()
181
181
  console.print(f"[green]✓ Logged in as[/green] {email}")
182
- usuario = data.get("usuario", {}) if isinstance(data.get("usuario"), dict) else {}
183
- console.print(f" Active group: {data.get('grupo_activo') or usuario.get('grupo_por_defecto') or '—'}")
184
- console.print(f" Active workspace: {data.get('entidad_activa') or usuario.get('entidad_por_defecto') or '—'}")
182
+ # The summary reads the public session (`/v1/session`), never the internal
183
+ # login payload: the CLI speaks workspace, not the backend's own names.
184
+ try:
185
+ from .cloud_commands import cloud_request
186
+ sesion = cloud_request("GET", "/v1/session", token=data.get("access_token") or data.get("token"), timeout=15) or {}
187
+ except Exception:
188
+ sesion = {}
189
+ console.print(f" Active group: {sesion.get('active_group') or '—'}")
190
+ console.print(f" Active workspace: {sesion.get('active_workspace') or '—'}")
185
191
  console.print(" Session stored in [dim]OS keyring[/dim]")
186
192
  console.print()
187
193
 
@@ -266,6 +272,18 @@ def cloud_workspace_set(workspace_code: str | None, release: bool, output: str):
266
272
  console.print(f"[green]✓ Active workspace:[/green] [bold]{active}[/bold]")
267
273
 
268
274
 
275
+ @cloud_workspace.command("unset")
276
+ @click.option("-o", "--output", type=OUTPUT_TABLE, default="table")
277
+ def cloud_workspace_unset(output: str):
278
+ """Release the workspace focus (same as `set --clear`): use all authorized workspaces."""
279
+ data = _v1("DELETE", "/v1/session/active-workspace")
280
+ if output == "json":
281
+ _emit_json(data)
282
+ return
283
+ active = data.get("active_workspace") or "all authorized workspaces"
284
+ console.print(f"[green]✓ Active workspace:[/green] [bold]{active}[/bold]")
285
+
286
+
269
287
  # ── cloud area / cloud location ─────────────────────────────────────────────
270
288
 
271
289
  HIERARCHY_COLUMNS = [("Code", "code"), ("Name", "name"), ("Parent", "parent_code"), ("Depth", "depth"),
@@ -39,7 +39,6 @@ class ClienteConfig(BaseSettings):
39
39
 
40
40
  # --- Contexto multi-tenant ---
41
41
  codigo_grupo: str = ""
42
- codigo_entidad: str = ""
43
42
 
44
43
  # --- Rutas locales ---
45
44
  directorio_documentos: str = ""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ragfly-cli
3
- Version: 2.0.0
3
+ Version: 2.1.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: MIT
@@ -76,7 +76,7 @@ ragfly
76
76
  ├── login / logout / version
77
77
  └── cloud ← the English REST /v1 contract of api.ragfly.ai
78
78
  ├── me
79
- ├── workspace set [WORKSPACE_CODE] | set --clear
79
+ ├── workspace set [WORKSPACE_CODE] | set --clear | unset
80
80
  ├── area set [AREA_CODE] | set --release | list
81
81
  ├── location list
82
82
  ├── group list | switch | clear (signed-in person)
@@ -22,4 +22,5 @@ ragfly_cli/oop/cli_command.py
22
22
  ragfly_cli/oop/http_client.py
23
23
  tests/test_agent_context_cli.py
24
24
  tests/test_api_key_group_override.py
25
+ tests/test_login_summary_cli.py
25
26
  tests/test_surface_parity_cli.py
@@ -0,0 +1,34 @@
1
+ """`ragfly login` shows the active group and workspace from the public session, never from the internal login payload."""
2
+ from click.testing import CliRunner
3
+
4
+ from ragfly_cli import cloud_commands
5
+ from ragfly_cli.cli import app
6
+
7
+
8
+ def test_login_summary_reads_the_public_session(monkeypatch):
9
+ internal = {"access_token": "jwt.a.b", "grupo_activo": "OLD-G", "entidad_activa": "OLD-E"}
10
+ monkeypatch.setattr(cloud_commands, "login", lambda email, password: internal)
11
+ calls = []
12
+
13
+ def fake_request(method, path, params=None, body=None, token=None, timeout=None):
14
+ calls.append((method, path, token))
15
+ return {"active_group": "G1", "active_workspace": "W1"}
16
+
17
+ monkeypatch.setattr(cloud_commands, "cloud_request", fake_request)
18
+ result = CliRunner().invoke(app, ["login", "--email", "a@b.c", "--password-stdin"], input="pw\n")
19
+ assert result.exit_code == 0, result.output
20
+ assert calls == [("GET", "/v1/session", "jwt.a.b")]
21
+ assert "Active workspace: W1" in result.output and "Active group: G1" in result.output
22
+ assert "OLD-" not in result.output
23
+
24
+
25
+ def test_login_summary_survives_an_unreachable_session(monkeypatch):
26
+ monkeypatch.setattr(cloud_commands, "login", lambda email, password: {"access_token": "jwt.a.b"})
27
+
28
+ def failing(*args, **kwargs):
29
+ raise cloud_commands.CloudError("down", exit_code=2)
30
+
31
+ monkeypatch.setattr(cloud_commands, "cloud_request", failing)
32
+ result = CliRunner().invoke(app, ["login", "--email", "a@b.c", "--password-stdin"], input="pw\n")
33
+ assert result.exit_code == 0, result.output
34
+ assert "Active workspace: —" in result.output
@@ -114,3 +114,15 @@ def test_workspace_clear_is_the_published_flag_and_release_stays_an_alias(wire):
114
114
  assert run("cloud", "workspace", "set", "--clear").exit_code == 0
115
115
  assert run("cloud", "workspace", "set", "--release").exit_code == 0
116
116
  assert [c["json"] for c in wire.calls] == [{"workspace_code": None}, {"workspace_code": None}]
117
+
118
+
119
+ def test_workspace_unset_calls_the_delete_route_and_matches_set_clear(wire):
120
+ """`cloud workspace unset` is `DELETE /v1/session/active-workspace`, the same release as `set --clear`."""
121
+ wire.reply = httpx.Response(200, json={"active_workspace": None})
122
+ result = run("cloud", "workspace", "unset", "-o", "json")
123
+ assert result.exit_code == 0, result.output
124
+ [call] = wire.calls
125
+ assert call["method"] == "DELETE"
126
+ assert call["url"].endswith("/v1/session/active-workspace")
127
+ assert not call.get("json")
128
+ assert json.loads(result.output) == {"active_workspace": None}
@@ -1 +0,0 @@
1
- __version__ = "2.0.0"
File without changes
File without changes