← Back to Skills Marketplace
niracler

Code Sync

by Niracler · GitHub ↗ · v0.3.0 · MIT-0
cross-platform ✓ Security Clean
425
Downloads
0
Stars
0
Active Installs
6
Versions
Install in OpenClaw
/install nini-code-sync
Description
Use this skill to batch-sync all git repos across machines — pushing uncommitted changes at end of day or pulling latest at start of day. Invoke when the use...
README (SKILL.md)

Code Sync

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.

Prerequisites

Tool Type Required Install
git cli Yes brew install git or git-scm.com
git-workflow skill Yes Included in npx skills add niracler/skillmust 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.

First-Time Setup

On first use, check for config at ~/.config/nini-skill/code-sync/config.md. If not found, ask the user:

  1. "Where do you keep your git repos?" (default: ~/code)
  2. "What's the directory structure?" — explain the expected pattern: \x3Cbase-dir>/*/ for top-level repos and \x3Cbase-dir>/*/repos/*/ for monorepo sub-repos
  3. Save to ~/.config/nini-skill/code-sync/config.md:
base_dir: ~/code

Mode Selection

User says Mode
「下班同步」or "push" Push
「上班更新」or "pull" Pull
「同步代码」「code-sync」 Ask user

Workflow (shared by both modes)

  1. Scan → 2. Categorize → 3. Batch action (auto, no confirmation) → 4. Handle exceptions (interactive) → 5. Summary

If all repos are up-to-date, report that and stop.

Scan

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).

Categorize

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

Exception Handling

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 \x3Cbranch>), 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

Summary

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

Common Issues

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
Usage Guidance
This skill appears to do what it says: scan ~/code (or a configured base dir) and push/pull repositories. Before installing: 1) Be aware it can automatically push or pull repos — that can expose or change work in bulk; consider running a dry run or review mode first. 2) Inspect or audit the referenced 'git-workflow' skill before allowing it to perform commits (SKILL.md requires invoking it for commits via the Skill tool). 3) Note it writes config to ~/.config/nini-skill/code-sync/config.md and outputs remote URLs in scan results; if you store any sensitive tokens in remote URLs (unusual but possible), treat those outputs as sensitive. 4) If you want an extra safety layer, run the included scripts locally yourself to observe behavior before granting the skill autonomous use.
Capability Analysis
Type: OpenClaw Skill Name: nini-code-sync Version: 0.3.0 The skill is a legitimate utility for batch-synchronizing git repositories in a specified directory (defaulting to ~/code). The included shell script (scripts/scan.sh) safely gathers git metadata such as branch names, remote URLs, and commit counts using standard git commands, and the SKILL.md provides clear instructions for the agent to handle push/pull workflows. No evidence of data exfiltration, malicious execution, or harmful prompt injection was found.
Capability Assessment
Purpose & Capability
The skill claims to batch-sync git repos and only requires the git binary; that aligns with the included scan script and the described workflow. One minor inconsistency: SKILL.md says a separate 'git-workflow' skill is required for commits (installed via an npx command), but that external skill is not declared in the registry metadata. This is likely an implementation detail rather than a sign of malice, but you should verify the referenced 'git-workflow' skill before allowing commits.
Instruction Scope
Instructions and the script stay within the stated scope: scanning a base directory (~/.config path for configuration), enumerating repos, optionally running git fetch, and returning JSON status. A functional caveat: the workflow performs automated push/pull actions ('auto, no confirmation' for certain categories) which can modify remote state without an explicit per-repo prompt. The skill also collects remote URLs (remote_url) in its scan output, which is expected for this purpose but is data you may not want transmitted elsewhere.
Install Mechanism
No install spec — instruction-only plus an included shell script. Nothing is downloaded or extracted; the script is local and runs git commands. This is the lowest-risk install pattern.
Credentials
The skill requests no environment variables or credentials. It does read $HOME and writes/reads a config at ~/.config/nini-skill/code-sync/config.md. It also exposes remote URLs from git remotes in its JSON output — reasonable for a sync tool but consider whether those URLs (which might contain embedded credentials in unusual setups) should be handled or stored.
Persistence & Privilege
The skill does not request always:true and has no system-wide modifications. It will create a config file under the user's home config directory on first run, which is normal for user-level tools.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install nini-code-sync
  3. After installation, invoke the skill by name or use /nini-code-sync
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v0.3.0
Release v0.3.0 — see https://github.com/niracler/skill/releases/tag/v0.3.0
v0.2.1
Release v0.2.1 — see https://github.com/niracler/skill/releases/tag/v0.2.1
v0.2.0
Release v0.2.0 — see https://github.com/niracler/skill/releases/tag/v0.2.0
v0.1.2
Release v0.1.2 — see https://github.com/niracler/skill/releases/tag/v0.1.2
v0.1.1
Release v0.1.1 — see https://github.com/niracler/skill/releases/tag/v0.1.1
v0.1.0
Initial release: Batch sync git repos across machines (push/pull)
Metadata
Slug nini-code-sync
Version 0.3.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 6
Frequently Asked Questions

What is Code Sync?

Use this skill to batch-sync all git repos across machines — pushing uncommitted changes at end of day or pulling latest at start of day. Invoke when the use... It is an AI Agent Skill for Claude Code / OpenClaw, with 425 downloads so far.

How do I install Code Sync?

Run "/install nini-code-sync" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Code Sync free?

Yes, Code Sync is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Code Sync support?

Code Sync is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Code Sync?

It is built and maintained by Niracler (@niracler); the current version is v0.3.0.

💬 Comments