@vibegrid/mcp 0.4.0-beta.2 → 0.4.0-beta.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.
- package/dist/index.js +61 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -238,7 +238,8 @@ function createSchema() {
|
|
|
238
238
|
hook_session_id TEXT,
|
|
239
239
|
status_source TEXT,
|
|
240
240
|
saved_at INTEGER,
|
|
241
|
-
sort_order INTEGER NOT NULL DEFAULT 0
|
|
241
|
+
sort_order INTEGER NOT NULL DEFAULT 0,
|
|
242
|
+
worktree_name TEXT
|
|
242
243
|
);
|
|
243
244
|
|
|
244
245
|
CREATE TABLE IF NOT EXISTS schedule_log (
|
|
@@ -331,6 +332,7 @@ function createSchema() {
|
|
|
331
332
|
CREATE INDEX IF NOT EXISTS idx_session_events_type ON session_events(event_type, timestamp DESC);
|
|
332
333
|
`);
|
|
333
334
|
migrateSchema(d);
|
|
335
|
+
verifySchema(d);
|
|
334
336
|
}
|
|
335
337
|
function migrateSchema(d) {
|
|
336
338
|
const row = d.prepare("SELECT value FROM schema_meta WHERE key = 'schema_version'").get();
|
|
@@ -400,6 +402,63 @@ function migrateSchema(d) {
|
|
|
400
402
|
})();
|
|
401
403
|
logger_default.info("[database] migrated schema to version 3 (session sort order)");
|
|
402
404
|
}
|
|
405
|
+
if (version < 4) {
|
|
406
|
+
d.transaction(() => {
|
|
407
|
+
const sessionCols = d.prepare("PRAGMA table_info(sessions)").all();
|
|
408
|
+
if (!sessionCols.some((c) => c.name === "worktree_name")) {
|
|
409
|
+
d.exec("ALTER TABLE sessions ADD COLUMN worktree_name TEXT");
|
|
410
|
+
}
|
|
411
|
+
d.prepare(
|
|
412
|
+
"INSERT OR REPLACE INTO schema_meta (key, value) VALUES ('schema_version', '4')"
|
|
413
|
+
).run();
|
|
414
|
+
})();
|
|
415
|
+
logger_default.info("[database] migrated schema to version 4 (worktree name)");
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
function verifySchema(d) {
|
|
419
|
+
const expectedByTable = {
|
|
420
|
+
projects: [
|
|
421
|
+
{
|
|
422
|
+
column: "workspace_id",
|
|
423
|
+
ddl: "ALTER TABLE projects ADD COLUMN workspace_id TEXT NOT NULL DEFAULT 'personal'"
|
|
424
|
+
}
|
|
425
|
+
],
|
|
426
|
+
workflows: [
|
|
427
|
+
{
|
|
428
|
+
column: "workspace_id",
|
|
429
|
+
ddl: "ALTER TABLE workflows ADD COLUMN workspace_id TEXT NOT NULL DEFAULT 'personal'"
|
|
430
|
+
}
|
|
431
|
+
],
|
|
432
|
+
remote_hosts: [
|
|
433
|
+
{ column: "auth_method", ddl: "ALTER TABLE remote_hosts ADD COLUMN auth_method TEXT" },
|
|
434
|
+
{ column: "credential_id", ddl: "ALTER TABLE remote_hosts ADD COLUMN credential_id TEXT" },
|
|
435
|
+
{
|
|
436
|
+
column: "encrypted_password",
|
|
437
|
+
ddl: "ALTER TABLE remote_hosts ADD COLUMN encrypted_password TEXT"
|
|
438
|
+
}
|
|
439
|
+
],
|
|
440
|
+
sessions: [
|
|
441
|
+
{
|
|
442
|
+
column: "sort_order",
|
|
443
|
+
ddl: "ALTER TABLE sessions ADD COLUMN sort_order INTEGER NOT NULL DEFAULT 0"
|
|
444
|
+
},
|
|
445
|
+
{ column: "worktree_name", ddl: "ALTER TABLE sessions ADD COLUMN worktree_name TEXT" }
|
|
446
|
+
]
|
|
447
|
+
};
|
|
448
|
+
for (const [table, columns] of Object.entries(expectedByTable)) {
|
|
449
|
+
const existing = new Set(
|
|
450
|
+
d.prepare(`PRAGMA table_info(${table})`).all().map((c) => c.name)
|
|
451
|
+
);
|
|
452
|
+
for (const { column, ddl } of columns) {
|
|
453
|
+
if (existing.has(column)) continue;
|
|
454
|
+
try {
|
|
455
|
+
d.exec(ddl);
|
|
456
|
+
logger_default.warn(`[database] self-heal: added missing column ${table}.${column}`);
|
|
457
|
+
} catch (err) {
|
|
458
|
+
logger_default.error(`[database] self-heal: failed to add ${table}.${column}:`, err);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
403
462
|
}
|
|
404
463
|
function loadConfig() {
|
|
405
464
|
const d = getDb();
|
|
@@ -2215,7 +2274,7 @@ console.warn = (...args) => _origError("[mcp:warn]", ...args);
|
|
|
2215
2274
|
console.error = (...args) => _origError("[mcp:error]", ...args);
|
|
2216
2275
|
async function main() {
|
|
2217
2276
|
configManager.init();
|
|
2218
|
-
const version = true ? "0.4.0-beta.
|
|
2277
|
+
const version = true ? "0.4.0-beta.4" : createRequire(import.meta.url)("../package.json").version;
|
|
2219
2278
|
const server = createMcpServer(version);
|
|
2220
2279
|
const transport = new StdioServerTransport();
|
|
2221
2280
|
await server.connect(transport);
|