ljg-push

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

ljg-push: 推送 ljg-* skills

ljg-push: Push ljg-* skills

把本地
~/.claude/skills/ljg-*
里改过的 skills,一键同步到 github repo,覆盖 master 和 md 两个分支。
One-click sync modified skills in local
~/.claude/skills/ljg-*
to the GitHub repo, overwriting both the master and md branches.

仓库路径(硬编码)

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"
如果
$SKILLS_REPO
不存在,脚本会自动 clone。如果它存在但不是 ljg-skills 的 git repo,脚本会报错退出(不破坏现有目录)。
SKILLS_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
$SKILLS_REPO
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).

两条分支的差异

Differences Between the Two Branches

分支输出格式文件扩展加粗文件头
master
(默认)
org-mode
.org
*bold*
#+title:
md
markdown
.md
**bold**
YAML frontmatter
~/.claude/skills/
里的 skill 是 master 风格(源版本)。md 分支的差异由脚本自动转换 + 必要时手工补。
BranchOutput FormatFile ExtensionBold FormatFile Header
master
(default)
org-mode
.org
*bold*
#+title:
etc.
md
markdown
.md
**bold**
YAML frontmatter
The skills in
~/.claude/skills/
are in master style (source version). Differences for the md branch are automatically converted by the script + manually supplemented if necessary.

工作流

Workflow

Workflows/Push.md
步骤执行 → 调用
Tools/Push.sh
Execute according to the steps in
Workflows/Push.md
→ Call
Tools/Push.sh
.

README 一致性(硬 gate)

README Consistency (Hard Gate)

每次 push 前,脚本强制做一件事:把 README 跟 local skills 对一遍
  • 列出
    ~/.claude/skills/ljg-*
    全部 skill 名
  • grep
    $SKILLS_REPO/README.md
    里出现的
    ljg-xxx
  • 找出 local 有但 README 没有的——几乎肯定意味着 README 漏更新
  • 命中 → push 中止,报告差异
每次 push 都是检视 README 的机会。问自己:
  1. 新增 skill 了吗?README 的 skill 清单 / 安装命令需要加一行
  2. 删了 skill 吗?README 对应行要删
  3. 某个 skill 的描述大改了吗?README 的简介可能要同步
确认 README 已审、确实不需要更新时,绕过 gate:
bash
/ljg-push --skip-readme-check
Before each push, the script enforces one task: Compare the README with local skills.
  • List all skill names in
    ~/.claude/skills/ljg-*
  • Grep for
    ljg-xxx
    entries in
    $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:
  1. Did you add a new skill? The skill list / installation command in the README needs to be updated with a new line
  2. Did you delete a skill? The corresponding line in the README needs to be removed
  3. 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
    __paper.md
    等(denote 命名约定)
  • 模板引用:
    template.org
    template.md
  • 关键词:
    org-mode
    markdown
    Org-mode
    Markdown
不会自动转换 的内容(脚本不动,需要手工维护):
  • *bold*
    **bold**
    :在 markdown 文件里
    *bold*
    是斜体,自动替换会破坏文档自身格式
  • org 头
    #+title:
    #+date:
    → YAML frontmatter:太复杂,留人工
  • 文件本体重命名:如
    references/template.org
    文件 →
    references/template.md
碰到这些差异,脚本推完 md 分支后会列出 仍有差异 的文件清单,给一个 review checklist。
Strings automatically replaced during md branch sync:
  • File extension references:
    __qa.org
    __qa.md
    ,
    __paper.org
    __paper.md
    , etc. (denote naming convention)
  • Template references:
    template.org
    template.md
  • Keywords:
    org-mode
    markdown
    ,
    Org-mode
    Markdown
Content not automatically converted (script leaves these unchanged, manual maintenance required):
  • *bold*
    **bold**
    : In markdown files,
    *bold*
    is italic; automatic replacement would break the document's own formatting
  • Org headers
    #+title:
    #+date:
    → YAML frontmatter: Too complex, left for manual handling
  • File renaming: e.g.,
    references/template.org
    references/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 / push
Example 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 differences
Example 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 / push

Gotchas

Gotchas

  • README 漂移是最容易被忽略的——加完新 skill 直接推,README 还停在老清单。脚本现在有硬 gate 拦这一刀;拦下来时不要无脑加
    --skip-readme-check
    ,先去看一下 README
  • 脚本前提是 git credentials 已配好(ssh key 或 PAT)—— ljg-push 不处理认证,认证失败时直接报错
  • master 必须先推——md 分支的 markdown 化基于 master 的 org 版本做转换。反过来推会破坏顺序
  • untracked 杂物(如
    assets/measure.js
    )会被 rsync 同步到 repo
    ——如果不想推,先在本地删掉,或加进
    .gitignore
  • 自动 markdown 化只动字符串——
    *bold*
    和 org 头不动。md 分支的复杂差异(如 ljg-paper 的
    template.org
    template.md
    )需要继刚手工维护
  • 脚本会自动 bump patch version 在 plugin.json + marketplace.json——如果你想 bump minor / major,先手动改完再跑脚本,脚本只追加 patch
  • 如果 md 分支的远端比本地新(继刚另一台机器推过),脚本会
    pull --rebase
    失败时尝试一次
    reset --hard origin/md
    重新应用——这会丢弃本地未推的 md 分支 commit。脚本前会提示
  • 搬迁记录:repo 历史曾在
    ~/.claude.backup-20260502/ljg-skills-repo/
    (路径名带 backup 是历史遗留),2026-05-02 搬到
    ~/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
    --skip-readme-check
    — check the README first
  • 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.,
    assets/measure.js
    ) will be synced to the repo via rsync
    — if you don't want to push them, delete them locally first or add them to
    .gitignore
  • Automatic markdown conversion only modifies strings
    *bold*
    and Org headers remain unchanged. Complex differences for the md branch (e.g.,
    template.org
    template.md
    for ljg-paper) require manual maintenance
  • 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
    reset --hard origin/md
    to reapply changes if
    pull --rebase
    fails — this will discard unpushed local commits on the md branch. The script will prompt before doing this
  • Migration Record: The repo was previously located at
    ~/.claude.backup-20260502/ljg-skills-repo/
    (the 'backup' in the path is a historical legacy), and was moved to
    ~/code/ljg-skills/
    on 2026-05-02