@@ -79,7 +79,7 @@ class Jira {
79
79
const transitionInfo = {
80
80
id : transition . id ,
81
81
name : transition . name ,
82
- from : transition . from || [ ] , // Array of source status IDs
82
+ from : transition . from || [ ] ,
83
83
to : transition . to , // Target status ID
84
84
type : transition . type || 'directed' ,
85
85
hasScreen : transition . hasScreen || false ,
@@ -88,9 +88,7 @@ class Jira {
88
88
89
89
stateMachine . transitions . push ( transitionInfo )
90
90
91
- // Build transition map for quick lookup
92
91
const fromStatuses = transitionInfo . from . length > 0 ? transitionInfo . from : Object . keys ( stateMachine . states )
93
-
94
92
fromStatuses . forEach ( fromStatus => {
95
93
if ( ! stateMachine . transitionMap . has ( fromStatus ) ) {
96
94
stateMachine . transitionMap . set ( fromStatus , new Map ( ) )
@@ -217,6 +215,7 @@ class Jira {
217
215
console . log ( `\n=== WORKFLOW: ${ stateMachine . name } ===` )
218
216
219
217
console . log ( '\n--- STATES ---' )
218
+ console . log ( JSON . stringify ( stateMachine ) )
220
219
for ( const [ id , state ] of Object . entries ( stateMachine . states ) ) {
221
220
console . log ( ` [${ id } ] ${ state . name } (${ state . statusCategory . name } )` )
222
221
}
@@ -421,57 +420,6 @@ class Jira {
421
420
}
422
421
}
423
422
424
- /**
425
- * Build a complete transition graph by analyzing multiple issues
426
- * @param {number } sampleSize - Number of issues to analyze
427
- * @returns {Promise<Map> } Transition graph
428
- */
429
- async buildTransitionGraph ( sampleSize = 50 ) {
430
- try {
431
- // Graph structure: Map<fromStatus, Map<toStatus, transitionId>>
432
- const transitionGraph = new Map ( )
433
-
434
- let jql = `order by created DESC`
435
- if ( this . projectKey ) {
436
- jql = `project = ${ this . projectKey } AND ${ jql } `
437
- }
438
-
439
- const response = await this . request ( '/search' , {
440
- method : 'POST' ,
441
- body : JSON . stringify ( {
442
- jql,
443
- fields : [ 'key' , 'status' ] ,
444
- maxResults : sampleSize
445
- } )
446
- } )
447
-
448
- const data = await response . json ( )
449
- const issues = data . issues
450
-
451
- // For each issue, get available transitions
452
- for ( const issue of issues ) {
453
- const currentStatus = issue . fields . status . name
454
- const transitions = await this . getTransitions ( issue . key )
455
-
456
- if ( ! transitionGraph . has ( currentStatus ) ) {
457
- transitionGraph . set ( currentStatus , new Map ( ) )
458
- }
459
-
460
- const statusTransitions = transitionGraph . get ( currentStatus )
461
-
462
- for ( const transition of transitions ) {
463
- const toStatus = transition . to . name
464
- statusTransitions . set ( toStatus , transition . id )
465
- }
466
- }
467
-
468
- return transitionGraph
469
- } catch ( error ) {
470
- console . error ( `Error building transition graph:` , error . message )
471
- throw error
472
- }
473
- }
474
-
475
423
/**
476
424
* Find the shortest path of transitions between two statuses
477
425
* @param {Map } transitionGraph - The complete transition graph
0 commit comments