sqlew 3.7.2 → 3.7.4

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 (117) hide show
  1. package/CHANGELOG.md +237 -0
  2. package/LICENSE +0 -0
  3. package/README.md +2 -2
  4. package/assets/config.example.toml +0 -0
  5. package/assets/kanban-style.png +0 -0
  6. package/assets/sample-agents/README.md +0 -0
  7. package/assets/sample-agents/sqlew-architect.md +0 -0
  8. package/assets/sample-agents/sqlew-researcher.md +0 -0
  9. package/assets/sample-agents/sqlew-scrum-master.md +0 -0
  10. package/assets/schema.sql +0 -0
  11. package/assets/sqlew-logo.png +0 -0
  12. package/dist/cli/db-export.d.ts +29 -0
  13. package/dist/cli/db-export.d.ts.map +1 -0
  14. package/dist/cli/db-export.js +251 -0
  15. package/dist/cli/db-export.js.map +1 -0
  16. package/dist/cli/db-import.d.ts +31 -0
  17. package/dist/cli/db-import.d.ts.map +1 -0
  18. package/dist/cli/db-import.js +258 -0
  19. package/dist/cli/db-import.js.map +1 -0
  20. package/dist/cli.js +24 -2
  21. package/dist/cli.js.map +1 -1
  22. package/dist/config/knex/bootstrap/20251025020452_create_master_tables.d.ts.map +1 -1
  23. package/dist/config/knex/bootstrap/20251025020452_create_master_tables.js +12 -3
  24. package/dist/config/knex/bootstrap/20251025020452_create_master_tables.js.map +1 -1
  25. package/dist/config/knex/enhancements/20251106000000_fix_master_tables_project_id_v3_7_3.d.ts +29 -0
  26. package/dist/config/knex/enhancements/20251106000000_fix_master_tables_project_id_v3_7_3.d.ts.map +1 -0
  27. package/dist/config/knex/enhancements/20251106000000_fix_master_tables_project_id_v3_7_3.js +556 -0
  28. package/dist/config/knex/enhancements/20251106000000_fix_master_tables_project_id_v3_7_3.js.map +1 -0
  29. package/dist/config/knex/upgrades/20251104000000_add_multi_project_v3_7_0.d.ts.map +1 -1
  30. package/dist/config/knex/upgrades/20251104000000_add_multi_project_v3_7_0.js +110 -9
  31. package/dist/config/knex/upgrades/20251104000000_add_multi_project_v3_7_0.js.map +1 -1
  32. package/dist/database.d.ts +3 -3
  33. package/dist/database.d.ts.map +1 -1
  34. package/dist/database.js +30 -12
  35. package/dist/database.js.map +1 -1
  36. package/dist/tests/migration-idempotency.test.js +11 -10
  37. package/dist/tests/migration-idempotency.test.js.map +1 -1
  38. package/dist/tests/migration-upgrade-paths.test.js +6 -5
  39. package/dist/tests/migration-upgrade-paths.test.js.map +1 -1
  40. package/dist/tests/migrations/test-all-versions-real.js +3 -2
  41. package/dist/tests/migrations/test-all-versions-real.js.map +1 -1
  42. package/dist/tests/project-detector.test.d.ts +10 -0
  43. package/dist/tests/project-detector.test.d.ts.map +1 -0
  44. package/dist/tests/project-detector.test.js +156 -0
  45. package/dist/tests/project-detector.test.js.map +1 -0
  46. package/dist/tests/tasks.auto-pruning-partial.test.js +1 -1
  47. package/dist/tests/tasks.auto-pruning-partial.test.js.map +1 -1
  48. package/dist/tests/tasks.link-file-backward-compat.test.js +3 -3
  49. package/dist/tests/tasks.link-file-backward-compat.test.js.map +1 -1
  50. package/dist/tests/tasks.watch-files-action.test.js +1 -1
  51. package/dist/tests/tasks.watch-files-action.test.js.map +1 -1
  52. package/dist/tests/tasks.watch-files-parameter.test.js +2 -2
  53. package/dist/tests/tasks.watch-files-parameter.test.js.map +1 -1
  54. package/dist/tools/constraints.js +1 -1
  55. package/dist/tools/constraints.js.map +1 -1
  56. package/dist/tools/context.js +2 -2
  57. package/dist/tools/context.js.map +1 -1
  58. package/dist/tools/files.js +2 -2
  59. package/dist/tools/files.js.map +1 -1
  60. package/dist/tools/tasks.d.ts.map +1 -1
  61. package/dist/tools/tasks.js +7 -5
  62. package/dist/tools/tasks.js.map +1 -1
  63. package/dist/types.d.ts +121 -0
  64. package/dist/types.d.ts.map +1 -1
  65. package/dist/utils/exporter/export.d.ts +100 -0
  66. package/dist/utils/exporter/export.d.ts.map +1 -0
  67. package/dist/utils/exporter/export.js +363 -0
  68. package/dist/utils/exporter/export.js.map +1 -0
  69. package/dist/utils/importer/import.d.ts +29 -0
  70. package/dist/utils/importer/import.d.ts.map +1 -0
  71. package/dist/utils/importer/import.js +514 -0
  72. package/dist/utils/importer/import.js.map +1 -0
  73. package/dist/utils/importer/master-tables.d.ts +18 -0
  74. package/dist/utils/importer/master-tables.d.ts.map +1 -0
  75. package/dist/utils/importer/master-tables.js +255 -0
  76. package/dist/utils/importer/master-tables.js.map +1 -0
  77. package/dist/utils/importer/topological-sort.d.ts +61 -0
  78. package/dist/utils/importer/topological-sort.d.ts.map +1 -0
  79. package/dist/utils/importer/topological-sort.js +143 -0
  80. package/dist/utils/importer/topological-sort.js.map +1 -0
  81. package/dist/utils/project-detector.d.ts +42 -0
  82. package/dist/utils/project-detector.d.ts.map +1 -0
  83. package/dist/utils/project-detector.js +130 -0
  84. package/dist/utils/project-detector.js.map +1 -0
  85. package/docs/ACCEPTANCE_CRITERIA.md +0 -0
  86. package/docs/AI_AGENT_GUIDE.md +0 -0
  87. package/docs/ARCHITECTURE.md +0 -0
  88. package/docs/AUTO_FILE_TRACKING.md +0 -1
  89. package/docs/BEST_PRACTICES.md +0 -0
  90. package/docs/CONFIGURATION.md +0 -0
  91. package/docs/DATABASE_AUTH.md +1 -2
  92. package/docs/DECISION_CONTEXT.md +0 -0
  93. package/docs/DECISION_TO_TASK_MIGRATION_GUIDE.md +0 -0
  94. package/docs/GIT_AWARE_AUTO_COMPLETE.md +0 -0
  95. package/docs/SHARED_CONCEPTS.md +0 -0
  96. package/docs/SPECIALIZED_AGENTS.md +0 -0
  97. package/docs/TASK_ACTIONS.md +0 -0
  98. package/docs/TASK_DEPENDENCIES.md +0 -0
  99. package/docs/TASK_LINKING.md +0 -0
  100. package/docs/TASK_MIGRATION.md +0 -0
  101. package/docs/TASK_OVERVIEW.md +0 -0
  102. package/docs/TASK_PRUNING.md +0 -0
  103. package/docs/TASK_SYSTEM.md +0 -0
  104. package/docs/TOOL_REFERENCE.md +0 -2
  105. package/docs/TOOL_SELECTION.md +0 -0
  106. package/docs/WORKFLOWS.md +0 -0
  107. package/docs/{DATABASE_MIGRATION.md → cli/DATABASE_MIGRATION.md} +71 -32
  108. package/docs/cli/DATA_EXPORT_IMPORT.md +400 -0
  109. package/docs/cli/README.md +227 -0
  110. package/package.json +3 -2
  111. package/docs/BASEADAPTER_IMPLEMENTATION.md +0 -399
  112. package/docs/HELP_PREVIEW_COMPARISON.md +0 -259
  113. package/docs/MIGRATION_CHAIN.md +0 -293
  114. package/docs/MIGRATION_v2.md +0 -538
  115. package/docs/MIGRATION_v3.3.md +0 -602
  116. package/docs/MIGRATION_v3.6.0.md +0 -170
  117. package/docs/MULTI_PROJECT_ARCHITECTURE.md +0 -497
package/CHANGELOG.md CHANGED
@@ -7,6 +7,164 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ---
9
9
 
10
+ ## [3.7.4] - 2025-11-08
11
+
12
+ ### Added - Complete JSON Import/Export System
13
+
14
+ **Full-featured data migration system with smart ID remapping and dependency resolution**
15
+
16
+ #### New Features
17
+
18
+ - **db:import CLI Command** - Import project data from JSON exports with automatic ID remapping
19
+ - Smart conflict detection (skip-if-exists, project-name override)
20
+ - Dry-run mode for validation before import
21
+ - Comprehensive error messages with validation details
22
+ - **Topological Sort Algorithm** - Resolves task dependencies during import
23
+ - Circular dependency detection prevents import of invalid dependency graphs
24
+ - BFS-based topological sorting ensures dependencies imported before dependents
25
+ - Preserves all task relationships and blocking constraints
26
+ - **Smart ID Remapping** - Handles complex foreign key relationships
27
+ - Master table merge logic (reuse existing entries by name/path)
28
+ - Transaction table ID translation with bidirectional mapping
29
+ - Junction table relationship preservation
30
+ - Automatic orphan cleanup for invalid references
31
+
32
+ #### Import System Architecture
33
+
34
+ - **4 Core Modules**:
35
+ 1. `import.ts` - Main orchestrator with transaction management
36
+ 2. `master-tables.ts` - Master table merge logic (m_files, m_tags, m_scopes, etc.)
37
+ 3. `topological-sort.ts` - Dependency graph analysis and sorting
38
+ 4. `db-import.ts` - CLI command with argument parsing and validation
39
+
40
+ #### Data Migration Strategy
41
+
42
+ - **ID Remapping**: All imported data gets fresh auto-incremented IDs (no ID preservation)
43
+ - **Master Table Deduplication**: Reuse existing entries for agents, tags, scopes, files by name/path
44
+ - **Transaction Atomicity**: All-or-nothing semantics (full rollback on any error)
45
+ - **Project Isolation**: Each import creates independent project with no cross-contamination
46
+
47
+ #### CLI Examples
48
+
49
+ ```bash
50
+ # Import project from JSON export
51
+ npx sqlew db:import --source=project-backup.json
52
+
53
+ # Import with custom project name
54
+ npx sqlew db:import --source=data.json --project-name=my-project
55
+
56
+ # Dry-run validation (no actual import)
57
+ npx sqlew db:import --source=data.json --dry-run
58
+
59
+ # Export project for migration
60
+ npx sqlew db:export --project=visualizer --output=visualizer-data.json
61
+ ```
62
+
63
+ #### Technical Details
64
+
65
+ - **Batch Inserts** - 10-row batches to avoid SQLite UNION ALL limits
66
+ - **Foreign Key Validation** - Validates all foreign key references before insertion
67
+ - **View Handling** - Temporarily drops/restores views during schema changes
68
+ - **Idempotent Operations** - Safe to retry on failure
69
+ - **Error Recovery** - Detailed error messages with validation guidance
70
+
71
+ #### Use Cases
72
+
73
+ - **Multi-Project Single Database** - Consolidate multiple projects when database creation permissions are limited
74
+ - **Project Sharing** - Share context with team members or between machines
75
+ - **Cross-Database Migration** - Move projects between different databases (different machine, SQLite → MySQL, etc.)
76
+
77
+ **Note**: Import uses `--skip-if-exists=true` by default. This is NOT a backup/restore solution for the same database.
78
+ Use database-level backups (SQLite file copy, MySQL dump) for backup/restore scenarios.
79
+
80
+ #### Impact
81
+
82
+ - ✅ **Complete migration solution** - Export from one database, import to another
83
+ - ✅ **Multi-project support** - Merge multiple project exports into single database
84
+ - ✅ **Permission-friendly** - Works for users who can't create multiple databases
85
+ - ✅ **Data integrity** - Zero data loss, all relationships preserved
86
+ - ✅ **Production ready** - Comprehensive error handling and validation
87
+ - ✅ **Cross-database compatible** - JSON format works across SQLite, MySQL, PostgreSQL
88
+
89
+ ---
90
+
91
+ ### Fixed - Multi-Project Migration (HOTFIX)
92
+
93
+ **Critical fix for v3.7.0-v3.7.2 migration in multi-project scenarios**
94
+
95
+ #### Problem
96
+
97
+ - Users upgrading from v3.6.10 to v3.7.0+ could end up with duplicate projects
98
+ - Migration 20251104000000 created project #1 with fake name "default-project"
99
+ - Users creating second project manually resulted in namespace conflicts
100
+
101
+ #### Solution
102
+
103
+ - Enhanced migration idempotency checks
104
+ - Improved project consolidation logic
105
+ - Better handling of existing project scenarios
106
+
107
+ #### Impact
108
+
109
+ - ✅ **Safe multi-project migration** - No duplicate projects created
110
+ - ✅ **Backward compatible** - Works for both fresh installs and upgrades
111
+ - ✅ **Data preservation** - All existing data maintained correctly
112
+
113
+ ---
114
+
115
+ ## [3.7.3] - 2025-11-06
116
+
117
+ ### Fixed - Master Tables Namespace Collision Bug
118
+
119
+ **Critical bug fix for incomplete multi-project support in v3.7.0-v3.7.2**
120
+
121
+ #### Problem
122
+ - Master tables (m_files, m_tags, m_scopes) lacked `project_id` columns in v3.7.0-v3.7.2
123
+ - This caused **namespace collisions** where identical file paths/tag names/scope names from different projects would conflict
124
+ - Example: "src/index.ts" from ProjectA would collide with ProjectB's "src/index.ts"
125
+ - Users upgrading from v3.6.x would have fake project name "default-project" instead of detected real name
126
+
127
+ #### Solution
128
+ - **20251106000000_fix_master_tables_project_id_v3_7_3.ts** - Comprehensive migration that:
129
+ 1. **Data Consolidation** - Detects v3.7.0-v3.7.2 upgrade scenario and consolidates project #2 data into project #1
130
+ 2. **Project Rename** - Renames fake "default-project" to real detected name (from config.toml/git remote/directory)
131
+ 3. **Schema Fix** - Adds `project_id` column to m_files, m_tags, m_scopes with composite UNIQUE constraints
132
+ 4. **Data Migration** - Maps all existing master table data to default project (ID 1)
133
+ 5. **Orphan Cleanup** - Filters out 95 orphaned foreign key references (deleted tasks/tags)
134
+ 6. **View Restoration** - Temporarily drops and restores 4 views during migration
135
+ 7. **Table Restoration** - Backs up and restores 6 referencing tables with updated foreign keys
136
+
137
+ #### Migration Details
138
+ - **Idempotent** - Can run multiple times safely (checks for existing columns)
139
+ - **Version-Aware** - Only consolidates data for v3.7.0-v3.7.2 databases (detects fake project names)
140
+ - **Batch Inserts** - Uses 10-row batches to avoid SQLite UNION ALL limits
141
+ - **FK Filtering** - Validates foreign key references before restoration to prevent constraint errors
142
+ - **SQLite-Optimized** - Handles better-sqlite3 FK constraint behavior during table drops
143
+
144
+ #### Technical Changes
145
+ - **m_files**: Added `project_id` column, changed UNIQUE constraint from `(path)` to `(project_id, path)`
146
+ - **m_tags**: Added `project_id` column, changed UNIQUE constraint from `(name)` to `(project_id, name)`
147
+ - **m_scopes**: Added `project_id` column, changed UNIQUE constraint from `(name)` to `(project_id, name)`
148
+ - **Referencing Tables**: Updated t_file_changes, t_task_file_links, t_decision_tags, t_task_tags, t_constraint_tags, t_decision_scopes
149
+ - **Views**: Restored v_layer_summary, v_task_board, v_tagged_decisions, v_tagged_constraints
150
+
151
+ #### Impact
152
+ - ✅ **Fixed namespace collisions** - Files/tags/scopes from different projects can now have identical names
153
+ - ✅ **Data integrity** - All existing data preserved and mapped correctly
154
+ - ✅ **Project consolidation** - v3.7.0-v3.7.2 users get clean migration path
155
+ - ✅ **Real project names** - No more fake "default-project" names
156
+ - ✅ **Orphan cleanup** - Removed invalid foreign key references automatically
157
+ - ✅ **Full idempotency** - Migration can be safely re-run if interrupted
158
+
159
+ #### Testing
160
+ - ✅ Tested on actual v3.7.2 production database (mcp-sqlew project)
161
+ - ✅ Successfully consolidated 77 decisions, 191 tasks, 61 file changes
162
+ - ✅ Filtered 95 orphaned task-tag references
163
+ - ✅ All views and referencing tables restored correctly
164
+ - ✅ Final database state validated with composite UNIQUE constraints working
165
+
166
+ ---
167
+
10
168
  ## [3.7.2] - 2025-11-05
11
169
 
12
170
  ### Changed - Enhanced Sub-Agent Templates
@@ -529,6 +687,85 @@ if (!hasProjectId) {
529
687
 
530
688
  ---
531
689
 
690
+ ### Added - Environment Variable Support for Project Root
691
+
692
+ **New `SQLEW_PROJECT_ROOT` environment variable for project-relative databases**
693
+
694
+ #### Problem
695
+ - Junie AI and other MCP clients require absolute paths in configuration
696
+ - Users had to hardcode project-specific paths in MCP server config
697
+ - No easy way to use project-relative database paths
698
+
699
+ #### Solution
700
+ - Added `SQLEW_PROJECT_ROOT` environment variable support (inspired by serena-mcp pattern)
701
+ - MCP clients can now pass project directory via environment variable
702
+ - Database automatically created at `$SQLEW_PROJECT_ROOT/.sqlew/sqlew.db`
703
+
704
+ #### Priority Order
705
+ 1. `SQLEW_PROJECT_ROOT` environment variable (NEW - highest priority)
706
+ 2. `--db-path` CLI argument (absolute path)
707
+ 3. `--config-path` CLI argument (absolute path)
708
+ 4. `database.path` in config file (absolute path)
709
+ 5. `process.cwd()` fallback
710
+
711
+ #### Junie AI Configuration Example
712
+ ```json
713
+ {
714
+ "mcpServers": {
715
+ "sqlew": {
716
+ "command": "npx",
717
+ "args": ["sqlew"],
718
+ "env": {
719
+ "SQLEW_PROJECT_ROOT": "{projectDir}"
720
+ }
721
+ }
722
+ }
723
+ }
724
+ ```
725
+
726
+ **Note:** Junie AI uses `{projectDir}` variable which expands to the current project's absolute path. This ensures each project gets its own isolated database without hardcoded paths. Other MCP clients may use different variable names like `${workspaceFolder}` (VS Code/Cline) - check your client's documentation.
727
+
728
+ #### Impact
729
+ - ✅ **Project-relative databases** without hardcoded absolute paths
730
+ - ✅ **Cleaner MCP configuration** (no per-project path updates needed)
731
+ - ✅ **Compatible with Junie AI, Claude Desktop, and other MCP clients**
732
+ - ✅ **No breaking changes** (environment variable is optional)
733
+
734
+ ---
735
+
736
+ ### Fixed - MCP Protocol Compliance (EPIPE Fix)
737
+
738
+ **Eliminated console output for strict JSON-RPC protocol compliance**
739
+
740
+ #### Problem
741
+ - EPIPE (broken pipe) errors when running with Junie AI on Windows
742
+ - Console output to stdout/stderr violated MCP JSON-RPC protocol requirements
743
+ - Strict MCP clients (like Junie AI) expect pure JSON-RPC on stdio streams
744
+
745
+ #### Changes
746
+ - **Redirected all diagnostic output to debug log file** - stdout/stderr reserved exclusively for JSON-RPC
747
+ - Modified `safeConsoleError()` to write to debug log instead of stderr
748
+ - Replaced 50+ console.log/console.error calls across codebase:
749
+ - `src/database.ts` - Database initialization messages
750
+ - `src/watcher/file-watcher.ts` - File watcher status and events
751
+ - `src/watcher/gitignore-parser.ts` - .gitignore loading warnings
752
+ - `src/tools/tasks.ts` - Task file registration warnings
753
+ - `src/config/example-generator.ts` - First launch messages
754
+
755
+ #### Technical Details
756
+ - **MCP Protocol Requirement**: stdin/stdout/stderr must carry only JSON-RPC messages
757
+ - **Debug Logging**: All diagnostic messages now use `debugLog()` with appropriate levels (INFO, WARN, ERROR)
758
+ - **Zero stdout pollution**: Server starts silently, waits for JSON-RPC requests
759
+ - **Tested with Junie AI**: Confirmed no EPIPE errors on Windows
760
+
761
+ #### Impact
762
+ - ✅ **Works with strict MCP clients** (Junie AI, etc.)
763
+ - ✅ **Maintains full diagnostics** via debug log file
764
+ - ✅ **Pure JSON-RPC protocol** compliance
765
+ - ✅ **No breaking changes** to MCP tool functionality
766
+
767
+ ---
768
+
532
769
  ### Fixed - Windows Absolute Path Handling
533
770
 
534
771
  **Fixed path normalization for Windows environments**
package/LICENSE CHANGED
File without changes
package/README.md CHANGED
@@ -219,7 +219,7 @@ All tools support:
219
219
  ### For Developers
220
220
 
221
221
  - [Configuration Guide](docs/CONFIGURATION.md) - TOML config file setup
222
- - [Database Migration](docs/DATABASE_MIGRATION.md) - SQLite MySQL/PostgreSQL migration
222
+ - [CLI Mode Overview](docs/cli/README.md) - Database migration, export/import commands
223
223
  - [Building from Source](docs/ARCHITECTURE.md#development) - Setup instructions
224
224
  - [Migration Guides](docs/MIGRATION_v2.md) - Version upgrade guides
225
225
 
@@ -245,7 +245,7 @@ Support development via [GitHub Sponsors](https://github.com/sponsors/sin5ddd) -
245
245
 
246
246
  ## Version
247
247
 
248
- Current version: **3.7.0**
248
+ Current version: **3.7.4**
249
249
  See [CHANGELOG.md](CHANGELOG.md) for release history.
250
250
 
251
251
  ## License
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/assets/schema.sql CHANGED
File without changes
File without changes
@@ -0,0 +1,29 @@
1
+ /**
2
+ * db:export CLI command - JSON data-only export for append-import
3
+ * Complementary to db:dump (SQL export with schema)
4
+ */
5
+ interface DbExportArgs {
6
+ project?: string;
7
+ output?: string;
8
+ 'db-path'?: string;
9
+ config?: string;
10
+ help?: boolean;
11
+ }
12
+ /**
13
+ * Show help message for db:export command
14
+ */
15
+ export declare function showDbExportHelp(): void;
16
+ /**
17
+ * Parse command-line arguments for db:export
18
+ */
19
+ export declare function parseDbExportArgs(args: string[]): DbExportArgs;
20
+ /**
21
+ * Execute db:export command
22
+ */
23
+ export declare function executeDbExport(args: DbExportArgs): Promise<void>;
24
+ /**
25
+ * Main entry point for db:export command
26
+ */
27
+ export declare function dbExportCommand(args: string[]): Promise<void>;
28
+ export {};
29
+ //# sourceMappingURL=db-export.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db-export.d.ts","sourceRoot":"","sources":["../../src/cli/db-export.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,UAAU,YAAY;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAoDvC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,YAAY,CAyC9D;AAWD;;GAEG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAgIvE;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAGnE"}
@@ -0,0 +1,251 @@
1
+ /**
2
+ * db:export CLI command - JSON data-only export for append-import
3
+ * Complementary to db:dump (SQL export with schema)
4
+ */
5
+ import knex from 'knex';
6
+ import * as fs from 'fs';
7
+ import * as path from 'path';
8
+ import knexConfig from '../knexfile.js';
9
+ import { generateJsonExport } from '../utils/exporter/export.js';
10
+ import { loadConfigFile } from '../config/loader.js';
11
+ /**
12
+ * Show help message for db:export command
13
+ */
14
+ export function showDbExportHelp() {
15
+ console.log(`
16
+ sqlew db:export - Export project data to JSON format
17
+
18
+ USAGE:
19
+ npx sqlew db:export [options]
20
+
21
+ OPTIONS:
22
+ --project <name> Export specific project by name (required for multi-project databases)
23
+ If not specified, exports all projects
24
+ --output <file> Output file path (default: stdout)
25
+ --db-path <path> SQLite database file path (overrides config file)
26
+ --config <path> Config file path (default: auto-detect .sqlew/config.toml or config.toml)
27
+ --help Show this help message
28
+
29
+ CONFIG FILE:
30
+ The command automatically loads database settings from config.toml.
31
+ Priority: CLI args > config file > environment variables > defaults
32
+
33
+ EXAMPLES:
34
+ # Export specific project to file
35
+ npx sqlew db:export --project=visualizer --output=visualizer-data.json
36
+
37
+ # Export all projects
38
+ npx sqlew db:export --output=full-backup.json
39
+
40
+ # Export to stdout (pipe to file or another command)
41
+ npx sqlew db:export --project=myproject
42
+
43
+ # Export with explicit database path
44
+ npx sqlew db:export --project=myproject --db-path=.sqlew/sqlew.db --output=data.json
45
+
46
+ EXPORT FORMAT:
47
+ The exported JSON contains:
48
+ - Project metadata
49
+ - Master tables (agents, files, tags, etc.) - only entries used by project
50
+ - Transaction tables (decisions, tasks, constraints, etc.) - filtered by project_id
51
+ - Statistics (decision count, task count, etc.)
52
+
53
+ IMPORT WORKFLOW:
54
+ 1. Export data from source database:
55
+ npx sqlew db:export --project=visualizer --output=data.json
56
+
57
+ 2. Copy JSON file to target project directory
58
+
59
+ 3. Import data into target database:
60
+ npx sqlew db:import --source=data.json --project-name=visualizer-v2
61
+
62
+ SEE ALSO:
63
+ npx sqlew db:dump --help # SQL export with schema (for full database migration)
64
+ npx sqlew db:import --help # Import JSON data (append to existing database)
65
+ `);
66
+ }
67
+ /**
68
+ * Parse command-line arguments for db:export
69
+ */
70
+ export function parseDbExportArgs(args) {
71
+ const parsed = {};
72
+ for (let i = 0; i < args.length; i++) {
73
+ const arg = args[i];
74
+ if (arg.startsWith('--')) {
75
+ // Handle both --key=value and --key value formats
76
+ let key;
77
+ let value;
78
+ if (arg.includes('=')) {
79
+ // --key=value format
80
+ const [k, ...v] = arg.slice(2).split('=');
81
+ key = k;
82
+ value = v.join('='); // Rejoin in case value contains '='
83
+ }
84
+ else {
85
+ // --key value format
86
+ key = arg.slice(2);
87
+ value = args[i + 1];
88
+ }
89
+ if (key === 'help') {
90
+ parsed.help = true;
91
+ }
92
+ else if (value && !value.startsWith('--')) {
93
+ if (key === 'db-path') {
94
+ parsed['db-path'] = value;
95
+ }
96
+ else if (key === 'config') {
97
+ parsed.config = value;
98
+ }
99
+ else {
100
+ parsed[key] = value;
101
+ }
102
+ // Only skip next arg if we used --key value format (not --key=value)
103
+ if (!arg.includes('=')) {
104
+ i++;
105
+ }
106
+ }
107
+ }
108
+ }
109
+ return parsed;
110
+ }
111
+ /**
112
+ * Validate db:export arguments
113
+ */
114
+ function validateArgs(args) {
115
+ // No required arguments - project name is optional
116
+ // If not specified, exports all projects
117
+ return null;
118
+ }
119
+ /**
120
+ * Execute db:export command
121
+ */
122
+ export async function executeDbExport(args) {
123
+ // Show help if requested
124
+ if (args.help) {
125
+ showDbExportHelp();
126
+ return;
127
+ }
128
+ // Validate arguments
129
+ const validationError = validateArgs(args);
130
+ if (validationError) {
131
+ console.error(validationError);
132
+ console.error('Run "npx sqlew db:export --help" for usage information.');
133
+ process.exit(1);
134
+ }
135
+ const projectName = args.project;
136
+ const output = args.output;
137
+ // Load config file - prioritize: explicit --config > default locations
138
+ console.error(`Loading config file...`);
139
+ const fileConfig = loadConfigFile(process.cwd(), args.config);
140
+ if (fileConfig.database) {
141
+ console.error(`Config loaded: database.type = ${fileConfig.database.type || 'sqlite'}`);
142
+ if (fileConfig.database.path) {
143
+ console.error(`Config loaded: database.path = ${fileConfig.database.path}`);
144
+ }
145
+ if (fileConfig.database.connection) {
146
+ console.error(`Config loaded: database.connection configured`);
147
+ }
148
+ }
149
+ // Determine source database - normalize 'postgres' to 'postgresql'
150
+ const configDbType = fileConfig.database?.type || 'sqlite';
151
+ const sourceDb = configDbType === 'postgres' ? 'postgresql' : configDbType;
152
+ try {
153
+ console.error(`Reading from ${sourceDb.toUpperCase()} database...`);
154
+ if (projectName) {
155
+ console.error(`Exporting project: ${projectName}`);
156
+ }
157
+ else {
158
+ console.error(`Exporting all projects`);
159
+ }
160
+ // Create Knex instance based on source database
161
+ let db;
162
+ if (sourceDb === 'sqlite') {
163
+ // SQLite source - prioritize: CLI arg > config file (default) > env var > hardcoded default
164
+ const dbPath = args['db-path'] || fileConfig.database?.path || process.env.SQLEW_DB_PATH || '.sqlew/sqlew.db';
165
+ const resolvedDbPath = path.resolve(process.cwd(), dbPath);
166
+ // Check if database exists
167
+ if (!fs.existsSync(resolvedDbPath)) {
168
+ console.error(`Error: SQLite database not found at ${resolvedDbPath}`);
169
+ process.exit(1);
170
+ }
171
+ const config = { ...knexConfig.development };
172
+ config.connection = { filename: resolvedDbPath };
173
+ db = knex(config);
174
+ console.error(`Connected to SQLite: ${resolvedDbPath}`);
175
+ }
176
+ else if (sourceDb === 'mysql') {
177
+ // MySQL source - use config file (default) or environment variables
178
+ const config = { ...knexConfig.mysql };
179
+ if (fileConfig.database?.connection) {
180
+ // Override with config file settings
181
+ config.connection = {
182
+ host: fileConfig.database.connection.host || '127.0.0.1',
183
+ port: fileConfig.database.connection.port || 3306,
184
+ user: fileConfig.database.auth?.user || 'root',
185
+ password: fileConfig.database.auth?.password || '',
186
+ database: fileConfig.database.connection.database || 'mcp_context',
187
+ charset: 'utf8mb4',
188
+ };
189
+ console.error(`Using MySQL connection from config file`);
190
+ }
191
+ db = knex(config);
192
+ const conn = config.connection;
193
+ console.error(`Connected to MySQL: ${conn.host}:${conn.port}/${conn.database}`);
194
+ }
195
+ else if (sourceDb === 'postgresql') {
196
+ // PostgreSQL source - use config file (default) or environment variables
197
+ const config = { ...knexConfig.postgresql };
198
+ if (fileConfig.database?.connection) {
199
+ // Override with config file settings
200
+ config.connection = {
201
+ host: fileConfig.database.connection.host || 'localhost',
202
+ port: fileConfig.database.connection.port || 5432,
203
+ user: fileConfig.database.auth?.user || 'postgres',
204
+ password: fileConfig.database.auth?.password || '',
205
+ database: fileConfig.database.connection.database || 'mcp_context',
206
+ };
207
+ console.error(`Using PostgreSQL connection from config file`);
208
+ }
209
+ db = knex(config);
210
+ const conn = config.connection;
211
+ console.error(`Connected to PostgreSQL: ${conn.host}:${conn.port}/${conn.database}`);
212
+ }
213
+ else {
214
+ console.error(`Error: Unsupported source database: ${sourceDb}`);
215
+ process.exit(1);
216
+ }
217
+ try {
218
+ // Generate JSON export
219
+ const json = await generateJsonExport(db, {
220
+ projectName,
221
+ });
222
+ // Output to file or stdout
223
+ if (output) {
224
+ fs.writeFileSync(output, json, 'utf-8');
225
+ console.error(`✓ JSON export written to: ${output}`);
226
+ console.error(`\nNext steps:`);
227
+ console.error(` 1. Copy file to target project directory`);
228
+ console.error(` 2. Import data: npx sqlew db:import --source=${output}`);
229
+ }
230
+ else {
231
+ // Output to stdout (user can pipe to file)
232
+ console.log(json);
233
+ }
234
+ }
235
+ finally {
236
+ await db.destroy();
237
+ }
238
+ }
239
+ catch (error) {
240
+ console.error('Error generating JSON export:', error instanceof Error ? error.message : String(error));
241
+ process.exit(1);
242
+ }
243
+ }
244
+ /**
245
+ * Main entry point for db:export command
246
+ */
247
+ export async function dbExportCommand(args) {
248
+ const parsedArgs = parseDbExportArgs(args);
249
+ await executeDbExport(parsedArgs);
250
+ }
251
+ //# sourceMappingURL=db-export.js.map
@@ -0,0 +1 @@
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AAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,IAAc;IAClD,MAAM,UAAU,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,eAAe,CAAC,UAAU,CAAC,CAAC;AACpC,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * db:import CLI command - JSON data import for multi-project migration
3
+ * Complements db:export (JSON export) and db:dump (SQL export)
4
+ */
5
+ interface DbImportArgs {
6
+ source: string;
7
+ 'project-name'?: string;
8
+ 'skip-if-exists'?: boolean;
9
+ 'dry-run'?: boolean;
10
+ 'db-path'?: string;
11
+ config?: string;
12
+ help?: boolean;
13
+ }
14
+ /**
15
+ * Show help message for db:import command
16
+ */
17
+ export declare function showDbImportHelp(): void;
18
+ /**
19
+ * Parse command-line arguments for db:import
20
+ */
21
+ export declare function parseDbImportArgs(args: string[]): DbImportArgs;
22
+ /**
23
+ * Execute db:import command
24
+ */
25
+ export declare function executeDbImport(args: DbImportArgs): Promise<void>;
26
+ /**
27
+ * Main entry point for db:import command
28
+ */
29
+ export declare function dbImportCommand(args: string[]): Promise<void>;
30
+ export {};
31
+ //# sourceMappingURL=db-import.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db-import.d.ts","sourceRoot":"","sources":["../../src/cli/db-import.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,UAAU,YAAY;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAqDvC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,YAAY,CAiD9D;AAiBD;;GAEG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA2HvE;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAGnE"}