ragfly-cli 1.21.1__tar.gz → 2.0.1__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-1.21.1/ragfly_cli.egg-info → ragfly_cli-2.0.1}/PKG-INFO +6 -6
  2. {ragfly_cli-1.21.1 → ragfly_cli-2.0.1}/README.md +5 -5
  3. {ragfly_cli-1.21.1 → ragfly_cli-2.0.1}/pyproject.toml +1 -1
  4. ragfly_cli-2.0.1/ragfly_cli/__init__.py +1 -0
  5. {ragfly_cli-1.21.1 → ragfly_cli-2.0.1}/ragfly_cli/cli.py +114 -107
  6. {ragfly_cli-1.21.1 → ragfly_cli-2.0.1}/ragfly_cli/config.py +0 -1
  7. {ragfly_cli-1.21.1 → ragfly_cli-2.0.1/ragfly_cli.egg-info}/PKG-INFO +6 -6
  8. {ragfly_cli-1.21.1 → ragfly_cli-2.0.1}/ragfly_cli.egg-info/SOURCES.txt +1 -0
  9. {ragfly_cli-1.21.1 → ragfly_cli-2.0.1}/tests/test_agent_context_cli.py +8 -8
  10. ragfly_cli-2.0.1/tests/test_login_summary_cli.py +34 -0
  11. {ragfly_cli-1.21.1 → ragfly_cli-2.0.1}/tests/test_surface_parity_cli.py +26 -26
  12. ragfly_cli-1.21.1/ragfly_cli/__init__.py +0 -1
  13. {ragfly_cli-1.21.1 → ragfly_cli-2.0.1}/LICENSE +0 -0
  14. {ragfly_cli-1.21.1 → ragfly_cli-2.0.1}/ragfly_cli/__main__.py +0 -0
  15. {ragfly_cli-1.21.1 → ragfly_cli-2.0.1}/ragfly_cli/_http.py +0 -0
  16. {ragfly_cli-1.21.1 → ragfly_cli-2.0.1}/ragfly_cli/_runtime.py +0 -0
  17. {ragfly_cli-1.21.1 → ragfly_cli-2.0.1}/ragfly_cli/cloud_commands.py +0 -0
  18. {ragfly_cli-1.21.1 → ragfly_cli-2.0.1}/ragfly_cli/grupo_activo.py +0 -0
  19. {ragfly_cli-1.21.1 → ragfly_cli-2.0.1}/ragfly_cli/keyring_store.py +0 -0
  20. {ragfly_cli-1.21.1 → ragfly_cli-2.0.1}/ragfly_cli/oop/__init__.py +0 -0
  21. {ragfly_cli-1.21.1 → ragfly_cli-2.0.1}/ragfly_cli/oop/cli_command.py +0 -0
  22. {ragfly_cli-1.21.1 → ragfly_cli-2.0.1}/ragfly_cli/oop/http_client.py +0 -0
  23. {ragfly_cli-1.21.1 → ragfly_cli-2.0.1}/ragfly_cli/version_check.py +0 -0
  24. {ragfly_cli-1.21.1 → ragfly_cli-2.0.1}/ragfly_cli.egg-info/dependency_links.txt +0 -0
  25. {ragfly_cli-1.21.1 → ragfly_cli-2.0.1}/ragfly_cli.egg-info/entry_points.txt +0 -0
  26. {ragfly_cli-1.21.1 → ragfly_cli-2.0.1}/ragfly_cli.egg-info/requires.txt +0 -0
  27. {ragfly_cli-1.21.1 → ragfly_cli-2.0.1}/ragfly_cli.egg-info/top_level.txt +0 -0
  28. {ragfly_cli-1.21.1 → ragfly_cli-2.0.1}/setup.cfg +0 -0
  29. {ragfly_cli-1.21.1 → ragfly_cli-2.0.1}/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: 1.21.1
3
+ Version: 2.0.1
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,13 +76,13 @@ ragfly
76
76
  ├── login / logout / version
77
77
  └── cloud ← the English REST /v1 contract of api.ragfly.ai
78
78
  ├── me
79
- ├── entity set [ENTITY_CODE] | set --clear
79
+ ├── workspace set [WORKSPACE_CODE] | set --clear
80
80
  ├── area set [AREA_CODE] | set --release | list
81
81
  ├── location list
82
82
  ├── group list | switch | clear (signed-in person)
83
83
  ├── api-key create | list | revoke (signed-in person)
84
84
  ├── document list | show | edges
85
- ├── space list | show | compose | read | refresh | promote
85
+ ├── collection list | show | compose | read | refresh | save
86
86
  ├── queue show | runs
87
87
  ├── skill list | show | run
88
88
  ├── catalog
@@ -116,10 +116,10 @@ Output is English end to end (`--status VECTORIZED`, `-o json | jq`).
116
116
 
117
117
  ```bash
118
118
  ragfly cloud document list --status VECTORIZED --limit 20 -o id
119
- ragfly cloud skill run SUMMARIZE_DOCUMENT --space 12
119
+ ragfly cloud skill run SUMMARIZE_DOCUMENT --collection 12
120
120
  ragfly cloud search "Q1 revenue"
121
- ragfly cloud search "statements" --filter @filter.json --space 12
122
- ragfly cloud chat ask "How do I release the entity of my key?" --mode help
121
+ ragfly cloud search "statements" --filter @filter.json --collection 12
122
+ ragfly cloud chat ask "How do I release the workspace of my key?" --mode help
123
123
  ```
124
124
 
125
125
  Full reference: <https://api.ragfly.ai/docs>.
@@ -55,13 +55,13 @@ ragfly
55
55
  ├── login / logout / version
56
56
  └── cloud ← the English REST /v1 contract of api.ragfly.ai
57
57
  ├── me
58
- ├── entity set [ENTITY_CODE] | set --clear
58
+ ├── workspace set [WORKSPACE_CODE] | set --clear
59
59
  ├── area set [AREA_CODE] | set --release | list
60
60
  ├── location list
61
61
  ├── group list | switch | clear (signed-in person)
62
62
  ├── api-key create | list | revoke (signed-in person)
63
63
  ├── document list | show | edges
64
- ├── space list | show | compose | read | refresh | promote
64
+ ├── collection list | show | compose | read | refresh | save
65
65
  ├── queue show | runs
66
66
  ├── skill list | show | run
67
67
  ├── catalog
@@ -95,10 +95,10 @@ Output is English end to end (`--status VECTORIZED`, `-o json | jq`).
95
95
 
96
96
  ```bash
97
97
  ragfly cloud document list --status VECTORIZED --limit 20 -o id
98
- ragfly cloud skill run SUMMARIZE_DOCUMENT --space 12
98
+ ragfly cloud skill run SUMMARIZE_DOCUMENT --collection 12
99
99
  ragfly cloud search "Q1 revenue"
100
- ragfly cloud search "statements" --filter @filter.json --space 12
101
- ragfly cloud chat ask "How do I release the entity of my key?" --mode help
100
+ ragfly cloud search "statements" --filter @filter.json --collection 12
101
+ ragfly cloud chat ask "How do I release the workspace of my key?" --mode help
102
102
  ```
103
103
 
104
104
  Full reference: <https://api.ragfly.ai/docs>.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ragfly-cli"
7
- version = "1.21.1"
7
+ version = "2.0.1"
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.0.1"
@@ -12,7 +12,8 @@ Commands:
12
12
  ragfly cloud group list | switch | clear (signed-in person only)
13
13
  ragfly cloud api-key create | list | revoke (signed-in person only)
14
14
  ragfly cloud document list | show | edges
15
- ragfly cloud space list | show
15
+ ragfly cloud workspace set
16
+ ragfly cloud collection list | show | compose | read | refresh | save
16
17
  ragfly cloud queue show | runs
17
18
  ragfly cloud skill list | show | run
18
19
  ragfly cloud catalog | function show | search | chat ask
@@ -178,9 +179,15 @@ def login(email: str | None, password_stdin: bool):
178
179
 
179
180
  console.print()
180
181
  console.print(f"[green]✓ Logged in as[/green] {email}")
181
- usuario = data.get("usuario", {}) if isinstance(data.get("usuario"), dict) else {}
182
- console.print(f" Active group: {data.get('grupo_activo') or usuario.get('grupo_por_defecto') or '—'}")
183
- console.print(f" Active entity: {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 '—'}")
184
191
  console.print(" Session stored in [dim]OS keyring[/dim]")
185
192
  console.print()
186
193
 
@@ -231,49 +238,49 @@ def cloud_me(output: str):
231
238
  _fields("Session", {
232
239
  "user": user.get("code"), "name": user.get("name"), "profile": data.get("profile"),
233
240
  "roles": ", ".join(data.get("roles") or []), "group": data.get("active_group"),
234
- "entity": data.get("active_entity"), "area": data.get("active_area"),
241
+ "workspace": data.get("active_workspace"), "area": data.get("active_area"),
235
242
  "effective_area": data.get("effective_area"),
236
243
  }, [("User", "user"), ("Name", "name"), ("Profile", "profile"), ("Roles", "roles"),
237
- ("Active group", "group"), ("Active entity", "entity"), ("Active area", "area"),
244
+ ("Active group", "group"), ("Active workspace", "workspace"), ("Active area", "area"),
238
245
  ("Effective area", "effective_area")])
239
246
 
240
247
 
241
- # ── cloud entity ────────────────────────────────────────────────────────────
248
+ # ── cloud workspace ────────────────────────────────────────────────────────────
242
249
 
243
- @cloud.group("entity")
244
- def cloud_entity():
245
- """Active entity focus for the authenticated credential."""
250
+ @cloud.group("workspace")
251
+ def cloud_workspace():
252
+ """Active workspace focus for the authenticated credential."""
246
253
 
247
254
 
248
- @cloud_entity.command("set")
249
- @click.argument("entity_code", required=False)
255
+ @cloud_workspace.command("set")
256
+ @click.argument("workspace_code", required=False)
250
257
  @click.option("--clear", "--release", "release", is_flag=True,
251
- help="Clear the focus and use all authorized entities (--release is an alias).")
258
+ help="Clear the focus and use all authorized workspaces (--release is an alias).")
252
259
  @click.option("-o", "--output", type=OUTPUT_TABLE, default="table")
253
- def cloud_entity_set(entity_code: str | None, release: bool, output: str):
254
- """Set ENTITY_CODE as active, or use --clear to clear the focus."""
255
- if release == (entity_code is not None):
256
- raise click.UsageError("Pass exactly one of ENTITY_CODE or --clear.")
260
+ def cloud_workspace_set(workspace_code: str | None, release: bool, output: str):
261
+ """Set WORKSPACE_CODE as active, or use --clear to clear the focus."""
262
+ if release == (workspace_code is not None):
263
+ raise click.UsageError("Pass exactly one of WORKSPACE_CODE or --clear.")
257
264
  data = _v1(
258
- "POST", "/v1/session/active-entity",
259
- body={"entity_code": None if release else entity_code},
265
+ "POST", "/v1/session/active-workspace",
266
+ body={"workspace_code": None if release else workspace_code},
260
267
  )
261
268
  if output == "json":
262
269
  _emit_json(data)
263
270
  return
264
- active = data.get("active_entity") or "all authorized entities"
265
- console.print(f"[green]✓ Active entity:[/green] [bold]{active}[/bold]")
271
+ active = data.get("active_workspace") or "all authorized workspaces"
272
+ console.print(f"[green]✓ Active workspace:[/green] [bold]{active}[/bold]")
266
273
 
267
274
 
268
275
  # ── cloud area / cloud location ─────────────────────────────────────────────
269
276
 
270
277
  HIERARCHY_COLUMNS = [("Code", "code"), ("Name", "name"), ("Parent", "parent_code"), ("Depth", "depth"),
271
- ("Entity", "entity_code")]
278
+ ("Workspace", "workspace_code")]
272
279
 
273
280
 
274
- def _hierarchy_list(path: str, title: str, entity: str | None, parent: str | None, query: str | None,
281
+ def _hierarchy_list(path: str, title: str, workspace: str | None, parent: str | None, query: str | None,
275
282
  limit: int, cursor: str | None, output: str) -> None:
276
- data = _v1("GET", path, params={"entity_code": entity, "parent_code": parent, "query": query,
283
+ data = _v1("GET", path, params={"workspace_code": workspace, "parent_code": parent, "query": query,
277
284
  "limit": limit, "cursor": cursor})
278
285
  _list(data, output, key="items", id_key="code", title=title, columns=HIERARCHY_COLUMNS)
279
286
  if output == "table" and (data or {}).get("next_cursor"):
@@ -287,10 +294,10 @@ def cloud_area():
287
294
 
288
295
  @cloud_area.command("set")
289
296
  @click.argument("area_code", required=False)
290
- @click.option("--release", is_flag=True, help="Release the area focus and keep the current entity.")
297
+ @click.option("--release", is_flag=True, help="Release the area focus and keep the current workspace.")
291
298
  @click.option("-o", "--output", type=OUTPUT_TABLE, default="table")
292
299
  def cloud_area_set(area_code: str | None, release: bool, output: str):
293
- """Set AREA_CODE as active (it also selects its entity), or use --release to clear it."""
300
+ """Set AREA_CODE as active (it also selects its workspace), or use --release to clear it."""
294
301
  if release == (area_code is not None):
295
302
  raise click.UsageError("Pass exactly one of AREA_CODE or --release.")
296
303
  data = _v1("POST", "/v1/session/active-area", body={"area_code": None if release else area_code})
@@ -299,11 +306,11 @@ def cloud_area_set(area_code: str | None, release: bool, output: str):
299
306
  return
300
307
  active = data.get("active_area") or "no area focus"
301
308
  console.print(f"[green]✓ Active area:[/green] [bold]{active}[/bold] "
302
- f"[dim](entity {data.get('active_entity') or '—'})[/dim]")
309
+ f"[dim](workspace {data.get('active_workspace') or '—'})[/dim]")
303
310
 
304
311
 
305
312
  AREA_OPTIONS = [
306
- click.option("--entity", default=None, help="Entity code (defaults to the active entity)"),
313
+ click.option("--workspace", default=None, help="Workspace code (defaults to the active workspace)"),
307
314
  click.option("--parent", default=None, help="Only the children of this code"),
308
315
  click.option("--query", default=None, help="Text to look for in the name"),
309
316
  click.option("--limit", default=50, show_default=True),
@@ -320,9 +327,9 @@ def _area_options(command):
320
327
 
321
328
  @cloud_area.command("list")
322
329
  @_area_options
323
- def cloud_area_list(entity, parent, query, limit, cursor, output):
330
+ def cloud_area_list(workspace, parent, query, limit, cursor, output):
324
331
  """List the organizational areas the credential can see."""
325
- _hierarchy_list("/v1/areas", "Areas", entity, parent, query, limit, cursor, output)
332
+ _hierarchy_list("/v1/areas", "Areas", workspace, parent, query, limit, cursor, output)
326
333
 
327
334
 
328
335
  @cloud.group("location")
@@ -332,9 +339,9 @@ def cloud_location():
332
339
 
333
340
  @cloud_location.command("list")
334
341
  @_area_options
335
- def cloud_location_list(entity, parent, query, limit, cursor, output):
342
+ def cloud_location_list(workspace, parent, query, limit, cursor, output):
336
343
  """List the document folders the credential can see."""
337
- _hierarchy_list("/v1/locations", "Locations", entity, parent, query, limit, cursor, output)
344
+ _hierarchy_list("/v1/locations", "Locations", workspace, parent, query, limit, cursor, output)
338
345
 
339
346
 
340
347
  # ── cloud group (signed-in person only) ──────────────────────────────────────
@@ -481,81 +488,81 @@ def cloud_document_edges(document_code: str, neighbor_limit: int):
481
488
  _emit_json(_v1("GET", f"/v1/documents/{_segment(document_code)}/edges", params={"neighbor_limit": neighbor_limit}))
482
489
 
483
490
 
484
- # ── cloud space ──────────────────────────────────────────────────────────────
491
+ # ── cloud collection ──────────────────────────────────────────────────────────────
485
492
 
486
- @cloud.group("space")
487
- def cloud_space():
488
- """Working spaces."""
493
+ @cloud.group("collection")
494
+ def cloud_collection():
495
+ """Collections."""
489
496
 
490
497
 
491
- @cloud_space.command("list")
498
+ @cloud_collection.command("list")
492
499
  @click.option("--limit", default=20, show_default=True)
493
500
  @click.option("-o", "--output", type=OUTPUT_LIST, default="table")
494
- def cloud_space_list(limit: int, output: str):
495
- """List working spaces."""
496
- data = _v1("GET", "/v1/spaces", params={"limit": limit})
497
- _list(data, output, key="spaces", id_key="space_id", title="Working spaces",
498
- columns=[("ID", "space_id"), ("Name", "name"), ("Type", "type"), ("Scope", "scope"),
501
+ def cloud_collection_list(limit: int, output: str):
502
+ """List collections."""
503
+ data = _v1("GET", "/v1/collections", params={"limit": limit})
504
+ _list(data, output, key="collections", id_key="collection_id", title="Collections",
505
+ columns=[("ID", "collection_id"), ("Name", "name"), ("Type", "type"), ("Scope", "scope"),
499
506
  ("Docs", "total_documents"), ("Created", "created_at")])
500
507
 
501
508
 
502
- @cloud_space.command("show")
503
- @click.argument("space_id", type=int)
509
+ @cloud_collection.command("show")
510
+ @click.argument("collection_id", type=int)
504
511
  @click.option("--document-limit", default=20, show_default=True)
505
512
  @click.option("-o", "--output", type=OUTPUT_TABLE, default="table")
506
- def cloud_space_show(space_id: int, document_limit: int, output: str):
507
- """Show a working space with its documents."""
508
- data = _v1("GET", f"/v1/spaces/{space_id}", params={"document_limit": document_limit})
513
+ def cloud_collection_show(collection_id: int, document_limit: int, output: str):
514
+ """Show a collection with its documents."""
515
+ data = _v1("GET", f"/v1/collections/{collection_id}", params={"document_limit": document_limit})
509
516
  if output == "json":
510
517
  _emit_json(data)
511
518
  return
512
- _fields(f"Working space #{space_id}", data.get("space") or {}, [
519
+ _fields(f"Collection #{collection_id}", data.get("collection") or {}, [
513
520
  ("Name", "name"), ("Type", "type"), ("Scope", "scope"), ("Criterion", "criterion"),
514
521
  ("Documents", "total_documents"), ("Created", "created_at"),
515
522
  ])
516
523
  _table("Documents", data.get("documents") or [], [("Code", "code"), ("Name", "name"), ("Status", "status")])
517
524
 
518
525
 
519
- @cloud_space.command("compose")
526
+ @cloud_collection.command("compose")
520
527
  @click.argument("operation", type=click.Choice(["union", "intersection", "difference", "symmetric_difference"]))
521
- @click.argument("space_a", type=int)
522
- @click.argument("space_b", type=int)
528
+ @click.argument("collection_a", type=int)
529
+ @click.argument("collection_b", type=int)
523
530
  @click.option("--name", default="", help="Name of the result (generated when empty)")
524
- @click.option("--type", "space_type", type=click.Choice(["AREA", "SPACE"]), default="AREA", show_default=True)
531
+ @click.option("--type", "collection_type", type=click.Choice(["TEMPORARY", "SAVED"]), default="TEMPORARY", show_default=True)
525
532
  @click.option("-o", "--output", type=OUTPUT_TABLE, default="json")
526
- def cloud_space_compose(operation: str, space_a: int, space_b: int, name: str, space_type: str, output: str):
527
- """Combine two working spaces by set algebra into a new one."""
528
- data = _v1("POST", "/v1/spaces/compose", body={
529
- "operation": operation, "space_id_a": space_a, "space_id_b": space_b,
530
- "name": name, "space_type": space_type,
533
+ def cloud_collection_compose(operation: str, collection_a: int, collection_b: int, name: str, collection_type: str, output: str):
534
+ """Combine two collections by set algebra into a new one."""
535
+ data = _v1("POST", "/v1/collections/compose", body={
536
+ "operation": operation, "collection_id_a": collection_a, "collection_id_b": collection_b,
537
+ "name": name, "collection_type": collection_type,
531
538
  })
532
- _emit_json(data) if output == "json" else _fields("New working space", data, [
533
- ("ID", "space_id"), ("Name", "name"), ("Type", "type"), ("Documents", "total_documents")])
539
+ _emit_json(data) if output == "json" else _fields("New collection", data, [
540
+ ("ID", "collection_id"), ("Name", "name"), ("Type", "type"), ("Documents", "total_documents")])
534
541
 
535
542
 
536
- @cloud_space.command("read")
537
- @click.argument("space_id", type=int)
543
+ @cloud_collection.command("read")
544
+ @click.argument("collection_id", type=int)
538
545
  @click.option("--resolution", type=click.Choice(["count", "manifest", "chunks", "text"]), default="manifest", show_default=True)
539
546
  @click.option("--query", default="", help="Sub-question to rank by (required with --resolution chunks)")
540
547
  @click.option("--limit", type=int, default=50, show_default=True)
541
- def cloud_space_read(space_id: int, resolution: str, query: str, limit: int):
542
- """Read a working space at the chosen resolution (JSON output)."""
543
- _emit_json(_v1("POST", f"/v1/spaces/{space_id}/read",
548
+ def cloud_collection_read(collection_id: int, resolution: str, query: str, limit: int):
549
+ """Read a collection at the chosen resolution (JSON output)."""
550
+ _emit_json(_v1("POST", f"/v1/collections/{collection_id}/read",
544
551
  body={"resolution": resolution, "query": query, "limit": limit}))
545
552
 
546
553
 
547
- @cloud_space.command("refresh")
548
- @click.argument("space_id", type=int)
549
- def cloud_space_refresh(space_id: int):
550
- """Recompute the members of a working space (JSON output)."""
551
- _emit_json(_v1("POST", f"/v1/spaces/{space_id}/refresh"))
554
+ @cloud_collection.command("refresh")
555
+ @click.argument("collection_id", type=int)
556
+ def cloud_collection_refresh(collection_id: int):
557
+ """Recompute the members of a collection (JSON output)."""
558
+ _emit_json(_v1("POST", f"/v1/collections/{collection_id}/refresh"))
552
559
 
553
560
 
554
- @cloud_space.command("promote")
555
- @click.argument("space_id", type=int)
556
- def cloud_space_promote(space_id: int):
557
- """Turn a temporary working space into a permanent one (JSON output)."""
558
- _emit_json(_v1("POST", f"/v1/spaces/{space_id}/promote"))
561
+ @cloud_collection.command("save")
562
+ @click.argument("collection_id", type=int)
563
+ def cloud_collection_save(collection_id: int):
564
+ """Save a temporary collection as a saved one (JSON output)."""
565
+ _emit_json(_v1("POST", f"/v1/collections/{collection_id}/save"))
559
566
 
560
567
 
561
568
  # ── cloud queue ──────────────────────────────────────────────────────────────
@@ -619,14 +626,14 @@ def cloud_skill_show(skill_code: str, output: str):
619
626
 
620
627
  @cloud_skill.command("run")
621
628
  @click.argument("skill_code")
622
- @click.option("--space", type=int, default=None, help="Working space ID")
629
+ @click.option("--collection", type=int, default=None, help="Collection ID")
623
630
  @click.option("--document", default=None, help="Single document code")
624
631
  @click.option("-o", "--output", type=OUTPUT_TABLE, default="table")
625
- def cloud_skill_run(skill_code: str, space: int | None, document: str | None, output: str):
626
- """Run a skill on a working space or a document."""
627
- if not space and not document:
628
- raise click.UsageError("Provide --space <ID> or --document <CODE>")
629
- body = {k: v for k, v in {"space_id": space, "document_code": document}.items() if v is not None}
632
+ def cloud_skill_run(skill_code: str, collection: int | None, document: str | None, output: str):
633
+ """Run a skill on a collection or a document."""
634
+ if not collection and not document:
635
+ raise click.UsageError("Provide --collection <ID> or --document <CODE>")
636
+ body = {k: v for k, v in {"collection_id": collection, "document_code": document}.items() if v is not None}
630
637
  data = _v1("POST", f"/v1/skills/{_segment(skill_code)}/run", body=body)
631
638
  if output == "json":
632
639
  _emit_json(data)
@@ -655,15 +662,15 @@ def cloud_catalog(type_: str, output: str):
655
662
 
656
663
  @cloud.group("document-type")
657
664
  def cloud_document_type():
658
- """Document types of an entity: the codes `search --filter` accepts."""
665
+ """Document types of a workspace: the codes `search --filter` accepts."""
659
666
 
660
667
 
661
668
  @cloud_document_type.command("list")
662
- @click.option("--entity", default=None, help="Entity code (defaults to the active entity)")
669
+ @click.option("--workspace", default=None, help="Workspace code (defaults to the active workspace)")
663
670
  @click.option("-o", "--output", type=OUTPUT_LIST, default="table")
664
- def cloud_document_type_list(entity: str | None, output: str):
665
- """List the document types of the entity, with their parent type."""
666
- data = _v1("GET", "/v1/catalog/document-types", params={"entity_code": entity})
671
+ def cloud_document_type_list(workspace: str | None, output: str):
672
+ """List the document types of the workspace, with their parent type."""
673
+ data = _v1("GET", "/v1/catalog/document-types", params={"workspace_code": workspace})
667
674
  _list(data, output, key="document_types", id_key="code", title="Document types",
668
675
  columns=[("Code", "code"), ("Name", "name"), ("Parent", "parent_code"), ("Documents", "document_count")])
669
676
 
@@ -675,12 +682,12 @@ def cloud_characteristic():
675
682
 
676
683
  @cloud_characteristic.command("list")
677
684
  @click.option("--document-type", "document_types", multiple=True, help="Document type code (repeat for several)")
678
- @click.option("--entity", default=None, help="Entity code (defaults to the active entity)")
685
+ @click.option("--workspace", default=None, help="Workspace code (defaults to the active workspace)")
679
686
  @click.option("-o", "--output", type=OUTPUT_LIST, default="table")
680
- def cloud_characteristic_list(document_types: tuple[str, ...], entity: str | None, output: str):
687
+ def cloud_characteristic_list(document_types: tuple[str, ...], workspace: str | None, output: str):
681
688
  """List the characteristics available for those types (all when none is given)."""
682
689
  data = _v1("GET", "/v1/catalog/characteristics", params={
683
- "document_types": ",".join(document_types) or None, "entity_code": entity})
690
+ "document_types": ",".join(document_types) or None, "workspace_code": workspace})
684
691
  _list(data, output, key="characteristics", id_key="code", title="Characteristics",
685
692
  columns=[("Category", "category_code"), ("Code", "code"), ("Name", "name"), ("Role", "role")])
686
693
 
@@ -707,24 +714,24 @@ def cloud_function_show(function_code: str, output: str):
707
714
  @click.argument("query", nargs=-1, required=True)
708
715
  @click.option("--limit", type=int, default=10, show_default=True)
709
716
  @click.option("--min-similarity", type=float, default=0.0, show_default=True)
710
- @click.option("--entity", default=None, help="Filter by entity code")
711
- @click.option("--space", "space_id", type=int, default=None, help="Search only inside this working space")
717
+ @click.option("--workspace", default=None, help="Filter by workspace code")
718
+ @click.option("--collection", "collection_id", type=int, default=None, help="Search only inside this collection")
712
719
  @click.option("--filter", "filter_json", default=None,
713
720
  help="Structured filter as JSON, @file or - (document_types, attributes, characteristics)")
714
721
  @click.option("--location", "location_code", default=None,
715
722
  help="Search only this visible folder and its subfolders (this request only)")
716
723
  @click.option("-o", "--output", type=OUTPUT_TABLE, default="table")
717
- def cloud_search(query: tuple[str, ...], limit: int, min_similarity: float, entity: str | None,
718
- space_id: int | None, filter_json: str | None, location_code: str | None, output: str):
724
+ def cloud_search(query: tuple[str, ...], limit: int, min_similarity: float, workspace: str | None,
725
+ collection_id: int | None, filter_json: str | None, location_code: str | None, output: str):
719
726
  """Semantic search over the group's vectorized documents."""
720
727
  text = " ".join(query).strip()
721
728
  if not text:
722
729
  raise click.UsageError("The query cannot be empty.")
723
730
  body = {"query": text, "limit": limit, "min_similarity": min_similarity}
724
- if entity:
725
- body["entity_code"] = entity
726
- if space_id is not None:
727
- body["space_id"] = space_id
731
+ if workspace:
732
+ body["workspace_code"] = workspace
733
+ if collection_id is not None:
734
+ body["collection_id"] = collection_id
728
735
  if filter_json:
729
736
  body["filter"] = _json_argument(filter_json, "--filter")
730
737
  if location_code:
@@ -911,22 +918,22 @@ def cloud_process_update(process_code: str, **fields):
911
918
 
912
919
  @cloud.group("organization")
913
920
  def cloud_organization():
914
- """Organization profile (group and entity descriptions and system prompts)."""
921
+ """Organization profile (group and workspace descriptions and system prompts)."""
915
922
 
916
923
 
917
924
  @cloud_organization.command("show")
918
- @click.option("--entity", default=None, help="Entity code (default: the active entity)")
919
- def cloud_organization_show(entity: str | None):
925
+ @click.option("--workspace", default=None, help="Workspace code (default: the active workspace)")
926
+ def cloud_organization_show(workspace: str | None):
920
927
  """Show the organization profile (JSON)."""
921
- _emit_json(_v1("GET", "/v1/organization", params={"entity_code": entity}))
928
+ _emit_json(_v1("GET", "/v1/organization", params={"workspace_code": workspace}))
922
929
 
923
930
 
924
931
  @cloud_organization.command("update")
925
932
  @click.option("--group-description", default=None)
926
933
  @click.option("--group-system-prompt", default=None)
927
- @click.option("--entity-description", default=None)
928
- @click.option("--entity-system-prompt", default=None)
929
- @click.option("--entity", "entity_code", default=None)
934
+ @click.option("--workspace-description", default=None)
935
+ @click.option("--workspace-system-prompt", default=None)
936
+ @click.option("--workspace", "workspace_code", default=None)
930
937
  def cloud_organization_update(**fields):
931
938
  """Update the organization profile. Only the options you pass are written."""
932
939
  body = {k: v for k, v in fields.items() if v is not None}
@@ -938,13 +945,13 @@ def cloud_organization_update(**fields):
938
945
  @cloud_organization.command("draft")
939
946
  @click.option("--source-file", type=click.Path(exists=True, dir_okay=False), default=None,
940
947
  help="Text describing the organization (default: stdin)")
941
- @click.option("--entity", "entity_code", default=None)
942
- def cloud_organization_draft(source_file: str | None, entity_code: str | None):
948
+ @click.option("--workspace", "workspace_code", default=None)
949
+ def cloud_organization_draft(source_file: str | None, workspace_code: str | None):
943
950
  """Draft the profile texts from a source text (does not write them)."""
944
951
  source = Path(source_file).read_text(encoding="utf-8") if source_file else sys.stdin.read()
945
952
  body = {"source_text": source}
946
- if entity_code:
947
- body["entity_code"] = entity_code
953
+ if workspace_code:
954
+ body["workspace_code"] = workspace_code
948
955
  _emit_json(_v1("POST", "/v1/organization/draft", body=body))
949
956
 
950
957
 
@@ -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: 1.21.1
3
+ Version: 2.0.1
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,13 +76,13 @@ ragfly
76
76
  ├── login / logout / version
77
77
  └── cloud ← the English REST /v1 contract of api.ragfly.ai
78
78
  ├── me
79
- ├── entity set [ENTITY_CODE] | set --clear
79
+ ├── workspace set [WORKSPACE_CODE] | set --clear
80
80
  ├── area set [AREA_CODE] | set --release | list
81
81
  ├── location list
82
82
  ├── group list | switch | clear (signed-in person)
83
83
  ├── api-key create | list | revoke (signed-in person)
84
84
  ├── document list | show | edges
85
- ├── space list | show | compose | read | refresh | promote
85
+ ├── collection list | show | compose | read | refresh | save
86
86
  ├── queue show | runs
87
87
  ├── skill list | show | run
88
88
  ├── catalog
@@ -116,10 +116,10 @@ Output is English end to end (`--status VECTORIZED`, `-o json | jq`).
116
116
 
117
117
  ```bash
118
118
  ragfly cloud document list --status VECTORIZED --limit 20 -o id
119
- ragfly cloud skill run SUMMARIZE_DOCUMENT --space 12
119
+ ragfly cloud skill run SUMMARIZE_DOCUMENT --collection 12
120
120
  ragfly cloud search "Q1 revenue"
121
- ragfly cloud search "statements" --filter @filter.json --space 12
122
- ragfly cloud chat ask "How do I release the entity of my key?" --mode help
121
+ ragfly cloud search "statements" --filter @filter.json --collection 12
122
+ ragfly cloud chat ask "How do I release the workspace of my key?" --mode help
123
123
  ```
124
124
 
125
125
  Full reference: <https://api.ragfly.ai/docs>.
@@ -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
@@ -47,17 +47,17 @@ def test_every_cloud_call_goes_to_v1_with_the_cli_surface(wire):
47
47
  assert call["headers"]["X-RAGfly-Client"] == "cli"
48
48
 
49
49
 
50
- def test_entity_set_and_release_use_the_single_public_session_operation(wire):
51
- wire.reply = httpx.Response(200, json={"active_entity": "E1"})
52
- result = run("cloud", "entity", "set", "E1", "-o", "json")
50
+ def test_workspace_set_and_release_use_the_single_public_session_operation(wire):
51
+ wire.reply = httpx.Response(200, json={"active_workspace": "E1"})
52
+ result = run("cloud", "workspace", "set", "E1", "-o", "json")
53
53
  assert result.exit_code == 0, result.output
54
- assert wire.calls[0]["url"].endswith("/v1/session/active-entity")
55
- assert wire.calls[0]["json"] == {"entity_code": "E1"}
54
+ assert wire.calls[0]["url"].endswith("/v1/session/active-workspace")
55
+ assert wire.calls[0]["json"] == {"workspace_code": "E1"}
56
56
 
57
- wire.reply = httpx.Response(200, json={"active_entity": None})
58
- result = run("cloud", "entity", "set", "--release", "-o", "json")
57
+ wire.reply = httpx.Response(200, json={"active_workspace": None})
58
+ result = run("cloud", "workspace", "set", "--release", "-o", "json")
59
59
  assert result.exit_code == 0, result.output
60
- assert wire.calls[1]["json"] == {"entity_code": None}
60
+ assert wire.calls[1]["json"] == {"workspace_code": None}
61
61
 
62
62
 
63
63
  def test_agent_context_and_tool(wire):
@@ -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
@@ -1,4 +1,4 @@
1
- """The CLI exposes the same /v1 operations as the SDKs and MCP: ask mode, filtered search, catalogs, spaces, areas and locations."""
1
+ """The CLI exposes the same /v1 operations as the SDKs and MCP: ask mode, filtered search, catalogs, collections, areas and locations."""
2
2
  import json
3
3
 
4
4
  import httpx
@@ -35,48 +35,48 @@ def run(*args):
35
35
 
36
36
  def test_ask_sends_mode_only_when_given(wire):
37
37
  wire.reply = httpx.Response(200, json={"answer": "A", "conversation_id": 1})
38
- assert run("cloud", "chat", "ask", "how do I release the entity?", "--mode", "help").exit_code == 0
39
- assert wire.calls[0]["json"] == {"question": "how do I release the entity?", "function_code": "CHAT-USER", "mode": "help"}
38
+ assert run("cloud", "chat", "ask", "how do I release the workspace?", "--mode", "help").exit_code == 0
39
+ assert wire.calls[0]["json"] == {"question": "how do I release the workspace?", "function_code": "CHAT-USER", "mode": "help"}
40
40
  assert run("cloud", "chat", "ask", "hello").exit_code == 0
41
41
  assert "mode" not in wire.calls[1]["json"]
42
42
  assert run("cloud", "chat", "ask", "hello", "--mode", "support").exit_code != 0
43
43
 
44
44
 
45
- def test_search_takes_space_and_structured_filter(wire):
45
+ def test_search_takes_collection_and_structured_filter(wire):
46
46
  wire.reply = httpx.Response(200, json={"documents": []})
47
47
  flt = {"document_types": ["TDOC_cartola"], "attributes": [{"field": "language", "operator": "EQ", "value": "es"}]}
48
- result = run("cloud", "search", "cartolas", "--space", "12", "--filter", json.dumps(flt), "-o", "json")
48
+ result = run("cloud", "search", "cartolas", "--collection", "12", "--filter", json.dumps(flt), "-o", "json")
49
49
  assert result.exit_code == 0, result.output
50
50
  body = wire.calls[0]["json"]
51
51
  assert wire.calls[0]["url"].endswith("/v1/documents/search")
52
- assert body["query"] == "cartolas" and body["space_id"] == 12 and body["filter"] == flt
52
+ assert body["query"] == "cartolas" and body["collection_id"] == 12 and body["filter"] == flt
53
53
  assert run("cloud", "search", "x", "--filter", "[1]").exit_code != 0 # a filter is a JSON object
54
54
 
55
55
 
56
56
  def test_catalog_commands_call_the_public_catalog_routes(wire):
57
57
  wire.reply = httpx.Response(200, json={"document_types": [{"code": "T1", "name": "Statement", "parent_code": None, "document_count": 3}]})
58
- assert run("cloud", "document-type", "list", "--entity", "E1", "-o", "id").output.strip() == "T1"
59
- assert wire.calls[0]["url"].endswith("/v1/catalog/document-types") and wire.calls[0]["params"] == {"entity_code": "E1"}
58
+ assert run("cloud", "document-type", "list", "--workspace", "E1", "-o", "id").output.strip() == "T1"
59
+ assert wire.calls[0]["url"].endswith("/v1/catalog/document-types") and wire.calls[0]["params"] == {"workspace_code": "E1"}
60
60
  wire.reply = httpx.Response(200, json={"characteristics": []})
61
61
  assert run("cloud", "characteristic", "list", "--document-type", "T1", "--document-type", "T2", "-o", "json").exit_code == 0
62
62
  assert wire.calls[1]["url"].endswith("/v1/catalog/characteristics")
63
63
  assert wire.calls[1]["params"] == {"document_types": "T1,T2"}
64
64
 
65
65
 
66
- def test_space_commands_cover_compose_read_refresh_and_promote(wire):
67
- wire.reply = httpx.Response(200, json={"space_id": 9})
68
- assert run("cloud", "space", "compose", "difference", "1", "2", "--name", "N", "--type", "SPACE").exit_code == 0
69
- assert wire.calls[0]["url"].endswith("/v1/spaces/compose")
70
- assert wire.calls[0]["json"] == {"operation": "difference", "space_id_a": 1, "space_id_b": 2, "name": "N", "space_type": "SPACE"}
71
- assert run("cloud", "space", "read", "9", "--resolution", "chunks", "--query", "q", "--limit", "5").exit_code == 0
72
- assert wire.calls[1]["url"].endswith("/v1/spaces/9/read")
66
+ def test_collection_commands_cover_compose_read_refresh_and_save(wire):
67
+ wire.reply = httpx.Response(200, json={"collection_id": 9})
68
+ assert run("cloud", "collection", "compose", "difference", "1", "2", "--name", "N", "--type", "SAVED").exit_code == 0
69
+ assert wire.calls[0]["url"].endswith("/v1/collections/compose")
70
+ assert wire.calls[0]["json"] == {"operation": "difference", "collection_id_a": 1, "collection_id_b": 2, "name": "N", "collection_type": "SAVED"}
71
+ assert run("cloud", "collection", "read", "9", "--resolution", "chunks", "--query", "q", "--limit", "5").exit_code == 0
72
+ assert wire.calls[1]["url"].endswith("/v1/collections/9/read")
73
73
  assert wire.calls[1]["json"] == {"resolution": "chunks", "query": "q", "limit": 5}
74
- assert run("cloud", "space", "refresh", "9").exit_code == 0 and wire.calls[2]["url"].endswith("/v1/spaces/9/refresh")
75
- assert run("cloud", "space", "promote", "9").exit_code == 0 and wire.calls[3]["url"].endswith("/v1/spaces/9/promote")
74
+ assert run("cloud", "collection", "refresh", "9").exit_code == 0 and wire.calls[2]["url"].endswith("/v1/collections/9/refresh")
75
+ assert run("cloud", "collection", "save", "9").exit_code == 0 and wire.calls[3]["url"].endswith("/v1/collections/9/save")
76
76
 
77
77
 
78
78
  def test_area_set_and_release_send_the_area_focus(wire):
79
- wire.reply = httpx.Response(200, json={"active_area": "FIN", "active_entity": "E1"})
79
+ wire.reply = httpx.Response(200, json={"active_area": "FIN", "active_workspace": "E1"})
80
80
  assert run("cloud", "area", "set", "FIN").exit_code == 0
81
81
  assert wire.calls[0]["url"].endswith("/v1/session/active-area") and wire.calls[0]["json"] == {"area_code": "FIN"}
82
82
  assert run("cloud", "area", "set", "--release").exit_code == 0
@@ -87,12 +87,12 @@ def test_area_set_and_release_send_the_area_focus(wire):
87
87
 
88
88
  def test_area_and_location_lists_call_their_routes_with_paging(wire):
89
89
  wire.reply = httpx.Response(200, json={"items": [{"code": "A1", "name": "Finance", "parent_code": None,
90
- "depth": 0, "entity_code": "E1"}], "next_cursor": None})
91
- out = run("cloud", "area", "list", "--entity", "E1", "--parent", "A0", "--query", "fin", "--limit", "10",
90
+ "depth": 0, "workspace_code": "E1"}], "next_cursor": None})
91
+ out = run("cloud", "area", "list", "--workspace", "E1", "--parent", "A0", "--query", "fin", "--limit", "10",
92
92
  "--cursor", "c1", "-o", "id")
93
93
  assert out.exit_code == 0 and out.output.strip() == "A1"
94
94
  assert wire.calls[0]["url"].endswith("/v1/areas")
95
- assert wire.calls[0]["params"] == {"entity_code": "E1", "parent_code": "A0", "query": "fin", "limit": 10, "cursor": "c1"}
95
+ assert wire.calls[0]["params"] == {"workspace_code": "E1", "parent_code": "A0", "query": "fin", "limit": 10, "cursor": "c1"}
96
96
  assert run("cloud", "location", "list", "-o", "json").exit_code == 0
97
97
  assert wire.calls[1]["url"].endswith("/v1/locations") and wire.calls[1]["params"] == {"limit": 50}
98
98
 
@@ -109,8 +109,8 @@ def test_location_narrows_search_document_list_and_ask(wire):
109
109
  assert "location_code" not in wire.calls[3]["json"]
110
110
 
111
111
 
112
- def test_entity_clear_is_the_published_flag_and_release_stays_an_alias(wire):
113
- wire.reply = httpx.Response(200, json={"active_entity": None})
114
- assert run("cloud", "entity", "set", "--clear").exit_code == 0
115
- assert run("cloud", "entity", "set", "--release").exit_code == 0
116
- assert [c["json"] for c in wire.calls] == [{"entity_code": None}, {"entity_code": None}]
112
+ def test_workspace_clear_is_the_published_flag_and_release_stays_an_alias(wire):
113
+ wire.reply = httpx.Response(200, json={"active_workspace": None})
114
+ assert run("cloud", "workspace", "set", "--clear").exit_code == 0
115
+ assert run("cloud", "workspace", "set", "--release").exit_code == 0
116
+ assert [c["json"] for c in wire.calls] == [{"workspace_code": None}, {"workspace_code": None}]
@@ -1 +0,0 @@
1
- __version__ = "1.21.1"
File without changes
File without changes