-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
916 lines (821 loc) · 51.2 KB
/
Copy pathindex.html
File metadata and controls
916 lines (821 loc) · 51.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
<!DOCTYPE html>
<html lang="en" class="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI-Powered Jira Release Notes Generator</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script src="https://unpkg.com/html-docx-js/dist/html-docx.js"></script>
<style>
:root {
--background-light: #f7fafc;
--background-dark: #1a202c;
--card-light: #ffffff;
--card-dark: #2d3748;
--text-light: #2d3748;
--text-dark: #e2e8f0;
--border-light: #e2e8f0;
--border-dark: #4a5568;
--primary-500: #4f46e5;
--primary-600: #4338ca;
}
body {
font-family: 'Inter', sans-serif;
transition: background-color 0.3s, color 0.3s;
}
.dark body {
background-color: var(--background-dark);
color: var(--text-dark);
}
body {
background-color: var(--background-light);
color: var(--text-light);
}
.card {
background-color: var(--card-light);
border: 1px solid var(--border-light);
}
.dark .card {
background-color: var(--card-dark);
border: 1px solid var(--border-dark);
}
.step-indicator {
transition: all 0.3s ease-in-out;
border-color: var(--border-light);
}
.dark .step-indicator {
border-color: var(--border-dark);
}
.step-indicator.active {
border-color: var(--primary-500);
color: var(--primary-500);
}
.dark .step-indicator.active {
color: #a5b4fc; /* Lighter indigo for dark mode */
}
.step-indicator .step-circle {
background-color: var(--card-light);
border: 2px solid var(--border-light);
}
.dark .step-indicator .step-circle {
background-color: var(--card-dark);
border: 2px solid var(--border-dark);
}
.step-indicator.active .step-circle {
background-color: var(--primary-500);
border-color: var(--primary-500);
color: white;
}
.dark .step-indicator.active .step-circle {
background-color: #a5b4fc;
border-color: #a5b4fc;
color: var(--card-dark);
}
.step-indicator.completed .step-circle {
background-color: #10b981;
border-color: #10b981;
color: white;
}
.step-line {
background-color: var(--border-light);
}
.dark .step-line {
background-color: var(--border-dark);
}
.step-indicator.completed + .step-line {
background-color: #10b981;
}
/* Spinner */
.loader {
border: 4px solid #f3f3f3;
border-top: 4px solid var(--primary-500);
border-radius: 50%;
width: 40px;
height: 40px;
animation: spin 1s linear infinite;
}
.dark .loader {
border-color: var(--border-dark);
border-top-color: #a5b4fc;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* Release Notes Preview */
#release-notes-preview {
line-height: 1.6;
}
#release-notes-preview h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.5rem; }
#release-notes-preview h2 { font-size: 1.25rem; font-weight: 600; margin-top: 1.5rem; margin-bottom: 0.75rem; border-bottom: 2px solid; padding-bottom: 0.25rem; }
#release-notes-preview h3 { font-size: 1.1rem; font-weight: 600; margin-top: 1.25rem; margin-bottom: 0.5rem; }
.dark #release-notes-preview h2 { border-color: var(--border-dark); }
#release-notes-preview h2 { border-color: var(--border-light); }
#release-notes-preview ul { list-style-type: disc; margin-left: 1.5rem; }
#release-notes-preview li { margin-bottom: 0.5rem; }
#release-notes-preview p { margin-bottom: 1rem; }
#release-notes-preview b, #release-notes-preview strong { font-weight: 600; }
#release-notes-preview code { background: rgba(128,128,128,0.15); padding: 0.1rem 0.3rem; border-radius: 0.25rem; font-size: 0.9em; }
#release-notes-preview table { border-collapse: collapse; margin-bottom: 1rem; width: 100%; }
#release-notes-preview th, #release-notes-preview td { border: 1px solid var(--border-light); padding: 0.4rem 0.6rem; text-align: left; }
.dark #release-notes-preview th, .dark #release-notes-preview td { border-color: var(--border-dark); }
</style>
</head>
<body class="antialiased min-h-screen">
<div id="app" class="p-4 sm:p-6 lg:p-8">
<!-- Header -->
<header class="flex justify-between items-center mb-6">
<div class="flex items-center space-x-3">
<svg class="w-8 h-8 text-indigo-500" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 002.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 00-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75 2.25 2.25 0 00-.1-.664m-5.8 0A2.251 2.251 0 0113.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C6.095 4.01 5.25 4.973 5.25 6.108V18.75c0 1.243.87 2.25 1.976 2.25h4.814a2.25 2.25 0 002.25-2.25v-1.5m3 0a2.25 2.25 0 00-2.25-2.25H9a2.25 2.25 0 00-2.25 2.25v1.5" />
</svg>
<h1 class="text-xl sm:text-2xl font-bold">AI Release Notes Generator</h1>
</div>
<button id="theme-toggle" class="p-2 rounded-full focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:focus:ring-offset-gray-800">
<svg id="theme-icon-light" class="w-6 h-6 hidden" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"></path></svg>
<svg id="theme-icon-dark" class="w-6 h-6 hidden" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"></path></svg>
</button>
</header>
<!-- Stepper -->
<div class="flex items-center justify-center mb-8">
<div id="step-1-indicator" class="step-indicator active flex items-center p-2 rounded-lg">
<div class="step-circle flex items-center justify-center w-8 h-8 rounded-full font-bold text-sm">1</div>
<span class="ml-2 font-semibold hidden sm:inline">Setup</span>
</div>
<div class="step-line flex-auto h-0.5 mx-2"></div>
<div id="step-2-indicator" class="step-indicator flex items-center p-2 rounded-lg">
<div class="step-circle flex items-center justify-center w-8 h-8 rounded-full font-bold text-sm">2</div>
<span class="ml-2 font-semibold hidden sm:inline">Import Data</span>
</div>
<div class="step-line flex-auto h-0.5 mx-2"></div>
<div id="step-3-indicator" class="step-indicator flex items-center p-2 rounded-lg">
<div class="step-circle flex items-center justify-center w-8 h-8 rounded-full font-bold text-sm">3</div>
<span class="ml-2 font-semibold hidden sm:inline">Generate & Review</span>
</div>
</div>
<!-- Main Content Area -->
<main class="max-w-4xl mx-auto">
<!-- Step 1: Configuration -->
<div id="step-1" class="step-content">
<div class="card p-6 rounded-xl shadow-md">
<h2 class="text-lg font-semibold mb-4">Step 1: Release & AI Configuration</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<label for="release-version" class="block text-sm font-medium mb-1">Release Version/Name</label>
<input type="text" id="release-version" class="w-full bg-transparent border rounded-md p-2 focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 dark:border-gray-600" placeholder="e.g., v2.5.1 or 'Orion Update'">
</div>
<div>
<label for="build-number" class="block text-sm font-medium mb-1">Build Number</label>
<input type="text" id="build-number" class="w-full bg-transparent border rounded-md p-2 focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 dark:border-gray-600" placeholder="e.g., 20241012.3">
</div>
<div>
<label for="release-date" class="block text-sm font-medium mb-1">Release Date</label>
<input type="date" id="release-date" class="w-full bg-transparent border rounded-md p-2 focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 dark:border-gray-600">
</div>
<div>
<label for="ai-provider" class="block text-sm font-medium mb-1">AI Provider</label>
<select id="ai-provider" class="w-full bg-transparent border rounded-md p-2 focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 dark:border-gray-600">
<option value="gemini" class="dark:bg-gray-700">Google Gemini</option>
<option value="openai" class="dark:bg-gray-700">OpenAI ChatGPT</option>
<option value="deepseek" class="dark:bg-gray-700">DeepSeek</option>
</select>
</div>
<div>
<label for="ai-model" class="block text-sm font-medium mb-1">Model</label>
<input list="model-suggestions" id="ai-model" class="w-full bg-transparent border rounded-md p-2 focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 dark:border-gray-600" placeholder="Model ID">
<datalist id="model-suggestions"></datalist>
<p class="text-xs mt-1 text-gray-500 dark:text-gray-400">Pick a suggestion or type any model ID your provider supports. Model names change often — check your provider's docs if unsure.</p>
</div>
<div class="md:col-span-2">
<label for="api-key" class="block text-sm font-medium mb-1">API Key</label>
<input type="password" id="api-key" class="w-full bg-transparent border rounded-md p-2 focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 dark:border-gray-600" placeholder="Enter your AI provider API key">
</div>
<!-- Optional Context Section -->
<h3 class="md:col-span-2 text-md font-semibold mt-4 mb-2 border-t pt-4 dark:border-gray-600">Optional: Add Context for Higher Quality Notes</h3>
<div class="md:col-span-2">
<label class="block text-sm font-medium mb-1">Knowledge Base File (.json)</label>
<div class="flex items-center space-x-2">
<input id="kb-json-upload" type="file" accept=".json" class="block w-full text-sm file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-sm file:font-semibold file:bg-indigo-50 file:text-indigo-700 hover:file:bg-indigo-100 dark:file:bg-gray-600 dark:file:text-gray-200 dark:hover:file:bg-gray-500"/>
<button id="download-kb-template" class="text-sm text-indigo-600 dark:text-indigo-400 hover:underline whitespace-nowrap">Download Template</button>
</div>
</div>
<div class="md:col-span-2">
<label class="block text-sm font-medium mb-1">RAG Context File (.txt)</label>
<input id="rag-file-upload" type="file" accept=".txt" class="block w-full text-sm file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-sm file:font-semibold file:bg-indigo-50 file:text-indigo-700 hover:file:bg-indigo-100 dark:file:bg-gray-600 dark:file:text-gray-200 dark:hover:file:bg-gray-500"/>
</div>
<div class="md:col-span-2">
<label for="rag-file-link" class="block text-sm font-medium mb-1">Or: Link to RAG Context File (.txt)</label>
<input type="url" id="rag-file-link" class="w-full bg-transparent border rounded-md p-2 focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 dark:border-gray-600" placeholder="https://example.com/docs/llms.txt (used only if no file is uploaded above)">
<p class="text-xs mt-1 text-gray-500 dark:text-gray-400">Fetching a link happens from your browser, so it only works if that server allows cross-origin requests (CORS). Uploading the file above always works, regardless of CORS.</p>
</div>
<div class="md:col-span-2">
<label for="kb-json-link" class="block text-sm font-medium mb-1">Or: Link to Knowledge Base File (.json)</label>
<input type="url" id="kb-json-link" class="w-full bg-transparent border rounded-md p-2 focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 dark:border-gray-600" placeholder="https://example.com/kb/data.json (used only if no file is uploaded above)">
<p class="text-xs mt-1 text-gray-500 dark:text-gray-400">Fetching a link happens from your browser, so it only works if that server allows cross-origin requests (CORS). Uploading the file above always works, regardless of CORS.</p>
</div>
</div>
<div class="mt-6 text-right">
<button id="next-to-step-2" class="bg-indigo-600 text-white font-semibold py-2 px-4 rounded-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:focus:ring-offset-gray-800">Next: Import Data</button>
</div>
</div>
</div>
<!-- Step 2: Import Data -->
<div id="step-2" class="step-content hidden">
<div class="card p-6 rounded-xl shadow-md">
<h2 class="text-lg font-semibold mb-4">Step 2: Upload Jira CSV Exports</h2>
<p class="text-sm mb-4 dark:text-gray-400">Upload separate CSV files for each category. You can export these from Jira filters or a tool like the Jira Cloud for Google Sheets add-on. All uploads are optional.</p>
<div class="grid grid-cols-1 md:grid-cols-2 gap-x-8 gap-y-4">
<div>
<label class="block text-sm font-medium mb-1">Epics</label>
<input id="epics-csv" type="file" accept=".csv" class="block w-full text-sm file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-sm file:font-semibold file:bg-indigo-50 file:text-indigo-700 hover:file:bg-indigo-100 dark:file:bg-gray-600 dark:file:text-gray-200 dark:hover:file:bg-gray-500"/>
</div>
<div>
<label class="block text-sm font-medium mb-1">Stories</label>
<input id="stories-csv" type="file" accept=".csv" class="block w-full text-sm file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-sm file:font-semibold file:bg-indigo-50 file:text-indigo-700 hover:file:bg-indigo-100 dark:file:bg-gray-600 dark:file:text-gray-200 dark:hover:file:bg-gray-500"/>
</div>
<div>
<label class="block text-sm font-medium mb-1">Bug Fixes</label>
<input id="fixes-csv" type="file" accept=".csv" class="block w-full text-sm file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-sm file:font-semibold file:bg-indigo-50 file:text-indigo-700 hover:file:bg-indigo-100 dark:file:bg-gray-600 dark:file:text-gray-200 dark:hover:file:bg-gray-500"/>
</div>
<div>
<label class="block text-sm font-medium mb-1">Support Escalations</label>
<input id="escalations-csv" type="file" accept=".csv" class="block w-full text-sm file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-sm file:font-semibold file:bg-indigo-50 file:text-indigo-700 hover:file:bg-indigo-100 dark:file:bg-gray-600 dark:file:text-gray-200 dark:hover:file:bg-gray-500"/>
</div>
<div class="md:col-span-2">
<label class="block text-sm font-medium mb-1">Known Issues</label>
<input id="known-issues-csv" type="file" accept=".csv" class="block w-full text-sm file:mr-4 file:py-2 file:px-4 file:rounded-md file:border-0 file:text-sm file:font-semibold file:bg-indigo-50 file:text-indigo-700 hover:file:bg-indigo-100 dark:file:bg-gray-600 dark:file:text-gray-200 dark:hover:file:bg-gray-500"/>
</div>
</div>
<div class="mt-6 flex justify-between">
<button id="back-to-step-1" class="bg-gray-200 dark:bg-gray-600 text-black dark:text-white font-semibold py-2 px-4 rounded-md hover:bg-gray-300 dark:hover:bg-gray-500 focus:outline-none">Back</button>
<button id="next-to-step-3" class="bg-indigo-600 text-white font-semibold py-2 px-4 rounded-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 dark:focus:ring-offset-gray-800">Generate Notes</button>
</div>
</div>
</div>
<!-- Step 3: Generate & Review -->
<div id="step-3" class="step-content hidden">
<div class="card p-6 rounded-xl shadow-md">
<h2 class="text-lg font-semibold mb-4">Step 3: Generate & Review Release Notes</h2>
<div id="generation-area">
<div class="flex flex-col items-center justify-center text-center p-8 border-2 border-dashed rounded-lg dark:border-gray-600">
<svg class="w-12 h-12 text-gray-400 mb-3" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M11.42 15.17L17.25 21A2.652 2.652 0 0021 17.25l-5.877-5.877M11.42 15.17l2.496-3.03c.317-.384.73-.664 1.193-.816M11.42 15.17l-4.216 4.216m3.928-3.928a9.027 9.027 0 01-1.316-3.663M11.42 15.17l-1.316-3.663m0 0a9.027 9.027 0 00-3.663-1.316m3.663 1.316L5.877 5.877m5.543 9.293l2.496-3.03c.317-.384.73-.664 1.193-.816" />
</svg>
<p class="font-semibold">Your release notes will be generated here.</p>
<p class="text-sm text-gray-500 dark:text-gray-400">Click "Generate Notes" in the previous step to begin.</p>
</div>
</div>
<div id="loading-area" class="hidden">
<div class="flex flex-col items-center justify-center text-center p-8">
<div class="loader"></div>
<p class="mt-4 font-semibold">Analyzing Jira items and writing notes...</p>
<p class="text-sm text-gray-500 dark:text-gray-400">This may take a moment.</p>
</div>
</div>
<div id="results-area" class="hidden">
<div id="release-notes-preview" class="p-6 border rounded-md dark:border-gray-600 bg-gray-50 dark:bg-gray-900/50 min-h-[300px]">
<!-- Generated content goes here -->
</div>
<div class="mt-4 flex flex-wrap gap-3 justify-end">
<button id="download-md" class="bg-gray-700 text-white font-semibold py-2 px-4 rounded-md hover:bg-gray-800 flex items-center gap-2">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm3.293-7.707a1 1 0 011.414 0L9 10.586V3a1 1 0 112 0v7.586l1.293-1.293a1 1 0 111.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z" clip-rule="evenodd" /></svg>
Download .md
</button>
<button id="download-docx" class="bg-blue-600 text-white font-semibold py-2 px-4 rounded-md hover:bg-blue-700 flex items-center gap-2">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm3.293-7.707a1 1 0 011.414 0L9 10.586V3a1 1 0 112 0v7.586l1.293-1.293a1 1 0 111.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z" clip-rule="evenodd" /></svg>
Download .docx
</button>
<button id="download-pdf" class="bg-red-600 text-white font-semibold py-2 px-4 rounded-md hover:bg-red-700 flex items-center gap-2">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm3.293-7.707a1 1 0 011.414 0L9 10.586V3a1 1 0 112 0v7.586l1.293-1.293a1 1 0 111.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z" clip-rule="evenodd" /></svg>
Download .pdf
</button>
</div>
</div>
<div class="mt-6 flex justify-between">
<button id="back-to-step-2" class="bg-gray-200 dark:bg-gray-600 text-black dark:text-white font-semibold py-2 px-4 rounded-md hover:bg-gray-300 dark:hover:bg-gray-500 focus:outline-none">Back</button>
<button id="start-over" class="bg-green-600 text-white font-semibold py-2 px-4 rounded-md hover:bg-green-700 focus:outline-none">Start Over</button>
</div>
</div>
</div>
</main>
</div>
<script type="module">
const steps = ['step-1', 'step-2', 'step-3'];
let currentStep = 1;
let releaseData = {};
let allCsvData = {};
let generatedMarkdown = '';
// DOM Elements
const stepContents = document.querySelectorAll('.step-content');
const stepIndicators = {
1: document.getElementById('step-1-indicator'),
2: document.getElementById('step-2-indicator'),
3: document.getElementById('step-3-indicator')
};
// Model suggestions per provider. These change often - the input
// field also accepts any custom model ID the user types in.
const MODEL_SUGGESTIONS = {
gemini: {
default: 'gemini-2.5-flash',
options: ['gemini-2.5-flash', 'gemini-2.5-pro', 'gemini-2.5-flash-lite', 'gemini-3.1-pro', 'gemini-3.6-flash', 'gemini-3.5-flash-lite']
},
openai: {
default: 'gpt-4.1-mini',
options: ['gpt-4.1-mini', 'gpt-4.1', 'gpt-4o', 'gpt-4o-mini', 'gpt-5-chat-latest', 'o4-mini']
},
deepseek: {
default: 'deepseek-chat',
options: ['deepseek-chat', 'deepseek-reasoner', 'deepseek-v4-flash', 'deepseek-v4-pro']
}
};
const aiProviderSelect = document.getElementById('ai-provider');
const aiModelInput = document.getElementById('ai-model');
const modelDatalist = document.getElementById('model-suggestions');
function updateModelSuggestions() {
const provider = aiProviderSelect.value;
const info = MODEL_SUGGESTIONS[provider] || { default: '', options: [] };
modelDatalist.innerHTML = info.options.map(m => `<option value="${m}"></option>`).join('');
// Only overwrite the field if it's empty or still matches a
// previous provider's default, so we don't clobber a custom
// value the user already typed in.
const previousDefaults = Object.values(MODEL_SUGGESTIONS).map(i => i.default);
if (!aiModelInput.value || previousDefaults.includes(aiModelInput.value)) {
aiModelInput.value = info.default;
}
}
aiProviderSelect.addEventListener('change', updateModelSuggestions);
updateModelSuggestions();
// Navigation Buttons
document.getElementById('next-to-step-2').addEventListener('click', () => navigateTo(2));
document.getElementById('next-to-step-3').addEventListener('click', handleGenerate);
document.getElementById('back-to-step-1').addEventListener('click', () => navigateTo(1));
document.getElementById('back-to-step-2').addEventListener('click', () => navigateTo(2));
document.getElementById('start-over').addEventListener('click', () => {
location.reload();
});
document.getElementById('download-kb-template').addEventListener('click', downloadKBTemplate);
// Theme Toggle
const themeToggle = document.getElementById('theme-toggle');
const lightIcon = document.getElementById('theme-icon-light');
const darkIcon = document.getElementById('theme-icon-dark');
const applyTheme = (theme) => {
if (theme === 'dark') {
document.documentElement.classList.add('dark');
lightIcon.classList.remove('hidden');
darkIcon.classList.add('hidden');
} else {
document.documentElement.classList.remove('dark');
lightIcon.classList.add('hidden');
darkIcon.classList.remove('hidden');
}
};
themeToggle.addEventListener('click', () => {
const currentTheme = localStorage.getItem('theme') || 'dark';
const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
localStorage.setItem('theme', newTheme);
applyTheme(newTheme);
});
// Initialize theme
applyTheme(localStorage.getItem('theme') || 'dark');
function updateStepIndicator() {
Object.values(stepIndicators).forEach(indicator => indicator.classList.remove('active', 'completed'));
for (let i = 1; i <= 3; i++) {
if (i < currentStep) {
stepIndicators[i].classList.add('completed');
} else if (i === currentStep) {
stepIndicators[i].classList.add('active');
}
}
}
function navigateTo(step) {
if (step === 2) {
// Validate Step 1
releaseData.version = document.getElementById('release-version').value;
releaseData.build = document.getElementById('build-number').value;
releaseData.date = document.getElementById('release-date').value;
releaseData.aiProvider = document.getElementById('ai-provider').value;
releaseData.aiModel = document.getElementById('ai-model').value.trim() || (MODEL_SUGGESTIONS[document.getElementById('ai-provider').value] || {}).default;
releaseData.apiKey = document.getElementById('api-key').value;
releaseData.ragUrl = document.getElementById('rag-file-link').value;
releaseData.ragFile = document.getElementById('rag-file-upload').files[0];
releaseData.kbUrl = document.getElementById('kb-json-link').value;
releaseData.kbFile = document.getElementById('kb-json-upload').files[0];
if (!releaseData.version || !releaseData.date || !releaseData.apiKey) {
alert('Please fill in Release Version, Release Date, and API Key.');
return;
}
}
currentStep = step;
stepContents.forEach(content => content.classList.add('hidden'));
document.getElementById(`step-${step}`).classList.remove('hidden');
updateStepIndicator();
}
// Helper to fetch content from a URL. Returns { content, error }
// instead of alerting directly, so callers can decide how/when to
// surface failures (e.g. batched into one warning instead of a
// pop-up per failed fetch).
const fetchUrlContent = async (url) => {
if (!url) return { content: null, error: null };
try {
const response = await fetch(url);
if (!response.ok) {
return { content: null, error: `${url} responded with ${response.status} ${response.statusText}.` };
}
return { content: await response.text(), error: null };
} catch (error) {
console.error(`Error fetching ${url}:`, error);
const reason = error.name === 'TypeError'
? 'this is often caused by the remote server not allowing cross-origin (CORS) requests from this app'
: error.message;
return { content: null, error: `Could not fetch ${url} (${reason}).` };
}
};
async function handleGenerate() {
const epicsFile = document.getElementById('epics-csv').files[0];
const storiesFile = document.getElementById('stories-csv').files[0];
const fixesFile = document.getElementById('fixes-csv').files[0];
const escalationsFile = document.getElementById('escalations-csv').files[0];
const knownIssuesFile = document.getElementById('known-issues-csv').files[0];
if (!epicsFile && !storiesFile && !fixesFile && !escalationsFile && !knownIssuesFile) {
alert('Please upload at least one CSV file.');
return;
}
navigateTo(3);
document.getElementById('generation-area').classList.add('hidden');
document.getElementById('loading-area').classList.remove('hidden');
document.getElementById('results-area').classList.add('hidden');
try {
const contextWarnings = [];
// Prioritize uploaded files over URLs for both KB and RAG context
const kbFileContent = releaseData.kbFile ? await releaseData.kbFile.text() : null;
let kbContent = kbFileContent;
if (!kbContent && releaseData.kbUrl) {
const kbResult = await fetchUrlContent(releaseData.kbUrl);
kbContent = kbResult.content;
if (kbResult.error) contextWarnings.push(`Knowledge Base link: ${kbResult.error}`);
}
const ragFileContent = releaseData.ragFile ? await releaseData.ragFile.text() : null;
let ragContent = ragFileContent;
if (!ragContent && releaseData.ragUrl) {
const ragResult = await fetchUrlContent(releaseData.ragUrl);
ragContent = ragResult.content;
if (ragResult.error) contextWarnings.push(`RAG context link: ${ragResult.error}`);
}
// Parse CSVs concurrently
const [
epicsData,
storiesData,
fixesData,
escalationsData,
knownIssuesData
] = await Promise.all([
epicsFile ? parseCsv(epicsFile) : Promise.resolve(null),
storiesFile ? parseCsv(storiesFile) : Promise.resolve(null),
fixesFile ? parseCsv(fixesFile) : Promise.resolve(null),
escalationsFile ? parseCsv(escalationsFile) : Promise.resolve(null),
knownIssuesFile ? parseCsv(knownIssuesFile) : Promise.resolve(null)
]);
allCsvData = {
epics: epicsData,
stories: storiesData,
fixes: fixesData,
escalations: escalationsData,
knownIssues: knownIssuesData
};
const allWarnings = [
...contextWarnings,
...findCsvWarnings([
{ label: 'Epics', text: epicsData },
{ label: 'Stories', text: storiesData },
{ label: 'Bug Fixes', text: fixesData },
{ label: 'Support Escalations', text: escalationsData },
{ label: 'Known Issues', text: knownIssuesData }
])
];
if (allWarnings.length > 0) {
const proceed = confirm(
`Heads up, this may reduce output quality:\n\n${allWarnings.join('\n')}\n\nContinue generating anyway?`
);
if (!proceed) {
document.getElementById('loading-area').classList.add('hidden');
document.getElementById('generation-area').classList.remove('hidden');
navigateTo(2);
return;
}
}
const prompt = buildAIPrompt(allCsvData, ragContent, kbContent);
const releaseNotesText = await callAI(prompt);
generatedMarkdown = releaseNotesText;
// Render with marked.js for reliable Markdown parsing
// (handles nested lists, tables, code blocks, etc. that the
// old hand-rolled regex converter could not).
const htmlNotes = marked.parse(releaseNotesText);
document.getElementById('release-notes-preview').innerHTML = htmlNotes;
document.getElementById('loading-area').classList.add('hidden');
document.getElementById('results-area').classList.remove('hidden');
} catch (error) {
console.error("Error during generation:", error);
alert(`An error occurred: ${error.message}`);
document.getElementById('loading-area').classList.add('hidden');
document.getElementById('generation-area').classList.remove('hidden');
navigateTo(2);
}
}
function parseCsv(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = (event) => {
resolve(event.target.result);
};
reader.onerror = (error) => {
reject(error);
};
reader.readAsText(file);
});
}
// Quick, non-blocking sanity check: a real Jira CSV export's header
// row should contain columns like 'Issue key' and 'Summary'. This
// doesn't validate the whole file, just flags obviously-wrong
// uploads (e.g. the wrong file picked) before spending an AI call.
function findCsvWarnings(labeledCsvs) {
const warnings = [];
labeledCsvs.forEach(({ label, text }) => {
if (!text) return;
const firstLine = text.split(/\r?\n/)[0] || '';
const lower = firstLine.toLowerCase();
const hasIssueKey = lower.includes('issue key') || lower.includes('key');
const hasSummary = lower.includes('summary');
if (!hasIssueKey || !hasSummary) {
warnings.push(`"${label}" doesn't look like a standard Jira CSV export (missing expected columns like 'Issue key' or 'Summary').`);
}
});
return warnings;
}
function buildAIPrompt(data, ragContent, kbContent) {
let prompt = `Act as an expert technical writer specializing in software release notes. Your primary goal is to **rewrite and rephrase** the raw Jira data into a clear, concise, and professional document.
**Core Writing Principles (Microsoft Style Guide):**
- **Tone:** Be professional, direct, and helpful. Avoid marketing fluff, hype, and subjective claims (e.g., "exciting new feature").
- **Voice and Tense:** Use the active voice and present tense (e.g., "You can now export reports," not "Reports can now be exported.").
- **Clarity:** Use simple, everyday words. Avoid jargon.
- **Structure:** Start the document directly with the release title. Do not add introductory or concluding paragraphs.
**Analysis & Categorization Task:**
For each Jira item, you must analyze its 'Summary', 'Description', and any other relevant fields to deduce the following:
1. **Functional Area:** What part of the product does it affect? (e.g., User Management, Reporting, API, Performance)
2. **Deployment Type:** Is this for 'Cloud', 'On-premises', or 'Both'? Infer this from keywords like 'server', 'data center', 'online', 'multi-tenant'. If unsure, assume 'Both'.
3. **Applicable User Role:** Who is this for? (e.g., Administrators, End-users, Developers). If unsure, assume 'All users'.
**Markdown Formatting Rules:**
- **For "New Features" (from Epics and Stories):**
- Create a main section titled "## New Features".
- For each feature, create a Level 3 sub-header (###) based on its deduced **Functional Area**.
- Below the header, add a metadata line: **Applies to:** [Deduced User Role] on [Deduced Deployment Type].
- Finally, write a paragraph describing the feature and its benefits to the user.
- **For "Bug Fixes" (from Bug Fixes and Support Escalations):**
- Create a main section titled "## Bug Fixes".
- **First, analyze ALL bug fix and escalation items to identify the unique Functional Areas present in the data.**
- Then, for each unique Functional Area, create **one single, bolded sub-category** (e.g., "**Platform**").
- **List ALL fixes belonging to that area as bullet points (*) under that single heading.** Do not create duplicate sub-category headings for the same functional area.
- Each bullet point must concisely describe the fix and end with the Jira **'Issue key'** in parentheses. Example: * Corrected an issue that caused report exports to fail. (PROJ-123)
- **For "Known Issues":**
- Create a main section titled "## Known Issues".
- List each issue as a Markdown bullet point (*).
**Release Information:**
- Release Title: Release ${releaseData.version}
- Build Number: ${releaseData.build}
- Release Date: ${new Date(releaseData.date).toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' })}
`;
if (ragContent) {
prompt += `
---
## ADDITIONAL CONTEXT FROM KNOWLEDGE BASE (RAG)
Use this text to better understand the product, its features, and terminology.
---
${ragContent}
`;
}
if (kbContent) {
prompt += `
---
## ADDITIONAL STRUCTURED CONTEXT (JSON)
This JSON data provides structured information about the product. Use it to ensure accuracy.
---
${kbContent}
`;
}
prompt += `
---
## JIRA DATA (IN CSV FORMAT)
(Assume standard Jira CSV columns like 'Issue key', 'Summary', 'Description', 'Labels', etc.)
---
`;
if (data.epics || data.stories) {
prompt += `
### JIRA CSV FOR NEW FEATURES (Epics and Stories)
${data.epics || ''}
${data.stories || ''}
`;
}
if (data.fixes || data.escalations) {
prompt += `
### JIRA CSV FOR BUG FIXES (Bugs and Support Escalations)
${data.fixes || ''}
${data.escalations || ''}
`;
}
if (data.knownIssues) {
prompt += `
### JIRA CSV FOR KNOWN ISSUES
${data.knownIssues}
`;
}
prompt += `
---
Now, generate the complete release notes document based on all the provided data and the strict instructions above.
`;
return prompt;
}
async function callAI(prompt) {
const { aiProvider, apiKey } = releaseData;
const model = releaseData.aiModel || (MODEL_SUGGESTIONS[aiProvider] || {}).default;
let apiUrl, payload;
switch(aiProvider) {
case 'gemini':
apiUrl = `https://generativelanguage.googleapis.com/v1beta/models/${model}:generateContent?key=${apiKey}`;
payload = { contents: [{ parts: [{ text: prompt }] }] };
break;
case 'openai':
apiUrl = 'https://api.openai.com/v1/chat/completions';
payload = {
model: model,
messages: [{ role: "user", content: prompt }]
};
break;
case 'deepseek':
// DeepSeek's API is OpenAI-compatible.
apiUrl = 'https://api.deepseek.com/chat/completions';
payload = {
model: model,
messages: [{ role: "user", content: prompt }]
};
break;
default:
throw new Error("Unsupported AI provider.");
}
const headers = { 'Content-Type': 'application/json' };
if (aiProvider === 'openai' || aiProvider === 'deepseek') {
headers['Authorization'] = `Bearer ${apiKey}`;
}
const response = await fetch(apiUrl, {
method: 'POST',
headers: headers,
body: JSON.stringify(payload)
});
if (!response.ok) {
const errorData = await response.json();
throw new Error(`AI API request failed: ${response.status} ${response.statusText} - ${JSON.stringify(errorData)}`);
}
const result = await response.json();
switch(aiProvider) {
case 'gemini':
return result.candidates[0].content.parts[0].text;
case 'openai':
case 'deepseek':
return result.choices[0].message.content;
default:
throw new Error("Could not parse response from AI provider.");
}
}
function downloadKBTemplate() {
const template = {
"product_name": "[Your Product Name]",
"deployment_types": {
"Cloud": "[Text for Cloud Deployment, e.g., YourCloud Service]",
"On-prem": "[Text for On-premise Deployment, e.g., Enterprise Server]",
"Both": "[Text for Both, e.g., Cloud and Enterprise]"
},
"user_roles": [
"[Administrator]",
"[Editor]",
"[Viewer]",
"[API User]"
],
"functional_areas": {
"[User Management]": {
"description": "Features related to users, groups, and permissions.",
"keywords": ["[user]", "[group]", "[permission]", "[role]"]
},
"[Reporting]": {
"description": "Features related to creating, viewing, and exporting reports.",
"keywords": ["[report]", "[dashboard]", "[analytics]", "[export]"]
},
"[API]": {
"description": "Updates to the public-facing API.",
"keywords": ["[api]", "[endpoint]", "[graphql]", "[rest]"]
},
"[Example Area]": {
"description": "[Add a description for another functional area of your product.]",
"keywords": ["[keyword1]", "[keyword2]"]
}
}
};
const blob = new Blob([JSON.stringify(template, null, 2)], { type: 'application/json' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'kb_template.json';
a.click();
URL.revokeObjectURL(url);
}
// Export functionality
document.getElementById('download-md').addEventListener('click', () => {
const blob = new Blob([generatedMarkdown], { type: 'text/markdown;charset=utf-8' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `Release_Notes_${releaseData.version}.md`;
a.click();
URL.revokeObjectURL(url);
});
document.getElementById('download-docx').addEventListener('click', () => {
const content = document.getElementById('release-notes-preview').innerHTML;
const converted = htmlDocx.asBlob(content);
const url = URL.createObjectURL(converted);
const a = document.createElement('a');
a.href = url;
a.download = `Release_Notes_${releaseData.version}.docx`;
a.click();
URL.revokeObjectURL(url);
});
document.getElementById('download-pdf').addEventListener('click', () => {
const { jsPDF } = window.jspdf;
const pdf = new jsPDF('p', 'mm', 'a4');
const margin = 18;
const pageWidth = pdf.internal.pageSize.getWidth();
const pageHeight = pdf.internal.pageSize.getHeight();
const maxWidth = pageWidth - margin * 2;
let y = margin;
// Strip inline markdown emphasis markers - jsPDF's plain text()
// can't mix bold/normal runs within one line without manual
// segment splitting, so we simplify to plain text here.
const clean = (s) => (s || '')
.replace(/\*\*(.*?)\*\*/g, '$1')
.replace(/\*(.*?)\*/g, '$1')
.replace(/`(.*?)`/g, '$1');
const ensureSpace = (lineHeight) => {
if (y + lineHeight > pageHeight - margin) {
pdf.addPage();
y = margin;
}
};
const addBlock = (text, fontSize, style, indent, spacingAfter) => {
pdf.setFont('helvetica', style);
pdf.setFontSize(fontSize);
const lineHeight = fontSize * 0.42;
const lines = pdf.splitTextToSize(clean(text), maxWidth - indent);
lines.forEach(line => {
ensureSpace(lineHeight);
pdf.text(line, margin + indent, y);
y += lineHeight;
});
y += spacingAfter;
};
const tokens = marked.lexer(generatedMarkdown || '');
tokens.forEach(token => {
switch (token.type) {
case 'heading': {
const sizes = { 1: 20, 2: 16, 3: 13 };
addBlock(token.text, sizes[token.depth] || 12, 'bold', 0, 3);
break;
}
case 'paragraph':
addBlock(token.text, 11, 'normal', 0, 3);
break;
case 'list':
token.items.forEach(item => {
addBlock('\u2022 ' + item.text, 11, 'normal', 5, 1.5);
});
y += 1.5;
break;
case 'table':
// Minimal fallback: render each row as a plain line.
addBlock(token.header.map(h => h.text).join(' | '), 11, 'bold', 0, 1);
token.rows.forEach(row => {
addBlock(row.map(c => c.text).join(' | '), 10, 'normal', 0, 1);
});
y += 2;
break;
case 'space':
break;
default:
if (token.text) addBlock(token.text, 11, 'normal', 0, 2);
}
});
pdf.save(`Release_Notes_${releaseData.version}.pdf`);
});
// Initialize first step
updateStepIndicator();
</script>
</body>
</html>