@clipboard-health/ai-rules 2.14.3 → 2.14.4

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/scripts/setup.sh +35 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clipboard-health/ai-rules",
3
- "version": "2.14.3",
3
+ "version": "2.14.4",
4
4
  "description": "Pre-built AI agent rules for consistent coding standards.",
5
5
  "keywords": [
6
6
  "ai",
package/scripts/setup.sh CHANGED
@@ -115,6 +115,40 @@ persist_claude_env() {
115
115
  }
116
116
  persist_claude_env
117
117
 
118
+ # npm auth for private installs is often injected by a shell wrapper. This
119
+ # Bash script does not inherit interactive aliases/functions, so bridge
120
+ # install-like commands explicitly when NPM_TOKEN is absent.
121
+ run_npm() {
122
+ local npm_args=("$@")
123
+
124
+ if [ -n "${NPM_TOKEN:-}" ]; then
125
+ npm "${npm_args[@]}"
126
+ return
127
+ fi
128
+
129
+ if command -v op >/dev/null 2>&1 && [ -f "$HOME/.1password.env" ]; then
130
+ echo "NPM_TOKEN not set; running npm ${npm_args[*]} via 1Password env"
131
+ if op run --env-file="$HOME/.1password.env" -- npm "${npm_args[@]}"; then
132
+ return
133
+ fi
134
+ echo "1Password env execution failed; trying other npm fallbacks" >&2
135
+ fi
136
+
137
+ local user_shell="${SHELL:-}"
138
+ local shell_name="${user_shell##*/}"
139
+ case "$shell_name" in
140
+ bash|zsh)
141
+ if "$user_shell" -ic 'alias npm >/dev/null 2>&1 || typeset -f npm >/dev/null 2>&1'; then
142
+ echo "NPM_TOKEN not set; running npm ${npm_args[*]} via interactive $shell_name shell"
143
+ "$user_shell" -ic 'npm "$@"' shell "${npm_args[@]}"
144
+ return
145
+ fi
146
+ ;;
147
+ esac
148
+
149
+ npm "${npm_args[@]}"
150
+ }
151
+
118
152
  actual_node="$(node -v | sed 's/^v//')"
119
153
  actual_npm="$(npm -v)"
120
154
 
@@ -174,6 +208,6 @@ fi
174
208
  if [ "$need_install" -eq 0 ]; then
175
209
  echo "Dependencies unchanged for $(basename "$repo_root"), skipping npm ci"
176
210
  else
177
- npm ci
211
+ run_npm ci
178
212
  printf '%s\n' "$dep_key" > "$stamp_file"
179
213
  fi