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