Rework omni search onto a typed search contract and add a TUI artifacts view

Protocol: replace the loose Query/Kind/Matches/Limit search fields with a Search request object and a SearchResults response, and have the server answer search from Store.Search over the shared run projections (runFrom/runStamps).

CLI: add the read-only 'pipelines search QUERY [--type KIND] [--limit N] [--json]' command with usage/help, and document the typed targets, ranking and bounds in docs/cli.md.

TUI: the '/' popup keeps type-to-search, up/down, Enter and Esc, renders one ranked list with kind badges and a bracketed (non-colour) match snippet, and Enter opens the matched pipeline, run, step, artifact or field; footer text updated to match.

TUI: add a dedicated run artifacts view ('A') with open/copy of recorded files, and move artifacts out of the run-detail File changes section (artifactCaptureNotes).

Tests: add Store.OpenReadOnly for read-only inspection of a live database plus pipeline/server/TUI search tests and artifacts tests, including env-gated live checks.
This commit is contained in:
2026-10-16 23:48:38 +01:00
parent fae1005962
commit 865993b200
24 changed files with 1761 additions and 68 deletions
+28 -4
View File
@@ -134,7 +134,8 @@ type Model struct {
commandIndex int
homeTop int
searchOpen bool
searchResults []protocol.SearchMatch
searchResults []protocol.SearchResult
searchText string
searchRequest string
searchInFlight bool
searchQueued bool
@@ -203,6 +204,9 @@ type Model struct {
decisionIndex int
decisionFeedback textinput.Model
decisionFeedbackFocus bool
artifactsOpen bool
artifactIndex int
artifactTop int
editorOpen bool
editorInput textinput.Model
editorIndex int
@@ -275,6 +279,17 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.appendLine("Harness debug: " + msg.err.Error())
}
return m, nil
case artifactActionMsg:
if msg.err != nil {
m.appendLine("Artifact " + msg.verb + ": " + msg.err.Error())
return m, nil
}
if msg.verb == "copy" {
m.appendLine("Copied artifact URL: " + msg.url)
} else {
m.appendLine("Opened artifact URL: " + msg.url)
}
return m, nil
case spinner.TickMsg:
var cmd tea.Cmd
m.runSpinner, cmd = m.runSpinner.Update(msg)
@@ -360,11 +375,12 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.statusRequest = ""
}
if msg.Type == protocol.SearchResults {
if msg.ID == m.searchRequest {
if msg.ID == m.searchRequest && msg.SearchResults != nil {
m.searchInFlight = false
m.searchResults = msg.Matches
m.searchResults = msg.SearchResults.Results
m.searchText = msg.SearchResults.Query
m.searchError = ""
m.commandIndex = min(m.commandIndex, max(0, len(msg.Matches)-1))
m.commandIndex = min(m.commandIndex, max(0, len(msg.SearchResults.Results)-1))
if m.searchQueued {
m.searchQueued = false
updated, cmd := m.requestSearch()
@@ -442,6 +458,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.searchInFlight = false
m.searchQueued = false
m.searchResults = nil
m.searchText = ""
m.searchError = msg.Error
}
} else if msg.Type == protocol.Submitted {
@@ -638,6 +655,9 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if m.decisionOpen {
return m.updateDecision(msg)
}
if m.artifactsOpen {
return m.updateArtifacts(msg)
}
if m.runOpen && (msg.String() != ":" || m.runSearchOpen) {
return m.updateRuns(msg)
}
@@ -667,6 +687,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.commandInput = newInput()
if m.searchOpen {
m.searchResults = nil
m.searchText = ""
m.searchError = ""
m.commandInput.Placeholder = "Type to search…"
return m, m.commandInput.Focus()
@@ -845,6 +866,9 @@ func (m Model) View() string {
if m.decisionOpen {
content = m.decisionView(bodyHeight)
}
if m.artifactsOpen {
content = m.artifactsView(bodyHeight)
}
if m.mutationCommand != nil {
paragraphs := []string{"This opens a new session/editor and may modify a retained draft.", "Published definitions and previous run history are unchanged."}
if strings.Contains(m.mutationTitle, "debugging") {