feat(search): regex mode + matched columns in kbagent search (DMD-1716, DMD-1717)#471
Open
romanbracinik wants to merge 1 commit into
Open
Conversation
16fca9a to
9e69f89
Compare
There was a problem hiding this comment.
Pull request overview
Adds opt-in regex mode and matched-column reporting to kbagent search, threading the new regex flag down to the Storage API global-search call and surfacing matchedColumns as matched_columns in both JSON and human output.
Changes:
- Add
--regexflag tokbagent search, validate it against--search-type config-based, and forward it through service/client layers asmode=regex. - Parse API
matchedColumnsinto a stablematched_columnsfield and conditionally render a “Matched columns” column in human output only when populated. - Bump version to
0.66.0and update changelog + command reference docs.
Reviewed changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| uv.lock | Bumps locked project version to 0.66.0. |
| pyproject.toml | Bumps package version to 0.66.0. |
| plugins/kbagent/.claude-plugin/plugin.json | Bumps plugin version to 0.66.0. |
| .claude-plugin/marketplace.json | Updates marketplace plugin version reference to 0.66.0. |
| src/keboola_agent_cli/client.py | Adds regex param to global_search() and sends mode=regex when enabled. |
| src/keboola_agent_cli/services/search_service.py | Threads regex through textual search and normalizes matchedColumns to matched_columns; ensures config-based results include matched_columns: []. |
| src/keboola_agent_cli/commands/search.py | Adds --regex, enforces CLI incompatibility with config-based search, and conditionally renders “Matched columns”. |
| src/keboola_agent_cli/server/routers/search.py | Exposes regex query param and forwards it to SearchService.search(). |
| src/keboola_agent_cli/commands/context.py | Updates help/context text to document --regex and matched_columns. |
| src/keboola_agent_cli/changelog.py | Adds 0.66.0 changelog entry describing the new search behavior. |
| plugins/kbagent/skills/kbagent/references/commands-reference.md | Documents --regex and matched_columns in the command reference. |
| plugins/kbagent/skills/kbagent/references/gotchas.md | Adds gotcha documentation for regex semantics and matched-columns behavior. |
| CLAUDE.md | Updates top-level CLI command reference to include --regex and matched-columns notes. |
| tests/test_client.py | Adds unit tests asserting mode=regex is sent/omitted correctly. |
| tests/test_search_service.py | Adds tests for regex threading and matchedColumns normalization. |
| tests/test_search_cli.py | Adds CLI tests for --regex wiring, validation, and matched-columns rendering/JSON. |
| tests/test_server_router_calls.py | Adds router tests ensuring regex is forwarded/defaulted. |
| tests/test_e2e.py | Adds E2E coverage for regex feature-gate behavior and CLI usage error on config-based + regex. |
Comments suppressed due to low confidence (1)
src/keboola_agent_cli/server/routers/search.py:25
- The
/searchrouter now acceptsregex=truefor allsearch_typevalues, but the CLI explicitly treats--regex+--search-type config-basedas a usage error. Since this endpoint claims to “Mirrorkbagent search”, it should reject the same unsupported combination instead of silently ignoringregexon the config-based path.
regex: bool = False,
registry: ServiceRegistry = Depends(get_registry),
) -> dict[str, Any]:
"""Search tables, buckets, configs and flows across one or more projects. Mirrors `kbagent search`."""
return registry.search.search(
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Author
5c05c4d to
5b3d503
Compare
…6, DMD-1717) Wire the two client-side capabilities of the Global Search re-architecture into `kbagent search`. The rebuilt index/ranking is server-side and already flowed through unchanged; only these opt-in bits needed the CLI. - --regex (DMD-1716): forwards mode=regex to the Storage API global-search endpoint. Case-insensitive, whole-term match against entity names only (report != monthly_report; use .*report.*). Textual-only; combining with --search-type config-based is a usage error (exit 2 from the CLI, HTTP 400 from the serve REST /search) -- validated in SearchService so both surfaces inherit the check. - matched_columns (DMD-1717): a table can match via a column name. The API returns matchedColumns; surfaced as matched_columns on every --json result (always present, [] when the name itself matched) and a "Matched columns" human-table column, shown only when a result actually matched via a column. 3-layer: - client.global_search gains regex param (sends mode=regex; omitted otherwise) - SearchService threads regex through the textual path + rejects regex/config-based; _normalise_item exposes matched_columns (null-safe []); config-based results carry it too for a uniform JSON shape - commands/search.py: --regex/-r flag (matches config search style) + validation + conditional column + header - serve REST /search router forwards regex= (mirrors the CLI) Docs (CLAUDE.md, context.py, commands-reference.md, gotchas.md, keboola-expert.md tool matrix incl. 0.66.0 version gate), changelog split into prefixed one-change-per-bullet entries, version bump 0.66.0. Server contracts verified live. +21 unit/CLI/E2E tests.
5b3d503 to
f608052
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What & why
Wires the two client-side capabilities of the Global Search re-architecture into
kbagent search. The rebuilt index / ranking upgrade is server-side and already flowed through unchanged; only these opt-in bits needed the CLI:--regex(DMD-1716): forwardsmode=regexto the Storage API global-search endpoint. Case-insensitive, whole-term match against entity names only (reportdoes not matchmonthly_report; use.*report.*). Textual-only — combining with--search-type config-basedis a usage error (exit 2).matched_columns(DMD-1717): atablecan now match via one of its column names. The API returnsmatchedColumns; we surface it as amatched_columnsfield on every--jsonresult and a "Matched columns" column in the human table — shown only when at least one result actually matched via a column (no empty column otherwise, incl. every--regexsearch, since regex matches names only).Changes (3-layer)
client.py::global_search—regex: boolparam → sendsmode=regexwhen set (omitted otherwise; non-regex request byte-identical to before).services/search_service.py— threadsregexthrough the textual path;_normalise_itemexposesmatched_columns([]when absent, stable JSON shape).commands/search.py—--regexflag + validation + conditional "Matched columns" column +(regex)header label.CLAUDE.md,context.py(AGENT_CONTEXT),commands-reference.md,gotchas.md(since v0.66.0); changelog + version bump 0.66.0.Verification
curlagainst/v2/storage/global-search):mode=regex→ 200 (invalid pattern → 400, not 500); regex is whole-term/case-insensitive over names;matchedColumns: ["<col>"]returned in textual mode when a table matches via a column; regex does not match columns →matched_columnsalways empty under--regex.ruff,ty,skill-check,command-sync-check,changelog-checkpass.Notes
searchtool (separate repo) and thekbcGo CLI are out of scope.Closes DMD-1716
Closes DMD-1717
🤖 Generated with Claude Code