sqlew 4.0.5 → 4.1.1

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 (217) hide show
  1. package/CHANGELOG.md +1817 -1782
  2. package/README.md +409 -468
  3. package/assets/claude-md-snippets/plan-mode-integration.md +17 -6
  4. package/assets/config.example.toml +282 -284
  5. package/assets/sample-agents/README.md +36 -40
  6. package/assets/sample-agents/sqlew-architect.md +321 -322
  7. package/assets/sample-agents/sqlew-researcher.md +292 -293
  8. package/assets/sample-agents/sqlew-scrum-master.md +286 -287
  9. package/assets/sample-commands/README.md +56 -57
  10. package/assets/sample-skills/sqlew-plan-guidance/SKILL.md +33 -26
  11. package/dist/cli/hooks/check-completion.d.ts +19 -0
  12. package/dist/cli/hooks/check-completion.d.ts.map +1 -0
  13. package/dist/cli/hooks/check-completion.js +104 -0
  14. package/dist/cli/hooks/check-completion.js.map +1 -0
  15. package/dist/cli/hooks/init-hooks.d.ts +35 -0
  16. package/dist/cli/hooks/init-hooks.d.ts.map +1 -0
  17. package/dist/cli/hooks/init-hooks.js +425 -0
  18. package/dist/cli/hooks/init-hooks.js.map +1 -0
  19. package/dist/cli/hooks/mark-done.d.ts +25 -0
  20. package/dist/cli/hooks/mark-done.d.ts.map +1 -0
  21. package/dist/cli/hooks/mark-done.js +128 -0
  22. package/dist/cli/hooks/mark-done.js.map +1 -0
  23. package/dist/cli/hooks/plan-id-utils.d.ts +83 -0
  24. package/dist/cli/hooks/plan-id-utils.d.ts.map +1 -0
  25. package/dist/cli/hooks/plan-id-utils.js +183 -0
  26. package/dist/cli/hooks/plan-id-utils.js.map +1 -0
  27. package/dist/cli/hooks/save.d.ts +23 -0
  28. package/dist/cli/hooks/save.d.ts.map +1 -0
  29. package/dist/cli/hooks/save.js +90 -0
  30. package/dist/cli/hooks/save.js.map +1 -0
  31. package/dist/cli/hooks/stdin-parser.d.ts +139 -0
  32. package/dist/cli/hooks/stdin-parser.d.ts.map +1 -0
  33. package/dist/cli/hooks/stdin-parser.js +127 -0
  34. package/dist/cli/hooks/stdin-parser.js.map +1 -0
  35. package/dist/cli/hooks/suggest.d.ts +19 -0
  36. package/dist/cli/hooks/suggest.d.ts.map +1 -0
  37. package/dist/cli/hooks/suggest.js +157 -0
  38. package/dist/cli/hooks/suggest.js.map +1 -0
  39. package/dist/cli/hooks/track-plan.d.ts +36 -0
  40. package/dist/cli/hooks/track-plan.d.ts.map +1 -0
  41. package/dist/cli/hooks/track-plan.js +152 -0
  42. package/dist/cli/hooks/track-plan.js.map +1 -0
  43. package/dist/cli.d.ts.map +1 -1
  44. package/dist/cli.js +56 -16
  45. package/dist/cli.js.map +1 -1
  46. package/dist/config/global-config.d.ts +187 -0
  47. package/dist/config/global-config.d.ts.map +1 -0
  48. package/dist/config/global-config.js +206 -0
  49. package/dist/config/global-config.js.map +1 -0
  50. package/dist/config/loader.d.ts +42 -0
  51. package/dist/config/loader.d.ts.map +1 -1
  52. package/dist/config/loader.js +96 -0
  53. package/dist/config/loader.js.map +1 -1
  54. package/dist/constants.d.ts +4 -0
  55. package/dist/constants.d.ts.map +1 -1
  56. package/dist/constants.js +10 -0
  57. package/dist/constants.js.map +1 -1
  58. package/dist/database/migrations/v4/20251126000000_v4_bootstrap.js +59 -59
  59. package/dist/database/migrations/v4/20251126000000_v4_bootstrap.js.map +1 -1
  60. package/dist/database/migrations/v4/20251126000001_v4_migrate_data.js +33 -33
  61. package/dist/database/migrations/v4/20251126000001_v4_migrate_data.js.map +1 -1
  62. package/dist/database/migrations/v4/20251127000000_add_rejected_status.js +7 -7
  63. package/dist/database/migrations/v4/20251127000000_add_rejected_status.js.map +1 -1
  64. package/dist/database/migrations/v4/20251127000001_update_task_move_help.js +11 -11
  65. package/dist/database/migrations/v4/20251127000001_update_task_move_help.js.map +1 -1
  66. package/dist/database/migrations/v4/20251127000002_v4_seed_help_system.js +10 -10
  67. package/dist/database/migrations/v4/20251127000002_v4_seed_help_system.js.map +1 -1
  68. package/dist/database/migrations/v4/20251127000003_add_task_notes_column.js +7 -7
  69. package/dist/database/migrations/v4/20251127000003_add_task_notes_column.js.map +1 -1
  70. package/dist/database/migrations/v4/20251128000000_drop_all_views.js +8 -8
  71. package/dist/database/migrations/v4/20251128000000_drop_all_views.js.map +1 -1
  72. package/dist/database/operations/queries.d.ts.map +1 -1
  73. package/dist/database/operations/queries.js +11 -2
  74. package/dist/database/operations/queries.js.map +1 -1
  75. package/dist/index.js +4 -1
  76. package/dist/index.js.map +1 -1
  77. package/dist/init-agents.js +0 -1
  78. package/dist/init-agents.js.map +1 -1
  79. package/dist/init-skills.d.ts +4 -3
  80. package/dist/init-skills.d.ts.map +1 -1
  81. package/dist/init-skills.js +10 -3
  82. package/dist/init-skills.js.map +1 -1
  83. package/dist/server/setup.d.ts +8 -0
  84. package/dist/server/setup.d.ts.map +1 -1
  85. package/dist/server/setup.js +141 -21
  86. package/dist/server/setup.js.map +1 -1
  87. package/dist/sync-agents.d.ts.map +1 -1
  88. package/dist/sync-agents.js +48 -3
  89. package/dist/sync-agents.js.map +1 -1
  90. package/dist/sync-commands.d.ts.map +1 -1
  91. package/dist/sync-commands.js +43 -3
  92. package/dist/sync-commands.js.map +1 -1
  93. package/dist/tools/constraints/actions/get.d.ts.map +1 -1
  94. package/dist/tools/constraints/actions/get.js +5 -8
  95. package/dist/tools/constraints/actions/get.js.map +1 -1
  96. package/dist/tools/constraints/help/help.d.ts.map +1 -1
  97. package/dist/tools/constraints/help/help.js +1 -6
  98. package/dist/tools/constraints/help/help.js.map +1 -1
  99. package/dist/tools/context/actions/get.d.ts.map +1 -1
  100. package/dist/tools/context/actions/get.js.map +1 -1
  101. package/dist/tools/context/actions/search-layer.d.ts.map +1 -1
  102. package/dist/tools/context/actions/search-layer.js +5 -3
  103. package/dist/tools/context/actions/search-layer.js.map +1 -1
  104. package/dist/tools/context/actions/set-from-policy.d.ts +2 -1
  105. package/dist/tools/context/actions/set-from-policy.d.ts.map +1 -1
  106. package/dist/tools/context/actions/set-from-policy.js.map +1 -1
  107. package/dist/tools/context/help/help.d.ts.map +1 -1
  108. package/dist/tools/context/help/help.js +1 -7
  109. package/dist/tools/context/help/help.js.map +1 -1
  110. package/dist/tools/context/internal/queries.d.ts.map +1 -1
  111. package/dist/tools/context/internal/queries.js +5 -2
  112. package/dist/tools/context/internal/queries.js.map +1 -1
  113. package/dist/tools/context/types.d.ts +1 -1
  114. package/dist/tools/context/types.d.ts.map +1 -1
  115. package/dist/tools/files/actions/get.d.ts.map +1 -1
  116. package/dist/tools/files/actions/get.js +4 -6
  117. package/dist/tools/files/actions/get.js.map +1 -1
  118. package/dist/tools/files/help/help.d.ts.map +1 -1
  119. package/dist/tools/files/help/help.js +1 -6
  120. package/dist/tools/files/help/help.js.map +1 -1
  121. package/dist/tools/suggest/help/constraint-help.d.ts.map +1 -1
  122. package/dist/tools/suggest/help/constraint-help.js +0 -2
  123. package/dist/tools/suggest/help/constraint-help.js.map +1 -1
  124. package/dist/tools/suggest/internal/constraint-queries.d.ts.map +1 -1
  125. package/dist/tools/suggest/internal/constraint-queries.js +12 -5
  126. package/dist/tools/suggest/internal/constraint-queries.js.map +1 -1
  127. package/dist/tools/suggest/internal/queries.js +2 -2
  128. package/dist/tools/suggest/internal/queries.js.map +1 -1
  129. package/dist/tools/tasks/help/help.d.ts.map +1 -1
  130. package/dist/tools/tasks/help/help.js +0 -6
  131. package/dist/tools/tasks/help/help.js.map +1 -1
  132. package/dist/tools/tasks/help/use-case.d.ts.map +1 -1
  133. package/dist/tools/tasks/help/use-case.js +0 -1
  134. package/dist/tools/tasks/help/use-case.js.map +1 -1
  135. package/dist/tools/tasks/watcher/status.d.ts.map +1 -1
  136. package/dist/tools/tasks/watcher/status.js +5 -1
  137. package/dist/tools/tasks/watcher/status.js.map +1 -1
  138. package/dist/types/decision/params.d.ts +7 -6
  139. package/dist/types/decision/params.d.ts.map +1 -1
  140. package/dist/types/decision/templates.d.ts +3 -2
  141. package/dist/types/decision/templates.d.ts.map +1 -1
  142. package/dist/types/view-entities.d.ts +2 -1
  143. package/dist/types/view-entities.d.ts.map +1 -1
  144. package/dist/types.d.ts +19 -11
  145. package/dist/types.d.ts.map +1 -1
  146. package/dist/types.js +4 -1
  147. package/dist/types.js.map +1 -1
  148. package/dist/utils/enum-converter.d.ts +72 -0
  149. package/dist/utils/enum-converter.d.ts.map +1 -0
  150. package/dist/utils/enum-converter.js +76 -0
  151. package/dist/utils/enum-converter.js.map +1 -0
  152. package/dist/utils/hook-queue.d.ts +81 -0
  153. package/dist/utils/hook-queue.d.ts.map +1 -0
  154. package/dist/utils/hook-queue.js +156 -0
  155. package/dist/utils/hook-queue.js.map +1 -0
  156. package/dist/utils/project-root.d.ts +9 -2
  157. package/dist/utils/project-root.d.ts.map +1 -1
  158. package/dist/utils/project-root.js +16 -2
  159. package/dist/utils/project-root.js.map +1 -1
  160. package/dist/utils/tag-parser.d.ts.map +1 -1
  161. package/dist/utils/tag-parser.js +6 -0
  162. package/dist/utils/tag-parser.js.map +1 -1
  163. package/dist/utils/universal-knex.js +3 -3
  164. package/dist/utils/universal-knex.js.map +1 -1
  165. package/dist/utils/validators.d.ts +1 -1
  166. package/dist/utils/validators.d.ts.map +1 -1
  167. package/dist/utils/validators.js +1 -1
  168. package/dist/utils/validators.js.map +1 -1
  169. package/dist/utils/vcs-adapter.d.ts +44 -0
  170. package/dist/utils/vcs-adapter.d.ts.map +1 -1
  171. package/dist/utils/vcs-adapter.js +88 -0
  172. package/dist/utils/vcs-adapter.js.map +1 -1
  173. package/dist/utils/view-queries.d.ts.map +1 -1
  174. package/dist/utils/view-queries.js +9 -19
  175. package/dist/utils/view-queries.js.map +1 -1
  176. package/dist/watcher/base-watcher.d.ts +69 -0
  177. package/dist/watcher/base-watcher.d.ts.map +1 -0
  178. package/dist/watcher/base-watcher.js +130 -0
  179. package/dist/watcher/base-watcher.js.map +1 -0
  180. package/dist/watcher/index.d.ts +3 -0
  181. package/dist/watcher/index.d.ts.map +1 -1
  182. package/dist/watcher/index.js +2 -0
  183. package/dist/watcher/index.js.map +1 -1
  184. package/dist/watcher/queue-watcher.d.ts +64 -0
  185. package/dist/watcher/queue-watcher.d.ts.map +1 -0
  186. package/dist/watcher/queue-watcher.js +187 -0
  187. package/dist/watcher/queue-watcher.js.map +1 -0
  188. package/docs/ADR_CONCEPTS.md +140 -0
  189. package/docs/CONFIGURATION.md +922 -925
  190. package/docs/CROSS_DATABASE.md +153 -0
  191. package/docs/DATABASE_AUTH.md +70 -356
  192. package/docs/HOOKS_GUIDE.md +159 -0
  193. package/docs/SLASH_COMMANDS.md +329 -337
  194. package/docs/TASK_SYSTEM_DEPRECATED.md +88 -0
  195. package/docs/changelogs/CHANGELOG_ARCHIVE_v3.4_and_older.md +293 -296
  196. package/docs/cli/DATA_EXPORT_IMPORT.md +699 -700
  197. package/docs/cli/README.md +276 -277
  198. package/package.json +123 -124
  199. package/docs/ACCEPTANCE_CRITERIA.md +0 -625
  200. package/docs/AI_AGENT_GUIDE.md +0 -299
  201. package/docs/ARCHITECTURE.md +0 -167
  202. package/docs/AUTO_FILE_TRACKING.md +0 -841
  203. package/docs/BATCH_VALIDATION.md +0 -617
  204. package/docs/BEST_PRACTICES.md +0 -168
  205. package/docs/CONSTRAINT_INTELLIGENCE.md +0 -339
  206. package/docs/DECISION_CONTEXT.md +0 -697
  207. package/docs/DECISION_INTELLIGENCE.md +0 -605
  208. package/docs/GIT_AWARE_AUTO_COMPLETE.md +0 -646
  209. package/docs/MIGRATION_GUIDE_V3.9.0.md +0 -371
  210. package/docs/SHARED_CONCEPTS.md +0 -225
  211. package/docs/SPECIALIZED_AGENTS.md +0 -126
  212. package/docs/TASK_ACTIONS.md +0 -1177
  213. package/docs/TASK_OVERVIEW.md +0 -452
  214. package/docs/TASK_PRUNING.md +0 -594
  215. package/docs/TOOL_REFERENCE.md +0 -1077
  216. package/docs/TOOL_SELECTION.md +0 -83
  217. package/docs/WORKFLOWS.md +0 -941
@@ -1,925 +1,922 @@
1
- # sqlew Configuration Guide
2
-
3
- **Complete guide to configuring sqlew via CLI arguments and config files**
4
-
5
- ## Table of Contents
6
-
7
- 1. [Overview](#overview)
8
- 2. [Configuration Priority](#configuration-priority)
9
- 3. [Config File Format](#config-file-format)
10
- 4. [Configuration Options](#configuration-options)
11
- 5. [Setup Instructions](#setup-instructions)
12
- 6. [Validation Rules](#validation-rules)
13
- 7. [Runtime Configuration](#runtime-configuration)
14
- 8. [Common Configurations](#common-configurations)
15
- 9. [Troubleshooting](#troubleshooting)
16
-
17
- ---
18
-
19
- ## Overview
20
-
21
- sqlew supports flexible configuration through two mechanisms:
22
-
23
- - **CLI arguments** - Override settings at startup (highest priority)
24
- - **Config file** (`.sqlew/config.toml`) - Persistent project settings
25
-
26
- ### Why Use Config Files?
27
-
28
- **Benefits:**
29
- - ✅ **Persistent settings** - No need to specify CLI args every time
30
- - ✅ **Version control** - Commit config to share team settings
31
- - ✅ **Documentation** - Self-documenting project requirements
32
- - ✅ **Type safety** - TOML validation catches errors early
33
- - ✅ **Separation of concerns** - Config separate from code
34
-
35
- **When to use:**
36
- - Multi-developer projects with shared settings
37
- - Different settings per environment (dev/staging/prod)
38
- - Complex retention policies (weekend-aware, long retention)
39
- - Custom database locations
40
-
41
- ---
42
-
43
- ## Configuration Priority
44
-
45
- sqlew applies configuration in this order (highest to lowest priority):
46
-
47
- ```
48
- 1. CLI Arguments (--autodelete-message-hours=48)
49
-
50
- 2. Config File (.sqlew/config.toml)
51
-
52
- 3. Code Defaults (DEFAULT_CONFIG in types.ts)
53
- ```
54
-
55
- **Example:**
56
- ```toml
57
- # .sqlew/config.toml
58
- [autodelete]
59
- message_hours = 24
60
- ```
61
-
62
- ```bash
63
- # CLI overrides config file
64
- npx sqlew --autodelete-message-hours=48
65
-
66
- # Result: message_hours = 48 (CLI wins)
67
- ```
68
-
69
- **After startup:**
70
- - CLI and config file values are merged
71
- - Settings are held in memory during runtime
72
-
73
- ---
74
-
75
- ## Config File Format
76
-
77
- ### Location
78
-
79
- **Default path:** `.sqlew/config.toml` (relative to project root)
80
-
81
- **Custom path:** Specify via `--config-path` CLI argument
82
- ```bash
83
- npx sqlew --config-path=config/custom.toml
84
- ```
85
-
86
- ### TOML Structure
87
-
88
- Config file uses TOML format with three sections:
89
-
90
- ```toml
91
- [database] # Database location
92
- [autodelete] # Retention policies
93
- [tasks] # Task management
94
- ```
95
-
96
- ### Complete Example
97
-
98
- ```toml
99
- # sqlew Configuration File
100
- # Copy from .sqlew/config.toml.example and customize
101
-
102
- # ============================================================================
103
- # Database Settings
104
- # ============================================================================
105
- [database]
106
- # Database file path (relative to project root or absolute)
107
- # Default: ".sqlew/sqlew.db"
108
- path = ".sqlew/custom.db"
109
- # path = "/absolute/path/to/database.db"
110
-
111
- # ============================================================================
112
- # Auto-Deletion Settings
113
- # ============================================================================
114
- [autodelete]
115
- # Skip weekends when calculating retention periods
116
- # When true: 24 hours on Monday = previous Friday (skips Sat/Sun)
117
- # When false: 24 hours = exactly 24 hours ago
118
- # Default: false
119
- ignore_weekend = false
120
-
121
- # Message retention period in hours (1-720)
122
- # Messages older than this are automatically deleted
123
- # Default: 24 (1 day)
124
- message_hours = 24
125
-
126
- # File change history retention in days (1-365)
127
- # File changes older than this are automatically deleted
128
- # Default: 7 (1 week)
129
- file_history_days = 7
130
-
131
- # ============================================================================
132
- # Task Management Settings
133
- # ============================================================================
134
- [tasks]
135
- # Git-aware auto-complete (v3.4.0)
136
- # Enable automatic completion when all watched files are committed
137
- # Default: true
138
- git_auto_complete_enabled = true
139
-
140
- # Require all watched files to be committed for auto-complete
141
- # When true: All watched files must be committed (strict)
142
- # When false: At least one watched file committed (permissive)
143
- # Default: true
144
- require_all_files_committed = true
145
-
146
- # Notification threshold for stale waiting_review tasks (hours, 1-720)
147
- # Tasks stuck in 'waiting_review' longer than this → notification
148
- # Note: v3.4.0 removed auto-revert to 'todo' behavior
149
- # Default: 48 (2 days)
150
- stale_review_notification_hours = 48
151
-
152
- # Auto-archive done tasks after N days (1-365)
153
- # Tasks in 'done' status older than this are moved to 'archived'
154
- # Keeps task list clean while preserving history
155
- # Default: 2 (48 hours)
156
- auto_archive_done_days = 2
157
-
158
- # Stale detection threshold for 'in_progress' tasks (hours, 1-168)
159
- # Tasks stuck in 'in_progress' longer than this → move to 'waiting_review'
160
- # Helps recover from interrupted AI sessions
161
- # Default: 2 (2 hours)
162
- stale_hours_in_progress = 2
163
-
164
- # Stale detection threshold for 'waiting_review' tasks (hours, 1-720)
165
- # DEPRECATED in v3.4.0 (kept for backward compatibility)
166
- # No longer auto-reverts to 'todo' - use stale_review_notification_hours instead
167
- # Default: 24 (1 day)
168
- stale_hours_waiting_review = 24
169
-
170
- # Enable automatic stale detection
171
- # When true: Runs stale detection on startup and before task operations
172
- # When false: Stale detection disabled (manual only)
173
- # Default: true
174
- auto_stale_enabled = true
175
- ```
176
-
177
- ---
178
-
179
- ## Configuration Options
180
-
181
- ### Database Settings
182
-
183
- #### `database.path`
184
-
185
- **Description:** Database file location
186
-
187
- **Type:** String (file path)
188
-
189
- **Default:** `.sqlew/sqlew.db`
190
-
191
- **Examples:**
192
- ```toml
193
- # Relative path (from project root)
194
- [database]
195
- path = ".sqlew/custom.db"
196
-
197
- # Absolute path
198
- path = "/var/data/sqlew/production.db"
199
-
200
- # Per-environment config
201
- path = ".sqlew/dev.db" # development
202
- path = ".sqlew/prod.db" # production
203
- ```
204
-
205
- **CLI Override:**
206
- ```bash
207
- npx sqlew /path/to/database.db
208
- ```
209
-
210
- ---
211
-
212
- ### Auto-Deletion Settings
213
-
214
- #### `autodelete.ignore_weekend`
215
-
216
- **Description:** Skip weekends when calculating retention periods
217
-
218
- **Type:** Boolean
219
-
220
- **Default:** `false`
221
-
222
- **Behavior:**
223
- - `false`: Standard time-based (24h = 24 hours ago)
224
- - `true`: Skip weekends (24h on Monday = Friday 24h ago)
225
-
226
- **Use cases:**
227
- - Development teams (no work on weekends)
228
- - Business-hours-only projects
229
- - Preserve Friday context through Monday
230
-
231
- **Examples:**
232
- ```toml
233
- [autodelete]
234
- # Preserve weekend context
235
- ignore_weekend = true
236
- message_hours = 24
237
-
238
- # Result on Monday 9am:
239
- # - false: Deletes messages before Sunday 9am
240
- # - true: Deletes messages before Friday 9am (skips Sat/Sun)
241
- ```
242
-
243
- **CLI Override:**
244
- ```bash
245
- npx sqlew --autodelete-ignore-weekend
246
- npx sqlew --autodelete-ignore-weekend=true
247
- ```
248
-
249
- #### `autodelete.message_hours`
250
-
251
- **Description:** Message retention period in hours
252
-
253
- **Type:** Integer (1-720)
254
-
255
- **Default:** `24` (1 day)
256
-
257
- **Range:** 1 hour to 720 hours (30 days)
258
-
259
- **Examples:**
260
- ```toml
261
- [autodelete]
262
- message_hours = 1 # Aggressive cleanup (dev)
263
- message_hours = 24 # Default (1 day)
264
- message_hours = 168 # 1 week
265
- message_hours = 720 # 30 days (max)
266
- ```
267
-
268
- **CLI Override:**
269
- ```bash
270
- npx sqlew --autodelete-message-hours=48
271
- ```
272
-
273
- #### `autodelete.file_history_days`
274
-
275
- **Description:** File change history retention in days
276
-
277
- **Type:** Integer (1-365)
278
-
279
- **Default:** `7` (1 week)
280
-
281
- **Range:** 1 day to 365 days (1 year)
282
-
283
- **Examples:**
284
- ```toml
285
- [autodelete]
286
- file_history_days = 1 # Aggressive cleanup (dev)
287
- file_history_days = 7 # Default (1 week)
288
- file_history_days = 30 # 1 month
289
- file_history_days = 365 # 1 year (max)
290
- ```
291
-
292
- **CLI Override:**
293
- ```bash
294
- npx sqlew --autodelete-file-history-days=30
295
- ```
296
-
297
- ---
298
-
299
- ### Task Management Settings
300
-
301
- #### `tasks.git_auto_complete_enabled`
302
-
303
- **Description:** Enable git-aware auto-complete for waiting_review tasks
304
-
305
- **Type:** Boolean
306
-
307
- **Default:** `true`
308
-
309
- **Behavior:**
310
- - `true`: Tasks in `waiting_review` auto-complete to `done` when all watched files are committed to git
311
- - `false`: Manual completion required (no git integration)
312
-
313
- **Use cases:**
314
- - Auto-completion based on git commits
315
- - Ensure work is properly tracked in version control
316
- - Reduce manual task management overhead
317
-
318
- **Examples:**
319
- ```toml
320
- [tasks]
321
- # Enable git-aware auto-complete (default)
322
- git_auto_complete_enabled = true
323
-
324
- # Disable git-aware auto-complete
325
- git_auto_complete_enabled = false
326
- ```
327
-
328
- **Configure via CLI arguments only**
329
-
330
- #### `tasks.require_all_files_committed`
331
-
332
- **Description:** Require all watched files to be committed before auto-complete
333
-
334
- **Type:** Boolean
335
-
336
- **Default:** `true`
337
-
338
- **Behavior:**
339
- - `true`: All watched files must be committed (strict mode)
340
- - `false`: At least one watched file committed triggers auto-complete (permissive mode)
341
-
342
- **Use cases:**
343
- - Strict mode: Ensure complete work is committed
344
- - Permissive mode: Allow partial commits to trigger completion
345
-
346
- **Examples:**
347
- ```toml
348
- [tasks]
349
- # Require all watched files committed (strict - default)
350
- require_all_files_committed = true
351
-
352
- # Allow partial commits (permissive)
353
- require_all_files_committed = false
354
- ```
355
-
356
- **Configure via CLI arguments only**
357
-
358
- #### `tasks.stale_review_notification_hours`
359
-
360
- **Description:** Notification threshold for stale waiting_review tasks (hours)
361
-
362
- **Type:** Integer (1-720)
363
-
364
- **Default:** `48` (2 days)
365
-
366
- **Range:** 1 hour to 720 hours (30 days)
367
-
368
- **Behavior:**
369
- - Tasks in `waiting_review` > threshold → generate notification
370
- - Does NOT auto-transition (removed in v3.4.0)
371
- - Helps identify tasks stuck in review
372
-
373
- **Examples:**
374
- ```toml
375
- [tasks]
376
- stale_review_notification_hours = 24 # Notify after 1 day
377
- stale_review_notification_hours = 48 # Default (2 days)
378
- stale_review_notification_hours = 72 # Notify after 3 days
379
- stale_review_notification_hours = 168 # Notify after 1 week
380
- ```
381
-
382
- **Configure via CLI arguments only**
383
-
384
- #### `tasks.auto_archive_done_days`
385
-
386
- **Description:** Auto-archive done tasks after N days
387
-
388
- **Type:** Integer (1-365)
389
-
390
- **Default:** `2` (48 hours)
391
-
392
- **Range:** 1 day to 365 days
393
-
394
- **Behavior:**
395
- - Tasks in `done` status older than threshold → `archived`
396
- - Keeps task board clean while preserving history
397
- - Archived tasks still queryable via `task` tool
398
-
399
- **Examples:**
400
- ```toml
401
- [tasks]
402
- auto_archive_done_days = 1 # Quick cleanup (demo/dev)
403
- auto_archive_done_days = 2 # Default (48 hours)
404
- auto_archive_done_days = 7 # 1 week (production)
405
- auto_archive_done_days = 30 # Long retention
406
- ```
407
-
408
- **Configure via CLI arguments only**
409
-
410
- #### `tasks.stale_hours_in_progress`
411
-
412
- **Description:** Stale detection threshold for `in_progress` tasks
413
-
414
- **Type:** Integer (1-168)
415
-
416
- **Default:** `2` (2 hours)
417
-
418
- **Range:** 1 hour to 168 hours (7 days)
419
-
420
- **Behavior:**
421
- - Tasks in `in_progress` > threshold → `waiting_review`
422
- - Helps recover from interrupted AI sessions
423
- - Runs on startup and before task operations
424
-
425
- **Examples:**
426
- ```toml
427
- [tasks]
428
- stale_hours_in_progress = 1 # Aggressive (1 hour)
429
- stale_hours_in_progress = 2 # Default (2 hours)
430
- stale_hours_in_progress = 4 # Relaxed (4 hours)
431
- stale_hours_in_progress = 24 # Very relaxed (1 day)
432
- ```
433
-
434
- **Configure via CLI arguments only**
435
-
436
- #### `tasks.stale_hours_waiting_review`
437
-
438
- **Description:** Stale detection threshold for `waiting_review` tasks
439
-
440
- **Type:** Integer (1-720)
441
-
442
- **Default:** `24` (1 day)
443
-
444
- **Range:** 1 hour to 720 hours (30 days)
445
-
446
- **Behavior:**
447
- - Tasks in `waiting_review` > threshold → `todo`
448
- - Prevents abandoned reviews from blocking workflow
449
- - Runs on startup and before task operations
450
-
451
- **Examples:**
452
- ```toml
453
- [tasks]
454
- stale_hours_waiting_review = 8 # Aggressive (8 hours)
455
- stale_hours_waiting_review = 24 # Default (1 day)
456
- stale_hours_waiting_review = 48 # Relaxed (2 days)
457
- stale_hours_waiting_review = 168 # Very relaxed (1 week)
458
- ```
459
-
460
- **Configure via CLI arguments only**
461
-
462
- #### `tasks.auto_stale_enabled`
463
-
464
- **Description:** Enable automatic stale detection
465
-
466
- **Type:** Boolean
467
-
468
- **Default:** `true`
469
-
470
- **Behavior:**
471
- - `true`: Runs stale detection on startup and before task operations
472
- - `false`: Stale detection disabled (manual only via MCP tool)
473
-
474
- **Examples:**
475
- ```toml
476
- [tasks]
477
- # Enable auto-stale (default)
478
- auto_stale_enabled = true
479
-
480
- # Disable auto-stale (manual control only)
481
- auto_stale_enabled = false
482
- ```
483
-
484
- **Configure via CLI arguments only**
485
-
486
- ---
487
-
488
- ## Setup Instructions
489
-
490
- ### 1. Copy Example Config
491
-
492
- ```bash
493
- # Navigate to project root
494
- cd /path/to/your/project
495
-
496
- # Copy example config
497
- cp .sqlew/config.toml.example .sqlew/config.toml
498
- ```
499
-
500
- ### 2. Customize Settings
501
-
502
- Edit `.sqlew/config.toml`:
503
-
504
- ```toml
505
- [database]
506
- # Use custom database location
507
- path = ".sqlew/my-project.db"
508
-
509
- [autodelete]
510
- # Weekend-aware cleanup for development team
511
- ignore_weekend = true
512
- message_hours = 48
513
- file_history_days = 14
514
-
515
- [tasks]
516
- # Quick archival for fast-paced projects
517
- auto_archive_done_days = 1
518
- stale_hours_in_progress = 1
519
- stale_hours_waiting_review = 12
520
- ```
521
-
522
- ### 3. Version Control (Optional)
523
-
524
- ```bash
525
- # Add to git (share team settings)
526
- git add .sqlew/config.toml
527
- git commit -m "Add sqlew configuration"
528
-
529
- # Or ignore (per-developer settings)
530
- echo ".sqlew/config.toml" >> .gitignore
531
- ```
532
-
533
- ### 4. Start sqlew
534
-
535
- ```bash
536
- # Uses .sqlew/config.toml automatically
537
- npx sqlew
538
-
539
- # Or specify custom config path
540
- npx sqlew --config-path=config/custom.toml
541
- ```
542
-
543
- ### 5. Verify Configuration
544
-
545
- Check the console output on startup to verify configuration was loaded:
546
-
547
- ```
548
- ✓ Loaded 7 config values from file (.sqlew/config.toml)
549
- ✓ Configuration merged with CLI arguments
550
- ```
551
-
552
- Settings are loaded from config file and CLI arguments at startup.
553
-
554
- ---
555
-
556
- ## Validation Rules
557
-
558
- sqlew validates all configuration values on startup:
559
-
560
- ### Auto-Deletion Rules
561
-
562
- | Setting | Min | Max | Default |
563
- |---------|-----|-----|---------|
564
- | `message_hours` | 1 | 720 | 24 |
565
- | `file_history_days` | 1 | 365 | 7 |
566
-
567
- **Validation errors:**
568
- ```toml
569
- [autodelete]
570
- message_hours = 0 # ❌ Error: must be >= 1
571
- message_hours = 1000 # ❌ Error: must be <= 720
572
- ```
573
-
574
- ### Task Management Rules
575
-
576
- | Setting | Min | Max | Default |
577
- |---------|-----|-----|---------|
578
- | `auto_archive_done_days` | 1 | 365 | 2 |
579
- | `stale_hours_in_progress` | 1 | 168 | 2 |
580
- | `stale_hours_waiting_review` | 1 | 720 | 24 |
581
-
582
- **Validation errors:**
583
- ```toml
584
- [tasks]
585
- stale_hours_in_progress = 0 # ❌ Error: must be >= 1
586
- stale_hours_in_progress = 200 # ❌ Error: must be <= 168
587
- ```
588
-
589
- ### Error Handling
590
-
591
- **On validation failure:**
592
- 1. sqlew prints warnings to console
593
- 2. Invalid values ignored
594
- 3. Falls back to defaults
595
- 4. Server continues to start
596
-
597
- **Example output:**
598
- ```
599
- ⚠️ Configuration validation warnings:
600
- - autodelete.message_hours must be between 1 and 720 (30 days)
601
- - tasks.stale_hours_in_progress must be between 1 and 168 (7 days)
602
- Using default configuration
603
- ```
604
-
605
- ---
606
-
607
- ## Runtime Configuration
608
-
609
- ### Configuration Methods (v4.0.0)
610
-
611
- v4.0.0 uses **CLI arguments only** for configuration. The config MCP tool has been removed.
612
-
613
- **Configuration priority:**
614
- 1. **CLI Arguments** - Highest priority, applied at startup
615
- 2. **Config File** (.sqlew/config.toml) - Persistent project settings
616
- 3. **Code Defaults** - Built-in defaults (lowest priority)
617
-
618
- ### CLI Arguments (Recommended)
619
-
620
- Use CLI arguments for one-time overrides or environment-specific settings:
621
-
622
- ```bash
623
- # Override specific settings at startup
624
- npx sqlew --autodelete-message-hours=48 --autodelete-ignore-weekend
625
-
626
- # Multiple arguments can be combined
627
- npx sqlew \
628
- --db-path=.sqlew/prod.db \
629
- --autodelete-ignore-weekend \
630
- --autodelete-message-hours=168 \
631
- --autodelete-file-history-days=30
632
- ```
633
-
634
- **Available CLI arguments:**
635
- ```bash
636
- --db-path=/path/to/database.db # Database file location
637
- --autodelete-ignore-weekend # Skip weekends in retention
638
- --autodelete-message-hours=N # Message retention (1-720 hours)
639
- --autodelete-file-history-days=N # File history retention (1-365 days)
640
- --config-path=/path/to/config.toml # Custom config file location
641
- ```
642
-
643
- ### File-Based Configuration (Recommended)
644
-
645
- Edit `.sqlew/config.toml` directly for persistent settings:
646
-
647
- ```toml
648
- [database]
649
- path = ".sqlew/custom.db"
650
-
651
- [autodelete]
652
- ignore_weekend = true
653
- message_hours = 48
654
- file_history_days = 14
655
-
656
- [tasks]
657
- git_auto_complete_enabled = true
658
- auto_archive_done_days = 2
659
- ```
660
-
661
- **Benefits:**
662
- 1. **Persistent** - Settings survive server restarts
663
- 2. **Version control** - Commit config to git, share with team
664
- 3. **Documentation** - Config file documents project requirements
665
- 4. **Type safety** - TOML validation catches errors at startup
666
-
667
- ### Applying Configuration Changes
668
-
669
- **To apply changes:**
670
- 1. **Edit** `.sqlew/config.toml` or update CLI arguments
671
- 2. **Restart** the MCP server (changes take effect on startup)
672
- 3. **Verify** via console output showing loaded configuration
673
-
674
- Merged settings are held in memory during runtime.
675
-
676
- ---
677
-
678
- ## Common Configurations
679
-
680
- ### Development (Aggressive Cleanup)
681
-
682
- **Use case:** Fast iteration, minimal data retention
683
-
684
- ```toml
685
- [autodelete]
686
- ignore_weekend = false
687
- message_hours = 1
688
- file_history_days = 1
689
-
690
- [tasks]
691
- auto_archive_done_days = 1
692
- stale_hours_in_progress = 1
693
- stale_hours_waiting_review = 8
694
- auto_stale_enabled = true
695
- ```
696
-
697
- ### Production (Conservative Retention)
698
-
699
- **Use case:** Long-term projects, preserve history
700
-
701
- ```toml
702
- [autodelete]
703
- ignore_weekend = false
704
- message_hours = 168 # 7 days
705
- file_history_days = 30
706
-
707
- [tasks]
708
- auto_archive_done_days = 7
709
- stale_hours_in_progress = 4
710
- stale_hours_waiting_review = 48
711
- auto_stale_enabled = true
712
- ```
713
-
714
- ### Weekend-Aware Workflow
715
-
716
- **Use case:** Developer teams (no weekend work)
717
-
718
- ```toml
719
- [autodelete]
720
- ignore_weekend = true # Skip weekends
721
- message_hours = 48
722
- file_history_days = 14
723
-
724
- [tasks]
725
- auto_archive_done_days = 2
726
- stale_hours_in_progress = 2
727
- stale_hours_waiting_review = 24
728
- auto_stale_enabled = true
729
- ```
730
-
731
- ### Manual Control (No Auto-Cleanup)
732
-
733
- **Use case:** Full control, manual cleanup only
734
-
735
- ```toml
736
- [autodelete]
737
- ignore_weekend = false
738
- message_hours = 720 # Max retention (30 days)
739
- file_history_days = 365 # Max retention (1 year)
740
-
741
- [tasks]
742
- auto_archive_done_days = 365
743
- stale_hours_in_progress = 168 # 7 days (max)
744
- stale_hours_waiting_review = 720 # 30 days (max)
745
- auto_stale_enabled = false # Disable auto-stale
746
- ```
747
-
748
- ### Multi-Environment Setup
749
-
750
- **Development:**
751
- ```toml
752
- # .sqlew/dev.toml
753
- [database]
754
- path = ".sqlew/dev.db"
755
-
756
- [autodelete]
757
- message_hours = 1
758
- file_history_days = 1
759
- ```
760
-
761
- **Production:**
762
- ```toml
763
- # .sqlew/prod.toml
764
- [database]
765
- path = ".sqlew/prod.db"
766
-
767
- [autodelete]
768
- message_hours = 168
769
- file_history_days = 30
770
- ```
771
-
772
- **Usage:**
773
- ```bash
774
- # Development
775
- npx sqlew --config-path=.sqlew/dev.toml
776
-
777
- # Production
778
- npx sqlew --config-path=.sqlew/prod.toml
779
- ```
780
-
781
- ---
782
-
783
- ## Troubleshooting
784
-
785
- ### Config File Not Found
786
-
787
- **Symptom:**
788
- ```
789
- ⚠️ Failed to load config file: .sqlew/config.toml
790
- Error: ENOENT: no such file or directory
791
- Using default configuration
792
- ```
793
-
794
- **Solution:**
795
- 1. Config file is optional - this is not an error
796
- 2. Create config file if needed:
797
- ```bash
798
- cp .sqlew/config.toml.example .sqlew/config.toml
799
- ```
800
-
801
- ### Invalid TOML Syntax
802
-
803
- **Symptom:**
804
- ```
805
- ⚠️ Failed to load config file: .sqlew/config.toml
806
- Error: Invalid TOML: Unexpected character at line 5
807
- Using default configuration
808
- ```
809
-
810
- **Solution:**
811
- 1. Validate TOML syntax: https://www.toml-lint.com/
812
- 2. Common errors:
813
- ```toml
814
- # ❌ Wrong: Missing quotes for strings with spaces
815
- path = /path with spaces/db.db
816
-
817
- # ✅ Correct: Quote strings with spaces
818
- path = "/path with spaces/db.db"
819
-
820
- # ❌ Wrong: Invalid boolean
821
- ignore_weekend = yes
822
-
823
- # ✅ Correct: Use true/false
824
- ignore_weekend = true
825
- ```
826
-
827
- ### Values Not Applied
828
-
829
- **Symptom:** Changed config file but values not reflected
830
-
831
- **Solution:**
832
- 1. **Check priority:** CLI args override config file
833
- ```bash
834
- # CLI wins over config file
835
- npx sqlew --autodelete-message-hours=24
836
- ```
837
-
838
- 2. **Verify config loading:**
839
- ```bash
840
- # Check console output on startup
841
- ✓ Loaded 7 config values from file
842
- ```
843
-
844
- ### Validation Warnings
845
-
846
- **Symptom:**
847
- ```
848
- ⚠️ Configuration validation warnings:
849
- - autodelete.message_hours must be between 1 and 720 (30 days)
850
- ```
851
-
852
- **Solution:**
853
- 1. Check validation rules (see [Validation Rules](#validation-rules))
854
- 2. Fix invalid values in config file
855
- 3. Restart sqlew
856
-
857
- ### Database Path Issues
858
-
859
- **Symptom:**
860
- ```
861
- Error: SQLITE_CANTOPEN: unable to open database file
862
- ```
863
-
864
- **Solution:**
865
- 1. **Check path syntax:**
866
- ```toml
867
- # ❌ Wrong: Relative to config file location
868
- path = "sqlew.db"
869
-
870
- # ✅ Correct: Relative to project root
871
- path = ".sqlew/sqlew.db"
872
- ```
873
-
874
- 2. **Use absolute paths for clarity:**
875
- ```toml
876
- path = "/absolute/path/to/database.db"
877
- ```
878
-
879
- 3. **Ensure directory exists:**
880
- - sqlew auto-creates parent directory
881
- - Check file permissions
882
-
883
- ### Weekend-Aware Not Working
884
-
885
- **Symptom:** Weekend dates not skipped in retention
886
-
887
- **Solution:**
888
- 1. **Check configuration:**
889
- ```toml
890
- [autodelete]
891
- ignore_weekend = true # Must be true, not "true"
892
- ```
893
-
894
- 2. **Test behavior:**
895
- - Monday cleanup should reference Friday
896
- - Not Saturday/Sunday
897
-
898
- ---
899
-
900
- ## Related Documentation
901
-
902
- - **[Architecture](ARCHITECTURE.md)** - Database schema and system design
903
- - **[Tool Reference](TOOL_REFERENCE.md)** - MCP tool usage
904
- - **[Best Practices](BEST_PRACTICES.md)** - Configuration recommendations
905
-
906
- ---
907
-
908
- ## Example Files
909
-
910
- ### Minimal Configuration
911
-
912
- ```toml
913
- # .sqlew/config.toml (minimal)
914
- [autodelete]
915
- ignore_weekend = true
916
- message_hours = 48
917
- ```
918
-
919
- ### Full Configuration with Comments
920
-
921
- See `.sqlew/config.toml.example` in project root for complete annotated example.
922
-
923
- ---
924
-
925
- **Last Updated:** v4.0.0 (2025-11-27)
1
+ # sqlew Configuration Guide
2
+
3
+ **Complete guide to configuring sqlew via CLI arguments and config files**
4
+
5
+ ## Table of Contents
6
+
7
+ 1. [Overview](#overview)
8
+ 2. [Configuration Priority](#configuration-priority)
9
+ 3. [Config File Format](#config-file-format)
10
+ 4. [Configuration Options](#configuration-options)
11
+ 5. [Setup Instructions](#setup-instructions)
12
+ 6. [Validation Rules](#validation-rules)
13
+ 7. [Runtime Configuration](#runtime-configuration)
14
+ 8. [Common Configurations](#common-configurations)
15
+ 9. [Troubleshooting](#troubleshooting)
16
+
17
+ ---
18
+
19
+ ## Overview
20
+
21
+ sqlew supports flexible configuration through two mechanisms:
22
+
23
+ - **CLI arguments** - Override settings at startup (highest priority)
24
+ - **Config file** (`.sqlew/config.toml`) - Persistent project settings
25
+
26
+ ### Why Use Config Files?
27
+
28
+ **Benefits:**
29
+ - ✅ **Persistent settings** - No need to specify CLI args every time
30
+ - ✅ **Version control** - Commit config to share team settings
31
+ - ✅ **Documentation** - Self-documenting project requirements
32
+ - ✅ **Type safety** - TOML validation catches errors early
33
+ - ✅ **Separation of concerns** - Config separate from code
34
+
35
+ **When to use:**
36
+ - Multi-developer projects with shared settings
37
+ - Different settings per environment (dev/staging/prod)
38
+ - Complex retention policies (weekend-aware, long retention)
39
+ - Custom database locations
40
+
41
+ ---
42
+
43
+ ## Configuration Priority
44
+
45
+ sqlew applies configuration in this order (highest to lowest priority):
46
+
47
+ ```
48
+ 1. CLI Arguments (--autodelete-message-hours=48)
49
+
50
+ 2. Config File (.sqlew/config.toml)
51
+
52
+ 3. Code Defaults (DEFAULT_CONFIG in types.ts)
53
+ ```
54
+
55
+ **Example:**
56
+ ```toml
57
+ # .sqlew/config.toml
58
+ [autodelete]
59
+ message_hours = 24
60
+ ```
61
+
62
+ ```bash
63
+ # CLI overrides config file
64
+ npx sqlew --autodelete-message-hours=48
65
+
66
+ # Result: message_hours = 48 (CLI wins)
67
+ ```
68
+
69
+ **After startup:**
70
+ - CLI and config file values are merged
71
+ - Settings are held in memory during runtime
72
+
73
+ ---
74
+
75
+ ## Config File Format
76
+
77
+ ### Location
78
+
79
+ **Default path:** `.sqlew/config.toml` (relative to project root)
80
+
81
+ **Custom path:** Specify via `--config-path` CLI argument
82
+ ```bash
83
+ npx sqlew --config-path=config/custom.toml
84
+ ```
85
+
86
+ ### TOML Structure
87
+
88
+ Config file uses TOML format with three sections:
89
+
90
+ ```toml
91
+ [database] # Database location
92
+ [autodelete] # Retention policies
93
+ [tasks] # Task management
94
+ ```
95
+
96
+ ### Complete Example
97
+
98
+ ```toml
99
+ # sqlew Configuration File
100
+ # Copy from .sqlew/config.toml.example and customize
101
+
102
+ # ============================================================================
103
+ # Database Settings
104
+ # ============================================================================
105
+ [database]
106
+ # Database file path (relative to project root or absolute)
107
+ # Default: ".sqlew/sqlew.db"
108
+ path = ".sqlew/custom.db"
109
+ # path = "/absolute/path/to/database.db"
110
+
111
+ # ============================================================================
112
+ # Auto-Deletion Settings
113
+ # ============================================================================
114
+ [autodelete]
115
+ # Skip weekends when calculating retention periods
116
+ # When true: 24 hours on Monday = previous Friday (skips Sat/Sun)
117
+ # When false: 24 hours = exactly 24 hours ago
118
+ # Default: false
119
+ ignore_weekend = false
120
+
121
+ # Message retention period in hours (1-720)
122
+ # Messages older than this are automatically deleted
123
+ # Default: 24 (1 day)
124
+ message_hours = 24
125
+
126
+ # File change history retention in days (1-365)
127
+ # File changes older than this are automatically deleted
128
+ # Default: 7 (1 week)
129
+ file_history_days = 7
130
+
131
+ # ============================================================================
132
+ # Task Management Settings
133
+ # ============================================================================
134
+ [tasks]
135
+ # Git-aware auto-complete (v3.4.0)
136
+ # Enable automatic completion when all watched files are committed
137
+ # Default: true
138
+ git_auto_complete_enabled = true
139
+
140
+ # Require all watched files to be committed for auto-complete
141
+ # When true: All watched files must be committed (strict)
142
+ # When false: At least one watched file committed (permissive)
143
+ # Default: true
144
+ require_all_files_committed = true
145
+
146
+ # Notification threshold for stale waiting_review tasks (hours, 1-720)
147
+ # Tasks stuck in 'waiting_review' longer than this → notification
148
+ # Note: v3.4.0 removed auto-revert to 'todo' behavior
149
+ # Default: 48 (2 days)
150
+ stale_review_notification_hours = 48
151
+
152
+ # Auto-archive done tasks after N days (1-365)
153
+ # Tasks in 'done' status older than this are moved to 'archived'
154
+ # Keeps task list clean while preserving history
155
+ # Default: 2 (48 hours)
156
+ auto_archive_done_days = 2
157
+
158
+ # Stale detection threshold for 'in_progress' tasks (hours, 1-168)
159
+ # Tasks stuck in 'in_progress' longer than this → move to 'waiting_review'
160
+ # Helps recover from interrupted AI sessions
161
+ # Default: 2 (2 hours)
162
+ stale_hours_in_progress = 2
163
+
164
+ # Stale detection threshold for 'waiting_review' tasks (hours, 1-720)
165
+ # DEPRECATED in v3.4.0 (kept for backward compatibility)
166
+ # No longer auto-reverts to 'todo' - use stale_review_notification_hours instead
167
+ # Default: 24 (1 day)
168
+ stale_hours_waiting_review = 24
169
+
170
+ # Enable automatic stale detection
171
+ # When true: Runs stale detection on startup and before task operations
172
+ # When false: Stale detection disabled (manual only)
173
+ # Default: true
174
+ auto_stale_enabled = true
175
+ ```
176
+
177
+ ---
178
+
179
+ ## Configuration Options
180
+
181
+ ### Database Settings
182
+
183
+ #### `database.path`
184
+
185
+ **Description:** Database file location
186
+
187
+ **Type:** String (file path)
188
+
189
+ **Default:** `.sqlew/sqlew.db`
190
+
191
+ **Examples:**
192
+ ```toml
193
+ # Relative path (from project root)
194
+ [database]
195
+ path = ".sqlew/custom.db"
196
+
197
+ # Absolute path
198
+ path = "/var/data/sqlew/production.db"
199
+
200
+ # Per-environment config
201
+ path = ".sqlew/dev.db" # development
202
+ path = ".sqlew/prod.db" # production
203
+ ```
204
+
205
+ **CLI Override:**
206
+ ```bash
207
+ npx sqlew /path/to/database.db
208
+ ```
209
+
210
+ ---
211
+
212
+ ### Auto-Deletion Settings
213
+
214
+ #### `autodelete.ignore_weekend`
215
+
216
+ **Description:** Skip weekends when calculating retention periods
217
+
218
+ **Type:** Boolean
219
+
220
+ **Default:** `false`
221
+
222
+ **Behavior:**
223
+ - `false`: Standard time-based (24h = 24 hours ago)
224
+ - `true`: Skip weekends (24h on Monday = Friday 24h ago)
225
+
226
+ **Use cases:**
227
+ - Development teams (no work on weekends)
228
+ - Business-hours-only projects
229
+ - Preserve Friday context through Monday
230
+
231
+ **Examples:**
232
+ ```toml
233
+ [autodelete]
234
+ # Preserve weekend context
235
+ ignore_weekend = true
236
+ message_hours = 24
237
+
238
+ # Result on Monday 9am:
239
+ # - false: Deletes messages before Sunday 9am
240
+ # - true: Deletes messages before Friday 9am (skips Sat/Sun)
241
+ ```
242
+
243
+ **CLI Override:**
244
+ ```bash
245
+ npx sqlew --autodelete-ignore-weekend
246
+ npx sqlew --autodelete-ignore-weekend=true
247
+ ```
248
+
249
+ #### `autodelete.message_hours`
250
+
251
+ **Description:** Message retention period in hours
252
+
253
+ **Type:** Integer (1-720)
254
+
255
+ **Default:** `24` (1 day)
256
+
257
+ **Range:** 1 hour to 720 hours (30 days)
258
+
259
+ **Examples:**
260
+ ```toml
261
+ [autodelete]
262
+ message_hours = 1 # Aggressive cleanup (dev)
263
+ message_hours = 24 # Default (1 day)
264
+ message_hours = 168 # 1 week
265
+ message_hours = 720 # 30 days (max)
266
+ ```
267
+
268
+ **CLI Override:**
269
+ ```bash
270
+ npx sqlew --autodelete-message-hours=48
271
+ ```
272
+
273
+ #### `autodelete.file_history_days`
274
+
275
+ **Description:** File change history retention in days
276
+
277
+ **Type:** Integer (1-365)
278
+
279
+ **Default:** `7` (1 week)
280
+
281
+ **Range:** 1 day to 365 days (1 year)
282
+
283
+ **Examples:**
284
+ ```toml
285
+ [autodelete]
286
+ file_history_days = 1 # Aggressive cleanup (dev)
287
+ file_history_days = 7 # Default (1 week)
288
+ file_history_days = 30 # 1 month
289
+ file_history_days = 365 # 1 year (max)
290
+ ```
291
+
292
+ **CLI Override:**
293
+ ```bash
294
+ npx sqlew --autodelete-file-history-days=30
295
+ ```
296
+
297
+ ---
298
+
299
+ ### Task Management Settings
300
+
301
+ #### `tasks.git_auto_complete_enabled`
302
+
303
+ **Description:** Enable git-aware auto-complete for waiting_review tasks
304
+
305
+ **Type:** Boolean
306
+
307
+ **Default:** `true`
308
+
309
+ **Behavior:**
310
+ - `true`: Tasks in `waiting_review` auto-complete to `done` when all watched files are committed to git
311
+ - `false`: Manual completion required (no git integration)
312
+
313
+ **Use cases:**
314
+ - Auto-completion based on git commits
315
+ - Ensure work is properly tracked in version control
316
+ - Reduce manual task management overhead
317
+
318
+ **Examples:**
319
+ ```toml
320
+ [tasks]
321
+ # Enable git-aware auto-complete (default)
322
+ git_auto_complete_enabled = true
323
+
324
+ # Disable git-aware auto-complete
325
+ git_auto_complete_enabled = false
326
+ ```
327
+
328
+ **Configure via CLI arguments only**
329
+
330
+ #### `tasks.require_all_files_committed`
331
+
332
+ **Description:** Require all watched files to be committed before auto-complete
333
+
334
+ **Type:** Boolean
335
+
336
+ **Default:** `true`
337
+
338
+ **Behavior:**
339
+ - `true`: All watched files must be committed (strict mode)
340
+ - `false`: At least one watched file committed triggers auto-complete (permissive mode)
341
+
342
+ **Use cases:**
343
+ - Strict mode: Ensure complete work is committed
344
+ - Permissive mode: Allow partial commits to trigger completion
345
+
346
+ **Examples:**
347
+ ```toml
348
+ [tasks]
349
+ # Require all watched files committed (strict - default)
350
+ require_all_files_committed = true
351
+
352
+ # Allow partial commits (permissive)
353
+ require_all_files_committed = false
354
+ ```
355
+
356
+ **Configure via CLI arguments only**
357
+
358
+ #### `tasks.stale_review_notification_hours`
359
+
360
+ **Description:** Notification threshold for stale waiting_review tasks (hours)
361
+
362
+ **Type:** Integer (1-720)
363
+
364
+ **Default:** `48` (2 days)
365
+
366
+ **Range:** 1 hour to 720 hours (30 days)
367
+
368
+ **Behavior:**
369
+ - Tasks in `waiting_review` > threshold → generate notification
370
+ - Does NOT auto-transition (removed in v3.4.0)
371
+ - Helps identify tasks stuck in review
372
+
373
+ **Examples:**
374
+ ```toml
375
+ [tasks]
376
+ stale_review_notification_hours = 24 # Notify after 1 day
377
+ stale_review_notification_hours = 48 # Default (2 days)
378
+ stale_review_notification_hours = 72 # Notify after 3 days
379
+ stale_review_notification_hours = 168 # Notify after 1 week
380
+ ```
381
+
382
+ **Configure via CLI arguments only**
383
+
384
+ #### `tasks.auto_archive_done_days`
385
+
386
+ **Description:** Auto-archive done tasks after N days
387
+
388
+ **Type:** Integer (1-365)
389
+
390
+ **Default:** `2` (48 hours)
391
+
392
+ **Range:** 1 day to 365 days
393
+
394
+ **Behavior:**
395
+ - Tasks in `done` status older than threshold → `archived`
396
+ - Keeps task board clean while preserving history
397
+ - Archived tasks still queryable via `task` tool
398
+
399
+ **Examples:**
400
+ ```toml
401
+ [tasks]
402
+ auto_archive_done_days = 1 # Quick cleanup (demo/dev)
403
+ auto_archive_done_days = 2 # Default (48 hours)
404
+ auto_archive_done_days = 7 # 1 week (production)
405
+ auto_archive_done_days = 30 # Long retention
406
+ ```
407
+
408
+ **Configure via CLI arguments only**
409
+
410
+ #### `tasks.stale_hours_in_progress`
411
+
412
+ **Description:** Stale detection threshold for `in_progress` tasks
413
+
414
+ **Type:** Integer (1-168)
415
+
416
+ **Default:** `2` (2 hours)
417
+
418
+ **Range:** 1 hour to 168 hours (7 days)
419
+
420
+ **Behavior:**
421
+ - Tasks in `in_progress` > threshold → `waiting_review`
422
+ - Helps recover from interrupted AI sessions
423
+ - Runs on startup and before task operations
424
+
425
+ **Examples:**
426
+ ```toml
427
+ [tasks]
428
+ stale_hours_in_progress = 1 # Aggressive (1 hour)
429
+ stale_hours_in_progress = 2 # Default (2 hours)
430
+ stale_hours_in_progress = 4 # Relaxed (4 hours)
431
+ stale_hours_in_progress = 24 # Very relaxed (1 day)
432
+ ```
433
+
434
+ **Configure via CLI arguments only**
435
+
436
+ #### `tasks.stale_hours_waiting_review`
437
+
438
+ **Description:** Stale detection threshold for `waiting_review` tasks
439
+
440
+ **Type:** Integer (1-720)
441
+
442
+ **Default:** `24` (1 day)
443
+
444
+ **Range:** 1 hour to 720 hours (30 days)
445
+
446
+ **Behavior:**
447
+ - Tasks in `waiting_review` > threshold → `todo`
448
+ - Prevents abandoned reviews from blocking workflow
449
+ - Runs on startup and before task operations
450
+
451
+ **Examples:**
452
+ ```toml
453
+ [tasks]
454
+ stale_hours_waiting_review = 8 # Aggressive (8 hours)
455
+ stale_hours_waiting_review = 24 # Default (1 day)
456
+ stale_hours_waiting_review = 48 # Relaxed (2 days)
457
+ stale_hours_waiting_review = 168 # Very relaxed (1 week)
458
+ ```
459
+
460
+ **Configure via CLI arguments only**
461
+
462
+ #### `tasks.auto_stale_enabled`
463
+
464
+ **Description:** Enable automatic stale detection
465
+
466
+ **Type:** Boolean
467
+
468
+ **Default:** `true`
469
+
470
+ **Behavior:**
471
+ - `true`: Runs stale detection on startup and before task operations
472
+ - `false`: Stale detection disabled (manual only via MCP tool)
473
+
474
+ **Examples:**
475
+ ```toml
476
+ [tasks]
477
+ # Enable auto-stale (default)
478
+ auto_stale_enabled = true
479
+
480
+ # Disable auto-stale (manual control only)
481
+ auto_stale_enabled = false
482
+ ```
483
+
484
+ **Configure via CLI arguments only**
485
+
486
+ ---
487
+
488
+ ## Setup Instructions
489
+
490
+ ### 1. Copy Example Config
491
+
492
+ ```bash
493
+ # Navigate to project root
494
+ cd /path/to/your/project
495
+
496
+ # Copy example config
497
+ cp .sqlew/config.toml.example .sqlew/config.toml
498
+ ```
499
+
500
+ ### 2. Customize Settings
501
+
502
+ Edit `.sqlew/config.toml`:
503
+
504
+ ```toml
505
+ [database]
506
+ # Use custom database location
507
+ path = ".sqlew/my-project.db"
508
+
509
+ [autodelete]
510
+ # Weekend-aware cleanup for development team
511
+ ignore_weekend = true
512
+ message_hours = 48
513
+ file_history_days = 14
514
+
515
+ [tasks]
516
+ # Quick archival for fast-paced projects
517
+ auto_archive_done_days = 1
518
+ stale_hours_in_progress = 1
519
+ stale_hours_waiting_review = 12
520
+ ```
521
+
522
+ ### 3. Version Control (Optional)
523
+
524
+ ```bash
525
+ # Add to git (share team settings)
526
+ git add .sqlew/config.toml
527
+ git commit -m "Add sqlew configuration"
528
+
529
+ # Or ignore (per-developer settings)
530
+ echo ".sqlew/config.toml" >> .gitignore
531
+ ```
532
+
533
+ ### 4. Start sqlew
534
+
535
+ ```bash
536
+ # Uses .sqlew/config.toml automatically
537
+ npx sqlew
538
+
539
+ # Or specify custom config path
540
+ npx sqlew --config-path=config/custom.toml
541
+ ```
542
+
543
+ ### 5. Verify Configuration
544
+
545
+ Check the console output on startup to verify configuration was loaded:
546
+
547
+ ```
548
+ ✓ Loaded 7 config values from file (.sqlew/config.toml)
549
+ ✓ Configuration merged with CLI arguments
550
+ ```
551
+
552
+ Settings are loaded from config file and CLI arguments at startup.
553
+
554
+ ---
555
+
556
+ ## Validation Rules
557
+
558
+ sqlew validates all configuration values on startup:
559
+
560
+ ### Auto-Deletion Rules
561
+
562
+ | Setting | Min | Max | Default |
563
+ |---------|-----|-----|---------|
564
+ | `message_hours` | 1 | 720 | 24 |
565
+ | `file_history_days` | 1 | 365 | 7 |
566
+
567
+ **Validation errors:**
568
+ ```toml
569
+ [autodelete]
570
+ message_hours = 0 # ❌ Error: must be >= 1
571
+ message_hours = 1000 # ❌ Error: must be <= 720
572
+ ```
573
+
574
+ ### Task Management Rules
575
+
576
+ | Setting | Min | Max | Default |
577
+ |---------|-----|-----|---------|
578
+ | `auto_archive_done_days` | 1 | 365 | 2 |
579
+ | `stale_hours_in_progress` | 1 | 168 | 2 |
580
+ | `stale_hours_waiting_review` | 1 | 720 | 24 |
581
+
582
+ **Validation errors:**
583
+ ```toml
584
+ [tasks]
585
+ stale_hours_in_progress = 0 # ❌ Error: must be >= 1
586
+ stale_hours_in_progress = 200 # ❌ Error: must be <= 168
587
+ ```
588
+
589
+ ### Error Handling
590
+
591
+ **On validation failure:**
592
+ 1. sqlew prints warnings to console
593
+ 2. Invalid values ignored
594
+ 3. Falls back to defaults
595
+ 4. Server continues to start
596
+
597
+ **Example output:**
598
+ ```
599
+ ⚠️ Configuration validation warnings:
600
+ - autodelete.message_hours must be between 1 and 720 (30 days)
601
+ - tasks.stale_hours_in_progress must be between 1 and 168 (7 days)
602
+ Using default configuration
603
+ ```
604
+
605
+ ---
606
+
607
+ ## Runtime Configuration
608
+
609
+ ### Configuration Methods (v4.0.0)
610
+
611
+ v4.0.0 uses **CLI arguments only** for configuration. The config MCP tool has been removed.
612
+
613
+ **Configuration priority:**
614
+ 1. **CLI Arguments** - Highest priority, applied at startup
615
+ 2. **Config File** (.sqlew/config.toml) - Persistent project settings
616
+ 3. **Code Defaults** - Built-in defaults (lowest priority)
617
+
618
+ ### CLI Arguments (Recommended)
619
+
620
+ Use CLI arguments for one-time overrides or environment-specific settings:
621
+
622
+ ```bash
623
+ # Override specific settings at startup
624
+ npx sqlew --autodelete-message-hours=48 --autodelete-ignore-weekend
625
+
626
+ # Multiple arguments can be combined
627
+ npx sqlew \
628
+ --db-path=.sqlew/prod.db \
629
+ --autodelete-ignore-weekend \
630
+ --autodelete-message-hours=168 \
631
+ --autodelete-file-history-days=30
632
+ ```
633
+
634
+ **Available CLI arguments:**
635
+ ```bash
636
+ --db-path=/path/to/database.db # Database file location
637
+ --autodelete-ignore-weekend # Skip weekends in retention
638
+ --autodelete-message-hours=N # Message retention (1-720 hours)
639
+ --autodelete-file-history-days=N # File history retention (1-365 days)
640
+ --config-path=/path/to/config.toml # Custom config file location
641
+ ```
642
+
643
+ ### File-Based Configuration (Recommended)
644
+
645
+ Edit `.sqlew/config.toml` directly for persistent settings:
646
+
647
+ ```toml
648
+ [database]
649
+ path = ".sqlew/custom.db"
650
+
651
+ [autodelete]
652
+ ignore_weekend = true
653
+ message_hours = 48
654
+ file_history_days = 14
655
+
656
+ [tasks]
657
+ git_auto_complete_enabled = true
658
+ auto_archive_done_days = 2
659
+ ```
660
+
661
+ **Benefits:**
662
+ 1. **Persistent** - Settings survive server restarts
663
+ 2. **Version control** - Commit config to git, share with team
664
+ 3. **Documentation** - Config file documents project requirements
665
+ 4. **Type safety** - TOML validation catches errors at startup
666
+
667
+ ### Applying Configuration Changes
668
+
669
+ **To apply changes:**
670
+ 1. **Edit** `.sqlew/config.toml` or update CLI arguments
671
+ 2. **Restart** the MCP server (changes take effect on startup)
672
+ 3. **Verify** via console output showing loaded configuration
673
+
674
+ Merged settings are held in memory during runtime.
675
+
676
+ ---
677
+
678
+ ## Common Configurations
679
+
680
+ ### Development (Aggressive Cleanup)
681
+
682
+ **Use case:** Fast iteration, minimal data retention
683
+
684
+ ```toml
685
+ [autodelete]
686
+ ignore_weekend = false
687
+ message_hours = 1
688
+ file_history_days = 1
689
+
690
+ [tasks]
691
+ auto_archive_done_days = 1
692
+ stale_hours_in_progress = 1
693
+ stale_hours_waiting_review = 8
694
+ auto_stale_enabled = true
695
+ ```
696
+
697
+ ### Production (Conservative Retention)
698
+
699
+ **Use case:** Long-term projects, preserve history
700
+
701
+ ```toml
702
+ [autodelete]
703
+ ignore_weekend = false
704
+ message_hours = 168 # 7 days
705
+ file_history_days = 30
706
+
707
+ [tasks]
708
+ auto_archive_done_days = 7
709
+ stale_hours_in_progress = 4
710
+ stale_hours_waiting_review = 48
711
+ auto_stale_enabled = true
712
+ ```
713
+
714
+ ### Weekend-Aware Workflow
715
+
716
+ **Use case:** Developer teams (no weekend work)
717
+
718
+ ```toml
719
+ [autodelete]
720
+ ignore_weekend = true # Skip weekends
721
+ message_hours = 48
722
+ file_history_days = 14
723
+
724
+ [tasks]
725
+ auto_archive_done_days = 2
726
+ stale_hours_in_progress = 2
727
+ stale_hours_waiting_review = 24
728
+ auto_stale_enabled = true
729
+ ```
730
+
731
+ ### Manual Control (No Auto-Cleanup)
732
+
733
+ **Use case:** Full control, manual cleanup only
734
+
735
+ ```toml
736
+ [autodelete]
737
+ ignore_weekend = false
738
+ message_hours = 720 # Max retention (30 days)
739
+ file_history_days = 365 # Max retention (1 year)
740
+
741
+ [tasks]
742
+ auto_archive_done_days = 365
743
+ stale_hours_in_progress = 168 # 7 days (max)
744
+ stale_hours_waiting_review = 720 # 30 days (max)
745
+ auto_stale_enabled = false # Disable auto-stale
746
+ ```
747
+
748
+ ### Multi-Environment Setup
749
+
750
+ **Development:**
751
+ ```toml
752
+ # .sqlew/dev.toml
753
+ [database]
754
+ path = ".sqlew/dev.db"
755
+
756
+ [autodelete]
757
+ message_hours = 1
758
+ file_history_days = 1
759
+ ```
760
+
761
+ **Production:**
762
+ ```toml
763
+ # .sqlew/prod.toml
764
+ [database]
765
+ path = ".sqlew/prod.db"
766
+
767
+ [autodelete]
768
+ message_hours = 168
769
+ file_history_days = 30
770
+ ```
771
+
772
+ **Usage:**
773
+ ```bash
774
+ # Development
775
+ npx sqlew --config-path=.sqlew/dev.toml
776
+
777
+ # Production
778
+ npx sqlew --config-path=.sqlew/prod.toml
779
+ ```
780
+
781
+ ---
782
+
783
+ ## Troubleshooting
784
+
785
+ ### Config File Not Found
786
+
787
+ **Symptom:**
788
+ ```
789
+ ⚠️ Failed to load config file: .sqlew/config.toml
790
+ Error: ENOENT: no such file or directory
791
+ Using default configuration
792
+ ```
793
+
794
+ **Solution:**
795
+ 1. Config file is optional - this is not an error
796
+ 2. Create config file if needed:
797
+ ```bash
798
+ cp .sqlew/config.toml.example .sqlew/config.toml
799
+ ```
800
+
801
+ ### Invalid TOML Syntax
802
+
803
+ **Symptom:**
804
+ ```
805
+ ⚠️ Failed to load config file: .sqlew/config.toml
806
+ Error: Invalid TOML: Unexpected character at line 5
807
+ Using default configuration
808
+ ```
809
+
810
+ **Solution:**
811
+ 1. Validate TOML syntax: https://www.toml-lint.com/
812
+ 2. Common errors:
813
+ ```toml
814
+ # ❌ Wrong: Missing quotes for strings with spaces
815
+ path = /path with spaces/db.db
816
+
817
+ # ✅ Correct: Quote strings with spaces
818
+ path = "/path with spaces/db.db"
819
+
820
+ # ❌ Wrong: Invalid boolean
821
+ ignore_weekend = yes
822
+
823
+ # ✅ Correct: Use true/false
824
+ ignore_weekend = true
825
+ ```
826
+
827
+ ### Values Not Applied
828
+
829
+ **Symptom:** Changed config file but values not reflected
830
+
831
+ **Solution:**
832
+ 1. **Check priority:** CLI args override config file
833
+ ```bash
834
+ # CLI wins over config file
835
+ npx sqlew --autodelete-message-hours=24
836
+ ```
837
+
838
+ 2. **Verify config loading:**
839
+ ```bash
840
+ # Check console output on startup
841
+ ✓ Loaded 7 config values from file
842
+ ```
843
+
844
+ ### Validation Warnings
845
+
846
+ **Symptom:**
847
+ ```
848
+ ⚠️ Configuration validation warnings:
849
+ - autodelete.message_hours must be between 1 and 720 (30 days)
850
+ ```
851
+
852
+ **Solution:**
853
+ 1. Check validation rules (see [Validation Rules](#validation-rules))
854
+ 2. Fix invalid values in config file
855
+ 3. Restart sqlew
856
+
857
+ ### Database Path Issues
858
+
859
+ **Symptom:**
860
+ ```
861
+ Error: SQLITE_CANTOPEN: unable to open database file
862
+ ```
863
+
864
+ **Solution:**
865
+ 1. **Check path syntax:**
866
+ ```toml
867
+ # ❌ Wrong: Relative to config file location
868
+ path = "sqlew.db"
869
+
870
+ # ✅ Correct: Relative to project root
871
+ path = ".sqlew/sqlew.db"
872
+ ```
873
+
874
+ 2. **Use absolute paths for clarity:**
875
+ ```toml
876
+ path = "/absolute/path/to/database.db"
877
+ ```
878
+
879
+ 3. **Ensure directory exists:**
880
+ - sqlew auto-creates parent directory
881
+ - Check file permissions
882
+
883
+ ### Weekend-Aware Not Working
884
+
885
+ **Symptom:** Weekend dates not skipped in retention
886
+
887
+ **Solution:**
888
+ 1. **Check configuration:**
889
+ ```toml
890
+ [autodelete]
891
+ ignore_weekend = true # Must be true, not "true"
892
+ ```
893
+
894
+ 2. **Test behavior:**
895
+ - Monday cleanup should reference Friday
896
+ - Not Saturday/Sunday
897
+
898
+ ---
899
+
900
+ ## Related Documentation
901
+
902
+
903
+ ---
904
+
905
+ ## Example Files
906
+
907
+ ### Minimal Configuration
908
+
909
+ ```toml
910
+ # .sqlew/config.toml (minimal)
911
+ [autodelete]
912
+ ignore_weekend = true
913
+ message_hours = 48
914
+ ```
915
+
916
+ ### Full Configuration with Comments
917
+
918
+ See `.sqlew/config.toml.example` in project root for complete annotated example.
919
+
920
+ ---
921
+
922
+ **Last Updated:** v4.0.0 (2025-11-27)