Skip to content

feat: add --query-time flag to search - #65

Merged
IlyaGusev merged 2 commits into
mainfrom
feat/query-time-flag
Aug 16, 2026
Merged

feat: add --query-time flag to search#65
IlyaGusev merged 2 commits into
mainfrom
feat/query-time-flag

Conversation

@IlyaGusev

Copy link
Copy Markdown
Collaborator

Adds --query-time to keenable search for point-in-time search: results are limited to pages available on or before the given timestamp (ISO 8601 or relative, e.g. 7d). Sent as query_time in the search body.

Companion to keenableai/keenable-backend-ts#354, which exposes query_time on the MCP surface so all three interfaces (REST, MCP, CLI) accept the same parameter set.

Example:

keenable search "AI news" --query-time 2026-01-01T00:00:00Z

Verified: cargo check and cargo test pass (20/20).

🤖 Generated with Claude Code

Point-in-time search: sends query_time in the search body, matching the
REST API and the MCP tool schema (keenable-backend-ts#354).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Add --query-time flag for point-in-time web search

✨ Enhancement 🕐 10-20 Minutes

Grey Divider

AI Description

• Add --query-time CLI flag to request point-in-time search results.
• Forward query_time into the search JSON body sent to the daemon/API.
• Document the new flag in keenable search help examples.
Diagram

graph TD
  U["User"] --> CLI["CLI (clap)"] --> SC["Search command"] --> RB["Search body (query_time)"] --> API["Backend Search API"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Client-side validation/normalization
  • ➕ Earlier user feedback for invalid ISO 8601/relative formats
  • ➕ Optionally normalize relative durations into a canonical timestamp
  • ➖ Duplicates backend parsing rules; risk of CLI/backend drift
  • ➖ Adds date parsing dependencies and edge cases (timezones, relative units)
2. Typed query_time (DateTime/Duration) model
  • ➕ Clearer internal API than raw strings
  • ➕ Enables consistent formatting before sending to server
  • ➖ Requires designing a parsing/serialization layer anyway
  • ➖ More code churn for minimal functional gain if backend already accepts strings

Recommendation: Keep the current pass-through approach unless CLI-side validation is a known pain point. It minimizes drift with the backend/MCP schema and keeps the CLI thin; consider adding optional client-side validation later if users frequently misformat --query-time.

Files changed (2) +12 / -1

Enhancement (2) +12 / -1
search.rsThread 'query_time' into the search request body +4/-0

Thread 'query_time' into the search request body

• Extends the 'search()' command signature to accept an optional 'query_time'. When provided, adds 'query_time' to the JSON body sent with the search daemon request.

src/commands/search.rs

main.rsAdd '--query-time' flag to 'keenable search' and wire it through +8/-1

Add '--query-time' flag to 'keenable search' and wire it through

• Adds a new '--query-time' option to the Search command (with help text describing ISO 8601 and relative formats) and includes an example in 'after_help'. Passes the parsed value through to 'commands::search::search()'.

src/main.rs

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can add REVIEW.md to your repo root and Qodo follows it on every PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

- carry query_time in SearchFilters instead of a 7th positional arg
- bare #[arg(long)] and one-line help in the sibling style
- add the flag to the README example list and the e2e suite

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@IlyaGusev
IlyaGusev merged commit 4e354cc into main Aug 16, 2026
12 checks passed
@IlyaGusev
IlyaGusev deleted the feat/query-time-flag branch August 16, 2026 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant