Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

Refine pagination hints

cyhbd0d8658ba3d
diff --git a/tests/test_cli_pagination.py b/tests/test_cli_pagination.py
index 193b3166d..04a52ca5f 100644
--- a/tests/test_cli_pagination.py
+++ b/tests/test_cli_pagination.py
@@ -38,7 +38,7 @@ def test_runs_list_cli_defaults_to_first_page(monkeypatch, tmp_path, capsys) ->
assert payload["runs"][0]["id"] == "run-24"
assert payload["pagination"]["has_more"] is True
assert payload["pagination"]["next_command"] == "vibe runs list --brief --page 2 --limit 20"
- assert "还有更多记录" in payload["message"]
+ assert "More records are available" in payload["message"]
def test_runs_list_cli_filters_status_and_query(monkeypatch, tmp_path, capsys) -> None:
@@ -169,6 +169,34 @@ def test_data_query_cli_runs_read_only_sql(monkeypatch, tmp_path, capsys) -> Non
assert payload["rows"] == [{"id": "run-1", "status": "succeeded"}]
+def test_data_query_cli_omits_next_command_for_stdin_sql(monkeypatch, tmp_path, capsys) -> None:
+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))
+ paths.ensure_data_dirs()
+ store = SQLiteBackgroundTaskStore()
+ try:
+ for index in range(25):
+ store.enqueue_run(
+ {
+ "id": f"run-{index:02d}",
+ "request_type": "agent_run",
+ "status": "succeeded",
+ "created_at": f"2026-05-25T00:{index:02d}:00+00:00",
+ "updated_at": f"2026-05-25T00:{index:02d}:00+00:00",
+ }
+ )
+ finally:
+ store.close()
+
+ monkeypatch.setattr("sys.stdin", type("FakeStdin", (), {"read": lambda self: "select id from agent_runs order by id"})())
+ args = cli.build_parser().parse_args(["data", "query", "--sql-file", "-", "--limit", "10"])
+ assert cli.cmd_data_query(args) == 0
+
+ payload = json.loads(capsys.readouterr().out)
+ assert payload["pagination"]["has_more"] is True
+ assert "next_command" not in payload["pagination"]
+ assert payload["message"] == "More records are available. Add --page to continue."
+
+
def test_data_query_cli_rejects_writes(monkeypatch, tmp_path, capsys) -> None:
monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))
paths.ensure_data_dirs()
diff --git a/tests/test_show_pages.py b/tests/test_show_pages.py
index 4268a9d13..59219252f 100644
--- a/tests/test_show_pages.py
+++ b/tests/test_show_pages.py
@@ -235,7 +235,7 @@ def test_show_list_cli_json_reports_pagination(monkeypatch, tmp_path, capsys):
assert payload["pagination"]["has_more"] is True
assert payload["pagination"]["next_page"] == 2
assert "vibe show list --json --page 2 --limit 20" == payload["pagination"]["next_command"]
- assert "还有更多记录" in payload["message"]
+ assert "More records are available" in payload["message"]
def test_show_list_cli_next_command_uses_absolute_time_filters(monkeypatch, tmp_path, capsys):
diff --git a/vibe/cli.py b/vibe/cli.py
index 27ab00e39..f0a163bae 100644
--- a/vibe/cli.py
+++ b/vibe/cli.py
@@ -200,8 +200,8 @@ def _pagination_message(page_payload: dict) -> str | None:
return None
next_command = page_payload.get("next_command")
if next_command:
- return f"还有更多记录。继续翻页:{next_command}"
- return "还有更多记录。请加上 --page 参数继续翻页。"
+ return f"More records are available. Continue with: {next_command}"
+ return "More records are available. Add --page to continue."
def _parse_cli_time_filter(value: str | None, *, field_name: str, help_command: str) -> str | None:
@@ -2750,9 +2750,17 @@ def cmd_data_query(args):
command = ["vibe", "data", "query"]
if getattr(args, "sql", None):
_add_optional_arg(command, "--sql", getattr(args, "sql", None))
- elif sql_file:
+ elif sql_file and sql_file != "-":
_add_optional_arg(command, "--sql-file", sql_file)
- page_payload = pagination_payload(result.pagination, next_command=_next_command(command, result.pagination, include_all=bool(getattr(args, "all", False))))
+ omit_next_command = bool(sql_file == "-")
+ page_payload = pagination_payload(
+ result.pagination,
+ next_command=_next_command(
+ command,
+ result.pagination,
+ include_all=bool(getattr(args, "all", False)) or omit_next_command,
+ ),
+ )
message = _pagination_message(page_payload)
payload = {
"columns": result.columns,