yg-team-cli 2.1.8 → 2.1.9

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/index.js CHANGED
@@ -2473,6 +2473,7 @@ async function executeDevelopment(specFile, milestone, todo) {
2473
2473
  logger.separator("\u2500", 60);
2474
2474
  logger.newLine();
2475
2475
  await generateSessionLog(specFile, milestone, todo, taskDescription, result);
2476
+ await askAndUpdateSpecStatus(specFile, milestone, todo);
2476
2477
  logger.header("\u5F00\u53D1\u4EFB\u52A1\u5B8C\u6210!");
2477
2478
  logger.success("\u4F1A\u8BDD\u65E5\u5FD7\u5DF2\u4FDD\u5B58");
2478
2479
  logger.newLine();
@@ -2666,6 +2667,72 @@ ${result}
2666
2667
  `;
2667
2668
  await FileUtils.write(logFile, content);
2668
2669
  }
2670
+ async function askAndUpdateSpecStatus(specFile, milestone, todo) {
2671
+ try {
2672
+ const { shouldUpdate } = await inquirer3.prompt([
2673
+ {
2674
+ type: "confirm",
2675
+ name: "shouldUpdate",
2676
+ message: "\u4EFB\u52A1\u662F\u5426\u5DF2\u5B8C\u6210\uFF1F\u662F\u5426\u66F4\u65B0 spec \u6587\u4EF6\u4E2D\u7684 todo \u72B6\u6001\uFF1F",
2677
+ default: true
2678
+ }
2679
+ ]);
2680
+ if (!shouldUpdate) {
2681
+ logger.info("\u8DF3\u8FC7\u66F4\u65B0 spec \u6587\u4EF6");
2682
+ return;
2683
+ }
2684
+ const content = await FileUtils.read(specFile);
2685
+ const lines = content.split("\n");
2686
+ let inTargetMilestone = false;
2687
+ let targetTodoIndex = -1;
2688
+ let milestoneIndex = -1;
2689
+ for (let i = 0; i < lines.length; i++) {
2690
+ const line = lines[i];
2691
+ if (milestone !== "\u6574\u4E2A spec" && line.includes(milestone)) {
2692
+ inTargetMilestone = true;
2693
+ milestoneIndex = i;
2694
+ continue;
2695
+ }
2696
+ if (inTargetMilestone) {
2697
+ if (line.match(/^###\s+Milestone/)) {
2698
+ break;
2699
+ }
2700
+ if (todo !== "\u5168\u90E8\u529F\u80FD" && todo !== "\u5168\u90E8\u4EFB\u52A1") {
2701
+ const todoMatch = line.match(/^-\s+\[[ x ]\]\s*(.+)/);
2702
+ if (todoMatch && todoMatch[1].trim() === todo) {
2703
+ targetTodoIndex = i;
2704
+ break;
2705
+ }
2706
+ }
2707
+ }
2708
+ }
2709
+ if (targetTodoIndex !== -1) {
2710
+ const line = lines[targetTodoIndex];
2711
+ lines[targetTodoIndex] = line.replace(/^-\s+\[ \]/, "- [x]");
2712
+ logger.success(`\u5DF2\u6807\u8BB0 todo \u4E3A\u5B8C\u6210: ${todo}`);
2713
+ } else if (todo === "\u5168\u90E8\u529F\u80FD" || todo === "\u5168\u90E8\u4EFB\u52A1") {
2714
+ let updatedCount = 0;
2715
+ for (let i = milestoneIndex + 1; i < lines.length; i++) {
2716
+ const line = lines[i];
2717
+ if (line.match(/^###\s+Milestone/)) {
2718
+ break;
2719
+ }
2720
+ if (line.match(/^-\s+\[ \]/)) {
2721
+ lines[i] = line.replace(/^-\s+\[ \]/, "- [x]");
2722
+ updatedCount++;
2723
+ }
2724
+ }
2725
+ logger.success(`\u5DF2\u6807\u8BB0 ${updatedCount} \u4E2A todos \u4E3A\u5B8C\u6210`);
2726
+ } else {
2727
+ logger.warn("\u672A\u627E\u5230\u5BF9\u5E94\u7684 todo \u9879");
2728
+ return;
2729
+ }
2730
+ await FileUtils.write(specFile, lines.join("\n"));
2731
+ logger.success("Spec \u6587\u4EF6\u5DF2\u66F4\u65B0");
2732
+ } catch (error) {
2733
+ logger.warn(`\u66F4\u65B0 spec \u6587\u4EF6\u5931\u8D25: ${error}`);
2734
+ }
2735
+ }
2669
2736
 
2670
2737
  // src/commands/add-feature.ts
2671
2738
  init_esm_shims();
@@ -5686,7 +5753,7 @@ var Table = class {
5686
5753
 
5687
5754
  // src/index.ts
5688
5755
  var program = new Command16();
5689
- program.name("team-cli").description("AI-Native \u56E2\u961F\u7814\u53D1\u811A\u624B\u67B6").version("2.1.8");
5756
+ program.name("team-cli").description("AI-Native \u56E2\u961F\u7814\u53D1\u811A\u624B\u67B6").version("2.1.9");
5690
5757
  program.option("-v, --verbose", "\u8BE6\u7EC6\u8F93\u51FA\u6A21\u5F0F").option("--debug", "\u8C03\u8BD5\u6A21\u5F0F");
5691
5758
  program.addCommand(initCommand);
5692
5759
  program.addCommand(splitPrdCommand);