Agent skill that turns natural language, code, Terraform/K8s, SQL, OpenAPI, AsyncAPI, Protobuf and GraphQL sources into editable, tested draw.io architecture diagrams: incremental sync, multi-view projection, drift diff, CI architecture tests, whiteboard derasterize, interactive HTML/PPTX/Mermaid exports.
Python agent-skillsarchitecturearchitecture-diagramasyncapibpmnc4-modelclaude-codediagramdiagrams-as-codedrawioflowchartgithub-actionsgraphqlimage-to-diagramkubernetesmcp-serverprotobufsysmlterraformuml
feat: replace manual update check with auto-check (12h throttled)
Agents365-aie2c8e7313611
diff --git a/.github/workflows/publish-clawhub.yml b/.github/workflows/publish-clawhub.ymldeleted file mode 100644index e52f123..0000000--- a/.github/workflows/publish-clawhub.yml+++ /dev/null@@ -1,44 +0,0 @@-name: Publish to ClawHub--on:- workflow_dispatch:- push:- branches: [main]- paths:- - 'SKILL.md'- - 'scripts/**'--concurrency:- group: clawhub-publish- cancel-in-progress: true--permissions:- contents: read--jobs:- publish:- runs-on: ubuntu-latest- steps:- - uses: actions/checkout@v4-- - uses: actions/setup-node@v4- with:- node-version: '20'-- - name: Install ClawHub CLI- run: npm install -g clawhub@latest-- - name: Authenticate with ClawHub- run: |- mkdir -p "$HOME/.config/clawhub"- echo '{"registry":"https://clawhub.ai","token":"'"${{ secrets.CLAWHUB_TOKEN }}"'"}' > "$HOME/.config/clawhub/config.json"- chmod 600 "$HOME/.config/clawhub/config.json"-- - name: Get version from metadata- id: version- run: |- VERSION=$(grep -o '"version":"[^"]*"' SKILL.md | head -1 | cut -d'"' -f4)- echo "version=${VERSION:-1.0.0}" >> "$GITHUB_OUTPUT"-- - name: Publish skill- run: clawhub publish . --version "${{ steps.version.outputs.version }}" --slug drawio-pro-skilldiff --git a/README.md b/README.mdindex d2da0b3..d5026de 100644--- a/README.md+++ b/README.md@@ -212,23 +212,15 @@ clawhub install drawio-pro-skill## Updates-Check for updates:--```bash-# Run from anywhere — pass your install path-bash ~/.claude/skills/drawio-skill/scripts/check-update.sh--# Or from the skill directory-cd ~/.claude/skills/drawio-skill && bash scripts/check-update.sh-```--Update to latest version:+The skill auto-checks for updates once per 12 hours on first use in a conversation. When a new version is available, the agent prints a one-line notice in the reply. To apply:```bashcd <your-install-path>/drawio-skill && git pull```-Platform-specific package managers:+The check is read-only, self-throttled, and silent when up to date, offline, or not a git install — it won't block or slow the workflow.++Package-manager installs handle updates themselves:```bash# OpenClaw@@ -286,7 +278,7 @@ CI/CD pipeline with a closed loop and 2 spur branches. Edges flow along the peri- `SKILL.md` — **the only required file**. Loaded by all platforms as the skill instructions.- `agents/openai.yaml` — OpenAI Codex-specific configuration (UI, policy)-- `scripts/check-update.sh` — lightweight update checker (compares local vs remote HEAD)+- `check-update.sh` — auto-runs on first skill use per conversation; self-throttled to once per 12h, silent when up to date- `README.md` — this file (English, displayed on GitHub homepage)- `README_CN.md` — Chinese documentation- `assets/` — example diagrams and workflow imagesdiff --git a/README_CN.md b/README_CN.mdindex 8ebfbc8..3c726b7 100644--- a/README_CN.md+++ b/README_CN.md@@ -212,23 +212,15 @@ clawhub install drawio-pro-skill## 更新-检查是否有新版本:--```bash-# 从任意位置运行 — 传入安装路径-bash ~/.claude/skills/drawio-skill/scripts/check-update.sh--# 或在 skill 目录下运行-cd ~/.claude/skills/drawio-skill && bash scripts/check-update.sh-```--更新到最新版本:+Skill 会在每次对话首次使用时自动检查更新(12 小时节流)。有新版本时,Agent 会在回复中打印一行提示。应用更新:```bashcd <你的安装路径>/drawio-skill && git pull```-平台包管理器:+检查为只读、自节流,在已是最新版、离线、或非 git 安装时静默退出,不会阻塞或拖慢工作流。++通过包管理器安装的用户直接用对应命令更新:```bash# OpenClaw@@ -287,7 +279,7 @@ CI/CD 流水线,包含闭合回路和 2 个分支。线条沿矩形外围流- `SKILL.md` — **唯一必需的文件**,所有平台加载的 skill 指令- `agents/openai.yaml` — OpenAI Codex 专用配置(界面、策略)-- `scripts/check-update.sh` — 轻量级更新检查器(比较本地与远程 HEAD)+- `check-update.sh` — Skill 首次使用时自动运行;12 小时节流、已是最新版时静默- `README.md` — 英文说明(GitHub 首页显示)- `README_CN.md` — 本文件(中文)- `assets/` — 示例图表和工作流图片diff --git a/SKILL.md b/SKILL.mdindex 3989acd..cb753a5 100644--- a/SKILL.md+++ b/SKILL.md@@ -62,6 +62,7 @@ Before starting the workflow, assess whether the user's request is specific enouSkip clarification if the request already specifies these details or is clearly simple (e.g., "draw a flowchart of X").+0. **Check for updates (first use per conversation)** — run `bash <this-skill-dir>/check-update.sh` once before the first diagram. The script self-throttles to once per 12 hours and is silent when up to date, offline, or not a git install. If it prints an update notice, include that notice verbatim in your reply to the user, then continue normally — do not block or delay on it.1. **Check deps** — verify `draw.io --version` succeeds; note platform for correct CLI path2. **Plan** — identify shapes, relationships, layout (LR or TB), group by tier/layer3. **Generate** — write `.drawio` XML file to disk (output dir same as user's working dir)diff --git a/check-update.sh b/check-update.shnew file mode 100755index 0000000..5be396b--- /dev/null+++ b/check-update.sh@@ -0,0 +1,37 @@+#!/usr/bin/env bash+# drawio-skill auto update check — self-throttled to once per 12 hours.+# Silent when up to date, offline, or not a git checkout.+# Prints a one-line notice only when upstream has new commits.++set -u++SKILL_DIR="$(cd "$(dirname "$0")" && pwd)"+CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/drawio-skill"+STAMP="$CACHE_DIR/last-check"+THROTTLE_MIN=720 # 12 hours++# Skip if we checked within the throttle window.+if [ -f "$STAMP" ] && [ -z "$(find "$STAMP" -mmin +"$THROTTLE_MIN" 2>/dev/null)" ]; then+ exit 0+fi++mkdir -p "$CACHE_DIR" 2>/dev/null || exit 0+# Refresh timestamp up front so offline / non-git installs don't retry every call.+touch "$STAMP" 2>/dev/null || exit 0++git -C "$SKILL_DIR" rev-parse --git-dir >/dev/null 2>&1 || exit 0++BRANCH="$(git -C "$SKILL_DIR" symbolic-ref --short HEAD 2>/dev/null)" || exit 0+UPSTREAM="$(git -C "$SKILL_DIR" rev-parse --abbrev-ref "${BRANCH}@{upstream}" 2>/dev/null)" || exit 0+REMOTE="${UPSTREAM%%/*}"++git -C "$SKILL_DIR" fetch "$REMOTE" --quiet 2>/dev/null || exit 0++LOCAL="$(git -C "$SKILL_DIR" rev-parse HEAD 2>/dev/null)"+REMOTE_HASH="$(git -C "$SKILL_DIR" rev-parse "$UPSTREAM" 2>/dev/null)"+[ -n "$LOCAL" ] && [ -n "$REMOTE_HASH" ] || exit 0++AHEAD="$(git -C "$SKILL_DIR" rev-list --count "$LOCAL..$REMOTE_HASH" 2>/dev/null || echo 0)"+if [ "${AHEAD:-0}" -gt 0 ]; then+ echo "💡 drawio-skill update available ($AHEAD new commit(s)) — run: cd \"$SKILL_DIR\" && git pull"+fidiff --git a/scripts/check-update.sh b/scripts/check-update.shdeleted file mode 100755index e4f87dd..0000000--- a/scripts/check-update.sh+++ /dev/null@@ -1,52 +0,0 @@-#!/usr/bin/env bash-# Check if drawio-skill has updates available on the remote.-# Usage: bash scripts/check-update.sh [skill-dir]-# skill-dir defaults to the script's parent directory.-# Exit codes: 0 = update available, 1 = up to date, 2 = error--set -euo pipefail--SKILL_DIR="${1:-$(cd "$(dirname "$0")/.." && pwd)}"--if ! git -C "$SKILL_DIR" rev-parse --git-dir &>/dev/null; then- echo "Not a git repository: $SKILL_DIR" >&2- exit 2-fi--# Detect current branch and its upstream-BRANCH=$(git -C "$SKILL_DIR" symbolic-ref --short HEAD 2>/dev/null) || {- echo "Detached HEAD — cannot check for updates. Please checkout a branch." >&2- exit 2-}--UPSTREAM=$(git -C "$SKILL_DIR" rev-parse --abbrev-ref "${BRANCH}@{upstream}" 2>/dev/null) || {- echo "Branch '$BRANCH' has no upstream configured. Set with: git branch --set-upstream-to=origin/$BRANCH" >&2- exit 2-}--REMOTE_NAME="${UPSTREAM%%/*}"--# Fetch latest refs from remote-if ! git -C "$SKILL_DIR" fetch "$REMOTE_NAME" --quiet 2>/dev/null; then- echo "Cannot reach remote '$REMOTE_NAME' (offline?)" >&2- exit 2-fi--LOCAL_HASH=$(git -C "$SKILL_DIR" rev-parse HEAD 2>/dev/null)-REMOTE_HASH=$(git -C "$SKILL_DIR" rev-parse "$UPSTREAM" 2>/dev/null)--if [ -z "$REMOTE_HASH" ]; then- echo "Cannot resolve upstream ref '$UPSTREAM'" >&2- exit 2-fi--if [ "$REMOTE_HASH" != "$LOCAL_HASH" ]; then- echo "Update available for drawio-skill (branch: $BRANCH)."- echo " Local: ${LOCAL_HASH:0:8}"- echo " Remote: ${REMOTE_HASH:0:8}"- echo " Run: cd \"$SKILL_DIR\" && git pull"- exit 0-else- echo "drawio-skill is up to date (branch: $BRANCH)."- exit 1-fi