sheet-edit 首战复盘两改进:① 内层动作键 op→action(run.py 兼容旧键 op 缺省 inspect),消除与 skill 工具外层 op=run 的撞名——AI 照抄示例漏外层参数、或把内层值填进外层枚举的根因;SKILL.md 顶部新增「调用形式」章节给出完整外层调用并声明下文均为 input_args。② 表头行不再靠 AI 自觉:locate.detect_header_row 扫描前 10 行(候选=非空全字符串且互不重复取最多列),inspect 每 sheet 返回 suggested_header_row;build_col_map 只解析出 1 列(典型:横跨全行的合并标题被当表头)且检测到不同行时直接报错给出 header_row=N 建议——跳过 inspect 直接 apply 也能一次报错自愈,正是「标题行+表头行」中文表格翻车现场的兜底

This commit is contained in:
2026-09-28 10:16:17 +08:00
parent efe3dcc910
commit d4f83b0694
4 changed files with 63 additions and 14 deletions
+4 -4
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""sheet-edit 技能入口。接收一个 JSON 参数,分发到对应 op。"""
"""sheet-edit 技能入口。接收一个 JSON 参数,按其中 action 键分发(旧键名 op 仍兼容)。"""
import json
import sys
from pathlib import Path
@@ -33,10 +33,10 @@ def main():
_err("input_args 必须是 JSON 对象")
return 1
op = args.get('op')
handler = HANDLERS.get(op)
action = args.get('action') or args.get('op') or 'inspect'
handler = HANDLERS.get(action)
if not handler:
_err(f"未知 op: {op!r}(支持: {', '.join(HANDLERS.keys())})")
_err(f"未知 action: {action!r}(支持: {', '.join(HANDLERS.keys())})")
return 1
try: