Issue 描述 (Description)
中文
在审核(Audit)标签页中,点击待审核文件的可折叠块展开详情时,应用直接崩溃,并抛出 MarkupError。错误信息提示 “Expected markup value (found '+ getCLISyspromptPrefix({...}), // "You are Claude Code, Anthropic's official CLI..."\n')”,原因为待审核的 diff 内容中包含方括号 [ 字符,被 Textual 的 Static 控件误解析为 Rich 标记语法。
English
When expanding a collapsible file item in the Audit tab, the application crashes with a MarkupError: “Expected markup value (found '+ getCLISyspromptPrefix({...}), // "You are Claude Code, Anthropic's official CLI..."\n')”. The crash occurs because the diff content contains square brackets ([), which the Static widget tries to parse as Rich markup by default.
复现步骤 (Steps to Reproduce)
- 在一个项目中创建一次待审核的文件变更(例如编辑一个包含
[key] 或 [...] 代码片段的文件)。
- 使用 ManualAid 打开该工作区。
- 切换到 审核(Audit) 标签页。
- 点击包含上述文件的折叠项展开详情。
- 应用崩溃。
预期行为 (Expected Behavior)
审核界面应正常展开并显示 diff 内容,不因内容中的特殊字符而崩溃。
实际行为 (Actual Behavior)
应用直接退出,终端显示如下 Traceback 关键部分:
MarkupError: Expected markup value (found '+ ... // "You are Claude Code, ..."\n').
...
File "...\src\console\ui\widgets\audit_tab.py", line 139, in _refresh
diff_container = Vertical(Static(diff_content), classes="audit-diff")
根本原因 (Root Cause)
Static(diff_content) 默认开启 Rich 标记解析(markup=True),当 diff 文本包含 [ 字符时被误认为标记起始符。
- 同一文件中另外一处
Static(f"[{color}]{result}[/{color}]") 的 result 也可能包含特殊字符,破坏了 Rich 标记结构。
修复方案 (Fix)
修改文件 src/console/ui/widgets/audit_tab.py:
- 为 diff 内容
Static 禁用标记解析:
Static(diff_content, markup=False)
- 对审核结果消息中的
result 进行转义,并引入 rich.markup.escape:
from rich.markup import escape
...
escaped = escape(result)
await log.mount(Static(f"[{color}]{escaped}[/{color}]"))
受影响的版本 (Affected Versions)
状态 (Status): 已修复并进行简单测试,一段时间后会推送到 GitHub / Fixed and briefly tested; will be pushed to GitHub shortly.
Issue 描述 (Description)
中文
在审核(Audit)标签页中,点击待审核文件的可折叠块展开详情时,应用直接崩溃,并抛出
MarkupError。错误信息提示 “Expected markup value (found '+ getCLISyspromptPrefix({...}), // "You are Claude Code, Anthropic's official CLI..."\n')”,原因为待审核的 diff 内容中包含方括号[字符,被 Textual 的Static控件误解析为 Rich 标记语法。English
When expanding a collapsible file item in the Audit tab, the application crashes with a
MarkupError: “Expected markup value (found '+ getCLISyspromptPrefix({...}), // "You are Claude Code, Anthropic's official CLI..."\n')”. The crash occurs because the diff content contains square brackets ([), which theStaticwidget tries to parse as Rich markup by default.复现步骤 (Steps to Reproduce)
[key]或[...]代码片段的文件)。预期行为 (Expected Behavior)
审核界面应正常展开并显示 diff 内容,不因内容中的特殊字符而崩溃。
实际行为 (Actual Behavior)
应用直接退出,终端显示如下 Traceback 关键部分:
根本原因 (Root Cause)
Static(diff_content)默认开启 Rich 标记解析(markup=True),当 diff 文本包含[字符时被误认为标记起始符。Static(f"[{color}]{result}[/{color}]")的result也可能包含特殊字符,破坏了 Rich 标记结构。修复方案 (Fix)
修改文件
src/console/ui/widgets/audit_tab.py:Static禁用标记解析:Static(diff_content, markup=False)result进行转义,并引入rich.markup.escape:受影响的版本 (Affected Versions)
状态 (Status): 已修复并进行简单测试,一段时间后会推送到 GitHub / Fixed and briefly tested; will be pushed to GitHub shortly.