@meet-im/lxcli 0.0.6 → 0.0.8

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.
@@ -11,6 +11,7 @@ export const METHOD_DESCRIPTIONS = {
11
11
  getTask: '获取需求/bug 明细',
12
12
  queryUsers: '获取用户信息',
13
13
  searchTasks: '搜索需求/bug 列表',
14
+ searchSubtasks: '搜索子任务列表',
14
15
  getAllActiveIterations: '获取启用迭代列表',
15
16
  getAllCategories: '获取项目分类列表',
16
17
  createTask: '创建需求/bug',
@@ -4,10 +4,12 @@ export interface KbCommandOptions {
4
4
  task_id?: string;
5
5
  title?: string;
6
6
  project_id?: string;
7
+ iteration_id?: string;
7
8
  file_id?: string;
8
9
  owner_id?: string;
9
10
  category_id?: string;
10
11
  query?: string;
12
+ page?: string;
11
13
  user_id?: string;
12
14
  content?: string;
13
15
  user?: string;
@@ -105,6 +105,34 @@ export function createKbAction(method) {
105
105
  }
106
106
  params = { project_id: projectId, query: options.query };
107
107
  }
108
+ else if (method === 'searchSubtasks' && (options.project_id || options.iteration_id || options.user_id || options.page)) {
109
+ const projectId = options.project_id === undefined ? undefined : parseTaskId(options.project_id);
110
+ const iterationId = options.iteration_id === undefined ? undefined : parseTaskId(options.iteration_id);
111
+ const userId = options.user_id === undefined ? undefined : options.user_id === '0' ? 0 : parseTaskId(options.user_id);
112
+ const page = options.page === undefined ? undefined : parseTaskId(options.page);
113
+ if (projectId === null) {
114
+ outputCliError('PARAM_INVALID', '--project_id must be a positive integer');
115
+ return;
116
+ }
117
+ if (iterationId === null) {
118
+ outputCliError('PARAM_INVALID', '--iteration_id must be a positive integer');
119
+ return;
120
+ }
121
+ if (userId === null) {
122
+ outputCliError('PARAM_INVALID', '--user_id must be a non-negative integer');
123
+ return;
124
+ }
125
+ if (page === null) {
126
+ outputCliError('PARAM_INVALID', '--page must be a positive integer');
127
+ return;
128
+ }
129
+ params = {
130
+ ...(projectId !== undefined ? { project_id: projectId } : {}),
131
+ ...(iterationId !== undefined ? { iteration_id: iterationId } : {}),
132
+ ...(userId !== undefined ? { user_id: userId } : {}),
133
+ ...(page !== undefined ? { page } : {}),
134
+ };
135
+ }
108
136
  else if (method === 'getAllActiveIterations' && options.project_id) {
109
137
  const projectId = parseTaskId(options.project_id);
110
138
  if (projectId === null) {
@@ -199,6 +227,7 @@ export function createKbAction(method) {
199
227
  getTask: '--task_id',
200
228
  createTask: '--title, --project_id, --owner_id and --category_id',
201
229
  searchTasks: '--project_id and --query',
230
+ searchSubtasks: '--project_id, --iteration_id, --user_id, --page',
202
231
  getAllActiveIterations: '--project_id',
203
232
  getAllCategories: '--project_id',
204
233
  getAllComments: '--task_id',
@@ -60,6 +60,18 @@ const kbService = {
60
60
  .option('--user <user>', 'Specify user')
61
61
  .option('--gateway <url>', 'Override kanboard gateway')
62
62
  .action(createKbAction('searchTasks'));
63
+ // searchSubtasks 支持快捷参数 --project_id / --user_id / --page
64
+ cmd
65
+ .command('searchSubtasks')
66
+ .description(METHOD_DESCRIPTIONS.searchSubtasks)
67
+ .option('--params <json>', 'JSON/JSON5 params; CLI fills jsonrpc/method/id')
68
+ .option('--project_id <id>', 'Project ID (shortcut)')
69
+ .option('--iteration_id <id>', 'Iteration ID (shortcut)')
70
+ .option('--user_id <id>', 'User ID (shortcut)')
71
+ .option('--page <page>', 'Page number (shortcut)')
72
+ .option('--user <user>', 'Specify user')
73
+ .option('--gateway <url>', 'Override kanboard gateway')
74
+ .action(createKbAction('searchSubtasks'));
63
75
  // getAllActiveIterations 支持快捷参数 --project_id
64
76
  cmd
65
77
  .command('getAllActiveIterations')
@@ -103,6 +115,7 @@ const kbService = {
103
115
  item !== 'getTask' &&
104
116
  item !== 'createTask' &&
105
117
  item !== 'searchTasks' &&
118
+ item !== 'searchSubtasks' &&
106
119
  item !== 'getAllActiveIterations' &&
107
120
  item !== 'getAllCategories' &&
108
121
  item !== 'getAllComments' &&
@@ -19,6 +19,12 @@ export const PARAM_DEFS = {
19
19
  { name: 'project_id', type: 'integer', required: true, description: '项目 ID。接口按项目检查查看权限。' },
20
20
  { name: 'query', type: 'string', required: true, description: 'Kanboard 搜索表达式,例如 iteration:456 status:1' },
21
21
  ],
22
+ searchSubtasks: [
23
+ { name: 'project_id', type: 'integer', required: false, description: '项目 ID。传入后仅返回该项目下的子任务,并按项目检查查看权限;不传时仅在当前用户有权限查看的启用项目中查找。' },
24
+ { name: 'iteration_id', type: 'integer', required: false, description: '迭代 ID。传入后仅返回所属需求在该迭代下的子任务;不传表示不限制迭代。' },
25
+ { name: 'user_id', type: 'integer', required: false, description: '处理人 ID。传入后仅返回该处理人的子任务;不传或传 0 表示不限制处理人。' },
26
+ { name: 'page', type: 'integer', required: false, description: '页码,从 1 开始,默认 1。每页固定最多 30 条,按页翻取。' },
27
+ ],
22
28
  getAllActiveIterations: [
23
29
  { name: 'project_id', type: 'integer', required: true, description: '项目 ID' },
24
30
  ],
@@ -38,6 +44,7 @@ export const PARAM_DEFS = {
38
44
  { name: 'category_id', type: 'integer', required: true, description: '分类 ID' },
39
45
  { name: 'iteration_id', type: 'integer', required: false, description: '迭代 ID' },
40
46
  { name: 'column_id', type: 'integer', required: false, description: '状态列 ID' },
47
+ { name: 'cc_id', type: 'array<string>', required: false, description: '抄送人列表。数组元素格式为 用户ID-用户名称,例如 ["22-Alice", "33-Bob"];未传时不设置抄送人。' },
41
48
  ],
42
49
  createSubtask: [
43
50
  { name: 'task_id', type: 'integer', required: true, description: '父需求/bug ID' },
@@ -55,6 +62,7 @@ export const PARAM_DEFS = {
55
62
  { name: 'category_id', type: 'integer', required: false, description: '分类 ID' },
56
63
  { name: 'iteration_id', type: 'integer', required: false, description: '迭代 ID' },
57
64
  { name: 'column_id', type: 'integer', required: false, description: '状态列 ID' },
65
+ { name: 'cc_id', type: 'array<string>', required: false, description: '抄送人列表。数组元素格式为 用户ID-用户名称,例如 ["22-Alice", "33-Bob"];传空数组 [] 表示清空抄送人,未传则保持不变。' },
58
66
  ],
59
67
  updateSubtask: [
60
68
  { name: 'id', type: 'integer', required: true, description: '子任务 ID' },
@@ -2,6 +2,7 @@ export const METHOD_SHORTCUT_PARAMS = {
2
2
  getTask: ['task_id'],
3
3
  createTask: ['title', 'project_id', 'owner_id', 'category_id'],
4
4
  searchTasks: ['project_id', 'query'],
5
+ searchSubtasks: ['project_id', 'iteration_id', 'user_id', 'page'],
5
6
  getAllActiveIterations: ['project_id'],
6
7
  getAllCategories: ['project_id'],
7
8
  getAllComments: ['task_id'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meet-im/lxcli",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "连续科技命令行工具",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",