@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
@@ -0,0 +1,776 @@
1
+ # Config Commands
2
+
3
+ Manage CLI configuration and profile settings.
4
+
5
+ ## Overview
6
+
7
+ The config commands allow you to manage your CLI profile, customize settings, and view your complete configuration. Profile settings are stored in `~/.cakemail/config.json`.
8
+
9
+ **Available Commands:**
10
+ - [`config profile`](#config-profile) - Show current profile and settings
11
+ - [`config profile-set`](#config-profile-set) - Switch to a different profile
12
+ - [`config preview`](#config-preview) - Preview profile settings without switching
13
+ - [`config set`](#config-set) - Customize individual settings
14
+ - [`config reset`](#config-reset) - Reset all settings to profile defaults
15
+ - [`config show`](#config-show) - Show complete configuration
16
+ - [`logout`](#logout) - Log out and clear all authentication tokens
17
+
18
+ **Related Documentation:**
19
+ - [Profile System](/en/cli/core-concepts/profile-system/) - Complete profile guide
20
+ - [Configuration Guide](/en/cli/getting-started/configuration/) - Configuration overview
21
+ - [Authentication](/en/cli/getting-started/authentication/) - Authentication methods
22
+
23
+ ---
24
+
25
+ ## config profile
26
+
27
+ Show your current profile and all settings.
28
+
29
+ ### Usage
30
+
31
+ ```bash
32
+ cakemail config profile
33
+ ```
34
+
35
+ ### Output
36
+
37
+ ```
38
+ Current Profile: balanced
39
+
40
+ Settings:
41
+ Output Format: table
42
+ Color Scheme: moderate
43
+ Date Format: friendly
44
+ Show Progress: true
45
+ Interactive Prompts: auto
46
+ Confirmations: auto
47
+ Error Style: balanced
48
+ Show Tips: auto
49
+ ```
50
+
51
+ ### Description
52
+
53
+ Displays your active profile and all profile-controlled settings. Use this to understand your current CLI behavior.
54
+
55
+ ### Output Formats
56
+
57
+ This command always outputs in a human-readable format, regardless of `-f` flag.
58
+
59
+ ---
60
+
61
+ ## config profile-set
62
+
63
+ Switch to a different profile.
64
+
65
+ ### Usage
66
+
67
+ ```bash
68
+ cakemail config profile-set <type>
69
+ ```
70
+
71
+ ### Arguments
72
+
73
+ - `<type>` - Profile type (required)
74
+ - `developer` - Fast, non-interactive, JSON output
75
+ - `marketer` - Interactive, guided, rich colors
76
+ - `balanced` - Auto-detect context (default)
77
+
78
+ ### Examples
79
+
80
+ **Switch to Developer Profile:**
81
+ ```bash
82
+ $ cakemail config profile-set developer
83
+ ✓ Profile set to: developer
84
+
85
+ Settings:
86
+ Output Format: json
87
+ Color Scheme: none
88
+ Interactive Prompts: never
89
+ Confirmations: never
90
+ Show Progress: false
91
+ ```
92
+
93
+ **Switch to Marketer Profile:**
94
+ ```bash
95
+ $ cakemail config profile-set marketer
96
+ ✓ Profile set to: marketer
97
+
98
+ Settings:
99
+ Output Format: compact
100
+ Color Scheme: rich
101
+ Interactive Prompts: always
102
+ Confirmations: always
103
+ Show Progress: true
104
+ ```
105
+
106
+ **Switch to Balanced Profile:**
107
+ ```bash
108
+ $ cakemail config profile-set balanced
109
+ ✓ Profile set to: balanced
110
+
111
+ Settings:
112
+ Output Format: table
113
+ Color Scheme: moderate
114
+ Interactive Prompts: auto
115
+ Confirmations: auto
116
+ ```
117
+
118
+ ### Notes
119
+
120
+ - Profile settings are saved to `~/.cakemail/config.json`
121
+ - Settings apply immediately to all subsequent commands
122
+ - Custom settings are preserved (but profile defaults may override)
123
+ - Use `config reset` to clear custom settings
124
+
125
+ ---
126
+
127
+ ## config preview
128
+
129
+ Preview a profile's settings without switching to it.
130
+
131
+ ### Usage
132
+
133
+ ```bash
134
+ cakemail config preview <type>
135
+ ```
136
+
137
+ ### Arguments
138
+
139
+ - `<type>` - Profile type to preview (required)
140
+ - `developer`
141
+ - `marketer`
142
+ - `balanced`
143
+
144
+ ### Example
145
+
146
+ ```bash
147
+ $ cakemail config preview developer
148
+ ```
149
+
150
+ **Output:**
151
+ ```
152
+ Developer Profile Settings:
153
+ Output Format: json
154
+ Color Scheme: none
155
+ Date Format: iso8601
156
+ Show Progress: false
157
+ Interactive Prompts: never
158
+ Confirmations: never
159
+ Error Style: technical
160
+ Show Tips: false
161
+
162
+ This profile is optimized for:
163
+ - Automation and scripting
164
+ - CI/CD pipelines
165
+ - Fast, non-interactive execution
166
+ - Machine-readable output
167
+
168
+ To switch to this profile:
169
+ cakemail config profile-set developer
170
+ ```
171
+
172
+ ### Use Cases
173
+
174
+ - **Exploring profiles** before committing to a switch
175
+ - **Comparing profiles** to find the right one for your workflow
176
+ - **Documentation** - understanding what each profile does
177
+
178
+ ---
179
+
180
+ ## config set
181
+
182
+ Customize individual profile settings.
183
+
184
+ ### Usage
185
+
186
+ ```bash
187
+ cakemail config set <key> <value>
188
+ ```
189
+
190
+ ### Arguments
191
+
192
+ - `<key>` - Setting name (required)
193
+ - `<value>` - Setting value (required)
194
+
195
+ ### Available Settings
196
+
197
+ | Setting | Values | Description |
198
+ |---------|--------|-------------|
199
+ | `output_format` | `json`, `table`, `compact` | Default output format |
200
+ | `color_scheme` | `none`, `minimal`, `moderate`, `rich` | Color usage |
201
+ | `date_format` | `iso8601`, `friendly`, `relative` | Date display style |
202
+ | `show_progress` | `true`, `false` | Show progress indicators |
203
+ | `interactive_prompts` | `never`, `auto`, `always` | Interactive prompt behavior |
204
+ | `confirmations` | `never`, `auto`, `always` | Confirmation prompt behavior |
205
+ | `error_style` | `technical`, `balanced`, `friendly` | Error message style |
206
+ | `show_tips` | `true`, `false`, `auto` | Show helpful tips |
207
+
208
+ ### Examples
209
+
210
+ **Change Output Format:**
211
+ ```bash
212
+ $ cakemail config set output_format json
213
+ ✓ Setting updated: output_format = json
214
+
215
+ Current settings now differ from profile defaults.
216
+ Use 'cakemail config reset' to restore profile defaults.
217
+ ```
218
+
219
+ **Disable Colors:**
220
+ ```bash
221
+ $ cakemail config set color_scheme none
222
+ ✓ Setting updated: color_scheme = none
223
+ ```
224
+
225
+ **Always Show Prompts:**
226
+ ```bash
227
+ $ cakemail config set interactive_prompts always
228
+ ✓ Setting updated: interactive_prompts = always
229
+ ```
230
+
231
+ **Disable Progress Indicators:**
232
+ ```bash
233
+ $ cakemail config set show_progress false
234
+ ✓ Setting updated: show_progress = false
235
+ ```
236
+
237
+ ### Notes
238
+
239
+ - Custom settings override profile defaults
240
+ - Settings persist in `~/.cakemail/config.json`
241
+ - Use `config show` to see all custom settings
242
+ - Use `config reset` to clear custom settings and restore profile defaults
243
+
244
+ ### Configuration Priority
245
+
246
+ When a setting is customized:
247
+ ```
248
+ CLI flags > Custom settings > Profile defaults > Hard-coded defaults
249
+ ```
250
+
251
+ Example:
252
+ ```bash
253
+ # Custom setting
254
+ cakemail config set output_format json
255
+
256
+ # Profile default
257
+ cakemail config profile-set balanced # (default: table)
258
+
259
+ # Result: JSON (custom setting wins)
260
+ cakemail campaigns list # outputs JSON
261
+
262
+ # Override with flag
263
+ cakemail -f compact campaigns list # outputs compact (flag wins)
264
+ ```
265
+
266
+ ---
267
+
268
+ ## config reset
269
+
270
+ Reset all custom settings to profile defaults.
271
+
272
+ ### Usage
273
+
274
+ ```bash
275
+ cakemail config reset
276
+ ```
277
+
278
+ ### Example
279
+
280
+ ```bash
281
+ $ cakemail config reset
282
+ ⚠ Reset all custom settings to profile defaults?
283
+ This will remove all customizations.
284
+
285
+ Reset settings? (y/N): y
286
+
287
+ ✓ Settings reset to defaults for profile: balanced
288
+
289
+ Current Settings:
290
+ Output Format: table
291
+ Color Scheme: moderate
292
+ Date Format: friendly
293
+ Show Progress: true
294
+ ```
295
+
296
+ ### Description
297
+
298
+ Removes all custom settings and restores the defaults for your current profile. Profile selection is preserved - only custom setting overrides are cleared.
299
+
300
+ ### What Gets Reset
301
+
302
+ - Output format override
303
+ - Color scheme override
304
+ - Date format override
305
+ - Progress indicator override
306
+ - Interactive prompts override
307
+ - Confirmation override
308
+ - Error style override
309
+ - Tips override
310
+
311
+ ### What Stays
312
+
313
+ - Current profile selection
314
+ - Authentication credentials
315
+ - Account context
316
+
317
+ ### Use Cases
318
+
319
+ - **Profile switching** - Clean slate when trying a different profile
320
+ - **Troubleshooting** - Eliminate custom settings as error source
321
+ - **Defaults** - Return to recommended profile settings
322
+
323
+ ### Notes
324
+
325
+ - Requires confirmation (unless `--force` flag used)
326
+ - Cannot be undone (custom settings are lost)
327
+ - Profile remains unchanged (only custom overrides are cleared)
328
+
329
+ ---
330
+
331
+ ## config show
332
+
333
+ Show complete configuration including authentication and defaults.
334
+
335
+ ### Usage
336
+
337
+ ```bash
338
+ cakemail config show
339
+ ```
340
+
341
+ ### Example
342
+
343
+ ```bash
344
+ $ cakemail config show
345
+ ```
346
+
347
+ **Output:**
348
+ ```json
349
+ {
350
+ "profile": "balanced",
351
+ "settings": {
352
+ "output_format": "table",
353
+ "color_scheme": "moderate",
354
+ "date_format": "friendly",
355
+ "show_progress": true,
356
+ "interactive_prompts": "auto",
357
+ "confirmations": "auto",
358
+ "error_style": "balanced",
359
+ "show_tips": "auto"
360
+ },
361
+ "custom_settings": {
362
+ "output_format": "json"
363
+ },
364
+ "auth": {
365
+ "method": "access_token",
366
+ "has_token": true
367
+ },
368
+ "defaults": {
369
+ "current_account_id": 12345
370
+ },
371
+ "config_file": "/Users/username/.cakemail/config.json"
372
+ }
373
+ ```
374
+
375
+ ### Description
376
+
377
+ Displays your complete CLI configuration in JSON format. Useful for:
378
+ - Debugging configuration issues
379
+ - Sharing configuration with support
380
+ - Understanding effective settings
381
+ - Auditing custom overrides
382
+
383
+ ### Fields Explained
384
+
385
+ **profile**
386
+ - Currently active profile (developer, marketer, balanced)
387
+
388
+ **settings**
389
+ - Effective settings (combining profile defaults and custom overrides)
390
+
391
+ **custom_settings**
392
+ - Your custom overrides (if any)
393
+ - Empty object if using pure profile defaults
394
+
395
+ **auth**
396
+ - Authentication method in use
397
+ - Whether credentials are present (never shows actual credentials)
398
+
399
+ **defaults**
400
+ - Current account ID
401
+ - Other default values
402
+
403
+ **config_file**
404
+ - Path to configuration file
405
+
406
+ ### Output Format
407
+
408
+ This command always outputs JSON, regardless of profile or `-f` flag.
409
+
410
+ ---
411
+
412
+ ## Global Override Flags
413
+
414
+ In addition to config commands, you can override settings per-command:
415
+
416
+ ### --profile Flag
417
+
418
+ Use a different profile for a single command:
419
+
420
+ ```bash
421
+ # Current profile: balanced
422
+ cakemail config profile
423
+ # Profile: balanced
424
+
425
+ # Override to developer for this command only
426
+ cakemail --profile developer campaigns list
427
+ # [outputs JSON]
428
+
429
+ # Next command uses balanced again
430
+ cakemail campaigns list
431
+ # [outputs table]
432
+ ```
433
+
434
+ **Use Cases:**
435
+ - Quick non-interactive command in marketer profile
436
+ - Quick formatted output in developer profile
437
+ - Testing different profile behaviors
438
+
439
+ ### --batch Flag
440
+
441
+ Force batch mode (non-interactive) for a single command:
442
+
443
+ ```bash
444
+ cakemail --batch campaigns create --name "Newsletter" --list-id 123 --sender-id 456
445
+ ```
446
+
447
+ **Batch mode disables:**
448
+ - Interactive prompts
449
+ - Confirmations
450
+ - Progress indicators
451
+ - Tips and hints
452
+
453
+ **Use Cases:**
454
+ - Shell scripts
455
+ - CI/CD pipelines
456
+ - Cron jobs
457
+ - Any automated workflow
458
+
459
+ ---
460
+
461
+ ## Examples
462
+
463
+ ### Example 1: First-Time Profile Selection
464
+
465
+ ```bash
466
+ # View all profiles
467
+ cakemail config preview developer
468
+ cakemail config preview marketer
469
+ cakemail config preview balanced
470
+
471
+ # Choose marketer profile
472
+ cakemail config profile-set marketer
473
+
474
+ # Verify
475
+ cakemail config profile
476
+ ```
477
+
478
+ ---
479
+
480
+ ### Example 2: Developer Customization
481
+
482
+ ```bash
483
+ # Start with developer profile
484
+ cakemail config profile-set developer
485
+
486
+ # But prefer tables over JSON sometimes
487
+ cakemail config set output_format table
488
+
489
+ # Now you get:
490
+ # - No prompts (developer profile)
491
+ # - No confirmations (developer profile)
492
+ # - Table output (custom setting)
493
+ ```
494
+
495
+ ---
496
+
497
+ ### Example 3: Troubleshooting Configuration
498
+
499
+ ```bash
500
+ # Something not working right?
501
+
502
+ # 1. Check current profile
503
+ cakemail config profile
504
+
505
+ # 2. View complete configuration
506
+ cakemail config show
507
+
508
+ # 3. Reset to defaults
509
+ cakemail config reset
510
+
511
+ # 4. Try again
512
+ cakemail campaigns list
513
+ ```
514
+
515
+ ---
516
+
517
+ ### Example 4: Temporary Profile Override
518
+
519
+ ```bash
520
+ # Set marketer profile
521
+ cakemail config profile-set marketer
522
+
523
+ # Need fast JSON output once
524
+ cakemail --profile developer campaigns list
525
+
526
+ # Back to marketer for next command
527
+ cakemail campaigns create
528
+ # [shows interactive prompts]
529
+ ```
530
+
531
+ ---
532
+
533
+ ## Configuration File Location
534
+
535
+ Profile settings are stored in:
536
+ ```
537
+ ~/.cakemail/config.json
538
+ ```
539
+
540
+ ### File Structure
541
+
542
+ ```json
543
+ {
544
+ "profile": "balanced",
545
+ "custom_settings": {
546
+ "output_format": "json"
547
+ },
548
+ "auth": {
549
+ "access_token": "your_token_here"
550
+ },
551
+ "defaults": {
552
+ "current_account_id": 12345
553
+ }
554
+ }
555
+ ```
556
+
557
+ ### Manual Editing
558
+
559
+ You can manually edit `config.json`, but use config commands when possible:
560
+ - Commands validate settings
561
+ - Commands provide helpful feedback
562
+ - Commands are cross-platform compatible
563
+
564
+ ---
565
+
566
+ ## Troubleshooting
567
+
568
+ ### Settings Not Applied
569
+
570
+ **Problem:** Changed a setting but commands don't reflect it
571
+
572
+ **Solutions:**
573
+
574
+ 1. **Check effective settings:**
575
+ ```bash
576
+ cakemail config show
577
+ ```
578
+
579
+ 2. **CLI flags override everything:**
580
+ ```bash
581
+ # This ignores your profile/custom settings
582
+ cakemail -f json campaigns list
583
+ ```
584
+
585
+ 3. **Environment variables can override:**
586
+ ```bash
587
+ # Check for environment variable overrides
588
+ env | grep CAKEMAIL
589
+ ```
590
+
591
+ ---
592
+
593
+ ### Config File Missing
594
+
595
+ **Problem:** Config file deleted or corrupted
596
+
597
+ **Solution:**
598
+
599
+ Config file is created automatically on first use. Just run a command:
600
+ ```bash
601
+ cakemail config profile-set balanced
602
+ ```
603
+
604
+ ---
605
+
606
+ ### Lost Custom Settings
607
+
608
+ **Problem:** Custom settings disappeared
609
+
610
+ **Possible Causes:**
611
+
612
+ 1. **Ran `config reset`:**
613
+ - This clears all custom settings
614
+ - Cannot be undone
615
+
616
+ 2. **Switched profiles:**
617
+ - Profile switch preserves custom settings
618
+ - But profile defaults may override
619
+
620
+ 3. **Config file deleted:**
621
+ - Settings stored in `~/.cakemail/config.json`
622
+ - If deleted, settings are lost
623
+
624
+ ---
625
+
626
+ ## logout
627
+
628
+ Log out and clear all authentication tokens and configuration.
629
+
630
+ ### Usage
631
+
632
+ ```bash
633
+ cakemail logout [options]
634
+ ```
635
+
636
+ ### Options
637
+
638
+ - `-f, --force` - Skip confirmation prompt
639
+
640
+ ### Examples
641
+
642
+ **Interactive Logout:**
643
+ ```bash
644
+ $ cakemail logout
645
+ ```
646
+
647
+ **Output:**
648
+ ```
649
+ 🚪 Logout
650
+
651
+ Currently logged in as: user@example.com
652
+
653
+ This will remove:
654
+ • Authentication tokens
655
+ • Profile settings
656
+ • All saved configuration
657
+
658
+ ? Are you sure you want to log out? (y/N) y
659
+
660
+ ✓ Logged out successfully
661
+
662
+ Run any command to log in again.
663
+ ```
664
+
665
+ **Force Logout (Skip Confirmation):**
666
+ ```bash
667
+ $ cakemail logout --force
668
+ ```
669
+
670
+ **Output:**
671
+ ```
672
+ ✓ Logged out successfully
673
+ ```
674
+
675
+ ### Description
676
+
677
+ The logout command removes all stored credentials and configuration from `~/.cakemail/config.json`. This includes:
678
+
679
+ - OAuth access tokens
680
+ - OAuth refresh tokens
681
+ - Profile settings
682
+ - Account context
683
+ - All custom configuration
684
+
685
+ After logging out, you'll need to authenticate again the next time you run a command.
686
+
687
+ ### Use Cases
688
+
689
+ **Switching Accounts:**
690
+ ```bash
691
+ # Log out from current account
692
+ $ cakemail logout --force
693
+
694
+ # Run any command to log in with different account
695
+ $ cakemail campaigns list
696
+ # [Prompts for credentials]
697
+ ```
698
+
699
+ **Shared Machine:**
700
+ ```bash
701
+ # Log out when done to protect credentials
702
+ $ cakemail logout --force
703
+ ```
704
+
705
+ **Troubleshooting:**
706
+ ```bash
707
+ # Clear all config and start fresh
708
+ $ cakemail logout --force
709
+ $ cakemail campaigns list
710
+ # [Fresh authentication flow]
711
+ ```
712
+
713
+ ### Notes
714
+
715
+ - Logout is profile-aware:
716
+ - **Marketer profile**: Always confirms (unless `--force`)
717
+ - **Developer profile**: Never confirms
718
+ - **Balanced profile**: Confirms in TTY, skips in scripts
719
+ - The entire config file is deleted, not just authentication
720
+ - Cannot be undone - you'll need to re-authenticate
721
+ - Use `--force` in scripts to skip confirmation
722
+
723
+ ### See Also
724
+
725
+ - [`config show`](#config-show) - View current configuration
726
+ - [Authentication Guide](/en/cli/getting-started/authentication/) - Learn about authentication methods
727
+
728
+ ---
729
+
730
+ ## Best Practices
731
+
732
+ ### 1. Choose Profile First
733
+
734
+ Start with a profile that matches your workflow:
735
+ ```bash
736
+ cakemail config profile-set marketer # or developer or balanced
737
+ ```
738
+
739
+ ### 2. Customize Sparingly
740
+
741
+ Profiles provide sensible defaults. Only customize when necessary:
742
+ ```bash
743
+ # Good - profile is usually enough
744
+ cakemail config profile-set developer
745
+
746
+ # Avoid - defeats the purpose of profiles
747
+ cakemail config set output_format table
748
+ cakemail config set color_scheme rich
749
+ cakemail config set interactive_prompts always
750
+ # (you've basically recreated marketer profile)
751
+ ```
752
+
753
+ ### 3. Use Temporary Overrides
754
+
755
+ For one-off changes, use flags instead of changing config:
756
+ ```bash
757
+ # Good - temporary override
758
+ cakemail --profile developer campaigns list
759
+
760
+ # Avoid - changes persistent config
761
+ cakemail config set output_format json
762
+ cakemail campaigns list
763
+ cakemail config set output_format table
764
+ ```
765
+
766
+ ### 4. Document Team Profiles
767
+
768
+ For teams, document the recommended profile:
769
+ ```bash
770
+ # In your project README:
771
+ # "This project uses developer profile for CI/CD"
772
+ cakemail config profile-set developer
773
+ ```
774
+
775
+ ---
776
+