-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
1769 lines (1657 loc) · 84 KB
/
index.html
File metadata and controls
1769 lines (1657 loc) · 84 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
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en" style="font-size:1.2em">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lagoon Command Generator</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/dark.min.css">
<style>
:root {
--tag-auth: #6366f1;
--tag-setup: #0ea5e9;
--tag-variables: #8b5cf6;
--tag-deploy: #ef4444;
--tag-ssh: #14b8a6;
--tag-data: #ec4899;
--tag-users: #a78bfa;
--tag-custom: #64748b;
}
body { max-width: 1100px; margin: 0 auto; padding: 1rem 1.5rem 3rem; }
h1 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.subtitle { color: #94a3b8; font-size: 0.875rem; margin-bottom: 1.5rem; }
/* Settings panel */
.settings-toggle {
display: flex; align-items: center; gap: 0.5rem;
background: none; border: 1px solid #334155; border-radius: 6px;
color: #94a3b8; cursor: pointer; font-size: 0.875rem;
padding: 0.4rem 0.75rem; margin-bottom: 0.75rem;
}
.settings-toggle:hover { border-color: #64748b; color: #cbd5e1; }
#bookmark-link { box-sizing: border-box !important; }
#bookmark-link-label { display: none; }
.settings-grid {
display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: 0.75rem 1.5rem;
}
.settings-grid label { display: block; font-size: 0.8rem; color: #94a3b8; margin-bottom: 0.2rem; }
.settings-grid input {
width: 100%; box-sizing: border-box; font-size: 0.85rem;
padding: 0.35rem 0.6rem; background: #1e293b; border: 1px solid #334155;
border-radius: 4px; color: #e2e8f0;
}
.settings-grid input::placeholder { color: #475569; }
.settings-grid input:focus { border-color: #6366f1; outline: none; }
/* Search bar */
.search-wrap { position: relative; margin-bottom: 0.75rem; }
#search {
width: 100%; box-sizing: border-box; font-size: 1.05rem;
padding: 0.65rem 1rem 0.65rem 2.75rem;
background: #0f172a; border: 2px solid #334155;
border-radius: 8px; color: #e2e8f0;
}
#search::placeholder { color: #475569; }
#search:focus { border-color: #6366f1; outline: none; }
.search-icon {
position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%);
color: #64748b; pointer-events: none; font-size: 1rem;
}
#search-clear {
position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%);
background: none; border: none; color: #64748b; cursor: pointer;
font-size: 1.1rem; padding: 0; display: none;
}
#search-clear:hover { color: #94a3b8; }
/* Tag filter buttons */
.tag-filters { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.75rem; }
.tag-filter-btn {
border: none; border-radius: 4px; cursor: pointer;
font-size: 0.75rem; font-weight: 600; padding: 0.25rem 0.6rem;
opacity: 0.55; transition: opacity 0.15s;
}
.tag-filter-btn:hover { opacity: 0.8; }
.tag-filter-btn.active { opacity: 1; box-shadow: 0 0 0 2px #ffffffcc, 0 0 8px 2px currentColor; transform: scale(1.08); }
.tag-filter-btn[data-tag="auth"] { background: var(--tag-auth); color: #fff; }
.tag-filter-btn[data-tag="setup"] { background: var(--tag-setup); color: #fff; }
.tag-filter-btn[data-tag="variables"] { background: var(--tag-variables); color: #fff; }
.tag-filter-btn[data-tag="deploy"] { background: var(--tag-deploy); color: #fff; }
.tag-filter-btn[data-tag="ssh"] { background: var(--tag-ssh); color: #fff; }
.tag-filter-btn[data-tag="data"] { background: var(--tag-data); color: #fff; }
.tag-filter-btn[data-tag="users"] { background: var(--tag-users); color: #fff; }
.tag-filter-btn[data-tag="custom"] { background: var(--tag-custom); color: #fff; }
/* Count bar */
.count-bar { font-size: 0.8rem; color: #64748b; margin-bottom: 1rem; }
/* Command cards */
.commands-list { display: flex; flex-direction: column; gap: 0.75rem; }
.cmd-card {
background: #0f172a; border: 1px solid #1e293b;
border-radius: 8px; padding: 0.9rem 1rem;
}
.cmd-card.hidden { display: none; }
.cmd-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 0.5rem; }
.cmd-title { font-weight: 600; font-size: 0.95rem; color: #e2e8f0; }
.cmd-desc { font-size: 0.8rem; color: #64748b; margin-top: 0.1rem; }
.cmd-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.tag-pill {
border-radius: 4px; font-size: 0.7rem; font-weight: 600;
padding: 0.15rem 0.5rem; cursor: pointer; opacity: 0.85;
transition: opacity 0.15s;
}
.tag-pill:hover { opacity: 1; }
.tag-pill[data-tag="auth"] { background: var(--tag-auth); color: #fff; }
.tag-pill[data-tag="setup"] { background: var(--tag-setup); color: #fff; }
.tag-pill[data-tag="variables"] { background: var(--tag-variables); color: #fff; }
.tag-pill[data-tag="deploy"] { background: var(--tag-deploy); color: #fff; }
.tag-pill[data-tag="ssh"] { background: var(--tag-ssh); color: #fff; }
.tag-pill[data-tag="data"] { background: var(--tag-data); color: #fff; }
.tag-pill[data-tag="users"] { background: var(--tag-users); color: #fff; }
.tag-pill[data-tag="custom"] { background: var(--tag-custom); color: #fff; }
/* Inline params */
.cmd-params { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin-bottom: 0.6rem; }
.param-field { display: flex; align-items: center; gap: 0.4rem; }
.param-field label { font-size: 0.75rem; color: #94a3b8; white-space: nowrap; }
.param-field input {
font-size: 0.8rem; padding: 0.2rem 0.5rem;
background: #1e293b; border: 1px solid #334155;
border-radius: 4px; color: #e2e8f0; width: 140px;
}
.param-field input:focus { border-color: #6366f1; outline: none; }
/* Code block */
.cmd-code-wrap { position: relative; margin-top: 0.4rem; }
.cmd-code {
background: #020617; border: 1px solid #1e293b; border-radius: 6px;
padding: 0.65rem 3rem 0.65rem 0.85rem;
font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
font-size: 0.78rem; color: #7dd3fc; white-space: pre-wrap; word-break: break-all;
line-height: 1.5;
}
.copy-btn {
position: absolute; right: 0.4rem; top: 0.4rem;
background: #1e293b; border: 1px solid #334155;
border-radius: 4px; color: #94a3b8; cursor: pointer;
font-size: 0.7rem; padding: 0.2rem 0.5rem;
transition: background 0.15s, color 0.15s;
}
.copy-btn:hover { background: #334155; color: #e2e8f0; }
.copy-btn.copied { background: #166534; border-color: #166534; color: #86efac; }
.no-results { text-align: center; color: #64748b; padding: 3rem 1rem; }
.no-results.hidden { display: none; }
/* Command groups */
.cmd-group {
border: 1px solid #1e293b; border-radius: 10px;
padding: 0.5rem; margin-bottom: 0.75rem;
background: #080e1e;
}
.cmd-group .cmd-card { border: 1px solid #1e293b; margin-bottom: 0.5rem; }
.cmd-group.hidden { display: none; }
.cmd-group .cmd-card:last-child { margin-bottom: 0; }
.cmd-group-label {
font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
letter-spacing: 0.08em; color: #475569; padding: 0.25rem 0.5rem 0.4rem;
}
/* Inline config controls within cards */
.cmd-inline-config { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin-bottom: 0.6rem; align-items: center; }
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; }
.checkbox-row input[type="checkbox"] { width: auto; margin: 0; accent-color: #6366f1; }
.checkbox-row label { margin-bottom: 0; cursor: pointer; font-size: 0.8rem; color: #94a3b8; }
.inline-number {
width: 60px; font-size: 0.8rem; padding: 0.2rem 0.5rem;
background: #1e293b; border: 1px solid #334155;
border-radius: 4px; color: #e2e8f0; text-align: center;
}
.inline-number:focus { border-color: #6366f1; outline: none; }
/* Environment selector */
.env-selector { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-bottom: 0.6rem; }
.env-btn {
border: 1px solid #334155; border-radius: 4px; cursor: pointer;
font-size: 0.78rem; padding: 0.25rem 0.65rem;
background: #1e293b; color: #94a3b8; transition: all 0.15s;
}
.env-btn:hover { border-color: #64748b; color: #cbd5e1; }
.env-btn.active { background: #4c1d95; border-color: #4c1d95; color: #c4b5fd; font-weight: 600; }
.env-btn code { font-size: 0.75rem; background: rgb(0 0 0 / 20%); padding: 0.05rem 0.3rem; border-radius: 3px; }
.env-custom-input {
font-size: 0.8rem; padding: 0.25rem 0.5rem;
background: #1e293b; border: 1px solid #334155;
border-radius: 4px; color: #e2e8f0; width: 160px;
}
.env-custom-input:focus { border-color: #6366f1; outline: none; }
.env-custom-input:disabled { opacity: 0.4; cursor: not-allowed; }
/* Project autocomplete */
.project-wrap { position: relative; }
.project-dropdown {
display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 10;
background: #1e293b; border: 1px solid #334155; border-top: none;
border-radius: 0 0 4px 4px; max-height: 180px; overflow-y: auto;
}
.project-dropdown.open { display: block; }
.project-item {
padding: 0.35rem 0.6rem; font-size: 0.85rem; color: #e2e8f0;
cursor: pointer; display: flex; justify-content: space-between; align-items: center;
}
.project-item:hover { background: #334155; }
.project-item-remove {
background: none; border: none; color: #64748b; cursor: pointer;
font-size: 0.7rem; padding: 0.1rem 0.3rem;
}
.project-item-remove:hover { color: #ef4444; }
/* Collapsible toggle */
.collapsible-toggle {
display: flex; align-items: center; gap: 0.5rem; width: 100%;
font-size: 0.8rem; color: #94a3b8; cursor: pointer;
padding: 0.5rem 0; margin: 0;
border: none; border-top: 1px solid #1e293b; border-radius: 0;
background: none; text-align: left; transition: color 0.15s;
}
.collapsible-toggle:hover { color: #e2e8f0; }
.collapsible-toggle:focus { outline: none; box-shadow: none; }
.collapsible-toggle .chevron { display: flex; transition: transform 0.2s ease; color: #475569; }
.collapsible-toggle.open .chevron { transform: rotate(90deg); color: #94a3b8; }
.collapsible-toggle.open { color: #e2e8f0; }
.collapsible-body { display: none; padding: 0.5rem 0 0.75rem 1.6rem; }
.collapsible-body.open { display: block; }
/* Global settings modal */
.modal-overlay {
display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
background: rgb(0 0 0 / 60%); z-index: 100; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-box {
background: #0f172a; border: 1px solid #334155; border-radius: 10px;
padding: 1.25rem 1.5rem; width: 700px; max-width: 90vw;
}
.modal-title { font-size: 0.95rem; font-weight: 700; color: #e2e8f0; margin-bottom: 1rem; }
.modal-box label { display: block; font-size: 0.8rem; color: #94a3b8; margin-bottom: 0.2rem; }
.modal-box input {
width: 100%; box-sizing: border-box; font-size: 0.85rem;
padding: 0.35rem 0.6rem; background: #1e293b; border: 1px solid #334155;
border-radius: 4px; color: #e2e8f0; margin-bottom: 0.75rem;
}
.modal-box input::placeholder { color: #475569; }
.modal-box input:focus { border-color: #6366f1; outline: none; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.5rem; }
.modal-actions button {
font-size: 0.78rem; padding: 0.35rem 0.75rem; border-radius: 4px; cursor: pointer;
}
</style>
</head>
<body>
<h1>Lagoon Command Generator</h1>
<p class="subtitle">Search and filter pre-filled Lagoon commands. Configure your project in settings or pass <code style="font-size:0.8rem;background:#1e293b;padding:0.1rem 0.4rem;border-radius:3px">?project=name</code> in the URL.</p>
<!-- Settings group -->
<div class="cmd-group" style="margin-bottom:1rem">
<div class="cmd-group-label" style="display:flex;align-items:center;justify-content:space-between">
<span style="display:inline-flex;align-items:center;gap:0.5rem">Project Information <button class="settings-toggle" id="global-settings-btn" style="margin-bottom:0;padding:0.25rem 0.4rem;line-height:1" title="Global Settings"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg></button></span>
<span style="display:inline-flex;align-items:center;gap:0.5rem"><span style="color:#64748b;font-size:0.65rem">Drag to bookmarks bar</span> <a class="settings-toggle" id="bookmark-link" href="#" style="margin-bottom:0;padding:0.2rem 0.4rem;line-height:1;text-transform:none;letter-spacing:0;text-decoration:none;gap:0" title="Drag to bookmarks bar to save this project" draggable="true"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="flex-shrink:0"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg><span id="bookmark-link-label">Lagoon Commands</span></a> <button class="settings-toggle" id="share-link-btn" style="margin-bottom:0;padding:0.2rem 0.4rem;line-height:1;text-transform:none;letter-spacing:0" title="Copy a shareable URL with current settings"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><line x1="8.59" y1="13.51" x2="15.42" y2="17.49"/><line x1="15.41" y1="6.51" x2="8.59" y2="10.49"/></svg></button></span>
</div>
<div style="padding:0.5rem 0.75rem">
<div class="settings-grid">
<div class="project-wrap">
<label for="s-project">Project Name <span style="color:#ef4444">*</span></label>
<input type="text" id="s-project" placeholder="my-project" autocomplete="off" data-lpignore="true" data-1p-ignore data-bwignore>
<div class="project-dropdown" id="project-dropdown"></div>
</div>
<div>
<label for="s-github-repo">GitHub Repo</label>
<input type="text" id="s-github-repo" placeholder="org/PROJECT" autocomplete="off" data-lpignore="true" data-1p-ignore data-bwignore>
</div>
<div style="grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 0.75rem 1.5rem;">
<div>
<label for="s-prod-branch">Production Branch <span style="color:#ef4444">*</span></label>
<input type="text" id="s-prod-branch" placeholder="main" autocomplete="off" data-lpignore="true" data-1p-ignore data-bwignore>
</div>
<div>
<label for="s-dev-branch">Dev Branch <span style="color:#ef4444">*</span></label>
<input type="text" id="s-dev-branch" placeholder="develop" autocomplete="off" data-lpignore="true" data-1p-ignore data-bwignore>
</div>
<div>
<label for="s-pr-prefix">PR Env Prefix <span style="color:#ef4444">*</span></label>
<input type="text" id="s-pr-prefix" placeholder="pr-" autocomplete="off" data-lpignore="true" data-1p-ignore data-bwignore>
</div>
<div>
<label for="s-ssh-port">SSH Port <span style="color:#ef4444">*</span></label>
<input type="text" id="s-ssh-port" placeholder="32222" autocomplete="off" data-lpignore="true" data-1p-ignore data-bwignore>
</div>
</div>
<div style="grid-column: 1 / -1">
<div class="checkbox-row" style="margin-bottom:0.4rem">
<input type="checkbox" id="s-custom-ssh" style="width:auto;margin:0;accent-color:#6366f1">
<label for="s-custom-ssh" style="cursor:pointer;font-size:0.8rem;color:#94a3b8;margin-bottom:0">Use custom SSH key</label>
</div>
<div id="ssh-custom-block" style="display:none">
<label for="s-ssh-pattern">SSH Key Pattern <span style="color:#64748b;font-weight:normal">(use <code style="font-size:0.75rem;background:#1e293b;padding:0.05rem 0.3rem;border-radius:3px">{PROJECT}</code> as placeholder)</span></label>
<input type="text" id="s-ssh-pattern" placeholder="$HOME/.ssh/deploy_plus_{PROJECT}_lagoon_at_acme_com" autocomplete="off" data-lpignore="true" data-1p-ignore data-bwignore>
<div style="font-size:0.75rem;color:#64748b;margin-top:0.2rem">Resolved: <span id="s-ssh-preview" style="color:#7dd3fc;font-family:monospace;cursor:pointer" title="Click to copy"></span><svg id="ssh-preview-copy-icon" width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="#64748b" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="margin-left:0.3rem;vertical-align:middle;cursor:pointer;display:none" title="Click to copy"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg></div>
<button class="collapsible-toggle" style="margin-top:0.3rem" onclick="this.classList.toggle('open');this.nextElementSibling.classList.toggle('open')">
<span class="chevron"><svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"/></svg></span>
Generate SSH deploy key
</button>
<div class="collapsible-body">
<div style="position:relative">
<pre id="ssh-keygen-code" style="background:#020617;border:1px solid #1e293b;border-radius:6px;padding:0.65rem 3rem 0.65rem 0.85rem;font-family:'JetBrains Mono','Fira Code','Cascadia Code',monospace;font-size:0.78rem;color:#7dd3fc;white-space:pre-wrap;word-break:break-all;line-height:1.5;margin:0"></pre>
<button class="copy-btn" id="ssh-keygen-copy" style="position:absolute;right:0.4rem;top:0.4rem">Copy</button>
</div>
</div>
</div>
</div>
</div>
<div style="margin-top:0.75rem;display:flex;justify-content:space-between;align-items:center">
<button id="reset-defaults-btn" style="font-size:0.78rem;padding:0.35rem 0.75rem;background:#1e293b;border:1px solid #ef4444;border-radius:4px;color:#ef4444;cursor:pointer">Clear Project</button>
<button id="save-settings-btn" style="font-size:0.78rem;padding:0.35rem 0.75rem;background:#166534;border:1px solid #166534;border-radius:4px;color:#86efac;cursor:pointer;font-weight:600">Save</button>
</div>
</div>
</div>
<!-- Search bar -->
<div class="search-wrap">
<span class="search-icon"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg></span>
<input type="text" id="search" placeholder="Search commands by name, description, or tag…" autocomplete="off" data-lpignore="true" data-1p-ignore data-bwignore aria-label="Search commands">
<button id="search-clear" title="Clear search"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg></button>
</div>
<!-- Tag filter buttons -->
<div class="tag-filters" id="tag-filters">
<button class="tag-filter-btn" data-tag="auth">auth</button>
<button class="tag-filter-btn" data-tag="setup">setup</button>
<button class="tag-filter-btn" data-tag="variables">variables</button>
<button class="tag-filter-btn" data-tag="deploy">deploy</button>
<button class="tag-filter-btn" data-tag="ssh">ssh</button>
<button class="tag-filter-btn" data-tag="data">data</button>
<button class="tag-filter-btn" data-tag="users">users</button>
<button class="tag-filter-btn" data-tag="custom">custom</button>
</div>
<div class="count-bar" id="count-bar">Showing all commands</div>
<div class="commands-list" id="commands-list"></div>
<div class="no-results hidden" id="no-results">No commands match your search.</div>
<!-- Global settings modal -->
<div class="modal-overlay" id="global-settings-modal">
<div class="modal-box">
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:1rem">
<div class="modal-title" style="margin-bottom:0">Global Settings</div>
<button id="global-close-btn" style="background:none;border:none;color:#64748b;cursor:pointer;padding:0.2rem;line-height:1" title="Close"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg></button>
</div>
<div style="display:grid;grid-template-columns:1fr 1fr 1fr 1fr;gap:0.75rem 1.5rem;margin-bottom:0.75rem">
<div>
<label for="g-prod-branch">Default Production Branch</label>
<input type="text" id="g-prod-branch" placeholder="main" autocomplete="off" data-lpignore="true" data-1p-ignore data-bwignore>
</div>
<div>
<label for="g-dev-branch">Default Dev Branch</label>
<input type="text" id="g-dev-branch" placeholder="develop" autocomplete="off" data-lpignore="true" data-1p-ignore data-bwignore>
</div>
<div>
<label for="g-pr-prefix">Default PR Env Prefix</label>
<input type="text" id="g-pr-prefix" placeholder="pr-" autocomplete="off" data-lpignore="true" data-1p-ignore data-bwignore>
</div>
<div>
<label for="g-ssh-port">Default SSH Port</label>
<input type="text" id="g-ssh-port" placeholder="32222" autocomplete="off" data-lpignore="true" data-1p-ignore data-bwignore>
</div>
</div>
<label for="g-ssh-pattern">Default SSH Key Pattern <span style="color:#64748b;font-weight:normal">(use <code style="font-size:0.75rem;background:#1e293b;padding:0.05rem 0.3rem;border-radius:3px">{PROJECT}</code> as placeholder)</span></label>
<input type="text" id="g-ssh-pattern" placeholder="$HOME/.ssh/deploy_plus_{PROJECT}_lagoon_at_acme_com" autocomplete="off" data-lpignore="true" data-1p-ignore data-bwignore>
<button class="collapsible-toggle" style="margin-top:1rem" onclick="this.classList.toggle('open');this.nextElementSibling.classList.toggle('open')">
<span class="chevron"><svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"/></svg></span>
Import / Export Configuration
</button>
<div class="collapsible-body">
<div style="font-size:0.75rem;color:#64748b;margin-bottom:0.3rem">Export — copy this to transfer settings to another browser:</div>
<div style="position:relative">
<pre id="config-export" style="background:#020617;border:1px solid #1e293b;border-radius:6px;padding:0.5rem 3rem 0.5rem 0.65rem;font-family:monospace;font-size:0.72rem;color:#7dd3fc;white-space:pre-wrap;word-break:break-all;max-height:120px;overflow-y:auto;margin:0"></pre>
<button class="copy-btn" id="config-export-copy" style="position:absolute;right:0.4rem;top:0.4rem">Copy</button>
</div>
<div style="font-size:0.75rem;color:#64748b;margin-top:0.75rem;margin-bottom:0.3rem">Import — paste configuration and click Import:</div>
<textarea id="config-import" rows="4" style="width:100%;box-sizing:border-box;font-family:monospace;font-size:0.72rem;background:#020617;border:1px solid #1e293b;border-radius:6px;padding:0.5rem 0.65rem;color:#e2e8f0;resize:vertical" placeholder="Paste configuration JSON here..."></textarea>
<button id="config-import-btn" style="margin-top:0.3rem;font-size:0.78rem;padding:0.35rem 0.75rem;background:#1e293b;border:1px solid #334155;border-radius:4px;color:#94a3b8;cursor:pointer">Import</button>
</div>
<button class="collapsible-toggle" onclick="this.classList.toggle('open');this.nextElementSibling.classList.toggle('open')">
<span class="chevron"><svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="9 18 15 12 9 6"/></svg></span>
Clear All Data
</button>
<div class="collapsible-body">
<div style="font-size:0.78rem;color:#64748b;margin-bottom:0.5rem">Clear all saved projects and settings from this browser.</div>
<div class="checkbox-row" style="margin-bottom:0.5rem">
<input type="checkbox" id="g-wipe-confirm" style="width:auto;margin:0;accent-color:#ef4444">
<label for="g-wipe-confirm" style="cursor:pointer;font-size:0.78rem;color:#94a3b8;margin-bottom:0">Confirm</label>
</div>
<button id="global-wipe-btn" disabled style="font-size:0.78rem;padding:0.35rem 0.75rem;background:#1e293b;border:1px solid #334155;border-radius:4px;color:#94a3b8;cursor:not-allowed;opacity:0.5">Clear All</button>
</div>
<div class="modal-actions" style="margin-top:1.25rem;padding-top:1rem;border-top:1px solid #1e293b">
<button id="global-cancel-btn" style="background:#1e293b;border:1px solid #334155;color:#94a3b8">Cancel</button>
<button id="global-save-btn" style="background:#166534;border:1px solid #166534;color:#86efac;font-weight:600">Save</button>
</div>
</div>
</div>
<script>
// ─── Command definitions ───────────────────────────────────────────────────
// Template vars: {{PROJECT}}, {{SSH_KEY}}, {{SSH_PORT}}, {{PROD_BRANCH}}, {{DEV_BRANCH}}, {{GITHUB_REPO}}
// Inline param keys: BRANCH, PR_NUM, PR_SHA, EMAIL, ENV_NAME
const COMMANDS = [
// ── auth ──
{
id: 1, title: 'Login to Lagoon', tags: ['auth'], group: 'auth',
desc: 'Authenticate with Lagoon using your SSH key.',
tpl: 'lagoon -i "{{SSH_KEY}}" login',
params: []
},
{
id: 2, title: 'Check current user', tags: ['auth'], group: 'auth',
desc: 'Display the currently authenticated Lagoon user.',
tpl: 'lagoon whoami',
params: []
},
{
id: 3, title: 'List all variables', tags: ['auth', 'variables'], group: 'auth',
desc: 'List all project variables with values revealed.',
tpl: 'lagoon list variables -p {{PROJECT}} --reveal',
params: []
},
{
id: 4, title: 'Get project key', tags: ['auth', 'setup'], group: 'auth',
desc: 'Retrieve the SSH public key for the project.',
tpl: 'lagoon -p {{PROJECT}} get project-key',
params: []
},
// ── setup (dynamic — inline controls in each card) ──
{
id: 5, title: 'Set deployable branches', tags: ['setup'], group: 'setup',
desc: 'Configure which branch patterns are allowed to deploy.',
tpl: "lagoon update project -p {{PROJECT}} --branches '{{BRANCH_REGEX}}'",
params: [], dynamic: true, control: 'branches'
},
{
id: 7, title: 'Set PR deployments', tags: ['setup'], group: 'setup',
desc: 'Enable or disable pull-request environment deployments.',
tpl: 'lagoon update project -p {{PROJECT}} -m {{PR_DEPLOY}}',
params: [], dynamic: true, control: 'pr-deploy'
},
{
id: 8, title: 'Set environment limit', tags: ['setup'], group: 'setup',
desc: 'Set the maximum number of concurrent environments.',
tpl: 'lagoon update project -p {{PROJECT}} -L {{ENV_LIMIT}}',
params: [], dynamic: true, control: 'env-limit'
},
{
id: 9, title: 'Set production environment', tags: ['setup'], group: 'setup',
desc: 'Mark which branch is the production environment.',
tpl: 'lagoon update project -p {{PROJECT}} -E {{SETUP_PROD_ENV}}',
params: [], dynamic: true, control: 'prod-env'
},
{
id: 36, title: 'Set auto-idle', tags: ['setup'], group: 'setup',
desc: 'Enable or disable auto-idling for an environment.',
tplBranch: 'lagoon update environment -p {{PROJECT}} -e {{DEPLOY_BRANCH}} --autoIdle {{AUTO_IDLE}}',
tplPr: 'lagoon update environment -p {{PROJECT}} -e {{PR_PREFIX}}{{PR_NUM}} --autoIdle {{AUTO_IDLE}}',
tpl: 'lagoon update environment -p {{PROJECT}} -e {{DEPLOY_BRANCH}} --autoIdle {{AUTO_IDLE}}',
params: [], dynamic: true, control: 'auto-idle', envSelectPr: true, envSelectNoProd: true
},
// ── variables ──
{
id: 10, title: 'Add Shield user', tags: ['variables', 'setup'], group: 'variables',
desc: 'Set the HTTP Shield username as a runtime variable.',
tpl: 'lagoon add variable -p {{PROJECT}} -N DRUPAL_SHIELD_USER -S runtime -V {{PROJECT}}',
params: []
},
{
id: 11, title: 'Add Shield password', tags: ['variables', 'setup'], group: 'variables',
desc: 'Set the HTTP Shield password as a runtime variable.',
tpl: 'lagoon add variable -p {{PROJECT}} -N DRUPAL_SHIELD_PASS -S runtime -V {{PROJECT}}2025',
params: []
},
{
id: 12, title: 'Add GitHub token', tags: ['variables'], group: 'variables',
desc: 'Add a GitHub personal access token for deployment notifications.',
tpl: 'lagoon add variable -p {{PROJECT}} -N VORTEX_NOTIFY_GITHUB_TOKEN -S runtime -V <TOKEN>',
params: []
},
{
id: 13, title: 'Add PACKAGE_TOKEN variable', tags: ['variables', 'setup'], group: 'variables',
desc: 'Add a package registry token used at build time.',
tpl: 'lagoon add variable -p {{PROJECT}} -N PACKAGE_TOKEN -S build -V <TOKEN>',
params: []
},
{
id: 14, title: 'Enable debug mode', tags: ['variables'], group: 'variables',
desc: 'Set VORTEX_DEBUG=1 as a runtime variable to enable verbose output.',
tpl: 'lagoon add variable -p {{PROJECT}} -N VORTEX_DEBUG -S runtime -V 1',
params: []
},
{
id: 15, title: 'Disable debug mode', tags: ['variables'], group: 'variables',
desc: 'Remove the VORTEX_DEBUG runtime variable.',
tpl: 'lagoon delete variable -p {{PROJECT}} -N VORTEX_DEBUG --force',
params: []
},
{
id: 16, title: 'Remove Shield user', tags: ['variables', 'setup'], group: 'variables',
desc: 'Delete the DRUPAL_SHIELD_USER variable from the project.',
tpl: 'lagoon delete variable -p {{PROJECT}} -N DRUPAL_SHIELD_USER --force',
params: []
},
{
id: 17, title: 'Remove Shield password', tags: ['variables'], group: 'variables',
desc: 'Delete the DRUPAL_SHIELD_PASS variable from the project.',
tpl: 'lagoon delete variable -p {{PROJECT}} -N DRUPAL_SHIELD_PASS --force',
params: []
},
// ── deploy ──
{
id: 18, title: 'Deploy branch', tags: ['deploy'], group: 'deploy',
desc: 'Trigger a fresh deployment of a branch.',
tpl: 'lagoon deploy branch -p {{PROJECT}} -b "{{DEPLOY_BRANCH}}"',
params: [], envSelect: true, dbOverride: true
},
{
id: 19, title: 'Redeploy latest', tags: ['deploy'], group: 'deploy',
desc: 'Re-run the latest existing deployment without a new push.',
tpl: 'lagoon deploy latest -p {{PROJECT}} -e "{{DEPLOY_BRANCH}}"',
params: [], envSelect: true, dbOverride: true
},
// ── ssh ──
{
id: 28, title: 'SSH to environment', tags: ['ssh'], group: 'ssh',
desc: 'Open an SSH session to an environment.',
tplBranch: 'lagoon ssh -p {{PROJECT}} -e {{DEPLOY_BRANCH}}',
tplPr: 'lagoon ssh -p {{PROJECT}} -e {{PR_PREFIX}}{{PR_NUM}}',
tplBranchAlt: 'ssh -i {{SSH_KEY}} -o "IdentitiesOnly=yes" -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -p {{SSH_PORT}} {{PROJECT}}-{{DEPLOY_BRANCH}}@ssh.lagoon.amazeeio.cloud',
tplPrAlt: 'ssh -i {{SSH_KEY}} -o "IdentitiesOnly=yes" -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -p {{SSH_PORT}} {{PROJECT}}-{{PR_PREFIX}}{{PR_NUM}}@ssh.lagoon.amazeeio.cloud',
tpl: 'lagoon ssh -p {{PROJECT}} -e {{DEPLOY_BRANCH}}',
params: [], envSelectPr: true, altCode: true
},
// ── data ──
{
id: 39, title: 'Copy DB from environment', tags: ['data'], group: 'data',
desc: 'Download db.sql from the environment /tmp via rsync over SSH.',
tplBranch: "rsync -e \"ssh -i {{SSH_KEY}} -t -o 'IdentitiesOnly=yes' -o 'UserKnownHostsFile=/dev/null' -o 'StrictHostKeyChecking=no' -p {{SSH_PORT}}\" {{PROJECT}}-{{DEPLOY_BRANCH}}@ssh.lagoon.amazeeio.cloud:/tmp/db.sql ./.data/db.sql",
tplPr: "rsync -e \"ssh -i {{SSH_KEY}} -t -o 'IdentitiesOnly=yes' -o 'UserKnownHostsFile=/dev/null' -o 'StrictHostKeyChecking=no' -p {{SSH_PORT}}\" {{PROJECT}}-{{PR_PREFIX}}{{PR_NUM}}@ssh.lagoon.amazeeio.cloud:/tmp/db.sql ./.data/db.sql",
tpl: "rsync -e \"ssh -i {{SSH_KEY}} -t -o 'IdentitiesOnly=yes' -o 'UserKnownHostsFile=/dev/null' -o 'StrictHostKeyChecking=no' -p {{SSH_PORT}}\" {{PROJECT}}-{{DEPLOY_BRANCH}}@ssh.lagoon.amazeeio.cloud:/tmp/db.sql ./.data/db.sql",
params: [], envSelectPr: true
},
{
id: 31, title: 'Copy DB to environment', tags: ['data'], group: 'data',
desc: 'Upload local db.sql to the environment /tmp via rsync over SSH.',
tplBranch: "rsync -e \"ssh -i {{SSH_KEY}} -t -o 'IdentitiesOnly=yes' -o 'UserKnownHostsFile=/dev/null' -o 'StrictHostKeyChecking=no' -p {{SSH_PORT}}\" ./.data/db.sql {{PROJECT}}-{{DEPLOY_BRANCH}}@ssh.lagoon.amazeeio.cloud:/tmp/",
tplPr: "rsync -e \"ssh -i {{SSH_KEY}} -t -o 'IdentitiesOnly=yes' -o 'UserKnownHostsFile=/dev/null' -o 'StrictHostKeyChecking=no' -p {{SSH_PORT}}\" ./.data/db.sql {{PROJECT}}-{{PR_PREFIX}}{{PR_NUM}}@ssh.lagoon.amazeeio.cloud:/tmp/",
tpl: "rsync -e \"ssh -i {{SSH_KEY}} -t -o 'IdentitiesOnly=yes' -o 'UserKnownHostsFile=/dev/null' -o 'StrictHostKeyChecking=no' -p {{SSH_PORT}}\" ./.data/db.sql {{PROJECT}}-{{DEPLOY_BRANCH}}@ssh.lagoon.amazeeio.cloud:/tmp/",
params: [], envSelectPr: true
},
{
id: 32, title: 'Sync files to environment', tags: ['data'], group: 'data',
desc: 'Upload local files directory to an environment via rsync.',
tplBranch: "rsync -avz -e \"ssh -i {{SSH_KEY}} -o 'IdentitiesOnly=yes' -o 'UserKnownHostsFile=/dev/null' -o 'StrictHostKeyChecking=no' -p {{SSH_PORT}}\" ./web/sites/default/files/ {{PROJECT}}-{{DEPLOY_BRANCH}}@ssh.lagoon.amazeeio.cloud:/app/web/sites/default/files/",
tplPr: "rsync -avz -e \"ssh -i {{SSH_KEY}} -o 'IdentitiesOnly=yes' -o 'UserKnownHostsFile=/dev/null' -o 'StrictHostKeyChecking=no' -p {{SSH_PORT}}\" ./web/sites/default/files/ {{PROJECT}}-{{PR_PREFIX}}{{PR_NUM}}@ssh.lagoon.amazeeio.cloud:/app/web/sites/default/files/",
tpl: "rsync -avz -e \"ssh -i {{SSH_KEY}} -o 'IdentitiesOnly=yes' -o 'UserKnownHostsFile=/dev/null' -o 'StrictHostKeyChecking=no' -p {{SSH_PORT}}\" ./web/sites/default/files/ {{PROJECT}}-{{DEPLOY_BRANCH}}@ssh.lagoon.amazeeio.cloud:/app/web/sites/default/files/",
params: [], envSelectPr: true
},
{
id: 33, title: 'Sync files from environment', tags: ['data'], group: 'data',
desc: 'Download files directory from an environment via rsync.',
tplBranch: "rsync -avz -e \"ssh -i {{SSH_KEY}} -o 'IdentitiesOnly=yes' -o 'UserKnownHostsFile=/dev/null' -o 'StrictHostKeyChecking=no' -p {{SSH_PORT}}\" {{PROJECT}}-{{DEPLOY_BRANCH}}@ssh.lagoon.amazeeio.cloud:/app/web/sites/default/files/ ./web/sites/default/files/",
tplPr: "rsync -avz -e \"ssh -i {{SSH_KEY}} -o 'IdentitiesOnly=yes' -o 'UserKnownHostsFile=/dev/null' -o 'StrictHostKeyChecking=no' -p {{SSH_PORT}}\" {{PROJECT}}-{{PR_PREFIX}}{{PR_NUM}}@ssh.lagoon.amazeeio.cloud:/app/web/sites/default/files/ ./web/sites/default/files/",
tpl: "rsync -avz -e \"ssh -i {{SSH_KEY}} -o 'IdentitiesOnly=yes' -o 'UserKnownHostsFile=/dev/null' -o 'StrictHostKeyChecking=no' -p {{SSH_PORT}}\" {{PROJECT}}-{{DEPLOY_BRANCH}}@ssh.lagoon.amazeeio.cloud:/app/web/sites/default/files/ ./web/sites/default/files/",
params: [], envSelectPr: true
},
// ── users ──
{
id: 40, title: 'Add user to Lagoon', tags: ['users'], group: 'users',
desc: 'Create a new user in Lagoon.',
tpl: 'lagoon add user -E {{EMAIL}} -F {{FIRST_NAME}} -L {{LAST_NAME}}',
params: [
{ key: 'EMAIL', label: 'Email', placeholder: 'user@example.com', width: 280 },
{ key: 'FIRST_NAME', label: 'First name', placeholder: 'John' },
{ key: 'LAST_NAME', label: 'Last name', placeholder: 'Doe' }
]
},
{
id: 34, title: 'Add user to group', tags: ['users'], group: 'users',
desc: 'Grant a user maintainer role in the main project group.',
tpl: 'lagoon add user-group -E {{EMAIL}} -N {{PROJECT}} -R maintainer',
params: [{ key: 'EMAIL', label: 'User email', placeholder: 'user@example.com', width: 280 }]
},
{
id: 35, title: 'Add user to project group', tags: ['users'], group: 'users',
desc: 'Grant a user maintainer role in the project-prefixed group.',
tpl: 'lagoon add user-group -E {{EMAIL}} -N project-{{PROJECT}} -R maintainer',
params: [{ key: 'EMAIL', label: 'User email', placeholder: 'user@example.com', width: 280 }]
},
{
id: 41, title: 'Delete user from Lagoon', tags: ['users'], group: 'users',
desc: 'Remove a user from Lagoon.',
tpl: 'lagoon delete user -E {{EMAIL}} --force',
params: [{ key: 'EMAIL', label: 'Email', placeholder: 'user@example.com', width: 280 }]
},
// ── custom ──
{
id: 42, title: 'Custom command', tags: ['custom'], group: 'custom',
desc: 'Run a custom Lagoon command with the project pre-filled.',
tpl: 'lagoon {{CUSTOM_CMD}} -p {{PROJECT}}',
params: [{ key: 'CUSTOM_CMD', label: 'Command', placeholder: 'list environments', wide: true }]
}
];
// ─── State ─────────────────────────────────────────────────────────────────
const DEFAULT_SSH_PATTERN = '$HOME/.ssh/deploy_plus_{PROJECT}_lagoon_at_acme_com';
const state = {
project: '',
sshKeyPattern: '',
prodBranch: '',
devBranch: '',
githubRepo: '',
prPrefix: '',
sshPort: '',
useCustomSsh: false,
searchQuery: '',
activeTag: null,
inlineParams: {},
// Setup config
setup: {
branches: { production: false, main: true, master: false, develop: true, release: true, hotfix: true, project: true, feature: false },
branchesCustom: '',
envLimit: 4,
prodEnv: '',
prDeploy: true,
autoIdle: true
}
};
// ─── Persistence ───────────────────────────────────────────────────────────
var LS_KEYS = ['project', 'sshKeyPattern', 'prodBranch', 'devBranch', 'githubRepo', 'prPrefix', 'sshPort', 'useCustomSsh', 'inlineParams', 'setup', 'projects', 'global'];
function lsSet(key, value) {
try { localStorage.setItem(key, JSON.stringify(value)); } catch (_e) {}
}
function lsGet(key, fallback) {
try {
var v = localStorage.getItem(key);
return v !== null ? JSON.parse(v) : fallback;
} catch (_e) { return fallback; }
}
function saveToLS() {
if (!state.project.trim()) return;
lsSet('project', state.project);
lsSet('sshKeyPattern', state.sshKeyPattern);
lsSet('prodBranch', state.prodBranch);
lsSet('devBranch', state.devBranch);
lsSet('githubRepo', state.githubRepo);
lsSet('prPrefix', state.prPrefix);
lsSet('sshPort', state.sshPort);
lsSet('useCustomSsh', state.useCustomSsh);
lsSet('inlineParams', state.inlineParams);
lsSet('setup', state.setup);
}
function loadFromLS() {
state.project = lsGet('project', '');
state.sshKeyPattern = lsGet('sshKeyPattern', '');
state.prodBranch = lsGet('prodBranch', '');
state.devBranch = lsGet('devBranch', '');
state.githubRepo = lsGet('githubRepo', '');
state.prPrefix = lsGet('prPrefix', '');
state.sshPort = lsGet('sshPort', '');
state.useCustomSsh = lsGet('useCustomSsh', false);
state.inlineParams = lsGet('inlineParams', {});
var savedSetup = lsGet('setup', null);
if (savedSetup) {
if (savedSetup.branches) state.setup.branches = Object.assign(state.setup.branches, savedSetup.branches);
if (savedSetup.branchesCustom !== undefined) state.setup.branchesCustom = savedSetup.branchesCustom;
if (savedSetup.envLimit !== undefined) state.setup.envLimit = savedSetup.envLimit;
if (savedSetup.prodEnv !== undefined) state.setup.prodEnv = savedSetup.prodEnv;
if (savedSetup.prDeploy !== undefined) state.setup.prDeploy = savedSetup.prDeploy;
if (savedSetup.autoIdle !== undefined) state.setup.autoIdle = savedSetup.autoIdle;
}
}
// ─── Saved projects ─────────────────────────────────────────────────────────
var LS_PROJECTS_KEY = 'projects';
function loadSavedProjects() {
try { return JSON.parse(localStorage.getItem(LS_PROJECTS_KEY) || '{}'); } catch (_e) { return {}; }
}
function saveProject() {
var name = state.project.trim();
if (!name) return;
var projects = loadSavedProjects();
projects[name] = {
sshKeyPattern: state.sshKeyPattern,
prodBranch: state.prodBranch,
devBranch: state.devBranch,
githubRepo: state.githubRepo,
prPrefix: state.prPrefix,
sshPort: state.sshPort,
useCustomSsh: state.useCustomSsh
};
try { localStorage.setItem(LS_PROJECTS_KEY, JSON.stringify(projects)); } catch (_e) {}
}
function removeProject(name) {
var projects = loadSavedProjects();
delete projects[name];
try { localStorage.setItem(LS_PROJECTS_KEY, JSON.stringify(projects)); } catch (_e) {}
}
function loadProjectSettings(name) {
var projects = loadSavedProjects();
var p = projects[name];
if (!p) return;
state.project = name;
if (p.sshKeyPattern !== undefined) state.sshKeyPattern = p.sshKeyPattern;
if (p.prodBranch !== undefined) state.prodBranch = p.prodBranch;
if (p.devBranch !== undefined) state.devBranch = p.devBranch;
if (p.githubRepo !== undefined) state.githubRepo = p.githubRepo;
if (p.prPrefix !== undefined) state.prPrefix = p.prPrefix;
if (p.sshPort !== undefined) state.sshPort = p.sshPort;
if (p.useCustomSsh !== undefined) state.useCustomSsh = p.useCustomSsh;
populateSettingsFromState();
updateSshPreview();
updateAllCodeBlocks();
saveToLS();
}
function showProjectDropdown(filter) {
var dropdown = document.getElementById('project-dropdown');
var projects = loadSavedProjects();
var names = Object.keys(projects).sort();
if (filter) {
var q = filter.toLowerCase();
names = names.filter(function(n) { return n.toLowerCase().includes(q) && n !== filter; });
}
dropdown.innerHTML = '';
if (names.length === 0) { dropdown.classList.remove('open'); return; }
names.forEach(function(name) {
var item = document.createElement('div');
item.className = 'project-item';
var label = document.createElement('span');
label.textContent = name;
var removeBtn = document.createElement('button');
removeBtn.className = 'project-item-remove';
removeBtn.textContent = '\u2715';
removeBtn.title = 'Remove saved project';
removeBtn.addEventListener('mousedown', function(e) {
e.preventDefault();
e.stopPropagation();
removeProject(name);
showProjectDropdown(document.getElementById('s-project').value);
});
item.appendChild(label);
item.appendChild(removeBtn);
item.addEventListener('mousedown', function(e) {
e.preventDefault();
loadProjectSettings(name);
dropdown.classList.remove('open');
});
dropdown.appendChild(item);
});
dropdown.classList.add('open');
}
// ─── Variable resolution ───────────────────────────────────────────────────
var GLOBAL_DEFAULTS_MAP = { prodBranch: 'prodBranch', devBranch: 'devBranch', prPrefix: 'prPrefix', sshPort: 'sshPort' };
var BUILTIN_DEFAULTS = { prodBranch: 'main', devBranch: 'develop', prPrefix: 'pr-', sshPort: '32222' };
function getEffective(key, fallback) {
const v = state[key];
if (v && v.trim()) return v.trim();
if (GLOBAL_DEFAULTS_MAP[key]) {
var global = loadGlobalSettings();
var gv = global[GLOBAL_DEFAULTS_MAP[key]];
if (gv && gv.trim()) return gv.trim();
if (BUILTIN_DEFAULTS[key]) return BUILTIN_DEFAULTS[key];
}
return fallback;
}
function resolveSshKey(project) {
var pattern = state.sshKeyPattern.trim();
if (!pattern) {
var global = loadGlobalSettings();
pattern = global.sshPattern || DEFAULT_SSH_PATTERN;
}
return pattern.split('{PROJECT}').join(project);
}
function buildBranchRegex() {
var parts = [];
var br = state.setup.branches;
if (br.production) parts.push('production');
if (br.main) parts.push('main');
if (br.master) parts.push('master');
if (br.develop) parts.push('develop');
if (br.release) parts.push('release/[0-9]+(\\.[0-9]+)+(-rc[0-9]+)?');
if (br.hotfix) parts.push('hotfix/[0-9]+(\\.[0-9]+)+(-rc[0-9]+)?');
if (br.project) parts.push('project/.*');
if (br.feature) parts.push('feature/.*');
var custom = state.setup.branchesCustom.trim();
if (custom) parts.push(custom);
if (parts.length === 0) return '.*';
return '^(' + parts.join('|') + ')$';
}
function validateRegex(pattern) {
try {
new RegExp(pattern);
return true;
} catch (_e) {
return false;
}
}
function updateBranchValidation(iconEl) {
var regex = buildBranchRegex();
var valid = validateRegex(regex);
iconEl.innerHTML = valid ? '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#22c55e" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>' : '<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#ef4444" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>';
iconEl.title = valid ? 'Valid regex' : 'Invalid regex — check the "More" pattern';
}
function resolveCommand(cmd, useAlt) {
const project = getEffective('project', '<project>');
const sshKey = resolveSshKey(project);
const prodBranch = getEffective('prodBranch', '<prod-branch>');
const devBranch = getEffective('devBranch', '<dev-branch>');
const githubRepo = getEffective('githubRepo', '<github-repo>');
const inlineVars = state.inlineParams[cmd.id] || {};
var useOverride = cmd.dbOverride && inlineVars._dbOverride;
var baseTpl = cmd.tpl;
if (cmd.envSelectPr) {
var eType = (inlineVars._envType || 'prod');
if (useAlt && cmd.altCode) {
baseTpl = eType === 'pr' ? cmd.tplPrAlt : cmd.tplBranchAlt;
} else {
baseTpl = eType === 'pr' ? cmd.tplPr : cmd.tplBranch;
}
}
let out = baseTpl;
var projectUnderscore = project.replace(/-/g, '_');
out = out.split('{{PROJECT}}').join(project);
out = out.split('{{PROJECT_UNDERSCORE}}').join(projectUnderscore);
if (state.useCustomSsh) {
out = out.split('{{SSH_KEY}}').join(sshKey);
} else {
// Remove SSH key references when custom SSH is not used.
out = out.replace(/ -i "{{SSH_KEY}}"/g, '');
out = out.replace(/ -i {{SSH_KEY}}/g, '');
out = out.replace(/VORTEX_DEPLOY_SSH_FILE={{SSH_KEY}} /g, '');
out = out.split('{{SSH_KEY}}').join('');
}
var sshPort = getEffective('sshPort', '32222');
out = out.split('{{SSH_PORT}}').join(sshPort);
out = out.split('{{PROD_BRANCH}}').join(prodBranch);
out = out.split('{{DEV_BRANCH}}').join(devBranch);
out = out.split('{{GITHUB_REPO}}').join(githubRepo);
var prPrefix = getEffective('prPrefix', 'pr-');
out = out.split('{{PR_PREFIX}}').join(prPrefix);
// Environment selector for deploy/ssh commands
if (cmd.envSelect || cmd.envSelectPr) {
var envState = inlineVars || {};
var envDefault = cmd.envSelectNoProd ? 'dev' : 'prod';
var envType = envState._envType || envDefault;
if (envType !== 'pr') {
var deployBranch = prodBranch;
if (envType === 'dev') deployBranch = devBranch;
if (envType === 'custom') deployBranch = (envState._customBranch && envState._customBranch.trim()) ? envState._customBranch.trim() : 'feature/my-feature';
out = out.split('{{DEPLOY_BRANCH}}').join(deployBranch);
}
if (envType === 'pr') {
var prNum = (envState._prNum && envState._prNum.trim()) ? envState._prNum.trim() : '42';
out = out.split('{{PR_NUM}}').join(prNum);
}
}
// Setup-specific dynamic tokens
if (cmd.dynamic) {
out = out.split('{{BRANCH_REGEX}}').join(buildBranchRegex());
out = out.split('{{ENV_LIMIT}}').join(String(state.setup.envLimit));
out = out.split('{{PR_DEPLOY}}').join(state.setup.prDeploy ? 'true' : 'false');
var setupProdEnv = state.setup.prodEnv.trim() || prodBranch;
out = out.split('{{SETUP_PROD_ENV}}').join(setupProdEnv);
out = out.split('{{AUTO_IDLE}}').join(state.setup.autoIdle ? '1' : '0');
}
cmd.params.forEach(function(p) {
const val = (inlineVars[p.key] && inlineVars[p.key].trim()) ? inlineVars[p.key].trim() : p.placeholder;
out = out.split('{{' + p.key + '}}').join(val);
});
// Wrap with DB override variable set/remove.
if (useOverride) {
var addVar = 'lagoon add variable -p ' + project + ' -N VORTEX_PROVISION_OVERRIDE_DB -V 1 -S global --force';
var delVar = 'lagoon delete variable -p ' + project + ' -N VORTEX_PROVISION_OVERRIDE_DB --force';
out = '# Set DB override variable\n' + addVar + '\n\n# Deploy\n' + out + '\n\n# Remove DB override variable\n' + delVar;
}
return out;
}
// ─── Fuzzy/substring search ─────────────────────────────────────────────────
function matchesSearch(cmd, query) {
if (!query) return true;
const q = query.toLowerCase();
if (cmd.title.toLowerCase().includes(q)) return true;
if (cmd.desc.toLowerCase().includes(q)) return true;
for (var i = 0; i < cmd.tags.length; i++) {
if (cmd.tags[i].toLowerCase().includes(q)) return true;
}
return false;
}
function matchesTag(cmd, tag) {
if (!tag) return true;
return cmd.tags.indexOf(tag) !== -1;
}
// ─── Render ────────────────────────────────────────────────────────────────
function buildCard(cmd) {
const div = document.createElement('div');
div.className = 'cmd-card';
div.dataset.id = cmd.id;
// Header row
const header = document.createElement('div');
header.className = 'cmd-header';
const titleBlock = document.createElement('div');
const titleEl = document.createElement('div');
titleEl.className = 'cmd-title';
titleEl.textContent = cmd.title;
const descEl = document.createElement('div');
descEl.className = 'cmd-desc';
descEl.textContent = cmd.desc;
titleBlock.appendChild(titleEl);
titleBlock.appendChild(descEl);
const tagsEl = document.createElement('div');
tagsEl.className = 'cmd-tags';
cmd.tags.forEach(function(t) {
const pill = document.createElement('span');
pill.className = 'tag-pill';
pill.dataset.tag = t;
pill.textContent = t;
pill.title = 'Filter by ' + t;
pill.addEventListener('click', function() { toggleTagFilter(t); });
tagsEl.appendChild(pill);
});
header.appendChild(titleBlock);
header.appendChild(tagsEl);
div.appendChild(header);
// Inline controls for setup commands
if (cmd.control) {
var ctrlRow = document.createElement('div');
ctrlRow.className = 'cmd-inline-config';
if (cmd.control === 'branches') {
var branchNames = ['production', 'main', 'master', 'develop', 'release', 'hotfix', 'project', 'feature'];
var branchLabels = ['production', 'main', 'master', 'develop', 'release/*', 'hotfix/*', 'project/*', 'feature/*'];
branchNames.forEach(function(br, i) {
var row = document.createElement('div');
row.className = 'checkbox-row';
var cb = document.createElement('input');
cb.type = 'checkbox';
cb.id = 'br-' + br + '-' + cmd.id;
cb.checked = state.setup.branches[br];
cb.addEventListener('change', function() {
state.setup.branches[br] = cb.checked;
updateBranchValidation(validIcon);
updateAllCodeBlocks();
});
var lbl = document.createElement('label');
lbl.htmlFor = cb.id;
lbl.textContent = branchLabels[i];
row.appendChild(cb);
row.appendChild(lbl);
ctrlRow.appendChild(row);
});
// "More" custom pattern input
var moreLabel = document.createElement('label');