specweave 1.0.406 → 1.0.409

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.
Files changed (31) hide show
  1. package/dist/plugins/specweave-ado/lib/ado-spec-sync.d.ts.map +1 -1
  2. package/dist/plugins/specweave-ado/lib/ado-spec-sync.js +16 -5
  3. package/dist/plugins/specweave-ado/lib/ado-spec-sync.js.map +1 -1
  4. package/dist/plugins/specweave-jira/lib/jira-paginated-search.d.ts +9 -1
  5. package/dist/plugins/specweave-jira/lib/jira-paginated-search.d.ts.map +1 -1
  6. package/dist/plugins/specweave-jira/lib/jira-paginated-search.js +28 -19
  7. package/dist/plugins/specweave-jira/lib/jira-paginated-search.js.map +1 -1
  8. package/dist/plugins/specweave-jira/lib/jira-spec-sync.d.ts +5 -0
  9. package/dist/plugins/specweave-jira/lib/jira-spec-sync.d.ts.map +1 -1
  10. package/dist/plugins/specweave-jira/lib/jira-spec-sync.js +39 -5
  11. package/dist/plugins/specweave-jira/lib/jira-spec-sync.js.map +1 -1
  12. package/dist/src/cli/commands/init.d.ts.map +1 -1
  13. package/dist/src/cli/commands/init.js +31 -10
  14. package/dist/src/cli/commands/init.js.map +1 -1
  15. package/dist/src/cli/commands/update.d.ts.map +1 -1
  16. package/dist/src/cli/commands/update.js +30 -20
  17. package/dist/src/cli/commands/update.js.map +1 -1
  18. package/dist/src/cli/helpers/init/plugin-installer.js +2 -9
  19. package/dist/src/cli/helpers/init/plugin-installer.js.map +1 -1
  20. package/dist/src/core/background/job-launcher.js +2 -2
  21. package/dist/src/core/background/job-launcher.js.map +1 -1
  22. package/dist/src/core/doctor/checkers/installation-health-checker.d.ts.map +1 -1
  23. package/dist/src/core/doctor/checkers/installation-health-checker.js +21 -6
  24. package/dist/src/core/doctor/checkers/installation-health-checker.js.map +1 -1
  25. package/package.json +1 -1
  26. package/plugins/specweave-ado/lib/ado-spec-sync.js +14 -5
  27. package/plugins/specweave-ado/lib/ado-spec-sync.ts +17 -5
  28. package/plugins/specweave-jira/lib/jira-paginated-search.js +18 -17
  29. package/plugins/specweave-jira/lib/jira-paginated-search.ts +32 -20
  30. package/plugins/specweave-jira/lib/jira-spec-sync.js +35 -4
  31. package/plugins/specweave-jira/lib/jira-spec-sync.ts +44 -6
@@ -149,8 +149,10 @@ export class JiraSpecSync {
149
149
  changes
150
150
  };
151
151
 
152
- } catch (error) {
153
- console.error('❌ Error syncing to Jira:', error);
152
+ } catch (error: any) {
153
+ const axiosData = error?.response?.data;
154
+ const detail = axiosData ? JSON.stringify(axiosData) : '';
155
+ console.error('❌ Error syncing to Jira:', error?.message || error, detail ? `\n Response: ${detail}` : '');
154
156
  return {
155
157
  success: false,
156
158
  specId,
@@ -562,7 +564,9 @@ ${acList}
562
564
  * Find story by title pattern
563
565
  */
564
566
  private async findStoryByTitle(usId: string): Promise<JiraStory | null> {
565
- const jql = `project = ${this.config.projectKey} AND summary ~ "[${usId}]" AND issuetype = Story`;
567
+ // Search for user story by ID in summary don't hardcode issuetype since
568
+ // projects may use Task, New Feature, etc. instead of Story
569
+ const jql = `project = ${this.config.projectKey} AND summary ~ "[${usId}]" AND issuetype != Epic`;
566
570
 
567
571
  const issues = await searchAllIssues(this.client, {
568
572
  jql,
@@ -591,8 +595,9 @@ ${acList}
591
595
  priority?: string;
592
596
  type?: string;
593
597
  }): Promise<JiraStory> {
594
- // Determine issue type (supports Bug for bug-type stories)
595
- const issueType = this.mapTypeToJira(story.type, 'Story');
598
+ // Determine issue type with fallback for projects that lack "Story"
599
+ const preferredType = this.mapTypeToJira(story.type, 'Story');
600
+ const issueType = await this.resolveIssueType(preferredType);
596
601
 
597
602
  // Discover epic link field dynamically based on project style
598
603
  const { field: epicField, style } = await getEpicLinkFieldForProject(
@@ -606,7 +611,7 @@ ${acList}
606
611
  key: this.config.projectKey
607
612
  },
608
613
  summary: story.summary,
609
- description: story.description,
614
+ description: toDescription(story.description, this.config.domain),
610
615
  issuetype: {
611
616
  name: issueType
612
617
  },
@@ -691,6 +696,39 @@ ${acList}
691
696
  });
692
697
  }
693
698
 
699
+ /**
700
+ * Resolve the actual issue type name available in this project.
701
+ * Falls back through preferred → alternatives if the preferred type doesn't exist.
702
+ */
703
+ private async resolveIssueType(preferred: string): Promise<string> {
704
+ try {
705
+ const response = await this.client.get(
706
+ `/issue/createmeta/${this.config.projectKey}/issuetypes`
707
+ );
708
+ const types: Array<{ name: string; subtask: boolean }> = response.data.issueTypes || [];
709
+ const available = types.filter(t => !t.subtask).map(t => t.name);
710
+
711
+ if (available.includes(preferred)) return preferred;
712
+
713
+ // Fallback chain: Story → Task → New Feature → first available
714
+ const fallbacks = ['Story', 'Task', 'New Feature', 'Improvement'];
715
+ for (const fb of fallbacks) {
716
+ if (available.includes(fb)) {
717
+ console.log(` ℹ️ Issue type "${preferred}" not available, using "${fb}"`);
718
+ return fb;
719
+ }
720
+ }
721
+
722
+ if (available.length > 0) {
723
+ console.log(` ℹ️ Issue type "${preferred}" not available, using "${available[0]}"`);
724
+ return available[0];
725
+ }
726
+ } catch {
727
+ // If createmeta fails, just use preferred and let the create call handle it
728
+ }
729
+ return preferred;
730
+ }
731
+
694
732
  /**
695
733
  * Map SpecWeave priority to JIRA priority name
696
734
  *