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