cmdx 1.7.5 → 1.9.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 (150) hide show
  1. checksums.yaml +4 -4
  2. data/.DS_Store +0 -0
  3. data/.cursor/prompts/docs.md +3 -3
  4. data/.cursor/prompts/llms.md +1 -3
  5. data/.cursor/prompts/rspec.md +1 -1
  6. data/.irbrc +14 -2
  7. data/CHANGELOG.md +62 -29
  8. data/LLM.md +203 -78
  9. data/README.md +23 -85
  10. data/docs/.DS_Store +0 -0
  11. data/docs/assets/favicon.ico +0 -0
  12. data/docs/assets/favicon.svg +1 -0
  13. data/docs/attributes/coercions.md +19 -29
  14. data/docs/attributes/defaults.md +3 -16
  15. data/docs/attributes/definitions.md +29 -39
  16. data/docs/attributes/naming.md +3 -13
  17. data/docs/attributes/transformations.md +63 -0
  18. data/docs/attributes/validations.md +23 -40
  19. data/docs/basics/chain.md +14 -23
  20. data/docs/basics/context.md +13 -22
  21. data/docs/basics/execution.md +8 -26
  22. data/docs/basics/setup.md +8 -19
  23. data/docs/callbacks.md +19 -32
  24. data/docs/deprecation.md +8 -25
  25. data/docs/getting_started.md +101 -77
  26. data/docs/index.md +120 -0
  27. data/docs/internationalization.md +6 -18
  28. data/docs/interruptions/exceptions.md +10 -16
  29. data/docs/interruptions/faults.md +8 -25
  30. data/docs/interruptions/halt.md +31 -25
  31. data/docs/logging.md +7 -17
  32. data/docs/middlewares.md +13 -29
  33. data/docs/outcomes/result.md +21 -38
  34. data/docs/outcomes/states.md +8 -22
  35. data/docs/outcomes/statuses.md +10 -21
  36. data/docs/stylesheets/extra.css +42 -0
  37. data/docs/tips_and_tricks.md +7 -46
  38. data/docs/workflows.md +23 -38
  39. data/examples/active_record_query_tagging.md +46 -0
  40. data/examples/paper_trail_whatdunnit.md +39 -0
  41. data/lib/cmdx/attribute.rb +9 -2
  42. data/lib/cmdx/attribute_value.rb +31 -10
  43. data/lib/cmdx/callback_registry.rb +12 -2
  44. data/lib/cmdx/coercions/hash.rb +6 -1
  45. data/lib/cmdx/configuration.rb +10 -2
  46. data/lib/cmdx/deprecator.rb +3 -3
  47. data/lib/cmdx/errors.rb +1 -1
  48. data/lib/cmdx/executor.rb +97 -9
  49. data/lib/cmdx/log_formatters/logstash.rb +4 -4
  50. data/lib/cmdx/pipeline.rb +4 -4
  51. data/lib/cmdx/railtie.rb +9 -0
  52. data/lib/cmdx/result.rb +10 -1
  53. data/lib/cmdx/task.rb +12 -7
  54. data/lib/cmdx/version.rb +1 -1
  55. data/lib/cmdx.rb +1 -0
  56. data/lib/generators/cmdx/templates/install.rb +9 -0
  57. data/lib/locales/af.yml +2 -2
  58. data/lib/locales/ar.yml +2 -2
  59. data/lib/locales/az.yml +2 -2
  60. data/lib/locales/be.yml +2 -2
  61. data/lib/locales/bg.yml +2 -2
  62. data/lib/locales/bn.yml +2 -2
  63. data/lib/locales/bs.yml +2 -2
  64. data/lib/locales/ca.yml +2 -2
  65. data/lib/locales/cnr.yml +2 -2
  66. data/lib/locales/cs.yml +2 -2
  67. data/lib/locales/cy.yml +2 -2
  68. data/lib/locales/da.yml +2 -2
  69. data/lib/locales/de.yml +2 -2
  70. data/lib/locales/dz.yml +2 -2
  71. data/lib/locales/el.yml +2 -2
  72. data/lib/locales/en.yml +2 -2
  73. data/lib/locales/eo.yml +2 -2
  74. data/lib/locales/es.yml +2 -2
  75. data/lib/locales/et.yml +2 -2
  76. data/lib/locales/eu.yml +2 -2
  77. data/lib/locales/fa.yml +2 -2
  78. data/lib/locales/fi.yml +2 -2
  79. data/lib/locales/fr.yml +2 -2
  80. data/lib/locales/fy.yml +2 -2
  81. data/lib/locales/gd.yml +2 -2
  82. data/lib/locales/gl.yml +2 -2
  83. data/lib/locales/he.yml +2 -2
  84. data/lib/locales/hi.yml +2 -2
  85. data/lib/locales/hr.yml +2 -2
  86. data/lib/locales/hu.yml +2 -2
  87. data/lib/locales/hy.yml +2 -2
  88. data/lib/locales/id.yml +2 -2
  89. data/lib/locales/is.yml +2 -2
  90. data/lib/locales/it.yml +2 -2
  91. data/lib/locales/ja.yml +2 -2
  92. data/lib/locales/ka.yml +2 -2
  93. data/lib/locales/kk.yml +2 -2
  94. data/lib/locales/km.yml +2 -2
  95. data/lib/locales/kn.yml +2 -2
  96. data/lib/locales/ko.yml +2 -2
  97. data/lib/locales/lb.yml +2 -2
  98. data/lib/locales/lo.yml +2 -2
  99. data/lib/locales/lt.yml +2 -2
  100. data/lib/locales/lv.yml +2 -2
  101. data/lib/locales/mg.yml +2 -2
  102. data/lib/locales/mk.yml +2 -2
  103. data/lib/locales/ml.yml +2 -2
  104. data/lib/locales/mn.yml +2 -2
  105. data/lib/locales/mr-IN.yml +2 -2
  106. data/lib/locales/ms.yml +2 -2
  107. data/lib/locales/nb.yml +2 -2
  108. data/lib/locales/ne.yml +2 -2
  109. data/lib/locales/nl.yml +2 -2
  110. data/lib/locales/nn.yml +2 -2
  111. data/lib/locales/oc.yml +2 -2
  112. data/lib/locales/or.yml +2 -2
  113. data/lib/locales/pa.yml +2 -2
  114. data/lib/locales/pl.yml +2 -2
  115. data/lib/locales/pt.yml +2 -2
  116. data/lib/locales/rm.yml +2 -2
  117. data/lib/locales/ro.yml +2 -2
  118. data/lib/locales/ru.yml +2 -2
  119. data/lib/locales/sc.yml +2 -2
  120. data/lib/locales/sk.yml +2 -2
  121. data/lib/locales/sl.yml +2 -2
  122. data/lib/locales/sq.yml +2 -2
  123. data/lib/locales/sr.yml +2 -2
  124. data/lib/locales/st.yml +2 -2
  125. data/lib/locales/sv.yml +2 -2
  126. data/lib/locales/sw.yml +2 -2
  127. data/lib/locales/ta.yml +2 -2
  128. data/lib/locales/te.yml +2 -2
  129. data/lib/locales/th.yml +2 -2
  130. data/lib/locales/tl.yml +2 -2
  131. data/lib/locales/tr.yml +2 -2
  132. data/lib/locales/tt.yml +2 -2
  133. data/lib/locales/ug.yml +2 -2
  134. data/lib/locales/uk.yml +2 -2
  135. data/lib/locales/ur.yml +2 -2
  136. data/lib/locales/uz.yml +2 -2
  137. data/lib/locales/vi.yml +2 -2
  138. data/lib/locales/wo.yml +2 -2
  139. data/lib/locales/zh-CN.yml +2 -2
  140. data/lib/locales/zh-HK.yml +2 -2
  141. data/lib/locales/zh-TW.yml +2 -2
  142. data/lib/locales/zh-YUE.yml +2 -2
  143. data/mkdocs.yml +122 -0
  144. data/src/cmdx-dark-logo.png +0 -0
  145. data/src/cmdx-favicon.svg +1 -0
  146. data/src/cmdx-light-logo.png +0 -0
  147. data/src/cmdx-logo.svg +1 -0
  148. metadata +15 -4
  149. data/lib/cmdx/freezer.rb +0 -51
  150. data/src/cmdx-logo.png +0 -0
data/docs/basics/chain.md CHANGED
@@ -1,20 +1,14 @@
1
1
  # Basics - Chain
2
2
 
3
- Chains automatically group related task executions within a thread, providing unified tracking, correlation, and execution context management. Each thread maintains its own chain through thread-local storage, eliminating the need for manual coordination.
4
-
5
- ## Table of Contents
6
-
7
- - [Management](#management)
8
- - [Links](#links)
9
- - [Inheritance](#inheritance)
10
- - [Structure](#structure)
3
+ Chains automatically track related task executions within a thread. Think of them as execution traces that help you understand what happened and in what order.
11
4
 
12
5
  ## Management
13
6
 
14
- Each thread maintains its own chain context through thread-local storage, providing automatic isolation without manual coordination.
7
+ Each thread maintains its own isolated chain using thread-local storage.
15
8
 
16
- > [!WARNING]
17
- > Chain operations are thread-local. Never share chain references across threads as this can lead to race conditions and data corruption.
9
+ !!! warning
10
+
11
+ Chains are thread-local. Don't share chain references across threads—it causes race conditions.
18
12
 
19
13
  ```ruby
20
14
  # Thread A
@@ -36,10 +30,11 @@ CMDx::Chain.clear #=> Clears current thread's chain
36
30
 
37
31
  ## Links
38
32
 
39
- Every task execution automatically creates or joins the current thread's chain:
33
+ Tasks automatically create or join the current thread's chain:
34
+
35
+ !!! warning "Important"
40
36
 
41
- > [!IMPORTANT]
42
- > Chain creation is automatic and transparent. You don't need to manually manage chain lifecycle.
37
+ Chain management is automatic—no manual lifecycle handling needed.
43
38
 
44
39
  ```ruby
45
40
  class ImportDataset < CMDx::Task
@@ -62,7 +57,7 @@ end
62
57
 
63
58
  ## Inheritance
64
59
 
65
- When tasks call subtasks within the same thread, all executions automatically inherit the current chain, creating a unified execution trail.
60
+ Subtasks automatically inherit the current thread's chain, building a unified execution trail:
66
61
 
67
62
  ```ruby
68
63
  class ImportDataset < CMDx::Task
@@ -87,10 +82,11 @@ chain.results.map { |r| r.task.class }
87
82
 
88
83
  ## Structure
89
84
 
90
- Chains provide comprehensive execution information with state delegation:
85
+ Chains expose comprehensive execution information:
91
86
 
92
- > [!IMPORTANT]
93
- > Chain state always reflects the first (outer-most) task result, not individual subtask outcomes. Subtasks maintain their own success/failure states.
87
+ !!! warning "Important"
88
+
89
+ Chain state reflects the first (outermost) task result. Subtasks maintain their own states.
94
90
 
95
91
  ```ruby
96
92
  result = ImportDataset.execute(dataset_id: 456)
@@ -110,8 +106,3 @@ chain.results.each_with_index do |result, index|
110
106
  puts "#{index}: #{result.task.class} - #{result.status}"
111
107
  end
112
108
  ```
113
-
114
- ---
115
-
116
- - **Prev:** [Basics - Context](context.md)
117
- - **Next:** [Interruptions - Halt](../interruptions/halt.md)
@@ -1,17 +1,10 @@
1
1
  # Basics - Context
2
2
 
3
- Task context provides flexible data storage, access, and sharing within task execution. It serves as the primary data container for all task inputs, intermediate results, and outputs.
4
-
5
- ## Table of Contents
6
-
7
- - [Assigning Data](#assigning-data)
8
- - [Accessing Data](#accessing-data)
9
- - [Modifying Context](#modifying-context)
10
- - [Data Sharing](#data-sharing)
3
+ Context is your data container for inputs, intermediate values, and outputs. It makes sharing data between tasks effortless.
11
4
 
12
5
  ## Assigning Data
13
6
 
14
- Context is automatically populated with all inputs passed to a task. All keys are normalized to symbols for consistent access:
7
+ Context automatically captures all task inputs, normalizing keys to symbols:
15
8
 
16
9
  ```ruby
17
10
  # Direct execution
@@ -21,12 +14,13 @@ CalculateShipping.execute(weight: 2.5, destination: "CA")
21
14
  CalculateShipping.new(weight: 2.5, "destination" => "CA")
22
15
  ```
23
16
 
24
- > [!IMPORTANT]
25
- > String keys are automatically converted to symbols. Use symbols for consistency in your code.
17
+ !!! warning "Important"
18
+
19
+ String keys convert to symbols automatically. Prefer symbols for consistency.
26
20
 
27
21
  ## Accessing Data
28
22
 
29
- Context provides multiple access patterns with automatic nil safety:
23
+ Access context data using method notation, hash keys, or safe accessors:
30
24
 
31
25
  ```ruby
32
26
  class CalculateShipping < CMDx::Task
@@ -49,8 +43,9 @@ class CalculateShipping < CMDx::Task
49
43
  end
50
44
  ```
51
45
 
52
- > [!IMPORTANT]
53
- > Accessing undefined context attributes returns `nil` instead of raising errors, enabling graceful handling of optional attributes.
46
+ !!! warning "Important"
47
+
48
+ Undefined attributes return `nil` instead of raising errors—perfect for optional data.
54
49
 
55
50
  ## Modifying Context
56
51
 
@@ -91,12 +86,13 @@ class CalculateShipping < CMDx::Task
91
86
  end
92
87
  ```
93
88
 
94
- > [!TIP]
95
- > Use context for both input values and intermediate results. This creates natural data flow through your task execution pipeline.
89
+ !!! tip
90
+
91
+ Use context for both input values and intermediate results. This creates natural data flow through your task execution pipeline.
96
92
 
97
93
  ## Data Sharing
98
94
 
99
- Context enables seamless data flow between related tasks in complex workflows:
95
+ Share context across tasks for seamless data flow:
100
96
 
101
97
  ```ruby
102
98
  # During execution
@@ -123,8 +119,3 @@ result = CalculateShipping.execute(destination: "New York, NY")
123
119
 
124
120
  CreateShippingLabel.execute(result)
125
121
  ```
126
-
127
- ---
128
-
129
- - **Prev:** [Basics - Execution](execution.md)
130
- - **Next:** [Basics - Chain](chain.md)
@@ -1,19 +1,10 @@
1
1
  # Basics - Execution
2
2
 
3
- Task execution in CMDx provides two distinct methods that handle success and halt scenarios differently. Understanding when to use each method is crucial for proper error handling and control flow in your application workflows.
3
+ CMDx offers two execution methods with different error handling approaches. Choose based on your needs: safe result handling or exception-based control flow.
4
4
 
5
- ## Table of Contents
5
+ ## Execution Methods
6
6
 
7
- - [Methods Overview](#methods-overview)
8
- - [Non-bang Execution](#non-bang-execution)
9
- - [Bang Execution](#bang-execution)
10
- - [Direct Instantiation](#direct-instantiation)
11
- - [Result Details](#result-details)
12
-
13
- ## Methods Overview
14
-
15
- Tasks are single-use objects. Once executed, they are frozen and cannot be executed again.
16
- Create a new instance for subsequent executions.
7
+ Both methods return results, but handle failures differently:
17
8
 
18
9
  | Method | Returns | Exceptions | Use Case |
19
10
  |--------|---------|------------|----------|
@@ -22,10 +13,7 @@ Create a new instance for subsequent executions.
22
13
 
23
14
  ## Non-bang Execution
24
15
 
25
- The `execute` method always returns a `CMDx::Result` object regardless of execution outcome.
26
- This is the preferred method for most use cases.
27
-
28
- Any unhandled exceptions will be caught and returned as a task failure.
16
+ Always returns a `CMDx::Result`, never raises exceptions. Perfect for most use cases.
29
17
 
30
18
  ```ruby
31
19
  result = CreateAccount.execute(email: "user@example.com")
@@ -43,17 +31,16 @@ result.status #=> "success"
43
31
 
44
32
  ## Bang Execution
45
33
 
46
- The bang `execute!` method raises a `CMDx::Fault` based exception when tasks fail or are skipped, and returns a `CMDx::Result` object only on success.
47
-
48
- It raises any unhandled non-fault exceptions caused during execution.
34
+ Raises `CMDx::Fault` exceptions on failure or skip. Returns results only on success.
49
35
 
50
36
  | Exception | Raised When |
51
37
  |-----------|-------------|
52
38
  | `CMDx::FailFault` | Task execution fails |
53
39
  | `CMDx::SkipFault` | Task execution is skipped |
54
40
 
55
- > [!IMPORTANT]
56
- > `execute!` behavior depends on the `task_breakpoints` or `workflow_breakpoints` configuration. By default, it raises exceptions only on failures.
41
+ !!! warning "Important"
42
+
43
+ Behavior depends on `task_breakpoints` or `workflow_breakpoints` config. Default: only failures raise exceptions.
57
44
 
58
45
  ```ruby
59
46
  begin
@@ -107,8 +94,3 @@ result.chain #=> Task execution chain
107
94
  result.context #=> Context with all task data
108
95
  result.metadata #=> Hash with execution metadata
109
96
  ```
110
-
111
- ---
112
-
113
- - **Prev:** [Basics - Setup](setup.md)
114
- - **Next:** [Basics - Context](context.md)
data/docs/basics/setup.md CHANGED
@@ -1,16 +1,10 @@
1
1
  # Basics - Setup
2
2
 
3
- Tasks are the core building blocks of CMDx, encapsulating business logic within structured, reusable objects. Each task represents a unit of work with automatic attribute validation, error handling, and execution tracking.
4
-
5
- ## Table of Contents
6
-
7
- - [Structure](#structure)
8
- - [Inheritance](#inheritance)
9
- - [Lifecycle](#lifecycle)
3
+ Tasks are the heart of CMDx—self-contained units of business logic with built-in validation, error handling, and execution tracking.
10
4
 
11
5
  ## Structure
12
6
 
13
- Tasks inherit from `CMDx::Task` and require only a `work` method:
7
+ Tasks need only two things: inherit from `CMDx::Task` and define a `work` method:
14
8
 
15
9
  ```ruby
16
10
  class ValidateDocument < CMDx::Task
@@ -20,7 +14,7 @@ class ValidateDocument < CMDx::Task
20
14
  end
21
15
  ```
22
16
 
23
- An exception will be raised if a work method is not defined.
17
+ Without a `work` method, execution raises `CMDx::UndefinedMethodError`.
24
18
 
25
19
  ```ruby
26
20
  class IncompleteTask < CMDx::Task
@@ -32,8 +26,7 @@ IncompleteTask.execute #=> raises CMDx::UndefinedMethodError
32
26
 
33
27
  ## Inheritance
34
28
 
35
- All configuration options are inheritable by any child classes.
36
- Create a base class to share common configuration across tasks:
29
+ Share configuration across tasks using inheritance:
37
30
 
38
31
  ```ruby
39
32
  class ApplicationTask < CMDx::Task
@@ -59,10 +52,11 @@ end
59
52
 
60
53
  ## Lifecycle
61
54
 
62
- Tasks follow a predictable call pattern with specific states and statuses:
55
+ Tasks follow a predictable execution pattern:
56
+
57
+ !!! danger "Caution"
63
58
 
64
- > [!CAUTION]
65
- > Tasks are single-use objects. Once executed, they are frozen and cannot be executed again.
59
+ Tasks are single-use objects. Once executed, they're frozen and immutable.
66
60
 
67
61
  | Stage | State | Status | Description |
68
62
  |-------|-------|--------|-------------|
@@ -71,8 +65,3 @@ Tasks follow a predictable call pattern with specific states and statuses:
71
65
  | **Execution** | `executing` | `success`/`failed`/`skipped` | `work` method runs |
72
66
  | **Completion** | `executed` | `success`/`failed`/`skipped` | Result finalized |
73
67
  | **Freezing** | `executed` | `success`/`failed`/`skipped` | Task becomes immutable |
74
-
75
- ---
76
-
77
- - **Prev:** [Getting Started](../getting_started.md)
78
- - **Next:** [Basics - Execution](execution.md)
data/docs/callbacks.md CHANGED
@@ -1,36 +1,27 @@
1
1
  # Callbacks
2
2
 
3
- Callbacks provide precise control over task execution lifecycle, running custom logic at specific transition points. Callback callables have access to the same context and result information as the `execute` method, enabling rich integration patterns.
3
+ Run custom logic at specific points during task execution. Callbacks have full access to task context and results, making them perfect for logging, notifications, cleanup, and more.
4
4
 
5
- Check out the [Getting Started](https://github.com/drexed/cmdx/blob/main/docs/getting_started.md#callbacks) docs for global configuration.
5
+ See [Global Configuration](getting_started.md#callbacks) for framework-wide callback setup.
6
6
 
7
- > [!IMPORTANT]
8
- > Callbacks execute in the order they are declared within each hook type. Multiple callbacks of the same type execute in declaration order (FIFO: first in, first out).
7
+ !!! warning "Important"
9
8
 
10
- ## Table of Contents
11
-
12
- - [Available Callbacks](#available-callbacks)
13
- - [Declarations](#declarations)
14
- - [Symbol References](#symbol-references)
15
- - [Proc or Lambda](#proc-or-lambda)
16
- - [Class or Module](#class-or-module)
17
- - [Conditional Execution](#conditional-execution)
18
- - [Callback Removal](#callback-removal)
9
+ Callbacks execute in declaration order (FIFO). Multiple callbacks of the same type run sequentially.
19
10
 
20
11
  ## Available Callbacks
21
12
 
22
- Callbacks execute in precise lifecycle order. Here is the complete execution sequence:
13
+ Callbacks execute in a predictable lifecycle order:
23
14
 
24
15
  ```ruby
25
16
  1. before_validation # Pre-validation setup
26
- 2. before_execution # Setup and preparation
17
+ 2. before_execution # Prepare for execution
27
18
 
28
- # --- Task#work executed ---
19
+ # --- Task#work executes ---
29
20
 
30
- 3. on_[complete|interrupted] # Based on execution state
31
- 4. on_executed # Task finished (any outcome)
32
- 5. on_[success|skipped|failed] # Based on execution status
33
- 6. on_[good|bad] # Based on outcome classification
21
+ 3. on_[complete|interrupted] # State-based (execution lifecycle)
22
+ 4. on_executed # Always runs after work completes
23
+ 5. on_[success|skipped|failed] # Status-based (business outcome)
24
+ 6. on_[good|bad] # Outcome-based (success/skip vs fail)
34
25
  ```
35
26
 
36
27
  ## Declarations
@@ -73,7 +64,7 @@ Use anonymous functions for inline callback logic:
73
64
  ```ruby
74
65
  class ProcessBooking < CMDx::Task
75
66
  # Proc
76
- on_interrupted proc { |task| ReservationSystem.pause! }
67
+ on_interrupted proc { ReservationSystem.pause! }
77
68
 
78
69
  # Lambda
79
70
  on_complete -> { ReservationSystem.resume! }
@@ -120,10 +111,10 @@ class ProcessBooking < CMDx::Task
120
111
  before_execution :notify_guest, if: :messaging_enabled?, unless: :messaging_blocked?
121
112
 
122
113
  # Proc
123
- on_failure :increment_failure, if: ->(task) { Rails.env.production? && task.class.name.include?("Legacy") }
114
+ on_failure :increment_failure, if: -> { Rails.env.production? && self.class.name.include?("Legacy") }
124
115
 
125
116
  # Lambda
126
- on_success :ping_housekeeping, if: proc { |task| task.context.rooms_need_cleaning? }
117
+ on_success :ping_housekeeping, if: proc { context.rooms_need_cleaning? }
127
118
 
128
119
  # Class or Module
129
120
  on_complete :send_confirmation, unless: MessagingPermissionCheck
@@ -138,7 +129,7 @@ class ProcessBooking < CMDx::Task
138
129
  private
139
130
 
140
131
  def messaging_enabled?
141
- context.guest.messaging_preference.present?
132
+ context.guest.messaging_preference == true
142
133
  end
143
134
 
144
135
  def messaging_blocked?
@@ -149,10 +140,11 @@ end
149
140
 
150
141
  ## Callback Removal
151
142
 
152
- Remove callbacks at runtime for dynamic behavior control:
143
+ Remove unwanted callbacks dynamically:
144
+
145
+ !!! warning "Important"
153
146
 
154
- > [!IMPORTANT]
155
- > Only one removal operation is allowed per `deregister` call. Multiple removals require separate calls.
147
+ Each `deregister` call removes one callback. Use multiple calls for batch removals.
156
148
 
157
149
  ```ruby
158
150
  class ProcessBooking < CMDx::Task
@@ -163,8 +155,3 @@ class ProcessBooking < CMDx::Task
163
155
  deregister :callback, :on_complete, BookingConfirmationCallback
164
156
  end
165
157
  ```
166
-
167
- ---
168
-
169
- - **Prev:** [Attributes - Defaults](attributes/defaults.md)
170
- - **Next:** [Middlewares](middlewares.md)
data/docs/deprecation.md CHANGED
@@ -1,28 +1,16 @@
1
1
  # Task Deprecation
2
2
 
3
- Task deprecation provides a systematic approach to managing legacy tasks in CMDx applications. The deprecation system enables controlled migration paths by issuing warnings, logging messages, or preventing execution of deprecated tasks entirely, helping teams maintain code quality while providing clear upgrade paths.
4
-
5
- ## Table of Contents
6
-
7
- - [Modes](#modes)
8
- - [Raise](#raise)
9
- - [Log](#log)
10
- - [Warn](#warn)
11
- - [Declarations](#declarations)
12
- - [Symbol or String](#symbol-or-string)
13
- - [Boolean or Nil](#boolean-or-nil)
14
- - [Method](#method)
15
- - [Proc or Lambda](#proc-or-lambda)
16
- - [Class or Module](#class-or-module)
3
+ Manage legacy tasks gracefully with built-in deprecation support. Choose how to handle deprecated tasks—log warnings for awareness, issue Ruby warnings for development, or prevent execution entirely.
17
4
 
18
5
  ## Modes
19
6
 
20
7
  ### Raise
21
8
 
22
- `:raise` mode prevents task execution entirely. Use this for tasks that should no longer be used under any circumstances.
9
+ Prevent task execution completely. Perfect for tasks that must no longer run.
10
+
11
+ !!! warning
23
12
 
24
- > [!WARNING]
25
- > Use `:raise` mode carefully in production environments as it will break existing workflows immediately.
13
+ Use `:raise` mode carefully—it will break existing workflows immediately.
26
14
 
27
15
  ```ruby
28
16
  class ProcessObsoleteAPI < CMDx::Task
@@ -39,7 +27,7 @@ result = ProcessObsoleteAPI.execute
39
27
 
40
28
  ### Log
41
29
 
42
- `:log` mode allows continued usage while tracking deprecation warnings. Perfect for gradual migration scenarios where immediate replacement isn't feasible.
30
+ Allow execution while tracking deprecation in logs. Ideal for gradual migrations.
43
31
 
44
32
  ```ruby
45
33
  class ProcessLegacyFormat < CMDx::Task
@@ -62,7 +50,7 @@ result.successful? #=> true
62
50
 
63
51
  ### Warn
64
52
 
65
- `:warn` mode issues Ruby warnings visible in development and testing environments. Useful for alerting developers without affecting production logging.
53
+ Issue Ruby warnings visible during development and testing. Keeps production logs clean while alerting developers.
66
54
 
67
55
  ```ruby
68
56
  class ProcessOldData < CMDx::Task
@@ -77,7 +65,7 @@ result = ProcessOldData.execute
77
65
  result.successful? #=> true
78
66
 
79
67
  # Ruby warning appears in stderr:
80
- # [ProcessOldData] DEPRECATED: migrate to replacement or discontinue use
68
+ # [ProcessOldData] DEPRECATED: migrate to a replacement or discontinue use
81
69
  ```
82
70
 
83
71
  ## Declarations
@@ -155,8 +143,3 @@ class OutdatedConnector < CMDx::Task
155
143
  settings(deprecated: OutdatedTaskDeprecator.new)
156
144
  end
157
145
  ```
158
-
159
- ---
160
-
161
- - **Prev:** [Internationalization (i18n)](internationalization.md)
162
- - **Next:** [Workflows](workflows.md)