pumuki-ast-hooks 5.5.18 → 5.5.20

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/bin/session-loader.sh +111 -13
  2. package/package.json +1 -3
@@ -1,25 +1,123 @@
1
1
  #!/bin/bash
2
- # AST Session Loader
3
- # Runs on IDE startup to initialize AST hooks and check tokens
2
+ # AST Session Loader v5.5.20
3
+ # Runs on IDE startup to initialize AST hooks, show context and check tokens
4
4
  REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || echo ".")
5
5
 
6
- # Run token tracker to warn about approaching limits
6
+ # Colors
7
+ BLUE='\033[0;34m'
8
+ CYAN='\033[0;36m'
9
+ GREEN='\033[0;32m'
10
+ YELLOW='\033[1;33m'
11
+ MAGENTA='\033[0;35m'
12
+ NC='\033[0m'
13
+
14
+ # Files
15
+ EVIDENCE_FILE="$REPO_ROOT/.AI_EVIDENCE.json"
16
+ SESSION_FILE="$REPO_ROOT/.AI_SESSION_START.md"
17
+ TOKEN_STATUS="$REPO_ROOT/.audit_tmp/token-status.txt"
18
+ VIOLATIONS_REPORT="$REPO_ROOT/.audit_tmp/intelligent-report.txt"
19
+
20
+ # Run token tracker first
7
21
  TOKEN_TRACKER="$REPO_ROOT/scripts/hooks-system/infrastructure/watchdog/token-tracker.sh"
8
22
  if [ -f "$TOKEN_TRACKER" ]; then
9
23
  bash "$TOKEN_TRACKER"
10
24
  fi
11
25
 
12
- # Display AST hooks status
13
- echo "🚀 AST Intelligence Hooks v5.5.18"
14
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
26
+ # Banner
15
27
  echo ""
16
- echo "✅ AST Hooks loaded successfully"
17
- echo "📁 Repository: $REPO_ROOT"
18
- echo "🤖 AI Gate: Active"
19
- echo "🔍 Evidence Monitoring: Active"
28
+ echo -e "${BLUE}╔══════════════════════════════════════════════════════════╗${NC}"
29
+ echo -e "${BLUE}║ 🤖 AST Intelligence Hooks v5.5.20 ║${NC}"
30
+ echo -e "${BLUE}║ Workspace Opened - Loading Context... ║${NC}"
31
+ echo -e "${BLUE}╚══════════════════════════════════════════════════════════╝${NC}"
32
+ echo ""
33
+
34
+ # Current branch
35
+ CURRENT_BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
36
+ echo -e "${CYAN}📍 Current Branch: ${MAGENTA}$CURRENT_BRANCH${NC}"
20
37
  echo ""
21
- echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
38
+
39
+ # Recent commits
40
+ echo -e "${CYAN}📝 Recent Commits:${NC}"
41
+ git log --oneline -3 2>/dev/null | sed 's/^/ /' || echo " No commits yet"
22
42
  echo ""
23
- echo "💡 Tip: Run 'ai-start' to initialize AI context for your current branch"
24
- echo "💡 Tip: Run 'bash scripts/hooks-system/infrastructure/shell/orchestrators/audit-orchestrator.sh' for full audit"
43
+
44
+ # Session context from evidence
45
+ if [[ -f "$EVIDENCE_FILE" ]]; then
46
+ CURRENT_SESSION_ID=$(jq -r '.session_id // empty' "$EVIDENCE_FILE" 2>/dev/null || echo "")
47
+ CURRENT_ACTION=$(jq -r '.action // empty' "$EVIDENCE_FILE" 2>/dev/null || echo "")
48
+ if [[ -n "$CURRENT_SESSION_ID" && "$CURRENT_SESSION_ID" != "null" ]]; then
49
+ echo -e "${CYAN}📖 Session Context:${NC}"
50
+ if [[ -n "$CURRENT_ACTION" && "$CURRENT_ACTION" != "null" ]]; then
51
+ echo " Session: $CURRENT_SESSION_ID - $CURRENT_ACTION"
52
+ else
53
+ echo " Session: $CURRENT_SESSION_ID"
54
+ fi
55
+ echo ""
56
+ fi
57
+ fi
58
+
59
+ # Top violations from last audit
60
+ if [[ -f "$VIOLATIONS_REPORT" ]]; then
61
+ echo -e "${CYAN}🎯 Top Violations (last audit):${NC}"
62
+ grep -E "CRITICAL|HIGH|MEDIUM|LOW" "$VIOLATIONS_REPORT" 2>/dev/null | head -5 | sed 's/^/ /' || echo " No violations found"
63
+ echo ""
64
+ elif [[ -f "$REPO_ROOT/.audit_tmp/ast-summary.json" ]]; then
65
+ echo -e "${CYAN}🎯 Violations Summary:${NC}"
66
+ CRITICAL=$(jq -r '.levels.CRITICAL // 0' "$REPO_ROOT/.audit_tmp/ast-summary.json" 2>/dev/null || echo "0")
67
+ HIGH=$(jq -r '.levels.HIGH // 0' "$REPO_ROOT/.audit_tmp/ast-summary.json" 2>/dev/null || echo "0")
68
+ MEDIUM=$(jq -r '.levels.MEDIUM // 0' "$REPO_ROOT/.audit_tmp/ast-summary.json" 2>/dev/null || echo "0")
69
+ LOW=$(jq -r '.levels.LOW // 0' "$REPO_ROOT/.audit_tmp/ast-summary.json" 2>/dev/null || echo "0")
70
+ echo " 🔴 CRITICAL: $CRITICAL 🟠 HIGH: $HIGH 🟡 MEDIUM: $MEDIUM 🔵 LOW: $LOW"
71
+ echo ""
72
+ fi
73
+
74
+ # Evidence freshness check
75
+ AGE=0
76
+ if [[ -f "$EVIDENCE_FILE" ]]; then
77
+ EVIDENCE_TS=$(jq -r '.timestamp' "$EVIDENCE_FILE" 2>/dev/null || echo "")
78
+ if [[ -n "$EVIDENCE_TS" ]] && [[ "$EVIDENCE_TS" != "null" ]]; then
79
+ # Parse ISO 8601 with timezone (e.g., 2026-01-04T08:12:13.372+01:00)
80
+ # Remove milliseconds and convert to epoch
81
+ CLEAN_TS=$(echo "$EVIDENCE_TS" | sed -E 's/\.[0-9]+([+-][0-9]{2}:[0-9]{2}|Z)$/\1/')
82
+
83
+ # Try parsing with timezone offset format
84
+ if [[ "$CLEAN_TS" =~ \+[0-9]{2}:[0-9]{2}$ ]] || [[ "$CLEAN_TS" =~ -[0-9]{2}:[0-9]{2}$ ]]; then
85
+ # Convert to UTC by using Python (more reliable for timezone parsing)
86
+ EVIDENCE_EPOCH=$(python3 -c "from datetime import datetime; import sys; dt = datetime.fromisoformat('$CLEAN_TS'); print(int(dt.timestamp()))" 2>/dev/null || echo "0")
87
+ elif [[ "$CLEAN_TS" =~ Z$ ]]; then
88
+ # UTC format
89
+ EVIDENCE_EPOCH=$(date -j -f "%Y-%m-%dT%H:%M:%SZ" "$CLEAN_TS" +%s 2>/dev/null || echo "0")
90
+ else
91
+ EVIDENCE_EPOCH=0
92
+ fi
93
+
94
+ if [[ "$EVIDENCE_EPOCH" != "0" ]]; then
95
+ NOW_EPOCH=$(date +%s)
96
+ AGE=$((NOW_EPOCH - EVIDENCE_EPOCH))
97
+
98
+ if [[ $AGE -gt 180 ]]; then
99
+ echo -e "${YELLOW}⚠️ Evidence is stale (${AGE}s old, max 3min)${NC}"
100
+ echo -e "${YELLOW} Run: ai-start${NC}"
101
+ else
102
+ echo -e "${GREEN}✅ Evidence fresh (${AGE}s old)${NC}"
103
+ fi
104
+ echo ""
105
+ fi
106
+ fi
107
+ fi
108
+
109
+ # Quick commands
110
+ echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
111
+ echo -e "${CYAN}🚀 Quick Commands:${NC}"
112
+ echo " ai-start → Update evidence & start work"
113
+ echo " bash scripts/hooks-system/infrastructure/shell/orchestrators/audit-orchestrator.sh → Full audit"
114
+ echo -e "${BLUE}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
115
+ echo ""
116
+
117
+ # Final status
118
+ if [[ $AGE -gt 180 ]]; then
119
+ echo -e "${YELLOW}⚠️ Run 'ai-start' to refresh evidence before working${NC}"
120
+ else
121
+ echo -e "${GREEN}✅ Session loaded - Ready to work!${NC}"
122
+ fi
25
123
  echo ""
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pumuki-ast-hooks",
3
- "version": "5.5.18",
3
+ "version": "5.5.20",
4
4
  "description": "Enterprise-grade AST Intelligence System with multi-platform support (iOS, Android, Backend, Frontend) and Feature-First + DDD + Clean Architecture enforcement. Includes dynamic violations API for intelligent querying.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -92,12 +92,10 @@
92
92
  "@babel/generator": "^7.28.5",
93
93
  "@babel/parser": "^7.28.5",
94
94
  "@babel/traverse": "^7.28.5",
95
- "@pumuki/ast-intelligence-hooks": "file:pumuki-ast-intelligence-hooks-5.3.1.tgz",
96
95
  "@types/node": "^20.10.0",
97
96
  "eslint": "^9.12.0",
98
97
  "jest": "^30.2.0",
99
98
  "jscodeshift": "^17.3.0",
100
- "pumuki-ast-hooks": "^5.5.17",
101
99
  "recast": "^0.23.11",
102
100
  "typescript": "^5.3.0"
103
101
  },