@josephyan/qingflow-cli 0.2.0-beta.58 → 0.2.0-beta.60
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/README.md +3 -2
- package/docs/local-agent-install.md +9 -0
- package/npm/bin/qingflow.mjs +1 -1
- package/npm/lib/runtime.mjs +156 -21
- package/package.json +1 -1
- package/pyproject.toml +1 -1
- package/src/qingflow_mcp/builder_facade/service.py +670 -191
- package/src/qingflow_mcp/cli/commands/app.py +16 -16
- package/src/qingflow_mcp/cli/commands/auth.py +19 -16
- package/src/qingflow_mcp/cli/commands/builder.py +124 -162
- package/src/qingflow_mcp/cli/commands/common.py +21 -95
- package/src/qingflow_mcp/cli/commands/imports.py +42 -34
- package/src/qingflow_mcp/cli/commands/record.py +131 -133
- package/src/qingflow_mcp/cli/commands/task.py +43 -44
- package/src/qingflow_mcp/cli/commands/workspace.py +10 -10
- package/src/qingflow_mcp/cli/context.py +35 -32
- package/src/qingflow_mcp/cli/formatters.py +124 -121
- package/src/qingflow_mcp/cli/main.py +52 -17
- package/src/qingflow_mcp/server_app_builder.py +122 -190
- package/src/qingflow_mcp/server_app_user.py +63 -662
- package/src/qingflow_mcp/solution/executor.py +63 -4
- package/src/qingflow_mcp/tools/solution_tools.py +115 -3
- package/src/qingflow_mcp/ops/__init__.py +0 -3
- package/src/qingflow_mcp/ops/apps.py +0 -64
- package/src/qingflow_mcp/ops/auth.py +0 -121
- package/src/qingflow_mcp/ops/base.py +0 -290
- package/src/qingflow_mcp/ops/builder.py +0 -357
- package/src/qingflow_mcp/ops/context.py +0 -120
- package/src/qingflow_mcp/ops/directory.py +0 -171
- package/src/qingflow_mcp/ops/feedback.py +0 -49
- package/src/qingflow_mcp/ops/files.py +0 -78
- package/src/qingflow_mcp/ops/imports.py +0 -140
- package/src/qingflow_mcp/ops/records.py +0 -415
- package/src/qingflow_mcp/ops/tasks.py +0 -171
- package/src/qingflow_mcp/ops/workspace.py +0 -76
|
@@ -10,69 +10,77 @@ def register(subparsers: argparse._SubParsersAction[argparse.ArgumentParser]) ->
|
|
|
10
10
|
parser = subparsers.add_parser("import", help="导入")
|
|
11
11
|
import_subparsers = parser.add_subparsers(dest="import_command", required=True)
|
|
12
12
|
|
|
13
|
-
template = import_subparsers.add_parser("template", help="
|
|
14
|
-
template.add_argument("--app", required=True)
|
|
15
|
-
template.add_argument("--to")
|
|
16
|
-
template.set_defaults(handler=_handle_template, format_hint="
|
|
13
|
+
template = import_subparsers.add_parser("template", help="下载导入模板")
|
|
14
|
+
template.add_argument("--app-key", required=True)
|
|
15
|
+
template.add_argument("--download-to-path")
|
|
16
|
+
template.set_defaults(handler=_handle_template, format_hint="")
|
|
17
17
|
|
|
18
18
|
verify = import_subparsers.add_parser("verify", help="校验导入文件")
|
|
19
|
-
verify.add_argument("--app", required=True)
|
|
20
|
-
verify.add_argument("--file", required=True)
|
|
19
|
+
verify.add_argument("--app-key", required=True)
|
|
20
|
+
verify.add_argument("--file-path", required=True)
|
|
21
21
|
verify.set_defaults(handler=_handle_verify, format_hint="import_verify")
|
|
22
22
|
|
|
23
|
-
repair = import_subparsers.add_parser("repair", help="
|
|
24
|
-
repair.add_argument("--verification", required=True)
|
|
25
|
-
repair.add_argument("--
|
|
26
|
-
repair.add_argument("--
|
|
23
|
+
repair = import_subparsers.add_parser("repair", help="授权后修复导入文件")
|
|
24
|
+
repair.add_argument("--verification-id", required=True)
|
|
25
|
+
repair.add_argument("--authorized-file-modification", action="store_true")
|
|
26
|
+
repair.add_argument("--output-path")
|
|
27
27
|
repair.add_argument("--repair", dest="selected_repairs", action="append", default=[])
|
|
28
|
-
repair.set_defaults(handler=_handle_repair, format_hint="
|
|
28
|
+
repair.set_defaults(handler=_handle_repair, format_hint="")
|
|
29
29
|
|
|
30
30
|
start = import_subparsers.add_parser("start", help="启动导入")
|
|
31
|
-
start.add_argument("--app", required=True)
|
|
32
|
-
start.add_argument("--verification", required=True)
|
|
33
|
-
start.add_argument("--enter-auditing", type=parse_bool_text, required=True)
|
|
34
|
-
start.add_argument("--view")
|
|
35
|
-
start.set_defaults(handler=_handle_start, format_hint="
|
|
36
|
-
|
|
37
|
-
status = import_subparsers.add_parser("status", help="
|
|
38
|
-
status.add_argument("--app", required=True)
|
|
31
|
+
start.add_argument("--app-key", required=True)
|
|
32
|
+
start.add_argument("--verification-id", required=True)
|
|
33
|
+
start.add_argument("--being-enter-auditing", type=parse_bool_text, required=True)
|
|
34
|
+
start.add_argument("--view-key")
|
|
35
|
+
start.set_defaults(handler=_handle_start, format_hint="")
|
|
36
|
+
|
|
37
|
+
status = import_subparsers.add_parser("status", help="查询导入状态")
|
|
38
|
+
status.add_argument("--app-key", required=True)
|
|
39
39
|
status.add_argument("--import-id")
|
|
40
|
-
status.add_argument("--process-id")
|
|
40
|
+
status.add_argument("--process-id-str")
|
|
41
41
|
status.set_defaults(handler=_handle_status, format_hint="import_status")
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
def _handle_template(args: argparse.Namespace, context: CliContext) -> dict:
|
|
45
|
-
return context.imports.
|
|
45
|
+
return context.imports.record_import_template_get(
|
|
46
|
+
profile=args.profile,
|
|
47
|
+
app_key=args.app_key,
|
|
48
|
+
download_to_path=args.download_to_path,
|
|
49
|
+
)
|
|
46
50
|
|
|
47
51
|
|
|
48
52
|
def _handle_verify(args: argparse.Namespace, context: CliContext) -> dict:
|
|
49
|
-
return context.imports.
|
|
53
|
+
return context.imports.record_import_verify(
|
|
54
|
+
profile=args.profile,
|
|
55
|
+
app_key=args.app_key,
|
|
56
|
+
file_path=args.file_path,
|
|
57
|
+
)
|
|
50
58
|
|
|
51
59
|
|
|
52
60
|
def _handle_repair(args: argparse.Namespace, context: CliContext) -> dict:
|
|
53
|
-
return context.imports.
|
|
61
|
+
return context.imports.record_import_repair_local(
|
|
54
62
|
profile=args.profile,
|
|
55
|
-
verification_id=args.
|
|
56
|
-
authorized_file_modification=bool(args.
|
|
57
|
-
output_path=args.
|
|
63
|
+
verification_id=args.verification_id,
|
|
64
|
+
authorized_file_modification=bool(args.authorized_file_modification),
|
|
65
|
+
output_path=args.output_path,
|
|
58
66
|
selected_repairs=list(args.selected_repairs or []),
|
|
59
67
|
)
|
|
60
68
|
|
|
61
69
|
|
|
62
70
|
def _handle_start(args: argparse.Namespace, context: CliContext) -> dict:
|
|
63
|
-
return context.imports.
|
|
71
|
+
return context.imports.record_import_start(
|
|
64
72
|
profile=args.profile,
|
|
65
|
-
app_key=args.
|
|
66
|
-
verification_id=args.
|
|
67
|
-
being_enter_auditing=bool(args.
|
|
68
|
-
view_key=args.
|
|
73
|
+
app_key=args.app_key,
|
|
74
|
+
verification_id=args.verification_id,
|
|
75
|
+
being_enter_auditing=bool(args.being_enter_auditing),
|
|
76
|
+
view_key=args.view_key,
|
|
69
77
|
)
|
|
70
78
|
|
|
71
79
|
|
|
72
80
|
def _handle_status(args: argparse.Namespace, context: CliContext) -> dict:
|
|
73
|
-
return context.imports.
|
|
81
|
+
return context.imports.record_import_status_get(
|
|
74
82
|
profile=args.profile,
|
|
75
|
-
app_key=args.
|
|
83
|
+
app_key=args.app_key,
|
|
76
84
|
import_id=args.import_id,
|
|
77
|
-
process_id_str=args.
|
|
85
|
+
process_id_str=args.process_id_str,
|
|
78
86
|
)
|
|
@@ -5,200 +5,198 @@ from typing import Any
|
|
|
5
5
|
|
|
6
6
|
from ...errors import QingflowApiError
|
|
7
7
|
from ..context import CliContext
|
|
8
|
-
from .common import
|
|
8
|
+
from .common import load_list_arg, load_object_arg, require_list_arg, require_object_arg
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
def register(subparsers: argparse._SubParsersAction[argparse.ArgumentParser]) -> None:
|
|
12
|
-
parser = subparsers.add_parser("
|
|
13
|
-
record_subparsers = parser.add_subparsers(dest="
|
|
12
|
+
parser = subparsers.add_parser("record", help="记录与表结构")
|
|
13
|
+
record_subparsers = parser.add_subparsers(dest="record_command", required=True)
|
|
14
14
|
|
|
15
|
-
schema = record_subparsers.add_parser("schema", help="
|
|
16
|
-
schema.add_argument("--app", required=True)
|
|
15
|
+
schema = record_subparsers.add_parser("schema", help="读取记录相关表结构")
|
|
16
|
+
schema.add_argument("--app-key", required=True)
|
|
17
17
|
schema.add_argument("--mode", choices=["applicant", "browse", "insert", "update", "import", "code-block"], default="applicant")
|
|
18
|
-
schema.add_argument("--view")
|
|
19
|
-
schema.add_argument("--record", type=int)
|
|
20
|
-
schema.set_defaults(handler=_handle_schema, format_hint="
|
|
18
|
+
schema.add_argument("--view-id")
|
|
19
|
+
schema.add_argument("--record-id", type=int)
|
|
20
|
+
schema.set_defaults(handler=_handle_schema, format_hint="")
|
|
21
21
|
|
|
22
22
|
list_parser = record_subparsers.add_parser("list", help="列出记录")
|
|
23
|
-
list_parser.add_argument("--app", required=True)
|
|
24
|
-
list_parser.add_argument("--view")
|
|
23
|
+
list_parser.add_argument("--app-key", required=True)
|
|
25
24
|
list_parser.add_argument("--column", dest="columns", action="append", type=int, default=[])
|
|
25
|
+
list_parser.add_argument("--columns-file")
|
|
26
|
+
list_parser.add_argument("--where-file")
|
|
27
|
+
list_parser.add_argument("--order-by-file")
|
|
26
28
|
list_parser.add_argument("--limit", type=int, default=20)
|
|
27
29
|
list_parser.add_argument("--page", type=int, default=1)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
list_parser.set_defaults(handler=_handle_list, format_hint="records_list")
|
|
30
|
+
list_parser.add_argument("--view-id")
|
|
31
|
+
list_parser.set_defaults(handler=_handle_list, format_hint="record_list")
|
|
31
32
|
|
|
32
33
|
get = record_subparsers.add_parser("get", help="读取单条记录")
|
|
33
|
-
get.add_argument("--app", required=True)
|
|
34
|
-
get.add_argument("--record", required=True, type=int)
|
|
35
|
-
get.add_argument("--view")
|
|
34
|
+
get.add_argument("--app-key", required=True)
|
|
35
|
+
get.add_argument("--record-id", required=True, type=int)
|
|
36
36
|
get.add_argument("--column", dest="columns", action="append", type=int, default=[])
|
|
37
|
-
get.
|
|
37
|
+
get.add_argument("--columns-file")
|
|
38
|
+
get.add_argument("--view-id")
|
|
39
|
+
get.set_defaults(handler=_handle_get, format_hint="")
|
|
38
40
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
create.add_argument("--verify-write", action=argparse.BooleanOptionalAction, default=True)
|
|
45
|
-
create.set_defaults(handler=_handle_create, format_hint="record_write")
|
|
41
|
+
insert = record_subparsers.add_parser("insert", help="新增记录")
|
|
42
|
+
insert.add_argument("--app-key", required=True)
|
|
43
|
+
insert.add_argument("--fields-file", required=True)
|
|
44
|
+
insert.add_argument("--verify-write", action=argparse.BooleanOptionalAction, default=True)
|
|
45
|
+
insert.set_defaults(handler=_handle_insert, format_hint="")
|
|
46
46
|
|
|
47
47
|
update = record_subparsers.add_parser("update", help="更新记录")
|
|
48
|
-
update.add_argument("--app", required=True)
|
|
49
|
-
update.add_argument("--record", required=True, type=int)
|
|
50
|
-
|
|
51
|
-
add_file_arg(update)
|
|
52
|
-
add_stdin_json_flag(update)
|
|
48
|
+
update.add_argument("--app-key", required=True)
|
|
49
|
+
update.add_argument("--record-id", required=True, type=int)
|
|
50
|
+
update.add_argument("--fields-file", required=True)
|
|
53
51
|
update.add_argument("--verify-write", action=argparse.BooleanOptionalAction, default=True)
|
|
54
|
-
update.set_defaults(handler=_handle_update, format_hint="
|
|
52
|
+
update.set_defaults(handler=_handle_update, format_hint="")
|
|
55
53
|
|
|
56
54
|
delete = record_subparsers.add_parser("delete", help="删除记录")
|
|
57
|
-
delete.add_argument("--app", required=True)
|
|
58
|
-
delete.add_argument("--record", type=int)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
delete.set_defaults(handler=_handle_delete, format_hint="record_write")
|
|
55
|
+
delete.add_argument("--app-key", required=True)
|
|
56
|
+
delete.add_argument("--record-id", type=int)
|
|
57
|
+
delete.add_argument("--record-ids-file")
|
|
58
|
+
delete.set_defaults(handler=_handle_delete, format_hint="")
|
|
62
59
|
|
|
63
60
|
analyze = record_subparsers.add_parser("analyze", help="分析记录数据")
|
|
64
|
-
analyze.add_argument("--app", required=True)
|
|
65
|
-
analyze.add_argument("--
|
|
61
|
+
analyze.add_argument("--app-key", required=True)
|
|
62
|
+
analyze.add_argument("--dimensions-file")
|
|
63
|
+
analyze.add_argument("--metrics-file")
|
|
64
|
+
analyze.add_argument("--filters-file")
|
|
65
|
+
analyze.add_argument("--sort-file")
|
|
66
66
|
analyze.add_argument("--limit", type=int, default=20)
|
|
67
67
|
analyze.add_argument("--strict-full", action=argparse.BooleanOptionalAction, default=False)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
68
|
+
analyze.add_argument("--view-id")
|
|
69
|
+
analyze.set_defaults(handler=_handle_analyze, format_hint="")
|
|
70
|
+
|
|
71
|
+
code_block = record_subparsers.add_parser("code-block-run", help="执行代码块字段")
|
|
72
|
+
code_block.add_argument("--app-key", required=True)
|
|
73
|
+
code_block.add_argument("--record-id", required=True, type=int)
|
|
74
|
+
code_block.add_argument("--code-block-field", required=True)
|
|
75
|
+
code_block.add_argument("--role", type=int, default=1)
|
|
76
|
+
code_block.add_argument("--workflow-node-id", type=int)
|
|
77
|
+
code_block.add_argument("--answers-file")
|
|
78
|
+
code_block.add_argument("--fields-file")
|
|
79
|
+
code_block.add_argument("--manual", action=argparse.BooleanOptionalAction, default=True)
|
|
80
|
+
code_block.add_argument("--verify-writeback", action=argparse.BooleanOptionalAction, default=True)
|
|
81
|
+
code_block.add_argument("--force-refresh-form", action="store_true")
|
|
82
|
+
code_block.set_defaults(handler=_handle_code_block_run, format_hint="")
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def _columns(args: argparse.Namespace) -> list[Any]:
|
|
86
|
+
columns: list[Any] = list(args.columns or [])
|
|
87
|
+
if args.columns_file:
|
|
88
|
+
columns.extend(require_list_arg(args.columns_file, option_name="--columns-file"))
|
|
89
|
+
return columns
|
|
84
90
|
|
|
85
91
|
|
|
86
92
|
def _handle_schema(args: argparse.Namespace, context: CliContext) -> dict:
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
93
|
+
mode = args.mode
|
|
94
|
+
if mode == "applicant":
|
|
95
|
+
return context.record.record_schema_get(
|
|
96
|
+
profile=args.profile,
|
|
97
|
+
app_key=args.app_key,
|
|
98
|
+
schema_mode="applicant",
|
|
99
|
+
)
|
|
100
|
+
if mode == "browse":
|
|
101
|
+
if not args.view_id:
|
|
102
|
+
raise QingflowApiError.config_error("--view-id is required when --mode browse")
|
|
103
|
+
return context.record.record_browse_schema_get_public(
|
|
104
|
+
profile=args.profile,
|
|
105
|
+
app_key=args.app_key,
|
|
106
|
+
view_id=args.view_id,
|
|
107
|
+
)
|
|
108
|
+
if mode == "insert":
|
|
109
|
+
return context.record.record_insert_schema_get_public(profile=args.profile, app_key=args.app_key)
|
|
110
|
+
if mode == "update":
|
|
111
|
+
if not args.record_id:
|
|
112
|
+
raise QingflowApiError.config_error("--record-id is required when --mode update")
|
|
113
|
+
return context.record.record_update_schema_get_public(
|
|
114
|
+
profile=args.profile,
|
|
115
|
+
app_key=args.app_key,
|
|
116
|
+
record_id=args.record_id,
|
|
117
|
+
)
|
|
118
|
+
if mode == "import":
|
|
119
|
+
return context.imports.record_import_schema_get(profile=args.profile, app_key=args.app_key)
|
|
120
|
+
return context.code_block.record_code_block_schema_get_public(profile=args.profile, app_key=args.app_key)
|
|
98
121
|
|
|
99
122
|
|
|
100
123
|
def _handle_list(args: argparse.Namespace, context: CliContext) -> dict:
|
|
101
|
-
|
|
102
|
-
return context.records.list(
|
|
124
|
+
return context.record.record_list(
|
|
103
125
|
profile=args.profile,
|
|
104
|
-
app_key=args.
|
|
105
|
-
columns=
|
|
106
|
-
where=
|
|
107
|
-
order_by=
|
|
108
|
-
limit=
|
|
109
|
-
page=
|
|
110
|
-
view_id=
|
|
111
|
-
list_type=None,
|
|
112
|
-
view_key=None,
|
|
113
|
-
view_name=None,
|
|
126
|
+
app_key=args.app_key,
|
|
127
|
+
columns=_columns(args),
|
|
128
|
+
where=load_list_arg(args.where_file, option_name="--where-file"),
|
|
129
|
+
order_by=load_list_arg(args.order_by_file, option_name="--order-by-file"),
|
|
130
|
+
limit=args.limit,
|
|
131
|
+
page=args.page,
|
|
132
|
+
view_id=args.view_id,
|
|
114
133
|
)
|
|
115
134
|
|
|
116
135
|
|
|
117
136
|
def _handle_get(args: argparse.Namespace, context: CliContext) -> dict:
|
|
118
|
-
return context.
|
|
137
|
+
return context.record.record_get_public(
|
|
119
138
|
profile=args.profile,
|
|
120
|
-
app_key=args.
|
|
121
|
-
record_id=args.
|
|
122
|
-
columns=
|
|
123
|
-
view_id=args.
|
|
124
|
-
workflow_node_id=None,
|
|
139
|
+
app_key=args.app_key,
|
|
140
|
+
record_id=args.record_id,
|
|
141
|
+
columns=_columns(args),
|
|
142
|
+
view_id=args.view_id,
|
|
125
143
|
)
|
|
126
144
|
|
|
127
145
|
|
|
128
|
-
def
|
|
129
|
-
return context.
|
|
146
|
+
def _handle_insert(args: argparse.Namespace, context: CliContext) -> dict:
|
|
147
|
+
return context.record.record_insert_public(
|
|
130
148
|
profile=args.profile,
|
|
131
|
-
app_key=args.
|
|
132
|
-
fields=
|
|
149
|
+
app_key=args.app_key,
|
|
150
|
+
fields=require_object_arg(args.fields_file, option_name="--fields-file"),
|
|
133
151
|
verify_write=bool(args.verify_write),
|
|
134
152
|
)
|
|
135
153
|
|
|
136
154
|
|
|
137
155
|
def _handle_update(args: argparse.Namespace, context: CliContext) -> dict:
|
|
138
|
-
return context.
|
|
156
|
+
return context.record.record_update_public(
|
|
139
157
|
profile=args.profile,
|
|
140
|
-
app_key=args.
|
|
141
|
-
record_id=args.
|
|
142
|
-
fields=
|
|
158
|
+
app_key=args.app_key,
|
|
159
|
+
record_id=args.record_id,
|
|
160
|
+
fields=require_object_arg(args.fields_file, option_name="--fields-file"),
|
|
143
161
|
verify_write=bool(args.verify_write),
|
|
144
162
|
)
|
|
145
163
|
|
|
146
164
|
|
|
147
165
|
def _handle_delete(args: argparse.Namespace, context: CliContext) -> dict:
|
|
148
|
-
record_ids =
|
|
149
|
-
|
|
150
|
-
payload = load_list_input(args, required=False)
|
|
151
|
-
record_ids = [item for item in payload if isinstance(item, int)]
|
|
152
|
-
return context.records.delete(
|
|
166
|
+
record_ids = load_list_arg(args.record_ids_file, option_name="--record-ids-file")
|
|
167
|
+
return context.record.record_delete_public(
|
|
153
168
|
profile=args.profile,
|
|
154
|
-
app_key=args.
|
|
155
|
-
record_id=args.
|
|
169
|
+
app_key=args.app_key,
|
|
170
|
+
record_id=args.record_id,
|
|
156
171
|
record_ids=record_ids,
|
|
157
172
|
)
|
|
158
173
|
|
|
159
174
|
|
|
160
175
|
def _handle_analyze(args: argparse.Namespace, context: CliContext) -> dict:
|
|
161
|
-
|
|
162
|
-
return context.records.analyze(
|
|
176
|
+
return context.record.record_analyze(
|
|
163
177
|
profile=args.profile,
|
|
164
|
-
app_key=args.
|
|
165
|
-
dimensions=
|
|
166
|
-
metrics=
|
|
167
|
-
filters=
|
|
168
|
-
sort=
|
|
169
|
-
limit=
|
|
170
|
-
strict_full=bool(
|
|
171
|
-
view_id=
|
|
172
|
-
list_type=None,
|
|
173
|
-
view_key=None,
|
|
174
|
-
view_name=None,
|
|
178
|
+
app_key=args.app_key,
|
|
179
|
+
dimensions=load_list_arg(args.dimensions_file, option_name="--dimensions-file"),
|
|
180
|
+
metrics=load_list_arg(args.metrics_file, option_name="--metrics-file"),
|
|
181
|
+
filters=load_list_arg(args.filters_file, option_name="--filters-file"),
|
|
182
|
+
sort=load_list_arg(args.sort_file, option_name="--sort-file"),
|
|
183
|
+
limit=args.limit,
|
|
184
|
+
strict_full=bool(args.strict_full),
|
|
185
|
+
view_id=args.view_id,
|
|
175
186
|
)
|
|
176
187
|
|
|
177
188
|
|
|
178
|
-
def
|
|
179
|
-
|
|
180
|
-
return context.records.run_code(
|
|
189
|
+
def _handle_code_block_run(args: argparse.Namespace, context: CliContext) -> dict:
|
|
190
|
+
return context.code_block.record_code_block_run(
|
|
181
191
|
profile=args.profile,
|
|
182
|
-
app_key=args.
|
|
183
|
-
record_id=args.
|
|
184
|
-
code_block_field=args.
|
|
192
|
+
app_key=args.app_key,
|
|
193
|
+
record_id=args.record_id,
|
|
194
|
+
code_block_field=args.code_block_field,
|
|
185
195
|
role=args.role,
|
|
186
196
|
workflow_node_id=args.workflow_node_id,
|
|
187
|
-
answers=
|
|
188
|
-
fields=
|
|
189
|
-
manual=bool(
|
|
190
|
-
verify_writeback=bool(
|
|
191
|
-
force_refresh_form=bool(
|
|
197
|
+
answers=load_list_arg(args.answers_file, option_name="--answers-file"),
|
|
198
|
+
fields=load_object_arg(args.fields_file, option_name="--fields-file") or {},
|
|
199
|
+
manual=bool(args.manual),
|
|
200
|
+
verify_writeback=bool(args.verify_writeback),
|
|
201
|
+
force_refresh_form=bool(args.force_refresh_form),
|
|
192
202
|
)
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
def _load_query_payload(args: argparse.Namespace) -> dict[str, Any]:
|
|
196
|
-
if args.stdin_json or args.file:
|
|
197
|
-
payload = load_object_input(args, required=False)
|
|
198
|
-
if payload:
|
|
199
|
-
return payload
|
|
200
|
-
return {}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
def _coerce_list(value: Any) -> list[Any]:
|
|
204
|
-
return value if isinstance(value, list) else []
|
|
@@ -3,53 +3,52 @@ from __future__ import annotations
|
|
|
3
3
|
import argparse
|
|
4
4
|
|
|
5
5
|
from ..context import CliContext
|
|
6
|
-
from .common import
|
|
6
|
+
from .common import load_object_arg
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
def register(subparsers: argparse._SubParsersAction[argparse.ArgumentParser]) -> None:
|
|
10
|
-
parser = subparsers.add_parser("
|
|
11
|
-
task_subparsers = parser.add_subparsers(dest="
|
|
10
|
+
parser = subparsers.add_parser("task", help="待办与流程上下文")
|
|
11
|
+
task_subparsers = parser.add_subparsers(dest="task_command", required=True)
|
|
12
12
|
|
|
13
13
|
list_parser = task_subparsers.add_parser("list", help="列出待办")
|
|
14
14
|
list_parser.add_argument("--task-box", default="todo")
|
|
15
15
|
list_parser.add_argument("--flow-status", default="all")
|
|
16
|
-
list_parser.add_argument("--app")
|
|
17
|
-
list_parser.add_argument("--node",
|
|
16
|
+
list_parser.add_argument("--app-key")
|
|
17
|
+
list_parser.add_argument("--workflow-node-id", type=int)
|
|
18
18
|
list_parser.add_argument("--query")
|
|
19
19
|
list_parser.add_argument("--page", type=int, default=1)
|
|
20
20
|
list_parser.add_argument("--page-size", type=int, default=20)
|
|
21
|
-
list_parser.set_defaults(handler=_handle_list, format_hint="
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
act.set_defaults(handler=_handle_act, format_hint="task_action")
|
|
21
|
+
list_parser.set_defaults(handler=_handle_list, format_hint="task_list")
|
|
22
|
+
|
|
23
|
+
get = task_subparsers.add_parser("get", help="读取待办详情")
|
|
24
|
+
get.add_argument("--app-key", required=True)
|
|
25
|
+
get.add_argument("--record-id", required=True, type=int)
|
|
26
|
+
get.add_argument("--workflow-node-id", required=True, type=int)
|
|
27
|
+
get.add_argument("--include-candidates", action=argparse.BooleanOptionalAction, default=True)
|
|
28
|
+
get.add_argument("--include-associated-reports", action=argparse.BooleanOptionalAction, default=True)
|
|
29
|
+
get.set_defaults(handler=_handle_get, format_hint="")
|
|
30
|
+
|
|
31
|
+
action = task_subparsers.add_parser("action", help="执行待办动作")
|
|
32
|
+
action.add_argument("--app-key", required=True)
|
|
33
|
+
action.add_argument("--record-id", required=True, type=int)
|
|
34
|
+
action.add_argument("--workflow-node-id", required=True, type=int)
|
|
35
|
+
action.add_argument("--action", required=True)
|
|
36
|
+
action.add_argument("--payload-file")
|
|
37
|
+
action.set_defaults(handler=_handle_action, format_hint="")
|
|
39
38
|
|
|
40
39
|
log = task_subparsers.add_parser("log", help="读取流程日志")
|
|
41
|
-
log.add_argument("--app", required=True)
|
|
42
|
-
log.add_argument("--record", required=True, type=int)
|
|
43
|
-
log.add_argument("--node", required=True, type=int)
|
|
44
|
-
log.set_defaults(handler=_handle_log, format_hint="
|
|
40
|
+
log.add_argument("--app-key", required=True)
|
|
41
|
+
log.add_argument("--record-id", required=True, type=int)
|
|
42
|
+
log.add_argument("--workflow-node-id", required=True, type=int)
|
|
43
|
+
log.set_defaults(handler=_handle_log, format_hint="")
|
|
45
44
|
|
|
46
45
|
|
|
47
46
|
def _handle_list(args: argparse.Namespace, context: CliContext) -> dict:
|
|
48
|
-
return context.
|
|
47
|
+
return context.task.task_list(
|
|
49
48
|
profile=args.profile,
|
|
50
49
|
task_box=args.task_box,
|
|
51
50
|
flow_status=args.flow_status,
|
|
52
|
-
app_key=args.
|
|
51
|
+
app_key=args.app_key,
|
|
53
52
|
workflow_node_id=args.workflow_node_id,
|
|
54
53
|
query=args.query,
|
|
55
54
|
page=args.page,
|
|
@@ -57,32 +56,32 @@ def _handle_list(args: argparse.Namespace, context: CliContext) -> dict:
|
|
|
57
56
|
)
|
|
58
57
|
|
|
59
58
|
|
|
60
|
-
def
|
|
61
|
-
return context.
|
|
59
|
+
def _handle_get(args: argparse.Namespace, context: CliContext) -> dict:
|
|
60
|
+
return context.task.task_get(
|
|
62
61
|
profile=args.profile,
|
|
63
|
-
app_key=args.
|
|
64
|
-
record_id=args.
|
|
65
|
-
workflow_node_id=args.
|
|
62
|
+
app_key=args.app_key,
|
|
63
|
+
record_id=args.record_id,
|
|
64
|
+
workflow_node_id=args.workflow_node_id,
|
|
66
65
|
include_candidates=bool(args.include_candidates),
|
|
67
66
|
include_associated_reports=bool(args.include_associated_reports),
|
|
68
67
|
)
|
|
69
68
|
|
|
70
69
|
|
|
71
|
-
def
|
|
72
|
-
return context.
|
|
70
|
+
def _handle_action(args: argparse.Namespace, context: CliContext) -> dict:
|
|
71
|
+
return context.task.task_action_execute(
|
|
73
72
|
profile=args.profile,
|
|
74
|
-
app_key=args.
|
|
75
|
-
record_id=args.
|
|
76
|
-
workflow_node_id=args.
|
|
73
|
+
app_key=args.app_key,
|
|
74
|
+
record_id=args.record_id,
|
|
75
|
+
workflow_node_id=args.workflow_node_id,
|
|
77
76
|
action=args.action,
|
|
78
|
-
payload=
|
|
77
|
+
payload=load_object_arg(args.payload_file, option_name="--payload-file") or {},
|
|
79
78
|
)
|
|
80
79
|
|
|
81
80
|
|
|
82
81
|
def _handle_log(args: argparse.Namespace, context: CliContext) -> dict:
|
|
83
|
-
return context.
|
|
82
|
+
return context.task.task_workflow_log_get(
|
|
84
83
|
profile=args.profile,
|
|
85
|
-
app_key=args.
|
|
86
|
-
record_id=args.
|
|
87
|
-
workflow_node_id=args.
|
|
84
|
+
app_key=args.app_key,
|
|
85
|
+
record_id=args.record_id,
|
|
86
|
+
workflow_node_id=args.workflow_node_id,
|
|
88
87
|
)
|
|
@@ -6,22 +6,22 @@ from ..context import CliContext
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
def register(subparsers: argparse._SubParsersAction[argparse.ArgumentParser]) -> None:
|
|
9
|
-
parser = subparsers.add_parser("
|
|
10
|
-
|
|
9
|
+
parser = subparsers.add_parser("workspace", help="工作区")
|
|
10
|
+
workspace_subparsers = parser.add_subparsers(dest="workspace_command", required=True)
|
|
11
11
|
|
|
12
|
-
list_parser =
|
|
12
|
+
list_parser = workspace_subparsers.add_parser("list", help="列出工作区")
|
|
13
13
|
list_parser.add_argument("--page", type=int, default=1)
|
|
14
14
|
list_parser.add_argument("--page-size", type=int, default=20)
|
|
15
15
|
list_parser.add_argument("--include-external", action="store_true")
|
|
16
|
-
list_parser.set_defaults(handler=_handle_list, format_hint="
|
|
16
|
+
list_parser.set_defaults(handler=_handle_list, format_hint="workspace_list")
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
select = workspace_subparsers.add_parser("select", help="切换工作区")
|
|
19
|
+
select.add_argument("--ws-id", type=int, required=True)
|
|
20
|
+
select.set_defaults(handler=_handle_select, format_hint="")
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
def _handle_list(args: argparse.Namespace, context: CliContext) -> dict:
|
|
24
|
-
return context.workspace.
|
|
24
|
+
return context.workspace.workspace_list(
|
|
25
25
|
profile=args.profile,
|
|
26
26
|
page_num=args.page,
|
|
27
27
|
page_size=args.page_size,
|
|
@@ -29,5 +29,5 @@ def _handle_list(args: argparse.Namespace, context: CliContext) -> dict:
|
|
|
29
29
|
)
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
def
|
|
33
|
-
return context.workspace.
|
|
32
|
+
def _handle_select(args: argparse.Namespace, context: CliContext) -> dict:
|
|
33
|
+
return context.workspace.workspace_select(profile=args.profile, ws_id=args.ws_id)
|