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.
- package/CHANGELOG.md +2169 -2110
- package/LICENSE +190 -190
- package/NOTICE +24 -24
- package/README.md +204 -199
- package/dist/adapters/mysql-adapter.js +3 -3
- package/dist/adapters/postgresql-adapter.js +3 -3
- package/dist/cli/db-export.js +32 -32
- package/dist/cli/db-import.js +30 -30
- package/dist/cli/hooks/codex-transcript.d.ts +23 -0
- package/dist/cli/hooks/codex-transcript.d.ts.map +1 -0
- package/dist/cli/hooks/codex-transcript.js +134 -0
- package/dist/cli/hooks/codex-transcript.js.map +1 -0
- package/dist/cli/hooks/on-exit-plan.d.ts.map +1 -1
- package/dist/cli/hooks/on-exit-plan.js +30 -3
- package/dist/cli/hooks/on-exit-plan.js.map +1 -1
- package/dist/cli/hooks/on-prompt.d.ts +2 -2
- package/dist/cli/hooks/on-prompt.d.ts.map +1 -1
- package/dist/cli/hooks/on-prompt.js +33 -16
- package/dist/cli/hooks/on-prompt.js.map +1 -1
- package/dist/cli/hooks/plan-pattern-extractor.d.ts +2 -0
- package/dist/cli/hooks/plan-pattern-extractor.d.ts.map +1 -1
- package/dist/cli/hooks/plan-pattern-extractor.js +1 -0
- package/dist/cli/hooks/plan-pattern-extractor.js.map +1 -1
- package/dist/cli/hooks/plan-processor.d.ts.map +1 -1
- package/dist/cli/hooks/plan-processor.js +1 -0
- package/dist/cli/hooks/plan-processor.js.map +1 -1
- package/dist/cli/hooks/pr-adr.js +5 -5
- package/dist/cli/hooks/stdin-parser.d.ts +4 -2
- package/dist/cli/hooks/stdin-parser.d.ts.map +1 -1
- package/dist/cli/hooks/stdin-parser.js +79 -9
- package/dist/cli/hooks/stdin-parser.js.map +1 -1
- package/dist/cli/hooks/track-plan.js +15 -15
- package/dist/cli.js +48 -48
- package/dist/config/global-config.js +19 -19
- package/dist/database/migrations/v4/20251126000000_v4_bootstrap.js +32 -32
- package/dist/database/migrations/v4/20260102204000_v4_fix_decision_set_example.js +3 -3
- package/dist/database/migrations/v4/20260613000000_add_constraint_reason.d.ts +9 -0
- package/dist/database/migrations/v4/20260613000000_add_constraint_reason.d.ts.map +1 -0
- package/dist/database/migrations/v4/20260613000000_add_constraint_reason.js +31 -0
- package/dist/database/migrations/v4/20260613000000_add_constraint_reason.js.map +1 -0
- package/dist/help-data/constraint.toml +265 -259
- package/dist/help-data/decision.toml +845 -845
- package/dist/help-data/queue.toml +134 -134
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +4 -5
- package/dist/schema.js.map +1 -1
- package/dist/server/tool-schemas.js +30 -30
- package/dist/tests/docker/native/constraint-operations.test.js +38 -0
- package/dist/tests/docker/native/constraint-operations.test.js.map +1 -1
- package/dist/tests/docker/native/db-init.js +9 -9
- package/dist/tests/feature/constraint/reason.test.d.ts +7 -0
- package/dist/tests/feature/constraint/reason.test.d.ts.map +1 -0
- package/dist/tests/feature/constraint/reason.test.js +68 -0
- package/dist/tests/feature/constraint/reason.test.js.map +1 -0
- package/dist/tests/unit/hooks/codex-hook-normalization.test.d.ts +7 -0
- package/dist/tests/unit/hooks/codex-hook-normalization.test.d.ts.map +1 -0
- package/dist/tests/unit/hooks/codex-hook-normalization.test.js +112 -0
- package/dist/tests/unit/hooks/codex-hook-normalization.test.js.map +1 -0
- package/dist/tests/unit/hooks/grok-hook-normalization.test.js +45 -7
- package/dist/tests/unit/hooks/grok-hook-normalization.test.js.map +1 -1
- package/dist/tests/unit/hooks/plan-pattern-extractor.test.d.ts +8 -0
- package/dist/tests/unit/hooks/plan-pattern-extractor.test.d.ts.map +1 -0
- package/dist/tests/unit/hooks/plan-pattern-extractor.test.js +110 -0
- package/dist/tests/unit/hooks/plan-pattern-extractor.test.js.map +1 -0
- package/dist/tests/utils/db-schema.js +48 -48
- package/dist/tests/utils/test-helpers.js +48 -48
- package/dist/tools/constraints/actions/add.d.ts.map +1 -1
- package/dist/tools/constraints/actions/add.js +1 -0
- package/dist/tools/constraints/actions/add.js.map +1 -1
- package/dist/tools/constraints/actions/get.d.ts.map +1 -1
- package/dist/tools/constraints/actions/get.js +9 -7
- package/dist/tools/constraints/actions/get.js.map +1 -1
- package/dist/tools/constraints/help/example.js +1 -1
- package/dist/tools/constraints/help/example.js.map +1 -1
- package/dist/types/constraint/params.d.ts +2 -0
- package/dist/types/constraint/params.d.ts.map +1 -1
- package/dist/types/view-entities.d.ts +1 -0
- package/dist/types/view-entities.d.ts.map +1 -1
- package/dist/utils/action-specs/constraint-specs.d.ts.map +1 -1
- package/dist/utils/action-specs/constraint-specs.js +4 -3
- package/dist/utils/action-specs/constraint-specs.js.map +1 -1
- package/dist/utils/hook-queue.d.ts +2 -0
- package/dist/utils/hook-queue.d.ts.map +1 -1
- package/dist/utils/hook-queue.js.map +1 -1
- package/dist/utils/project-root.d.ts +1 -0
- package/dist/utils/project-root.d.ts.map +1 -1
- package/dist/utils/project-root.js +6 -0
- package/dist/utils/project-root.js.map +1 -1
- package/dist/utils/view-queries.d.ts.map +1 -1
- package/dist/utils/view-queries.js +1 -0
- package/dist/utils/view-queries.js.map +1 -1
- package/dist/watcher/queue-watcher.d.ts.map +1 -1
- package/dist/watcher/queue-watcher.js +1 -0
- package/dist/watcher/queue-watcher.js.map +1 -1
- package/docs/ADR_CONCEPTS.md +152 -152
- package/docs/CLI_USAGE.md +392 -392
- package/docs/CONFIGURATION.md +157 -157
- package/docs/CROSS_DATABASE.md +66 -66
- package/docs/DATABASE_AUTH.md +135 -135
- package/docs/HOOKS_GUIDE.md +116 -101
- package/docs/MIGRATION_TO_SAAS.md +176 -176
- package/docs/SHARED_DATABASE.md +108 -108
- package/package.json +88 -88
- package/scripts/copy-help-data.js +19 -19
- package/scripts/filter-test-output.js +78 -78
- package/dist/tests/docker/native/help-system.test.d.ts +0 -8
- package/dist/tests/docker/native/help-system.test.d.ts.map +0 -1
- package/dist/tests/docker/native/help-system.test.js +0 -508
- package/dist/tests/docker/native/help-system.test.js.map +0 -1
|
@@ -1,176 +1,176 @@
|
|
|
1
|
-
# Migrating Local Data to SaaS
|
|
2
|
-
|
|
3
|
-
This guide explains how to migrate your existing local sqlew data to [sqlew.io](https://sqlew.io) cloud backend.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
┌─────────────────────────────────────────────────┐
|
|
9
|
-
│ Migration Flow │
|
|
10
|
-
├─────────────────────────────────────────────────┤
|
|
11
|
-
│ │
|
|
12
|
-
│ [Local v3.x/v4.x DB] │
|
|
13
|
-
│ │ │
|
|
14
|
-
│ ▼ npm install -g sqlew@latest │
|
|
15
|
-
│ │ │
|
|
16
|
-
│ ▼ sqlew (auto-migration to v5.0+) │
|
|
17
|
-
│ │ │
|
|
18
|
-
│ [Local v5.0+ DB] │
|
|
19
|
-
│ │ │
|
|
20
|
-
│ ▼ npm run db:export -- backup.json │
|
|
21
|
-
│ │ │
|
|
22
|
-
│ [JSON file] │
|
|
23
|
-
│ │ │
|
|
24
|
-
│ ▼ Upload to sqlew.io │
|
|
25
|
-
│ │ │
|
|
26
|
-
│ [SaaS v5.0+] │
|
|
27
|
-
│ │
|
|
28
|
-
└─────────────────────────────────────────────────┘
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Step-by-Step Guide
|
|
32
|
-
|
|
33
|
-
### 1. Update to v5.0+
|
|
34
|
-
|
|
35
|
-
If you're on an older version (v3.x or v4.x), update first:
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
npm install -g sqlew@latest
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### 2. Run Auto-Migration
|
|
42
|
-
|
|
43
|
-
Start the MCP server once. This automatically migrates your database schema:
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
sqlew
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
The migration system:
|
|
50
|
-
- Detects your current schema version
|
|
51
|
-
- Applies all necessary migrations (v3→v4→v5)
|
|
52
|
-
- Preserves your decisions and constraints
|
|
53
|
-
|
|
54
|
-
### 3. Export Your Data
|
|
55
|
-
|
|
56
|
-
Export your local database to JSON format:
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
# From your project directory
|
|
60
|
-
cd your-project
|
|
61
|
-
|
|
62
|
-
# Export to JSON
|
|
63
|
-
npx sqlew db:export backup.json
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
The exported JSON includes:
|
|
67
|
-
- All decisions with full metadata
|
|
68
|
-
- Decision history (version tracking)
|
|
69
|
-
- Decision context (rationale, alternatives, tradeoffs)
|
|
70
|
-
- Constraints with categories and priorities
|
|
71
|
-
- Tags and scopes
|
|
72
|
-
|
|
73
|
-
### 4. Import to SaaS
|
|
74
|
-
|
|
75
|
-
Upload your JSON file via the sqlew.io dashboard:
|
|
76
|
-
|
|
77
|
-
1. Go to [sqlew.io/dashboard/import](https://sqlew.io/dashboard/import)
|
|
78
|
-
2. Select your project (or create a new one)
|
|
79
|
-
3. Upload `backup.json`
|
|
80
|
-
4. Review and confirm the import
|
|
81
|
-
|
|
82
|
-
## Version Compatibility
|
|
83
|
-
|
|
84
|
-
| Source Version | Support | Notes |
|
|
85
|
-
|----------------|---------|-------|
|
|
86
|
-
| **v5.0+** | ✅ Full | Direct export/import |
|
|
87
|
-
| **v4.x** | ✅ Full | Auto-migrated on startup |
|
|
88
|
-
| **v3.7+** | ✅ Full | Auto-migrated on startup |
|
|
89
|
-
| **v3.0-v3.6** | ⚠️ Untested | May work, but not guaranteed |
|
|
90
|
-
|
|
91
|
-
## What Gets Migrated
|
|
92
|
-
|
|
93
|
-
### Preserved Data
|
|
94
|
-
|
|
95
|
-
| Data Type | Migrated | Notes |
|
|
96
|
-
|-----------|----------|-------|
|
|
97
|
-
| Decisions | ✅ Yes | All metadata preserved |
|
|
98
|
-
| Decision History | ✅ Yes | Full version tracking |
|
|
99
|
-
| Decision Context | ✅ Yes | Rationale, alternatives, tradeoffs |
|
|
100
|
-
| Constraints | ✅ Yes | Categories, priorities |
|
|
101
|
-
| Tags | ✅ Yes | Project-scoped |
|
|
102
|
-
| Scopes | ✅ Yes | Project-scoped |
|
|
103
|
-
| Layers | ✅ Yes | 9 predefined layers |
|
|
104
|
-
|
|
105
|
-
### Not Migrated (Removed Features)
|
|
106
|
-
|
|
107
|
-
| Data Type | Version Removed | Reason |
|
|
108
|
-
|-----------|-----------------|--------|
|
|
109
|
-
| Agent references | v4.0 | Agent system simplified |
|
|
110
|
-
| Tasks | v5.0 | Replaced by Claude Code TodoWrite |
|
|
111
|
-
| Task dependencies | v5.0 | Replaced by Claude Code TodoWrite |
|
|
112
|
-
| Files/File changes | v5.0 | No longer tracked |
|
|
113
|
-
|
|
114
|
-
> **Note:** These features were removed from sqlew itself. The data is not lost during migration—these systems simply no longer exist in v5.0+.
|
|
115
|
-
|
|
116
|
-
## Troubleshooting
|
|
117
|
-
|
|
118
|
-
### Migration Fails
|
|
119
|
-
|
|
120
|
-
If auto-migration fails:
|
|
121
|
-
|
|
122
|
-
1. Check your Node.js version (requires 20.0.0+)
|
|
123
|
-
2. Ensure `.sqlew/sqlew.db` exists and is readable
|
|
124
|
-
3. Check for disk space issues
|
|
125
|
-
|
|
126
|
-
### Export Fails
|
|
127
|
-
|
|
128
|
-
If export fails:
|
|
129
|
-
|
|
130
|
-
1. Verify the database was migrated successfully
|
|
131
|
-
2. Check write permissions for the output directory
|
|
132
|
-
3. Try with absolute path: `npx sqlew db:export /full/path/to/backup.json`
|
|
133
|
-
|
|
134
|
-
### Import Fails on SaaS
|
|
135
|
-
|
|
136
|
-
If SaaS import fails:
|
|
137
|
-
|
|
138
|
-
1. Verify JSON file is valid (not corrupted)
|
|
139
|
-
2. Check schema_version in JSON metadata is 5.0+
|
|
140
|
-
3. Contact support if the issue persists
|
|
141
|
-
|
|
142
|
-
## FAQ
|
|
143
|
-
|
|
144
|
-
### Can I migrate v3.0-v3.6 data?
|
|
145
|
-
|
|
146
|
-
These versions are untested. The migration may work, but we recommend:
|
|
147
|
-
|
|
148
|
-
1. Backup your database first
|
|
149
|
-
2. Try the migration
|
|
150
|
-
3. Report any issues to [GitHub Issues](https://github.com/sqlew-io/sqlew/issues)
|
|
151
|
-
|
|
152
|
-
### Will I lose any decisions?
|
|
153
|
-
|
|
154
|
-
No. All decisions and constraints are fully preserved. Only deprecated features (agents, tasks, files) are not migrated because they no longer exist in v5.0+.
|
|
155
|
-
|
|
156
|
-
### Can I migrate multiple projects?
|
|
157
|
-
|
|
158
|
-
Yes. Export each project separately:
|
|
159
|
-
|
|
160
|
-
```bash
|
|
161
|
-
# Export all projects
|
|
162
|
-
npx sqlew db:export backup-all.json project=all
|
|
163
|
-
|
|
164
|
-
# Or export specific project
|
|
165
|
-
npx sqlew db:export backup.json project=my-project
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
### What about constraint tags?
|
|
169
|
-
|
|
170
|
-
There's a known limitation where constraint-to-tag relationships may not be fully preserved. After import, you may need to re-tag some constraints manually.
|
|
171
|
-
|
|
172
|
-
## See Also
|
|
173
|
-
|
|
174
|
-
- [Configuration Guide](CONFIGURATION.md) - SaaS connection setup
|
|
175
|
-
- [CLI Reference](cli/README.md) - All export/import commands
|
|
176
|
-
|
|
1
|
+
# Migrating Local Data to SaaS
|
|
2
|
+
|
|
3
|
+
This guide explains how to migrate your existing local sqlew data to [sqlew.io](https://sqlew.io) cloud backend.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
┌─────────────────────────────────────────────────┐
|
|
9
|
+
│ Migration Flow │
|
|
10
|
+
├─────────────────────────────────────────────────┤
|
|
11
|
+
│ │
|
|
12
|
+
│ [Local v3.x/v4.x DB] │
|
|
13
|
+
│ │ │
|
|
14
|
+
│ ▼ npm install -g sqlew@latest │
|
|
15
|
+
│ │ │
|
|
16
|
+
│ ▼ sqlew (auto-migration to v5.0+) │
|
|
17
|
+
│ │ │
|
|
18
|
+
│ [Local v5.0+ DB] │
|
|
19
|
+
│ │ │
|
|
20
|
+
│ ▼ npm run db:export -- backup.json │
|
|
21
|
+
│ │ │
|
|
22
|
+
│ [JSON file] │
|
|
23
|
+
│ │ │
|
|
24
|
+
│ ▼ Upload to sqlew.io │
|
|
25
|
+
│ │ │
|
|
26
|
+
│ [SaaS v5.0+] │
|
|
27
|
+
│ │
|
|
28
|
+
└─────────────────────────────────────────────────┘
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Step-by-Step Guide
|
|
32
|
+
|
|
33
|
+
### 1. Update to v5.0+
|
|
34
|
+
|
|
35
|
+
If you're on an older version (v3.x or v4.x), update first:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install -g sqlew@latest
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 2. Run Auto-Migration
|
|
42
|
+
|
|
43
|
+
Start the MCP server once. This automatically migrates your database schema:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
sqlew
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The migration system:
|
|
50
|
+
- Detects your current schema version
|
|
51
|
+
- Applies all necessary migrations (v3→v4→v5)
|
|
52
|
+
- Preserves your decisions and constraints
|
|
53
|
+
|
|
54
|
+
### 3. Export Your Data
|
|
55
|
+
|
|
56
|
+
Export your local database to JSON format:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# From your project directory
|
|
60
|
+
cd your-project
|
|
61
|
+
|
|
62
|
+
# Export to JSON
|
|
63
|
+
npx sqlew db:export backup.json
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The exported JSON includes:
|
|
67
|
+
- All decisions with full metadata
|
|
68
|
+
- Decision history (version tracking)
|
|
69
|
+
- Decision context (rationale, alternatives, tradeoffs)
|
|
70
|
+
- Constraints with categories and priorities
|
|
71
|
+
- Tags and scopes
|
|
72
|
+
|
|
73
|
+
### 4. Import to SaaS
|
|
74
|
+
|
|
75
|
+
Upload your JSON file via the sqlew.io dashboard:
|
|
76
|
+
|
|
77
|
+
1. Go to [sqlew.io/dashboard/import](https://sqlew.io/dashboard/import)
|
|
78
|
+
2. Select your project (or create a new one)
|
|
79
|
+
3. Upload `backup.json`
|
|
80
|
+
4. Review and confirm the import
|
|
81
|
+
|
|
82
|
+
## Version Compatibility
|
|
83
|
+
|
|
84
|
+
| Source Version | Support | Notes |
|
|
85
|
+
|----------------|---------|-------|
|
|
86
|
+
| **v5.0+** | ✅ Full | Direct export/import |
|
|
87
|
+
| **v4.x** | ✅ Full | Auto-migrated on startup |
|
|
88
|
+
| **v3.7+** | ✅ Full | Auto-migrated on startup |
|
|
89
|
+
| **v3.0-v3.6** | ⚠️ Untested | May work, but not guaranteed |
|
|
90
|
+
|
|
91
|
+
## What Gets Migrated
|
|
92
|
+
|
|
93
|
+
### Preserved Data
|
|
94
|
+
|
|
95
|
+
| Data Type | Migrated | Notes |
|
|
96
|
+
|-----------|----------|-------|
|
|
97
|
+
| Decisions | ✅ Yes | All metadata preserved |
|
|
98
|
+
| Decision History | ✅ Yes | Full version tracking |
|
|
99
|
+
| Decision Context | ✅ Yes | Rationale, alternatives, tradeoffs |
|
|
100
|
+
| Constraints | ✅ Yes | Categories, priorities |
|
|
101
|
+
| Tags | ✅ Yes | Project-scoped |
|
|
102
|
+
| Scopes | ✅ Yes | Project-scoped |
|
|
103
|
+
| Layers | ✅ Yes | 9 predefined layers |
|
|
104
|
+
|
|
105
|
+
### Not Migrated (Removed Features)
|
|
106
|
+
|
|
107
|
+
| Data Type | Version Removed | Reason |
|
|
108
|
+
|-----------|-----------------|--------|
|
|
109
|
+
| Agent references | v4.0 | Agent system simplified |
|
|
110
|
+
| Tasks | v5.0 | Replaced by Claude Code TodoWrite |
|
|
111
|
+
| Task dependencies | v5.0 | Replaced by Claude Code TodoWrite |
|
|
112
|
+
| Files/File changes | v5.0 | No longer tracked |
|
|
113
|
+
|
|
114
|
+
> **Note:** These features were removed from sqlew itself. The data is not lost during migration—these systems simply no longer exist in v5.0+.
|
|
115
|
+
|
|
116
|
+
## Troubleshooting
|
|
117
|
+
|
|
118
|
+
### Migration Fails
|
|
119
|
+
|
|
120
|
+
If auto-migration fails:
|
|
121
|
+
|
|
122
|
+
1. Check your Node.js version (requires 20.0.0+)
|
|
123
|
+
2. Ensure `.sqlew/sqlew.db` exists and is readable
|
|
124
|
+
3. Check for disk space issues
|
|
125
|
+
|
|
126
|
+
### Export Fails
|
|
127
|
+
|
|
128
|
+
If export fails:
|
|
129
|
+
|
|
130
|
+
1. Verify the database was migrated successfully
|
|
131
|
+
2. Check write permissions for the output directory
|
|
132
|
+
3. Try with absolute path: `npx sqlew db:export /full/path/to/backup.json`
|
|
133
|
+
|
|
134
|
+
### Import Fails on SaaS
|
|
135
|
+
|
|
136
|
+
If SaaS import fails:
|
|
137
|
+
|
|
138
|
+
1. Verify JSON file is valid (not corrupted)
|
|
139
|
+
2. Check schema_version in JSON metadata is 5.0+
|
|
140
|
+
3. Contact support if the issue persists
|
|
141
|
+
|
|
142
|
+
## FAQ
|
|
143
|
+
|
|
144
|
+
### Can I migrate v3.0-v3.6 data?
|
|
145
|
+
|
|
146
|
+
These versions are untested. The migration may work, but we recommend:
|
|
147
|
+
|
|
148
|
+
1. Backup your database first
|
|
149
|
+
2. Try the migration
|
|
150
|
+
3. Report any issues to [GitHub Issues](https://github.com/sqlew-io/sqlew/issues)
|
|
151
|
+
|
|
152
|
+
### Will I lose any decisions?
|
|
153
|
+
|
|
154
|
+
No. All decisions and constraints are fully preserved. Only deprecated features (agents, tasks, files) are not migrated because they no longer exist in v5.0+.
|
|
155
|
+
|
|
156
|
+
### Can I migrate multiple projects?
|
|
157
|
+
|
|
158
|
+
Yes. Export each project separately:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
# Export all projects
|
|
162
|
+
npx sqlew db:export backup-all.json project=all
|
|
163
|
+
|
|
164
|
+
# Or export specific project
|
|
165
|
+
npx sqlew db:export backup.json project=my-project
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### What about constraint tags?
|
|
169
|
+
|
|
170
|
+
There's a known limitation where constraint-to-tag relationships may not be fully preserved. After import, you may need to re-tag some constraints manually.
|
|
171
|
+
|
|
172
|
+
## See Also
|
|
173
|
+
|
|
174
|
+
- [Configuration Guide](CONFIGURATION.md) - SaaS connection setup
|
|
175
|
+
- [CLI Reference](cli/README.md) - All export/import commands
|
|
176
|
+
|
package/docs/SHARED_DATABASE.md
CHANGED
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
# Shared Database (v5.1.0+)
|
|
2
|
-
|
|
3
|
-
As of v5.1.0, sqlew uses a **global shared database** by default instead of a per-project local database. This resolves the issue where git worktrees created isolated databases that couldn't share decisions.
|
|
4
|
-
|
|
5
|
-
## Default Paths
|
|
6
|
-
|
|
7
|
-
| Purpose | Path |
|
|
8
|
-
|---------|------|
|
|
9
|
-
| Database | `~/.config/sqlew/sqlew-shared.db` |
|
|
10
|
-
| Config | `~/.config/sqlew/config.toml` |
|
|
11
|
-
| Session cache | `~/.config/sqlew/session-cache/` |
|
|
12
|
-
|
|
13
|
-
These paths are the same on all platforms (Windows, macOS, Linux).
|
|
14
|
-
|
|
15
|
-
## Automatic Migration
|
|
16
|
-
|
|
17
|
-
When the MCP server starts, it automatically migrates local databases to the global shared database under these conditions:
|
|
18
|
-
|
|
19
|
-
- **SQLite only** — MySQL/PostgreSQL/Cloud users are not affected
|
|
20
|
-
- **No explicit `database.path` in config** — If you set a custom path in `.sqlew/config.toml`, auto-migration is skipped
|
|
21
|
-
- **`.sqlew/sqlew.db` exists** — Only the standard local DB location is migrated
|
|
22
|
-
|
|
23
|
-
### What happens during auto-migration
|
|
24
|
-
|
|
25
|
-
1. If the global DB **doesn't exist yet** → the local DB is copied directly (fastest path)
|
|
26
|
-
2. If the global DB **already exists** → data is exported as JSON and imported (skip-if-exists per project)
|
|
27
|
-
3. The local DB is renamed to `.sqlew/sqlew.db.migrated` (not deleted)
|
|
28
|
-
|
|
29
|
-
### Safety net for merge path
|
|
30
|
-
|
|
31
|
-
When merging into an existing global DB (case 2), if the import is skipped due to a project name conflict, a `pre-migration-export.json` file is saved in `.sqlew/`. This file is automatically deleted on successful import. If it remains, you can manually import it later:
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
sqlew db:import .sqlew/pre-migration-export.json
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## Manual Migration
|
|
38
|
-
|
|
39
|
-
If your project uses a custom database path (set via `database.path` in `.sqlew/config.toml`), auto-migration does not apply. You can manually migrate to the global shared database:
|
|
40
|
-
|
|
41
|
-
### Step 1: Export from your current database
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
# Export current project (auto-detected from .sqlew/config.toml [project].name)
|
|
45
|
-
sqlew db:export export.json
|
|
46
|
-
|
|
47
|
-
# Or export all projects from the database
|
|
48
|
-
sqlew db:export export.json project=all
|
|
49
|
-
|
|
50
|
-
# Or specify the database path explicitly
|
|
51
|
-
sqlew db:export export.json db-path=.claude/docs/sqlew.db project=all
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### Step 2: Switch to global database
|
|
55
|
-
|
|
56
|
-
Remove or comment out the `database.path` line in `.sqlew/config.toml`:
|
|
57
|
-
|
|
58
|
-
```toml
|
|
59
|
-
[database]
|
|
60
|
-
# path = ".claude/docs/sqlew.db" # commented out → uses global default
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### Step 3: Import into global database
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
sqlew db:import export.json
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
The global database at `~/.config/sqlew/sqlew-shared.db` will be created automatically on the next MCP server startup if it doesn't exist yet.
|
|
70
|
-
|
|
71
|
-
## Per-Project Database Override
|
|
72
|
-
|
|
73
|
-
If you want to keep a project-specific database instead of using the global shared one, set `database.path` in that project's `.sqlew/config.toml`:
|
|
74
|
-
|
|
75
|
-
```toml
|
|
76
|
-
[database]
|
|
77
|
-
path = ".sqlew/sqlew.db" # project-local database
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### Config priority
|
|
81
|
-
|
|
82
|
-
```
|
|
83
|
-
1. CLI --db-path argument (highest)
|
|
84
|
-
2. Project .sqlew/config.toml
|
|
85
|
-
3. Worktree parent config
|
|
86
|
-
4. Global ~/.config/sqlew/config.toml
|
|
87
|
-
5. Default: ~/.config/sqlew/sqlew-shared.db (lowest)
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
Project-level config always overrides global config, so you can use the global shared database by default and opt specific projects out as needed.
|
|
91
|
-
|
|
92
|
-
## FAQ
|
|
93
|
-
|
|
94
|
-
### Can I still use project-local databases?
|
|
95
|
-
|
|
96
|
-
Yes. Set `database.path` in your project's `.sqlew/config.toml` and the global default is bypassed entirely.
|
|
97
|
-
|
|
98
|
-
### What happens to my old `.sqlew/sqlew.db`?
|
|
99
|
-
|
|
100
|
-
It's renamed to `.sqlew/sqlew.db.migrated` after successful migration. You can safely delete it once you've confirmed the global DB has your data.
|
|
101
|
-
|
|
102
|
-
### What about MySQL/PostgreSQL users?
|
|
103
|
-
|
|
104
|
-
No change. External database connections configured in `config.toml` work exactly as before.
|
|
105
|
-
|
|
106
|
-
### Is data shared between projects?
|
|
107
|
-
|
|
108
|
-
Yes, all projects using the default global database share the same `sqlew-shared.db` file. Each project's data is scoped by `project_id`, so there's no data mixing. This is the same model used when multiple projects connect to a shared MySQL/PostgreSQL instance.
|
|
1
|
+
# Shared Database (v5.1.0+)
|
|
2
|
+
|
|
3
|
+
As of v5.1.0, sqlew uses a **global shared database** by default instead of a per-project local database. This resolves the issue where git worktrees created isolated databases that couldn't share decisions.
|
|
4
|
+
|
|
5
|
+
## Default Paths
|
|
6
|
+
|
|
7
|
+
| Purpose | Path |
|
|
8
|
+
|---------|------|
|
|
9
|
+
| Database | `~/.config/sqlew/sqlew-shared.db` |
|
|
10
|
+
| Config | `~/.config/sqlew/config.toml` |
|
|
11
|
+
| Session cache | `~/.config/sqlew/session-cache/` |
|
|
12
|
+
|
|
13
|
+
These paths are the same on all platforms (Windows, macOS, Linux).
|
|
14
|
+
|
|
15
|
+
## Automatic Migration
|
|
16
|
+
|
|
17
|
+
When the MCP server starts, it automatically migrates local databases to the global shared database under these conditions:
|
|
18
|
+
|
|
19
|
+
- **SQLite only** — MySQL/PostgreSQL/Cloud users are not affected
|
|
20
|
+
- **No explicit `database.path` in config** — If you set a custom path in `.sqlew/config.toml`, auto-migration is skipped
|
|
21
|
+
- **`.sqlew/sqlew.db` exists** — Only the standard local DB location is migrated
|
|
22
|
+
|
|
23
|
+
### What happens during auto-migration
|
|
24
|
+
|
|
25
|
+
1. If the global DB **doesn't exist yet** → the local DB is copied directly (fastest path)
|
|
26
|
+
2. If the global DB **already exists** → data is exported as JSON and imported (skip-if-exists per project)
|
|
27
|
+
3. The local DB is renamed to `.sqlew/sqlew.db.migrated` (not deleted)
|
|
28
|
+
|
|
29
|
+
### Safety net for merge path
|
|
30
|
+
|
|
31
|
+
When merging into an existing global DB (case 2), if the import is skipped due to a project name conflict, a `pre-migration-export.json` file is saved in `.sqlew/`. This file is automatically deleted on successful import. If it remains, you can manually import it later:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
sqlew db:import .sqlew/pre-migration-export.json
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Manual Migration
|
|
38
|
+
|
|
39
|
+
If your project uses a custom database path (set via `database.path` in `.sqlew/config.toml`), auto-migration does not apply. You can manually migrate to the global shared database:
|
|
40
|
+
|
|
41
|
+
### Step 1: Export from your current database
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Export current project (auto-detected from .sqlew/config.toml [project].name)
|
|
45
|
+
sqlew db:export export.json
|
|
46
|
+
|
|
47
|
+
# Or export all projects from the database
|
|
48
|
+
sqlew db:export export.json project=all
|
|
49
|
+
|
|
50
|
+
# Or specify the database path explicitly
|
|
51
|
+
sqlew db:export export.json db-path=.claude/docs/sqlew.db project=all
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Step 2: Switch to global database
|
|
55
|
+
|
|
56
|
+
Remove or comment out the `database.path` line in `.sqlew/config.toml`:
|
|
57
|
+
|
|
58
|
+
```toml
|
|
59
|
+
[database]
|
|
60
|
+
# path = ".claude/docs/sqlew.db" # commented out → uses global default
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Step 3: Import into global database
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
sqlew db:import export.json
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The global database at `~/.config/sqlew/sqlew-shared.db` will be created automatically on the next MCP server startup if it doesn't exist yet.
|
|
70
|
+
|
|
71
|
+
## Per-Project Database Override
|
|
72
|
+
|
|
73
|
+
If you want to keep a project-specific database instead of using the global shared one, set `database.path` in that project's `.sqlew/config.toml`:
|
|
74
|
+
|
|
75
|
+
```toml
|
|
76
|
+
[database]
|
|
77
|
+
path = ".sqlew/sqlew.db" # project-local database
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Config priority
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
1. CLI --db-path argument (highest)
|
|
84
|
+
2. Project .sqlew/config.toml
|
|
85
|
+
3. Worktree parent config
|
|
86
|
+
4. Global ~/.config/sqlew/config.toml
|
|
87
|
+
5. Default: ~/.config/sqlew/sqlew-shared.db (lowest)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Project-level config always overrides global config, so you can use the global shared database by default and opt specific projects out as needed.
|
|
91
|
+
|
|
92
|
+
## FAQ
|
|
93
|
+
|
|
94
|
+
### Can I still use project-local databases?
|
|
95
|
+
|
|
96
|
+
Yes. Set `database.path` in your project's `.sqlew/config.toml` and the global default is bypassed entirely.
|
|
97
|
+
|
|
98
|
+
### What happens to my old `.sqlew/sqlew.db`?
|
|
99
|
+
|
|
100
|
+
It's renamed to `.sqlew/sqlew.db.migrated` after successful migration. You can safely delete it once you've confirmed the global DB has your data.
|
|
101
|
+
|
|
102
|
+
### What about MySQL/PostgreSQL users?
|
|
103
|
+
|
|
104
|
+
No change. External database connections configured in `config.toml` work exactly as before.
|
|
105
|
+
|
|
106
|
+
### Is data shared between projects?
|
|
107
|
+
|
|
108
|
+
Yes, all projects using the default global database share the same `sqlew-shared.db` file. Each project's data is scoped by `project_id`, so there's no data mixing. This is the same model used when multiple projects connect to a shared MySQL/PostgreSQL instance.
|