paymongo-cli 1.4.12 → 1.4.14

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 (51) hide show
  1. package/.gitattributes +2 -0
  2. package/.github/copilot-instructions.md +8 -6
  3. package/AGENTS.md +8 -9
  4. package/CHANGELOG.md +21 -0
  5. package/README.md +3 -3
  6. package/biome.json +72 -0
  7. package/dist/.tsbuildinfo +1 -1
  8. package/dist/commands/config/actions.js +13 -5
  9. package/dist/commands/config/analytics.js +75 -0
  10. package/dist/commands/config/helpers.js +14 -25
  11. package/dist/commands/config/rate-limit.js +3 -3
  12. package/dist/commands/config.js +7 -1
  13. package/dist/commands/dev/logs.js +13 -4
  14. package/dist/commands/dev/status.js +1 -1
  15. package/dist/commands/dev/stop.js +2 -2
  16. package/dist/commands/dev.js +10 -258
  17. package/dist/commands/doctor.js +7 -8
  18. package/dist/commands/env.js +10 -19
  19. package/dist/commands/generate/templates/index.js +3 -3
  20. package/dist/commands/generate.js +7 -7
  21. package/dist/commands/init.js +22 -36
  22. package/dist/commands/login.js +18 -29
  23. package/dist/commands/payments/actions.js +15 -15
  24. package/dist/commands/payments/helpers.js +6 -24
  25. package/dist/commands/payments.js +1 -1
  26. package/dist/commands/shared/auth.js +23 -0
  27. package/dist/commands/shared/runtime.js +35 -0
  28. package/dist/commands/team/index.js +4 -4
  29. package/dist/commands/trigger/actions.js +2 -2
  30. package/dist/commands/trigger/helpers.js +13 -9
  31. package/dist/commands/trigger.js +2 -2
  32. package/dist/commands/webhooks/actions.js +11 -11
  33. package/dist/commands/webhooks/helpers.js +5 -23
  34. package/dist/commands/webhooks.js +1 -1
  35. package/dist/index.js +37 -19
  36. package/dist/services/analytics/service.js +3 -3
  37. package/dist/services/api/client.js +8 -4
  38. package/dist/services/api/rate-limiter.js +3 -2
  39. package/dist/services/config/manager.js +13 -3
  40. package/dist/services/dev/process-manager.js +4 -4
  41. package/dist/services/dev/server.js +7 -8
  42. package/dist/services/dev/session.js +354 -0
  43. package/dist/services/team/service.js +1 -1
  44. package/dist/types/schemas.js +3 -2
  45. package/dist/utils/bulk.js +11 -11
  46. package/dist/utils/cache.js +5 -5
  47. package/dist/utils/constants.js +1 -1
  48. package/dist/utils/webhook-store.js +3 -3
  49. package/package.json +11 -25
  50. package/vitest.config.ts +18 -0
  51. package/eslint.config.ts +0 -70
package/.gitattributes ADDED
@@ -0,0 +1,2 @@
1
+ * text=auto eol=lf
2
+
@@ -48,7 +48,7 @@ import ConfigManager from '../services/config/manager.js';
48
48
 
49
49
  ## Configuration
50
50
  - Project config: `.paymongo` (JSON, managed via `ConfigManager`)
51
- - Global credentials: `~/.paymongo/credentials.enc` (AES-256-CBC encrypted)
51
+ - Global credentials: `~/.paymongo/credentials.enc` (AES-256-GCM encrypted, with legacy AES-256-CBC migration support)
52
52
  - Validation: Zod schemas in `src/types/schemas.ts`
53
53
 
54
54
  ## Development Workflow
@@ -58,18 +58,20 @@ import ConfigManager from '../services/config/manager.js';
58
58
  npm run build # Compile TypeScript
59
59
  npm run dev # Watch mode compilation
60
60
  npm link # Test CLI globally as 'paymongo'
61
- npm test # Jest with ESM (--experimental-vm-modules)
62
- npm run lint:fix # ESLint auto-fix
61
+ npm test # Vitest
62
+ npm run lint:fix # Biome auto-fix
63
63
  ```
64
64
 
65
65
  ### Testing Strategy
66
- - **Mocking ESM**: Use `jest.unstable_mockModule()` before dynamic imports
66
+ - **Framework**: Vitest
67
67
  - Structure: `tests/unit/`, `tests/integration/`
68
- - Mock external services (axios, ngrok, filesystem)
68
+ - Mock external services (undici, ngrok, filesystem)
69
69
 
70
70
  Example test pattern:
71
71
  ```typescript
72
- jest.unstable_mockModule('axios', () => ({ default: mockAxios }));
72
+ import { vi } from 'vitest';
73
+
74
+ vi.mock('undici', () => ({ request: mockRequest }));
73
75
  const { ApiClient } = await import('../../src/services/api/client.js');
74
76
  ```
75
77
 
package/AGENTS.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  PayMongo CLI is a developer-first command-line tool for PayMongo payment integration with local webhook forwarding. It uses **ESM modules** with Commander.js for CLI commands and provides a terminal-first interface.
6
6
 
7
- **Tech Stack**: TypeScript, Node.js 20+, Commander.js, built-in `http`, `undici`, ngrok, Zod, Jest
7
+ **Tech Stack**: TypeScript, Node.js 20+, Commander.js, built-in `http`, `undici`, ngrok, Zod, Vitest
8
8
 
9
9
  ---
10
10
 
@@ -22,11 +22,11 @@ npm link # Test CLI globally during development
22
22
  ### Quality Assurance
23
23
 
24
24
  ```bash
25
- npm run lint # ESLint check
26
- npm run lint:fix # Auto-fix ESLint issues
27
- npm run format # Prettier formatting
25
+ npm run lint # Biome check
26
+ npm run lint:fix # Auto-fix lint issues with Biome
27
+ npm run format # Biome formatting
28
28
  npm run test # Run all tests
29
- npm run test:watch # Jest watch mode
29
+ npm run test:watch # Vitest watch mode
30
30
  npm run benchmark # Performance benchmarking
31
31
  ```
32
32
 
@@ -54,7 +54,7 @@ npm run test -- tests/unit/
54
54
  - **Strict mode**: Enabled with all strict checks
55
55
  - **Module resolution**: NodeNext (ESM)
56
56
  - **Imports**: Use `.js` extension for local imports (required for ESM)
57
- - **Declarations**: Generate `.d.ts` files for npm publishing
57
+ - **Declarations**: Currently disabled in `tsconfig.json` for build output
58
58
 
59
59
  ### Import/Export Patterns
60
60
 
@@ -329,9 +329,8 @@ Use the provided `.github/PULL_REQUEST_TEMPLATE.md` which includes:
329
329
  ### VS Code Extensions
330
330
 
331
331
  - TypeScript and JavaScript Language Features
332
- - ESLint
333
- - Prettier - Code formatter
334
- - Jest Runner
332
+ - Biome
333
+ - Vitest
335
334
 
336
335
  ### EditorConfig
337
336
 
package/CHANGELOG.md CHANGED
@@ -7,6 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.4.13] - 2026-04-06
11
+
12
+ ### Added
13
+
14
+ - **Analytics Config Commands** - Added `paymongo config analytics enable`, `disable`, and `status` to manage local webhook analytics directly from the CLI.
15
+ - **Shared Command Runtime** - Introduced shared command runtime helpers for config loading, API client creation, auth validation, and consistent command failure handling.
16
+ - **Dev Session Service** - Added a dedicated dev session service to own dev-mode startup, shutdown, webhook registration, and tunnel orchestration outside the command layer.
17
+
18
+ ### Changed
19
+
20
+ - **Test Runner** - Replaced Jest with Vitest and migrated the CLI test suite to the new runner.
21
+ - **Linting and Formatting** - Replaced ESLint and Prettier with Biome for linting, formatting, and import organization.
22
+ - **Dev Command Architecture** - Refactored `paymongo dev` so the command is a thinner CLI adapter around centralized session orchestration.
23
+ - **Global Runtime Wiring** - Wired the global `--no-rate-limit` flag through the shared runtime so API client behavior matches the CLI option.
24
+
25
+ ### Fixed
26
+
27
+ - **Documentation Drift** - Aligned the README and command surface around analytics configuration and current tooling.
28
+ - **Detached Dev Startup** - Updated detached dev mode to reuse the active CLI entrypoint instead of depending on a hardcoded compiled path.
29
+ - **CLI Test Stability** - Tightened test lifecycle handling and ESM module isolation to keep the Vitest suite reliable.
30
+
10
31
  ## [1.4.12] - 2026-03-08
11
32
 
12
33
  ### Added
package/README.md CHANGED
@@ -121,9 +121,9 @@ paymongo config rate-limit disable
121
121
 
122
122
  Use `--no-rate-limit` with any command to temporarily disable rate limiting:
123
123
 
124
- ````bash
124
+ ```bash
125
125
  paymongo payments list --no-rate-limit
126
- ---
126
+ ```
127
127
 
128
128
  ## Analytics (Optional)
129
129
 
@@ -147,7 +147,7 @@ paymongo config analytics status
147
147
 
148
148
  # Disable analytics (default)
149
149
  paymongo config analytics disable
150
- ````
150
+ ```
151
151
 
152
152
  ### Analytics Features
153
153
 
package/biome.json ADDED
@@ -0,0 +1,72 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/2.4.10/schema.json",
3
+ "vcs": {
4
+ "enabled": true,
5
+ "clientKind": "git",
6
+ "useIgnoreFile": true
7
+ },
8
+ "files": {
9
+ "includes": ["**", "!!**/dist", "!!coverage", "!!node_modules"]
10
+ },
11
+ "formatter": {
12
+ "enabled": true,
13
+ "formatWithErrors": false,
14
+ "indentStyle": "space",
15
+ "indentWidth": 2,
16
+ "lineEnding": "lf",
17
+ "lineWidth": 100,
18
+ "attributePosition": "auto",
19
+ "bracketSameLine": false,
20
+ "bracketSpacing": true,
21
+ "expand": "auto",
22
+ "useEditorconfig": true
23
+ },
24
+ "linter": {
25
+ "enabled": true,
26
+ "rules": {
27
+ "recommended": true,
28
+ "complexity": {
29
+ "noStaticOnlyClass": "off"
30
+ }
31
+ }
32
+ },
33
+ "overrides": [
34
+ {
35
+ "includes": ["tests/**/*.ts"],
36
+ "linter": {
37
+ "rules": {
38
+ "suspicious": {
39
+ "noExplicitAny": "off"
40
+ }
41
+ }
42
+ }
43
+ }
44
+ ],
45
+ "javascript": {
46
+ "formatter": {
47
+ "jsxQuoteStyle": "double",
48
+ "quoteProperties": "asNeeded",
49
+ "trailingCommas": "es5",
50
+ "semicolons": "always",
51
+ "arrowParentheses": "always",
52
+ "bracketSameLine": false,
53
+ "quoteStyle": "single",
54
+ "attributePosition": "auto",
55
+ "bracketSpacing": true
56
+ }
57
+ },
58
+ "html": {
59
+ "formatter": {
60
+ "indentScriptAndStyle": false,
61
+ "selfCloseVoidElements": "always"
62
+ }
63
+ },
64
+ "assist": {
65
+ "enabled": true,
66
+ "actions": {
67
+ "source": {
68
+ "organizeImports": "on"
69
+ }
70
+ }
71
+ }
72
+ }