@01b/team-kb 0.2.4 → 0.2.5
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,8 +1,10 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
-
# KB pre-commit hook: frontmatter validation + secret detection
|
|
2
|
+
# KB pre-commit hook: frontmatter validation + secret detection + index rebuild
|
|
3
|
+
KB_ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
3
4
|
ERRORS=0
|
|
5
|
+
|
|
4
6
|
for f in $(git diff --cached --name-only --diff-filter=ACM -- '*.md'); do
|
|
5
|
-
case "$f" in .kb/*|templates/*|99-personal/*|00-inbox
|
|
7
|
+
case "$f" in .kb/*|templates/*|99-personal/*|00-inbox/*|README.md) continue;; esac
|
|
6
8
|
|
|
7
9
|
if ! head -1 "$f" | grep -q '^---'; then
|
|
8
10
|
echo "ERROR: $f — frontmatter 없음"; ERRORS=$((ERRORS+1))
|
|
@@ -22,10 +24,19 @@ if command -v gitleaks &> /dev/null; then
|
|
|
22
24
|
echo "ERROR: gitleaks가 민감 정보를 탐지했습니다."; ERRORS=$((ERRORS+1))
|
|
23
25
|
fi
|
|
24
26
|
else
|
|
25
|
-
|
|
27
|
+
STAGED_MD=$(git diff --cached --name-only --diff-filter=ACM -- '*.md')
|
|
28
|
+
if [ -n "$STAGED_MD" ] && echo "$STAGED_MD" | xargs grep -l 'password\|secret\|jdbc:\|api[_-]key\|token=' 2>/dev/null; then
|
|
26
29
|
echo "ERROR: 민감 정보가 포함된 파일이 있습니다."; ERRORS=$((ERRORS+1))
|
|
27
30
|
echo "TIP: brew install gitleaks 로 더 정밀한 탐지를 사용할 수 있습니다."
|
|
28
31
|
fi
|
|
29
32
|
fi
|
|
30
33
|
|
|
31
34
|
if [ $ERRORS -gt 0 ]; then exit 1; fi
|
|
35
|
+
|
|
36
|
+
# Auto-rebuild index if .md files changed
|
|
37
|
+
STAGED_MD=$(git diff --cached --name-only --diff-filter=ACDMR -- '*.md')
|
|
38
|
+
if [ -n "$STAGED_MD" ]; then
|
|
39
|
+
"$KB_ROOT/.kb/scripts/rebuild-index.sh" > /dev/null
|
|
40
|
+
git add "$KB_ROOT/kb-index.json" "$KB_ROOT/.kb-index.local.json" 2>/dev/null
|
|
41
|
+
echo "kb-index 자동 갱신 완료"
|
|
42
|
+
fi
|