paymongo-cli 1.0.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 (107) hide show
  1. package/.github/ISSUE_TEMPLATE/bug-report.md +33 -0
  2. package/.github/PULL_REQUEST_TEMPLATE.md +30 -0
  3. package/.github/workflows/ci-cd.yml +88 -0
  4. package/.github/workflows/ci.yml +46 -0
  5. package/.github/workflows/release.yml +54 -0
  6. package/LICENSE +21 -0
  7. package/README.md +113 -0
  8. package/bin/paymongo.js +3 -0
  9. package/dist/.tsbuildinfo +1 -0
  10. package/dist/commands/config.d.ts +4 -0
  11. package/dist/commands/config.d.ts.map +1 -0
  12. package/dist/commands/config.js +398 -0
  13. package/dist/commands/config.js.map +1 -0
  14. package/dist/commands/dev.d.ts +4 -0
  15. package/dist/commands/dev.d.ts.map +1 -0
  16. package/dist/commands/dev.js +353 -0
  17. package/dist/commands/dev.js.map +1 -0
  18. package/dist/commands/gui.d.ts +4 -0
  19. package/dist/commands/gui.d.ts.map +1 -0
  20. package/dist/commands/gui.js +74 -0
  21. package/dist/commands/gui.js.map +1 -0
  22. package/dist/commands/init.d.ts +4 -0
  23. package/dist/commands/init.d.ts.map +1 -0
  24. package/dist/commands/init.js +268 -0
  25. package/dist/commands/init.js.map +1 -0
  26. package/dist/commands/login.d.ts +4 -0
  27. package/dist/commands/login.d.ts.map +1 -0
  28. package/dist/commands/login.js +287 -0
  29. package/dist/commands/login.js.map +1 -0
  30. package/dist/commands/payments.d.ts +4 -0
  31. package/dist/commands/payments.d.ts.map +1 -0
  32. package/dist/commands/payments.js +180 -0
  33. package/dist/commands/payments.js.map +1 -0
  34. package/dist/commands/team/index.d.ts +4 -0
  35. package/dist/commands/team/index.d.ts.map +1 -0
  36. package/dist/commands/team/index.js +155 -0
  37. package/dist/commands/team/index.js.map +1 -0
  38. package/dist/commands/trigger.d.ts +4 -0
  39. package/dist/commands/trigger.d.ts.map +1 -0
  40. package/dist/commands/trigger.js +312 -0
  41. package/dist/commands/trigger.js.map +1 -0
  42. package/dist/commands/webhooks.d.ts +4 -0
  43. package/dist/commands/webhooks.d.ts.map +1 -0
  44. package/dist/commands/webhooks.js +357 -0
  45. package/dist/commands/webhooks.js.map +1 -0
  46. package/dist/index.d.ts +3 -0
  47. package/dist/index.d.ts.map +1 -0
  48. package/dist/index.js +61 -0
  49. package/dist/index.js.map +1 -0
  50. package/dist/services/analytics/service.d.ts +29 -0
  51. package/dist/services/analytics/service.d.ts.map +1 -0
  52. package/dist/services/analytics/service.js +97 -0
  53. package/dist/services/analytics/service.js.map +1 -0
  54. package/dist/services/api/client.d.ts +27 -0
  55. package/dist/services/api/client.d.ts.map +1 -0
  56. package/dist/services/api/client.js +151 -0
  57. package/dist/services/api/client.js.map +1 -0
  58. package/dist/services/config/manager.d.ts +16 -0
  59. package/dist/services/config/manager.d.ts.map +1 -0
  60. package/dist/services/config/manager.js +211 -0
  61. package/dist/services/config/manager.js.map +1 -0
  62. package/dist/services/github/auth.d.ts +15 -0
  63. package/dist/services/github/auth.d.ts.map +1 -0
  64. package/dist/services/github/auth.js +119 -0
  65. package/dist/services/github/auth.js.map +1 -0
  66. package/dist/services/github/client.d.ts +54 -0
  67. package/dist/services/github/client.d.ts.map +1 -0
  68. package/dist/services/github/client.js +107 -0
  69. package/dist/services/github/client.js.map +1 -0
  70. package/dist/services/github/sync.d.ts +26 -0
  71. package/dist/services/github/sync.d.ts.map +1 -0
  72. package/dist/services/github/sync.js +200 -0
  73. package/dist/services/github/sync.js.map +1 -0
  74. package/dist/services/web/server.d.ts +30 -0
  75. package/dist/services/web/server.d.ts.map +1 -0
  76. package/dist/services/web/server.js +159 -0
  77. package/dist/services/web/server.js.map +1 -0
  78. package/dist/types/paymongo.d.ts +118 -0
  79. package/dist/types/paymongo.d.ts.map +1 -0
  80. package/dist/types/paymongo.js +3 -0
  81. package/dist/types/paymongo.js.map +1 -0
  82. package/dist/utils/cache.d.ts +20 -0
  83. package/dist/utils/cache.d.ts.map +1 -0
  84. package/dist/utils/cache.js +164 -0
  85. package/dist/utils/cache.js.map +1 -0
  86. package/dist/utils/constants.d.ts +32 -0
  87. package/dist/utils/constants.d.ts.map +1 -0
  88. package/dist/utils/constants.js +52 -0
  89. package/dist/utils/constants.js.map +1 -0
  90. package/dist/utils/errors.d.ts +33 -0
  91. package/dist/utils/errors.d.ts.map +1 -0
  92. package/dist/utils/errors.js +79 -0
  93. package/dist/utils/errors.js.map +1 -0
  94. package/dist/utils/logger.d.ts +17 -0
  95. package/dist/utils/logger.d.ts.map +1 -0
  96. package/dist/utils/logger.js +53 -0
  97. package/dist/utils/logger.js.map +1 -0
  98. package/dist/utils/spinner.d.ts +17 -0
  99. package/dist/utils/spinner.d.ts.map +1 -0
  100. package/dist/utils/spinner.js +54 -0
  101. package/dist/utils/spinner.js.map +1 -0
  102. package/dist/utils/validator.d.ts +10 -0
  103. package/dist/utils/validator.d.ts.map +1 -0
  104. package/dist/utils/validator.js +79 -0
  105. package/dist/utils/validator.js.map +1 -0
  106. package/package.json +70 -0
  107. package/web/index.html +688 -0
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: Bug Report
3
+ about: Report a bug or issue with the PayMongo CLI
4
+ title: '[BUG] '
5
+ labels: bug
6
+ assignees: ''
7
+ ---
8
+
9
+ ## Bug Description
10
+
11
+ A clear and concise description of what the bug is.
12
+
13
+ ## Steps to Reproduce
14
+
15
+ 1. Run command: `paymongo ...`
16
+ 2. Expected behavior: ...
17
+ 3. Actual behavior: ...
18
+
19
+ ## Environment
20
+
21
+ - OS: [e.g., Windows 10, macOS 12.1, Ubuntu 20.04]
22
+ - Node.js version: [e.g., 18.12.0]
23
+ - CLI version: [e.g., 1.0.0]
24
+ - PayMongo environment: [test/live]
25
+
26
+ ## Additional Context
27
+
28
+ Add any other context about the problem here, such as:
29
+
30
+ - Error messages
31
+ - Screenshots
32
+ - Configuration files
33
+ - API responses
@@ -0,0 +1,30 @@
1
+ ## Description
2
+
3
+ Brief description of the changes made.
4
+
5
+ ## Type of Change
6
+
7
+ - [ ] Bug fix
8
+ - [ ] New feature
9
+ - [ ] Breaking change
10
+ - [ ] Documentation update
11
+ - [ ] Refactoring
12
+ - [ ] Test addition
13
+
14
+ ## Testing
15
+
16
+ - [ ] Unit tests pass
17
+ - [ ] Integration tests pass
18
+ - [ ] Manual testing completed
19
+
20
+ ## Checklist
21
+
22
+ - [ ] Code follows existing patterns
23
+ - [ ] Tests added for new functionality
24
+ - [ ] Documentation updated
25
+ - [ ] Breaking changes documented
26
+ - [ ] Commit messages are clear
27
+
28
+ ## Additional Notes
29
+
30
+ Any additional context or screenshots.
@@ -0,0 +1,88 @@
1
+ name: CI/CD Pipeline
2
+
3
+ on:
4
+ push:
5
+ branches: [main, develop]
6
+ pull_request:
7
+ branches: [main, develop]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ${{ matrix.os }}
12
+ strategy:
13
+ matrix:
14
+ os: [ubuntu-latest, windows-latest, macos-latest]
15
+ node-version: [18, 20]
16
+
17
+ steps:
18
+ - name: Checkout code
19
+ uses: actions/checkout@v4
20
+
21
+ - name: Setup Node.js ${{ matrix.node-version }}
22
+ uses: actions/setup-node@v4
23
+ with:
24
+ node-version: ${{ matrix.node-version }}
25
+ cache: 'npm'
26
+
27
+ - name: Install dependencies
28
+ run: npm ci
29
+
30
+ - name: Run linter
31
+ run: npm run lint
32
+
33
+ - name: Run type checking
34
+ run: npm run build
35
+
36
+ - name: Run tests
37
+ run: npm test -- --coverage --passWithNoTests
38
+ continue-on-error: true # Allow Windows file locking issues
39
+
40
+ - name: Upload coverage reports
41
+ uses: codecov/codecov-action@v3
42
+ if: matrix.os == 'ubuntu-latest' && matrix.node-version == '18'
43
+ with:
44
+ file: ./coverage/lcov.info
45
+
46
+ release:
47
+ needs: test
48
+ if: github.ref == 'refs/heads/main' && github.event_name == 'push'
49
+ runs-on: ubuntu-latest
50
+
51
+ steps:
52
+ - name: Checkout code
53
+ uses: actions/checkout@v4
54
+
55
+ - name: Setup Node.js
56
+ uses: actions/setup-node@v4
57
+ with:
58
+ node-version: 18
59
+ registry-url: 'https://registry.npmjs.org'
60
+
61
+ - name: Install dependencies
62
+ run: npm ci
63
+
64
+ - name: Build project
65
+ run: npm run build
66
+
67
+ - name: Run tests
68
+ run: npm test -- --passWithNoTests
69
+
70
+ - name: Publish to npm
71
+ run: npm publish --access public
72
+ env:
73
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
74
+
75
+ - name: Create GitHub release
76
+ uses: actions/create-release@v1
77
+ env:
78
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79
+ with:
80
+ tag_name: v${{ github.run_number }}
81
+ release_name: Release v${{ github.run_number }}
82
+ body: |
83
+ ## Changes
84
+ - Automated release from CI/CD pipeline
85
+ - All tests passed
86
+ - Code quality checks completed
87
+ draft: false
88
+ prerelease: false
@@ -0,0 +1,46 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ main, develop ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+
13
+ strategy:
14
+ matrix:
15
+ node-version: [16.x, 18.x, 20.x]
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Use Node.js ${{ matrix.node-version }}
21
+ uses: actions/setup-node@v4
22
+ with:
23
+ node-version: ${{ matrix.node-version }}
24
+ cache: 'npm'
25
+
26
+ - name: Install dependencies
27
+ run: npm ci
28
+
29
+ - name: Run linter
30
+ run: npm run lint
31
+
32
+ - name: Run tests
33
+ run: npm test
34
+
35
+ - name: Build project
36
+ run: npm run build
37
+
38
+ - name: Run build tests
39
+ run: |
40
+ # Test CLI help commands
41
+ node bin/paymongo.js --help
42
+ node bin/paymongo.js init --help
43
+ node bin/paymongo.js dev --help
44
+ node bin/paymongo.js login --help
45
+ node bin/paymongo.js config --help
46
+ node bin/paymongo.js webhooks --help
@@ -0,0 +1,54 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ jobs:
9
+ release:
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+
15
+ - name: Use Node.js 20.x
16
+ uses: actions/setup-node@v4
17
+ with:
18
+ node-version: 20.x
19
+ cache: 'npm'
20
+ registry-url: 'https://registry.npmjs.org'
21
+
22
+ - name: Install dependencies
23
+ run: npm ci
24
+
25
+ - name: Run tests
26
+ run: npm test
27
+
28
+ - name: Build project
29
+ run: npm run build
30
+
31
+ - name: Publish to npm
32
+ run: npm publish
33
+ env:
34
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
35
+
36
+ - name: Create GitHub Release
37
+ uses: actions/create-release@v1
38
+ env:
39
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40
+ with:
41
+ tag_name: ${{ github.ref }}
42
+ release_name: Release ${{ github.ref }}
43
+ body: |
44
+ ## Changes
45
+
46
+ See [CHANGELOG.md](https://github.com/leodyver/paymongo-cli/blob/main/CHANGELOG.md) for details.
47
+
48
+ ## Installation
49
+
50
+ ```bash
51
+ npm install -g paymongo-cli
52
+ ```
53
+ draft: false
54
+ prerelease: false
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Leodyver Semilla
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,113 @@
1
+ # PayMongo CLI
2
+
3
+ > **A developer-first CLI for PayMongo integration with local webhook forwarding.**
4
+
5
+ PayMongo CLI is the official-feel command-line tool designed to streamline your development process with PayMongo. It solves the biggest pain point in payment integration: **testing webhooks locally**.
6
+
7
+ [![npm version](https://img.shields.io/npm/v/paymongo-cli.svg)](https://www.npmjs.com/package/paymongo-cli)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.x-blue.svg)](https://www.typescriptlang.org/)
10
+
11
+ ---
12
+
13
+ ## Key Features
14
+
15
+ - **Local Webhook Forwarding**: Seamlessly receive PayMongo webhooks on your localhost using integrated `ngrok` tunneling.
16
+ - **Zero-Config Setup**: Get started in seconds with `paymongo init`.
17
+ - **Payment Testing**: Create and monitor payment intents and payments directly from your terminal.
18
+ - **Real-time Monitoring**: Watch webhook events as they happen with formatted logs or a web-based GUI.
19
+ - **Team Collaboration**: Sync configurations across your team using GitHub integration.
20
+ - **Web Dashboard**: Use `paymongo gui` for a premium visual monitoring experience.
21
+ - **Secure Management**: Encrypted storage for your API keys.
22
+
23
+ ---
24
+
25
+ ## Installation
26
+
27
+ ### Prerequisites
28
+
29
+ - **Node.js**: v18.0.0 or higher
30
+ - **ngrok account**: Required for webhook forwarding (free tier works great!)
31
+
32
+ ### Install via npm (Recommended)
33
+
34
+ ```bash
35
+ npm install -g paymongo-cli
36
+ ```
37
+
38
+ ### Setup ngrok Authtoken
39
+
40
+ To use the `dev` server with webhook forwarding, you need an ngrok authtoken:
41
+
42
+ 1. Sign up at [ngrok.com](https://ngrok.com)
43
+ 2. Copy your authtoken from the [ngrok dashboard](https://dashboard.ngrok.com/get-started/your-authtoken)
44
+ 3. Configure it in the CLI:
45
+
46
+ ```bash
47
+ paymongo config set ngrok.authtoken YOUR_AUTHTOKEN
48
+ ```
49
+
50
+ ---
51
+
52
+ ## Quick Start
53
+
54
+ ### 1. Initialize Project
55
+
56
+ ```bash
57
+ mkdir my-paymongo-app
58
+ cd my-paymongo-app
59
+ paymongo init
60
+ ```
61
+
62
+ ### 2. Start Development Server
63
+
64
+ This command sets up a tunnel and starts forwarding webhooks to your local app.
65
+
66
+ ```bash
67
+ paymongo dev --port 3000
68
+ ```
69
+
70
+ ### 3. Trigger a Test Webhook
71
+
72
+ In another terminal, simulate a successful payment:
73
+
74
+ ```bash
75
+ paymongo trigger --event payment.paid
76
+ ```
77
+
78
+ ---
79
+
80
+ ## Commands Reference
81
+
82
+ | Command | Description |
83
+ | :------------------ | :------------------------------------------------------ |
84
+ | `paymongo init` | Initialize a new project and set up credentials. |
85
+ | `paymongo dev` | Start local development server with webhook forwarding. |
86
+ | `paymongo payments` | Manage payments and payment intents. |
87
+ | `paymongo webhooks` | List, create, and manage PayMongo webhooks. |
88
+ | `paymongo config` | View and modify CLI configuration. |
89
+ | `paymongo team` | Sync configurations with your team via GitHub. |
90
+ | `paymongo gui` | Launch the web-based monitoring dashboard. |
91
+ | `paymongo trigger` | Simulate webhook events locally for testing. |
92
+
93
+ > Use `paymongo <command> --help` for detailed information on any command.
94
+
95
+ ---
96
+
97
+ ## Documentation
98
+
99
+ - **[Installation Guide](INSTALLATION.md)** - Platform-specific setup instructions.
100
+ - **[User Guide](USER_GUIDE.md)** - Detailed step-by-step instructions.
101
+ - **[API Reference](API_REFERENCE.md)** - Complete command and option reference.
102
+ - **[Troubleshooting](TROUBLESHOOTING.md)** - Solutions to common issues.
103
+ - **[Contributing](CONTRIBUTING.md)** - Help improve the PayMongo CLI.
104
+
105
+ ---
106
+
107
+ ## Built for Filipino Developers
108
+
109
+ PayMongo CLI is crafted to empower Filipino developers building the next generation of fintech solutions.
110
+
111
+ ## License
112
+
113
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ require('../dist/index.js');