@cleocode/cleo 2026.3.60 → 2026.3.61
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/cli/index.js +90 -24
- package/dist/cli/index.js.map +2 -2
- package/dist/mcp/index.js +74 -8
- package/dist/mcp/index.js.map +2 -2
- package/package.json +3 -3
package/dist/mcp/index.js
CHANGED
|
@@ -11229,16 +11229,33 @@ function runMigrations(nativeDb, db) {
|
|
|
11229
11229
|
);
|
|
11230
11230
|
}
|
|
11231
11231
|
}
|
|
11232
|
-
|
|
11232
|
+
if (tableExists3(nativeDb, "__drizzle_migrations") && tableExists3(nativeDb, "tasks")) {
|
|
11233
|
+
const localMigrations = readMigrationFiles({ migrationsFolder });
|
|
11234
|
+
const localHashes = new Set(localMigrations.map((m) => m.hash));
|
|
11235
|
+
const dbEntries = nativeDb.prepare('SELECT hash FROM "__drizzle_migrations"').all();
|
|
11236
|
+
const hasOrphanedEntries = dbEntries.some((e) => !localHashes.has(e.hash));
|
|
11237
|
+
if (hasOrphanedEntries) {
|
|
11238
|
+
const log11 = getLogger("sqlite");
|
|
11239
|
+
log11.warn(
|
|
11240
|
+
{ orphaned: dbEntries.filter((e) => !localHashes.has(e.hash)).length },
|
|
11241
|
+
"Detected stale migration journal entries from a previous CLEO version. Reconciling."
|
|
11242
|
+
);
|
|
11243
|
+
nativeDb.exec('DELETE FROM "__drizzle_migrations"');
|
|
11244
|
+
for (const m of localMigrations) {
|
|
11245
|
+
nativeDb.exec(
|
|
11246
|
+
`INSERT INTO "__drizzle_migrations" ("hash", "created_at") VALUES ('${m.hash}', ${m.folderMillis})`
|
|
11247
|
+
);
|
|
11248
|
+
}
|
|
11249
|
+
}
|
|
11250
|
+
}
|
|
11233
11251
|
for (let attempt = 1; attempt <= MAX_MIGRATION_RETRIES; attempt++) {
|
|
11234
11252
|
try {
|
|
11235
11253
|
migrate(db, { migrationsFolder });
|
|
11236
|
-
|
|
11254
|
+
break;
|
|
11237
11255
|
} catch (err) {
|
|
11238
11256
|
if (!isSqliteBusy(err) || attempt === MAX_MIGRATION_RETRIES) {
|
|
11239
11257
|
throw err;
|
|
11240
11258
|
}
|
|
11241
|
-
lastError = err;
|
|
11242
11259
|
const delay = Math.min(
|
|
11243
11260
|
MIGRATION_RETRY_BASE_DELAY_MS * 2 ** (attempt - 1) * (1 + Math.random() * 0.5),
|
|
11244
11261
|
MIGRATION_RETRY_MAX_DELAY_MS
|
|
@@ -11246,7 +11263,19 @@ function runMigrations(nativeDb, db) {
|
|
|
11246
11263
|
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, Math.round(delay));
|
|
11247
11264
|
}
|
|
11248
11265
|
}
|
|
11249
|
-
|
|
11266
|
+
ensureRequiredColumns(nativeDb);
|
|
11267
|
+
}
|
|
11268
|
+
function ensureRequiredColumns(nativeDb) {
|
|
11269
|
+
if (!tableExists3(nativeDb, "tasks")) return;
|
|
11270
|
+
const columns = nativeDb.prepare("PRAGMA table_info(tasks)").all();
|
|
11271
|
+
const existingCols = new Set(columns.map((c) => c.name));
|
|
11272
|
+
for (const req of REQUIRED_TASK_COLUMNS) {
|
|
11273
|
+
if (!existingCols.has(req.name)) {
|
|
11274
|
+
const log11 = getLogger("sqlite");
|
|
11275
|
+
log11.warn({ column: req.name }, `Adding missing column tasks.${req.name} via ALTER TABLE`);
|
|
11276
|
+
nativeDb.exec(`ALTER TABLE tasks ADD COLUMN ${req.name} ${req.ddl}`);
|
|
11277
|
+
}
|
|
11278
|
+
}
|
|
11250
11279
|
}
|
|
11251
11280
|
function closeDb() {
|
|
11252
11281
|
if (_nativeDb2) {
|
|
@@ -11303,7 +11332,7 @@ async function closeAllDatabases() {
|
|
|
11303
11332
|
} catch {
|
|
11304
11333
|
}
|
|
11305
11334
|
}
|
|
11306
|
-
var _require2, DatabaseSync2, DB_FILENAME3, SQLITE_SCHEMA_VERSION, SCHEMA_VERSION, _db2, _nativeDb2, _dbPath2, _initPromise2, _gitTrackingChecked, MIN_BACKUP_TASK_COUNT, MAX_MIGRATION_RETRIES, MIGRATION_RETRY_BASE_DELAY_MS, MIGRATION_RETRY_MAX_DELAY_MS;
|
|
11335
|
+
var _require2, DatabaseSync2, DB_FILENAME3, SQLITE_SCHEMA_VERSION, SCHEMA_VERSION, _db2, _nativeDb2, _dbPath2, _initPromise2, _gitTrackingChecked, MIN_BACKUP_TASK_COUNT, MAX_MIGRATION_RETRIES, MIGRATION_RETRY_BASE_DELAY_MS, MIGRATION_RETRY_MAX_DELAY_MS, REQUIRED_TASK_COLUMNS;
|
|
11307
11336
|
var init_sqlite2 = __esm({
|
|
11308
11337
|
"packages/core/src/store/sqlite.ts"() {
|
|
11309
11338
|
"use strict";
|
|
@@ -11328,6 +11357,9 @@ var init_sqlite2 = __esm({
|
|
|
11328
11357
|
MAX_MIGRATION_RETRIES = 5;
|
|
11329
11358
|
MIGRATION_RETRY_BASE_DELAY_MS = 100;
|
|
11330
11359
|
MIGRATION_RETRY_MAX_DELAY_MS = 2e3;
|
|
11360
|
+
REQUIRED_TASK_COLUMNS = [
|
|
11361
|
+
{ name: "pipeline_stage", ddl: "text" }
|
|
11362
|
+
];
|
|
11331
11363
|
}
|
|
11332
11364
|
});
|
|
11333
11365
|
|
|
@@ -74377,6 +74409,7 @@ var init_migration_sqlite = __esm({
|
|
|
74377
74409
|
// packages/core/src/repair.ts
|
|
74378
74410
|
var repair_exports = {};
|
|
74379
74411
|
__export(repair_exports, {
|
|
74412
|
+
repairMissingColumns: () => repairMissingColumns,
|
|
74380
74413
|
repairMissingCompletedAt: () => repairMissingCompletedAt,
|
|
74381
74414
|
repairMissingSizes: () => repairMissingSizes,
|
|
74382
74415
|
runAllRepairs: () => runAllRepairs
|
|
@@ -74440,12 +74473,43 @@ async function repairMissingCompletedAt(cwd, dryRun) {
|
|
|
74440
74473
|
details: `Set completedAt for ${affected.length} done/cancelled task(s)`
|
|
74441
74474
|
};
|
|
74442
74475
|
}
|
|
74476
|
+
async function repairMissingColumns(cwd, dryRun) {
|
|
74477
|
+
const { getDb: getDb4 } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
|
|
74478
|
+
const db = await getDb4(cwd);
|
|
74479
|
+
const { sql: sql12 } = await import("drizzle-orm");
|
|
74480
|
+
const columns = db.all(sql12`PRAGMA table_info(tasks)`);
|
|
74481
|
+
const existingCols = new Set(columns.map((c) => c.name));
|
|
74482
|
+
const missingCols = ["pipeline_stage"].filter((c) => !existingCols.has(c));
|
|
74483
|
+
if (missingCols.length === 0) {
|
|
74484
|
+
return {
|
|
74485
|
+
action: "fix_missing_columns",
|
|
74486
|
+
status: "skipped",
|
|
74487
|
+
details: "All required columns present on tasks table"
|
|
74488
|
+
};
|
|
74489
|
+
}
|
|
74490
|
+
if (dryRun) {
|
|
74491
|
+
return {
|
|
74492
|
+
action: "fix_missing_columns",
|
|
74493
|
+
status: "preview",
|
|
74494
|
+
details: `Would add missing column(s): ${missingCols.join(", ")}`
|
|
74495
|
+
};
|
|
74496
|
+
}
|
|
74497
|
+
for (const col of missingCols) {
|
|
74498
|
+
db.run(sql12.raw(`ALTER TABLE tasks ADD COLUMN ${col} text`));
|
|
74499
|
+
}
|
|
74500
|
+
return {
|
|
74501
|
+
action: "fix_missing_columns",
|
|
74502
|
+
status: "applied",
|
|
74503
|
+
details: `Added missing column(s): ${missingCols.join(", ")}`
|
|
74504
|
+
};
|
|
74505
|
+
}
|
|
74443
74506
|
async function runAllRepairs(cwd, dryRun) {
|
|
74444
|
-
const [sizes, completedAt] = await Promise.all([
|
|
74507
|
+
const [sizes, completedAt, columns] = await Promise.all([
|
|
74445
74508
|
repairMissingSizes(cwd, dryRun),
|
|
74446
|
-
repairMissingCompletedAt(cwd, dryRun)
|
|
74509
|
+
repairMissingCompletedAt(cwd, dryRun),
|
|
74510
|
+
repairMissingColumns(cwd, dryRun)
|
|
74447
74511
|
]);
|
|
74448
|
-
return [sizes, completedAt];
|
|
74512
|
+
return [sizes, completedAt, columns];
|
|
74449
74513
|
}
|
|
74450
74514
|
var init_repair = __esm({
|
|
74451
74515
|
"packages/core/src/repair.ts"() {
|
|
@@ -78061,6 +78125,7 @@ __export(internal_exports, {
|
|
|
78061
78125
|
WorkflowGateTracker: () => WorkflowGateTracker,
|
|
78062
78126
|
adapters: () => adapters_exports,
|
|
78063
78127
|
addChain: () => addChain,
|
|
78128
|
+
addIssue: () => addIssue,
|
|
78064
78129
|
addRemote: () => addRemote,
|
|
78065
78130
|
addSticky: () => addSticky,
|
|
78066
78131
|
addTask: () => addTask,
|
|
@@ -78701,6 +78766,7 @@ var init_internal = __esm({
|
|
|
78701
78766
|
init_impact();
|
|
78702
78767
|
init_patterns2();
|
|
78703
78768
|
init_prediction();
|
|
78769
|
+
init_create();
|
|
78704
78770
|
init_diagnostics();
|
|
78705
78771
|
init_retry2();
|
|
78706
78772
|
init_chain_store();
|