From 7587c02a9fa8f3fd36350c4e31e03a4ce33789c9 Mon Sep 17 00:00:00 2001 From: salva Date: Fri, 1 May 2026 00:23:21 +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 agent into selected target(s) from THAT target's parked source (format-aware). Idempotent — skips already-active. usage: opc-agents enable-all [--target T] [-y|--yes] --- bin/opc-agents | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/bin/opc-agents b/bin/opc-agents index dad8d4e..cf078b0 100755 --- a/bin/opc-agents +++ b/bin/opc-agents @@ -328,6 +328,51 @@ cmd_disable_all() { done } +# enable every parked agent into selected target(s) — symmetric to disable-all +# usage: cmd_enable_all [--target T] [-y|--yes] +# Per-target: only reads from THAT target's parked source (format-aware). +# Idempotent: skips agents already active. +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" + local -a pairs=() + local t pdir adir n + for t in "${tgts[@]}"; do + pdir=$(target_parked "$t") || continue + adir=$(target_active "$t") || continue + while IFS= read -r n; do + [ -z "$n" ] && continue + [ -f "$adir/$n.md" ] && continue # already active + pairs+=("$t:$n") + done < <(agent_names_in "$pdir") + done + [ "${#pairs[@]}" -gt 0 ] || { echo "all parked agents already active in [${tgts[*]}]"; exit 0; } + echo "Will enable ${#pairs[@]} (target:agent) entries:" + printf ' %s\n' "${pairs[@]:0:20}" + [ "${#pairs[@]}" -gt 20 ] && echo " ... and $((${#pairs[@]} - 20)) more" + 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 + enable-all [--target T] [-y|--yes] enable every parked agent into selected targets + (idempotent — restore-from-archive helper) disable-all [--target T] [-y|--yes] [--keep-primary] disable every active agent across targets enable-category fzf multi-pick within a base-persona prefix, then enable @@ -682,6 +729,7 @@ main() { variants|vars) cmd_variants "$@" ;; 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 "$@" ;;