vectorgov-cli 0.2.7__tar.gz → 0.2.9__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.2.7 → vectorgov_cli-0.2.9}/PKG-INFO +1 -1
  2. {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.9}/pyproject.toml +1 -1
  3. {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.9}/src/vectorgov/cli/__init__.py +1 -1
  4. {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.9}/src/vectorgov/cli/commands/lookup.py +80 -0
  5. {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.9}/.gitignore +0 -0
  6. {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.9}/README.md +0 -0
  7. {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.9}/src/vectorgov/cli/commands/__init__.py +0 -0
  8. {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.9}/src/vectorgov/cli/commands/ask.py +0 -0
  9. {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.9}/src/vectorgov/cli/commands/audit.py +0 -0
  10. {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.9}/src/vectorgov/cli/commands/auth.py +0 -0
  11. {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.9}/src/vectorgov/cli/commands/config.py +0 -0
  12. {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.9}/src/vectorgov/cli/commands/context.py +0 -0
  13. {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.9}/src/vectorgov/cli/commands/docs.py +0 -0
  14. {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.9}/src/vectorgov/cli/commands/explain.py +0 -0
  15. {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.9}/src/vectorgov/cli/commands/feedback.py +0 -0
  16. {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.9}/src/vectorgov/cli/commands/fs_search.py +0 -0
  17. {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.9}/src/vectorgov/cli/commands/grep_cmd.py +0 -0
  18. {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.9}/src/vectorgov/cli/commands/hybrid.py +0 -0
  19. {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.9}/src/vectorgov/cli/commands/init.py +0 -0
  20. {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.9}/src/vectorgov/cli/commands/merged.py +0 -0
  21. {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.9}/src/vectorgov/cli/commands/prompts.py +0 -0
  22. {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.9}/src/vectorgov/cli/commands/quota.py +0 -0
  23. {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.9}/src/vectorgov/cli/commands/read.py +0 -0
  24. {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.9}/src/vectorgov/cli/commands/search.py +0 -0
  25. {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.9}/src/vectorgov/cli/commands/smart_search.py +0 -0
  26. {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.9}/src/vectorgov/cli/commands/tokens.py +0 -0
  27. {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.9}/src/vectorgov/cli/main.py +0 -0
  28. {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.9}/src/vectorgov/cli/utils/__init__.py +0 -0
  29. {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.9}/src/vectorgov/cli/utils/config.py +0 -0
  30. {vectorgov_cli-0.2.7 → vectorgov_cli-0.2.9}/src/vectorgov/cli/utils/output.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vectorgov-cli
3
- Version: 0.2.7
3
+ Version: 0.2.9
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
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "vectorgov-cli"
7
- version = "0.2.7"
7
+ version = "0.2.9"
8
8
  description = "CLI para a API VectorGov - Busca semântica em legislação brasileira"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -7,7 +7,7 @@ Uso:
7
7
  vectorgov auth login
8
8
  """
9
9
 
10
- __version__ = "0.2.7"
10
+ __version__ = "0.2.9"
11
11
 
12
12
  from .main import app
13
13
 
@@ -116,6 +116,10 @@ def lookup( # noqa: C901
116
116
  console.print(f"\n[bold cyan][{i+1}] {ref_str}[/bold cyan] [{status}]")
117
117
  if text:
118
118
  console.print(text[:300])
119
+ if ev:
120
+ console.print(f"[dim] Ver trecho: {ev}[/dim]")
121
+ if doc_url:
122
+ console.print(f"[dim] Baixar PDF: {doc_url}[/dim]")
119
123
  return
120
124
 
121
125
  # Single mode (existing logic)
@@ -130,6 +134,82 @@ def lookup( # noqa: C901
130
134
 
131
135
  status = getattr(result, "status", None)
132
136
 
137
+ # Backend faz auto-split quando a query contem multiplas referencias
138
+ # separadas por virgula ou "e" (ex: "inc. I do Art. 4, inc. II do Art. 4").
139
+ # Nesse caso retorna status=batch com a lista em `results`.
140
+ if status == "batch":
141
+ batch_results = getattr(result, "results", None) or []
142
+ if raw or effective_output == "raw":
143
+ data = {
144
+ "batch": True,
145
+ "total": len(batch_results),
146
+ "results": [],
147
+ }
148
+ for r in batch_results:
149
+ raw_r = getattr(r, "_raw_response", None) or {}
150
+ data["results"].append({
151
+ "reference": getattr(r, "query", ""),
152
+ "status": getattr(r, "status", "unknown"),
153
+ "text": raw_r.get("text") or getattr(r, "stitched_text", "") or "",
154
+ "evidence_url": absolute_url(
155
+ getattr(r, "evidence_url", None) or raw_r.get("evidence_url")
156
+ ),
157
+ "document_url": absolute_url(
158
+ getattr(r, "document_url", None) or raw_r.get("document_url")
159
+ ),
160
+ "document_id": raw_r.get("document_id", ""),
161
+ "device_type": raw_r.get("device_type", ""),
162
+ "breadcrumb": raw_r.get("breadcrumb", ""),
163
+ })
164
+ print(json.dumps(data, ensure_ascii=False, indent=2))
165
+ return
166
+
167
+ # Text / json / llm output
168
+ if effective_output == "llm":
169
+ for i, r in enumerate(batch_results):
170
+ raw_r = getattr(r, "_raw_response", None) or {}
171
+ r_status = getattr(r, "status", "unknown")
172
+ r_text = raw_r.get("text") or getattr(r, "stitched_text", "") or ""
173
+ r_ref = getattr(r, "query", f"ref {i+1}")
174
+ r_ev = absolute_url(getattr(r, "evidence_url", None) or raw_r.get("evidence_url"))
175
+ r_doc = absolute_url(getattr(r, "document_url", None) or raw_r.get("document_url"))
176
+ print(f"[{i+1}/{len(batch_results)}] {r_ref} ({r_status})")
177
+ if r_text:
178
+ print(r_text)
179
+ if r_ev:
180
+ print(f"EVIDENCE: {r_ev}")
181
+ if r_doc:
182
+ print(f"PDF: {r_doc}")
183
+ if i < len(batch_results) - 1:
184
+ print("---")
185
+ else:
186
+ console.print(f"[bold]Batch:[/bold] {len(batch_results)} referencias encontradas")
187
+ for i, r in enumerate(batch_results):
188
+ raw_r = getattr(r, "_raw_response", None) or {}
189
+ r_status = getattr(r, "status", "unknown")
190
+ r_text = raw_r.get("text") or getattr(r, "stitched_text", "") or ""
191
+ r_ref = getattr(r, "query", f"ref {i+1}")
192
+ r_breadcrumb = raw_r.get("breadcrumb", "")
193
+ r_ev = absolute_url(
194
+ getattr(r, "evidence_url", None) or raw_r.get("evidence_url")
195
+ )
196
+ r_doc = absolute_url(
197
+ getattr(r, "document_url", None) or raw_r.get("document_url")
198
+ )
199
+ title = f"[{i+1}] {r_ref} [{r_status}]"
200
+ if r_breadcrumb:
201
+ title += f"\n {r_breadcrumb}"
202
+ if r_text:
203
+ console.print(Panel(r_text, title=title, border_style="cyan"))
204
+ else:
205
+ console.print(f"\n[yellow]{title}[/yellow]")
206
+ console.print(f" Nenhum texto retornado.")
207
+ # Links de evidencia abaixo de cada resultado
208
+ pseudo_r = {"evidence_url": r_ev, "document_url": r_doc}
209
+ for line in render_evidence_lines_text(pseudo_r):
210
+ console.print(f"[dim]{line}[/dim]")
211
+ return
212
+
133
213
  # Fallback: SDK v0.16 falha ao parsear `match` quando o backend aplica
134
214
  # _strip_lookup_internals (remove node_id/span_id por segurança). O
135
215
  # backend envia text/document_id/device_type no root do response mas
File without changes
File without changes