Agent Skillsnetdata/netdata › learn-pr-preview

learn-pr-preview

GitHub

用于在本地隔离环境中构建、运行和预览 Netdata Learn 站点,以验证 PR 中的文档内容。通过创建独立目录和虚拟环境,确保不污染主仓库,支持检查链接、警告及生成页面效果。

.agents/skills/learn-pr-preview/SKILL.md netdata/netdata

Trigger Scenarios

用户明确要求在合并前预览或验证 PR 中的文档内容 用户请求在本地构建或检查 Learn 站点的特定 PR 变更

Install

npx skills add netdata/netdata --skill learn-pr-preview -g -y
More Options

Non-standard path

npx skills add https://github.com/netdata/netdata/tree/master/.agents/skills/learn-pr-preview -g -y

Use without installing

npx skills use netdata/netdata@learn-pr-preview

指定 Agent (Claude Code)

npx skills add netdata/netdata --skill learn-pr-preview -a claude-code -g -y

安装 repo 全部 skill

npx skills add netdata/netdata --all -g -y

预览 repo 内 skill

npx skills add netdata/netdata --list

SKILL.md

Frontmatter
{
    "name": "learn-pr-preview",
    "description": "Use only when the user explicitly asks to build, run, preview, inspect, or validate learn.netdata.cloud locally using the contents of a PR or documentation branch before merge. Do not trigger for ordinary docs edits unless the user asks for a local Learn preview."
}

learn-pr-preview

Build and inspect a local Learn site from a PR's documentation content without dirtying the real Learn checkout.

Always load learn-site-structure first. If the PR touches metadata.yaml or generated integration pages, also load integrations-lifecycle.

Rules

  • Trigger only on an explicit preview/build/inspect request.
  • Do not run ingest directly in a dirty Learn worktree.
  • Use an isolated preview directory under /tmp or the repo's gitignored .local/.
  • Record the Learn branch and commit used for the preview.
  • Copy PR source content into an isolated source directory. Prefer committed PR content; if validating uncommitted work, copy tracked modified files and only intentional untracked docs files after checking git status --short.
  • Save any preview server PID and kill only that PID when stopping it.
  • Treat site-wide warnings as evidence, but separate pre-existing global Learn warnings from PR-specific Network Flows or docs warnings.

Workflow

Set paths:

REPO_ROOT="$(git rev-parse --show-toplevel)"
PR_NUMBER="<pr-number>"
LEARN_REPO="${NETDATA_REPOS_DIR}/learn"
PREVIEW_ROOT="${TMPDIR:-/tmp}/netdata-learn-preview-pr-${PR_NUMBER}-$(date +%Y%m%d%H%M%S)"
SOURCE_COPY="${PREVIEW_ROOT}/netdata-source"
LEARN_COPY="${PREVIEW_ROOT}/learn"

Create isolated copies:

mkdir -p "${SOURCE_COPY}"
git -C "${REPO_ROOT}" ls-files -co --exclude-standard -z \
  | rsync -a --from0 --files-from=- --ignore-missing-args "${REPO_ROOT}/" "${SOURCE_COPY}/"

git clone --branch "$(git -C "${LEARN_REPO}" branch --show-current)" \
  --single-branch "${LEARN_REPO}" "${LEARN_COPY}"
git -C "${LEARN_COPY}" rev-parse HEAD

Install ingest dependencies in the isolated preview:

python3.13 -m venv "${PREVIEW_ROOT}/venv"
"${PREVIEW_ROOT}/venv/bin/python" -m pip install \
  --require-hashes \
  -r "${LEARN_COPY}/.learn_environment/ingest-requirements.txt"

If the real Learn checkout has compatible node_modules, symlink it to avoid a fresh install:

ln -s "${LEARN_REPO}/node_modules" "${LEARN_COPY}/node_modules"

Run ingest with the PR source:

cd "${LEARN_COPY}"
"${PREVIEW_ROOT}/venv/bin/python" ingest/ingest.py \
  --local-repo "netdata:${SOURCE_COPY}" \
  --ignore-on-prem-repo \
  --use_plain_https \
  --fail-links-netdata

Build with the Netlify-pinned runtime:

NODE_OPTIONS=--max_old_space_size=4096 \
  npx -y -p node@22.14.0 -p yarn@1.22.22 yarn build

Serve the static build for inspection:

python3 -m http.server 3030 --bind 127.0.0.1 --directory "${LEARN_COPY}/build"

Or run it in the background with a PID file:

python3 -m http.server 3030 --bind 127.0.0.1 --directory "${LEARN_COPY}/build" \
  >"${PREVIEW_ROOT}/http.log" 2>&1 &
echo "$!" > "${PREVIEW_ROOT}/http.pid"

Inspect representative pages in a browser. For docs PRs, check:

  • the changed hand-authored pages;
  • generated integration pages affected by metadata.yaml;
  • the category index page;
  • at least one page that previously failed ingest, MDX, or link checks.

Report:

  • Learn branch and commit used;
  • ingest command and exit status;
  • build command and exit status;
  • inspected URLs and HTTP/browser status;
  • PR-specific warnings or failures;
  • pre-existing global warnings separately.

Version History

  • a6cd391 Current 2026-08-29 07:26

    对齐文档检查与 Learn 运行时版本(PR #23593)

  • 8f91e63 2026-08-20 20:21

Same Skill Collection

.agents/skills/coverity-audit/SKILL.md
.agents/skills/graphql-audit/SKILL.md
.agents/skills/integrations-lifecycle/SKILL.md
.agents/skills/project-create-topology/SKILL.md
.agents/skills/project-health-alert-authoring/SKILL.md
.agents/skills/project-prometheus-profiles/SKILL.md
.agents/skills/project-query-corpus/SKILL.md
.agents/skills/project-snmp-profiles-authoring/SKILL.md
.agents/skills/project-snmp-trap-profiles-authoring/SKILL.md
.agents/skills/project-writing-go-modules-framework-v2/SKILL.md
.agents/skills/sonarqube-audit/SKILL.md
docs/netdata-ai/skills/query-netdata-agents/SKILL.md
docs/netdata-ai/skills/query-snmp-traps/SKILL.md
.agents/skills/codacy-audit/SKILL.md
.agents/skills/learn-site-structure/SKILL.md
.agents/skills/mirror-netdata-repos/SKILL.md
.agents/skills/pr-reviews/SKILL.md
.agents/skills/project-build-static-binary/SKILL.md
.agents/skills/project-writing-collectors/SKILL.md
.agents/skills/query-agent-events/SKILL.md
docs/netdata-ai/skills/query-netdata-cloud/SKILL.md

Metadata

Files
0
Version
a6cd391
Hash
bce5bbb1
Indexed
2026-08-20 20:21

trang chủ - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-01 18:12
浙ICP备14020137号-1 $bản đồ khách truy cập$