speccrew 0.7.41 → 0.7.43

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speccrew",
3
- "version": "0.7.41",
3
+ "version": "0.7.43",
4
4
  "description": "Spec-Driven Development toolkit for AI-powered IDEs",
5
5
  "author": "charlesmu99",
6
6
  "repository": {
@@ -653,15 +653,26 @@ function cmdUpdateTask(args) {
653
653
  }
654
654
  targetStage = data.stages[args.stage];
655
655
  if (!targetStage.features) {
656
- targetStage.features = [];
656
+ targetStage.features = {};
657
657
  }
658
- taskArray = targetStage.features;
659
- taskIndex = taskArray.findIndex(t => t.id === args.taskId);
660
- if (taskIndex === -1) {
661
- // UPSERT: Task not found, create new entry
662
- console.error(`Info: Task ${args.taskId} not found in stage ${args.stage}, creating new entry`);
663
- taskArray.push({ id: args.taskId, status: 'pending' });
664
- taskIndex = taskArray.length - 1;
658
+ const features = targetStage.features;
659
+ if (Array.isArray(features)) {
660
+ // Array form: [{id: "F-M08-03", ...}, ...]
661
+ taskArray = features;
662
+ taskIndex = taskArray.findIndex(t => t.id === args.taskId);
663
+ if (taskIndex === -1) {
664
+ console.error(`Info: Task ${args.taskId} not found in stage ${args.stage}, creating new entry`);
665
+ taskArray.push({ id: args.taskId, status: 'pending' });
666
+ taskIndex = taskArray.length - 1;
667
+ }
668
+ task = taskArray[taskIndex];
669
+ } else {
670
+ // Object form: { "F-M08-03": { status: ... }, ... }
671
+ if (!features[args.taskId]) {
672
+ console.error(`Info: Task ${args.taskId} not found in stage ${args.stage}, creating new entry`);
673
+ features[args.taskId] = { status: 'pending' };
674
+ }
675
+ task = features[args.taskId];
665
676
  }
666
677
  } else {
667
678
  // Flat structure: data.tasks
@@ -670,9 +681,8 @@ function cmdUpdateTask(args) {
670
681
  if (taskIndex === -1 || taskIndex === undefined) {
671
682
  outputError(`Task not found: ${args.taskId}`);
672
683
  }
684
+ task = taskArray[taskIndex];
673
685
  }
674
-
675
- task = taskArray[taskIndex];
676
686
  const now = getTimestamp();
677
687
 
678
688
  // Update status
@@ -717,15 +727,20 @@ function cmdUpdateTask(args) {
717
727
  }
718
728
  }
719
729
 
720
- // Update task
721
- taskArray[taskIndex] = task;
730
+ // Update task (only needed for array mode; object mode is updated by reference)
731
+ if (taskArray && taskIndex >= 0) {
732
+ taskArray[taskIndex] = task;
733
+ }
722
734
  data.updated_at = now;
723
735
 
724
736
  // Recalculate counts
725
737
  if (isStageMode && targetStage.counts) {
726
738
  // Update stage-level counts
727
- targetStage.counts = calculateCounts(taskArray);
728
- } else {
739
+ const countSource = Array.isArray(targetStage.features)
740
+ ? targetStage.features
741
+ : Object.values(targetStage.features);
742
+ targetStage.counts = calculateCounts(countSource);
743
+ } else if (data.tasks) {
729
744
  // Update global counts
730
745
  data.counts = calculateCounts(data.tasks);
731
746
  }