@vikasagarwal101/skill-sync 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +206 -0
- package/bin/skill-sync.js +38 -0
- package/bin/skill-sync.sh +1250 -0
- package/install.sh +516 -0
- package/lib/authoring.sh +200 -0
- package/lib/core.sh +221 -0
- package/lib/health.sh +136 -0
- package/lib/inspect.sh +210 -0
- package/lib/sync.sh +281 -0
- package/lib/targets.sh +73 -0
- package/package.json +42 -0
- package/rules/skill-sync.md +96 -0
- package/scripts/bundle.sh +28 -0
- package/skill-sync +131 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
## Skill Management — `skill-sync`
|
|
2
|
+
|
|
3
|
+
The controlled entrypoint for managing AI agent skills across all locations on this machine. Use it instead of manually copying skills between directories.
|
|
4
|
+
|
|
5
|
+
### Where it lives
|
|
6
|
+
|
|
7
|
+
- CLI: `~/.local/bin/skill-sync`
|
|
8
|
+
- Manifest: `~/.config/skill-sync/manifest`
|
|
9
|
+
- Config: `~/.config/skill-sync/config` (auto-generated, editable)
|
|
10
|
+
|
|
11
|
+
### Canonical sources (where skills live)
|
|
12
|
+
|
|
13
|
+
| Label | Path | Scanned by |
|
|
14
|
+
|-------|------|-----------|
|
|
15
|
+
| `agents` | `~/.agents/skills/` | OpenCode, Codex |
|
|
16
|
+
| `opencode` | `~/.config/opencode/skills/` | OpenCode only |
|
|
17
|
+
| `codex` | `~/.codex/skills/` | Codex only |
|
|
18
|
+
|
|
19
|
+
### Sync targets (real copies, not symlinks)
|
|
20
|
+
|
|
21
|
+
| Label | Path | Why |
|
|
22
|
+
|-------|------|-----|
|
|
23
|
+
| `claude` | `~/.claude/skills/` | Claude Code doesn't scan `.agents/` and breaks on symlinks |
|
|
24
|
+
|
|
25
|
+
Add custom targets with `skill-sync target add <label> <path>`.
|
|
26
|
+
|
|
27
|
+
### Quick reference
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# Core sync
|
|
31
|
+
skill-sync # sync all tracked skills
|
|
32
|
+
skill-sync sync <name> # sync one skill
|
|
33
|
+
skill-sync add <name> # deploy skill to claude + track
|
|
34
|
+
skill-sync remove <name> # remove from targets (--purge to delete source)
|
|
35
|
+
skill-sync --dry-run sync # preview what would change
|
|
36
|
+
|
|
37
|
+
# Authoring
|
|
38
|
+
skill-sync create <name> # scaffold new skill (default: agents scope)
|
|
39
|
+
skill-sync edit <name> # open SKILL.md in $EDITOR
|
|
40
|
+
skill-sync rename <old> <new> # rename across all locations
|
|
41
|
+
|
|
42
|
+
# Inspection
|
|
43
|
+
skill-sync info <name> # show source, sync state, health
|
|
44
|
+
skill-sync status # sync state across all skills
|
|
45
|
+
skill-sync list --all # every skill from every location
|
|
46
|
+
skill-sync search <query> # find skills by keyword
|
|
47
|
+
skill-sync diff <name> # show diff between source and target
|
|
48
|
+
|
|
49
|
+
# Health
|
|
50
|
+
skill-sync validate # check frontmatter health
|
|
51
|
+
skill-sync doctor # full system health check
|
|
52
|
+
|
|
53
|
+
# Target management
|
|
54
|
+
skill-sync target list # show all sources and targets
|
|
55
|
+
skill-sync target add X /path # add a new sync target
|
|
56
|
+
skill-sync target remove X # remove a target
|
|
57
|
+
|
|
58
|
+
# Maintenance
|
|
59
|
+
skill-sync init # rebuild manifest from current state
|
|
60
|
+
skill-sync pull <name> # reverse sync: pull target edits back to source
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Golden rules for agents
|
|
64
|
+
|
|
65
|
+
1. **Always create skills in a canonical source first** (`~/.agents/skills/` for shared, `~/.config/opencode/skills/` for opencode-only), never directly in `~/.claude/skills/`.
|
|
66
|
+
2. **Use `skill-sync add` to deploy** — never `cp -r` manually, as it bypasses manifest tracking.
|
|
67
|
+
3. **Run `skill-sync sync` after editing** any skill that has copies in `.claude/`.
|
|
68
|
+
4. **Use `skill-sync edit <name>`** to open the canonical SKILL.md — it reminds you to sync after.
|
|
69
|
+
5. **Run `skill-sync doctor`** to check system health if something seems wrong.
|
|
70
|
+
6. **Never create skills without YAML frontmatter** — `skill-sync create` generates it automatically.
|
|
71
|
+
7. **Claude Code cannot follow symlinks** — that's why `.claude/skills/` uses real copies synced by this tool.
|
|
72
|
+
|
|
73
|
+
### Creating a new skill
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
skill-sync create my-skill --scope agents # scaffold in shared location
|
|
77
|
+
skill-sync edit my-skill # open in $EDITOR to write content
|
|
78
|
+
skill-sync add my-skill --to claude # deploy to Claude Code
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### After editing a skill
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
skill-sync edit <name> # opens canonical source in $EDITOR, reminds to sync
|
|
85
|
+
skill-sync # push changes to all targets
|
|
86
|
+
skill-sync status # verify everything is in sync
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Reverse sync (target → source)
|
|
90
|
+
|
|
91
|
+
If a skill was edited directly in a target (e.g., Claude copy was hand-modified):
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
skill-sync pull <name> # pull from first available target
|
|
95
|
+
skill-sync pull <name> --from claude # pull from specific target
|
|
96
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# bundle.sh — generate bin/skill-sync.sh from lib/ modules + dispatch
|
|
5
|
+
# Called by npm prepublishOnly/prepack hooks
|
|
6
|
+
|
|
7
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
8
|
+
OUT="$SCRIPT_DIR/bin/skill-sync.sh"
|
|
9
|
+
|
|
10
|
+
mkdir -p "$SCRIPT_DIR/bin"
|
|
11
|
+
|
|
12
|
+
{
|
|
13
|
+
echo '#!/usr/bin/env bash'
|
|
14
|
+
echo 'set -euo pipefail'
|
|
15
|
+
echo ''
|
|
16
|
+
echo '# skill-sync (bundled by scripts/bundle.sh)'
|
|
17
|
+
echo '# Source: https://github.com/vikasagarwal101/skill-sync'
|
|
18
|
+
echo ''
|
|
19
|
+
for lib in core sync authoring inspect health targets; do
|
|
20
|
+
cat "$SCRIPT_DIR/lib/$lib.sh" 2>/dev/null || { echo "ERROR: lib/$lib.sh not found" >&2; exit 1; }
|
|
21
|
+
echo ''
|
|
22
|
+
done
|
|
23
|
+
# Dispatch (everything from Main dispatch onward)
|
|
24
|
+
awk '/^# ── Main dispatch/{p=1} p' "$SCRIPT_DIR/skill-sync"
|
|
25
|
+
} > "$OUT"
|
|
26
|
+
|
|
27
|
+
chmod +x "$OUT"
|
|
28
|
+
echo "Bundled: $OUT ($(wc -l < "$OUT") lines)"
|
package/skill-sync
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# skill-sync — manage skills across all AI agent directories
|
|
5
|
+
# Entry point: sources lib modules in dev mode, bundled for production
|
|
6
|
+
|
|
7
|
+
# Source library modules (dev mode — install.sh bundles for production)
|
|
8
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
9
|
+
if [ -d "$SCRIPT_DIR/lib" ]; then
|
|
10
|
+
for _lib in core sync authoring inspect health targets; do
|
|
11
|
+
source "$SCRIPT_DIR/lib/$_lib.sh"
|
|
12
|
+
done
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
# ── Main dispatch ──────────────────────────────────────────────
|
|
16
|
+
|
|
17
|
+
# Parse global flags
|
|
18
|
+
local_args=()
|
|
19
|
+
for a in "$@"; do
|
|
20
|
+
case "$a" in
|
|
21
|
+
--dry-run) DRY_RUN=1 ;;
|
|
22
|
+
*) local_args+=("$a") ;;
|
|
23
|
+
esac
|
|
24
|
+
done
|
|
25
|
+
set -- "${local_args[@]}" 2>/dev/null || true
|
|
26
|
+
[ $DRY_RUN -eq 1 ] && echo "[dry-run mode — no changes will be made]"
|
|
27
|
+
|
|
28
|
+
cmd="${1:-help}"
|
|
29
|
+
shift || true
|
|
30
|
+
|
|
31
|
+
case "$cmd" in
|
|
32
|
+
sync|"")
|
|
33
|
+
[ -n "${1:-}" ] && cmd_sync_one "$1" || cmd_sync_all
|
|
34
|
+
;;
|
|
35
|
+
add)
|
|
36
|
+
[ -z "${1:-}" ] && { echo "Usage: skill-sync add <name> [--to claude]"; exit 1; }
|
|
37
|
+
cmd_add "$@"
|
|
38
|
+
;;
|
|
39
|
+
remove|rm)
|
|
40
|
+
[ -z "${1:-}" ] && { echo "Usage: skill-sync remove <name> [--from T] [--purge]"; exit 1; }
|
|
41
|
+
cmd_remove "$@"
|
|
42
|
+
;;
|
|
43
|
+
create|new)
|
|
44
|
+
[ -z "${1:-}" ] && { echo "Usage: skill-sync create <name> [--scope agents|opencode]"; exit 1; }
|
|
45
|
+
cmd_create "$@"
|
|
46
|
+
;;
|
|
47
|
+
edit)
|
|
48
|
+
[ -z "${1:-}" ] && { echo "Usage: skill-sync edit <name>"; exit 1; }
|
|
49
|
+
cmd_edit "$1"
|
|
50
|
+
;;
|
|
51
|
+
pull)
|
|
52
|
+
[ -z "${1:-}" ] && { echo "Usage: skill-sync pull <name> [--from T]"; exit 1; }
|
|
53
|
+
cmd_pull "$@"
|
|
54
|
+
;;
|
|
55
|
+
search)
|
|
56
|
+
[ -z "${1:-}" ] && { echo "Usage: skill-sync search <query>"; exit 1; }
|
|
57
|
+
cmd_search "$@"
|
|
58
|
+
;;
|
|
59
|
+
rename)
|
|
60
|
+
[ -z "${2:-}" ] && { echo "Usage: skill-sync rename <old> <new>"; exit 1; }
|
|
61
|
+
cmd_rename "$1" "$2"
|
|
62
|
+
;;
|
|
63
|
+
diff)
|
|
64
|
+
[ -z "${1:-}" ] && { echo "Usage: skill-sync diff <name>"; exit 1; }
|
|
65
|
+
cmd_diff "$1"
|
|
66
|
+
;;
|
|
67
|
+
target)
|
|
68
|
+
cmd_target "${1:-list}" "${2:-}" "${3:-}"
|
|
69
|
+
;;
|
|
70
|
+
info)
|
|
71
|
+
[ -z "${1:-}" ] && { echo "Usage: skill-sync info <name>"; exit 1; }
|
|
72
|
+
cmd_info "$1"
|
|
73
|
+
;;
|
|
74
|
+
status)
|
|
75
|
+
cmd_status
|
|
76
|
+
;;
|
|
77
|
+
list|ls)
|
|
78
|
+
cmd_list "${1:-}"
|
|
79
|
+
;;
|
|
80
|
+
validate|check)
|
|
81
|
+
cmd_validate "${1:-}"
|
|
82
|
+
;;
|
|
83
|
+
doctor)
|
|
84
|
+
cmd_doctor
|
|
85
|
+
;;
|
|
86
|
+
init)
|
|
87
|
+
cmd_init
|
|
88
|
+
;;
|
|
89
|
+
help|--help|-h)
|
|
90
|
+
cat << 'HELPEOF'
|
|
91
|
+
skill-sync — manage skills across all AI agent directories
|
|
92
|
+
|
|
93
|
+
Commands:
|
|
94
|
+
sync [name] Sync all manifest skills, or just one
|
|
95
|
+
add <name> [--to T] Deploy a skill to a target (default: claude)
|
|
96
|
+
remove <name> Remove from targets (--from T) or --purge source
|
|
97
|
+
create <name> [--scope S] Scaffold new skill (default scope: agents)
|
|
98
|
+
edit <name> Open SKILL.md in $EDITOR, then offer to sync
|
|
99
|
+
pull <name> [--from T] Reverse sync: copy target edits back to source
|
|
100
|
+
search <query> Find skills by keyword in name or description
|
|
101
|
+
rename <old> <new> Rename a skill across all locations
|
|
102
|
+
diff <name> Show content diff between source and target copies
|
|
103
|
+
info <name> Show details, sync state, and health
|
|
104
|
+
status Show sync status for all tracked skills
|
|
105
|
+
list [--all] List synced skills, or --all for every skill
|
|
106
|
+
validate [name] Check frontmatter + naming (one or all)
|
|
107
|
+
doctor Full health check across all locations
|
|
108
|
+
target [list|add|remove] Manage sync targets dynamically
|
|
109
|
+
init Generate manifest from current state
|
|
110
|
+
|
|
111
|
+
Global flags:
|
|
112
|
+
--dry-run Preview changes without executing
|
|
113
|
+
|
|
114
|
+
Sources (canonical, auto-discovered):
|
|
115
|
+
agents ~/.agents/skills/
|
|
116
|
+
opencode ~/.config/opencode/skills/
|
|
117
|
+
codex ~/.codex/skills/
|
|
118
|
+
|
|
119
|
+
Targets (real copies, synced from sources):
|
|
120
|
+
claude ~/.claude/skills/
|
|
121
|
+
|
|
122
|
+
Config: ~/.config/skill-sync/config
|
|
123
|
+
Manifest: ~/.config/skill-sync/manifest
|
|
124
|
+
HELPEOF
|
|
125
|
+
;;
|
|
126
|
+
*)
|
|
127
|
+
echo "Unknown command: $cmd"
|
|
128
|
+
echo "Run 'skill-sync help' for usage"
|
|
129
|
+
exit 1
|
|
130
|
+
;;
|
|
131
|
+
esac
|