vectorgov-cli 0.3.4__tar.gz → 0.3.6__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 (30) hide show
  1. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/PKG-INFO +2 -2
  2. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/pyproject.toml +2 -2
  3. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/src/vectorgov/cli/__init__.py +1 -1
  4. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/src/vectorgov/cli/commands/read.py +4 -1
  5. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/src/vectorgov/cli/utils/output.py +21 -10
  6. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/.gitignore +0 -0
  7. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/README.md +0 -0
  8. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/src/vectorgov/cli/commands/__init__.py +0 -0
  9. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/src/vectorgov/cli/commands/ask.py +0 -0
  10. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/src/vectorgov/cli/commands/audit.py +0 -0
  11. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/src/vectorgov/cli/commands/auth.py +0 -0
  12. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/src/vectorgov/cli/commands/config.py +0 -0
  13. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/src/vectorgov/cli/commands/context.py +0 -0
  14. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/src/vectorgov/cli/commands/docs.py +0 -0
  15. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/src/vectorgov/cli/commands/explain.py +0 -0
  16. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/src/vectorgov/cli/commands/feedback.py +0 -0
  17. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/src/vectorgov/cli/commands/fs_search.py +0 -0
  18. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/src/vectorgov/cli/commands/grep_cmd.py +0 -0
  19. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/src/vectorgov/cli/commands/hybrid.py +0 -0
  20. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/src/vectorgov/cli/commands/init.py +0 -0
  21. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/src/vectorgov/cli/commands/lookup.py +0 -0
  22. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/src/vectorgov/cli/commands/merged.py +0 -0
  23. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/src/vectorgov/cli/commands/prompts.py +0 -0
  24. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/src/vectorgov/cli/commands/quota.py +0 -0
  25. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/src/vectorgov/cli/commands/search.py +0 -0
  26. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/src/vectorgov/cli/commands/smart_search.py +0 -0
  27. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/src/vectorgov/cli/commands/tokens.py +0 -0
  28. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/src/vectorgov/cli/main.py +0 -0
  29. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/src/vectorgov/cli/utils/__init__.py +0 -0
  30. {vectorgov_cli-0.3.4 → vectorgov_cli-0.3.6}/src/vectorgov/cli/utils/config.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vectorgov-cli
3
- Version: 0.3.4
3
+ Version: 0.3.6
4
4
  Summary: CLI para a API VectorGov - Busca semântica em legislação brasileira
5
5
  Project-URL: Homepage, https://vectorgov.io
6
6
  Project-URL: Documentation, https://vectorgov.io/documentacao
@@ -25,7 +25,7 @@ Requires-Python: >=3.9
25
25
  Requires-Dist: pyyaml>=6.0.0
26
26
  Requires-Dist: rich>=13.0.0
27
27
  Requires-Dist: typer>=0.9.0
28
- Requires-Dist: vectorgov>=0.19.1
28
+ Requires-Dist: vectorgov>=0.19.2
29
29
  Provides-Extra: all
30
30
  Requires-Dist: anthropic>=0.18.0; extra == 'all'
31
31
  Requires-Dist: google-generativeai>=0.3.0; extra == 'all'
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "vectorgov-cli"
7
- version = "0.3.4"
7
+ version = "0.3.6"
8
8
  description = "CLI para a API VectorGov - Busca semântica em legislação brasileira"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -37,7 +37,7 @@ classifiers = [
37
37
  "Topic :: Text Processing :: Linguistic",
38
38
  ]
39
39
  dependencies = [
40
- "vectorgov>=0.19.1",
40
+ "vectorgov>=0.19.2",
41
41
  "typer>=0.9.0",
42
42
  "rich>=13.0.0",
43
43
  "pyyaml>=6.0.0",
@@ -7,7 +7,7 @@ Uso:
7
7
  vectorgov auth login
8
8
  """
9
9
 
10
- __version__ = "0.3.4"
10
+ __version__ = "0.3.6"
11
11
 
12
12
  from .main import app
13
13
 
@@ -5,7 +5,7 @@ import typer
5
5
  from rich.console import Console
6
6
  from rich.panel import Panel
7
7
  from ..utils.config import ConfigManager
8
- from ..utils.output import extract_request_id, print_request_id_footer
8
+ from ..utils.output import extract_credits, extract_request_id, print_credits_footer, print_request_id_footer
9
9
 
10
10
  console = Console()
11
11
  config_manager = ConfigManager()
@@ -63,6 +63,7 @@ def read_canonical(
63
63
  "char_count": char_count,
64
64
  "source": source,
65
65
  "request_id": extract_request_id(result),
66
+ "credits": extract_credits(result),
66
67
  }
67
68
  print(json.dumps(data, ensure_ascii=False, indent=2))
68
69
  return
@@ -81,6 +82,7 @@ def read_canonical(
81
82
  "token_count": token_count,
82
83
  "char_count": char_count,
83
84
  "request_id": extract_request_id(result),
85
+ "credits": extract_credits(result),
84
86
  }
85
87
  console.print_json(json.dumps(data, ensure_ascii=False))
86
88
  else:
@@ -94,6 +96,7 @@ def read_canonical(
94
96
  f"[dim]{char_count} chars • {token_count} tokens • source={source}[/dim]"
95
97
  )
96
98
  print_request_id_footer(console, extract_request_id(result))
99
+ print_credits_footer(console, result)
97
100
 
98
101
  except Exception as e:
99
102
  console.print(f"[red]Erro:[/red] {e}")
@@ -271,15 +271,21 @@ def render_llm_output(hits: list, query: str, metadata: Optional[dict] = None) -
271
271
  lines = []
272
272
  total = len(hits)
273
273
  for i, hit in enumerate(hits, 1):
274
+ # Prefere `citation` (v0.19.4+) — formato jurídico pronto para LLMs.
275
+ # Fallback para `source` (legado) ou `document_id`.
276
+ citation = _hit_get(hit, "citation") or ""
274
277
  source = _hit_get(hit, "source") or _hit_get(hit, "document_id") or ""
278
+ label = citation or source
275
279
  article = _hit_get(hit, "article_number") or ""
276
280
  score = _hit_get(hit, "score", 0) or 0
277
281
  text = _hit_get(hit, "text", "") or ""
278
282
 
279
283
  header = f"[{i}/{total}]"
280
- if source:
281
- header += f" {source}"
282
- if article and article not in source:
284
+ if label:
285
+ header += f" {label}"
286
+ # adiciona "Art. N" extra se o label não tiver a citation formatada
287
+ # (citation já inclui o artigo com contexto correto)
288
+ if not citation and article and article not in source:
283
289
  header += f", Art. {article}"
284
290
  try:
285
291
  header += f" (score={float(score):.2f})"
@@ -426,22 +432,27 @@ def format_search_results(console: Console, results: Any, output_format: OutputF
426
432
  # na coluna Texto. Se o resultado for muito alto visualmente, use --top-k N.
427
433
  table = Table(show_header=True, header_style="bold cyan")
428
434
  table.add_column("#", justify="right", style="dim", width=3)
429
- table.add_column("Norma", style="cyan", width=22)
430
- table.add_column("Artigo", style="green", width=8)
435
+ table.add_column("Referência", style="cyan", width=34, overflow="fold")
431
436
  table.add_column("Texto", overflow="fold")
432
437
  table.add_column("Score", justify="right", width=7)
433
438
  table.add_column("Evidência", width=14)
434
439
 
435
440
  for i, hit in enumerate(results.hits, 1):
436
- doc_id = get_hit_document_id(hit)
437
- norma = format_document_label(doc_id)
438
- article = getattr(hit, "article_number", "-") or "-"
441
+ # Prefere citation (formato jurídico brasileiro) se disponível;
442
+ # fallback para "Norma Art. N" montado a partir do document_id.
443
+ citation = getattr(hit, "citation", None)
444
+ if citation:
445
+ reference_cell = citation
446
+ else:
447
+ doc_id = get_hit_document_id(hit)
448
+ norma = format_document_label(doc_id)
449
+ article = getattr(hit, "article_number", None)
450
+ reference_cell = f"{norma}, Art. {article}" if article else norma
439
451
  text = hit.text # sem truncamento, sem replace \n — dado integral
440
452
  evidence_cell = render_evidence_cell_table(hit)
441
453
  table.add_row(
442
454
  str(i),
443
- norma,
444
- str(article),
455
+ reference_cell,
445
456
  text,
446
457
  f"{hit.score:.3f}",
447
458
  evidence_cell,
File without changes
File without changes