Specification
This page replaces the former root-levelSPEC.md file.
Product Summary
gitquarry is a Rust terminal CLI for public GitHub repository search.
The core contract is:
- plain
search "query"is native GitHub-style repository search - custom filtering and better discovery exist behind explicit flags
- nothing heavier happens silently
Command Surface
Root
gitquarry search [OPTIONS] [QUERY]gitquarry inspect [OPTIONS] <OWNER/REPO>gitquarry auth login [OPTIONS]gitquarry auth status [OPTIONS]gitquarry auth logout [OPTIONS]gitquarry config pathgitquarry config showgitquarry versiongitquarry --versiongitquarry --generate-completion <bash|zsh|fish|powershell>
Global Options
--host <HOST_OR_URL>- accept bare hostnames or full URLs
- normalize internally
- default host is
github.comunless overridden by config
Auth
Scope
- auth is always required
- v1 is PAT-only
- device flow is out of scope for v1
- v1 is read-only and public-repos-only
Commands
auth login- interactive guided PAT setup
- teaches the user how to create a PAT
- recommends fine-grained PATs when possible
- validates the PAT immediately
- stores credentials per host
auth status- shows whether the current effective host has a saved PAT
auth logout- deletes the PAT for the current effective host
Storage
- secrets are stored in the OS credential store by default
- env vars override saved credentials
- if secure storage is unavailable, insecure file fallback is allowed only with explicit opt-in and warning
- PATs are stored per host, not globally
Config
Location
- store config in a standard per-user config path
- do not store config in the repo or current working directory
Allowed Saved Defaults
hostformatlimitprogress- color preference
Disallowed Saved Defaults
These must remain explicit per command:moderankdepthreadmeexplain- blended ranking weights
- discovery-only engine knobs
Search
Synopsis
Base Behavior
- if the user passes no enhancement flags, search behaves as close to native GitHub repository search as possible
- default output format is
pretty - default result limit is
10 - empty query is invalid in plain native search
Output Formats
pretty- defaultjsoncompactcsv
Pretty Output Visual Default
- the default accent color for human-facing
prettyoutput is electric blue - the exact electric-blue shade does not need to be fixed in v1 as long as it stays in that visual family
- ANSI color choices such as
21or27are acceptable defaults - users may override color preference through config or terminal settings where supported
Retrieval Modes
--mode native- one native GitHub repository search only
--mode discover- explicit enhanced retrieval
- uses staged candidate collection and local reranking
- no
--modeflag -> native behavior
Rank Modes
--rank native--rank query--rank activity--rank quality--rank blended
- no enhancement flags -> effective rank is native
--mode discoverwith no--rank-> default toblended--ranknever changes retrieval mode--sortnever changes rank mode
Native Ordering
--sort is reserved for native GitHub-like retrieval ordering.
Supported values:
best-matchstarsupdated
- in
--rank native, final output order follows native ordering and--sort - in non-native rank modes,
--sortinfluences candidate retrieval only; final displayed order comes from the selected rank mode
Structured Filter Flags
Owner / Visibility
--user <USER>--org <ORG>--archived <true|false>--template <true|false>--fork <false|true|only>
Metadata / Classification
--language <LANG>repeatable--topic <TOPIC>repeatable--license <LICENSE>repeatable
Numeric Ranges
--min-stars <N>--max-stars <N>--min-forks <N>--max-forks <N>--min-size <N>--max-size <N>
Absolute Date Filters
--created-after <YYYY-MM-DD>--created-before <YYYY-MM-DD>--updated-after <YYYY-MM-DD>--updated-before <YYYY-MM-DD>--pushed-after <YYYY-MM-DD>--pushed-before <YYYY-MM-DD>
Relative Date Filters
--created-within <DURATION>--updated-within <DURATION>--pushed-within <DURATION>
12h30d8w6m1y
Filter Semantics
- repeated structured flags use AND semantics
- OR semantics remain available only through raw GitHub query syntax in the query string
--topicis GitHub-native topics only- custom label/category matching is not exposed as a first-class flag
- custom label/category interpretation is query-driven and only available in enhanced/discovery mode
Native vs Post-Filter Behavior
Compile directly into GitHub-native search when possible:- user/org
- archived
- template
- fork
- language
- topic
- license
- stars
- forks
- size
- created
- pushed
- sort
updated-*
Empty Query Rules
- plain native search requires a query
- empty query is allowed only in explicit discovery-oriented usage
- valid:
gitquarry search "rust sdk" - valid:
gitquarry search --mode discover --topic cli --sort updated - invalid:
gitquarry search
Raw Query Plus Structured Flags
The free-text query is the base query. Structured flags append constraints. If the user manually writes a raw GitHub qualifier in the query and also passes an overlapping structured flag, fail clearly instead of guessing. Examples of conflicts:language:rustplus--language gotopic:cliplus--topic sdkstars:>100plus--min-stars 200
Discovery Depth
Discovery depth is discover-only.--depth quick--depth balanced--depth deep
--depth outside discover mode.
Default in discover mode:
balanced
Candidate Pool Targets
Discovery uses a deduped candidate pool before final reranking. Defaults:quick: targetmax(25, limit * 3), cap100balanced: targetmax(50, limit * 5), cap200deep: targetmax(100, limit * 8), cap400
Discovery Retrieval Behavior
Discovery retrieval is staged and bounded.Quick
- seed with one native GitHub repository search only
- no extra fan-out beyond the initial retrieval
- rerank only the returned candidate set
Balanced
- seed with one native GitHub repository search
- if the deduped pool is below target:
- run the same search with
sort=updated - run one recency-biased shard using a recent
pushedbucket
- run the same search with
- stop as soon as the target pool is reached
Deep
- includes balanced behavior
- if still below target:
- add older
pushedbucket searches - add star-bucket shard searches if the user did not already constrain stars
- add older
- stop as soon as the target pool is reached
README Enrichment
--readmeis explicit- no README fetching occurs by default
--readmenever changes retrieval mode by itself- README is enrichment-only, not candidate retrieval
- metadata ranking runs first
- then README enrichment inspects only the top candidate window
- default window =
min(20, max(limit * 2, 10))
Explainability
--explainis explicit- without
--explain, no ranking reasons are shown - in native mode,
--explainis minimal or unsupported - in enhanced modes,
--explaincan show:- matched surfaces
- query score
- activity score
- quality score
- blended score
- effective weights
- key contributing signals
Blended Ranking Weights
Weight flags:--weight-query <0.0..3.0>--weight-activity <0.0..3.0>--weight-quality <0.0..3.0>
- weight flags are valid only with
--rank blended - each value must be in the inclusive range
0.0to3.0 - default weight for each component is
1.0 - all-zero weight sets are invalid
Scoring
Query Score
Literal-first only. No automatic synonym expansion in v1. Use weighted literal matching across:- repository name
- description
- topics
- README only if
--readmeis enabled
Activity Score
Use only:pushed_atupdated_at- release recency
- archived penalty
Quality Score
Use only:- stars
- forks
- contributor count
- license presence
- README presence
- template status
Blended Score
For--rank blended, compute a normalized weighted average:
(wq * query + wa * activity + wql * quality) / (wq + wa + wql)
Only include components whose weight is greater than zero.
Inspect
Synopsis
Behavior
- accept only explicit
owner/repo - no cross-command memory
- default is metadata-first
- README is optional and explicit
Defaults
- output format defaults to
pretty - default content includes:
- full name
- URL
- description
- stars
- forks
- language
- topics
- license
- created / updated / pushed
- archived / template / fork status
- open issues count
- latest release summary when cheaply available
Inspect Flags
--readme--format pretty|json|compact|csv
Progress
- progress output goes to
stderronly - default progress mode is
auto - support
--progress auto|on|off - in
auto, show progress only whenstderris a TTY - no progress is written to stdout
- prefer phase-based progress and counts over fake ETA
- show ETA only for bounded loops where estimation is defensible
Advanced Engine Flags
--concurrency <N>- discover or enrichment only
- default
1 - error outside explicit discovery or enrichment usage
Error Handling
- fail on the first clear error
- print plain text to
stderr - include a stable symbolic error code
- exit code
1
E_FLAG_REQUIRES_MODE: --concurrency requires --mode discoverE_FLAG_CONFLICT: --created-after cannot be combined with --created-withinE_AUTH_REQUIRED: auth required for host github.example.com; run gitquarry auth login --host github.example.com
Version And Completion
- support both
versionand root--version - include shell completion generation in v1
- support
bash|zsh|fish|powershell