paymongo-cli 1.4.7 → 1.4.8

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.
package/AGENTS.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  ## Project Overview
4
4
 
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 both terminal and web-based interfaces.
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 18+, Express, Socket.io, ngrok, Axios, Zod, Winston, Jest
7
+ **Tech Stack**: TypeScript, Node.js 20+, Commander.js, built-in `http`, `undici`, ngrok, Zod, Jest
8
8
 
9
9
  ---
10
10
 
@@ -134,8 +134,10 @@ src/
134
134
  ├── services/ # Business logic
135
135
  │ ├── api/ # PayMongo API client
136
136
  │ ├── config/ # Configuration management
137
- │ ├── web/ # Express + Socket.io server
138
- └── github/ # GitHub integration
137
+ │ ├── dev/ # Local dev server + process management
138
+ ├── analytics/ # Local webhook analytics
139
+ │ ├── payments/ # Payment simulation helpers
140
+ │ └── team/ # Team key-sharing workflows
139
141
  ├── types/ # TypeScript definitions + Zod schemas
140
142
  ├── utils/ # Shared utilities
141
143
  └── index.ts # CLI entry point
@@ -174,8 +176,8 @@ tests/
174
176
  Use `jest.unstable_mockModule()` before dynamic imports:
175
177
 
176
178
  ```typescript
177
- jest.unstable_mockModule('axios', () => ({
178
- default: mockAxios,
179
+ jest.unstable_mockModule('undici', () => ({
180
+ request: mockRequest,
179
181
  }));
180
182
 
181
183
  const { ApiClient } = await import('../../src/services/api/client.js');
package/CHANGELOG.md CHANGED
@@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.4.8] - 2026-03-08
11
+
12
+ ### Changed
13
+
14
+ - **Command Modularization** - Refactored the large `config`, `payments`, `webhooks`, and `trigger` command files into focused helper/action modules to improve maintainability and make future changes safer.
15
+ - **Test Execution** - Reworked CLI entry/config integration tests to avoid subprocess spawning in restricted environments while preserving end-to-end behavior checks.
16
+ - **Documentation Alignment** - Updated README, installation, user guide, troubleshooting, testing, and contributor guidance to match the current Node 20+ runtime, `undici` network layer, ngrok token handling, and local team key-sharing workflow.
17
+
18
+ ### Fixed
19
+
20
+ - **Config Validation Drift** - Added `rateLimiting` to the Zod configuration schema so runtime validation matches the declared config type and command behavior.
21
+ - **CLI Test Reliability** - Eliminated environment-specific `EPERM` failures in spawn-based tests by switching to sandbox-friendly execution patterns.
22
+ - **Release Metadata** - Synchronized package metadata by updating the npm package version and lockfile version fields to the current release line.
23
+
24
+ ### Security
25
+
26
+ - **Webhook Verification Defaults** - New configs now enable webhook signature verification by default, and the dev server now rejects requests when verification is enabled but no webhook secret is configured.
27
+ - **Secret Messaging** - Clarified CLI messaging around webhook secret storage to describe the actual `.paymongo` storage location.
28
+
10
29
  ## [1.4.7] - 2026-02-27
11
30
 
12
31
  ### Changed
package/README.md CHANGED
@@ -17,10 +17,10 @@ PayMongo CLI is the official-feel command-line tool designed to streamline your
17
17
  - **Payment Testing**: Create and monitor payment intents and payments directly from your terminal.
18
18
  - **Real-time Monitoring**: Watch webhook events as they happen with formatted terminal logs.
19
19
  - **Privacy-First Analytics**: Optional local webhook event tracking to improve your development workflow (opt-in only).
20
- - **Team Collaboration**: Sync configurations across your team using GitHub integration.
20
+ - **Team Collaboration**: Share API key bundles with teammates for test/live environments.
21
21
  - **Bulk Operations**: Import/export payments and webhooks for easy migration between environments.
22
22
  - **Rate Limiting Protection**: Built-in API abuse prevention with configurable limits and automatic backoff.
23
- - **Secure Management**: Encrypted storage for your API keys.
23
+ - **Secure Management**: Local credential encryption for stored login sessions.
24
24
 
25
25
  ---
26
26
 
@@ -43,10 +43,12 @@ To use the `dev` server with webhook forwarding, you need an ngrok authtoken:
43
43
 
44
44
  1. Sign up at [ngrok.com](https://ngrok.com)
45
45
  2. Copy your authtoken from the [ngrok dashboard](https://dashboard.ngrok.com/get-started/your-authtoken)
46
- 3. Configure it in the CLI:
46
+ 3. Configure it via environment variable or pass it at runtime:
47
47
 
48
48
  ```bash
49
- paymongo config set ngrok.authtoken YOUR_AUTHTOKEN
49
+ export NGROK_AUTHTOKEN=YOUR_AUTHTOKEN
50
+ # or
51
+ paymongo dev --ngrok-token YOUR_AUTHTOKEN
50
52
  ```
51
53
 
52
54
  ---
@@ -168,7 +170,7 @@ Analytics data helps you:
168
170
  | `paymongo config` | View and modify CLI configuration. |
169
171
  | `paymongo config analytics` | Configure webhook analytics settings. |
170
172
  | `paymongo config rate-limit` | Configure rate limiting settings. |
171
- | `paymongo team` | Sync configurations with your team via GitHub. |
173
+ | `paymongo team` | Share API key bundles with your team. |
172
174
  | `paymongo trigger` | Simulate webhook events locally for testing. |
173
175
 
174
176
  > Use `paymongo <command> --help` for detailed information on any command.
package/TESTING.md CHANGED
@@ -4,12 +4,12 @@
4
4
 
5
5
  This document tracks the progress of improving test coverage for the PayMongo CLI project from the initial ~12% to the target 80-85%.
6
6
 
7
- ## Current Status (2026-01-25)
7
+ ## Current Status (2026-03-08)
8
8
 
9
- - **Overall Coverage**: ~65-70% statements (estimated post-all command testing completion)
9
+ - **Overall Coverage**: strong command and service coverage with full green suite
10
10
  - **Target**: ≥80% statements/branches/functions/lines
11
11
  - **Progress**: API client, init command, config command, login command, dev command, env command, trigger command, webhooks command, CLI entry point, and payments command testing completed
12
- - **Total Tests**: 380 passing tests across 23 test suites
12
+ - **Total Tests**: 459 passing tests across 29 test suites
13
13
 
14
14
  ## Completed Work
15
15
 
@@ -79,9 +79,8 @@ This document tracks the progress of improving test coverage for the PayMongo CL
79
79
  - Resolved testing challenges: crypto timingSafeEqual mocking, HTTP request/response simulation, ESM module mocking for complex dependencies
80
80
 
81
81
  - **CLI Entry Point Testing**: ✅ **COMPLETED**
82
- - Created integration tests in `tests/unit/index.test.ts` with 3 test cases
83
82
  - Tests verify CLI initialization, help display, version information, and error handling
84
- - Uses subprocess spawning to test actual CLI behavior rather than complex module mocking
83
+ - Uses in-process execution instead of subprocess spawning for sandbox-friendly test runs
85
84
 
86
85
  - **Payments Command Testing**: ✅ **COMPLETED**
87
86
  - Created comprehensive test file `tests/unit/payments-command.test.ts` with 20 test cases achieving 100% coverage
@@ -195,7 +194,7 @@ This document tracks the progress of improving test coverage for the PayMongo CL
195
194
 
196
195
  1. **ESM Mocking Complexity**: Required careful setup of `jest.unstable_mockModule()` for modern ES modules
197
196
  2. **Interceptor Testing**: Needed to test interceptor functions directly rather than through full API calls
198
- 3. **Error Handler Mocking**: Complex to mock axios.isAxiosError in interceptor context
197
+ 3. **Network Layer Mocking**: `undici` request/response behavior requires careful ESM mocking
199
198
  4. **Commander.js Testing**: Resolved by extracting command action logic to separate exported function for direct testing
200
199
  5. **Console Mocking**: Required global.console usage for reliable spy functionality across test suites
201
200
  6. **ESM Module Resolution**: Fixed import path issues in tests by using '../../src/' prefix for consistency
@@ -219,4 +218,4 @@ This document tracks the progress of improving test coverage for the PayMongo CL
219
218
 
220
219
  ---
221
220
 
222
- _Last updated: 2026-01-25_
221
+ _Last updated: 2026-03-08_