skillpull 0.3.0 → 0.3.3
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/package.json +1 -1
- package/skillpull +89 -14
package/package.json
CHANGED
package/skillpull
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
set -euo pipefail
|
|
3
3
|
|
|
4
|
-
VERSION="0.3.
|
|
4
|
+
VERSION="0.3.3"
|
|
5
5
|
MANIFEST_FILE=".skillpull.json"
|
|
6
6
|
TMPDIR_PREFIX="skillpull"
|
|
7
7
|
CONFIG_DIR="$HOME/.config/skillpull"
|
|
@@ -669,35 +669,88 @@ cmd_push() {
|
|
|
669
669
|
info "Done. $pushed skill(s) pushed to $resolved"
|
|
670
670
|
}
|
|
671
671
|
|
|
672
|
+
cmd_uninstall() {
|
|
673
|
+
local self; self="$(realpath "$0" 2>/dev/null || echo "$0")"
|
|
674
|
+
local local_bin="${SKILLPULL_INSTALL_DIR:-$HOME/.local/bin}/skillpull"
|
|
675
|
+
|
|
676
|
+
printf "\n ${CYAN}Uninstall skillpull${RESET}\n\n"
|
|
677
|
+
|
|
678
|
+
# Remove local binary if exists
|
|
679
|
+
if [[ -f "$local_bin" ]]; then
|
|
680
|
+
rm -f "$local_bin"
|
|
681
|
+
info "Removed $local_bin"
|
|
682
|
+
fi
|
|
683
|
+
|
|
684
|
+
# Remove config
|
|
685
|
+
if [[ -d "$CONFIG_DIR" ]]; then
|
|
686
|
+
printf " Remove config (~/.config/skillpull)? (y/n) "
|
|
687
|
+
read -r yn
|
|
688
|
+
if [[ "$yn" == "y" || "$yn" == "Y" ]]; then
|
|
689
|
+
rm -rf "$CONFIG_DIR"
|
|
690
|
+
info "Removed $CONFIG_DIR"
|
|
691
|
+
else
|
|
692
|
+
dim "Config kept at $CONFIG_DIR"
|
|
693
|
+
fi
|
|
694
|
+
fi
|
|
695
|
+
|
|
696
|
+
# npm global uninstall
|
|
697
|
+
if command -v npm &>/dev/null; then
|
|
698
|
+
local npm_global; npm_global="$(npm root -g 2>/dev/null)/../bin/skillpull"
|
|
699
|
+
if [[ -f "$npm_global" ]] || npm ls -g skillpull &>/dev/null 2>&1; then
|
|
700
|
+
printf " Remove npm global package? (y/n) "
|
|
701
|
+
read -r yn
|
|
702
|
+
if [[ "$yn" == "y" || "$yn" == "Y" ]]; then
|
|
703
|
+
npm uninstall -g skillpull 2>/dev/null
|
|
704
|
+
info "npm global package removed"
|
|
705
|
+
fi
|
|
706
|
+
fi
|
|
707
|
+
fi
|
|
708
|
+
|
|
709
|
+
echo ""
|
|
710
|
+
info "skillpull uninstalled."
|
|
711
|
+
}
|
|
712
|
+
|
|
672
713
|
cmd_init() {
|
|
673
714
|
ensure_config
|
|
674
715
|
local current; current="$(read_config_key "registry")"
|
|
675
716
|
|
|
676
|
-
printf "\n ${CYAN}skillpull
|
|
717
|
+
printf "\n ${CYAN}Welcome to skillpull!${RESET}\n\n"
|
|
718
|
+
printf " Set a default skill repository so you can pull skills by name.\n\n"
|
|
719
|
+
printf " ${DIM}Examples:${RESET}\n"
|
|
720
|
+
printf " ${DIM} tianhaocui/ai-skills GitHub shortname${RESET}\n"
|
|
721
|
+
printf " ${DIM} https://github.com/user/repo Full URL${RESET}\n"
|
|
722
|
+
printf " ${DIM} git@github.com:user/repo.git SSH URL${RESET}\n"
|
|
723
|
+
echo ""
|
|
677
724
|
|
|
678
725
|
if [[ -n "$current" ]]; then
|
|
679
|
-
printf " Current
|
|
680
|
-
printf "
|
|
726
|
+
printf " Current: ${GREEN}%s${RESET}\n\n" "$current"
|
|
727
|
+
printf " New skill repo (Enter to keep current): "
|
|
681
728
|
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
729
|
printf " Skill repo: "
|
|
685
730
|
fi
|
|
686
731
|
|
|
687
732
|
read -r repo_input
|
|
688
733
|
|
|
689
|
-
|
|
734
|
+
# Trim whitespace and control characters
|
|
735
|
+
repo_input="$(echo "$repo_input" | tr -d '[:cntrl:]' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')"
|
|
736
|
+
|
|
737
|
+
if [[ -z "$repo_input" ]]; then
|
|
738
|
+
if [[ -n "$current" ]]; then
|
|
739
|
+
dim "Keeping current registry: $current"
|
|
740
|
+
else
|
|
741
|
+
warn "No registry set. Run 'skillpull init' again when ready."
|
|
742
|
+
return 0
|
|
743
|
+
fi
|
|
744
|
+
else
|
|
690
745
|
local resolved; resolved="$(resolve_repo_url "$repo_input")" || return 1
|
|
691
746
|
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
747
|
fi
|
|
698
748
|
|
|
699
749
|
echo ""
|
|
700
|
-
|
|
750
|
+
printf " ${CYAN}What's next:${RESET}\n"
|
|
751
|
+
printf " skillpull list List available skills\n"
|
|
752
|
+
printf " skillpull <skill-name> Pull a skill into your project\n"
|
|
753
|
+
printf " skillpull --help See all commands\n"
|
|
701
754
|
echo ""
|
|
702
755
|
}
|
|
703
756
|
|
|
@@ -781,6 +834,7 @@ USAGE:
|
|
|
781
834
|
skillpull push [target-repo] [options]
|
|
782
835
|
skillpull installed [--global]
|
|
783
836
|
skillpull remove <skill-name> [--global]
|
|
837
|
+
skillpull uninstall
|
|
784
838
|
|
|
785
839
|
SOURCE FORMATS:
|
|
786
840
|
https://github.com/user/repo Full URL (GitHub, GitLab, any Git host)
|
|
@@ -827,7 +881,24 @@ main() {
|
|
|
827
881
|
local alias_args=()
|
|
828
882
|
QUIET=0; BRANCH=""
|
|
829
883
|
|
|
830
|
-
[[ $# -eq 0 ]]
|
|
884
|
+
if [[ $# -eq 0 ]]; then
|
|
885
|
+
# If running via npx or not installed globally, auto-install
|
|
886
|
+
local self; self="$(realpath "$0" 2>/dev/null || echo "$0")"
|
|
887
|
+
local global_bin="${SKILLPULL_INSTALL_DIR:-$HOME/.local/bin}/skillpull"
|
|
888
|
+
|
|
889
|
+
if [[ "$self" != "$global_bin" && ! -f "$global_bin" ]]; then
|
|
890
|
+
mkdir -p "$(dirname "$global_bin")"
|
|
891
|
+
cp "$self" "$global_bin"
|
|
892
|
+
chmod +x "$global_bin"
|
|
893
|
+
info "Installed skillpull to $global_bin"
|
|
894
|
+
if ! echo "$PATH" | tr ':' '\n' | grep -qx "$(dirname "$global_bin")"; then
|
|
895
|
+
warn "Add to PATH: export PATH=\"$(dirname "$global_bin"):\$PATH\""
|
|
896
|
+
fi
|
|
897
|
+
else
|
|
898
|
+
usage
|
|
899
|
+
fi
|
|
900
|
+
exit 0
|
|
901
|
+
fi
|
|
831
902
|
|
|
832
903
|
while [[ $# -gt 0 ]]; do
|
|
833
904
|
case "$1" in
|
|
@@ -850,6 +921,7 @@ main() {
|
|
|
850
921
|
update) cmd="update"; shift ;;
|
|
851
922
|
push) cmd="push"; shift ;;
|
|
852
923
|
init) cmd="init"; shift ;;
|
|
924
|
+
uninstall) cmd="uninstall"; shift ;;
|
|
853
925
|
search) cmd="search"; shift ;;
|
|
854
926
|
alias) cmd="alias"; shift
|
|
855
927
|
# Collect remaining args for alias subcommand
|
|
@@ -912,6 +984,9 @@ main() {
|
|
|
912
984
|
init)
|
|
913
985
|
cmd_init
|
|
914
986
|
;;
|
|
987
|
+
uninstall)
|
|
988
|
+
cmd_uninstall
|
|
989
|
+
;;
|
|
915
990
|
alias)
|
|
916
991
|
cmd_alias "${alias_args[@]}"
|
|
917
992
|
;;
|