From 38c6c5354ead93b7e6aa74e49042ba3501037fef Mon Sep 17 00:00:00 2001 From: OpenClaw Agent Date: Tue, 10 Feb 2026 23:57:18 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E5=96=84CLI=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- skills/kb-workflow/kb_workflow.py | 44 ++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/skills/kb-workflow/kb_workflow.py b/skills/kb-workflow/kb_workflow.py index 9cac8e2..85f8632 100644 --- a/skills/kb-workflow/kb_workflow.py +++ b/skills/kb-workflow/kb_workflow.py @@ -243,13 +243,51 @@ def main(): parser.add_argument('--check', action='store_true', help='查重') parser.add_argument('--url', type=str, help='要检查的URL') - parser.add_argument('--archive', type=str, help='要归档的文件路径') - parser.add_argument('--base-path', type=str, help='知识库根目录') - + parser.add_argument('--archive', type=str, help='归档的文件路径') + parser.add_argument('--base-path', type=str, help='获取知识库根目录') + + parser.add_argument('--pending', action='store_true', help='获取url解析目录') + parser.add_argument('--metadata', action='store_true', help='获取元数据目录') + parser.add_argument('--content', action='store_true', help='获取内容目录') + parser.add_argument('--content_downloads', action='store_true', help='获取主内容下载目录') + parser.add_argument('--content_subtitles', action='store_true', help='获取字幕目录') + parser.add_argument('--analyzed', action='store_true', help='获取深度分析目录') + parser.add_argument('--archive', action='store_true', help='获取归档目录') + parser.add_argument('--archive_subscriptions', action='store_true', help='获取订阅信息目录') + parser.add_argument('--extract_platform', type=str, help='要提取平台名称的文件名') args = parser.parse_args() base_path = Path(args.base_path) if args.base_path else None + # 获取目录参数处理 + dirs = ensure_directories(base_path) + + if args.extract_platform: + platform = extract_platform(args.extract_platform) + print(json.dumps({"platform": platform}, ensure_ascii=False, indent=2)) + return + + # 目录路径查询 + dir_map = { + "pending": dirs.get("pending"), + "metadata": dirs.get("metadata"), + "content": dirs.get("content"), + "content_downloads": dirs.get("content_downloads"), + "content_subtitles": dirs.get("content_subtitles"), + "analyzed": dirs.get("analyzed"), + "archive": dirs.get("archive"), + "archive_subscriptions": dirs.get("archive_subscriptions"), + } + + found = False + for arg_name, dir_path in dir_map.items(): + if getattr(args, arg_name, False) and dir_path: + print(json.dumps({"path": str(dir_path)}, ensure_ascii=False, indent=2)) + found = True + + if found: + return + if args.check and args.url: result = check_duplicate(base_path, args.url) print(json.dumps(result, ensure_ascii=False, indent=2))