@miller-tech/uap 1.36.0 → 1.36.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miller-tech/uap",
3
- "version": "1.36.0",
3
+ "version": "1.36.1",
4
4
  "description": "Autonomous AI agent memory system with CLAUDE.md protocol enforcement",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -277,25 +277,49 @@ EOF
277
277
  chmod +x "${HOOKS_DIR}/commit-msg"
278
278
  echo " ✓ Created commit-msg hook"
279
279
 
280
- # Pre-push hook - runs tests before pushing
280
+ # Pre-push hook - enforces build/test/type-check gates before pushing
281
281
  cat > "${HOOKS_DIR}/pre-push" << 'EOF'
282
- #!/bin/bash
283
- #
284
- # UAP Pre-push Hook
285
- #
286
- # Runs tests before pushing to remote
287
- #
282
+ #!/usr/bin/env bash
283
+ # UAP Pre-Push Hook — Enforces build, test, type-check gates before push
284
+ set -euo pipefail
288
285
 
289
- echo "Running tests before push..."
290
- if npm test 2>&1 | tail -5; then
291
- if [ ${PIPESTATUS[0]} -eq 0 ]; then
292
- echo "✓ All tests passed"
293
- exit 0
286
+ RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[0;33m'; NC='\033[0m'
287
+ fail() { echo -e "${RED}[PRE-PUSH] BLOCKED: $1${NC}"; exit 1; }
288
+ ok() { echo -e "${GREEN}[PRE-PUSH] $1${NC}"; }
289
+
290
+ # git exports repo-context vars into hook environments; anything this hook
291
+ # spawns (npm test → enforcers/tests that run their own git) would then
292
+ # operate on THIS repo instead of its own cwd. Sanitize before the gates.
293
+ unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_COMMON_DIR GIT_OBJECT_DIRECTORY GIT_PREFIX
294
+
295
+ ROOT_DIR="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
296
+ cd "$ROOT_DIR"
297
+
298
+ while read local_ref local_sha remote_ref remote_sha; do
299
+ REMOTE_BRANCH=$(echo "$remote_ref" | sed 's@refs/heads/@@')
300
+ if [[ "$REMOTE_BRANCH" == "main" || "$REMOTE_BRANCH" == "master" ]]; then
301
+ if [[ "$remote_sha" != "0000000000000000000000000000000000000000" ]]; then
302
+ IS_ANCESTOR=$(git merge-base --is-ancestor "$remote_sha" "$local_sha" 2>/dev/null && echo "yes" || echo "no")
303
+ if [[ "$IS_ANCESTOR" == "no" ]]; then
304
+ fail "Force push to '$REMOTE_BRANCH' is prohibited."
305
+ fi
294
306
  fi
295
- fi
307
+ fi
308
+ done
309
+
310
+ echo -e "${YELLOW}[PRE-PUSH] Running type check...${NC}"
311
+ npx tsc --noEmit 2>&1 || fail "TypeScript type-check failed."
312
+ ok "Type check passed"
313
+
314
+ echo -e "${YELLOW}[PRE-PUSH] Running build...${NC}"
315
+ npm run build 2>&1 || fail "Build failed."
316
+ ok "Build passed"
317
+
318
+ echo -e "${YELLOW}[PRE-PUSH] Running tests...${NC}"
319
+ npm test -- --run 2>&1 || fail "Tests failed."
320
+ ok "Tests passed"
296
321
 
297
- echo "Error: Tests failed. Fix tests before pushing."
298
- exit 1
322
+ ok "All pre-push gates passed"
299
323
  EOF
300
324
  chmod +x "${HOOKS_DIR}/pre-push"
301
325
  echo " ✓ Created pre-push hook"