@loopress/cli 0.12.0 → 0.14.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 (49) hide show
  1. package/README.md +88 -29
  2. package/dist/commands/init.js +5 -5
  3. package/dist/commands/login.d.ts +0 -1
  4. package/dist/commands/login.js +21 -90
  5. package/dist/commands/plugin/add.d.ts +0 -2
  6. package/dist/commands/plugin/add.js +6 -47
  7. package/dist/commands/plugin/pull.js +4 -6
  8. package/dist/commands/plugin/push.d.ts +1 -2
  9. package/dist/commands/plugin/push.js +18 -50
  10. package/dist/commands/project/config.d.ts +2 -0
  11. package/dist/commands/project/config.js +45 -11
  12. package/dist/commands/snippet/publish.d.ts +10 -0
  13. package/dist/commands/snippet/publish.js +74 -0
  14. package/dist/commands/snippet/push.js +5 -70
  15. package/dist/commands/status.js +6 -2
  16. package/dist/commands/telemetry/disable.d.ts +6 -0
  17. package/dist/commands/telemetry/disable.js +14 -0
  18. package/dist/commands/telemetry/enable.d.ts +6 -0
  19. package/dist/commands/telemetry/enable.js +14 -0
  20. package/dist/config/auth.manager.d.ts +4 -2
  21. package/dist/config/auth.manager.js +15 -5
  22. package/dist/config/project-config.manager.d.ts +7 -2
  23. package/dist/config/project-config.manager.js +35 -6
  24. package/dist/hooks/finally.js +11 -2
  25. package/dist/hooks/init.js +8 -16
  26. package/dist/lib/load-snippets.d.ts +2 -0
  27. package/dist/lib/load-snippets.js +84 -0
  28. package/dist/lib/local-callback-server.d.ts +25 -0
  29. package/dist/lib/local-callback-server.js +103 -0
  30. package/dist/lib/open-browser.d.ts +2 -0
  31. package/dist/lib/open-browser.js +5 -0
  32. package/dist/lib/sentry.d.ts +0 -1
  33. package/dist/lib/sentry.js +6 -8
  34. package/dist/lib/wp-authorize-flow.d.ts +22 -0
  35. package/dist/lib/wp-authorize-flow.js +60 -0
  36. package/dist/lib/wp-client.d.ts +1 -1
  37. package/dist/lib/wp-client.js +1 -1
  38. package/dist/lib/wp-site-diagnostic.d.ts +13 -0
  39. package/dist/lib/wp-site-diagnostic.js +46 -0
  40. package/dist/types/config.d.ts +1 -1
  41. package/dist/types/global-config.generated.d.ts +11 -1
  42. package/dist/types/plugin.d.ts +4 -5
  43. package/dist/types/project-config.generated.d.ts +1 -4
  44. package/dist/utils/plugins.d.ts +3 -7
  45. package/dist/utils/plugins.js +27 -13
  46. package/oclif.manifest.json +163 -90
  47. package/package.json +7 -2
  48. package/schemas/global-config.schema.json +17 -1
  49. package/schemas/project-config.schema.json +3 -4
@@ -193,16 +193,11 @@
193
193
  "description": "Plugin slug on WordPress.org",
194
194
  "name": "slug",
195
195
  "required": true
196
- },
197
- "version": {
198
- "description": "Version to pin (default: latest)",
199
- "name": "version"
200
196
  }
201
197
  },
202
198
  "description": "Add a WordPress.org plugin to loopress.json",
203
199
  "examples": [
204
200
  "$ lps plugin add woocommerce",
205
- "$ lps plugin add woocommerce 8.9.1",
206
201
  "$ lps plugin add contact-form-7 --dry-run"
207
202
  ],
208
203
  "flags": {
@@ -311,6 +306,126 @@
311
306
  "push.js"
312
307
  ]
313
308
  },
309
+ "project:config": {
310
+ "aliases": [],
311
+ "args": {},
312
+ "description": "Add or update a WordPress project environment. By default, authorizes via WordPress in your browser; manual username/Application Password entry is available as a fallback.",
313
+ "examples": [
314
+ "$ lps project config"
315
+ ],
316
+ "flags": {},
317
+ "hasDynamicHelp": false,
318
+ "hiddenAliases": [],
319
+ "id": "project:config",
320
+ "pluginAlias": "@loopress/cli",
321
+ "pluginName": "@loopress/cli",
322
+ "pluginType": "core",
323
+ "strict": true,
324
+ "enableJsonFlag": false,
325
+ "isESM": true,
326
+ "relativePath": [
327
+ "dist",
328
+ "commands",
329
+ "project",
330
+ "config.js"
331
+ ]
332
+ },
333
+ "project:list": {
334
+ "aliases": [],
335
+ "args": {},
336
+ "description": "List configured WordPress projects",
337
+ "examples": [
338
+ "$ lps project list"
339
+ ],
340
+ "flags": {},
341
+ "hasDynamicHelp": false,
342
+ "hiddenAliases": [],
343
+ "id": "project:list",
344
+ "pluginAlias": "@loopress/cli",
345
+ "pluginName": "@loopress/cli",
346
+ "pluginType": "core",
347
+ "strict": true,
348
+ "enableJsonFlag": false,
349
+ "isESM": true,
350
+ "relativePath": [
351
+ "dist",
352
+ "commands",
353
+ "project",
354
+ "list.js"
355
+ ]
356
+ },
357
+ "project:remove": {
358
+ "aliases": [],
359
+ "args": {},
360
+ "description": "Remove one or more WordPress projects or environments",
361
+ "examples": [
362
+ "$ lps project remove"
363
+ ],
364
+ "flags": {},
365
+ "hasDynamicHelp": false,
366
+ "hiddenAliases": [],
367
+ "id": "project:remove",
368
+ "pluginAlias": "@loopress/cli",
369
+ "pluginName": "@loopress/cli",
370
+ "pluginType": "core",
371
+ "strict": true,
372
+ "enableJsonFlag": false,
373
+ "isESM": true,
374
+ "relativePath": [
375
+ "dist",
376
+ "commands",
377
+ "project",
378
+ "remove.js"
379
+ ]
380
+ },
381
+ "project:switch": {
382
+ "aliases": [],
383
+ "args": {},
384
+ "description": "Switch the active project and environment",
385
+ "examples": [
386
+ "$ lps project switch"
387
+ ],
388
+ "flags": {},
389
+ "hasDynamicHelp": false,
390
+ "hiddenAliases": [],
391
+ "id": "project:switch",
392
+ "pluginAlias": "@loopress/cli",
393
+ "pluginName": "@loopress/cli",
394
+ "pluginType": "core",
395
+ "strict": true,
396
+ "enableJsonFlag": false,
397
+ "isESM": true,
398
+ "relativePath": [
399
+ "dist",
400
+ "commands",
401
+ "project",
402
+ "switch.js"
403
+ ]
404
+ },
405
+ "project:sync": {
406
+ "aliases": [],
407
+ "args": {},
408
+ "description": "Sync locally configured projects and environments with your Loopress account",
409
+ "examples": [
410
+ "$ lps project sync"
411
+ ],
412
+ "flags": {},
413
+ "hasDynamicHelp": false,
414
+ "hiddenAliases": [],
415
+ "id": "project:sync",
416
+ "pluginAlias": "@loopress/cli",
417
+ "pluginName": "@loopress/cli",
418
+ "pluginType": "core",
419
+ "strict": true,
420
+ "enableJsonFlag": false,
421
+ "isESM": true,
422
+ "relativePath": [
423
+ "dist",
424
+ "commands",
425
+ "project",
426
+ "sync.js"
427
+ ]
428
+ },
314
429
  "snippet:list": {
315
430
  "aliases": [],
316
431
  "args": {},
@@ -351,6 +466,36 @@
351
466
  "list.js"
352
467
  ]
353
468
  },
469
+ "snippet:publish": {
470
+ "aliases": [],
471
+ "args": {
472
+ "path": {
473
+ "description": "Path to snippets directory (overrides project config)",
474
+ "name": "path"
475
+ }
476
+ },
477
+ "description": "Publish snippets to your Loopress account so they can be deployed to other projects. Does not touch any WordPress site.",
478
+ "examples": [
479
+ "$ lps snippet publish",
480
+ "$ lps snippet publish --path ./snippets"
481
+ ],
482
+ "flags": {},
483
+ "hasDynamicHelp": false,
484
+ "hiddenAliases": [],
485
+ "id": "snippet:publish",
486
+ "pluginAlias": "@loopress/cli",
487
+ "pluginName": "@loopress/cli",
488
+ "pluginType": "core",
489
+ "strict": true,
490
+ "enableJsonFlag": false,
491
+ "isESM": true,
492
+ "relativePath": [
493
+ "dist",
494
+ "commands",
495
+ "snippet",
496
+ "publish.js"
497
+ ]
498
+ },
354
499
  "snippet:pull": {
355
500
  "aliases": [],
356
501
  "args": {
@@ -434,17 +579,17 @@
434
579
  "push.js"
435
580
  ]
436
581
  },
437
- "project:config": {
582
+ "telemetry:disable": {
438
583
  "aliases": [],
439
584
  "args": {},
440
- "description": "Add or update a WordPress project environment",
585
+ "description": "Disable error reporting to Sentry",
441
586
  "examples": [
442
- "$ lps project config"
587
+ "$ lps telemetry disable"
443
588
  ],
444
589
  "flags": {},
445
590
  "hasDynamicHelp": false,
446
591
  "hiddenAliases": [],
447
- "id": "project:config",
592
+ "id": "telemetry:disable",
448
593
  "pluginAlias": "@loopress/cli",
449
594
  "pluginName": "@loopress/cli",
450
595
  "pluginType": "core",
@@ -454,21 +599,21 @@
454
599
  "relativePath": [
455
600
  "dist",
456
601
  "commands",
457
- "project",
458
- "config.js"
602
+ "telemetry",
603
+ "disable.js"
459
604
  ]
460
605
  },
461
- "project:list": {
606
+ "telemetry:enable": {
462
607
  "aliases": [],
463
608
  "args": {},
464
- "description": "List configured WordPress projects",
609
+ "description": "Enable error reporting to Sentry",
465
610
  "examples": [
466
- "$ lps project list"
611
+ "$ lps telemetry enable"
467
612
  ],
468
613
  "flags": {},
469
614
  "hasDynamicHelp": false,
470
615
  "hiddenAliases": [],
471
- "id": "project:list",
616
+ "id": "telemetry:enable",
472
617
  "pluginAlias": "@loopress/cli",
473
618
  "pluginName": "@loopress/cli",
474
619
  "pluginType": "core",
@@ -478,82 +623,10 @@
478
623
  "relativePath": [
479
624
  "dist",
480
625
  "commands",
481
- "project",
482
- "list.js"
483
- ]
484
- },
485
- "project:remove": {
486
- "aliases": [],
487
- "args": {},
488
- "description": "Remove one or more WordPress projects or environments",
489
- "examples": [
490
- "$ lps project remove"
491
- ],
492
- "flags": {},
493
- "hasDynamicHelp": false,
494
- "hiddenAliases": [],
495
- "id": "project:remove",
496
- "pluginAlias": "@loopress/cli",
497
- "pluginName": "@loopress/cli",
498
- "pluginType": "core",
499
- "strict": true,
500
- "enableJsonFlag": false,
501
- "isESM": true,
502
- "relativePath": [
503
- "dist",
504
- "commands",
505
- "project",
506
- "remove.js"
507
- ]
508
- },
509
- "project:switch": {
510
- "aliases": [],
511
- "args": {},
512
- "description": "Switch the active project and environment",
513
- "examples": [
514
- "$ lps project switch"
515
- ],
516
- "flags": {},
517
- "hasDynamicHelp": false,
518
- "hiddenAliases": [],
519
- "id": "project:switch",
520
- "pluginAlias": "@loopress/cli",
521
- "pluginName": "@loopress/cli",
522
- "pluginType": "core",
523
- "strict": true,
524
- "enableJsonFlag": false,
525
- "isESM": true,
526
- "relativePath": [
527
- "dist",
528
- "commands",
529
- "project",
530
- "switch.js"
531
- ]
532
- },
533
- "project:sync": {
534
- "aliases": [],
535
- "args": {},
536
- "description": "Sync locally configured projects and environments with your Loopress account",
537
- "examples": [
538
- "$ lps project sync"
539
- ],
540
- "flags": {},
541
- "hasDynamicHelp": false,
542
- "hiddenAliases": [],
543
- "id": "project:sync",
544
- "pluginAlias": "@loopress/cli",
545
- "pluginName": "@loopress/cli",
546
- "pluginType": "core",
547
- "strict": true,
548
- "enableJsonFlag": false,
549
- "isESM": true,
550
- "relativePath": [
551
- "dist",
552
- "commands",
553
- "project",
554
- "sync.js"
626
+ "telemetry",
627
+ "enable.js"
555
628
  ]
556
629
  }
557
630
  },
558
- "version": "0.12.0"
631
+ "version": "0.14.0"
559
632
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@loopress/cli",
3
3
  "description": "CLI tool for syncing WordPress code snippets, plugins, and Composer dependencies via the REST API",
4
- "version": "0.12.0",
4
+ "version": "0.14.0",
5
5
  "author": "jean-smaug",
6
6
  "bin": {
7
7
  "loopress": "bin/run.js",
@@ -19,6 +19,7 @@
19
19
  "glob": "13.0.6",
20
20
  "got": "^15.0.7",
21
21
  "listr2": "^10.2.2",
22
+ "open": "^10.2.0",
22
23
  "slugify": "^1.6.9",
23
24
  "write-file-atomic": "^5.0.1"
24
25
  },
@@ -94,6 +95,9 @@
94
95
  },
95
96
  "snippet": {
96
97
  "description": "Manage WordPress code snippets"
98
+ },
99
+ "telemetry": {
100
+ "description": "Manage error reporting preferences"
97
101
  }
98
102
  }
99
103
  },
@@ -109,6 +113,7 @@
109
113
  "prewatch": "pnpm run schema:types",
110
114
  "watch": "tsc -b --watch",
111
115
  "build": "shx rm -rf dist && pnpm run schema:types && tsc -b",
116
+ "prelint": "pnpm run schema:types",
112
117
  "lint": "eslint",
113
118
  "pretest": "pnpm run schema:types",
114
119
  "posttest": "pnpm run lint",
@@ -116,7 +121,7 @@
116
121
  "test": "vitest run",
117
122
  "pretest:mutation": "pnpm run schema:types",
118
123
  "test:mutation": "stryker run",
119
- "version": "oclif readme && git add README.md",
124
+ "version": "oclif manifest && oclif readme && git add README.md oclif.manifest.json",
120
125
  "format": "prettier . --write"
121
126
  }
122
127
  }
@@ -2,7 +2,7 @@
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
3
  "$id": "https://loopress.dev/schema/global-config.json",
4
4
  "title": "Loopress global configuration",
5
- "description": "Global CLI state stored at ~/.loopress/config.json: known projects, their environments, and which one is currently active.",
5
+ "description": "Global CLI state stored at $XDG_CONFIG_HOME/loopress/config.json (or ~/.config/loopress/config.json): known projects, their environments, and which one is currently active.",
6
6
  "type": "object",
7
7
  "additionalProperties": false,
8
8
  "required": ["currentProject", "projects"],
@@ -15,6 +15,10 @@
15
15
  "type": "object",
16
16
  "description": "Known projects, keyed by project id.",
17
17
  "additionalProperties": {"$ref": "#/definitions/ProjectConfig"}
18
+ },
19
+ "telemetry": {
20
+ "description": "User preferences for error reporting, set via `lps telemetry disable`/`lps telemetry enable`.",
21
+ "$ref": "#/definitions/TelemetryConfig"
18
22
  }
19
23
  },
20
24
  "definitions": {
@@ -59,6 +63,18 @@
59
63
  }
60
64
  }
61
65
  },
66
+ "TelemetryConfig": {
67
+ "title": "TelemetryConfig",
68
+ "type": "object",
69
+ "additionalProperties": false,
70
+ "required": ["disabled"],
71
+ "properties": {
72
+ "disabled": {
73
+ "type": "boolean",
74
+ "description": "Whether error reporting to Sentry is disabled."
75
+ }
76
+ }
77
+ },
62
78
  "EnvironmentConfig": {
63
79
  "title": "EnvironmentConfig",
64
80
  "type": "object",
@@ -25,15 +25,14 @@
25
25
  },
26
26
  "plugins": {
27
27
  "type": "object",
28
- "description": "Pinned plugin versions. Keys are WordPress.org plugin slugs, values are version constraints.",
28
+ "description": "WordPress.org plugins managed by Loopress. Keys are plugin slugs; values are written as \"latest\" since installs go through WordPress's native plugin API, which only installs the current version. Older files may still have a pinned version string here from before this was the case; it is read but no longer acted on.",
29
29
  "additionalProperties": {
30
30
  "type": "string",
31
- "description": "Version to pin. Use an exact version (e.g. \"8.9.1\") or \"latest\".",
32
- "examples": ["8.9.1", "latest"]
31
+ "examples": ["latest"]
33
32
  },
34
33
  "examples": [
35
34
  {
36
- "woocommerce": "8.9.1",
35
+ "woocommerce": "latest",
37
36
  "contact-form-7": "latest"
38
37
  }
39
38
  ]