Skip to main content

Search

JJHub provides full-text search across the platform. You can search for repositories, issues, code, and users from the CLI or via the API. Search results are paginated and can be filtered, sorted, and output as JSON for programmatic use.
ResourceCLI CommandAPI EndpointWhat’s Indexed
Repositoriesjjhub search reposGET /api/search/repositoriesName, description, topics
Issuesjjhub search issuesGET /api/search/issuesTitle, body, comments
Codejjhub search codeGET /api/search/codeFile contents across all public repositories
Users(API only)GET /api/search/usersUsername, display name, email

CLI Search Commands

Search Repositories

Find repositories by name, description, or topic.
# Basic search
jjhub search repos "jj native"

# Limit results
jjhub search repos "workflow engine" -L 10

# JSON output for scripting
jjhub search repos "jj native" --json
FlagDescription
-L, --limit <n>Maximum number of results to return (default: 30)
Example output:
NAME                    DESCRIPTION                          STARS  UPDATED
alice/jj-tools          CLI utilities for jj workflows       42     2026-03-01
bob/jj-hooks            Git hooks compatible with jj         18     2026-02-28
acme/jj-migration       Migrate from git to jj               7     2026-02-15

Search Issues

Search across issue titles and bodies.
# Search for issues mentioning authentication
jjhub search issues "authentication"

# Filter by state
jjhub search issues "landing request" -s open

# Only closed issues
jjhub search issues "fix crash" -s closed

# Limit results
jjhub search issues "bookmark" -L 5
FlagDescription
-s, --state <state>Filter by state: open, closed, all (default: all)
-L, --limit <n>Maximum number of results to return (default: 30)
Example output:
REPO              NUMBER  TITLE                          STATE   UPDATED
alice/my-project  42      Auth fails on Sign in with Key open    2026-03-01
bob/api-server    17      Token refresh broken           closed  2026-02-20

Search Code

Search file contents across repositories.
# Search for a function name
jjhub search code "import_refs"

# Search for a specific pattern
jjhub search code "fn handle_landing_request"

# Limit results
jjhub search code "BookmarkResolver" -L 10
FlagDescription
-L, --limit <n>Maximum number of results to return (default: 30)
Example output:
REPO              FILE                         MATCH
alice/jj-tools    src/import.rs:42             pub fn import_refs(repo: &Repository) {
bob/jj-hooks      lib/reconcile.rs:18          use jj_lib::import_refs;
acme/jj-server    internal/vcs/import.go:55    // import_refs synchronizes git refs

API Search Endpoints

All search endpoints are under /api/search/ and accept a q query parameter. Results are paginated using standard JJHub pagination (see Pagination).
Search endpoints have a stricter rate limit of 30 requests per minute, separate from the general API rate limit of 5,000 requests per hour.

Search Repositories

curl "https://api.jjhub.tech/api/search/repositories?q=jj+native" \
  -H "Authorization: token jjhub_your_token"
Query parameters:
ParameterTypeDescription
qstringSearch query (required)
pageintegerPage number (default: 1)
per_pageintegerResults per page (default: 30, max: 100)
Response (200 OK):
[
  {
    "id": 1,
    "owner": {
      "login": "alice",
      "id": 1
    },
    "name": "jj-tools",
    "full_name": "alice/jj-tools",
    "description": "CLI utilities for jj workflows",
    "private": false,
    "stars_count": 42,
    "topics": ["jj", "cli", "workflow"],
    "updated_at": "2026-03-01T12:00:00Z"
  }
]

Search Issues

curl "https://api.jjhub.tech/api/search/issues?q=authentication&state=open" \
  -H "Authorization: token jjhub_your_token"
Query parameters:
ParameterTypeDescription
qstringSearch query (required)
statestringFilter: open, closed, all (default: all)
pageintegerPage number (default: 1)
per_pageintegerResults per page (default: 30, max: 100)
Response (200 OK):
[
  {
    "id": 1,
    "number": 42,
    "title": "Auth fails on Sign in with Key",
    "state": "open",
    "body": "When attempting to authenticate via Sign in with Key...",
    "user": {
      "login": "alice",
      "id": 1
    },
    "repository": {
      "full_name": "alice/my-project"
    },
    "created_at": "2026-02-28T10:00:00Z",
    "updated_at": "2026-03-01T15:30:00Z"
  }
]

Search Code

curl "https://api.jjhub.tech/api/search/code?q=import_refs" \
  -H "Authorization: token jjhub_your_token"
Query parameters:
ParameterTypeDescription
qstringSearch query (required)
pageintegerPage number (default: 1)
per_pageintegerResults per page (default: 30, max: 100)
Response (200 OK):
[
  {
    "name": "import.rs",
    "path": "src/import.rs",
    "repository": {
      "full_name": "alice/jj-tools"
    },
    "content": "pub fn import_refs(repo: &Repository) {",
    "line_number": 42
  }
]

Search Users

User search is available via the API only (no CLI command).
curl "https://api.jjhub.tech/api/search/users?q=alice" \
  -H "Authorization: token jjhub_your_token"
Query parameters:
ParameterTypeDescription
qstringSearch query (required)
pageintegerPage number (default: 1)
per_pageintegerResults per page (default: 30, max: 100)
Response (200 OK):
[
  {
    "id": 1,
    "login": "alice",
    "full_name": "Alice Smith",
    "avatar_url": "https://api.jjhub.tech/avatars/alice",
    "created_at": "2026-01-15T10:00:00Z"
  }
]

Pagination

Search results follow JJHub’s standard pagination model. Use the page and per_page query parameters to navigate through results. The response includes:
  • Link header with rel="next" and rel="last" URLs for navigating pages
  • X-Total-Count header with the total number of matching results
# Page through results
curl "https://api.jjhub.tech/api/search/repositories?q=jj&page=2&per_page=10" \
  -H "Authorization: token jjhub_your_token"
In the CLI, use --limit to control the number of results returned in a single request:
jjhub search repos "jj" -L 50
See the Pagination guide for full details on how pagination works across the API.

JSON Output for Programmatic Use

All CLI search commands support --json output for scripting and automation:
# Get JSON output
jjhub search repos "workflow" --json

# Pipe to jq for filtering
jjhub search repos "workflow" --json | jq '.[].full_name'

# Use in shell scripts
for repo in $(jjhub search repos "jj" --json | jq -r '.[].full_name'); do
  echo "Found: $repo"
done
For AI and LLM pipelines, use --toon output (Token-Oriented Object Notation) which produces the same data in a format optimized for token efficiency:
jjhub search repos "workflow" --toon

Search Tips

Exact Phrases

Wrap your query in double quotes to search for an exact phrase:
jjhub search repos '"landing request"'
jjhub search code '"fn resolve_conflicts"'

Combining Terms

Multiple words are matched as an AND query by default — all terms must be present:
# Finds repos with both "jj" and "workflow" in their name/description
jjhub search repos "jj workflow"

Common Patterns

Find all repositories by a user:
jjhub search repos "owner:alice"
Find open issues about a specific topic:
jjhub search issues "bookmark conflict" -s open
Find code referencing a specific function:
jjhub search code "handle_landing_request"
Find code in a specific language:
jjhub search code "import_refs language:rust"

Rate Limiting

Search endpoints are rate-limited separately from the rest of the API:
TypeLimit
Search (authenticated)30 requests per minute
Search (unauthenticated)10 requests per minute
General API (authenticated)5,000 requests per hour
When you exceed the search rate limit, the API returns 429 Too Many Requests with standard rate limit headers:
X-RateLimit-Limit: 30
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1709726400
See the Rate Limiting guide for more details.

API Reference

MethodEndpointDescription
GET/api/search/repositories?q=...Search repositories by name, description, topics
GET/api/search/issues?q=...Search issues by title, body, comments
GET/api/search/code?q=...Search code by file contents
GET/api/search/users?q=...Search users by username, display name