sqlew 5.0.7 → 5.0.8

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.
@@ -55,96 +55,9 @@ user = "sqlew_user"
55
55
  password = "your_password"
56
56
  ```
57
57
 
58
- ## Database-Specific Differences
59
-
60
- ### String Aggregation
61
-
62
- | Database | Function |
63
- |----------|----------|
64
- | SQLite | `GROUP_CONCAT(column)` |
65
- | MySQL | `GROUP_CONCAT(column)` |
66
- | MariaDB | `GROUP_CONCAT(column)` |
67
- | PostgreSQL | `string_agg(column, ',')` |
68
-
69
- sqlew automatically detects the database type and uses the appropriate function.
70
-
71
- ### GROUP BY Strictness
72
-
73
- PostgreSQL enforces strict GROUP BY rules:
74
- - All non-aggregated SELECT columns must appear in GROUP BY
75
- - MySQL/MariaDB/SQLite are more lenient
76
-
77
- sqlew includes all necessary columns in GROUP BY for cross-database compatibility.
78
-
79
- ### Example Query Difference
80
-
81
- **MySQL/SQLite:**
82
- ```sql
83
- SELECT d.key_id, ck.key_name, GROUP_CONCAT(t.name) as tags
84
- FROM v4_decisions d
85
- JOIN v4_context_keys ck ON d.key_id = ck.id
86
- GROUP BY d.key_id
87
- ```
88
-
89
- **PostgreSQL:**
90
- ```sql
91
- SELECT d.key_id, ck.key_name, string_agg(t.name, ',') as tags
92
- FROM v4_decisions d
93
- JOIN v4_context_keys ck ON d.key_id = ck.id
94
- GROUP BY d.key_id, ck.key_name
95
- ```
96
-
97
58
  ## Data Migration
98
59
 
99
- ### Cross-Database Migration
100
-
101
- Use JSON export/import for migrating between database types:
102
-
103
- ```bash
104
- # Export from source database
105
- sqlew db:export backup.json
106
-
107
- # Import to target database (after changing config)
108
- sqlew db:import backup.json
109
- ```
110
-
111
- **Note:** SQL dump (`db:dump`) is for same-database-type operations only.
112
-
113
- ### Export Options
114
-
115
- ```bash
116
- # Export all data
117
- sqlew db:export full-backup.json
118
-
119
- # Export with version tracking
120
- sqlew db:export --version 4.1.0 backup.json
121
- ```
122
-
123
- ## Adapter Implementation
124
-
125
- Database adapters are located in `src/adapters/`:
126
-
127
- | File | Purpose |
128
- |------|---------|
129
- | `sqlite-adapter.ts` | SQLite (better-sqlite3) |
130
- | `mysql-adapter.ts` | MySQL/MariaDB (mysql2) |
131
- | `postgresql-adapter.ts` | PostgreSQL (pg) |
132
-
133
- Each adapter implements the `DatabaseAdapter` interface with database-specific:
134
- - Connection handling
135
- - Transaction management
136
- - String aggregation
137
- - Type conversions
138
-
139
- ## Testing Cross-Database Compatibility
140
-
141
- ```bash
142
- # Run tests on all configured databases
143
- npm run test:cross-db
144
-
145
- # Run tests on specific database
146
- DB_TYPE=postgres npm test
147
- ```
60
+ See [CLI Usage Guide](CLI_USAGE.md#cross-database-migration) for export/import commands and step-by-step migration procedures.
148
61
 
149
62
  ## Version History
150
63
 
@@ -8,9 +8,6 @@ This document describes the authentication configuration for multi-database supp
8
8
  |--------|--------|-------------|
9
9
  | **Direct (Password)** | ✅ Supported | Standard username/password authentication |
10
10
  | **SSH Tunnel** | ✅ Manual | User-managed SSH port forwarding |
11
- | SSL/TLS Certificates | 🔮 Planned | Client certificate authentication |
12
- | AWS RDS IAM | 🔮 Planned | Token-based authentication for AWS RDS |
13
- | GCP Cloud SQL IAM | 🔮 Planned | Token-based authentication for GCP Cloud SQL |
14
11
 
15
12
  ## Configuration Structure
16
13
 
@@ -57,6 +54,30 @@ user = "mysql_user"
57
54
  password = "your-password"
58
55
  ```
59
56
 
57
+ ## Managed Database (Recommended)
58
+
59
+ For environments that require SSL/TLS encryption, IAM authentication, or managed scaling, use the sqlew cloud backend instead of configuring these locally.
60
+
61
+ The cloud backend handles authentication, encryption, and scaling — no local database administration needed.
62
+
63
+ ### Setup
64
+
65
+ 1. Obtain an API key from the [sqlew dashboard](https://sqlew.io)
66
+
67
+ 2. Save the key to `~/.sqlew.env`:
68
+ ```bash
69
+ echo 'SQLEW_API_KEY=sk-your-api-key' >> ~/.sqlew.env
70
+ chmod 600 ~/.sqlew.env # Unix only
71
+ ```
72
+
73
+ 3. Set database type in `.sqlew/config.toml`:
74
+ ```toml
75
+ [database]
76
+ type = "cloud"
77
+ ```
78
+
79
+ See [Configuration Guide](./CONFIGURATION.md) for full environment variable details.
80
+
60
81
  ## SSH Tunnel (Manual Setup)
61
82
 
62
83
  **SSH tunneling is NOT built into sqlew.** Set up tunnels manually before connecting.
@@ -100,15 +121,6 @@ password = "db-password"
100
121
  - `user`: Required
101
122
  - `password`: Required
102
123
 
103
- ## Error Handling
104
-
105
- ```
106
- ⚠️ Configuration validation failed: .sqlew/config.toml
107
- - database.connection.host is required
108
- - database.auth.user is required for direct authentication
109
- Using default configuration
110
- ```
111
-
112
124
  ## Security Best Practices
113
125
 
114
126
  1. **Never commit passwords** - Don't commit config.toml with passwords to git
@@ -117,41 +129,6 @@ password = "db-password"
117
129
 
118
130
  ---
119
131
 
120
- ## Future Authentication Methods
121
-
122
- > **Status**: Planned for future releases. If you need these features, please [open an issue](https://github.com/sqlew-io/sqlew/issues) - we'll prioritize based on demand!
123
-
124
- ### SSL/TLS Client Certificates
125
-
126
- ```toml
127
- # PLANNED - Not yet implemented
128
- [database.auth.ssl]
129
- ca = "/path/to/ca-cert.pem"
130
- cert = "/path/to/client-cert.pem"
131
- key = "/path/to/client-key.pem"
132
- rejectUnauthorized = true
133
- ```
134
-
135
- ### AWS RDS IAM Authentication
136
-
137
- ```toml
138
- # PLANNED - Not yet implemented
139
- [database.auth]
140
- type = "aws-iam"
141
- region = "us-east-1"
142
- ```
143
-
144
- ### GCP Cloud SQL IAM Authentication
145
-
146
- ```toml
147
- # PLANNED - Not yet implemented
148
- [database.auth]
149
- type = "gcp-iam"
150
- project = "my-project"
151
- ```
152
-
153
- ---
154
-
155
132
  ## Related Documentation
156
133
 
157
134
  - [Configuration Guide](./CONFIGURATION.md)
@@ -1,139 +1,67 @@
1
- # Claude Code Hooks Guide
1
+ # Plugin Installation
2
2
 
3
- Integration guide for sqlew with Claude Code hooks.
3
+ sqlew integrates with AI coding assistants through plugins.
4
4
 
5
- ## Overview
5
+ ## Prerequisites
6
6
 
7
- sqlew integrates with Claude Code through PreToolUse and PostToolUse hooks, enabling **Plan-to-ADR** (v4.3.0+): automatic Architecture Decision Record generation during AI-assisted development.
7
+ Install the sqlew MCP server globally:
8
8
 
9
- ## Architecture
10
-
11
- ```
12
- Claude Code sqlew
13
- │ │
14
- ├─ PreToolUse ──────────────►│ suggest (related decisions)
15
- │ │
16
- ├─ Tool Execution │
17
- │ │
18
- ├─ PostToolUse ─────────────►│ track-plan, save, check-completion
19
- │ │
20
- └─ (Git hooks) ─────────────►│ mark-done (post-merge, post-rewrite)
9
+ ```bash
10
+ npm i -g sqlew
21
11
  ```
22
12
 
23
- ## File Queue Architecture
24
-
25
- Hooks use a file-based queue for async operations:
26
-
27
- 1. **Hook writes to queue** (fast, <100ms)
28
- - Location: `.sqlew/queue/pending.json`
29
- 2. **QueueWatcher detects change** (MCP server)
30
- 3. **Decisions registered in DB** (async)
13
+ ## Claude Code
31
14
 
32
- This architecture ensures zero latency on code edits.
33
-
34
- ## Installation
35
-
36
- As of v5.0.0, hooks are managed by the **sqlew-plugin** (Claude Code Plugin).
15
+ Two commands to install:
37
16
 
38
17
  ```bash
39
- # 1. Add the marketplace
40
- /plugin marketplace add sqlew-io/sqlew-plugin
41
-
42
- # 2. Install the plugin (user-level recommended)
43
- /plugin install sqlew-plugin
44
-
45
- # 3. Restart Claude Code to apply changes
18
+ claude plugin marketplace add sqlew-io/sqlew-plugin
19
+ claude plugin install sqlew
46
20
  ```
47
21
 
48
22
  The plugin automatically configures:
49
- - MCP server settings (`.mcp.json`)
50
- - Claude Code Hooks (PreToolUse/PostToolUse)
51
- - Claude Code Skills (Plan Mode guidance)
52
-
53
- > **Note:** Global Rules are automatically created at `~/.claude/rules/sqlew/` when the MCP server starts.
54
-
55
- ## Hook Commands
56
-
57
- ### PreToolUse Hooks
58
-
59
- | Trigger | Command | Purpose |
60
- |---------|---------|---------|
61
- | Task | `sqlew suggest` | Suggest related decisions before Task creation |
62
- | Write | `sqlew track-plan` | Track plan ID during planning |
63
-
64
- ### PostToolUse Hooks
65
-
66
- | Trigger | Command | Purpose |
67
- |---------|---------|---------|
68
- | Edit, Write | `sqlew save` | Enqueue decision updates |
69
- | TodoWrite | `sqlew check-completion` | Check task completion status |
70
- | ExitPlanMode | `sqlew save` | Save plan state on exit |
71
-
72
- ### Git Hooks
73
-
74
- | Trigger | Command | Purpose |
75
- |---------|---------|---------|
76
- | post-merge | `sqlew mark-done` | Mark decisions as complete after merge |
77
- | post-rewrite | `sqlew mark-done` | Mark decisions as complete after rebase |
78
-
79
- ## Queue File Format
80
-
81
- `.sqlew/queue/pending.json`:
82
-
83
- ```json
84
- {
85
- "items": [
86
- {
87
- "type": "decision",
88
- "action": "update",
89
- "key": "plan/my-feature",
90
- "timestamp": 1703404800000,
91
- "data": {
92
- "value": "in_progress",
93
- "layer": "planning"
94
- }
95
- }
96
- ]
97
- }
98
- ```
23
+ - MCP server settings (`.mcp.json`)
24
+ - Claude Code Hooks (plan tracking, decision extraction)
25
+ - Claude Code Skills (plan mode guidance, PR enrichment)
99
26
 
100
- ## Troubleshooting
27
+ To uninstall:
101
28
 
102
- ### Hooks not triggering
103
-
104
- 1. Verify plugin is installed: `/plugin list`
105
- 2. Check plugin status for errors
106
- 3. Restart Claude Code to reload hooks
29
+ ```bash
30
+ claude plugin remove sqlew
31
+ ```
107
32
 
108
- ### Queue not processing
33
+ Source: https://github.com/sqlew-io/sqlew-plugin
109
34
 
110
- 1. Ensure MCP server is running
111
- 2. Use `queue { action: "list" }` to check pending items
112
- 3. Verify QueueWatcher is active (check debug logs)
35
+ ## Codex
113
36
 
114
- ### Items stuck in queue (High Similarity)
37
+ ```bash
38
+ git clone https://github.com/sqlew-io/sqlew-codex.git
39
+ cp -r sqlew-codex/copy_to_codex_dir/* ~/.codex/
40
+ ```
115
41
 
116
- Items may remain in queue if they have 60%+ similarity to existing decisions:
42
+ Then add to `~/.codex/config.toml`:
117
43
 
118
- 1. **Check queue**: `queue { action: "list" }`
119
- 2. **Search existing**: `/sqlew search for <topic>`
120
- 3. **Remove if duplicate**: `queue { action: "remove", index: N }`
121
- 4. **Or clear all**: `queue { action: "clear" }`
44
+ ```toml
45
+ [mcp_servers.sqlew]
46
+ command = "sqlew"
47
+ args = []
48
+ ```
122
49
 
123
- See `~/.claude/rules/sqlew/queue-monitoring.md` for details.
50
+ To uninstall, remove the copied skill directories and config entries.
124
51
 
125
- ### Debug logging
52
+ Source: https://github.com/sqlew-io/sqlew-codex
126
53
 
127
- Enable debug logging in `.sqlew/config.toml`:
54
+ ## What Gets Configured
128
55
 
129
- ```toml
130
- [debug]
131
- log_path = ".sqlew/debug.log"
132
- log_level = "debug"
133
- ```
56
+ | Feature | Claude Code | Codex |
57
+ |---------|-------------|-------|
58
+ | MCP server | Auto-configured | Manual (config.toml) |
59
+ | Plan-to-ADR | Skills + Hooks | Skills + System prompt |
60
+ | PR enrichment | Skill (sqlew-pr-adr) | Skill (sqlew-pr-adr) |
61
+ | Decision format guidance | Skill (sqlew-decision-format) | Skill (sqlew-decision-format) |
134
62
 
135
63
  ## Version History
136
64
 
137
- - **v5.0.0**: Hooks managed by sqlew-plugin (Claude Code Plugin)
65
+ - **v5.0.0**: Plugin-first architecture (sqlew-plugin for Claude Code, sqlew-codex for Codex)
138
66
  - **v4.3.0**: Plan-to-ADR - Automatic ADR from Plan Mode
139
- - **v4.1.0**: Initial Claude Code Hooks integration with File Queue Architecture
67
+ - **v4.1.0**: Initial Claude Code Hooks integration
@@ -173,4 +173,4 @@ There's a known limitation where constraint-to-tag relationships may not be full
173
173
 
174
174
  - [Configuration Guide](CONFIGURATION.md) - SaaS connection setup
175
175
  - [CLI Reference](cli/README.md) - All export/import commands
176
- - [Upgrade from v4 to v5](MIGRATION_CLEANUP_GUIDE.md) - Plugin migration guide
176
+
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sqlew",
3
3
  "description": "Automated ADR (Architecture Decision Records) for Claude Code - MCP server with SQL-backed decision repository",
4
- "version": "5.0.7",
4
+ "version": "5.0.8",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
7
7
  "bin": {
@@ -1,199 +0,0 @@
1
- # How to Uninstall sqlew
2
-
3
- This guide explains how to completely remove sqlew from your system.
4
-
5
- ---
6
-
7
- ## All Clients (Common Steps)
8
-
9
- These steps apply to all MCP clients (Claude Code, Codex, Gemini CLI, etc.).
10
-
11
- ### 1. Remove SaaS Configuration (if using cloud mode)
12
-
13
- If you configured sqlew for SaaS/cloud mode, remove the environment file:
14
-
15
- ```bash
16
- # Windows
17
- del %USERPROFILE%\.sqlew.env
18
-
19
- # macOS / Linux
20
- rm ~/.sqlew.env
21
- ```
22
-
23
- ### 2. Remove Project-Local Data
24
-
25
- Each project may have a `.sqlew/` directory containing:
26
- - `sqlew.db` - Local SQLite database
27
- - `config.toml` - Project configuration
28
- - `queue/` - Hook queue files (pending.json, failed.json)
29
-
30
- ```bash
31
- # In each project directory
32
- rm -rf .sqlew/
33
- ```
34
-
35
- ---
36
-
37
- ## Claude Code
38
-
39
- ### 1. Remove sqlew-plugin (if installed)
40
-
41
- ```bash
42
- # List installed plugins
43
- /plugin list
44
-
45
- # Remove sqlew plugin
46
- /plugin remove sqlew
47
-
48
- # Remove from marketplace (if added)
49
- /plugin marketplace remove sqlew-io/sqlew-plugin
50
- ```
51
-
52
- ### 2. Remove Plugin Repository (if cloned)
53
-
54
- If you cloned the plugin repository locally:
55
-
56
- ```bash
57
- # Windows
58
- rmdir /s /q %USERPROFILE%\.claude\plugins\sqlew-plugin
59
-
60
- # macOS / Linux
61
- rm -rf ~/.claude/plugins/sqlew-plugin
62
- ```
63
-
64
- ### 3. Remove MCP Server Configuration
65
-
66
- Edit your Claude Code MCP settings file:
67
-
68
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
69
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
70
- **Linux**: `~/.config/Claude/claude_desktop_config.json`
71
-
72
- Remove the sqlew entry from `mcpServers`:
73
-
74
- ```json
75
- {
76
- "mcpServers": {
77
- "sqlew": { ... } // ← Delete this entire block
78
- }
79
- }
80
- ```
81
-
82
- ### 4. Remove Injected CLAUDE.md Section
83
-
84
- sqlew automatically injects a section into `~/.claude/CLAUDE.md`. Remove it manually:
85
-
86
- 1. Open `~/.claude/CLAUDE.md` in your editor
87
- 2. Find and delete the section between these markers:
88
-
89
- ```markdown
90
- <!-- sqlew:auto-injected:start -->
91
- ...
92
- <!-- sqlew:auto-injected:end -->
93
- ```
94
-
95
- **Quick removal (Unix/macOS/WSL):**
96
-
97
- ```bash
98
- # Backup first
99
- cp ~/.claude/CLAUDE.md ~/.claude/CLAUDE.md.bak
100
-
101
- # Remove injected section using sed
102
- sed -i '/<!-- sqlew:auto-injected:start -->/,/<!-- sqlew:auto-injected:end -->/d' ~/.claude/CLAUDE.md
103
- ```
104
-
105
- **Quick removal (Windows PowerShell):**
106
-
107
- ```powershell
108
- # Backup first
109
- Copy-Item "$env:USERPROFILE\.claude\CLAUDE.md" "$env:USERPROFILE\.claude\CLAUDE.md.bak"
110
-
111
- # Remove injected section
112
- $content = Get-Content "$env:USERPROFILE\.claude\CLAUDE.md" -Raw
113
- $content = $content -replace '(?s)<!-- sqlew:auto-injected:start -->.*?<!-- sqlew:auto-injected:end -->\r?\n?', ''
114
- Set-Content "$env:USERPROFILE\.claude\CLAUDE.md" $content
115
- ```
116
-
117
- ### 5. Remove Global Rules (Legacy v5.0.0)
118
-
119
- If you used sqlew v5.0.0 (before v5.0.0), rules were copied to `~/.claude/rules/sqlew/`:
120
-
121
- ```bash
122
- # Windows
123
- rmdir /s /q %USERPROFILE%\.claude\rules\sqlew
124
-
125
- # macOS / Linux
126
- rm -rf ~/.claude/rules/sqlew
127
- ```
128
-
129
- ---
130
-
131
- ## Codex / Gemini CLI / Other Clients
132
-
133
- ### 1. Remove MCP Server Configuration
134
-
135
- Remove sqlew from your client's MCP configuration file. The location varies by client:
136
-
137
- - **Codex**: Check Codex documentation for MCP config location
138
- - **Gemini CLI**: Check Gemini CLI documentation for MCP config location
139
-
140
- ### 2. Remove Client-Specific Injections (if any)
141
-
142
- Future versions may inject into client-specific configuration files. Check for sqlew markers:
143
-
144
- ```
145
- <!-- sqlew:auto-injected:start -->
146
- ...
147
- <!-- sqlew:auto-injected:end -->
148
- ```
149
-
150
- ---
151
-
152
- ## npm Package Removal
153
-
154
- ### Uninstall Global Package
155
-
156
- If installed globally:
157
-
158
- ```bash
159
- npm uninstall -g sqlew
160
- # or
161
- npm uninstall -g mcp-sqlew
162
- ```
163
-
164
- ### Remove npm link (Development)
165
-
166
- If you used `npm link` for local development:
167
-
168
- ```bash
169
- # In the mcp-sqlew project directory
170
- npm unlink
171
-
172
- # Remove global symlink
173
- npm unlink -g sqlew
174
- ```
175
-
176
- ---
177
-
178
- ## Verification
179
-
180
- After uninstalling, verify removal:
181
-
182
- ```bash
183
- # Check if sqlew command is available (should fail)
184
- sqlew --version
185
-
186
- # Check if MCP server is removed
187
- # Restart your MCP client and verify no sqlew tools appear
188
- ```
189
-
190
- ---
191
-
192
- ## Reinstallation
193
-
194
- To reinstall sqlew:
195
-
196
- 1. **Recommended (Plugin)**: `/plugin marketplace add sqlew-io/sqlew-plugin`
197
- 2. **Manual (MCP)**: Add sqlew to your MCP configuration
198
-
199
- See [README.md](../README.md) for installation instructions.