@cleocode/cleo 2026.4.80 → 2026.4.82
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 +470 -256
- package/dist/cli/index.js.map +4 -4
- package/package.json +8 -8
package/dist/cli/index.js
CHANGED
|
@@ -17403,9 +17403,9 @@ async function readSequenceFromDb(cwd, accessor) {
|
|
|
17403
17403
|
return isValidSequenceState(value) ? value : null;
|
|
17404
17404
|
}
|
|
17405
17405
|
const { getDb: getDb4 } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
|
|
17406
|
-
const { eq:
|
|
17406
|
+
const { eq: eq22 } = await import("drizzle-orm");
|
|
17407
17407
|
const db = await getDb4(cwd);
|
|
17408
|
-
const rows = await db.select().from(schemaMeta).where(
|
|
17408
|
+
const rows = await db.select().from(schemaMeta).where(eq22(schemaMeta.key, SEQUENCE_META_KEY)).all();
|
|
17409
17409
|
const raw = rows[0]?.value;
|
|
17410
17410
|
if (!raw) return null;
|
|
17411
17411
|
try {
|
|
@@ -19236,7 +19236,7 @@ async function linkPipelineAdr(projectRoot, taskId) {
|
|
|
19236
19236
|
return result;
|
|
19237
19237
|
}
|
|
19238
19238
|
const { getDb: getDb4 } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
|
|
19239
|
-
const { and:
|
|
19239
|
+
const { and: and17, eq: eq22 } = await import("drizzle-orm");
|
|
19240
19240
|
const db = await getDb4(projectRoot);
|
|
19241
19241
|
const now2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
19242
19242
|
for (const filePath of matchingFiles) {
|
|
@@ -19246,7 +19246,7 @@ async function linkPipelineAdr(projectRoot, taskId) {
|
|
|
19246
19246
|
const fm = record2.frontmatter;
|
|
19247
19247
|
const content = readFileSync5(filePath, "utf-8");
|
|
19248
19248
|
const relativePath = `.cleo/adrs/${filename}`;
|
|
19249
|
-
const existing = await db.select({ id: architectureDecisions.id }).from(architectureDecisions).where(
|
|
19249
|
+
const existing = await db.select({ id: architectureDecisions.id }).from(architectureDecisions).where(eq22(architectureDecisions.id, record2.id)).all();
|
|
19250
19250
|
const rowBase = {
|
|
19251
19251
|
id: record2.id,
|
|
19252
19252
|
title: record2.title,
|
|
@@ -19266,19 +19266,19 @@ async function linkPipelineAdr(projectRoot, taskId) {
|
|
|
19266
19266
|
updatedAt: now2
|
|
19267
19267
|
};
|
|
19268
19268
|
if (existing.length > 0) {
|
|
19269
|
-
await db.update(architectureDecisions).set(rowBase).where(
|
|
19269
|
+
await db.update(architectureDecisions).set(rowBase).where(eq22(architectureDecisions.id, record2.id));
|
|
19270
19270
|
} else {
|
|
19271
19271
|
await db.insert(architectureDecisions).values({ ...rowBase, createdAt: now2 });
|
|
19272
19272
|
}
|
|
19273
19273
|
result.synced++;
|
|
19274
|
-
await db.delete(adrTaskLinks).where(
|
|
19274
|
+
await db.delete(adrTaskLinks).where(and17(eq22(adrTaskLinks.adrId, record2.id), eq22(adrTaskLinks.taskId, taskId)));
|
|
19275
19275
|
await db.insert(adrTaskLinks).values({ adrId: record2.id, taskId, linkType: "implements" });
|
|
19276
19276
|
result.linked.push({ adrId: record2.id, taskId });
|
|
19277
19277
|
if (fm["Related ADRs"]) {
|
|
19278
19278
|
const relatedIds = fm["Related ADRs"].split(",").map((r) => r.trim()).filter((r) => /^ADR-\d+$/.test(r));
|
|
19279
19279
|
for (const toId of relatedIds) {
|
|
19280
19280
|
try {
|
|
19281
|
-
const targetExists = await db.select({ id: architectureDecisions.id }).from(architectureDecisions).where(
|
|
19281
|
+
const targetExists = await db.select({ id: architectureDecisions.id }).from(architectureDecisions).where(eq22(architectureDecisions.id, toId)).all();
|
|
19282
19282
|
if (targetExists.length > 0) {
|
|
19283
19283
|
await db.insert(adrRelations).values({ fromAdrId: record2.id, toAdrId: toId, relationType: "related" }).onConflictDoNothing();
|
|
19284
19284
|
}
|
|
@@ -19442,7 +19442,7 @@ async function syncAdrsToDb(projectRoot) {
|
|
|
19442
19442
|
return result;
|
|
19443
19443
|
}
|
|
19444
19444
|
const { getDb: getDb4 } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
|
|
19445
|
-
const { eq:
|
|
19445
|
+
const { eq: eq22 } = await import("drizzle-orm");
|
|
19446
19446
|
const db = await getDb4(projectRoot);
|
|
19447
19447
|
const now2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
19448
19448
|
const allFiles = collectAdrFiles(adrsDir);
|
|
@@ -19459,7 +19459,7 @@ async function syncAdrsToDb(projectRoot) {
|
|
|
19459
19459
|
let supersededById = fm["Superseded By"] ? extractAdrIdFromRef(fm["Superseded By"]) : null;
|
|
19460
19460
|
let amendsId = fm.Amends ? extractAdrIdFromRef(fm.Amends) : null;
|
|
19461
19461
|
if (supersedesId) {
|
|
19462
|
-
const exists2 = await db.select({ id: architectureDecisions.id }).from(architectureDecisions).where(
|
|
19462
|
+
const exists2 = await db.select({ id: architectureDecisions.id }).from(architectureDecisions).where(eq22(architectureDecisions.id, supersedesId)).all();
|
|
19463
19463
|
if (exists2.length === 0) {
|
|
19464
19464
|
result.warnings.push(
|
|
19465
19465
|
`${record2.id}: supersedes target ${supersedesId} not found in DB, setting to null`
|
|
@@ -19468,7 +19468,7 @@ async function syncAdrsToDb(projectRoot) {
|
|
|
19468
19468
|
}
|
|
19469
19469
|
}
|
|
19470
19470
|
if (supersededById) {
|
|
19471
|
-
const exists2 = await db.select({ id: architectureDecisions.id }).from(architectureDecisions).where(
|
|
19471
|
+
const exists2 = await db.select({ id: architectureDecisions.id }).from(architectureDecisions).where(eq22(architectureDecisions.id, supersededById)).all();
|
|
19472
19472
|
if (exists2.length === 0) {
|
|
19473
19473
|
result.warnings.push(
|
|
19474
19474
|
`${record2.id}: supersededBy target ${supersededById} not found in DB, setting to null`
|
|
@@ -19477,7 +19477,7 @@ async function syncAdrsToDb(projectRoot) {
|
|
|
19477
19477
|
}
|
|
19478
19478
|
}
|
|
19479
19479
|
if (amendsId) {
|
|
19480
|
-
const exists2 = await db.select({ id: architectureDecisions.id }).from(architectureDecisions).where(
|
|
19480
|
+
const exists2 = await db.select({ id: architectureDecisions.id }).from(architectureDecisions).where(eq22(architectureDecisions.id, amendsId)).all();
|
|
19481
19481
|
if (exists2.length === 0) {
|
|
19482
19482
|
result.warnings.push(
|
|
19483
19483
|
`${record2.id}: amends target ${amendsId} not found in DB, setting to null`
|
|
@@ -19503,18 +19503,18 @@ async function syncAdrsToDb(projectRoot) {
|
|
|
19503
19503
|
topics: fm.Topics ?? null,
|
|
19504
19504
|
updatedAt: now2
|
|
19505
19505
|
};
|
|
19506
|
-
const existing = await db.select({ id: architectureDecisions.id }).from(architectureDecisions).where(
|
|
19506
|
+
const existing = await db.select({ id: architectureDecisions.id }).from(architectureDecisions).where(eq22(architectureDecisions.id, record2.id)).all();
|
|
19507
19507
|
if (existing.length > 0) {
|
|
19508
|
-
await db.update(architectureDecisions).set(rowBase).where(
|
|
19508
|
+
await db.update(architectureDecisions).set(rowBase).where(eq22(architectureDecisions.id, record2.id));
|
|
19509
19509
|
result.updated++;
|
|
19510
19510
|
} else {
|
|
19511
19511
|
await db.insert(architectureDecisions).values({ ...rowBase, createdAt: now2 });
|
|
19512
19512
|
result.inserted++;
|
|
19513
19513
|
}
|
|
19514
|
-
await db.delete(adrTaskLinks).where(
|
|
19514
|
+
await db.delete(adrTaskLinks).where(eq22(adrTaskLinks.adrId, record2.id));
|
|
19515
19515
|
if (fm["Related Tasks"]) {
|
|
19516
19516
|
for (const taskId of parseTaskIds2(fm["Related Tasks"])) {
|
|
19517
|
-
const taskExists2 = await db.select({ id: tasks.id }).from(tasks).where(
|
|
19517
|
+
const taskExists2 = await db.select({ id: tasks.id }).from(tasks).where(eq22(tasks.id, taskId)).all();
|
|
19518
19518
|
if (taskExists2.length === 0) {
|
|
19519
19519
|
result.warnings.push(
|
|
19520
19520
|
`${record2.id}: related task ${taskId} not found in DB, skipping link`
|
|
@@ -25196,19 +25196,19 @@ async function queryAudit(options) {
|
|
|
25196
25196
|
try {
|
|
25197
25197
|
const { getDb: getDb4 } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
|
|
25198
25198
|
const { auditLog: auditLog2 } = await Promise.resolve().then(() => (init_tasks_schema(), tasks_schema_exports));
|
|
25199
|
-
const { and:
|
|
25199
|
+
const { and: and17, eq: eq22, gte: gte4, or: or8 } = await import("drizzle-orm");
|
|
25200
25200
|
const db = await getDb4(process.cwd());
|
|
25201
25201
|
const conditions = [];
|
|
25202
|
-
if (options?.sessionId) conditions.push(
|
|
25203
|
-
if (options?.domain) conditions.push(
|
|
25202
|
+
if (options?.sessionId) conditions.push(eq22(auditLog2.sessionId, options.sessionId));
|
|
25203
|
+
if (options?.domain) conditions.push(eq22(auditLog2.domain, options.domain));
|
|
25204
25204
|
if (options?.operation)
|
|
25205
25205
|
conditions.push(
|
|
25206
|
-
|
|
25206
|
+
or8(eq22(auditLog2.operation, options.operation), eq22(auditLog2.action, options.operation))
|
|
25207
25207
|
);
|
|
25208
|
-
if (options?.taskId) conditions.push(
|
|
25208
|
+
if (options?.taskId) conditions.push(eq22(auditLog2.taskId, options.taskId));
|
|
25209
25209
|
if (options?.since) conditions.push(gte4(auditLog2.timestamp, options.since));
|
|
25210
25210
|
const limit = options?.limit ?? 1e3;
|
|
25211
|
-
const rows = await db.select().from(auditLog2).where(conditions.length > 0 ?
|
|
25211
|
+
const rows = await db.select().from(auditLog2).where(conditions.length > 0 ? and17(...conditions) : void 0).orderBy(auditLog2.timestamp).limit(limit);
|
|
25212
25212
|
return rows.map((row) => ({
|
|
25213
25213
|
timestamp: row.timestamp,
|
|
25214
25214
|
sessionId: row.sessionId,
|
|
@@ -48510,7 +48510,7 @@ async function backfillRewardSignals(projectRoot, sessionId, lookbackDays = 30)
|
|
|
48510
48510
|
const { getDb: getDb4 } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
|
|
48511
48511
|
const tasksDb = await getDb4(projectRoot);
|
|
48512
48512
|
const { tasks: tasks2 } = await Promise.resolve().then(() => (init_tasks_schema(), tasks_schema_exports));
|
|
48513
|
-
const { and:
|
|
48513
|
+
const { and: and17, eq: eq22, inArray: inArray10, gte: gte4, or: or8, isNotNull: isNotNull3 } = await import("drizzle-orm");
|
|
48514
48514
|
const cutoffTs = new Date(Date.now() - lookbackDays * 24 * 60 * 60 * 1e3).toISOString().replace("T", " ").slice(0, 19);
|
|
48515
48515
|
const rawRows = await tasksDb.select({
|
|
48516
48516
|
id: tasks2.id,
|
|
@@ -48519,12 +48519,12 @@ async function backfillRewardSignals(projectRoot, sessionId, lookbackDays = 30)
|
|
|
48519
48519
|
completedAt: tasks2.completedAt,
|
|
48520
48520
|
cancelledAt: tasks2.cancelledAt
|
|
48521
48521
|
}).from(tasks2).where(
|
|
48522
|
-
|
|
48523
|
-
|
|
48524
|
-
|
|
48525
|
-
|
|
48526
|
-
|
|
48527
|
-
|
|
48522
|
+
and17(
|
|
48523
|
+
eq22(tasks2.sessionId, sessionId),
|
|
48524
|
+
inArray10(tasks2.status, ["done", "cancelled"]),
|
|
48525
|
+
or8(
|
|
48526
|
+
and17(isNotNull3(tasks2.completedAt), gte4(tasks2.completedAt, cutoffTs)),
|
|
48527
|
+
and17(isNotNull3(tasks2.cancelledAt), gte4(tasks2.cancelledAt, cutoffTs))
|
|
48528
48528
|
)
|
|
48529
48529
|
)
|
|
48530
48530
|
).all();
|
|
@@ -60037,13 +60037,13 @@ function extractYamlArray(content, field) {
|
|
|
60037
60037
|
}
|
|
60038
60038
|
const lines = content.split("\n");
|
|
60039
60039
|
const items = [];
|
|
60040
|
-
let
|
|
60040
|
+
let inArray10 = false;
|
|
60041
60041
|
for (const line2 of lines) {
|
|
60042
60042
|
if (line2.match(new RegExp(`^${field}:`))) {
|
|
60043
|
-
|
|
60043
|
+
inArray10 = true;
|
|
60044
60044
|
continue;
|
|
60045
60045
|
}
|
|
60046
|
-
if (
|
|
60046
|
+
if (inArray10) {
|
|
60047
60047
|
const itemMatch = line2.match(/^\s+-\s+["']?(.+?)["']?\s*$/);
|
|
60048
60048
|
if (itemMatch) {
|
|
60049
60049
|
items.push(itemMatch[1].trim());
|
|
@@ -62162,12 +62162,12 @@ async function getEnforcementMode(cwd) {
|
|
|
62162
62162
|
}
|
|
62163
62163
|
async function getLifecycleStatus(epicId, cwd) {
|
|
62164
62164
|
const { getDb: getDb4 } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
|
|
62165
|
-
const { eq:
|
|
62165
|
+
const { eq: eq22 } = await import("drizzle-orm");
|
|
62166
62166
|
const db = await getDb4(cwd);
|
|
62167
62167
|
const pipelineResult = await db.select({
|
|
62168
62168
|
pipeline: lifecyclePipelines,
|
|
62169
62169
|
task: tasks
|
|
62170
|
-
}).from(lifecyclePipelines).innerJoin(tasks,
|
|
62170
|
+
}).from(lifecyclePipelines).innerJoin(tasks, eq22(lifecyclePipelines.taskId, tasks.id)).where(eq22(lifecyclePipelines.taskId, epicId)).limit(1);
|
|
62171
62171
|
if (pipelineResult.length === 0) {
|
|
62172
62172
|
return {
|
|
62173
62173
|
epicId,
|
|
@@ -62180,7 +62180,7 @@ async function getLifecycleStatus(epicId, cwd) {
|
|
|
62180
62180
|
}
|
|
62181
62181
|
const task = pipelineResult[0].task;
|
|
62182
62182
|
const pipelineId = `pipeline-${epicId}`;
|
|
62183
|
-
const stageRows = await db.select().from(lifecycleStages).where(
|
|
62183
|
+
const stageRows = await db.select().from(lifecycleStages).where(eq22(lifecycleStages.pipelineId, pipelineId)).orderBy(lifecycleStages.sequence);
|
|
62184
62184
|
const stageDataMap = /* @__PURE__ */ new Map();
|
|
62185
62185
|
for (const row of stageRows) {
|
|
62186
62186
|
let parsedChain;
|
|
@@ -62249,10 +62249,10 @@ async function getLifecycleStatus(epicId, cwd) {
|
|
|
62249
62249
|
}
|
|
62250
62250
|
async function getLifecycleHistory(epicId, cwd) {
|
|
62251
62251
|
const { getDb: getDb4 } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
|
|
62252
|
-
const { eq:
|
|
62252
|
+
const { eq: eq22 } = await import("drizzle-orm");
|
|
62253
62253
|
const db = await getDb4(cwd);
|
|
62254
62254
|
const pipelineId = `pipeline-${epicId}`;
|
|
62255
|
-
const stages = await db.select().from(lifecycleStages).where(
|
|
62255
|
+
const stages = await db.select().from(lifecycleStages).where(eq22(lifecycleStages.pipelineId, pipelineId));
|
|
62256
62256
|
if (stages.length === 0) {
|
|
62257
62257
|
return { epicId, history: [] };
|
|
62258
62258
|
}
|
|
@@ -62282,7 +62282,7 @@ async function getLifecycleHistory(epicId, cwd) {
|
|
|
62282
62282
|
}
|
|
62283
62283
|
const stageIds = stages.map((s3) => s3.id);
|
|
62284
62284
|
if (stageIds.length > 0) {
|
|
62285
|
-
const gateResults = await db.select().from(lifecycleGateResults).where(
|
|
62285
|
+
const gateResults = await db.select().from(lifecycleGateResults).where(eq22(lifecycleGateResults.stageId, stageIds[0]));
|
|
62286
62286
|
for (const gate of gateResults) {
|
|
62287
62287
|
const stageName = stageIdToName.get(gate.stageId);
|
|
62288
62288
|
if (stageName) {
|
|
@@ -62295,7 +62295,7 @@ async function getLifecycleHistory(epicId, cwd) {
|
|
|
62295
62295
|
}
|
|
62296
62296
|
}
|
|
62297
62297
|
for (let i = 1; i < stageIds.length; i++) {
|
|
62298
|
-
const additionalGates = await db.select().from(lifecycleGateResults).where(
|
|
62298
|
+
const additionalGates = await db.select().from(lifecycleGateResults).where(eq22(lifecycleGateResults.stageId, stageIds[i]));
|
|
62299
62299
|
for (const gate of additionalGates) {
|
|
62300
62300
|
const stageName = stageIdToName.get(gate.stageId);
|
|
62301
62301
|
if (stageName) {
|
|
@@ -62314,16 +62314,16 @@ async function getLifecycleHistory(epicId, cwd) {
|
|
|
62314
62314
|
}
|
|
62315
62315
|
async function getLifecycleGates(epicId, cwd) {
|
|
62316
62316
|
const { getDb: getDb4 } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
|
|
62317
|
-
const { eq:
|
|
62317
|
+
const { eq: eq22 } = await import("drizzle-orm");
|
|
62318
62318
|
const db = await getDb4(cwd);
|
|
62319
62319
|
const pipelineId = `pipeline-${epicId}`;
|
|
62320
|
-
const stages = await db.select().from(lifecycleStages).where(
|
|
62320
|
+
const stages = await db.select().from(lifecycleStages).where(eq22(lifecycleStages.pipelineId, pipelineId));
|
|
62321
62321
|
if (stages.length === 0) {
|
|
62322
62322
|
return {};
|
|
62323
62323
|
}
|
|
62324
62324
|
const gates = {};
|
|
62325
62325
|
for (const stage of stages) {
|
|
62326
|
-
const gateRows = await db.select().from(lifecycleGateResults).where(
|
|
62326
|
+
const gateRows = await db.select().from(lifecycleGateResults).where(eq22(lifecycleGateResults.stageId, stage.id));
|
|
62327
62327
|
if (gateRows.length > 0) {
|
|
62328
62328
|
gates[stage.stageName] = {};
|
|
62329
62329
|
for (const gateRow of gateRows) {
|
|
@@ -62387,7 +62387,7 @@ async function checkStagePrerequisites(epicId, targetStage, cwd) {
|
|
|
62387
62387
|
}
|
|
62388
62388
|
async function ensureLifecycleContext(epicId, stageName, cwd, options) {
|
|
62389
62389
|
const { getDb: getDb4 } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
|
|
62390
|
-
const { eq:
|
|
62390
|
+
const { eq: eq22 } = await import("drizzle-orm");
|
|
62391
62391
|
const db = await getDb4(cwd);
|
|
62392
62392
|
const pipelineId = `pipeline-${epicId}`;
|
|
62393
62393
|
const stageId = `stage-${epicId}-${stageName}`;
|
|
@@ -62395,7 +62395,7 @@ async function ensureLifecycleContext(epicId, stageName, cwd, options) {
|
|
|
62395
62395
|
getNativeDb3().prepare(
|
|
62396
62396
|
`INSERT OR IGNORE INTO tasks (id, title, status, priority, created_at) VALUES (?, ?, 'pending', 'medium', datetime('now'))`
|
|
62397
62397
|
).run(epicId, `Task ${epicId}`);
|
|
62398
|
-
const existingPipeline = await db.select().from(lifecyclePipelines).where(
|
|
62398
|
+
const existingPipeline = await db.select().from(lifecyclePipelines).where(eq22(lifecyclePipelines.id, pipelineId)).limit(1).all();
|
|
62399
62399
|
if (existingPipeline.length === 0) {
|
|
62400
62400
|
await db.insert(lifecyclePipelines).values({
|
|
62401
62401
|
id: pipelineId,
|
|
@@ -62405,7 +62405,7 @@ async function ensureLifecycleContext(epicId, stageName, cwd, options) {
|
|
|
62405
62405
|
startedAt: options.now
|
|
62406
62406
|
}).run();
|
|
62407
62407
|
}
|
|
62408
|
-
const existingStage = await db.select().from(lifecycleStages).where(
|
|
62408
|
+
const existingStage = await db.select().from(lifecycleStages).where(eq22(lifecycleStages.id, stageId)).limit(1).all();
|
|
62409
62409
|
if (existingStage.length === 0) {
|
|
62410
62410
|
const sequence = isValidStage(stageName) ? STAGE_ORDER[stageName] : 0;
|
|
62411
62411
|
await db.insert(lifecycleStages).values({
|
|
@@ -62418,7 +62418,7 @@ async function ensureLifecycleContext(epicId, stageName, cwd, options) {
|
|
|
62418
62418
|
}).run();
|
|
62419
62419
|
}
|
|
62420
62420
|
if (options.updateCurrentStage) {
|
|
62421
|
-
await db.update(lifecyclePipelines).set({ currentStageId: stageId }).where(
|
|
62421
|
+
await db.update(lifecyclePipelines).set({ currentStageId: stageId }).where(eq22(lifecyclePipelines.id, pipelineId)).run();
|
|
62422
62422
|
}
|
|
62423
62423
|
return { db, pipelineId, stageId };
|
|
62424
62424
|
}
|
|
@@ -62433,7 +62433,7 @@ async function recordStageProgress(epicId, stage, status, notes, cwd) {
|
|
|
62433
62433
|
`Invalid status: ${status}. Valid: ${validStatuses.join(", ")}`
|
|
62434
62434
|
);
|
|
62435
62435
|
}
|
|
62436
|
-
const { eq:
|
|
62436
|
+
const { eq: eq22 } = await import("drizzle-orm");
|
|
62437
62437
|
const now2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
62438
62438
|
const stageName = stage;
|
|
62439
62439
|
const { db, stageId, pipelineId } = await ensureLifecycleContext(epicId, stage, cwd, {
|
|
@@ -62449,7 +62449,7 @@ async function recordStageProgress(epicId, stage, status, notes, cwd) {
|
|
|
62449
62449
|
status,
|
|
62450
62450
|
related: artifact.related
|
|
62451
62451
|
};
|
|
62452
|
-
const existingStage = await db.select().from(lifecycleStages).where(
|
|
62452
|
+
const existingStage = await db.select().from(lifecycleStages).where(eq22(lifecycleStages.id, stageId)).limit(1).all();
|
|
62453
62453
|
const sequence = STAGE_ORDER[stage];
|
|
62454
62454
|
const stageValues = {
|
|
62455
62455
|
status,
|
|
@@ -62476,7 +62476,7 @@ async function recordStageProgress(epicId, stage, status, notes, cwd) {
|
|
|
62476
62476
|
provenanceChainJson: JSON.stringify(provenanceChain)
|
|
62477
62477
|
}).run();
|
|
62478
62478
|
} else {
|
|
62479
|
-
await db.update(lifecycleStages).set(stageValues).where(
|
|
62479
|
+
await db.update(lifecycleStages).set(stageValues).where(eq22(lifecycleStages.id, stageId)).run();
|
|
62480
62480
|
}
|
|
62481
62481
|
if (status === "completed") {
|
|
62482
62482
|
await linkProvenance(epicId, stageName, artifact.absolutePath, cwd);
|
|
@@ -62487,7 +62487,7 @@ async function recordStageProgress(epicId, stage, status, notes, cwd) {
|
|
|
62487
62487
|
}
|
|
62488
62488
|
}
|
|
62489
62489
|
if (status === "in_progress" || status === "completed") {
|
|
62490
|
-
await db.update(tasks).set({ pipelineStage: stage }).where(
|
|
62490
|
+
await db.update(tasks).set({ pipelineStage: stage }).where(eq22(tasks.id, epicId)).run();
|
|
62491
62491
|
}
|
|
62492
62492
|
return { epicId, stage, status, timestamp: now2 };
|
|
62493
62493
|
}
|
|
@@ -62499,7 +62499,7 @@ async function resetStage(epicId, stage, reason, cwd) {
|
|
|
62499
62499
|
if (!PIPELINE_STAGES.includes(stage)) {
|
|
62500
62500
|
throw new CleoError(2 /* INVALID_INPUT */, `Invalid stage: ${stage}`);
|
|
62501
62501
|
}
|
|
62502
|
-
const { eq:
|
|
62502
|
+
const { eq: eq22 } = await import("drizzle-orm");
|
|
62503
62503
|
const now2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
62504
62504
|
const { db, stageId } = await ensureLifecycleContext(epicId, stage, cwd, {
|
|
62505
62505
|
now: now2,
|
|
@@ -62512,11 +62512,11 @@ async function resetStage(epicId, stage, reason, cwd) {
|
|
|
62512
62512
|
skippedAt: null,
|
|
62513
62513
|
skipReason: null,
|
|
62514
62514
|
notesJson: JSON.stringify([`Reset: ${reason}`])
|
|
62515
|
-
}).where(
|
|
62515
|
+
}).where(eq22(lifecycleStages.id, stageId)).run();
|
|
62516
62516
|
return { epicId, stage, reason };
|
|
62517
62517
|
}
|
|
62518
62518
|
async function passGate(epicId, gateName, agent, notes, cwd) {
|
|
62519
|
-
const { eq:
|
|
62519
|
+
const { eq: eq22 } = await import("drizzle-orm");
|
|
62520
62520
|
const now2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
62521
62521
|
const stageName = gateName.split("-")[0];
|
|
62522
62522
|
const gateId = `gate-${epicId}-${stageName}-${gateName}`;
|
|
@@ -62525,7 +62525,7 @@ async function passGate(epicId, gateName, agent, notes, cwd) {
|
|
|
62525
62525
|
stageStatusOnCreate: "in_progress",
|
|
62526
62526
|
updateCurrentStage: true
|
|
62527
62527
|
});
|
|
62528
|
-
const existingGate = await db.select().from(lifecycleGateResults).where(
|
|
62528
|
+
const existingGate = await db.select().from(lifecycleGateResults).where(eq22(lifecycleGateResults.id, gateId)).limit(1).all();
|
|
62529
62529
|
const gateValues = {
|
|
62530
62530
|
id: gateId,
|
|
62531
62531
|
stageId,
|
|
@@ -62537,14 +62537,14 @@ async function passGate(epicId, gateName, agent, notes, cwd) {
|
|
|
62537
62537
|
reason: null
|
|
62538
62538
|
};
|
|
62539
62539
|
if (existingGate.length > 0) {
|
|
62540
|
-
await db.update(lifecycleGateResults).set(gateValues).where(
|
|
62540
|
+
await db.update(lifecycleGateResults).set(gateValues).where(eq22(lifecycleGateResults.id, gateId)).run();
|
|
62541
62541
|
} else {
|
|
62542
62542
|
await db.insert(lifecycleGateResults).values(gateValues).run();
|
|
62543
62543
|
}
|
|
62544
62544
|
return { epicId, gateName, timestamp: now2 };
|
|
62545
62545
|
}
|
|
62546
62546
|
async function failGate(epicId, gateName, reason, cwd) {
|
|
62547
|
-
const { eq:
|
|
62547
|
+
const { eq: eq22 } = await import("drizzle-orm");
|
|
62548
62548
|
const now2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
62549
62549
|
const stageName = gateName.split("-")[0];
|
|
62550
62550
|
const gateId = `gate-${epicId}-${stageName}-${gateName}`;
|
|
@@ -62553,7 +62553,7 @@ async function failGate(epicId, gateName, reason, cwd) {
|
|
|
62553
62553
|
stageStatusOnCreate: "in_progress",
|
|
62554
62554
|
updateCurrentStage: true
|
|
62555
62555
|
});
|
|
62556
|
-
const existingGate = await db.select().from(lifecycleGateResults).where(
|
|
62556
|
+
const existingGate = await db.select().from(lifecycleGateResults).where(eq22(lifecycleGateResults.id, gateId)).limit(1).all();
|
|
62557
62557
|
const gateValues = {
|
|
62558
62558
|
id: gateId,
|
|
62559
62559
|
stageId,
|
|
@@ -62565,7 +62565,7 @@ async function failGate(epicId, gateName, reason, cwd) {
|
|
|
62565
62565
|
reason: reason ?? null
|
|
62566
62566
|
};
|
|
62567
62567
|
if (existingGate.length > 0) {
|
|
62568
|
-
await db.update(lifecycleGateResults).set(gateValues).where(
|
|
62568
|
+
await db.update(lifecycleGateResults).set(gateValues).where(eq22(lifecycleGateResults.id, gateId)).run();
|
|
62569
62569
|
} else {
|
|
62570
62570
|
await db.insert(lifecycleGateResults).values(gateValues).run();
|
|
62571
62571
|
}
|
|
@@ -62771,6 +62771,9 @@ var init_enforcement = __esm({
|
|
|
62771
62771
|
});
|
|
62772
62772
|
|
|
62773
62773
|
// packages/core/src/tasks/pipeline-stage.ts
|
|
62774
|
+
function isTerminalPipelineStage(stage) {
|
|
62775
|
+
return !!stage && TERMINAL_PIPELINE_STAGES.has(stage);
|
|
62776
|
+
}
|
|
62774
62777
|
function isValidPipelineStage(stage) {
|
|
62775
62778
|
return TASK_PIPELINE_STAGES.includes(stage);
|
|
62776
62779
|
}
|
|
@@ -62822,7 +62825,7 @@ function validatePipelineTransition(currentStage, newStage) {
|
|
|
62822
62825
|
);
|
|
62823
62826
|
}
|
|
62824
62827
|
}
|
|
62825
|
-
var TASK_PIPELINE_STAGES, STAGE_ORDER2;
|
|
62828
|
+
var TASK_PIPELINE_STAGES, STAGE_ORDER2, TERMINAL_PIPELINE_STAGES;
|
|
62826
62829
|
var init_pipeline_stage = __esm({
|
|
62827
62830
|
"packages/core/src/tasks/pipeline-stage.ts"() {
|
|
62828
62831
|
"use strict";
|
|
@@ -62838,7 +62841,8 @@ var init_pipeline_stage = __esm({
|
|
|
62838
62841
|
"validation",
|
|
62839
62842
|
"testing",
|
|
62840
62843
|
"release",
|
|
62841
|
-
"contribution"
|
|
62844
|
+
"contribution",
|
|
62845
|
+
"cancelled"
|
|
62842
62846
|
];
|
|
62843
62847
|
STAGE_ORDER2 = {
|
|
62844
62848
|
research: 1,
|
|
@@ -62850,8 +62854,13 @@ var init_pipeline_stage = __esm({
|
|
|
62850
62854
|
validation: 7,
|
|
62851
62855
|
testing: 8,
|
|
62852
62856
|
release: 9,
|
|
62853
|
-
contribution: 10
|
|
62857
|
+
contribution: 10,
|
|
62858
|
+
cancelled: 11
|
|
62854
62859
|
};
|
|
62860
|
+
TERMINAL_PIPELINE_STAGES = /* @__PURE__ */ new Set([
|
|
62861
|
+
"contribution",
|
|
62862
|
+
"cancelled"
|
|
62863
|
+
]);
|
|
62855
62864
|
}
|
|
62856
62865
|
});
|
|
62857
62866
|
|
|
@@ -67450,9 +67459,9 @@ async function nexusRegister(projectPath, name2, permissions = "read") {
|
|
|
67450
67459
|
const projectHash = generateProjectHash(projectPath);
|
|
67451
67460
|
await nexusInit();
|
|
67452
67461
|
const { getNexusDb: getNexusDb2 } = await Promise.resolve().then(() => (init_nexus_sqlite(), nexus_sqlite_exports));
|
|
67453
|
-
const { eq:
|
|
67462
|
+
const { eq: eq22 } = await import("drizzle-orm");
|
|
67454
67463
|
const db = await getNexusDb2();
|
|
67455
|
-
const existingRows = await db.select().from(projectRegistry).where(
|
|
67464
|
+
const existingRows = await db.select().from(projectRegistry).where(eq22(projectRegistry.projectHash, projectHash));
|
|
67456
67465
|
const existing = existingRows[0];
|
|
67457
67466
|
if (existing?.permissions) {
|
|
67458
67467
|
throw new CleoError(
|
|
@@ -67461,7 +67470,7 @@ async function nexusRegister(projectPath, name2, permissions = "read") {
|
|
|
67461
67470
|
);
|
|
67462
67471
|
}
|
|
67463
67472
|
if (!existing) {
|
|
67464
|
-
const nameConflictRows = await db.select().from(projectRegistry).where(
|
|
67473
|
+
const nameConflictRows = await db.select().from(projectRegistry).where(eq22(projectRegistry.name, projectName));
|
|
67465
67474
|
if (nameConflictRows.length > 0) {
|
|
67466
67475
|
throw new CleoError(
|
|
67467
67476
|
6 /* VALIDATION_ERROR */,
|
|
@@ -67484,7 +67493,7 @@ async function nexusRegister(projectPath, name2, permissions = "read") {
|
|
|
67484
67493
|
lastSeen: now2,
|
|
67485
67494
|
brainDbPath,
|
|
67486
67495
|
tasksDbPath
|
|
67487
|
-
}).where(
|
|
67496
|
+
}).where(eq22(projectRegistry.projectHash, projectHash));
|
|
67488
67497
|
} else {
|
|
67489
67498
|
if (!projectId) {
|
|
67490
67499
|
projectId = randomUUID4();
|
|
@@ -67525,9 +67534,9 @@ async function nexusUnregister(nameOrHash) {
|
|
|
67525
67534
|
throw new CleoError(4 /* NOT_FOUND */, `Project not found in registry: ${nameOrHash}`);
|
|
67526
67535
|
}
|
|
67527
67536
|
const { getNexusDb: getNexusDb2 } = await Promise.resolve().then(() => (init_nexus_sqlite(), nexus_sqlite_exports));
|
|
67528
|
-
const { eq:
|
|
67537
|
+
const { eq: eq22 } = await import("drizzle-orm");
|
|
67529
67538
|
const db = await getNexusDb2();
|
|
67530
|
-
await db.delete(projectRegistry).where(
|
|
67539
|
+
await db.delete(projectRegistry).where(eq22(projectRegistry.projectHash, project.hash));
|
|
67531
67540
|
await writeNexusAudit({
|
|
67532
67541
|
action: "unregister",
|
|
67533
67542
|
projectHash: project.hash,
|
|
@@ -67549,9 +67558,9 @@ async function nexusList() {
|
|
|
67549
67558
|
async function nexusGetProject(nameOrHash) {
|
|
67550
67559
|
try {
|
|
67551
67560
|
const { getNexusDb: getNexusDb2 } = await Promise.resolve().then(() => (init_nexus_sqlite(), nexus_sqlite_exports));
|
|
67552
|
-
const { eq:
|
|
67561
|
+
const { eq: eq22, or: or8 } = await import("drizzle-orm");
|
|
67553
67562
|
const db = await getNexusDb2();
|
|
67554
|
-
const rows = await db.select().from(projectRegistry).where(
|
|
67563
|
+
const rows = await db.select().from(projectRegistry).where(or8(eq22(projectRegistry.projectHash, nameOrHash), eq22(projectRegistry.name, nameOrHash)));
|
|
67555
67564
|
const row = rows[0];
|
|
67556
67565
|
if (!row) return null;
|
|
67557
67566
|
return rowToProject(row);
|
|
@@ -67574,14 +67583,14 @@ async function nexusSync(nameOrHash) {
|
|
|
67574
67583
|
const meta3 = await readProjectMeta(project.path);
|
|
67575
67584
|
const now2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
67576
67585
|
const { getNexusDb: getNexusDb2 } = await Promise.resolve().then(() => (init_nexus_sqlite(), nexus_sqlite_exports));
|
|
67577
|
-
const { eq:
|
|
67586
|
+
const { eq: eq22 } = await import("drizzle-orm");
|
|
67578
67587
|
const db = await getNexusDb2();
|
|
67579
67588
|
await db.update(projectRegistry).set({
|
|
67580
67589
|
taskCount: meta3.taskCount,
|
|
67581
67590
|
labelsJson: JSON.stringify(meta3.labels),
|
|
67582
67591
|
lastSync: now2,
|
|
67583
67592
|
lastSeen: now2
|
|
67584
|
-
}).where(
|
|
67593
|
+
}).where(eq22(projectRegistry.projectHash, project.hash));
|
|
67585
67594
|
await writeNexusAudit({
|
|
67586
67595
|
action: "sync",
|
|
67587
67596
|
projectHash: project.hash,
|
|
@@ -67595,7 +67604,7 @@ async function nexusSyncAll() {
|
|
|
67595
67604
|
let synced = 0;
|
|
67596
67605
|
let failed = 0;
|
|
67597
67606
|
const { getNexusDb: getNexusDb2 } = await Promise.resolve().then(() => (init_nexus_sqlite(), nexus_sqlite_exports));
|
|
67598
|
-
const { eq:
|
|
67607
|
+
const { eq: eq22 } = await import("drizzle-orm");
|
|
67599
67608
|
const db = await getNexusDb2();
|
|
67600
67609
|
for (const project of projects) {
|
|
67601
67610
|
try {
|
|
@@ -67606,7 +67615,7 @@ async function nexusSyncAll() {
|
|
|
67606
67615
|
labelsJson: JSON.stringify(meta3.labels),
|
|
67607
67616
|
lastSync: now2,
|
|
67608
67617
|
lastSeen: now2
|
|
67609
|
-
}).where(
|
|
67618
|
+
}).where(eq22(projectRegistry.projectHash, project.hash));
|
|
67610
67619
|
synced++;
|
|
67611
67620
|
} catch {
|
|
67612
67621
|
failed++;
|
|
@@ -67626,9 +67635,9 @@ async function nexusUpdateIndexStats(projectPath, stats2) {
|
|
|
67626
67635
|
const now2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
67627
67636
|
try {
|
|
67628
67637
|
const { getNexusDb: getNexusDb2 } = await Promise.resolve().then(() => (init_nexus_sqlite(), nexus_sqlite_exports));
|
|
67629
|
-
const { eq:
|
|
67638
|
+
const { eq: eq22 } = await import("drizzle-orm");
|
|
67630
67639
|
const db = await getNexusDb2();
|
|
67631
|
-
const rows = await db.select().from(projectRegistry).where(
|
|
67640
|
+
const rows = await db.select().from(projectRegistry).where(eq22(projectRegistry.projectHash, projectHash));
|
|
67632
67641
|
if (rows.length === 0) {
|
|
67633
67642
|
try {
|
|
67634
67643
|
await nexusRegister(projectPath);
|
|
@@ -67639,7 +67648,7 @@ async function nexusUpdateIndexStats(projectPath, stats2) {
|
|
|
67639
67648
|
lastIndexed: now2,
|
|
67640
67649
|
statsJson: JSON.stringify(stats2),
|
|
67641
67650
|
lastSeen: now2
|
|
67642
|
-
}).where(
|
|
67651
|
+
}).where(eq22(projectRegistry.projectHash, projectHash));
|
|
67643
67652
|
await writeNexusAudit({
|
|
67644
67653
|
action: "update-index-stats",
|
|
67645
67654
|
projectHash,
|
|
@@ -67661,9 +67670,9 @@ async function nexusSetPermission(nameOrHash, permission) {
|
|
|
67661
67670
|
throw new CleoError(4 /* NOT_FOUND */, `Project not found in registry: ${nameOrHash}`);
|
|
67662
67671
|
}
|
|
67663
67672
|
const { getNexusDb: getNexusDb2 } = await Promise.resolve().then(() => (init_nexus_sqlite(), nexus_sqlite_exports));
|
|
67664
|
-
const { eq:
|
|
67673
|
+
const { eq: eq22 } = await import("drizzle-orm");
|
|
67665
67674
|
const db = await getNexusDb2();
|
|
67666
|
-
await db.update(projectRegistry).set({ permissions: permission }).where(
|
|
67675
|
+
await db.update(projectRegistry).set({ permissions: permission }).where(eq22(projectRegistry.projectHash, project.hash));
|
|
67667
67676
|
await writeNexusAudit({
|
|
67668
67677
|
action: "set-permission",
|
|
67669
67678
|
projectHash: project.hash,
|
|
@@ -67679,12 +67688,12 @@ async function nexusReconcile(projectRoot) {
|
|
|
67679
67688
|
}
|
|
67680
67689
|
await nexusInit();
|
|
67681
67690
|
const { getNexusDb: getNexusDb2 } = await Promise.resolve().then(() => (init_nexus_sqlite(), nexus_sqlite_exports));
|
|
67682
|
-
const { eq:
|
|
67691
|
+
const { eq: eq22 } = await import("drizzle-orm");
|
|
67683
67692
|
const db = await getNexusDb2();
|
|
67684
67693
|
const projectId = await readProjectId(projectRoot);
|
|
67685
67694
|
const currentHash = generateProjectHash(projectRoot);
|
|
67686
67695
|
if (projectId) {
|
|
67687
|
-
const hashRows2 = await db.select().from(projectRegistry).where(
|
|
67696
|
+
const hashRows2 = await db.select().from(projectRegistry).where(eq22(projectRegistry.projectHash, currentHash));
|
|
67688
67697
|
const hashMatch2 = hashRows2[0];
|
|
67689
67698
|
if (hashMatch2 && hashMatch2.projectId !== projectId) {
|
|
67690
67699
|
await writeNexusAudit({
|
|
@@ -67703,12 +67712,12 @@ async function nexusReconcile(projectRoot) {
|
|
|
67703
67712
|
}
|
|
67704
67713
|
}
|
|
67705
67714
|
if (projectId) {
|
|
67706
|
-
const idRows = await db.select().from(projectRegistry).where(
|
|
67715
|
+
const idRows = await db.select().from(projectRegistry).where(eq22(projectRegistry.projectId, projectId));
|
|
67707
67716
|
const existing = idRows[0];
|
|
67708
67717
|
if (existing) {
|
|
67709
67718
|
const now2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
67710
67719
|
if (existing.projectPath === projectRoot) {
|
|
67711
|
-
await db.update(projectRegistry).set({ lastSeen: now2 }).where(
|
|
67720
|
+
await db.update(projectRegistry).set({ lastSeen: now2 }).where(eq22(projectRegistry.projectId, projectId));
|
|
67712
67721
|
await writeNexusAudit({
|
|
67713
67722
|
action: "reconcile",
|
|
67714
67723
|
projectHash: currentHash,
|
|
@@ -67724,7 +67733,7 @@ async function nexusReconcile(projectRoot) {
|
|
|
67724
67733
|
projectPath: projectRoot,
|
|
67725
67734
|
projectHash: currentHash,
|
|
67726
67735
|
lastSeen: now2
|
|
67727
|
-
}).where(
|
|
67736
|
+
}).where(eq22(projectRegistry.projectId, projectId));
|
|
67728
67737
|
await writeNexusAudit({
|
|
67729
67738
|
action: "reconcile",
|
|
67730
67739
|
projectHash: currentHash,
|
|
@@ -67736,11 +67745,11 @@ async function nexusReconcile(projectRoot) {
|
|
|
67736
67745
|
return { status: "path_updated", oldPath, newPath: projectRoot };
|
|
67737
67746
|
}
|
|
67738
67747
|
}
|
|
67739
|
-
const hashRows = await db.select().from(projectRegistry).where(
|
|
67748
|
+
const hashRows = await db.select().from(projectRegistry).where(eq22(projectRegistry.projectHash, currentHash));
|
|
67740
67749
|
const hashMatch = hashRows[0];
|
|
67741
67750
|
if (hashMatch) {
|
|
67742
67751
|
const now2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
67743
|
-
await db.update(projectRegistry).set({ lastSeen: now2 }).where(
|
|
67752
|
+
await db.update(projectRegistry).set({ lastSeen: now2 }).where(eq22(projectRegistry.projectHash, currentHash));
|
|
67744
67753
|
await writeNexusAudit({
|
|
67745
67754
|
action: "reconcile",
|
|
67746
67755
|
projectHash: currentHash,
|
|
@@ -69369,6 +69378,9 @@ async function completeTask(options, cwd, accessor) {
|
|
|
69369
69378
|
if (completionStage && isValidPipelineStage(completionStage) && EXECUTION_STAGES_FOR_RELEASE.has(completionStage)) {
|
|
69370
69379
|
task.pipelineStage = "release";
|
|
69371
69380
|
}
|
|
69381
|
+
if (!isTerminalPipelineStage(task.pipelineStage)) {
|
|
69382
|
+
task.pipelineStage = "contribution";
|
|
69383
|
+
}
|
|
69372
69384
|
task.status = "done";
|
|
69373
69385
|
task.completedAt = now2;
|
|
69374
69386
|
task.updatedAt = now2;
|
|
@@ -69392,6 +69404,9 @@ async function completeTask(options, cwd, accessor) {
|
|
|
69392
69404
|
parent.status = "done";
|
|
69393
69405
|
parent.completedAt = now2;
|
|
69394
69406
|
parent.updatedAt = now2;
|
|
69407
|
+
if (!isTerminalPipelineStage(parent.pipelineStage)) {
|
|
69408
|
+
parent.pipelineStage = "contribution";
|
|
69409
|
+
}
|
|
69395
69410
|
autoCompleted.push(parent.id);
|
|
69396
69411
|
autoCompletedTasks.push(parent);
|
|
69397
69412
|
}
|
|
@@ -79330,7 +79345,7 @@ async function queryTasks(cwd, since) {
|
|
|
79330
79345
|
try {
|
|
79331
79346
|
const { getDb: getDb4 } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
|
|
79332
79347
|
const { tasks: tasks2 } = await Promise.resolve().then(() => (init_tasks_schema(), tasks_schema_exports));
|
|
79333
|
-
const { and:
|
|
79348
|
+
const { and: and17, gte: gte4 } = await import("drizzle-orm");
|
|
79334
79349
|
const db = await getDb4(cwd);
|
|
79335
79350
|
const conditions = [];
|
|
79336
79351
|
if (since) {
|
|
@@ -79344,7 +79359,7 @@ async function queryTasks(cwd, since) {
|
|
|
79344
79359
|
sessionId: tasks2.sessionId,
|
|
79345
79360
|
completedAt: tasks2.completedAt,
|
|
79346
79361
|
createdAt: tasks2.createdAt
|
|
79347
|
-
}).from(tasks2).where(conditions.length > 0 ?
|
|
79362
|
+
}).from(tasks2).where(conditions.length > 0 ? and17(...conditions) : void 0).all();
|
|
79348
79363
|
return rows;
|
|
79349
79364
|
} catch (err2) {
|
|
79350
79365
|
log9.warn({ err: err2 }, "Failed to query tasks for workflow telemetry");
|
|
@@ -79355,7 +79370,7 @@ async function queryCompletionAuditRows(cwd, since) {
|
|
|
79355
79370
|
try {
|
|
79356
79371
|
const { getDb: getDb4 } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
|
|
79357
79372
|
const { auditLog: auditLog2 } = await Promise.resolve().then(() => (init_tasks_schema(), tasks_schema_exports));
|
|
79358
|
-
const { and:
|
|
79373
|
+
const { and: and17, gte: gte4 } = await import("drizzle-orm");
|
|
79359
79374
|
const db = await getDb4(cwd);
|
|
79360
79375
|
const conditions = [];
|
|
79361
79376
|
if (since) conditions.push(gte4(auditLog2.timestamp, since));
|
|
@@ -79367,7 +79382,7 @@ async function queryCompletionAuditRows(cwd, since) {
|
|
|
79367
79382
|
afterJson: auditLog2.afterJson,
|
|
79368
79383
|
operation: auditLog2.operation,
|
|
79369
79384
|
domain: auditLog2.domain
|
|
79370
|
-
}).from(auditLog2).where(conditions.length > 0 ?
|
|
79385
|
+
}).from(auditLog2).where(conditions.length > 0 ? and17(...conditions) : void 0).orderBy(auditLog2.timestamp).all();
|
|
79371
79386
|
return allRows.filter((row) => {
|
|
79372
79387
|
const isComplete = row.action === "task_completed" || row.action === "complete" || row.operation === "complete" && row.domain === "tasks";
|
|
79373
79388
|
if (!isComplete && row.afterJson) {
|
|
@@ -91406,7 +91421,6 @@ var init_cleo = __esm({
|
|
|
91406
91421
|
// packages/core/src/index.ts
|
|
91407
91422
|
var init_src3 = __esm({
|
|
91408
91423
|
"packages/core/src/index.ts"() {
|
|
91409
|
-
"use strict";
|
|
91410
91424
|
init_src();
|
|
91411
91425
|
init_adapters();
|
|
91412
91426
|
init_admin();
|
|
@@ -107057,6 +107071,106 @@ var init_backfill_pipeline_stage = __esm({
|
|
|
107057
107071
|
}
|
|
107058
107072
|
});
|
|
107059
107073
|
|
|
107074
|
+
// packages/core/src/lifecycle/backfill-terminal-pipeline-stage.ts
|
|
107075
|
+
import { and as and13, eq as eq16, inArray as inArray7, isNull as isNull3, or as or5 } from "drizzle-orm";
|
|
107076
|
+
async function backfillTerminalPipelineStage(options = {}, cwd) {
|
|
107077
|
+
const { dryRun = false, force = false } = options;
|
|
107078
|
+
const db = await getDb(cwd);
|
|
107079
|
+
if (!force) {
|
|
107080
|
+
const guard = await db.select().from(schemaMeta).where(eq16(schemaMeta.key, TERMINAL_BACKFILL_KEY)).limit(1).all();
|
|
107081
|
+
if (guard.length > 0) {
|
|
107082
|
+
return {
|
|
107083
|
+
alreadyRun: true,
|
|
107084
|
+
dryRun,
|
|
107085
|
+
tasksScanned: 0,
|
|
107086
|
+
tasksUpdated: 0,
|
|
107087
|
+
changes: []
|
|
107088
|
+
};
|
|
107089
|
+
}
|
|
107090
|
+
}
|
|
107091
|
+
const rows = await db.select({
|
|
107092
|
+
id: tasks.id,
|
|
107093
|
+
status: tasks.status,
|
|
107094
|
+
pipelineStage: tasks.pipelineStage
|
|
107095
|
+
}).from(tasks).where(inArray7(tasks.status, ["done", "cancelled"])).all();
|
|
107096
|
+
const tasksScanned = rows.length;
|
|
107097
|
+
const changes = [];
|
|
107098
|
+
for (const row of rows) {
|
|
107099
|
+
if (row.pipelineStage && TERMINAL_STAGES.includes(row.pipelineStage)) {
|
|
107100
|
+
continue;
|
|
107101
|
+
}
|
|
107102
|
+
const status = row.status;
|
|
107103
|
+
const newStage = status === "done" ? "contribution" : "cancelled";
|
|
107104
|
+
changes.push({
|
|
107105
|
+
taskId: row.id,
|
|
107106
|
+
status,
|
|
107107
|
+
previousStage: row.pipelineStage ?? null,
|
|
107108
|
+
newStage
|
|
107109
|
+
});
|
|
107110
|
+
}
|
|
107111
|
+
if (!dryRun && changes.length > 0) {
|
|
107112
|
+
const now2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
107113
|
+
for (const change of changes) {
|
|
107114
|
+
await db.update(tasks).set({
|
|
107115
|
+
pipelineStage: change.newStage,
|
|
107116
|
+
updatedAt: now2
|
|
107117
|
+
}).where(
|
|
107118
|
+
and13(
|
|
107119
|
+
eq16(tasks.id, change.taskId),
|
|
107120
|
+
or5(
|
|
107121
|
+
isNull3(tasks.pipelineStage),
|
|
107122
|
+
inArray7(tasks.pipelineStage, [
|
|
107123
|
+
"research",
|
|
107124
|
+
"consensus",
|
|
107125
|
+
"architecture_decision",
|
|
107126
|
+
"specification",
|
|
107127
|
+
"decomposition",
|
|
107128
|
+
"implementation",
|
|
107129
|
+
"validation",
|
|
107130
|
+
"testing",
|
|
107131
|
+
"release"
|
|
107132
|
+
])
|
|
107133
|
+
)
|
|
107134
|
+
)
|
|
107135
|
+
).run();
|
|
107136
|
+
}
|
|
107137
|
+
}
|
|
107138
|
+
if (!dryRun) {
|
|
107139
|
+
const guardValue = JSON.stringify({
|
|
107140
|
+
ranAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
107141
|
+
tasksUpdated: changes.length,
|
|
107142
|
+
task: "T871"
|
|
107143
|
+
});
|
|
107144
|
+
await db.insert(schemaMeta).values({ key: TERMINAL_BACKFILL_KEY, value: guardValue }).onConflictDoUpdate({
|
|
107145
|
+
target: schemaMeta.key,
|
|
107146
|
+
set: { value: guardValue }
|
|
107147
|
+
}).run();
|
|
107148
|
+
}
|
|
107149
|
+
return {
|
|
107150
|
+
alreadyRun: false,
|
|
107151
|
+
dryRun,
|
|
107152
|
+
tasksScanned,
|
|
107153
|
+
tasksUpdated: changes.length,
|
|
107154
|
+
changes
|
|
107155
|
+
};
|
|
107156
|
+
}
|
|
107157
|
+
async function isTerminalPipelineStageBackfillDone(cwd) {
|
|
107158
|
+
const db = await getDb(cwd);
|
|
107159
|
+
const guard = await db.select().from(schemaMeta).where(eq16(schemaMeta.key, TERMINAL_BACKFILL_KEY)).limit(1).all();
|
|
107160
|
+
return guard.length > 0;
|
|
107161
|
+
}
|
|
107162
|
+
var TERMINAL_BACKFILL_KEY, TERMINAL_STAGES;
|
|
107163
|
+
var init_backfill_terminal_pipeline_stage = __esm({
|
|
107164
|
+
"packages/core/src/lifecycle/backfill-terminal-pipeline-stage.ts"() {
|
|
107165
|
+
"use strict";
|
|
107166
|
+
init_sqlite2();
|
|
107167
|
+
init_tasks_schema();
|
|
107168
|
+
init_pipeline_stage();
|
|
107169
|
+
TERMINAL_BACKFILL_KEY = "backfill:terminal-pipeline-stage";
|
|
107170
|
+
TERMINAL_STAGES = Array.from(TERMINAL_PIPELINE_STAGES);
|
|
107171
|
+
}
|
|
107172
|
+
});
|
|
107173
|
+
|
|
107060
107174
|
// packages/core/src/validation/chain-validation.ts
|
|
107061
107175
|
function validateChainShape(shape) {
|
|
107062
107176
|
const errors = [];
|
|
@@ -107194,9 +107308,9 @@ async function addChain(chain, projectRoot) {
|
|
|
107194
107308
|
}
|
|
107195
107309
|
async function showChain(id2, projectRoot) {
|
|
107196
107310
|
const { getDb: getDb4 } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
|
|
107197
|
-
const { eq:
|
|
107311
|
+
const { eq: eq22 } = await import("drizzle-orm");
|
|
107198
107312
|
const db = await getDb4(projectRoot);
|
|
107199
|
-
const rows = await db.select().from(warpChains).where(
|
|
107313
|
+
const rows = await db.select().from(warpChains).where(eq22(warpChains.id, id2));
|
|
107200
107314
|
if (rows.length === 0) return null;
|
|
107201
107315
|
return JSON.parse(rows[0].definition);
|
|
107202
107316
|
}
|
|
@@ -107243,9 +107357,9 @@ async function createInstance(params2, projectRoot) {
|
|
|
107243
107357
|
}
|
|
107244
107358
|
async function showInstance(id2, projectRoot) {
|
|
107245
107359
|
const { getDb: getDb4 } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
|
|
107246
|
-
const { eq:
|
|
107360
|
+
const { eq: eq22 } = await import("drizzle-orm");
|
|
107247
107361
|
const db = await getDb4(projectRoot);
|
|
107248
|
-
const rows = await db.select().from(warpChainInstances).where(
|
|
107362
|
+
const rows = await db.select().from(warpChainInstances).where(eq22(warpChainInstances.id, id2));
|
|
107249
107363
|
if (rows.length === 0) return null;
|
|
107250
107364
|
const row = rows[0];
|
|
107251
107365
|
return {
|
|
@@ -107291,11 +107405,11 @@ async function advanceInstance(id2, nextStage, gateResults, projectRoot) {
|
|
|
107291
107405
|
}
|
|
107292
107406
|
}
|
|
107293
107407
|
const { getDb: getDb4 } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
|
|
107294
|
-
const { eq:
|
|
107408
|
+
const { eq: eq22 } = await import("drizzle-orm");
|
|
107295
107409
|
const db = await getDb4(projectRoot);
|
|
107296
107410
|
const now2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
107297
107411
|
const existingResults = [];
|
|
107298
|
-
const row = (await db.select().from(warpChainInstances).where(
|
|
107412
|
+
const row = (await db.select().from(warpChainInstances).where(eq22(warpChainInstances.id, id2)))[0];
|
|
107299
107413
|
if (row?.gateResults) {
|
|
107300
107414
|
existingResults.push(...JSON.parse(row.gateResults));
|
|
107301
107415
|
}
|
|
@@ -107305,7 +107419,7 @@ async function advanceInstance(id2, nextStage, gateResults, projectRoot) {
|
|
|
107305
107419
|
gateResults: JSON.stringify(allResults),
|
|
107306
107420
|
status: "active",
|
|
107307
107421
|
updatedAt: now2
|
|
107308
|
-
}).where(
|
|
107422
|
+
}).where(eq22(warpChainInstances.id, id2));
|
|
107309
107423
|
return {
|
|
107310
107424
|
...instance,
|
|
107311
107425
|
currentStage: nextStage,
|
|
@@ -107830,7 +107944,7 @@ var init_gate_runner = __esm({
|
|
|
107830
107944
|
|
|
107831
107945
|
// packages/core/src/lifecycle/ivtr-loop.ts
|
|
107832
107946
|
import { createHash as createHash20 } from "node:crypto";
|
|
107833
|
-
import { eq as
|
|
107947
|
+
import { eq as eq17 } from "drizzle-orm";
|
|
107834
107948
|
function nextPhase(current) {
|
|
107835
107949
|
const idx = PHASE_ORDER.indexOf(current);
|
|
107836
107950
|
if (idx === -1 || idx >= PHASE_ORDER.length - 1) return null;
|
|
@@ -107838,7 +107952,7 @@ function nextPhase(current) {
|
|
|
107838
107952
|
}
|
|
107839
107953
|
async function readIvtrStateRaw(taskId, cwd) {
|
|
107840
107954
|
const db = await getDb(cwd);
|
|
107841
|
-
const rows = await db.select({ ivtrState: tasks.ivtrState }).from(tasks).where(
|
|
107955
|
+
const rows = await db.select({ ivtrState: tasks.ivtrState }).from(tasks).where(eq17(tasks.id, taskId)).all();
|
|
107842
107956
|
if (rows.length === 0 || rows[0]?.ivtrState == null) return null;
|
|
107843
107957
|
try {
|
|
107844
107958
|
return JSON.parse(rows[0].ivtrState);
|
|
@@ -107849,12 +107963,12 @@ async function readIvtrStateRaw(taskId, cwd) {
|
|
|
107849
107963
|
}
|
|
107850
107964
|
async function writeIvtrState(state, cwd) {
|
|
107851
107965
|
const db = await getDb(cwd);
|
|
107852
|
-
const exists2 = await db.select({ id: tasks.id }).from(tasks).where(
|
|
107966
|
+
const exists2 = await db.select({ id: tasks.id }).from(tasks).where(eq17(tasks.id, state.taskId)).get();
|
|
107853
107967
|
if (!exists2) {
|
|
107854
107968
|
throw new Error(`Task ${state.taskId} not found --- cannot write IVTR state`);
|
|
107855
107969
|
}
|
|
107856
107970
|
const json3 = JSON.stringify(state);
|
|
107857
|
-
await db.update(tasks).set({ ivtrState: json3, updatedAt: (/* @__PURE__ */ new Date()).toISOString() }).where(
|
|
107971
|
+
await db.update(tasks).set({ ivtrState: json3, updatedAt: (/* @__PURE__ */ new Date()).toISOString() }).where(eq17(tasks.id, state.taskId)).run();
|
|
107858
107972
|
}
|
|
107859
107973
|
async function startIvtr(taskId, options) {
|
|
107860
107974
|
const existing = await readIvtrStateRaw(taskId, options?.cwd);
|
|
@@ -107995,7 +108109,7 @@ async function releaseIvtr(taskId, options) {
|
|
|
107995
108109
|
state.currentPhase = "released";
|
|
107996
108110
|
await writeIvtrState(state, options?.cwd);
|
|
107997
108111
|
const db = await getDb(options?.cwd);
|
|
107998
|
-
await db.update(tasks).set({ status: "done", completedAt: now2, updatedAt: now2 }).where(
|
|
108112
|
+
await db.update(tasks).set({ status: "done", completedAt: now2, updatedAt: now2 }).where(eq17(tasks.id, taskId)).all();
|
|
107999
108113
|
log11.info({ taskId }, "IVTR released --- task marked done");
|
|
108000
108114
|
return { released: true };
|
|
108001
108115
|
}
|
|
@@ -109749,7 +109863,7 @@ var init_brain_maintenance = __esm({
|
|
|
109749
109863
|
});
|
|
109750
109864
|
|
|
109751
109865
|
// packages/core/src/memory/brain-purge.ts
|
|
109752
|
-
import { inArray as
|
|
109866
|
+
import { inArray as inArray8, ne as ne3, sql as sql15 } from "drizzle-orm";
|
|
109753
109867
|
function countRowsNative(tableName) {
|
|
109754
109868
|
const nativeDb = getBrainNativeDb();
|
|
109755
109869
|
if (!nativeDb) return 0;
|
|
@@ -109798,7 +109912,7 @@ async function purgeBrainNoise(projectRoot) {
|
|
|
109798
109912
|
const BATCH = 500;
|
|
109799
109913
|
for (let i = 0; i < patternIdsToDelete.length; i += BATCH) {
|
|
109800
109914
|
const batch = patternIdsToDelete.slice(i, i + BATCH);
|
|
109801
|
-
await db.delete(brainPatterns).where(
|
|
109915
|
+
await db.delete(brainPatterns).where(inArray8(brainPatterns.id, batch));
|
|
109802
109916
|
patternsDeleted += batch.length;
|
|
109803
109917
|
}
|
|
109804
109918
|
}
|
|
@@ -109810,7 +109924,7 @@ async function purgeBrainNoise(projectRoot) {
|
|
|
109810
109924
|
const BATCH = 500;
|
|
109811
109925
|
for (let i = 0; i < ids.length; i += BATCH) {
|
|
109812
109926
|
const batch = ids.slice(i, i + BATCH);
|
|
109813
|
-
await db.delete(brainLearnings).where(
|
|
109927
|
+
await db.delete(brainLearnings).where(inArray8(brainLearnings.id, batch));
|
|
109814
109928
|
}
|
|
109815
109929
|
}
|
|
109816
109930
|
console.log(`Learnings deleted (all): ${learningsDeleted}`);
|
|
@@ -109818,7 +109932,7 @@ async function purgeBrainNoise(projectRoot) {
|
|
|
109818
109932
|
const decisionsDeleted = decisionsToDelete.length;
|
|
109819
109933
|
if (decisionsDeleted > 0) {
|
|
109820
109934
|
const ids = decisionsToDelete.map((r) => r.id);
|
|
109821
|
-
await db.delete(brainDecisions).where(
|
|
109935
|
+
await db.delete(brainDecisions).where(inArray8(brainDecisions.id, ids));
|
|
109822
109936
|
}
|
|
109823
109937
|
console.log(`Decisions deleted (all except D-mntpeeer): ${decisionsDeleted}`);
|
|
109824
109938
|
const allObservations = await db.select().from(brainObservations);
|
|
@@ -109865,7 +109979,7 @@ async function purgeBrainNoise(projectRoot) {
|
|
|
109865
109979
|
const BATCH = 500;
|
|
109866
109980
|
for (let i = 0; i < obsIdsToDelete.length; i += BATCH) {
|
|
109867
109981
|
const batch = obsIdsToDelete.slice(i, i + BATCH);
|
|
109868
|
-
await db.delete(brainObservations).where(
|
|
109982
|
+
await db.delete(brainObservations).where(inArray8(brainObservations.id, batch));
|
|
109869
109983
|
observationsDeleted += batch.length;
|
|
109870
109984
|
}
|
|
109871
109985
|
}
|
|
@@ -111817,7 +111931,7 @@ var init_engine_compat = __esm({
|
|
|
111817
111931
|
import { createHash as createHash22 } from "node:crypto";
|
|
111818
111932
|
import { existsSync as existsSync113, readFileSync as readFileSync82, renameSync as renameSync8 } from "node:fs";
|
|
111819
111933
|
import { join as join114 } from "node:path";
|
|
111820
|
-
import { and as
|
|
111934
|
+
import { and as and14, count as count3, desc as desc6, eq as eq18, gte as gte3, isNull as isNull4, like as like3, lte as lte2, or as or6 } from "drizzle-orm";
|
|
111821
111935
|
async function getDb3(cwd) {
|
|
111822
111936
|
const { getDb: _getDb } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
|
|
111823
111937
|
return _getDb(cwd);
|
|
@@ -111836,13 +111950,13 @@ function effectivePageLimit2(limit, offset) {
|
|
|
111836
111950
|
return limit ?? (offset !== void 0 ? 50 : void 0);
|
|
111837
111951
|
}
|
|
111838
111952
|
function buildManifestSqlFilters(filter) {
|
|
111839
|
-
const conditions = [
|
|
111953
|
+
const conditions = [isNull4(pipelineManifest.archivedAt)];
|
|
111840
111954
|
if (filter.status) {
|
|
111841
111955
|
const storedStatus = filter.status === "completed" ? "active" : filter.status;
|
|
111842
|
-
conditions.push(
|
|
111956
|
+
conditions.push(eq18(pipelineManifest.status, storedStatus));
|
|
111843
111957
|
}
|
|
111844
111958
|
if (filter.agent_type) {
|
|
111845
|
-
conditions.push(
|
|
111959
|
+
conditions.push(eq18(pipelineManifest.type, filter.agent_type));
|
|
111846
111960
|
}
|
|
111847
111961
|
if (filter.dateAfter) {
|
|
111848
111962
|
conditions.push(gte3(pipelineManifest.createdAt, `${filter.dateAfter} 00:00:00`));
|
|
@@ -111935,7 +112049,7 @@ async function pipelineManifestShow(researchId, projectRoot) {
|
|
|
111935
112049
|
}
|
|
111936
112050
|
try {
|
|
111937
112051
|
const db = await getDb3(projectRoot);
|
|
111938
|
-
const rows = await db.select().from(pipelineManifest).where(
|
|
112052
|
+
const rows = await db.select().from(pipelineManifest).where(eq18(pipelineManifest.id, researchId)).limit(1);
|
|
111939
112053
|
if (rows.length === 0) {
|
|
111940
112054
|
return {
|
|
111941
112055
|
success: false,
|
|
@@ -111977,8 +112091,8 @@ async function pipelineManifestList(params2, projectRoot) {
|
|
|
111977
112091
|
const offset = normalizeOffset2(params2.offset);
|
|
111978
112092
|
const pageLimit = effectivePageLimit2(limit, offset);
|
|
111979
112093
|
const { conditions, requiresInMemoryFiltering } = buildManifestSqlFilters(filter);
|
|
111980
|
-
const whereClause =
|
|
111981
|
-
const totalRow = await db.select({ count: count3() }).from(pipelineManifest).where(
|
|
112094
|
+
const whereClause = and14(...conditions);
|
|
112095
|
+
const totalRow = await db.select({ count: count3() }).from(pipelineManifest).where(isNull4(pipelineManifest.archivedAt)).get();
|
|
111982
112096
|
const total = totalRow?.count ?? 0;
|
|
111983
112097
|
if (!requiresInMemoryFiltering) {
|
|
111984
112098
|
const filteredRow = await db.select({ count: count3() }).from(pipelineManifest).where(whereClause).get();
|
|
@@ -112025,9 +112139,9 @@ async function pipelineManifestFind(query, options, projectRoot) {
|
|
|
112025
112139
|
const db = await getDb3(projectRoot);
|
|
112026
112140
|
const likePattern = `%${query}%`;
|
|
112027
112141
|
const rows = await db.select().from(pipelineManifest).where(
|
|
112028
|
-
|
|
112029
|
-
|
|
112030
|
-
|
|
112142
|
+
and14(
|
|
112143
|
+
isNull4(pipelineManifest.archivedAt),
|
|
112144
|
+
or6(like3(pipelineManifest.content, likePattern), like3(pipelineManifest.type, likePattern))
|
|
112031
112145
|
)
|
|
112032
112146
|
).orderBy(desc6(pipelineManifest.createdAt));
|
|
112033
112147
|
const queryLower = query.toLowerCase();
|
|
@@ -112069,7 +112183,7 @@ async function pipelineManifestFind(query, options, projectRoot) {
|
|
|
112069
112183
|
async function pipelineManifestPending(epicId, projectRoot) {
|
|
112070
112184
|
try {
|
|
112071
112185
|
const db = await getDb3(projectRoot);
|
|
112072
|
-
const rows = await db.select().from(pipelineManifest).where(
|
|
112186
|
+
const rows = await db.select().from(pipelineManifest).where(isNull4(pipelineManifest.archivedAt)).orderBy(desc6(pipelineManifest.createdAt));
|
|
112073
112187
|
const entries = rows.map(rowToEntry);
|
|
112074
112188
|
let pending = entries.filter(
|
|
112075
112189
|
(e) => e.status === "partial" || e.status === "blocked" || e.needs_followup && e.needs_followup.length > 0
|
|
@@ -112102,7 +112216,7 @@ async function pipelineManifestPending(epicId, projectRoot) {
|
|
|
112102
112216
|
async function pipelineManifestStats(epicId, projectRoot) {
|
|
112103
112217
|
try {
|
|
112104
112218
|
const db = await getDb3(projectRoot);
|
|
112105
|
-
const rows = await db.select().from(pipelineManifest).where(
|
|
112219
|
+
const rows = await db.select().from(pipelineManifest).where(isNull4(pipelineManifest.archivedAt));
|
|
112106
112220
|
const entries = rows.map(rowToEntry);
|
|
112107
112221
|
let filtered = entries;
|
|
112108
112222
|
if (epicId) {
|
|
@@ -112207,7 +112321,7 @@ async function pipelineManifestArchive(beforeDate, projectRoot) {
|
|
|
112207
112321
|
error: { code: "E_DB_NOT_INITIALIZED", message: "Database not initialized" }
|
|
112208
112322
|
};
|
|
112209
112323
|
}
|
|
112210
|
-
const rows = await db.select().from(pipelineManifest).where(
|
|
112324
|
+
const rows = await db.select().from(pipelineManifest).where(isNull4(pipelineManifest.archivedAt));
|
|
112211
112325
|
const toArchive = rows.filter((r) => r.createdAt.slice(0, 10) < beforeDate);
|
|
112212
112326
|
if (toArchive.length === 0) {
|
|
112213
112327
|
const remaining2 = rows.length;
|
|
@@ -112218,7 +112332,7 @@ async function pipelineManifestArchive(beforeDate, projectRoot) {
|
|
|
112218
112332
|
}
|
|
112219
112333
|
const archivedAt = now();
|
|
112220
112334
|
for (const row of toArchive) {
|
|
112221
|
-
await db.update(pipelineManifest).set({ archivedAt }).where(
|
|
112335
|
+
await db.update(pipelineManifest).set({ archivedAt }).where(eq18(pipelineManifest.id, row.id));
|
|
112222
112336
|
}
|
|
112223
112337
|
const remaining = rows.length - toArchive.length;
|
|
112224
112338
|
return { success: true, data: { archived: toArchive.length, remaining } };
|
|
@@ -112235,7 +112349,7 @@ async function pipelineManifestArchive(beforeDate, projectRoot) {
|
|
|
112235
112349
|
async function readManifestEntries2(projectRoot) {
|
|
112236
112350
|
try {
|
|
112237
112351
|
const db = await getDb3(projectRoot);
|
|
112238
|
-
const rows = await db.select().from(pipelineManifest).where(
|
|
112352
|
+
const rows = await db.select().from(pipelineManifest).where(isNull4(pipelineManifest.archivedAt)).orderBy(desc6(pipelineManifest.createdAt));
|
|
112239
112353
|
return rows.map(rowToEntry);
|
|
112240
112354
|
} catch {
|
|
112241
112355
|
return [];
|
|
@@ -112567,25 +112681,25 @@ async function measureTokenExchange(input) {
|
|
|
112567
112681
|
);
|
|
112568
112682
|
}
|
|
112569
112683
|
async function whereClauses(filters) {
|
|
112570
|
-
const { eq:
|
|
112684
|
+
const { eq: eq22, gte: gte4, lte: lte3 } = await import("drizzle-orm");
|
|
112571
112685
|
const clauses = [];
|
|
112572
|
-
if (filters.provider) clauses.push(
|
|
112573
|
-
if (filters.transport) clauses.push(
|
|
112574
|
-
if (filters.gateway) clauses.push(
|
|
112575
|
-
if (filters.domain) clauses.push(
|
|
112576
|
-
if (filters.operation) clauses.push(
|
|
112577
|
-
if (filters.sessionId) clauses.push(
|
|
112578
|
-
if (filters.taskId) clauses.push(
|
|
112579
|
-
if (filters.method) clauses.push(
|
|
112580
|
-
if (filters.confidence) clauses.push(
|
|
112581
|
-
if (filters.requestId) clauses.push(
|
|
112686
|
+
if (filters.provider) clauses.push(eq22(tokenUsage.provider, filters.provider));
|
|
112687
|
+
if (filters.transport) clauses.push(eq22(tokenUsage.transport, filters.transport));
|
|
112688
|
+
if (filters.gateway) clauses.push(eq22(tokenUsage.gateway, filters.gateway));
|
|
112689
|
+
if (filters.domain) clauses.push(eq22(tokenUsage.domain, filters.domain));
|
|
112690
|
+
if (filters.operation) clauses.push(eq22(tokenUsage.operation, filters.operation));
|
|
112691
|
+
if (filters.sessionId) clauses.push(eq22(tokenUsage.sessionId, filters.sessionId));
|
|
112692
|
+
if (filters.taskId) clauses.push(eq22(tokenUsage.taskId, filters.taskId));
|
|
112693
|
+
if (filters.method) clauses.push(eq22(tokenUsage.method, filters.method));
|
|
112694
|
+
if (filters.confidence) clauses.push(eq22(tokenUsage.confidence, filters.confidence));
|
|
112695
|
+
if (filters.requestId) clauses.push(eq22(tokenUsage.requestId, filters.requestId));
|
|
112582
112696
|
if (filters.since) clauses.push(gte4(tokenUsage.createdAt, filters.since));
|
|
112583
112697
|
if (filters.until) clauses.push(lte3(tokenUsage.createdAt, filters.until));
|
|
112584
112698
|
return clauses;
|
|
112585
112699
|
}
|
|
112586
112700
|
async function recordTokenExchange(input) {
|
|
112587
112701
|
const { getDb: getDb4 } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
|
|
112588
|
-
const { eq:
|
|
112702
|
+
const { eq: eq22 } = await import("drizzle-orm");
|
|
112589
112703
|
const measurement = await measureTokenExchange(input);
|
|
112590
112704
|
const db = await getDb4(input.cwd);
|
|
112591
112705
|
const row = {
|
|
@@ -112614,22 +112728,22 @@ async function recordTokenExchange(input) {
|
|
|
112614
112728
|
})
|
|
112615
112729
|
};
|
|
112616
112730
|
await db.insert(tokenUsage).values(row);
|
|
112617
|
-
const inserted = await db.select().from(tokenUsage).where(
|
|
112731
|
+
const inserted = await db.select().from(tokenUsage).where(eq22(tokenUsage.id, row.id)).limit(1);
|
|
112618
112732
|
return inserted[0];
|
|
112619
112733
|
}
|
|
112620
112734
|
async function showTokenUsage(id2, cwd) {
|
|
112621
112735
|
const { getDb: getDb4 } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
|
|
112622
|
-
const { eq:
|
|
112736
|
+
const { eq: eq22 } = await import("drizzle-orm");
|
|
112623
112737
|
const db = await getDb4(cwd);
|
|
112624
|
-
const rows = await db.select().from(tokenUsage).where(
|
|
112738
|
+
const rows = await db.select().from(tokenUsage).where(eq22(tokenUsage.id, id2)).limit(1);
|
|
112625
112739
|
return rows[0] ?? null;
|
|
112626
112740
|
}
|
|
112627
112741
|
async function listTokenUsage(filters = {}, cwd) {
|
|
112628
112742
|
const { getDb: getDb4 } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
|
|
112629
|
-
const { and:
|
|
112743
|
+
const { and: and17, count: count5, desc: desc8 } = await import("drizzle-orm");
|
|
112630
112744
|
const db = await getDb4(cwd);
|
|
112631
112745
|
const clauses = await whereClauses(filters);
|
|
112632
|
-
const where = clauses.length > 0 ?
|
|
112746
|
+
const where = clauses.length > 0 ? and17(...clauses) : void 0;
|
|
112633
112747
|
const totalRows = await db.select({ count: count5() }).from(tokenUsage);
|
|
112634
112748
|
const filteredRows = await db.select({ count: count5() }).from(tokenUsage).where(where);
|
|
112635
112749
|
let query = db.select().from(tokenUsage).orderBy(desc8(tokenUsage.createdAt));
|
|
@@ -112645,10 +112759,10 @@ async function listTokenUsage(filters = {}, cwd) {
|
|
|
112645
112759
|
}
|
|
112646
112760
|
async function summarizeTokenUsage(filters = {}, cwd) {
|
|
112647
112761
|
const { getDb: getDb4 } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
|
|
112648
|
-
const { and:
|
|
112762
|
+
const { and: and17, desc: desc8 } = await import("drizzle-orm");
|
|
112649
112763
|
const db = await getDb4(cwd);
|
|
112650
112764
|
const clauses = await whereClauses(filters);
|
|
112651
|
-
const where = clauses.length > 0 ?
|
|
112765
|
+
const where = clauses.length > 0 ? and17(...clauses) : void 0;
|
|
112652
112766
|
const rows = await db.select().from(tokenUsage).where(where).orderBy(desc8(tokenUsage.createdAt));
|
|
112653
112767
|
const byMethod = /* @__PURE__ */ new Map();
|
|
112654
112768
|
const byTransport = /* @__PURE__ */ new Map();
|
|
@@ -112689,17 +112803,17 @@ async function summarizeTokenUsage(filters = {}, cwd) {
|
|
|
112689
112803
|
}
|
|
112690
112804
|
async function deleteTokenUsage(id2, cwd) {
|
|
112691
112805
|
const { getDb: getDb4 } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
|
|
112692
|
-
const { eq:
|
|
112806
|
+
const { eq: eq22 } = await import("drizzle-orm");
|
|
112693
112807
|
const db = await getDb4(cwd);
|
|
112694
|
-
await db.delete(tokenUsage).where(
|
|
112808
|
+
await db.delete(tokenUsage).where(eq22(tokenUsage.id, id2));
|
|
112695
112809
|
return { deleted: true, id: id2 };
|
|
112696
112810
|
}
|
|
112697
112811
|
async function clearTokenUsage(filters = {}, cwd) {
|
|
112698
112812
|
const { getDb: getDb4 } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
|
|
112699
|
-
const { and:
|
|
112813
|
+
const { and: and17, count: count5 } = await import("drizzle-orm");
|
|
112700
112814
|
const db = await getDb4(cwd);
|
|
112701
112815
|
const clauses = await whereClauses(filters);
|
|
112702
|
-
const where = clauses.length > 0 ?
|
|
112816
|
+
const where = clauses.length > 0 ? and17(...clauses) : void 0;
|
|
112703
112817
|
const countRows = await db.select({ count: count5() }).from(tokenUsage).where(where);
|
|
112704
112818
|
await db.delete(tokenUsage).where(where);
|
|
112705
112819
|
return { deleted: countRows[0]?.count ?? 0 };
|
|
@@ -113140,7 +113254,7 @@ function Pn(s3, t) {
|
|
|
113140
113254
|
function zn(s3, t) {
|
|
113141
113255
|
s3.head = new ue(t, void 0, s3.head, s3), s3.tail || (s3.tail = s3.head), s3.length++;
|
|
113142
113256
|
}
|
|
113143
|
-
var kr, vr, Os, Br, Pr, zr, q, j, rt, Le, jt, Ne, Ts, Ae, xs, z10, Mt, b, Qt, Bt, _, A, g, yi, De, L2, w, Ri, bi, Ls, _i, Z, gi, Ie, Jt, yt, C2, te, Ur, Hr, Wr, Gr, Ce, Oi, Zr, Yr, D, Vr, ot, H, ee, m, xi, J, Li, Ii, Ci, se, Fe, Ut, Ht, Ni, Pt, ht, U, nt, Y, zt, Ai, Q, ie, Di, ke, Rt, ve, bt, _t, Me, tt, Wt, $r, As, Ds, Is, Cs, Fs, Xr, re, K, jr, M2, Qr, vs, Jr, ki, Ot, Gt, vi, ne4, Be, Pe, ze, Ue, He, We, Ge, Ze, Ye, Ms, en, sn, Bs, rn, nn, Ps, zs, Bi, oe, hn, he, Ke, F, an, Tt, Pi, ln, at, cn, fn, dn, lt3, un, mn, pn, zi, En, xt, ct, Sn, yn, Rn, bn, f, Yt, Lt, gn, Zi, Yi, On, B, Nt, et, Ui, Us, V, ae, ft, Hs, p, it, dt, Hi, At, y, Ve, $e, Wi, Ws, Gs, le, Gi, Xe, Kt, ut, qe, Dt, je, Qe, Zs, Tn, st, mt, Nn, Ki, An, Dn, It, Vi, Cn, Ys, ce, Je, $i, Fn, kn, Xi, Ks, Js, vn, Xs, qs, js, ji, Qs, fe, ti, Qi, ei, Ji, ts, es, is2, pt, ii, ss, qi, X, de, si, ri, Mn, ni, ue, di, tr, oi, me, W2, Ct, Ft, pe, rs, G2, ns, hi, er, as, ls, ai, li, ir, os, ci, rr, hs, Et, kt, Un, Hn,
|
|
113257
|
+
var kr, vr, Os, Br, Pr, zr, q, j, rt, Le, jt, Ne, Ts, Ae, xs, z10, Mt, b, Qt, Bt, _, A, g, yi, De, L2, w, Ri, bi, Ls, _i, Z, gi, Ie, Jt, yt, C2, te, Ur, Hr, Wr, Gr, Ce, Oi, Zr, Yr, D, Vr, ot, H, ee, m, xi, J, Li, Ii, Ci, se, Fe, Ut, Ht, Ni, Pt, ht, U, nt, Y, zt, Ai, Q, ie, Di, ke, Rt, ve, bt, _t, Me, tt, Wt, $r, As, Ds, Is, Cs, Fs, Xr, re, K, jr, M2, Qr, vs, Jr, ki, Ot, Gt, vi, ne4, Be, Pe, ze, Ue, He, We, Ge, Ze, Ye, Ms, en, sn, Bs, rn, nn, Ps, zs, Bi, oe, hn, he, Ke, F, an, Tt, Pi, ln, at, cn, fn, dn, lt3, un, mn, pn, zi, En, xt, ct, Sn, yn, Rn, bn, f, Yt, Lt, gn, Zi, Yi, On, B, Nt, et, Ui, Us, V, ae, ft, Hs, p, it, dt, Hi, At, y, Ve, $e, Wi, Ws, Gs, le, Gi, Xe, Kt, ut, qe, Dt, je, Qe, Zs, Tn, st, mt, Nn, Ki, An, Dn, It, Vi, Cn, Ys, ce, Je, $i, Fn, kn, Xi, Ks, Js, vn, Xs, qs, js, ji, Qs, fe, ti, Qi, ei, Ji, ts, es, is2, pt, ii, ss, qi, X, de, si, ri, Mn, ni, ue, di, tr, oi, me, W2, Ct, Ft, pe, rs, G2, ns, hi, er, as, ls, ai, li, ir, os, ci, rr, hs, Et, kt, Un, Hn, or7, hr, Wn, Gn, Zn, Yn, fr, dr, ar, ur, mr, pr, Kn, Vn, $n, lr, cs, fs3, ui, Xn, ds, qn, us, we, wt, Qn, Er, ms, wr, Jn, Sr, ps, yr, $t, Rr, to, eo, io, Ei, _r, gr, ys, Or, Rs, P2, bs, _s, Si, Tr, xr, ye, Lr, Nr, Es, St, O, wi, Ar, Xt, ws, Ss, gs, Re, be, _e, ge, ro, Oe, no, oo, ho, Dr, qt, Se, Te, ao, lo, co, fo, uo, mo, po, Eo, vt, wo, So;
|
|
113144
113258
|
var init_index_min = __esm({
|
|
113145
113259
|
"node_modules/.pnpm/tar@7.5.13/node_modules/tar/dist/esm/index.min.js"() {
|
|
113146
113260
|
kr = Object.defineProperty;
|
|
@@ -115167,7 +115281,7 @@ var init_index_min = __esm({
|
|
|
115167
115281
|
};
|
|
115168
115282
|
Un = (s3, t) => {
|
|
115169
115283
|
let e = new kt(s3), i = new Wt(s3.file, { mode: s3.mode || 438 });
|
|
115170
|
-
e.pipe(i),
|
|
115284
|
+
e.pipe(i), or7(e, t);
|
|
115171
115285
|
};
|
|
115172
115286
|
Hn = (s3, t) => {
|
|
115173
115287
|
let e = new Et(s3), i = new tt(s3.file, { mode: s3.mode || 438 });
|
|
@@ -115177,7 +115291,7 @@ var init_index_min = __esm({
|
|
|
115177
115291
|
});
|
|
115178
115292
|
return hr(e, t).catch((n) => e.emit("error", n)), r;
|
|
115179
115293
|
};
|
|
115180
|
-
|
|
115294
|
+
or7 = (s3, t) => {
|
|
115181
115295
|
t.forEach((e) => {
|
|
115182
115296
|
e.charAt(0) === "@" ? It({ file: nr.resolve(s3.cwd, e.slice(1)), sync: true, noResume: true, onReadEntry: (i) => s3.add(i) }) : s3.add(e);
|
|
115183
115297
|
}), s3.end();
|
|
@@ -115190,7 +115304,7 @@ var init_index_min = __esm({
|
|
|
115190
115304
|
};
|
|
115191
115305
|
Wn = (s3, t) => {
|
|
115192
115306
|
let e = new kt(s3);
|
|
115193
|
-
return
|
|
115307
|
+
return or7(e, t), e;
|
|
115194
115308
|
};
|
|
115195
115309
|
Gn = (s3, t) => {
|
|
115196
115310
|
let e = new Et(s3);
|
|
@@ -117002,7 +117116,7 @@ __export(session_store_exports, {
|
|
|
117002
117116
|
updateSession: () => updateSession,
|
|
117003
117117
|
workHistory: () => workHistory
|
|
117004
117118
|
});
|
|
117005
|
-
import { and as
|
|
117119
|
+
import { and as and15, desc as desc7, eq as eq19, isNull as isNull5 } from "drizzle-orm";
|
|
117006
117120
|
async function createSession(session, cwd) {
|
|
117007
117121
|
const db = await getDb(cwd);
|
|
117008
117122
|
const tw = session.taskWork;
|
|
@@ -117024,7 +117138,7 @@ async function createSession(session, cwd) {
|
|
|
117024
117138
|
}
|
|
117025
117139
|
async function getSession(sessionId, cwd) {
|
|
117026
117140
|
const db = await getDb(cwd);
|
|
117027
|
-
const rows = await db.select().from(sessions).where(
|
|
117141
|
+
const rows = await db.select().from(sessions).where(eq19(sessions.id, sessionId)).all();
|
|
117028
117142
|
if (rows.length === 0) return null;
|
|
117029
117143
|
return rowToSession(rows[0]);
|
|
117030
117144
|
}
|
|
@@ -117053,16 +117167,16 @@ async function updateSession(sessionId, updates, cwd) {
|
|
|
117053
117167
|
updateRow.handoffConsumedBy = updates.handoffConsumedBy;
|
|
117054
117168
|
if (updates.debriefJson !== void 0) updateRow.debriefJson = updates.debriefJson;
|
|
117055
117169
|
if (updates.handoffJson !== void 0) updateRow.handoffJson = updates.handoffJson;
|
|
117056
|
-
db.update(sessions).set(updateRow).where(
|
|
117170
|
+
db.update(sessions).set(updateRow).where(eq19(sessions.id, sessionId)).run();
|
|
117057
117171
|
return getSession(sessionId, cwd);
|
|
117058
117172
|
}
|
|
117059
117173
|
async function listSessions2(filters, cwd) {
|
|
117060
117174
|
const db = await getDb(cwd);
|
|
117061
117175
|
const conditions = [];
|
|
117062
117176
|
if (filters?.active) {
|
|
117063
|
-
conditions.push(
|
|
117177
|
+
conditions.push(eq19(sessions.status, "active"));
|
|
117064
117178
|
}
|
|
117065
|
-
const query = db.select().from(sessions).where(conditions.length > 0 ?
|
|
117179
|
+
const query = db.select().from(sessions).where(conditions.length > 0 ? and15(...conditions) : void 0).orderBy(desc7(sessions.startedAt));
|
|
117066
117180
|
const rows = filters?.limit ? await query.limit(filters.limit).all() : await query.all();
|
|
117067
117181
|
return rows.map(rowToSession);
|
|
117068
117182
|
}
|
|
@@ -117084,20 +117198,20 @@ async function startTask2(sessionId, taskId, cwd) {
|
|
|
117084
117198
|
const db = await getDb(cwd);
|
|
117085
117199
|
const now2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
117086
117200
|
db.update(taskWorkHistory).set({ clearedAt: now2 }).where(
|
|
117087
|
-
|
|
117088
|
-
|
|
117089
|
-
|
|
117201
|
+
and15(
|
|
117202
|
+
eq19(taskWorkHistory.sessionId, sessionId),
|
|
117203
|
+
isNull5(taskWorkHistory.clearedAt)
|
|
117090
117204
|
)
|
|
117091
117205
|
).run();
|
|
117092
117206
|
db.insert(taskWorkHistory).values({ sessionId, taskId, setAt: now2 }).run();
|
|
117093
|
-
db.update(sessions).set({ currentTask: taskId, taskStartedAt: now2 }).where(
|
|
117207
|
+
db.update(sessions).set({ currentTask: taskId, taskStartedAt: now2 }).where(eq19(sessions.id, sessionId)).run();
|
|
117094
117208
|
}
|
|
117095
117209
|
async function getCurrentTask(sessionId, cwd) {
|
|
117096
117210
|
const db = await getDb(cwd);
|
|
117097
117211
|
const rows = await db.select({
|
|
117098
117212
|
currentTask: sessions.currentTask,
|
|
117099
117213
|
taskStartedAt: sessions.taskStartedAt
|
|
117100
|
-
}).from(sessions).where(
|
|
117214
|
+
}).from(sessions).where(eq19(sessions.id, sessionId)).all();
|
|
117101
117215
|
if (rows.length === 0) return { taskId: null, since: null };
|
|
117102
117216
|
return { taskId: rows[0].currentTask, since: rows[0].taskStartedAt };
|
|
117103
117217
|
}
|
|
@@ -117105,16 +117219,16 @@ async function stopTask2(sessionId, cwd) {
|
|
|
117105
117219
|
const db = await getDb(cwd);
|
|
117106
117220
|
const now2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
117107
117221
|
db.update(taskWorkHistory).set({ clearedAt: now2 }).where(
|
|
117108
|
-
|
|
117109
|
-
|
|
117110
|
-
|
|
117222
|
+
and15(
|
|
117223
|
+
eq19(taskWorkHistory.sessionId, sessionId),
|
|
117224
|
+
isNull5(taskWorkHistory.clearedAt)
|
|
117111
117225
|
)
|
|
117112
117226
|
).run();
|
|
117113
|
-
db.update(sessions).set({ currentTask: null, taskStartedAt: null }).where(
|
|
117227
|
+
db.update(sessions).set({ currentTask: null, taskStartedAt: null }).where(eq19(sessions.id, sessionId)).run();
|
|
117114
117228
|
}
|
|
117115
117229
|
async function workHistory(sessionId, limit = 50, cwd) {
|
|
117116
117230
|
const db = await getDb(cwd);
|
|
117117
|
-
const rows = await db.select().from(taskWorkHistory).where(
|
|
117231
|
+
const rows = await db.select().from(taskWorkHistory).where(eq19(taskWorkHistory.sessionId, sessionId)).orderBy(desc7(taskWorkHistory.setAt), desc7(taskWorkHistory.id)).limit(limit).all();
|
|
117118
117232
|
return rows.map((r) => ({
|
|
117119
117233
|
taskId: r.taskId,
|
|
117120
117234
|
setAt: r.setAt,
|
|
@@ -117125,16 +117239,16 @@ async function gcSessions2(maxAgeDays = 30, cwd) {
|
|
|
117125
117239
|
const db = await getDb(cwd);
|
|
117126
117240
|
const threshold = /* @__PURE__ */ new Date();
|
|
117127
117241
|
threshold.setDate(threshold.getDate() - maxAgeDays);
|
|
117128
|
-
const before = await db.select({ id: sessions.id }).from(sessions).where(
|
|
117242
|
+
const before = await db.select({ id: sessions.id }).from(sessions).where(and15(eq19(sessions.status, "ended"))).all();
|
|
117129
117243
|
const toUpdate = before;
|
|
117130
117244
|
if (toUpdate.length > 0) {
|
|
117131
|
-
db.update(sessions).set({ status: "orphaned" }).where(
|
|
117245
|
+
db.update(sessions).set({ status: "orphaned" }).where(eq19(sessions.status, "ended")).run();
|
|
117132
117246
|
}
|
|
117133
117247
|
return toUpdate.length;
|
|
117134
117248
|
}
|
|
117135
117249
|
async function getActiveSession(cwd) {
|
|
117136
117250
|
const db = await getDb(cwd);
|
|
117137
|
-
const rows = await db.select().from(sessions).where(
|
|
117251
|
+
const rows = await db.select().from(sessions).where(eq19(sessions.status, "active")).orderBy(desc7(sessions.startedAt)).limit(1).all();
|
|
117138
117252
|
if (rows.length === 0) return null;
|
|
117139
117253
|
return rowToSession(rows[0]);
|
|
117140
117254
|
}
|
|
@@ -117148,12 +117262,12 @@ var init_session_store = __esm({
|
|
|
117148
117262
|
});
|
|
117149
117263
|
|
|
117150
117264
|
// packages/core/src/store/data-safety.ts
|
|
117151
|
-
import { eq as
|
|
117265
|
+
import { eq as eq20 } from "drizzle-orm";
|
|
117152
117266
|
async function checkTaskExists(taskId, cwd, config2 = {}) {
|
|
117153
117267
|
const cfg = { ...DEFAULT_CONFIG2, ...config2 };
|
|
117154
117268
|
if (!cfg.detectCollisions) return false;
|
|
117155
117269
|
const db = await getDb(cwd);
|
|
117156
|
-
const existing = await db.select().from(tasks).where(
|
|
117270
|
+
const existing = await db.select().from(tasks).where(eq20(tasks.id, taskId)).all();
|
|
117157
117271
|
const exists2 = existing.length > 0;
|
|
117158
117272
|
if (exists2 && cfg.strictMode) {
|
|
117159
117273
|
throw new SafetyError(
|
|
@@ -117303,7 +117417,7 @@ __export(task_store_exports, {
|
|
|
117303
117417
|
updateTask: () => updateTask2,
|
|
117304
117418
|
updateTaskSafe: () => updateTaskSafe
|
|
117305
117419
|
});
|
|
117306
|
-
import { and as
|
|
117420
|
+
import { and as and16, asc as asc4, count as count4, eq as eq21, inArray as inArray9, isNull as isNull6, ne as ne5, sql as sql16 } from "drizzle-orm";
|
|
117307
117421
|
async function insertTaskRow(task, cwd) {
|
|
117308
117422
|
const db = await getDb(cwd);
|
|
117309
117423
|
const row = taskToRow(task);
|
|
@@ -117317,10 +117431,10 @@ async function insertTaskRow(task, cwd) {
|
|
|
117317
117431
|
}
|
|
117318
117432
|
async function getTask(taskId, cwd) {
|
|
117319
117433
|
const db = await getDb(cwd);
|
|
117320
|
-
const rows = await db.select().from(tasks).where(
|
|
117434
|
+
const rows = await db.select().from(tasks).where(eq21(tasks.id, taskId)).all();
|
|
117321
117435
|
if (rows.length === 0) return null;
|
|
117322
117436
|
const task = rowToTask(rows[0]);
|
|
117323
|
-
const deps = await db.select().from(taskDependencies).where(
|
|
117437
|
+
const deps = await db.select().from(taskDependencies).where(eq21(taskDependencies.taskId, taskId)).all();
|
|
117324
117438
|
if (deps.length > 0) {
|
|
117325
117439
|
task.depends = deps.map((d) => d.dependsOn);
|
|
117326
117440
|
}
|
|
@@ -117363,9 +117477,9 @@ async function updateTask2(taskId, updates, cwd) {
|
|
|
117363
117477
|
if (updates.verification !== void 0)
|
|
117364
117478
|
updateRow.verificationJson = JSON.stringify(updates.verification);
|
|
117365
117479
|
if (updates.assignee !== void 0) updateRow.assignee = updates.assignee;
|
|
117366
|
-
db.update(tasks).set(updateRow).where(
|
|
117480
|
+
db.update(tasks).set(updateRow).where(eq21(tasks.id, taskId)).run();
|
|
117367
117481
|
if (updates.depends !== void 0) {
|
|
117368
|
-
db.delete(taskDependencies).where(
|
|
117482
|
+
db.delete(taskDependencies).where(eq21(taskDependencies.taskId, taskId)).run();
|
|
117369
117483
|
for (const depId of updates.depends) {
|
|
117370
117484
|
db.insert(taskDependencies).values({ taskId, dependsOn: depId }).run();
|
|
117371
117485
|
}
|
|
@@ -117374,9 +117488,9 @@ async function updateTask2(taskId, updates, cwd) {
|
|
|
117374
117488
|
}
|
|
117375
117489
|
async function deleteTask2(taskId, cwd) {
|
|
117376
117490
|
const db = await getDb(cwd);
|
|
117377
|
-
const existing = await db.select({ id: tasks.id }).from(tasks).where(
|
|
117491
|
+
const existing = await db.select({ id: tasks.id }).from(tasks).where(eq21(tasks.id, taskId)).all();
|
|
117378
117492
|
if (existing.length === 0) return false;
|
|
117379
|
-
db.delete(tasks).where(
|
|
117493
|
+
db.delete(tasks).where(eq21(tasks.id, taskId)).run();
|
|
117380
117494
|
void cleanupBrainRefsOnTaskDelete(taskId, cwd);
|
|
117381
117495
|
return true;
|
|
117382
117496
|
}
|
|
@@ -117384,17 +117498,17 @@ async function listTasks2(filters, cwd) {
|
|
|
117384
117498
|
const db = await getDb(cwd);
|
|
117385
117499
|
const conditions = [];
|
|
117386
117500
|
conditions.push(ne5(tasks.status, "archived"));
|
|
117387
|
-
if (filters?.status) conditions.push(
|
|
117501
|
+
if (filters?.status) conditions.push(eq21(tasks.status, filters.status));
|
|
117388
117502
|
if (filters?.parentId !== void 0) {
|
|
117389
117503
|
if (filters.parentId === null) {
|
|
117390
|
-
conditions.push(
|
|
117504
|
+
conditions.push(isNull6(tasks.parentId));
|
|
117391
117505
|
} else {
|
|
117392
|
-
conditions.push(
|
|
117506
|
+
conditions.push(eq21(tasks.parentId, filters.parentId));
|
|
117393
117507
|
}
|
|
117394
117508
|
}
|
|
117395
|
-
if (filters?.type) conditions.push(
|
|
117396
|
-
if (filters?.phase) conditions.push(
|
|
117397
|
-
const query = db.select().from(tasks).where(conditions.length > 0 ?
|
|
117509
|
+
if (filters?.type) conditions.push(eq21(tasks.type, filters.type));
|
|
117510
|
+
if (filters?.phase) conditions.push(eq21(tasks.phase, filters.phase));
|
|
117511
|
+
const query = db.select().from(tasks).where(conditions.length > 0 ? and16(...conditions) : void 0).orderBy(asc4(tasks.position), asc4(tasks.createdAt));
|
|
117398
117512
|
const rows = filters?.limit ? await query.limit(filters.limit).all() : await query.all();
|
|
117399
117513
|
const tasks2 = rows.map(rowToTask);
|
|
117400
117514
|
await loadDependencies(tasks2, cwd);
|
|
@@ -117404,7 +117518,7 @@ async function findTasks2(query, limit = 20, cwd) {
|
|
|
117404
117518
|
const db = await getDb(cwd);
|
|
117405
117519
|
const pattern = `%${query}%`;
|
|
117406
117520
|
const rows = await db.select().from(tasks).where(
|
|
117407
|
-
|
|
117521
|
+
and16(
|
|
117408
117522
|
ne5(tasks.status, "archived"),
|
|
117409
117523
|
sql16`(${tasks.id} LIKE ${pattern} OR ${tasks.title} LIKE ${pattern} OR ${tasks.description} LIKE ${pattern})`
|
|
117410
117524
|
)
|
|
@@ -117423,14 +117537,14 @@ async function archiveTask(taskId, reason, cwd) {
|
|
|
117423
117537
|
archiveReason: reason ?? "completed",
|
|
117424
117538
|
cycleTimeDays: cycleTime,
|
|
117425
117539
|
updatedAt: now2
|
|
117426
|
-
}).where(
|
|
117540
|
+
}).where(eq21(tasks.id, taskId)).run();
|
|
117427
117541
|
return true;
|
|
117428
117542
|
}
|
|
117429
117543
|
async function loadDependencies(tasks2, cwd) {
|
|
117430
117544
|
if (tasks2.length === 0) return;
|
|
117431
117545
|
const db = await getDb(cwd);
|
|
117432
117546
|
const taskIds = tasks2.map((t) => t.id);
|
|
117433
|
-
const deps = await db.select().from(taskDependencies).where(
|
|
117547
|
+
const deps = await db.select().from(taskDependencies).where(inArray9(taskDependencies.taskId, taskIds)).all();
|
|
117434
117548
|
const depMap = /* @__PURE__ */ new Map();
|
|
117435
117549
|
for (const dep of deps) {
|
|
117436
117550
|
if (!depMap.has(dep.taskId)) depMap.set(dep.taskId, []);
|
|
@@ -117450,9 +117564,9 @@ async function addDependency(taskId, dependsOn, cwd) {
|
|
|
117450
117564
|
async function removeDependency(taskId, dependsOn, cwd) {
|
|
117451
117565
|
const db = await getDb(cwd);
|
|
117452
117566
|
db.delete(taskDependencies).where(
|
|
117453
|
-
|
|
117454
|
-
|
|
117455
|
-
|
|
117567
|
+
and16(
|
|
117568
|
+
eq21(taskDependencies.taskId, taskId),
|
|
117569
|
+
eq21(taskDependencies.dependsOn, dependsOn)
|
|
117456
117570
|
)
|
|
117457
117571
|
).run();
|
|
117458
117572
|
}
|
|
@@ -117462,7 +117576,7 @@ async function addRelation(taskId, relatedTo, relationType = "related", cwd, rea
|
|
|
117462
117576
|
}
|
|
117463
117577
|
async function getRelations(taskId, cwd) {
|
|
117464
117578
|
const db = await getDb(cwd);
|
|
117465
|
-
const rows = await db.select().from(taskRelations).where(
|
|
117579
|
+
const rows = await db.select().from(taskRelations).where(eq21(taskRelations.taskId, taskId)).all();
|
|
117466
117580
|
return rows.map((r) => ({
|
|
117467
117581
|
relatedTo: r.relatedTo,
|
|
117468
117582
|
type: r.relationType,
|
|
@@ -117486,7 +117600,7 @@ async function getBlockerChain(taskId, cwd) {
|
|
|
117486
117600
|
}
|
|
117487
117601
|
async function getChildren2(parentId, cwd) {
|
|
117488
117602
|
const db = await getDb(cwd);
|
|
117489
|
-
const rows = await db.select().from(tasks).where(
|
|
117603
|
+
const rows = await db.select().from(tasks).where(eq21(tasks.parentId, parentId)).orderBy(asc4(tasks.position), asc4(tasks.createdAt)).all();
|
|
117490
117604
|
return rows.map(rowToTask);
|
|
117491
117605
|
}
|
|
117492
117606
|
async function getSubtree(rootId, cwd) {
|
|
@@ -117611,6 +117725,7 @@ function canCancel(task) {
|
|
|
117611
117725
|
var init_cancel_ops = __esm({
|
|
117612
117726
|
"packages/core/src/tasks/cancel-ops.ts"() {
|
|
117613
117727
|
"use strict";
|
|
117728
|
+
init_pipeline_stage();
|
|
117614
117729
|
}
|
|
117615
117730
|
});
|
|
117616
117731
|
|
|
@@ -117982,6 +118097,9 @@ async function coreTaskRestore(projectRoot, taskId, params2) {
|
|
|
117982
118097
|
t.cancelledAt = void 0;
|
|
117983
118098
|
t.cancellationReason = void 0;
|
|
117984
118099
|
t.updatedAt = now2;
|
|
118100
|
+
if (t.pipelineStage === "cancelled") {
|
|
118101
|
+
t.pipelineStage = t.type === "epic" ? "research" : "implementation";
|
|
118102
|
+
}
|
|
117985
118103
|
if (!t.notes) t.notes = [];
|
|
117986
118104
|
t.notes.push(`[${now2}] Restored from cancelled${params2?.notes ? ": " + params2.notes : ""}`);
|
|
117987
118105
|
restored.push(t.id);
|
|
@@ -118006,6 +118124,9 @@ async function coreTaskCancel(projectRoot, taskId, params2) {
|
|
|
118006
118124
|
task.cancelledAt = cancelledAt;
|
|
118007
118125
|
task.cancellationReason = params2?.reason ?? void 0;
|
|
118008
118126
|
task.updatedAt = cancelledAt;
|
|
118127
|
+
if (!isTerminalPipelineStage(task.pipelineStage)) {
|
|
118128
|
+
task.pipelineStage = "cancelled";
|
|
118129
|
+
}
|
|
118009
118130
|
await accessor.upsertSingleTask(task);
|
|
118010
118131
|
return { task: taskId, cancelled: true, reason: params2?.reason, cancelledAt };
|
|
118011
118132
|
}
|
|
@@ -118708,6 +118829,7 @@ var init_task_ops = __esm({
|
|
|
118708
118829
|
init_cancel_ops();
|
|
118709
118830
|
init_dependency_check();
|
|
118710
118831
|
init_deps_ready();
|
|
118832
|
+
init_pipeline_stage();
|
|
118711
118833
|
PRIORITY_SCORE2 = {
|
|
118712
118834
|
critical: 100,
|
|
118713
118835
|
high: 75,
|
|
@@ -119095,10 +119217,10 @@ async function migrateJsonToSqlite2(cwd, options) {
|
|
|
119095
119217
|
const jsonCounts = countJsonRecords(cleoDir);
|
|
119096
119218
|
result.jsonCounts = jsonCounts;
|
|
119097
119219
|
if (dbExists(cwd)) {
|
|
119098
|
-
const { ne: ne6, eq:
|
|
119220
|
+
const { ne: ne6, eq: eq22, count: count5 } = await import("drizzle-orm");
|
|
119099
119221
|
const db2 = await getDb(cwd);
|
|
119100
119222
|
const tasksResult = await db2.select({ count: count5() }).from(tasks).where(ne6(tasks.status, "archived")).get();
|
|
119101
|
-
const archivedResult = await db2.select({ count: count5() }).from(tasks).where(
|
|
119223
|
+
const archivedResult = await db2.select({ count: count5() }).from(tasks).where(eq22(tasks.status, "archived")).get();
|
|
119102
119224
|
const sessionsResult = await db2.select({ count: count5() }).from(sessions).get();
|
|
119103
119225
|
const existingCounts = {
|
|
119104
119226
|
tasks: tasksResult?.count ?? 0,
|
|
@@ -119282,10 +119404,10 @@ async function migrateJsonToSqlite2(cwd, options) {
|
|
|
119282
119404
|
async function exportToJson(cwd) {
|
|
119283
119405
|
const { listTasks: listTasks3 } = await Promise.resolve().then(() => (init_task_store(), task_store_exports));
|
|
119284
119406
|
const { listSessions: listSessions3 } = await Promise.resolve().then(() => (init_session_store(), session_store_exports));
|
|
119285
|
-
const { eq:
|
|
119407
|
+
const { eq: eq22 } = await import("drizzle-orm");
|
|
119286
119408
|
const tasks2 = await listTasks3(void 0, cwd);
|
|
119287
119409
|
const db = await getDb(cwd);
|
|
119288
|
-
const archivedRows = await db.select().from(tasks).where(
|
|
119410
|
+
const archivedRows = await db.select().from(tasks).where(eq22(tasks.status, "archived")).all();
|
|
119289
119411
|
const archived = archivedRows.map((row) => ({
|
|
119290
119412
|
id: row.id,
|
|
119291
119413
|
title: row.title,
|
|
@@ -119321,9 +119443,9 @@ __export(repair_exports, {
|
|
|
119321
119443
|
async function repairMissingSizes(cwd, dryRun) {
|
|
119322
119444
|
const { getDb: getDb4 } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
|
|
119323
119445
|
const { tasks: tasks2 } = await Promise.resolve().then(() => (init_tasks_schema(), tasks_schema_exports));
|
|
119324
|
-
const { isNull:
|
|
119446
|
+
const { isNull: isNull7 } = await import("drizzle-orm");
|
|
119325
119447
|
const db = await getDb4(cwd);
|
|
119326
|
-
const affected = await db.select({ id: tasks2.id }).from(tasks2).where(
|
|
119448
|
+
const affected = await db.select({ id: tasks2.id }).from(tasks2).where(isNull7(tasks2.size));
|
|
119327
119449
|
if (affected.length === 0) {
|
|
119328
119450
|
return {
|
|
119329
119451
|
action: "fix_missing_sizes",
|
|
@@ -119338,7 +119460,7 @@ async function repairMissingSizes(cwd, dryRun) {
|
|
|
119338
119460
|
details: `Would set size='medium' for ${affected.length} task(s)`
|
|
119339
119461
|
};
|
|
119340
119462
|
}
|
|
119341
|
-
await db.update(tasks2).set({ size: "medium" }).where(
|
|
119463
|
+
await db.update(tasks2).set({ size: "medium" }).where(isNull7(tasks2.size));
|
|
119342
119464
|
return {
|
|
119343
119465
|
action: "fix_missing_sizes",
|
|
119344
119466
|
status: "applied",
|
|
@@ -122196,7 +122318,7 @@ async function validateSqliteRows(type, projectRoot) {
|
|
|
122196
122318
|
const { getDb: getDb4 } = await Promise.resolve().then(() => (init_sqlite2(), sqlite_exports));
|
|
122197
122319
|
const schemaTable = await Promise.resolve().then(() => (init_tasks_schema(), tasks_schema_exports));
|
|
122198
122320
|
const zodSchemas = await Promise.resolve().then(() => (init_validation_schemas(), validation_schemas_exports));
|
|
122199
|
-
const { ne: ne6, eq:
|
|
122321
|
+
const { ne: ne6, eq: eq22 } = await import("drizzle-orm");
|
|
122200
122322
|
const db = await getDb4(projectRoot);
|
|
122201
122323
|
const errors = [];
|
|
122202
122324
|
switch (type) {
|
|
@@ -122208,7 +122330,7 @@ async function validateSqliteRows(type, projectRoot) {
|
|
|
122208
122330
|
break;
|
|
122209
122331
|
}
|
|
122210
122332
|
case "archive": {
|
|
122211
|
-
const rows = await db.select().from(schemaTable.tasks).where(
|
|
122333
|
+
const rows = await db.select().from(schemaTable.tasks).where(eq22(schemaTable.tasks.status, "archived"));
|
|
122212
122334
|
for (const row of rows) {
|
|
122213
122335
|
errors.push(...collectZodErrors(zodSchemas.selectTaskSchema.safeParse(row), row.id));
|
|
122214
122336
|
}
|
|
@@ -123861,15 +123983,15 @@ var require_codegen = __commonJS({
|
|
|
123861
123983
|
}
|
|
123862
123984
|
exports.not = not2;
|
|
123863
123985
|
var andCode = mappend(exports.operators.AND);
|
|
123864
|
-
function
|
|
123986
|
+
function and17(...args2) {
|
|
123865
123987
|
return args2.reduce(andCode);
|
|
123866
123988
|
}
|
|
123867
|
-
exports.and =
|
|
123989
|
+
exports.and = and17;
|
|
123868
123990
|
var orCode = mappend(exports.operators.OR);
|
|
123869
|
-
function
|
|
123991
|
+
function or8(...args2) {
|
|
123870
123992
|
return args2.reduce(orCode);
|
|
123871
123993
|
}
|
|
123872
|
-
exports.or =
|
|
123994
|
+
exports.or = or8;
|
|
123873
123995
|
function mappend(op) {
|
|
123874
123996
|
return (x, y2) => x === code_1.nil ? y2 : y2 === code_1.nil ? x : (0, code_1._)`${par(x)} ${op} ${par(y2)}`;
|
|
123875
123997
|
}
|
|
@@ -132166,6 +132288,7 @@ __export(internal_exports, {
|
|
|
132166
132288
|
TASK_STATUSES: () => TASK_STATUSES,
|
|
132167
132289
|
TASK_STATUS_SYMBOLS_ASCII: () => TASK_STATUS_SYMBOLS_ASCII,
|
|
132168
132290
|
TASK_STATUS_SYMBOLS_UNICODE: () => TASK_STATUS_SYMBOLS_UNICODE,
|
|
132291
|
+
TERMINAL_PIPELINE_STAGE_BACKFILL_KEY: () => TERMINAL_BACKFILL_KEY,
|
|
132169
132292
|
TERMINAL_PIPELINE_STATUSES: () => TERMINAL_PIPELINE_STATUSES,
|
|
132170
132293
|
TERMINAL_STAGE_STATUSES: () => TERMINAL_STAGE_STATUSES,
|
|
132171
132294
|
TERMINAL_TASK_STATUSES: () => TERMINAL_TASK_STATUSES,
|
|
@@ -132230,6 +132353,7 @@ __export(internal_exports, {
|
|
|
132230
132353
|
backfillBrainGraph: () => backfillBrainGraph,
|
|
132231
132354
|
backfillPipelineStageFromLifecycle: () => backfillPipelineStageFromLifecycle,
|
|
132232
132355
|
backfillTasks: () => backfillTasks,
|
|
132356
|
+
backfillTerminalPipelineStage: () => backfillTerminalPipelineStage,
|
|
132233
132357
|
backupGlobalSalt: () => backupGlobalSalt,
|
|
132234
132358
|
batchParse: () => batchParse,
|
|
132235
132359
|
blobAttachmentSchema: () => blobAttachmentSchema,
|
|
@@ -132662,6 +132786,7 @@ __export(internal_exports, {
|
|
|
132662
132786
|
isRecoverableCode: () => isRecoverableCode,
|
|
132663
132787
|
isSuccessCode: () => isSuccessCode,
|
|
132664
132788
|
isTelemetryEnabled: () => isTelemetryEnabled,
|
|
132789
|
+
isTerminalPipelineStageBackfillDone: () => isTerminalPipelineStageBackfillDone,
|
|
132665
132790
|
isTreeSitterAvailable: () => isTreeSitterAvailable,
|
|
132666
132791
|
isValidStage: () => isValidStage,
|
|
132667
132792
|
isValidStatus: () => isValidStatus,
|
|
@@ -133063,6 +133188,7 @@ var init_internal = __esm({
|
|
|
133063
133188
|
init_diagnostics();
|
|
133064
133189
|
init_retry2();
|
|
133065
133190
|
init_backfill_pipeline_stage();
|
|
133191
|
+
init_backfill_terminal_pipeline_stage();
|
|
133066
133192
|
init_chain_store();
|
|
133067
133193
|
init_lifecycle2();
|
|
133068
133194
|
init_ivtr_loop();
|
|
@@ -141470,10 +141596,10 @@ async function releaseShip(params2, projectRoot) {
|
|
|
141470
141596
|
);
|
|
141471
141597
|
const { getDb: getDb4 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
|
|
141472
141598
|
const { releaseManifests: releaseManifests2 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
|
|
141473
|
-
const { eq:
|
|
141599
|
+
const { eq: eq22 } = await import("drizzle-orm");
|
|
141474
141600
|
const normalizedVer = version2.startsWith("v") ? version2 : `v${version2}`;
|
|
141475
141601
|
const db = await getDb4(cwd);
|
|
141476
|
-
await db.update(releaseManifests2).set({ epicId }).where(
|
|
141602
|
+
await db.update(releaseManifests2).set({ epicId }).where(eq22(releaseManifests2.version, normalizedVer)).run();
|
|
141477
141603
|
await generateReleaseChangelog(version2, () => loadTasks2(projectRoot), cwd);
|
|
141478
141604
|
}
|
|
141479
141605
|
logStep(0, 8, "Auto-prepare release record", true);
|
|
@@ -145742,12 +145868,12 @@ function scanForbiddenPhrases(filePath, lines) {
|
|
|
145742
145868
|
}
|
|
145743
145869
|
function countCanonicalDomains(typesFilePath) {
|
|
145744
145870
|
const lines = readLines(typesFilePath);
|
|
145745
|
-
let
|
|
145871
|
+
let inArray10 = false;
|
|
145746
145872
|
let count5 = 0;
|
|
145747
145873
|
for (const line2 of lines) {
|
|
145748
|
-
if (!
|
|
145874
|
+
if (!inArray10) {
|
|
145749
145875
|
if (line2.includes("CANONICAL_DOMAINS") && line2.includes("[")) {
|
|
145750
|
-
|
|
145876
|
+
inArray10 = true;
|
|
145751
145877
|
}
|
|
145752
145878
|
continue;
|
|
145753
145879
|
}
|
|
@@ -155485,7 +155611,9 @@ var adminCommand = defineCommand({
|
|
|
155485
155611
|
"install-global": installGlobalCommand,
|
|
155486
155612
|
"context-inject": contextInjectCommand
|
|
155487
155613
|
},
|
|
155488
|
-
async run({ cmd }) {
|
|
155614
|
+
async run({ cmd, rawArgs }) {
|
|
155615
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
155616
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
155489
155617
|
await showUsage(cmd);
|
|
155490
155618
|
}
|
|
155491
155619
|
});
|
|
@@ -155623,7 +155751,9 @@ var adrCommand = defineCommand({
|
|
|
155623
155751
|
sync: syncCommand,
|
|
155624
155752
|
find: findCommand
|
|
155625
155753
|
},
|
|
155626
|
-
async run({ cmd }) {
|
|
155754
|
+
async run({ cmd, rawArgs }) {
|
|
155755
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
155756
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
155627
155757
|
await showUsage(cmd);
|
|
155628
155758
|
}
|
|
155629
155759
|
});
|
|
@@ -157811,7 +157941,9 @@ var agentCommand = defineCommand({
|
|
|
157811
157941
|
pack: packCommand,
|
|
157812
157942
|
create: createCommand
|
|
157813
157943
|
},
|
|
157814
|
-
async run({ cmd }) {
|
|
157944
|
+
async run({ cmd, rawArgs }) {
|
|
157945
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
157946
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
157815
157947
|
await showUsage(cmd);
|
|
157816
157948
|
}
|
|
157817
157949
|
});
|
|
@@ -159535,7 +159667,9 @@ var brainCommand = defineCommand({
|
|
|
159535
159667
|
quality: qualityCommand,
|
|
159536
159668
|
export: exportCommand2
|
|
159537
159669
|
},
|
|
159538
|
-
async run({ cmd }) {
|
|
159670
|
+
async run({ cmd, rawArgs }) {
|
|
159671
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
159672
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
159539
159673
|
await showUsage(cmd);
|
|
159540
159674
|
}
|
|
159541
159675
|
});
|
|
@@ -159896,7 +160030,9 @@ var cantCommand = defineCommand({
|
|
|
159896
160030
|
execute: cantExecuteCommand,
|
|
159897
160031
|
migrate: cantMigrateCommand
|
|
159898
160032
|
},
|
|
159899
|
-
async run({ cmd }) {
|
|
160033
|
+
async run({ cmd, rawArgs }) {
|
|
160034
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
160035
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
159900
160036
|
await showUsage(cmd);
|
|
159901
160037
|
}
|
|
159902
160038
|
});
|
|
@@ -160006,7 +160142,9 @@ var chainCommand = defineCommand({
|
|
|
160006
160142
|
instantiate: instantiateCommand,
|
|
160007
160143
|
advance: advanceCommand
|
|
160008
160144
|
},
|
|
160009
|
-
async run({ cmd }) {
|
|
160145
|
+
async run({ cmd, rawArgs }) {
|
|
160146
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
160147
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
160010
160148
|
await showUsage(cmd);
|
|
160011
160149
|
}
|
|
160012
160150
|
});
|
|
@@ -160276,7 +160414,9 @@ var checkCommand = defineCommand({
|
|
|
160276
160414
|
canon: checkCanonCommand,
|
|
160277
160415
|
protocol: checkProtocolCommand
|
|
160278
160416
|
},
|
|
160279
|
-
async run({ cmd }) {
|
|
160417
|
+
async run({ cmd, rawArgs }) {
|
|
160418
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
160419
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
160280
160420
|
await showUsage(cmd);
|
|
160281
160421
|
}
|
|
160282
160422
|
});
|
|
@@ -160622,7 +160762,9 @@ var complexityEstimateCommand = defineCommand({
|
|
|
160622
160762
|
var complexityCommand = defineCommand({
|
|
160623
160763
|
meta: { name: "complexity", description: "Task complexity analysis" },
|
|
160624
160764
|
subCommands: { estimate: complexityEstimateCommand },
|
|
160625
|
-
async run({ cmd }) {
|
|
160765
|
+
async run({ cmd, rawArgs }) {
|
|
160766
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
160767
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
160626
160768
|
await showUsage(cmd);
|
|
160627
160769
|
}
|
|
160628
160770
|
});
|
|
@@ -160865,7 +161007,9 @@ var complianceCommand = defineCommand({
|
|
|
160865
161007
|
value: valueCommand,
|
|
160866
161008
|
record: recordCommand
|
|
160867
161009
|
},
|
|
160868
|
-
async run({ cmd }) {
|
|
161010
|
+
async run({ cmd, rawArgs }) {
|
|
161011
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
161012
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
160869
161013
|
await showUsage(cmd);
|
|
160870
161014
|
}
|
|
160871
161015
|
});
|
|
@@ -161010,7 +161154,9 @@ var conduitCommand = defineCommand({
|
|
|
161010
161154
|
stop: stopCommand2,
|
|
161011
161155
|
send: sendCommand2
|
|
161012
161156
|
},
|
|
161013
|
-
async run({ cmd }) {
|
|
161157
|
+
async run({ cmd, rawArgs }) {
|
|
161158
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
161159
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
161014
161160
|
await showUsage(cmd);
|
|
161015
161161
|
}
|
|
161016
161162
|
});
|
|
@@ -161128,7 +161274,9 @@ var configCommand = defineCommand({
|
|
|
161128
161274
|
presets: presetsCommand,
|
|
161129
161275
|
list: listCommand6
|
|
161130
161276
|
},
|
|
161131
|
-
async run({ cmd }) {
|
|
161277
|
+
async run({ cmd, rawArgs }) {
|
|
161278
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
161279
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
161132
161280
|
await showUsage(cmd);
|
|
161133
161281
|
}
|
|
161134
161282
|
});
|
|
@@ -161216,7 +161364,9 @@ var consensusCommand = defineCommand({
|
|
|
161216
161364
|
validate: validateCommand2,
|
|
161217
161365
|
check: checkCommand2
|
|
161218
161366
|
},
|
|
161219
|
-
async run({ cmd }) {
|
|
161367
|
+
async run({ cmd, rawArgs }) {
|
|
161368
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
161369
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
161220
161370
|
await showUsage(cmd);
|
|
161221
161371
|
}
|
|
161222
161372
|
});
|
|
@@ -161413,7 +161563,9 @@ var contributionCommand = defineCommand({
|
|
|
161413
161563
|
validate: validateCommand3,
|
|
161414
161564
|
check: checkCommand4
|
|
161415
161565
|
},
|
|
161416
|
-
async run({ cmd }) {
|
|
161566
|
+
async run({ cmd, rawArgs }) {
|
|
161567
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
161568
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
161417
161569
|
await showUsage(cmd);
|
|
161418
161570
|
}
|
|
161419
161571
|
});
|
|
@@ -162161,7 +162313,9 @@ var decompositionCommand = defineCommand({
|
|
|
162161
162313
|
validate: validateCommand4,
|
|
162162
162314
|
check: checkCommand5
|
|
162163
162315
|
},
|
|
162164
|
-
async run({ cmd }) {
|
|
162316
|
+
async run({ cmd, rawArgs }) {
|
|
162317
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
162318
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
162165
162319
|
await showUsage(cmd);
|
|
162166
162320
|
}
|
|
162167
162321
|
});
|
|
@@ -162341,7 +162495,9 @@ var depsCommand = defineCommand({
|
|
|
162341
162495
|
impact: impactCommand,
|
|
162342
162496
|
cycles: cyclesCommand
|
|
162343
162497
|
},
|
|
162344
|
-
async run({ cmd }) {
|
|
162498
|
+
async run({ cmd, rawArgs }) {
|
|
162499
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
162500
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
162345
162501
|
await showUsage(cmd);
|
|
162346
162502
|
}
|
|
162347
162503
|
});
|
|
@@ -162850,7 +163006,9 @@ var diagnosticsCommand = defineCommand({
|
|
|
162850
163006
|
analyze: analyzeCommand2,
|
|
162851
163007
|
export: exportCommand3
|
|
162852
163008
|
},
|
|
162853
|
-
async run({ cmd }) {
|
|
163009
|
+
async run({ cmd, rawArgs }) {
|
|
163010
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
163011
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
162854
163012
|
await showUsage(cmd);
|
|
162855
163013
|
}
|
|
162856
163014
|
});
|
|
@@ -163200,7 +163358,9 @@ var docsCommand = defineCommand({
|
|
|
163200
163358
|
sync: syncCommand3,
|
|
163201
163359
|
"gap-check": gapCheckCommand
|
|
163202
163360
|
},
|
|
163203
|
-
async run({ cmd }) {
|
|
163361
|
+
async run({ cmd, rawArgs }) {
|
|
163362
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
163363
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
163204
163364
|
await showUsage(cmd);
|
|
163205
163365
|
}
|
|
163206
163366
|
});
|
|
@@ -163848,7 +164008,9 @@ var gcCommand = defineCommand({
|
|
|
163848
164008
|
run: runCommand3,
|
|
163849
164009
|
status: statusCommand6
|
|
163850
164010
|
},
|
|
163851
|
-
async run({ cmd }) {
|
|
164011
|
+
async run({ cmd, rawArgs }) {
|
|
164012
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
164013
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
163852
164014
|
await showUsage(cmd);
|
|
163853
164015
|
}
|
|
163854
164016
|
});
|
|
@@ -164156,7 +164318,9 @@ var historyCommand = defineCommand({
|
|
|
164156
164318
|
log: logCommand,
|
|
164157
164319
|
work: workCommand2
|
|
164158
164320
|
},
|
|
164159
|
-
async run({ cmd }) {
|
|
164321
|
+
async run({ cmd, rawArgs }) {
|
|
164322
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
164323
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
164160
164324
|
await showUsage(cmd);
|
|
164161
164325
|
}
|
|
164162
164326
|
});
|
|
@@ -164558,7 +164722,9 @@ var intelligenceCommand = defineCommand({
|
|
|
164558
164722
|
confidence: confidenceCommand,
|
|
164559
164723
|
match: matchCommand
|
|
164560
164724
|
},
|
|
164561
|
-
async run({ cmd }) {
|
|
164725
|
+
async run({ cmd, rawArgs }) {
|
|
164726
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
164727
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
164562
164728
|
await showUsage(cmd);
|
|
164563
164729
|
}
|
|
164564
164730
|
});
|
|
@@ -164679,7 +164845,9 @@ var issueCommand = defineCommand({
|
|
|
164679
164845
|
help: helpCommand,
|
|
164680
164846
|
diagnostics: diagnosticsCommand2
|
|
164681
164847
|
},
|
|
164682
|
-
async run({ cmd }) {
|
|
164848
|
+
async run({ cmd, rawArgs }) {
|
|
164849
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
164850
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
164683
164851
|
await showUsage(cmd);
|
|
164684
164852
|
}
|
|
164685
164853
|
});
|
|
@@ -164956,7 +165124,9 @@ var lifecycleCommand = defineCommand({
|
|
|
164956
165124
|
reset: resetCommand,
|
|
164957
165125
|
"gate-record": gateRecordCommand
|
|
164958
165126
|
},
|
|
164959
|
-
async run({ cmd }) {
|
|
165127
|
+
async run({ cmd, rawArgs }) {
|
|
165128
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
165129
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
164960
165130
|
await showUsage(cmd);
|
|
164961
165131
|
}
|
|
164962
165132
|
});
|
|
@@ -167053,7 +167223,9 @@ var memoryBrainCommand = defineCommand({
|
|
|
167053
167223
|
"pending-verify": pendingVerifyCommand,
|
|
167054
167224
|
tier: tierCommand
|
|
167055
167225
|
},
|
|
167056
|
-
async run({ cmd }) {
|
|
167226
|
+
async run({ cmd, rawArgs }) {
|
|
167227
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
167228
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
167057
167229
|
await showUsage(cmd);
|
|
167058
167230
|
}
|
|
167059
167231
|
});
|
|
@@ -167151,7 +167323,9 @@ var migrateClaudeMemCommand = defineCommand({
|
|
|
167151
167323
|
"claude-mem": claudeMemCommand,
|
|
167152
167324
|
storage: storageCommand
|
|
167153
167325
|
},
|
|
167154
|
-
async run({ cmd }) {
|
|
167326
|
+
async run({ cmd, rawArgs }) {
|
|
167327
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
167328
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
167155
167329
|
await showUsage(cmd);
|
|
167156
167330
|
}
|
|
167157
167331
|
});
|
|
@@ -168673,7 +168847,7 @@ var analyzeCommand3 = defineCommand({
|
|
|
168673
168847
|
);
|
|
168674
168848
|
}
|
|
168675
168849
|
try {
|
|
168676
|
-
const [{ getNexusDb: getNexusDb2, nexusSchema }, { runPipeline: runPipeline2 }, { getProjectRoot: getProjectRoot4 }, { eq:
|
|
168850
|
+
const [{ getNexusDb: getNexusDb2, nexusSchema }, { runPipeline: runPipeline2 }, { getProjectRoot: getProjectRoot4 }, { eq: eq22 }] = await Promise.all([
|
|
168677
168851
|
import("@cleocode/core/store/nexus-sqlite"),
|
|
168678
168852
|
import("@cleocode/nexus/pipeline"),
|
|
168679
168853
|
Promise.resolve().then(() => (init_internal(), internal_exports)),
|
|
@@ -168690,11 +168864,11 @@ var analyzeCommand3 = defineCommand({
|
|
|
168690
168864
|
process.stderr.write("[nexus] Clearing existing index for project...\n");
|
|
168691
168865
|
}
|
|
168692
168866
|
try {
|
|
168693
|
-
db.delete(nexusSchema.nexusNodes).where(
|
|
168867
|
+
db.delete(nexusSchema.nexusNodes).where(eq22(nexusSchema.nexusNodes.projectId, projectId)).run();
|
|
168694
168868
|
} catch {
|
|
168695
168869
|
}
|
|
168696
168870
|
try {
|
|
168697
|
-
db.delete(nexusSchema.nexusRelations).where(
|
|
168871
|
+
db.delete(nexusSchema.nexusRelations).where(eq22(nexusSchema.nexusRelations.projectId, projectId)).run();
|
|
168698
168872
|
} catch {
|
|
168699
168873
|
}
|
|
168700
168874
|
}
|
|
@@ -169351,7 +169525,7 @@ var projectsCleanCommand = defineCommand({
|
|
|
169351
169525
|
const { getNexusDb: getNexusDb2 } = await import("@cleocode/core/store/nexus-sqlite");
|
|
169352
169526
|
const { projectRegistry: regTable, nexusAuditLog: auditTable } = await import("@cleocode/core/store/nexus-schema");
|
|
169353
169527
|
const { randomUUID: randomUUID16 } = await import("node:crypto");
|
|
169354
|
-
const { inArray:
|
|
169528
|
+
const { inArray: inArray10 } = await import("drizzle-orm");
|
|
169355
169529
|
const db = await getNexusDb2();
|
|
169356
169530
|
const allRows = await db.select({
|
|
169357
169531
|
projectId: regTable.projectId,
|
|
@@ -169461,7 +169635,7 @@ var projectsCleanCommand = defineCommand({
|
|
|
169461
169635
|
}
|
|
169462
169636
|
}
|
|
169463
169637
|
const idsToDelete = matches.map((r) => r.projectId);
|
|
169464
|
-
await db.delete(regTable).where(
|
|
169638
|
+
await db.delete(regTable).where(inArray10(regTable.projectId, idsToDelete));
|
|
169465
169639
|
const remaining = totalCount - matchCount;
|
|
169466
169640
|
try {
|
|
169467
169641
|
await db.insert(auditTable).values({
|
|
@@ -169956,7 +170130,9 @@ var nexusCommand = defineCommand({
|
|
|
169956
170130
|
export: exportCommand5,
|
|
169957
170131
|
diff: diffCommand
|
|
169958
170132
|
},
|
|
169959
|
-
async run({ cmd }) {
|
|
170133
|
+
async run({ cmd, rawArgs }) {
|
|
170134
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
170135
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
169960
170136
|
await showUsage(cmd);
|
|
169961
170137
|
}
|
|
169962
170138
|
});
|
|
@@ -170596,7 +170772,9 @@ var orchestrateCommand = defineCommand({
|
|
|
170596
170772
|
"conduit-stop": conduitStopCommand,
|
|
170597
170773
|
"conduit-send": conduitSendCommand
|
|
170598
170774
|
},
|
|
170599
|
-
async run({ cmd }) {
|
|
170775
|
+
async run({ cmd, rawArgs }) {
|
|
170776
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
170777
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
170600
170778
|
await showUsage(cmd);
|
|
170601
170779
|
}
|
|
170602
170780
|
});
|
|
@@ -170746,7 +170924,9 @@ var otelCommand = defineCommand({
|
|
|
170746
170924
|
real: realCommand,
|
|
170747
170925
|
clear: clearCommand
|
|
170748
170926
|
},
|
|
170749
|
-
async run({ cmd }) {
|
|
170927
|
+
async run({ cmd, rawArgs }) {
|
|
170928
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
170929
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
170750
170930
|
await showUsage(cmd);
|
|
170751
170931
|
}
|
|
170752
170932
|
});
|
|
@@ -170933,7 +171113,9 @@ var phaseCommand = defineCommand({
|
|
|
170933
171113
|
rename: renameCommand,
|
|
170934
171114
|
delete: deleteCommand2
|
|
170935
171115
|
},
|
|
170936
|
-
async run({ cmd }) {
|
|
171116
|
+
async run({ cmd, rawArgs }) {
|
|
171117
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
171118
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
170937
171119
|
await showUsage(cmd);
|
|
170938
171120
|
}
|
|
170939
171121
|
});
|
|
@@ -171250,7 +171432,9 @@ var reasonCommand = defineCommand({
|
|
|
171250
171432
|
impact: impactCommand3,
|
|
171251
171433
|
timeline: timelineCommand2
|
|
171252
171434
|
},
|
|
171253
|
-
async run({ cmd }) {
|
|
171435
|
+
async run({ cmd, rawArgs }) {
|
|
171436
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
171437
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
171254
171438
|
await showUsage(cmd);
|
|
171255
171439
|
}
|
|
171256
171440
|
});
|
|
@@ -171388,7 +171572,9 @@ var relatesCommand = defineCommand({
|
|
|
171388
171572
|
discover: discoverCommand2,
|
|
171389
171573
|
list: listCommand13
|
|
171390
171574
|
},
|
|
171391
|
-
async run({ cmd }) {
|
|
171575
|
+
async run({ cmd, rawArgs }) {
|
|
171576
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
171577
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
171392
171578
|
await showUsage(cmd);
|
|
171393
171579
|
}
|
|
171394
171580
|
});
|
|
@@ -171605,7 +171791,9 @@ var releaseCommand = defineCommand({
|
|
|
171605
171791
|
"rollback-full": rollbackFullCommand,
|
|
171606
171792
|
channel: channelCommand
|
|
171607
171793
|
},
|
|
171608
|
-
async run({ cmd }) {
|
|
171794
|
+
async run({ cmd, rawArgs }) {
|
|
171795
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
171796
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
171609
171797
|
await showUsage(cmd);
|
|
171610
171798
|
}
|
|
171611
171799
|
});
|
|
@@ -171755,7 +171943,9 @@ var remoteCommand = defineCommand({
|
|
|
171755
171943
|
list: listRemoteCommand,
|
|
171756
171944
|
status: statusRemoteCommand
|
|
171757
171945
|
},
|
|
171758
|
-
async run({ cmd }) {
|
|
171946
|
+
async run({ cmd, rawArgs }) {
|
|
171947
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
171948
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
171759
171949
|
await showUsage(cmd);
|
|
171760
171950
|
}
|
|
171761
171951
|
});
|
|
@@ -172009,7 +172199,9 @@ var reqCommand = defineCommand({
|
|
|
172009
172199
|
list: listCommand15,
|
|
172010
172200
|
migrate: migrateCommand
|
|
172011
172201
|
},
|
|
172012
|
-
async run({ cmd }) {
|
|
172202
|
+
async run({ cmd, rawArgs }) {
|
|
172203
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
172204
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
172013
172205
|
await showUsage(cmd);
|
|
172014
172206
|
}
|
|
172015
172207
|
});
|
|
@@ -172336,7 +172528,9 @@ var researchCommand = defineCommand({
|
|
|
172336
172528
|
archive: archiveCommand2,
|
|
172337
172529
|
manifest: manifestCommand
|
|
172338
172530
|
},
|
|
172339
|
-
async run({ cmd }) {
|
|
172531
|
+
async run({ cmd, rawArgs }) {
|
|
172532
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
172533
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
172340
172534
|
await showUsage(cmd);
|
|
172341
172535
|
}
|
|
172342
172536
|
});
|
|
@@ -172811,7 +173005,9 @@ var restoreCommand = defineCommand({
|
|
|
172811
173005
|
backup: backupSubCommand,
|
|
172812
173006
|
task: taskSubCommand
|
|
172813
173007
|
},
|
|
172814
|
-
async run({ cmd }) {
|
|
173008
|
+
async run({ cmd, rawArgs }) {
|
|
173009
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
173010
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
172815
173011
|
await showUsage(cmd);
|
|
172816
173012
|
}
|
|
172817
173013
|
});
|
|
@@ -173492,7 +173688,9 @@ var sequenceCommand = defineCommand({
|
|
|
173492
173688
|
check: checkCommand6,
|
|
173493
173689
|
repair: repairCommand
|
|
173494
173690
|
},
|
|
173495
|
-
async run({ cmd }) {
|
|
173691
|
+
async run({ cmd, rawArgs }) {
|
|
173692
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
173693
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
173496
173694
|
await showUsage(cmd);
|
|
173497
173695
|
}
|
|
173498
173696
|
});
|
|
@@ -173964,7 +174162,9 @@ var sessionCommand = defineCommand({
|
|
|
173964
174162
|
"record-decision": recordDecisionCommand,
|
|
173965
174163
|
"decision-log": decisionLogCommand
|
|
173966
174164
|
},
|
|
173967
|
-
async run({ cmd }) {
|
|
174165
|
+
async run({ cmd, rawArgs }) {
|
|
174166
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
174167
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
173968
174168
|
await showUsage(cmd);
|
|
173969
174169
|
}
|
|
173970
174170
|
});
|
|
@@ -174416,7 +174616,9 @@ var snapshotCommand = defineCommand({
|
|
|
174416
174616
|
export: exportCommand6,
|
|
174417
174617
|
import: importCommand4
|
|
174418
174618
|
},
|
|
174419
|
-
async run({ cmd }) {
|
|
174619
|
+
async run({ cmd, rawArgs }) {
|
|
174620
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
174621
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
174420
174622
|
await showUsage(cmd);
|
|
174421
174623
|
}
|
|
174422
174624
|
});
|
|
@@ -174793,7 +174995,9 @@ var stickyCommand = defineCommand({
|
|
|
174793
174995
|
archive: archiveCommand3,
|
|
174794
174996
|
purge: purgeCommand2
|
|
174795
174997
|
},
|
|
174796
|
-
async run({ cmd }) {
|
|
174998
|
+
async run({ cmd, rawArgs }) {
|
|
174999
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
175000
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
174797
175001
|
await showUsage(cmd);
|
|
174798
175002
|
}
|
|
174799
175003
|
});
|
|
@@ -174918,7 +175122,9 @@ var syncCommand5 = defineCommand({
|
|
|
174918
175122
|
links: linksCommand2,
|
|
174919
175123
|
reconcile: reconcileCommand2
|
|
174920
175124
|
},
|
|
174921
|
-
async run({ cmd }) {
|
|
175125
|
+
async run({ cmd, rawArgs }) {
|
|
175126
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
175127
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
174922
175128
|
await showUsage(cmd);
|
|
174923
175129
|
}
|
|
174924
175130
|
});
|
|
@@ -175031,7 +175237,9 @@ var testingCommand = defineCommand({
|
|
|
175031
175237
|
coverage: coverageCommand,
|
|
175032
175238
|
run: runCommand4
|
|
175033
175239
|
},
|
|
175034
|
-
async run({ cmd }) {
|
|
175240
|
+
async run({ cmd, rawArgs }) {
|
|
175241
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
175242
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
175035
175243
|
await showUsage(cmd);
|
|
175036
175244
|
}
|
|
175037
175245
|
});
|
|
@@ -175217,7 +175425,9 @@ var tokenCommand = defineCommand({
|
|
|
175217
175425
|
clear: clearCommand2,
|
|
175218
175426
|
estimate: estimateCommand
|
|
175219
175427
|
},
|
|
175220
|
-
async run({ cmd }) {
|
|
175428
|
+
async run({ cmd, rawArgs }) {
|
|
175429
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
175430
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
175221
175431
|
await showUsage(cmd);
|
|
175222
175432
|
}
|
|
175223
175433
|
});
|
|
@@ -175906,7 +176116,9 @@ var transcriptCommand = defineCommand({
|
|
|
175906
176116
|
migrate: migrateCommand2,
|
|
175907
176117
|
prune: pruneCommand
|
|
175908
176118
|
},
|
|
175909
|
-
async run({ cmd }) {
|
|
176119
|
+
async run({ cmd, rawArgs }) {
|
|
176120
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
176121
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
175910
176122
|
await showUsage(cmd);
|
|
175911
176123
|
}
|
|
175912
176124
|
});
|
|
@@ -176544,7 +176756,9 @@ var webCommand = defineCommand({
|
|
|
176544
176756
|
status: statusCommand12,
|
|
176545
176757
|
open: openCommand
|
|
176546
176758
|
},
|
|
176547
|
-
async run({ cmd }) {
|
|
176759
|
+
async run({ cmd, rawArgs }) {
|
|
176760
|
+
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
176761
|
+
if (firstArg && cmd.subCommands && firstArg in cmd.subCommands) return;
|
|
176548
176762
|
await showUsage(cmd);
|
|
176549
176763
|
}
|
|
176550
176764
|
});
|