devvit-docs

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Devvit Docs

Devvit 文档

Look up Devvit documentation from
reddit/devvit-docs
.
Constraints:
  • Use only
    reddit/devvit-docs
    as the source of truth.
  • 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.
reddit/devvit-docs
查阅Devvit文档。
约束条件:
  • 仅将
    reddit/devvit-docs
    作为权威来源。
  • 不得使用其他仓库、分支、博客文章或网页搜索结果。
  • 如果未找到答案,请明确说明并引用最相关的文件。

How It Works

工作原理

  1. Run the
    ensure-docs.js
    script to clone or refresh the local docs cache.
  2. Read the JSON output to get the docs directory path.
  3. Search that directory to answer the user's question.
  4. Cite specific files/sections in your answer.
  1. 运行
    ensure-docs.js
    脚本以克隆或刷新本地文档缓存。
  2. 读取JSON输出以获取文档目录路径。
  3. 在该目录中搜索以回答用户的问题。
  4. 在回答中引用具体的文件/章节。

Usage

使用方法

bash
node ./scripts/ensure-docs.cjs [--force] [--ttl <hours>] [--project-dir <path>]
Script path is relative to this skill's directory.
  • --force
    — Pull regardless of cache age
  • --ttl <hours>
    — Cache TTL in hours (default: 24)
  • --project-dir <path>
    — User's project root for version detection (default: cwd)
Examples:
bash
node ./scripts/ensure-docs.cjs
node ./scripts/ensure-docs.cjs --force
bash
node ./scripts/ensure-docs.cjs [--force] [--ttl <hours>] [--project-dir <path>]
脚本路径相对于此skill的目录。
  • --force
    — 无论缓存时长如何,强制拉取最新文档
  • --ttl <hours>
    — 缓存有效期(小时),默认值:24
  • --project-dir <path>
    — 用户项目根目录,用于版本检测(默认值:当前工作目录)
示例:
bash
node ./scripts/ensure-docs.cjs
node ./scripts/ensure-docs.cjs --force

Output

输出

json
{
  "docsRoot": "node_modules/.cache/devvit-docs/versioned_docs/version-0.11",
  "repoDir": "node_modules/.cache/devvit-docs",
  "appDevvitVersion": "0.11"
}
  • docsRoot
    — The directory to search. Versioned if a matching version was found, otherwise
    docs/
    .
  • repoDir
    — Root of the cloned repo (use as fallback if versioned docs are incomplete).
  • appDevvitVersion
    — Devvit version from the user's
    package.json
    , or
    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
    — 从用户
    package.json
    中获取的Devvit版本,若未找到则为
    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

故障排除

  • git
    not found
    — Requires
    git
    on PATH.
  • Network errors — Script uses existing cache if pull fails.
  • Stale docs — Use
    --force
    to bypass the TTL cache.
  • 未找到
    git
    — 需要将
    git
    添加到系统PATH中。
  • 网络错误 — 如果拉取失败,脚本会使用现有缓存。
  • 文档过期 — 使用
    --force
    参数绕过TTL缓存。