GFramework/.agents/skills/_shared/scripts/update-vitepress-nav.sh
gewuyou 1239fb4651 refactor(skills): 统一文档刷新技能入口
- 新增 gframework-doc-refresh 统一技能入口,并补齐模块扫描、证据顺序、模板与校验脚本

- 更新共享文档规范与模块映射,收口源码模块到 README、docs 和 ai-libs 的固定关联

- 删除旧 vitepress-* 公开技能定义,避免继续以文档类型拆分入口

- 同步 documentation-governance-and-refresh 的恢复点、风险和下一步
2026-04-22 09:13:22 +08:00

58 lines
1.5 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 更新 VitePress 侧边栏配置
# 用法: update-vitepress-nav.sh <文档路径> <文档标题>
set -e
DOC_PATH="$1"
DOC_TITLE="$2"
CONFIG_FILE="docs/.vitepress/config.mts"
if [ -z "$DOC_PATH" ] || [ -z "$DOC_TITLE" ]; then
echo "用法: $0 <文档路径> <文档标题>"
echo "示例: $0 /zh-CN/api-reference/core/architecture Architecture"
exit 1
fi
if [ ! -f "$CONFIG_FILE" ]; then
echo "错误: 找不到 VitePress 配置文件: $CONFIG_FILE"
exit 1
fi
# 提取模块名称core/game/godot/source-generators
MODULE=$(echo "$DOC_PATH" | grep -oP '(?<=/zh-CN/)[^/]+' | head -1)
if [ -z "$MODULE" ]; then
echo "错误: 无法从路径中提取模块名称: $DOC_PATH"
exit 1
fi
echo "=========================================="
echo "VitePress 导航配置更新"
echo "=========================================="
echo "模块: $MODULE"
echo "路径: $DOC_PATH"
echo "标题: $DOC_TITLE"
echo ""
# 检查配置文件中是否已存在该路径
if grep -q "link: '$DOC_PATH'" "$CONFIG_FILE"; then
echo "✓ 该文档已存在于导航配置中"
exit 0
fi
echo "提示: 需要在 VitePress 配置中添加新条目"
echo ""
echo "建议的配置条目:"
echo "{ text: '$DOC_TITLE', link: '$DOC_PATH' }"
echo ""
echo "请使用以下方式之一更新配置:"
echo "1. 让 AI 使用 Edit 工具直接修改 $CONFIG_FILE"
echo "2. 手动编辑配置文件并添加上述条目到对应的 sidebar 部分"
echo ""
# 输出相关的 sidebar 配置路径
echo "相关的 sidebar 配置路径: '/zh-CN/$MODULE/'"
exit 0