triflux 9.8.6 → 9.8.7
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/hooks/safety-guard.mjs +14 -7
- package/package.json +1 -1
package/hooks/safety-guard.mjs
CHANGED
|
@@ -65,13 +65,20 @@ function main() {
|
|
|
65
65
|
// psmux 명령이 실제 CLI 호출인지 판별 (오탐 방지)
|
|
66
66
|
// git commit 메시지, echo, grep, cat, heredoc 안의 텍스트는 무시
|
|
67
67
|
function isPsmuxInvocation(cmd) {
|
|
68
|
-
//
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
68
|
+
// psmux kill-session/server가 명령에 없으면 즉시 false
|
|
69
|
+
if (!/\bpsmux\s+kill-(session|server)\b/i.test(cmd)) return false;
|
|
70
|
+
|
|
71
|
+
// 줄 분할 → 세그먼트 분할(&&, ;, ||)로 각 명령 단위 검사
|
|
72
|
+
// 세그먼트가 echo/grep/git-commit으로 시작하면 인자 텍스트이므로 무시
|
|
73
|
+
const lines = cmd.split(/\n/);
|
|
74
|
+
return lines.some((line) => {
|
|
75
|
+
const segments = line.split(/\s*(?:&&|;|\|\|)\s*/);
|
|
76
|
+
return segments.some((seg) => {
|
|
77
|
+
const t = seg.trim();
|
|
78
|
+
if (!t || t.startsWith("#")) return false;
|
|
79
|
+
if (/^\s*(echo|printf|grep|git\s+commit)\b/i.test(t)) return false;
|
|
80
|
+
return /\bpsmux\s+kill-(session|server)\b/i.test(t);
|
|
81
|
+
});
|
|
75
82
|
});
|
|
76
83
|
}
|
|
77
84
|
|