pumuki-ast-hooks 5.5.19 → 5.5.21

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/README.md CHANGED
@@ -1065,6 +1065,21 @@ For coding standards, see [CODE_STANDARDS.md](./docs/CODE_STANDARDS.md).
1065
1065
 
1066
1066
  ## 📝 Recent Changes
1067
1067
 
1068
+ ### Version 5.5.20 (2026-01-04)
1069
+
1070
+ **🐛 Bug Fixes:**
1071
+ - Restored comprehensive session context report on IDE startup
1072
+ - Fixed evidence age calculation for ISO 8601 timestamps with timezone offsets
1073
+ - Removed `exec "$SHELL"` that caused infinite loop on macOS
1074
+ - Added Python-based timestamp parsing for reliable timezone conversion
1075
+
1076
+ **🔧 Improvements:**
1077
+ - Session loader now displays branch, recent commits, session context, violations summary, and evidence freshness
1078
+ - Added quick commands section for user convenience
1079
+ - Violations summary now reads from `ast-summary.json` with severity breakdown
1080
+
1081
+ ---
1082
+
1068
1083
  ### Version 5.5.16 (2026-01-04)
1069
1084
 
1070
1085
  **✨ New Features:**
@@ -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 ""
@@ -1,3 +1,62 @@
1
+ # Release Notes - v5.5.20
2
+
3
+ **Release Date**: January 4, 2026
4
+ **Type**: Patch Release
5
+ **Compatibility**: Fully backward compatible with 5.5.x
6
+
7
+ ---
8
+
9
+ ## 🎯 Overview
10
+
11
+ This release restores the comprehensive session context report on IDE startup and fixes critical bugs in the session loader, including infinite loop prevention and correct timestamp parsing for evidence freshness checks.
12
+
13
+ ---
14
+
15
+ ## 🐛 Bug Fixes
16
+
17
+ ### Fixed: Session loader infinite loop on macOS
18
+ - **Issue**: `exec "$SHELL"` at the end of session-loader.sh caused fork resource exhaustion
19
+ - **Resolution**: Removed shell exec, script now completes without forking
20
+ - **Impact**: IDE startup no longer hangs or creates zombie processes
21
+
22
+ ### Fixed: Evidence age calculation showing incorrect values
23
+ - **Issue**: ISO 8601 timestamps with timezone offsets (e.g., `2026-01-04T08:12:13.372+01:00`) were parsed incorrectly, showing millions of seconds
24
+ - **Resolution**: Added Python-based timestamp parsing using `datetime.fromisoformat()` for reliable timezone conversion
25
+ - **Impact**: Evidence freshness check now displays correct age in seconds
26
+
27
+ ### Fixed: Session loader showing minimal context
28
+ - **Issue**: Session loader was simplified to basic status only, losing branch info, commits, violations summary
29
+ - **Resolution**: Restored full context report with branch, recent commits, session context, violations summary, and evidence freshness
30
+ - **Impact**: Users now see complete project context on IDE startup
31
+
32
+ ---
33
+
34
+ ## 🔧 Improvements
35
+
36
+ ### Enhanced Session Loader Output
37
+ - Displays current branch with color coding
38
+ - Shows last 3 commits with one-line format
39
+ - Reads session context from `.AI_EVIDENCE.json`
40
+ - Shows violations summary from `ast-summary.json` with severity breakdown (CRITICAL/HIGH/MEDIUM/LOW)
41
+ - Displays evidence freshness with correct age calculation
42
+ - Added quick commands section for common actions
43
+
44
+ ### Technical Details
45
+ - Evidence timestamps with timezone offsets now correctly parsed
46
+ - Session loader no longer forks shell process
47
+ - All session information displayed in a single, organized banner
48
+ - Violations summary reads from JSON report for accurate counts
49
+
50
+ ---
51
+
52
+ ## 📦 Installation / Upgrade
53
+ ```bash
54
+ npm install --save-dev pumuki-ast-hooks@5.5.20
55
+ npm run install-hooks
56
+ ```
57
+
58
+ ---
59
+
1
60
  # Release Notes - v5.3.15
2
61
 
3
62
  **Release Date**: December 30, 2025
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pumuki-ast-hooks",
3
- "version": "5.5.19",
3
+ "version": "5.5.21",
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": {
@@ -54,6 +54,9 @@ class FileSystemInstallerService {
54
54
  if (fs.existsSync(source)) {
55
55
  if (item === 'infrastructure/') {
56
56
  this.copyRecursiveExcluding(source, dest, ['scripts']);
57
+ } else if (item === 'bin/') {
58
+ // Exclude wrapper scripts that would cause fork bombs
59
+ this.copyRecursiveExcluding(source, dest, ['session-loader.sh', 'cli.js', 'install.js']);
57
60
  } else {
58
61
  this.copyRecursive(source, dest);
59
62
  }