@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
|
@@ -1,196 +1,208 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
def
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
a
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
log('
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# v3.0 路径自举: 引导到 common/bootstrap, 统一 sys.path 逻辑
|
|
3
|
+
import os as _o, sys as _s
|
|
4
|
+
_f = _o.path.abspath(__file__)
|
|
5
|
+
for _ in range(10):
|
|
6
|
+
_f = _o.path.dirname(_f)
|
|
7
|
+
_cp = _o.path.join(_f, 'foundation')
|
|
8
|
+
if _o.path.isfile(_o.path.join(_cp, 'bootstrap.py')):
|
|
9
|
+
break
|
|
10
|
+
if _cp not in _s.path: _s.path.insert(0, _cp)
|
|
11
|
+
from bootstrap import setup; setup()
|
|
12
|
+
from foundation.core.paths import get_repo_root
|
|
13
|
+
|
|
14
|
+
"""
|
|
15
|
+
全自动登录: 获取验证码 → ddddocr识别 → 页面JS加密提交 → 保存token
|
|
16
|
+
登录态保存到 auth-state.json, 后续测试复用(无需再次识别验证码)。
|
|
17
|
+
"""
|
|
18
|
+
import base64
|
|
19
|
+
import json
|
|
20
|
+
import os
|
|
21
|
+
import sys
|
|
22
|
+
import requests
|
|
23
|
+
import ddddocr
|
|
24
|
+
|
|
25
|
+
BASE_URL = 'https://icsqas.inforecloud.com'
|
|
26
|
+
API_PREFIX = '/test-api'
|
|
27
|
+
USERNAME = '15888888887'
|
|
28
|
+
PASSWORD = 'admin123'
|
|
29
|
+
CLIENT_ID = 'e5cd7e4891bf95d1d19206ce24a7b32e'
|
|
30
|
+
|
|
31
|
+
# RSA公钥 (从 .env.production)
|
|
32
|
+
RSA_PUBLIC_KEY_B64 = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDN/EkuOg1gq/t2/PUI8GpcJCsCFQgHkSHUEdk7ZPrEQYd8IM1hFkHmDJrCOQ+qUPqKHG9a5BAI44yE6FuPI9Vvqu2ZrCww/zryR7A+2n5jaKIG2rJG9KHDzT5mAVOJrlhBf8L2i7wZc8eWrNg0md0BlwEowQyVEEj9oIBlw/nqTwIDAQAB'
|
|
33
|
+
|
|
34
|
+
# 保存路径
|
|
35
|
+
SCRIPTS_DIR = get_repo_root()
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _read_developer():
|
|
39
|
+
"""读 .qoder/.developer 拿当前开发者名, 用于身份隔离。
|
|
40
|
+
多人共用 workspace 时, auth-state 必须按开发者分目录, 否则会串登录态。
|
|
41
|
+
没有身份 → 抛异常 (绝不 fallback 到 hupan/default, 防串号)。"""
|
|
42
|
+
dev_file = os.path.join(SCRIPTS_DIR, '..', '..', '.qoder', '.developer')
|
|
43
|
+
if os.path.isfile(dev_file):
|
|
44
|
+
for ln in open(dev_file, encoding='utf-8'):
|
|
45
|
+
if ln.strip().startswith('name='):
|
|
46
|
+
return ln.strip().split('=', 1)[1].strip()
|
|
47
|
+
raise RuntimeError(
|
|
48
|
+
'未检测到开发者身份(.qoder/.developer)。请先运行 /wl-init 注册身份。'
|
|
49
|
+
' (auth-state 按开发者分目录, 没身份无法隔离 → 拒绝执行防串号)'
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
STATE_FILE = os.path.join(SCRIPTS_DIR, '..', '..', 'workspace', 'members',
|
|
54
|
+
_read_developer(), 'auth-state.json')
|
|
55
|
+
|
|
56
|
+
out = []
|
|
57
|
+
def log(s=''):
|
|
58
|
+
out.append(s)
|
|
59
|
+
print(s)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def get_captcha():
|
|
63
|
+
"""获取验证码图片 + uuid"""
|
|
64
|
+
resp = requests.get(BASE_URL + API_PREFIX + '/auth/code', timeout=10)
|
|
65
|
+
data = resp.json().get('data', {})
|
|
66
|
+
return data.get('uuid'), data.get('img'), data.get('captchaEnabled', False)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def recognize_captcha(img_b64):
|
|
70
|
+
"""用 ddddocr 识别验证码图片, 并解析数学题(ICS 是 a op b = ? 形式).
|
|
71
|
+
返回算出的答案字符串; 解析失败返回 None."""
|
|
72
|
+
import re as _re
|
|
73
|
+
ocr = ddddocr.DdddOcr(show_ad=False)
|
|
74
|
+
img_bytes = base64.b64decode(img_b64)
|
|
75
|
+
raw = ocr.classification(img_bytes)
|
|
76
|
+
# 规范化运算符 (x/X/× → *, ÷ → /), 去掉 = ? 尾部
|
|
77
|
+
expr = raw.replace('x', '*').replace('X', '*').replace('×', '*').replace('÷', '/')
|
|
78
|
+
expr = expr.rstrip('=??').strip()
|
|
79
|
+
m = _re.match(r'^\s*(\d+)\s*([+\-*/])\s*(\d+)\s*$', expr)
|
|
80
|
+
if not m:
|
|
81
|
+
return None
|
|
82
|
+
a, op, b = int(m.group(1)), m.group(2), int(m.group(3))
|
|
83
|
+
if op == '+':
|
|
84
|
+
ans = a + b
|
|
85
|
+
elif op == '-':
|
|
86
|
+
ans = a - b
|
|
87
|
+
elif op == '*':
|
|
88
|
+
ans = a * b
|
|
89
|
+
elif op == '/':
|
|
90
|
+
ans = a // b if b else None
|
|
91
|
+
else:
|
|
92
|
+
return None
|
|
93
|
+
return str(ans) if ans is not None else None
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def encrypt_login(username, password, code, uuid):
|
|
97
|
+
"""用 RSA+AES 加密登录请求 (复现前端加密逻辑)。
|
|
98
|
+
使用 cryptography 库 (替代 pycryptodome)。"""
|
|
99
|
+
import os as _os
|
|
100
|
+
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
|
101
|
+
from cryptography.hazmat.primitives.padding import PKCS7
|
|
102
|
+
from cryptography.hazmat.primitives.asymmetric import padding as asym_padding
|
|
103
|
+
from cryptography.hazmat.primitives.serialization import load_der_public_key
|
|
104
|
+
|
|
105
|
+
# 1. 生成随机 AES 密钥 (前端用 randomUUID = 32 hex chars)
|
|
106
|
+
aes_key = _os.urandom(16).hex().encode('utf-8') # 32 bytes
|
|
107
|
+
|
|
108
|
+
# 2. AES-ECB-PKCS7 加密请求体
|
|
109
|
+
login_body = json.dumps({
|
|
110
|
+
'username': username,
|
|
111
|
+
'password': password,
|
|
112
|
+
'grantType': 'password',
|
|
113
|
+
'tenantId': '000000',
|
|
114
|
+
'clientId': CLIENT_ID,
|
|
115
|
+
'code': code,
|
|
116
|
+
'uuid': uuid,
|
|
117
|
+
}, ensure_ascii=False).encode('utf-8')
|
|
118
|
+
|
|
119
|
+
padder = PKCS7(128).padder()
|
|
120
|
+
padded = padder.update(login_body) + padder.finalize()
|
|
121
|
+
cipher = Cipher(algorithms.AES(aes_key), modes.ECB())
|
|
122
|
+
encryptor = cipher.encryptor()
|
|
123
|
+
encrypted_body = base64.b64encode(encryptor.update(padded) + encryptor.finalize()).decode()
|
|
124
|
+
|
|
125
|
+
# 3. RSA 加密 AES 密钥 (前端: encrypt(encryptBase64(aesKey)))
|
|
126
|
+
aes_key_b64 = base64.b64encode(aes_key).decode()
|
|
127
|
+
pub_key = load_der_public_key(base64.b64decode(RSA_PUBLIC_KEY_B64))
|
|
128
|
+
encrypted_key_bytes = pub_key.encrypt(aes_key_b64.encode('utf-8'), asym_padding.PKCS1v15())
|
|
129
|
+
encrypted_key = base64.b64encode(encrypted_key_bytes).decode()
|
|
130
|
+
|
|
131
|
+
return encrypted_body, encrypted_key
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def login():
|
|
135
|
+
"""全自动登录流程"""
|
|
136
|
+
log('=== 全自动登录 ===')
|
|
137
|
+
|
|
138
|
+
# 1. 获取验证码
|
|
139
|
+
uuid, img_b64, captcha_enabled = get_captcha()
|
|
140
|
+
log('验证码: enabled=%s, uuid=%s' % (captcha_enabled, uuid[:8] if uuid else 'N/A'))
|
|
141
|
+
|
|
142
|
+
if not captcha_enabled:
|
|
143
|
+
log('验证码未开启, 直接登录')
|
|
144
|
+
code = ''
|
|
145
|
+
uuid = ''
|
|
146
|
+
else:
|
|
147
|
+
# 2. OCR 识别 + 数学题解析
|
|
148
|
+
code = recognize_captcha(img_b64)
|
|
149
|
+
log('OCR识别验证码: %s' % code)
|
|
150
|
+
if code is None:
|
|
151
|
+
# ddddocr 没读对(数学题识别不稳定), 本次放弃, 让外层重试
|
|
152
|
+
log('验证码识别失败(数学题未解析), 重试')
|
|
153
|
+
return None
|
|
154
|
+
|
|
155
|
+
# 3. 加密 + 登录
|
|
156
|
+
try:
|
|
157
|
+
encrypted_body, encrypted_key = encrypt_login(USERNAME, PASSWORD, code, uuid)
|
|
158
|
+
log('加密完成, 发送登录请求...')
|
|
159
|
+
|
|
160
|
+
resp = requests.post(
|
|
161
|
+
BASE_URL + API_PREFIX + '/auth/login',
|
|
162
|
+
data=encrypted_body,
|
|
163
|
+
headers={
|
|
164
|
+
'Content-Type': 'application/json',
|
|
165
|
+
'encrypt-key': encrypted_key,
|
|
166
|
+
},
|
|
167
|
+
timeout=10,
|
|
168
|
+
)
|
|
169
|
+
result = resp.json()
|
|
170
|
+
log('登录响应: code=%s, msg=%s' % (result.get('code'), result.get('msg')))
|
|
171
|
+
|
|
172
|
+
if result.get('code') == 200 and result.get('data', {}).get('access_token'):
|
|
173
|
+
token = result['data']['access_token']
|
|
174
|
+
log('✓ 登录成功! token=%s...' % token[:20])
|
|
175
|
+
|
|
176
|
+
# 保存登录态
|
|
177
|
+
os.makedirs(os.path.dirname(STATE_FILE), exist_ok=True)
|
|
178
|
+
with open(STATE_FILE, 'w', encoding='utf-8') as f:
|
|
179
|
+
json.dump({
|
|
180
|
+
'access_token': token,
|
|
181
|
+
'base_url': BASE_URL,
|
|
182
|
+
'api_prefix': API_PREFIX,
|
|
183
|
+
'saved_at': __import__('datetime').datetime.now().isoformat(),
|
|
184
|
+
}, f, indent=2)
|
|
185
|
+
log('登录态已保存: %s' % STATE_FILE)
|
|
186
|
+
return token
|
|
187
|
+
else:
|
|
188
|
+
log('✗ 登录失败: %s' % json.dumps(result, ensure_ascii=False)[:200])
|
|
189
|
+
log(' 可能验证码识别错误, 重试...')
|
|
190
|
+
return None
|
|
191
|
+
except Exception as e:
|
|
192
|
+
log('登录异常: %s' % str(e))
|
|
193
|
+
return None
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
if __name__ == '__main__':
|
|
197
|
+
# 数学题验证码识别不稳定, 多重试几次 (实测 ~30% 一次读对, 20 次基本必中)
|
|
198
|
+
import time as _time
|
|
199
|
+
for attempt in range(20):
|
|
200
|
+
log('--- 尝试 %d ---' % (attempt + 1))
|
|
201
|
+
token = login()
|
|
202
|
+
if token:
|
|
203
|
+
break
|
|
204
|
+
_time.sleep(0.3)
|
|
205
|
+
else:
|
|
206
|
+
log('20次尝试均失败, 请检查账号/密码/验证码/网络')
|
|
207
|
+
|
|
208
|
+
open(os.path.join(SCRIPTS_DIR, '_login_log.txt'), 'w', encoding='utf-8').write('\n'.join(out))
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
|
+
# v3.0 路径自举: 引导到 common/bootstrap, 统一 sys.path 逻辑
|
|
3
|
+
import os as _o, sys as _s
|
|
4
|
+
_f = _o.path.abspath(__file__)
|
|
5
|
+
for _ in range(10):
|
|
6
|
+
_f = _o.path.dirname(_f)
|
|
7
|
+
_cp = _o.path.join(_f, 'foundation')
|
|
8
|
+
if _o.path.isfile(_o.path.join(_cp, 'bootstrap.py')):
|
|
9
|
+
break
|
|
10
|
+
if _cp not in _s.path: _s.path.insert(0, _cp)
|
|
11
|
+
from bootstrap import setup; setup()
|
|
12
|
+
|
|
2
13
|
"""
|
|
3
14
|
Automated test runner using Playwright (headless) + knowledge graph.
|
|
4
15
|
|
|
@@ -23,9 +34,9 @@ import sys
|
|
|
23
34
|
import time
|
|
24
35
|
import yaml
|
|
25
36
|
|
|
26
|
-
SCRIPTS = os.path.dirname(os.path.abspath(__file__))
|
|
37
|
+
SCRIPTS = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # 子包→scripts/根
|
|
27
38
|
sys.path.insert(0, SCRIPTS)
|
|
28
|
-
from
|
|
39
|
+
from foundation.core.paths import DATA_INDEX_DIR, PROJECT_ROOT
|
|
29
40
|
|
|
30
41
|
INDEX_DIR = str(DATA_INDEX_DIR)
|
|
31
42
|
CODE_DIR = str(PROJECT_ROOT / 'data' / 'code')
|