feat: 更新 stopCommand 函数以确保进程正常退出;优化 MCP 路由序列化以支持嵌套对象;添加 CSS 类以实现文本行数限制

This commit is contained in:
catlog22
2025-12-21 12:47:25 +08:00
parent 89b3475508
commit 15d5890861
4 changed files with 95 additions and 18 deletions

View File

@@ -514,6 +514,13 @@
overflow: hidden;
}
.line-clamp-3 {
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
}
/* Highlight pulse effect */
.highlight-pulse {
animation: highlightPulse 0.5s ease-out 2;

View File

@@ -371,9 +371,9 @@ function renderHooksByEvent(hooks, scope) {
<span class="font-mono text-xs bg-muted px-1.5 py-0.5 rounded shrink-0">matcher</span>
<span class="text-muted-foreground">${escapeHtml(matcher)}</span>
</div>
<div class="flex items-center gap-2">
<div class="flex items-start gap-2">
<span class="font-mono text-xs bg-muted px-1.5 py-0.5 rounded shrink-0">command</span>
<span class="font-mono text-xs text-foreground">${escapeHtml(command)}</span>
<span class="font-mono text-xs text-foreground break-all line-clamp-3 overflow-hidden" title="${escapeHtml(command)}">${escapeHtml(command)}</span>
</div>
${args.length > 0 ? `
<div class="flex items-start gap-2">
@@ -570,13 +570,36 @@ function attachHookEventListeners() {
const hook = hookList[index];
if (hook) {
// Support both Claude Code format (hooks[0].command) and legacy format (command + args)
let command = '';
let args = [];
if (hook.hooks && hook.hooks[0]) {
// Claude Code format: { hooks: [{ type: "command", command: "bash -c '...'" }] }
const fullCommand = hook.hooks[0].command || '';
// Try to split command and args for bash -c commands
const bashMatch = fullCommand.match(/^(bash|sh|cmd)\s+(-c)\s+(.+)$/s);
if (bashMatch) {
command = bashMatch[1];
args = [bashMatch[2], bashMatch[3]];
} else {
// For other commands, put the whole thing as command
command = fullCommand;
args = [];
}
} else {
// Legacy format: { command: "bash", args: ["-c", "..."] }
command = hook.command || '';
args = hook.args || [];
}
openHookCreateModal({
scope: scope,
event: event,
index: index,
matcher: hook.matcher || '',
command: hook.command,
args: hook.args || []
command: command,
args: args
});
}
});