{
  "schemaVersion": "1.0",
  "item": {
    "slug": "tianyi-self-upgrade",
    "name": "Self-Upgrade (Tianyi)",
    "source": "tencent",
    "type": "skill",
    "category": "AI 智能",
    "sourceUrl": "https://clawhub.ai/fffdz/tianyi-self-upgrade",
    "canonicalUrl": "https://clawhub.ai/fffdz/tianyi-self-upgrade",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadMode": "redirect",
    "downloadUrl": "/downloads/tianyi-self-upgrade",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=tianyi-self-upgrade",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "installMethod": "Manual import",
    "extraction": "Extract archive",
    "prerequisites": [
      "OpenClaw"
    ],
    "packageFormat": "ZIP package",
    "includedAssets": [
      "SKILL.md"
    ],
    "primaryDoc": "SKILL.md",
    "quickSetup": [
      "Download the package from Yavira.",
      "Extract the archive and review SKILL.md first.",
      "Import or place the package into your OpenClaw setup."
    ],
    "agentAssist": {
      "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
      "steps": [
        "Download the package from Yavira.",
        "Extract it into a folder your agent can access.",
        "Paste one of the prompts below and point your agent at the extracted folder."
      ],
      "prompts": [
        {
          "label": "New install",
          "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
        },
        {
          "label": "Upgrade existing",
          "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
        }
      ]
    },
    "sourceHealth": {
      "source": "tencent",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-04-30T16:55:25.780Z",
      "expiresAt": "2026-05-07T16:55:25.780Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=network",
        "contentDisposition": "attachment; filename=\"network-1.0.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null
      },
      "scope": "source",
      "summary": "Source download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this source.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/tianyi-self-upgrade"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    },
    "downloadPageUrl": "https://openagent3.xyz/downloads/tianyi-self-upgrade",
    "agentPageUrl": "https://openagent3.xyz/skills/tianyi-self-upgrade/agent",
    "manifestUrl": "https://openagent3.xyz/skills/tianyi-self-upgrade/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/tianyi-self-upgrade/agent.md"
  },
  "agentAssist": {
    "summary": "Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.",
    "steps": [
      "Download the package from Yavira.",
      "Extract it into a folder your agent can access.",
      "Paste one of the prompts below and point your agent at the extracted folder."
    ],
    "prompts": [
      {
        "label": "New install",
        "body": "I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete."
      },
      {
        "label": "Upgrade existing",
        "body": "I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run."
      }
    ]
  },
  "documentation": {
    "source": "clawhub",
    "primaryDoc": "SKILL.md",
    "sections": [
      {
        "title": "Self-Upgrade 技能",
        "body": "OpenClaw 系统的自我维护和升级能力。"
      },
      {
        "title": "安全分级",
        "body": "风险等级操作类型执行策略低风险日志清理、状态检查、配置格式化自动执行中风险配置字段更新、技能包安装需用户确认高风险服务重启、文件删除、版本升级必须用户明确授权"
      },
      {
        "title": "升级策略",
        "body": "向后兼容优先: 保留旧配置字段（标记 deprecated）而非直接删除\n可回滚: 重大变更前自动备份\n渐进式: 分步执行，每步验证后再继续"
      },
      {
        "title": "1. 版本检查",
        "body": "# 检查当前版本\nopenclaw --version\n\n# 检查配置版本\n$config = Get-Content ~\\.openclaw\\openclaw.json | ConvertFrom-Json\n$config.meta.lastTouchedVersion"
      },
      {
        "title": "2. 配置迁移",
        "body": "检测并迁移废弃字段：\n\n# 示例：authToken → auth.token\nif ($config.gateway.authToken) {\n    $config.gateway.auth = @{ token = $config.gateway.authToken }\n    $config.gateway.PSObject.Properties.Remove('authToken')\n}"
      },
      {
        "title": "3. 依赖检查",
        "body": "# 检查必要技能\n$requiredSkills = @('healthcheck', 'skill-creator', 'auto-diagnostic')\nforeach ($skill in $requiredSkills) {\n    if (-not (Test-Path \"skills\\$skill\\SKILL.md\")) {\n        Write-Host \"[MISSING] Skill: $skill\"\n    }\n}\n\n# 检查 npm 包版本\nnpm list -g openclaw"
      },
      {
        "title": "4. 自动修复",
        "body": "运行内置诊断：\n\nopenclaw doctor --fix"
      },
      {
        "title": "5. 备份与回滚",
        "body": "# 备份配置\n$backupPath = \"~\\.openclaw\\backups\\openclaw-$(Get-Date -Format 'yyyyMMdd-HHmmss').json\"\nCopy-Item ~\\.openclaw\\openclaw.json $backupPath\n\n# 回滚命令\nCopy-Item $backupPath ~\\.openclaw\\openclaw.json"
      },
      {
        "title": "scripts/self-upgrade.ps1",
        "body": "param(\n    [switch]$Auto,      # 自动模式（低风险操作）\n    [switch]$DryRun,    # 仅预览，不执行\n    [string]$BackupDir = \"~\\.openclaw\\backups\"\n)\n\n$ErrorActionPreference = \"Stop\"\n$ConfigPath = \"~\\.openclaw\\openclaw.json\"\n\n# 1. 创建备份\nif (-not $DryRun) {\n    if (-not (Test-Path $BackupDir)) {\n        New-Item -ItemType Directory -Path $BackupDir | Out-Null\n    }\n    $backupPath = Join-Path $BackupDir \"openclaw-$(Get-Date -Format 'yyyyMMdd-HHmmss').json\"\n    Copy-Item $ConfigPath $backupPath\n    Write-Host \"[OK] Backup created: $backupPath\" -ForegroundColor Green\n}\n\n# 2. 检查配置\ntry {\n    $config = Get-Content $ConfigPath -Raw | ConvertFrom-Json\n    Write-Host \"[OK] Config is valid JSON\" -ForegroundColor Green\n} catch {\n    Write-Host \"[ERROR] Config is invalid: $($_.Exception.Message)\" -ForegroundColor Red\n    exit 1\n}\n\n# 3. 迁移废弃字段\n$migrated = $false\n\nif ($config.gateway.authToken) {\n    Write-Host \"[MIGRATE] gateway.authToken → gateway.auth.token\" -ForegroundColor Yellow\n    if (-not $DryRun) {\n        $config.gateway.auth = @{ token = $config.gateway.authToken }\n        $config.gateway.PSObject.Properties.Remove('authToken')\n        $migrated = $true\n    }\n}\n\n# 4. 保存变更\nif ($migrated -and -not $DryRun) {\n    $config | ConvertTo-Json -Depth 10 | Set-Content $ConfigPath\n    Write-Host \"[OK] Config updated\" -ForegroundColor Green\n    \n    # 验证\n    openclaw doctor --fix\n}\n\n# 5. 检查技能\n$skillsPath = \"D:\\workspace\\openclaw_ceo\\skills\"\nif (Test-Path $skillsPath) {\n    $skills = Get-ChildItem $skillsPath -Directory | Select-Object -ExpandProperty Name\n    Write-Host \"[OK] Found $($skills.Count) skills: $($skills -join ', ')\" -ForegroundColor Green\n}"
      },
      {
        "title": "references/upgrade-history.md",
        "body": "记录每次升级的详细信息，用于追溯和回滚。"
      },
      {
        "title": "references/config-schema.md",
        "body": "配置文件的 schema 定义，用于验证迁移正确性。"
      },
      {
        "title": "触发条件",
        "body": "以下情况应触发本技能：\n\n用户执行 openclaw doctor --fix\n检测到配置字段已废弃（如 authToken）\n版本升级后首次启动\n技能加载失败（缺失或格式错误）\n定期维护（如每周一次健康检查）"
      },
      {
        "title": "输出格式",
        "body": "升级报告应包含：\n\n升级摘要: 执行了哪些变更\n备份位置: 回滚所需信息\n验证结果: 升级后状态检查\n后续建议: 需要用户注意的事项\n\n示例：\n\n【升级报告】\n时间：2026-02-26 21:30:00\n模式：自动（低风险）\n\n【执行变更】\n✅ 迁移 gateway.authToken → gateway.auth.token\n✅ 格式化配置文件\n✅ 清理过期日志（>7 天）\n\n【备份位置】\n~\\.openclaw\\backups\\openclaw-20260226-213000.json\n\n【验证结果】\n✅ 配置验证通过\n✅ 网关运行正常\n✅ 技能加载正常\n\n【后续建议】\n无需用户操作"
      },
      {
        "title": "禁止自动执行的操作",
        "body": "❌ 删除用户数据文件\n❌ 修改 API 密钥/令牌（除非明确授权迁移）\n❌ 卸载已安装的技能\n❌ 更改网络配置（端口、绑定地址）"
      },
      {
        "title": "必须备份的操作",
        "body": "✅ 配置文件修改\n✅ 技能包安装/更新\n✅ 依赖包升级"
      },
      {
        "title": "回滚机制",
        "body": "所有自动变更必须支持回滚：\n\n# 回滚到指定备份\n.\\self-upgrade.ps1 -RollbackTo \"20260226-213000\""
      }
    ],
    "body": "Self-Upgrade 技能\n\nOpenClaw 系统的自我维护和升级能力。\n\n核心原则\n安全分级\n风险等级\t操作类型\t执行策略\n低风险\t日志清理、状态检查、配置格式化\t自动执行\n中风险\t配置字段更新、技能包安装\t需用户确认\n高风险\t服务重启、文件删除、版本升级\t必须用户明确授权\n升级策略\n向后兼容优先: 保留旧配置字段（标记 deprecated）而非直接删除\n可回滚: 重大变更前自动备份\n渐进式: 分步执行，每步验证后再继续\n核心流程\n1. 版本检查\n# 检查当前版本\nopenclaw --version\n\n# 检查配置版本\n$config = Get-Content ~\\.openclaw\\openclaw.json | ConvertFrom-Json\n$config.meta.lastTouchedVersion\n\n2. 配置迁移\n\n检测并迁移废弃字段：\n\n# 示例：authToken → auth.token\nif ($config.gateway.authToken) {\n    $config.gateway.auth = @{ token = $config.gateway.authToken }\n    $config.gateway.PSObject.Properties.Remove('authToken')\n}\n\n3. 依赖检查\n# 检查必要技能\n$requiredSkills = @('healthcheck', 'skill-creator', 'auto-diagnostic')\nforeach ($skill in $requiredSkills) {\n    if (-not (Test-Path \"skills\\$skill\\SKILL.md\")) {\n        Write-Host \"[MISSING] Skill: $skill\"\n    }\n}\n\n# 检查 npm 包版本\nnpm list -g openclaw\n\n4. 自动修复\n\n运行内置诊断：\n\nopenclaw doctor --fix\n\n5. 备份与回滚\n# 备份配置\n$backupPath = \"~\\.openclaw\\backups\\openclaw-$(Get-Date -Format 'yyyyMMdd-HHmmss').json\"\nCopy-Item ~\\.openclaw\\openclaw.json $backupPath\n\n# 回滚命令\nCopy-Item $backupPath ~\\.openclaw\\openclaw.json\n\n脚本工具\nscripts/self-upgrade.ps1\nparam(\n    [switch]$Auto,      # 自动模式（低风险操作）\n    [switch]$DryRun,    # 仅预览，不执行\n    [string]$BackupDir = \"~\\.openclaw\\backups\"\n)\n\n$ErrorActionPreference = \"Stop\"\n$ConfigPath = \"~\\.openclaw\\openclaw.json\"\n\n# 1. 创建备份\nif (-not $DryRun) {\n    if (-not (Test-Path $BackupDir)) {\n        New-Item -ItemType Directory -Path $BackupDir | Out-Null\n    }\n    $backupPath = Join-Path $BackupDir \"openclaw-$(Get-Date -Format 'yyyyMMdd-HHmmss').json\"\n    Copy-Item $ConfigPath $backupPath\n    Write-Host \"[OK] Backup created: $backupPath\" -ForegroundColor Green\n}\n\n# 2. 检查配置\ntry {\n    $config = Get-Content $ConfigPath -Raw | ConvertFrom-Json\n    Write-Host \"[OK] Config is valid JSON\" -ForegroundColor Green\n} catch {\n    Write-Host \"[ERROR] Config is invalid: $($_.Exception.Message)\" -ForegroundColor Red\n    exit 1\n}\n\n# 3. 迁移废弃字段\n$migrated = $false\n\nif ($config.gateway.authToken) {\n    Write-Host \"[MIGRATE] gateway.authToken → gateway.auth.token\" -ForegroundColor Yellow\n    if (-not $DryRun) {\n        $config.gateway.auth = @{ token = $config.gateway.authToken }\n        $config.gateway.PSObject.Properties.Remove('authToken')\n        $migrated = $true\n    }\n}\n\n# 4. 保存变更\nif ($migrated -and -not $DryRun) {\n    $config | ConvertTo-Json -Depth 10 | Set-Content $ConfigPath\n    Write-Host \"[OK] Config updated\" -ForegroundColor Green\n    \n    # 验证\n    openclaw doctor --fix\n}\n\n# 5. 检查技能\n$skillsPath = \"D:\\workspace\\openclaw_ceo\\skills\"\nif (Test-Path $skillsPath) {\n    $skills = Get-ChildItem $skillsPath -Directory | Select-Object -ExpandProperty Name\n    Write-Host \"[OK] Found $($skills.Count) skills: $($skills -join ', ')\" -ForegroundColor Green\n}\n\n参考文档\nreferences/upgrade-history.md\n\n记录每次升级的详细信息，用于追溯和回滚。\n\nreferences/config-schema.md\n\n配置文件的 schema 定义，用于验证迁移正确性。\n\n触发条件\n\n以下情况应触发本技能：\n\n用户执行 openclaw doctor --fix\n检测到配置字段已废弃（如 authToken）\n版本升级后首次启动\n技能加载失败（缺失或格式错误）\n定期维护（如每周一次健康检查）\n输出格式\n\n升级报告应包含：\n\n升级摘要: 执行了哪些变更\n备份位置: 回滚所需信息\n验证结果: 升级后状态检查\n后续建议: 需要用户注意的事项\n\n示例：\n\n【升级报告】\n时间：2026-02-26 21:30:00\n模式：自动（低风险）\n\n【执行变更】\n✅ 迁移 gateway.authToken → gateway.auth.token\n✅ 格式化配置文件\n✅ 清理过期日志（>7 天）\n\n【备份位置】\n~\\.openclaw\\backups\\openclaw-20260226-213000.json\n\n【验证结果】\n✅ 配置验证通过\n✅ 网关运行正常\n✅ 技能加载正常\n\n【后续建议】\n无需用户操作\n\n安全约束\n禁止自动执行的操作\n❌ 删除用户数据文件\n❌ 修改 API 密钥/令牌（除非明确授权迁移）\n❌ 卸载已安装的技能\n❌ 更改网络配置（端口、绑定地址）\n必须备份的操作\n✅ 配置文件修改\n✅ 技能包安装/更新\n✅ 依赖包升级\n回滚机制\n\n所有自动变更必须支持回滚：\n\n# 回滚到指定备份\n.\\self-upgrade.ps1 -RollbackTo \"20260226-213000\""
  },
  "trust": {
    "sourceLabel": "tencent",
    "provenanceUrl": "https://clawhub.ai/fffdz/tianyi-self-upgrade",
    "publisherUrl": "https://clawhub.ai/fffdz/tianyi-self-upgrade",
    "owner": "fffdz",
    "version": "1.0.0",
    "license": null,
    "verificationStatus": "Indexed source record"
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/tianyi-self-upgrade",
    "downloadUrl": "https://openagent3.xyz/downloads/tianyi-self-upgrade",
    "agentUrl": "https://openagent3.xyz/skills/tianyi-self-upgrade/agent",
    "manifestUrl": "https://openagent3.xyz/skills/tianyi-self-upgrade/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/tianyi-self-upgrade/agent.md"
  }
}