sqlew 5.1.0 → 5.2.1

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