Agent Skill

preview-sync

自动将文件同步到 GitHub 仓库,以便在 GitHub Pages 上进行预览。当代理生成需要通过网页界面预览的文件(markdown、HTML、图片)时使用。在请求如"同步此文件以预览"、"更新预览"、"上传到预览站点",或代理完成撰写应通过网页访问的文档/报告/文章时触发。

编程·jaguarliu·来自 skill_cn·github.com ↗
3 Stars·19 下载量·1k 综合热度·1,476 字文档·源站更新 2026-02-21

README 文档

1,476 字

Preview Sync Skill

Sync local files to GitHub repository for automatic preview deployment on GitHub Pages.

Quick Start

preview-sync /path/to/file.md [agent-name]

Example:

preview-sync /tmp/report.md kira

This will:

  1. Copy file to project directory
  2. Commit and push to GitHub
  3. Trigger GitHub Actions deployment
  4. File appears at preview site in 1-2 minutes

Configuration

Skill reads configuration from ~/.openclaw/openclaw.json:

{
  "skills": {
    "entries": {
      "preview-sync": {
        "enabled": true,
        "previewRepo": "username/repo-name",
        "agentName": "default-agent-name"
      }
    }
  }
}

Fields:

  • previewRepo: GitHub repository (format: username/repo)
  • agentName: Default agent name (can be overridden via command line)

Project Structure

Files are organized by agent:

project-root/public/agents/
├── kira/     # Kira's files
├── ha/       # Ha's files
└── hen/      # Hen's files

Adding a new agent:

mkdir project-root/public/agents/new-agent
preview-sync /path/to/file.md new-agent

No code changes needed.

Supported File Types

  • Markdown (.md): Rendered with GFM syntax, code highlighting
  • HTML (.html): Rendered in iframe sandbox
  • Images (.png, .jpg, .gif, .svg, .webp): Direct display
  • Code files (.js, .py, .java): Plain text display

Workflow

  1. Agent generates a file (document, report, article)
  2. Call preview-sync with file path and agent name
  3. Script copies file to project directory
  4. Git commit and push to GitHub
  5. GitHub Actions builds and deploys
  6. File accessible on preview site in 1-2 minutes

Script Location

The main script is at scripts/preview-sync.sh.

For installation, see install.sh.

For script details, see scripts/preview-sync.sh.

同分类其他技能

查看全部 ›