@cakemail-org/cakemail-cli 1.5.0 → 2.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 (234) hide show
  1. package/.claude/settings.local.json +12 -0
  2. package/.env.example +40 -0
  3. package/.env.test.example +45 -0
  4. package/CHANGELOG.md +1031 -0
  5. package/README.md +319 -15
  6. package/audit-formats.js +128 -0
  7. package/cakemail.rb +20 -0
  8. package/dist/cli.js +27 -10
  9. package/dist/cli.js.map +1 -1
  10. package/dist/client.d.ts +2 -0
  11. package/dist/client.d.ts.map +1 -1
  12. package/dist/client.js +16 -6
  13. package/dist/client.js.map +1 -1
  14. package/dist/commands/account.js +1 -1
  15. package/dist/commands/account.js.map +1 -1
  16. package/dist/commands/attributes.js +1 -1
  17. package/dist/commands/attributes.js.map +1 -1
  18. package/dist/commands/campaigns.d.ts.map +1 -1
  19. package/dist/commands/campaigns.js +103 -8
  20. package/dist/commands/campaigns.js.map +1 -1
  21. package/dist/commands/config.d.ts.map +1 -1
  22. package/dist/commands/config.js +63 -4
  23. package/dist/commands/config.js.map +1 -1
  24. package/dist/commands/contacts.d.ts.map +1 -1
  25. package/dist/commands/contacts.js +91 -12
  26. package/dist/commands/contacts.js.map +1 -1
  27. package/dist/commands/emails.js +1 -1
  28. package/dist/commands/emails.js.map +1 -1
  29. package/dist/commands/interests.d.ts +5 -0
  30. package/dist/commands/interests.d.ts.map +1 -0
  31. package/dist/commands/interests.js +172 -0
  32. package/dist/commands/interests.js.map +1 -0
  33. package/dist/commands/lists.d.ts.map +1 -1
  34. package/dist/commands/lists.js +6 -8
  35. package/dist/commands/lists.js.map +1 -1
  36. package/dist/commands/logs.d.ts +5 -0
  37. package/dist/commands/logs.d.ts.map +1 -0
  38. package/dist/commands/logs.js +237 -0
  39. package/dist/commands/logs.js.map +1 -0
  40. package/dist/commands/reports.js +1 -1
  41. package/dist/commands/reports.js.map +1 -1
  42. package/dist/commands/segments.js +1 -1
  43. package/dist/commands/segments.js.map +1 -1
  44. package/dist/commands/senders.d.ts.map +1 -1
  45. package/dist/commands/senders.js +11 -8
  46. package/dist/commands/senders.js.map +1 -1
  47. package/dist/commands/suppressed.js +1 -1
  48. package/dist/commands/suppressed.js.map +1 -1
  49. package/dist/commands/tags.d.ts +5 -0
  50. package/dist/commands/tags.d.ts.map +1 -0
  51. package/dist/commands/tags.js +124 -0
  52. package/dist/commands/tags.js.map +1 -0
  53. package/dist/commands/templates.js +1 -1
  54. package/dist/commands/templates.js.map +1 -1
  55. package/dist/commands/transactional-templates.d.ts +5 -0
  56. package/dist/commands/transactional-templates.d.ts.map +1 -0
  57. package/dist/commands/transactional-templates.js +354 -0
  58. package/dist/commands/transactional-templates.js.map +1 -0
  59. package/dist/commands/webhooks.js +1 -1
  60. package/dist/commands/webhooks.js.map +1 -1
  61. package/dist/utils/auth.d.ts +8 -1
  62. package/dist/utils/auth.d.ts.map +1 -1
  63. package/dist/utils/auth.js +39 -11
  64. package/dist/utils/auth.js.map +1 -1
  65. package/dist/utils/config-file.d.ts +7 -0
  66. package/dist/utils/config-file.d.ts.map +1 -1
  67. package/dist/utils/config-file.js +15 -0
  68. package/dist/utils/config-file.js.map +1 -1
  69. package/dist/utils/config.d.ts +2 -0
  70. package/dist/utils/config.d.ts.map +1 -1
  71. package/dist/utils/config.js +12 -4
  72. package/dist/utils/config.js.map +1 -1
  73. package/dist/utils/errors.js +1 -1
  74. package/dist/utils/errors.js.map +1 -1
  75. package/dist/utils/list-defaults.d.ts +33 -0
  76. package/dist/utils/list-defaults.d.ts.map +1 -0
  77. package/dist/utils/list-defaults.js +52 -0
  78. package/dist/utils/list-defaults.js.map +1 -0
  79. package/dist/utils/output.d.ts.map +1 -1
  80. package/dist/utils/output.js +36 -13
  81. package/dist/utils/output.js.map +1 -1
  82. package/dist/utils/progress.d.ts.map +1 -1
  83. package/dist/utils/progress.js +32 -4
  84. package/dist/utils/progress.js.map +1 -1
  85. package/dist/utils/spinner.d.ts +17 -0
  86. package/dist/utils/spinner.d.ts.map +1 -0
  87. package/dist/utils/spinner.js +43 -0
  88. package/dist/utils/spinner.js.map +1 -0
  89. package/docs/DOCUMENTATION-STANDARD.md +1068 -0
  90. package/docs/README.md +161 -0
  91. package/docs/developer/ARCHITECTURE.md +516 -0
  92. package/docs/developer/AUTH.md +204 -0
  93. package/docs/developer/CONTRIBUTING.md +227 -0
  94. package/docs/developer/DOCUMENTATION_SUMMARY.md +346 -0
  95. package/docs/developer/PROJECT_INDEX.md +365 -0
  96. package/docs/planning/API_COVERAGE.md +1045 -0
  97. package/docs/planning/BACKLOG.md +1159 -0
  98. package/docs/planning/PROFILE_SYSTEM_TASKS.md +287 -0
  99. package/docs/planning/UX_IMPLEMENTATION_PLAN.md +691 -0
  100. package/docs/planning/archive/RELEASE_CHECKLIST_v1.3.0.md +332 -0
  101. package/docs/planning/archive/RELEASE_v1.3.0.md +428 -0
  102. package/docs/planning/archive/cakemail-cli-ux-improvements.md +438 -0
  103. package/docs/planning/cakemail-profile-system-plan.md +1121 -0
  104. package/docs/testing/AI_USER_SIMULATION_DESIGN.md +1342 -0
  105. package/docs/testing/KENOGAMI_BIDIRECTIONAL_FLOW.md +1517 -0
  106. package/docs/testing/KENOGAMI_TRUTH_RECONCILIATION_SYSTEM.md +1369 -0
  107. package/docs/user-manual/.obsidian/app.json +1 -0
  108. package/docs/user-manual/.obsidian/appearance.json +1 -0
  109. package/docs/user-manual/.obsidian/core-plugins.json +33 -0
  110. package/docs/user-manual/.obsidian/workspace.json +167 -0
  111. package/docs/user-manual/01-getting-started/01-installation.md +214 -0
  112. package/docs/user-manual/01-getting-started/02-quick-start.md +432 -0
  113. package/docs/user-manual/01-getting-started/03-authentication.md +448 -0
  114. package/docs/user-manual/01-getting-started/04-configuration.md +430 -0
  115. package/docs/user-manual/01-getting-started/05-output-formats.md +447 -0
  116. package/docs/user-manual/02-core-concepts/01-accounts.md +514 -0
  117. package/docs/user-manual/02-core-concepts/02-profile-system.md +771 -0
  118. package/docs/user-manual/02-core-concepts/03-smart-defaults.md +485 -0
  119. package/docs/user-manual/02-core-concepts/04-authentication-methods.md +435 -0
  120. package/docs/user-manual/02-core-concepts/05-pagination-filtering.md +600 -0
  121. package/docs/user-manual/02-core-concepts/06-error-handling.md +718 -0
  122. package/docs/user-manual/02-core-concepts/07-api-coverage.md +483 -0
  123. package/docs/user-manual/03-email-operations/01-senders.md +490 -0
  124. package/docs/user-manual/03-email-operations/02-templates.md +444 -0
  125. package/docs/user-manual/03-email-operations/03-transactional-emails.md +706 -0
  126. package/docs/user-manual/03-email-operations/04-email-tracking.md +407 -0
  127. package/docs/user-manual/04-campaign-management/01-campaigns-basics.md +394 -0
  128. package/docs/user-manual/04-campaign-management/02-campaign-scheduling.md +630 -0
  129. package/docs/user-manual/04-campaign-management/03-campaign-testing.md +997 -0
  130. package/docs/user-manual/04-campaign-management/04-campaign-lifecycle.md +709 -0
  131. package/docs/user-manual/04-campaign-management/05-campaign-links.md +934 -0
  132. package/docs/user-manual/05-contact-management/01-lists.md +836 -0
  133. package/docs/user-manual/05-contact-management/02-contacts.md +1035 -0
  134. package/docs/user-manual/05-contact-management/03-custom-attributes.md +788 -0
  135. package/docs/user-manual/05-contact-management/04-segments.md +1028 -0
  136. package/docs/user-manual/05-contact-management/05-contact-import-export.md +1031 -0
  137. package/docs/user-manual/06-analytics-reporting/01-campaign-analytics.md +867 -0
  138. package/docs/user-manual/06-analytics-reporting/02-account-reports.md +227 -0
  139. package/docs/user-manual/07-integrations/01-webhooks-integration.md +259 -0
  140. package/docs/user-manual/07-integrations/02-automation.md +326 -0
  141. package/docs/user-manual/08-advanced-usage/01-scripting-patterns.md +672 -0
  142. package/docs/user-manual/08-advanced-usage/02-bulk-operations.md +932 -0
  143. package/docs/user-manual/08-advanced-usage/03-ci-cd-integration.md +892 -0
  144. package/docs/user-manual/08-advanced-usage/04-performance-optimization.md +766 -0
  145. package/docs/user-manual/09-command-reference/01-config.md +776 -0
  146. package/docs/user-manual/09-command-reference/02-account.md +652 -0
  147. package/docs/user-manual/09-command-reference/03-lists.md +958 -0
  148. package/docs/user-manual/09-command-reference/04-contacts.md +1408 -0
  149. package/docs/user-manual/09-command-reference/05-attributes.md +617 -0
  150. package/docs/user-manual/09-command-reference/06-segments.md +894 -0
  151. package/docs/user-manual/09-command-reference/07-senders.md +803 -0
  152. package/docs/user-manual/09-command-reference/08-templates.md +818 -0
  153. package/docs/user-manual/09-command-reference/09-campaigns.md +1250 -0
  154. package/docs/user-manual/09-command-reference/10-emails.md +807 -0
  155. package/docs/user-manual/09-command-reference/11-reports.md +1135 -0
  156. package/docs/user-manual/09-command-reference/12-webhooks.md +773 -0
  157. package/docs/user-manual/09-command-reference/13-suppressed.md +797 -0
  158. package/docs/user-manual/09-command-reference/14-interests.md +630 -0
  159. package/docs/user-manual/09-command-reference/15-tags.md +584 -0
  160. package/docs/user-manual/09-command-reference/16-logs.md +656 -0
  161. package/docs/user-manual/09-command-reference/17-transactional-templates.md +850 -0
  162. package/docs/user-manual/10-troubleshooting/01-common-errors.md +457 -0
  163. package/docs/user-manual/10-troubleshooting/02-authentication-issues.md +558 -0
  164. package/docs/user-manual/10-troubleshooting/03-connection-problems.md +634 -0
  165. package/docs/user-manual/10-troubleshooting/04-debugging.md +725 -0
  166. package/docs/user-manual/11-appendix/04-faq.md +484 -0
  167. package/docs/user-manual/11-appendix/05-glossary.md +250 -0
  168. package/docs/user-manual/README.md +0 -0
  169. package/package.json +13 -47
  170. package/src/cli.ts +125 -0
  171. package/src/client.ts +16 -0
  172. package/src/commands/account.ts +267 -0
  173. package/src/commands/accounts.ts +78 -0
  174. package/src/commands/actions.ts +249 -0
  175. package/src/commands/attributes.ts +139 -0
  176. package/src/commands/campaign-blueprints.ts +106 -0
  177. package/src/commands/campaigns.ts +469 -0
  178. package/src/commands/config.ts +77 -0
  179. package/src/commands/contacts.ts +612 -0
  180. package/src/commands/custom-attributes.ts +127 -0
  181. package/src/commands/dkims.ts +117 -0
  182. package/src/commands/domains.ts +82 -0
  183. package/src/commands/email-apis.ts +569 -0
  184. package/src/commands/emails.ts +197 -0
  185. package/src/commands/forms.ts +283 -0
  186. package/src/commands/interests.ts +155 -0
  187. package/src/commands/links.ts +38 -0
  188. package/src/commands/lists.ts +406 -0
  189. package/src/commands/logos.ts +71 -0
  190. package/src/commands/logs.ts +386 -0
  191. package/src/commands/reports.ts +306 -0
  192. package/src/commands/segments.ts +158 -0
  193. package/src/commands/senders.ts +204 -0
  194. package/src/commands/sub-accounts.ts +271 -0
  195. package/src/commands/suppressed-emails.ts +234 -0
  196. package/src/commands/suppressed.ts +198 -0
  197. package/src/commands/system-emails.ts +85 -0
  198. package/src/commands/tags.ts +146 -0
  199. package/src/commands/tasks.ts +116 -0
  200. package/src/commands/templates.ts +189 -0
  201. package/src/commands/tokens.ts +83 -0
  202. package/src/commands/transactional-emails.ts +374 -0
  203. package/src/commands/transactional-templates.ts +385 -0
  204. package/src/commands/users.ts +506 -0
  205. package/src/commands/webhooks.ts +172 -0
  206. package/src/commands/workflow-blueprints.ts +123 -0
  207. package/src/commands/workflows.ts +265 -0
  208. package/src/types/profile.ts +93 -0
  209. package/src/utils/auth.ts +272 -0
  210. package/src/utils/config-file.ts +96 -0
  211. package/src/utils/config.ts +134 -0
  212. package/src/utils/confirm.ts +32 -0
  213. package/src/utils/defaults.ts +99 -0
  214. package/src/utils/errors.ts +116 -0
  215. package/src/utils/interactive.ts +91 -0
  216. package/src/utils/list-defaults.ts +74 -0
  217. package/src/utils/output.ts +190 -0
  218. package/src/utils/progress.ts +320 -0
  219. package/src/utils/spinner.ts +22 -0
  220. package/tests/IMPLEMENTATION_STATUS.md +258 -0
  221. package/tests/PTY_SETUP.md +118 -0
  222. package/tests/PTY_TESTING_GUIDE.md +507 -0
  223. package/tests/README.md +244 -0
  224. package/tests/fixtures/api-responses/campaigns.json +34 -0
  225. package/tests/fixtures/test-config.json +13 -0
  226. package/tests/helpers/cli-runner.ts +128 -0
  227. package/tests/helpers/mock-server.ts +301 -0
  228. package/tests/helpers/pty-runner.ts +181 -0
  229. package/tests/integration/campaigns-real-api.test.ts +196 -0
  230. package/tests/integration/setup-integration.ts +50 -0
  231. package/tests/pty/campaigns.test.ts +241 -0
  232. package/tests/setup.ts +34 -0
  233. package/tsconfig.json +15 -0
  234. package/vitest.config.ts +28 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,1031 @@
1
+ # Changelog
2
+
3
+ All notable changes to the Cakemail CLI will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.7.0] - 2025-10-16
9
+
10
+ ### Added - OAuth Authentication & Profile Enhancements
11
+
12
+ **OAuth Token-Based Authentication**
13
+ - Migrated from password-based to OAuth token authentication
14
+ - Access tokens and refresh tokens now stored in config file
15
+ - Token expiration tracking with `expires_in` field
16
+ - Automatic token refresh support (foundation for future implementation)
17
+ - Enhanced authentication flow with better error handling
18
+ - Account selection prompt when multiple accounts are available
19
+ - Improved first-time authentication experience
20
+
21
+ **Logout Command**
22
+ - `logout` - Log out and clear all authentication tokens
23
+ - Interactive confirmation prompt showing current user and what will be deleted
24
+ - `--force` flag to skip confirmation for scripting
25
+ - Gracefully handles case when user is already logged out
26
+ - Deletes entire config file including profile settings
27
+
28
+ **Profile-Based List Defaults**
29
+ - Marketer profile now defaults to 25 items per page (instead of API default 50)
30
+ - Marketer profile now sorts lists by newest first (`-created_on`)
31
+ - Applied to all list commands: campaigns, contacts, lists, senders, etc.
32
+ - Created reusable `applyListDefaults()` helper for consistent behavior
33
+ - Maintains backward compatibility with explicit `--limit` and `--sort` flags
34
+
35
+ **Enhanced Help System**
36
+ - `cakemail --help` now works without requiring authentication
37
+ - `cakemail --version` works without authentication
38
+ - Subcommand help (e.g., `cakemail config --help`) works without authentication
39
+ - Bare `cakemail` command still triggers authentication as intended
40
+ - Early return optimization for help/version commands
41
+
42
+ **Improved Configuration Display**
43
+ - `config profile` now shows all available quick actions including logout
44
+ - Added "View all" quick action for `config show` command
45
+ - Better organized help text with clear command examples
46
+ - Shows current profile and all active settings
47
+
48
+ ### Fixed
49
+
50
+ **Date Display Issues**
51
+ - Fixed Unix timestamp conversion (seconds to milliseconds)
52
+ - Timestamps no longer show as 1970-01-01 dates
53
+ - Proper date formatting in all output modes (JSON, table, compact)
54
+ - Fixed in authentication tokens, campaign dates, and contact timestamps
55
+
56
+ **Profile Persistence**
57
+ - Fixed profile setting not being saved during authentication
58
+ - Profile selection now properly persists to config file
59
+ - Enhanced OAuth flow to maintain profile choice
60
+
61
+ **SDK Parameter Mapping**
62
+ - Fixed parameter naming inconsistencies across SDK services
63
+ - Senders command now correctly maps `per_page` to `perPage`
64
+ - Ensures all list commands work with profile defaults
65
+
66
+ ### Changed
67
+
68
+ **Authentication Flow**
69
+ - Email/password flow now returns OAuth tokens instead of storing password
70
+ - Config file now stores `access_token`, `refresh_token`, and `expires_in`
71
+ - Password is never stored in config file (security improvement)
72
+ - Authentication method tracked in config (`password` or `token`)
73
+ - Profile selection integrated into initial authentication flow
74
+
75
+ **Configuration Structure**
76
+ - Added `auth.access_token` field (replaces legacy `token` field)
77
+ - Added `auth.refresh_token` field for token refresh
78
+ - Added `auth.expires_in` field for expiration tracking
79
+ - Added `auth.method` field to track authentication method
80
+ - Maintains backward compatibility with legacy `token` field
81
+
82
+ **List Command Behavior**
83
+ - All list commands now respect profile-based defaults
84
+ - Marketer profile provides more curated experience with smaller page sizes
85
+ - Developer profile still uses API defaults (50 items, default sort)
86
+ - Explicit flags (`--limit`, `--sort`) always override profile defaults
87
+
88
+ ### Technical Improvements
89
+
90
+ **New Files**
91
+ - `src/utils/list-defaults.ts` - Reusable helper for applying profile-based defaults to list commands
92
+ - `applyListDefaults()` function with proper parameter mapping
93
+ - Handles `per_page`, `page`, and `sort` parameters
94
+ - Profile-aware with fallback to API defaults
95
+
96
+ **Enhanced Files**
97
+ - `src/utils/auth.ts` - Complete OAuth authentication flow implementation
98
+ - Account selection when multiple accounts available
99
+ - Token extraction from OAuth response
100
+ - Profile selection persistence
101
+ - Better error handling and user feedback
102
+
103
+ - `src/utils/config-file.ts` - Enhanced config file management
104
+ - `deleteConfigFile()` function for logout
105
+ - Support for OAuth token fields
106
+ - Maintains backward compatibility with legacy fields
107
+
108
+ - `src/commands/config.ts` - Logout command and improved help
109
+ - `logout` command with interactive confirmation
110
+ - Enhanced profile display with all quick actions
111
+ - Better command organization
112
+
113
+ - `src/cli.ts` - Improved help and authentication logic
114
+ - Early return for help/version commands
115
+ - Conditional client creation for help scenarios
116
+ - Better authentication skip logic
117
+
118
+ - `src/utils/config.ts` - OAuth token support
119
+ - Load access_token and refresh_token from config
120
+ - Support for token expiration tracking
121
+ - Maintains backward compatibility
122
+
123
+ - `src/utils/output.ts` - Date formatting fixes
124
+ - Proper Unix timestamp conversion (seconds → milliseconds)
125
+ - Enhanced date display across all output modes
126
+
127
+ - `src/client.ts` - OAuth token authentication
128
+ - Uses access_token from config instead of password
129
+ - Maintains backward compatibility with old authentication
130
+
131
+ **Updated Commands**
132
+ - `src/commands/campaigns.ts` - Profile-based list defaults
133
+ - `src/commands/contacts.ts` - Profile-based list defaults
134
+ - `src/commands/lists.ts` - Profile-based list defaults
135
+ - `src/commands/senders.ts` - Profile-based list defaults with parameter mapping
136
+
137
+ ### Security Improvements
138
+ - Password no longer stored in config file
139
+ - OAuth tokens used for API authentication
140
+ - Refresh token support for long-lived sessions
141
+ - Logout command completely removes all credentials
142
+
143
+ ### Example Usage
144
+
145
+ **OAuth Authentication:**
146
+ ```bash
147
+ # First-time authentication
148
+ $ cakemail campaigns list
149
+ ⚠ Not authenticated
150
+ Please enter your Cakemail credentials:
151
+
152
+ Email: user@example.com
153
+ Password: ********
154
+
155
+ 🔐 Authenticating...
156
+ ✓ Authentication successful!
157
+
158
+ # Multiple accounts - selection prompt
159
+ ? Select an account:
160
+ › Cakemail (ID: 123456) ⭐
161
+ Sub-Account A (ID: 789012)
162
+ Sub-Account B (ID: 345678)
163
+
164
+ # Profile selection
165
+ ? Select your profile:
166
+ › 📊 Marketer - Interactive, user-friendly
167
+ 💻 Developer - Fast, scriptable
168
+ ⚖️ Balanced - Best of both
169
+ ```
170
+
171
+ **Logout:**
172
+ ```bash
173
+ # Interactive logout
174
+ $ cakemail logout
175
+
176
+ 🚪 Logout
177
+
178
+ Currently logged in as: user@example.com
179
+
180
+ This will remove:
181
+ • Authentication tokens
182
+ • Profile settings
183
+ • All saved configuration
184
+
185
+ ? Are you sure you want to log out? (y/N) y
186
+
187
+ ✓ Logged out successfully
188
+
189
+ Run any command to log in again.
190
+
191
+ # Force logout (skip confirmation)
192
+ $ cakemail logout --force
193
+ ```
194
+
195
+ **Profile-Based List Defaults (Marketer):**
196
+ ```bash
197
+ # Marketer profile - gets 25 items, sorted by newest first
198
+ $ cakemail campaigns list
199
+ Showing 1-25 of 150 • Page 1 of 6
200
+ [Shows 25 newest campaigns]
201
+
202
+ # Override with explicit flags
203
+ $ cakemail campaigns list --limit 50 --sort "+name"
204
+ [Shows 50 campaigns sorted by name]
205
+ ```
206
+
207
+ **Enhanced Config Profile Display:**
208
+ ```bash
209
+ $ cakemail config profile
210
+
211
+ 📋 Current Profile
212
+
213
+ Profile: marketer
214
+ (📊 Marketer/Business user)
215
+
216
+ [... settings display ...]
217
+
218
+ ──────────────────────────────────────────────────
219
+
220
+ Quick actions:
221
+ Change profile: cakemail config profile-set <type>
222
+ Customize: cakemail config set <key> <value>
223
+ Reset: cakemail config reset
224
+ View all: cakemail config show
225
+ Logout: cakemail logout
226
+ ```
227
+
228
+ ### Upgrade Notes
229
+
230
+ **For Existing Users:**
231
+ - On first command after upgrade, you'll be prompted to re-authenticate
232
+ - This is a one-time process to migrate from password to OAuth tokens
233
+ - Your profile settings will be preserved
234
+ - Previous .env configurations are still supported but will migrate to OAuth
235
+
236
+ **For New Users:**
237
+ - Simply run any command to start the authentication flow
238
+ - OAuth tokens are automatically managed
239
+ - No manual token management required
240
+
241
+ ### Notes
242
+ - **No breaking changes** - All existing commands remain compatible
243
+ - OAuth migration is automatic and seamless
244
+ - Profile-based defaults improve UX without requiring configuration
245
+ - Logout provides clean way to switch accounts or remove credentials
246
+ - Help system now more accessible without authentication requirement
247
+ - All date display issues from previous versions are resolved
248
+
249
+ ## [1.6.0] - 2025-10-14
250
+
251
+ ### Added - Complete Testing Infrastructure
252
+
253
+ **Test Framework:**
254
+ - Vitest test framework with full configuration
255
+ - Integration tests for real API validation (5 tests)
256
+ - PTY (Pseudo-Terminal) test infrastructure for realistic user simulation
257
+ - Express-based mock HTTP server for subprocess testing
258
+ - Comprehensive test documentation and guides
259
+
260
+ **Testing Capabilities:**
261
+ - Real API integration tests with working credentials
262
+ - PTY tests simulate actual terminal sessions (colors, spinners, interactive prompts)
263
+ - Mock server handles OAuth, campaigns, lists, contacts, senders, templates
264
+ - Test helpers for CLI execution and PTY management
265
+ - Support for testing all output formats (JSON, table, compact)
266
+ - Coverage reporting with Vitest
267
+
268
+ **Test Scripts Added:**
269
+ ```bash
270
+ npm test # Run all tests
271
+ npm run test:integration # Test against real API
272
+ npm run test:pty # Test with PTY (needs Node 18-20)
273
+ npm run test:coverage # Generate coverage report
274
+ npm run test:ci # CI/CD pipeline tests
275
+ ```
276
+
277
+ **Test Documentation:**
278
+ - `tests/PTY_TESTING_GUIDE.md` - Complete PTY testing guide with examples
279
+ - `tests/PTY_SETUP.md` - Setup instructions and Node version requirements
280
+ - `tests/README.md` - Testing overview
281
+
282
+ **Node Version Compatibility:**
283
+ - PTY tests require Node 18.x or 20.x (node-pty compilation issue with Node 24+)
284
+ - Integration tests work on all Node versions ✅
285
+ - CLI works on all Node 18+ ✅
286
+
287
+ ### Fixed - Pagination and Table Rendering
288
+
289
+ **Pagination Handling:**
290
+ - Fixed support for new SDK pagination format (nested `pagination` object)
291
+ - Maintains backward compatibility with old format (root-level fields)
292
+ - Handles both `data.pagination.count` and `data.count` formats
293
+
294
+ **Table Rendering:**
295
+ - Fixed table column width calculation to handle `undefined` values
296
+ - Prevents crashes when column width calculation returns no results
297
+ - Only applies `colWidths` when explicitly calculated
298
+
299
+ ### Changed
300
+
301
+ - Test coverage: 0% → 6% (with room to grow to 100%)
302
+ - Dev dependencies: Added vitest, express, execa, strip-ansi, @vitest/coverage-v8
303
+ - Optional dependency: node-pty (for PTY testing on compatible Node versions)
304
+ - Package scripts: Removed placeholder test script, added comprehensive test suite
305
+
306
+ ### Added - Complete API Coverage Sprint (30 new commands)
307
+
308
+ Massive API coverage expansion from 108 to 136 commands, achieving **59% API coverage** (136/232 operations). This completes nearly all of the v1.4.0 API coverage goals.
309
+
310
+ **Tags Management (5 commands)**
311
+ - `tags list` - List all contact tags with optional contact counts
312
+ - `tags show <tag>` - Show tag details including usage statistics
313
+ - `tags create -n <name>` - Create new global tag
314
+ - `tags update <tag> -n <name>` - Rename existing tag
315
+ - `tags delete <tag>` - Delete tag (with confirmation, removes from all contacts)
316
+
317
+ **Interests Management (5 commands)**
318
+ - `interests list [list-id]` - List interests (auto-detects if only one list)
319
+ - `interests get [list-id] <interest-name>` - Get interest details
320
+ - `interests create [list-id] -n <name>` - Create interest with optional alias
321
+ - `interests update [list-id] <interest-name>` - Update interest name/alias
322
+ - `interests delete [list-id] <interest-name>` - Delete interest (with confirmation)
323
+
324
+ **Contact-Level Interest Management (2 commands)**
325
+ - `contacts add-interests <list-id>` - Add interests to contacts (bulk via --contacts IDs or --query SQL)
326
+ - `contacts remove-interests <list-id>` - Remove interests from contacts (bulk operations supported)
327
+
328
+ **Campaign Enhancements (3 commands)**
329
+ - `campaigns render <id>` - Render campaign HTML preview with optional contact personalization
330
+ - `campaigns revisions <id>` - List campaign revision history with pagination
331
+ - `campaigns blueprints` - List campaign blueprints/templates with filtering
332
+
333
+ **Activity Logs (6 commands)**
334
+ - `logs campaign <id>` - View campaign activity logs with filtering and sorting
335
+ - `logs list [list-id]` - View list activity logs (auto-detects if only one list)
336
+ - `logs campaign-export <id>` - Create campaign log export to CSV
337
+ - `logs campaign-export-download <id> <export-id>` - Get download URL for campaign log export
338
+ - `logs list-export [list-id]` - Create list log export to CSV
339
+ - `logs list-export-download [list-id] <export-id>` - Get download URL for list log export
340
+
341
+ **Transactional Email Templates (9 commands)**
342
+ - `transactional-templates list [list-id]` - List templates (auto-detects if only one list)
343
+ - `transactional-templates show [list-id] <id>` - Show template details
344
+ - `transactional-templates create [list-id]` - Create template with HTML/text/subject
345
+ - `transactional-templates update [list-id] <id>` - Update template content
346
+ - `transactional-templates delete [list-id] <id>` - Delete template (with confirmation)
347
+ - `transactional-templates send [list-id] <id>` - Send to contact ID or email address
348
+ - `transactional-templates test [list-id] <id>` - Send test email with variables
349
+ - `transactional-templates render [list-id] <id>` - Render template HTML with variables
350
+
351
+ ### API Coverage Progress
352
+ - **Before**: 108 commands (46% coverage)
353
+ - **After**: 136 commands (59% coverage)
354
+ - **Added**: 30 commands in this release
355
+ - **v1.4.0 Target**: 140 commands (60%) - 96% complete, just 4 commands away!
356
+
357
+ ### Key Features
358
+ - **Auto-Detection**: All list-scoped commands support automatic list ID detection when only one list exists
359
+ - **Profile-Aware**: All new commands respect user profiles (developer/marketer/balanced) for output formatting and interactivity
360
+ - **Interactive Confirmations**: Delete operations include profile-aware confirmation prompts (can be skipped with --force)
361
+ - **Bulk Operations**: Contact interest management supports bulk operations via contact IDs or SQL queries
362
+ - **Progress Indicators**: Tag/interest bulk operations show progress with elapsed time
363
+ - **Error Handling**: Enhanced error messages with context-specific suggestions for all new commands
364
+ - **SDK Integration**: All commands use @cakemail-org/cakemail-sdk v2.0 for API calls
365
+
366
+ ### Example Usage
367
+
368
+ **Tags Management:**
369
+ ```bash
370
+ # List all tags with contact counts
371
+ $ cakemail tags list --with-count
372
+ ✓ Tags retrieved successfully
373
+ ┌────┬─────────┬────────────────┬─────────────────────┐
374
+ │ ID │ Name │ Contacts Count │ Created At │
375
+ ├────┼─────────┼────────────────┼─────────────────────┤
376
+ │ 1 │ vip │ 342 │ 2025-09-15 10:23:11 │
377
+ │ 2 │ premium │ 128 │ 2025-09-20 14:05:42 │
378
+ └────┴─────────┴────────────────┴─────────────────────┘
379
+
380
+ # Create and manage tags
381
+ $ cakemail tags create --name "early-adopter"
382
+ $ cakemail tags update "early-adopter" --name "beta-tester"
383
+ $ cakemail tags delete "old-tag"
384
+ ```
385
+
386
+ **Interests Management:**
387
+ ```bash
388
+ # Create interest (auto-detects list if only one exists)
389
+ $ cakemail interests create --name "Product Updates" --alias "updates"
390
+
391
+ # Bulk add interests to contacts
392
+ $ cakemail contacts add-interests 123 -i "updates,news" -c "1,2,3"
393
+ $ cakemail contacts add-interests 123 -i "promotions" -q "status==active"
394
+
395
+ # Remove interests from contacts
396
+ $ cakemail contacts remove-interests 123 -i "old-interest" -q "tags==inactive"
397
+ ```
398
+
399
+ **Campaign Enhancements:**
400
+ ```bash
401
+ # Render campaign with contact personalization
402
+ $ cakemail campaigns render 789 --contact-id 456
403
+
404
+ # View campaign revision history
405
+ $ cakemail campaigns revisions 789
406
+
407
+ # Browse campaign blueprints
408
+ $ cakemail campaigns blueprints --filter "is_owner" --sort "+name"
409
+ ```
410
+
411
+ **Activity Logs:**
412
+ ```bash
413
+ # View campaign logs with filtering
414
+ $ cakemail logs campaign 789 --filter "type==open" --sort "+time"
415
+
416
+ # Export campaign logs to CSV
417
+ $ cakemail logs campaign-export 789 --description "Q4 Analytics"
418
+ $ cakemail logs campaign-export-download 789 export-id-123
419
+
420
+ # View and export list activity
421
+ $ cakemail logs list --start-time 1696118400 --filter "type==subscribe"
422
+ ```
423
+
424
+ **Transactional Templates:**
425
+ ```bash
426
+ # Create template
427
+ $ cakemail transactional-templates create \
428
+ --name "Order Confirmation" \
429
+ --subject "Your order #{{order_id}}" \
430
+ --html "<h1>Thank you!</h1>" \
431
+ --sender-id 456
432
+
433
+ # Send with variables
434
+ $ cakemail transactional-templates send 123 \
435
+ --email user@example.com \
436
+ --variables '{"order_id":"12345","total":"$99.99"}'
437
+
438
+ # Test template
439
+ $ cakemail transactional-templates test 123 \
440
+ --email test@example.com \
441
+ --variables '{"order_id":"TEST"}'
442
+
443
+ # Render preview
444
+ $ cakemail transactional-templates render 123 \
445
+ --contact-id 456 \
446
+ --variables '{"order_id":"12345"}'
447
+ ```
448
+
449
+ ### Changed
450
+ - Coverage increased from 108 to 136 commands (46% → 59% API coverage)
451
+ - Contact commands now include interest management operations
452
+ - Campaign commands now include render, revisions, and blueprints
453
+ - Version bumped to 1.6.0
454
+
455
+ ### Technical Improvements
456
+ - Created `src/commands/tags.ts` - Complete tags management
457
+ - Created `src/commands/interests.ts` - Interest CRUD operations
458
+ - Created `src/commands/logs.ts` - Activity logs and exports
459
+ - Created `src/commands/transactional-templates.ts` - Full transactional template lifecycle
460
+ - Enhanced `src/commands/campaigns.ts` - Added render, revisions, blueprints
461
+ - Enhanced `src/commands/contacts.ts` - Added add-interests, remove-interests
462
+ - All new commands follow SDK-based architecture with proper error handling
463
+ - All commands support profile-aware output and confirmations
464
+
465
+ ### Documentation
466
+ - Updated API coverage metrics to reflect 59% completion
467
+ - Added comprehensive examples for all new command groups
468
+ - Documented bulk operations for interest management
469
+
470
+ ### Notes
471
+ - **No breaking changes** - All existing commands remain compatible
472
+ - All new delete operations respect profile settings for confirmations
473
+ - Bulk operations show progress indicators for better UX
474
+ - Auto-detection makes commands work with zero configuration for single-list users
475
+ - Full backward compatibility with v1.5.0 commands
476
+ - Nearly achieved v1.4.0 target of 60% API coverage (96% complete)
477
+
478
+ ## [1.5.0] - 2025-10-11
479
+
480
+ ### Added - Complete Profile System
481
+
482
+ **Three User Profiles with Adaptive Behavior**
483
+ - **Developer Profile**: JSON output, minimal colors, no prompts, no confirmations, ISO8601 dates, verbose errors, show API details
484
+ - **Marketer Profile**: Compact output, rich colors, interactive prompts, confirmations, relative dates, friendly errors, helpful tips
485
+ - **Balanced Profile** (Default): Table output, moderate colors, auto-detect prompts, confirmations, friendly dates, balanced errors
486
+
487
+ **Profile Management Commands (6 commands)**
488
+ - `config profile` - Show current profile and all settings
489
+ - `config profile-set <type>` - Switch to different profile (developer|marketer|balanced)
490
+ - `config preview <type>` - Preview profile settings without switching
491
+ - `config set <key> <value>` - Customize individual settings
492
+ - `config reset` - Reset all settings to profile defaults
493
+ - `config show` - Show complete configuration including auth and defaults
494
+
495
+ **Interactive Prompt System**
496
+ - Smart environment detection (TTY, CI, batch mode)
497
+ - Profile-aware prompts that respect user preferences
498
+ - Interactive text, number, select, multi-select, confirm, and password prompts
499
+ - Automatic prompt suppression in non-interactive environments
500
+ - `promptText()`, `promptNumber()`, `promptSelect()`, `promptMultiSelect()`, `promptConfirm()`, `promptPassword()`
501
+
502
+ **Smart Resource Selection with Interactive Prompts**
503
+ - `campaigns create` - Interactive prompts for campaign name, list selection, and sender selection
504
+ - `lists create` - Interactive prompt for list name and optional language
505
+ - Auto-detects single resources (lists, senders) or shows interactive selection menu
506
+ - Displays resource details during selection (e.g., "Newsletter List (1,234 contacts)")
507
+
508
+ **Profile-Aware Confirmations**
509
+ - Developer profile: Skip all confirmations (trusts the developer)
510
+ - Marketer profile: Always confirm destructive operations (safety first)
511
+ - Balanced profile: Confirm in interactive mode, skip in scripts
512
+ - Automatic confirmation suppression in CI/batch environments
513
+
514
+ **Global CLI Flags**
515
+ - `--profile <type>` - Override profile for single command without switching
516
+ - `--batch` - Explicit scripting mode (disable all interactive prompts)
517
+ - Works with all commands: `cakemail --profile developer campaigns list`
518
+
519
+ **Profile-Aware Output Features**
520
+ - Color schemes: none (no colors), minimal (red/green only), moderate, rich (full colors)
521
+ - Date formats: iso8601 (machine-readable), friendly (human-readable), relative (time ago)
522
+ - Error messages: technical (developer) vs friendly (marketer) based on profile
523
+ - Progress indicators: shown/hidden based on profile settings
524
+ - Tips and hints: enabled for marketer, disabled for developer
525
+
526
+ **Configuration Storage**
527
+ - Profile settings stored in `~/.cakemail/config.json`
528
+ - Automatic migration from `.env` to config file
529
+ - Profile selection integrated into first-time auth flow
530
+ - Backward compatible with existing `.env` configurations
531
+
532
+ ### Changed
533
+ - `OutputFormatter` now accepts profile config getter for adaptive behavior
534
+ - `confirmDelete()` and related functions now accept optional `profileConfig` parameter
535
+ - Interactive prompts automatically skip in non-TTY and CI environments
536
+ - `campaigns create` and `lists create` now have optional `--name` parameter (prompts if missing)
537
+ - All confirmation functions now respect profile settings
538
+ - Error display adapts to profile (technical vs friendly)
539
+ - Spinners adapt to profile (shown/hidden based on `show_progress` setting)
540
+
541
+ ### Technical Improvements
542
+ - Created `src/types/profile.ts` - Complete profile type system with 3 profiles
543
+ - Created `src/utils/config-file.ts` - Profile config storage and management
544
+ - Created `src/utils/interactive.ts` - Interactive prompt system with environment detection
545
+ - Enhanced `src/utils/confirm.ts` - Profile-aware confirmations
546
+ - Enhanced `src/utils/errors.ts` - Profile-aware error messages
547
+ - Enhanced `src/commands/campaigns.ts` - Interactive create with smart resource selection
548
+ - Enhanced `src/commands/lists.ts` - Interactive create
549
+ - Added `getProfile()` public method to `OutputFormatter`
550
+ - Profile config uses lazy evaluation pattern for runtime overrides
551
+
552
+ ### Configuration Priority
553
+ ```
554
+ CLI flags (--profile, --batch) > Env vars > Custom overrides > Profile defaults > Hard-coded defaults
555
+ ```
556
+
557
+ ### Example Usage
558
+
559
+ **Switch Profiles:**
560
+ ```bash
561
+ cakemail config profile-set developer # Fast, scriptable, no interruptions
562
+ cakemail config profile-set marketer # Guided, interactive, safe
563
+ cakemail config profile-set balanced # Best of both worlds (default)
564
+ ```
565
+
566
+ **Preview Before Switching:**
567
+ ```bash
568
+ cakemail config preview developer # See what developer mode looks like
569
+ ```
570
+
571
+ **Override Profile Once:**
572
+ ```bash
573
+ cakemail --profile developer campaigns list # Use developer mode just once
574
+ cakemail --batch campaigns create ... # Disable prompts for this command
575
+ ```
576
+
577
+ **Interactive Campaign Creation (Marketer Profile):**
578
+ ```bash
579
+ $ cakemail campaigns create
580
+ Campaign name: Weekly Newsletter
581
+ ? Select a list: › Newsletter Subscribers (1,234 contacts)
582
+ ? Select a sender: › Marketing Team <marketing@company.com>
583
+ ✓ Campaign created: 789
584
+ ```
585
+
586
+ **Scripted Campaign Creation (Developer Profile):**
587
+ ```bash
588
+ $ cakemail campaigns create --name "Weekly Newsletter" --list-id 123 --sender-id 456
589
+ {"id":789,"name":"Weekly Newsletter","status":"draft"}
590
+ ```
591
+
592
+ ### Documentation
593
+ - Reorganized all documentation into `/docs` structure
594
+ - Created comprehensive user manual with 11 sections
595
+ - Added developer documentation (ARCHITECTURE, AUTH, CONTRIBUTING)
596
+ - Added planning documents (BACKLOG, PROFILE_SYSTEM_TASKS)
597
+ - Archived old documentation for reference
598
+
599
+ ### Notes
600
+ - **No breaking changes** - All existing commands remain compatible
601
+ - Profile system is opt-in - balanced profile is the default
602
+ - Developers can use `--profile developer` for fast, non-interactive behavior
603
+ - Marketers get guided experience with safety confirmations
604
+ - Scripts automatically detect non-TTY and skip prompts
605
+ - Full backward compatibility with `.env` based configuration
606
+
607
+ ## [1.4.0] - 2025-10-11
608
+
609
+ ### Added - Seamless Authentication, Multi-Tenant Support & Enhanced Output
610
+
611
+ **Enhanced Output Formatting - Visual Polish**
612
+ - JSON syntax highlighting with color-coded keys, values, booleans, and nulls
613
+ - Color-coded status badges with emoji indicators for quick visual scanning
614
+ - Relative time formatting for dates (e.g., "2h ago", "3d ago")
615
+ - Number formatting with thousands separators (1,234 instead of 1234)
616
+ - Enhanced pagination display showing item ranges and page navigation hints
617
+ - Better null/empty value handling with visual indicators (—)
618
+ - Status-specific colors and emoji:
619
+ - Campaigns: 🟢 sent, 🔵 scheduled, 🟡 sending, ⚪ draft, 🔴 failed
620
+ - Contacts: ✓ active, ✗ unsubscribed, ⚠ bounced
621
+ - Senders: ✓ confirmed, ⏳ pending
622
+ - Smart field truncation for long values in table/compact views
623
+ - Bold column headers and improved table styling
624
+ - Compact mode now shows status badges and metadata inline
625
+ - Warning method added to OutputFormatter for consistency
626
+
627
+ **Pagination Enhancements:**
628
+ ```bash
629
+ # Before:
630
+ Total: 150 items
631
+ [table data]
632
+
633
+ # After:
634
+ Showing 1-25 of 150 • Page 1 of 6
635
+ [table data with colored status badges]
636
+
637
+ 💡 Next: --page 2
638
+ ```
639
+
640
+ **Status Badge Examples:**
641
+ - Campaign list: Shows "🟢 sent" instead of just "sent"
642
+ - Sender list: Shows "✓ Yes" or "⏳ Pending" for confirmation status
643
+ - Contact list: Shows "✓ active" or "✗ unsubscribed"
644
+
645
+ ### Added - Seamless Authentication & Multi-Tenant Support
646
+
647
+ **Interactive Authentication**
648
+ - Seamless inline authentication prompts when credentials are missing
649
+ - No separate setup command required - authenticate on first use
650
+ - Interactive email/password prompts using inquirer
651
+ - Automatic credential validation via API
652
+ - Credentials automatically saved to `.env` file
653
+ - Welcome message shows total accessible accounts
654
+
655
+ **Multi-Tenant Account Management (5 new commands)**
656
+ - `account show` - Display current account details
657
+ - `account list` - List all accessible accounts (parent + sub-accounts)
658
+ - `account use <id>` - Switch active account context
659
+ - `account test` - Validate current credentials
660
+ - `account logout --force` - Remove credentials from .env
661
+
662
+ **Account Context Management**
663
+ - New `CAKEMAIL_CURRENT_ACCOUNT_ID` environment variable
664
+ - Global `--account <id>` flag to override context per-command
665
+ - Account context persists in `.env` file between sessions
666
+
667
+ **Progress Indicators for Long-Running Operations**
668
+ - Visual progress bars for bulk operations (batch tagging, multiple deletes)
669
+ - Polling progress with elapsed time and attempt tracking for async exports
670
+ - Multi-step progress indicators for complex workflows
671
+ - `--no-wait` flag for export commands to return immediately
672
+ - Progress utilities: `PollingProgress`, `BatchProgress`, `MultiStepProgress`, `pollUntilComplete()`
673
+
674
+ **Enhanced Error Handling & Validation**
675
+ - User-friendly error messages with context-aware suggestions
676
+ - HTTP status code mapping (400, 401, 403, 404, 409, 422, 429, 500, 502, 503)
677
+ - Error pattern matching for common scenarios (network errors, email validation, resource not found)
678
+ - Pre-flight validation helpers: email format, ID validation, date format, required fields, JSON parsing
679
+ - Colored output with actionable help text and command suggestions
680
+ - Enhanced error display in commands: campaigns, lists, reports, contacts, senders
681
+
682
+ **Example Error Messages:**
683
+ ```
684
+ ✗ Error: Campaign not found
685
+ → Campaign with ID '999' doesn't exist
686
+ 💡 Tip: To see all campaigns, use: cakemail campaigns list
687
+ ```
688
+
689
+ **Interactive Confirmations for Destructive Operations**
690
+ - Interactive Y/N prompts for all delete operations (13 commands enhanced)
691
+ - Visual danger indicators (⚠) with clear warnings about what will be deleted
692
+ - Context-specific details about consequences (e.g., "All contacts will be deleted")
693
+ - Graceful cancellation with informative messages
694
+ - `--force` flag still available for automation/scripting purposes
695
+ - Consistent confirmation UX across all destructive operations
696
+
697
+ **Enhanced Commands with Interactive Confirmations:**
698
+ - `campaigns delete` - Warns about permanent deletion
699
+ - `lists delete` - HIGH DANGER: Warns about contact and segment deletion
700
+ - `lists form-delete` - Warns about website forms breaking
701
+ - `contacts delete` - Warns about contact history loss
702
+ - `contacts export-delete` - Confirms export file deletion
703
+ - `reports delete-campaigns-export` - Confirms export deletion
704
+ - `attributes delete` - Warns about data loss from all contacts
705
+ - `segments delete` - Confirms segment deletion
706
+ - `senders delete` - Confirms sender deletion
707
+ - `templates delete` - Warns about campaign impacts
708
+ - `suppressed delete` - Warns email will receive emails again
709
+ - `suppressed export-delete` - Confirms export deletion
710
+ - `account logout` - LOW DANGER: Confirms credential removal
711
+
712
+ **Smart Defaults - Auto-Detection of Resources**
713
+ - Auto-detects list ID when only one list exists (14 commands enhanced)
714
+ - Auto-detects sender ID when only one confirmed sender exists (1 command)
715
+ - Session caching with 5-minute TTL for frequently used resources
716
+ - Helpful suggestions when multiple resources exist
717
+ - Zero-configuration workflow for single-list users
718
+
719
+ **Commands with Smart Defaults (list-id now optional):**
720
+ - `contacts list [list-id]` - Auto-detects list
721
+ - `contacts add [list-id]` - Auto-detects list
722
+ - `contacts export [list-id]` - Auto-detects list
723
+ - `contacts exports [list-id]` - Auto-detects list
724
+ - `segments list [list-id]` - Auto-detects list
725
+ - `segments get [list-id] <segment-id>` - Auto-detects list
726
+ - `segments create [list-id]` - Auto-detects list
727
+ - `segments update [list-id] <segment-id>` - Auto-detects list
728
+ - `segments delete [list-id] <segment-id>` - Auto-detects list
729
+ - `segments contacts [list-id] <segment-id>` - Auto-detects list
730
+ - `attributes list [list-id]` - Auto-detects list
731
+ - `attributes get [list-id] <name>` - Auto-detects list
732
+ - `attributes create [list-id]` - Auto-detects list
733
+ - `attributes delete [list-id] <name>` - Auto-detects list
734
+ - `campaigns create` - Auto-detects list-id AND sender-id
735
+
736
+ **Example Smart Default Behavior:**
737
+ ```bash
738
+ # Before (required list-id):
739
+ $ cakemail contacts list 123
740
+
741
+ # After (auto-detects if you have one list):
742
+ $ cakemail contacts list
743
+ Auto-detected list: 123 (My Newsletter List)
744
+ [shows contacts]
745
+
746
+ # Multiple resources scenario:
747
+ $ cakemail contacts list
748
+ Multiple lists found. Please specify --list-id <id>
749
+ Available lists:
750
+ 123: Newsletter List
751
+ 456: Product Updates
752
+ ```
753
+
754
+ ### Changed
755
+ - `getConfig()` is now async to support interactive authentication
756
+ - Config loading detects help/version commands to skip authentication
757
+ - Export commands now poll until completion by default (with `--no-wait` option)
758
+ - Error handling now validates inputs before API calls to catch errors early
759
+ - All delete operations now require interactive confirmation (or `--force` flag)
760
+ - `--force` flag description changed from "Skip confirmation" to "Skip confirmation prompt"
761
+ - List-id and sender-id parameters now optional in 15 commands with auto-detection
762
+ - Commands with `<list-id>` changed to `[list-id]` to indicate optional parameter
763
+ - Coverage increased from 103 to 108 commands (44% → 46% API coverage)
764
+
765
+ ### Dependencies
766
+ - Added `inquirer@^9.3.8` for interactive prompts
767
+ - Added `@types/inquirer@^9.0.9` for TypeScript support
768
+
769
+ ### Documentation
770
+ - Updated `.env.example` with multi-tenant account context
771
+ - Added account management examples to README
772
+ - Documented seamless authentication flow
773
+
774
+ ### Technical Improvements
775
+ - Created `src/utils/progress.ts` with 4 progress indicator types
776
+ - Created `src/utils/errors.ts` with comprehensive error handling utilities
777
+ - Created `src/utils/confirm.ts` with interactive confirmation utilities
778
+ - Enhanced `src/utils/output.ts` with advanced formatting capabilities:
779
+ - JSON syntax highlighting using regex-based colorization
780
+ - Status badge formatting with campaign/contact/sender-specific colors
781
+ - Relative date formatting with human-readable output
782
+ - Enhanced pagination with range display and navigation hints
783
+ - Number formatting with locale-aware thousands separators
784
+ - Enhanced 10 command files with validation and better error messages
785
+ - Enhanced 10 command files with interactive confirmations (13 delete operations total)
786
+ - All error messages include suggestions and help text for resolution
787
+ - All delete operations now have consistent confirmation UX
788
+ - All output modes (JSON, table, compact) now have enhanced visual formatting
789
+
790
+ ### Notes
791
+ - First-time users are prompted for credentials inline with their first command
792
+ - Multi-tenant users can easily switch between parent and sub-accounts
793
+ - Progress indicators provide real-time feedback for long operations
794
+ - Error messages guide users toward resolution with specific suggestions
795
+ - Interactive confirmations make destructive operations safer while maintaining scriptability with `--force`
796
+ - No breaking changes - all v1.3 commands remain compatible (but now require confirmation)
797
+
798
+ ## [1.3.0] - 2025-10-11
799
+
800
+ ### Added - Analytics & Data Operations (47 new commands)
801
+
802
+ **Reports & Analytics (12 commands)**
803
+ - `reports campaign <id>` - Campaign analytics and statistics
804
+ - `reports campaign-links <id>` - Link click analytics
805
+ - `reports list <id>` - List growth and engagement statistics
806
+ - `reports account` - Account-wide analytics
807
+ - `reports emails` - Email API statistics with date filtering
808
+ - `reports emails-summary` - Email API activity summary
809
+ - `reports transactional-emails` - Transactional email statistics
810
+ - `reports campaigns-exports` - List campaign report exports
811
+ - `reports export-campaigns` - Create campaign report export
812
+ - `reports campaigns-export <id>` - Get export status
813
+ - `reports download-campaigns-export <id>` - Download export
814
+ - `reports delete-campaigns-export <id>` - Delete export
815
+
816
+ **Contact Import/Export (9 commands)**
817
+ - Contact import command - Planned for future release (requires CSV parser)
818
+ - `contacts export <list-id>` - Create contacts export with filtering
819
+ - `contacts exports <list-id>` - List all contact exports
820
+ - `contacts export-get <list-id> <export-id>` - Get export status
821
+ - `contacts export-download <list-id> <export-id>` - Download export file
822
+ - `contacts export-delete <list-id> <export-id>` - Delete export
823
+ - `contacts tag <list-id> <contact-id>` - Tag individual contact
824
+ - `contacts untag <list-id> <contact-id>` - Remove tags from contact
825
+ - `contacts tag-bulk <list-id>` - Tag multiple contacts at once
826
+ - `contacts untag-bulk <list-id>` - Remove tags from multiple contacts
827
+
828
+ **Segments (6 commands)**
829
+ - `segments list <list-id>` - List all segments in a list
830
+ - `segments get <list-id> <segment-id>` - Get segment details
831
+ - `segments create <list-id>` - Create new segment with conditions
832
+ - `segments update <list-id> <segment-id>` - Update segment
833
+ - `segments delete <list-id> <segment-id>` - Delete segment
834
+ - `segments contacts <list-id> <segment-id>` - List contacts in segment
835
+
836
+ **Custom Attributes (4 commands)**
837
+ - `attributes list <list-id>` - List all custom attributes
838
+ - `attributes get <list-id> <name>` - Get attribute details
839
+ - `attributes create <list-id>` - Create custom attribute (text, number, date, boolean)
840
+ - `attributes delete <list-id> <name>` - Delete custom attribute
841
+
842
+ **Suppression List (7 commands)**
843
+ - `suppressed list` - List all suppressed email addresses
844
+ - `suppressed add <email>` - Add email to suppression list
845
+ - `suppressed delete <email>` - Remove email from suppression list
846
+ - `suppressed exports` - List suppression exports
847
+ - `suppressed export` - Create suppression list export
848
+ - `suppressed export-get <export-id>` - Get export status
849
+ - `suppressed export-download <export-id>` - Download export
850
+
851
+ **Extended List Operations (7 commands)**
852
+ - `lists update <id>` - Update list name and parameters
853
+ - `lists archive <id>` - Archive a list
854
+ - `lists accept-policy <id>` - Accept policy for a list
855
+ - `lists forms <id>` - List subscription form endpoints
856
+ - `lists form-create <id>` - Create subscription form endpoint
857
+ - `lists form-delete <list-id> <form-id>` - Delete subscription form
858
+
859
+ **Extended Email API (2 commands)**
860
+ - `emails logs` - Email API activity logs with filtering
861
+ - `emails tags` - List all email tags
862
+
863
+ ### Changed
864
+ - Coverage increased from 56 to 103 commands (24% → 44% API coverage)
865
+ - Enhanced contact management with bulk tagging operations
866
+ - Improved data portability with import/export capabilities
867
+
868
+ ### Documentation
869
+ - Complete rewrite of API_COVERAGE.md with detailed v1.3 roadmap
870
+ - Added coverage expansion plan for v1.3-v1.5
871
+ - Added priority matrix for feature development
872
+ - Added implementation timeline and effort estimates
873
+ - Updated API coverage table with 25 categories
874
+ - Created UX_IMPLEMENTATION_PLAN.md for future improvements
875
+
876
+ ### Notes
877
+ - All new commands follow SDK-based architecture
878
+ - Maintains backwards compatibility with all v1.2 commands
879
+ - File upload support for contact imports (CSV/JSON)
880
+ - Export operations support async task monitoring
881
+
882
+ ## [1.2.0] - 2025-10-10
883
+
884
+ ### Changed
885
+ - **BREAKING**: Renamed package from `@cakemail-org/cli` to `@cakemail-org/cakemail-cli`
886
+ - **BREAKING**: Renamed Homebrew formula from `cakemail` to `cakemail-cli`
887
+ - Binary name remains `cakemail` for ease of use
888
+
889
+ ### Migration
890
+ - npm users: `npm install -g @cakemail-org/cakemail-cli`
891
+ - Homebrew users: `brew uninstall cakemail && brew install cakemail-cli`
892
+ - Old package `@cakemail-org/cli` deprecated with migration message
893
+
894
+ ## [1.1.2] - 2025-10-10
895
+
896
+ ### Changed
897
+ - **BREAKING**: Migrated to new SDK package name `@cakemail-org/cakemail-sdk` (was `cakemail-sdk`)
898
+ - Updated all documentation references to new SDK package name
899
+
900
+ ### Added
901
+ - Homebrew distribution support via `brew tap cakemail/cakemail`
902
+ - HOMEBREW.md with complete Homebrew setup guide
903
+
904
+ ## [1.1.1] - 2025-10-10
905
+
906
+ ### Security
907
+ - Pre-publication security cleanup
908
+ - Enhanced .gitignore patterns
909
+
910
+ ### Documentation
911
+ - Added CONTRIBUTING.md with development guidelines
912
+ - Added CHANGELOG.md with version history
913
+ - Fixed package name in ARCHITECTURE.md
914
+
915
+ ### Fixed
916
+ - Replaced console.log with formatter.output in emails render command
917
+
918
+ ## [1.1.0] - 2025-10-10
919
+
920
+ ### Added
921
+ - Full migration to official @cakemail-org/cakemail-sdk v2.0 with 100% API coverage (232 operations)
922
+ - Complete senders management (7 commands)
923
+ - Complete templates management (6 commands)
924
+ - User-configurable default output format via `CAKEMAIL_OUTPUT_FORMAT` environment variable
925
+
926
+ ### Changed
927
+ - **BREAKING**: Sender confirmation now uses single confirmation ID: `senders confirm <confirmation-id>` (was `senders confirm <id> -k <key>`)
928
+ - All commands now use SDK 2.0 services (object-based API)
929
+ - Updated all SDK method calls to use object-based parameters
930
+ - Improved authentication error messages
931
+
932
+ ### Fixed
933
+ - Console.log replaced with formatter.output in emails render command
934
+ - URL encoding for authentication parameters
935
+ - .env loading now uses current working directory
936
+
937
+ ### Documentation
938
+ - Complete rewrite of API_COVERAGE.md to reflect SDK-based approach
939
+ - Updated README with SDK reference and all new commands
940
+ - Added comprehensive examples for all command categories
941
+
942
+ ## [1.0.0] - 2025-10-09
943
+
944
+ ### Added
945
+ - Initial migration to official @cakemail-org/cakemail-sdk v1.1.0
946
+ - SDK integration for campaigns, lists, contacts, emails, and webhooks
947
+
948
+ ### Changed
949
+ - Replaced custom HTTP client with SDK wrapper
950
+ - All migrated commands now use `client.sdk.*` methods
951
+
952
+ ## [0.5.0] - 2025-10-09
953
+
954
+ ### Added
955
+ - Email API v2 support for transactional emails
956
+ - `emails send` - Submit transactional emails with HTML/text or templates
957
+ - `emails get` - Retrieve submitted email details
958
+ - `emails render` - Render email HTML
959
+ - Template support with file uploads
960
+ - Custom headers, attachments, and tracking options
961
+
962
+ ## [0.4.0] - 2025-10-08
963
+
964
+ ### Added
965
+ - Complete campaign lifecycle management (15 commands)
966
+ - Campaign scheduling, rescheduling, and unscheduling
967
+ - Campaign suspension and resumption
968
+ - Campaign cancellation
969
+ - Test email sending
970
+ - Campaign archiving and unarchiving
971
+ - Campaign links listing
972
+ - Advanced filtering and sorting for campaigns
973
+
974
+ ## [0.3.0] - 2025-10-08
975
+
976
+ ### Added
977
+ - Complete template management (6 commands)
978
+ - `templates create` with HTML/text file upload support
979
+ - `templates update` with file upload support
980
+ - `templates render` for template preview
981
+ - Template deletion with confirmation
982
+ - Advanced filtering and sorting for templates
983
+
984
+ ## [0.2.0] - 2025-10-08
985
+
986
+ ### Added
987
+ - Webhooks management (6 commands)
988
+ - `webhooks create` with event subscriptions
989
+ - `webhooks update` for webhook configuration
990
+ - `webhooks archive` and `webhooks unarchive`
991
+ - Webhook secret support for signature verification
992
+
993
+ ## [0.1.3] - 2025-10-08
994
+
995
+ ### Fixed
996
+ - Removed unsupported format options from documentation
997
+
998
+ ## [0.1.2] - 2025-10-08
999
+
1000
+ ### Fixed
1001
+ - Corrected API base URL to api.cakemail.dev
1002
+
1003
+ ## [0.1.1] - 2025-10-08
1004
+
1005
+ ### Fixed
1006
+ - API base URL configuration
1007
+
1008
+ ## [0.1.0] - 2025-10-08
1009
+
1010
+ ### Added
1011
+ - Initial release
1012
+ - Campaigns management (list, get, create, update, delete)
1013
+ - Lists management (list, get, create, delete)
1014
+ - Contacts management (list, get, add, update, delete, unsubscribe)
1015
+ - Senders management (list, get, create, update, delete)
1016
+ - Three output formats: JSON, table, compact
1017
+ - Environment variable configuration
1018
+ - Access token and email/password authentication
1019
+ - Advanced filtering and sorting
1020
+ - Pagination support
1021
+
1022
+ [1.1.0]: https://github.com/cakemail/cakemail-cli/compare/v1.0.0...v1.1.0
1023
+ [1.0.0]: https://github.com/cakemail/cakemail-cli/compare/v0.5.0...v1.0.0
1024
+ [0.5.0]: https://github.com/cakemail/cakemail-cli/compare/v0.4.0...v0.5.0
1025
+ [0.4.0]: https://github.com/cakemail/cakemail-cli/compare/v0.3.0...v0.4.0
1026
+ [0.3.0]: https://github.com/cakemail/cakemail-cli/compare/v0.2.0...v0.3.0
1027
+ [0.2.0]: https://github.com/cakemail/cakemail-cli/compare/v0.1.3...v0.2.0
1028
+ [0.1.3]: https://github.com/cakemail/cakemail-cli/compare/v0.1.2...v0.1.3
1029
+ [0.1.2]: https://github.com/cakemail/cakemail-cli/compare/v0.1.1...v0.1.2
1030
+ [0.1.1]: https://github.com/cakemail/cakemail-cli/compare/v0.1.0...v0.1.1
1031
+ [0.1.0]: https://github.com/cakemail/cakemail-cli/releases/tag/v0.1.0