From 3d7907fd8c2d86dcc1c37722919473f38b33e7f4 Mon Sep 17 00:00:00 2001 From: Jonathan Yang <14588641+Joilence@users.noreply.github.com> Date: Wed, 7 Oct 2026 21:47:09 +0200 Subject: [PATCH] fix(search): move result date from snippet to published With a session token, kagi search now parses the result date into published (YYYY-MM-DDT00:00:00Z) and removes it from the snippet. Snippets also drop the "Summarize" link text and collapse whitespace. Relative dates such as "Yesterday" stay in the snippet. Breaking: search and batch CSV output gain a fourth column, so the header is now title,url,snippet,published. pretty and markdown print the date, and --template accepts {{published}}. --- CHANGELOG.md | 4 + docs/content/docs/commands/search.mdx | 8 +- .../docs/reference/output-contract.mdx | 5 + src/main.rs | 86 ++++++++++- src/parser.rs | 134 +++++++++++++++--- 5 files changed, 207 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 903e5ab..bc47568 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,16 @@ - `kagi assistant` and `kagi ask-page` JSON output no longer has `meta.version`, `meta.trace`, `message.reply_html`, or `message.trace_id`, because Kagi's v2 Assistant API returns markdown only. `message.id` is now the assistant turn id. - `kagi assistant --assistant --model ` is now an error, because built-in assistants always use their own model. +- `kagi search --format csv` and `kagi batch --format csv` gain a fourth column: the header is now `title,url,snippet,published`. ### Fixed - `kagi assistant` and `kagi ask-page` work again after Kagi moved Assistant to its v2 API; prompts no longer fail with `HTTP 405 Method Not Allowed`. - `kagi assistant --assistant` with a built-in assistant such as `Code` now selects it as a model, as the web app does. - Assistant citation markers are rewritten to `[^1]`, `[^2]`, ... to match `references_markdown`. +- `kagi search` snippets no longer include Kagi's "Summarize" link text, and whitespace in snippets is collapsed. +- `kagi search` with a session token fills `published` with the result's date as `YYYY-MM-DDT00:00:00Z` and removes the date from the snippet. Relative dates such as "Yesterday" stay in the snippet and leave `published` as `null`. +- `pretty` and `markdown` output print `published` under the URL, `csv` adds the column, and `--template` accepts `{{published}}`, for API-key searches too. ## [0.20.1] diff --git a/docs/content/docs/commands/search.mdx b/docs/content/docs/commands/search.mdx index 65691fb..b9cb78e 100644 --- a/docs/content/docs/commands/search.mdx +++ b/docs/content/docs/commands/search.mdx @@ -78,7 +78,7 @@ Possible values: - `compact` - minified JSON - `pretty` - terminal-friendly output - `markdown` - markdown list output -- `csv` - CSV table output +- `csv` - CSV table output with `title,url,snippet,published` columns ### `--no-color` @@ -179,7 +179,7 @@ kagi search --no-personalized "rust web framework" ### `--template