From workflow-skills
Batch-syncs all git repos under ~/code: pushes uncommitted/ahead repos end-of-day or pulls latest start-of-day. Scans, categorizes, auto-actions clean repos, interactive for dirty/no-upstream.
npx claudepluginhub niracler/skill --plugin workflow-skillsThis skill uses the workspace's default tool permissions.
Batch sync all git repos under a base directory — push (end-of-day) or pull (start-of-day).
Automatically syncs local workspace changes to remote GitHub repository via git add, commit, and push. Use after significant changes or periodically for backups.
Pulls latest changes from origin for all git repos under a directory. Uses configurable default path or prompts user to set one. Invoke to update or sync reference projects.
Syncs projects via git to enable working from multiple devices. Guides git setup for beginners or assumes knowledge as needed.
Share bugs, ideas, or general feedback.
Batch sync all git repos under a base directory — push (end-of-day) or pull (start-of-day).
Default base directory: ~/code. Configurable via ~/.config/nini-skill/code-sync/config.md.
| Tool | Type | Required | Install |
|---|---|---|---|
| git | cli | Yes | brew install git or git-scm.com |
| git-workflow | skill | Yes | Included in npx skills add niracler/skill — must be invoked via Skill tool for all commits |
Do NOT proactively verify these tools on skill load. If a command fails due to a missing tool, directly guide the user through installation and configuration step by step.
On first use, check for config at ~/.config/nini-skill/code-sync/config.md.
If not found, ask the user:
~/code)<base-dir>/*/ for top-level repos and <base-dir>/*/repos/*/ for monorepo sub-repos~/.config/nini-skill/code-sync/config.md:base_dir: ~/code
| User says | Mode |
|---|---|
| 「下班同步」or "push" | Push |
| 「上班更新」or "pull" | Pull |
| 「同步代码」「code-sync」 | Ask user |
If all repos are up-to-date, report that and stop.
bash scripts/scan.sh # Push: local data only (default ~/code)
bash scripts/scan.sh --fetch # Pull: fetch remote first (10s timeout/repo)
bash scripts/scan.sh --base-dir /path/to/dir # Custom base directory
Output: JSON array with fields path, name, branch, remote, remote_url, dirty_count, has_upstream, ahead, behind, and fetch_error (only on --fetch failure).
Push mode:
| Category | Condition | Action |
|---|---|---|
| up-to-date | dirty_count == 0 && ahead == 0 | Report |
| needs-push | dirty_count == 0 && ahead > 0 | Auto git push |
| dirty | dirty_count > 0 | Interactive |
| no-upstream | has_upstream == false | Ask user |
Pull mode:
| Category | Condition | Action |
|---|---|---|
| up-to-date | dirty_count == 0 && behind == 0 | Report |
| needs-pull | dirty_count == 0 && behind > 0 | Auto git pull --ff-only |
| dirty+behind | dirty_count > 0 && behind > 0 | Interactive |
| fetch-error | fetch_error == true | Report, skip |
| Situation | Steps |
|---|---|
| Dirty repo (push) | git diff --stat + git status → describe to user → ask: commit, stash, or skip. If commit, MUST invoke git-workflow skill via Skill tool — never run git commit directly. |
| No upstream (push) | Report → ask: set upstream and push (git push -u origin <branch>), or skip |
| ff-only fails (pull) | git log --oneline HEAD..@{u} + @{u}..HEAD → explain divergence → suggest: rebase, merge, or skip |
| Dirty + behind (pull) | Report both issues → ask: stash and pull (stash, pull --ff-only, pop), or skip |
Group repos by outcome after all operations complete:
## {Push|Pull} Summary
{Pushed|Updated} (N):
- repo-name (branch, N commits)
Already up-to-date (N):
- repo-a, repo-b, ...
Resolved (N):
- repo-c: action taken
Skipped (N):
- repo-d: reason
| Issue | Fix |
|---|---|
scan.sh finds 0 repos | Check ~/code/*/ has git repos |
fetch_error | Check network, SSH keys |
| ff-only fails | Rebase or merge manually |
| Push rejected | Pull first, then push |