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,157 +1,157 @@
1
- # Configuration Guide
2
-
3
- Complete guide to configuring sqlew via config files, CLI arguments, and environment variables.
4
-
5
- ## Configuration Priority
6
-
7
- Settings are applied in this order (highest to lowest):
8
-
9
- ```
10
- 1. CLI Arguments (--db-path, --project-name, etc.)
11
- 2. Environment Variables (SQLEW_API_KEY, SQLEW_DEBUG)
12
- 3. Config File (.sqlew/config.toml)
13
- 4. Code Defaults (DEFAULT_CONFIG in types.ts)
14
- ```
15
-
16
- ## Config File (.sqlew/config.toml)
17
-
18
- **Location:** `.sqlew/config.toml` (relative to project root)
19
-
20
- **Format:** [TOML](https://toml.io/)
21
-
22
- **Custom path:** `--config=path/to/config.toml` or `--config-path=path/to/config.toml`
23
-
24
- **Worktree support (v4.1.0+):** Each git worktree can have its own `.sqlew/config.toml`.
25
-
26
- **Template:** Copy from `.sqlew/config.example.toml` and customize.
27
-
28
- ---
29
-
30
- ## [project] — Project Settings
31
-
32
- ```toml
33
- [project]
34
- name = "my-project" # Required. Alphanumeric, hyphens, underscores. Max 64 chars.
35
- display_name = "My Project" # Optional. Human-readable name (spaces allowed).
36
- ```
37
-
38
- - `name` is auto-detected on first run and written to config.toml. Once set, it becomes the permanent project identifier.
39
- - Changing `name` requires MCP server restart.
40
-
41
- ## [database] — Database Settings
42
-
43
- ### SQLite (Default)
44
-
45
- As of v5.1.0, the default database is `~/.config/sqlew/sqlew-shared.db` (shared). To override with a project-local database:
46
-
47
- ```toml
48
- [database]
49
- path = ".sqlew/sqlew.db" # Relative to project root, or absolute path
50
- ```
51
-
52
- See [Shared Database](./SHARED_DATABASE.md) for migration guide and details.
53
-
54
- ### PostgreSQL / MySQL / MariaDB
55
-
56
- ```toml
57
- [database]
58
- type = "postgres" # "postgres" | "mysql"
59
-
60
- [database.connection]
61
- host = "localhost"
62
- port = 5432 # PostgreSQL: 5432, MySQL: 3306
63
- database = "sqlew" # Must already exist
64
-
65
- [database.auth]
66
- type = "direct"
67
- user = "postgres"
68
- password = "your-password"
69
- ```
70
-
71
- For detailed authentication options (SSH tunnel, SSL, validation rules), see [DATABASE_AUTH.md](./DATABASE_AUTH.md).
72
-
73
- ### Cloud Backend
74
-
75
- ```toml
76
- [database]
77
- type = "cloud"
78
- ```
79
-
80
- Requires `SQLEW_API_KEY` (see [Environment Variables](#environment-variables)).
81
-
82
- Authentication, encryption, and scaling are managed by the sqlew cloud service — no local database setup needed.
83
-
84
- ## [debug] — Debug Logging
85
-
86
- ```toml
87
- [debug]
88
- log_path = ".sqlew/debug.log" # Optional. Enables debug logging when set.
89
- log_level = "info" # "error" | "warn" | "info" | "debug" (case-insensitive)
90
- ```
91
-
92
- Priority for log path: CLI `--debug-log` > env `SQLEW_DEBUG` > config `debug.log_path`.
93
-
94
- Log levels (from least to most verbose):
95
- - **error** — Only errors
96
- - **warn** — Errors and warnings
97
- - **info** — Errors, warnings, and informational messages (default)
98
- - **debug** — All messages including detailed debug output
99
-
100
- ---
101
-
102
- ## CLI Arguments
103
-
104
- All arguments support both `--arg=value` and `--arg value` syntax.
105
-
106
- | Argument | Description |
107
- |----------|-------------|
108
- | `--config=<path>` | Path to config.toml file |
109
- | `--config-path=<path>` | Alias for `--config` |
110
- | `--db-path=<path>` | SQLite database file path |
111
- | `--project-name=<name>` | Project name (overrides auto-detection) |
112
- | `--autodelete-ignore-weekend` | Enable weekend-aware auto-deletion |
113
- | `--autodelete-message-hours=<N>` | Message retention hours |
114
- | `--autodelete-file-history-days=<N>` | File history retention days |
115
- | `--debug-log=<path>` | Debug log file path |
116
-
117
- **Backward compatibility:** First non-flag argument is treated as `--db-path`.
118
-
119
- ```bash
120
- # Examples
121
- node dist/index.js --db-path=.sqlew/custom.db
122
- node dist/index.js --project-name=my-app --debug-log=./debug.log
123
- node dist/index.js --autodelete-ignore-weekend --autodelete-message-hours=48
124
- ```
125
-
126
- ## Environment Variables
127
-
128
- | Variable | Description | Source |
129
- |----------|-------------|--------|
130
- | `SQLEW_API_KEY` | API key for cloud backend (`database.type = "cloud"`) | `~/.config/sqlew/.sqlew.env` or environment |
131
- | `SQLEW_DEBUG` | Debug log file path (overrides `debug.log_path` in config) | Environment only |
132
-
133
- ### SQLEW_API_KEY
134
-
135
- Used when `database.type = "cloud"`. Loaded in this priority:
136
-
137
- 1. Environment variable `SQLEW_API_KEY`
138
- 2. `~/.config/sqlew/.sqlew.env` file (key=value format)
139
-
140
- ```bash
141
- # ~/.config/sqlew/.sqlew.env
142
- SQLEW_API_KEY=sk-your-api-key-here
143
- ```
144
-
145
- On Unix systems, ensure `~/.config/sqlew/.sqlew.env` has `600` permissions:
146
-
147
- ```bash
148
- chmod 600 ~/.config/sqlew/.sqlew.env
149
- ```
150
-
151
- ---
152
-
153
- ## Related Documentation
154
-
155
- - [Shared Database](./SHARED_DATABASE.md) — Global shared database, migration guide, per-project override
156
- - [Database Authentication](./DATABASE_AUTH.md) — Detailed auth config (SSH tunnel, validation rules, security)
157
- - [Architecture](./ARCHITECTURE.md) — System design overview
1
+ # Configuration Guide
2
+
3
+ Complete guide to configuring sqlew via config files, CLI arguments, and environment variables.
4
+
5
+ ## Configuration Priority
6
+
7
+ Settings are applied in this order (highest to lowest):
8
+
9
+ ```
10
+ 1. CLI Arguments (--db-path, --project-name, etc.)
11
+ 2. Environment Variables (SQLEW_API_KEY, SQLEW_DEBUG)
12
+ 3. Config File (.sqlew/config.toml)
13
+ 4. Code Defaults (DEFAULT_CONFIG in types.ts)
14
+ ```
15
+
16
+ ## Config File (.sqlew/config.toml)
17
+
18
+ **Location:** `.sqlew/config.toml` (relative to project root)
19
+
20
+ **Format:** [TOML](https://toml.io/)
21
+
22
+ **Custom path:** `--config=path/to/config.toml` or `--config-path=path/to/config.toml`
23
+
24
+ **Worktree support (v4.1.0+):** Each git worktree can have its own `.sqlew/config.toml`.
25
+
26
+ **Template:** Copy from `.sqlew/config.example.toml` and customize.
27
+
28
+ ---
29
+
30
+ ## [project] — Project Settings
31
+
32
+ ```toml
33
+ [project]
34
+ name = "my-project" # Required. Alphanumeric, hyphens, underscores. Max 64 chars.
35
+ display_name = "My Project" # Optional. Human-readable name (spaces allowed).
36
+ ```
37
+
38
+ - `name` is auto-detected on first run and written to config.toml. Once set, it becomes the permanent project identifier.
39
+ - Changing `name` requires MCP server restart.
40
+
41
+ ## [database] — Database Settings
42
+
43
+ ### SQLite (Default)
44
+
45
+ As of v5.1.0, the default database is `~/.config/sqlew/sqlew-shared.db` (shared). To override with a project-local database:
46
+
47
+ ```toml
48
+ [database]
49
+ path = ".sqlew/sqlew.db" # Relative to project root, or absolute path
50
+ ```
51
+
52
+ See [Shared Database](./SHARED_DATABASE.md) for migration guide and details.
53
+
54
+ ### PostgreSQL / MySQL / MariaDB
55
+
56
+ ```toml
57
+ [database]
58
+ type = "postgres" # "postgres" | "mysql"
59
+
60
+ [database.connection]
61
+ host = "localhost"
62
+ port = 5432 # PostgreSQL: 5432, MySQL: 3306
63
+ database = "sqlew" # Must already exist
64
+
65
+ [database.auth]
66
+ type = "direct"
67
+ user = "postgres"
68
+ password = "your-password"
69
+ ```
70
+
71
+ For detailed authentication options (SSH tunnel, SSL, validation rules), see [DATABASE_AUTH.md](./DATABASE_AUTH.md).
72
+
73
+ ### Cloud Backend
74
+
75
+ ```toml
76
+ [database]
77
+ type = "cloud"
78
+ ```
79
+
80
+ Requires `SQLEW_API_KEY` (see [Environment Variables](#environment-variables)).
81
+
82
+ Authentication, encryption, and scaling are managed by the sqlew cloud service — no local database setup needed.
83
+
84
+ ## [debug] — Debug Logging
85
+
86
+ ```toml
87
+ [debug]
88
+ log_path = ".sqlew/debug.log" # Optional. Enables debug logging when set.
89
+ log_level = "info" # "error" | "warn" | "info" | "debug" (case-insensitive)
90
+ ```
91
+
92
+ Priority for log path: CLI `--debug-log` > env `SQLEW_DEBUG` > config `debug.log_path`.
93
+
94
+ Log levels (from least to most verbose):
95
+ - **error** — Only errors
96
+ - **warn** — Errors and warnings
97
+ - **info** — Errors, warnings, and informational messages (default)
98
+ - **debug** — All messages including detailed debug output
99
+
100
+ ---
101
+
102
+ ## CLI Arguments
103
+
104
+ All arguments support both `--arg=value` and `--arg value` syntax.
105
+
106
+ | Argument | Description |
107
+ |----------|-------------|
108
+ | `--config=<path>` | Path to config.toml file |
109
+ | `--config-path=<path>` | Alias for `--config` |
110
+ | `--db-path=<path>` | SQLite database file path |
111
+ | `--project-name=<name>` | Project name (overrides auto-detection) |
112
+ | `--autodelete-ignore-weekend` | Enable weekend-aware auto-deletion |
113
+ | `--autodelete-message-hours=<N>` | Message retention hours |
114
+ | `--autodelete-file-history-days=<N>` | File history retention days |
115
+ | `--debug-log=<path>` | Debug log file path |
116
+
117
+ **Backward compatibility:** First non-flag argument is treated as `--db-path`.
118
+
119
+ ```bash
120
+ # Examples
121
+ node dist/index.js --db-path=.sqlew/custom.db
122
+ node dist/index.js --project-name=my-app --debug-log=./debug.log
123
+ node dist/index.js --autodelete-ignore-weekend --autodelete-message-hours=48
124
+ ```
125
+
126
+ ## Environment Variables
127
+
128
+ | Variable | Description | Source |
129
+ |----------|-------------|--------|
130
+ | `SQLEW_API_KEY` | API key for cloud backend (`database.type = "cloud"`) | `~/.config/sqlew/.sqlew.env` or environment |
131
+ | `SQLEW_DEBUG` | Debug log file path (overrides `debug.log_path` in config) | Environment only |
132
+
133
+ ### SQLEW_API_KEY
134
+
135
+ Used when `database.type = "cloud"`. Loaded in this priority:
136
+
137
+ 1. Environment variable `SQLEW_API_KEY`
138
+ 2. `~/.config/sqlew/.sqlew.env` file (key=value format)
139
+
140
+ ```bash
141
+ # ~/.config/sqlew/.sqlew.env
142
+ SQLEW_API_KEY=sk-your-api-key-here
143
+ ```
144
+
145
+ On Unix systems, ensure `~/.config/sqlew/.sqlew.env` has `600` permissions:
146
+
147
+ ```bash
148
+ chmod 600 ~/.config/sqlew/.sqlew.env
149
+ ```
150
+
151
+ ---
152
+
153
+ ## Related Documentation
154
+
155
+ - [Shared Database](./SHARED_DATABASE.md) — Global shared database, migration guide, per-project override
156
+ - [Database Authentication](./DATABASE_AUTH.md) — Detailed auth config (SSH tunnel, validation rules, security)
157
+ - [Architecture](./ARCHITECTURE.md) — System design overview
@@ -1,66 +1,66 @@
1
- # Cross-Database Compatibility
2
-
3
- sqlew supports multiple database backends with unified query behavior.
4
-
5
- ## Supported Databases
6
-
7
- | Database | Version | Status |
8
- |----------|---------|--------|
9
- | SQLite | 3.x | Primary (default) |
10
- | MySQL | 8.0+ | Supported |
11
- | MariaDB | 10.5+ | Supported |
12
- | PostgreSQL | 12+ | Supported |
13
-
14
- ## Configuration
15
-
16
- ### SQLite (Default)
17
-
18
- ```toml
19
- [database]
20
- type = "sqlite"
21
- path = ".sqlew/sqlew.db"
22
- ```
23
-
24
- ### MySQL / MariaDB
25
-
26
- ```toml
27
- [database]
28
- type = "mysql" # or "mariadb"
29
-
30
- [database.connection]
31
- host = "localhost"
32
- port = 3306
33
- database = "sqlew"
34
-
35
- [database.auth]
36
- type = "direct"
37
- user = "sqlew_user"
38
- password = "your_password"
39
- ```
40
-
41
- ### PostgreSQL
42
-
43
- ```toml
44
- [database]
45
- type = "postgres"
46
-
47
- [database.connection]
48
- host = "localhost"
49
- port = 5432
50
- database = "sqlew"
51
-
52
- [database.auth]
53
- type = "direct"
54
- user = "sqlew_user"
55
- password = "your_password"
56
- ```
57
-
58
- ## Data Migration
59
-
60
- See [CLI Usage Guide](CLI_USAGE.md#cross-database-migration) for export/import commands and step-by-step migration procedures.
61
-
62
- ## Version History
63
-
64
- - **v4.1.0**: PostgreSQL compatibility fixes (string_agg, GROUP BY)
65
- - **v4.0.2**: JSON-only cross-database migration
66
- - **v3.7.0**: Multi-database adapter architecture
1
+ # Cross-Database Compatibility
2
+
3
+ sqlew supports multiple database backends with unified query behavior.
4
+
5
+ ## Supported Databases
6
+
7
+ | Database | Version | Status |
8
+ |----------|---------|--------|
9
+ | SQLite | 3.x | Primary (default) |
10
+ | MySQL | 8.0+ | Supported |
11
+ | MariaDB | 10.5+ | Supported |
12
+ | PostgreSQL | 12+ | Supported |
13
+
14
+ ## Configuration
15
+
16
+ ### SQLite (Default)
17
+
18
+ ```toml
19
+ [database]
20
+ type = "sqlite"
21
+ path = ".sqlew/sqlew.db"
22
+ ```
23
+
24
+ ### MySQL / MariaDB
25
+
26
+ ```toml
27
+ [database]
28
+ type = "mysql" # or "mariadb"
29
+
30
+ [database.connection]
31
+ host = "localhost"
32
+ port = 3306
33
+ database = "sqlew"
34
+
35
+ [database.auth]
36
+ type = "direct"
37
+ user = "sqlew_user"
38
+ password = "your_password"
39
+ ```
40
+
41
+ ### PostgreSQL
42
+
43
+ ```toml
44
+ [database]
45
+ type = "postgres"
46
+
47
+ [database.connection]
48
+ host = "localhost"
49
+ port = 5432
50
+ database = "sqlew"
51
+
52
+ [database.auth]
53
+ type = "direct"
54
+ user = "sqlew_user"
55
+ password = "your_password"
56
+ ```
57
+
58
+ ## Data Migration
59
+
60
+ See [CLI Usage Guide](CLI_USAGE.md#cross-database-migration) for export/import commands and step-by-step migration procedures.
61
+
62
+ ## Version History
63
+
64
+ - **v4.1.0**: PostgreSQL compatibility fixes (string_agg, GROUP BY)
65
+ - **v4.0.2**: JSON-only cross-database migration
66
+ - **v3.7.0**: Multi-database adapter architecture