sqlew 5.1.0 → 5.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/CHANGELOG.md +2140 -2081
  2. package/LICENSE +190 -190
  3. package/NOTICE +24 -24
  4. package/README.md +204 -190
  5. package/dist/adapters/mysql-adapter.js +3 -3
  6. package/dist/adapters/postgresql-adapter.js +3 -3
  7. package/dist/cli/db-export.js +32 -32
  8. package/dist/cli/db-import.js +30 -30
  9. package/dist/cli/hooks/codex-transcript.d.ts +23 -0
  10. package/dist/cli/hooks/codex-transcript.d.ts.map +1 -0
  11. package/dist/cli/hooks/codex-transcript.js +134 -0
  12. package/dist/cli/hooks/codex-transcript.js.map +1 -0
  13. package/dist/cli/hooks/on-exit-plan.d.ts.map +1 -1
  14. package/dist/cli/hooks/on-exit-plan.js +72 -4
  15. package/dist/cli/hooks/on-exit-plan.js.map +1 -1
  16. package/dist/cli/hooks/on-prompt.d.ts.map +1 -1
  17. package/dist/cli/hooks/on-prompt.js +38 -16
  18. package/dist/cli/hooks/on-prompt.js.map +1 -1
  19. package/dist/cli/hooks/plan-processor.d.ts.map +1 -1
  20. package/dist/cli/hooks/plan-processor.js +16 -2
  21. package/dist/cli/hooks/plan-processor.js.map +1 -1
  22. package/dist/cli/hooks/pr-adr.js +5 -5
  23. package/dist/cli/hooks/stdin-parser.d.ts +43 -0
  24. package/dist/cli/hooks/stdin-parser.d.ts.map +1 -1
  25. package/dist/cli/hooks/stdin-parser.js +212 -6
  26. package/dist/cli/hooks/stdin-parser.js.map +1 -1
  27. package/dist/cli/hooks/track-plan.d.ts +13 -0
  28. package/dist/cli/hooks/track-plan.d.ts.map +1 -1
  29. package/dist/cli/hooks/track-plan.js +73 -18
  30. package/dist/cli/hooks/track-plan.js.map +1 -1
  31. package/dist/cli.js +48 -48
  32. package/dist/config/global-config.d.ts +7 -1
  33. package/dist/config/global-config.d.ts.map +1 -1
  34. package/dist/config/global-config.js +5 -26
  35. package/dist/config/global-config.js.map +1 -1
  36. package/dist/database/migrations/v4/20251126000000_v4_bootstrap.js +32 -32
  37. package/dist/database/migrations/v4/20251126000001_v4_migrate_data.d.ts.map +1 -1
  38. package/dist/database/migrations/v4/20251126000001_v4_migrate_data.js +2 -1
  39. package/dist/database/migrations/v4/20251126000001_v4_migrate_data.js.map +1 -1
  40. package/dist/database/migrations/v4/20260102204000_v4_fix_decision_set_example.js +3 -3
  41. package/dist/help-data/constraint.toml +259 -259
  42. package/dist/help-data/decision.toml +845 -845
  43. package/dist/help-data/queue.toml +134 -134
  44. package/dist/server/tool-schemas.js +30 -30
  45. package/dist/tests/docker/native/db-init.js +9 -9
  46. package/dist/tests/unit/hooks/codex-hook-normalization.test.d.ts +7 -0
  47. package/dist/tests/unit/hooks/codex-hook-normalization.test.d.ts.map +1 -0
  48. package/dist/tests/unit/hooks/codex-hook-normalization.test.js +112 -0
  49. package/dist/tests/unit/hooks/codex-hook-normalization.test.js.map +1 -0
  50. package/dist/tests/unit/hooks/grok-hook-normalization.test.d.ts +9 -0
  51. package/dist/tests/unit/hooks/grok-hook-normalization.test.d.ts.map +1 -0
  52. package/dist/tests/unit/hooks/grok-hook-normalization.test.js +136 -0
  53. package/dist/tests/unit/hooks/grok-hook-normalization.test.js.map +1 -0
  54. package/dist/tests/unit/hooks/grok-plan-template-injection.test.d.ts +7 -0
  55. package/dist/tests/unit/hooks/grok-plan-template-injection.test.d.ts.map +1 -0
  56. package/dist/tests/unit/hooks/grok-plan-template-injection.test.js +55 -0
  57. package/dist/tests/unit/hooks/grok-plan-template-injection.test.js.map +1 -0
  58. package/dist/tests/utils/db-schema.js +48 -48
  59. package/dist/tests/utils/test-helpers.js +48 -48
  60. package/dist/tools/constraints/actions/get.js +5 -5
  61. package/dist/utils/path-normalize.d.ts +23 -0
  62. package/dist/utils/path-normalize.d.ts.map +1 -0
  63. package/dist/utils/path-normalize.js +38 -0
  64. package/dist/utils/path-normalize.js.map +1 -0
  65. package/dist/utils/project-root.d.ts +7 -3
  66. package/dist/utils/project-root.d.ts.map +1 -1
  67. package/dist/utils/project-root.js +17 -3
  68. package/dist/utils/project-root.js.map +1 -1
  69. package/dist/watcher/base-watcher.d.ts +0 -4
  70. package/dist/watcher/base-watcher.d.ts.map +1 -1
  71. package/dist/watcher/base-watcher.js +11 -22
  72. package/dist/watcher/base-watcher.js.map +1 -1
  73. package/docs/ADR_CONCEPTS.md +152 -152
  74. package/docs/CLI_USAGE.md +392 -392
  75. package/docs/CONFIGURATION.md +157 -157
  76. package/docs/CROSS_DATABASE.md +66 -66
  77. package/docs/DATABASE_AUTH.md +135 -135
  78. package/docs/HOOKS_GUIDE.md +116 -67
  79. package/docs/MIGRATION_TO_SAAS.md +176 -176
  80. package/docs/SHARED_DATABASE.md +108 -108
  81. package/package.json +88 -88
  82. package/scripts/copy-help-data.js +19 -19
  83. package/scripts/filter-test-output.js +78 -78
@@ -1,135 +1,135 @@
1
- # Database Authentication Configuration
2
-
3
- This document describes the authentication configuration for multi-database support in sqlew v4.0.0+.
4
-
5
- ## Supported Authentication
6
-
7
- | Method | Status | Description |
8
- |--------|--------|-------------|
9
- | **Direct (Password)** | ✅ Supported | Standard username/password authentication |
10
- | **SSH Tunnel** | ✅ Manual | User-managed SSH port forwarding |
11
-
12
- ## Configuration Structure
13
-
14
- All configuration is defined in `.sqlew/config.toml`.
15
-
16
- ### SQLite (Default)
17
-
18
- ```toml
19
- [database]
20
- path = ".sqlew/sqlew.db"
21
- ```
22
-
23
- ### PostgreSQL
24
-
25
- ```toml
26
- [database]
27
- type = "postgres"
28
-
29
- [database.connection]
30
- host = "localhost"
31
- port = 5432
32
- database = "sqlew_db"
33
-
34
- [database.auth]
35
- type = "direct"
36
- user = "postgres"
37
- password = "your-password"
38
- ```
39
-
40
- ### MySQL/MariaDB
41
-
42
- ```toml
43
- [database]
44
- type = "mysql"
45
-
46
- [database.connection]
47
- host = "localhost"
48
- port = 3306
49
- database = "sqlew_db"
50
-
51
- [database.auth]
52
- type = "direct"
53
- user = "mysql_user"
54
- password = "your-password"
55
- ```
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 `~/.config/sqlew/.sqlew.env`:
68
- ```bash
69
- echo 'SQLEW_API_KEY=sk-your-api-key' >> ~/.config/sqlew/.sqlew.env
70
- chmod 600 ~/.config/sqlew/.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
-
81
- ## SSH Tunnel (Manual Setup)
82
-
83
- **SSH tunneling is NOT built into sqlew.** Set up tunnels manually before connecting.
84
-
85
- ```bash
86
- # Example: Forward local port 5433 to remote database
87
- ssh -L 5433:db.internal.example.com:5432 user@bastion.example.com
88
- ```
89
-
90
- Then configure sqlew to connect to localhost:
91
-
92
- ```toml
93
- [database]
94
- type = "postgres"
95
-
96
- [database.connection]
97
- host = "localhost" # Tunnel endpoint
98
- port = 5433 # Forwarded port
99
- database = "sqlew_db"
100
-
101
- [database.auth]
102
- type = "direct"
103
- user = "postgres"
104
- password = "db-password"
105
- ```
106
-
107
- **Useful SSH options:**
108
- - `-N`: Don't execute remote command (tunnel only)
109
- - `-f`: Run in background
110
- - `-o ServerAliveInterval=60`: Keep connection alive
111
-
112
- ## Validation Rules
113
-
114
- ### Connection
115
- - `host`: Required for PostgreSQL/MySQL
116
- - `port`: 1-65535
117
- - `database`: Required for PostgreSQL/MySQL
118
-
119
- ### Authentication
120
- - `type`: Must be `direct`
121
- - `user`: Required
122
- - `password`: Required
123
-
124
- ## Security Best Practices
125
-
126
- 1. **Never commit passwords** - Don't commit config.toml with passwords to git
127
- 2. **Use SSH tunnels** - For databases behind firewalls
128
- 3. **Restrict access** - Limit database user permissions
129
-
130
- ---
131
-
132
- ## Related Documentation
133
-
134
- - [Configuration Guide](./CONFIGURATION.md)
135
- - [Cross Database Guide](./CROSS_DATABASE.md)
1
+ # Database Authentication Configuration
2
+
3
+ This document describes the authentication configuration for multi-database support in sqlew v4.0.0+.
4
+
5
+ ## Supported Authentication
6
+
7
+ | Method | Status | Description |
8
+ |--------|--------|-------------|
9
+ | **Direct (Password)** | ✅ Supported | Standard username/password authentication |
10
+ | **SSH Tunnel** | ✅ Manual | User-managed SSH port forwarding |
11
+
12
+ ## Configuration Structure
13
+
14
+ All configuration is defined in `.sqlew/config.toml`.
15
+
16
+ ### SQLite (Default)
17
+
18
+ ```toml
19
+ [database]
20
+ path = ".sqlew/sqlew.db"
21
+ ```
22
+
23
+ ### PostgreSQL
24
+
25
+ ```toml
26
+ [database]
27
+ type = "postgres"
28
+
29
+ [database.connection]
30
+ host = "localhost"
31
+ port = 5432
32
+ database = "sqlew_db"
33
+
34
+ [database.auth]
35
+ type = "direct"
36
+ user = "postgres"
37
+ password = "your-password"
38
+ ```
39
+
40
+ ### MySQL/MariaDB
41
+
42
+ ```toml
43
+ [database]
44
+ type = "mysql"
45
+
46
+ [database.connection]
47
+ host = "localhost"
48
+ port = 3306
49
+ database = "sqlew_db"
50
+
51
+ [database.auth]
52
+ type = "direct"
53
+ user = "mysql_user"
54
+ password = "your-password"
55
+ ```
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 `~/.config/sqlew/.sqlew.env`:
68
+ ```bash
69
+ echo 'SQLEW_API_KEY=sk-your-api-key' >> ~/.config/sqlew/.sqlew.env
70
+ chmod 600 ~/.config/sqlew/.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
+
81
+ ## SSH Tunnel (Manual Setup)
82
+
83
+ **SSH tunneling is NOT built into sqlew.** Set up tunnels manually before connecting.
84
+
85
+ ```bash
86
+ # Example: Forward local port 5433 to remote database
87
+ ssh -L 5433:db.internal.example.com:5432 user@bastion.example.com
88
+ ```
89
+
90
+ Then configure sqlew to connect to localhost:
91
+
92
+ ```toml
93
+ [database]
94
+ type = "postgres"
95
+
96
+ [database.connection]
97
+ host = "localhost" # Tunnel endpoint
98
+ port = 5433 # Forwarded port
99
+ database = "sqlew_db"
100
+
101
+ [database.auth]
102
+ type = "direct"
103
+ user = "postgres"
104
+ password = "db-password"
105
+ ```
106
+
107
+ **Useful SSH options:**
108
+ - `-N`: Don't execute remote command (tunnel only)
109
+ - `-f`: Run in background
110
+ - `-o ServerAliveInterval=60`: Keep connection alive
111
+
112
+ ## Validation Rules
113
+
114
+ ### Connection
115
+ - `host`: Required for PostgreSQL/MySQL
116
+ - `port`: 1-65535
117
+ - `database`: Required for PostgreSQL/MySQL
118
+
119
+ ### Authentication
120
+ - `type`: Must be `direct`
121
+ - `user`: Required
122
+ - `password`: Required
123
+
124
+ ## Security Best Practices
125
+
126
+ 1. **Never commit passwords** - Don't commit config.toml with passwords to git
127
+ 2. **Use SSH tunnels** - For databases behind firewalls
128
+ 3. **Restrict access** - Limit database user permissions
129
+
130
+ ---
131
+
132
+ ## Related Documentation
133
+
134
+ - [Configuration Guide](./CONFIGURATION.md)
135
+ - [Cross Database Guide](./CROSS_DATABASE.md)
@@ -1,67 +1,116 @@
1
- # Plugin Installation
2
-
3
- sqlew integrates with AI coding assistants through plugins.
4
-
5
- ## Prerequisites
6
-
7
- Install the sqlew MCP server globally:
8
-
9
- ```bash
10
- npm i -g sqlew
11
- ```
12
-
13
- ## Claude Code
14
-
15
- Two commands to install:
16
-
17
- ```bash
18
- claude plugin marketplace add sqlew-io/sqlew-plugin
19
- claude plugin install sqlew
20
- ```
21
-
22
- The plugin automatically configures:
23
- - MCP server settings (`.mcp.json`)
24
- - Claude Code Hooks (plan tracking, decision extraction)
25
- - Claude Code Skills (plan mode guidance, PR enrichment)
26
-
27
- To uninstall:
28
-
29
- ```bash
30
- claude plugin remove sqlew
31
- ```
32
-
33
- Source: https://github.com/sqlew-io/sqlew-plugin
34
-
35
- ## Codex
36
-
37
- ```bash
38
- git clone https://github.com/sqlew-io/sqlew-codex.git
39
- cp -r sqlew-codex/copy_to_codex_dir/* ~/.codex/
40
- ```
41
-
42
- Then add to `~/.codex/config.toml`:
43
-
44
- ```toml
45
- [mcp_servers.sqlew]
46
- command = "sqlew"
47
- args = []
48
- ```
49
-
50
- To uninstall, remove the copied skill directories and config entries.
51
-
52
- Source: https://github.com/sqlew-io/sqlew-codex
53
-
54
- ## What Gets Configured
55
-
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) |
62
-
63
- ## Version History
64
-
65
- - **v5.0.0**: Plugin-first architecture (sqlew-plugin for Claude Code, sqlew-codex for Codex)
66
- - **v4.3.0**: Plan-to-ADR - Automatic ADR from Plan Mode
67
- - **v4.1.0**: Initial Claude Code Hooks integration
1
+ # Plugin Installation
2
+
3
+ sqlew integrates with AI coding assistants through plugins.
4
+
5
+ ## Prerequisites
6
+
7
+ Install the sqlew MCP server globally:
8
+
9
+ ```bash
10
+ npm i -g sqlew
11
+ ```
12
+
13
+ ## Claude Code
14
+
15
+ Two commands to install:
16
+
17
+ ```bash
18
+ claude plugin marketplace add sqlew-io/sqlew-plugin
19
+ claude plugin install sqlew
20
+ ```
21
+
22
+ The plugin automatically configures:
23
+ - MCP server settings (`.mcp.json`)
24
+ - Claude Code Hooks (plan tracking, decision extraction)
25
+ - Claude Code Skills (plan mode guidance, PR enrichment)
26
+
27
+ To uninstall:
28
+
29
+ ```bash
30
+ claude plugin remove sqlew
31
+ ```
32
+
33
+ Source: https://github.com/sqlew-io/sqlew-plugin
34
+
35
+ ## Codex
36
+
37
+ ```bash
38
+ npm i -g sqlew
39
+ codex plugin marketplace add sqlew-io/sqlew-plugin
40
+ codex plugin install sqlew --source sqlew-plugin
41
+ ```
42
+
43
+ After install, trust bundled hooks via `/hooks` in Codex.
44
+
45
+ Enable Plan mode when needed:
46
+
47
+ ```toml
48
+ [features]
49
+ collaboration_modes = true
50
+ ```
51
+
52
+ The plugin automatically configures:
53
+ - MCP server settings (`.mcp.json`)
54
+ - Skills (plan mode guidance, decision format, PR ADR)
55
+ - Hooks (plan enforcement, PR ADR guard, decision extraction)
56
+
57
+ To uninstall:
58
+
59
+ ```bash
60
+ codex plugin remove sqlew
61
+ ```
62
+
63
+ **Legacy manual install** (deprecated): see [sqlew-codex-skills](https://github.com/sqlew-io/sqlew-codex-skills).
64
+
65
+ Source: https://github.com/sqlew-io/sqlew-plugin
66
+
67
+ ## Grok Build
68
+
69
+ sqlew-plugin provides unified support for Claude Code and Grok Build (v5.2+).
70
+ No separate adapter is required.
71
+
72
+ ```bash
73
+ npm i -g sqlew
74
+ grok plugin install sqlew-io/sqlew-plugin --trust
75
+ grok plugin update
76
+ ```
77
+
78
+ For local development, install from a cloned directory instead:
79
+
80
+ ```bash
81
+ git clone https://github.com/sqlew-io/sqlew-plugin.git
82
+ grok plugin install ./sqlew-plugin --trust
83
+ ```
84
+
85
+ Verify installation:
86
+
87
+ ```bash
88
+ grok plugin list # sqlew enabled + trusted
89
+ grok inspect # hooks, MCP, skills visible
90
+ ```
91
+
92
+ **Important**:
93
+ - Do NOT register sqlew hooks in `~/.grok/hooks/` (causes double-firing with plugin hooks)
94
+ - Do NOT add `[mcp_servers.sqlew]` to `~/.grok/config.toml` (plugin `.mcp.json` handles MCP)
95
+ - Plan mode guidance uses plugin skills (`sqlew-plan-guidance`, `sqlew-decision-format`), not hook injection
96
+ - Plan-to-ADR extracts `### 📌 Decision:` / `### 🚫 Constraint:` from `plan.md` on `exit_plan_mode`
97
+
98
+ Source: https://github.com/sqlew-io/sqlew-plugin
99
+
100
+ ## What Gets Configured
101
+
102
+ | Feature | Claude Code | Codex | Grok Build |
103
+ |---------|-------------|-------|------------|
104
+ | Install | `claude plugin install` | `codex plugin install` | `grok plugin install` |
105
+ | MCP server | Plugin `.mcp.json` | Plugin `.mcp.json` | Plugin `.mcp.json` |
106
+ | Plan-to-ADR | Skills + Hooks | Skills + Hooks | Skills + Hooks |
107
+ | PR enrichment | Skill + Hook | Skill + Hook | Skill + Hook |
108
+ | Decision format guidance | Skill (sqlew-decision-format) | Skill (sqlew-decision-format) | Skill (sqlew-decision-format) |
109
+
110
+ ## Version History
111
+
112
+ - **v5.2.1**: Codex plugin support via sqlew-plugin (`.codex-plugin`, marketplace, hook normalization, transcript-based plan extraction)
113
+ - **v5.2.0**: Grok Build support via sqlew-plugin (hook normalization, Grok plan path, skills-based plan guidance)
114
+ - **v5.0.0**: Plugin-first architecture (sqlew-plugin for Claude Code; manual sqlew-codex-skills for Codex — now deprecated)
115
+ - **v4.3.0**: Plan-to-ADR - Automatic ADR from Plan Mode
116
+ - **v4.1.0**: Initial Claude Code Hooks integration