sentix 2.0.1 → 2.0.2

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.
@@ -0,0 +1,169 @@
1
+ #!/usr/bin/env bash
2
+ # ── sentix framework updater ──────────────────────────────────
3
+ # 하위 프로젝트에서 sentix 프레임워크 파일을 최신화하는 독립 스크립트.
4
+ # sentix 버전에 의존하지 않으므로 구형 설치 환경에서도 동작한다.
5
+ #
6
+ # 사용법 (하위 프로젝트 루트에서):
7
+ # curl -sL https://raw.githubusercontent.com/kgg1226/sentix/main/scripts/update-downstream.sh | bash
8
+ # curl -sL ... | bash -s -- --dry # 미리보기만
9
+ #
10
+ # 또는 Claude Code 세션에서:
11
+ # "sentix 프레임워크 최신화해줘"
12
+
13
+ set -euo pipefail
14
+
15
+ SENTIX_REPO="kgg1226/sentix"
16
+ SENTIX_BRANCH="main"
17
+ RAW_BASE="https://raw.githubusercontent.com/${SENTIX_REPO}/${SENTIX_BRANCH}"
18
+ API_BASE="https://api.github.com/repos/${SENTIX_REPO}"
19
+
20
+ DRY_RUN=false
21
+ if [[ "${1:-}" == "--dry" ]]; then
22
+ DRY_RUN=true
23
+ fi
24
+
25
+ # 동기화 대상 (프레임워크 공통 파일만)
26
+ SYNC_FILES=(
27
+ ".github/workflows/deploy.yml"
28
+ ".github/workflows/security-scan.yml"
29
+ ".sentix/rules/hard-rules.md"
30
+ "FRAMEWORK.md"
31
+ "docs/governor-sop.md"
32
+ "docs/agent-scopes.md"
33
+ "docs/severity.md"
34
+ "docs/architecture.md"
35
+ )
36
+
37
+ # ── 프로젝트 확인 ──────────────────────────────────────────
38
+ if [[ ! -f ".sentix/config.toml" ]] && [[ ! -f "CLAUDE.md" ]]; then
39
+ echo "✗ This project has not been initialized with sentix."
40
+ echo " Run: npx sentix init"
41
+ exit 1
42
+ fi
43
+
44
+ # ── sentix 최신 버전 확인 ──────────────────────────────────
45
+ echo "=== Sentix Framework Updater ==="
46
+ echo ""
47
+
48
+ REMOTE_VERSION=$(curl -sf "${RAW_BASE}/package.json" 2>/dev/null | grep '"version"' | head -1 | sed 's/.*: *"//;s/".*//')
49
+ if [[ -z "$REMOTE_VERSION" ]]; then
50
+ echo "✗ Cannot reach sentix repository. Check network connection."
51
+ exit 1
52
+ fi
53
+ echo "Remote sentix version: v${REMOTE_VERSION}"
54
+
55
+ LOCAL_VERSION="unknown"
56
+ if [[ -f ".sentix/config.toml" ]]; then
57
+ LOCAL_VERSION=$(grep 'version' .sentix/config.toml | head -1 | sed 's/.*= *"//;s/".*//')
58
+ fi
59
+ echo "Local framework version: v${LOCAL_VERSION}"
60
+
61
+ # ── 최신 커밋 정보 (변경 내역 고지용) ──────────────────────
62
+ echo ""
63
+ echo "=== Recent Changes ==="
64
+ COMMITS=$(curl -sf "${API_BASE}/commits?path=.github/workflows&sha=${SENTIX_BRANCH}&per_page=5" 2>/dev/null)
65
+ if [[ -n "$COMMITS" ]] && command -v python3 &>/dev/null; then
66
+ echo "$COMMITS" | python3 -c "
67
+ import sys, json
68
+ commits = json.load(sys.stdin)
69
+ for c in commits[:5]:
70
+ sha = c['sha'][:7]
71
+ msg = c['commit']['message'].split('\n')[0][:72]
72
+ date = c['commit']['committer']['date'][:10]
73
+ print(f' {date} {sha} {msg}')
74
+ " 2>/dev/null || echo " (commit log unavailable)"
75
+ else
76
+ echo " (commit log unavailable)"
77
+ fi
78
+
79
+ # ── 파일별 동기화 ──────────────────────────────────────────
80
+ echo ""
81
+ echo "=== File Sync ==="
82
+
83
+ UPDATED=0
84
+ CREATED=0
85
+ UNCHANGED=0
86
+ FAILED=0
87
+
88
+ for FILE in "${SYNC_FILES[@]}"; do
89
+ # 원격 파일 다운로드
90
+ REMOTE_CONTENT=$(curl -sf "${RAW_BASE}/${FILE}" 2>/dev/null) || {
91
+ echo " ⚠ ${FILE} — not found in sentix (skipped)"
92
+ FAILED=$((FAILED + 1))
93
+ continue
94
+ }
95
+
96
+ if [[ -f "$FILE" ]]; then
97
+ LOCAL_CONTENT=$(cat "$FILE")
98
+
99
+ if [[ "$REMOTE_CONTENT" == "$LOCAL_CONTENT" ]]; then
100
+ UNCHANGED=$((UNCHANGED + 1))
101
+ continue
102
+ fi
103
+
104
+ # diff 요약
105
+ LOCAL_LINES=$(echo "$LOCAL_CONTENT" | wc -l)
106
+ REMOTE_LINES=$(echo "$REMOTE_CONTENT" | wc -l)
107
+ DIFF_LINES=$((REMOTE_LINES - LOCAL_LINES))
108
+ DIFF_SIGN="+"
109
+ if [[ $DIFF_LINES -lt 0 ]]; then
110
+ DIFF_SIGN=""
111
+ fi
112
+
113
+ echo " ↻ ${FILE}"
114
+ echo " ${LOCAL_LINES} lines → ${REMOTE_LINES} lines (${DIFF_SIGN}${DIFF_LINES})"
115
+
116
+ # 주요 변경 내용 (diff 가능한 경우)
117
+ if command -v diff &>/dev/null; then
118
+ DIFF_OUTPUT=$(diff <(echo "$LOCAL_CONTENT") <(echo "$REMOTE_CONTENT") | grep "^>" | grep -v "^> *#" | grep -v "^> *$" | head -3)
119
+ if [[ -n "$DIFF_OUTPUT" ]]; then
120
+ echo " New:"
121
+ echo "$DIFF_OUTPUT" | while IFS= read -r line; do
122
+ echo " ${line:0:80}"
123
+ done
124
+ fi
125
+ fi
126
+
127
+ if [[ "$DRY_RUN" == "false" ]]; then
128
+ mkdir -p "$(dirname "$FILE")"
129
+ echo "$REMOTE_CONTENT" > "$FILE"
130
+ echo " ✓ Updated"
131
+ else
132
+ echo " [DRY] Would update"
133
+ fi
134
+ UPDATED=$((UPDATED + 1))
135
+ else
136
+ echo " + ${FILE}"
137
+ if [[ "$DRY_RUN" == "false" ]]; then
138
+ mkdir -p "$(dirname "$FILE")"
139
+ echo "$REMOTE_CONTENT" > "$FILE"
140
+ echo " ✓ Created"
141
+ else
142
+ echo " [DRY] Would create"
143
+ fi
144
+ CREATED=$((CREATED + 1))
145
+ fi
146
+ done
147
+
148
+ # ── 요약 ──────────────────────────────────────────────────
149
+ TOTAL=$((UPDATED + CREATED))
150
+
151
+ echo ""
152
+ echo "=== Summary ==="
153
+ echo " Updated: ${UPDATED}"
154
+ echo " Created: ${CREATED}"
155
+ echo " Unchanged: ${UNCHANGED}"
156
+ [[ $FAILED -gt 0 ]] && echo " Failed: ${FAILED}"
157
+
158
+ echo ""
159
+ if [[ $TOTAL -eq 0 ]]; then
160
+ echo "✓ Already up to date."
161
+ elif [[ "$DRY_RUN" == "true" ]]; then
162
+ echo "⚠ ${TOTAL} file(s) would be changed. Run without --dry to apply."
163
+ else
164
+ echo "✓ ${TOTAL} file(s) updated to sentix v${REMOTE_VERSION}."
165
+ echo ""
166
+ echo "Next steps:"
167
+ echo " git diff # review changes"
168
+ echo " git add -p && git commit # commit selectively"
169
+ fi