From f53f9320a875b946b875d5d0724f7ab2c36ae0a2 Mon Sep 17 00:00:00 2001 From: salva Date: Fri, 1 May 2026 00:23:19 +0300 Subject: [PATCH] feat: enable-all command (symmetric to disable-all) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bulk-enable every parked skill into selected target(s). Idempotent — skips already-active. Useful as a 'restore-from-archive' helper after disable-all or filesystem mishap. usage: opc-skills enable-all [--target T] [-y|--yes] --- bin/opc-skills | 55 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/bin/opc-skills b/bin/opc-skills index ba973ba..88e71f7 100755 --- a/bin/opc-skills +++ b/bin/opc-skills @@ -395,6 +395,56 @@ cmd_disable_all() { echo "done." } +# enable every parked skill into selected target(s) — symmetric to disable-all +# usage: cmd_enable_all [--target T] [-y|--yes] +# Idempotent: skips skills already active in a target. +cmd_enable_all() { + parse_target_flag "$@" + set -- "${REMAINING_ARGS[@]}" + require_dirs + local force=0 + if [ "${1:-}" = "-y" ] || [ "${1:-}" = "--yes" ]; then + force=1 + fi + IFS=',' read -ra tgts <<< "$PARSED_TARGETS" + # For each target, list parked skills NOT already active there + local -A pending=() + local -a parked_list + mapfile -t parked_list < <(skill_dirs_in "$PARKED") + local total=0 t + for t in "${tgts[@]}"; do + local base; base=$(target_dir "$t") + local n + for n in "${parked_list[@]}"; do + [ -z "$n" ] && continue + if [ ! -d "$base/$n" ]; then + pending["$t:$n"]=1 + total=$((total+1)) + fi + done + done + [ "$total" -gt 0 ] || { echo "all parked skills already active in [${tgts[*]}]"; exit 0; } + echo "Will enable $total (target:skill) entries from parked → active in [${tgts[*]}]:" + echo "(${#parked_list[@]} parked × ${#tgts[@]} targets, minus already-active)" + if [ "$force" -ne 1 ]; then + printf "Proceed? [y/N] " + read -r ans copy parked → active in selected targets disable [--target T] remove from active in selected targets (parked kept) + enable-all [--target T] [-y|--yes] enable every parked skill into selected targets + (idempotent — skips already-active; useful as restore-from-archive) disable-all [--target T] [-y|--yes] disable every active skill across targets Bulk by axis (default: opencode+claude): @@ -775,6 +827,7 @@ main() { tags) cmd_tags "$@" ;; enable) cmd_enable "$@" ;; disable) cmd_disable "$@" ;; + enable-all) cmd_enable_all "$@" ;; disable-all) cmd_disable_all "$@" ;; enable-category|enable-cat) cmd_enable_category "$@" ;; disable-category|disable-cat) cmd_disable_category "$@" ;;