Commit graph

6 commits

Author SHA1 Message Date
guzzle
4856644766 fix: allow colons in unquoted query identifier values
The query lexer's isIdentChar function did not include ':' as a valid
character, causing expressions like "label=gt:merge-request" to fail
with "unexpected character ':'" errors. This broke bd query for any
label using the namespaced gt: prefix convention.

Add ':' to isIdentChar so that namespaced label values can be used
without quoting. Quoted form ("gt:merge-request") continues to work.

Fixes: mo-qki
2026-03-14 05:02:22 +00:00
beads/refinery
69573b8810 fix: add test coverage for quoted label values with colons (bd-wnr1)
Adds lexer and evaluator tests for label="gt:merge-request" syntax,
verifying the query parser correctly handles colon characters in
quoted string values.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 01:46:11 -07:00
Joseph Turian
9457158f2d feat: add has_metadata_key to bd query DSL
Support metadata existence checks in the query DSL:
  bd query "has_metadata_key=team AND status=open"

Completes the list/search/query triangle for metadata existence
filtering. Uses existing IssueFilter.HasMetadataKey field and
SQL-level JSON_EXTRACT IS NOT NULL from PR2.

Implements GH#1406.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 12:43:06 -05:00
Joseph Turian
00e802f60c
feat: make metadata queryable from bd list, bd search, and bd query (#1908)
Add SQL-level metadata filtering using Dolt's JSON_EXTRACT/JSON_UNQUOTE
with parameterized queries. New CLI flags: --metadata-field key=value
(repeatable, AND semantics) and --has-metadata-key key. Add metadata.<key>
support to bd query DSL. Strict key validation prevents JSON path injection.

Remove //go:build cgo tag from metadata_filter_test.go (CGO bifurcation
was removed in c4010c19).
2026-02-22 15:30:07 -08:00
beads/crew/lizzy
2bb827facb style: run gofmt across entire codebase (bd-nmk12)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 19:35:20 -08:00
Patrick Farrell
f3874edee0 feat: add simple query language for complex filtering
Adds a new `bd query` command that enables complex filtering with a simple
query language supporting boolean operators, comparisons, and date-relative
expressions.

Features:
- Field comparisons: status=open, priority>1, updated>7d
- Boolean operators: AND, OR, NOT (case-insensitive)
- Parentheses for grouping: (status=open OR status=blocked) AND priority<2
- Date-relative expressions: 7d, 24h, 2w (interpreted as "X ago")
- Supports all IssueFilter fields: status, priority, type, assignee, label,
  title, description, notes, created, updated, closed, id, spec, pinned,
  ephemeral, template, parent, mol_type

Implementation:
- New internal/query package with lexer, parser, and evaluator
- Simple AND queries converted directly to IssueFilter for SQL efficiency
- Complex OR queries use predicate functions for in-memory filtering
- Comprehensive test coverage (62 tests)

Examples:
  bd query "status=open AND priority>1"
  bd query "(status=open OR status=blocked) AND updated>7d"
  bd query "NOT status=closed AND type=bug"
  bd query "label=urgent OR label=critical"

Closes: bd-o9g

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 15:57:40 +00:00