gread

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Gread

Gread

Provide the ability to search, inspect, and read source code from all public GitHub repositories and their associated documentation.
提供搜索、查看和读取所有公开GitHub仓库及其相关文档中源代码的能力。

Endpoints

端点

All endpoints are GET endpoints exposed at
https://api.gread.dev
. Only use parameters through the query string (
?key=value
). The system returns well-formatted markdown blocks.
  • If the exact repository full name is known (e.g.,
    owner/repo
    ), view repository (
    /repo
    ) directly.
  • Otherwise, search repositories (
    /search
    ) first to find the correct repository.
  • To retrieve documents, also view the main repository through
    /repo
    ; its corresponding document repo will also be returned (if exists).
所有端点均为暴露在
https://api.gread.dev
的 GET 端点。仅通过查询字符串(
?key=value
)使用参数。系统返回格式规范的markdown块。
  • 如果已知仓库的完整名称(例如:
    owner/repo
    ),可直接通过
    /repo
    查看仓库。
  • 否则,先通过
    /search
    搜索仓库以找到正确的目标仓库。
  • 如需获取文档,同样通过
    /repo
    查看主仓库;若存在对应的文档仓库,也会一并返回。

1. Search Repositories

1. 搜索仓库

Search for GitHub repositories by name, description, or topic keywords using the GitHub Search API. Format:
GET https://api.gread.dev/search?q={keyword}
Example:
GET https://api.gread.dev/search?q=hono
ParameterTypeRequiredDescription
q
stringYesKeyword to search in repository names, descriptions, or topics
使用GitHub Search API,通过名称、描述或主题关键词搜索GitHub仓库。 格式
GET https://api.gread.dev/search?q={keyword}
示例
GET https://api.gread.dev/search?q=hono
参数类型是否必填描述
q
string用于搜索仓库名称、描述或主题的关键词

2. View Repository

2. 查看仓库

View repository basic information and its directory structure. Includes corresponding documentation repo if available. Format:
GET https://api.gread.dev/repo?name={user/repo}
Example:
GET https://api.gread.dev/repo?name=honojs/hono
ParameterTypeRequiredDescription
name
stringYesFull name of the repository (owner/repo)
查看仓库基本信息及其目录结构。若存在对应的文档仓库,也会包含在内。 格式
GET https://api.gread.dev/repo?name={user/repo}
示例
GET https://api.gread.dev/repo?name=honojs/hono
参数类型是否必填描述
name
string仓库的完整名称(owner/repo)

3. List Directory Tree

3. 列出目录树

Detailed view of a repository's directory tree with recursion limits. Format:
GET https://api.gread.dev/tree?name={user/repo}&dir={targetDir}&depth={num}&limit={num}
Example:
GET https://api.gread.dev/tree?name=honojs/hono&dir=src&depth=3&limit=50
ParameterTypeRequiredDescription
name
stringYesFull name of the repository (owner/repo)
dir
stringNoTarget directory path to inspect (defaults to root if empty)
depth
numberNoMaximum depth into the directory structure to list (default:3)
limit
numberNoMaximum number of items to display per directory level (default: 40)
查看仓库目录树的详细视图,包含递归限制。 格式
GET https://api.gread.dev/tree?name={user/repo}&dir={targetDir}&depth={num}&limit={num}
示例
GET https://api.gread.dev/tree?name=honojs/hono&dir=src&depth=3&limit=50
参数类型是否必填描述
name
string仓库的完整名称(owner/repo)
dir
string要查看的目标目录路径(为空时默认根目录)
depth
number目录结构的最大递归深度(默认值:3)
limit
number每个目录级别显示的最大条目数(默认值:40)

4. Read Code

4. 读取代码

Retrieve the raw source code of specified files from within a known repository. Provide paths separated by commas. Format:
GET https://api.gread.dev/read?name={user/repo}&paths={path1,path2}
Example:
GET https://api.gread.dev/read?name=honojs/hono&paths=src/index.ts,package.json
ParameterTypeRequiredDescription
name
stringYesFull name of the repository (owner/repo)
paths
stringYesComma-separated list of precise file paths within the repository
从已知仓库中检索指定文件的原始源代码。提供用逗号分隔的路径。 格式
GET https://api.gread.dev/read?name={user/repo}&paths={path1,path2}
示例
GET https://api.gread.dev/read?name=honojs/hono&paths=src/index.ts,package.json
参数类型是否必填描述
name
string仓库的完整名称(owner/repo)
paths
string仓库内精确文件路径的逗号分隔列表

5. Search within Repo

5. 仓库内搜索

Perform a fast
git grep
inside the repository. Format:
GET https://api.gread.dev/grep?name={user/repo}&q={search_pattern}&i=true&F=true&E=true&C=2&path={targetDir}
Example:
GET https://api.gread.dev/grep?name=honojs/hono&q=listen&C=2&path=src
ParameterTypeRequiredDescription
name
stringYesFull name of the repository (owner/repo)
q
stringYesSearch pattern or query to pass to git grep
i
booleanNoIgnore case distinctions (
-i
)
F
booleanNoInterpret pattern as fixed string (
-F
)
E
booleanNoInterpret pattern as extended regular expression (
-E
)
C
numberNoPrint num lines of output context (
-C
)
path
stringNoDirectory or file path to limit the search scope
在仓库内执行快速的
git grep
操作。 格式
GET https://api.gread.dev/grep?name={user/repo}&q={search_pattern}&i=true&F=true&E=true&C=2&path={targetDir}
示例
GET https://api.gread.dev/grep?name=honojs/hono&q=listen&C=2&path=src
参数类型是否必填描述
name
string仓库的完整名称(owner/repo)
q
string传递给git grep的搜索模式或查询内容
i
boolean忽略大小写差异(
-i
F
boolean将模式解释为固定字符串(
-F
E
boolean将模式解释为扩展正则表达式(
-E
C
number输出上下文的行数(
-C
path
string限制搜索范围的目录或文件路径