@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,229 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""
|
|
4
|
+
QODER Pipeline - 任务生命周期管理
|
|
5
|
+
|
|
6
|
+
完整的任务 CRUD 和生命周期管理:
|
|
7
|
+
- create: 创建任务 (含 task.json, prd.md 模板, implement.jsonl, check.jsonl)
|
|
8
|
+
- start: 开始任务 (设置活跃任务, 状态 planning -> in_progress)
|
|
9
|
+
- current: 查看当前活跃任务
|
|
10
|
+
- finish: 完成任务 (清除活跃任务)
|
|
11
|
+
- archive: 归档任务 (移动到 archive/ 目录)
|
|
12
|
+
- list: 列出活跃/归档任务
|
|
13
|
+
- show: 查看任务详情
|
|
14
|
+
- reassign: 改派任务负责人 (多角色协作, PM 建任务后转给开发)
|
|
15
|
+
- add-subtask / remove-subtask: 父子任务关联
|
|
16
|
+
- set-due / block / unblock / gantt: 排期与依赖
|
|
17
|
+
|
|
18
|
+
参考: Trellis 的 task.py 设计
|
|
19
|
+
|
|
20
|
+
Usage:
|
|
21
|
+
python task.py create "<title>" [--slug <name>] [--assignee <dev>] [--priority P0|P1|P2|P3]
|
|
22
|
+
python task.py start <name>
|
|
23
|
+
python task.py current [--source]
|
|
24
|
+
python task.py finish
|
|
25
|
+
python task.py archive <name>
|
|
26
|
+
python task.py reassign <name> <new_assignee>
|
|
27
|
+
python task.py list [--mine] [--status <s>]
|
|
28
|
+
python task.py add-subtask <parent> <child>
|
|
29
|
+
python task.py remove-subtask <parent> <child>
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
from __future__ import annotations
|
|
33
|
+
|
|
34
|
+
# v3.0 路径自举: 引导到 common/bootstrap, 统一 sys.path 逻辑
|
|
35
|
+
import os as _o, sys as _s
|
|
36
|
+
_f = _o.path.abspath(__file__)
|
|
37
|
+
for _ in range(10):
|
|
38
|
+
_f = _o.path.dirname(_f)
|
|
39
|
+
_cp = _o.path.join(_f, 'foundation')
|
|
40
|
+
if _o.path.isfile(_o.path.join(_cp, 'bootstrap.py')):
|
|
41
|
+
break
|
|
42
|
+
if _cp not in _s.path: _s.path.insert(0, _cp)
|
|
43
|
+
from bootstrap import setup; setup()
|
|
44
|
+
|
|
45
|
+
import argparse
|
|
46
|
+
import json
|
|
47
|
+
import os
|
|
48
|
+
import shutil
|
|
49
|
+
import sys
|
|
50
|
+
from datetime import datetime
|
|
51
|
+
from pathlib import Path
|
|
52
|
+
|
|
53
|
+
# 将 scripts 目录加入路径
|
|
54
|
+
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
55
|
+
|
|
56
|
+
from foundation.core.paths import (
|
|
57
|
+
DIR_TASKS,
|
|
58
|
+
DIR_ARCHIVE,
|
|
59
|
+
FILE_TASK_JSON,
|
|
60
|
+
get_repo_root,
|
|
61
|
+
get_developer,
|
|
62
|
+
get_tasks_dir,
|
|
63
|
+
)
|
|
64
|
+
from foundation.integrations.active_task import (
|
|
65
|
+
clear_active_task,
|
|
66
|
+
resolve_active_task,
|
|
67
|
+
resolve_context_key,
|
|
68
|
+
set_active_task,
|
|
69
|
+
)
|
|
70
|
+
from foundation.data.task_utils import (
|
|
71
|
+
resolve_task_dir,
|
|
72
|
+
run_task_hooks,
|
|
73
|
+
load_task_json,
|
|
74
|
+
write_task_json,
|
|
75
|
+
modify_task_json,
|
|
76
|
+
assert_can_modify_task,
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
# =============================================================================
|
|
81
|
+
# 命令: create
|
|
82
|
+
# =============================================================================
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
# v3.0 f6: cmd_* 拆到三个模块
|
|
86
|
+
from task_lifecycle import cmd_create, cmd_start, cmd_current, cmd_finish, cmd_archive
|
|
87
|
+
from task_query import cmd_list, cmd_show
|
|
88
|
+
from task_relations import cmd_add_subtask, cmd_remove_subtask, cmd_set_due, cmd_reassign, cmd_block, cmd_unblock, cmd_gantt
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def main() -> int:
|
|
92
|
+
"""CLI 入口。v3.0: 用 cmd_registry 声明式注册 (消除 ~81 行 argparse 样板)。"""
|
|
93
|
+
try:
|
|
94
|
+
from foundation.core.cmd_registry import run_command
|
|
95
|
+
except ImportError:
|
|
96
|
+
# 回退: 内联 parser (common 不可用时)
|
|
97
|
+
return _main_legacy()
|
|
98
|
+
|
|
99
|
+
COMMANDS = [
|
|
100
|
+
('create', 'Create a new task', [
|
|
101
|
+
('title', {'help': 'Task title'}),
|
|
102
|
+
('--slug', {'help': 'URL-safe slug (auto-generated if omitted)'}),
|
|
103
|
+
('--assignee', {'help': 'Assignee (defaults to current developer)'}),
|
|
104
|
+
('--priority', {'choices': ['P0', 'P1', 'P2', 'P3'], 'default': 'P2'}),
|
|
105
|
+
('--req-id', {'default': None, 'help': '关联的需求编号 REQ-xxxx (用于 PRD↔Task 串联)'}),
|
|
106
|
+
], cmd_create),
|
|
107
|
+
('start', 'Start a task', [
|
|
108
|
+
('dir', {'help': 'Task directory or name'}),
|
|
109
|
+
], cmd_start),
|
|
110
|
+
('current', 'Show current task', [
|
|
111
|
+
('--source', {'action': 'store_true', 'help': 'Show source info'}),
|
|
112
|
+
], cmd_current),
|
|
113
|
+
('finish', 'Finish current task', [], cmd_finish),
|
|
114
|
+
('archive', 'Archive a task', [
|
|
115
|
+
('dir', {'help': 'Task directory or name'}),
|
|
116
|
+
], cmd_archive),
|
|
117
|
+
('list', 'List tasks', [
|
|
118
|
+
('--mine', {'action': 'store_true', 'help': 'Only my tasks (assignee or creator)'}),
|
|
119
|
+
('--status', {'help': 'Filter by status'}),
|
|
120
|
+
('--ready', {'action': 'store_true', 'help': '只显示可立即开始的 (无未完成依赖)'}),
|
|
121
|
+
('--blocked', {'action': 'store_true', 'help': '只显示被阻塞的任务'}),
|
|
122
|
+
], cmd_list),
|
|
123
|
+
('show', 'Show task details', [
|
|
124
|
+
('dir', {'help': 'Task directory or name'}),
|
|
125
|
+
], cmd_show),
|
|
126
|
+
('add-subtask', 'Add subtask', [
|
|
127
|
+
('parent', {'help': 'Parent task'}),
|
|
128
|
+
('child', {'help': 'Child task'}),
|
|
129
|
+
], cmd_add_subtask),
|
|
130
|
+
('remove-subtask', 'Remove subtask', [
|
|
131
|
+
('parent', {'help': 'Parent task'}),
|
|
132
|
+
('child', {'help': 'Child task'}),
|
|
133
|
+
], cmd_remove_subtask),
|
|
134
|
+
('set-due', 'Set due date (YYYY-MM-DD)', [
|
|
135
|
+
('task', {'help': 'Task name'}),
|
|
136
|
+
('due_date', {'help': 'Due date YYYY-MM-DD'}),
|
|
137
|
+
], cmd_set_due),
|
|
138
|
+
('reassign', 'Reassign task to another developer', [
|
|
139
|
+
('task', {'help': 'Task name'}),
|
|
140
|
+
('new_assignee', {'help': 'New assignee (developer name)'}),
|
|
141
|
+
], cmd_reassign),
|
|
142
|
+
('block', 'Mark task blocked by another', [
|
|
143
|
+
('task', {'help': 'Task that is blocked'}),
|
|
144
|
+
('blocker', {'help': 'Task that blocks it (must finish first)'}),
|
|
145
|
+
], cmd_block),
|
|
146
|
+
('unblock', 'Remove block relationship', [
|
|
147
|
+
('task', {'help': 'Task'}),
|
|
148
|
+
('blocker', {'help': 'Blocker task'}),
|
|
149
|
+
], cmd_unblock),
|
|
150
|
+
('gantt', 'Render markdown Gantt chart', [
|
|
151
|
+
('--weeks', {'type': int, 'default': 4, 'help': 'Number of weeks to show'}),
|
|
152
|
+
], cmd_gantt),
|
|
153
|
+
]
|
|
154
|
+
return run_command(COMMANDS, prog='task', description='QODER Task Management')
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def _main_legacy() -> int:
|
|
158
|
+
"""回退: common.cmd_registry 不可用时的内联 argparse (与旧版行为一致)。"""
|
|
159
|
+
parser = argparse.ArgumentParser(description="QODER Task Management")
|
|
160
|
+
subparsers = parser.add_subparsers(dest="command", help="Available commands")
|
|
161
|
+
|
|
162
|
+
p_create = subparsers.add_parser("create", help="Create a new task")
|
|
163
|
+
p_create.add_argument("title", help="Task title")
|
|
164
|
+
p_create.add_argument("--slug", help="URL-safe slug (auto-generated if omitted)")
|
|
165
|
+
p_create.add_argument("--assignee", help="Assignee (defaults to current developer)")
|
|
166
|
+
p_create.add_argument("--priority", choices=["P0", "P1", "P2", "P3"], default="P2")
|
|
167
|
+
p_create.add_argument("--req-id", default=None,
|
|
168
|
+
help="关联的需求编号 REQ-xxxx (用于 PRD↔Task 串联)")
|
|
169
|
+
p_create.set_defaults(func=cmd_create)
|
|
170
|
+
|
|
171
|
+
p_start = subparsers.add_parser("start", help="Start a task")
|
|
172
|
+
p_start.add_argument("dir", help="Task directory or name")
|
|
173
|
+
p_start.set_defaults(func=cmd_start)
|
|
174
|
+
|
|
175
|
+
p_current = subparsers.add_parser("current", help="Show current task")
|
|
176
|
+
p_current.add_argument("--source", action="store_true", help="Show source info")
|
|
177
|
+
p_current.set_defaults(func=cmd_current)
|
|
178
|
+
|
|
179
|
+
p_finish = subparsers.add_parser("finish", help="Finish current task")
|
|
180
|
+
p_finish.set_defaults(func=cmd_finish)
|
|
181
|
+
|
|
182
|
+
p_archive = subparsers.add_parser("archive", help="Archive a task")
|
|
183
|
+
p_archive.add_argument("dir", help="Task directory or name")
|
|
184
|
+
p_archive.set_defaults(func=cmd_archive)
|
|
185
|
+
|
|
186
|
+
p_list = subparsers.add_parser("list", help="List tasks")
|
|
187
|
+
p_list.add_argument("--mine", action="store_true", help="Only my tasks")
|
|
188
|
+
p_list.add_argument("--status", help="Filter by status")
|
|
189
|
+
p_list.add_argument("--ready", action="store_true", help="可立即开始")
|
|
190
|
+
p_list.add_argument("--blocked", action="store_true", help="被阻塞")
|
|
191
|
+
p_list.set_defaults(func=cmd_list)
|
|
192
|
+
|
|
193
|
+
p_show = subparsers.add_parser("show", help="Show task details")
|
|
194
|
+
p_show.add_argument("dir", help="Task directory or name")
|
|
195
|
+
p_show.set_defaults(func=cmd_show)
|
|
196
|
+
|
|
197
|
+
for cmd, fn in [
|
|
198
|
+
("add-subtask", cmd_add_subtask), ("remove-subtask", cmd_remove_subtask),
|
|
199
|
+
]:
|
|
200
|
+
p = subparsers.add_parser(cmd)
|
|
201
|
+
p.add_argument("parent"); p.add_argument("child")
|
|
202
|
+
p.set_defaults(func=fn)
|
|
203
|
+
|
|
204
|
+
p_due = subparsers.add_parser("set-due")
|
|
205
|
+
p_due.add_argument("task"); p_due.add_argument("due_date")
|
|
206
|
+
p_due.set_defaults(func=cmd_set_due)
|
|
207
|
+
|
|
208
|
+
p_reassign = subparsers.add_parser("reassign")
|
|
209
|
+
p_reassign.add_argument("task"); p_reassign.add_argument("new_assignee")
|
|
210
|
+
p_reassign.set_defaults(func=cmd_reassign)
|
|
211
|
+
|
|
212
|
+
for cmd, fn in [("block", cmd_block), ("unblock", cmd_unblock)]:
|
|
213
|
+
p = subparsers.add_parser(cmd)
|
|
214
|
+
p.add_argument("task"); p.add_argument("blocker")
|
|
215
|
+
p.set_defaults(func=fn)
|
|
216
|
+
|
|
217
|
+
p_gantt = subparsers.add_parser("gantt")
|
|
218
|
+
p_gantt.add_argument("--weeks", type=int, default=4)
|
|
219
|
+
p_gantt.set_defaults(func=cmd_gantt)
|
|
220
|
+
|
|
221
|
+
args = parser.parse_args()
|
|
222
|
+
if not hasattr(args, "func"):
|
|
223
|
+
parser.print_help()
|
|
224
|
+
return 1
|
|
225
|
+
return args.func(args)
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
if __name__ == "__main__":
|
|
229
|
+
sys.exit(main())
|