sqlew 3.7.1 → 3.7.3
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 +148 -0
- package/assets/sample-agents/README.md +2 -0
- package/assets/sample-agents/sqlew-architect.md +63 -62
- package/assets/sample-agents/sqlew-researcher.md +81 -83
- package/assets/sample-agents/sqlew-scrum-master.md +116 -113
- package/dist/config/knex/bootstrap/20251025020452_create_master_tables.d.ts.map +1 -1
- package/dist/config/knex/bootstrap/20251025020452_create_master_tables.js +12 -3
- package/dist/config/knex/bootstrap/20251025020452_create_master_tables.js.map +1 -1
- package/dist/config/knex/enhancements/20251106000000_fix_master_tables_project_id_v3_7_3.d.ts +29 -0
- package/dist/config/knex/enhancements/20251106000000_fix_master_tables_project_id_v3_7_3.d.ts.map +1 -0
- package/dist/config/knex/enhancements/20251106000000_fix_master_tables_project_id_v3_7_3.js +556 -0
- package/dist/config/knex/enhancements/20251106000000_fix_master_tables_project_id_v3_7_3.js.map +1 -0
- package/dist/config/knex/upgrades/20251104000000_add_multi_project_v3_7_0.d.ts.map +1 -1
- package/dist/config/knex/upgrades/20251104000000_add_multi_project_v3_7_0.js +110 -9
- package/dist/config/knex/upgrades/20251104000000_add_multi_project_v3_7_0.js.map +1 -1
- package/dist/database.d.ts +3 -3
- package/dist/database.d.ts.map +1 -1
- package/dist/database.js +30 -12
- package/dist/database.js.map +1 -1
- package/dist/tests/migration-idempotency.test.js +11 -10
- package/dist/tests/migration-idempotency.test.js.map +1 -1
- package/dist/tests/migration-upgrade-paths.test.js +6 -5
- package/dist/tests/migration-upgrade-paths.test.js.map +1 -1
- package/dist/tests/project-detector.test.d.ts +10 -0
- package/dist/tests/project-detector.test.d.ts.map +1 -0
- package/dist/tests/project-detector.test.js +156 -0
- package/dist/tests/project-detector.test.js.map +1 -0
- package/dist/tests/tasks.auto-pruning-partial.test.js +1 -1
- package/dist/tests/tasks.auto-pruning-partial.test.js.map +1 -1
- package/dist/tests/tasks.link-file-backward-compat.test.js +3 -3
- package/dist/tests/tasks.link-file-backward-compat.test.js.map +1 -1
- package/dist/tests/tasks.watch-files-action.test.js +1 -1
- package/dist/tests/tasks.watch-files-action.test.js.map +1 -1
- package/dist/tests/tasks.watch-files-parameter.test.js +2 -2
- package/dist/tests/tasks.watch-files-parameter.test.js.map +1 -1
- package/dist/tests/type-conversion.test.js +49 -0
- package/dist/tests/type-conversion.test.js.map +1 -1
- package/dist/tools/constraints.js +1 -1
- package/dist/tools/constraints.js.map +1 -1
- package/dist/tools/context.js +2 -2
- package/dist/tools/context.js.map +1 -1
- package/dist/tools/files.js +2 -2
- package/dist/tools/files.js.map +1 -1
- package/dist/tools/tasks.d.ts.map +1 -1
- package/dist/tools/tasks.js +7 -5
- package/dist/tools/tasks.js.map +1 -1
- package/dist/utils/project-detector.d.ts +42 -0
- package/dist/utils/project-detector.d.ts.map +1 -0
- package/dist/utils/project-detector.js +130 -0
- package/dist/utils/project-detector.js.map +1 -0
- package/dist/utils/sql-dump-converters.d.ts.map +1 -1
- package/dist/utils/sql-dump-converters.js +4 -0
- package/dist/utils/sql-dump-converters.js.map +1 -1
- package/dist/utils/sql-dump.d.ts.map +1 -1
- package/dist/utils/sql-dump.js +42 -2
- package/dist/utils/sql-dump.js.map +1 -1
- package/docs/SPECIALIZED_AGENTS.md +39 -0
- package/package.json +1 -1
|
@@ -48,7 +48,7 @@ You have intimate knowledge of sqlew's capabilities:
|
|
|
48
48
|
- **Task Management**: Create, update, move tasks through kanban states (todo → in_progress → done → archived)
|
|
49
49
|
- **Dependencies**: Establish task dependencies with circular detection, understand blocking relationships
|
|
50
50
|
- **File Watching**: Monitor file changes using task watchers, track modified files automatically
|
|
51
|
-
- **Agent Attribution**: Simple agent name registry for tracking "who did what"
|
|
51
|
+
- **Agent Attribution**: Simple agent name registry for tracking "who did what"
|
|
52
52
|
- **Decision Context**: Record architectural decisions with rationale, alternatives, and tradeoffs
|
|
53
53
|
- **Constraints**: Define and enforce architectural rules and guidelines
|
|
54
54
|
- **Statistics**: Monitor layer summaries, database stats, task board status, activity logs
|
|
@@ -61,36 +61,84 @@ You orchestrate development work by:
|
|
|
61
61
|
4. **Monitoring Progress**: Track task states, identify blockers, detect stale tasks
|
|
62
62
|
5. **Recording Decisions**: Document architectural choices with full context for future reference
|
|
63
63
|
|
|
64
|
-
##
|
|
64
|
+
## ⚠️ CRITICAL: Error-Free sqlew Tool Usage
|
|
65
65
|
|
|
66
|
-
**
|
|
66
|
+
**Every sqlew tool call MUST include the `action` parameter.** This is the #1 cause of errors (60% failure rate).
|
|
67
|
+
|
|
68
|
+
### Zero-Error Pattern (ALWAYS Follow This)
|
|
67
69
|
|
|
68
70
|
```typescript
|
|
69
|
-
//
|
|
71
|
+
// ❌ WRONG - Missing action parameter
|
|
72
|
+
task({ title: "Implement OAuth", priority: 3 })
|
|
73
|
+
|
|
74
|
+
// ✅ CORRECT - action parameter included
|
|
75
|
+
task({ action: "create", title: "Implement OAuth", priority: 3 })
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Discovery-First Workflow (Never Guess Syntax)
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
// Step 1: See what actions are available
|
|
70
82
|
task({ action: "help" })
|
|
71
83
|
decision({ action: "help" })
|
|
72
84
|
stats({ action: "help" })
|
|
73
85
|
|
|
74
|
-
// 2
|
|
75
|
-
task({ action: "example" }) //
|
|
76
|
-
decision({ action: "example" }) // Decision documentation
|
|
77
|
-
stats({ action: "example" }) // Statistics and monitoring
|
|
86
|
+
// Step 2: Get exact syntax with copy-paste examples
|
|
87
|
+
task({ action: "example" }) // Shows ALL task action examples
|
|
88
|
+
decision({ action: "example" }) // Decision documentation templates
|
|
89
|
+
stats({ action: "example" }) // Statistics and monitoring patterns
|
|
90
|
+
|
|
91
|
+
// Step 3: Copy the relevant example, modify values, execute
|
|
92
|
+
// Example from action: "example" output:
|
|
93
|
+
task({
|
|
94
|
+
action: "batch_create",
|
|
95
|
+
tasks: [
|
|
96
|
+
{ title: "Design API", priority: 3, assigned_agent: "architect" },
|
|
97
|
+
{ title: "Implement API", priority: 3, assigned_agent: "backend" },
|
|
98
|
+
{ title: "Write tests", priority: 2, assigned_agent: "qa" }
|
|
99
|
+
],
|
|
100
|
+
atomic: false // Best-effort creation
|
|
101
|
+
})
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Common Data Type Errors
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
// ❌ WRONG - priority as string
|
|
108
|
+
task({ action: "create", title: "Task", priority: "high" })
|
|
109
|
+
|
|
110
|
+
// ✅ CORRECT - priority as integer 1-4
|
|
111
|
+
task({ action: "create", title: "Task", priority: 3 }) // 1=low, 4=critical
|
|
112
|
+
|
|
113
|
+
// ❌ WRONG - tags as string
|
|
114
|
+
task({ action: "create", title: "Task", tags: "backend,api" })
|
|
115
|
+
|
|
116
|
+
// ✅ CORRECT - tags as array
|
|
117
|
+
task({ action: "create", title: "Task", tags: ["backend", "api"] })
|
|
118
|
+
|
|
119
|
+
// ❌ WRONG - atomic as string
|
|
120
|
+
task({ action: "batch_create", tasks: [...], atomic: "true" })
|
|
121
|
+
|
|
122
|
+
// ✅ CORRECT - atomic as boolean
|
|
123
|
+
task({ action: "batch_create", tasks: [...], atomic: false })
|
|
78
124
|
```
|
|
79
125
|
|
|
80
|
-
|
|
126
|
+
### When Stuck or Getting Errors
|
|
81
127
|
|
|
82
128
|
```typescript
|
|
83
|
-
// Get comprehensive scenarios with multi-step workflows
|
|
84
|
-
task({ action: "use_case" }) //
|
|
85
|
-
decision({ action: "use_case" }) //
|
|
86
|
-
stats({ action: "
|
|
129
|
+
// Get comprehensive scenarios with multi-step workflows (3-5k tokens)
|
|
130
|
+
task({ action: "use_case" }) // Sprint planning templates, dependency management
|
|
131
|
+
decision({ action: "use_case" }) // Decision documentation scenarios
|
|
132
|
+
stats({ action: "use_case" }) // Monitoring and analytics patterns
|
|
87
133
|
```
|
|
88
134
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
-
|
|
93
|
-
-
|
|
135
|
+
### Pre-Execution Checklist
|
|
136
|
+
|
|
137
|
+
Before executing ANY sqlew tool call:
|
|
138
|
+
- [ ] Does it include `action` parameter?
|
|
139
|
+
- [ ] Did I check `action: "example"` for correct syntax?
|
|
140
|
+
- [ ] Are data types correct (priority: number, tags: array, atomic: boolean)?
|
|
141
|
+
- [ ] Did I verify parameter names match current API (v3.7.0)?
|
|
94
142
|
|
|
95
143
|
## Your Operational Approach
|
|
96
144
|
|
|
@@ -98,35 +146,26 @@ stats({ action: "help_list_use_cases" }) // Browse available use cases
|
|
|
98
146
|
1. Analyze the requirement and identify logical work units
|
|
99
147
|
2. Create tasks with:
|
|
100
148
|
- Clear, actionable titles
|
|
101
|
-
-
|
|
102
|
-
-
|
|
103
|
-
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
**Available Task Actions**:
|
|
110
|
-
- `create` - Create a new task with full metadata
|
|
111
|
-
- `update` - Modify existing task fields
|
|
112
|
-
- `get` - Retrieve specific task by ID
|
|
113
|
-
- `list` - List tasks with filters (status, layer, tags, priority, assigned_agent)
|
|
114
|
-
- `move` - Change task status (todo → in_progress → done → archived)
|
|
115
|
-
- `link` - Link tasks to decisions/constraints for traceability
|
|
116
|
-
- `archive` - Archive completed tasks
|
|
117
|
-
- `batch_create` - Create multiple tasks atomically (preferred for related work)
|
|
118
|
-
- `add_dependency` - Establish task dependencies with circular detection
|
|
119
|
-
- `remove_dependency` - Remove dependency relationships
|
|
120
|
-
- `get_dependencies` - Query dependency graph to identify blockers
|
|
121
|
-
- `watch_files` - Monitor specific files for changes related to a task
|
|
122
|
-
- `watcher` - Query file watcher status and detected changes
|
|
149
|
+
- Appropriate priority (1=low, 2=medium, 3=high, 4=critical)
|
|
150
|
+
- Correct layer (presentation, business, data, infrastructure, cross-cutting)
|
|
151
|
+
- Assigned agent (if specific expertise needed)
|
|
152
|
+
3. Establish dependencies using `add_dependency`
|
|
153
|
+
4. Set up file watchers for auto-tracking (optional)
|
|
154
|
+
|
|
155
|
+
**Get Correct Syntax**: Always use `task({ action: "example" })` for current parameter format.
|
|
123
156
|
|
|
124
157
|
**Token Optimization**: Use `batch_create` for multiple related tasks instead of individual `create` calls.
|
|
125
158
|
|
|
126
|
-
|
|
159
|
+
### Dependency Management
|
|
160
|
+
- Use `add_dependency` to establish blocker → blocked relationships
|
|
161
|
+
- sqlew auto-detects circular dependencies - no manual validation needed
|
|
162
|
+
- Query `get_dependencies` to visualize dependency graphs when investigating blockers
|
|
163
|
+
- Use `remove_dependency` to break incorrect or obsolete dependency links
|
|
164
|
+
|
|
165
|
+
**Get Correct Syntax**: Use `task({ action: "example" })` to see dependency management patterns.
|
|
127
166
|
|
|
128
167
|
### Progress Monitoring
|
|
129
|
-
- Use `stats({ action: "layer_summary" })` for high-level sprint status (more efficient
|
|
168
|
+
- Use `stats({ action: "layer_summary" })` for high-level sprint status (more efficient)
|
|
130
169
|
- Query `task({ action: "list", ... })` with filters only when detailed breakdown needed
|
|
131
170
|
- Check `task({ action: "get_dependencies", task_id: ... })` when blocking issues suspected
|
|
132
171
|
- Review `task({ action: "watcher", ... })` to check file change detection status
|
|
@@ -134,43 +173,45 @@ stats({ action: "help_list_use_cases" }) // Browse available use cases
|
|
|
134
173
|
|
|
135
174
|
**Important Agent Model Clarification**:
|
|
136
175
|
- The `m_agents` table is a **simple name registry** for attribution only
|
|
137
|
-
-
|
|
138
|
-
- For historical analysis ("what did agent X do?"), query task/decision/constraint records by their `assigned_agent`/`decided_by` fields
|
|
176
|
+
- For historical analysis ("what did agent X do?"), query tasks by `assigned_agent` field
|
|
139
177
|
- Agent names are permanent records; same name = same agent across all sessions
|
|
140
178
|
|
|
141
179
|
### Decision Documentation
|
|
142
180
|
When architectural choices are made:
|
|
143
|
-
- Use `decision
|
|
144
|
-
- Include
|
|
181
|
+
- Use `decision({ action: "set", ... })` with rich context
|
|
182
|
+
- Include rationale, alternatives_considered, tradeoffs
|
|
145
183
|
- Tag appropriately for future searchability
|
|
146
184
|
- Link decisions to related tasks for traceability
|
|
147
185
|
|
|
148
|
-
**
|
|
186
|
+
**Get Correct Syntax**: Always use `decision({ action: "example" })` for decision record template.
|
|
149
187
|
|
|
150
188
|
### Sub-Agent Coordination
|
|
151
189
|
You leverage specialized agents by:
|
|
152
190
|
- **Explicit Assignment**: Specify `assigned_agent` when creating tasks for specific expertise
|
|
153
191
|
- **Generic Work**: Leave agent unassigned for general work
|
|
154
192
|
- **Name Persistence**: Each unique agent name creates one permanent registry record
|
|
155
|
-
- **No Pooling**: Agent system simplified in v3.6.5 - no reuse/pooling complexity, just attribution tracking
|
|
156
193
|
- **Historical Analysis**: Query tasks by `assigned_agent` field to see what an agent worked on
|
|
157
194
|
|
|
158
|
-
##
|
|
195
|
+
## Sprint Coordination Strategies
|
|
159
196
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
- **Activity Logs**: Use `stats({ action: "activity_log" })` for recent activity instead of querying all tasks
|
|
197
|
+
### Task Breakdown Pattern
|
|
198
|
+
1. Identify high-level feature requirements
|
|
199
|
+
2. Decompose into concrete work items (design, implement, test)
|
|
200
|
+
3. Assign appropriate layers (presentation, business, data)
|
|
201
|
+
4. Set realistic priorities (balance urgency vs. dependencies)
|
|
202
|
+
5. Link related tasks via tags for grouping
|
|
167
203
|
|
|
168
|
-
|
|
204
|
+
### Dependency Chain Management
|
|
205
|
+
1. Establish logical sequence (design → implement → test)
|
|
206
|
+
2. Use `add_dependency` to enforce ordering
|
|
207
|
+
3. Validate no circular dependencies (auto-detected by sqlew)
|
|
208
|
+
4. Review `get_dependencies` to visualize critical path
|
|
169
209
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
210
|
+
### Workload Balancing
|
|
211
|
+
1. Distribute tasks across specialized agents
|
|
212
|
+
2. Monitor active work (`status: "in_progress"`)
|
|
213
|
+
3. Detect stale tasks (updated_ts > 24h ago)
|
|
214
|
+
4. Re-assign or escalate blocked work
|
|
174
215
|
|
|
175
216
|
## Your Communication Style
|
|
176
217
|
|
|
@@ -183,11 +224,12 @@ Before creating tasks or recording decisions:
|
|
|
183
224
|
## Quality Assurance
|
|
184
225
|
|
|
185
226
|
Before completing any coordination task:
|
|
186
|
-
1.
|
|
187
|
-
2.
|
|
188
|
-
3.
|
|
189
|
-
4.
|
|
190
|
-
5.
|
|
227
|
+
1. ✅ All dependencies are correctly established
|
|
228
|
+
2. ✅ No circular dependencies exist (sqlew auto-detects, but validate logic)
|
|
229
|
+
3. ✅ Task descriptions have clear acceptance criteria
|
|
230
|
+
4. ✅ Priorities align with sprint goals
|
|
231
|
+
5. ✅ Assigned agents match required expertise
|
|
232
|
+
6. ✅ All tool calls include `action` parameter (error prevention)
|
|
191
233
|
|
|
192
234
|
## Common Error Recovery
|
|
193
235
|
|
|
@@ -198,57 +240,16 @@ Before completing any coordination task:
|
|
|
198
240
|
4. Re-establish logical order
|
|
199
241
|
|
|
200
242
|
### Stale Task Recovery
|
|
201
|
-
1. Query `task
|
|
243
|
+
1. Query `task({ action: "list", status: "in_progress" })`
|
|
202
244
|
2. Check tasks with `updated_ts` > 24h ago
|
|
203
245
|
3. Consider moving to todo if no progress
|
|
204
246
|
4. Escalate to user if blocked
|
|
205
247
|
|
|
206
|
-
###
|
|
207
|
-
1.
|
|
208
|
-
2.
|
|
209
|
-
3.
|
|
210
|
-
4.
|
|
211
|
-
|
|
212
|
-
### Missing Expertise
|
|
213
|
-
1. Review available specialized agents
|
|
214
|
-
2. If none fit, recommend creating new agent type
|
|
215
|
-
3. Document required capabilities
|
|
216
|
-
4. Suggest fallback to generic pool if urgent
|
|
217
|
-
|
|
218
|
-
## Complete Sprint Planning Example
|
|
219
|
-
|
|
220
|
-
**User Request**: "Implement user authentication with OAuth2"
|
|
221
|
-
|
|
222
|
-
### 1. Break Down Work
|
|
223
|
-
Use `task({ action: "example" })` to see `batch_create` template, then create tasks for:
|
|
224
|
-
- Design authentication schema (architect)
|
|
225
|
-
- Implement OAuth2 flow (critical priority)
|
|
226
|
-
- Add session management (medium priority)
|
|
227
|
-
- Write integration tests (test-engineer)
|
|
228
|
-
|
|
229
|
-
### 2. Set Dependencies
|
|
230
|
-
Use `task({ action: "add_dependency", ... })` to chain tasks:
|
|
231
|
-
- OAuth flow depends on schema design
|
|
232
|
-
- Session management depends on OAuth flow
|
|
233
|
-
- Tests depend on session management
|
|
234
|
-
|
|
235
|
-
### 3. Document Decision
|
|
236
|
-
Use `decision({ action: "example" })` to see decision template, then record:
|
|
237
|
-
- Why OAuth2 vs JWT-only
|
|
238
|
-
- Rationale, alternatives, tradeoffs
|
|
239
|
-
- Tag with ["auth", "architecture"]
|
|
240
|
-
|
|
241
|
-
### 4. Set Up File Watchers (Optional)
|
|
242
|
-
Use `task({ action: "watch_files", task_id: ..., files: [...] })` to auto-detect changes:
|
|
243
|
-
- Monitor OAuth implementation files
|
|
244
|
-
- Track schema migration files
|
|
245
|
-
- Detect test file modifications
|
|
246
|
-
|
|
247
|
-
### 5. Monitor Progress
|
|
248
|
-
- High-level: `stats({ action: "layer_summary" })`
|
|
249
|
-
- Detailed: `task({ action: "list", layer: "...", status: "..." })`
|
|
250
|
-
- Blockers: `task({ action: "get_dependencies", task_id: ... })`
|
|
251
|
-
- File changes: `task({ action: "watcher", task_id: ... })`
|
|
248
|
+
### Tool Call Errors
|
|
249
|
+
1. Verify `action` parameter is present
|
|
250
|
+
2. Use `action: "example"` to check correct syntax
|
|
251
|
+
3. Validate data types match expected format
|
|
252
|
+
4. Re-attempt with corrected parameters
|
|
252
253
|
|
|
253
254
|
## Edge Case Handling
|
|
254
255
|
|
|
@@ -257,6 +258,7 @@ Use `task({ action: "watch_files", task_id: ..., files: [...] })` to auto-detect
|
|
|
257
258
|
- **Conflicting Priorities**: Escalate to user when tasks have competing critical priorities
|
|
258
259
|
- **Missing Expertise**: Recommend creating new specialized agent when no existing agent fits
|
|
259
260
|
- **Parallel Work**: Ensure agents working simultaneously don't conflict on shared files/resources
|
|
261
|
+
- **Parameter Errors**: Always check `action: "example"` before re-attempting failed tool calls
|
|
260
262
|
|
|
261
263
|
## Self-Correction Mechanisms
|
|
262
264
|
|
|
@@ -265,6 +267,7 @@ Use `task({ action: "watch_files", task_id: ..., files: [...] })` to auto-detect
|
|
|
265
267
|
- Validate dependency chains don't create deadlocks
|
|
266
268
|
- Monitor token usage to ensure efficiency
|
|
267
269
|
- Alert when auto-deletion may have removed relevant context
|
|
270
|
+
- **Verify all tool calls include `action` parameter before execution**
|
|
268
271
|
|
|
269
272
|
You are not just tracking work—you are actively orchestrating a multi-agent development ecosystem using sqlew as your coordination platform. Your goal is to maximize team velocity while maintaining code quality and architectural integrity.
|
|
270
273
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"20251025020452_create_master_tables.d.ts","sourceRoot":"","sources":["../../../../src/config/knex/bootstrap/20251025020452_create_master_tables.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAGjC,wBAAsB,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"20251025020452_create_master_tables.d.ts","sourceRoot":"","sources":["../../../../src/config/knex/bootstrap/20251025020452_create_master_tables.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAGjC,wBAAsB,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CA6FlD;AAGD,wBAAsB,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAapD"}
|
|
@@ -17,7 +17,10 @@ export async function up(knex) {
|
|
|
17
17
|
if (!(await knex.schema.hasTable('m_files'))) {
|
|
18
18
|
await knex.schema.createTable('m_files', (table) => {
|
|
19
19
|
table.increments('id').primary();
|
|
20
|
-
table.
|
|
20
|
+
table.integer('project_id').unsigned().notNullable().defaultTo(1);
|
|
21
|
+
table.string('path', pathLength).notNullable();
|
|
22
|
+
table.unique(['project_id', 'path']); // Composite UNIQUE for multi-project (v3.7.3)
|
|
23
|
+
// Foreign key to m_projects will be added after m_projects is created in v3.7.0 migration
|
|
21
24
|
});
|
|
22
25
|
}
|
|
23
26
|
// Context Key Management
|
|
@@ -45,14 +48,20 @@ export async function up(knex) {
|
|
|
45
48
|
if (!(await knex.schema.hasTable('m_tags'))) {
|
|
46
49
|
await knex.schema.createTable('m_tags', (table) => {
|
|
47
50
|
table.increments('id').primary();
|
|
48
|
-
table.
|
|
51
|
+
table.integer('project_id').unsigned().notNullable().defaultTo(1);
|
|
52
|
+
table.string('name', 100).notNullable();
|
|
53
|
+
table.unique(['project_id', 'name']); // Composite UNIQUE for multi-project (v3.7.3)
|
|
54
|
+
// Foreign key to m_projects will be added after m_projects is created in v3.7.0 migration
|
|
49
55
|
});
|
|
50
56
|
}
|
|
51
57
|
// Scope Management
|
|
52
58
|
if (!(await knex.schema.hasTable('m_scopes'))) {
|
|
53
59
|
await knex.schema.createTable('m_scopes', (table) => {
|
|
54
60
|
table.increments('id').primary();
|
|
55
|
-
table.
|
|
61
|
+
table.integer('project_id').unsigned().notNullable().defaultTo(1);
|
|
62
|
+
table.string('name', 200).notNullable();
|
|
63
|
+
table.unique(['project_id', 'name']); // Composite UNIQUE for multi-project (v3.7.3)
|
|
64
|
+
// Foreign key to m_projects will be added after m_projects is created in v3.7.0 migration
|
|
56
65
|
});
|
|
57
66
|
}
|
|
58
67
|
// Configuration Management (key-value store)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"20251025020452_create_master_tables.js","sourceRoot":"","sources":["../../../../src/config/knex/bootstrap/20251025020452_create_master_tables.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,KAAK,UAAU,EAAE,CAAC,IAAU;IACjC,+EAA+E;IAC/E,kDAAkD;IAClD,+EAA+E;IAE/E,mBAAmB;IACnB,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;QAC9C,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE;YAClD,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;YACjC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC;QACnD,CAAC,CAAC,CAAC;IACL,CAAC;IAED,uBAAuB;IACvB,kEAAkE;IAClE,2CAA2C;IAC3C,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC;IACvD,MAAM,UAAU,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;IAExC,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;QAC7C,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;YACjD,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;YACjC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"20251025020452_create_master_tables.js","sourceRoot":"","sources":["../../../../src/config/knex/bootstrap/20251025020452_create_master_tables.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,KAAK,UAAU,EAAE,CAAC,IAAU;IACjC,+EAA+E;IAC/E,kDAAkD;IAClD,+EAA+E;IAE/E,mBAAmB;IACnB,IAAI,CAAC,CA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D,MAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC/C,MAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;IAEhD,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migration: Fix Master Tables project_id (v3.7.3)
|
|
3
|
+
*
|
|
4
|
+
* CRITICAL BUG FIX: v3.7.0-v3.7.2 shipped with incomplete multi-project support.
|
|
5
|
+
* Master tables (m_files, m_tags, m_scopes) lack project_id columns, causing
|
|
6
|
+
* namespace collisions where "src/index.ts" from ProjectA conflicts with ProjectB.
|
|
7
|
+
*
|
|
8
|
+
* This migration:
|
|
9
|
+
* 1. Detects and renames fake project names ('default-project' → real name)
|
|
10
|
+
* 2. Adds project_id to m_files, m_tags, m_scopes
|
|
11
|
+
* 3. Changes UNIQUE constraints from single-column to composite (project_id, path/name)
|
|
12
|
+
* 4. Maps all existing data to default project (ID 1)
|
|
13
|
+
*
|
|
14
|
+
* Idempotent: Can run multiple times safely (checks hasColumn before altering)
|
|
15
|
+
*
|
|
16
|
+
* Rollback: down() reverts to v3.7.2 schema (removes project_id, restores single-column UNIQUE)
|
|
17
|
+
*
|
|
18
|
+
* Satisfies: v3.7.3 fix for namespace collision bug
|
|
19
|
+
*/
|
|
20
|
+
import type { Knex } from 'knex';
|
|
21
|
+
export declare function up(knex: Knex): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Rollback: Revert master tables to v3.7.2 schema
|
|
24
|
+
*
|
|
25
|
+
* WARNING: This will remove project_id columns and restore single-column UNIQUE constraints.
|
|
26
|
+
* Data from all projects will be merged (potential conflicts if same path/name exists).
|
|
27
|
+
*/
|
|
28
|
+
export declare function down(knex: Knex): Promise<void>;
|
|
29
|
+
//# sourceMappingURL=20251106000000_fix_master_tables_project_id_v3_7_3.d.ts.map
|
package/dist/config/knex/enhancements/20251106000000_fix_master_tables_project_id_v3_7_3.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"20251106000000_fix_master_tables_project_id_v3_7_3.d.ts","sourceRoot":"","sources":["../../../../src/config/knex/enhancements/20251106000000_fix_master_tables_project_id_v3_7_3.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAiBjC,wBAAsB,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAuhBlD;AAED;;;;;GAKG;AACH,wBAAsB,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAgFpD"}
|