Skip to main content

Crate gqls

Crate gqls 

Source
Expand description

gqls — GraphQL schema search.

Layered like rq: a source loader turns a schema (SDL file, or — planned — an introspection URL) into flat model::SchemaRecords, and a search layer ranks them. Two capabilities are borrowed rather than rebuilt:

  • fuzzy ranking — adapted from rq’s search/score.rs (~/code/lib/rust/rq); see search::score.
  • semantic search — lifted from ae’s local embedding pipeline (~/code/lib/rust/ae: embed.rs + mrl.rs); see semantic. Behind the semantic cargo feature (pulls in ONNX Runtime).

Modules§

cli
clap CLI, dispatch, and output formatting (text / json / ndjson).
load
Schema ingestion: a source string is either an http(s) URL (introspect) or a path to an SDL file. Both produce the same SchemaRecord list, so nothing downstream cares which it was. When no source is given, discover finds a schema in the current directory tree.
logging
Stderr verbosity, set once from -q/-v and shared across the CLI.
model
The language-agnostic record model: every type, field, arg, enum value, and directive in a schema flattens to one SchemaRecord. Search and output operate only on these — they never touch a parser or a transport.
paths
Shared on-disk locations. gqls keeps everything cacheable under one base dir ($XDG_CACHE_HOME/gqls, else ~/.cache/gqls) — embedding vectors, the introspection response cache, and the background-warm lockfiles.
resolve
Field → resolver jump.
search
The read path: score every record against the query, rank, truncate.
semantic
Semantic (embedding) search over schema records.

Macros§

detail
Verbose-only diagnostics — printed only under -v. Prefixed gqls:.
status
Normal status chatter — printed unless -q. Prefixed gqls:.