ljg-push
Synchronize all updated skills in ~/.agents/skills/ljg-* to the GitHub repo (ljg-skills). First pushes to the master branch (org-mode output style), then switches to the md branch (markdown output style) to perform basic markdown conversion before pushing. Use when user says '/ljg-push', 'push skills', '推送 skills', '同步 skills', 'sync ljg', or whenever ljg-* skills get updated and need shipping. NOT FOR pushing non-ljg skills or arbitrary git repos.
1How It Works & Mechanism
The core action is a one-click synchronization of local updates from ~/.agents/skills/ljg-* to the GitHub repo, covering both the master (org style) and md (markdown style) branches.
把本地 `~/.agents/skills/ljg-*` 里改过的 skills,一键同步到 github repo,覆盖 master 和 md 两个分支。
Repository paths are hardcoded; if $SKILLS_REPO does not exist, it will automatically run git clone. If it exists but origin is not ljg-skills, it exits with an error without damaging existing directories.
如果 `$SKILLS_REPO` 不存在,脚本会自动 clone。如果它存在但不是 ljg-skills 的 git repo,脚本会报错退出(不破坏现有目录)。
Change detection and synchronization share the same file boundary: compared by checksums; pure timestamps, directory metadata, or empty directories do not trigger it; the ignore list contains only .git/, node_modules/, and .DS_Store.
检测与同步共用同一文件边界:按校验和比较内容,可靠识别文件新增、删除、内容和可执行位变化;纯时间戳、目录元数据、空目录不会单独触发发布
README consistency is a hard gate: before pushing, it lists local skill names and runs grep against the README, aborting if a local skill is missing in the README; use --skip-readme-check to bypass when no update is confirmed necessary.
找出 local 有但 README 没有的——*几乎肯定意味着 README 漏更新*
Automatic conversion is executed before releasing to the md branch: org files are converted to .md with the same name and originals are removed, embedded org examples are converted to markdown/YAML, extension references and keywords are rewritten, and evals/*.json output contracts are switched to Markdown.
md 分支同步时自动转换(2026-06-12 起含 org 文件本体):
The push order is enforced as master first, md second, and then switching back to master, because the markdown conversion of md is based on the org version from master.
*master 必须先推*——md 分支的 markdown 化基于 master 的 org 版本做转换。反过来推会破坏顺序
The script automatically bumps the patch version (plugin.json + marketplace.json); minor/major versions must be changed manually beforehand, as the script only increments the patch.
*脚本会自动 bump patch version 在 plugin.json + marketplace.json*
When remote md is ahead of local, it runs pull --rebase first; if it fails, it attempts a single reset --hard origin/md and reapplies—this will discard unpushed local md commits, which is prompted before execution.
脚本会 `pull --rebase` 失败时尝试一次 `reset --hard origin/md` 重新应用——这会丢弃本地未推的 md 分支 commit。脚本前会提示
Supports --dry-run (lists skills and conversions to be synced without executing rsync/commit/push) and --force (skips change detection and syncs all), accompanied by a local curl voice notification.
不执行 rsync / commit / push
2Core Capabilities
3External Dependencies
| Kind | Dependency / Endpoint |
|---|---|
| cli | git(clone / commit / push / pull --rebase / reset --hard,凭据由用户预先配置的 ssh key 或 PAT 提供) |
| cli | rsync(按校验和同步 skill 目录,含 --delete) |
| cli | bun(运行 mdize 转换器与测试) |
| network | GitHub 远端仓库(硬编码,作为 push 目标) |
| network | 本地语音通知服务(宿主/工作流用 curl 触发,非脚本内) |
4Recommended Governance & Evidence
- scripts/: Local script or command execution: Tools/Push.sh (bash script; rsync sync, git clone/commit/push/pull --rebase/reset --hard)
- 网络端点: Declared external network access: git push/clone/pull to hardcoded remote git@github.com:lijigang/ljg-skills.git (via user pre-configured credentials)
- 本地工作目录: File read/write and artifact output: $HOME/code/ljg-skills (rsync syncs skill directories, git commit/push; deletes .org and generates .md on the md branch)
5Second-Pass Verification
- [ok] URL 命中性质 — 4 条:2 条 SKILL.md/Workflows 的本地 curl http://localhost:31337/notify,2 条 MdizeEmbeddedOrg.test.ts 的 https://example.com 测试字面量;无对公网 API 的查询端点,网络面是 git 远端 + 本地通知。
- [ok] 「凭证」命中非凭证读取 — 52 条命中均为 $HOME/$SKILLS_REPO/$SKILLS_LOCAL 变量、路径与 README/日志文案;SKILL.md 明写「脚本前提是 git credentials 已配好…ljg-push 不处理认证」,credential_reads=[] 成立。
- [ok] 外部程序确为执行面 — 8 条:SKILL.md/Workflows 的 curl、Push.test.ts 的 Bun.spawnSync(bash) 测试驱动;Push.sh 另有 rsync/git/awk/sed 调用,scripts_executed 已列。
- [ok] 写盘面与破坏性动作有原文 — 检测/同步边界、sed 改 plugin.json/marketplace.json、md 分支删 .org、reset --hard origin/md 均在 SKILL.md 原文;file_writes 与 risks 表述有据。
- [ok] README gate 与 dry-run 作为人工闸门 — SKILL.md 的硬 gate 段落与 --skip-readme-check 说明、Example 2 的 --dry-run 行为(不执行 rsync/commit/push)为原文,判级理由引用成立。
- [ok] 功能声明未夸大 — description「把本地 ~/.agents/skills/ljg-* 里改过的 skills 一键同步…覆盖 master 和 md 两个分支」与 SKILL.md 的两分支差异表、工作流一致;NOT FOR 亦与脚本硬编码范围相符。
6Verdict & Scenarios
76457b2903899638…