Parses and serializes task search queries, handling qualifiers, scopes, and free text for GitHub-like searches.
// Source: https://github.com/stablyai/orca | License: MIT | Copyright 2026 Lovecast Inc
// Provided via justclaw.it.com; keep this notice with the code.
export type ParsedTaskQuery = {
scope: 'all' | 'issue' | 'pr'
state: 'open' | 'closed' | 'all' | 'merged' | null
draft: boolean
assignee: string | null
author: string | null
reviewRequested: string | null
reviewedBy: string | null
labels: string[]
freeText: string
}
type SearchQueryToken = {
value: string
raw: string
}
function tokenizeSearchQueryWithRaw(rawQuery: string): SearchQueryToken[] {
const tokens: SearchQueryToken[] = []
let value = ''
let raw = ''
let quote: '"' | "'" | null = null
const flush = (): void => {
if (value || raw) {
tokens.push({ value, raw })
value = ''
raw
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key