pumuki-ast-hooks 5.5.30 → 5.5.31
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": "pumuki-ast-hooks",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.31",
|
|
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": {
|
|
@@ -79,12 +79,19 @@ class GitEnvironmentService {
|
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
// Install pre-commit hook
|
|
82
83
|
const preCommitHook = this.getPreCommitHookContent();
|
|
83
84
|
const preCommitPath = path.join(gitHooksDir, 'pre-commit');
|
|
84
|
-
|
|
85
85
|
fs.writeFileSync(preCommitPath, preCommitHook);
|
|
86
86
|
fs.chmodSync(preCommitPath, '755');
|
|
87
87
|
this.logSuccess(' ✅ Installed pre-commit hook');
|
|
88
|
+
|
|
89
|
+
// Install pre-push hook (Git Flow enforcement)
|
|
90
|
+
const prePushHook = this.getPrePushHookContent();
|
|
91
|
+
const prePushPath = path.join(gitHooksDir, 'pre-push');
|
|
92
|
+
fs.writeFileSync(prePushPath, prePushHook);
|
|
93
|
+
fs.chmodSync(prePushPath, '755');
|
|
94
|
+
this.logSuccess(' ✅ Installed pre-push hook (Git Flow enforcement)');
|
|
88
95
|
}
|
|
89
96
|
|
|
90
97
|
getPreCommitHookContent() {
|
|
@@ -146,6 +153,107 @@ fi
|
|
|
146
153
|
|
|
147
154
|
# Fallback: direct execution logic here...
|
|
148
155
|
echo "⚠️ ast-intelligence-hooks not found"
|
|
156
|
+
exit 0
|
|
157
|
+
`;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
getPrePushHookContent() {
|
|
161
|
+
return `#!/bin/bash
|
|
162
|
+
# AST Intelligence Hooks - Pre-push (Git Flow Enforcement)
|
|
163
|
+
# Auto-generated by pumuki-ast-hooks v${this.version}
|
|
164
|
+
|
|
165
|
+
# Check for bypass
|
|
166
|
+
if [[ -n "\${GIT_BYPASS_HOOK}" ]]; then
|
|
167
|
+
echo "⚠️ Bypassing Git Flow enforcement (GIT_BYPASS_HOOK=1)"
|
|
168
|
+
exit 0
|
|
169
|
+
fi
|
|
170
|
+
|
|
171
|
+
# Change to project root
|
|
172
|
+
cd "$(git rev-parse --show-toplevel)" || exit 1
|
|
173
|
+
|
|
174
|
+
# Check if we're pushing only tags (read from stdin)
|
|
175
|
+
while read local_ref local_sha remote_ref remote_sha; do
|
|
176
|
+
# If pushing a tag (refs/tags/*), allow it
|
|
177
|
+
if [[ "$local_ref" =~ ^refs/tags/ ]]; then
|
|
178
|
+
echo ""
|
|
179
|
+
echo "✅ Tag push detected - allowing release workflow"
|
|
180
|
+
echo ""
|
|
181
|
+
exit 0
|
|
182
|
+
fi
|
|
183
|
+
done
|
|
184
|
+
|
|
185
|
+
echo ""
|
|
186
|
+
echo "🔍 Validating Git Flow compliance before push..."
|
|
187
|
+
echo ""
|
|
188
|
+
|
|
189
|
+
# Get current branch
|
|
190
|
+
CURRENT_BRANCH=$(git branch --show-current 2>/dev/null || echo "")
|
|
191
|
+
|
|
192
|
+
if [[ -z "$CURRENT_BRANCH" ]]; then
|
|
193
|
+
echo "❌ Detached HEAD - cannot validate Git Flow"
|
|
194
|
+
exit 1
|
|
195
|
+
fi
|
|
196
|
+
|
|
197
|
+
# Protected branches - cannot push directly
|
|
198
|
+
PROTECTED_BRANCHES=("main" "master" "develop")
|
|
199
|
+
for protected in "\${PROTECTED_BRANCHES[@]}"; do
|
|
200
|
+
if [[ "$CURRENT_BRANCH" == "$protected" ]]; then
|
|
201
|
+
echo "❌ Cannot push directly to protected branch: $CURRENT_BRANCH"
|
|
202
|
+
echo ""
|
|
203
|
+
echo "Create a feature branch instead:"
|
|
204
|
+
echo " git checkout -b feature/my-feature"
|
|
205
|
+
echo ""
|
|
206
|
+
exit 1
|
|
207
|
+
fi
|
|
208
|
+
done
|
|
209
|
+
|
|
210
|
+
# Validate branch naming convention
|
|
211
|
+
if [[ ! "$CURRENT_BRANCH" =~ ^(feature|fix|hotfix|chore|docs|refactor|test|ci)/ ]]; then
|
|
212
|
+
echo "⚠️ Branch name '$CURRENT_BRANCH' doesn't follow Git Flow convention"
|
|
213
|
+
echo ""
|
|
214
|
+
echo "Expected patterns:"
|
|
215
|
+
echo " feature/description"
|
|
216
|
+
echo " fix/description"
|
|
217
|
+
echo " hotfix/description"
|
|
218
|
+
echo " chore/description"
|
|
219
|
+
echo ""
|
|
220
|
+
echo "This is a WARNING - push will continue"
|
|
221
|
+
echo ""
|
|
222
|
+
fi
|
|
223
|
+
|
|
224
|
+
# Check evidence freshness (optional - warn only)
|
|
225
|
+
EVIDENCE_FILE=".AI_EVIDENCE.json"
|
|
226
|
+
if [[ -f "$EVIDENCE_FILE" ]]; then
|
|
227
|
+
EVIDENCE_TS=$(jq -r '.timestamp // .severity_metrics.last_updated // empty' "$EVIDENCE_FILE" 2>/dev/null || echo "")
|
|
228
|
+
if [[ -n "$EVIDENCE_TS" ]]; then
|
|
229
|
+
# Parse timestamp and check age
|
|
230
|
+
CLEAN_TS=$(echo "$EVIDENCE_TS" | sed 's/\\.[0-9]*Z$/Z/')
|
|
231
|
+
EVIDENCE_EPOCH=$(date -j -f "%Y-%m-%dT%H:%M:%SZ" "$CLEAN_TS" +%s 2>/dev/null || echo "0")
|
|
232
|
+
NOW_EPOCH=$(date +%s)
|
|
233
|
+
AGE=$((NOW_EPOCH - EVIDENCE_EPOCH))
|
|
234
|
+
|
|
235
|
+
if [[ $AGE -gt 300 ]]; then
|
|
236
|
+
echo "⚠️ Evidence is stale (\${AGE}s old, recommended <5min)"
|
|
237
|
+
echo " Consider running: npm run ast:refresh"
|
|
238
|
+
echo ""
|
|
239
|
+
fi
|
|
240
|
+
fi
|
|
241
|
+
fi
|
|
242
|
+
|
|
243
|
+
# Run gitflow-enforcer if available (optional validation)
|
|
244
|
+
ENFORCER_SCRIPT="scripts/hooks-system/infrastructure/shell/gitflow/gitflow-enforcer.sh"
|
|
245
|
+
if [[ -f "$ENFORCER_SCRIPT" ]]; then
|
|
246
|
+
if ! bash "$ENFORCER_SCRIPT" check 2>/dev/null; then
|
|
247
|
+
echo ""
|
|
248
|
+
echo "⚠️ Git Flow check completed with warnings (non-blocking)"
|
|
249
|
+
echo ""
|
|
250
|
+
fi
|
|
251
|
+
fi
|
|
252
|
+
|
|
253
|
+
echo ""
|
|
254
|
+
echo "✅ Git Flow validation passed. Proceeding with push..."
|
|
255
|
+
echo ""
|
|
256
|
+
|
|
149
257
|
exit 0
|
|
150
258
|
`;
|
|
151
259
|
}
|