kasl-cli 1.0.1

kasl is a comprehensive command-line utility 🛠️ designed to streamline the tracking of work activities 📊, including start times ⏰, pauses ⏸, and task completion
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
//! Message type definitions for the kasl application.
//!
//! Defines the central `Message` enum that represents all user-facing messages with type safety and compile-time verification.
//!
//! ## Features
//!
//! - **Type Safety**: All messages are strongly typed with appropriate parameters
//! - **Centralization**: Single enum captures all application messaging needs  
//! - **Extensibility**: Easy addition of new message types and categories
//! - **Organization**: Logical grouping by functional categories
//! - **Internationalization**: Structure supports future localization efforts
//!
//! ## Usage
//!
//! ```rust
//! use kasl::libs::messages::types::Message;
//! use kasl::{msg_info, msg_error, msg_success};
//!
//! msg_success!(Message::TaskCreated);
//! msg_error!(Message::ConfigSaveError);
//! msg_info!(Message::MonitorStarted {
//!     pause_threshold: 60,
//!     poll_interval: 500,
//!     activity_threshold: 30,
//! });
//! ```

/// Comprehensive message enumeration for all user-facing communication.
///
/// This enum represents every type of message that the kasl application can
/// present to users. It provides a type-safe way to handle all application
/// communication while ensuring consistent formatting and proper parameter
/// handling across all components.
///
/// ## Message Categories
///
/// The enum is organized into logical categories that correspond to different
/// areas of application functionality. Each category groups related messages
/// to improve maintainability and make it easier to understand the scope
/// of each functional area.
///
/// ## Parameter Conventions
///
/// - **String Parameters**: Used for names, descriptions, and user-provided text
/// - **Numeric Parameters**: Used for counts, IDs, and measurements
/// - **Status Parameters**: Used for system states and operation results
/// - **Structured Parameters**: Named fields for complex message data
///
/// ## Adding New Messages
///
/// When adding new message variants:
/// 1. Choose the appropriate category section
/// 2. Use descriptive names that clearly indicate the message purpose
/// 3. Include necessary parameters with appropriate types
/// 4. Add corresponding text in the `Display` implementation
/// 5. Document the message purpose and usage context
///
/// ## Backward Compatibility
///
/// The enum is designed to maintain backward compatibility:
/// - New variants can be added without breaking existing code
/// - Parameter changes should be additive when possible
/// - Deprecated messages can be maintained for transition periods
#[derive(Debug, Clone)]
pub enum Message {
    // === AUTOSTART MESSAGES ===
    AutostartEnabled,
    AutostartEnabledUser,
    AutostartDisabled,
    AutostartAlreadyDisabled,
    AutostartEnableFailed(String),
    AutostartDisableFailed(String),
    AutostartStatus(String),
    AutostartNotImplemented,
    AutostartRequiresAdmin,
    AutostartCheckingAlternative,

    // === TASK MESSAGES ===
    TaskCreated,
    TaskUpdated,
    TaskDeleted,
    TaskNotFound,
    TaskCreateFailed,
    TaskUpdateFailed,
    TaskDeleteFailed,
    TasksDeletedCount(usize),
    TasksNotFoundForDate(String),
    TasksNotFoundSad,
    TasksHeader,
    TasksIncompleteHeader,
    TasksGitlabHeader,
    TasksJiraHeader,
    /// Summary line before unified discovery MultiSelect
    TasksDiscoverySummary {
        incomplete: usize,
        jira: usize,
        gitlab: usize,
    },
    /// Non-selectable separator between incomplete and other items
    TasksDiscoverySeparator,
    TasksDiscoverySearchingIncomplete,
    TasksDiscoveryFetchingExternal,
    NoTaskIdsProvided,
    TasksNotFoundForIds(Vec<i32>),
    TasksToBeDeleted,
    ConfirmDeleteTask,
    ConfirmDeleteTasks(usize),
    ConfirmDeleteAllTodayTasks(usize),
    ConfirmDeleteAllTodayTasksFinal,
    NoTasksForToday,
    TaskNotFoundWithId(i32),
    CurrentTaskState,
    TaskEditPreview,
    ConfirmTaskUpdate,
    NoChangesDetected,
    NoTasksSelected,
    SelectTasksToEdit,
    EditingTask(String),
    TaskUpdatedWithName(String),
    TaskSkippedNoChanges(String),
    TaskEditingCompleted,
    PromptTaskNameEdit,
    PromptTaskCommentEdit,
    PromptTaskCompletenessEdit,
    TaskCompletenessRange,

    // === WORKDAY MESSAGES ===
    WorkdayEnded,
    WorkdayNotFound,
    WorkdayNotFoundForDate(String),
    WorkdayCreateFailed,
    WorkdayStarting(String),                    // date
    WorkdayCouldNotFindAfterFinalizing(String), // date

    // === CONFIGURATION MESSAGES ===
    ConfigSaved,
    ConfigDeleted,
    ConfigLoaded,
    ConfigFileNotFound,
    ConfigParseError,
    ConfigSaveError,
    ConfigModuleGitLab,
    ConfigModuleJira,
    ConfigModuleSiServer,
    ConfigModuleMonitor,
    ConfigModuleServer,
    ConfigModuleProductivity,
    ConfigModuleTaskDiscovery,
    ConfigModuleJiraInbox,
    TaskDiscoveryIgnoreListHeader,
    TaskDiscoveryIgnoreListEmpty,
    TaskDiscoveryIgnoreNameAdded(String),
    TaskDiscoveryIgnoreNameExists(String),
    TaskDiscoveryIgnoreNamesAdded(usize),

    // === REPORT MESSAGES ===
    DailyReportSent(String),   // date
    MonthlyReportSent(String), // date
    MonthlyReportTriggered,
    ReportSendFailed(String),        // status
    MonthlyReportSendFailed(String), // status
    ReportHeader(String),            // date
    WorkingHoursForMonth(String),    // month/year

    // === EXPORT MESSAGES ===
    ExportingData(String, String), // data type, format
    ExportCompleted(String),       // file path
    ExportingAllData,
    ExportFailed(String), // error

    // === TEMPLATE MESSAGES ===
    TemplateCreated(String),
    TemplateUpdated(String),
    TemplateDeleted(String),
    TemplateNotFound(String),
    TemplateAlreadyExists(String),
    TemplateCreateFailed,
    NoTemplatesFound,
    TemplateListHeader,
    SelectTemplateToEdit,
    SelectTemplateToDelete,
    ConfirmDeleteTemplate(String),
    EditingTemplate(String),
    NoTemplatesMatchingQuery(String),
    TemplateSearchResults(String),
    SelectTemplateAction,
    PromptTemplateName,
    PromptTemplateTaskName,
    PromptTemplateComment,
    PromptTemplateCompleteness,
    CreatingTaskFromTemplate(String),
    SelectTemplate,
    CreateTemplateFirst,

    // === TAG MESSAGES ===
    TagCreated(String),
    TagUpdated(String),
    TagDeleted(String),
    TagNotFound(String),
    TagAlreadyExists(String),
    NoTagsFound,
    TagListHeader,
    EditingTag(String),
    SelectTagAction,
    SelectTagToEdit,
    SelectTagToDelete,
    ConfirmDeleteTag(String),
    ConfirmDeleteTagWithTasks(String, usize), // tag name, task count
    PromptTagName,
    PromptTagColor,
    NoTasksWithTag(String),
    TasksWithTag(String),
    TagsAddedToTask(String),

    // === SHORT INTERVALS MESSAGES ===
    ShortIntervalsDetected(usize, String), // count, total duration
    NoShortIntervalsFound(u64),            // min_minutes
    ShortIntervalsToRemove(usize),         // count
    RemovingPauses(usize),                 // count
    ShortIntervalsCleared(usize),          // deleted count
    NoRemovablePausesFound,
    UpdatedReport,
    PromptMinWorkInterval,

    // === TIME ADJUSTMENT MESSAGES ===
    SelectAdjustmentMode,
    PromptAdjustmentMinutes,
    PromptPauseStartTime,
    ConfirmTimeAdjustment,
    TimeAdjustmentApplied,
    AdjustmentPreview,
    InvalidAdjustmentTooMuchTime,
    InvalidPauseOutsideWorkday,
    WorkdayUpdateFailed,

    // === PAUSE MESSAGES ===
    PausesTitle(String),

    // === MONITOR MESSAGES ===
    MonitorStarted {
        pause_threshold: u64,
        poll_interval: u64,
        activity_threshold: u64,
    },
    MonitorStopped,
    MonitorStartFailed,
    MonitorStopFailed,
    MonitorExitedNormally,
    MonitorShuttingDown,
    MonitorError(String),
    MonitorTaskPanicked(String),
    PauseStarted,
    PauseEnded,

    // === WATCHER/DAEMON MESSAGES ===
    WatcherStarted(u32), // PID
    WatcherStopped(u32), // PID
    WatcherStoppedSuccessfully,
    WatcherNotRunning,
    WatcherNotRunningPidNotFound,
    WatcherStartingForeground,
    WatcherStoppingExisting(String),     // PID
    WatcherFailedToStopExisting(String), // error
    WatcherFailedToStop(u32),            // PID
    WatcherReceivedSigterm,
    WatcherReceivedSigint,
    WatcherReceivedCtrlC,
    WatcherCtrlCListenFailed(String), // error
    WatcherSignalHandlingNotSupported,
    DaemonModeNotSupported,
    FailedToGetCurrentExecutable,
    FailedToCreateSigtermHandler,
    FailedToCreateSigintHandler,

    // === UPDATE MESSAGES ===
    UpdateAvailable {
        app_name: String,
        latest: String,
    },
    UpdateCompleted {
        app_name: String,
        version: String,
    },
    NoUpdateRequired,
    UpdateDownloadUrlNotSet,
    WatcherStoppingForUpdate,
    WatcherRestartingAfterUpdate,
    WatcherStoppingForConfig,
    WatcherRestartingAfterConfig,
    WatcherRestarted,
    WatcherRestartFailed {
        error: String,
    },
    UpdateBinaryNotFoundInArchive,

    // === AUTHENTICATION MESSAGES ===
    WrongPassword(i32), // attempt count
    InvalidCredentials,
    SessionExpired,
    AuthenticationFailed(String), // service name
    JiraAuthenticateFailed,
    LoginFailed,
    CredentialsNotSet,

    // === API MESSAGES ===
    ApiConnectionFailed,
    ApiAuthFailed,
    ApiRequestFailed,
    GitlabFetchFailed(String),  // error message
    GitlabUserIdFailed(String), // error message
    JiraFetchFailed(String),    // error message
    SiServerConfigNotFound,
    SiServerSessionFailed(String),          // error message
    SiServerRestDatesFailed(String),        // error message
    SiServerRestDatesParsingFailed(String), // error message

    // === DATABASE MESSAGES ===
    DbConnectionFailed,
    DbQueryFailed,
    DbMigrationFailed,
    DatabaseOperationFailed {
        operation: String,
        error: String,
    },
    NoIdSet,

    // === FILE SYSTEM MESSAGES ===
    FileNotFound,
    FileReadError,
    FileWriteError,
    InvalidPidFileContent,
    DataStoragePathError,

    // === SYSTEM/PATH MESSAGES ===
    PathConfigured,
    PathConfigWarning {
        error: String,
    },
    PathQueryFailed(String), // status
    PathSetFailed,
    PathRegistryQueryError {
        status: String,
    },
    PathRegistryUpdateError {
        status: String,
        stderr: String,
    },
    FailedToJoinPaths,
    FailedToExecuteRegQuery,
    FailedToParseRegOutput,
    FailedToGetPathFromReg,
    FailedToExecuteRegSet,
    FailedToOpenProcess(u32),      // error code
    FailedToTerminateProcess(u32), // error code
    ProcessNotFound,
    ProcessTerminationNotSupported,

    // === PRODUCTIVITY MESSAGES ===
    MonthlyProductivity(f64), // percentage
    LowProductivityWarning {
        current: f64,
        threshold: f64,
    },
    ProductivityTooLowToSend {
        current: f64,
        threshold: f64,
    },
    ManualPauseCreated {
        start_time: String,
        end_time: String,
        duration_minutes: u64,
    },
    ManualPauseOverlaps {
        start_time: String,
        end_time: String,
    },
    ManualPauseRemoved(i32),
    ManualPauseNotFound(i32),
    ProductivityRecalculated(f64),

    // === ENCRYPTION/SECRET MESSAGES ===
    EncryptionKeyMustBeSet,
    EncryptionIvMustBeSet,

    // === PROMPTS ===
    PromptTaskName,
    TaskNameMergedFromPaste,
    PromptTaskComment,
    PromptTaskCompleteness,
    PromptGitlabToken,
    PromptGitlabUrl,
    PromptJiraLogin,
    PromptJiraUrl,
    PromptJiraPassword,
    PromptSiLogin,
    PromptSiAuthUrl,
    PromptSiApiUrl,
    PromptSiPassword,
    PromptMinPauseDuration,
    PromptPauseThreshold,
    PromptPollInterval,
    PromptActivityThreshold,
    PromptMinProductivityThreshold,
    PromptWorkdayHours,
    PromptMinWorkdayFraction,
    PromptServerApiUrl,
    PromptServerAuthToken,
    PromptConfirmDelete,
    PromptSelectOptions,
    PromptSelectModules,
    PromptSelectTasks,
    PromptSelectTasksToEdit,
    PromptSelectTasksToImport,
    PromptSelectTasksToIgnore,
    PromptSelectIgnoreNamesToRemove,
    PromptAddIgnoreName,

    // === GENERAL MESSAGES ===
    OperationCompleted,
    OperationCancelled,
    DataExported,
    BackupCreated,
    InvalidInput,
    PermissionDenied,

    // === ERROR LOGGING ===
    ErrorSendingEvents(String),        // error message
    ErrorSendingMonthlyReport(String), // error message
    ErrorInRdevListener(String),       // error message
    ErrorRequestingRestDates(String),  // error message

    // === SPECIFIC UI MESSAGES ===
    SelectingTask(String),           // task name
    SelectedTaskFormat(String, i32), // task name, completeness

    // === JIRA INBOX MESSAGES ===
    JiraInboxRequiresJiraConfig,
    JiraInboxEmpty,
    JiraInboxListHeader,
    JiraInboxSynced {
        fetched: usize,
        new_count: usize,
        updated: usize,
    },
    JiraInboxNewIssues(usize),
    JiraInboxNotFound(String),
    JiraInboxPinned(String),
    JiraInboxUnpinned(String),
    JiraInboxDismissed(String),
    JiraInboxOpened(String),
    JiraInboxTaken(String),
    JiraInboxOpenFailed(String),
    PromptJiraInboxEnabled,
    PromptJiraInboxPollInterval,
    PromptJiraInboxNotify,
    PromptJiraInboxSortFieldId,
    PromptJiraInboxSortFieldLabel,
    PromptJiraInboxExtraFieldId,
    PromptJiraInboxExtraFieldLabel,

    // === MIGRATION MESSAGES ===
    MigrationsFound(usize),        // count
    RunningMigration(u32, String), // version, name
    MigrationCompleted(u32),       // version
    MigrationFailed(u32, String),  // version, error
    AllMigrationsCompleted,
    DatabaseVersion(u32),
    DatabaseUpToDate,
    DatabaseNeedsUpdate,
    MigrationHistory,
    NothingToRollback,
    RollingBack(u32, u32),  // from, to
    RollbackCompleted(u32), // version
}