@hupan56/wlkj 2.7.12 → 3.1.2
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/bin/cli.js +1435 -1107
- package/package.json +29 -29
- package/templates/qoder/agents/insight-planning.md +1 -1
- package/templates/qoder/agents/insight-research.md +28 -15
- package/templates/qoder/commands/optional/wl-insight.md +161 -161
- package/templates/qoder/commands/optional/wl-report.md +20 -39
- package/templates/qoder/commands/optional/wl-status.md +4 -4
- package/templates/qoder/commands/wl-code.md +2 -2
- package/templates/qoder/commands/wl-design.md +6 -6
- package/templates/qoder/commands/wl-init.md +3 -3
- package/templates/qoder/commands/wl-prd.md +26 -13
- package/templates/qoder/commands/wl-req.md +43 -0
- package/templates/qoder/commands/wl-search.md +78 -47
- package/templates/qoder/commands/wl-task.md +343 -40
- package/templates/qoder/commands/wl-test.md +43 -17
- package/templates/qoder/config.yaml +52 -14
- package/templates/qoder/hooks/post-tool-use.py +181 -0
- package/templates/qoder/hooks/session-start.py +94 -23
- package/templates/qoder/hooks/stop-eval.py +207 -0
- package/templates/qoder/hooks/user-prompt-submit.py +139 -0
- package/templates/qoder/rules/wl-pipeline.md +85 -49
- package/templates/qoder/scripts/README.md +102 -0
- package/templates/qoder/scripts/capability/__init__.py +26 -0
- package/templates/qoder/scripts/capability/__main__.py +72 -0
- package/templates/qoder/scripts/capability/adapters/__init__.py +29 -0
- package/templates/qoder/scripts/capability/adapters/cli.py +316 -0
- package/templates/qoder/scripts/capability/adapters/mcp.py +334 -0
- package/templates/qoder/scripts/capability/adapters/qw.py +271 -0
- package/templates/qoder/scripts/capability/caps/__init__.py +27 -0
- package/templates/qoder/scripts/capability/caps/context.py +36 -0
- package/templates/qoder/scripts/capability/caps/cron.py +50 -0
- package/templates/qoder/scripts/capability/caps/identity.py +43 -0
- package/templates/qoder/scripts/capability/caps/memory.py +71 -0
- package/templates/qoder/scripts/capability/caps/notify.py +41 -0
- package/templates/qoder/scripts/capability/caps/present.py +48 -0
- package/templates/qoder/scripts/capability/caps/repo.py +31 -0
- package/templates/qoder/scripts/capability/caps/sandbox.py +43 -0
- package/templates/qoder/scripts/capability/chain.py +92 -0
- package/templates/qoder/scripts/capability/memory_chain.py +41 -0
- package/templates/qoder/scripts/capability/registry.py +246 -0
- package/templates/qoder/scripts/capability/registry_mcp.py +250 -0
- package/templates/qoder/scripts/capability/smoke_test.py +211 -0
- package/templates/qoder/scripts/capability/smoke_test_report.json +94 -0
- package/templates/qoder/scripts/deployment/setup/__init__.py +11 -0
- package/templates/qoder/scripts/deployment/setup/carriers.py +669 -0
- package/templates/qoder/scripts/deployment/setup/carriers_verify.py +148 -0
- package/templates/qoder/scripts/{init_doctor.py → deployment/setup/init_doctor.py} +100 -39
- package/templates/qoder/scripts/{install_qoderwork.py → deployment/setup/install_qoderwork.py} +48 -30
- package/templates/qoder/scripts/{platform_doctor.py → deployment/setup/platform_doctor.py} +271 -259
- package/templates/qoder/scripts/{repo_root.py → deployment/setup/repo_root.py} +9 -2
- package/templates/qoder/scripts/{setup.py → deployment/setup/setup.py} +143 -14
- package/templates/qoder/scripts/{setup_lanhu.py → deployment/setup/setup_lanhu.py} +979 -963
- package/templates/qoder/scripts/domain/design/__init__.py +0 -0
- package/templates/qoder/scripts/{fill_prototype.py → domain/design/fill_prototype.py} +17 -5
- package/templates/qoder/scripts/{gen_design_doc.py → domain/design/gen_design_doc.py} +406 -394
- package/templates/qoder/scripts/domain/kg/__init__.py +11 -0
- package/templates/qoder/scripts/domain/kg/build/__init__.py +0 -0
- package/templates/qoder/scripts/domain/kg/build/build_entity_registry.py +201 -0
- package/templates/qoder/scripts/domain/kg/build/build_relations.py +132 -0
- package/templates/qoder/scripts/{build_style_index.py → domain/kg/build/build_style_index.py} +50 -15
- package/templates/qoder/scripts/domain/kg/build/build_workflows.py +149 -0
- package/templates/qoder/scripts/{kg_build.py → domain/kg/build/kg_build.py} +685 -612
- package/templates/qoder/scripts/{kg_build_db.py → domain/kg/build/kg_build_db.py} +338 -327
- package/templates/qoder/scripts/{kg_incremental.py → domain/kg/build/kg_incremental.py} +425 -393
- package/templates/qoder/scripts/{learn_aggregate.py → domain/kg/build/learn_aggregate.py} +212 -201
- package/templates/qoder/scripts/domain/kg/extract/__init__.py +0 -0
- package/templates/qoder/scripts/{common → domain/kg/extract}/extract.py +430 -419
- package/templates/qoder/scripts/domain/kg/extract/test_extract.py +115 -0
- package/templates/qoder/scripts/{common → domain/kg/extract}/ts_extract.py +614 -536
- package/templates/qoder/scripts/domain/kg/graph/__init__.py +0 -0
- package/templates/qoder/scripts/{kg_link_db.py → domain/kg/graph/kg_link_db.py} +235 -224
- package/templates/qoder/scripts/domain/kg/graph/kg_semantic.py +683 -0
- package/templates/qoder/scripts/{kg.py → domain/kg/kg.py} +871 -708
- package/templates/qoder/scripts/domain/kg/kg_capabilities.py +182 -0
- package/templates/qoder/scripts/domain/kg/search/__init__.py +0 -0
- package/templates/qoder/scripts/{context_pack.py → domain/kg/search/context_pack.py} +45 -17
- package/templates/qoder/scripts/{enrich_prompt.py → domain/kg/search/enrich_prompt.py} +238 -226
- package/templates/qoder/scripts/domain/kg/search/prefetch.py +384 -0
- package/templates/qoder/scripts/{common → domain/kg/search}/search_engine.py +207 -205
- package/templates/qoder/scripts/{search_index.py → domain/kg/search/search_index.py} +210 -88
- package/templates/qoder/scripts/domain/kg/server/__init__.py +0 -0
- package/templates/qoder/scripts/domain/kg/server/kgd.py +549 -0
- package/templates/qoder/scripts/domain/kg/server/perf_bench.py +197 -0
- package/templates/qoder/scripts/domain/kg/storage/__init__.py +0 -0
- package/templates/qoder/scripts/{kg_duckdb.py → domain/kg/storage/kg_duckdb.py} +70 -45
- package/templates/qoder/scripts/domain/learning/__init__.py +0 -0
- package/templates/qoder/scripts/{learn.py → domain/learning/learn.py} +157 -146
- package/templates/qoder/scripts/domain/report/__init__.py +11 -0
- package/templates/qoder/scripts/{add_session.py → domain/report/add_session.py} +256 -244
- package/templates/qoder/scripts/{export.py → domain/report/export.py} +72 -4
- package/templates/qoder/scripts/{report.py → domain/report/report.py} +292 -281
- package/templates/qoder/scripts/domain/report/report_snapshot.py +261 -0
- package/templates/qoder/scripts/domain/report/role.py +39 -0
- package/templates/qoder/scripts/{status.py → domain/report/status.py} +737 -628
- package/templates/qoder/scripts/domain/report/status_snapshot.py +191 -0
- package/templates/qoder/scripts/domain/requirement/__init__.py +0 -0
- package/templates/qoder/scripts/{archive_prd.py → domain/requirement/archive_prd.py} +389 -377
- package/templates/qoder/scripts/domain/requirement/req.py +228 -0
- package/templates/qoder/scripts/domain/task/__init__.py +11 -0
- package/templates/qoder/scripts/{git_sync.py → domain/task/git_sync.py} +90 -50
- package/templates/qoder/scripts/{syncgate.py → domain/task/syncgate.py} +18 -7
- package/templates/qoder/scripts/domain/task/task.py +229 -0
- package/templates/qoder/scripts/domain/task/task_lifecycle.py +606 -0
- package/templates/qoder/scripts/domain/task/task_query.py +162 -0
- package/templates/qoder/scripts/domain/task/task_relations.py +425 -0
- package/templates/qoder/scripts/{team_sync.py → domain/task/team_sync.py} +101 -23
- package/templates/qoder/scripts/domain/task/zentao_sync.py +370 -0
- package/templates/qoder/scripts/foundation/__init__.py +0 -0
- package/templates/qoder/scripts/foundation/bootstrap.py +145 -0
- package/templates/qoder/scripts/foundation/core/__init__.py +0 -0
- package/templates/qoder/scripts/foundation/core/cmd_registry.py +112 -0
- package/templates/qoder/scripts/foundation/core/config.py +187 -0
- package/templates/qoder/scripts/{common → foundation/core}/paths.py +706 -400
- package/templates/qoder/scripts/foundation/data/__init__.py +0 -0
- package/templates/qoder/scripts/foundation/data/contract.py +317 -0
- package/templates/qoder/scripts/{common → foundation/data}/events.py +2 -2
- package/templates/qoder/scripts/foundation/data/result.py +223 -0
- package/templates/qoder/scripts/{common → foundation/data}/task_utils.py +427 -392
- package/templates/qoder/scripts/foundation/identity/__init__.py +0 -0
- package/templates/qoder/scripts/foundation/identity/check_publish.py +103 -0
- package/templates/qoder/scripts/{common → foundation/identity}/developer.py +239 -238
- package/templates/qoder/scripts/foundation/identity/guard.py +159 -0
- package/templates/qoder/scripts/{common → foundation/identity}/identity.py +132 -9
- package/templates/qoder/scripts/foundation/identity/roles.py +60 -0
- package/templates/qoder/scripts/foundation/integrations/__init__.py +0 -0
- package/templates/qoder/scripts/{common → foundation/integrations}/active_task.py +30 -15
- package/templates/qoder/scripts/{common → foundation/integrations}/feishu.py +11 -10
- package/templates/qoder/scripts/{common → foundation/integrations}/terms.py +3 -3
- package/templates/qoder/scripts/foundation/integrations/zentao_client.py +220 -0
- package/templates/qoder/scripts/foundation/io/__init__.py +0 -0
- package/templates/qoder/scripts/{common → foundation/io}/filelock.py +1 -1
- package/templates/qoder/scripts/{common → foundation/io}/reqid.py +1 -1
- package/templates/qoder/scripts/foundation/protocol/__init__.py +0 -0
- package/templates/qoder/scripts/foundation/protocol/duckdb_conn.py +39 -0
- package/templates/qoder/scripts/foundation/protocol/mcp_base.py +268 -0
- package/templates/qoder/scripts/foundation/utils/__init__.py +0 -0
- package/templates/qoder/scripts/{common → foundation/utils}/eval_api.py +12 -1
- package/templates/qoder/scripts/{common → foundation/utils}/pip_install.py +23 -6
- package/templates/qoder/scripts/{common → foundation/utils}/platform_guard.py +1 -1
- package/templates/qoder/scripts/orchestration/__init__.py +0 -0
- package/templates/qoder/scripts/orchestration/wlkj.py +185 -0
- package/templates/qoder/scripts/protocol/__init__.py +0 -0
- package/templates/qoder/scripts/protocol/browser/README.md +207 -0
- package/templates/qoder/scripts/protocol/browser/SKILL.md +265 -0
- package/templates/qoder/scripts/protocol/browser/config.env +9 -0
- package/templates/qoder/scripts/protocol/browser/references/cdp-api.md +110 -0
- package/templates/qoder/scripts/protocol/browser/references/migration-2.5.3.md +72 -0
- package/templates/qoder/scripts/protocol/browser/references/site-patterns/.gitkeep +0 -0
- package/templates/qoder/scripts/protocol/browser/scripts/browser-discovery.mjs +138 -0
- package/templates/qoder/scripts/protocol/browser/scripts/cdp-proxy.mjs +672 -0
- package/templates/qoder/scripts/protocol/browser/scripts/check-deps.mjs +206 -0
- package/templates/qoder/scripts/protocol/browser/scripts/find-url.mjs +253 -0
- package/templates/qoder/scripts/protocol/browser/scripts/match-site.mjs +46 -0
- package/templates/qoder/scripts/protocol/browser/templates/config.env.template +9 -0
- package/templates/qoder/scripts/protocol/mcp/__init__.py +11 -0
- package/templates/qoder/scripts/protocol/mcp/kg_mcp_server.py +478 -0
- package/templates/qoder/scripts/{lanhu_stdio_wrapper.py → protocol/mcp/lanhu_stdio_wrapper.py} +131 -119
- package/templates/qoder/scripts/protocol/mcp/mcp_doctor.py +548 -0
- package/templates/qoder/scripts/protocol/mcp/mcp_launcher.py +600 -0
- package/templates/qoder/scripts/protocol/mcp/mysql_mcp_server.py +461 -0
- package/templates/qoder/scripts/protocol/mcp/zentao_mcp_server.py +1920 -0
- package/templates/qoder/scripts/protocol/transports/__init__.py +56 -0
- package/templates/qoder/scripts/protocol/transports/base.py +87 -0
- package/templates/qoder/scripts/protocol/transports/cli.py +132 -0
- package/templates/qoder/scripts/protocol/transports/http.py +141 -0
- package/templates/qoder/scripts/protocol/transports/stdio.py +293 -0
- package/templates/qoder/scripts/run_weekly_update.bat +27 -18
- package/templates/qoder/scripts/run_weekly_update.sh +22 -13
- package/templates/qoder/scripts/validation/__init__.py +0 -0
- package/templates/qoder/scripts/validation/eval/__init__.py +0 -0
- package/templates/qoder/scripts/validation/eval/perf-report-2026-06-24.md +139 -0
- package/templates/qoder/scripts/validation/eval/qwork_harness.py +617 -0
- package/templates/qoder/scripts/validation/eval/report-commands.md +220 -0
- package/templates/qoder/scripts/validation/eval/transcript_timing.py +386 -0
- package/templates/qoder/scripts/validation/metrics/__init__.py +0 -0
- package/templates/qoder/scripts/{eval_prd.py → validation/metrics/eval_prd.py} +84 -15
- package/templates/qoder/scripts/validation/metrics/usability_score.py +750 -0
- package/templates/qoder/scripts/validation/test/__init__.py +11 -0
- package/templates/qoder/scripts/validation/test/assertion_gen.py +551 -0
- package/templates/qoder/scripts/{autotest.py → validation/test/autotest.py} +1234 -1751
- package/templates/qoder/scripts/validation/test/autotest_auth.py +109 -0
- package/templates/qoder/scripts/{autotest_batch.py → validation/test/autotest_batch.py} +255 -224
- package/templates/qoder/scripts/validation/test/autotest_data.py +680 -0
- package/templates/qoder/scripts/validation/test/autotest_opencli.py +646 -0
- package/templates/qoder/scripts/{autotest_run.py → validation/test/autotest_run.py} +323 -297
- package/templates/qoder/scripts/validation/test/autotest_webaccess.py +571 -0
- package/templates/qoder/scripts/{benchmark.py → validation/test/benchmark.py} +17 -5
- package/templates/qoder/scripts/{kg_auto_login.py → validation/test/kg_auto_login.py} +208 -196
- package/templates/qoder/scripts/{kg_test_runner.py → validation/test/kg_test_runner.py} +13 -2
- package/templates/qoder/scripts/{page_probe.py → validation/test/page_probe.py} +470 -459
- package/templates/qoder/scripts/validation/test/smoke_all_commands.py +170 -0
- package/templates/qoder/settings.json +23 -2
- package/templates/qoder/skills/design-import/SKILL.md +235 -226
- package/templates/qoder/skills/design-review/SKILL.md +91 -82
- package/templates/qoder/skills/prd-generator/SKILL.md +38 -24
- package/templates/qoder/skills/prd-review/SKILL.md +8 -6
- package/templates/qoder/skills/prototype-generator/SKILL.md +296 -247
- package/templates/qoder/skills/spec-coder/SKILL.md +24 -15
- package/templates/qoder/skills/spec-generator/SKILL.md +24 -12
- package/templates/qoder/skills/test-generator/SKILL.md +9 -7
- package/templates/qoder/skills/wl-code/SKILL.md +25 -13
- package/templates/qoder/skills/wl-commit/SKILL.md +10 -9
- package/templates/qoder/skills/wl-design/SKILL.md +7 -5
- package/templates/qoder/skills/wl-init/SKILL.md +8 -8
- package/templates/qoder/skills/wl-insight/SKILL.md +25 -12
- package/templates/qoder/skills/wl-prd-full/SKILL.md +59 -8
- package/templates/qoder/skills/wl-prd-quick/SKILL.md +7 -7
- package/templates/qoder/skills/wl-prd-review/SKILL.md +18 -6
- package/templates/qoder/skills/wl-report/SKILL.md +27 -25
- package/templates/qoder/skills/wl-search/SKILL.md +151 -80
- package/templates/qoder/skills/wl-spec/SKILL.md +9 -7
- package/templates/qoder/skills/wl-status/SKILL.md +50 -18
- package/templates/qoder/skills/wl-task/SKILL.md +94 -12
- package/templates/qoder/skills/wl-test/SKILL.md +154 -45
- package/templates/qoder/templates/prd-full-template.md +7 -0
- package/templates/root/AGENTS.md +275 -237
- package/templates/root/requirements.txt +3 -0
- package/templates/root//344/275/277/347/224/250/350/257/264/346/230/216.md +3 -3
- package/templates/root//346/226/260/346/211/213/346/214/207/345/215/227.md +2 -2
- package/templates/qoder/hooks/inject-workflow-state.py +0 -169
- package/templates/qoder/scripts/__pycache__/check_mcp_launch.cpython-39.pyc +0 -0
- package/templates/qoder/scripts/__pycache__/install_qoderwork.cpython-39.pyc +0 -0
- package/templates/qoder/scripts/__pycache__/mcp_launcher.cpython-39.pyc +0 -0
- package/templates/qoder/scripts/__pycache__/platform_doctor.cpython-39.pyc +0 -0
- package/templates/qoder/scripts/check_carriers.py +0 -238
- package/templates/qoder/scripts/check_mcp.py +0 -298
- package/templates/qoder/scripts/check_mcp_launch.py +0 -183
- package/templates/qoder/scripts/check_qoderwork_consistency.py +0 -166
- package/templates/qoder/scripts/collect_prds.py +0 -31
- package/templates/qoder/scripts/common/mentions.py +0 -134
- package/templates/qoder/scripts/common/utf8.py +0 -38
- package/templates/qoder/scripts/extract_api_params.py +0 -246
- package/templates/qoder/scripts/extract_routes.py +0 -54
- package/templates/qoder/scripts/extract_routes_tree.py +0 -78
- package/templates/qoder/scripts/handoff.py +0 -22
- package/templates/qoder/scripts/init_developer.py +0 -76
- package/templates/qoder/scripts/kg_mcp_server.py +0 -801
- package/templates/qoder/scripts/kg_semantic.py +0 -150
- package/templates/qoder/scripts/mcp_launcher.py +0 -414
- package/templates/qoder/scripts/mysql_mcp_server.py +0 -396
- package/templates/qoder/scripts/parse_prds.py +0 -33
- package/templates/qoder/scripts/role.py +0 -51
- package/templates/qoder/scripts/sync_carriers.py +0 -259
- package/templates/qoder/scripts/task.py +0 -1261
- package/templates/qoder/scripts/workspace_init.py +0 -102
- package/templates/qoder/scripts/zentao_mcp_server.py +0 -424
- package/templates/qoder/skills/prompt-enrich/SKILL.md +0 -90
- /package/templates/qoder/scripts/{common → deployment}/__init__.py +0 -0
- /package/templates/qoder/{skills/prototype-generator/SKILL.md.zcode-79180-2af4721f-f9a6-412c-88db-c0af680d211b.tmp → scripts/domain/__init__.py} +0 -0
- /package/templates/qoder/scripts/{common → domain/kg/graph}/graph_traverse.py +0 -0
- /package/templates/qoder/scripts/{common → domain/kg/server}/repowiki.py +0 -0
- /package/templates/qoder/scripts/{common → foundation/io}/atomicio.py +0 -0
- /package/templates/qoder/scripts/{secure-ls.js → validation/test/secure-ls.js} +0 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""
|
|
4
|
+
wlkj.py - 工作流顶层调度器 (Facade 统一入口)
|
|
5
|
+
|
|
6
|
+
角色: 所有 Qoder 载体 (commands/skills/rules 里写的脚本调用) 统一走本入口,
|
|
7
|
+
由 DISPATCH 表路由到 scripts/ 下分层子目录的真实脚本。这样:
|
|
8
|
+
- 载体文件只认一个路径 (orchestration/wlkj.py); scripts/ 重组目录时
|
|
9
|
+
只需改 DISPATCH 一处, 载体文件不受影响 (根治"目录一重组就断链")。
|
|
10
|
+
- 脚本内部互调 (Python 进程间) 仍直接用分层路径, 不绕本入口 (避免 subprocess 嵌套)。
|
|
11
|
+
|
|
12
|
+
用法:
|
|
13
|
+
python .qoder/scripts/orchestration/wlkj.py kg search 保险 --platform web
|
|
14
|
+
python .qoder/scripts/orchestration/wlkj.py task list
|
|
15
|
+
python .qoder/scripts/orchestration/wlkj.py doctor --fix
|
|
16
|
+
python .qoder/scripts/orchestration/wlkj.py search 考勤
|
|
17
|
+
python .qoder/scripts/orchestration/wlkj.py status
|
|
18
|
+
|
|
19
|
+
分组 (逻辑导航, 非物理目录):
|
|
20
|
+
kg/* 知识图谱 (kg.py 的子命令直接透传)
|
|
21
|
+
task 任务系统
|
|
22
|
+
search 代码搜索
|
|
23
|
+
doctor 环境体检
|
|
24
|
+
status 项目状态
|
|
25
|
+
sync 团队同步
|
|
26
|
+
...
|
|
27
|
+
|
|
28
|
+
设计:
|
|
29
|
+
- 透明转发: 不改变任何子脚本的行为, 只是把 argv 转过去
|
|
30
|
+
- 单一真源: 脚本物理路径只在 DISPATCH 出现一次, 载体层不写死路径
|
|
31
|
+
- 零维护: 加新命令只需在 DISPATCH 表加一行
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
import os
|
|
35
|
+
import subprocess
|
|
36
|
+
import sys
|
|
37
|
+
|
|
38
|
+
# 命令 → 脚本 映射 (加新命令只需在此加一行)
|
|
39
|
+
# v3.0: 脚本已分子目录, 路径更新为 子包/脚本
|
|
40
|
+
DISPATCH = {
|
|
41
|
+
# ── 知识图谱 ──
|
|
42
|
+
'kg': 'domain/kg/kg.py',
|
|
43
|
+
'search': 'domain/kg/search/search_index.py',
|
|
44
|
+
'context': 'domain/kg/search/context_pack.py',
|
|
45
|
+
'prefetch': 'domain/kg/search/prefetch.py',
|
|
46
|
+
'kg-build': 'domain/kg/build/kg_build.py',
|
|
47
|
+
'kg-incremental': 'domain/kg/build/kg_incremental.py',
|
|
48
|
+
'kg-semantic': 'domain/kg/graph/kg_semantic.py',
|
|
49
|
+
'semantic': 'domain/kg/graph/kg_semantic.py',
|
|
50
|
+
'style': 'domain/kg/build/build_style_index.py',
|
|
51
|
+
# ── 任务 / 同步 ──
|
|
52
|
+
'task': 'domain/task/task.py',
|
|
53
|
+
'sync': 'domain/task/team_sync.py',
|
|
54
|
+
'team-sync': 'domain/task/team_sync.py',
|
|
55
|
+
'git-sync': 'domain/task/git_sync.py',
|
|
56
|
+
'zentao-sync': 'domain/task/zentao_sync.py',
|
|
57
|
+
# ── 需求 / PRD ──
|
|
58
|
+
'req': 'domain/requirement/req.py',
|
|
59
|
+
'archive-prd': 'domain/requirement/archive_prd.py',
|
|
60
|
+
# ── 设计 ──
|
|
61
|
+
'fill-prototype': 'domain/design/fill_prototype.py',
|
|
62
|
+
'design-doc': 'domain/design/gen_design_doc.py',
|
|
63
|
+
# ── 评估 / 学习 (飞轮) ──
|
|
64
|
+
'eval': 'validation/metrics/eval_prd.py',
|
|
65
|
+
'eva': 'validation/metrics/eval_prd.py',
|
|
66
|
+
'usability': 'validation/metrics/usability_score.py',
|
|
67
|
+
'learn': 'domain/learning/learn.py',
|
|
68
|
+
'learn-aggregate': 'domain/kg/build/learn_aggregate.py',
|
|
69
|
+
# ── 报告 / 状态 ──
|
|
70
|
+
'status': 'domain/report/status.py',
|
|
71
|
+
'status-snapshot': 'domain/report/status_snapshot.py',
|
|
72
|
+
'report': 'domain/report/report.py',
|
|
73
|
+
'report-snapshot': 'domain/report/report_snapshot.py',
|
|
74
|
+
'session': 'domain/report/add_session.py',
|
|
75
|
+
'add-session': 'domain/report/add_session.py',
|
|
76
|
+
'role': 'domain/report/role.py',
|
|
77
|
+
'export': 'domain/report/export.py',
|
|
78
|
+
# ── 测试 ──
|
|
79
|
+
'test': 'validation/test/autotest.py',
|
|
80
|
+
'autotest': 'validation/test/autotest.py',
|
|
81
|
+
'autotest-batch': 'validation/test/autotest_batch.py',
|
|
82
|
+
'benchmark': 'validation/test/benchmark.py',
|
|
83
|
+
# ── 环境 / 初始化 ──
|
|
84
|
+
'doctor': 'deployment/setup/init_doctor.py',
|
|
85
|
+
'init': 'deployment/setup/setup.py',
|
|
86
|
+
'install-qw': 'deployment/setup/install_qoderwork.py',
|
|
87
|
+
'setup-lanhu': 'deployment/setup/setup_lanhu.py',
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def _find_script_by_name(scripts_root, name):
|
|
94
|
+
"""未知命令时, 当作脚本名在 scripts/ 下递归查找。
|
|
95
|
+
支撑 'wlkj.py <脚本名>' 万能跑 (cli.js 的 run 命令底层依赖)。
|
|
96
|
+
返回绝对路径或 None。"""
|
|
97
|
+
import glob
|
|
98
|
+
if not name.endswith('.py'):
|
|
99
|
+
name = name + '.py'
|
|
100
|
+
# 递归找 scripts/**/name
|
|
101
|
+
pattern = os.path.join(scripts_root, '**', name)
|
|
102
|
+
hits = glob.glob(pattern, recursive=True)
|
|
103
|
+
return hits[0] if hits else None
|
|
104
|
+
|
|
105
|
+
def _usage():
|
|
106
|
+
lines = [
|
|
107
|
+
'wlkj.py — 工作流顶层调度器',
|
|
108
|
+
'',
|
|
109
|
+
'用法: python .qoder/scripts/orchestration/wlkj.py <命令> [参数...]',
|
|
110
|
+
'',
|
|
111
|
+
'命令分组 (转发到对应脚本):',
|
|
112
|
+
' 知识图谱: kg <子命令> (kg.py, 13+ 能力)',
|
|
113
|
+
' search <词> (search_index.py)',
|
|
114
|
+
' context <词> (context_pack.py)',
|
|
115
|
+
' kg-build (全量构建图谱)',
|
|
116
|
+
' kg-incremental (增量构建, 定时任务用)',
|
|
117
|
+
' 任务: task <子命令> (task.py, create/list/start/finish)',
|
|
118
|
+
' 同步: sync pull|push (team_sync.py)',
|
|
119
|
+
' 需求: req <子命令> (req.py, 需求生命周期)',
|
|
120
|
+
' archive-prd (PRD 归档)',
|
|
121
|
+
' 设计: fill-prototype <tpl> (真实数据预填原型)',
|
|
122
|
+
' design-doc (生成 DESIGN.md)',
|
|
123
|
+
' 评估/学习: eval <prd.md> (eval_prd.py, EVA 评分)',
|
|
124
|
+
' usability [--days N] (usability_score.py, 工作流可用性: 采纳+流程)',
|
|
125
|
+
' learn record/status (个人埋点)',
|
|
126
|
+
' learn-aggregate (团队聚合 → kg.duckdb)',
|
|
127
|
+
' 状态/报告: status (status.py, 健康度)',
|
|
128
|
+
' report daily|weekly (report.py)',
|
|
129
|
+
' export <格式> (export.py)',
|
|
130
|
+
' 测试: test <子命令> (autotest.py)',
|
|
131
|
+
' autotest-batch <f> (批量串测)',
|
|
132
|
+
' benchmark (性能基线)',
|
|
133
|
+
' 体检: doctor [--fix] (init_doctor.py)',
|
|
134
|
+
'',
|
|
135
|
+
'示例:',
|
|
136
|
+
' wlkj.py kg search 保险 --platform web',
|
|
137
|
+
' wlkj.py task create "登录优化"',
|
|
138
|
+
' wlkj.py doctor --fix',
|
|
139
|
+
' wlkj.py learn record prd_accepted \'{"req_id":"REQ-001","score":87}\'',
|
|
140
|
+
'',
|
|
141
|
+
'注: 所有 Qoder 载体 (命令/skills/rules) 统一走本入口; 脚本物理位置见 DISPATCH 表。',
|
|
142
|
+
]
|
|
143
|
+
return '\n'.join(lines)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def main():
|
|
147
|
+
argv = sys.argv[1:]
|
|
148
|
+
if not argv or argv[0] in ('-h', '--help', 'help'):
|
|
149
|
+
print(_usage())
|
|
150
|
+
return 0
|
|
151
|
+
|
|
152
|
+
cmd = argv[0]
|
|
153
|
+
rest = argv[1:]
|
|
154
|
+
|
|
155
|
+
# scripts/ 根 = __file__ 的上两级 (orchestration/ -> scripts/)
|
|
156
|
+
scripts_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
157
|
+
|
|
158
|
+
script = DISPATCH.get(cmd)
|
|
159
|
+
if not script:
|
|
160
|
+
# Fallback: 当作脚本名在 scripts/ 下递归找 (支撑 'wlkj.py run <脚本>')
|
|
161
|
+
# 这样 cli.js 的 'run' 和直接 'wlkj.py xxx.py' 都能走单一入口, 不需另维护路径表
|
|
162
|
+
hit = _find_script_by_name(scripts_root, cmd)
|
|
163
|
+
if hit:
|
|
164
|
+
script_path = hit
|
|
165
|
+
r = subprocess.run([sys.executable, script_path] + rest)
|
|
166
|
+
return r.returncode
|
|
167
|
+
sys.stderr.write('未知命令: %s\n' % cmd)
|
|
168
|
+
sys.stderr.write('可用命令: %s\n' % ', '.join(sorted(DISPATCH.keys())))
|
|
169
|
+
sys.stderr.write('提示: 也可用 wlkj.py <脚本名.py> 递归查找脚本\n')
|
|
170
|
+
return 1
|
|
171
|
+
|
|
172
|
+
# scripts/ 根 = __file__ 的上两级 (orchestration/ → scripts/)
|
|
173
|
+
scripts_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
174
|
+
script_path = os.path.join(scripts_root, script)
|
|
175
|
+
if not os.path.isfile(script_path):
|
|
176
|
+
sys.stderr.write('脚本不存在: %s\n' % script_path)
|
|
177
|
+
return 1
|
|
178
|
+
|
|
179
|
+
# 透明转发: 用当前 python 跑目标脚本, 透传所有参数和 exit code
|
|
180
|
+
r = subprocess.run([sys.executable, script_path] + rest)
|
|
181
|
+
return r.returncode
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
if __name__ == '__main__':
|
|
185
|
+
sys.exit(main())
|
|
File without changes
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
<div align="right">
|
|
2
|
+
<details>
|
|
3
|
+
<summary>🌐 Language</summary>
|
|
4
|
+
<div>
|
|
5
|
+
<div align="center">
|
|
6
|
+
<a href="https://openaitx.github.io/view.html?user=eze-is&project=web-access&lang=en">English</a>
|
|
7
|
+
| <a href="https://openaitx.github.io/view.html?user=eze-is&project=web-access&lang=zh-CN">简体中文</a>
|
|
8
|
+
| <a href="https://openaitx.github.io/view.html?user=eze-is&project=web-access&lang=zh-TW">繁體中文</a>
|
|
9
|
+
| <a href="https://openaitx.github.io/view.html?user=eze-is&project=web-access&lang=ja">日本語</a>
|
|
10
|
+
| <a href="https://openaitx.github.io/view.html?user=eze-is&project=web-access&lang=ko">한국어</a>
|
|
11
|
+
| <a href="https://openaitx.github.io/view.html?user=eze-is&project=web-access&lang=fr">Français</a>
|
|
12
|
+
| <a href="https://openaitx.github.io/view.html?user=eze-is&project=web-access&lang=de">Deutsch</a>
|
|
13
|
+
| <a href="https://openaitx.github.io/view.html?user=eze-is&project=web-access&lang=es">Español</a>
|
|
14
|
+
| <a href="https://openaitx.github.io/view.html?user=eze-is&project=web-access&lang=pt">Português</a>
|
|
15
|
+
| <a href="https://openaitx.github.io/view.html?user=eze-is&project=web-access&lang=ru">Русский</a>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</details>
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<img width="879" height="376" alt="image" src="https://github.com/user-attachments/assets/a87fd816-a0b5-4264-b01c-9466eae90723" />
|
|
22
|
+
|
|
23
|
+
<p align="center">
|
|
24
|
+
<b>给 AI Agent 装上完整联网能力的 Skill。</b><br/>
|
|
25
|
+
<a href="https://web-access.eze.is">🌐 官网</a> · <a href="https://mp.weixin.qq.com/s/rps5YVB6TchT9npAaIWKCw">📖 设计详解</a> · <a href="#安装">⚡ 快速安装</a>
|
|
26
|
+
</p>
|
|
27
|
+
|
|
28
|
+
AI Agent 原本的联网能力(WebSearch、WebFetch)缺少调度策略和浏览器自动化能力。这个 Agent Skill 补上的是:**联网策略 + CDP 浏览器操作 + 站点经验积累**。兼容所有支持 SKILL.md 的 Agent(Claude Code、Cursor、Gemini CLI、Codex CLI 等)。
|
|
29
|
+
|
|
30
|
+
> 推荐必读:[Web Access:一个 Skill,拉满 Agent 联网和浏览器能力](https://mp.weixin.qq.com/s/rps5YVB6TchT9npAaIWKCw) ,完整介绍了 Web-Access Skill 的开发细节与 Agent Skill 设计哲学,帮助你也能写出类似通用、高上限的 Skill
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## v2.5.2 能力
|
|
35
|
+
|
|
36
|
+
| 能力 | 说明 |
|
|
37
|
+
|------|------|
|
|
38
|
+
| 联网工具自动选择 | WebSearch / WebFetch / curl / Jina / CDP,按场景自主判断,可任意组合 |
|
|
39
|
+
| CDP Proxy 浏览器操作 | 直连用户日常浏览器(Chrome / Edge / Chromium 系),天然携带登录态,支持动态页面、交互操作、视频截帧 |
|
|
40
|
+
| 三种点击方式 | `/click`(JS click)、`/clickAt`(CDP 真实鼠标事件)、`/setFiles`(文件上传) |
|
|
41
|
+
| 本地浏览器书签/历史检索 | `find-url.mjs` 跨 Chrome / Edge 查询公网搜不到的目标(内部系统)或用户访问过的页面,支持关键词/时间窗/访问频度排序 |
|
|
42
|
+
| 并行分治 | 多目标时分发子 Agent 并行执行,共享一个 Proxy,tab 级隔离 |
|
|
43
|
+
| 站点经验积累 | 按域名存储操作经验(URL 模式、平台特征、已知陷阱),跨 session 复用 |
|
|
44
|
+
| 媒体提取 | 从 DOM 直取图片/视频 URL,或对视频任意时间点截帧分析 |
|
|
45
|
+
|
|
46
|
+
**v2.5.2 更新:**
|
|
47
|
+
- **Microsoft Edge 支持** — CDP Proxy 不再绑定 Chrome,新增 Edge 适配(及 Chromium、Chrome Canary 等 Chromium 系,通过同一套自动发现机制接入)。在 `edge://inspect/#remote-debugging` 勾选 "Allow remote debugging for this browser instance" 即可
|
|
48
|
+
- **浏览器偏好持久化** — 新增 `config.env`(gitignored,首次运行从模板创建),通过 `WEB_ACCESS_BROWSER` 固定默认浏览器;多浏览器同时开启 toggle 时 Agent 会询问偏好。也支持单次覆盖 `--browser <chrome|edge>`
|
|
49
|
+
- **不擅自降级** — 偏好/指定的浏览器没启动或没开 toggle 时硬错并给出明确处理步骤,不会悄悄连到别的浏览器;proxy 首次成功连接后 pin 住浏览器 id,避免运行中漂移
|
|
50
|
+
- **find-url 也支持 Edge** — 本地书签/历史检索默认遍历 Chrome 与 Edge,可用 `--browser <chrome|edge>` 限定单一浏览器
|
|
51
|
+
|
|
52
|
+
<details><summary>v2.5.0 更新</summary>
|
|
53
|
+
|
|
54
|
+
- **本地 Chrome 资源检索** — 新增 `scripts/find-url.mjs`,从本地 Chrome 书签/历史按关键词/时间窗/访问频度定位 URL。典型场景:用户提到组织内部系统("我们的 XX 平台"等公网搜不到的目标)、回查之前访问过但不记得地址的页面、查看最近高频访问网站等(场景感谢 @MVPGFC 在 #60 提出)
|
|
55
|
+
</details>
|
|
56
|
+
|
|
57
|
+
<details><summary>v2.4.3 更新</summary>
|
|
58
|
+
|
|
59
|
+
- **修复 CLAUDE_SKILL_DIR 路径问题** — bash 代码块改用 `${CLAUDE_SKILL_DIR}` 字符串替换语法,修复 Windows Git Bash 路径转换错误和变量未设置问题(#47 #46)
|
|
60
|
+
- **站点经验列表合并到前置检查** — 启动检查通过后自动输出已有站点经验列表,移除不可靠的 `!` 内联注入
|
|
61
|
+
</details>
|
|
62
|
+
|
|
63
|
+
<details><summary>v2.4.1 更新</summary>
|
|
64
|
+
|
|
65
|
+
- **跨平台支持** — 脚本从 bash 迁移到 Node.js,Windows / Linux / macOS 均可使用
|
|
66
|
+
- **DOM 边界穿透** — 新增技术事实:eval 递归遍历可穿透 Shadow DOM、iframe 等选择器不可跨越的边界
|
|
67
|
+
</details>
|
|
68
|
+
|
|
69
|
+
<details><summary>v2.4 更新</summary>
|
|
70
|
+
|
|
71
|
+
- **站点内 URL 可靠性** — 新增事实说明:站点生成的链接自带完整上下文,手动构造的 URL 可能缺失隐式必要参数
|
|
72
|
+
- **平台错误提示不可信** — 新增技术事实:平台返回的"内容不存在"等提示可能是访问方式问题而非内容本身问题
|
|
73
|
+
- **小红书站点经验增强** — xsec_token 机制、创作者平台状态校验、暂存草稿流程
|
|
74
|
+
</details>
|
|
75
|
+
|
|
76
|
+
<details><summary>v2.3 更新</summary>
|
|
77
|
+
|
|
78
|
+
- **浏览哲学重构** — 更清晰的「像人一样思考」框架,强调目标驱动而非步骤驱动
|
|
79
|
+
- **Jina 积极推荐** — 明确鼓励在合适场景主动使用 Jina 节省 token
|
|
80
|
+
- **子 Agent prompt 指引优化** — 明确加载写法,增加避免动词暗示执行方式的说明
|
|
81
|
+
</details>
|
|
82
|
+
|
|
83
|
+
## 安装
|
|
84
|
+
|
|
85
|
+
**方式一:npx skills 一键安装(推荐)**
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
npx skills add eze-is/web-access
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
> [skills CLI](https://github.com/vercel-labs/skills) 是开源的 Agent Skill 包管理器,自动检测你的 Agent 环境并安装到正确位置。
|
|
92
|
+
|
|
93
|
+
**方式二:让 Agent 自动安装**
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
帮我安装这个 skill:https://github.com/eze-is/web-access
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**方式三:Plugin 安装(Claude Code)**
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
claude plugin marketplace add https://github.com/eze-is/web-access
|
|
103
|
+
claude plugin install web-access@web-access --scope user
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**方式四:手动**
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
git clone https://github.com/eze-is/web-access ~/.claude/skills/web-access
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## 前置配置(CDP 模式)
|
|
113
|
+
|
|
114
|
+
CDP 模式需要 **Node.js 22+** 和浏览器(Chrome / Edge)开启远程调试:
|
|
115
|
+
|
|
116
|
+
1. 在你想用的浏览器地址栏打开对应 inspect 页面:
|
|
117
|
+
- Chrome:`chrome://inspect/#remote-debugging`
|
|
118
|
+
- Edge:`edge://inspect/#remote-debugging`
|
|
119
|
+
2. 勾选 **Allow remote debugging for this browser instance**(可能需要重启浏览器)
|
|
120
|
+
|
|
121
|
+
### 浏览器偏好(config.env)
|
|
122
|
+
|
|
123
|
+
skill 长期偏好保存在 `${CLAUDE_SKILL_DIR}/config.env`(首次运行自动从 `config.env.template` 创建,gitignored):
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# 留空 = 每次启动都询问偏好;设值 = 固定使用该浏览器
|
|
127
|
+
WEB_ACCESS_BROWSER=edge
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
合法值:`chrome` / `edge`
|
|
131
|
+
|
|
132
|
+
**临时用别的浏览器**(不修改 config.env):
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
node "${CLAUDE_SKILL_DIR}/scripts/check-deps.mjs" --browser chrome
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**切换浏览器**(proxy 已连接旧的):
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
pkill -f cdp-proxy.mjs && node "${CLAUDE_SKILL_DIR}/scripts/check-deps.mjs"
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
环境检查(Agent 运行时会自动完成前置检查,无需手动执行):
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
node "${CLAUDE_SKILL_DIR}/scripts/check-deps.mjs"
|
|
148
|
+
# $CLAUDE_SKILL_DIR 是 skill 加载时自动设置的环境变量
|
|
149
|
+
# 手动运行请替换为实际路径,如 ~/.claude/skills/web-access
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## CDP Proxy API
|
|
153
|
+
|
|
154
|
+
Proxy 通过 WebSocket 直连浏览器(兼容 `chrome://inspect` / `edge://inspect` 方式,无需命令行参数启动),提供 HTTP API:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
# 启动(Agent 会自动管理 Proxy 生命周期,无需手动启动)
|
|
158
|
+
node "${CLAUDE_SKILL_DIR}/scripts/cdp-proxy.mjs" &
|
|
159
|
+
|
|
160
|
+
# 页面操作
|
|
161
|
+
curl -s -X POST --data-raw 'https://example.com' http://localhost:3456/new # 新建 tab(v2.5.3 起 URL 走 POST body)
|
|
162
|
+
curl -s -X POST "http://localhost:3456/eval?target=ID" -d 'document.title' # 执行 JS
|
|
163
|
+
curl -s -X POST "http://localhost:3456/click?target=ID" -d 'button.submit' # JS 点击
|
|
164
|
+
curl -s -X POST "http://localhost:3456/clickAt?target=ID" -d '.upload-btn' # 真实鼠标点击
|
|
165
|
+
curl -s -X POST "http://localhost:3456/setFiles?target=ID" \
|
|
166
|
+
-d '{"selector":"input[type=file]","files":["/path/to/file.png"]}' # 文件上传
|
|
167
|
+
curl -s "http://localhost:3456/screenshot?target=ID&file=/tmp/shot.png" # 截图
|
|
168
|
+
curl -s "http://localhost:3456/scroll?target=ID&direction=bottom" # 滚动
|
|
169
|
+
curl -s "http://localhost:3456/close?target=ID" # 关闭 tab
|
|
170
|
+
curl -s "http://localhost:3456/health" # 查看状态(含 managedTabs 数量)
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Proxy 会自动追踪通过 `/new` 创建的 tab,闲置 15 分钟后自动关闭,防止 Agent 异常退出时留下孤儿 tab。可通过环境变量 `CDP_TAB_IDLE_TIMEOUT`(单位毫秒)调整超时时间。
|
|
174
|
+
|
|
175
|
+
## ⚠️ 使用前提醒
|
|
176
|
+
|
|
177
|
+
通过浏览器自动化操作社交平台(如小红书)存在账号被平台限流或封禁的风险。**强烈建议使用小号进行操作。**
|
|
178
|
+
|
|
179
|
+
## 使用
|
|
180
|
+
|
|
181
|
+
安装后直接让 Agent 执行联网任务,skill 自动接管:
|
|
182
|
+
|
|
183
|
+
- "帮我搜索 xxx 最新进展"
|
|
184
|
+
- "读一下这个页面:[URL]"
|
|
185
|
+
- "去小红书搜索 xxx 的账号"
|
|
186
|
+
- "帮我在创作者平台发一篇图文"
|
|
187
|
+
- "同时调研这 5 个产品的官网,给我对比摘要"
|
|
188
|
+
|
|
189
|
+
## 设计哲学
|
|
190
|
+
|
|
191
|
+
> Skill = 哲学 + 技术事实,不是操作手册。讲清 tradeoff 让 AI 自己选,不替它推理。
|
|
192
|
+
|
|
193
|
+
详见 [SKILL.md](./SKILL.md) 中的浏览哲学部分。
|
|
194
|
+
|
|
195
|
+
## License
|
|
196
|
+
|
|
197
|
+
MIT · 作者:[一泽 Eze](https://github.com/eze-is) · [官网](https://web-access.eze.is)
|
|
198
|
+
|
|
199
|
+
## Star History
|
|
200
|
+
|
|
201
|
+
[](https://star-history.com/#eze-is/web-access&Date)
|
|
202
|
+
|
|
203
|
+
## Clawhub Download History
|
|
204
|
+
|
|
205
|
+
[](https://skill-history.com/eze-is/web-access)
|
|
206
|
+
|
|
207
|
+
<img width="1280" height="306" alt="image" src="https://github.com/user-attachments/assets/2afa25c2-3730-413e-b40f-94e52567249d" />
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: web-access
|
|
3
|
+
license: MIT
|
|
4
|
+
github: https://github.com/eze-is/web-access
|
|
5
|
+
description:
|
|
6
|
+
所有联网操作必须通过此 skill 处理,包括:搜索、网页抓取、登录后操作、网络交互等。
|
|
7
|
+
触发场景:用户要求搜索信息、查看网页内容、访问需要登录的网站、操作网页界面、抓取社交媒体内容(小红书、微博、推特等)、读取动态渲染页面、以及任何需要真实浏览器环境的网络任务。
|
|
8
|
+
metadata:
|
|
9
|
+
author: 一泽Eze
|
|
10
|
+
version: "2.5.3"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# web-access Skill
|
|
14
|
+
|
|
15
|
+
## 前置检查
|
|
16
|
+
|
|
17
|
+
在开始联网操作前,先检查 CDP 模式可用性:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
node "${CLAUDE_SKILL_DIR}/scripts/check-deps.mjs"
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Node.js 22+** 必需(使用原生 WebSocket)。
|
|
24
|
+
|
|
25
|
+
按脚本输出处理:
|
|
26
|
+
- `exit 0` → 继续
|
|
27
|
+
- `exit 2` → 需询问用户偏好,写入 `${CLAUDE_SKILL_DIR}/config.env` 的 `WEB_ACCESS_BROWSER`
|
|
28
|
+
- `exit 1` → 按 stdout 错误信息处理。若提示包含「Agent 处理顺序」,按其步骤执行(如先用系统命令打开浏览器后重跑),自动可解则不打扰用户;仍失败再向用户求助
|
|
29
|
+
|
|
30
|
+
支持参数 `--browser <chrome|edge>` 表达本次临时覆盖(不写 config.env)。
|
|
31
|
+
|
|
32
|
+
切换浏览器时,proxy 是长驻进程,需先 `pkill -f cdp-proxy.mjs` 再重跑 check-deps。
|
|
33
|
+
|
|
34
|
+
检查通过后并必须在回复中向用户直接展示以下须知,再启动 CDP Proxy 执行操作:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
温馨提示:部分站点对浏览器自动化操作检测严格,存在账号封禁风险。已内置防护措施但无法完全避免,Agent 继续操作即视为接受。
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## 浏览哲学
|
|
41
|
+
|
|
42
|
+
**像人一样思考,兼顾高效与适应性的完成任务。**
|
|
43
|
+
|
|
44
|
+
执行任务时不会过度依赖固有印象所规划的步骤,而是带着目标进入,边看边判断,遇到阻碍就解决,发现内容不够就深入——全程围绕「我要达成什么」做决策。这个 skill 的所有行为都应遵循这个逻辑。
|
|
45
|
+
|
|
46
|
+
**① 拿到请求** — 先明确用户要做什么,定义成功标准:什么算完成了?需要获取什么信息、执行什么操作、达到什么结果?这是后续所有判断的锚点。
|
|
47
|
+
|
|
48
|
+
**② 选择起点** — 根据任务性质、平台特征、达成条件,选一个最可能直达的方式作为第一步去验证。一次成功当然最好;不成功则在③中调整。比如,需要操作页面、需要登录态、已知静态方式不可达的平台(小红书、微信公众号等)→ 直接 CDP
|
|
49
|
+
|
|
50
|
+
**③ 过程校验** — 每一步的结果都是证据,不只是成功或失败的二元信号。用结果对照①的成功标准,更新你对目标的判断:路径在推进吗?结果的整体面貌(质量、相关度、量级)是否指向目标可达?发现方向错了立即调整,不在同一个方式上反复重试——搜索没命中不等于"还没找对方法",也可能是"目标不存在";API 报错、页面缺少预期元素、重试无改善,都是在告诉你该重新评估方向。遇到弹窗、登录墙等障碍,判断它是否真的挡住了目标:挡住了就处理,没挡住就绕过——内容可能已在页面 DOM 中,交互只是展示手段。
|
|
51
|
+
|
|
52
|
+
**④ 完成判断** — 对照定义的任务成功标准,确认任务完成后才停止,但也不要过度操作,不为了"完整"而浪费代价。
|
|
53
|
+
|
|
54
|
+
## 联网工具选择
|
|
55
|
+
|
|
56
|
+
- **确保信息的真实性,一手信息优于二手信息**:搜索引擎和聚合平台是信息发现入口。当多次搜索尝试后没有质的改进时,升级到更根本的获取方式:定位一手来源(官网、官方平台、原始页面)。
|
|
57
|
+
|
|
58
|
+
| 场景 | 工具 |
|
|
59
|
+
|------|------|
|
|
60
|
+
| 搜索摘要或关键词结果,发现信息来源 | **WebSearch** |
|
|
61
|
+
| URL 已知,需要从页面定向提取特定信息 | **WebFetch**(拉取网页内容,由小模型根据 prompt 提取,返回处理后结果) |
|
|
62
|
+
| URL 已知,需要原始 HTML 源码(meta、JSON-LD 等结构化字段) | **curl** |
|
|
63
|
+
| 非公开内容,或已知静态层无效的平台(小红书、微信公众号等公开内容也被反爬限制) | **浏览器 CDP**(直接,跳过静态层) |
|
|
64
|
+
| 需要登录态、交互操作,或需要像人一样在浏览器内自由导航探索 | **浏览器 CDP** |
|
|
65
|
+
|
|
66
|
+
浏览器 CDP 不要求 URL 已知——可从任意入口出发,通过页面内搜索、点击、跳转等方式找到目标内容。WebSearch、WebFetch、curl 均不处理登录态。
|
|
67
|
+
|
|
68
|
+
**Jina**(可选预处理层,可与 WebFetch/curl 组合使用,由于其特性可节省 tokens 消耗,请积极在任务合适时组合使用):第三方网络服务,可将网页转为 Markdown,大幅节省 token 但可能有信息损耗。调用方式为 `r.jina.ai/example.com`(URL 前加前缀,不保留原网址 http 前缀),限 20 RPM。适合文章、博客、文档、PDF 等以正文为核心的页面;对数据面板、商品页等非文章结构页面可能提取到错误区块。
|
|
69
|
+
|
|
70
|
+
进入浏览器层后,`/eval` 就是你的眼睛和手:
|
|
71
|
+
|
|
72
|
+
- **看**:用 `/eval` 查询 DOM,发现页面上的链接、按钮、表单、文本内容——相当于「看看这个页面有什么」
|
|
73
|
+
- **做**:用 `/click` 点击元素、`/scroll` 滚动加载、`/eval` 填表提交——像人一样在页面内自然导航
|
|
74
|
+
- **读**:用 `/eval` 提取文字内容,判断图片/视频是否承载核心信息——是则提取媒体 URL 定向读取或 `/screenshot` 视觉识别
|
|
75
|
+
|
|
76
|
+
浏览网页时,**先了解页面结构,再决定下一步动作**。不需要提前规划所有步骤。
|
|
77
|
+
|
|
78
|
+
### 补充:本地浏览器资源
|
|
79
|
+
|
|
80
|
+
用户指向**本人访问过的页面**("我之前看的那个讲 X 的文章"、"上次打开过的 XX 面板")或**组织内部系统**("我们的 XX 平台"、"公司那个 YY 系统"等公网搜不到的目标)时,检索本地浏览器(Chrome / Edge)书签/历史:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
node "${CLAUDE_SKILL_DIR}/scripts/find-url.mjs" [关键词...] [--only bookmarks|history] [--browser chrome|edge] [--limit N] [--since 1d|7h|YYYY-MM-DD] [--sort recent|visits]
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
关键词空格分词、多词 AND,匹配 title + url(可省略);默认遍历所有已安装的 Chromium 系浏览器(Chrome、Edge),`--browser` 限定单一来源;`--since` / `--sort` 仅作用于历史;默认按最近访问倒序,`--sort visits` 按访问次数排序(适合"高频访问的网站"这类场景)。
|
|
87
|
+
|
|
88
|
+
### 程序化操作与 GUI 交互
|
|
89
|
+
|
|
90
|
+
浏览器内操作页面有两种方式:
|
|
91
|
+
|
|
92
|
+
- **程序化方式**(构造 URL 直接导航、eval 操作 DOM):成功时速度快、精确,但对网站来说不是正常用户行为,可能触发反爬机制。
|
|
93
|
+
- **GUI 交互**(点击按钮、填写输入框、滚动浏览):GUI 是为人设计的,网站不会限制正常的 UI 操作,确定性最高,但步骤多、速度慢。
|
|
94
|
+
|
|
95
|
+
根据对目标平台的了解来灵活选择方式。GUI 交互也是程序化方式的有效探测——通过一次真实交互观察站点的实际行为(URL 模式、必需参数、页面跳转逻辑),为后续程序化操作提供依据;同时当程序化方式受阻时,GUI 交互是可靠的兜底。
|
|
96
|
+
|
|
97
|
+
**站点内交互产生的链接是可靠的**:通过用户视角中的可交互单元(卡片、条目、按钮)进行的站点内交互,自然到达的 URL 天然携带平台所需的完整上下文。而手动构造的 URL 可能缺失隐式必要参数,导致被拦截、返回错误页面、甚至触发反爬。
|
|
98
|
+
|
|
99
|
+
## 浏览器 CDP 模式
|
|
100
|
+
|
|
101
|
+
通过 CDP Proxy 直连用户日常浏览器(Chrome / Edge / Chromium 等 Chromium 系),天然携带登录态,无需启动独立浏览器。
|
|
102
|
+
若无用户明确要求,不主动操作用户已有 tab,所有操作都在自己创建的后台 tab 中进行,保持对用户环境的最小侵入。不关闭用户 tab 的前提下,完成任务后关闭自己创建的 tab,保持环境整洁。
|
|
103
|
+
|
|
104
|
+
### 启动
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
node "${CLAUDE_SKILL_DIR}/scripts/check-deps.mjs"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
脚本会依次检查 Node.js、浏览器调试端口,并确保 Proxy 已连接(未运行则自动启动并等待)。Proxy 启动后持续运行。
|
|
111
|
+
|
|
112
|
+
### Proxy API
|
|
113
|
+
|
|
114
|
+
所有操作通过 curl 调用 HTTP API:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# 列出用户已打开的 tab
|
|
118
|
+
curl -s http://localhost:3456/targets
|
|
119
|
+
|
|
120
|
+
# 创建新后台 tab(自动等待加载)— URL 走 POST body,避免目标 URL 含 query 时被切分
|
|
121
|
+
curl -s -X POST --data-raw 'https://example.com' http://localhost:3456/new
|
|
122
|
+
|
|
123
|
+
# 页面信息
|
|
124
|
+
curl -s "http://localhost:3456/info?target=ID"
|
|
125
|
+
|
|
126
|
+
# 执行任意 JS:可读写 DOM、提取数据、操控元素、触发状态变更、提交表单、调用内部方法
|
|
127
|
+
curl -s -X POST "http://localhost:3456/eval?target=ID" -d 'document.title'
|
|
128
|
+
|
|
129
|
+
# 捕获页面渲染状态(含视频当前帧)
|
|
130
|
+
curl -s "http://localhost:3456/screenshot?target=ID&file=/tmp/shot.png"
|
|
131
|
+
|
|
132
|
+
# 导航(URL 走 POST body,target 走 query)、后退
|
|
133
|
+
curl -s -X POST --data-raw 'https://example.com' "http://localhost:3456/navigate?target=ID"
|
|
134
|
+
curl -s "http://localhost:3456/back?target=ID"
|
|
135
|
+
|
|
136
|
+
# 点击(POST body 为 CSS 选择器)— JS el.click(),简单快速,覆盖大多数场景
|
|
137
|
+
curl -s -X POST "http://localhost:3456/click?target=ID" -d 'button.submit'
|
|
138
|
+
|
|
139
|
+
# 真实鼠标点击 — CDP Input.dispatchMouseEvent,算用户手势,能触发文件对话框
|
|
140
|
+
curl -s -X POST "http://localhost:3456/clickAt?target=ID" -d 'button.upload'
|
|
141
|
+
|
|
142
|
+
# 文件上传 — 直接设置 file input 的本地文件路径,绕过文件对话框
|
|
143
|
+
curl -s -X POST "http://localhost:3456/setFiles?target=ID" -d '{"selector":"input[type=file]","files":["/path/to/file.png"]}'
|
|
144
|
+
|
|
145
|
+
# 滚动(触发懒加载)
|
|
146
|
+
curl -s "http://localhost:3456/scroll?target=ID&y=3000"
|
|
147
|
+
curl -s "http://localhost:3456/scroll?target=ID&direction=bottom"
|
|
148
|
+
|
|
149
|
+
# 关闭 tab
|
|
150
|
+
curl -s "http://localhost:3456/close?target=ID"
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### 页面内导航
|
|
154
|
+
|
|
155
|
+
两种方式打开页面内的链接:
|
|
156
|
+
|
|
157
|
+
- **`/click`**:在当前 tab 内直接点击用户视角中的可交互单元,简单直接,串行处理。适合需要在同一页面内连续操作的场景,如点击展开、翻页、进入详情等。
|
|
158
|
+
- **`/new` + 完整 URL**:使用目标链接的完整地址(包含所有URL参数),在新 tab 中打开。适合需要同时访问多个页面的场景。
|
|
159
|
+
|
|
160
|
+
很多网站的链接包含会话相关的参数(如 token),这些参数是正常访问所必需的。提取 URL 时应保留完整地址,不要裁剪或省略参数。URL 通过 POST body 原样传入 `/new` 或 `/navigate`。
|
|
161
|
+
|
|
162
|
+
> **v2.5.3 迁移提示**:若引用的站点经验文件(`references/site-patterns/*.md`)或其它脚本中仍含 `GET /new?url=...` 或 `/navigate?target=...&url=...` 的旧写法,调用会收到迁移指引。按 [`references/migration-2.5.3.md`](references/migration-2.5.3.md) 就地改写为 POST body 后再使用,并顺手把该站点经验文件更新掉。
|
|
163
|
+
|
|
164
|
+
### 媒体资源提取
|
|
165
|
+
|
|
166
|
+
判断内容在图片里时,用 `/eval` 从 DOM 直接拿图片 URL,再定向读取——比全页截图精准得多。
|
|
167
|
+
|
|
168
|
+
### 技术事实
|
|
169
|
+
- 页面中存在大量已加载但未展示的内容——轮播中非当前帧的图片、折叠区块的文字、懒加载占位元素等,它们存在于 DOM 中但对用户不可见。以数据结构(容器、属性、节点关系)为单位思考,可以直接触达这些内容。
|
|
170
|
+
- DOM 中存在选择器不可跨越的边界(Shadow DOM 的 `shadowRoot`、iframe 的 `contentDocument`等)。eval 递归遍历可一次穿透所有层级,返回带标签的结构化内容,适合快速了解未知页面的完整结构。
|
|
171
|
+
- `/scroll` 到底部会触发懒加载,使未进入视口的图片完成加载。提取图片 URL 前若未滚动,部分图片可能尚未加载。
|
|
172
|
+
- 拿到媒体资源 URL 后,公开资源可直接下载到本地后用读取;需要登录态才可获取的资源才需要在浏览器内 navigate + screenshot。
|
|
173
|
+
- 短时间内密集打开大量页面(如批量 `/new`)可能触发网站的反爬风控。
|
|
174
|
+
- 平台返回的"内容不存在""页面不见了"等提示不一定反映真实状态,也可能是访问方式的问题(如 URL 缺失必要参数、触发反爬)而非内容本身的问题。
|
|
175
|
+
|
|
176
|
+
### 视频内容获取
|
|
177
|
+
|
|
178
|
+
用户浏览器真实渲染,截图可捕获当前视频帧。核心能力:通过 `/eval` 操控 `<video>` 元素(获取时长、seek 到任意时间点、播放/暂停/全屏),配合 `/screenshot` 采帧,可对视频内容进行离散采样分析。
|
|
179
|
+
|
|
180
|
+
### 登录判断
|
|
181
|
+
|
|
182
|
+
用户日常浏览器天然携带登录态,大多数常用网站已登录。
|
|
183
|
+
|
|
184
|
+
登录判断的核心问题只有一个:**目标内容拿到了吗?**
|
|
185
|
+
|
|
186
|
+
打开页面后先尝试获取目标内容。只有当确认**目标内容无法获取**且判断登录能解决时,才告知用户:
|
|
187
|
+
> "当前页面在未登录状态下无法获取[具体内容],请在你的浏览器中登录 [网站名],完成后告诉我继续。"
|
|
188
|
+
|
|
189
|
+
登录完成后无需重启任何东西,直接刷新页面继续。
|
|
190
|
+
|
|
191
|
+
### 任务结束
|
|
192
|
+
|
|
193
|
+
用 `/close` 关闭自己创建的 tab,必须保留用户原有的 tab 不受影响。
|
|
194
|
+
|
|
195
|
+
Proxy 持续运行,不建议主动停止——重启后需要在浏览器中重新授权 CDP 连接。
|
|
196
|
+
|
|
197
|
+
## 并行调研:子 Agent 分治策略
|
|
198
|
+
|
|
199
|
+
任务包含多个**独立**调研目标时(如同时调研 N 个项目、N 个来源),鼓励合理分治给子 Agent 并行执行,而非主 Agent 串行处理。
|
|
200
|
+
|
|
201
|
+
**好处:**
|
|
202
|
+
- **速度**:多子 Agent 并行,总耗时约等于单个子任务时长
|
|
203
|
+
- **上下文保护**:抓取内容不进入主 Agent 上下文,主 Agent 只接收摘要,节省 token
|
|
204
|
+
|
|
205
|
+
**并行 CDP 操作**:每个子 Agent 在当前用户浏览器实例中,自行创建所需的后台 tab(`/new`),自行操作,任务结束自行关闭(`/close`)。所有子 Agent 共享一个浏览器、一个 Proxy,通过不同 targetId 操作不同 tab,无竞态风险。
|
|
206
|
+
|
|
207
|
+
**子 Agent Prompt 写法:目标导向,而非步骤指令**
|
|
208
|
+
- 必须在子 Agent prompt 中写 `必须加载 web-access skill 并遵循指引` ,子 Agent 会自动加载 skill,无需在 prompt 中复制 skill 内容或指定路径。
|
|
209
|
+
- 子 Agent 有自主判断能力。主 Agent 的职责是说清楚**要什么**,仅在必要与确信时限定**怎么做**。过度指定步骤会剥夺子 Agent 的判断空间,反而引入主 Agent 的假设错误。**避免 prompt 用词对子 Agent 行为的暗示**:「搜索xx」会把子 Agent 锚定到 WebSearch,而实际上有些反爬站点需要 CDP 直接访问主站才能有效获取内容。主 Agent 写 prompt 时应描述目标(「获取」「调研」「了解」),避免用暗示具体手段的动词(「搜索」「抓取」「爬取」)。
|
|
210
|
+
|
|
211
|
+
**分治判断标准:**
|
|
212
|
+
|
|
213
|
+
| 适合分治 | 不适合分治 |
|
|
214
|
+
|----------|-----------|
|
|
215
|
+
| 目标相互独立,结果互不依赖 | 目标有依赖关系,下一个需要上一个的结果 |
|
|
216
|
+
| 每个子任务量足够大(多页抓取、多轮搜索) | 简单单页查询,分治开销大于收益 |
|
|
217
|
+
| 需要 CDP 浏览器或长时间运行的任务 | 几次 WebSearch / Jina 就能完成的轻量查询 |
|
|
218
|
+
|
|
219
|
+
## 信息核实类任务
|
|
220
|
+
|
|
221
|
+
核实的目标是**一手来源**,而非更多的二手报道。多个媒体引用同一个错误会造成循环印证假象。
|
|
222
|
+
|
|
223
|
+
搜索引擎和聚合平台是信息发现入口,是**定位**信息的工具,不可用于直接**证明**真伪。找到来源后,直接访问读取原文。同一原则适用于工具能力/用法的调研——官方文档是一手来源,不确定时先查文档或源码,不猜测。
|
|
224
|
+
|
|
225
|
+
| 信息类型 | 一手来源 |
|
|
226
|
+
|----------|---------|
|
|
227
|
+
| 政策/法规 | 发布机构官网 |
|
|
228
|
+
| 企业公告 | 公司官方新闻页 |
|
|
229
|
+
| 学术声明 | 原始论文/机构官网 |
|
|
230
|
+
| 工具能力/用法 | 官方文档、源码 |
|
|
231
|
+
|
|
232
|
+
**找不到官网时**:权威媒体的原创报道(非转载)可作为次级依据,但需向用户说明:"未找到官方原文,以下核实来自[媒体名]报道,存在转述误差可能。"单一来源时同样向用户声明。
|
|
233
|
+
|
|
234
|
+
## 站点经验
|
|
235
|
+
|
|
236
|
+
操作中积累的特定网站经验,按域名存储在 `references/site-patterns/` 下。
|
|
237
|
+
|
|
238
|
+
确定目标网站后,如果前置检查输出的 site-patterns 列表中有匹配的站点,必须读取对应文件获取先验知识(平台特征、有效模式、已知陷阱)。经验内容标注了发现日期,当作可能有效的提示而非保证——如果按经验操作失败,回退通用模式并更新经验文件。
|
|
239
|
+
|
|
240
|
+
CDP 操作成功完成后,如果发现了有必要记录经验的新站点或新模式(URL 结构、平台特征、操作策略),主动写入对应的站点经验文件。只写经过验证的事实,不写未确认的猜测。
|
|
241
|
+
|
|
242
|
+
文件格式:
|
|
243
|
+
```markdown
|
|
244
|
+
---
|
|
245
|
+
domain: example.com
|
|
246
|
+
aliases: [示例, Example]
|
|
247
|
+
updated: 2026-03-19
|
|
248
|
+
---
|
|
249
|
+
## 平台特征
|
|
250
|
+
架构、反爬行为、登录需求、内容加载方式等事实
|
|
251
|
+
|
|
252
|
+
## 有效模式
|
|
253
|
+
已验证的 URL 模式、操作策略、选择器
|
|
254
|
+
|
|
255
|
+
## 已知陷阱
|
|
256
|
+
什么会失败以及为什么
|
|
257
|
+
```
|
|
258
|
+
经验/陷阱内容标注发现日期,当作"可能有效的提示"而非"保证正确的事实"。
|
|
259
|
+
|
|
260
|
+
## References 索引
|
|
261
|
+
|
|
262
|
+
| 文件 | 何时加载 |
|
|
263
|
+
|------|---------|
|
|
264
|
+
| `references/cdp-api.md` | 需要 CDP API 详细参考、JS 提取模式、错误处理时 |
|
|
265
|
+
| `references/site-patterns/{domain}.md` | 确定目标网站后,读取对应站点经验 |
|