Преглед на файлове

fix(mac-ops): health-audit --days parsing

`for arg in "$@"; do shift` doesn't update the iteration variable, so
`DAYS="${1:-30}"` after `shift` was reading the next $1 from the still-
populated argv at that point — which happened to be the literal string
"--days" rather than the intended numeric value.

Result: section labels printed "(--days days)" instead of "(N days)".

Refactored to a `while [[ $# -gt 0 ]]` loop that correctly handles the
two-token `--days N` form. Stash + restore via `SAVED_ARGS` keeps
downstream parse_common_flags / maybe_filter_self working unchanged.

Caught by dogfooding quickrun.sh end-to-end.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0xDarkMatter преди 2 седмици
родител
ревизия
50a1fe9c58
променени са 3 файла, в които са добавени 13 реда и са изтрити 5 реда
  1. 1 1
      .claude-plugin/plugin.json
  2. 3 0
      README.md
  3. 9 4
      skills/mac-ops/scripts/health-audit.sh

+ 1 - 1
.claude-plugin/plugin.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "claude-mods",
   "name": "claude-mods",
-  "version": "2.7.7",
+  "version": "2.7.8",
   "description": "Custom commands, skills, and agents for Claude Code - session continuity, 23 expert agents, 78 skills, 2 commands, 6 rules, 4 hooks, 13 output styles, modern CLI tools",
   "description": "Custom commands, skills, and agents for Claude Code - session continuity, 23 expert agents, 78 skills, 2 commands, 6 rules, 4 hooks, 13 output styles, modern CLI tools",
   "author": "0xDarkMatter",
   "author": "0xDarkMatter",
   "repository": "https://github.com/0xDarkMatter/claude-mods",
   "repository": "https://github.com/0xDarkMatter/claude-mods",

Файловите разлики са ограничени, защото са твърде много
+ 3 - 0
README.md


+ 9 - 4
skills/mac-ops/scripts/health-audit.sh

@@ -13,10 +13,12 @@ set -u
 
 
 DAYS=30
 DAYS=30
 
 
-for arg in "$@"; do
-    case "$arg" in
-        --days) shift; DAYS="${1:-30}" ;;
-        --days=*) DAYS="${arg#--days=}" ;;
+# Use a while loop instead of for-arg-in to correctly handle --days N (two tokens)
+SAVED_ARGS=("$@")
+while [[ $# -gt 0 ]]; do
+    case "$1" in
+        --days) DAYS="${2:-30}"; shift 2 ;;
+        --days=*) DAYS="${1#--days=}"; shift ;;
         --help|-h)
         --help|-h)
             cat <<EOF
             cat <<EOF
 Usage: $0 [options]
 Usage: $0 [options]
@@ -34,8 +36,11 @@ Exit codes (reflect whether the audit RAN, not what it found):
   5  precondition missing
   5  precondition missing
 EOF
 EOF
             exit 0 ;;
             exit 0 ;;
+        *) shift ;;
     esac
     esac
 done
 done
+# Restore $@ for downstream parse_common_flags / maybe_filter_self
+set -- ${SAVED_ARGS[@]+"${SAVED_ARGS[@]}"}
 
 
 source "$(dirname "$0")/_lib/common.sh"
 source "$(dirname "$0")/_lib/common.sh"
 parse_common_flags "$@"
 parse_common_flags "$@"