@lyra-ai/toolkit 0.2.5 → 0.2.7
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/QUICKSTART.md +1 -4
- package/README.md +1 -2
- package/bin/toolkit.mjs +10 -21
- package/package.json +1 -1
- package/src/config-cmd.mjs +1 -1
- package/src/flush.mjs +243 -221
- package/src/hook.mjs +35 -21
- package/src/install.mjs +74 -34
- package/src/shared/backlog.mjs +96 -0
- package/src/shared/config.mjs +17 -0
- package/src/shared/http.mjs +29 -0
- package/src/shared/lock.mjs +79 -0
- package/src/shared/settle.mjs +20 -0
- package/src/shared/zip.mjs +89 -0
- package/src/skillhub.mjs +2 -319
- package/src/status.mjs +103 -36
- package/src/uninstall.mjs +26 -13
- package/src/zentao.mjs +57 -2
package/src/zentao.mjs
CHANGED
|
@@ -327,6 +327,48 @@ export function shapeBugListItem(b) {
|
|
|
327
327
|
};
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
+
// 去除 HTML 标签 + 折叠空白:action.comment/desc 可能含 <p>/<strong>/<br> 等
|
|
331
|
+
function stripHtml(s) {
|
|
332
|
+
if (!s) return '';
|
|
333
|
+
return String(s)
|
|
334
|
+
.replace(/<br\s*\/?\s*>/gi, '\n')
|
|
335
|
+
.replace(/<\/p>\s*<p[^>]*>/gi, '\n')
|
|
336
|
+
.replace(/<[^>]+>/g, '')
|
|
337
|
+
.replace(/ /g, ' ')
|
|
338
|
+
.replace(/</g, '<')
|
|
339
|
+
.replace(/>/g, '>')
|
|
340
|
+
.replace(/&/g, '&')
|
|
341
|
+
.replace(/[ \t]+\n/g, '\n')
|
|
342
|
+
.replace(/\n{3,}/g, '\n\n')
|
|
343
|
+
.trim();
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// 历史动作/评论轨迹:原始 actions[] 清洗为精简结构
|
|
347
|
+
// { actor, action, date, comment, extra, changes: [{ field, fieldName, old, new }] }
|
|
348
|
+
// comment/desc 去标签;history 取字段变更明细;空 comment / 无变更的动作仍保留(动作本身有意义)
|
|
349
|
+
export function shapeActions(actions) {
|
|
350
|
+
if (!Array.isArray(actions)) return [];
|
|
351
|
+
return actions
|
|
352
|
+
.filter((a) => a && typeof a === 'object')
|
|
353
|
+
.map((a) => ({
|
|
354
|
+
actor: a.actor ?? '',
|
|
355
|
+
action: a.action ?? '',
|
|
356
|
+
date: a.date ?? '',
|
|
357
|
+
comment: stripHtml(a.comment),
|
|
358
|
+
extra: a.extra ? stripHtml(String(a.extra)) : '',
|
|
359
|
+
changes: Array.isArray(a.history)
|
|
360
|
+
? a.history
|
|
361
|
+
.filter((h) => h && typeof h === 'object')
|
|
362
|
+
.map((h) => ({
|
|
363
|
+
field: h.field ?? '',
|
|
364
|
+
fieldName: h.fieldName ?? h.field ?? '',
|
|
365
|
+
old: h.old ?? '',
|
|
366
|
+
new: h.new ?? '',
|
|
367
|
+
}))
|
|
368
|
+
: [],
|
|
369
|
+
}));
|
|
370
|
+
}
|
|
371
|
+
|
|
330
372
|
export function shapeBugDetail(b) {
|
|
331
373
|
return {
|
|
332
374
|
...shapeBugListItem(b),
|
|
@@ -336,6 +378,7 @@ export function shapeBugDetail(b) {
|
|
|
336
378
|
resolvedDate: b.resolvedDate ?? '', resolvedBuild: b.resolvedBuild ?? '',
|
|
337
379
|
closedBy: userToAccount(b.closedBy), closedDate: b.closedDate ?? '',
|
|
338
380
|
lastEditedBy: userToAccount(b.lastEditedBy), lastEditedDate: b.lastEditedDate ?? '',
|
|
381
|
+
actions: shapeActions(b.actions),
|
|
339
382
|
};
|
|
340
383
|
}
|
|
341
384
|
|
|
@@ -377,14 +420,26 @@ export function bugListToMarkdown({ total, count, bugs }) {
|
|
|
377
420
|
|
|
378
421
|
export function bugDetailToMarkdown(b) {
|
|
379
422
|
const f = (k) => b[k] === '' || b[k] == null ? '-' : b[k];
|
|
380
|
-
|
|
423
|
+
const lines = [
|
|
381
424
|
`# Bug #${b.id}: ${b.title}`, '',
|
|
382
425
|
`- **Severity**: ${b.severity} | **Priority**: ${b.priority} | **Status**: ${b.status}`,
|
|
383
426
|
`- **Project**: ${b.projectId} | **Product**: ${b.productId}`,
|
|
384
427
|
`- **OpenedBy**: ${b.openedBy} ${b.openedDate} | **AssignedTo**: ${f('assignedTo')}`,
|
|
385
428
|
`- **Resolution**: ${f('resolution')} by ${f('resolvedBy')} ${f('resolvedDate')}`,
|
|
386
429
|
'', '## Steps', '', b.steps || '(empty)',
|
|
387
|
-
]
|
|
430
|
+
];
|
|
431
|
+
if (Array.isArray(b.actions) && b.actions.length) {
|
|
432
|
+
lines.push('', '## History', '');
|
|
433
|
+
for (const a of b.actions) {
|
|
434
|
+
const extra = a.extra ? ` → **${a.extra}**` : '';
|
|
435
|
+
lines.push(`- **${a.actor || '?'}** \`${a.action || '?'}\` _${a.date || '?'}_${extra}`);
|
|
436
|
+
if (a.comment) lines.push(` > ${a.comment.replace(/\n/g, '\n > ')}`);
|
|
437
|
+
for (const c of a.changes) {
|
|
438
|
+
lines.push(` - ${c.fieldName || c.field}: \`${c.old || '∅'}\` → \`${c.new || '∅'}\``);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
return lines.join('\n');
|
|
388
443
|
}
|
|
389
444
|
|
|
390
445
|
// HTTP 状态码 -> 统一错误 kind/message
|