@windyroad/risk-scorer 0.18.18 → 0.18.19
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.
|
@@ -214,6 +214,7 @@ except Exception:
|
|
|
214
214
|
DRAFT=$(printf '%s' "$COMMAND" | python3 -c "
|
|
215
215
|
import sys, re
|
|
216
216
|
cmd = sys.stdin.read()
|
|
217
|
+
surface = sys.argv[1]
|
|
217
218
|
# P364: bash double-quote unescape. The double-quoted body capture groups
|
|
218
219
|
# carry RAW shell-escaped command text — an orchestrator must backslash-escape
|
|
219
220
|
# backticks (and \$, \", \\) inside \"...\" to survive bash parsing, e.g.
|
|
@@ -240,6 +241,25 @@ def unescape_dq(s):
|
|
|
240
241
|
out.append(s[i])
|
|
241
242
|
i += 1
|
|
242
243
|
return ''.join(out)
|
|
244
|
+
|
|
245
|
+
# Git joins repeated -m/--message values with one blank line. Extract every
|
|
246
|
+
# quoted value in command order so the gate hashes the message Git will create.
|
|
247
|
+
# Preserve the existing heredoc-first behaviour for the AI-dominant form.
|
|
248
|
+
if surface == 'git-commit-message':
|
|
249
|
+
heredoc = re.search(r\"[<][<]\s*['\\\"]?EOF['\\\"]?\s*\n(.*?)\nEOF\", cmd, re.DOTALL)
|
|
250
|
+
if heredoc:
|
|
251
|
+
print(heredoc.group(1))
|
|
252
|
+
raise SystemExit
|
|
253
|
+
|
|
254
|
+
messages = []
|
|
255
|
+
for match in re.finditer(r\"(?:-m|--message)(?:=|\s+)(?:'([^']*)'|\\\"([^\\\"]*)\\\")\", cmd):
|
|
256
|
+
if match.group(1) is not None:
|
|
257
|
+
messages.append(match.group(1))
|
|
258
|
+
else:
|
|
259
|
+
messages.append(unescape_dq(match.group(2)))
|
|
260
|
+
if messages:
|
|
261
|
+
print('\n\n'.join(messages))
|
|
262
|
+
raise SystemExit
|
|
243
263
|
# (pattern, flags, unescape) — first match wins. unescape=True for the
|
|
244
264
|
# double-quoted forms only (P364).
|
|
245
265
|
patterns = [
|
|
@@ -268,7 +288,7 @@ for pat, flags, unescape in patterns:
|
|
|
268
288
|
body = unescape_dq(body)
|
|
269
289
|
print(body)
|
|
270
290
|
break
|
|
271
|
-
" 2>/dev/null || echo "")
|
|
291
|
+
" "$SURFACE" 2>/dev/null || echo "")
|
|
272
292
|
;;
|
|
273
293
|
|
|
274
294
|
Write|Edit)
|
package/package.json
CHANGED