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
package/README.md CHANGED
@@ -1,190 +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
- #### Manual
62
-
63
- Add to `.mcp.json` in your project root:
64
-
65
- ```json
66
- {
67
- "mcpServers": {
68
- "sqlew": {
69
- "command": "sqlew"
70
- }
71
- }
72
- }
73
- ```
74
-
75
- The database (`~/.config/sqlew/sqlew-shared.db`) and config are auto-created on first run. See [Shared Database](docs/SHARED_DATABASE.md) for details.
76
-
77
- ### 3. Just use Plan Mode!
78
-
79
- That's it. Every time you create a plan and get user approval, your architectural decisions are **automatically recorded**.
80
-
81
- No special commands needed — just plan your work normally, and sqlew captures the decisions in the background.
82
-
83
- ## Features
84
-
85
- - **Structured Records** — Decisions stored as relational data with metadata, tags, layers, and version history
86
- - **Fast Queries** — 2-50ms retrieval via SQL, even with thousands of decisions
87
- - **Duplicate Detection** — Three-tier similarity scoring (0-100) prevents redundant decisions
88
- - **Constraint Tracking** — Architectural rules and principles as first-class entities
89
- - **Auto-Capture** — Hooks automatically record decisions from Plan Mode (Claude Code plugin)
90
- - **Multi-Database** SQLite (default), PostgreSQL, MySQL/MariaDB, or Cloud
91
- - **Git Worktree Ready** — Each worktree shares the same context database
92
-
93
- ## For Teams (sqlew.io)
94
-
95
- Connect to [sqlew.io](https://sqlew.io) for team-shared decisions:
96
-
97
- **Step 1: Get your API key**
98
-
99
- Visit [sqlew.io](https://sqlew.io) and save your API key:
100
-
101
- ```bash
102
- # ~/.config/sqlew/.sqlew.env (shared across all projects)
103
- SQLEW_API_KEY=your-api-key
104
- ```
105
-
106
- **Step 2: Configure each project**
107
-
108
- ```toml
109
- # .sqlew/config.toml
110
- [database]
111
- type = "cloud"
112
-
113
- [project]
114
- name = "your-project-name"
115
- ```
116
-
117
- **Benefits:**
118
- - All team members share the same decision database
119
- - Works seamlessly with Git worktree workflows
120
- - No local database setup required
121
-
122
- ## Performance
123
-
124
- | Metric | Value |
125
- |--------|-------|
126
- | Query speed | 2-50ms |
127
- | Concurrent agents | 5+ simultaneous |
128
- | Storage efficiency | ~140 bytes/decision |
129
- | Token savings | 60-75% vs Markdown ADRs |
130
-
131
- ## Use Cases
132
-
133
- - **Architecture Evolution** Document major decisions with full context and alternatives considered
134
- - **Pattern Standardization** Establish coding patterns as constraints, enforce via AI code generation
135
- - **Cross-Session Continuity** AI maintains context across days/weeks without re-reading docs
136
- - **Multi-Agent Coordination** — Multiple AI agents share architectural understanding
137
- - **Onboarding Acceleration** — New AI sessions instantly understand project history
138
-
139
- ## Documentation
140
-
141
- | Guide | Description |
142
- |-------|-------------|
143
- | [ADR Concepts](docs/ADR_CONCEPTS.md) | Architecture Decision Records explained |
144
- | [Configuration](docs/CONFIGURATION.md) | Config file setup, database options |
145
- | [Hooks Guide](docs/HOOKS_GUIDE.md) | Claude Code Hooks integration |
146
- | [Cross Database](docs/CROSS_DATABASE.md) | Multi-database support |
147
- | [CLI Usage](docs/CLI_USAGE.md) | Database migration, export/import |
148
-
149
- ### Upgrade Guides
150
-
151
- - [Migrating to SaaS](docs/MIGRATION_TO_SAAS.md) Export local data to sqlew.io cloud
152
-
153
-
154
- ### MCP Tools
155
-
156
- 7 action-based tools: `decision`, `constraint`, `suggest`, `help`, `example`, `use_case`, `queue`
157
-
158
- All tools support `action: "help"` for documentation.
159
-
160
- ## Support
161
-
162
- Support development via [GitHub Sponsors](https://github.com/sponsors/sqlew-io).
163
-
164
- ## Version
165
-
166
- Current version: **5.0.8**
167
-
168
- See [CHANGELOG.md](CHANGELOG.md) for release history.
169
-
170
- **What's New in v5.0.8:**
171
-
172
- - **PR ADR enforcement** — PreToolUse Hook blocks `gh pr create` without ADR markers, file-grouped format
173
- - **Codex CLI support** Works beyond Claude Code via [sqlew-codex](https://github.com/sqlew-io/sqlew-codex)
174
- - **Plugin-first architecture** — Simplified setup via sqlew-plugin
175
- - **Cloud backend** — Connect to [sqlew.io](https://sqlew.io) for team-shared decisions
176
-
177
- ## License
178
-
179
- Apache License 2.0 — Free for commercial and personal use. See [LICENSE](LICENSE) for details.
180
-
181
- ## Links
182
-
183
- - [npm package](https://www.npmjs.com/package/sqlew)
184
- - [GitHub](https://github.com/sqlew-io/sqlew)
185
- - [Issues](https://github.com/sqlew-io/sqlew/issues)
186
- - [Model Context Protocol](https://modelcontextprotocol.io/)
187
-
188
- ---
189
-
190
- 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"}