sqlew 5.2.0 → 5.2.2

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 (109) hide show
  1. package/CHANGELOG.md +2169 -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 +2 -2
  17. package/dist/cli/hooks/on-prompt.d.ts.map +1 -1
  18. package/dist/cli/hooks/on-prompt.js +33 -16
  19. package/dist/cli/hooks/on-prompt.js.map +1 -1
  20. package/dist/cli/hooks/plan-pattern-extractor.d.ts +2 -0
  21. package/dist/cli/hooks/plan-pattern-extractor.d.ts.map +1 -1
  22. package/dist/cli/hooks/plan-pattern-extractor.js +1 -0
  23. package/dist/cli/hooks/plan-pattern-extractor.js.map +1 -1
  24. package/dist/cli/hooks/plan-processor.d.ts.map +1 -1
  25. package/dist/cli/hooks/plan-processor.js +1 -0
  26. package/dist/cli/hooks/plan-processor.js.map +1 -1
  27. package/dist/cli/hooks/pr-adr.js +5 -5
  28. package/dist/cli/hooks/stdin-parser.d.ts +4 -2
  29. package/dist/cli/hooks/stdin-parser.d.ts.map +1 -1
  30. package/dist/cli/hooks/stdin-parser.js +79 -9
  31. package/dist/cli/hooks/stdin-parser.js.map +1 -1
  32. package/dist/cli/hooks/track-plan.js +15 -15
  33. package/dist/cli.js +48 -48
  34. package/dist/config/global-config.js +19 -19
  35. package/dist/database/migrations/v4/20251126000000_v4_bootstrap.js +32 -32
  36. package/dist/database/migrations/v4/20260102204000_v4_fix_decision_set_example.js +3 -3
  37. package/dist/database/migrations/v4/20260613000000_add_constraint_reason.d.ts +9 -0
  38. package/dist/database/migrations/v4/20260613000000_add_constraint_reason.d.ts.map +1 -0
  39. package/dist/database/migrations/v4/20260613000000_add_constraint_reason.js +31 -0
  40. package/dist/database/migrations/v4/20260613000000_add_constraint_reason.js.map +1 -0
  41. package/dist/help-data/constraint.toml +265 -259
  42. package/dist/help-data/decision.toml +845 -845
  43. package/dist/help-data/queue.toml +134 -134
  44. package/dist/schema.d.ts.map +1 -1
  45. package/dist/schema.js +4 -5
  46. package/dist/schema.js.map +1 -1
  47. package/dist/server/tool-schemas.js +30 -30
  48. package/dist/tests/docker/native/constraint-operations.test.js +38 -0
  49. package/dist/tests/docker/native/constraint-operations.test.js.map +1 -1
  50. package/dist/tests/docker/native/db-init.js +9 -9
  51. package/dist/tests/feature/constraint/reason.test.d.ts +7 -0
  52. package/dist/tests/feature/constraint/reason.test.d.ts.map +1 -0
  53. package/dist/tests/feature/constraint/reason.test.js +68 -0
  54. package/dist/tests/feature/constraint/reason.test.js.map +1 -0
  55. package/dist/tests/unit/hooks/codex-hook-normalization.test.d.ts +7 -0
  56. package/dist/tests/unit/hooks/codex-hook-normalization.test.d.ts.map +1 -0
  57. package/dist/tests/unit/hooks/codex-hook-normalization.test.js +112 -0
  58. package/dist/tests/unit/hooks/codex-hook-normalization.test.js.map +1 -0
  59. package/dist/tests/unit/hooks/grok-hook-normalization.test.js +45 -7
  60. package/dist/tests/unit/hooks/grok-hook-normalization.test.js.map +1 -1
  61. package/dist/tests/unit/hooks/plan-pattern-extractor.test.d.ts +8 -0
  62. package/dist/tests/unit/hooks/plan-pattern-extractor.test.d.ts.map +1 -0
  63. package/dist/tests/unit/hooks/plan-pattern-extractor.test.js +110 -0
  64. package/dist/tests/unit/hooks/plan-pattern-extractor.test.js.map +1 -0
  65. package/dist/tests/utils/db-schema.js +48 -48
  66. package/dist/tests/utils/test-helpers.js +48 -48
  67. package/dist/tools/constraints/actions/add.d.ts.map +1 -1
  68. package/dist/tools/constraints/actions/add.js +1 -0
  69. package/dist/tools/constraints/actions/add.js.map +1 -1
  70. package/dist/tools/constraints/actions/get.d.ts.map +1 -1
  71. package/dist/tools/constraints/actions/get.js +9 -7
  72. package/dist/tools/constraints/actions/get.js.map +1 -1
  73. package/dist/tools/constraints/help/example.js +1 -1
  74. package/dist/tools/constraints/help/example.js.map +1 -1
  75. package/dist/types/constraint/params.d.ts +2 -0
  76. package/dist/types/constraint/params.d.ts.map +1 -1
  77. package/dist/types/view-entities.d.ts +1 -0
  78. package/dist/types/view-entities.d.ts.map +1 -1
  79. package/dist/utils/action-specs/constraint-specs.d.ts.map +1 -1
  80. package/dist/utils/action-specs/constraint-specs.js +4 -3
  81. package/dist/utils/action-specs/constraint-specs.js.map +1 -1
  82. package/dist/utils/hook-queue.d.ts +2 -0
  83. package/dist/utils/hook-queue.d.ts.map +1 -1
  84. package/dist/utils/hook-queue.js.map +1 -1
  85. package/dist/utils/project-root.d.ts +1 -0
  86. package/dist/utils/project-root.d.ts.map +1 -1
  87. package/dist/utils/project-root.js +6 -0
  88. package/dist/utils/project-root.js.map +1 -1
  89. package/dist/utils/view-queries.d.ts.map +1 -1
  90. package/dist/utils/view-queries.js +1 -0
  91. package/dist/utils/view-queries.js.map +1 -1
  92. package/dist/watcher/queue-watcher.d.ts.map +1 -1
  93. package/dist/watcher/queue-watcher.js +1 -0
  94. package/dist/watcher/queue-watcher.js.map +1 -1
  95. package/docs/ADR_CONCEPTS.md +152 -152
  96. package/docs/CLI_USAGE.md +392 -392
  97. package/docs/CONFIGURATION.md +157 -157
  98. package/docs/CROSS_DATABASE.md +66 -66
  99. package/docs/DATABASE_AUTH.md +135 -135
  100. package/docs/HOOKS_GUIDE.md +116 -101
  101. package/docs/MIGRATION_TO_SAAS.md +176 -176
  102. package/docs/SHARED_DATABASE.md +108 -108
  103. package/package.json +88 -88
  104. package/scripts/copy-help-data.js +19 -19
  105. package/scripts/filter-test-output.js +78 -78
  106. package/dist/tests/docker/native/help-system.test.d.ts +0 -8
  107. package/dist/tests/docker/native/help-system.test.d.ts.map +0 -1
  108. package/dist/tests/docker/native/help-system.test.js +0 -508
  109. package/dist/tests/docker/native/help-system.test.js.map +0 -1
package/README.md CHANGED
@@ -1,199 +1,204 @@
1
- # sqlew
2
-
3
- ![sqlew_logo](assets/sqlew-logo.png)
4
-
5
- [![npm version](https://img.shields.io/npm/v/sqlew.svg)](https://www.npmjs.com/package/sqlew)
6
- [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
7
-
8
- > **Design decisions, remembered by SQL** — an MCP server for AI agents
9
-
10
- ## What is sqlew?
11
-
12
- ### The Problem
13
-
14
- Every AI coding session starts from scratch. Your agent doesn't remember that you chose PostgreSQL over MongoDB last week, or that the team agreed on a specific API versioning strategy. Without persistent memory, agents repeat mistakes, contradict earlier decisions, and waste tokens re-discovering context.
15
-
16
- ### The Solution
17
-
18
- sqlew stores your architectural decisions in a structured SQL database. When a new session starts, the AI agent queries past decisions in milliseconds — not by reading through scattered Markdown files, but through efficient SQL lookups with metadata, tags, and similarity detection.
19
-
20
- ```
21
- ┌─────────────────────────────────────────────────────────────┐
22
- │ Before sqlew │ After sqlew │
23
- │───────────────────────────────│─────────────────────────────│
24
- │ Session 1: "Use PostgreSQL" │ Session 1: "Use PostgreSQL"│
25
- │ Session 2: "Use MongoDB?" │ → decision recorded │
26
- │ Session 3: "Use PostgreSQL" │ Session 2: query → got it │
27
- │ (same debate, every time) │ Session 3: query → got it │
28
- │ │ (instant recall) │
29
- └─────────────────────────────────────────────────────────────┘
30
- ```
31
-
32
- sqlew is built on the [Model Context Protocol](https://modelcontextprotocol.io/) (MCP), so it works with any MCP-compatible AI coding tool.
33
-
34
- > _This software does not send any data to external networks. We NEVER collect any data or usage statistics._
35
-
36
- ## Quick Start
37
-
38
- ### 1. Install
39
-
40
- ```bash
41
- npm install -g sqlew
42
- ```
43
-
44
- ### 2. Setup
45
-
46
- Choose the setup that matches your environment:
47
-
48
- #### Claude Code (Plugin)
49
-
50
- ```bash
51
- claude plugin marketplace add sqlew-io/sqlew-plugin
52
- claude plugin install sqlew
53
- ```
54
-
55
- The plugin automatically configures MCP server, Skills (Plan Mode guidance), and Hooks (automatic decision capture).
56
-
57
- #### Codex CLI
58
-
59
- See [sqlew-codex](https://github.com/sqlew-io/sqlew-codex) for Codex CLI integration.
60
-
61
- #### Grok Build (Plugin)
62
-
63
- ```bash
64
- npm install -g sqlew
65
- grok plugin install sqlew-io/sqlew-plugin --trust
66
- grok plugin update
67
- ```
68
-
69
- The plugin configures MCP server, Skills (plan mode guidance), and Hooks (automatic decision capture on `exit_plan_mode`). See [Hooks Guide](docs/HOOKS_GUIDE.md) for setup details and caveats (do not duplicate hooks in `~/.grok/hooks/` or `config.toml`).
70
-
71
- #### Manual
72
-
73
- Add to `.mcp.json` in your project root:
74
-
75
- ```json
76
- {
77
- "mcpServers": {
78
- "sqlew": {
79
- "command": "sqlew"
80
- }
81
- }
82
- }
83
- ```
84
-
85
- The database (`~/.config/sqlew/sqlew-shared.db`) and config are auto-created on first run. See [Shared Database](docs/SHARED_DATABASE.md) for details.
86
-
87
- ### 3. Just use Plan Mode!
88
-
89
- That's it. Every time you create a plan and get user approval, your architectural decisions are **automatically recorded**.
90
-
91
- No special commands needed — just plan your work normally, and sqlew captures the decisions in the background.
92
-
93
- ## Features
94
-
95
- - **Structured Records** — Decisions stored as relational data with metadata, tags, layers, and version history
96
- - **Fast Queries**2-50ms retrieval via SQL, even with thousands of decisions
97
- - **Duplicate Detection** — Three-tier similarity scoring (0-100) prevents redundant decisions
98
- - **Constraint Tracking** — Architectural rules and principles as first-class entities
99
- - **Auto-Capture** — Hooks automatically record decisions from Plan Mode (Claude Code and Grok Build via sqlew-plugin)
100
- - **Multi-Database** — SQLite (default), PostgreSQL, MySQL/MariaDB, or Cloud
101
- - **Git Worktree Ready** — Each worktree shares the same context database
102
-
103
- ## For Teams (sqlew.io)
104
-
105
- Connect to [sqlew.io](https://sqlew.io) for team-shared decisions:
106
-
107
- **Step 1: Get your API key**
108
-
109
- Visit [sqlew.io](https://sqlew.io) and save your API key:
110
-
111
- ```bash
112
- # ~/.config/sqlew/.sqlew.env (shared across all projects)
113
- SQLEW_API_KEY=your-api-key
114
- ```
115
-
116
- **Step 2: Configure each project**
117
-
118
- ```toml
119
- # .sqlew/config.toml
120
- [database]
121
- type = "cloud"
122
-
123
- [project]
124
- name = "your-project-name"
125
- ```
126
-
127
- **Benefits:**
128
- - All team members share the same decision database
129
- - Works seamlessly with Git worktree workflows
130
- - No local database setup required
131
-
132
- ## Performance
133
-
134
- | Metric | Value |
135
- |--------|-------|
136
- | Query speed | 2-50ms |
137
- | Concurrent agents | 5+ simultaneous |
138
- | Storage efficiency | ~140 bytes/decision |
139
- | Token savings | 60-75% vs Markdown ADRs |
140
-
141
- ## Use Cases
142
-
143
- - **Architecture Evolution** Document major decisions with full context and alternatives considered
144
- - **Pattern Standardization** Establish coding patterns as constraints, enforce via AI code generation
145
- - **Cross-Session Continuity** — AI maintains context across days/weeks without re-reading docs
146
- - **Multi-Agent Coordination** — Multiple AI agents share architectural understanding
147
- - **Onboarding Acceleration** — New AI sessions instantly understand project history
148
-
149
- ## Documentation
150
-
151
- | Guide | Description |
152
- |-------|-------------|
153
- | [ADR Concepts](docs/ADR_CONCEPTS.md) | Architecture Decision Records explained |
154
- | [Configuration](docs/CONFIGURATION.md) | Config file setup, database options |
155
- | [Hooks Guide](docs/HOOKS_GUIDE.md) | Claude Code, Codex, and Grok Build integration |
156
- | [Cross Database](docs/CROSS_DATABASE.md) | Multi-database support |
157
- | [CLI Usage](docs/CLI_USAGE.md) | Database migration, export/import |
158
-
159
- ### Upgrade Guides
160
-
161
- - [Migrating to SaaS](docs/MIGRATION_TO_SAAS.md) Export local data to sqlew.io cloud
162
-
163
-
164
- ### MCP Tools
165
-
166
- 7 action-based tools: `decision`, `constraint`, `suggest`, `help`, `example`, `use_case`, `queue`
167
-
168
- All tools support `action: "help"` for documentation.
169
-
170
- ## Support
171
-
172
- Support development via [GitHub Sponsors](https://github.com/sponsors/sqlew-io).
173
-
174
- ## Version
175
-
176
- Current version: **5.2.0**
177
-
178
- See [CHANGELOG.md](CHANGELOG.md) for release history.
179
-
180
- **What's New in v5.2.0:**
181
-
182
- - **Grok Build support** — Plan-to-ADR via [sqlew-plugin](https://github.com/sqlew-io/sqlew-plugin) (`grok plugin install sqlew-io/sqlew-plugin --trust`)
183
- - **Grok plan.md injection** Decision/Constraint template appended on `enter_plan_mode`
184
- - **Hook normalization** — Single CLI hook handlers work under both Claude Code and Grok Build
185
-
186
- ## License
187
-
188
- Apache License 2.0Free for commercial and personal use. See [LICENSE](LICENSE) for details.
189
-
190
- ## Links
191
-
192
- - [npm package](https://www.npmjs.com/package/sqlew)
193
- - [GitHub](https://github.com/sqlew-io/sqlew)
194
- - [Issues](https://github.com/sqlew-io/sqlew/issues)
195
- - [Model Context Protocol](https://modelcontextprotocol.io/)
196
-
197
- ---
198
-
199
- Built with [MCP SDK](https://github.com/modelcontextprotocol/sdk), [better-sqlite3](https://github.com/WiseLibs/better-sqlite3), and TypeScript.
1
+ # sqlew
2
+
3
+ ![sqlew_logo](assets/sqlew-logo.png)
4
+
5
+ [![npm version](https://img.shields.io/npm/v/sqlew.svg)](https://www.npmjs.com/package/sqlew)
6
+ [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
7
+
8
+ > **Design decisions, remembered by SQL** — an MCP server for AI agents
9
+
10
+ ## What is sqlew?
11
+
12
+ ### The Problem
13
+
14
+ Every AI coding session starts from scratch. Your agent doesn't remember that you chose PostgreSQL over MongoDB last week, or that the team agreed on a specific API versioning strategy. Without persistent memory, agents repeat mistakes, contradict earlier decisions, and waste tokens re-discovering context.
15
+
16
+ ### The Solution
17
+
18
+ sqlew stores your architectural decisions in a structured SQL database. When a new session starts, the AI agent queries past decisions in milliseconds — not by reading through scattered Markdown files, but through efficient SQL lookups with metadata, tags, and similarity detection.
19
+
20
+ ```
21
+ ┌─────────────────────────────────────────────────────────────┐
22
+ │ Before sqlew │ After sqlew │
23
+ │───────────────────────────────│─────────────────────────────│
24
+ │ Session 1: "Use PostgreSQL" │ Session 1: "Use PostgreSQL"│
25
+ │ Session 2: "Use MongoDB?" │ → decision recorded │
26
+ │ Session 3: "Use PostgreSQL" │ Session 2: query → got it │
27
+ │ (same debate, every time) │ Session 3: query → got it │
28
+ │ │ (instant recall) │
29
+ └─────────────────────────────────────────────────────────────┘
30
+ ```
31
+
32
+ sqlew is built on the [Model Context Protocol](https://modelcontextprotocol.io/) (MCP), so it works with any MCP-compatible AI coding tool.
33
+
34
+ > _This software does not send any data to external networks. We NEVER collect any data or usage statistics._
35
+
36
+ ## Quick Start
37
+
38
+ ### 1. Install
39
+
40
+ ```bash
41
+ npm install -g sqlew
42
+ ```
43
+
44
+ ### 2. Setup
45
+
46
+ Choose the setup that matches your environment:
47
+
48
+ #### Claude Code (Plugin)
49
+
50
+ ```bash
51
+ claude plugin marketplace add sqlew-io/sqlew-plugin
52
+ claude plugin install sqlew
53
+ ```
54
+
55
+ The plugin automatically configures MCP server, Skills (Plan Mode guidance), and Hooks (automatic decision capture).
56
+
57
+ #### Codex CLI (Plugin)
58
+
59
+ ```bash
60
+ codex plugin marketplace add sqlew-io/sqlew-plugin
61
+ codex plugin install sqlew --source sqlew-plugin
62
+ ```
63
+
64
+ After install, open `/hooks` in Codex and trust the bundled sqlew hooks. Enable Plan Mode with `collaboration_modes = true` under `[features]` in your Codex config. The plugin configures MCP server, Skills (plan mode guidance), and Hooks (plan enforcement, PR ADR guard, decision extraction). See [Hooks Guide](docs/HOOKS_GUIDE.md) for caveats (do not duplicate skills in `~/.codex/skills/` or add `[mcp_servers.sqlew]` to `config.toml`).
65
+
66
+ #### Grok Build (Plugin)
67
+
68
+ ```bash
69
+ npm install -g sqlew
70
+ grok plugin install sqlew-io/sqlew-plugin --trust
71
+ grok plugin update
72
+ ```
73
+
74
+ The plugin configures MCP server, Skills (plan mode guidance), and Hooks (automatic decision capture on `exit_plan_mode`). See [Hooks Guide](docs/HOOKS_GUIDE.md) for setup details and caveats (do not duplicate hooks in `~/.grok/hooks/` or `config.toml`).
75
+
76
+ #### Manual
77
+
78
+ Add to `.mcp.json` in your project root:
79
+
80
+ ```json
81
+ {
82
+ "mcpServers": {
83
+ "sqlew": {
84
+ "command": "sqlew"
85
+ }
86
+ }
87
+ }
88
+ ```
89
+
90
+ The database (`~/.config/sqlew/sqlew-shared.db`) and config are auto-created on first run. See [Shared Database](docs/SHARED_DATABASE.md) for details.
91
+
92
+ ### 3. Just use Plan Mode!
93
+
94
+ That's it. Every time you create a plan and get user approval, your architectural decisions are **automatically recorded**.
95
+
96
+ No special commands needed just plan your work normally, and sqlew captures the decisions in the background.
97
+
98
+ ## Features
99
+
100
+ - **Structured Records** — Decisions stored as relational data with metadata, tags, layers, and version history
101
+ - **Fast Queries** — 2-50ms retrieval via SQL, even with thousands of decisions
102
+ - **Duplicate Detection** — Three-tier similarity scoring (0-100) prevents redundant decisions
103
+ - **Constraint Tracking** — Architectural rules and principles as first-class entities
104
+ - **Auto-Capture** — Hooks automatically record decisions from Plan Mode (Claude Code, Codex, and Grok Build via sqlew-plugin)
105
+ - **Multi-Database** — SQLite (default), PostgreSQL, MySQL/MariaDB, or Cloud
106
+ - **Git Worktree Ready** — Each worktree shares the same context database
107
+
108
+ ## For Teams (sqlew.io)
109
+
110
+ Connect to [sqlew.io](https://sqlew.io) for team-shared decisions:
111
+
112
+ **Step 1: Get your API key**
113
+
114
+ Visit [sqlew.io](https://sqlew.io) and save your API key:
115
+
116
+ ```bash
117
+ # ~/.config/sqlew/.sqlew.env (shared across all projects)
118
+ SQLEW_API_KEY=your-api-key
119
+ ```
120
+
121
+ **Step 2: Configure each project**
122
+
123
+ ```toml
124
+ # .sqlew/config.toml
125
+ [database]
126
+ type = "cloud"
127
+
128
+ [project]
129
+ name = "your-project-name"
130
+ ```
131
+
132
+ **Benefits:**
133
+ - All team members share the same decision database
134
+ - Works seamlessly with Git worktree workflows
135
+ - No local database setup required
136
+
137
+ ## Performance
138
+
139
+ | Metric | Value |
140
+ |--------|-------|
141
+ | Query speed | 2-50ms |
142
+ | Concurrent agents | 5+ simultaneous |
143
+ | Storage efficiency | ~140 bytes/decision |
144
+ | Token savings | 60-75% vs Markdown ADRs |
145
+
146
+ ## Use Cases
147
+
148
+ - **Architecture Evolution** — Document major decisions with full context and alternatives considered
149
+ - **Pattern Standardization** — Establish coding patterns as constraints, enforce via AI code generation
150
+ - **Cross-Session Continuity** — AI maintains context across days/weeks without re-reading docs
151
+ - **Multi-Agent Coordination** Multiple AI agents share architectural understanding
152
+ - **Onboarding Acceleration** — New AI sessions instantly understand project history
153
+
154
+ ## Documentation
155
+
156
+ | Guide | Description |
157
+ |-------|-------------|
158
+ | [ADR Concepts](docs/ADR_CONCEPTS.md) | Architecture Decision Records explained |
159
+ | [Configuration](docs/CONFIGURATION.md) | Config file setup, database options |
160
+ | [Hooks Guide](docs/HOOKS_GUIDE.md) | Claude Code, Codex, and Grok Build integration |
161
+ | [Cross Database](docs/CROSS_DATABASE.md) | Multi-database support |
162
+ | [CLI Usage](docs/CLI_USAGE.md) | Database migration, export/import |
163
+
164
+ ### Upgrade Guides
165
+
166
+ - [Migrating to SaaS](docs/MIGRATION_TO_SAAS.md) Export local data to sqlew.io cloud
167
+
168
+
169
+ ### MCP Tools
170
+
171
+ 7 action-based tools: `decision`, `constraint`, `suggest`, `help`, `example`, `use_case`, `queue`
172
+
173
+ All tools support `action: "help"` for documentation.
174
+
175
+ ## Support
176
+
177
+ Support development via [GitHub Sponsors](https://github.com/sponsors/sqlew-io).
178
+
179
+ ## Version
180
+
181
+ Current version: **5.2.0**
182
+
183
+ See [CHANGELOG.md](CHANGELOG.md) for release history.
184
+
185
+ **What's New in v5.2.0:**
186
+
187
+ - **Grok Build support** — Plan-to-ADR via [sqlew-plugin](https://github.com/sqlew-io/sqlew-plugin) (`grok plugin install sqlew-io/sqlew-plugin --trust`)
188
+ - **Grok plan.md injection** Decision/Constraint template appended on `enter_plan_mode`
189
+ - **Hook normalization** — Single CLI hook handlers work under both Claude Code and Grok Build
190
+
191
+ ## License
192
+
193
+ Apache License 2.0 — Free for commercial and personal use. See [LICENSE](LICENSE) for details.
194
+
195
+ ## Links
196
+
197
+ - [npm package](https://www.npmjs.com/package/sqlew)
198
+ - [GitHub](https://github.com/sqlew-io/sqlew)
199
+ - [Issues](https://github.com/sqlew-io/sqlew/issues)
200
+ - [Model Context Protocol](https://modelcontextprotocol.io/)
201
+
202
+ ---
203
+
204
+ Built with [MCP SDK](https://github.com/modelcontextprotocol/sdk), [better-sqlite3](https://github.com/WiseLibs/better-sqlite3), and TypeScript.
@@ -130,9 +130,9 @@ export class MySQLAdapter extends BaseAdapter {
130
130
  async tableExists(tableName) {
131
131
  const knex = this.getKnex();
132
132
  const database = this.config.connection.database;
133
- const result = await knex.raw(`SELECT TABLE_NAME
134
- FROM INFORMATION_SCHEMA.TABLES
135
- WHERE TABLE_SCHEMA = ?
133
+ const result = await knex.raw(`SELECT TABLE_NAME
134
+ FROM INFORMATION_SCHEMA.TABLES
135
+ WHERE TABLE_SCHEMA = ?
136
136
  AND TABLE_NAME = ?`, [database, tableName]);
137
137
  return result[0].length > 0;
138
138
  }
@@ -130,9 +130,9 @@ export class PostgreSQLAdapter extends BaseAdapter {
130
130
  async tableExists(tableName) {
131
131
  const knex = this.getKnex();
132
132
  const database = this.config.connection.database;
133
- const result = await knex.raw(`SELECT table_name
134
- FROM information_schema.tables
135
- WHERE table_catalog = ?
133
+ const result = await knex.raw(`SELECT table_name
134
+ FROM information_schema.tables
135
+ WHERE table_catalog = ?
136
136
  AND table_name = ?`, [database, tableName]);
137
137
  return result.rows.length > 0;
138
138
  }
@@ -13,38 +13,38 @@ import { getDefaultDbPath } from '../config/global-config.js';
13
13
  * Show help message for db:export command
14
14
  */
15
15
  export function showDbExportHelp() {
16
- console.log(`
17
- sqlew db:export - Export project data to JSON format
18
-
19
- USAGE:
20
- npm run db:export -- [output-file] [key=value ...]
21
-
22
- ARGUMENTS:
23
- [output-file] Output file (optional, default: stdout)
24
-
25
- OPTIONS (use key=value format):
26
- project=<name> Export specific project (default: auto-detect from config.toml)
27
- project=all Export all projects (explicit opt-in required)
28
- db-path=<path> SQLite database path
29
- config=<path> Config file path
30
-
31
- EXAMPLES:
32
- # Export current project (auto-detect from .sqlew/config.toml)
33
- npm run db:export -- data.json
34
-
35
- # Export specific project
36
- npm run db:export -- data.json project=myproject
37
-
38
- # Export all projects (explicit)
39
- npm run db:export -- backup.json project=all
40
-
41
- # Export to stdout
42
- npm run db:export -- project=myproject
43
-
44
- WORKFLOW:
45
- 1. Export: npm run db:export -- data.json project=myproject
46
- 2. Copy JSON to target
47
- 3. Import: npm run db:import -- data.json
16
+ console.log(`
17
+ sqlew db:export - Export project data to JSON format
18
+
19
+ USAGE:
20
+ npm run db:export -- [output-file] [key=value ...]
21
+
22
+ ARGUMENTS:
23
+ [output-file] Output file (optional, default: stdout)
24
+
25
+ OPTIONS (use key=value format):
26
+ project=<name> Export specific project (default: auto-detect from config.toml)
27
+ project=all Export all projects (explicit opt-in required)
28
+ db-path=<path> SQLite database path
29
+ config=<path> Config file path
30
+
31
+ EXAMPLES:
32
+ # Export current project (auto-detect from .sqlew/config.toml)
33
+ npm run db:export -- data.json
34
+
35
+ # Export specific project
36
+ npm run db:export -- data.json project=myproject
37
+
38
+ # Export all projects (explicit)
39
+ npm run db:export -- backup.json project=all
40
+
41
+ # Export to stdout
42
+ npm run db:export -- project=myproject
43
+
44
+ WORKFLOW:
45
+ 1. Export: npm run db:export -- data.json project=myproject
46
+ 2. Copy JSON to target
47
+ 3. Import: npm run db:import -- data.json
48
48
  `);
49
49
  }
50
50
  /**
@@ -13,36 +13,36 @@ import { getDefaultDbPath } from '../config/global-config.js';
13
13
  * Show help message for db:import command
14
14
  */
15
15
  export function showDbImportHelp() {
16
- console.log(`
17
- sqlew db:import - Import project data from JSON export
18
-
19
- USAGE:
20
- npm run db:import -- <source-file> [key=value ...]
21
-
22
- ARGUMENTS:
23
- <source-file> JSON export file (required)
24
-
25
- OPTIONS (use key=value format):
26
- project-name=<name> Target project name (default: from JSON)
27
- skip-if-exists=true Skip if project exists (default: true)
28
- dry-run=true Validate only, don't import
29
- db-path=<path> SQLite database path
30
- config=<path> Config file path
31
-
32
- EXAMPLES:
33
- # Import from JSON
34
- npm run db:import -- data.json
35
-
36
- # Import with custom project name
37
- npm run db:import -- data.json project-name=newproject
38
-
39
- # Dry run validation
40
- npm run db:import -- data.json dry-run=true
41
-
42
- WORKFLOW:
43
- 1. Export: npm run db:export -- data.json project=myproject
44
- 2. Copy JSON to target
45
- 3. Import: npm run db:import -- data.json
16
+ console.log(`
17
+ sqlew db:import - Import project data from JSON export
18
+
19
+ USAGE:
20
+ npm run db:import -- <source-file> [key=value ...]
21
+
22
+ ARGUMENTS:
23
+ <source-file> JSON export file (required)
24
+
25
+ OPTIONS (use key=value format):
26
+ project-name=<name> Target project name (default: from JSON)
27
+ skip-if-exists=true Skip if project exists (default: true)
28
+ dry-run=true Validate only, don't import
29
+ db-path=<path> SQLite database path
30
+ config=<path> Config file path
31
+
32
+ EXAMPLES:
33
+ # Import from JSON
34
+ npm run db:import -- data.json
35
+
36
+ # Import with custom project name
37
+ npm run db:import -- data.json project-name=newproject
38
+
39
+ # Dry run validation
40
+ npm run db:import -- data.json dry-run=true
41
+
42
+ WORKFLOW:
43
+ 1. Export: npm run db:export -- data.json project=myproject
44
+ 2. Copy JSON to target
45
+ 3. Import: npm run db:import -- data.json
46
46
  `);
47
47
  }
48
48
  /**
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Codex transcript helpers for Plan-to-ADR extraction.
3
+ *
4
+ * Codex stores session rollouts as JSONL under ~/.codex/sessions/ rather than
5
+ * a dedicated plan.md file. These helpers locate the transcript and extract
6
+ * assistant plan text written during collaboration Plan mode.
7
+ *
8
+ * @since v5.2.1
9
+ */
10
+ /**
11
+ * Recursively search ~/.codex/sessions for a rollout JSONL ending with sessionId.
12
+ */
13
+ export declare function findCodexTranscriptPath(sessionId: string): string | null;
14
+ /**
15
+ * Extract assistant plan text from a Codex rollout JSONL transcript.
16
+ * Returns concatenated assistant output from turns that ran in Plan mode.
17
+ */
18
+ export declare function extractPlanMarkdownFromCodexTranscript(transcriptPath: string): string | null;
19
+ /**
20
+ * Write extracted Codex plan text to a project-local temp markdown file.
21
+ */
22
+ export declare function materializeCodexPlanFile(projectPath: string, sessionId: string, content: string): string;
23
+ //# sourceMappingURL=codex-transcript.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex-transcript.d.ts","sourceRoot":"","sources":["../../../src/cli/hooks/codex-transcript.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAYxE;AAoCD;;;GAGG;AACH,wBAAgB,sCAAsC,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAoE5F;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAOxG"}