skillpull 0.4.4 → 0.4.5

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 (2) hide show
  1. package/package.json +1 -1
  2. package/skillpull +37 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skillpull",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
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,7 +1,7 @@
1
1
  #!/usr/bin/env bash
2
2
  set -euo pipefail
3
3
 
4
- VERSION="0.4.4"
4
+ VERSION="0.4.5"
5
5
  MANIFEST_FILE=".skillpull.json"
6
6
  TMPDIR_PREFIX="skillpull"
7
7
  CONFIG_DIR="$HOME/.config/skillpull"
@@ -209,8 +209,9 @@ remove_alias() {
209
209
  err "Alias '$name' not found"
210
210
  return 1
211
211
  fi
212
- # Remove the alias entry
213
- sedi "s|\"${name}\":\"[^\"]*\",\?||" "$CONFIG_FILE"
212
+ # Remove the alias entry (try with trailing comma first, then without)
213
+ sedi "s|\"${name}\":\"[^\"]*\",||" "$CONFIG_FILE"
214
+ sedi "s|\"${name}\":\"[^\"]*\"||" "$CONFIG_FILE"
214
215
  # Clean up double commas and trailing commas
215
216
  sedi 's/,,/,/g; s/,}/}/g; s/{,/{/g' "$CONFIG_FILE"
216
217
  info "Alias '$name' removed"
@@ -401,12 +402,26 @@ write_manifest_entry() {
401
402
  ' "$manifest" > "$tmp"
402
403
  mv "$tmp" "$manifest"
403
404
  else
404
- # Append before closing braces
405
- sedi '/"skills":/,$ {
406
- /^ }/ i\'"$entry"',
407
- }' "$manifest"
405
+ # Append new entry before closing braces using awk
406
+ awk -v new="$entry" '
407
+ /^ }/ && !done { printf "%s,\n", new; done=1 }
408
+ { print }
409
+ ' "$manifest" > "$tmp"
410
+ mv "$tmp" "$manifest"
408
411
  # Fix trailing comma before closing brace
409
- sedi ':a;N;$!ba;s/,\n }/\n }/g' "$manifest"
412
+ local tmp2; tmp2="$(mktemp)"
413
+ awk '
414
+ { lines[NR] = $0; n = NR }
415
+ END {
416
+ for (i=1; i<=n; i++) {
417
+ if (i < n && lines[i] ~ /,$/ && lines[i+1] ~ /^ }/) {
418
+ sub(/,$/, "", lines[i])
419
+ }
420
+ print lines[i]
421
+ }
422
+ }
423
+ ' "$manifest" > "$tmp2"
424
+ mv "$tmp2" "$manifest"
410
425
  fi
411
426
  }
412
427
 
@@ -666,7 +681,20 @@ cmd_remove() {
666
681
  local tmp; tmp="$(mktemp)"
667
682
  grep -v "\"${skill_name}\"" "$manifest" > "$tmp" || true
668
683
  mv "$tmp" "$manifest"
669
- sedi ':a;N;$!ba;s/,\n }/\n }/g' "$manifest"
684
+ # Fix trailing comma before closing brace
685
+ local tmp2; tmp2="$(mktemp)"
686
+ awk '
687
+ { lines[NR] = $0; n = NR }
688
+ END {
689
+ for (i=1; i<=n; i++) {
690
+ if (i < n && lines[i] ~ /,$/ && lines[i+1] ~ /^ }/) {
691
+ sub(/,$/, "", lines[i])
692
+ }
693
+ print lines[i]
694
+ }
695
+ }
696
+ ' "$manifest" > "$tmp2"
697
+ mv "$tmp2" "$manifest"
670
698
  fi
671
699
 
672
700
  info "Removed: $skill_name from $target_dir"