ljg-push
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseljg-push: 推送 ljg-* skills
ljg-push: Push ljg-* skills
把本地 里改过的 skills,一键同步到 github repo,覆盖 master 和 md 两个分支。
~/.claude/skills/ljg-*One-click sync modified skills in local to the GitHub repo, overwriting both the master and md branches.
~/.claude/skills/ljg-*仓库路径(硬编码)
Repository Paths (Hard-coded)
SKILLS_REPO="$HOME/code/ljg-skills" # 本地工作 repo
SKILLS_LOCAL="$HOME/.claude/skills" # 本地 skill 源
REPO_URL="git@github.com:lijigang/ljg-skills.git"如果 不存在,脚本会自动 clone。如果它存在但不是 ljg-skills 的 git repo,脚本会报错退出(不破坏现有目录)。
$SKILLS_REPOSKILLS_REPO="$HOME/code/ljg-skills" # Local working repo
SKILLS_LOCAL="$HOME/.claude/skills" # Local skill source
REPO_URL="git@github.com:lijigang/ljg-skills.git"If does not exist, the script will automatically clone it. If it exists but is not the ljg-skills Git repo, the script will exit with an error (without damaging the existing directory).
$SKILLS_REPO两条分支的差异
Differences Between the Two Branches
| 分支 | 输出格式 | 文件扩展 | 加粗 | 文件头 |
|---|---|---|---|---|
| org-mode | | | |
| markdown | | | YAML frontmatter |
~/.claude/skills/| Branch | Output Format | File Extension | Bold Format | File Header |
|---|---|---|---|---|
| org-mode | | | |
| markdown | | | YAML frontmatter |
The skills in are in master style (source version). Differences for the md branch are automatically converted by the script + manually supplemented if necessary.
~/.claude/skills/工作流
Workflow
按 步骤执行 → 调用 。
Workflows/Push.mdTools/Push.shExecute according to the steps in → Call .
Workflows/Push.mdTools/Push.shREADME 一致性(硬 gate)
README Consistency (Hard Gate)
每次 push 前,脚本强制做一件事:把 README 跟 local skills 对一遍。
- 列出 全部 skill 名
~/.claude/skills/ljg-* - grep 里出现的
$SKILLS_REPO/README.mdljg-xxx - 找出 local 有但 README 没有的——几乎肯定意味着 README 漏更新
- 命中 → push 中止,报告差异
每次 push 都是检视 README 的机会。问自己:
- 新增 skill 了吗?README 的 skill 清单 / 安装命令需要加一行
- 删了 skill 吗?README 对应行要删
- 某个 skill 的描述大改了吗?README 的简介可能要同步
确认 README 已审、确实不需要更新时,绕过 gate:
bash
/ljg-push --skip-readme-checkBefore each push, the script enforces one task: Compare the README with local skills.
- List all skill names in
~/.claude/skills/ljg-* - Grep for entries in
ljg-xxx$SKILLS_REPO/README.md - Identify skills that exist locally but are missing from the README — this almost certainly means the README is outdated
- If found → push is aborted, and differences are reported.
Each push is an opportunity to review the README. Ask yourself:
- Did you add a new skill? The skill list / installation command in the README needs to be updated with a new line
- Did you delete a skill? The corresponding line in the README needs to be removed
- Did you significantly modify the description of a skill? The introduction in the README may need to be synced.
When you confirm the README has been reviewed and truly does not need updates, bypass the gate:
bash
/ljg-push --skip-readme-check自动转换的范围
Scope of Automatic Conversion
md 分支同步时自动替换的字符串:
- 文件扩展引用:→
__qa.org、__qa.md→__paper.org等(denote 命名约定)__paper.md - 模板引用:→
template.orgtemplate.md - 关键词:→
org-mode、markdown→Org-modeMarkdown
不会自动转换 的内容(脚本不动,需要手工维护):
- →
*bold*:在 markdown 文件里**bold**是斜体,自动替换会破坏文档自身格式*bold* - org 头
#+title:→ YAML frontmatter:太复杂,留人工#+date: - 文件本体重命名:如 文件 →
references/template.orgreferences/template.md
碰到这些差异,脚本推完 md 分支后会列出 仍有差异 的文件清单,给一个 review checklist。
Strings automatically replaced during md branch sync:
- File extension references: →
__qa.org,__qa.md→__paper.org, etc. (denote naming convention)__paper.md - Template references: →
template.orgtemplate.md - Keywords: →
org-mode,markdown→Org-modeMarkdown
Content not automatically converted (script leaves these unchanged, manual maintenance required):
- →
*bold*: In markdown files,**bold**is italic; automatic replacement would break the document's own formatting*bold* - Org headers
#+title:→ YAML frontmatter: Too complex, left for manual handling#+date: - File renaming: e.g., →
references/template.orgreferences/template.md
When these differences are encountered, the script will list the files with remaining differences after pushing the md branch, along with a review checklist.
Voice Notification
Voice Notification
bash
curl -s -X POST http://localhost:31337/notify \
-H "Content-Type: application/json" \
-d '{"message": "Running Push in ljg-push"}' \
> /dev/null 2>&1 &输出文本:
Running **Push** in **ljg-push**...bash
curl -s -X POST http://localhost:31337/notify \
-H "Content-Type: application/json" \
-d '{"message": "Running Push in ljg-push"}' \
> /dev/null 2>&1 &Output text:
Running **Push** in **ljg-push**...Examples
Examples
Example 1: 一键推送
User: /ljg-push
→ 检测 ~/.claude/skills/ljg-* 中跟 repo 有差异的 skills
→ master: rsync + bump version + commit + push
→ md: rsync + mdize + bump version + commit + push
→ 报告:哪些 skills 推了,新版本号,剩余手工差异Example 2: 看会推什么但不真推
User: /ljg-push --dry-run
→ 列出会被同步的 skills
→ 列出会做的 markdown 化转换
→ 不执行 rsync / commit / pushExample 1: One-click Push
User: /ljg-push
→ Detect skills in ~/.claude/skills/ljg-* that differ from the repo
→ master: rsync + bump version + commit + push
→ md: rsync + mdize + bump version + commit + push
→ Report: which skills were pushed, new version number, remaining manual differencesExample 2: Preview what will be pushed without actual pushing
User: /ljg-push --dry-run
→ List skills that will be synced
→ List markdown conversions that will be performed
→ Do not execute rsync / commit / pushGotchas
Gotchas
- README 漂移是最容易被忽略的——加完新 skill 直接推,README 还停在老清单。脚本现在有硬 gate 拦这一刀;拦下来时不要无脑加 ,先去看一下 README
--skip-readme-check - 脚本前提是 git credentials 已配好(ssh key 或 PAT)—— ljg-push 不处理认证,认证失败时直接报错
- master 必须先推——md 分支的 markdown 化基于 master 的 org 版本做转换。反过来推会破坏顺序
- untracked 杂物(如 )会被 rsync 同步到 repo——如果不想推,先在本地删掉,或加进
assets/measure.js.gitignore - 自动 markdown 化只动字符串——和 org 头不动。md 分支的复杂差异(如 ljg-paper 的
*bold*→template.org)需要继刚手工维护template.md - 脚本会自动 bump patch version 在 plugin.json + marketplace.json——如果你想 bump minor / major,先手动改完再跑脚本,脚本只追加 patch
- 如果 md 分支的远端比本地新(继刚另一台机器推过),脚本会 失败时尝试一次
pull --rebase重新应用——这会丢弃本地未推的 md 分支 commit。脚本前会提示reset --hard origin/md - 搬迁记录:repo 历史曾在 (路径名带 backup 是历史遗留),2026-05-02 搬到
~/.claude.backup-20260502/ljg-skills-repo/~/code/ljg-skills/
- README drift is the easiest issue to overlook — pushing right after adding a new skill while the README still shows the old list. The script now has a hard gate to block this; when blocked, don't mindlessly add — check the README first
--skip-readme-check - The script assumes Git credentials are configured (SSH key or PAT) — ljg-push does not handle authentication, and will directly report an error if authentication fails
- Master branch must be pushed first — markdown conversion for the md branch is based on the org version from master. Pushing in reverse order will break the sequence
- Untracked files (e.g., ) will be synced to the repo via rsync — if you don't want to push them, delete them locally first or add them to
assets/measure.js.gitignore - Automatic markdown conversion only modifies strings — and Org headers remain unchanged. Complex differences for the md branch (e.g.,
*bold*→template.orgfor ljg-paper) require manual maintenancetemplate.md - The script automatically bumps the patch version in plugin.json + marketplace.json — if you want to bump the minor/major version, modify it manually first before running the script; the script only increments the patch version
- If the remote md branch is newer than the local one (e.g., pushed from another machine), the script will attempt to reapply changes if
reset --hard origin/mdfails — this will discard unpushed local commits on the md branch. The script will prompt before doing thispull --rebase - Migration Record: The repo was previously located at (the 'backup' in the path is a historical legacy), and was moved to
~/.claude.backup-20260502/ljg-skills-repo/on 2026-05-02~/code/ljg-skills/