devvit-docs
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDevvit Docs
Devvit 文档
Look up Devvit documentation from .
reddit/devvit-docsConstraints:
- Use only as the source of truth.
reddit/devvit-docs - Do not use other repos, forks, blog posts, or web search results.
- If the answer isn't found, say so and cite the closest relevant file.
从查阅Devvit文档。
reddit/devvit-docs约束条件:
- 仅将作为权威来源。
reddit/devvit-docs - 不得使用其他仓库、分支、博客文章或网页搜索结果。
- 如果未找到答案,请明确说明并引用最相关的文件。
How It Works
工作原理
- Run the script to clone or refresh the local docs cache.
ensure-docs.js - Read the JSON output to get the docs directory path.
- Search that directory to answer the user's question.
- Cite specific files/sections in your answer.
- 运行脚本以克隆或刷新本地文档缓存。
ensure-docs.js - 读取JSON输出以获取文档目录路径。
- 在该目录中搜索以回答用户的问题。
- 在回答中引用具体的文件/章节。
Usage
使用方法
bash
node ./scripts/ensure-docs.cjs [--force] [--ttl <hours>] [--project-dir <path>]Script path is relative to this skill's directory.
- — Pull regardless of cache age
--force - — Cache TTL in hours (default: 24)
--ttl <hours> - — User's project root for version detection (default: cwd)
--project-dir <path>
Examples:
bash
node ./scripts/ensure-docs.cjs
node ./scripts/ensure-docs.cjs --forcebash
node ./scripts/ensure-docs.cjs [--force] [--ttl <hours>] [--project-dir <path>]脚本路径相对于此skill的目录。
- — 无论缓存时长如何,强制拉取最新文档
--force - — 缓存有效期(小时),默认值:24
--ttl <hours> - — 用户项目根目录,用于版本检测(默认值:当前工作目录)
--project-dir <path>
示例:
bash
node ./scripts/ensure-docs.cjs
node ./scripts/ensure-docs.cjs --forceOutput
输出
json
{
"docsRoot": "node_modules/.cache/devvit-docs/versioned_docs/version-0.11",
"repoDir": "node_modules/.cache/devvit-docs",
"appDevvitVersion": "0.11"
}- — The directory to search. Versioned if a matching version was found, otherwise
docsRoot.docs/ - — Root of the cloned repo (use as fallback if versioned docs are incomplete).
repoDir - — Devvit version from the user's
appDevvitVersion, orpackage.json.null
json
{
"docsRoot": "node_modules/.cache/devvit-docs/versioned_docs/version-0.11",
"repoDir": "node_modules/.cache/devvit-docs",
"appDevvitVersion": "0.11"
}- — 待搜索的目录。如果找到匹配版本则为带版本的目录,否则为
docsRoot。docs/ - — 克隆仓库的根目录(如果带版本的文档不完整,可作为备选)。
repoDir - — 从用户
appDevvitVersion中获取的Devvit版本,若未找到则为package.json。null
Present Results to User
向用户展示结果
- Quote the specific doc file and section supporting each claim.
- Provide a minimal code example if the docs include one.
- If the docs don't cover it, say so and suggest the closest material found.
- 引用支持每个结论的具体文档文件和章节。
- 如果文档中包含代码示例,请提供最简示例。
- 如果文档未覆盖相关内容,请明确说明并建议查阅找到的最相近资料。
Troubleshooting
故障排除
- not found — Requires
giton PATH.git - Network errors — Script uses existing cache if pull fails.
- Stale docs — Use to bypass the TTL cache.
--force
- 未找到— 需要将
git添加到系统PATH中。git - 网络错误 — 如果拉取失败,脚本会使用现有缓存。
- 文档过期 — 使用参数绕过TTL缓存。
--force