skillpull 0.2.0 → 0.3.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.
Files changed (3) hide show
  1. package/install.sh +4 -35
  2. package/package.json +1 -1
  3. package/skillpull +71 -28
package/install.sh CHANGED
@@ -3,10 +3,8 @@ set -euo pipefail
3
3
 
4
4
  INSTALL_DIR="${SKILLPULL_INSTALL_DIR:-$HOME/.local/bin}"
5
5
  SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
6
- CONFIG_DIR="$HOME/.config/skillpull"
7
- CONFIG_FILE="$CONFIG_DIR/config.json"
8
6
 
9
- GREEN='\033[1;32m'; CYAN='\033[1;36m'; DIM='\033[2m'; RESET='\033[0m'
7
+ GREEN='\033[1;32m'; DIM='\033[2m'; RESET='\033[0m'
10
8
 
11
9
  mkdir -p "$INSTALL_DIR"
12
10
  cp "$SCRIPT_DIR/skillpull" "$INSTALL_DIR/skillpull"
@@ -19,36 +17,7 @@ if ! echo "$PATH" | tr ':' '\n' | grep -qx "$INSTALL_DIR"; then
19
17
  echo " Add to PATH: export PATH=\"$INSTALL_DIR:\$PATH\""
20
18
  fi
21
19
 
22
- # ── Setup default skill repository ──
23
20
  echo ""
24
- printf " ${CYAN}Set up a default skill repository?${RESET}\n"
25
- printf " ${DIM}This lets you run 'skillpull <skill-name>' without typing the full URL.${RESET}\n"
26
- printf " ${DIM}Supports: user/repo, full URL, or leave blank to skip.${RESET}\n"
27
- echo ""
28
- printf " Skill repo: "
29
- read -r repo_input
30
-
31
- if [[ -n "$repo_input" ]]; then
32
- # Resolve shortname to full URL
33
- resolved="$repo_input"
34
- if [[ "$repo_input" != *"://"* && "$repo_input" != git@* ]]; then
35
- if [[ "$repo_input" == */* && "$(echo "$repo_input" | tr -cd '/' | wc -c)" == "1" ]]; then
36
- resolved="https://github.com/${repo_input}.git"
37
- fi
38
- fi
39
-
40
- mkdir -p "$CONFIG_DIR"
41
- if [[ -f "$CONFIG_FILE" ]]; then
42
- sed -i "s|\"registry\":\"[^\"]*\"|\"registry\":\"${resolved}\"|" "$CONFIG_FILE"
43
- else
44
- echo "{\"aliases\":{},\"registry\":\"${resolved}\"}" > "$CONFIG_FILE"
45
- fi
46
-
47
- printf " ${GREEN}✓${RESET} Default registry set to: %s\n" "$resolved"
48
- printf " ${DIM}Now you can run: skillpull <skill-name>${RESET}\n"
49
- else
50
- printf " ${DIM}Skipped. You can set it later: skillpull registry <user/repo>${RESET}\n"
51
- fi
52
-
53
- echo ""
54
- printf " ${GREEN}Done!${RESET} Run 'skillpull --help' to get started.\n"
21
+ printf " ${DIM}Get started:${RESET}\n"
22
+ printf " ${DIM} skillpull init # Setup default skill repo${RESET}\n"
23
+ printf " ${DIM} skillpull --help # See all commands${RESET}\n"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skillpull",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Sync AI agent skills from Git repositories to Claude, Codex, Kiro, and Cursor",
5
5
  "bin": {
6
6
  "skillpull": "./skillpull"
package/skillpull CHANGED
@@ -1,34 +1,39 @@
1
1
  #!/usr/bin/env bash
2
2
  set -euo pipefail
3
3
 
4
- VERSION="0.2.0"
4
+ VERSION="0.3.0"
5
5
  MANIFEST_FILE=".skillpull.json"
6
6
  TMPDIR_PREFIX="skillpull"
7
7
  CONFIG_DIR="$HOME/.config/skillpull"
8
8
  CONFIG_FILE="$CONFIG_DIR/config.json"
9
9
 
10
- # ── Agent targets ──
11
- # Format: PROJECT_DIR|GLOBAL_DIR|FORMAT
12
- # FORMAT: skill = SKILL.md folder, mdc = .cursor/rules/*.mdc
13
- declare -A AGENT_PROJECT AGENT_GLOBAL AGENT_FORMAT
14
- AGENT_PROJECT=(
15
- [claude]=".claude/skills"
16
- [codex]=".codex/skills"
17
- [kiro]=".kiro/skills"
18
- [cursor]=".cursor/rules"
19
- )
20
- AGENT_GLOBAL=(
21
- [claude]="$HOME/.claude/skills"
22
- [codex]="$HOME/.codex/skills"
23
- [kiro]="$HOME/.kiro/skills"
24
- [cursor]="" # Cursor has no global file-based rules
25
- )
26
- AGENT_FORMAT=(
27
- [claude]="skill"
28
- [codex]="skill"
29
- [kiro]="skill"
30
- [cursor]="mdc"
31
- )
10
+ # ── Agent targets (bash 3 compatible) ──
11
+ agent_project() {
12
+ case "$1" in
13
+ claude) echo ".claude/skills" ;;
14
+ codex) echo ".codex/skills" ;;
15
+ kiro) echo ".kiro/skills" ;;
16
+ cursor) echo ".cursor/rules" ;;
17
+ esac
18
+ }
19
+
20
+ agent_global() {
21
+ case "$1" in
22
+ claude) echo "$HOME/.claude/skills" ;;
23
+ codex) echo "$HOME/.codex/skills" ;;
24
+ kiro) echo "$HOME/.kiro/skills" ;;
25
+ cursor) echo "" ;;
26
+ esac
27
+ }
28
+
29
+ agent_format() {
30
+ case "$1" in
31
+ claude) echo "skill" ;;
32
+ codex) echo "skill" ;;
33
+ kiro) echo "skill" ;;
34
+ cursor) echo "mdc" ;;
35
+ esac
36
+ }
32
37
 
33
38
  DEFAULT_AGENT="claude"
34
39
 
@@ -223,14 +228,14 @@ resolve_target_dir() {
223
228
  return
224
229
  fi
225
230
  if [[ "$is_global" == "1" ]]; then
226
- local gdir="${AGENT_GLOBAL[$agent]:-}"
231
+ local gdir; gdir="$(agent_global "$agent")"
227
232
  if [[ -z "$gdir" ]]; then
228
233
  err "$agent does not support global rules (no file-based global path)"
229
234
  return 1
230
235
  fi
231
236
  echo "$gdir"
232
237
  else
233
- echo "${AGENT_PROJECT[$agent]}"
238
+ echo "$(agent_project "$agent")"
234
239
  fi
235
240
  }
236
241
 
@@ -323,7 +328,7 @@ get_branch() {
323
328
 
324
329
  cmd_pull() {
325
330
  local repo_url="$1" skill_filter="${2:-}" target_dir="$3" force="${4:-0}" dry_run="${5:-0}" agent="${6:-claude}"
326
- local fmt="${AGENT_FORMAT[$agent]:-skill}"
331
+ local fmt; fmt="$(agent_format "$agent")"
327
332
  make_tmp
328
333
  local tmpdir="$_TMPDIR"
329
334
 
@@ -487,7 +492,7 @@ cmd_installed() {
487
492
 
488
493
  cmd_remove() {
489
494
  local skill_name="$1" target_dir="$2" agent="${3:-claude}"
490
- local fmt="${AGENT_FORMAT[$agent]:-skill}"
495
+ local fmt; fmt="$(agent_format "$agent")"
491
496
 
492
497
  if [[ "$fmt" == "mdc" ]]; then
493
498
  local dest="$target_dir/${skill_name}.mdc"
@@ -576,7 +581,7 @@ cmd_update() {
576
581
 
577
582
  cmd_push() {
578
583
  local target_dir="$1" repo_url="$2" agent="$3"
579
- local fmt="${AGENT_FORMAT[$agent]:-skill}"
584
+ local fmt; fmt="$(agent_format "$agent")"
580
585
 
581
586
  if [[ ! -d "$target_dir" ]]; then
582
587
  err "No skills directory found at $target_dir"
@@ -664,6 +669,38 @@ cmd_push() {
664
669
  info "Done. $pushed skill(s) pushed to $resolved"
665
670
  }
666
671
 
672
+ cmd_init() {
673
+ ensure_config
674
+ local current; current="$(read_config_key "registry")"
675
+
676
+ printf "\n ${CYAN}skillpull init${RESET}\n\n"
677
+
678
+ if [[ -n "$current" ]]; then
679
+ printf " Current registry: ${GREEN}%s${RESET}\n\n" "$current"
680
+ printf " Enter new skill repo (blank to keep current): "
681
+ else
682
+ printf " ${DIM}Set a default skill repository so you can run 'skillpull <skill-name>' directly.${RESET}\n"
683
+ printf " ${DIM}Supports: user/repo, full URL, or SSH.${RESET}\n\n"
684
+ printf " Skill repo: "
685
+ fi
686
+
687
+ read -r repo_input
688
+
689
+ if [[ -n "$repo_input" ]]; then
690
+ local resolved; resolved="$(resolve_repo_url "$repo_input")" || return 1
691
+ set_registry "$resolved"
692
+ elif [[ -z "$current" ]]; then
693
+ warn "No registry set. Run 'skillpull init' again or 'skillpull registry <repo>'."
694
+ return 0
695
+ else
696
+ dim "Keeping current registry: $current"
697
+ fi
698
+
699
+ echo ""
700
+ info "You're all set. Try: skillpull list"
701
+ echo ""
702
+ }
703
+
667
704
  cmd_alias() {
668
705
  local subcmd="${1:-list}" name="${2:-}" url="${3:-}"
669
706
  case "$subcmd" in
@@ -732,6 +769,7 @@ usage() {
732
769
  skillpull — Sync AI agent skills from Git repositories
733
770
 
734
771
  USAGE:
772
+ skillpull init
735
773
  skillpull <source> [skill-name] [options]
736
774
  skillpull list <source>
737
775
  skillpull search <keyword>
@@ -768,6 +806,7 @@ OPTIONS:
768
806
  --version Show version
769
807
 
770
808
  EXAMPLES:
809
+ skillpull init # Setup default skill repo
771
810
  skillpull tianhaocui/ai-skills # GitHub shortname
772
811
  skillpull @work plan-first-development --global # From alias
773
812
  skillpull search coding-standards # Search GitHub
@@ -810,6 +849,7 @@ main() {
810
849
  remove) cmd="remove"; shift ;;
811
850
  update) cmd="update"; shift ;;
812
851
  push) cmd="push"; shift ;;
852
+ init) cmd="init"; shift ;;
813
853
  search) cmd="search"; shift ;;
814
854
  alias) cmd="alias"; shift
815
855
  # Collect remaining args for alias subcommand
@@ -869,6 +909,9 @@ main() {
869
909
  search)
870
910
  cmd_search "${skill_name:-}"
871
911
  ;;
912
+ init)
913
+ cmd_init
914
+ ;;
872
915
  alias)
873
916
  cmd_alias "${alias_args[@]}"
874
917
  ;;