@loopress/cli 0.19.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +158 -37
  2. package/dist/commands/api/publish.d.ts +9 -0
  3. package/dist/commands/api/publish.js +60 -0
  4. package/dist/commands/api/push.d.ts +1 -0
  5. package/dist/commands/api/push.js +19 -0
  6. package/dist/commands/init.js +1 -0
  7. package/dist/commands/page/list.d.ts +9 -0
  8. package/dist/commands/page/list.js +26 -0
  9. package/dist/commands/page/pull.d.ts +13 -0
  10. package/dist/commands/page/pull.js +65 -0
  11. package/dist/commands/page/push.d.ts +16 -0
  12. package/dist/commands/page/push.js +145 -0
  13. package/dist/commands/project/config.d.ts +1 -0
  14. package/dist/commands/project/config.js +28 -0
  15. package/dist/commands/project/rotate.d.ts +7 -0
  16. package/dist/commands/project/rotate.js +20 -0
  17. package/dist/lib/base.d.ts +3 -0
  18. package/dist/lib/base.js +42 -10
  19. package/dist/lib/bootstrap-full-install.d.ts +10 -0
  20. package/dist/lib/bootstrap-full-install.js +66 -0
  21. package/dist/lib/browser-launch.d.ts +8 -0
  22. package/dist/lib/browser-launch.js +20 -0
  23. package/dist/lib/github-release.d.ts +11 -0
  24. package/dist/lib/github-release.js +37 -0
  25. package/dist/lib/plugin-detection.d.ts +8 -0
  26. package/dist/lib/plugin-detection.js +11 -0
  27. package/dist/lib/rotate-app-password.d.ts +6 -0
  28. package/dist/lib/rotate-app-password.js +33 -0
  29. package/dist/lib/temp-admin.d.ts +19 -0
  30. package/dist/lib/temp-admin.js +46 -0
  31. package/dist/lib/wp-client.d.ts +1 -0
  32. package/dist/lib/wp-client.js +3 -0
  33. package/dist/types/project-config.generated.d.ts +4 -0
  34. package/dist/utils/page-format.d.ts +7 -0
  35. package/dist/utils/page-format.js +78 -0
  36. package/oclif.manifest.json +252 -1
  37. package/package.json +8 -7
  38. package/schemas/project-config.schema.json +5 -0
package/README.md CHANGED
@@ -21,7 +21,7 @@ $ npm install -g @loopress/cli
21
21
  $ lps COMMAND
22
22
  running command...
23
23
  $ lps (--version)
24
- @loopress/cli/0.19.0 linux-x64 node-v24.18.0
24
+ @loopress/cli/0.20.0 linux-x64 node-v24.18.0
25
25
  $ lps --help [COMMAND]
26
26
  USAGE
27
27
  $ lps COMMAND
@@ -51,6 +51,7 @@ report.
51
51
  * [`lps acf pull [PATH]`](#lps-acf-pull-path)
52
52
  * [`lps acf push [PATH]`](#lps-acf-push-path)
53
53
  * [`lps api list`](#lps-api-list)
54
+ * [`lps api publish [PATH]`](#lps-api-publish-path)
54
55
  * [`lps api pull [PATH]`](#lps-api-pull-path)
55
56
  * [`lps api push [PATH]`](#lps-api-push-path)
56
57
  * [`lps composer init`](#lps-composer-init)
@@ -64,6 +65,9 @@ report.
64
65
  * [`lps init`](#lps-init)
65
66
  * [`lps login`](#lps-login)
66
67
  * [`lps logout`](#lps-logout)
68
+ * [`lps page list`](#lps-page-list)
69
+ * [`lps page pull [PATH]`](#lps-page-pull-path)
70
+ * [`lps page push [PATH]`](#lps-page-push-path)
67
71
  * [`lps plugin add SLUG`](#lps-plugin-add-slug)
68
72
  * [`lps plugin pull`](#lps-plugin-pull)
69
73
  * [`lps plugin push`](#lps-plugin-push)
@@ -72,6 +76,7 @@ report.
72
76
  * [`lps project pull`](#lps-project-pull)
73
77
  * [`lps project push`](#lps-project-push)
74
78
  * [`lps project remove`](#lps-project-remove)
79
+ * [`lps project rotate`](#lps-project-rotate)
75
80
  * [`lps project switch`](#lps-project-switch)
76
81
  * [`lps seo list`](#lps-seo-list)
77
82
  * [`lps seo pull [PATH]`](#lps-seo-pull-path)
@@ -107,7 +112,7 @@ EXAMPLES
107
112
  $ lps acf list --type field-groups
108
113
  ```
109
114
 
110
- _See code: [src/commands/acf/list.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/acf/list.ts)_
115
+ _See code: [src/commands/acf/list.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/acf/list.ts)_
111
116
 
112
117
  ## `lps acf pull [PATH]`
113
118
 
@@ -136,7 +141,7 @@ EXAMPLES
136
141
  $ lps acf pull --type field-groups
137
142
  ```
138
143
 
139
- _See code: [src/commands/acf/pull.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/acf/pull.ts)_
144
+ _See code: [src/commands/acf/pull.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/acf/pull.ts)_
140
145
 
141
146
  ## `lps acf push [PATH]`
142
147
 
@@ -165,7 +170,7 @@ EXAMPLES
165
170
  $ lps acf push --type field-groups
166
171
  ```
167
172
 
168
- _See code: [src/commands/acf/push.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/acf/push.ts)_
173
+ _See code: [src/commands/acf/push.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/acf/push.ts)_
169
174
 
170
175
  ## `lps api list`
171
176
 
@@ -186,7 +191,30 @@ EXAMPLES
186
191
  $ lps api list
187
192
  ```
188
193
 
189
- _See code: [src/commands/api/list.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/api/list.ts)_
194
+ _See code: [src/commands/api/list.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/api/list.ts)_
195
+
196
+ ## `lps api publish [PATH]`
197
+
198
+ Publish custom API routes to your Loopress account so they can be deployed to other projects. Does not touch any WordPress site.
199
+
200
+ ```
201
+ USAGE
202
+ $ lps api publish [PATH]
203
+
204
+ ARGUMENTS
205
+ [PATH] Path to api directory (overrides project config)
206
+
207
+ DESCRIPTION
208
+ Publish custom API routes to your Loopress account so they can be deployed to other projects. Does not touch any
209
+ WordPress site.
210
+
211
+ EXAMPLES
212
+ $ lps api publish
213
+
214
+ $ lps api publish --path ./api
215
+ ```
216
+
217
+ _See code: [src/commands/api/publish.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/api/publish.ts)_
190
218
 
191
219
  ## `lps api pull [PATH]`
192
220
 
@@ -213,7 +241,7 @@ EXAMPLES
213
241
  $ lps api pull --path ./api
214
242
  ```
215
243
 
216
- _See code: [src/commands/api/pull.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/api/pull.ts)_
244
+ _See code: [src/commands/api/pull.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/api/pull.ts)_
217
245
 
218
246
  ## `lps api push [PATH]`
219
247
 
@@ -240,7 +268,7 @@ EXAMPLES
240
268
  $ lps api push --path ./api
241
269
  ```
242
270
 
243
- _See code: [src/commands/api/push.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/api/push.ts)_
271
+ _See code: [src/commands/api/push.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/api/push.ts)_
244
272
 
245
273
  ## `lps composer init`
246
274
 
@@ -263,7 +291,7 @@ EXAMPLES
263
291
  $ lps composer init --dry-run
264
292
  ```
265
293
 
266
- _See code: [src/commands/composer/init.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/composer/init.ts)_
294
+ _See code: [src/commands/composer/init.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/composer/init.ts)_
267
295
 
268
296
  ## `lps composer pull`
269
297
 
@@ -286,7 +314,7 @@ EXAMPLES
286
314
  $ lps composer pull --dry-run
287
315
  ```
288
316
 
289
- _See code: [src/commands/composer/pull.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/composer/pull.ts)_
317
+ _See code: [src/commands/composer/pull.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/composer/pull.ts)_
290
318
 
291
319
  ## `lps composer push`
292
320
 
@@ -310,7 +338,7 @@ EXAMPLES
310
338
  $ lps composer push --dry-run
311
339
  ```
312
340
 
313
- _See code: [src/commands/composer/push.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/composer/push.ts)_
341
+ _See code: [src/commands/composer/push.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/composer/push.ts)_
314
342
 
315
343
  ## `lps doctor`
316
344
 
@@ -332,7 +360,7 @@ EXAMPLES
332
360
  $ lps doctor --env production
333
361
  ```
334
362
 
335
- _See code: [src/commands/doctor.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/doctor.ts)_
363
+ _See code: [src/commands/doctor.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/doctor.ts)_
336
364
 
337
365
  ## `lps form list`
338
366
 
@@ -353,7 +381,7 @@ EXAMPLES
353
381
  $ lps form list
354
382
  ```
355
383
 
356
- _See code: [src/commands/form/list.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/form/list.ts)_
384
+ _See code: [src/commands/form/list.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/form/list.ts)_
357
385
 
358
386
  ## `lps form pull [PATH]`
359
387
 
@@ -378,7 +406,7 @@ EXAMPLES
378
406
  $ lps form pull
379
407
  ```
380
408
 
381
- _See code: [src/commands/form/pull.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/form/pull.ts)_
409
+ _See code: [src/commands/form/pull.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/form/pull.ts)_
382
410
 
383
411
  ## `lps form push [PATH]`
384
412
 
@@ -404,7 +432,7 @@ EXAMPLES
404
432
  $ lps form push
405
433
  ```
406
434
 
407
- _See code: [src/commands/form/push.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/form/push.ts)_
435
+ _See code: [src/commands/form/push.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/form/push.ts)_
408
436
 
409
437
  ## `lps help [COMMAND]`
410
438
 
@@ -424,7 +452,7 @@ DESCRIPTION
424
452
  Display help for lps.
425
453
  ```
426
454
 
427
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/6.2.53/src/commands/help.ts)_
455
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/6.2.55/src/commands/help.ts)_
428
456
 
429
457
  ## `lps init`
430
458
 
@@ -441,7 +469,7 @@ EXAMPLES
441
469
  $ lps init
442
470
  ```
443
471
 
444
- _See code: [src/commands/init.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/init.ts)_
472
+ _See code: [src/commands/init.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/init.ts)_
445
473
 
446
474
  ## `lps login`
447
475
 
@@ -458,7 +486,7 @@ EXAMPLES
458
486
  $ lps login
459
487
  ```
460
488
 
461
- _See code: [src/commands/login.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/login.ts)_
489
+ _See code: [src/commands/login.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/login.ts)_
462
490
 
463
491
  ## `lps logout`
464
492
 
@@ -475,7 +503,78 @@ EXAMPLES
475
503
  $ lps logout
476
504
  ```
477
505
 
478
- _See code: [src/commands/logout.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/logout.ts)_
506
+ _See code: [src/commands/logout.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/logout.ts)_
507
+
508
+ ## `lps page list`
509
+
510
+ List pages from WordPress
511
+
512
+ ```
513
+ USAGE
514
+ $ lps page list [--env <value>] [-j]
515
+
516
+ FLAGS
517
+ -j, --json Output in JSON format
518
+ --env=<value> Target environment by name, overriding the globally active one (lps project switch)
519
+
520
+ DESCRIPTION
521
+ List pages from WordPress
522
+
523
+ EXAMPLES
524
+ $ lps page list
525
+ ```
526
+
527
+ _See code: [src/commands/page/list.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/page/list.ts)_
528
+
529
+ ## `lps page pull [PATH]`
530
+
531
+ Pull pages from WordPress
532
+
533
+ ```
534
+ USAGE
535
+ $ lps page pull [PATH] [--env <value>] [-d] [-y]
536
+
537
+ ARGUMENTS
538
+ [PATH] Path to pages directory (overrides project config)
539
+
540
+ FLAGS
541
+ -d, --dry-run Show what would change without making changes
542
+ -y, --yes Answer yes to confirmation prompts
543
+ --env=<value> Target environment by name, overriding the globally active one (lps project switch)
544
+
545
+ DESCRIPTION
546
+ Pull pages from WordPress
547
+
548
+ EXAMPLES
549
+ $ lps page pull
550
+ ```
551
+
552
+ _See code: [src/commands/page/pull.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/page/pull.ts)_
553
+
554
+ ## `lps page push [PATH]`
555
+
556
+ Push pages to WordPress. Local files created or updated remotely are renamed on disk to the `<id>-<slug>` convention.
557
+
558
+ ```
559
+ USAGE
560
+ $ lps page push [PATH] [--env <value>] [-d] [-y]
561
+
562
+ ARGUMENTS
563
+ [PATH] Path to pages directory (overrides project config)
564
+
565
+ FLAGS
566
+ -d, --dry-run Show what would change without making changes
567
+ -y, --yes Answer yes to confirmation prompts
568
+ --env=<value> Target environment by name, overriding the globally active one (lps project switch)
569
+
570
+ DESCRIPTION
571
+ Push pages to WordPress. Local files created or updated remotely are renamed on disk to the `<id>-<slug>` convention.
572
+
573
+ EXAMPLES
574
+ $ lps page push
575
+ ```
576
+
577
+ _See code: [src/commands/page/push.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/page/push.ts)_
479
578
 
480
579
  ## `lps plugin add SLUG`
481
580
 
@@ -501,7 +600,7 @@ EXAMPLES
501
600
  $ lps plugin add contact-form-7 --dry-run
502
601
  ```
503
602
 
504
- _See code: [src/commands/plugin/add.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/plugin/add.ts)_
603
+ _See code: [src/commands/plugin/add.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/plugin/add.ts)_
505
604
 
506
605
  ## `lps plugin pull`
507
606
 
@@ -524,7 +623,7 @@ EXAMPLES
524
623
  $ lps plugin pull --dry-run
525
624
  ```
526
625
 
527
- _See code: [src/commands/plugin/pull.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/plugin/pull.ts)_
626
+ _See code: [src/commands/plugin/pull.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/plugin/pull.ts)_
528
627
 
529
628
  ## `lps plugin push`
530
629
 
@@ -548,7 +647,7 @@ EXAMPLES
548
647
  $ lps plugin push --dry-run
549
648
  ```
550
649
 
551
- _See code: [src/commands/plugin/push.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/plugin/push.ts)_
650
+ _See code: [src/commands/plugin/push.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/plugin/push.ts)_
552
651
 
553
652
  ## `lps project config`
554
653
 
@@ -566,7 +665,7 @@ EXAMPLES
566
665
  $ lps project config
567
666
  ```
568
667
 
569
- _See code: [src/commands/project/config.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/project/config.ts)_
668
+ _See code: [src/commands/project/config.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/project/config.ts)_
570
669
 
571
670
  ## `lps project list`
572
671
 
@@ -583,7 +682,7 @@ EXAMPLES
583
682
  $ lps project list
584
683
  ```
585
684
 
586
- _See code: [src/commands/project/list.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/project/list.ts)_
685
+ _See code: [src/commands/project/list.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/project/list.ts)_
587
686
 
588
687
  ## `lps project pull`
589
688
 
@@ -600,7 +699,7 @@ EXAMPLES
600
699
  $ lps project pull
601
700
  ```
602
701
 
603
- _See code: [src/commands/project/pull.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/project/pull.ts)_
702
+ _See code: [src/commands/project/pull.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/project/pull.ts)_
604
703
 
605
704
  ## `lps project push`
606
705
 
@@ -620,7 +719,7 @@ EXAMPLES
620
719
  $ lps project push
621
720
  ```
622
721
 
623
- _See code: [src/commands/project/push.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/project/push.ts)_
722
+ _See code: [src/commands/project/push.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/project/push.ts)_
624
723
 
625
724
  ## `lps project remove`
626
725
 
@@ -637,7 +736,29 @@ EXAMPLES
637
736
  $ lps project remove
638
737
  ```
639
738
 
640
- _See code: [src/commands/project/remove.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/project/remove.ts)_
739
+ _See code: [src/commands/project/remove.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/project/remove.ts)_
740
+
741
+ ## `lps project rotate`
742
+
743
+ Rotate the WordPress application password for the current (or --env) environment
744
+
745
+ ```
746
+ USAGE
747
+ $ lps project rotate [--env <value>]
748
+
749
+ FLAGS
750
+ --env=<value> Target environment by name, overriding the globally active one (lps project switch)
751
+
752
+ DESCRIPTION
753
+ Rotate the WordPress application password for the current (or --env) environment
754
+
755
+ EXAMPLES
756
+ $ lps project rotate
757
+
758
+ $ lps project rotate --env staging
759
+ ```
760
+
761
+ _See code: [src/commands/project/rotate.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/project/rotate.ts)_
641
762
 
642
763
  ## `lps project switch`
643
764
 
@@ -654,7 +775,7 @@ EXAMPLES
654
775
  $ lps project switch
655
776
  ```
656
777
 
657
- _See code: [src/commands/project/switch.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/project/switch.ts)_
778
+ _See code: [src/commands/project/switch.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/project/switch.ts)_
658
779
 
659
780
  ## `lps seo list`
660
781
 
@@ -678,7 +799,7 @@ EXAMPLES
678
799
  $ lps seo list --post-type post
679
800
  ```
680
801
 
681
- _See code: [src/commands/seo/list.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/seo/list.ts)_
802
+ _See code: [src/commands/seo/list.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/seo/list.ts)_
682
803
 
683
804
  ## `lps seo pull [PATH]`
684
805
 
@@ -706,7 +827,7 @@ EXAMPLES
706
827
  $ lps seo pull --post-type post --post-type page
707
828
  ```
708
829
 
709
- _See code: [src/commands/seo/pull.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/seo/pull.ts)_
830
+ _See code: [src/commands/seo/pull.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/seo/pull.ts)_
710
831
 
711
832
  ## `lps seo push [PATH]`
712
833
 
@@ -732,7 +853,7 @@ EXAMPLES
732
853
  $ lps seo push
733
854
  ```
734
855
 
735
- _See code: [src/commands/seo/push.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/seo/push.ts)_
856
+ _See code: [src/commands/seo/push.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/seo/push.ts)_
736
857
 
737
858
  ## `lps snippet list`
738
859
 
@@ -753,7 +874,7 @@ EXAMPLES
753
874
  $ lps snippet list
754
875
  ```
755
876
 
756
- _See code: [src/commands/snippet/list.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/snippet/list.ts)_
877
+ _See code: [src/commands/snippet/list.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/snippet/list.ts)_
757
878
 
758
879
  ## `lps snippet publish [PATH]`
759
880
 
@@ -776,7 +897,7 @@ EXAMPLES
776
897
  $ lps snippet publish --path ./snippets
777
898
  ```
778
899
 
779
- _See code: [src/commands/snippet/publish.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/snippet/publish.ts)_
900
+ _See code: [src/commands/snippet/publish.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/snippet/publish.ts)_
780
901
 
781
902
  ## `lps snippet pull [PATH]`
782
903
 
@@ -803,7 +924,7 @@ EXAMPLES
803
924
  $ lps snippet pull --path ./snippets
804
925
  ```
805
926
 
806
- _See code: [src/commands/snippet/pull.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/snippet/pull.ts)_
927
+ _See code: [src/commands/snippet/pull.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/snippet/pull.ts)_
807
928
 
808
929
  ## `lps snippet push [PATH]`
809
930
 
@@ -831,7 +952,7 @@ EXAMPLES
831
952
  $ lps snippet push --path ./snippets
832
953
  ```
833
954
 
834
- _See code: [src/commands/snippet/push.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/snippet/push.ts)_
955
+ _See code: [src/commands/snippet/push.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/snippet/push.ts)_
835
956
 
836
957
  ## `lps status`
837
958
 
@@ -853,7 +974,7 @@ EXAMPLES
853
974
  $ lps status --env staging
854
975
  ```
855
976
 
856
- _See code: [src/commands/status.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/status.ts)_
977
+ _See code: [src/commands/status.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/status.ts)_
857
978
 
858
979
  ## `lps telemetry disable`
859
980
 
@@ -870,7 +991,7 @@ EXAMPLES
870
991
  $ lps telemetry disable
871
992
  ```
872
993
 
873
- _See code: [src/commands/telemetry/disable.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/telemetry/disable.ts)_
994
+ _See code: [src/commands/telemetry/disable.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/telemetry/disable.ts)_
874
995
 
875
996
  ## `lps telemetry enable`
876
997
 
@@ -887,5 +1008,5 @@ EXAMPLES
887
1008
  $ lps telemetry enable
888
1009
  ```
889
1010
 
890
- _See code: [src/commands/telemetry/enable.ts](https://github.com/loopress/loopress/blob/v0.19.0/src/commands/telemetry/enable.ts)_
1011
+ _See code: [src/commands/telemetry/enable.ts](https://github.com/loopress/loopress/blob/v0.20.0/src/commands/telemetry/enable.ts)_
891
1012
  <!-- commandsstop -->
@@ -0,0 +1,9 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class Publish extends Command {
3
+ static args: {
4
+ path: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ run(): Promise<void>;
9
+ }
@@ -0,0 +1,60 @@
1
+ import { Args, Command } from '@oclif/core';
2
+ import { basename, join } from 'node:path';
3
+ import { authManager } from '../../config/auth.manager.js';
4
+ import { configManager } from '../../config/project-config.manager.js';
5
+ import { ApiClient } from '../../lib/api-client.js';
6
+ import { loadFiles } from '../../lib/load-files.js';
7
+ import { readLocalConfig } from '../../utils/loopress-config.js';
8
+ // Publishes to the Loopress api (not a WordPress site), so this does not extend
9
+ // `LoopressCommand`/`PushCommand`: those force an environment to be resolved, but publishing
10
+ // for cross-project sharing doesn't need one, same reasoning as `snippet publish`. An API route
11
+ // is a special case of the same publish/deploy rules as snippets and ACF (see
12
+ // obsidian/Product/API and Console Backlog.md, US-18): a `push` (direct to WordPress, this
13
+ // project's own site) and a `publish` (to the cloud, deployable to other projects) are two
14
+ // separate, coexisting paths.
15
+ export default class Publish extends Command {
16
+ static args = {
17
+ path: Args.string({ description: 'Path to api directory (overrides project config)' }),
18
+ };
19
+ static description = 'Publish custom API routes to your Loopress account so they can be deployed to other projects. Does not touch any WordPress site.';
20
+ static examples = ['$ lps api publish', '$ lps api publish --path ./api'];
21
+ async run() {
22
+ const { args } = await this.parse(Publish);
23
+ const token = process.env.LOOPRESS_TOKEN ?? authManager.getAuth()?.token;
24
+ if (!token) {
25
+ this.error('Not logged in. Run `lps login` first.');
26
+ }
27
+ const localConfig = await readLocalConfig();
28
+ const projectId = localConfig.projectId ?? configManager.getCurrentProject()?.id;
29
+ if (!projectId) {
30
+ this.error('No project configured. Run `lps project config` first.');
31
+ }
32
+ const project = configManager.getProject(projectId);
33
+ if (!project) {
34
+ this.error(`Project "${projectId}" (from loopress.json) not found. Run \`lps project config\` to configure it.`);
35
+ }
36
+ if (!project.apiProjectId) {
37
+ this.error(`Project "${project.name}" is not linked to your Loopress account yet. Run \`lps project push\` first.`);
38
+ }
39
+ const path = args.path ?? join(localConfig.rootDir ?? '.', localConfig.apiDir ?? 'api');
40
+ this.log(`Publishing API routes from ${path}`);
41
+ const files = await loadFiles(path, {
42
+ extension: '.php',
43
+ onSkip: (message) => this.warn(message),
44
+ parse: (raw, filePath) => ({ code: raw, filename: basename(filePath, '.php') }),
45
+ });
46
+ const api = new ApiClient(token);
47
+ try {
48
+ await api.post(`projects/${project.apiProjectId}/api-routes/publish/upsert`, {
49
+ routes: files,
50
+ });
51
+ await api.post(`projects/${project.apiProjectId}/api-routes/publish/prune`, {
52
+ filenames: files.map((file) => file.filename),
53
+ });
54
+ }
55
+ catch (error) {
56
+ this.error(error.message);
57
+ }
58
+ this.log(`Published ${files.length} route${files.length === 1 ? '' : 's'} to your Loopress account.`);
59
+ }
60
+ }
@@ -12,4 +12,5 @@ export default class Push extends PushCommand {
12
12
  run(): Promise<void>;
13
13
  private loadFiles;
14
14
  private pushFile;
15
+ private syncApiRoutes;
15
16
  }
@@ -1,6 +1,8 @@
1
1
  import { Args } from '@oclif/core';
2
2
  import { Listr } from 'listr2';
3
3
  import { basename } from 'node:path';
4
+ import { authManager } from '../../config/auth.manager.js';
5
+ import { ApiClient } from '../../lib/api-client.js';
4
6
  import { loadFiles as loadDirectoryFiles } from '../../lib/load-files.js';
5
7
  import { PushCommand } from '../../lib/push-command.js';
6
8
  // Mirrors the server's own allowlist (wordpress-plugin ApiFilesController::FILENAME_PATTERN):
@@ -39,6 +41,7 @@ export default class Push extends PushCommand {
39
41
  if (this.dryRun)
40
42
  return;
41
43
  await this.recordSuccess();
44
+ await this.syncApiRoutes(files.map((file) => file.filename));
42
45
  this.log('All API routes pushed.');
43
46
  }
44
47
  async loadFiles(path) {
@@ -67,4 +70,20 @@ export default class Push extends PushCommand {
67
70
  this.reportTaskFailure(`Failed to push ${file.filename}: ${error.message}`, error, task);
68
71
  }
69
72
  }
73
+ // Best-effort report of the current file list to the Loopress cloud, purely for console
74
+ // visibility (see obsidian/Product/API and Console Backlog.md, US-18): the routes are already
75
+ // live on WordPress by this point, this can never block or fail the push itself, same
76
+ // reasoning as `recordDeployment` in PushCommand.
77
+ async syncApiRoutes(filenames) {
78
+ const token = process.env.LOOPRESS_TOKEN ?? authManager.getAuth()?.token;
79
+ const environmentId = this.siteConfig.apiEnvironmentId;
80
+ if (!token || !environmentId)
81
+ return;
82
+ try {
83
+ await new ApiClient(token).put('api-routes', { environmentId, filenames });
84
+ }
85
+ catch {
86
+ // non-blocking: reporting the route list must never interrupt the push flow
87
+ }
88
+ }
70
89
  }
@@ -16,6 +16,7 @@ const FEATURES = [
16
16
  { dir: 'acf', key: 'acfDir', label: 'ACF' },
17
17
  { dir: 'seo', key: 'seoDir', label: 'SEO' },
18
18
  { dir: 'forms', key: 'formDir', label: 'Forms' },
19
+ { dir: 'pages', key: 'pageDir', label: 'Pages' },
19
20
  { dir: 'api', key: 'apiDir', label: 'Custom API routes' },
20
21
  ];
21
22
  export default class Init extends Command {
@@ -0,0 +1,9 @@
1
+ import { LoopressCommand } from '../../lib/base.js';
2
+ export default class List extends LoopressCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
+ };
8
+ run(): Promise<void>;
9
+ }
@@ -0,0 +1,26 @@
1
+ import { Flags } from '@oclif/core';
2
+ import { LoopressCommand } from '../../lib/base.js';
3
+ import { getPageId, getPageTitle, PAGE_ENDPOINT, PAGE_LIST_QUERY } from '../../utils/page-format.js';
4
+ export default class List extends LoopressCommand {
5
+ static description = 'List pages from WordPress';
6
+ static examples = ['$ lps page list'];
7
+ static flags = {
8
+ json: Flags.boolean({ char: 'j', description: 'Output in JSON format' }),
9
+ };
10
+ async run() {
11
+ const { flags } = await this.parse(List);
12
+ const pages = await this.wp.get(`${PAGE_ENDPOINT}?${PAGE_LIST_QUERY}`);
13
+ if (flags.json) {
14
+ this.log(JSON.stringify(pages, null, 2));
15
+ return;
16
+ }
17
+ this.log(`Pages (${pages.length}):`);
18
+ if (pages.length === 0) {
19
+ this.log(' (none)');
20
+ return;
21
+ }
22
+ for (const page of pages) {
23
+ this.log(` ${getPageId(page) ?? '(no id)'}. ${getPageTitle(page)}`);
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,13 @@
1
+ import { LoopressCommand } from '../../lib/base.js';
2
+ export default class Pull extends LoopressCommand {
3
+ static args: {
4
+ path: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ static flags: {
9
+ yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
+ 'dry-run': import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ };
12
+ run(): Promise<void>;
13
+ }