Add cross-system read-only search
One query now finds anything in the system over the wire and from the CLI. - protocol: add Search/SearchResults message types and a SearchRequest (query, optional kind filter, optional limit) / SearchResponse (typed, ranked matches plus truncation and scan-bound counters) pair, with typed payloads for pipeline, version, run, step/visit, field text and artifact. - store: add Store.Search, a read-only query over pipelines, pipeline_versions, pipeline_runs, run_steps (+step_control) and step_artifacts. Ranks exact name (3) > name substring (2) > body text (1), breaks ties by recency then a stable kind/target order, and reports the matched field. Bounds work with a 50-default/200-max result cap, a 2000-row per-kind scan limit and a 2000-step / 1 MiB field-text scan budget. - terms: a bare status word or lone date expression (today, yesterday, this week, YYYY-MM-DD) selects runs; anything else stays free text. - server: dispatch protocol.Search to stores[0].Search; read-only and unconfirmed. - cli: add `pipelines search QUERY [--type KIND] [--limit N] [--json]`, help text and a BROWSE line. - store: add OpenReadOnly so the live-database check never runs DDL. - docs: document the grammar, kinds, ranking and bounds in docs/cli.md, scope the TUI omnisearch to pipelines in docs/ui-ux-review.md, and add a search bullet to the packaged operations reference. - tests: protocol round trip, store/ranking/term-parsing/limit/scan-bound unit tests, a server end-to-end test, and an env-guarded live check. No new dependencies; go.mod/go.sum unchanged.
This commit is contained in:
+42
-4
@@ -61,6 +61,42 @@ ntfy hosts are not misrepresented as local. Publishing URLs and credentials are
|
||||
never returned. Missing public phone configuration is labeled explicitly.
|
||||
`pipelines service status` remains the separate OS autostart status command.
|
||||
|
||||
## Search
|
||||
|
||||
`pipelines search QUERY [--type KIND] [--limit N] [--json]` runs one read-only
|
||||
query across the whole system: pipeline names and their versions, run identity,
|
||||
status and dates, stage and visit identifiers, artifact names and types, and the
|
||||
text of stage inputs, outputs, evidence and transcripts. It never reads
|
||||
artifact contents, never makes a per-result follow-up request, and asks for no
|
||||
confirmation.
|
||||
|
||||
- Free text matches case-insensitively. A bare status word (`queued`, `running`,
|
||||
`succeeded`, `failed`, `canceled`, `interrupted`) selects those runs, and a lone
|
||||
date expression (`today`, `yesterday`, `this week` — Monday 00:00 local — or a
|
||||
literal `YYYY-MM-DD`) selects the runs created in that window; any other text,
|
||||
including a status word inside a sentence, stays free text.
|
||||
- `--type` is the only narrowing mechanism and takes one kind: `pipeline`,
|
||||
`version`, `run`, `step`, `field` or `artifact`. An unknown kind is an error,
|
||||
never a silently ignored filter.
|
||||
- Ranking: an exact name match (score 3) beats a name substring (2) beats a
|
||||
body-text match (1); equal tiers break by recency, then a stable kind/target
|
||||
order. Every result carries `score`, `matched_field` and `recency` so a client
|
||||
can re-rank.
|
||||
- Bounds: the result cap defaults to 50 and clamps to 200 (`0` = default);
|
||||
every kind scans at most 2000 rows, and field-text scanning stops at 2000 steps
|
||||
or 1 MiB decoded. `truncated` plus `scanned_steps`, `scanned_bytes`, `cap` and
|
||||
`scan_bound_bytes` report when a bound applied.
|
||||
- Targets are stable and navigable: `pipeline:<id>`, `pipeline:<id>:v<version>`,
|
||||
`run:<id>`, `run:<id>:<sequence>`, `run:<id>:<sequence>:<field>`, or an
|
||||
artifact URL served by the artifact endpoint.
|
||||
|
||||
```sh
|
||||
pipelines search "release notes" --json
|
||||
pipelines search failed --json
|
||||
pipelines search 2026-10-16 --type run --json
|
||||
pipelines search "acceptance check" --type field --limit 10
|
||||
```
|
||||
|
||||
## Draft-first harness workflow
|
||||
|
||||
```sh
|
||||
@@ -194,6 +230,7 @@ Submitting activates included schedules, so review them before publishing.
|
||||
| TUI action | Agent-capable CLI |
|
||||
| --- | --- |
|
||||
| Browse/search pipelines | `list --json`, `show NAME --json` |
|
||||
| Search everything | `search QUERY --json` (see [Search](#search)) |
|
||||
| Original source and history | `export NAME --version N`, `versions NAME --json` |
|
||||
| Browse templates/source | `templates --json`, `template KEY --source` |
|
||||
| Create or edit a definition | `new`, `edit`, `drafts` |
|
||||
@@ -217,10 +254,11 @@ printf '%s' '{"type":"get_pipeline","pipeline_id":1,"version":1}' | pipelines rp
|
||||
|
||||
Existing protocol commands: `ping`, `list_pipelines`, `get_pipeline`,
|
||||
`list_templates`, `validate`, `submit`, `run_pipeline`, `list_runs`, `get_run`,
|
||||
`cancel_run`, `retry_run`, `get_status`. `list_runs` also returns all-history `usage`
|
||||
aggregates. See `internal/protocol/message.go` for JSON envelopes. Mutating RPCs
|
||||
have real effects; they are not previews. TUI-only animation, scrolling, and
|
||||
transient client logs are presentation, not separate server capabilities.
|
||||
`cancel_run`, `retry_run`, `get_status`, `search`. `list_runs` also returns
|
||||
all-history `usage` aggregates. See `internal/protocol/message.go` for JSON
|
||||
envelopes. Mutating RPCs have real effects; they are not previews. TUI-only
|
||||
animation, scrolling, and transient client logs are presentation, not separate
|
||||
server capabilities.
|
||||
|
||||
## Scripted runs
|
||||
|
||||
|
||||
Reference in New Issue
Block a user