Greptile Skill
Query and manage Greptile-indexed repositories via the REST API.
Setup
Required environment variables:
- -
GREPTILE_TOKEN — Greptile API token (from https://app.greptile.com) - INLINECODE1 — GitHub PAT with repo access (alternatively set
GREPTILE_GITHUB_TOKEN, or authenticate via gh auth login — the script falls back to gh auth token)
Commands
All commands use scripts/greptile.sh (resolve path relative to this skill directory).
Index a repository
CODEBLOCK0
Default branch: main. Use --no-reload to skip re-indexing if already processed.
Check index status
CODEBLOCK1
Returns: status (completed/processing/failed), filesProcessed, numFiles.
Query a codebase (AI answer + sources)
CODEBLOCK2
- -
--genius — slower but smarter analysis (good for PR reviews, architecture questions) - Returns: AI-generated answer + source file references with line numbers
Search a codebase (sources only, no AI answer)
CODEBLOCK3
Returns: ranked list of relevant files, functions, and snippets with line numbers.
Tips
- - Always
index a repo before querying/searching it. Check status to confirm indexing is complete. - Use
query --genius for complex questions (architecture, PR review context, cross-file analysis). - Use
search when you just need file locations without an AI explanation. - For GitLab repos, pass
--remote gitlab. - Pipe output through
jq for formatting: INLINECODE18 - Multi-repo queries: not supported by the wrapper; use the API directly with multiple repositories in the body.
Greptile 技能
通过 REST API 查询和管理 Greptile 索引的仓库。
设置
所需环境变量:
- - GREPTILETOKEN — Greptile API 令牌(来自 https://app.greptile.com)
- GITHUBTOKEN — 具有仓库访问权限的 GitHub PAT(也可设置 GREPTILEGITHUBTOKEN,或通过 gh auth login 进行身份验证——脚本会回退到 gh auth token)
命令
所有命令均使用 scripts/greptile.sh(路径相对于此技能目录解析)。
索引仓库
bash
scripts/greptile.sh index owner/repo [branch] [--remote github|gitlab] [--no-reload] [--no-notify]
默认分支:main。使用 --no-reload 可在已处理时跳过重新索引。
检查索引状态
bash
scripts/greptile.sh status owner/repo [branch] [--remote github|gitlab]
返回:status(已完成/处理中/失败)、filesProcessed、numFiles。
查询代码库(AI 回答 + 来源)
bash
scripts/greptile.sh query owner/repo [branch] 认证是如何工作的? [--genius] [--remote github|gitlab]
- - --genius — 较慢但更智能的分析(适用于 PR 审查、架构问题)
- 返回:AI 生成的回答 + 带行号的源文件引用
搜索代码库(仅来源,无 AI 回答)
bash
scripts/greptile.sh search owner/repo [branch] 支付处理 [--remote github|gitlab]
返回:带行号的相关文件、函数和代码片段排名列表。
提示
- - 在查询/搜索仓库前务必先执行 index。通过 status 确认索引已完成。
- 对复杂问题(架构、PR 审查上下文、跨文件分析)使用 query --genius。
- 当只需文件位置而不需要 AI 解释时使用 search。
- 对于 GitLab 仓库,传递 --remote gitlab。
- 通过 jq 管道输出以格式化:scripts/greptile.sh query ... | jq .
- 多仓库查询:包装器不支持;请直接在请求体中包含多个仓库以使用 API。