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/cli.js CHANGED
@@ -2458,6 +2458,7 @@ async function executeDevelopment(specFile, milestone, todo) {
2458
2458
  logger.separator("\u2500", 60);
2459
2459
  logger.newLine();
2460
2460
  await generateSessionLog(specFile, milestone, todo, taskDescription, result);
2461
+ await askAndUpdateSpecStatus(specFile, milestone, todo);
2461
2462
  logger.header("\u5F00\u53D1\u4EFB\u52A1\u5B8C\u6210!");
2462
2463
  logger.success("\u4F1A\u8BDD\u65E5\u5FD7\u5DF2\u4FDD\u5B58");
2463
2464
  logger.newLine();
@@ -2651,6 +2652,72 @@ ${result}
2651
2652
  `;
2652
2653
  await FileUtils.write(logFile, content);
2653
2654
  }
2655
+ async function askAndUpdateSpecStatus(specFile, milestone, todo) {
2656
+ try {
2657
+ const { shouldUpdate } = await inquirer3.prompt([
2658
+ {
2659
+ type: "confirm",
2660
+ name: "shouldUpdate",
2661
+ message: "\u4EFB\u52A1\u662F\u5426\u5DF2\u5B8C\u6210\uFF1F\u662F\u5426\u66F4\u65B0 spec \u6587\u4EF6\u4E2D\u7684 todo \u72B6\u6001\uFF1F",
2662
+ default: true
2663
+ }
2664
+ ]);
2665
+ if (!shouldUpdate) {
2666
+ logger.info("\u8DF3\u8FC7\u66F4\u65B0 spec \u6587\u4EF6");
2667
+ return;
2668
+ }
2669
+ const content = await FileUtils.read(specFile);
2670
+ const lines = content.split("\n");
2671
+ let inTargetMilestone = false;
2672
+ let targetTodoIndex = -1;
2673
+ let milestoneIndex = -1;
2674
+ for (let i = 0; i < lines.length; i++) {
2675
+ const line = lines[i];
2676
+ if (milestone !== "\u6574\u4E2A spec" && line.includes(milestone)) {
2677
+ inTargetMilestone = true;
2678
+ milestoneIndex = i;
2679
+ continue;
2680
+ }
2681
+ if (inTargetMilestone) {
2682
+ if (line.match(/^###\s+Milestone/)) {
2683
+ break;
2684
+ }
2685
+ if (todo !== "\u5168\u90E8\u529F\u80FD" && todo !== "\u5168\u90E8\u4EFB\u52A1") {
2686
+ const todoMatch = line.match(/^-\s+\[[ x ]\]\s*(.+)/);
2687
+ if (todoMatch && todoMatch[1].trim() === todo) {
2688
+ targetTodoIndex = i;
2689
+ break;
2690
+ }
2691
+ }
2692
+ }
2693
+ }
2694
+ if (targetTodoIndex !== -1) {
2695
+ const line = lines[targetTodoIndex];
2696
+ lines[targetTodoIndex] = line.replace(/^-\s+\[ \]/, "- [x]");
2697
+ logger.success(`\u5DF2\u6807\u8BB0 todo \u4E3A\u5B8C\u6210: ${todo}`);
2698
+ } else if (todo === "\u5168\u90E8\u529F\u80FD" || todo === "\u5168\u90E8\u4EFB\u52A1") {
2699
+ let updatedCount = 0;
2700
+ for (let i = milestoneIndex + 1; i < lines.length; i++) {
2701
+ const line = lines[i];
2702
+ if (line.match(/^###\s+Milestone/)) {
2703
+ break;
2704
+ }
2705
+ if (line.match(/^-\s+\[ \]/)) {
2706
+ lines[i] = line.replace(/^-\s+\[ \]/, "- [x]");
2707
+ updatedCount++;
2708
+ }
2709
+ }
2710
+ logger.success(`\u5DF2\u6807\u8BB0 ${updatedCount} \u4E2A todos \u4E3A\u5B8C\u6210`);
2711
+ } else {
2712
+ logger.warn("\u672A\u627E\u5230\u5BF9\u5E94\u7684 todo \u9879");
2713
+ return;
2714
+ }
2715
+ await FileUtils.write(specFile, lines.join("\n"));
2716
+ logger.success("Spec \u6587\u4EF6\u5DF2\u66F4\u65B0");
2717
+ } catch (error) {
2718
+ logger.warn(`\u66F4\u65B0 spec \u6587\u4EF6\u5931\u8D25: ${error}`);
2719
+ }
2720
+ }
2654
2721
  var devCommand;
2655
2722
  var init_dev = __esm({
2656
2723
  "src/commands/dev.ts"() {
@@ -5866,7 +5933,7 @@ var init_index = __esm({
5866
5933
  init_config();
5867
5934
  init_diff();
5868
5935
  program = new Command16();
5869
- program.name("team-cli").description("AI-Native \u56E2\u961F\u7814\u53D1\u811A\u624B\u67B6").version("2.1.8");
5936
+ program.name("team-cli").description("AI-Native \u56E2\u961F\u7814\u53D1\u811A\u624B\u67B6").version("2.1.9");
5870
5937
  program.option("-v, --verbose", "\u8BE6\u7EC6\u8F93\u51FA\u6A21\u5F0F").option("--debug", "\u8C03\u8BD5\u6A21\u5F0F");
5871
5938
  program.addCommand(initCommand);
5872
5939
  program.addCommand(splitPrdCommand);