sqlew 4.0.4 → 4.1.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 (203) hide show
  1. package/CHANGELOG.md +1805 -1762
  2. package/LICENSE +177 -39
  3. package/NOTICE +24 -0
  4. package/README.md +409 -390
  5. package/assets/claude-md-snippets/plan-mode-integration.md +17 -6
  6. package/assets/config.example.toml +282 -284
  7. package/assets/sample-agents/README.md +36 -40
  8. package/assets/sample-agents/sqlew-architect.md +321 -322
  9. package/assets/sample-agents/sqlew-researcher.md +292 -293
  10. package/assets/sample-agents/sqlew-scrum-master.md +286 -287
  11. package/assets/sample-commands/README.md +56 -57
  12. package/assets/sample-skills/sqlew-plan-guidance/SKILL.md +33 -26
  13. package/dist/cli/hooks/check-completion.d.ts +19 -0
  14. package/dist/cli/hooks/check-completion.d.ts.map +1 -0
  15. package/dist/cli/hooks/check-completion.js +104 -0
  16. package/dist/cli/hooks/check-completion.js.map +1 -0
  17. package/dist/cli/hooks/init-hooks.d.ts +35 -0
  18. package/dist/cli/hooks/init-hooks.d.ts.map +1 -0
  19. package/dist/cli/hooks/init-hooks.js +425 -0
  20. package/dist/cli/hooks/init-hooks.js.map +1 -0
  21. package/dist/cli/hooks/mark-done.d.ts +25 -0
  22. package/dist/cli/hooks/mark-done.d.ts.map +1 -0
  23. package/dist/cli/hooks/mark-done.js +128 -0
  24. package/dist/cli/hooks/mark-done.js.map +1 -0
  25. package/dist/cli/hooks/plan-id-utils.d.ts +83 -0
  26. package/dist/cli/hooks/plan-id-utils.d.ts.map +1 -0
  27. package/dist/cli/hooks/plan-id-utils.js +183 -0
  28. package/dist/cli/hooks/plan-id-utils.js.map +1 -0
  29. package/dist/cli/hooks/save.d.ts +23 -0
  30. package/dist/cli/hooks/save.d.ts.map +1 -0
  31. package/dist/cli/hooks/save.js +90 -0
  32. package/dist/cli/hooks/save.js.map +1 -0
  33. package/dist/cli/hooks/stdin-parser.d.ts +139 -0
  34. package/dist/cli/hooks/stdin-parser.d.ts.map +1 -0
  35. package/dist/cli/hooks/stdin-parser.js +127 -0
  36. package/dist/cli/hooks/stdin-parser.js.map +1 -0
  37. package/dist/cli/hooks/suggest.d.ts +19 -0
  38. package/dist/cli/hooks/suggest.d.ts.map +1 -0
  39. package/dist/cli/hooks/suggest.js +157 -0
  40. package/dist/cli/hooks/suggest.js.map +1 -0
  41. package/dist/cli/hooks/track-plan.d.ts +36 -0
  42. package/dist/cli/hooks/track-plan.d.ts.map +1 -0
  43. package/dist/cli/hooks/track-plan.js +152 -0
  44. package/dist/cli/hooks/track-plan.js.map +1 -0
  45. package/dist/cli.d.ts.map +1 -1
  46. package/dist/cli.js +56 -16
  47. package/dist/cli.js.map +1 -1
  48. package/dist/config/global-config.d.ts +187 -0
  49. package/dist/config/global-config.d.ts.map +1 -0
  50. package/dist/config/global-config.js +206 -0
  51. package/dist/config/global-config.js.map +1 -0
  52. package/dist/config/loader.d.ts +42 -0
  53. package/dist/config/loader.d.ts.map +1 -1
  54. package/dist/config/loader.js +96 -0
  55. package/dist/config/loader.js.map +1 -1
  56. package/dist/constants.d.ts +4 -0
  57. package/dist/constants.d.ts.map +1 -1
  58. package/dist/constants.js +10 -0
  59. package/dist/constants.js.map +1 -1
  60. package/dist/database/operations/queries.d.ts.map +1 -1
  61. package/dist/database/operations/queries.js +11 -2
  62. package/dist/database/operations/queries.js.map +1 -1
  63. package/dist/index.js +5 -2
  64. package/dist/index.js.map +1 -1
  65. package/dist/init-agents.js +0 -1
  66. package/dist/init-agents.js.map +1 -1
  67. package/dist/init-skills.d.ts +4 -3
  68. package/dist/init-skills.d.ts.map +1 -1
  69. package/dist/init-skills.js +10 -3
  70. package/dist/init-skills.js.map +1 -1
  71. package/dist/server/setup.d.ts +8 -0
  72. package/dist/server/setup.d.ts.map +1 -1
  73. package/dist/server/setup.js +141 -21
  74. package/dist/server/setup.js.map +1 -1
  75. package/dist/sync-agents.d.ts.map +1 -1
  76. package/dist/sync-agents.js +48 -3
  77. package/dist/sync-agents.js.map +1 -1
  78. package/dist/sync-commands.d.ts.map +1 -1
  79. package/dist/sync-commands.js +43 -3
  80. package/dist/sync-commands.js.map +1 -1
  81. package/dist/tools/constraints/actions/get.d.ts.map +1 -1
  82. package/dist/tools/constraints/actions/get.js +5 -8
  83. package/dist/tools/constraints/actions/get.js.map +1 -1
  84. package/dist/tools/constraints/help/help.d.ts.map +1 -1
  85. package/dist/tools/constraints/help/help.js +1 -6
  86. package/dist/tools/constraints/help/help.js.map +1 -1
  87. package/dist/tools/context/actions/get.d.ts.map +1 -1
  88. package/dist/tools/context/actions/get.js.map +1 -1
  89. package/dist/tools/context/actions/search-layer.d.ts.map +1 -1
  90. package/dist/tools/context/actions/search-layer.js +5 -3
  91. package/dist/tools/context/actions/search-layer.js.map +1 -1
  92. package/dist/tools/context/actions/set-from-policy.d.ts +2 -1
  93. package/dist/tools/context/actions/set-from-policy.d.ts.map +1 -1
  94. package/dist/tools/context/actions/set-from-policy.js.map +1 -1
  95. package/dist/tools/context/help/help.d.ts.map +1 -1
  96. package/dist/tools/context/help/help.js +1 -7
  97. package/dist/tools/context/help/help.js.map +1 -1
  98. package/dist/tools/context/internal/queries.d.ts.map +1 -1
  99. package/dist/tools/context/internal/queries.js +5 -2
  100. package/dist/tools/context/internal/queries.js.map +1 -1
  101. package/dist/tools/context/types.d.ts +1 -1
  102. package/dist/tools/context/types.d.ts.map +1 -1
  103. package/dist/tools/files/actions/get.d.ts.map +1 -1
  104. package/dist/tools/files/actions/get.js +4 -6
  105. package/dist/tools/files/actions/get.js.map +1 -1
  106. package/dist/tools/files/help/help.d.ts.map +1 -1
  107. package/dist/tools/files/help/help.js +1 -6
  108. package/dist/tools/files/help/help.js.map +1 -1
  109. package/dist/tools/suggest/help/constraint-help.d.ts.map +1 -1
  110. package/dist/tools/suggest/help/constraint-help.js +0 -2
  111. package/dist/tools/suggest/help/constraint-help.js.map +1 -1
  112. package/dist/tools/suggest/internal/constraint-queries.d.ts.map +1 -1
  113. package/dist/tools/suggest/internal/constraint-queries.js +12 -5
  114. package/dist/tools/suggest/internal/constraint-queries.js.map +1 -1
  115. package/dist/tools/suggest/internal/queries.js +2 -2
  116. package/dist/tools/suggest/internal/queries.js.map +1 -1
  117. package/dist/tools/tasks/help/help.d.ts.map +1 -1
  118. package/dist/tools/tasks/help/help.js +0 -6
  119. package/dist/tools/tasks/help/help.js.map +1 -1
  120. package/dist/tools/tasks/help/use-case.d.ts.map +1 -1
  121. package/dist/tools/tasks/help/use-case.js +0 -1
  122. package/dist/tools/tasks/help/use-case.js.map +1 -1
  123. package/dist/tools/tasks/watcher/status.d.ts.map +1 -1
  124. package/dist/tools/tasks/watcher/status.js +5 -1
  125. package/dist/tools/tasks/watcher/status.js.map +1 -1
  126. package/dist/types/decision/params.d.ts +7 -6
  127. package/dist/types/decision/params.d.ts.map +1 -1
  128. package/dist/types/decision/templates.d.ts +3 -2
  129. package/dist/types/decision/templates.d.ts.map +1 -1
  130. package/dist/types/view-entities.d.ts +2 -1
  131. package/dist/types/view-entities.d.ts.map +1 -1
  132. package/dist/types.d.ts +19 -11
  133. package/dist/types.d.ts.map +1 -1
  134. package/dist/types.js +4 -1
  135. package/dist/types.js.map +1 -1
  136. package/dist/utils/enum-converter.d.ts +72 -0
  137. package/dist/utils/enum-converter.d.ts.map +1 -0
  138. package/dist/utils/enum-converter.js +76 -0
  139. package/dist/utils/enum-converter.js.map +1 -0
  140. package/dist/utils/hook-queue.d.ts +81 -0
  141. package/dist/utils/hook-queue.d.ts.map +1 -0
  142. package/dist/utils/hook-queue.js +156 -0
  143. package/dist/utils/hook-queue.js.map +1 -0
  144. package/dist/utils/project-root.d.ts +9 -2
  145. package/dist/utils/project-root.d.ts.map +1 -1
  146. package/dist/utils/project-root.js +16 -2
  147. package/dist/utils/project-root.js.map +1 -1
  148. package/dist/utils/tag-parser.d.ts.map +1 -1
  149. package/dist/utils/tag-parser.js +6 -0
  150. package/dist/utils/tag-parser.js.map +1 -1
  151. package/dist/utils/validators.d.ts +1 -1
  152. package/dist/utils/validators.d.ts.map +1 -1
  153. package/dist/utils/validators.js +1 -1
  154. package/dist/utils/validators.js.map +1 -1
  155. package/dist/utils/vcs-adapter.d.ts +44 -0
  156. package/dist/utils/vcs-adapter.d.ts.map +1 -1
  157. package/dist/utils/vcs-adapter.js +88 -0
  158. package/dist/utils/vcs-adapter.js.map +1 -1
  159. package/dist/utils/view-queries.d.ts.map +1 -1
  160. package/dist/utils/view-queries.js +9 -19
  161. package/dist/utils/view-queries.js.map +1 -1
  162. package/dist/watcher/base-watcher.d.ts +69 -0
  163. package/dist/watcher/base-watcher.d.ts.map +1 -0
  164. package/dist/watcher/base-watcher.js +130 -0
  165. package/dist/watcher/base-watcher.js.map +1 -0
  166. package/dist/watcher/index.d.ts +3 -0
  167. package/dist/watcher/index.d.ts.map +1 -1
  168. package/dist/watcher/index.js +2 -0
  169. package/dist/watcher/index.js.map +1 -1
  170. package/dist/watcher/queue-watcher.d.ts +64 -0
  171. package/dist/watcher/queue-watcher.d.ts.map +1 -0
  172. package/dist/watcher/queue-watcher.js +187 -0
  173. package/dist/watcher/queue-watcher.js.map +1 -0
  174. package/docs/ADR_CONCEPTS.md +140 -0
  175. package/docs/CONFIGURATION.md +922 -925
  176. package/docs/CROSS_DATABASE.md +153 -0
  177. package/docs/DATABASE_AUTH.md +70 -356
  178. package/docs/HOOKS_GUIDE.md +159 -0
  179. package/docs/SLASH_COMMANDS.md +329 -337
  180. package/docs/TASK_SYSTEM_DEPRECATED.md +88 -0
  181. package/docs/changelogs/CHANGELOG_ARCHIVE_v3.4_and_older.md +293 -296
  182. package/docs/cli/DATA_EXPORT_IMPORT.md +699 -700
  183. package/docs/cli/README.md +276 -277
  184. package/package.json +123 -119
  185. package/docs/ACCEPTANCE_CRITERIA.md +0 -625
  186. package/docs/AI_AGENT_GUIDE.md +0 -198
  187. package/docs/ARCHITECTURE.md +0 -167
  188. package/docs/AUTO_FILE_TRACKING.md +0 -841
  189. package/docs/BATCH_VALIDATION.md +0 -617
  190. package/docs/BEST_PRACTICES.md +0 -168
  191. package/docs/CONSTRAINT_INTELLIGENCE.md +0 -339
  192. package/docs/DECISION_CONTEXT.md +0 -675
  193. package/docs/DECISION_INTELLIGENCE.md +0 -605
  194. package/docs/GIT_AWARE_AUTO_COMPLETE.md +0 -646
  195. package/docs/MIGRATION_GUIDE_V3.9.0.md +0 -371
  196. package/docs/SHARED_CONCEPTS.md +0 -225
  197. package/docs/SPECIALIZED_AGENTS.md +0 -126
  198. package/docs/TASK_ACTIONS.md +0 -1177
  199. package/docs/TASK_OVERVIEW.md +0 -452
  200. package/docs/TASK_PRUNING.md +0 -594
  201. package/docs/TOOL_REFERENCE.md +0 -1077
  202. package/docs/TOOL_SELECTION.md +0 -83
  203. package/docs/WORKFLOWS.md +0 -941
package/CHANGELOG.md CHANGED
@@ -1,1762 +1,1805 @@
1
- # Changelog
2
-
3
- All notable changes to sqlew will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ---
9
-
10
- ## [4.0.4] - 2025-12-10
11
-
12
- ### Fixed
13
-
14
- **Slash Command Sync Bug**
15
-
16
- - Fixed `sync-commands.ts` referencing obsolete command files (`sqw-scrum.md`, `sqw-documentor.md`, etc.)
17
- - Updated to use new unified `sqlew.md` command file
18
- - Resolves "Source file not found" errors during npm package installation
19
-
20
- ### Added
21
-
22
- **Agent Skills Configuration**
23
-
24
- - Added `skills` field to agent YAML frontmatter for automatic skill loading
25
- - All sqlew agents now reference `sqlew-plan-guidance` skill
26
- - Agents: `sqlew-architect`, `sqlew-researcher`, `sqlew-scrum-master`
27
-
28
- **Config Example Update**
29
-
30
- - Added `[commands]` section to `assets/config.example.toml`
31
- - Documents the unified `/sqlew` command configuration
32
-
33
- ### Changed
34
-
35
- **Plan Mode Integration Documentation**
36
-
37
- - Changed `Phase 1 (Research)` → `Research Phase` for flexibility
38
- - Changed `Phase 4 (Final Plan)` → `Final Plan Phase`
39
- - Plan mode phases are now semantically named instead of numbered
40
-
41
- **CommandsConfig Simplified**
42
-
43
- - Consolidated 6 individual command options into single `sqlew` option
44
- - Updated `src/config/types.ts` and `src/config/minimal-generator.ts`
45
-
46
- ---
47
-
48
- ## [4.0.3] - 2025-12-04
49
-
50
- ### Added
51
-
52
- **Unified `/sqlew` Slash Command**
53
-
54
- - Consolidated all slash commands (`/sqw-plan`, `/sqw-scrum`, `/sqw-research`, etc.) into single `/sqlew` command
55
- - Natural language interface with automatic intent detection
56
- - 6-level intent priority: List/Status → Search → Record → Update → Execute → Task Creation
57
- - Supports both English and Japanese keywords
58
- - Removed custom agent definitions (sqlew-architect, scrum-master, sqlew-researcher)
59
-
60
- **Usage Examples:**
61
- ```bash
62
- /sqlew # Show status and suggest next action
63
- /sqlew show remaining tasks # List/Status intent
64
- /sqlew search for auth decisions # Search intent
65
- /sqlew record that we use JWT # Record intent
66
- /sqlew execute pending tasks # Execute intent
67
- ```
68
-
69
- ### Fixed
70
-
71
- **v4_task_details JOIN Bug**
72
-
73
- - Fixed `task.get` action failing with "no such column: td.project_id" error
74
- - Root cause: `v4_task_details` table has only `task_id` as PK, not `project_id`
75
- - Removed invalid `.andOn('t.project_id', '=', 'td.project_id')` from JOIN conditions
76
- - Affected files: `task-queries.ts`, `get.ts`
77
-
78
- ### Changed
79
-
80
- **Documentation Updates**
81
-
82
- - Rewrote `CLAUDE.md` with unified `/sqlew` command section
83
- - Updated `README.md` Quick Start to use `/sqlew`
84
- - Rewrote `docs/SLASH_COMMANDS.md` as Unified /sqlew Command Guide
85
- - Marked `docs/SPECIALIZED_AGENTS.md` as deprecated with migration guide
86
-
87
- ---
88
-
89
- ## [4.0.2] - 2025-11-28
90
-
91
- ### BREAKING CHANGES
92
-
93
- **SQL Dump No Longer Supports Cross-Database Format Conversion**
94
-
95
- The `db:dump` command now generates SQL for the **same database type only**. Cross-database migrations (e.g., SQLite → MySQL) must use JSON export/import instead.
96
-
97
- **Migration Required:**
98
- ```bash
99
- # Old approach (no longer supported)
100
- npx sqlew db:dump mysql backup.sql # Cross-DB conversion removed
101
-
102
- # New approach: Use JSON for cross-database migration
103
- npx sqlew db:export backup.json # Export to JSON
104
- npx sqlew db:import backup.json # Import to target database
105
- ```
106
-
107
- **Rationale:**
108
- - SQL syntax differences between databases caused data corruption issues
109
- - Case-insensitive pattern matching failed in certain scenarios
110
- - JSON format is database-agnostic and handles all data types correctly
111
-
112
- **Node.js 20+ Required**
113
-
114
- Minimum Node.js version updated from 18.0.0 to 20.0.0.
115
-
116
- ### Added
117
-
118
- **Unified CLI Entry Point**
119
-
120
- - `npx sqlew db:export`, `npx sqlew db:import`, `npx sqlew db:dump` now work directly
121
- - No `npm install` required - just use `npx sqlew <command>`
122
- - CLI commands and MCP server mode unified under single `sqlew` entry point
123
- - Removed separate `sqlew-cli` binary
124
-
125
- ### Fixed
126
-
127
- **Case-Insensitive Validation for Master Records**
128
-
129
- - Added case-insensitive duplicate detection when registering new records
130
- - Prevents duplicate entries like "MyTag" and "mytag" from being created
131
- - Applies to tags, scopes, layers, and other master table entries
132
- - New utility: `src/utils/case-insensitive-validator.ts`
133
-
134
- **SQLite to MySQL SQL Dump Case-Sensitivity Bug**
135
-
136
- - Fixed regex pattern matching that failed with case variations
137
- - SQL dump now correctly handles mixed-case identifiers
138
- - Enhanced schema table export for better compatibility
139
-
140
- ### Changed
141
-
142
- **Export Version Tracking**
143
-
144
- - Export JSON now includes proper version metadata
145
- - Version information helps with import compatibility checks
146
- - Clearer error messages when importing incompatible versions
147
-
148
- **CLI Documentation Update**
149
-
150
- - Updated `docs/cli/README.md` with JSON-first migration workflow
151
- - Added clear guidance on when to use `db:dump` vs `db:export`/`db:import`
152
- - Improved comparison table for migration scenarios
153
-
154
- ### Added
155
-
156
- **Case-Insensitive Validator Utility**
157
-
158
- - New `src/utils/case-insensitive-validator.ts` for consistent validation
159
- - Comprehensive test suite: `src/tests/unit/utils/case-insensitive-validator.test.ts`
160
- - Reusable across all master table operations
161
-
162
- ### Migration Notes
163
-
164
- **Backward Compatibility:**
165
- - Existing databases unaffected
166
- - JSON export/import workflows unchanged
167
- - SQL dumps for same-database-type operations still work
168
-
169
- **Action Required:**
170
- - Update any scripts that use `db:dump` for cross-database migrations
171
- - Switch to `db:export`/`db:import` for SQLite ↔ MySQL ↔ PostgreSQL migrations
172
-
173
- ---
174
-
175
- ## [4.0.1] - 2025-11-28
176
-
177
- ### Removed
178
-
179
- **Database Views Eliminated**
180
-
181
- - Dropped all database views (`v_tagged_constraints`, `v_recent_file_changes`, etc.)
182
- - Views caused migration complexity across SQLite/MySQL/PostgreSQL due to database-specific syntax
183
- - Migration: `20251128000000_drop_all_views.ts`
184
-
185
- ### Changed
186
-
187
- **JOIN-Based Queries**
188
-
189
- - `src/tools/constraints/actions/get.ts` - Replaced `v_tagged_constraints` view with JOIN query
190
- - `src/tools/files/actions/get.ts` - Replaced `v_recent_file_changes` view with JOIN query
191
- - Uses `UniversalKnex` wrapper for cross-database compatibility (date functions, boolean values, string aggregation)
192
-
193
- **VCS Test Cleanup**
194
-
195
- - `src/tests/feature/vcs/git-aware-completion.test.ts` - Added automatic git reset after tests
196
- - Test commits are now automatically dropped when tests complete
197
- - Prevents test artifacts from polluting git history
198
-
199
- ### Added
200
-
201
- **No-Views Guardrail Skill**
202
-
203
- - `.claude/skills/no-views/SKILL.md` - Documentation for view prohibition policy
204
- - `.claude/skills/skill-rules.json` - Added `no-views` rule (enforcement: block)
205
- - Blocks creation of database views, requires JOINs instead
206
-
207
- **Documentation Updates**
208
-
209
- - `CLAUDE.md` - Updated to reflect no-views policy
210
- - Removed Views section from database schema documentation
211
- - Added `no-views` to Guardrail Skills table
212
-
213
- ---
214
-
215
- ## [4.0.0] - 2025-11-27
216
-
217
- ### Changed
218
-
219
- **Concept & Positioning**
220
-
221
- - Reframed sqlew as a **shared SQL-backed context repository** and a **Decision & Constraint repository layer** for AI tools
222
- - Clarified that Decisions capture *why* changes were made and Constraints capture *how* code should be written
223
- - Updated README introduction to focus on "Never Start From Zero Context Again" and the repository-based metaphor instead of generic "memory"
224
-
225
- **Documentation & Cleanup**
226
-
227
- - Updated `README.md` to describe sqlew as a context repository rather than an abstract memory layer
228
- - Aligned terminology across docs around Decisions, Constraints, tasks, and the repository layer
229
- - Confirmed that previously removed/legacy features remain out of scope, keeping focus on decision history and constraint rules
230
-
231
- > Note: v4.0.0 is primarily a **concept and documentation alignment release**. Core Decision/Constraint features and the v3.9.x database schema remain compatible; no breaking API changes were introduced for existing integrations.
232
-
233
- ---
234
-
235
- ## [3.9.0] - 2025-01-15
236
-
237
- ### Added
238
-
239
- **🎯 Decision Intelligence System with Three-Tier Similarity Detection**
240
-
241
- **New `suggest` Tool:**
242
- - **by_key** - Pattern-based decision search (e.g., "api/*/latency" finds all API latency decisions)
243
- - **by_tags** - Tag similarity scoring for related decisions (Jaccard similarity)
244
- - **by_context** - Combined key + tags + layer search for best matches
245
- - **check_duplicate** - Duplicate decision detection with similarity scoring (0-100 points)
246
-
247
- **Three-Tier Duplicate Detection (Auto-Triggered):**
248
- - **Tier 1 (35-44 points):** Gentle nudge - Non-blocking warning with suggestions
249
- - **Tier 2 (45-59 points):** Hard block - Prevents creation, requires explicit override or update
250
- - **Tier 3 (60+ points):** Auto-update - Transparently updates existing decision, preserves new value
251
-
252
- **Similarity Scoring Algorithm:**
253
- - Tag overlap: 0-40 points (10 per matching tag, max 4)
254
- - Layer match: 0-25 points (same layer bonus)
255
- - Key similarity: 0-20 points (pattern + Levenshtein distance)
256
- - Recency: 0-10 points (recent updates prioritized)
257
- - Priority: 0-5 points (critical decisions weighted)
258
-
259
- **Policy-Based Auto-Triggering:**
260
- - Suggestions automatically triggered when policies have `suggest_similar=1`
261
- - Integrated with `decision.set` - returns suggestions in response
262
- - Configurable relevance threshold via `min_score` parameter (default: 30)
263
- - Policy validation rules support for targeted auto-triggering
264
-
265
- **Enhanced Decision Metadata:**
266
- - `duplicate_reason` - Similarity explanation with matched tags and layer info
267
- - `update_command` - Ready-to-use command for updating existing decisions
268
- - `version_info` - Existing decision version tracking
269
- - `auto_updated` flag - Indicates Tier 3 transparent updates
270
-
271
- **Supporting Features:**
272
- - Tag parser utility (`src/utils/tag-parser.ts`) for flexible tag handling
273
- - Policy validation integration (`src/utils/policy-validator.ts`)
274
- - Suggestion scorer (`src/utils/suggestion-scorer.ts`) with breakdown
275
- - Self-exclusion logic (prevents matching against own key during updates)
276
-
277
- ### Fixed
278
-
279
- **PostgreSQL Cross-Database Compatibility**
280
- - Fixed CAST type mismatch in `v_tagged_decisions` view export
281
- - PostgreSQL now correctly handles `COALESCE(TEXT, NUMERIC)` with `CAST(value AS TEXT)`
282
- - MySQL/MariaDB use `CAST(value AS CHAR)` for compatibility
283
- - Migration: `20251114000000_fix_v_tagged_decisions_numeric_support.ts`
284
- - SQL dump export: Enhanced view conversion in `src/utils/sql-dump/schema/views.ts`
285
- - Result: All 20 cross-database tests passing (MySQL, MariaDB, PostgreSQL)
286
-
287
- **Test Suite Improvements**
288
- - Fixed FK constraint cleanup order in `decision-intelligence-e2e.test.ts`
289
- - Child records now deleted before parent records (tags → scopes → context → decisions)
290
- - Result: 3/3 e2e workflow tests passing, no cleanup errors
291
-
292
- **Schema Fixes**
293
- - Migration `20251112000001_fix_task_file_links_schema_v3_9_0.ts` - Fixed UNIQUE constraint
294
- - Migration `20251112000002_fix_task_pruned_files_schema_v3_9_0.ts` - Enhanced task file tracking
295
- - All migrations idempotent with existence checks
296
-
297
- ### Changed
298
-
299
- **Test Organization (Docker Dependency Separation)**
300
- - Moved 7 Docker-dependent tests to `src/tests/docker/` directory
301
- - `npm test` now runs 481 unit tests without Docker (0 failures)
302
- - `npm run test:docker` runs cross-database tests (requires Docker containers)
303
- - Removed `test:all` script (caused database conflicts)
304
- - Updated `.husky/pre-commit` to reflect test separation
305
- - Decision documented in SQLew: `test-organization-docker-separation`
306
-
307
- **Git Hook Enhancement**
308
- - Pre-commit hook now checks for **PUSHED** migration files instead of just committed
309
- - Auto-detects remote branch (origin/main, origin/master, origin/dev)
310
- - Allows editing locally committed migrations (not yet pushed)
311
- - Prevents editing migrations that exist in remote
312
- - Graceful fallback for local-only repositories
313
-
314
- **Debug Output Cleanup**
315
- - Commented out scope validation warnings in test output
316
- - Removed DEBUG/DIAGNOSTIC console.log statements
317
- - Cleaner test output focusing on actual results
318
- - 75% reduction in test output verbosity
319
-
320
- ### Removed
321
-
322
- **Code Cleanup**
323
- - Deleted monolithic `src/utils/sql-dump.ts` (-1,799 lines)
324
- - Functionality now in modular structure:
325
- - `src/utils/sql-dump/schema/tables.ts`
326
- - `src/utils/sql-dump/schema/views.ts`
327
- - `src/utils/sql-dump/schema/primary-keys.ts`
328
- - `src/utils/sql-dump/schema/indexes.ts`
329
- - Deleted test tracking files (`test-tracking/file1.ts`, etc.)
330
-
331
- ### Documentation
332
-
333
- - Updated `CLAUDE.md` - Changed policy from "NEVER EDIT COMMITTED" to "NEVER EDIT PUSHED"
334
- - Created `STAGED_CHANGES_SUMMARY.md` - Comprehensive v3.9.0 change summary
335
- - Created `NEW_TOOL_DESCRIPTION.md` - Suggest tool reference
336
-
337
- ### Performance
338
-
339
- - Enhanced file pruning logic (`src/utils/file-pruning.ts`)
340
- - Improved VCS adapter file status tracking (`src/utils/vcs-adapter.ts`)
341
- - Better task stale detection (`src/utils/task-stale-detection.ts`)
342
- - Activity logging enhancements for suggestion tracking
343
-
344
- ### Testing
345
-
346
- **Test Results:**
347
- - **495/495 tests passing (100%)** - Production-ready
348
- - Tier 1 (Gentle Nudge): 5/5 tests passing
349
- - Tier 2 (Hard Block): 2/2 tests passing
350
- - Tier 3 (Auto-Update): 3/3 tests passing
351
- - Auto-trigger suggestions: 4/4 tests passing
352
- - ✅ Edge cases and error handling: All passing
353
- - 20/20 cross-database tests passing (MySQL, MariaDB, PostgreSQL)
354
- - 7 Docker test suites in separate directory
355
-
356
- **Test Suite Enhancements:**
357
- - AI-optimized quiet mode (80-90% token reduction, shows only failures + summary)
358
- - Verbose mode available with `:verbose` suffix (e.g., `npm run test:verbose`)
359
- - Cross-platform filter script (`scripts/filter-test-output.js`)
360
- - Comprehensive three-tier similarity detection test coverage
361
-
362
- **Coverage:**
363
- - Overall: 64.85% line coverage
364
- - All critical paths tested
365
- - Zero flaky tests
366
-
367
- ### Migration Notes
368
-
369
- **Backward Compatibility:**
370
- - v3.9.0 is fully backward compatible with v3.8.x
371
- - No breaking changes
372
- - Automatic migration on server startup
373
-
374
- **Database Changes:**
375
- - 3 new enhancement migrations (all idempotent)
376
- - Schema changes apply automatically
377
- - Safe to rollback by restoring backup
378
-
379
- **Files Changed:**
380
- - 50 files modified
381
- - 1,857 insertions, 2,096 deletions
382
- - Net: -239 lines (code reduction through refactoring)
383
-
384
- ---
385
-
386
- ## [3.8.1] - 2025-11-11
387
-
388
- ### Fixed
389
-
390
- **Critical Installation Bug**
391
-
392
- - Fixed `npm error Invalid Version:` error when installing sqlew@3.8.0
393
- - Changed `@modelcontextprotocol/sdk` dependency from `"latest"` to `"^1.21.1"` in package.json
394
- - The `"latest"` tag is not a valid semver version for published packages and caused npm dependency resolution to fail
395
- - This is a **hotfix release** that resolves installation issues preventing users from using v3.8.0
396
-
397
- **Impact:**
398
- - All users experiencing `Invalid Version:` errors when running `npx sqlew` can now install successfully
399
- - No functional changes from v3.8.0 - only dependency version fix
400
-
401
- ---
402
-
403
- ## [3.8.0] - 2025-11-09
404
-
405
- ### BREAKING CHANGES
406
-
407
- **Batch Action Naming Standardization**
408
-
409
- `task.batch_create` has been renamed to `task.create_batch` to follow the `<verb>_batch` naming pattern used by other batch actions (`set_batch`, `record_batch`).
410
-
411
- **Migration Required:**
412
- ```typescript
413
- // Old (v3.7.x and earlier)
414
- task({ action: "batch_create", tasks: [...] })
415
-
416
- // New (v3.8.0+)
417
- task({ action: "create_batch", tasks: [...] })
418
- ```
419
-
420
- **Rationale:**
421
- - Achieves 100% consistency across all batch actions
422
- - Improves alphabetical sorting in IDE auto-completion (create → create_batch)
423
- - Aligns with industry standard (REST APIs, GraphQL, ORMs use suffix pattern)
424
- - See docs/ADR-batch-naming-standard.md for full justification
425
-
426
- **Impact:**
427
- - All code using `task.batch_create` must update to `task.create_batch`
428
- - Simple find-replace migration (estimated 2-5 minutes per integration)
429
- - No database schema changes required
430
-
431
- ### Removed
432
-
433
- **Config Tool Removed (Phase 6)**
434
-
435
- The orphaned config tool has been removed in favor of CLI-only configuration:
436
-
437
- - **Deleted**: `src/tools/config.ts` (307 lines)
438
- - **Removed**: `ConfigAction` type from `src/types.ts` and `src/types/actions.ts`
439
- - **Removed**: ConfigAction import from `src/utils/parameter-validator.ts`
440
- - **Updated**: README.md with CLI-only config approach documentation
441
- - **Updated**: docs/CONFIGURATION.md already documented config tool removal
442
-
443
- **Why removed:**
444
- - Config tool was never registered in `tool-registry.ts` (orphaned code)
445
- - Messaging system deprecated (primary use case eliminated)
446
- - File-based configuration (`.sqlew/config.toml`) is clearer and more maintainable
447
- - Runtime updates were confusing (changes lost on restart unless manually synced to file)
448
- - Configuration drift between `m_config` table and config file
449
-
450
- **Migration Path:**
451
- - **Use `.sqlew/config.toml`** for all configuration (persistent, version-controlled)
452
- - ✅ **Use CLI arguments** for one-time overrides (`--autodelete-message-hours=48`)
453
- - **Internal config operations** preserved (`src/database/config/config-ops.ts`)
454
- - ✅ **m_config table** preserved (used internally by retention logic)
455
-
456
- **Impact:**
457
- - Cleaner codebase with ~300 lines removed
458
- - No functional impact - tool was never registered
459
- - Configuration via file and CLI arguments only
460
-
461
- **Message Tool Completely Removed**
462
-
463
- The deprecated message tool has been completely removed from the codebase:
464
-
465
- - **Deleted**: `src/tools/messaging.ts` (599 lines)
466
- - **Removed**: Message tool entry from `tool-registry.ts`
467
- - **Removed**: Message tool handler from `tool-handlers.ts`
468
- - **Removed**: Message imports from `cli.ts`
469
- - **Updated**: `MessageAction` type changed to `never` (backward compatibility stub)
470
- - **CLI**: `sqlew query messages` now returns error message
471
-
472
- **Migration Path**:
473
- - No action required - messaging system was already marked deprecated in v3.6.6
474
- - The `t_agent_messages` table was dropped in v3.6.6
475
- - All message tool actions returned deprecation warnings since v3.6.6
476
-
477
- **Impact**:
478
- - Cleaner codebase with ~700 lines removed
479
- - No functional impact - messaging system was unused
480
- - MessageAction type remains as deprecated stub for backward compatibility
481
-
482
- ### Added
483
-
484
- **Layer Expansion (5→9 layers)**
485
-
486
- Added 4 new layers to enable better task classification and semantic validation:
487
-
488
- **New FILE_REQUIRED layers:**
489
- - `documentation` - README, CHANGELOG, API docs, architecture docs (file_actions required)
490
-
491
- **New FILE_OPTIONAL layers:**
492
- - `planning` - Research, spike tasks, investigation (file_actions optional)
493
- - `coordination` - Multi-agent orchestration, task delegation (file_actions optional)
494
- - `review` - Code review, design review, verification (file_actions optional)
495
-
496
- **Existing layers** (5→6 FILE_REQUIRED):
497
- - presentation, business, data, infrastructure, cross-cutting (file_actions required or empty array)
498
-
499
- **Benefits:**
500
- - Documentation layer enforces file operations for docs work
501
- - Planning layers allow pure research tasks without file boilerplate
502
- - Better semantic task classification across the development lifecycle
503
-
504
- **file_actions Parameter for Tasks**
505
-
506
- Introduced semantic `file_actions` parameter to replace generic `watch_files`:
507
-
508
- ```typescript
509
- // New file_actions parameter
510
- task.create({
511
- title: "Implement OAuth",
512
- layer: "business",
513
- file_actions: [
514
- { action: "create", path: "src/auth/oauth.ts" },
515
- { action: "edit", path: "src/api/router.ts" },
516
- { action: "delete", path: "src/auth/legacy.ts" }
517
- ]
518
- });
519
-
520
- // Backward compatible - watch_files still works
521
- task.create({
522
- title: "Update config",
523
- layer: "infrastructure",
524
- watch_files: ["config.toml"] // Auto-converts to file_actions
525
- });
526
- ```
527
-
528
- **Layer-Based Validation:**
529
- - FILE_REQUIRED layers (6) → Must provide `file_actions` or `[]`
530
- - FILE_OPTIONAL layers (3) Can omit `file_actions` entirely
531
- - Clear error messages with layer-specific guidance
532
-
533
- **Benefits:**
534
- - Self-documenting: `action: 'create'` vs `action: 'edit'` shows intent
535
- - Prevents forgotten file watchers (validation enforced)
536
- - No boilerplate for planning tasks (can omit parameter)
537
- - Better token efficiency with automatic file watching
538
-
539
- **PostgreSQL Adapter Implementation**
540
-
541
- Full PostgreSQL 12+ support with complete adapter implementation:
542
-
543
- **Adapter Features:**
544
- - All 15 abstract methods implemented (`insertReturning`, `upsert`, `jsonExtract`, etc.)
545
- - PostgreSQL-specific SQL syntax (RETURNING, ON CONFLICT, string_agg)
546
- - Strict type handling (TRUE/FALSE for booleans, not 1/0)
547
- - Timezone-aware timestamp functions
548
- - Transaction support with savepoints
549
-
550
- **Migration Compatibility:**
551
- - All 22 migrations tested and verified on PostgreSQL 16.10
552
- - Cross-database helper functions for view creation
553
- - Proper CASCADE handling for foreign key dependencies
554
- - Sequence management after explicit ID inserts
555
- - GROUP BY strictness compliance
556
-
557
- **Supported Databases:**
558
- - SQLite 3.x (default, development)
559
- - MySQL 8.0 / MariaDB 10+ (production)
560
- - PostgreSQL 12+ (production) NEW
561
-
562
- **Configuration:**
563
- ```toml
564
- [database]
565
- type = "postgres"
566
-
567
- [database.connection]
568
- host = "localhost"
569
- port = 5432
570
- database = "sqlew_db"
571
-
572
- [database.auth]
573
- type = "direct"
574
- user = "sqlew_user"
575
- password = "secret"
576
- ```
577
-
578
- ### Fixed
579
-
580
- **Batch Action Parameter Parsing**
581
-
582
- Fixed MCP client array serialization issue affecting all batch actions:
583
-
584
- **Problem:** MCP client serializes array parameters as JSON strings:
585
- ```typescript
586
- // MCP sends:
587
- decisions: "[{\"key\": \"test\", \"value\": \"val\"}]" // String!
588
-
589
- // Expected:
590
- decisions: [{key: "test", value: "val"}] // Array
591
- ```
592
-
593
- **Solution:** Added JSON parsing in `tool-handlers.ts` for all batch actions:
594
- - `decision.set_batch` - parse `decisions` parameter
595
- - `file.record_batch` - parse `file_changes` parameter
596
- - `task.create_batch` - parse `tasks` parameter
597
-
598
- **Impact:** All batch actions now work correctly with array parameters from MCP client.
599
-
600
- **Help System Synchronization**
601
-
602
- Fixed critical bug where help database was severely out of sync with code:
603
-
604
- **Problem:** 25 actions missing from `m_help_actions` table, causing help system to lie about available actions.
605
-
606
- **Missing Actions:**
607
- - decision: 9 actions (quick_set, search_advanced, set_batch, has_updates, etc.)
608
- - task: 14 actions (update, get, list, move, link, archive, create_batch, etc.)
609
- - constraint: 1 action (use_case)
610
-
611
- **Solution:** Created migration `20251109020000_fix_missing_help_actions_v3_8_0.ts` to:
612
- - Add all 25 missing actions with correct descriptions
613
- - Idempotent checks to prevent duplicates
614
- - Full synchronization between code and database
615
-
616
- **Impact:** Help system now accurately reports all available actions.
617
-
618
- ### Changed
619
-
620
- **Tool Registry Schema Fix**
621
-
622
- Added `additionalProperties: true` to all tool schemas in `tool-registry.ts`:
623
-
624
- **Problem:** MCP couldn't pass action-specific parameters (key, value, tags, etc.) because schemas only defined `action` property.
625
-
626
- **Solution:**
627
- ```typescript
628
- {
629
- name: 'decision',
630
- inputSchema: {
631
- type: 'object',
632
- properties: {
633
- action: { ... }
634
- },
635
- required: ['action'],
636
- additionalProperties: true, // ← CRITICAL FIX
637
- },
638
- }
639
- ```
640
-
641
- **Impact:** All MCP tools now accept action-specific parameters correctly.
642
-
643
- ---
644
-
645
- ## [3.7.4] - 2025-11-08
646
-
647
- ### Added - Complete JSON Import/Export System
648
-
649
- **Full-featured data migration system with smart ID remapping and dependency resolution**
650
-
651
- #### New Features
652
-
653
- - **db:import CLI Command** - Import project data from JSON exports with automatic ID remapping
654
- - Smart conflict detection (skip-if-exists, project-name override)
655
- - Dry-run mode for validation before import
656
- - Comprehensive error messages with validation details
657
- - **Topological Sort Algorithm** - Resolves task dependencies during import
658
- - Circular dependency detection prevents import of invalid dependency graphs
659
- - BFS-based topological sorting ensures dependencies imported before dependents
660
- - Preserves all task relationships and blocking constraints
661
- - **Smart ID Remapping** - Handles complex foreign key relationships
662
- - Master table merge logic (reuse existing entries by name/path)
663
- - Transaction table ID translation with bidirectional mapping
664
- - Junction table relationship preservation
665
- - Automatic orphan cleanup for invalid references
666
-
667
- #### Import System Architecture
668
-
669
- - **4 Core Modules**:
670
- 1. `import.ts` - Main orchestrator with transaction management
671
- 2. `master-tables.ts` - Master table merge logic (m_files, m_tags, m_scopes, etc.)
672
- 3. `topological-sort.ts` - Dependency graph analysis and sorting
673
- 4. `db-import.ts` - CLI command with argument parsing and validation
674
-
675
- #### Data Migration Strategy
676
-
677
- - **ID Remapping**: All imported data gets fresh auto-incremented IDs (no ID preservation)
678
- - **Master Table Deduplication**: Reuse existing entries for agents, tags, scopes, files by name/path
679
- - **Transaction Atomicity**: All-or-nothing semantics (full rollback on any error)
680
- - **Project Isolation**: Each import creates independent project with no cross-contamination
681
-
682
- #### CLI Examples
683
-
684
- ```bash
685
- # Import project from JSON export
686
- npx sqlew db:import --source=project-backup.json
687
-
688
- # Import with custom project name
689
- npx sqlew db:import --source=data.json --project-name=my-project
690
-
691
- # Dry-run validation (no actual import)
692
- npx sqlew db:import --source=data.json --dry-run
693
-
694
- # Export project for migration
695
- npx sqlew db:export --project=visualizer --output=visualizer-data.json
696
- ```
697
-
698
- #### Technical Details
699
-
700
- - **Batch Inserts** - 10-row batches to avoid SQLite UNION ALL limits
701
- - **Foreign Key Validation** - Validates all foreign key references before insertion
702
- - **View Handling** - Temporarily drops/restores views during schema changes
703
- - **Idempotent Operations** - Safe to retry on failure
704
- - **Error Recovery** - Detailed error messages with validation guidance
705
-
706
- #### Use Cases
707
-
708
- - **Multi-Project Single Database** - Consolidate multiple projects when database creation permissions are limited
709
- - **Project Sharing** - Share context with team members or between machines
710
- - **Cross-Database Migration** - Move projects between different databases (different machine, SQLite → MySQL, etc.)
711
-
712
- **Note**: Import uses `--skip-if-exists=true` by default. This is NOT a backup/restore solution for the same database.
713
- Use database-level backups (SQLite file copy, MySQL dump) for backup/restore scenarios.
714
-
715
- #### Impact
716
-
717
- - **Complete migration solution** - Export from one database, import to another
718
- - ✅ **Multi-project support** - Merge multiple project exports into single database
719
- - ✅ **Permission-friendly** - Works for users who can't create multiple databases
720
- - ✅ **Data integrity** - Zero data loss, all relationships preserved
721
- - **Production ready** - Comprehensive error handling and validation
722
- - ✅ **Cross-database compatible** - JSON format works across SQLite, MySQL, PostgreSQL
723
-
724
- ---
725
-
726
- ### Fixed - Multi-Project Migration (HOTFIX)
727
-
728
- **Critical fix for v3.7.0-v3.7.2 migration in multi-project scenarios**
729
-
730
- #### Problem
731
-
732
- - Users upgrading from v3.6.10 to v3.7.0+ could end up with duplicate projects
733
- - Migration 20251104000000 created project #1 with fake name "default-project"
734
- - Users creating second project manually resulted in namespace conflicts
735
-
736
- #### Solution
737
-
738
- - Enhanced migration idempotency checks
739
- - Improved project consolidation logic
740
- - Better handling of existing project scenarios
741
-
742
- #### Impact
743
-
744
- - **Safe multi-project migration** - No duplicate projects created
745
- - ✅ **Backward compatible** - Works for both fresh installs and upgrades
746
- - **Data preservation** - All existing data maintained correctly
747
-
748
- ---
749
-
750
- ## [3.7.3] - 2025-11-06
751
-
752
- ### Fixed - Master Tables Namespace Collision Bug
753
-
754
- **Critical bug fix for incomplete multi-project support in v3.7.0-v3.7.2**
755
-
756
- #### Problem
757
- - Master tables (m_files, m_tags, m_scopes) lacked `project_id` columns in v3.7.0-v3.7.2
758
- - This caused **namespace collisions** where identical file paths/tag names/scope names from different projects would conflict
759
- - Example: "src/index.ts" from ProjectA would collide with ProjectB's "src/index.ts"
760
- - Users upgrading from v3.6.x would have fake project name "default-project" instead of detected real name
761
-
762
- #### Solution
763
- - **20251106000000_fix_master_tables_project_id_v3_7_3.ts** - Comprehensive migration that:
764
- 1. **Data Consolidation** - Detects v3.7.0-v3.7.2 upgrade scenario and consolidates project #2 data into project #1
765
- 2. **Project Rename** - Renames fake "default-project" to real detected name (from config.toml/git remote/directory)
766
- 3. **Schema Fix** - Adds `project_id` column to m_files, m_tags, m_scopes with composite UNIQUE constraints
767
- 4. **Data Migration** - Maps all existing master table data to default project (ID 1)
768
- 5. **Orphan Cleanup** - Filters out 95 orphaned foreign key references (deleted tasks/tags)
769
- 6. **View Restoration** - Temporarily drops and restores 4 views during migration
770
- 7. **Table Restoration** - Backs up and restores 6 referencing tables with updated foreign keys
771
-
772
- #### Migration Details
773
- - **Idempotent** - Can run multiple times safely (checks for existing columns)
774
- - **Version-Aware** - Only consolidates data for v3.7.0-v3.7.2 databases (detects fake project names)
775
- - **Batch Inserts** - Uses 10-row batches to avoid SQLite UNION ALL limits
776
- - **FK Filtering** - Validates foreign key references before restoration to prevent constraint errors
777
- - **SQLite-Optimized** - Handles better-sqlite3 FK constraint behavior during table drops
778
-
779
- #### Technical Changes
780
- - **m_files**: Added `project_id` column, changed UNIQUE constraint from `(path)` to `(project_id, path)`
781
- - **m_tags**: Added `project_id` column, changed UNIQUE constraint from `(name)` to `(project_id, name)`
782
- - **m_scopes**: Added `project_id` column, changed UNIQUE constraint from `(name)` to `(project_id, name)`
783
- - **Referencing Tables**: Updated t_file_changes, t_task_file_links, t_decision_tags, t_task_tags, t_constraint_tags, t_decision_scopes
784
- - **Views**: Restored v_layer_summary, v_task_board, v_tagged_decisions, v_tagged_constraints
785
-
786
- #### Impact
787
- - ✅ **Fixed namespace collisions** - Files/tags/scopes from different projects can now have identical names
788
- - ✅ **Data integrity** - All existing data preserved and mapped correctly
789
- - ✅ **Project consolidation** - v3.7.0-v3.7.2 users get clean migration path
790
- - ✅ **Real project names** - No more fake "default-project" names
791
- - ✅ **Orphan cleanup** - Removed invalid foreign key references automatically
792
- - ✅ **Full idempotency** - Migration can be safely re-run if interrupted
793
-
794
- #### Testing
795
- - ✅ Tested on actual v3.7.2 production database (mcp-sqlew project)
796
- - Successfully consolidated 77 decisions, 191 tasks, 61 file changes
797
- - ✅ Filtered 95 orphaned task-tag references
798
- - All views and referencing tables restored correctly
799
- - ✅ Final database state validated with composite UNIQUE constraints working
800
-
801
- ---
802
-
803
- ## [3.7.2] - 2025-11-05
804
-
805
- ### Changed - Enhanced Sub-Agent Templates
806
-
807
- **Improved specialized agent templates for more efficient sqlew usage**
808
-
809
- #### Sub-Agent Template Updates
810
- - **sqlew-scrum-master.md** - Enhanced multi-agent coordination and task management workflows
811
- - **sqlew-researcher.md** - Improved decision querying and context analysis patterns
812
- - **sqlew-architect.md** - Enhanced decision documentation and constraint enforcement workflows
813
-
814
- #### New Documentation
815
- - **docs/SPECIALIZED_AGENTS.md** - Comprehensive guide for specialized agents
816
- - Installation and configuration instructions
817
- - Usage examples for each agent
818
- - Token optimization guidelines
819
- - Agent comparison and capability matrix
820
- - Integration patterns
821
- - Troubleshooting guide
822
-
823
- #### SQL Dump Enhancements
824
- - Added type conversion testing (`src/tests/type-conversion.test.ts`)
825
- - Enhanced SQL dump converters for better type handling
826
- - Improved SQL dump utilities with expanded functionality
827
-
828
- ### Fixed - Git LFS PNG Display Issue
829
-
830
- **Removed Git LFS tracking for PNG files to fix GitHub display**
831
-
832
- #### Problem
833
- - PNG files were tracked with Git LFS, causing display issues on GitHub
834
- - Users without Git LFS saw ASCII pointers instead of images
835
- - README images were not rendering properly
836
-
837
- #### Solution
838
- - Removed `*.png filter=lfs diff=lfs merge=lfs -text` from .gitattributes
839
- - Restored actual PNG binary files from pre-LFS commits
840
- - All PNG images now display correctly on GitHub without requiring Git LFS
841
-
842
- #### Impact
843
- - ✅ **Better agent templates** - More efficient sqlew usage patterns
844
- - ✅ **Comprehensive documentation** - Clear installation and usage guides
845
- - ✅ **Improved type handling** - Better SQL dump type conversion
846
- - ✅ **Fixed GitHub display** - PNG images now render properly without Git LFS
847
- - ✅ **Token efficient** - Optimized agent workflows reduce unnecessary tool calls
848
-
849
- ---
850
-
851
- ## [3.7.1] - 2025-11-05
852
-
853
- ### Fixed - Error Message Visibility
854
-
855
- **Fixed validation error messages being hidden by error wrapper**
856
-
857
- #### Problem
858
- - Validation errors (JSON-structured responses) were being wrapped with stack traces
859
- - Wrong-usage messages were hidden from MCP clients
860
- - Users received generic error messages instead of helpful validation details
861
-
862
- #### Solution
863
- - **Error Handler Enhancement** - Detect and unwrap JSON validation errors
864
- - Validation errors now returned directly to MCP client without wrapping
865
- - Stack traces written to logs only (not returned to client)
866
- - Token-efficient responses without exposing internal stack details
867
- - **Parameter Validator Enhancement** - Detect unexpected/invalid parameters
868
- - Added validation for parameters that don't match valid list and have no typo suggestion
869
- - Improved error messages: "Unexpected params: X. Valid params: Y, Z"
870
-
871
- #### Impact
872
- - ✅ **Better UX** - Validation errors are now visible and actionable
873
- - **Token efficiency** - No stack traces in MCP responses
874
- - ✅ **Clearer feedback** - Users see helpful error messages immediately
875
- - ✅ **Security** - Internal stack details not exposed to clients
876
-
877
- ---
878
-
879
- ## [3.7.0] - 2025-11-05
880
-
881
- ### Added - Runtime Database Reconnection
882
-
883
- **Automatic connection recovery with exponential backoff retry logic**
884
-
885
- #### Features
886
- - **ConnectionManager** - Singleton wrapper for all database operations
887
- - **Exponential Backoff** - Retry delays: 1s → 2s → 4s → 8s → 16s (31 seconds total)
888
- - **Smart Error Detection** - Recognizes connection errors across SQLite, MySQL, PostgreSQL
889
- - **Process.exit on Exhaustion** - Exits cleanly after 5 failed retries
890
- - **27 Operations Wrapped** - All transactional operations protected:
891
- - context.ts: 5 operations
892
- - tasks.ts: 9 operations
893
- - files.ts: 3 operations
894
- - constraints.ts: 3 operations
895
- - config.ts: 2 operations
896
- - utils.ts: 5 operations
897
-
898
- #### Connection Error Patterns Detected
899
- - **Network Errors**: ECONNREFUSED, ENOTFOUND, ETIMEDOUT, ECONNRESET, EPIPE
900
- - **SQLite**: "database is locked", "unable to open database"
901
- - **MySQL/MariaDB**: "server has gone away", "lost connection to mysql server"
902
- - **PostgreSQL**: "connection to server was lost", "could not connect to server"
903
- - **Knex-specific**: "timeout acquiring a connection", "pool is destroyed"
904
-
905
- #### Test Coverage
906
- - **41 tests passing** (22 unit + 19 integration)
907
- - Retry behavior verification
908
- - Production scenario simulation (server restart, network failures)
909
- - Tool integration testing
910
-
911
- #### Impact
912
- - **Resilient operations** - Automatic recovery from transient connection failures
913
- - **Production ready** - Handles server restarts, network issues
914
- - **Zero regressions** - All existing tests pass
915
- - ✅ **Token efficient** - No manual retry logic needed in agent code
916
-
917
- ---
918
-
919
- ### Changed - Validation Error Messages
920
-
921
- **70-85% token reduction in error message size**
922
-
923
- #### Token Efficiency
924
- - **Before**: ~1000+ characters (~300+ tokens) with full examples embedded
925
- - **After**: ~200 characters (~50 tokens) with reference IDs
926
- - **Reduction**: 70-85% token savings
927
-
928
- #### New Error Format
929
- ```json
930
- {
931
- "error": "Missing: key, value",
932
- "action": "set",
933
- "reference": "decision.set",
934
- "missing": ["key", "value"],
935
- "hint": "Use 'quick_set' for simpler usage..."
936
- }
937
- ```
938
-
939
- #### Features
940
- - **Reference IDs** - Compact `{tool}.{action}` format (e.g., "decision.set")
941
- - **Concise Messages** - Essential information only
942
- - **Conditional Fields** - Only include fields when present
943
- - **Self-Documenting** - AI can query `action: "help"` for full docs if needed
944
-
945
- #### Error Types
946
- - Missing params: `"Missing: key, value"`
947
- - Typos: `"Invalid params: val value"`
948
- - Unknown action: `"Unknown action 'sett'. Did you mean: set?"`
949
-
950
- #### Impact
951
- - **Token efficiency** - 70-85% reduction in error size
952
- - **Cost reduction** - Lower API costs for AI agents
953
- - **Better UX** - Quick, scannable errors
954
- - **Backward compatible** - Error structure unchanged
955
-
956
- ---
957
-
958
- ### Changed - Debug Log Format
959
-
960
- **Single-line log entries for easier parsing**
961
-
962
- #### Problem
963
- Multi-line log messages broke standard text processing tools (grep, awk, log rotation).
964
-
965
- #### Solution
966
- - **Sanitization Function** - Replaces newlines with spaces, collapses whitespace
967
- - **Applied To**: All log messages, data values, JSON output
968
- - **Result**: Every log entry is exactly one line
969
-
970
- #### Benefits
971
- - **Easier parsing** - Line-based tools work correctly
972
- - ✅ **Better grep** - Search across entire messages
973
- - **Simpler analysis** - Standard text processing
974
- - ✅ **Cleaner output** - No unexpected line breaks
975
-
976
- #### Example
977
- **Before:**
978
- ```
979
- [2025-11-05T02:00:00.000Z] [ERROR] Error details:
980
- Stack trace line 1
981
- Stack trace line 2
982
- ```
983
-
984
- **After:**
985
- ```
986
- [2025-11-05T02:00:00.000Z] [ERROR] Error details: Stack trace line 1 Stack trace line 2
987
- ```
988
-
989
- ---
990
-
991
- ### Changed - Specialized Agent Templates (Error Prevention)
992
-
993
- **Restructured agent templates to reduce tool call errors from 60% to <10%**
994
-
995
- #### Problem
996
- - 60% of agent errors: missing `action` parameter in tool calls
997
- - Templates embedded outdated action samples that became obsolete
998
- - Agents guessed syntax instead of using discovery workflow
999
-
1000
- #### Solution
1001
- All three agent templates restructured with error-prevention focus:
1002
- - **sqlew-architect.md** - Decision documentation specialist
1003
- - **sqlew-researcher.md** - Context analysis specialist
1004
- - **sqlew-scrum-master.md** - Sprint coordination specialist
1005
-
1006
- #### Key Improvements
1007
- - ⚠️ **Prominent Error-Prevention Section** - "CRITICAL: Error-Free sqlew Tool Usage" at top
1008
- - 📚 **Discovery-First Workflow** - Guides agents: `action: "help"` `action: "example"` → copy/modify
1009
- - ❌✅ **Zero-Error Pattern** - Clear WRONG/CORRECT examples for every common mistake:
1010
- - Missing `action` parameter
1011
- - Wrong data types (priority: string vs number)
1012
- - Wrong parameter names (old v2.x API)
1013
- - 🔍 **Pre-Execution Checklist** - Verify `action` parameter before every tool call
1014
- - 🗑️ **No Embedded Samples** - Removed action lists to prevent outdated syntax
1015
- - 🛠️ **Common Data Type Errors** - Shows tag arrays, boolean atomics, integer priorities
1016
-
1017
- #### Upgrade Path
1018
- **Note**: Existing `.claude/agents/` files NOT auto-upgraded (preserves customizations)
1019
-
1020
- **Manual upgrade required**:
1021
- ```bash
1022
- # Remove old templates
1023
- rm .claude/agents/sqlew-{architect,researcher,scrum-master}.md
1024
-
1025
- # Restart MCP server (auto-copies new templates from assets/sample-agents/)
1026
- ```
1027
-
1028
- See [docs/SPECIALIZED_AGENTS.md#upgrading-to-error-prevention-templates-v370](docs/SPECIALIZED_AGENTS.md#upgrading-to-error-prevention-templates-v370) for detailed instructions.
1029
-
1030
- #### Impact
1031
- - **Target: 60% <10% error rate** for agent tool calls
1032
- - ✅ **Better UX** - Clear guidance prevents common mistakes
1033
- - ✅ **Self-Correcting** - Agents learn correct patterns from errors
1034
- - ✅ **Future-Proof** - Discovery workflow adapts to API changes
1035
-
1036
- ---
1037
-
1038
- ### Fixed - Multi-Project Migration (Critical)
1039
-
1040
- **Fixed migration for ALL users upgrading from v3.6.10 to v3.7.0**
1041
-
1042
- #### Problem
1043
- - SQLite's `ALTER TABLE` silently failed for 4 tables with complex foreign keys
1044
- - Migration reported success but columns weren't added
1045
- - Task creation would fail: `"table t_task_details has no column named project_id"`
1046
-
1047
- #### Root Cause
1048
- SQLite cannot modify tables with `ON DELETE CASCADE` constraints using ALTER TABLE.
1049
-
1050
- #### Solution
1051
- - **Table Recreation Strategy** - Backup → Drop → Recreate → Restore
1052
- - **4 Tables Fixed**:
1053
- - `t_task_details` (STEP 4.7)
1054
- - `t_task_file_links` (STEP 4.8)
1055
- - `t_task_decision_links` (STEP 4.9)
1056
- - `t_task_tags` (composite PRIMARY KEY)
1057
-
1058
- #### Idempotency
1059
- All recreation steps check if `project_id` exists before executing:
1060
- ```typescript
1061
- const hasProjectId = await knex.schema.hasColumn('table_name', 'project_id');
1062
- if (!hasProjectId) {
1063
- // Recreation logic
1064
- }
1065
- ```
1066
-
1067
- #### Data Preservation Verified
1068
- - ✅ 223 task detail rows preserved
1069
- - ✅ 632 task tag rows preserved
1070
- - All task links preserved
1071
- - ✅ 100% data integrity maintained
1072
-
1073
- #### Testing
1074
- - ✅ Fresh installation works
1075
- - ✅ v3.6.10v3.7.0 upgrade works
1076
- - ✅ Migration can be re-run safely (idempotent)
1077
- - ✅ TypeScript compiles without errors
1078
-
1079
- #### Impact
1080
- - ✅ **Production ready** - Safe for all v3.6.10 users to upgrade
1081
- - ✅ **No data loss** - All existing data preserved
1082
- - **Idempotent** - Can re-run without errors
1083
-
1084
- ---
1085
-
1086
- ## [3.6.10] - 2025-10-30
1087
-
1088
- ### Added - Environment Variable Support for Project Root
1089
-
1090
- **New `SQLEW_PROJECT_ROOT` environment variable for project-relative databases**
1091
-
1092
- #### Problem
1093
- - Junie AI and other MCP clients require absolute paths in configuration
1094
- - Users had to hardcode project-specific paths in MCP server config
1095
- - No easy way to use project-relative database paths
1096
-
1097
- #### Solution
1098
- - Added `SQLEW_PROJECT_ROOT` environment variable support (inspired by serena-mcp pattern)
1099
- - MCP clients can now pass project directory via environment variable
1100
- - Database automatically created at `$SQLEW_PROJECT_ROOT/.sqlew/sqlew.db`
1101
-
1102
- #### Priority Order
1103
- 1. `SQLEW_PROJECT_ROOT` environment variable (NEW - highest priority)
1104
- 2. `--db-path` CLI argument (absolute path)
1105
- 3. `--config-path` CLI argument (absolute path)
1106
- 4. `database.path` in config file (absolute path)
1107
- 5. `process.cwd()` fallback
1108
-
1109
- #### Junie AI Configuration Example
1110
- ```json
1111
- {
1112
- "mcpServers": {
1113
- "sqlew": {
1114
- "command": "npx",
1115
- "args": ["sqlew"],
1116
- "env": {
1117
- "SQLEW_PROJECT_ROOT": "{projectDir}"
1118
- }
1119
- }
1120
- }
1121
- }
1122
- ```
1123
-
1124
- **Note:** Junie AI uses `{projectDir}` variable which expands to the current project's absolute path. This ensures each project gets its own isolated database without hardcoded paths. Other MCP clients may use different variable names like `${workspaceFolder}` (VS Code/Cline) - check your client's documentation.
1125
-
1126
- #### Impact
1127
- - ✅ **Project-relative databases** without hardcoded absolute paths
1128
- - ✅ **Cleaner MCP configuration** (no per-project path updates needed)
1129
- - ✅ **Compatible with Junie AI, Claude Desktop, and other MCP clients**
1130
- - **No breaking changes** (environment variable is optional)
1131
-
1132
- ---
1133
-
1134
- ### Fixed - MCP Protocol Compliance (EPIPE Fix)
1135
-
1136
- **Eliminated console output for strict JSON-RPC protocol compliance**
1137
-
1138
- #### Problem
1139
- - EPIPE (broken pipe) errors when running with Junie AI on Windows
1140
- - Console output to stdout/stderr violated MCP JSON-RPC protocol requirements
1141
- - Strict MCP clients (like Junie AI) expect pure JSON-RPC on stdio streams
1142
-
1143
- #### Changes
1144
- - **Redirected all diagnostic output to debug log file** - stdout/stderr reserved exclusively for JSON-RPC
1145
- - Modified `safeConsoleError()` to write to debug log instead of stderr
1146
- - Replaced 50+ console.log/console.error calls across codebase:
1147
- - `src/database.ts` - Database initialization messages
1148
- - `src/watcher/file-watcher.ts` - File watcher status and events
1149
- - `src/watcher/gitignore-parser.ts` - .gitignore loading warnings
1150
- - `src/tools/tasks.ts` - Task file registration warnings
1151
- - `src/config/example-generator.ts` - First launch messages
1152
-
1153
- #### Technical Details
1154
- - **MCP Protocol Requirement**: stdin/stdout/stderr must carry only JSON-RPC messages
1155
- - **Debug Logging**: All diagnostic messages now use `debugLog()` with appropriate levels (INFO, WARN, ERROR)
1156
- - **Zero stdout pollution**: Server starts silently, waits for JSON-RPC requests
1157
- - **Tested with Junie AI**: Confirmed no EPIPE errors on Windows
1158
-
1159
- #### Impact
1160
- - ✅ **Works with strict MCP clients** (Junie AI, etc.)
1161
- - ✅ **Maintains full diagnostics** via debug log file
1162
- - ✅ **Pure JSON-RPC protocol** compliance
1163
- - ✅ **No breaking changes** to MCP tool functionality
1164
-
1165
- ---
1166
-
1167
- ### Added - Environment Variable Support for Project Root
1168
-
1169
- **New `SQLEW_PROJECT_ROOT` environment variable for project-relative databases**
1170
-
1171
- #### Problem
1172
- - Junie AI and other MCP clients require absolute paths in configuration
1173
- - Users had to hardcode project-specific paths in MCP server config
1174
- - No easy way to use project-relative database paths
1175
-
1176
- #### Solution
1177
- - Added `SQLEW_PROJECT_ROOT` environment variable support (inspired by serena-mcp pattern)
1178
- - MCP clients can now pass project directory via environment variable
1179
- - Database automatically created at `$SQLEW_PROJECT_ROOT/.sqlew/sqlew.db`
1180
-
1181
- #### Priority Order
1182
- 1. `SQLEW_PROJECT_ROOT` environment variable (NEW - highest priority)
1183
- 2. `--db-path` CLI argument (absolute path)
1184
- 3. `--config-path` CLI argument (absolute path)
1185
- 4. `database.path` in config file (absolute path)
1186
- 5. `process.cwd()` fallback
1187
-
1188
- #### Junie AI Configuration Example
1189
- ```json
1190
- {
1191
- "mcpServers": {
1192
- "sqlew": {
1193
- "command": "npx",
1194
- "args": ["sqlew"],
1195
- "env": {
1196
- "SQLEW_PROJECT_ROOT": "{projectDir}"
1197
- }
1198
- }
1199
- }
1200
- }
1201
- ```
1202
-
1203
- **Note:** Junie AI uses `{projectDir}` variable which expands to the current project's absolute path. This ensures each project gets its own isolated database without hardcoded paths. Other MCP clients may use different variable names like `${workspaceFolder}` (VS Code/Cline) - check your client's documentation.
1204
-
1205
- #### Impact
1206
- - ✅ **Project-relative databases** without hardcoded absolute paths
1207
- - ✅ **Cleaner MCP configuration** (no per-project path updates needed)
1208
- - ✅ **Compatible with Junie AI, Claude Desktop, and other MCP clients**
1209
- - ✅ **No breaking changes** (environment variable is optional)
1210
-
1211
- ---
1212
-
1213
- ### Fixed - MCP Protocol Compliance (EPIPE Fix)
1214
-
1215
- **Eliminated console output for strict JSON-RPC protocol compliance**
1216
-
1217
- #### Problem
1218
- - EPIPE (broken pipe) errors when running with Junie AI on Windows
1219
- - Console output to stdout/stderr violated MCP JSON-RPC protocol requirements
1220
- - Strict MCP clients (like Junie AI) expect pure JSON-RPC on stdio streams
1221
-
1222
- #### Changes
1223
- - **Redirected all diagnostic output to debug log file** - stdout/stderr reserved exclusively for JSON-RPC
1224
- - Modified `safeConsoleError()` to write to debug log instead of stderr
1225
- - Replaced 50+ console.log/console.error calls across codebase:
1226
- - `src/database.ts` - Database initialization messages
1227
- - `src/watcher/file-watcher.ts` - File watcher status and events
1228
- - `src/watcher/gitignore-parser.ts` - .gitignore loading warnings
1229
- - `src/tools/tasks.ts` - Task file registration warnings
1230
- - `src/config/example-generator.ts` - First launch messages
1231
-
1232
- #### Technical Details
1233
- - **MCP Protocol Requirement**: stdin/stdout/stderr must carry only JSON-RPC messages
1234
- - **Debug Logging**: All diagnostic messages now use `debugLog()` with appropriate levels (INFO, WARN, ERROR)
1235
- - **Zero stdout pollution**: Server starts silently, waits for JSON-RPC requests
1236
- - **Tested with Junie AI**: Confirmed no EPIPE errors on Windows
1237
-
1238
- #### Impact
1239
- - ✅ **Works with strict MCP clients** (Junie AI, etc.)
1240
- - ✅ **Maintains full diagnostics** via debug log file
1241
- - ✅ **Pure JSON-RPC protocol** compliance
1242
- - ✅ **No breaking changes** to MCP tool functionality
1243
-
1244
- ---
1245
-
1246
- ### Added - Environment Variable Support for Project Root
1247
-
1248
- **New `SQLEW_PROJECT_ROOT` environment variable for project-relative databases**
1249
-
1250
- #### Problem
1251
- - Junie AI and other MCP clients require absolute paths in configuration
1252
- - Users had to hardcode project-specific paths in MCP server config
1253
- - No easy way to use project-relative database paths
1254
-
1255
- #### Solution
1256
- - Added `SQLEW_PROJECT_ROOT` environment variable support (inspired by serena-mcp pattern)
1257
- - MCP clients can now pass project directory via environment variable
1258
- - Database automatically created at `$SQLEW_PROJECT_ROOT/.sqlew/sqlew.db`
1259
-
1260
- #### Priority Order
1261
- 1. `SQLEW_PROJECT_ROOT` environment variable (NEW - highest priority)
1262
- 2. `--db-path` CLI argument (absolute path)
1263
- 3. `--config-path` CLI argument (absolute path)
1264
- 4. `database.path` in config file (absolute path)
1265
- 5. `process.cwd()` fallback
1266
-
1267
- #### Junie AI Configuration Example
1268
- ```json
1269
- {
1270
- "mcpServers": {
1271
- "sqlew": {
1272
- "command": "npx",
1273
- "args": ["sqlew"],
1274
- "env": {
1275
- "SQLEW_PROJECT_ROOT": "{projectDir}"
1276
- }
1277
- }
1278
- }
1279
- }
1280
- ```
1281
-
1282
- **Note:** Junie AI uses `{projectDir}` variable which expands to the current project's absolute path. This ensures each project gets its own isolated database without hardcoded paths. Other MCP clients may use different variable names like `${workspaceFolder}` (VS Code/Cline) - check your client's documentation.
1283
-
1284
- #### Impact
1285
- - ✅ **Project-relative databases** without hardcoded absolute paths
1286
- - ✅ **Cleaner MCP configuration** (no per-project path updates needed)
1287
- - ✅ **Compatible with Junie AI, Claude Desktop, and other MCP clients**
1288
- - ✅ **No breaking changes** (environment variable is optional)
1289
-
1290
- ---
1291
-
1292
- ### Fixed - MCP Protocol Compliance (EPIPE Fix)
1293
-
1294
- **Eliminated console output for strict JSON-RPC protocol compliance**
1295
-
1296
- #### Problem
1297
- - EPIPE (broken pipe) errors when running with Junie AI on Windows
1298
- - Console output to stdout/stderr violated MCP JSON-RPC protocol requirements
1299
- - Strict MCP clients (like Junie AI) expect pure JSON-RPC on stdio streams
1300
-
1301
- #### Changes
1302
- - **Redirected all diagnostic output to debug log file** - stdout/stderr reserved exclusively for JSON-RPC
1303
- - Modified `safeConsoleError()` to write to debug log instead of stderr
1304
- - Replaced 50+ console.log/console.error calls across codebase:
1305
- - `src/database.ts` - Database initialization messages
1306
- - `src/watcher/file-watcher.ts` - File watcher status and events
1307
- - `src/watcher/gitignore-parser.ts` - .gitignore loading warnings
1308
- - `src/tools/tasks.ts` - Task file registration warnings
1309
- - `src/config/example-generator.ts` - First launch messages
1310
-
1311
- #### Technical Details
1312
- - **MCP Protocol Requirement**: stdin/stdout/stderr must carry only JSON-RPC messages
1313
- - **Debug Logging**: All diagnostic messages now use `debugLog()` with appropriate levels (INFO, WARN, ERROR)
1314
- - **Zero stdout pollution**: Server starts silently, waits for JSON-RPC requests
1315
- - **Tested with Junie AI**: Confirmed no EPIPE errors on Windows
1316
-
1317
- #### Impact
1318
- - ✅ **Works with strict MCP clients** (Junie AI, etc.)
1319
- - ✅ **Maintains full diagnostics** via debug log file
1320
- - ✅ **Pure JSON-RPC protocol** compliance
1321
- - ✅ **No breaking changes** to MCP tool functionality
1322
-
1323
- ---
1324
-
1325
- ### Added - Environment Variable Support for Project Root
1326
-
1327
- **New `SQLEW_PROJECT_ROOT` environment variable for project-relative databases**
1328
-
1329
- #### Problem
1330
- - Junie AI and other MCP clients require absolute paths in configuration
1331
- - Users had to hardcode project-specific paths in MCP server config
1332
- - No easy way to use project-relative database paths
1333
-
1334
- #### Solution
1335
- - Added `SQLEW_PROJECT_ROOT` environment variable support (inspired by serena-mcp pattern)
1336
- - MCP clients can now pass project directory via environment variable
1337
- - Database automatically created at `$SQLEW_PROJECT_ROOT/.sqlew/sqlew.db`
1338
-
1339
- #### Priority Order
1340
- 1. `SQLEW_PROJECT_ROOT` environment variable (NEW - highest priority)
1341
- 2. `--db-path` CLI argument (absolute path)
1342
- 3. `--config-path` CLI argument (absolute path)
1343
- 4. `database.path` in config file (absolute path)
1344
- 5. `process.cwd()` fallback
1345
-
1346
- #### Junie AI Configuration Example
1347
- ```json
1348
- {
1349
- "mcpServers": {
1350
- "sqlew": {
1351
- "command": "npx",
1352
- "args": ["sqlew"],
1353
- "env": {
1354
- "SQLEW_PROJECT_ROOT": "{projectDir}"
1355
- }
1356
- }
1357
- }
1358
- }
1359
- ```
1360
-
1361
- **Note:** Junie AI uses `{projectDir}` variable which expands to the current project's absolute path. This ensures each project gets its own isolated database without hardcoded paths. Other MCP clients may use different variable names like `${workspaceFolder}` (VS Code/Cline) - check your client's documentation.
1362
-
1363
- #### Impact
1364
- - ✅ **Project-relative databases** without hardcoded absolute paths
1365
- - ✅ **Cleaner MCP configuration** (no per-project path updates needed)
1366
- - ✅ **Compatible with Junie AI, Claude Desktop, and other MCP clients**
1367
- - ✅ **No breaking changes** (environment variable is optional)
1368
-
1369
- ---
1370
-
1371
- ### Fixed - MCP Protocol Compliance (EPIPE Fix)
1372
-
1373
- **Eliminated console output for strict JSON-RPC protocol compliance**
1374
-
1375
- #### Problem
1376
- - EPIPE (broken pipe) errors when running with Junie AI on Windows
1377
- - Console output to stdout/stderr violated MCP JSON-RPC protocol requirements
1378
- - Strict MCP clients (like Junie AI) expect pure JSON-RPC on stdio streams
1379
-
1380
- #### Changes
1381
- - **Redirected all diagnostic output to debug log file** - stdout/stderr reserved exclusively for JSON-RPC
1382
- - Modified `safeConsoleError()` to write to debug log instead of stderr
1383
- - Replaced 50+ console.log/console.error calls across codebase:
1384
- - `src/database.ts` - Database initialization messages
1385
- - `src/watcher/file-watcher.ts` - File watcher status and events
1386
- - `src/watcher/gitignore-parser.ts` - .gitignore loading warnings
1387
- - `src/tools/tasks.ts` - Task file registration warnings
1388
- - `src/config/example-generator.ts` - First launch messages
1389
-
1390
- #### Technical Details
1391
- - **MCP Protocol Requirement**: stdin/stdout/stderr must carry only JSON-RPC messages
1392
- - **Debug Logging**: All diagnostic messages now use `debugLog()` with appropriate levels (INFO, WARN, ERROR)
1393
- - **Zero stdout pollution**: Server starts silently, waits for JSON-RPC requests
1394
- - **Tested with Junie AI**: Confirmed no EPIPE errors on Windows
1395
-
1396
- #### Impact
1397
- - ✅ **Works with strict MCP clients** (Junie AI, etc.)
1398
- - ✅ **Maintains full diagnostics** via debug log file
1399
- - ✅ **Pure JSON-RPC protocol** compliance
1400
- - ✅ **No breaking changes** to MCP tool functionality
1401
-
1402
- ---
1403
-
1404
- ### Added - Environment Variable Support for Project Root
1405
-
1406
- **New `SQLEW_PROJECT_ROOT` environment variable for project-relative databases**
1407
-
1408
- #### Problem
1409
- - Junie AI and other MCP clients require absolute paths in configuration
1410
- - Users had to hardcode project-specific paths in MCP server config
1411
- - No easy way to use project-relative database paths
1412
-
1413
- #### Solution
1414
- - Added `SQLEW_PROJECT_ROOT` environment variable support (inspired by serena-mcp pattern)
1415
- - MCP clients can now pass project directory via environment variable
1416
- - Database automatically created at `$SQLEW_PROJECT_ROOT/.sqlew/sqlew.db`
1417
-
1418
- #### Priority Order
1419
- 1. `SQLEW_PROJECT_ROOT` environment variable (NEW - highest priority)
1420
- 2. `--db-path` CLI argument (absolute path)
1421
- 3. `--config-path` CLI argument (absolute path)
1422
- 4. `database.path` in config file (absolute path)
1423
- 5. `process.cwd()` fallback
1424
-
1425
- #### Junie AI Configuration Example
1426
- ```json
1427
- {
1428
- "mcpServers": {
1429
- "sqlew": {
1430
- "command": "npx",
1431
- "args": ["sqlew"],
1432
- "env": {
1433
- "SQLEW_PROJECT_ROOT": "{projectDir}"
1434
- }
1435
- }
1436
- }
1437
- }
1438
- ```
1439
-
1440
- **Note:** Junie AI uses `{projectDir}` variable which expands to the current project's absolute path. This ensures each project gets its own isolated database without hardcoded paths. Other MCP clients may use different variable names like `${workspaceFolder}` (VS Code/Cline) - check your client's documentation.
1441
-
1442
- #### Impact
1443
- - ✅ **Project-relative databases** without hardcoded absolute paths
1444
- - ✅ **Cleaner MCP configuration** (no per-project path updates needed)
1445
- - ✅ **Compatible with Junie AI, Claude Desktop, and other MCP clients**
1446
- - ✅ **No breaking changes** (environment variable is optional)
1447
-
1448
- ---
1449
-
1450
- ### Fixed - MCP Protocol Compliance (EPIPE Fix)
1451
-
1452
- **Eliminated console output for strict JSON-RPC protocol compliance**
1453
-
1454
- #### Problem
1455
- - EPIPE (broken pipe) errors when running with Junie AI on Windows
1456
- - Console output to stdout/stderr violated MCP JSON-RPC protocol requirements
1457
- - Strict MCP clients (like Junie AI) expect pure JSON-RPC on stdio streams
1458
-
1459
- #### Changes
1460
- - **Redirected all diagnostic output to debug log file** - stdout/stderr reserved exclusively for JSON-RPC
1461
- - Modified `safeConsoleError()` to write to debug log instead of stderr
1462
- - Replaced 50+ console.log/console.error calls across codebase:
1463
- - `src/database.ts` - Database initialization messages
1464
- - `src/watcher/file-watcher.ts` - File watcher status and events
1465
- - `src/watcher/gitignore-parser.ts` - .gitignore loading warnings
1466
- - `src/tools/tasks.ts` - Task file registration warnings
1467
- - `src/config/example-generator.ts` - First launch messages
1468
-
1469
- #### Technical Details
1470
- - **MCP Protocol Requirement**: stdin/stdout/stderr must carry only JSON-RPC messages
1471
- - **Debug Logging**: All diagnostic messages now use `debugLog()` with appropriate levels (INFO, WARN, ERROR)
1472
- - **Zero stdout pollution**: Server starts silently, waits for JSON-RPC requests
1473
- - **Tested with Junie AI**: Confirmed no EPIPE errors on Windows
1474
-
1475
- #### Impact
1476
- - ✅ **Works with strict MCP clients** (Junie AI, etc.)
1477
- - ✅ **Maintains full diagnostics** via debug log file
1478
- - ✅ **Pure JSON-RPC protocol** compliance
1479
- - ✅ **No breaking changes** to MCP tool functionality
1480
-
1481
- ---
1482
-
1483
- ### Fixed - Windows Absolute Path Handling
1484
-
1485
- **Fixed path normalization for Windows environments**
1486
-
1487
- #### Changes
1488
- - Fixed absolute path to relative path conversion in `gitignore-parser.ts`
1489
- - Prevented `uname` Unix command calls on Windows
1490
- - Resolved "path should be a `path.relative()`d string" error on Windows
1491
- - Improved cross-platform path handling in file watcher
1492
-
1493
- #### Technical Details
1494
- - Enhanced path normalization logic to handle Windows drive letters (`C:/`)
1495
- - Added proper Windows-specific path handling checks
1496
- - Fixed compatibility with `ignore` library path requirements
1497
-
1498
- ---
1499
-
1500
- ## [3.6.8] - 2025-10-30
1501
-
1502
- ### Fixed - Windows Environment Compatibility
1503
-
1504
- **Updated better-sqlite3 for Windows support**
1505
-
1506
- #### Changes
1507
- - Updated `better-sqlite3` from `^11.0.0` to `^12.4.1`
1508
- - Fixes Windows environment compatibility issues
1509
- - Improves cross-platform stability
1510
-
1511
- ---
1512
-
1513
- ## [3.6.7] - 2025-10-30
1514
-
1515
- ### Fixed - Dependency Update
1516
-
1517
- **Removed deprecated dependency**
1518
-
1519
- #### Changes
1520
- - Removed deprecated dependency to ensure compatibility with latest ecosystem
1521
- - Maintenance update for long-term stability
1522
-
1523
- ---
1524
-
1525
- ## [3.6.6] - 2025-10-29
1526
-
1527
- ### Added - Parameter Validation & Error Handling
1528
-
1529
- **Comprehensive parameter validation with helpful error messages**
1530
-
1531
- #### Parameter Validation
1532
- - **Required/Optional Detection** - Clear indication of required vs optional parameters
1533
- - **Typo Suggestions** - Levenshtein distance-based "did you mean" suggestions for mistyped parameters
1534
- - **Structured Error Messages** - JSON format with examples showing correct usage
1535
- - **Visual Markers** - Help responses show 🔴 REQUIRED and ⚪ OPTIONAL parameter markers
1536
- - **Action Specs Registry** - Centralized action specification in `src/utils/action-specs.ts`
1537
- - **Comprehensive Test Suite** - 49 validation tests across all 5 tools
1538
-
1539
- ### Removed - Config Tool Deprecated
1540
-
1541
- **Config MCP tool removed in favor of file-based configuration**
1542
-
1543
- #### Why Removed
1544
- - Messaging system deprecated (primary use case eliminated)
1545
- - File-based configuration (`.sqlew/config.toml`) is clearer and more maintainable
1546
- - Runtime updates caused configuration drift between `m_config` table and config file
1547
- - Confusing UX (changes lost on restart unless manually synced)
1548
-
1549
- #### Migration Path
1550
- - ✅ Use `.sqlew/config.toml` for all configuration (persistent, version-controlled)
1551
- - Use CLI arguments for one-time overrides
1552
- - Do not use `config` tool (will error)
1553
-
1554
- #### Impact
1555
- - ✅ 5 MCP tools (down from 6): `decision`, `task`, `file`, `constraint`, `stats`
1556
- - ✅ Clearer configuration workflow (single source of truth)
1557
- - Better developer experience (validation errors with examples)
1558
- - ✅ Reduced cognitive load (no config drift issues)
1559
-
1560
- ---
1561
-
1562
- ## [3.6.5] - 2025-10-28
1563
-
1564
- ### Changed - Agent System Simplification & CI/CD Fix
1565
-
1566
- **Removed messaging system and eliminated agent pooling complexity**
1567
-
1568
- #### Agent System Cleanup
1569
- - **Removed messaging system** - `t_agent_messages` table dropped, `message` MCP tool deprecated
1570
- - Messaging system was unused and added unnecessary complexity
1571
- - Simplified agent architecture to single-purpose registry
1572
- - **Eliminated agent pooling** - Code no longer uses `in_use` and `is_reusable` columns
1573
- - Removed race conditions and UNIQUE constraint errors
1574
- - Each agent name creates one permanent record (no reuse/pooling)
1575
- - Generic agents (`generic-N`) auto-allocated for empty names
1576
- - **6 MCP Tools** - Down from 7 (messaging removed)
1577
- - `decision`, `file`, `constraint`, `stats`, `config`, `task`
1578
-
1579
- #### Infrastructure
1580
- - **CI/CD Workflow** - Removed npm publish step from GitHub Actions
1581
- - npm publish requires 2FA authentication
1582
- - Publishing must be done manually to prevent workflow failures
1583
-
1584
- #### Impact
1585
- - Simplified agent management (no pooling overhead)
1586
- - ✅ Reduced complexity (messaging system removed)
1587
- - CI/CD workflow no longer fails on npm publish
1588
-
1589
- ---
1590
-
1591
- ## [3.6.4] - 2025-10-28
1592
-
1593
- ### Fixed - WSL Git Add Detection
1594
-
1595
- **WSL-specific polling workaround for chokidar file watcher**
1596
-
1597
- #### Changes
1598
- - **1-second polling for WSL** - Added platform-specific chokidar configuration
1599
- - WSL filesystem events are unreliable with native watching
1600
- - Polling ensures git add operations are detected consistently
1601
- - **Platform detection** - Automatic WSL detection via `/proc/version`
1602
- - **Backward compatible** - Non-WSL platforms use native file watching (no polling)
1603
-
1604
- #### Impact
1605
- - ✅ Git add detection now works reliably on WSL
1606
- - VCS-aware auto-complete functional across all platforms
1607
-
1608
- ---
1609
-
1610
- ## [3.6.3] - 2025-10-27
1611
-
1612
- ### Fixed - Critical Bug Fixes & Git Add Detection
1613
-
1614
- **Transaction pool exhaustion and VCS-aware auto-complete implementation**
1615
-
1616
- #### Bug Fixes
1617
- - **Task Move Transaction Bug** - Fixed `moveTask` using base `knex` instead of transaction `trx` (line 880)
1618
- - Caused "Knex: Timeout acquiring a connection" errors
1619
- - Now properly uses transaction object for `logTaskStatusChange`
1620
- - **Task Link Transaction Bug** - Fixed `linkTask` using base `knex` instead of transaction `trx` (line 948)
1621
- - Same connection pool exhaustion issue
1622
- - Now properly uses transaction object for decision link insertion
1623
-
1624
- #### Features
1625
- - **Git Add Detection** - Implemented `detectAndCompleteOnStaging()` for VCS-aware workflow
1626
- - Detects `git add` operations and auto-completes tasks (`waiting_review` → `done`)
1627
- - Supports Git, Mercurial, and SVN
1628
- - Configurable via `git_auto_complete_on_stage` and `require_all_files_staged`
1629
- - **VCS Configuration** - Added comprehensive settings documentation to `config.example.toml`
1630
- - `git_auto_complete_on_stage` (default: true)
1631
- - `git_auto_archive_on_commit` (default: true)
1632
- - `require_all_files_staged` (default: true)
1633
- - `require_all_files_committed_for_archive` (default: true)
1634
-
1635
- #### Infrastructure
1636
- - **Line Ending Fix** - Added `.gitattributes` to enforce LF endings for shell scripts
1637
- - Prevents CRLF issues in Husky hooks on Windows/WSL
1638
- - Applies to `*.sh` and `.husky/*` files
1639
- - **Husky Hooks** - Fixed pre-commit/pre-push hooks (added shebang, normalized line endings)
1640
-
1641
- #### Impact
1642
- - Task operations no longer fail with connection pool timeouts
1643
- - Git add detection now functional (was stubbed in v3.5.2)
1644
- - Cross-platform compatibility for git hooks (Windows/WSL/Linux/macOS)
1645
-
1646
- ---
1647
-
1648
- ## [3.6.2] - 2025-10-27
1649
-
1650
- ### Changed - Migration System Modernization
1651
-
1652
- **Simplified to Knex-only migrations with organized directory structure**
1653
-
1654
- #### Migration System Cleanup
1655
- - **Removed custom migration system** (14 obsolete files from `src/migrations/`)
1656
- - **Pure Knex migrations** - Standardized on Knex.js migration framework
1657
- - **Organized structure** - 22 migrations grouped into 3 logical subdirectories:
1658
- - `upgrades/` (7 files) - Version upgrade paths (v1.0 → v3.6)
1659
- - `bootstrap/` (5 files) - Fresh install foundation
1660
- - `enhancements/` (10 files) - v3.6.0+ feature additions
1661
-
1662
- #### Testing & CI/CD
1663
- - **Migration tests updated** - Converted to use Knex migrations exclusively
1664
- - **Comprehensive test coverage** - 8/9 versions migrate successfully (89% backward compatibility)
1665
- - **Husky git hooks** - Pre-commit (build + tests), pre-push (migration tests)
1666
- - **GitHub Actions workflow** - CI/CD pipeline for Node 18.x/20.x
1667
-
1668
- #### Benefits
1669
- - **Better maintainability** - Clear organization, standard tooling
1670
- - **Easier onboarding** - Knex is industry-standard
1671
- - **Faster development** - 56% time efficiency via parallel execution
1672
-
1673
- ---
1674
-
1675
- ## [3.6.0] - 2025-10-25
1676
-
1677
- ### Added - Help System Optimization
1678
-
1679
- **Database-driven help system with 60-70% token efficiency improvement**
1680
-
1681
- #### Key Achievements
1682
- - **60-70% Token Reduction** - Average help query: ~200 tokens (vs ~2,150 legacy)
1683
- - **95.8% Schema Reduction** - MCP InputSchemas: 350 tokens (vs 8,400 legacy)
1684
- - **6 New Help Actions** - Granular queries for actions, parameters, tools, use-cases
1685
- - **41 Use-Cases** - Comprehensive workflow examples across 6 categories
1686
- - **100% Test Coverage** - 38/38 tests passing
1687
-
1688
- #### New MCP Actions (stats tool)
1689
- - `help_action` - Query single action with parameters and examples
1690
- - `help_params` - Query parameter list for an action
1691
- - `help_tool` - Query tool overview + all actions
1692
- - `help_use_case` - Get single use-case with full workflow
1693
- - `help_list_use_cases` - List/filter use-cases by category/complexity
1694
- - `help_next_actions` - Suggest common next actions
1695
-
1696
- #### Database Schema
1697
- 7 new tables: `m_help_tools`, `m_help_actions`, `m_help_use_case_categories`, `t_help_action_params`, `t_help_action_examples`, `t_help_use_cases`, `t_help_action_sequences`
1698
-
1699
- #### Migration from v3.5.x
1700
- - Automatic migration on startup
1701
- - Backward compatible - all existing MCP actions unchanged
1702
- - Zero downtime
1703
-
1704
- ---
1705
-
1706
- ## [3.5.2] - 2025-10-24
1707
-
1708
- ### Added - Two-Step Git-Aware Task Workflow
1709
-
1710
- **Automatic task completion and archiving based on Git staging and committing**
1711
-
1712
- #### Features
1713
- - **Step 1 - Staging** (`git add`): `waiting_review` → `done` (work complete)
1714
- - **Step 2 - Committing** (`git commit`): `done` → `archived` (work finalized)
1715
- - **VCS Support**: Git, Mercurial, and SVN
1716
- - **Zero Token Cost**: Fully automated, no manual MCP calls needed
1717
-
1718
- #### Configuration
1719
- - `git_auto_complete_on_stage` (default: `'1'`)
1720
- - `git_auto_archive_on_commit` (default: `'1'`)
1721
- - `require_all_files_staged` (default: `'1'`)
1722
- - `require_all_files_committed_for_archive` (default: `'1'`)
1723
-
1724
- ---
1725
-
1726
- ## [3.5.1] - 2025-10-24
1727
-
1728
- ### Fixed - File Watcher WSL Compatibility
1729
-
1730
- **Upgraded chokidar from v3 to v4 + Fixed path normalization bug**
1731
-
1732
- #### Changes
1733
- - **chokidar**: `^3.6.0` `^4.0.3` (automatic WSL support)
1734
- - Fixed path normalization: chokidar reports absolute paths, database stores relative
1735
- - Removed manual WSL detection and polling configuration
1736
-
1737
- ---
1738
-
1739
- ## [3.5.0] - 2025-10-22
1740
-
1741
- ### Added - Non-Existent File Auto-Pruning
1742
-
1743
- **Automatic removal of non-existent watched files with audit trail**
1744
-
1745
- #### Features
1746
- - New table: `t_task_pruned_files` - Audit trail for pruned files
1747
- - Auto-pruning during `in_progress → waiting_review` transition
1748
- - Safety check: blocks if ALL files non-existent
1749
- - New MCP actions: `get_pruned_files`, `link_pruned_file`
1750
-
1751
- #### Documentation
1752
- - `TASK_PRUNING.md` - Comprehensive guide with examples and best practices
1753
-
1754
- ---
1755
-
1756
-
1757
- ## Older Versions
1758
-
1759
- For changelog entries **v3.4.1 and older**, see:
1760
- - [docs/changelogs/CHANGELOG_ARCHIVE_v3.4_and_older.md](docs/changelogs/CHANGELOG_ARCHIVE_v3.4_and_older.md)
1761
-
1762
- This includes all versions from v1.0.0 through v3.4.1.
1
+ # Changelog
2
+
3
+ All notable changes to sqlew will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ---
9
+
10
+ ## [4.1.0] - 2025-12-24
11
+
12
+ ### Added
13
+
14
+ **Claude Code Hooks Integration**
15
+
16
+ - File Queue Architecture for async decision operations
17
+ - Hook commands: `suggest`, `track-plan`, `save`, `check-completion`, `mark-done`
18
+ - QueueWatcher monitors `.sqlew/queue/pending.json` for changes
19
+ - Auto-initialization with `sqlew init --hooks`
20
+ - PreToolUse hooks (Task, Write triggers)
21
+ - PostToolUse hooks (Edit/Write, TodoWrite, ExitPlanMode triggers)
22
+ - Git hooks integration (post-merge, post-rewrite)
23
+
24
+ **PostgreSQL Compatibility**
25
+
26
+ - Replaced GROUP_CONCAT with string_agg for PostgreSQL
27
+ - Expanded GROUP BY clauses for PostgreSQL strictness compliance
28
+ - Cross-DB compatibility verified: SQLite, MySQL, MariaDB, PostgreSQL
29
+
30
+ ### Changed
31
+
32
+ - Hook operations now use file queue instead of direct DB access (<100ms latency)
33
+ - QueueWatcher singleton monitors queue file and processes decisions asynchronously
34
+
35
+ ---
36
+
37
+ ## [4.0.5] - 2025-12-19
38
+
39
+ ### Changed
40
+
41
+ **License Change: AGPL-3.0 → Apache-2.0**
42
+
43
+ - Changed license from AGPLv3 to Apache License 2.0
44
+ - More permissive license for commercial and enterprise adoption
45
+ - Added NOTICE file with third-party attributions
46
+ - Updated LICENSE file with full Apache 2.0 text
47
+ - Updated package.json license field
48
+
49
+ **Why Apache 2.0?**
50
+ - Patent protection for contributors and users
51
+ - Widely adopted by major tech companies (Google, Microsoft, AWS)
52
+ - Easier enterprise adoption without copyleft concerns
53
+ - Compatible with most open source licenses
54
+
55
+ ---
56
+
57
+ ## [4.0.4] - 2025-12-10
58
+
59
+ ### Fixed
60
+
61
+ **Slash Command Sync Bug**
62
+
63
+ - Fixed `sync-commands.ts` referencing obsolete command files (`sqw-scrum.md`, `sqw-documentor.md`, etc.)
64
+ - Updated to use new unified `sqlew.md` command file
65
+ - Resolves "Source file not found" errors during npm package installation
66
+
67
+ ### Added
68
+
69
+ **Agent Skills Configuration**
70
+
71
+ - Added `skills` field to agent YAML frontmatter for automatic skill loading
72
+ - All sqlew agents now reference `sqlew-plan-guidance` skill
73
+ - Agents: `sqlew-architect`, `sqlew-researcher`, `sqlew-scrum-master`
74
+
75
+ **Config Example Update**
76
+
77
+ - Added `[commands]` section to `assets/config.example.toml`
78
+ - Documents the unified `/sqlew` command configuration
79
+
80
+ ### Changed
81
+
82
+ **Plan Mode Integration Documentation**
83
+
84
+ - Changed `Phase 1 (Research)` `Research Phase` for flexibility
85
+ - Changed `Phase 4 (Final Plan)` `Final Plan Phase`
86
+ - Plan mode phases are now semantically named instead of numbered
87
+
88
+ **CommandsConfig Simplified**
89
+
90
+ - Consolidated 6 individual command options into single `sqlew` option
91
+ - Updated `src/config/types.ts` and `src/config/minimal-generator.ts`
92
+
93
+ ---
94
+
95
+ ## [4.0.3] - 2025-12-04
96
+
97
+ ### Added
98
+
99
+ **Unified `/sqlew` Slash Command**
100
+
101
+ - Consolidated all slash commands (`/sqw-plan`, `/sqw-scrum`, `/sqw-research`, etc.) into single `/sqlew` command
102
+ - Natural language interface with automatic intent detection
103
+ - 6-level intent priority: List/Status Search → Record → Update → Execute → Task Creation
104
+ - Supports both English and Japanese keywords
105
+ - Removed custom agent definitions (sqlew-architect, scrum-master, sqlew-researcher)
106
+
107
+ **Usage Examples:**
108
+ ```bash
109
+ /sqlew # Show status and suggest next action
110
+ /sqlew show remaining tasks # List/Status intent
111
+ /sqlew search for auth decisions # Search intent
112
+ /sqlew record that we use JWT # Record intent
113
+ /sqlew execute pending tasks # Execute intent
114
+ ```
115
+
116
+ ### Fixed
117
+
118
+ **v4_task_details JOIN Bug**
119
+
120
+ - Fixed `task.get` action failing with "no such column: td.project_id" error
121
+ - Root cause: `v4_task_details` table has only `task_id` as PK, not `project_id`
122
+ - Removed invalid `.andOn('t.project_id', '=', 'td.project_id')` from JOIN conditions
123
+ - Affected files: `task-queries.ts`, `get.ts`
124
+
125
+ ### Changed
126
+
127
+ **Documentation Updates**
128
+
129
+ - Rewrote `CLAUDE.md` with unified `/sqlew` command section
130
+ - Updated `README.md` Quick Start to use `/sqlew`
131
+ - Rewrote `docs/SLASH_COMMANDS.md` as Unified /sqlew Command Guide
132
+
133
+ ---
134
+
135
+ ## [4.0.2] - 2025-11-28
136
+
137
+ ### BREAKING CHANGES
138
+
139
+ **SQL Dump No Longer Supports Cross-Database Format Conversion**
140
+
141
+ The `db:dump` command now generates SQL for the **same database type only**. Cross-database migrations (e.g., SQLite → MySQL) must use JSON export/import instead.
142
+
143
+ **Migration Required:**
144
+ ```bash
145
+ # Old approach (no longer supported)
146
+ npx sqlew db:dump mysql backup.sql # Cross-DB conversion removed
147
+
148
+ # New approach: Use JSON for cross-database migration
149
+ npx sqlew db:export backup.json # Export to JSON
150
+ npx sqlew db:import backup.json # Import to target database
151
+ ```
152
+
153
+ **Rationale:**
154
+ - SQL syntax differences between databases caused data corruption issues
155
+ - Case-insensitive pattern matching failed in certain scenarios
156
+ - JSON format is database-agnostic and handles all data types correctly
157
+
158
+ **Node.js 20+ Required**
159
+
160
+ Minimum Node.js version updated from 18.0.0 to 20.0.0.
161
+
162
+ ### Added
163
+
164
+ **Unified CLI Entry Point**
165
+
166
+ - `npx sqlew db:export`, `npx sqlew db:import`, `npx sqlew db:dump` now work directly
167
+ - No `npm install` required - just use `npx sqlew <command>`
168
+ - CLI commands and MCP server mode unified under single `sqlew` entry point
169
+ - Removed separate `sqlew-cli` binary
170
+
171
+ ### Fixed
172
+
173
+ **Case-Insensitive Validation for Master Records**
174
+
175
+ - Added case-insensitive duplicate detection when registering new records
176
+ - Prevents duplicate entries like "MyTag" and "mytag" from being created
177
+ - Applies to tags, scopes, layers, and other master table entries
178
+ - New utility: `src/utils/case-insensitive-validator.ts`
179
+
180
+ **SQLite to MySQL SQL Dump Case-Sensitivity Bug**
181
+
182
+ - Fixed regex pattern matching that failed with case variations
183
+ - SQL dump now correctly handles mixed-case identifiers
184
+ - Enhanced schema table export for better compatibility
185
+
186
+ ### Changed
187
+
188
+ **Export Version Tracking**
189
+
190
+ - Export JSON now includes proper version metadata
191
+ - Version information helps with import compatibility checks
192
+ - Clearer error messages when importing incompatible versions
193
+
194
+ **CLI Documentation Update**
195
+
196
+ - Updated `docs/cli/README.md` with JSON-first migration workflow
197
+ - Added clear guidance on when to use `db:dump` vs `db:export`/`db:import`
198
+ - Improved comparison table for migration scenarios
199
+
200
+ ### Added
201
+
202
+ **Case-Insensitive Validator Utility**
203
+
204
+ - New `src/utils/case-insensitive-validator.ts` for consistent validation
205
+ - Comprehensive test suite: `src/tests/unit/utils/case-insensitive-validator.test.ts`
206
+ - Reusable across all master table operations
207
+
208
+ ### Migration Notes
209
+
210
+ **Backward Compatibility:**
211
+ - Existing databases unaffected
212
+ - JSON export/import workflows unchanged
213
+ - SQL dumps for same-database-type operations still work
214
+
215
+ **Action Required:**
216
+ - Update any scripts that use `db:dump` for cross-database migrations
217
+ - Switch to `db:export`/`db:import` for SQLite ↔ MySQL ↔ PostgreSQL migrations
218
+
219
+ ---
220
+
221
+ ## [4.0.1] - 2025-11-28
222
+
223
+ ### Removed
224
+
225
+ **Database Views Eliminated**
226
+
227
+ - Dropped all database views (`v_tagged_constraints`, `v_recent_file_changes`, etc.)
228
+ - Views caused migration complexity across SQLite/MySQL/PostgreSQL due to database-specific syntax
229
+ - Migration: `20251128000000_drop_all_views.ts`
230
+
231
+ ### Changed
232
+
233
+ **JOIN-Based Queries**
234
+
235
+ - `src/tools/constraints/actions/get.ts` - Replaced `v_tagged_constraints` view with JOIN query
236
+ - `src/tools/files/actions/get.ts` - Replaced `v_recent_file_changes` view with JOIN query
237
+ - Uses `UniversalKnex` wrapper for cross-database compatibility (date functions, boolean values, string aggregation)
238
+
239
+ **VCS Test Cleanup**
240
+
241
+ - `src/tests/feature/vcs/git-aware-completion.test.ts` - Added automatic git reset after tests
242
+ - Test commits are now automatically dropped when tests complete
243
+ - Prevents test artifacts from polluting git history
244
+
245
+ ### Added
246
+
247
+ **No-Views Guardrail Skill**
248
+
249
+ - `.claude/skills/no-views/SKILL.md` - Documentation for view prohibition policy
250
+ - `.claude/skills/skill-rules.json` - Added `no-views` rule (enforcement: block)
251
+ - Blocks creation of database views, requires JOINs instead
252
+
253
+ **Documentation Updates**
254
+
255
+ - `CLAUDE.md` - Updated to reflect no-views policy
256
+ - Removed Views section from database schema documentation
257
+ - Added `no-views` to Guardrail Skills table
258
+
259
+ ---
260
+
261
+ ## [4.0.0] - 2025-11-27
262
+
263
+ ### Changed
264
+
265
+ **Concept & Positioning**
266
+
267
+ - Reframed sqlew as a **shared SQL-backed context repository** and a **Decision & Constraint repository layer** for AI tools
268
+ - Clarified that Decisions capture *why* changes were made and Constraints capture *how* code should be written
269
+ - Updated README introduction to focus on "Never Start From Zero Context Again" and the repository-based metaphor instead of generic "memory"
270
+
271
+ **Documentation & Cleanup**
272
+
273
+ - Updated `README.md` to describe sqlew as a context repository rather than an abstract memory layer
274
+ - Aligned terminology across docs around Decisions, Constraints, tasks, and the repository layer
275
+ - Confirmed that previously removed/legacy features remain out of scope, keeping focus on decision history and constraint rules
276
+
277
+ > Note: v4.0.0 is primarily a **concept and documentation alignment release**. Core Decision/Constraint features and the v3.9.x database schema remain compatible; no breaking API changes were introduced for existing integrations.
278
+
279
+ ---
280
+
281
+ ## [3.9.0] - 2025-01-15
282
+
283
+ ### Added
284
+
285
+ **🎯 Decision Intelligence System with Three-Tier Similarity Detection**
286
+
287
+ **New `suggest` Tool:**
288
+ - **by_key** - Pattern-based decision search (e.g., "api/*/latency" finds all API latency decisions)
289
+ - **by_tags** - Tag similarity scoring for related decisions (Jaccard similarity)
290
+ - **by_context** - Combined key + tags + layer search for best matches
291
+ - **check_duplicate** - Duplicate decision detection with similarity scoring (0-100 points)
292
+
293
+ **Three-Tier Duplicate Detection (Auto-Triggered):**
294
+ - **Tier 1 (35-44 points):** Gentle nudge - Non-blocking warning with suggestions
295
+ - **Tier 2 (45-59 points):** Hard block - Prevents creation, requires explicit override or update
296
+ - **Tier 3 (60+ points):** Auto-update - Transparently updates existing decision, preserves new value
297
+
298
+ **Similarity Scoring Algorithm:**
299
+ - Tag overlap: 0-40 points (10 per matching tag, max 4)
300
+ - Layer match: 0-25 points (same layer bonus)
301
+ - Key similarity: 0-20 points (pattern + Levenshtein distance)
302
+ - Recency: 0-10 points (recent updates prioritized)
303
+ - Priority: 0-5 points (critical decisions weighted)
304
+
305
+ **Policy-Based Auto-Triggering:**
306
+ - Suggestions automatically triggered when policies have `suggest_similar=1`
307
+ - Integrated with `decision.set` - returns suggestions in response
308
+ - Configurable relevance threshold via `min_score` parameter (default: 30)
309
+ - Policy validation rules support for targeted auto-triggering
310
+
311
+ **Enhanced Decision Metadata:**
312
+ - `duplicate_reason` - Similarity explanation with matched tags and layer info
313
+ - `update_command` - Ready-to-use command for updating existing decisions
314
+ - `version_info` - Existing decision version tracking
315
+ - `auto_updated` flag - Indicates Tier 3 transparent updates
316
+
317
+ **Supporting Features:**
318
+ - Tag parser utility (`src/utils/tag-parser.ts`) for flexible tag handling
319
+ - Policy validation integration (`src/utils/policy-validator.ts`)
320
+ - Suggestion scorer (`src/utils/suggestion-scorer.ts`) with breakdown
321
+ - Self-exclusion logic (prevents matching against own key during updates)
322
+
323
+ ### Fixed
324
+
325
+ **PostgreSQL Cross-Database Compatibility**
326
+ - Fixed CAST type mismatch in `v_tagged_decisions` view export
327
+ - PostgreSQL now correctly handles `COALESCE(TEXT, NUMERIC)` with `CAST(value AS TEXT)`
328
+ - MySQL/MariaDB use `CAST(value AS CHAR)` for compatibility
329
+ - Migration: `20251114000000_fix_v_tagged_decisions_numeric_support.ts`
330
+ - SQL dump export: Enhanced view conversion in `src/utils/sql-dump/schema/views.ts`
331
+ - Result: All 20 cross-database tests passing (MySQL, MariaDB, PostgreSQL)
332
+
333
+ **Test Suite Improvements**
334
+ - Fixed FK constraint cleanup order in `decision-intelligence-e2e.test.ts`
335
+ - Child records now deleted before parent records (tags → scopes → context → decisions)
336
+ - Result: 3/3 e2e workflow tests passing, no cleanup errors
337
+
338
+ **Schema Fixes**
339
+ - Migration `20251112000001_fix_task_file_links_schema_v3_9_0.ts` - Fixed UNIQUE constraint
340
+ - Migration `20251112000002_fix_task_pruned_files_schema_v3_9_0.ts` - Enhanced task file tracking
341
+ - All migrations idempotent with existence checks
342
+
343
+ ### Changed
344
+
345
+ **Test Organization (Docker Dependency Separation)**
346
+ - Moved 7 Docker-dependent tests to `src/tests/docker/` directory
347
+ - `npm test` now runs 481 unit tests without Docker (0 failures)
348
+ - `npm run test:docker` runs cross-database tests (requires Docker containers)
349
+ - Removed `test:all` script (caused database conflicts)
350
+ - Updated `.husky/pre-commit` to reflect test separation
351
+ - Decision documented in SQLew: `test-organization-docker-separation`
352
+
353
+ **Git Hook Enhancement**
354
+ - Pre-commit hook now checks for **PUSHED** migration files instead of just committed
355
+ - Auto-detects remote branch (origin/main, origin/master, origin/dev)
356
+ - Allows editing locally committed migrations (not yet pushed)
357
+ - Prevents editing migrations that exist in remote
358
+ - Graceful fallback for local-only repositories
359
+
360
+ **Debug Output Cleanup**
361
+ - Commented out scope validation warnings in test output
362
+ - Removed DEBUG/DIAGNOSTIC console.log statements
363
+ - Cleaner test output focusing on actual results
364
+ - 75% reduction in test output verbosity
365
+
366
+ ### Removed
367
+
368
+ **Code Cleanup**
369
+ - Deleted monolithic `src/utils/sql-dump.ts` (-1,799 lines)
370
+ - Functionality now in modular structure:
371
+ - `src/utils/sql-dump/schema/tables.ts`
372
+ - `src/utils/sql-dump/schema/views.ts`
373
+ - `src/utils/sql-dump/schema/primary-keys.ts`
374
+ - `src/utils/sql-dump/schema/indexes.ts`
375
+ - Deleted test tracking files (`test-tracking/file1.ts`, etc.)
376
+
377
+ ### Documentation
378
+
379
+ - Updated `CLAUDE.md` - Changed policy from "NEVER EDIT COMMITTED" to "NEVER EDIT PUSHED"
380
+ - Created `STAGED_CHANGES_SUMMARY.md` - Comprehensive v3.9.0 change summary
381
+ - Created `NEW_TOOL_DESCRIPTION.md` - Suggest tool reference
382
+
383
+ ### Performance
384
+
385
+ - Enhanced file pruning logic (`src/utils/file-pruning.ts`)
386
+ - Improved VCS adapter file status tracking (`src/utils/vcs-adapter.ts`)
387
+ - Better task stale detection (`src/utils/task-stale-detection.ts`)
388
+ - Activity logging enhancements for suggestion tracking
389
+
390
+ ### Testing
391
+
392
+ **Test Results:**
393
+ - **495/495 tests passing (100%)** - Production-ready
394
+ - Tier 1 (Gentle Nudge): 5/5 tests passing
395
+ - Tier 2 (Hard Block): 2/2 tests passing
396
+ - ✅ Tier 3 (Auto-Update): 3/3 tests passing
397
+ - ✅ Auto-trigger suggestions: 4/4 tests passing
398
+ - Edge cases and error handling: All passing
399
+ - 20/20 cross-database tests passing (MySQL, MariaDB, PostgreSQL)
400
+ - ✅ 7 Docker test suites in separate directory
401
+
402
+ **Test Suite Enhancements:**
403
+ - AI-optimized quiet mode (80-90% token reduction, shows only failures + summary)
404
+ - Verbose mode available with `:verbose` suffix (e.g., `npm run test:verbose`)
405
+ - Cross-platform filter script (`scripts/filter-test-output.js`)
406
+ - Comprehensive three-tier similarity detection test coverage
407
+
408
+ **Coverage:**
409
+ - Overall: 64.85% line coverage
410
+ - All critical paths tested
411
+ - Zero flaky tests
412
+
413
+ ### Migration Notes
414
+
415
+ **Backward Compatibility:**
416
+ - v3.9.0 is fully backward compatible with v3.8.x
417
+ - No breaking changes
418
+ - Automatic migration on server startup
419
+
420
+ **Database Changes:**
421
+ - 3 new enhancement migrations (all idempotent)
422
+ - Schema changes apply automatically
423
+ - Safe to rollback by restoring backup
424
+
425
+ **Files Changed:**
426
+ - 50 files modified
427
+ - 1,857 insertions, 2,096 deletions
428
+ - Net: -239 lines (code reduction through refactoring)
429
+
430
+ ---
431
+
432
+ ## [3.8.1] - 2025-11-11
433
+
434
+ ### Fixed
435
+
436
+ **Critical Installation Bug**
437
+
438
+ - Fixed `npm error Invalid Version:` error when installing sqlew@3.8.0
439
+ - Changed `@modelcontextprotocol/sdk` dependency from `"latest"` to `"^1.21.1"` in package.json
440
+ - The `"latest"` tag is not a valid semver version for published packages and caused npm dependency resolution to fail
441
+ - This is a **hotfix release** that resolves installation issues preventing users from using v3.8.0
442
+
443
+ **Impact:**
444
+ - All users experiencing `Invalid Version:` errors when running `npx sqlew` can now install successfully
445
+ - No functional changes from v3.8.0 - only dependency version fix
446
+
447
+ ---
448
+
449
+ ## [3.8.0] - 2025-11-09
450
+
451
+ ### BREAKING CHANGES
452
+
453
+ **Batch Action Naming Standardization**
454
+
455
+ `task.batch_create` has been renamed to `task.create_batch` to follow the `<verb>_batch` naming pattern used by other batch actions (`set_batch`, `record_batch`).
456
+
457
+ **Migration Required:**
458
+ ```typescript
459
+ // Old (v3.7.x and earlier)
460
+ task({ action: "batch_create", tasks: [...] })
461
+
462
+ // ✅ New (v3.8.0+)
463
+ task({ action: "create_batch", tasks: [...] })
464
+ ```
465
+
466
+ **Rationale:**
467
+ - Achieves 100% consistency across all batch actions
468
+ - Improves alphabetical sorting in IDE auto-completion (create → create_batch)
469
+ - Aligns with industry standard (REST APIs, GraphQL, ORMs use suffix pattern)
470
+ - See docs/ADR-batch-naming-standard.md for full justification
471
+
472
+ **Impact:**
473
+ - All code using `task.batch_create` must update to `task.create_batch`
474
+ - Simple find-replace migration (estimated 2-5 minutes per integration)
475
+ - No database schema changes required
476
+
477
+ ### Removed
478
+
479
+ **Config Tool Removed (Phase 6)**
480
+
481
+ The orphaned config tool has been removed in favor of CLI-only configuration:
482
+
483
+ - **Deleted**: `src/tools/config.ts` (307 lines)
484
+ - **Removed**: `ConfigAction` type from `src/types.ts` and `src/types/actions.ts`
485
+ - **Removed**: ConfigAction import from `src/utils/parameter-validator.ts`
486
+ - **Updated**: README.md with CLI-only config approach documentation
487
+ - **Updated**: docs/CONFIGURATION.md already documented config tool removal
488
+
489
+ **Why removed:**
490
+ - Config tool was never registered in `tool-registry.ts` (orphaned code)
491
+ - Messaging system deprecated (primary use case eliminated)
492
+ - File-based configuration (`.sqlew/config.toml`) is clearer and more maintainable
493
+ - Runtime updates were confusing (changes lost on restart unless manually synced to file)
494
+ - Configuration drift between `m_config` table and config file
495
+
496
+ **Migration Path:**
497
+ - **Use `.sqlew/config.toml`** for all configuration (persistent, version-controlled)
498
+ - ✅ **Use CLI arguments** for one-time overrides (`--autodelete-message-hours=48`)
499
+ - ✅ **Internal config operations** preserved (`src/database/config/config-ops.ts`)
500
+ - **m_config table** preserved (used internally by retention logic)
501
+
502
+ **Impact:**
503
+ - Cleaner codebase with ~300 lines removed
504
+ - No functional impact - tool was never registered
505
+ - Configuration via file and CLI arguments only
506
+
507
+ **Message Tool Completely Removed**
508
+
509
+ The deprecated message tool has been completely removed from the codebase:
510
+
511
+ - **Deleted**: `src/tools/messaging.ts` (599 lines)
512
+ - **Removed**: Message tool entry from `tool-registry.ts`
513
+ - **Removed**: Message tool handler from `tool-handlers.ts`
514
+ - **Removed**: Message imports from `cli.ts`
515
+ - **Updated**: `MessageAction` type changed to `never` (backward compatibility stub)
516
+ - **CLI**: `sqlew query messages` now returns error message
517
+
518
+ **Migration Path**:
519
+ - No action required - messaging system was already marked deprecated in v3.6.6
520
+ - The `t_agent_messages` table was dropped in v3.6.6
521
+ - All message tool actions returned deprecation warnings since v3.6.6
522
+
523
+ **Impact**:
524
+ - Cleaner codebase with ~700 lines removed
525
+ - No functional impact - messaging system was unused
526
+ - MessageAction type remains as deprecated stub for backward compatibility
527
+
528
+ ### Added
529
+
530
+ **Layer Expansion (59 layers)**
531
+
532
+ Added 4 new layers to enable better task classification and semantic validation:
533
+
534
+ **New FILE_REQUIRED layers:**
535
+ - `documentation` - README, CHANGELOG, API docs, architecture docs (file_actions required)
536
+
537
+ **New FILE_OPTIONAL layers:**
538
+ - `planning` - Research, spike tasks, investigation (file_actions optional)
539
+ - `coordination` - Multi-agent orchestration, task delegation (file_actions optional)
540
+ - `review` - Code review, design review, verification (file_actions optional)
541
+
542
+ **Existing layers** (5→6 FILE_REQUIRED):
543
+ - presentation, business, data, infrastructure, cross-cutting (file_actions required or empty array)
544
+
545
+ **Benefits:**
546
+ - Documentation layer enforces file operations for docs work
547
+ - Planning layers allow pure research tasks without file boilerplate
548
+ - Better semantic task classification across the development lifecycle
549
+
550
+ **file_actions Parameter for Tasks**
551
+
552
+ Introduced semantic `file_actions` parameter to replace generic `watch_files`:
553
+
554
+ ```typescript
555
+ // New file_actions parameter
556
+ task.create({
557
+ title: "Implement OAuth",
558
+ layer: "business",
559
+ file_actions: [
560
+ { action: "create", path: "src/auth/oauth.ts" },
561
+ { action: "edit", path: "src/api/router.ts" },
562
+ { action: "delete", path: "src/auth/legacy.ts" }
563
+ ]
564
+ });
565
+
566
+ // Backward compatible - watch_files still works
567
+ task.create({
568
+ title: "Update config",
569
+ layer: "infrastructure",
570
+ watch_files: ["config.toml"] // Auto-converts to file_actions
571
+ });
572
+ ```
573
+
574
+ **Layer-Based Validation:**
575
+ - FILE_REQUIRED layers (6) → Must provide `file_actions` or `[]`
576
+ - FILE_OPTIONAL layers (3) → Can omit `file_actions` entirely
577
+ - Clear error messages with layer-specific guidance
578
+
579
+ **Benefits:**
580
+ - Self-documenting: `action: 'create'` vs `action: 'edit'` shows intent
581
+ - Prevents forgotten file watchers (validation enforced)
582
+ - No boilerplate for planning tasks (can omit parameter)
583
+ - Better token efficiency with automatic file watching
584
+
585
+ **PostgreSQL Adapter Implementation**
586
+
587
+ Full PostgreSQL 12+ support with complete adapter implementation:
588
+
589
+ **Adapter Features:**
590
+ - All 15 abstract methods implemented (`insertReturning`, `upsert`, `jsonExtract`, etc.)
591
+ - PostgreSQL-specific SQL syntax (RETURNING, ON CONFLICT, string_agg)
592
+ - Strict type handling (TRUE/FALSE for booleans, not 1/0)
593
+ - Timezone-aware timestamp functions
594
+ - Transaction support with savepoints
595
+
596
+ **Migration Compatibility:**
597
+ - All 22 migrations tested and verified on PostgreSQL 16.10
598
+ - Cross-database helper functions for view creation
599
+ - Proper CASCADE handling for foreign key dependencies
600
+ - Sequence management after explicit ID inserts
601
+ - GROUP BY strictness compliance
602
+
603
+ **Supported Databases:**
604
+ - SQLite 3.x (default, development)
605
+ - MySQL 8.0 / MariaDB 10+ (production)
606
+ - PostgreSQL 12+ (production) ✨ NEW
607
+
608
+ **Configuration:**
609
+ ```toml
610
+ [database]
611
+ type = "postgres"
612
+
613
+ [database.connection]
614
+ host = "localhost"
615
+ port = 5432
616
+ database = "sqlew_db"
617
+
618
+ [database.auth]
619
+ type = "direct"
620
+ user = "sqlew_user"
621
+ password = "secret"
622
+ ```
623
+
624
+ ### Fixed
625
+
626
+ **Batch Action Parameter Parsing**
627
+
628
+ Fixed MCP client array serialization issue affecting all batch actions:
629
+
630
+ **Problem:** MCP client serializes array parameters as JSON strings:
631
+ ```typescript
632
+ // MCP sends:
633
+ decisions: "[{\"key\": \"test\", \"value\": \"val\"}]" // String!
634
+
635
+ // Expected:
636
+ decisions: [{key: "test", value: "val"}] // Array
637
+ ```
638
+
639
+ **Solution:** Added JSON parsing in `tool-handlers.ts` for all batch actions:
640
+ - `decision.set_batch` - parse `decisions` parameter
641
+ - `file.record_batch` - parse `file_changes` parameter
642
+ - `task.create_batch` - parse `tasks` parameter
643
+
644
+ **Impact:** All batch actions now work correctly with array parameters from MCP client.
645
+
646
+ **Help System Synchronization**
647
+
648
+ Fixed critical bug where help database was severely out of sync with code:
649
+
650
+ **Problem:** 25 actions missing from `m_help_actions` table, causing help system to lie about available actions.
651
+
652
+ **Missing Actions:**
653
+ - decision: 9 actions (quick_set, search_advanced, set_batch, has_updates, etc.)
654
+ - task: 14 actions (update, get, list, move, link, archive, create_batch, etc.)
655
+ - constraint: 1 action (use_case)
656
+
657
+ **Solution:** Created migration `20251109020000_fix_missing_help_actions_v3_8_0.ts` to:
658
+ - Add all 25 missing actions with correct descriptions
659
+ - Idempotent checks to prevent duplicates
660
+ - Full synchronization between code and database
661
+
662
+ **Impact:** Help system now accurately reports all available actions.
663
+
664
+ ### Changed
665
+
666
+ **Tool Registry Schema Fix**
667
+
668
+ Added `additionalProperties: true` to all tool schemas in `tool-registry.ts`:
669
+
670
+ **Problem:** MCP couldn't pass action-specific parameters (key, value, tags, etc.) because schemas only defined `action` property.
671
+
672
+ **Solution:**
673
+ ```typescript
674
+ {
675
+ name: 'decision',
676
+ inputSchema: {
677
+ type: 'object',
678
+ properties: {
679
+ action: { ... }
680
+ },
681
+ required: ['action'],
682
+ additionalProperties: true, // ← CRITICAL FIX
683
+ },
684
+ }
685
+ ```
686
+
687
+ **Impact:** All MCP tools now accept action-specific parameters correctly.
688
+
689
+ ---
690
+
691
+ ## [3.7.4] - 2025-11-08
692
+
693
+ ### Added - Complete JSON Import/Export System
694
+
695
+ **Full-featured data migration system with smart ID remapping and dependency resolution**
696
+
697
+ #### New Features
698
+
699
+ - **db:import CLI Command** - Import project data from JSON exports with automatic ID remapping
700
+ - Smart conflict detection (skip-if-exists, project-name override)
701
+ - Dry-run mode for validation before import
702
+ - Comprehensive error messages with validation details
703
+ - **Topological Sort Algorithm** - Resolves task dependencies during import
704
+ - Circular dependency detection prevents import of invalid dependency graphs
705
+ - BFS-based topological sorting ensures dependencies imported before dependents
706
+ - Preserves all task relationships and blocking constraints
707
+ - **Smart ID Remapping** - Handles complex foreign key relationships
708
+ - Master table merge logic (reuse existing entries by name/path)
709
+ - Transaction table ID translation with bidirectional mapping
710
+ - Junction table relationship preservation
711
+ - Automatic orphan cleanup for invalid references
712
+
713
+ #### Import System Architecture
714
+
715
+ - **4 Core Modules**:
716
+ 1. `import.ts` - Main orchestrator with transaction management
717
+ 2. `master-tables.ts` - Master table merge logic (m_files, m_tags, m_scopes, etc.)
718
+ 3. `topological-sort.ts` - Dependency graph analysis and sorting
719
+ 4. `db-import.ts` - CLI command with argument parsing and validation
720
+
721
+ #### Data Migration Strategy
722
+
723
+ - **ID Remapping**: All imported data gets fresh auto-incremented IDs (no ID preservation)
724
+ - **Master Table Deduplication**: Reuse existing entries for agents, tags, scopes, files by name/path
725
+ - **Transaction Atomicity**: All-or-nothing semantics (full rollback on any error)
726
+ - **Project Isolation**: Each import creates independent project with no cross-contamination
727
+
728
+ #### CLI Examples
729
+
730
+ ```bash
731
+ # Import project from JSON export
732
+ npx sqlew db:import --source=project-backup.json
733
+
734
+ # Import with custom project name
735
+ npx sqlew db:import --source=data.json --project-name=my-project
736
+
737
+ # Dry-run validation (no actual import)
738
+ npx sqlew db:import --source=data.json --dry-run
739
+
740
+ # Export project for migration
741
+ npx sqlew db:export --project=visualizer --output=visualizer-data.json
742
+ ```
743
+
744
+ #### Technical Details
745
+
746
+ - **Batch Inserts** - 10-row batches to avoid SQLite UNION ALL limits
747
+ - **Foreign Key Validation** - Validates all foreign key references before insertion
748
+ - **View Handling** - Temporarily drops/restores views during schema changes
749
+ - **Idempotent Operations** - Safe to retry on failure
750
+ - **Error Recovery** - Detailed error messages with validation guidance
751
+
752
+ #### Use Cases
753
+
754
+ - **Multi-Project Single Database** - Consolidate multiple projects when database creation permissions are limited
755
+ - **Project Sharing** - Share context with team members or between machines
756
+ - **Cross-Database Migration** - Move projects between different databases (different machine, SQLite → MySQL, etc.)
757
+
758
+ **Note**: Import uses `--skip-if-exists=true` by default. This is NOT a backup/restore solution for the same database.
759
+ Use database-level backups (SQLite file copy, MySQL dump) for backup/restore scenarios.
760
+
761
+ #### Impact
762
+
763
+ - **Complete migration solution** - Export from one database, import to another
764
+ - **Multi-project support** - Merge multiple project exports into single database
765
+ - **Permission-friendly** - Works for users who can't create multiple databases
766
+ - **Data integrity** - Zero data loss, all relationships preserved
767
+ - **Production ready** - Comprehensive error handling and validation
768
+ - **Cross-database compatible** - JSON format works across SQLite, MySQL, PostgreSQL
769
+
770
+ ---
771
+
772
+ ### Fixed - Multi-Project Migration (HOTFIX)
773
+
774
+ **Critical fix for v3.7.0-v3.7.2 migration in multi-project scenarios**
775
+
776
+ #### Problem
777
+
778
+ - Users upgrading from v3.6.10 to v3.7.0+ could end up with duplicate projects
779
+ - Migration 20251104000000 created project #1 with fake name "default-project"
780
+ - Users creating second project manually resulted in namespace conflicts
781
+
782
+ #### Solution
783
+
784
+ - Enhanced migration idempotency checks
785
+ - Improved project consolidation logic
786
+ - Better handling of existing project scenarios
787
+
788
+ #### Impact
789
+
790
+ - ✅ **Safe multi-project migration** - No duplicate projects created
791
+ - ✅ **Backward compatible** - Works for both fresh installs and upgrades
792
+ - ✅ **Data preservation** - All existing data maintained correctly
793
+
794
+ ---
795
+
796
+ ## [3.7.3] - 2025-11-06
797
+
798
+ ### Fixed - Master Tables Namespace Collision Bug
799
+
800
+ **Critical bug fix for incomplete multi-project support in v3.7.0-v3.7.2**
801
+
802
+ #### Problem
803
+ - Master tables (m_files, m_tags, m_scopes) lacked `project_id` columns in v3.7.0-v3.7.2
804
+ - This caused **namespace collisions** where identical file paths/tag names/scope names from different projects would conflict
805
+ - Example: "src/index.ts" from ProjectA would collide with ProjectB's "src/index.ts"
806
+ - Users upgrading from v3.6.x would have fake project name "default-project" instead of detected real name
807
+
808
+ #### Solution
809
+ - **20251106000000_fix_master_tables_project_id_v3_7_3.ts** - Comprehensive migration that:
810
+ 1. **Data Consolidation** - Detects v3.7.0-v3.7.2 upgrade scenario and consolidates project #2 data into project #1
811
+ 2. **Project Rename** - Renames fake "default-project" to real detected name (from config.toml/git remote/directory)
812
+ 3. **Schema Fix** - Adds `project_id` column to m_files, m_tags, m_scopes with composite UNIQUE constraints
813
+ 4. **Data Migration** - Maps all existing master table data to default project (ID 1)
814
+ 5. **Orphan Cleanup** - Filters out 95 orphaned foreign key references (deleted tasks/tags)
815
+ 6. **View Restoration** - Temporarily drops and restores 4 views during migration
816
+ 7. **Table Restoration** - Backs up and restores 6 referencing tables with updated foreign keys
817
+
818
+ #### Migration Details
819
+ - **Idempotent** - Can run multiple times safely (checks for existing columns)
820
+ - **Version-Aware** - Only consolidates data for v3.7.0-v3.7.2 databases (detects fake project names)
821
+ - **Batch Inserts** - Uses 10-row batches to avoid SQLite UNION ALL limits
822
+ - **FK Filtering** - Validates foreign key references before restoration to prevent constraint errors
823
+ - **SQLite-Optimized** - Handles better-sqlite3 FK constraint behavior during table drops
824
+
825
+ #### Technical Changes
826
+ - **m_files**: Added `project_id` column, changed UNIQUE constraint from `(path)` to `(project_id, path)`
827
+ - **m_tags**: Added `project_id` column, changed UNIQUE constraint from `(name)` to `(project_id, name)`
828
+ - **m_scopes**: Added `project_id` column, changed UNIQUE constraint from `(name)` to `(project_id, name)`
829
+ - **Referencing Tables**: Updated t_file_changes, t_task_file_links, t_decision_tags, t_task_tags, t_constraint_tags, t_decision_scopes
830
+ - **Views**: Restored v_layer_summary, v_task_board, v_tagged_decisions, v_tagged_constraints
831
+
832
+ #### Impact
833
+ - **Fixed namespace collisions** - Files/tags/scopes from different projects can now have identical names
834
+ - **Data integrity** - All existing data preserved and mapped correctly
835
+ - **Project consolidation** - v3.7.0-v3.7.2 users get clean migration path
836
+ - ✅ **Real project names** - No more fake "default-project" names
837
+ - ✅ **Orphan cleanup** - Removed invalid foreign key references automatically
838
+ - **Full idempotency** - Migration can be safely re-run if interrupted
839
+
840
+ #### Testing
841
+ - ✅ Tested on actual v3.7.2 production database (mcp-sqlew project)
842
+ - ✅ Successfully consolidated 77 decisions, 191 tasks, 61 file changes
843
+ - ✅ Filtered 95 orphaned task-tag references
844
+ - ✅ All views and referencing tables restored correctly
845
+ - ✅ Final database state validated with composite UNIQUE constraints working
846
+
847
+ ---
848
+
849
+ ## [3.7.2] - 2025-11-05
850
+
851
+ ### Changed - Enhanced Sub-Agent Templates
852
+
853
+ **Improved specialized agent templates for more efficient sqlew usage**
854
+
855
+ #### Sub-Agent Template Updates
856
+ - **sqlew-scrum-master.md** - Enhanced multi-agent coordination and task management workflows
857
+ - **sqlew-researcher.md** - Improved decision querying and context analysis patterns
858
+ - **sqlew-architect.md** - Enhanced decision documentation and constraint enforcement workflows
859
+
860
+ #### New Documentation
861
+ - Installation and configuration instructions
862
+ - Usage examples for each agent
863
+ - Token optimization guidelines
864
+ - Agent comparison and capability matrix
865
+ - Integration patterns
866
+ - Troubleshooting guide
867
+
868
+ #### SQL Dump Enhancements
869
+ - Added type conversion testing (`src/tests/type-conversion.test.ts`)
870
+ - Enhanced SQL dump converters for better type handling
871
+ - Improved SQL dump utilities with expanded functionality
872
+
873
+ ### Fixed - Git LFS PNG Display Issue
874
+
875
+ **Removed Git LFS tracking for PNG files to fix GitHub display**
876
+
877
+ #### Problem
878
+ - PNG files were tracked with Git LFS, causing display issues on GitHub
879
+ - Users without Git LFS saw ASCII pointers instead of images
880
+ - README images were not rendering properly
881
+
882
+ #### Solution
883
+ - Removed `*.png filter=lfs diff=lfs merge=lfs -text` from .gitattributes
884
+ - Restored actual PNG binary files from pre-LFS commits
885
+ - All PNG images now display correctly on GitHub without requiring Git LFS
886
+
887
+ #### Impact
888
+ - **Better agent templates** - More efficient sqlew usage patterns
889
+ - **Comprehensive documentation** - Clear installation and usage guides
890
+ - **Improved type handling** - Better SQL dump type conversion
891
+ - **Fixed GitHub display** - PNG images now render properly without Git LFS
892
+ - **Token efficient** - Optimized agent workflows reduce unnecessary tool calls
893
+
894
+ ---
895
+
896
+ ## [3.7.1] - 2025-11-05
897
+
898
+ ### Fixed - Error Message Visibility
899
+
900
+ **Fixed validation error messages being hidden by error wrapper**
901
+
902
+ #### Problem
903
+ - Validation errors (JSON-structured responses) were being wrapped with stack traces
904
+ - Wrong-usage messages were hidden from MCP clients
905
+ - Users received generic error messages instead of helpful validation details
906
+
907
+ #### Solution
908
+ - **Error Handler Enhancement** - Detect and unwrap JSON validation errors
909
+ - Validation errors now returned directly to MCP client without wrapping
910
+ - Stack traces written to logs only (not returned to client)
911
+ - Token-efficient responses without exposing internal stack details
912
+ - **Parameter Validator Enhancement** - Detect unexpected/invalid parameters
913
+ - Added validation for parameters that don't match valid list and have no typo suggestion
914
+ - Improved error messages: "Unexpected params: X. Valid params: Y, Z"
915
+
916
+ #### Impact
917
+ - ✅ **Better UX** - Validation errors are now visible and actionable
918
+ - ✅ **Token efficiency** - No stack traces in MCP responses
919
+ - **Clearer feedback** - Users see helpful error messages immediately
920
+ - ✅ **Security** - Internal stack details not exposed to clients
921
+
922
+ ---
923
+
924
+ ## [3.7.0] - 2025-11-05
925
+
926
+ ### Added - Runtime Database Reconnection
927
+
928
+ **Automatic connection recovery with exponential backoff retry logic**
929
+
930
+ #### Features
931
+ - **ConnectionManager** - Singleton wrapper for all database operations
932
+ - **Exponential Backoff** - Retry delays: 1s → 2s → 4s → 8s → 16s (31 seconds total)
933
+ - **Smart Error Detection** - Recognizes connection errors across SQLite, MySQL, PostgreSQL
934
+ - **Process.exit on Exhaustion** - Exits cleanly after 5 failed retries
935
+ - **27 Operations Wrapped** - All transactional operations protected:
936
+ - context.ts: 5 operations
937
+ - tasks.ts: 9 operations
938
+ - files.ts: 3 operations
939
+ - constraints.ts: 3 operations
940
+ - config.ts: 2 operations
941
+ - utils.ts: 5 operations
942
+
943
+ #### Connection Error Patterns Detected
944
+ - **Network Errors**: ECONNREFUSED, ENOTFOUND, ETIMEDOUT, ECONNRESET, EPIPE
945
+ - **SQLite**: "database is locked", "unable to open database"
946
+ - **MySQL/MariaDB**: "server has gone away", "lost connection to mysql server"
947
+ - **PostgreSQL**: "connection to server was lost", "could not connect to server"
948
+ - **Knex-specific**: "timeout acquiring a connection", "pool is destroyed"
949
+
950
+ #### Test Coverage
951
+ - **41 tests passing** (22 unit + 19 integration)
952
+ - Retry behavior verification
953
+ - Production scenario simulation (server restart, network failures)
954
+ - Tool integration testing
955
+
956
+ #### Impact
957
+ - ✅ **Resilient operations** - Automatic recovery from transient connection failures
958
+ - **Production ready** - Handles server restarts, network issues
959
+ - ✅ **Zero regressions** - All existing tests pass
960
+ - ✅ **Token efficient** - No manual retry logic needed in agent code
961
+
962
+ ---
963
+
964
+ ### Changed - Validation Error Messages
965
+
966
+ **70-85% token reduction in error message size**
967
+
968
+ #### Token Efficiency
969
+ - **Before**: ~1000+ characters (~300+ tokens) with full examples embedded
970
+ - **After**: ~200 characters (~50 tokens) with reference IDs
971
+ - **Reduction**: 70-85% token savings
972
+
973
+ #### New Error Format
974
+ ```json
975
+ {
976
+ "error": "Missing: key, value",
977
+ "action": "set",
978
+ "reference": "decision.set",
979
+ "missing": ["key", "value"],
980
+ "hint": "Use 'quick_set' for simpler usage..."
981
+ }
982
+ ```
983
+
984
+ #### Features
985
+ - **Reference IDs** - Compact `{tool}.{action}` format (e.g., "decision.set")
986
+ - **Concise Messages** - Essential information only
987
+ - **Conditional Fields** - Only include fields when present
988
+ - **Self-Documenting** - AI can query `action: "help"` for full docs if needed
989
+
990
+ #### Error Types
991
+ - Missing params: `"Missing: key, value"`
992
+ - Typos: `"Invalid params: val → value"`
993
+ - Unknown action: `"Unknown action 'sett'. Did you mean: set?"`
994
+
995
+ #### Impact
996
+ - **Token efficiency** - 70-85% reduction in error size
997
+ - **Cost reduction** - Lower API costs for AI agents
998
+ - **Better UX** - Quick, scannable errors
999
+ - ✅ **Backward compatible** - Error structure unchanged
1000
+
1001
+ ---
1002
+
1003
+ ### Changed - Debug Log Format
1004
+
1005
+ **Single-line log entries for easier parsing**
1006
+
1007
+ #### Problem
1008
+ Multi-line log messages broke standard text processing tools (grep, awk, log rotation).
1009
+
1010
+ #### Solution
1011
+ - **Sanitization Function** - Replaces newlines with spaces, collapses whitespace
1012
+ - **Applied To**: All log messages, data values, JSON output
1013
+ - **Result**: Every log entry is exactly one line
1014
+
1015
+ #### Benefits
1016
+ - ✅ **Easier parsing** - Line-based tools work correctly
1017
+ - **Better grep** - Search across entire messages
1018
+ - **Simpler analysis** - Standard text processing
1019
+ - ✅ **Cleaner output** - No unexpected line breaks
1020
+
1021
+ #### Example
1022
+ **Before:**
1023
+ ```
1024
+ [2025-11-05T02:00:00.000Z] [ERROR] Error details:
1025
+ Stack trace line 1
1026
+ Stack trace line 2
1027
+ ```
1028
+
1029
+ **After:**
1030
+ ```
1031
+ [2025-11-05T02:00:00.000Z] [ERROR] Error details: Stack trace line 1 Stack trace line 2
1032
+ ```
1033
+
1034
+ ---
1035
+
1036
+ ### Changed - Specialized Agent Templates (Error Prevention)
1037
+
1038
+ **Restructured agent templates to reduce tool call errors from 60% to <10%**
1039
+
1040
+ #### Problem
1041
+ - 60% of agent errors: missing `action` parameter in tool calls
1042
+ - Templates embedded outdated action samples that became obsolete
1043
+ - Agents guessed syntax instead of using discovery workflow
1044
+
1045
+ #### Solution
1046
+ All three agent templates restructured with error-prevention focus:
1047
+ - **sqlew-architect.md** - Decision documentation specialist
1048
+ - **sqlew-researcher.md** - Context analysis specialist
1049
+ - **sqlew-scrum-master.md** - Sprint coordination specialist
1050
+
1051
+ #### Key Improvements
1052
+ - ⚠️ **Prominent Error-Prevention Section** - "CRITICAL: Error-Free sqlew Tool Usage" at top
1053
+ - 📚 **Discovery-First Workflow** - Guides agents: `action: "help"` `action: "example"` → copy/modify
1054
+ - ❌✅ **Zero-Error Pattern** - Clear WRONG/CORRECT examples for every common mistake:
1055
+ - Missing `action` parameter
1056
+ - Wrong data types (priority: string vs number)
1057
+ - Wrong parameter names (old v2.x API)
1058
+ - 🔍 **Pre-Execution Checklist** - Verify `action` parameter before every tool call
1059
+ - 🗑️ **No Embedded Samples** - Removed action lists to prevent outdated syntax
1060
+ - 🛠️ **Common Data Type Errors** - Shows tag arrays, boolean atomics, integer priorities
1061
+
1062
+ #### Upgrade Path
1063
+ **Note**: Existing `.claude/agents/` files NOT auto-upgraded (preserves customizations)
1064
+
1065
+ **Manual upgrade required**:
1066
+ ```bash
1067
+ # Remove old templates
1068
+ rm .claude/agents/sqlew-{architect,researcher,scrum-master}.md
1069
+
1070
+ # Restart MCP server (auto-copies new templates from assets/sample-agents/)
1071
+ ```
1072
+
1073
+
1074
+ #### Impact
1075
+ - ✅ **Target: 60% <10% error rate** for agent tool calls
1076
+ - ✅ **Better UX** - Clear guidance prevents common mistakes
1077
+ - ✅ **Self-Correcting** - Agents learn correct patterns from errors
1078
+ - ✅ **Future-Proof** - Discovery workflow adapts to API changes
1079
+
1080
+ ---
1081
+
1082
+ ### Fixed - Multi-Project Migration (Critical)
1083
+
1084
+ **Fixed migration for ALL users upgrading from v3.6.10 to v3.7.0**
1085
+
1086
+ #### Problem
1087
+ - SQLite's `ALTER TABLE` silently failed for 4 tables with complex foreign keys
1088
+ - Migration reported success but columns weren't added
1089
+ - Task creation would fail: `"table t_task_details has no column named project_id"`
1090
+
1091
+ #### Root Cause
1092
+ SQLite cannot modify tables with `ON DELETE CASCADE` constraints using ALTER TABLE.
1093
+
1094
+ #### Solution
1095
+ - **Table Recreation Strategy** - Backup Drop → Recreate → Restore
1096
+ - **4 Tables Fixed**:
1097
+ - `t_task_details` (STEP 4.7)
1098
+ - `t_task_file_links` (STEP 4.8)
1099
+ - `t_task_decision_links` (STEP 4.9)
1100
+ - `t_task_tags` (composite PRIMARY KEY)
1101
+
1102
+ #### Idempotency
1103
+ All recreation steps check if `project_id` exists before executing:
1104
+ ```typescript
1105
+ const hasProjectId = await knex.schema.hasColumn('table_name', 'project_id');
1106
+ if (!hasProjectId) {
1107
+ // Recreation logic
1108
+ }
1109
+ ```
1110
+
1111
+ #### Data Preservation Verified
1112
+ - ✅ 223 task detail rows preserved
1113
+ - ✅ 632 task tag rows preserved
1114
+ - ✅ All task links preserved
1115
+ - ✅ 100% data integrity maintained
1116
+
1117
+ #### Testing
1118
+ - ✅ Fresh installation works
1119
+ - ✅ v3.6.10 → v3.7.0 upgrade works
1120
+ - ✅ Migration can be re-run safely (idempotent)
1121
+ - ✅ TypeScript compiles without errors
1122
+
1123
+ #### Impact
1124
+ - **Production ready** - Safe for all v3.6.10 users to upgrade
1125
+ - ✅ **No data loss** - All existing data preserved
1126
+ - ✅ **Idempotent** - Can re-run without errors
1127
+
1128
+ ---
1129
+
1130
+ ## [3.6.10] - 2025-10-30
1131
+
1132
+ ### Added - Environment Variable Support for Project Root
1133
+
1134
+ **New `SQLEW_PROJECT_ROOT` environment variable for project-relative databases**
1135
+
1136
+ #### Problem
1137
+ - Junie AI and other MCP clients require absolute paths in configuration
1138
+ - Users had to hardcode project-specific paths in MCP server config
1139
+ - No easy way to use project-relative database paths
1140
+
1141
+ #### Solution
1142
+ - Added `SQLEW_PROJECT_ROOT` environment variable support (inspired by serena-mcp pattern)
1143
+ - MCP clients can now pass project directory via environment variable
1144
+ - Database automatically created at `$SQLEW_PROJECT_ROOT/.sqlew/sqlew.db`
1145
+
1146
+ #### Priority Order
1147
+ 1. `SQLEW_PROJECT_ROOT` environment variable (NEW - highest priority)
1148
+ 2. `--db-path` CLI argument (absolute path)
1149
+ 3. `--config-path` CLI argument (absolute path)
1150
+ 4. `database.path` in config file (absolute path)
1151
+ 5. `process.cwd()` fallback
1152
+
1153
+ #### Junie AI Configuration Example
1154
+ ```json
1155
+ {
1156
+ "mcpServers": {
1157
+ "sqlew": {
1158
+ "command": "npx",
1159
+ "args": ["sqlew"],
1160
+ "env": {
1161
+ "SQLEW_PROJECT_ROOT": "{projectDir}"
1162
+ }
1163
+ }
1164
+ }
1165
+ }
1166
+ ```
1167
+
1168
+ **Note:** Junie AI uses `{projectDir}` variable which expands to the current project's absolute path. This ensures each project gets its own isolated database without hardcoded paths. Other MCP clients may use different variable names like `${workspaceFolder}` (VS Code/Cline) - check your client's documentation.
1169
+
1170
+ #### Impact
1171
+ - ✅ **Project-relative databases** without hardcoded absolute paths
1172
+ - **Cleaner MCP configuration** (no per-project path updates needed)
1173
+ - **Compatible with Junie AI, Claude Desktop, and other MCP clients**
1174
+ - ✅ **No breaking changes** (environment variable is optional)
1175
+
1176
+ ---
1177
+
1178
+ ### Fixed - MCP Protocol Compliance (EPIPE Fix)
1179
+
1180
+ **Eliminated console output for strict JSON-RPC protocol compliance**
1181
+
1182
+ #### Problem
1183
+ - EPIPE (broken pipe) errors when running with Junie AI on Windows
1184
+ - Console output to stdout/stderr violated MCP JSON-RPC protocol requirements
1185
+ - Strict MCP clients (like Junie AI) expect pure JSON-RPC on stdio streams
1186
+
1187
+ #### Changes
1188
+ - **Redirected all diagnostic output to debug log file** - stdout/stderr reserved exclusively for JSON-RPC
1189
+ - Modified `safeConsoleError()` to write to debug log instead of stderr
1190
+ - Replaced 50+ console.log/console.error calls across codebase:
1191
+ - `src/database.ts` - Database initialization messages
1192
+ - `src/watcher/file-watcher.ts` - File watcher status and events
1193
+ - `src/watcher/gitignore-parser.ts` - .gitignore loading warnings
1194
+ - `src/tools/tasks.ts` - Task file registration warnings
1195
+ - `src/config/example-generator.ts` - First launch messages
1196
+
1197
+ #### Technical Details
1198
+ - **MCP Protocol Requirement**: stdin/stdout/stderr must carry only JSON-RPC messages
1199
+ - **Debug Logging**: All diagnostic messages now use `debugLog()` with appropriate levels (INFO, WARN, ERROR)
1200
+ - **Zero stdout pollution**: Server starts silently, waits for JSON-RPC requests
1201
+ - **Tested with Junie AI**: Confirmed no EPIPE errors on Windows
1202
+
1203
+ #### Impact
1204
+ - ✅ **Works with strict MCP clients** (Junie AI, etc.)
1205
+ - ✅ **Maintains full diagnostics** via debug log file
1206
+ - ✅ **Pure JSON-RPC protocol** compliance
1207
+ - ✅ **No breaking changes** to MCP tool functionality
1208
+
1209
+ ---
1210
+
1211
+ ### Added - Environment Variable Support for Project Root
1212
+
1213
+ **New `SQLEW_PROJECT_ROOT` environment variable for project-relative databases**
1214
+
1215
+ #### Problem
1216
+ - Junie AI and other MCP clients require absolute paths in configuration
1217
+ - Users had to hardcode project-specific paths in MCP server config
1218
+ - No easy way to use project-relative database paths
1219
+
1220
+ #### Solution
1221
+ - Added `SQLEW_PROJECT_ROOT` environment variable support (inspired by serena-mcp pattern)
1222
+ - MCP clients can now pass project directory via environment variable
1223
+ - Database automatically created at `$SQLEW_PROJECT_ROOT/.sqlew/sqlew.db`
1224
+
1225
+ #### Priority Order
1226
+ 1. `SQLEW_PROJECT_ROOT` environment variable (NEW - highest priority)
1227
+ 2. `--db-path` CLI argument (absolute path)
1228
+ 3. `--config-path` CLI argument (absolute path)
1229
+ 4. `database.path` in config file (absolute path)
1230
+ 5. `process.cwd()` fallback
1231
+
1232
+ #### Junie AI Configuration Example
1233
+ ```json
1234
+ {
1235
+ "mcpServers": {
1236
+ "sqlew": {
1237
+ "command": "npx",
1238
+ "args": ["sqlew"],
1239
+ "env": {
1240
+ "SQLEW_PROJECT_ROOT": "{projectDir}"
1241
+ }
1242
+ }
1243
+ }
1244
+ }
1245
+ ```
1246
+
1247
+ **Note:** Junie AI uses `{projectDir}` variable which expands to the current project's absolute path. This ensures each project gets its own isolated database without hardcoded paths. Other MCP clients may use different variable names like `${workspaceFolder}` (VS Code/Cline) - check your client's documentation.
1248
+
1249
+ #### Impact
1250
+ - ✅ **Project-relative databases** without hardcoded absolute paths
1251
+ - **Cleaner MCP configuration** (no per-project path updates needed)
1252
+ - **Compatible with Junie AI, Claude Desktop, and other MCP clients**
1253
+ - ✅ **No breaking changes** (environment variable is optional)
1254
+
1255
+ ---
1256
+
1257
+ ### Fixed - MCP Protocol Compliance (EPIPE Fix)
1258
+
1259
+ **Eliminated console output for strict JSON-RPC protocol compliance**
1260
+
1261
+ #### Problem
1262
+ - EPIPE (broken pipe) errors when running with Junie AI on Windows
1263
+ - Console output to stdout/stderr violated MCP JSON-RPC protocol requirements
1264
+ - Strict MCP clients (like Junie AI) expect pure JSON-RPC on stdio streams
1265
+
1266
+ #### Changes
1267
+ - **Redirected all diagnostic output to debug log file** - stdout/stderr reserved exclusively for JSON-RPC
1268
+ - Modified `safeConsoleError()` to write to debug log instead of stderr
1269
+ - Replaced 50+ console.log/console.error calls across codebase:
1270
+ - `src/database.ts` - Database initialization messages
1271
+ - `src/watcher/file-watcher.ts` - File watcher status and events
1272
+ - `src/watcher/gitignore-parser.ts` - .gitignore loading warnings
1273
+ - `src/tools/tasks.ts` - Task file registration warnings
1274
+ - `src/config/example-generator.ts` - First launch messages
1275
+
1276
+ #### Technical Details
1277
+ - **MCP Protocol Requirement**: stdin/stdout/stderr must carry only JSON-RPC messages
1278
+ - **Debug Logging**: All diagnostic messages now use `debugLog()` with appropriate levels (INFO, WARN, ERROR)
1279
+ - **Zero stdout pollution**: Server starts silently, waits for JSON-RPC requests
1280
+ - **Tested with Junie AI**: Confirmed no EPIPE errors on Windows
1281
+
1282
+ #### Impact
1283
+ - ✅ **Works with strict MCP clients** (Junie AI, etc.)
1284
+ - ✅ **Maintains full diagnostics** via debug log file
1285
+ - ✅ **Pure JSON-RPC protocol** compliance
1286
+ - ✅ **No breaking changes** to MCP tool functionality
1287
+
1288
+ ---
1289
+
1290
+ ### Added - Environment Variable Support for Project Root
1291
+
1292
+ **New `SQLEW_PROJECT_ROOT` environment variable for project-relative databases**
1293
+
1294
+ #### Problem
1295
+ - Junie AI and other MCP clients require absolute paths in configuration
1296
+ - Users had to hardcode project-specific paths in MCP server config
1297
+ - No easy way to use project-relative database paths
1298
+
1299
+ #### Solution
1300
+ - Added `SQLEW_PROJECT_ROOT` environment variable support (inspired by serena-mcp pattern)
1301
+ - MCP clients can now pass project directory via environment variable
1302
+ - Database automatically created at `$SQLEW_PROJECT_ROOT/.sqlew/sqlew.db`
1303
+
1304
+ #### Priority Order
1305
+ 1. `SQLEW_PROJECT_ROOT` environment variable (NEW - highest priority)
1306
+ 2. `--db-path` CLI argument (absolute path)
1307
+ 3. `--config-path` CLI argument (absolute path)
1308
+ 4. `database.path` in config file (absolute path)
1309
+ 5. `process.cwd()` fallback
1310
+
1311
+ #### Junie AI Configuration Example
1312
+ ```json
1313
+ {
1314
+ "mcpServers": {
1315
+ "sqlew": {
1316
+ "command": "npx",
1317
+ "args": ["sqlew"],
1318
+ "env": {
1319
+ "SQLEW_PROJECT_ROOT": "{projectDir}"
1320
+ }
1321
+ }
1322
+ }
1323
+ }
1324
+ ```
1325
+
1326
+ **Note:** Junie AI uses `{projectDir}` variable which expands to the current project's absolute path. This ensures each project gets its own isolated database without hardcoded paths. Other MCP clients may use different variable names like `${workspaceFolder}` (VS Code/Cline) - check your client's documentation.
1327
+
1328
+ #### Impact
1329
+ - ✅ **Project-relative databases** without hardcoded absolute paths
1330
+ - **Cleaner MCP configuration** (no per-project path updates needed)
1331
+ - **Compatible with Junie AI, Claude Desktop, and other MCP clients**
1332
+ - ✅ **No breaking changes** (environment variable is optional)
1333
+
1334
+ ---
1335
+
1336
+ ### Fixed - MCP Protocol Compliance (EPIPE Fix)
1337
+
1338
+ **Eliminated console output for strict JSON-RPC protocol compliance**
1339
+
1340
+ #### Problem
1341
+ - EPIPE (broken pipe) errors when running with Junie AI on Windows
1342
+ - Console output to stdout/stderr violated MCP JSON-RPC protocol requirements
1343
+ - Strict MCP clients (like Junie AI) expect pure JSON-RPC on stdio streams
1344
+
1345
+ #### Changes
1346
+ - **Redirected all diagnostic output to debug log file** - stdout/stderr reserved exclusively for JSON-RPC
1347
+ - Modified `safeConsoleError()` to write to debug log instead of stderr
1348
+ - Replaced 50+ console.log/console.error calls across codebase:
1349
+ - `src/database.ts` - Database initialization messages
1350
+ - `src/watcher/file-watcher.ts` - File watcher status and events
1351
+ - `src/watcher/gitignore-parser.ts` - .gitignore loading warnings
1352
+ - `src/tools/tasks.ts` - Task file registration warnings
1353
+ - `src/config/example-generator.ts` - First launch messages
1354
+
1355
+ #### Technical Details
1356
+ - **MCP Protocol Requirement**: stdin/stdout/stderr must carry only JSON-RPC messages
1357
+ - **Debug Logging**: All diagnostic messages now use `debugLog()` with appropriate levels (INFO, WARN, ERROR)
1358
+ - **Zero stdout pollution**: Server starts silently, waits for JSON-RPC requests
1359
+ - **Tested with Junie AI**: Confirmed no EPIPE errors on Windows
1360
+
1361
+ #### Impact
1362
+ - ✅ **Works with strict MCP clients** (Junie AI, etc.)
1363
+ - ✅ **Maintains full diagnostics** via debug log file
1364
+ - ✅ **Pure JSON-RPC protocol** compliance
1365
+ - ✅ **No breaking changes** to MCP tool functionality
1366
+
1367
+ ---
1368
+
1369
+ ### Added - Environment Variable Support for Project Root
1370
+
1371
+ **New `SQLEW_PROJECT_ROOT` environment variable for project-relative databases**
1372
+
1373
+ #### Problem
1374
+ - Junie AI and other MCP clients require absolute paths in configuration
1375
+ - Users had to hardcode project-specific paths in MCP server config
1376
+ - No easy way to use project-relative database paths
1377
+
1378
+ #### Solution
1379
+ - Added `SQLEW_PROJECT_ROOT` environment variable support (inspired by serena-mcp pattern)
1380
+ - MCP clients can now pass project directory via environment variable
1381
+ - Database automatically created at `$SQLEW_PROJECT_ROOT/.sqlew/sqlew.db`
1382
+
1383
+ #### Priority Order
1384
+ 1. `SQLEW_PROJECT_ROOT` environment variable (NEW - highest priority)
1385
+ 2. `--db-path` CLI argument (absolute path)
1386
+ 3. `--config-path` CLI argument (absolute path)
1387
+ 4. `database.path` in config file (absolute path)
1388
+ 5. `process.cwd()` fallback
1389
+
1390
+ #### Junie AI Configuration Example
1391
+ ```json
1392
+ {
1393
+ "mcpServers": {
1394
+ "sqlew": {
1395
+ "command": "npx",
1396
+ "args": ["sqlew"],
1397
+ "env": {
1398
+ "SQLEW_PROJECT_ROOT": "{projectDir}"
1399
+ }
1400
+ }
1401
+ }
1402
+ }
1403
+ ```
1404
+
1405
+ **Note:** Junie AI uses `{projectDir}` variable which expands to the current project's absolute path. This ensures each project gets its own isolated database without hardcoded paths. Other MCP clients may use different variable names like `${workspaceFolder}` (VS Code/Cline) - check your client's documentation.
1406
+
1407
+ #### Impact
1408
+ - ✅ **Project-relative databases** without hardcoded absolute paths
1409
+ - **Cleaner MCP configuration** (no per-project path updates needed)
1410
+ - **Compatible with Junie AI, Claude Desktop, and other MCP clients**
1411
+ - ✅ **No breaking changes** (environment variable is optional)
1412
+
1413
+ ---
1414
+
1415
+ ### Fixed - MCP Protocol Compliance (EPIPE Fix)
1416
+
1417
+ **Eliminated console output for strict JSON-RPC protocol compliance**
1418
+
1419
+ #### Problem
1420
+ - EPIPE (broken pipe) errors when running with Junie AI on Windows
1421
+ - Console output to stdout/stderr violated MCP JSON-RPC protocol requirements
1422
+ - Strict MCP clients (like Junie AI) expect pure JSON-RPC on stdio streams
1423
+
1424
+ #### Changes
1425
+ - **Redirected all diagnostic output to debug log file** - stdout/stderr reserved exclusively for JSON-RPC
1426
+ - Modified `safeConsoleError()` to write to debug log instead of stderr
1427
+ - Replaced 50+ console.log/console.error calls across codebase:
1428
+ - `src/database.ts` - Database initialization messages
1429
+ - `src/watcher/file-watcher.ts` - File watcher status and events
1430
+ - `src/watcher/gitignore-parser.ts` - .gitignore loading warnings
1431
+ - `src/tools/tasks.ts` - Task file registration warnings
1432
+ - `src/config/example-generator.ts` - First launch messages
1433
+
1434
+ #### Technical Details
1435
+ - **MCP Protocol Requirement**: stdin/stdout/stderr must carry only JSON-RPC messages
1436
+ - **Debug Logging**: All diagnostic messages now use `debugLog()` with appropriate levels (INFO, WARN, ERROR)
1437
+ - **Zero stdout pollution**: Server starts silently, waits for JSON-RPC requests
1438
+ - **Tested with Junie AI**: Confirmed no EPIPE errors on Windows
1439
+
1440
+ #### Impact
1441
+ - ✅ **Works with strict MCP clients** (Junie AI, etc.)
1442
+ - ✅ **Maintains full diagnostics** via debug log file
1443
+ - ✅ **Pure JSON-RPC protocol** compliance
1444
+ - ✅ **No breaking changes** to MCP tool functionality
1445
+
1446
+ ---
1447
+
1448
+ ### Added - Environment Variable Support for Project Root
1449
+
1450
+ **New `SQLEW_PROJECT_ROOT` environment variable for project-relative databases**
1451
+
1452
+ #### Problem
1453
+ - Junie AI and other MCP clients require absolute paths in configuration
1454
+ - Users had to hardcode project-specific paths in MCP server config
1455
+ - No easy way to use project-relative database paths
1456
+
1457
+ #### Solution
1458
+ - Added `SQLEW_PROJECT_ROOT` environment variable support (inspired by serena-mcp pattern)
1459
+ - MCP clients can now pass project directory via environment variable
1460
+ - Database automatically created at `$SQLEW_PROJECT_ROOT/.sqlew/sqlew.db`
1461
+
1462
+ #### Priority Order
1463
+ 1. `SQLEW_PROJECT_ROOT` environment variable (NEW - highest priority)
1464
+ 2. `--db-path` CLI argument (absolute path)
1465
+ 3. `--config-path` CLI argument (absolute path)
1466
+ 4. `database.path` in config file (absolute path)
1467
+ 5. `process.cwd()` fallback
1468
+
1469
+ #### Junie AI Configuration Example
1470
+ ```json
1471
+ {
1472
+ "mcpServers": {
1473
+ "sqlew": {
1474
+ "command": "npx",
1475
+ "args": ["sqlew"],
1476
+ "env": {
1477
+ "SQLEW_PROJECT_ROOT": "{projectDir}"
1478
+ }
1479
+ }
1480
+ }
1481
+ }
1482
+ ```
1483
+
1484
+ **Note:** Junie AI uses `{projectDir}` variable which expands to the current project's absolute path. This ensures each project gets its own isolated database without hardcoded paths. Other MCP clients may use different variable names like `${workspaceFolder}` (VS Code/Cline) - check your client's documentation.
1485
+
1486
+ #### Impact
1487
+ - ✅ **Project-relative databases** without hardcoded absolute paths
1488
+ - **Cleaner MCP configuration** (no per-project path updates needed)
1489
+ - **Compatible with Junie AI, Claude Desktop, and other MCP clients**
1490
+ - **No breaking changes** (environment variable is optional)
1491
+
1492
+ ---
1493
+
1494
+ ### Fixed - MCP Protocol Compliance (EPIPE Fix)
1495
+
1496
+ **Eliminated console output for strict JSON-RPC protocol compliance**
1497
+
1498
+ #### Problem
1499
+ - EPIPE (broken pipe) errors when running with Junie AI on Windows
1500
+ - Console output to stdout/stderr violated MCP JSON-RPC protocol requirements
1501
+ - Strict MCP clients (like Junie AI) expect pure JSON-RPC on stdio streams
1502
+
1503
+ #### Changes
1504
+ - **Redirected all diagnostic output to debug log file** - stdout/stderr reserved exclusively for JSON-RPC
1505
+ - Modified `safeConsoleError()` to write to debug log instead of stderr
1506
+ - Replaced 50+ console.log/console.error calls across codebase:
1507
+ - `src/database.ts` - Database initialization messages
1508
+ - `src/watcher/file-watcher.ts` - File watcher status and events
1509
+ - `src/watcher/gitignore-parser.ts` - .gitignore loading warnings
1510
+ - `src/tools/tasks.ts` - Task file registration warnings
1511
+ - `src/config/example-generator.ts` - First launch messages
1512
+
1513
+ #### Technical Details
1514
+ - **MCP Protocol Requirement**: stdin/stdout/stderr must carry only JSON-RPC messages
1515
+ - **Debug Logging**: All diagnostic messages now use `debugLog()` with appropriate levels (INFO, WARN, ERROR)
1516
+ - **Zero stdout pollution**: Server starts silently, waits for JSON-RPC requests
1517
+ - **Tested with Junie AI**: Confirmed no EPIPE errors on Windows
1518
+
1519
+ #### Impact
1520
+ - **Works with strict MCP clients** (Junie AI, etc.)
1521
+ - **Maintains full diagnostics** via debug log file
1522
+ - ✅ **Pure JSON-RPC protocol** compliance
1523
+ - ✅ **No breaking changes** to MCP tool functionality
1524
+
1525
+ ---
1526
+
1527
+ ### Fixed - Windows Absolute Path Handling
1528
+
1529
+ **Fixed path normalization for Windows environments**
1530
+
1531
+ #### Changes
1532
+ - Fixed absolute path to relative path conversion in `gitignore-parser.ts`
1533
+ - Prevented `uname` Unix command calls on Windows
1534
+ - Resolved "path should be a `path.relative()`d string" error on Windows
1535
+ - Improved cross-platform path handling in file watcher
1536
+
1537
+ #### Technical Details
1538
+ - Enhanced path normalization logic to handle Windows drive letters (`C:/`)
1539
+ - Added proper Windows-specific path handling checks
1540
+ - Fixed compatibility with `ignore` library path requirements
1541
+
1542
+ ---
1543
+
1544
+ ## [3.6.8] - 2025-10-30
1545
+
1546
+ ### Fixed - Windows Environment Compatibility
1547
+
1548
+ **Updated better-sqlite3 for Windows support**
1549
+
1550
+ #### Changes
1551
+ - Updated `better-sqlite3` from `^11.0.0` to `^12.4.1`
1552
+ - Fixes Windows environment compatibility issues
1553
+ - Improves cross-platform stability
1554
+
1555
+ ---
1556
+
1557
+ ## [3.6.7] - 2025-10-30
1558
+
1559
+ ### Fixed - Dependency Update
1560
+
1561
+ **Removed deprecated dependency**
1562
+
1563
+ #### Changes
1564
+ - Removed deprecated dependency to ensure compatibility with latest ecosystem
1565
+ - Maintenance update for long-term stability
1566
+
1567
+ ---
1568
+
1569
+ ## [3.6.6] - 2025-10-29
1570
+
1571
+ ### Added - Parameter Validation & Error Handling
1572
+
1573
+ **Comprehensive parameter validation with helpful error messages**
1574
+
1575
+ #### Parameter Validation
1576
+ - **Required/Optional Detection** - Clear indication of required vs optional parameters
1577
+ - **Typo Suggestions** - Levenshtein distance-based "did you mean" suggestions for mistyped parameters
1578
+ - **Structured Error Messages** - JSON format with examples showing correct usage
1579
+ - **Visual Markers** - Help responses show 🔴 REQUIRED and ⚪ OPTIONAL parameter markers
1580
+ - **Action Specs Registry** - Centralized action specification in `src/utils/action-specs.ts`
1581
+ - **Comprehensive Test Suite** - 49 validation tests across all 5 tools
1582
+
1583
+ ### Removed - Config Tool Deprecated
1584
+
1585
+ **Config MCP tool removed in favor of file-based configuration**
1586
+
1587
+ #### Why Removed
1588
+ - Messaging system deprecated (primary use case eliminated)
1589
+ - File-based configuration (`.sqlew/config.toml`) is clearer and more maintainable
1590
+ - Runtime updates caused configuration drift between `m_config` table and config file
1591
+ - Confusing UX (changes lost on restart unless manually synced)
1592
+
1593
+ #### Migration Path
1594
+ - ✅ Use `.sqlew/config.toml` for all configuration (persistent, version-controlled)
1595
+ - Use CLI arguments for one-time overrides
1596
+ - ❌ Do not use `config` tool (will error)
1597
+
1598
+ #### Impact
1599
+ - 5 MCP tools (down from 6): `decision`, `task`, `file`, `constraint`, `stats`
1600
+ - Clearer configuration workflow (single source of truth)
1601
+ - Better developer experience (validation errors with examples)
1602
+ - Reduced cognitive load (no config drift issues)
1603
+
1604
+ ---
1605
+
1606
+ ## [3.6.5] - 2025-10-28
1607
+
1608
+ ### Changed - Agent System Simplification & CI/CD Fix
1609
+
1610
+ **Removed messaging system and eliminated agent pooling complexity**
1611
+
1612
+ #### Agent System Cleanup
1613
+ - **Removed messaging system** - `t_agent_messages` table dropped, `message` MCP tool deprecated
1614
+ - Messaging system was unused and added unnecessary complexity
1615
+ - Simplified agent architecture to single-purpose registry
1616
+ - **Eliminated agent pooling** - Code no longer uses `in_use` and `is_reusable` columns
1617
+ - Removed race conditions and UNIQUE constraint errors
1618
+ - Each agent name creates one permanent record (no reuse/pooling)
1619
+ - Generic agents (`generic-N`) auto-allocated for empty names
1620
+ - **6 MCP Tools** - Down from 7 (messaging removed)
1621
+ - `decision`, `file`, `constraint`, `stats`, `config`, `task`
1622
+
1623
+ #### Infrastructure
1624
+ - **CI/CD Workflow** - Removed npm publish step from GitHub Actions
1625
+ - npm publish requires 2FA authentication
1626
+ - Publishing must be done manually to prevent workflow failures
1627
+
1628
+ #### Impact
1629
+ - Simplified agent management (no pooling overhead)
1630
+ - Reduced complexity (messaging system removed)
1631
+ - CI/CD workflow no longer fails on npm publish
1632
+
1633
+ ---
1634
+
1635
+ ## [3.6.4] - 2025-10-28
1636
+
1637
+ ### Fixed - WSL Git Add Detection
1638
+
1639
+ **WSL-specific polling workaround for chokidar file watcher**
1640
+
1641
+ #### Changes
1642
+ - **1-second polling for WSL** - Added platform-specific chokidar configuration
1643
+ - WSL filesystem events are unreliable with native watching
1644
+ - Polling ensures git add operations are detected consistently
1645
+ - **Platform detection** - Automatic WSL detection via `/proc/version`
1646
+ - **Backward compatible** - Non-WSL platforms use native file watching (no polling)
1647
+
1648
+ #### Impact
1649
+ - ✅ Git add detection now works reliably on WSL
1650
+ - VCS-aware auto-complete functional across all platforms
1651
+
1652
+ ---
1653
+
1654
+ ## [3.6.3] - 2025-10-27
1655
+
1656
+ ### Fixed - Critical Bug Fixes & Git Add Detection
1657
+
1658
+ **Transaction pool exhaustion and VCS-aware auto-complete implementation**
1659
+
1660
+ #### Bug Fixes
1661
+ - **Task Move Transaction Bug** - Fixed `moveTask` using base `knex` instead of transaction `trx` (line 880)
1662
+ - Caused "Knex: Timeout acquiring a connection" errors
1663
+ - Now properly uses transaction object for `logTaskStatusChange`
1664
+ - **Task Link Transaction Bug** - Fixed `linkTask` using base `knex` instead of transaction `trx` (line 948)
1665
+ - Same connection pool exhaustion issue
1666
+ - Now properly uses transaction object for decision link insertion
1667
+
1668
+ #### Features
1669
+ - **Git Add Detection** - Implemented `detectAndCompleteOnStaging()` for VCS-aware workflow
1670
+ - Detects `git add` operations and auto-completes tasks (`waiting_review` → `done`)
1671
+ - Supports Git, Mercurial, and SVN
1672
+ - Configurable via `git_auto_complete_on_stage` and `require_all_files_staged`
1673
+ - **VCS Configuration** - Added comprehensive settings documentation to `config.example.toml`
1674
+ - `git_auto_complete_on_stage` (default: true)
1675
+ - `git_auto_archive_on_commit` (default: true)
1676
+ - `require_all_files_staged` (default: true)
1677
+ - `require_all_files_committed_for_archive` (default: true)
1678
+
1679
+ #### Infrastructure
1680
+ - **Line Ending Fix** - Added `.gitattributes` to enforce LF endings for shell scripts
1681
+ - Prevents CRLF issues in Husky hooks on Windows/WSL
1682
+ - Applies to `*.sh` and `.husky/*` files
1683
+ - **Husky Hooks** - Fixed pre-commit/pre-push hooks (added shebang, normalized line endings)
1684
+
1685
+ #### Impact
1686
+ - Task operations no longer fail with connection pool timeouts
1687
+ - ✅ Git add detection now functional (was stubbed in v3.5.2)
1688
+ - Cross-platform compatibility for git hooks (Windows/WSL/Linux/macOS)
1689
+
1690
+ ---
1691
+
1692
+ ## [3.6.2] - 2025-10-27
1693
+
1694
+ ### Changed - Migration System Modernization
1695
+
1696
+ **Simplified to Knex-only migrations with organized directory structure**
1697
+
1698
+ #### Migration System Cleanup
1699
+ - **Removed custom migration system** (14 obsolete files from `src/migrations/`)
1700
+ - **Pure Knex migrations** - Standardized on Knex.js migration framework
1701
+ - **Organized structure** - 22 migrations grouped into 3 logical subdirectories:
1702
+ - `upgrades/` (7 files) - Version upgrade paths (v1.0 → v3.6)
1703
+ - `bootstrap/` (5 files) - Fresh install foundation
1704
+ - `enhancements/` (10 files) - v3.6.0+ feature additions
1705
+
1706
+ #### Testing & CI/CD
1707
+ - **Migration tests updated** - Converted to use Knex migrations exclusively
1708
+ - **Comprehensive test coverage** - 8/9 versions migrate successfully (89% backward compatibility)
1709
+ - **Husky git hooks** - Pre-commit (build + tests), pre-push (migration tests)
1710
+ - **GitHub Actions workflow** - CI/CD pipeline for Node 18.x/20.x
1711
+
1712
+ #### Benefits
1713
+ - **Better maintainability** - Clear organization, standard tooling
1714
+ - **Easier onboarding** - Knex is industry-standard
1715
+ - **Faster development** - 56% time efficiency via parallel execution
1716
+
1717
+ ---
1718
+
1719
+ ## [3.6.0] - 2025-10-25
1720
+
1721
+ ### Added - Help System Optimization
1722
+
1723
+ **Database-driven help system with 60-70% token efficiency improvement**
1724
+
1725
+ #### Key Achievements
1726
+ - **60-70% Token Reduction** - Average help query: ~200 tokens (vs ~2,150 legacy)
1727
+ - **95.8% Schema Reduction** - MCP InputSchemas: 350 tokens (vs 8,400 legacy)
1728
+ - **6 New Help Actions** - Granular queries for actions, parameters, tools, use-cases
1729
+ - **41 Use-Cases** - Comprehensive workflow examples across 6 categories
1730
+ - **100% Test Coverage** - 38/38 tests passing
1731
+
1732
+ #### New MCP Actions (stats tool)
1733
+ - `help_action` - Query single action with parameters and examples
1734
+ - `help_params` - Query parameter list for an action
1735
+ - `help_tool` - Query tool overview + all actions
1736
+ - `help_use_case` - Get single use-case with full workflow
1737
+ - `help_list_use_cases` - List/filter use-cases by category/complexity
1738
+ - `help_next_actions` - Suggest common next actions
1739
+
1740
+ #### Database Schema
1741
+ 7 new tables: `m_help_tools`, `m_help_actions`, `m_help_use_case_categories`, `t_help_action_params`, `t_help_action_examples`, `t_help_use_cases`, `t_help_action_sequences`
1742
+
1743
+ #### Migration from v3.5.x
1744
+ - Automatic migration on startup
1745
+ - Backward compatible - all existing MCP actions unchanged
1746
+ - Zero downtime
1747
+
1748
+ ---
1749
+
1750
+ ## [3.5.2] - 2025-10-24
1751
+
1752
+ ### Added - Two-Step Git-Aware Task Workflow
1753
+
1754
+ **Automatic task completion and archiving based on Git staging and committing**
1755
+
1756
+ #### Features
1757
+ - **Step 1 - Staging** (`git add`): `waiting_review` → `done` (work complete)
1758
+ - **Step 2 - Committing** (`git commit`): `done` → `archived` (work finalized)
1759
+ - **VCS Support**: Git, Mercurial, and SVN
1760
+ - **Zero Token Cost**: Fully automated, no manual MCP calls needed
1761
+
1762
+ #### Configuration
1763
+ - `git_auto_complete_on_stage` (default: `'1'`)
1764
+ - `git_auto_archive_on_commit` (default: `'1'`)
1765
+ - `require_all_files_staged` (default: `'1'`)
1766
+ - `require_all_files_committed_for_archive` (default: `'1'`)
1767
+
1768
+ ---
1769
+
1770
+ ## [3.5.1] - 2025-10-24
1771
+
1772
+ ### Fixed - File Watcher WSL Compatibility
1773
+
1774
+ **Upgraded chokidar from v3 to v4 + Fixed path normalization bug**
1775
+
1776
+ #### Changes
1777
+ - **chokidar**: `^3.6.0` → `^4.0.3` (automatic WSL support)
1778
+ - Fixed path normalization: chokidar reports absolute paths, database stores relative
1779
+ - Removed manual WSL detection and polling configuration
1780
+
1781
+ ---
1782
+
1783
+ ## [3.5.0] - 2025-10-22
1784
+
1785
+ ### Added - Non-Existent File Auto-Pruning
1786
+
1787
+ **Automatic removal of non-existent watched files with audit trail**
1788
+
1789
+ #### Features
1790
+ - New table: `t_task_pruned_files` - Audit trail for pruned files
1791
+ - Auto-pruning during `in_progress → waiting_review` transition
1792
+ - Safety check: blocks if ALL files non-existent
1793
+ - New MCP actions: `get_pruned_files`, `link_pruned_file`
1794
+
1795
+ #### Documentation
1796
+
1797
+ ---
1798
+
1799
+
1800
+ ## Older Versions
1801
+
1802
+ For changelog entries **v3.4.1 and older**, see:
1803
+ - [docs/changelogs/CHANGELOG_ARCHIVE_v3.4_and_older.md](docs/changelogs/CHANGELOG_ARCHIVE_v3.4_and_older.md)
1804
+
1805
+ This includes all versions from v1.0.0 through v3.4.1.