yg-team-cli 2.4.6 → 2.4.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.
- package/README.md +12 -0
- package/dist/cli.js +56 -30
- package/dist/cli.js.map +1 -1
- package/dist/index.js +56 -30
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -34,6 +34,18 @@
|
|
|
34
34
|
|
|
35
35
|
### 2026-02-03 - Bug 修复
|
|
36
36
|
|
|
37
|
+
**v2.4.8** - 修复 add-feature 命令 Listr 进度显示和 AI_MEMORY 更新问题
|
|
38
|
+
- **修复**: `claude.ts` 中 `prompt` 和 `chat` 方法使用 `-p` 参数以 print 模式运行
|
|
39
|
+
- **修复**: stdio 从 `inherit` 改为 `pipe`,正确捕获 Claude 输出
|
|
40
|
+
- **修复**: 添加 5 分钟超时和 10MB buffer 限制
|
|
41
|
+
- **影响**: 解决了 Listr 任务进度卡在"调用 Claude 生成 spec"的问题
|
|
42
|
+
|
|
43
|
+
**v2.4.7** - 修复 AI_MEMORY 功能清单更新
|
|
44
|
+
- **修复**: `add-feature.ts` 中 `updateAiMemory` 函数逻辑重写
|
|
45
|
+
- **修复**: 使用精确的段落定位在"功能清单"表格中插入新行
|
|
46
|
+
- **修复**: 添加功能名称格式化(`sso_pre_test` → `Sso Pre Test`)
|
|
47
|
+
- **修复**: Shell 脚本 `team-cli` 使用 awk 替代 sed 解决 macOS 兼容性问题
|
|
48
|
+
|
|
37
49
|
**v2.4.4** - 修复 breakdown 命令日志变量未正确插值
|
|
38
50
|
- **提交**: `c873ea5`
|
|
39
51
|
- **修复**: `breakdown.ts` 中 `ctx.selectedFile` 变量未正确插值
|
package/dist/cli.js
CHANGED
|
@@ -194,7 +194,7 @@ var init_logger = __esm({
|
|
|
194
194
|
import fs from "fs-extra";
|
|
195
195
|
import path2 from "path";
|
|
196
196
|
import { glob } from "glob";
|
|
197
|
-
var FileUtils,
|
|
197
|
+
var FileUtils, StringUtils, DateUtils, GitUtils, SpecUtils;
|
|
198
198
|
var init_utils = __esm({
|
|
199
199
|
"src/lib/utils.ts"() {
|
|
200
200
|
"use strict";
|
|
@@ -271,7 +271,7 @@ var init_utils = __esm({
|
|
|
271
271
|
return path2.dirname(new URL(url).pathname);
|
|
272
272
|
}
|
|
273
273
|
};
|
|
274
|
-
|
|
274
|
+
StringUtils = class {
|
|
275
275
|
/**
|
|
276
276
|
* 转换为 kebab-case
|
|
277
277
|
*/
|
|
@@ -447,6 +447,7 @@ var init_claude = __esm({
|
|
|
447
447
|
init_logger();
|
|
448
448
|
init_utils();
|
|
449
449
|
ClaudeAI = class {
|
|
450
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
450
451
|
verbose;
|
|
451
452
|
constructor(verbose = false) {
|
|
452
453
|
this.verbose = verbose;
|
|
@@ -514,8 +515,13 @@ ${promptText}`;
|
|
|
514
515
|
}
|
|
515
516
|
}
|
|
516
517
|
await fs2.writeFile(tempFile, finalPrompt, "utf-8");
|
|
517
|
-
const result = await execa("claude", ["
|
|
518
|
-
stdio: "inherit"
|
|
518
|
+
const result = await execa("claude", ["-p", finalPrompt], {
|
|
519
|
+
stdio: ["pipe", "pipe", "inherit"],
|
|
520
|
+
// stdin: pipe, stdout: pipe (capture), stderr: inherit (show errors)
|
|
521
|
+
timeout: options?.timeout || 3e5,
|
|
522
|
+
// 5 分钟超时
|
|
523
|
+
maxBuffer: 1024 * 1024 * 10
|
|
524
|
+
// 10MB buffer
|
|
519
525
|
});
|
|
520
526
|
return result.stdout || "";
|
|
521
527
|
} finally {
|
|
@@ -540,24 +546,16 @@ ${promptText}`;
|
|
|
540
546
|
* 发送对话(支持上下文)
|
|
541
547
|
*/
|
|
542
548
|
async chat(messages, options) {
|
|
543
|
-
const
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
});
|
|
554
|
-
return result.stdout || "";
|
|
555
|
-
} finally {
|
|
556
|
-
try {
|
|
557
|
-
await fs2.remove(tempFile);
|
|
558
|
-
} catch {
|
|
559
|
-
}
|
|
560
|
-
}
|
|
549
|
+
const fullPrompt = messages.map((msg) => {
|
|
550
|
+
const role = msg.role === "system" ? "\u7CFB\u7EDF\u6307\u4EE4" : `${msg.role === "user" ? "\u7528\u6237" : "\u52A9\u624B"}`;
|
|
551
|
+
return `[${role}]: ${msg.content}`;
|
|
552
|
+
}).join("\n\n");
|
|
553
|
+
const result = await execa("claude", ["-p", fullPrompt], {
|
|
554
|
+
stdio: ["pipe", "pipe", "inherit"],
|
|
555
|
+
timeout: options?.timeout || 3e5,
|
|
556
|
+
maxBuffer: 1024 * 1024 * 10
|
|
557
|
+
});
|
|
558
|
+
return result.stdout || "";
|
|
561
559
|
}
|
|
562
560
|
/**
|
|
563
561
|
* 分析代码
|
|
@@ -2329,7 +2327,7 @@ var init_init = __esm({
|
|
|
2329
2327
|
]);
|
|
2330
2328
|
projectName = answers.projectName;
|
|
2331
2329
|
}
|
|
2332
|
-
if (!
|
|
2330
|
+
if (!StringUtils.validateProjectName(projectName)) {
|
|
2333
2331
|
logger.error("\u9879\u76EE\u540D\u79F0\u53EA\u80FD\u5305\u542B\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\u548C\u8FDE\u5B57\u7B26");
|
|
2334
2332
|
process.exit(1);
|
|
2335
2333
|
}
|
|
@@ -3548,7 +3546,8 @@ async function updateAiMemory(featureName, featureSlug) {
|
|
|
3548
3546
|
return;
|
|
3549
3547
|
}
|
|
3550
3548
|
let content = await FileUtils.read(aiMemoryFile);
|
|
3551
|
-
const
|
|
3549
|
+
const featureDisplay = featureName.replace(/[-_]/g, " ").split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
|
|
3550
|
+
const newRow = `| ${featureDisplay} | ${featureSlug}.md | \u25CB \u672A\u5F00\u59CB | 0/0 | - | |`;
|
|
3552
3551
|
if (!content.includes("## \u529F\u80FD\u6E05\u5355")) {
|
|
3553
3552
|
content += `
|
|
3554
3553
|
## \u529F\u80FD\u6E05\u5355 (Feature Inventory)
|
|
@@ -3559,18 +3558,45 @@ ${newRow}
|
|
|
3559
3558
|
`;
|
|
3560
3559
|
} else {
|
|
3561
3560
|
const lines = content.split("\n");
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3561
|
+
let featureInventorySection = false;
|
|
3562
|
+
let insertIndex = -1;
|
|
3563
|
+
for (let i = 0; i < lines.length; i++) {
|
|
3564
|
+
const line = lines[i];
|
|
3565
|
+
if (line.includes("## \u529F\u80FD\u6E05\u5355")) {
|
|
3566
|
+
featureInventorySection = true;
|
|
3567
|
+
continue;
|
|
3568
|
+
}
|
|
3569
|
+
if (featureInventorySection && line.startsWith("## ") && !line.includes("\u529F\u80FD\u6E05\u5355")) {
|
|
3570
|
+
break;
|
|
3571
|
+
}
|
|
3572
|
+
if (featureInventorySection && /^\|[-]+\|/.test(line.trim())) {
|
|
3573
|
+
insertIndex = i + 1;
|
|
3574
|
+
break;
|
|
3575
|
+
}
|
|
3576
|
+
}
|
|
3577
|
+
if (insertIndex !== -1) {
|
|
3578
|
+
lines.splice(insertIndex, 0, newRow);
|
|
3565
3579
|
content = lines.join("\n");
|
|
3566
3580
|
} else {
|
|
3567
|
-
|
|
3581
|
+
const sectionIndex = lines.findIndex((line) => line.includes("## \u529F\u80FD\u6E05\u5355"));
|
|
3582
|
+
if (sectionIndex !== -1) {
|
|
3583
|
+
const tableLines = [
|
|
3584
|
+
"",
|
|
3585
|
+
"| \u529F\u80FD | Spec \u6587\u4EF6 | \u72B6\u6001 | \u8FDB\u5EA6 | \u5B8C\u6210\u65E5\u671F | \u5907\u6CE8 |",
|
|
3586
|
+
"|------|----------|------|------|---------|------|",
|
|
3587
|
+
newRow,
|
|
3588
|
+
""
|
|
3589
|
+
];
|
|
3590
|
+
lines.splice(sectionIndex + 1, 0, ...tableLines);
|
|
3591
|
+
content = lines.join("\n");
|
|
3592
|
+
} else {
|
|
3593
|
+
content += `
|
|
3568
3594
|
${newRow}
|
|
3569
3595
|
`;
|
|
3596
|
+
}
|
|
3570
3597
|
}
|
|
3571
3598
|
}
|
|
3572
3599
|
await FileUtils.write(aiMemoryFile, content);
|
|
3573
|
-
logger.success("AI_MEMORY.md \u5DF2\u66F4\u65B0");
|
|
3574
3600
|
}
|
|
3575
3601
|
async function showSpecPreview(specFile) {
|
|
3576
3602
|
logger.newLine();
|
|
@@ -3643,7 +3669,7 @@ var init_add_feature = __esm({
|
|
|
3643
3669
|
logger.info("\u8BF7\u5B89\u88C5 Claude CLI: npm install -g @anthropic-ai/claude-code");
|
|
3644
3670
|
process.exit(1);
|
|
3645
3671
|
}
|
|
3646
|
-
const featureSlug =
|
|
3672
|
+
const featureSlug = StringUtils.toKebabCase(featureName);
|
|
3647
3673
|
const specFile = path10.join("docs/specs", `${featureSlug}.md`);
|
|
3648
3674
|
const specExists = await FileUtils.exists(specFile);
|
|
3649
3675
|
if (specExists) {
|