@meet-im/lxcli 0.0.1 → 0.0.3
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/dist/commands/generate-skills.js +17 -11
- package/dist/commands/services/kb/descriptions.js +2 -0
- package/dist/commands/services/kb/handler.js +9 -0
- package/dist/commands/services/kb/index.js +10 -0
- package/dist/commands/services/kb/params.d.ts +1 -1
- package/dist/commands/services/kb/params.js +17 -4
- package/package.json +1 -1
|
@@ -7,12 +7,13 @@ import { PARAM_DEFS, METHOD_DESCRIPTIONS } from './services/kb/descriptions.js';
|
|
|
7
7
|
const API_ROOT = path.resolve('api');
|
|
8
8
|
const DEFAULT_SKILLS_DIR = path.resolve('api/skills');
|
|
9
9
|
const DEFAULT_OUTPUT = 'api/docs/skills.md';
|
|
10
|
+
const PACKAGE_JSON_PATH = path.resolve('package.json');
|
|
10
11
|
// 分类配置:前缀 -> 分类名/描述
|
|
11
12
|
const CATEGORY_CONFIG = {
|
|
12
13
|
'lxcli-builtin': { title: 'Builtin', description: 'lxcli 内置命令。' },
|
|
13
|
-
'kb-': { title: 'Kb', description: 'Kanboard 服务命令。' },
|
|
14
|
-
'meet-': { title: 'Meet', description: 'Meet 服务命令。' },
|
|
15
|
-
'meetbot-': { title: 'Meetbot', description: 'MeetBot 服务命令。' },
|
|
14
|
+
'lxcli-kb-': { title: 'Kb', description: 'Kanboard 服务命令。' },
|
|
15
|
+
'lxcli-meet-': { title: 'Meet', description: 'Meet 服务命令。' },
|
|
16
|
+
'lxcli-meetbot-': { title: 'Meetbot', description: 'MeetBot 服务命令。' },
|
|
16
17
|
};
|
|
17
18
|
function getCategory(skillName) {
|
|
18
19
|
// 精确匹配 lxcli-builtin
|
|
@@ -102,9 +103,9 @@ function renderIndex(entries) {
|
|
|
102
103
|
// 渲染各分类
|
|
103
104
|
const categoryMeta = {
|
|
104
105
|
builtin: CATEGORY_CONFIG['lxcli-builtin'],
|
|
105
|
-
kb: CATEGORY_CONFIG['kb-'],
|
|
106
|
-
meet: CATEGORY_CONFIG['meet-'],
|
|
107
|
-
meetbot: CATEGORY_CONFIG['meetbot-'],
|
|
106
|
+
kb: CATEGORY_CONFIG['lxcli-kb-'],
|
|
107
|
+
meet: CATEGORY_CONFIG['lxcli-meet-'],
|
|
108
|
+
meetbot: CATEGORY_CONFIG['lxcli-meetbot-'],
|
|
108
109
|
other: { title: 'Other', description: '其他命令。' },
|
|
109
110
|
};
|
|
110
111
|
for (const [cat, items] of Object.entries(grouped)) {
|
|
@@ -149,10 +150,14 @@ function renderParamsTable(params) {
|
|
|
149
150
|
lines.push('');
|
|
150
151
|
return lines.join('\n');
|
|
151
152
|
}
|
|
152
|
-
function
|
|
153
|
+
async function readPackageVersion() {
|
|
154
|
+
const packageJson = JSON.parse(await fs.readFile(PACKAGE_JSON_PATH, 'utf-8'));
|
|
155
|
+
return packageJson.version || '1.0.0';
|
|
156
|
+
}
|
|
157
|
+
function renderSkillMd(method, version) {
|
|
153
158
|
const description = METHOD_DESCRIPTIONS[method];
|
|
154
159
|
const params = PARAM_DEFS[method] || [];
|
|
155
|
-
const skillName = `kb-${method}`;
|
|
160
|
+
const skillName = `lxcli-kb-${method}`;
|
|
156
161
|
const hasParams = params.length > 0;
|
|
157
162
|
// 快捷参数列表
|
|
158
163
|
const shortcuts = params.filter(p => p.required).map(p => `--${p.name} <${p.type === 'integer' ? 'ID' : 'VALUE'}>`);
|
|
@@ -197,7 +202,7 @@ function renderSkillMd(method) {
|
|
|
197
202
|
name: ${skillName}
|
|
198
203
|
description: "Kanboard: ${description}"
|
|
199
204
|
metadata:
|
|
200
|
-
version:
|
|
205
|
+
version: ${version}
|
|
201
206
|
openclaw:
|
|
202
207
|
category: "productivity"
|
|
203
208
|
requires:
|
|
@@ -227,8 +232,9 @@ async function generateServiceSkills(skillsDir, serviceName) {
|
|
|
227
232
|
return;
|
|
228
233
|
}
|
|
229
234
|
const methods = Object.keys(PARAM_DEFS);
|
|
235
|
+
const version = await readPackageVersion();
|
|
230
236
|
for (const method of methods) {
|
|
231
|
-
const skillName =
|
|
237
|
+
const skillName = `lxcli-${serviceName}-${method}`;
|
|
232
238
|
const skillDir = path.join(skillsDir, skillName);
|
|
233
239
|
const skillPath = path.join(skillDir, 'SKILL.md');
|
|
234
240
|
// 检查是否已有手写的 SKILL.md
|
|
@@ -241,7 +247,7 @@ async function generateServiceSkills(skillsDir, serviceName) {
|
|
|
241
247
|
// 不存在,生成新的
|
|
242
248
|
}
|
|
243
249
|
await fs.mkdir(skillDir, { recursive: true });
|
|
244
|
-
const content = renderSkillMd(method);
|
|
250
|
+
const content = renderSkillMd(method, version);
|
|
245
251
|
await fs.writeFile(skillPath, content, 'utf-8');
|
|
246
252
|
logger.info(`Generated ${skillName}/SKILL.md`);
|
|
247
253
|
}
|
|
@@ -12,9 +12,11 @@ export const METHOD_DESCRIPTIONS = {
|
|
|
12
12
|
queryUsers: '获取用户信息',
|
|
13
13
|
searchTasks: '搜索需求/bug 列表',
|
|
14
14
|
getAllActiveIterations: '获取启用迭代列表',
|
|
15
|
+
getAllCategories: '获取项目分类列表',
|
|
15
16
|
createTask: '创建需求/bug',
|
|
16
17
|
createSubtask: '创建子任务',
|
|
17
18
|
updateTask: '修改需求',
|
|
19
|
+
updateSubtask: '更新子任务',
|
|
18
20
|
getAllComments: '获取评论列表',
|
|
19
21
|
createComment: '对需求增加评论',
|
|
20
22
|
createProjectFile: '上传附件到项目',
|
|
@@ -111,6 +111,14 @@ export function createKbAction(method) {
|
|
|
111
111
|
}
|
|
112
112
|
params = { project_id: projectId };
|
|
113
113
|
}
|
|
114
|
+
else if (method === 'getAllCategories' && options.project_id) {
|
|
115
|
+
const projectId = parseTaskId(options.project_id);
|
|
116
|
+
if (projectId === null) {
|
|
117
|
+
outputCliError('PARAM_INVALID', '--project_id must be a positive integer');
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
params = { project_id: projectId };
|
|
121
|
+
}
|
|
114
122
|
else if (method === 'getAllComments' && options.task_id) {
|
|
115
123
|
const taskId = parseTaskId(options.task_id);
|
|
116
124
|
if (taskId === null) {
|
|
@@ -164,6 +172,7 @@ export function createKbAction(method) {
|
|
|
164
172
|
createTask: '--title and --project_id',
|
|
165
173
|
searchTasks: '--project_id and --query',
|
|
166
174
|
getAllActiveIterations: '--project_id',
|
|
175
|
+
getAllCategories: '--project_id',
|
|
167
176
|
getAllComments: '--task_id',
|
|
168
177
|
createProjectFile: '--file and --project_id',
|
|
169
178
|
createTaskFile: '--file, --task_id and --project_id',
|
|
@@ -67,6 +67,15 @@ const kbService = {
|
|
|
67
67
|
.option('--user <user>', 'Specify user')
|
|
68
68
|
.option('--gateway <url>', 'Override kanboard gateway')
|
|
69
69
|
.action(createKbAction('getAllActiveIterations'));
|
|
70
|
+
// getAllCategories 支持快捷参数 --project_id
|
|
71
|
+
cmd
|
|
72
|
+
.command('getAllCategories')
|
|
73
|
+
.description(METHOD_DESCRIPTIONS.getAllCategories)
|
|
74
|
+
.option('--params <json>', 'JSON/JSON5 params; CLI fills jsonrpc/method/id')
|
|
75
|
+
.option('--project_id <id>', 'Project ID (shortcut)')
|
|
76
|
+
.option('--user <user>', 'Specify user')
|
|
77
|
+
.option('--gateway <url>', 'Override kanboard gateway')
|
|
78
|
+
.action(createKbAction('getAllCategories'));
|
|
70
79
|
// getAllComments 支持快捷参数 --task_id
|
|
71
80
|
cmd
|
|
72
81
|
.command('getAllComments')
|
|
@@ -82,6 +91,7 @@ const kbService = {
|
|
|
82
91
|
item !== 'createTask' &&
|
|
83
92
|
item !== 'searchTasks' &&
|
|
84
93
|
item !== 'getAllActiveIterations' &&
|
|
94
|
+
item !== 'getAllCategories' &&
|
|
85
95
|
item !== 'getAllComments' &&
|
|
86
96
|
item !== 'createTaskFile' &&
|
|
87
97
|
item !== 'createProjectFile')) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type ParamType = 'integer' | 'string' | 'array<integer>' | 'array<string>' | 'object' | 'file';
|
|
1
|
+
export type ParamType = 'integer' | 'number' | 'string' | 'array<integer>' | 'array<string>' | 'object' | 'file';
|
|
2
2
|
export interface ParamDef {
|
|
3
3
|
name: string;
|
|
4
4
|
type: ParamType;
|
|
@@ -22,6 +22,9 @@ export const PARAM_DEFS = {
|
|
|
22
22
|
getAllActiveIterations: [
|
|
23
23
|
{ name: 'project_id', type: 'integer', required: true, description: '项目 ID' },
|
|
24
24
|
],
|
|
25
|
+
getAllCategories: [
|
|
26
|
+
{ name: 'project_id', type: 'integer', required: true, description: '项目 ID' },
|
|
27
|
+
],
|
|
25
28
|
getAllComments: [
|
|
26
29
|
{ name: 'task_id', type: 'integer', required: true, description: '需求/bug ID' },
|
|
27
30
|
],
|
|
@@ -29,10 +32,10 @@ export const PARAM_DEFS = {
|
|
|
29
32
|
createTask: [
|
|
30
33
|
{ name: 'title', type: 'string', required: true, description: '需求标题' },
|
|
31
34
|
{ name: 'project_id', type: 'integer', required: true, description: '项目 ID' },
|
|
32
|
-
{ name: 'owner_id', type: 'integer', required:
|
|
35
|
+
{ name: 'owner_id', type: 'integer', required: true, description: '处理人 Kanboard 用户 ID' },
|
|
33
36
|
{ name: 'is_bug', type: 'integer', required: false, description: '是否为 bug,1 表示 bug,0 表示需求' },
|
|
34
37
|
{ name: 'description', type: 'string', required: false, description: '需求描述(支持 Markdown)' },
|
|
35
|
-
{ name: 'category_id', type: 'integer', required:
|
|
38
|
+
{ name: 'category_id', type: 'integer', required: true, description: '分类 ID' },
|
|
36
39
|
{ name: 'iteration_id', type: 'integer', required: false, description: '迭代 ID' },
|
|
37
40
|
{ name: 'column_id', type: 'integer', required: false, description: '状态列 ID' },
|
|
38
41
|
],
|
|
@@ -40,8 +43,8 @@ export const PARAM_DEFS = {
|
|
|
40
43
|
{ name: 'task_id', type: 'integer', required: true, description: '父需求/bug ID' },
|
|
41
44
|
{ name: 'title', type: 'string', required: true, description: '子任务标题' },
|
|
42
45
|
{ name: 'user_id', type: 'integer', required: false, description: '子任务处理人 Kanboard 用户 ID' },
|
|
43
|
-
{ name: 'time_estimated', type: '
|
|
44
|
-
{ name: 'time_spent', type: '
|
|
46
|
+
{ name: 'time_estimated', type: 'number', required: false, description: '预估时间(小时)' },
|
|
47
|
+
{ name: 'time_spent', type: 'number', required: false, description: '已花费时间(小时)' },
|
|
45
48
|
{ name: 'status', type: 'integer', required: false, description: '状态:0 未开始,1 进行中,2 已完成' },
|
|
46
49
|
],
|
|
47
50
|
updateTask: [
|
|
@@ -53,6 +56,16 @@ export const PARAM_DEFS = {
|
|
|
53
56
|
{ name: 'iteration_id', type: 'integer', required: false, description: '迭代 ID' },
|
|
54
57
|
{ name: 'column_id', type: 'integer', required: false, description: '状态列 ID' },
|
|
55
58
|
],
|
|
59
|
+
updateSubtask: [
|
|
60
|
+
{ name: 'id', type: 'integer', required: true, description: '子任务 ID' },
|
|
61
|
+
{ name: 'task_id', type: 'integer', required: true, description: '父需求/bug ID' },
|
|
62
|
+
{ name: 'title', type: 'string', required: false, description: '子任务标题' },
|
|
63
|
+
{ name: 'user_id', type: 'integer', required: false, description: '子任务处理人,传 0 表示未分配' },
|
|
64
|
+
{ name: 'time_estimated', type: 'number', required: false, description: '预估时间(小时)' },
|
|
65
|
+
{ name: 'time_spent', type: 'number', required: false, description: '已花费时间(小时)' },
|
|
66
|
+
{ name: 'status', type: 'integer', required: false, description: '状态:0 未开始,1 进行中,2 已完成' },
|
|
67
|
+
{ name: 'position', type: 'integer', required: false, description: '子任务排序位置' },
|
|
68
|
+
],
|
|
56
69
|
createComment: [
|
|
57
70
|
{ name: 'task_id', type: 'integer', required: true, description: '需求/bug ID' },
|
|
58
71
|
{ name: 'user_id', type: 'integer', required: true, description: '评论作者 Kanboard 用户 ID' },
|