@hupan56/wlkj 3.3.7 → 3.3.9
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/package.json +1 -1
- package/templates/qoder/commands/optional/wl-spec.md +12 -2
- package/templates/qoder/commands/optional/wl-status.md +8 -0
- package/templates/qoder/commands/wl-code.md +8 -0
- package/templates/qoder/commands/wl-commit.md +11 -1
- package/templates/qoder/commands/wl-data.md +46 -0
- package/templates/qoder/commands/wl-fix.md +47 -0
- package/templates/qoder/commands/wl-init.md +2 -2
- package/templates/qoder/commands/wl-knowledge.md +41 -0
- package/templates/qoder/commands/wl-prd.md +23 -22
- package/templates/qoder/commands/wl-review.md +49 -0
- package/templates/qoder/commands/wl-search.md +23 -27
- package/templates/qoder/commands/wl-task.md +11 -1
- package/templates/qoder/commands/wl-test.md +8 -0
- package/templates/qoder/contracts/insight.md +55 -0
- package/templates/qoder/hooks/__pycache__/pre-tool-use-commit.cpython-39.pyc +0 -0
- package/templates/qoder/hooks/__pycache__/pre-tool-use.cpython-39.pyc +0 -0
- package/templates/qoder/hooks/__pycache__/session-start.cpython-39.pyc +0 -0
- package/templates/qoder/hooks/__pycache__/stop-eval.cpython-39.pyc +0 -0
- package/templates/qoder/hooks/pre-tool-use-commit.py +124 -0
- package/templates/qoder/hooks/session-start.py +20 -1
- package/templates/qoder/hooks/stop-eval.py +129 -0
- package/templates/qoder/scripts/capability/adapters/mcp.py +1 -0
- package/templates/qoder/scripts/capability/registry.py +0 -3
- package/templates/qoder/scripts/domain/integration/return_to_platform.py +1 -0
- package/templates/qoder/scripts/domain/integration/spec_upload.py +3 -3
- package/templates/qoder/scripts/domain/kg/build/build_entity_registry.py +12 -12
- package/templates/qoder/scripts/domain/kg/build/build_relations.py +12 -12
- package/templates/qoder/scripts/foundation/__pycache__/__init__.cpython-39.pyc +0 -0
- package/templates/qoder/scripts/foundation/io/__pycache__/__init__.cpython-39.pyc +0 -0
- package/templates/qoder/scripts/foundation/io/__pycache__/context_cache.cpython-39.pyc +0 -0
- package/templates/qoder/scripts/foundation/io/context_cache.py +94 -0
- package/templates/qoder/scripts/orchestration/__pycache__/wlkj.cpython-39.pyc +0 -0
- package/templates/qoder/scripts/orchestration/wlkj.py +95 -0
- package/templates/qoder/scripts/tool_guide.md +70 -0
- package/templates/qoder/scripts/validation/eval/__pycache__/alignment_matrix.cpython-39.pyc +0 -0
- package/templates/qoder/scripts/validation/eval/__pycache__/bf2_content_fidelity.cpython-39.pyc +0 -0
- package/templates/qoder/scripts/validation/eval/__pycache__/bf2_llmjudge.cpython-39.pyc +0 -0
- package/templates/qoder/scripts/validation/eval/__pycache__/bf_score.cpython-39.pyc +0 -0
- package/templates/qoder/scripts/validation/eval/__pycache__/code_flywheel.cpython-39.pyc +0 -0
- package/templates/qoder/scripts/validation/eval/__pycache__/dispatcher_ab.cpython-39.pyc +0 -0
- package/templates/qoder/scripts/validation/eval/__pycache__/feature_fidelity_flywheel.cpython-39.pyc +0 -0
- package/templates/qoder/scripts/validation/eval/__pycache__/gradient_matrix.cpython-39.pyc +0 -0
- package/templates/qoder/scripts/validation/eval/__pycache__/metrics_dashboard.cpython-39.pyc +0 -0
- package/templates/qoder/scripts/validation/eval/__pycache__/multi_turn_flywheel.cpython-39.pyc +0 -0
- package/templates/qoder/scripts/validation/eval/__pycache__/prd_fidelity_flywheel.cpython-39.pyc +0 -0
- package/templates/qoder/scripts/validation/eval/__pycache__/prd_flywheel.cpython-39.pyc +0 -0
- package/templates/qoder/scripts/validation/eval/__pycache__/prototype_fidelity_flywheel.cpython-39.pyc +0 -0
- package/templates/qoder/scripts/validation/eval/__pycache__/recall_flywheel.cpython-39.pyc +0 -0
- package/templates/qoder/scripts/validation/eval/__pycache__/robustness_flywheel.cpython-39.pyc +0 -0
- package/templates/qoder/scripts/validation/eval/__pycache__/speed_accuracy_flywheel.cpython-39.pyc +0 -0
- package/templates/qoder/scripts/validation/eval/__pycache__/task_flywheel.cpython-39.pyc +0 -0
- package/templates/qoder/scripts/validation/eval/__pycache__/token_flywheel.cpython-39.pyc +0 -0
- package/templates/qoder/scripts/validation/eval/alignment_matrix.py +176 -0
- package/templates/qoder/scripts/validation/eval/bf2_content_fidelity.py +110 -0
- package/templates/qoder/scripts/validation/eval/bf2_llmjudge.py +104 -0
- package/templates/qoder/scripts/validation/eval/bf_score.py +218 -0
- package/templates/qoder/scripts/validation/eval/code_flywheel.py +150 -0
- package/templates/qoder/scripts/validation/eval/dispatcher_ab.py +156 -0
- package/templates/qoder/scripts/validation/eval/dispatcher_ab_2026-07-21.json +23 -0
- package/templates/qoder/scripts/validation/eval/feature_fidelity_flywheel.py +143 -0
- package/templates/qoder/scripts/validation/eval/gradient_matrix.py +261 -0
- package/templates/qoder/scripts/validation/eval/gradient_matrix_baseline_2026-07-21.json +33 -0
- package/templates/qoder/scripts/validation/eval/metrics_dashboard.py +105 -0
- package/templates/qoder/scripts/validation/eval/multi_turn_flywheel.py +118 -0
- package/templates/qoder/scripts/validation/eval/prd_fidelity_flywheel.py +128 -0
- package/templates/qoder/scripts/validation/eval/prd_flywheel.py +148 -0
- package/templates/qoder/scripts/validation/eval/prototype_fidelity_flywheel.py +166 -0
- package/templates/qoder/scripts/validation/eval/recall_flywheel.py +148 -0
- package/templates/qoder/scripts/validation/eval/robustness_flywheel.py +139 -0
- package/templates/qoder/scripts/validation/eval/speed_accuracy_flywheel.py +188 -0
- package/templates/qoder/scripts/validation/eval/task_flywheel.py +124 -0
- package/templates/qoder/scripts/validation/eval/token_flywheel.py +88 -0
- package/templates/qoder/scripts/validation/metrics/__pycache__/lint_cases.cpython-39.pyc +0 -0
- package/templates/qoder/scripts/validation/metrics/eval_code_ac.py +177 -0
- package/templates/qoder/scripts/validation/metrics/lint_cases.py +170 -0
- package/templates/qoder/scripts/validation/test/__pycache__/test_context_cache.cpython-39.pyc +0 -0
- package/templates/qoder/scripts/validation/test/test_context_cache.py +78 -0
- package/templates/qoder/scripts/validation/test/test_lint_cases.py +60 -0
- package/templates/qoder/scripts/validation/test/test_pre_tool_use_commit.py +70 -0
- package/templates/qoder/settings.json +8 -0
- package/templates/qoder/skills/wl-spec/SKILL.md +1 -1
- package/templates/workspace/specs/REQ-TEST-CTX/.context-cache.json +1 -0
- package/templates/qoder/agents/design-agent.md +0 -20
- package/templates/qoder/agents/spec-generator.md +0 -21
- package/templates/qoder/scripts/capability/smoke_test_report.json.new +0 -94
- package/templates/qoder/scripts/domain/kg/extract/asset/__init__.py +0 -10
- package/templates/qoder/scripts/domain/kg/extract/asset/asset_tree.py +0 -57
- package/templates/qoder/scripts/domain/kg/extract/asset/discussion_importer.py +0 -62
- package/templates/qoder/scripts/domain/kg/extract/asset/prd_importer.py +0 -146
- package/templates/qoder/scripts/domain/kg/extract/asset/prototype_importer.py +0 -64
- package/templates/qoder/scripts/domain/kg/extract/asset/returns_importer.py +0 -52
- package/templates/qoder/scripts/domain/kg/extract/build_goal3.py +0 -104
- package/templates/qoder/scripts/domain/kg/extract/build_goal4.py +0 -55
- package/templates/qoder/scripts/domain/kg/extract/build_goal5.py +0 -95
- package/templates/qoder/scripts/domain/kg/extract/db/__init__.py +0 -8
- package/templates/qoder/scripts/domain/kg/extract/db/data_profile.py +0 -22
- package/templates/qoder/scripts/domain/kg/extract/db/fk_extractor.py +0 -55
- package/templates/qoder/scripts/domain/kg/extract/db/schema_extractor.py +0 -90
- package/templates/qoder/scripts/domain/kg/extract/inference/__init__.py +0 -9
- package/templates/qoder/scripts/domain/kg/extract/inference/community_summarizer.py +0 -206
- package/templates/qoder/scripts/domain/kg/extract/inference/embed_builder.py +0 -132
- package/templates/qoder/scripts/domain/kg/extract/inference/naming_matcher.py +0 -80
- package/templates/qoder/scripts/domain/kg/extract/inference/promote.py +0 -59
- package/templates/qoder/scripts/domain/kg/extract/inference/recompute.py +0 -93
- package/templates/qoder/scripts/domain/kg/extract/inference/weak_link.py +0 -421
- package/templates/qoder/scripts/domain/kg/extract/mybatis/__init__.py +0 -9
- package/templates/qoder/scripts/domain/kg/extract/mybatis/all.py +0 -79
- package/templates/qoder/scripts/domain/kg/extract/mybatis/mapper_parser.py +0 -99
- package/templates/qoder/scripts/domain/kg/extract/mybatis/relation_builder.py +0 -69
- package/templates/qoder/scripts/domain/kg/extract/mybatis/sql_extractor.py +0 -78
- package/templates/qoder/scripts/domain/kg/extract/prd/__init__.py +0 -8
- package/templates/qoder/scripts/domain/kg/extract/prd/prd_chunk_embed.py +0 -105
- package/templates/qoder/scripts/domain/kg/extract/prd/prd_llm_extract.py +0 -153
- package/templates/qoder/scripts/domain/kg/extract/prd/req_anchor.py +0 -120
- package/templates/qoder/scripts/domain/kg/graph/kg_link_db.py +0 -235
- package/templates/qoder/scripts/domain/kg/search/enrich_prompt.py +0 -238
- package/templates/qoder/scripts/domain/kg/server/perf_bench.py +0 -197
- package/templates/qoder/scripts/domain/kg/sync_repowiki.py +0 -109
- package/templates/qoder/scripts/engine/poller.py +0 -219
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"timestamp": "2026-06-26 21:25:55",
|
|
3
|
-
"servers": {
|
|
4
|
-
"qoder-knowledge-graph": {
|
|
5
|
-
"available": true,
|
|
6
|
-
"tools_indexed": 17,
|
|
7
|
-
"latency_ms": 437.0,
|
|
8
|
-
"sample_tools": [
|
|
9
|
-
"search_code",
|
|
10
|
-
"search_api",
|
|
11
|
-
"search_prd",
|
|
12
|
-
"get_impact",
|
|
13
|
-
"context_360"
|
|
14
|
-
],
|
|
15
|
-
"spawn_pid": 38616,
|
|
16
|
-
"status": "PASS"
|
|
17
|
-
},
|
|
18
|
-
"qoder-zentao": {
|
|
19
|
-
"available": true,
|
|
20
|
-
"tools_indexed": 66,
|
|
21
|
-
"latency_ms": 3657.0,
|
|
22
|
-
"sample_tools": [
|
|
23
|
-
"check_zentao_status",
|
|
24
|
-
"get_zentao_url",
|
|
25
|
-
"list_products",
|
|
26
|
-
"get_product",
|
|
27
|
-
"create_product"
|
|
28
|
-
],
|
|
29
|
-
"spawn_pid": 11224,
|
|
30
|
-
"status": "PASS"
|
|
31
|
-
},
|
|
32
|
-
"qoder-mysql": {
|
|
33
|
-
"available": true,
|
|
34
|
-
"tools_indexed": 6,
|
|
35
|
-
"latency_ms": 3484.0,
|
|
36
|
-
"sample_tools": [
|
|
37
|
-
"list_envs",
|
|
38
|
-
"query_schema",
|
|
39
|
-
"query_data",
|
|
40
|
-
"query_distinct",
|
|
41
|
-
"list_databases"
|
|
42
|
-
],
|
|
43
|
-
"spawn_pid": 37868,
|
|
44
|
-
"status": "PASS"
|
|
45
|
-
},
|
|
46
|
-
"lanhu": {
|
|
47
|
-
"available": true,
|
|
48
|
-
"tools_indexed": 13,
|
|
49
|
-
"latency_ms": 3156.0,
|
|
50
|
-
"sample_tools": [
|
|
51
|
-
"lanhu_resolve_invite_link",
|
|
52
|
-
"lanhu_list_product_documents",
|
|
53
|
-
"lanhu_get_pages",
|
|
54
|
-
"lanhu_get_ai_analyze_page_result",
|
|
55
|
-
"lanhu_get_designs"
|
|
56
|
-
],
|
|
57
|
-
"spawn_pid": 36836,
|
|
58
|
-
"status": "PASS"
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
"call_tool": {
|
|
62
|
-
"status": "PASS",
|
|
63
|
-
"latency_ms": 3953.0,
|
|
64
|
-
"text_preview": "Chinese: 保险 -> English: ins insurance vehlife/insurance\n\n[Carmg-H5] 12 files\n Carmg-H5/src/.../main/List.vue -> data/code/Carmg-H5/src/modules/icsAbnormalCenter/module/main/List.vue\n Carmg-H5/src/",
|
|
65
|
-
"is_error": false
|
|
66
|
-
},
|
|
67
|
-
"memory": {
|
|
68
|
-
"available": true,
|
|
69
|
-
"providers": [
|
|
70
|
-
{
|
|
71
|
-
"provider": "McpMemoryProvider",
|
|
72
|
-
"available": true,
|
|
73
|
-
"hit": true
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"provider": "FileMemoryCap",
|
|
77
|
-
"available": true,
|
|
78
|
-
"hit": false
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
"provider": "NoOpMemoryCap",
|
|
82
|
-
"available": false,
|
|
83
|
-
"hit": false
|
|
84
|
-
}
|
|
85
|
-
],
|
|
86
|
-
"status": "PASS"
|
|
87
|
-
},
|
|
88
|
-
"summary": {
|
|
89
|
-
"all_pass": true,
|
|
90
|
-
"active_servers": 4,
|
|
91
|
-
"total_servers": 4,
|
|
92
|
-
"total_tools": 102
|
|
93
|
-
}
|
|
94
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""资产中心 25 表吸收 (GOAL 4)。
|
|
3
|
-
|
|
4
|
-
子模块:
|
|
5
|
-
prd_importer prds + prd_versions → 业务知识 (调 LLM)
|
|
6
|
-
prototype_importer prototypes + annotations → 意图知识
|
|
7
|
-
discussion_importer discussions → 决策知识 (LLM)
|
|
8
|
-
asset_tree assets → 模块结构
|
|
9
|
-
returns_importer asset_returns → 实践知识
|
|
10
|
-
"""
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""资产树 → 模块结构知识。
|
|
3
|
-
|
|
4
|
-
assets 表 (飞书式文件树, 330节点) → MODULE 实体。
|
|
5
|
-
"01_PRD/02_设计/03_交付" 这种结构本身就是项目知识。
|
|
6
|
-
parent_id 递归 → 模块层级。
|
|
7
|
-
"""
|
|
8
|
-
from __future__ import annotations
|
|
9
|
-
import os, sys
|
|
10
|
-
|
|
11
|
-
_THIS = os.path.dirname(os.path.abspath(__file__))
|
|
12
|
-
for _i in range(8):
|
|
13
|
-
_p = os.path.dirname(_THIS)
|
|
14
|
-
if os.path.isfile(os.path.join(_p, 'foundation', 'bootstrap.py')):
|
|
15
|
-
sys.path.insert(0, _p); break
|
|
16
|
-
_THIS = _p
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def import_asset_tree(project_id: str = None, logger=print):
|
|
20
|
-
"""assets 表 → MODULE 实体 + 层级边。"""
|
|
21
|
-
try:
|
|
22
|
-
from dotenv import load_dotenv
|
|
23
|
-
for p in ['wlinkj-workspace/backend/.env', '.env']:
|
|
24
|
-
if os.path.isfile(p): load_dotenv(p); break
|
|
25
|
-
except: pass
|
|
26
|
-
sys.path.insert(0, os.path.join(os.getcwd(), 'wlinkj-workspace', 'backend'))
|
|
27
|
-
from app.db import SessionLocal
|
|
28
|
-
from app.models import Asset
|
|
29
|
-
from domain.kg.extract.java import pg_upsert
|
|
30
|
-
|
|
31
|
-
db = SessionLocal()
|
|
32
|
-
q = db.query(Asset)
|
|
33
|
-
if project_id: q = q.filter(Asset.project_id == project_id)
|
|
34
|
-
assets = q.all()
|
|
35
|
-
logger(' [asset-tree] %d 个资产节点' % len(assets))
|
|
36
|
-
|
|
37
|
-
entities, edges = [], []
|
|
38
|
-
for a in assets:
|
|
39
|
-
repo_id = 'asset-%s' % (a.project_id or 'global')[:8]
|
|
40
|
-
entities.append({
|
|
41
|
-
'id': 'asset:%s' % a.id, 'repo_id': repo_id,
|
|
42
|
-
'type': 'MODULE' if a.is_folder else 'ASSET',
|
|
43
|
-
'canonical': a.name, 'cn': a.type or '',
|
|
44
|
-
'props': {'project_id': a.project_id, 'kind': 'folder' if a.is_folder else 'file',
|
|
45
|
-
'mime': a.mime_type, 'source': 'asset_center'},
|
|
46
|
-
})
|
|
47
|
-
# parent_id → 层级边
|
|
48
|
-
if a.parent_id:
|
|
49
|
-
edges.append({
|
|
50
|
-
'from_id': 'asset:%s' % a.id, 'to_id': 'asset:%s' % a.parent_id,
|
|
51
|
-
'edge_type': 'child_of', 'from_repo': repo_id, 'to_repo': repo_id,
|
|
52
|
-
'confidence': 1.0, 'source': 'explicit',
|
|
53
|
-
})
|
|
54
|
-
db.close()
|
|
55
|
-
|
|
56
|
-
upsert_r = pg_upsert.upsert_batch(entities, edges) if (entities or edges) else {'ok': False}
|
|
57
|
-
return {'assets': len(assets), 'entities': len(entities), 'edges': len(edges), 'upsert': upsert_r}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""讨论 → 决策知识。
|
|
3
|
-
|
|
4
|
-
discussion_messages → DECISION 实体 (LLM 抽取决策点)。
|
|
5
|
-
当前 0 数据, 管线先建好, 等团队用起来立刻生效。
|
|
6
|
-
"""
|
|
7
|
-
from __future__ import annotations
|
|
8
|
-
import os, sys
|
|
9
|
-
|
|
10
|
-
_THIS = os.path.dirname(os.path.abspath(__file__))
|
|
11
|
-
for _i in range(8):
|
|
12
|
-
_p = os.path.dirname(_THIS)
|
|
13
|
-
if os.path.isfile(os.path.join(_p, 'foundation', 'bootstrap.py')):
|
|
14
|
-
sys.path.insert(0, _p); break
|
|
15
|
-
_THIS = _p
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def import_discussions(project_id: str = None, logger=print):
|
|
19
|
-
"""讨论 → KG。"""
|
|
20
|
-
try:
|
|
21
|
-
from dotenv import load_dotenv
|
|
22
|
-
for p in ['wlinkj-workspace/backend/.env', '.env']:
|
|
23
|
-
if os.path.isfile(p): load_dotenv(p); break
|
|
24
|
-
except: pass
|
|
25
|
-
sys.path.insert(0, os.path.join(os.getcwd(), 'wlinkj-workspace', 'backend'))
|
|
26
|
-
from app.db import SessionLocal
|
|
27
|
-
from app.models import Discussion, DiscussionMessage
|
|
28
|
-
from domain.kg.extract.java import pg_upsert
|
|
29
|
-
|
|
30
|
-
db = SessionLocal()
|
|
31
|
-
q = db.query(Discussion)
|
|
32
|
-
if project_id: q = q.filter(Discussion.project_id == project_id)
|
|
33
|
-
discussions = q.all()
|
|
34
|
-
logger(' [asset-disc] %d 个讨论' % len(discussions))
|
|
35
|
-
|
|
36
|
-
entities, edges = [], []
|
|
37
|
-
for d in discussions:
|
|
38
|
-
repo_id = 'asset-%s' % (d.project_id or 'global')[:8]
|
|
39
|
-
# 讨论 → DECISION 实体
|
|
40
|
-
entities.append({
|
|
41
|
-
'id': 'disc:%s' % d.id, 'repo_id': repo_id, 'type': 'DECISION',
|
|
42
|
-
'canonical': d.title[:80], 'cn': '',
|
|
43
|
-
'props': {'kind': 'discussion', 'project_id': d.project_id, 'source': 'asset_center'},
|
|
44
|
-
})
|
|
45
|
-
# 消息 → 关联到讨论
|
|
46
|
-
msgs = db.query(DiscussionMessage).filter(DiscussionMessage.discussion_id == d.id).all()
|
|
47
|
-
for m in msgs:
|
|
48
|
-
if not m.content: continue
|
|
49
|
-
entities.append({
|
|
50
|
-
'id': 'discmsg:%s' % m.id, 'repo_id': repo_id, 'type': 'DECISION',
|
|
51
|
-
'canonical': m.content[:60], 'cn': m.author_name or '',
|
|
52
|
-
'props': {'discussion_id': d.id, 'author': m.author_name, 'source': 'discussion_msg'},
|
|
53
|
-
})
|
|
54
|
-
edges.append({
|
|
55
|
-
'from_id': 'discmsg:%s' % m.id, 'to_id': 'disc:%s' % d.id,
|
|
56
|
-
'edge_type': 'decided_in', 'from_repo': repo_id, 'to_repo': repo_id,
|
|
57
|
-
'confidence': 1.0, 'source': 'explicit',
|
|
58
|
-
})
|
|
59
|
-
db.close()
|
|
60
|
-
|
|
61
|
-
upsert_r = pg_upsert.upsert_batch(entities, edges) if (entities or edges) else {'ok': False}
|
|
62
|
-
return {'discussions': len(discussions), 'entities': len(entities), 'edges': len(edges), 'upsert': upsert_r}
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""资产中心 prds + prd_versions → KG 业务知识吸收。
|
|
3
|
-
|
|
4
|
-
把工作台 SQLite/PG 的 prds 表灌进 KG (当前0吸收)。
|
|
5
|
-
对每个有正文的 PRD:
|
|
6
|
-
1. 调 prd_llm_extract 抽功能点/字段/规则/端点/权限
|
|
7
|
-
2. 调 prd_chunk_embed 做向量 (LightRAG vector 路)
|
|
8
|
-
3. 调 req_anchor 锚到 REQ-ID
|
|
9
|
-
"""
|
|
10
|
-
from __future__ import annotations
|
|
11
|
-
import os
|
|
12
|
-
import sys
|
|
13
|
-
|
|
14
|
-
_THIS = os.path.dirname(os.path.abspath(__file__))
|
|
15
|
-
for _i in range(8):
|
|
16
|
-
_p = os.path.dirname(_THIS)
|
|
17
|
-
if os.path.isfile(os.path.join(_p, 'foundation', 'bootstrap.py')):
|
|
18
|
-
sys.path.insert(0, _p); break
|
|
19
|
-
_THIS = _p
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def import_all_prds(project_id: str = None, do_embed: bool = False, llm_limit: int = 10, logger=print):
|
|
23
|
-
"""扫资产中心所有 PRD → LLM 抽取 + 锚定。
|
|
24
|
-
|
|
25
|
-
Args:
|
|
26
|
-
project_id: 限定某项目 (None=全部)
|
|
27
|
-
do_embed: 是否做 embedding (慢, 默认False)
|
|
28
|
-
llm_limit: LLM 抽取上限 (避免154个PRD全调qwen超时; 0=不调LLM只锚定)
|
|
29
|
-
Returns: {stats}
|
|
30
|
-
"""
|
|
31
|
-
from domain.kg.extract.prd import prd_llm_extract, prd_chunk_embed, req_anchor
|
|
32
|
-
|
|
33
|
-
# 连工作台 DB 读 PRD
|
|
34
|
-
try:
|
|
35
|
-
from dotenv import load_dotenv
|
|
36
|
-
for p in ['wlinkj-workspace/backend/.env', '.env']:
|
|
37
|
-
if os.path.isfile(p):
|
|
38
|
-
load_dotenv(p); break
|
|
39
|
-
except Exception:
|
|
40
|
-
pass
|
|
41
|
-
sys.path.insert(0, os.path.join(os.getcwd(), 'wlinkj-workspace', 'backend'))
|
|
42
|
-
from app.db import SessionLocal
|
|
43
|
-
from app.models import PRD, PRDVersion
|
|
44
|
-
from sqlalchemy import text
|
|
45
|
-
|
|
46
|
-
db = SessionLocal()
|
|
47
|
-
q = db.query(PRD)
|
|
48
|
-
if project_id:
|
|
49
|
-
q = q.filter(PRD.project_id == project_id)
|
|
50
|
-
prds = q.all()
|
|
51
|
-
logger(' [asset-prd] %d 个 PRD 待吸收' % len(prds))
|
|
52
|
-
|
|
53
|
-
all_entities, all_edges = [], []
|
|
54
|
-
embedded = 0
|
|
55
|
-
llm_done = 0
|
|
56
|
-
for prd in prds:
|
|
57
|
-
# 取最新版本正文
|
|
58
|
-
ver = db.query(PRDVersion).filter(PRDVersion.prd_id == prd.id).order_by(PRDVersion.version.desc()).first()
|
|
59
|
-
content_md = ver.content_md if ver else ''
|
|
60
|
-
repo_id = 'asset-%s' % (prd.project_id or 'global')[:8]
|
|
61
|
-
|
|
62
|
-
# ① PRD 实体本身 (写 entities, group=prd)
|
|
63
|
-
all_entities.append({
|
|
64
|
-
'id': 'prd:%s' % prd.id, 'repo_id': repo_id, 'type': 'PRD',
|
|
65
|
-
'canonical': prd.title[:80], 'cn': prd.category or '',
|
|
66
|
-
'props': {'project_id': prd.project_id, 'status': prd.status,
|
|
67
|
-
'version': prd.current_version, 'source': 'asset_center'},
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
# ② REQ-ID 锚定 (PRD 标题 → anchors)
|
|
71
|
-
a_ent, a_edg = req_anchor.anchor_prd(prd.id, prd.title, prd.project_id, repo_id)
|
|
72
|
-
all_entities += a_ent
|
|
73
|
-
all_edges += a_edg
|
|
74
|
-
|
|
75
|
-
# ③ 有正文且未超 LLM 上限 → LLM 抽取
|
|
76
|
-
if content_md and len(content_md) > 100 and llm_done < llm_limit:
|
|
77
|
-
extracted = prd_llm_extract.extract_prd_knowledge(content_md)
|
|
78
|
-
e_ent, e_edg = prd_llm_extract.to_entities_edges(
|
|
79
|
-
extracted, prd.id, prd.project_id, repo_id)
|
|
80
|
-
all_entities += e_ent
|
|
81
|
-
all_edges += e_edg
|
|
82
|
-
llm_done += 1
|
|
83
|
-
|
|
84
|
-
# ④ embedding (可选, 慢)
|
|
85
|
-
if do_embed and len(content_md) > 500:
|
|
86
|
-
try:
|
|
87
|
-
r = prd_chunk_embed.embed_prd(prd.id, content_md, repo_id)
|
|
88
|
-
embedded += r.get('embedded', 0)
|
|
89
|
-
except Exception:
|
|
90
|
-
pass
|
|
91
|
-
|
|
92
|
-
db.close()
|
|
93
|
-
|
|
94
|
-
# 写 PG
|
|
95
|
-
from domain.kg.extract.java import pg_upsert
|
|
96
|
-
upsert_r = pg_upsert.upsert_batch(all_entities, all_edges) if (all_entities or all_edges) else {'ok': False}
|
|
97
|
-
|
|
98
|
-
# ★ 同时把锚点写进 anchors 专用表 (GOAL 1 建的)
|
|
99
|
-
anchor_records = []
|
|
100
|
-
seen_anchor = set()
|
|
101
|
-
for e in all_entities:
|
|
102
|
-
if e.get('type') == 'ANCHOR':
|
|
103
|
-
aid = e['id']
|
|
104
|
-
if aid in seen_anchor:
|
|
105
|
-
continue
|
|
106
|
-
seen_anchor.add(aid)
|
|
107
|
-
anchor_records.append({
|
|
108
|
-
'id': aid,
|
|
109
|
-
'project_id': e['props'].get('project_id'),
|
|
110
|
-
'title': e.get('cn', ''),
|
|
111
|
-
'kind': e['props'].get('kind', 'feature'),
|
|
112
|
-
'prd_id': e['props'].get('prd_id'),
|
|
113
|
-
})
|
|
114
|
-
anchor_ok = _upsert_anchors(anchor_records) if anchor_records else 0
|
|
115
|
-
|
|
116
|
-
return {
|
|
117
|
-
'prds_total': len(prds),
|
|
118
|
-
'entities': len(all_entities),
|
|
119
|
-
'edges': len(all_edges),
|
|
120
|
-
'embedded': embedded,
|
|
121
|
-
'anchors': anchor_ok,
|
|
122
|
-
'upsert': upsert_r,
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
def _upsert_anchors(records):
|
|
127
|
-
"""写 anchors 专用表。"""
|
|
128
|
-
from domain.kg.extract.java import pg_upsert as _pg
|
|
129
|
-
engine, _ = _pg._get_pg_engine()
|
|
130
|
-
if engine is None or not records:
|
|
131
|
-
return 0
|
|
132
|
-
from sqlalchemy import text
|
|
133
|
-
ok = 0
|
|
134
|
-
with engine.begin() as conn:
|
|
135
|
-
for r in records:
|
|
136
|
-
try:
|
|
137
|
-
conn.execute(text("""
|
|
138
|
-
INSERT INTO anchors (id, project_id, title, kind, prd_id)
|
|
139
|
-
VALUES (:id, :pid, :title, :kind, :prd)
|
|
140
|
-
ON CONFLICT (id) DO UPDATE SET title=EXCLUDED.title, updated_at=now()
|
|
141
|
-
"""), {'id': r['id'], 'pid': r.get('project_id'), 'title': r.get('title', ''),
|
|
142
|
-
'kind': r.get('kind', 'feature'), 'prd': r.get('prd_id')})
|
|
143
|
-
ok += 1
|
|
144
|
-
except Exception:
|
|
145
|
-
pass
|
|
146
|
-
return ok
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""原型 + 标注 → 意图知识。
|
|
3
|
-
|
|
4
|
-
把 prototypes 表灌进 KG (当前10个原型, 0标注 - 管线先建好)。
|
|
5
|
-
prototype → PAGE 实体; annotation → CONSTRAINT 实体。
|
|
6
|
-
"""
|
|
7
|
-
from __future__ import annotations
|
|
8
|
-
import os, sys
|
|
9
|
-
|
|
10
|
-
_THIS = os.path.dirname(os.path.abspath(__file__))
|
|
11
|
-
for _i in range(8):
|
|
12
|
-
_p = os.path.dirname(_THIS)
|
|
13
|
-
if os.path.isfile(os.path.join(_p, 'foundation', 'bootstrap.py')):
|
|
14
|
-
sys.path.insert(0, _p); break
|
|
15
|
-
_THIS = _p
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def import_prototypes(project_id: str = None, logger=print):
|
|
19
|
-
"""原型 + 标注 → KG。"""
|
|
20
|
-
try:
|
|
21
|
-
from dotenv import load_dotenv
|
|
22
|
-
for p in ['wlinkj-workspace/backend/.env', '.env']:
|
|
23
|
-
if os.path.isfile(p): load_dotenv(p); break
|
|
24
|
-
except: pass
|
|
25
|
-
sys.path.insert(0, os.path.join(os.getcwd(), 'wlinkj-workspace', 'backend'))
|
|
26
|
-
from app.db import SessionLocal
|
|
27
|
-
from app.models import Prototype, PrototypeAnnotation
|
|
28
|
-
from domain.kg.extract.java import pg_upsert
|
|
29
|
-
|
|
30
|
-
db = SessionLocal()
|
|
31
|
-
q = db.query(Prototype)
|
|
32
|
-
if project_id: q = q.filter(Prototype.project_id == project_id)
|
|
33
|
-
protos = q.all()
|
|
34
|
-
logger(' [asset-proto] %d 个原型' % len(protos))
|
|
35
|
-
|
|
36
|
-
entities, edges = [], []
|
|
37
|
-
for p in protos:
|
|
38
|
-
repo_id = 'asset-%s' % (p.project_id or 'global')[:8]
|
|
39
|
-
# 原型 → PAGE 实体
|
|
40
|
-
entities.append({
|
|
41
|
-
'id': 'proto:%s' % p.id, 'repo_id': repo_id, 'type': 'PAGE',
|
|
42
|
-
'canonical': p.feature or p.id[:8], 'cn': p.platform or '',
|
|
43
|
-
'props': {'kind': 'prototype', 'project_id': p.project_id,
|
|
44
|
-
'status': p.status, 'source': 'asset_center'},
|
|
45
|
-
})
|
|
46
|
-
# 该原型的标注 → CONSTRAINT
|
|
47
|
-
anns = db.query(PrototypeAnnotation).filter(PrototypeAnnotation.prototype_id == p.id).all()
|
|
48
|
-
for a in anns:
|
|
49
|
-
if not a.comment: continue
|
|
50
|
-
entities.append({
|
|
51
|
-
'id': 'ANNO:%s' % a.id, 'repo_id': repo_id, 'type': 'CONSTRAINT',
|
|
52
|
-
'canonical': a.comment[:60], 'cn': a.type or '',
|
|
53
|
-
'props': {'prototype_id': p.id, 'status': a.status,
|
|
54
|
-
'coords': {'x': a.x, 'y': a.y}, 'source': 'annotation'},
|
|
55
|
-
})
|
|
56
|
-
edges.append({
|
|
57
|
-
'from_id': 'ANNO:%s' % a.id, 'to_id': 'proto:%s' % p.id,
|
|
58
|
-
'edge_type': 'annotates', 'from_repo': repo_id, 'to_repo': repo_id,
|
|
59
|
-
'confidence': 1.0, 'source': 'explicit',
|
|
60
|
-
})
|
|
61
|
-
db.close()
|
|
62
|
-
|
|
63
|
-
upsert_r = pg_upsert.upsert_batch(entities, edges) if (entities or edges) else {'ok': False}
|
|
64
|
-
return {'prototypes': len(protos), 'entities': len(entities), 'edges': len(edges), 'upsert': upsert_r}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""回流历史 → 实践知识。
|
|
3
|
-
|
|
4
|
-
asset_returns (引擎→平台产出) → embedding (能搜"之前怎么做的")。
|
|
5
|
-
当前3条, 是引擎回流的PRD/原型/资产。
|
|
6
|
-
"""
|
|
7
|
-
from __future__ import annotations
|
|
8
|
-
import os, sys
|
|
9
|
-
|
|
10
|
-
_THIS = os.path.dirname(os.path.abspath(__file__))
|
|
11
|
-
for _i in range(8):
|
|
12
|
-
_p = os.path.dirname(_THIS)
|
|
13
|
-
if os.path.isfile(os.path.join(_p, 'foundation', 'bootstrap.py')):
|
|
14
|
-
sys.path.insert(0, _p); break
|
|
15
|
-
_THIS = _p
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def import_returns(project_id: str = None, logger=print):
|
|
19
|
-
"""asset_returns → KG 实践知识。"""
|
|
20
|
-
try:
|
|
21
|
-
from dotenv import load_dotenv
|
|
22
|
-
for p in ['wlinkj-workspace/backend/.env', '.env']:
|
|
23
|
-
if os.path.isfile(p): load_dotenv(p); break
|
|
24
|
-
except: pass
|
|
25
|
-
sys.path.insert(0, os.path.join(os.getcwd(), 'wlinkj-workspace', 'backend'))
|
|
26
|
-
from app.db import SessionLocal
|
|
27
|
-
from app.models import AssetReturn
|
|
28
|
-
from domain.kg.extract.java import pg_upsert
|
|
29
|
-
|
|
30
|
-
db = SessionLocal()
|
|
31
|
-
q = db.query(AssetReturn)
|
|
32
|
-
if project_id: q = q.filter(AssetReturn.project_id == project_id)
|
|
33
|
-
returns = q.all()
|
|
34
|
-
logger(' [asset-ret] %d 条回流' % len(returns))
|
|
35
|
-
|
|
36
|
-
entities, edges = [], []
|
|
37
|
-
for r in returns:
|
|
38
|
-
repo_id = 'asset-%s' % (r.project_id or 'global')[:8]
|
|
39
|
-
# 回流产出 → 实体 (按 return_type 分类)
|
|
40
|
-
etype = {'prd': 'PRD', 'prototype': 'PAGE', 'asset': 'ASSET'}.get(r.return_type, 'ASSET')
|
|
41
|
-
entities.append({
|
|
42
|
-
'id': 'return:%s' % r.id, 'repo_id': repo_id, 'type': etype,
|
|
43
|
-
'canonical': r.title[:80], 'cn': r.return_type or '',
|
|
44
|
-
'props': {'project_id': r.project_id, 'return_type': r.return_type,
|
|
45
|
-
'source': r.source, 'status': r.status,
|
|
46
|
-
'preview': (r.content_preview or '')[:200],
|
|
47
|
-
'source': 'asset_return'},
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
db.close()
|
|
51
|
-
upsert_r = pg_upsert.upsert_batch(entities, edges) if (entities or edges) else {'ok': False}
|
|
52
|
-
return {'returns': len(returns), 'entities': len(entities), 'edges': len(edges), 'upsert': upsert_r}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""GOAL 3 统一构建入口: MyBatis XML + DB Schema + 写 PG。
|
|
3
|
-
|
|
4
|
-
被 kg_build.py 调用, 或独立 CLI:
|
|
5
|
-
python -m domain.kg.extract.build_goal3 --repo-dir data/code/fywl-ics --repo-id fywl-ics
|
|
6
|
-
"""
|
|
7
|
-
from __future__ import annotations
|
|
8
|
-
import os
|
|
9
|
-
import sys
|
|
10
|
-
|
|
11
|
-
_THIS = os.path.dirname(os.path.abspath(__file__))
|
|
12
|
-
for _i in range(8):
|
|
13
|
-
_p = os.path.dirname(_THIS)
|
|
14
|
-
if os.path.isfile(os.path.join(_p, 'foundation', 'bootstrap.py')):
|
|
15
|
-
sys.path.insert(0, _p); break
|
|
16
|
-
_THIS = _p
|
|
17
|
-
|
|
18
|
-
from domain.kg.extract.mybatis import all as mybatis_all
|
|
19
|
-
from domain.kg.extract.db import schema_extractor, fk_extractor
|
|
20
|
-
from domain.kg.extract.java import pg_upsert
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def build(repo_dir: str, repo_id: str, write_pg: bool = True, logger=print):
|
|
24
|
-
"""GOAL 3 主入口: mybatis 提取 + db schema + 写 PG。"""
|
|
25
|
-
logger(' [goal3] === MyBatis XML 提取 ===')
|
|
26
|
-
mb_entities, mb_edges = mybatis_all.extract_repo(repo_dir, repo_id, logger=logger)
|
|
27
|
-
|
|
28
|
-
logger(' [goal3] === DB Schema 真源 ===')
|
|
29
|
-
db_tables, db_columns = schema_extractor.extract_all_schema(repo_id, logger=logger)
|
|
30
|
-
fk_edges = fk_extractor.extract_foreign_keys(repo_id, logger=logger)
|
|
31
|
-
|
|
32
|
-
# db_tables/db_columns 写专用表 (不是 entities)
|
|
33
|
-
db_pg_result = None
|
|
34
|
-
if write_pg and (db_tables or db_columns):
|
|
35
|
-
db_pg_result = _upsert_db_schema(db_tables, db_columns)
|
|
36
|
-
|
|
37
|
-
# mybatis 实体/边 写 entities/edges (复用 GOAL 2 的 pg_upsert)
|
|
38
|
-
mb_pg_result = None
|
|
39
|
-
if write_pg and (mb_entities or mb_edges):
|
|
40
|
-
# 加上 FK 边
|
|
41
|
-
all_edges = mb_edges + fk_edges
|
|
42
|
-
mb_pg_result = pg_upsert.upsert_batch(mb_entities, all_edges)
|
|
43
|
-
|
|
44
|
-
return {
|
|
45
|
-
'mybatis_entities': len(mb_entities), 'mybatis_edges': len(mb_edges),
|
|
46
|
-
'db_tables': len(db_tables), 'db_columns': len(db_columns),
|
|
47
|
-
'fk_edges': len(fk_edges),
|
|
48
|
-
'mb_pg': mb_pg_result, 'db_pg': db_pg_result,
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
def _upsert_db_schema(tables: list, columns: list):
|
|
53
|
-
"""把 db_tables / db_columns 写进 PG 专用表 (GOAL 1 建的)。"""
|
|
54
|
-
engine, _ = pg_upsert._get_pg_engine()
|
|
55
|
-
if engine is None:
|
|
56
|
-
return {'ok': False, 'error': 'PG 不可用'}
|
|
57
|
-
from sqlalchemy import text
|
|
58
|
-
t_ok = c_ok = 0
|
|
59
|
-
with engine.begin() as conn:
|
|
60
|
-
for t in tables:
|
|
61
|
-
try:
|
|
62
|
-
conn.execute(text("""
|
|
63
|
-
INSERT INTO db_tables (repo_id, schema_name, table_name, table_comment, rows_count)
|
|
64
|
-
VALUES (:r, :s, :t, :c, :n)
|
|
65
|
-
ON CONFLICT (repo_id, schema_name, table_name) DO UPDATE SET
|
|
66
|
-
table_comment=EXCLUDED.table_comment, rows_count=EXCLUDED.rows_count
|
|
67
|
-
"""), {'r': t['repo_id'], 's': t['schema_name'], 't': t['table_name'],
|
|
68
|
-
'c': t['table_comment'], 'n': t.get('rows_count')})
|
|
69
|
-
t_ok += 1
|
|
70
|
-
except Exception:
|
|
71
|
-
pass
|
|
72
|
-
for c in columns:
|
|
73
|
-
try:
|
|
74
|
-
conn.execute(text("""
|
|
75
|
-
INSERT INTO db_columns (repo_id, schema_name, table_name, column_name,
|
|
76
|
-
data_type, is_nullable, column_comment, ordinal_position)
|
|
77
|
-
VALUES (:r, :s, :t, :cn, :dt, :nn, :cc, :op)
|
|
78
|
-
ON CONFLICT (repo_id, schema_name, table_name, column_name) DO UPDATE SET
|
|
79
|
-
data_type=EXCLUDED.data_type, is_nullable=EXCLUDED.is_nullable,
|
|
80
|
-
column_comment=EXCLUDED.column_comment
|
|
81
|
-
"""), {'r': c['repo_id'], 's': c['schema_name'], 't': c['table_name'],
|
|
82
|
-
'cn': c['column_name'], 'dt': c['data_type'], 'nn': c['is_nullable'],
|
|
83
|
-
'cc': c['column_comment'], 'op': c.get('ordinal_position')})
|
|
84
|
-
c_ok += 1
|
|
85
|
-
except Exception:
|
|
86
|
-
pass
|
|
87
|
-
return {'ok': True, 'tables_ok': t_ok, 'columns_ok': c_ok}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if __name__ == '__main__':
|
|
91
|
-
import argparse, json
|
|
92
|
-
ap = argparse.ArgumentParser()
|
|
93
|
-
ap.add_argument('--repo-dir', required=True)
|
|
94
|
-
ap.add_argument('--repo-id', default='')
|
|
95
|
-
ap.add_argument('--dry-run', action='store_true')
|
|
96
|
-
args = ap.parse_args()
|
|
97
|
-
try:
|
|
98
|
-
from dotenv import load_dotenv
|
|
99
|
-
for p in ['wlinkj-workspace/backend/.env', '.env']:
|
|
100
|
-
if os.path.isfile(p): load_dotenv(p); break
|
|
101
|
-
except: pass
|
|
102
|
-
rid = args.repo_id or os.path.basename(args.repo_dir.rstrip('/\\'))
|
|
103
|
-
st = build(args.repo_dir, rid, write_pg=not args.dry_run)
|
|
104
|
-
print(json.dumps(st, ensure_ascii=False, indent=2, default=str))
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
"""GOAL 4 统一入口: PRD LLM + 资产中心 5 表 + REQ-ID 锚定。
|
|
3
|
-
|
|
4
|
-
被 kg_build.py 调用, 或独立 CLI:
|
|
5
|
-
python -m domain.kg.extract.build_goal4 [--project-id PID] [--embed]
|
|
6
|
-
"""
|
|
7
|
-
from __future__ import annotations
|
|
8
|
-
import os, sys
|
|
9
|
-
|
|
10
|
-
_THIS = os.path.dirname(os.path.abspath(__file__))
|
|
11
|
-
for _i in range(8):
|
|
12
|
-
_p = os.path.dirname(_THIS)
|
|
13
|
-
if os.path.isfile(os.path.join(_p, 'foundation', 'bootstrap.py')):
|
|
14
|
-
sys.path.insert(0, _p); break
|
|
15
|
-
_THIS = _p
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def build(project_id: str = None, do_embed: bool = False, logger=print):
|
|
19
|
-
"""GOAL 4 主入口: 资产中心 5 表吸收。"""
|
|
20
|
-
from domain.kg.extract.asset import (prd_importer, prototype_importer,
|
|
21
|
-
discussion_importer, asset_tree, returns_importer)
|
|
22
|
-
|
|
23
|
-
logger(' [goal4] === PRD LLM 抽取 + REQ-ID 锚定 ===')
|
|
24
|
-
prd_r = prd_importer.import_all_prds(project_id, do_embed=do_embed, logger=logger)
|
|
25
|
-
logger(' [goal4] PRD: %s' % {k: v for k, v in prd_r.items() if k != 'upsert'})
|
|
26
|
-
|
|
27
|
-
logger(' [goal4] === 原型 + 标注 ===')
|
|
28
|
-
proto_r = prototype_importer.import_prototypes(project_id, logger=logger)
|
|
29
|
-
|
|
30
|
-
logger(' [goal4] === 讨论 ===')
|
|
31
|
-
disc_r = discussion_importer.import_discussions(project_id, logger=logger)
|
|
32
|
-
|
|
33
|
-
logger(' [goal4] === 资产树 ===')
|
|
34
|
-
tree_r = asset_tree.import_asset_tree(project_id, logger=logger)
|
|
35
|
-
|
|
36
|
-
logger(' [goal4] === 回流 ===')
|
|
37
|
-
ret_r = returns_importer.import_returns(project_id, logger=logger)
|
|
38
|
-
|
|
39
|
-
return {'prd': prd_r, 'prototype': proto_r, 'discussion': disc_r,
|
|
40
|
-
'asset_tree': tree_r, 'returns': ret_r}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if __name__ == '__main__':
|
|
44
|
-
import argparse, json
|
|
45
|
-
ap = argparse.ArgumentParser()
|
|
46
|
-
ap.add_argument('--project-id', default='')
|
|
47
|
-
ap.add_argument('--embed', action='store_true')
|
|
48
|
-
args = ap.parse_args()
|
|
49
|
-
try:
|
|
50
|
-
from dotenv import load_dotenv
|
|
51
|
-
for p in ['wlinkj-workspace/backend/.env', '.env']:
|
|
52
|
-
if os.path.isfile(p): load_dotenv(p); break
|
|
53
|
-
except: pass
|
|
54
|
-
st = build(project_id=args.project_id or None, do_embed=args.embed)
|
|
55
|
-
print(json.dumps(st, ensure_ascii=False, indent=2, default=str))
|