Skip to content

Commit 16e693f

Browse files
authored
Merge pull request #54 from majiayu000/feat/guard-message-format-v2
feat(guards): migrate all guard messages to v2 format
2 parents 1f7c8c1 + ef9b11f commit 16e693f

10 files changed

Lines changed: 148 additions & 65 deletions

File tree

guards/go/check_error_handling.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ if [[ "$_USE_GREP_FALLBACK" == true ]]; then
118118
fi
119119

120120
apply_suppression_filter "${TMPFILE}"
121-
cat "${TMPFILE}"
121+
sed 's/^\[GO-01\] /[GO-01] [auto-fix] [this-line] OBSERVATION: /' "${TMPFILE}"
122122
FOUND=$(wc -l < "${TMPFILE}" | tr -d ' ')
123123

124124
echo ""
@@ -127,10 +127,8 @@ if [[ ${FOUND} -eq 0 ]]; then
127127
else
128128
echo "Found ${FOUND} unchecked error return(s)."
129129
echo ""
130-
echo "修复方法:"
131-
echo " 1. _ = fn() → err := fn(); if err != nil { return fmt.Errorf(\"context: %w\", err) }"
132-
echo " 2. 确实不需要错误 → 添加注释说明原因"
133-
echo " 3. defer 场景 → defer func() { _ = f.Close() }() 可接受,但建议记录日志"
130+
echo "SCOPE: this-line only — do not modify function signatures or upstream callers"
131+
echo "ACTION: REVIEW"
134132
if [[ "${STRICT}" == true ]]; then
135133
exit 1
136134
fi

guards/rust/check_unwrap_in_prod.sh

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ else
312312
fi
313313

314314
apply_suppression_filter "${TMPFILE}"
315-
cat "${TMPFILE}"
315+
sed 's/^\[RS-03\] /[RS-03] [review] [this-edit] OBSERVATION: /' "${TMPFILE}"
316316
FOUND=$(wc -l < "${TMPFILE}" | tr -d ' ')
317317

318318
echo ""
@@ -321,12 +321,8 @@ if [[ ${FOUND} -eq 0 ]]; then
321321
else
322322
echo "Found ${FOUND} unwrap()/expect() call(s) in production code."
323323
echo ""
324-
echo "修复方法:"
325-
echo " 1. .unwrap() → .map_err(|e| YourError::from(e))? (向上传播错误)"
326-
echo " 2. .unwrap() → .unwrap_or_default() (提供默认值)"
327-
echo " 3. .unwrap() → .unwrap_or_else(|| fallback()) (延迟计算默认值)"
328-
echo " 4. .expect(\"msg\") → match / if let (自定义处理逻辑)"
329-
echo " 5. main() 中 → 使用 anyhow::Result<()> 配合 ? 操作符"
324+
echo "SCOPE: this-line only — do not fix other unwrap calls, add error types, or change function signatures"
325+
echo "ACTION: REVIEW"
330326
if [[ "${STRICT}" == true ]]; then
331327
exit 1
332328
fi

guards/typescript/check_any_abuse.sh

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ for m in matches:
7777
# 避免仅删除行时 added_set 为空导致回退到全量扫描。
7878
if in_diff_mode and (f + ":" + str(line)) not in added_set:
7979
continue
80-
msg = m.get("message", "any 类型使用")
81-
print("[TS-01] " + f + ":" + str(line) + " " + msg)
80+
msg = m.get("message", "'any' type usage")
81+
print("[TS-01] " + f + ":" + str(line) + " [review] [this-line] OBSERVATION: " + msg)
8282
' < "${_ASG_TMPOUT}" >> "$RESULTS" || {
8383
echo "[TS-01] WARN: python3 处理失败,使用 grep fallback" >&2
8484
_USE_GREP_FALLBACK=true
@@ -106,7 +106,7 @@ if [[ "$_USE_GREP_FALLBACK" == true ]]; then
106106
if [[ "$_IN_DIFF_MODE" == true ]]; then
107107
grep -qxF "${f}:${LINE_NUM}" "$_LINEMAP" 2>/dev/null || continue
108108
fi
109-
echo "[TS-01] ${f}:${LINE_NUM} any 类型使用(grep fallback)"
109+
echo "[TS-01] ${f}:${LINE_NUM} [review] [this-line] OBSERVATION: 'any' type usage"
110110
done
111111
done >> "$RESULTS" || true
112112
fi
@@ -123,7 +123,7 @@ while IFS= read -r file; do
123123
if [[ "$_IN_DIFF_MODE" == true ]]; then
124124
grep -qxF "${file}:${LINE_NUM}" "$_LINEMAP" 2>/dev/null || continue
125125
fi
126-
echo "[TS-02] ${file}:${LINE_NUM} '@ts-ignore' 禁用类型检查。修复:修复类型错误而非忽略" >> "$RESULTS"
126+
echo "[TS-02] ${file}:${LINE_NUM} [review] [this-line] OBSERVATION: uses '@ts-ignore' to suppress type check" >> "$RESULTS"
127127
done < <(grep -n '@ts-ignore' "$file" 2>/dev/null || true)
128128

129129
while IFS= read -r line_info; do
@@ -133,7 +133,7 @@ while IFS= read -r file; do
133133
if [[ "$_IN_DIFF_MODE" == true ]]; then
134134
grep -qxF "${file}:${LINE_NUM}" "$_LINEMAP" 2>/dev/null || continue
135135
fi
136-
echo "[TS-02] ${file}:${LINE_NUM} '@ts-nocheck' 禁用整个文件类型检查。修复:逐个修复类型错误" >> "$RESULTS"
136+
echo "[TS-02] ${file}:${LINE_NUM} [review] [this-line] OBSERVATION: uses '@ts-nocheck' to disable type checking for entire file" >> "$RESULTS"
137137
done < <(grep -n '@ts-nocheck' "$file" 2>/dev/null || true)
138138

139139
done < <(list_ts_files "$TARGET_DIR" | filter_non_test)
@@ -149,15 +149,19 @@ if [[ "$COUNT" -eq 0 ]]; then
149149
fi
150150

151151
if [[ "$COUNT_01" -gt 0 ]]; then
152-
echo "[TS-01] 检测到 ${COUNT_01} any 类型问题:"
152+
echo "[TS-01] ${COUNT_01} 'any' type usage instance(s):"
153153
grep -E '^\[TS-01\]' "$RESULTS"
154154
fi
155155

156156
if [[ "$COUNT_02" -gt 0 ]]; then
157-
echo "[TS-02] 检测到 ${COUNT_02} ts-ignore/ts-nocheck 问题:"
157+
echo "[TS-02] ${COUNT_02} @ts-ignore/@ts-nocheck instance(s):"
158158
grep -E '^\[TS-02\]' "$RESULTS"
159159
fi
160160

161+
echo ""
162+
echo "SCOPE: this-line only — do not modify tsconfig.json, disable type checking globally, or broaden suppressions"
163+
echo "ACTION: REVIEW"
164+
161165
if [[ "$STRICT" == "true" ]]; then
162166
exit 1
163167
fi

guards/typescript/check_console_residual.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ for m in matches:
112112
# 避免仅删除行时 added_set 为空导致回退到全量扫描。
113113
if in_diff_mode and (f + ":" + str(line)) not in added_set:
114114
continue
115-
msg = m.get("message", "console 残留")
116-
print("[TS-03] " + f + ":" + str(line) + " " + msg)
115+
msg = m.get("message", "console residual")
116+
print("[TS-03] " + f + ":" + str(line) + " [review] [this-line] OBSERVATION: " + msg)
117117
' < "${_ASG_TMPOUT}" >> "$RESULTS" || {
118118
echo "[TS-03] WARN: python3 处理失败,使用 grep fallback" >&2
119119
_USE_GREP_FALLBACK=true
@@ -149,7 +149,7 @@ if [[ "$_USE_GREP_FALLBACK" == true ]]; then
149149
if [[ "$_IN_DIFF_MODE" == true ]]; then
150150
grep -qxF "${f}:${LINE_NUM}" "$_LINEMAP" 2>/dev/null || continue
151151
fi
152-
echo "[TS-03] ${f}:${LINE_NUM} console 残留(grep fallback)"
152+
echo "[TS-03] ${f}:${LINE_NUM} [review] [this-line] OBSERVATION: console residual"
153153
done
154154
done >> "$RESULTS" || true
155155
fi
@@ -162,9 +162,12 @@ if [[ "$COUNT" -eq 0 ]]; then
162162
exit 0
163163
fi
164164

165-
echo "[TS-03] 检测到 ${COUNT} console 残留:"
165+
echo "[TS-03] ${COUNT} console residual instance(s):"
166166
echo
167167
cat "$RESULTS"
168+
echo ""
169+
echo "SCOPE: this-line only — do not create logger modules, modify other files, or fix console usage outside this line"
170+
echo "ACTION: REVIEW — skip if this is a CLI project (check bin field in package.json)"
168171

169172
if [[ "$STRICT" == "true" ]]; then
170173
exit 1

hooks/post-edit-guard.sh

Lines changed: 80 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,21 @@ if [[ "$FILE_PATH" == *.rs ]]; then
7676
SAFE_COUNT=$(echo "$_RS03_FILTERED" | grep -cE '\.(unwrap_or|unwrap_or_else|unwrap_or_default)\(' 2>/dev/null || true)
7777
REAL_COUNT=$((UNSAFE_COUNT - SAFE_COUNT))
7878
if [[ $REAL_COUNT -gt 0 ]]; then
79-
WARNINGS="${WARNINGS}[RS-03] 新增了 ${REAL_COUNT} 个 unwrap()/expect()。修复:将 .unwrap() 替换为 .map_err(|e| YourError::from(e))? 或 .unwrap_or_default();在 main() 入口可用 anyhow::Result<()>。立即修复,不要留到后面。参考 vibeguard/rules/rust.md RS-03。"
79+
WARNINGS="${WARNINGS:+${WARNINGS}
80+
---
81+
}[RS-03] [review] [this-edit] OBSERVATION: ${REAL_COUNT} new unwrap()/expect() call(s) added
82+
SCOPE: this-edit only — do not propagate changes beyond this edit, add error types, or change signatures
83+
ACTION: REVIEW"
8084
fi
8185
fi
8286
# [RS-10] 检测静默丢弃 Result(let _ = expr)
8387
SILENT_COUNT=$(echo "$NEW_STRING" | vg_filter_suppressed "RS-10" | grep -cE '^\s*let\s+_\s*=' 2>/dev/null; true)
8488
if [[ $SILENT_COUNT -gt 0 ]]; then
85-
WARNINGS="${WARNINGS:+${WARNINGS} }[RS-10] 新增了 ${SILENT_COUNT} 个 let _ = 静默丢弃。修复:用 if let Err(e) = expr { log::warn(...) } 记录错误,或用 .map_err() 传播。参考 vibeguard/rules/rust.md RS-10。"
89+
WARNINGS="${WARNINGS:+${WARNINGS}
90+
---
91+
}[RS-10] [review] [this-edit] OBSERVATION: ${SILENT_COUNT} new let _ = silent discard(s) added
92+
SCOPE: this-edit only — do not refactor calling code or add new error types
93+
ACTION: REVIEW"
8694
fi
8795
;;
8896
esac
@@ -121,9 +129,17 @@ case "$FILE_PATH" in
121129
FILE_CONSOLE_TOTAL=$(grep -cE '\bconsole\.(log|warn|error)\(' "$FILE_PATH" 2>/dev/null; true)
122130
fi
123131
if [[ $FILE_CONSOLE_TOTAL -ge 10 ]]; then
124-
WARNINGS="${WARNINGS:+${WARNINGS} }[DEBUG ESCALATE] 文件已有 ${FILE_CONSOLE_TOTAL} 处 console 残留,且仍在新增!必须立即清理:使用项目 logger 替代所有 console 调用。"
132+
WARNINGS="${WARNINGS:+${WARNINGS}
133+
---
134+
}[DEBUG] [review] [this-file] OBSERVATION: file has ${FILE_CONSOLE_TOTAL} console residuals and new ones are being added
135+
FIX: Remove this console.log/warn/error call; keep only if this is intentional debug output
136+
DO NOT: Create logger modules, modify other files, or fix console usage outside this file"
125137
else
126-
WARNINGS="${WARNINGS:+${WARNINGS} }[DEBUG] 新增了 ${CONSOLE_COUNT} 个 console.log/warn/error。修复:使用项目的 logger 替代 console 调用;如果是临时调试,完成后删除。"
138+
WARNINGS="${WARNINGS:+${WARNINGS}
139+
---
140+
}[DEBUG] [review] [this-edit] OBSERVATION: ${CONSOLE_COUNT} new console.log/warn/error call(s) added
141+
FIX: Remove this console.log/warn/error call; keep only if this is a CLI project (check bin field in package.json)
142+
DO NOT: Create new logger modules, modify other files, or fix console usage outside this edit"
127143
fi
128144
fi
129145
fi
@@ -143,7 +159,11 @@ case "$FILE_PATH" in
143159
*)
144160
PRINT_COUNT=$(echo "$NEW_STRING" | vg_filter_suppressed "DEBUG" | grep -cE '^\s*print\(' 2>/dev/null; true)
145161
if [[ $PRINT_COUNT -gt 0 ]]; then
146-
WARNINGS="${WARNINGS:+${WARNINGS} }[DEBUG] 新增了 ${PRINT_COUNT} 个 print() 语句。修复:使用 logging 模块替代 print;如果是临时调试,完成后删除。"
162+
WARNINGS="${WARNINGS:+${WARNINGS}
163+
---
164+
}[DEBUG] [review] [this-edit] OBSERVATION: ${PRINT_COUNT} new print() statement(s) added
165+
FIX: Remove this print() call, or replace with logging.getLogger(__name__).debug() for permanent logging
166+
DO NOT: Modify logging configuration or other files"
147167
fi
148168
;;
149169
esac
@@ -155,7 +175,11 @@ if echo "$NEW_STRING" | vg_filter_suppressed "U-11" | grep -qE '"[^"]*\.(db|sqli
155175
case "$FILE_PATH" in
156176
*/tests/*|*_test.*|*.test.*|*.spec.*) ;;
157177
*)
158-
WARNINGS="${WARNINGS:+${WARNINGS} }[U-11] 检测到硬编码数据库路径。修复:将路径提取到 core 层公共函数(如 default_db_path()),所有入口统一调用;环境变量覆盖用 env::var(\"APP_DB_PATH\").unwrap_or_else(|_| default_db_path())。参考 vibeguard/rules/universal.md U-11。"
178+
WARNINGS="${WARNINGS:+${WARNINGS}
179+
---
180+
}[U-11] [review] [this-line] OBSERVATION: hardcoded database path (.db/.sqlite) detected
181+
FIX: Extract to a shared default_db_path() function in core layer; use env var APP_DB_PATH for override
182+
DO NOT: Refactor path functions, move code to another file, or change other hardcoded paths"
159183
;;
160184
esac
161185
fi
@@ -170,13 +194,21 @@ case "$FILE_PATH" in
170194
ERR_DISCARD=$(echo "$NEW_STRING" | vg_filter_suppressed "GO-01" | grep -E '^\s*_\s*(,\s*_)?\s*[:=]+' 2>/dev/null \
171195
| grep -cvE '(for\s+.*range|,\s*(ok|found|exists)\s*:?=)' 2>/dev/null; true)
172196
if [[ $ERR_DISCARD -gt 0 ]]; then
173-
WARNINGS="${WARNINGS:+${WARNINGS} }[GO-01] 新增了 ${ERR_DISCARD} 处 error 丢弃(_ = ...)。修复:用 if err != nil 处理错误。"
197+
WARNINGS="${WARNINGS:+${WARNINGS}
198+
---
199+
}[GO-01] [auto-fix] [this-line] OBSERVATION: ${ERR_DISCARD} new error discard(s) (\"_ = ...\") added
200+
FIX: Replace _ = fn() with err := fn(); if err != nil { return fmt.Errorf(\"context: %w\", err) }
201+
DO NOT: Modify function signatures or upstream callers"
174202
fi
175203
# [GO-08] 检测 defer 在循环内
176204
DEFER_LOOP=$(echo "$NEW_STRING" | vg_filter_suppressed "GO-08" | awk '/^\s*for\s/ {in_loop=1} /^\s*defer\s/ && in_loop {count++} /^\s*\}/ {in_loop=0} END {print count+0}' 2>/dev/null; true)
177205
DEFER_LOOP="${DEFER_LOOP:-0}"
178206
if [[ $DEFER_LOOP -gt 0 ]]; then
179-
WARNINGS="${WARNINGS:+${WARNINGS} }[GO-08] 检测到 defer 在循环内,可能导致资源泄漏。修复:将 defer 所在逻辑提取为独立函数。"
207+
WARNINGS="${WARNINGS:+${WARNINGS}
208+
---
209+
}[GO-08] [review] [this-edit] OBSERVATION: defer inside a loop detected, may cause resource leak
210+
FIX: Extract the loop body containing defer into a separate function
211+
DO NOT: Extract to a separate file or refactor loop logic beyond the current edit"
180212
fi
181213
;;
182214
esac
@@ -189,36 +221,50 @@ case "$FILE_PATH" in
189221
*.rs)
190222
STUB_COUNT=$(echo "$NEW_STRING" | vg_filter_suppressed "STUB" | grep -cE '^\s*(todo!\(|unimplemented!\(|panic!\("not implemented)' 2>/dev/null; true)
191223
if [[ "${STUB_COUNT:-0}" -gt 0 ]]; then
192-
STUB_WARNINGS="[STUB] 新增了 ${STUB_COUNT} 个 stub 占位符(todo!/unimplemented!)。必须在当前任务内替换为真实实现,或标记 DEFER 并说明原因。"
224+
STUB_WARNINGS="[STUB] [review] [this-edit] OBSERVATION: ${STUB_COUNT} stub placeholder(s) added (todo!/unimplemented!)
225+
FIX: Replace with real implementation in this task, or add a DEFER comment explaining why
226+
DO NOT: Add DEFER markers to stubs in other files"
193227
fi
194228
;;
195229
*.ts|*.tsx|*.js|*.jsx)
196230
STUB_COUNT=$(echo "$NEW_STRING" | vg_filter_suppressed "STUB" | grep -cE '^\s*(throw new Error\(.*(not implemented|TODO|FIXME)|// TODO|// FIXME|return null.*// stub)' 2>/dev/null; true)
197231
if [[ "${STUB_COUNT:-0}" -gt 0 ]]; then
198-
STUB_WARNINGS="[STUB] 新增了 ${STUB_COUNT} 个 stub 占位符(throw not implemented / TODO)。必须替换为真实实现或标记 DEFER。"
232+
STUB_WARNINGS="[STUB] [review] [this-edit] OBSERVATION: ${STUB_COUNT} stub placeholder(s) added (throw not implemented / TODO)
233+
FIX: Replace with real implementation in this task, or add a DEFER comment explaining why
234+
DO NOT: Add DEFER markers to stubs in other files"
199235
fi
200236
;;
201237
*.py)
202238
STUB_COUNT=$(echo "$NEW_STRING" | vg_filter_suppressed "STUB" | grep -cE '^\s*(pass\s*$|pass\s*#|raise NotImplementedError|# TODO|# FIXME)' 2>/dev/null; true)
203239
if [[ "${STUB_COUNT:-0}" -gt 0 ]]; then
204-
STUB_WARNINGS="[STUB] 新增了 ${STUB_COUNT} 个 stub 占位符(pass/NotImplementedError/TODO)。必须替换为真实实现或标记 DEFER。"
240+
STUB_WARNINGS="[STUB] [review] [this-edit] OBSERVATION: ${STUB_COUNT} stub placeholder(s) added (pass/NotImplementedError/TODO)
241+
FIX: Replace with real implementation in this task, or add a DEFER comment explaining why
242+
DO NOT: Add DEFER markers to stubs in other files"
205243
fi
206244
;;
207245
*.go)
208246
STUB_COUNT=$(echo "$NEW_STRING" | vg_filter_suppressed "STUB" | grep -cE '^\s*(panic\("not implemented|// TODO|// FIXME)' 2>/dev/null; true)
209247
if [[ "${STUB_COUNT:-0}" -gt 0 ]]; then
210-
STUB_WARNINGS="[STUB] 新增了 ${STUB_COUNT} 个 stub 占位符(panic not implemented / TODO)。必须替换为真实实现或标记 DEFER。"
248+
STUB_WARNINGS="[STUB] [review] [this-edit] OBSERVATION: ${STUB_COUNT} stub placeholder(s) added (panic not implemented / TODO)
249+
FIX: Replace with real implementation in this task, or add a DEFER comment explaining why
250+
DO NOT: Add DEFER markers to stubs in other files"
211251
fi
212252
;;
213253
esac
214254
if [[ -n "$STUB_WARNINGS" ]]; then
215-
WARNINGS="${WARNINGS:+${WARNINGS} }${STUB_WARNINGS}"
255+
WARNINGS="${WARNINGS:+${WARNINGS}
256+
---
257+
}${STUB_WARNINGS}"
216258
fi
217259

218260
# --- 超大 diff 检测(可能是幻觉编辑) ---
219261
DIFF_LINES=$(echo "$NEW_STRING" | wc -l | tr -d ' ')
220262
if [[ $DIFF_LINES -gt 200 ]]; then
221-
WARNINGS="${WARNINGS:+${WARNINGS} }[LARGE-EDIT] 单次编辑 ${DIFF_LINES} 行,超出 200 行阈值,请确认编辑内容正确。"
263+
WARNINGS="${WARNINGS:+${WARNINGS}
264+
---
265+
}[LARGE-EDIT] [info] [this-edit] OBSERVATION: single edit contains ${DIFF_LINES} lines, exceeding 200-line threshold
266+
FIX: Verify the edit content is correct and intentional
267+
DO NOT: Take any action — this is informational only"
222268
fi
223269

224270
# --- Churn Detection(同文件反复编辑 → 可能在循环修正) ---
@@ -248,13 +294,25 @@ print(count)
248294
CHURN_COUNT="${CHURN_COUNT:-0}"
249295

250296
if [[ "$CHURN_COUNT" -ge 20 ]]; then
251-
WARNINGS="${WARNINGS:+${WARNINGS} }[CHURN CRITICAL] ${FILE_PATH##*/} 已编辑 ${CHURN_COUNT} 次!你正处于 edit→fail→fix 死循环。必须立即停止当前方向,重新审视根因(W-02)。"
297+
WARNINGS="${WARNINGS:+${WARNINGS}
298+
---
299+
}[CHURN CRITICAL] [review] [this-file] OBSERVATION: ${FILE_PATH##*/} has been edited ${CHURN_COUNT} times — possible edit→fail→fix loop
300+
FIX: Stop current direction, review full build output, re-examine root cause (W-02)
301+
DO NOT: Continue editing this file until root cause is confirmed"
252302
vg_log "post-edit-guard" "Edit" "escalate" "churn ${CHURN_COUNT}x critical" "$FILE_PATH"
253303
elif [[ "$CHURN_COUNT" -ge 10 ]]; then
254-
WARNINGS="${WARNINGS:+${WARNINGS} }[CHURN WARNING] ${FILE_PATH##*/} 已编辑 ${CHURN_COUNT} 次,疑似循环修正。建议:停下来运行完整构建查看全貌,或 /vibeguard:learn 提取模式。"
304+
WARNINGS="${WARNINGS:+${WARNINGS}
305+
---
306+
}[CHURN WARNING] [info] [this-file] OBSERVATION: ${FILE_PATH##*/} has been edited ${CHURN_COUNT} times, possible correction loop
307+
FIX: Run full build to see the complete picture, or use /vibeguard:learn to extract patterns
308+
DO NOT: Take any action — monitor and decide whether to continue"
255309
vg_log "post-edit-guard" "Edit" "escalate" "churn ${CHURN_COUNT}x warning" "$FILE_PATH"
256310
elif [[ "$CHURN_COUNT" -ge 5 ]]; then
257-
WARNINGS="${WARNINGS:+${WARNINGS} }[CHURN] ${FILE_PATH##*/} 已编辑 ${CHURN_COUNT} 次,注意是否在循环修正。"
311+
WARNINGS="${WARNINGS:+${WARNINGS}
312+
---
313+
}[CHURN] [info] [this-file] OBSERVATION: ${FILE_PATH##*/} has been edited ${CHURN_COUNT} times
314+
FIX: Check if you are in a correction loop before continuing
315+
DO NOT: Take any action — this is informational only"
258316
vg_log "post-edit-guard" "Edit" "correction" "churn ${CHURN_COUNT}x" "$FILE_PATH"
259317
fi
260318

@@ -293,7 +351,11 @@ WARN_COUNT_FOR_FILE="${WARN_COUNT_FOR_FILE:-0}"
293351

294352
if [[ "$WARN_COUNT_FOR_FILE" -ge 3 ]]; then
295353
DECISION="escalate"
296-
WARNINGS="[ESCALATE] 该文件已被警告 ${WARN_COUNT_FOR_FILE} 次,建议用户主动介入审查。${WARNINGS}"
354+
WARNINGS="[ESCALATE] [review] [this-file] OBSERVATION: this file has triggered ${WARN_COUNT_FOR_FILE} warnings — user intervention recommended
355+
FIX: Stop and review the warnings below before continuing
356+
DO NOT: Continue editing this file without reviewing all warnings
357+
---
358+
${WARNINGS}"
297359
fi
298360

299361
vg_log "post-edit-guard" "Edit" "$DECISION" "$WARNINGS" "$FILE_PATH"

0 commit comments

Comments
 (0)