yg-team-cli 2.4.5 → 2.4.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/dist/cli.js CHANGED
@@ -3548,46 +3548,57 @@ async function updateAiMemory(featureName, featureSlug) {
3548
3548
  return;
3549
3549
  }
3550
3550
  let content = await FileUtils.read(aiMemoryFile);
3551
- const newRow = `| ${featureName} | ${featureSlug}.md | \u25CB \u672A\u5F00\u59CB | 0/0 | - | |`;
3551
+ const featureDisplay = featureName.replace(/[-_]/g, " ").split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
3552
+ const newRow = `| ${featureDisplay} | ${featureSlug}.md | \u25CB \u672A\u5F00\u59CB | 0/0 | - | |`;
3552
3553
  if (!content.includes("## \u529F\u80FD\u6E05\u5355")) {
3553
- const lastHeaderMatch = content.match(/^(#{1,6}\s+.+)$/m);
3554
- if (lastHeaderMatch) {
3555
- const featureList = `
3556
-
3554
+ content += `
3557
3555
  ## \u529F\u80FD\u6E05\u5355 (Feature Inventory)
3558
3556
 
3559
3557
  | \u529F\u80FD | Spec \u6587\u4EF6 | \u72B6\u6001 | \u8FDB\u5EA6 | \u5B8C\u6210\u65E5\u671F | \u5907\u6CE8 |
3560
3558
  |------|----------|------|------|---------|------|
3561
3559
  ${newRow}
3562
3560
  `;
3563
- content = content.replace(lastHeaderMatch[0], lastHeaderMatch[0] + featureList);
3561
+ } else {
3562
+ const lines = content.split("\n");
3563
+ let featureInventorySection = false;
3564
+ let insertIndex = -1;
3565
+ for (let i = 0; i < lines.length; i++) {
3566
+ const line = lines[i];
3567
+ if (line.includes("## \u529F\u80FD\u6E05\u5355")) {
3568
+ featureInventorySection = true;
3569
+ continue;
3570
+ }
3571
+ if (featureInventorySection && line.startsWith("## ") && !line.includes("\u529F\u80FD\u6E05\u5355")) {
3572
+ break;
3573
+ }
3574
+ if (featureInventorySection && /^\|[-]+\|/.test(line.trim())) {
3575
+ insertIndex = i + 1;
3576
+ break;
3577
+ }
3578
+ }
3579
+ if (insertIndex !== -1) {
3580
+ lines.splice(insertIndex, 0, newRow);
3581
+ content = lines.join("\n");
3564
3582
  } else {
3565
- content += `
3566
- ## \u529F\u80FD\u6E05\u5355 (Feature Inventory)
3567
-
3568
- | \u529F\u80FD | Spec \u6587\u4EF6 | \u72B6\u6001 | \u8FDB\u5EA6 | \u5B8C\u6210\u65E5\u671F | \u5907\u6CE8 |
3569
- |------|----------|------|------|---------|------|
3583
+ const sectionIndex = lines.findIndex((line) => line.includes("## \u529F\u80FD\u6E05\u5355"));
3584
+ if (sectionIndex !== -1) {
3585
+ const tableLines = [
3586
+ "",
3587
+ "| \u529F\u80FD | Spec \u6587\u4EF6 | \u72B6\u6001 | \u8FDB\u5EA6 | \u5B8C\u6210\u65E5\u671F | \u5907\u6CE8 |",
3588
+ "|------|----------|------|------|---------|------|",
3589
+ newRow,
3590
+ ""
3591
+ ];
3592
+ lines.splice(sectionIndex + 1, 0, ...tableLines);
3593
+ content = lines.join("\n");
3594
+ } else {
3595
+ content += `
3570
3596
  ${newRow}
3571
3597
  `;
3572
- }
3573
- } else {
3574
- const tableHeaderPattern = /(\| 功能 \| Spec 文件 \| 状态 \| 进度 \| 完成日期 \| 备注 \|(?:\r?\n)?)/;
3575
- if (tableHeaderPattern.test(content)) {
3576
- content = content.replace(tableHeaderPattern, `$1
3577
- ${newRow}$2`);
3578
- } else {
3579
- content = content.replace(
3580
- /## 功能清单 \(Feature Inventory\)/,
3581
- `## \u529F\u80FD\u6E05\u5355 (Feature Inventory)
3582
-
3583
- | \u529F\u80FD | Spec \u6587\u4EF6 | \u72B6\u6001 | \u8FDB\u5EA6 | \u5B8C\u6210\u65E5\u671F | \u5907\u6CE8 |
3584
- |------|----------|------|------|---------|------|
3585
- ${newRow}`
3586
- );
3598
+ }
3587
3599
  }
3588
3600
  }
3589
3601
  await FileUtils.write(aiMemoryFile, content);
3590
- logger.success("AI_MEMORY.md \u5DF2\u66F4\u65B0");
3591
3602
  }
3592
3603
  async function showSpecPreview(specFile) {
3593
3604
  logger.newLine();