flightdesk 0.1.12 → 0.1.13
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/main.js +56 -3
- package/main.js.map +2 -2
- package/package.json +1 -1
package/main.js
CHANGED
|
@@ -3935,17 +3935,30 @@ async function watchCommand(options) {
|
|
|
3935
3935
|
try {
|
|
3936
3936
|
const tasks = await api.listTasks();
|
|
3937
3937
|
const activeTasks = tasks.filter(
|
|
3938
|
-
(t) => ["DISPATCHED", "IN_PROGRESS", "BRANCH_CREATED"].includes(t.status)
|
|
3938
|
+
(t) => ["DISPATCHED", "IN_PROGRESS", "BRANCH_CREATED"].includes(t.status) || t.status === "PENDING" && t.sessionViewUrl
|
|
3939
3939
|
);
|
|
3940
3940
|
if (activeTasks.length === 0) {
|
|
3941
3941
|
console.log(" No active tasks to monitor");
|
|
3942
3942
|
return;
|
|
3943
3943
|
}
|
|
3944
|
+
const needsReconciliation = activeTasks.filter((t) => {
|
|
3945
|
+
if (t.prUrl && !["PR_OPEN", "MERGED", "ARCHIVED"].includes(t.status)) return true;
|
|
3946
|
+
if (t.branchName && t.status === "PENDING") return true;
|
|
3947
|
+
if (t.sessionViewUrl && t.status === "PENDING") return true;
|
|
3948
|
+
return false;
|
|
3949
|
+
});
|
|
3950
|
+
if (needsReconciliation.length > 0) {
|
|
3951
|
+
console.log(` \u26A0\uFE0F ${needsReconciliation.length} task(s) need status reconciliation`);
|
|
3952
|
+
}
|
|
3944
3953
|
console.log(` Found ${activeTasks.length} active task(s)`);
|
|
3945
3954
|
for (const task2 of activeTasks) {
|
|
3946
3955
|
console.log(`
|
|
3947
3956
|
\u{1F4CB} ${task2.title}`);
|
|
3948
3957
|
console.log(` Status: ${task2.status}`);
|
|
3958
|
+
const reconciled = await reconcileTaskStatus(api, task2);
|
|
3959
|
+
if (reconciled) {
|
|
3960
|
+
continue;
|
|
3961
|
+
}
|
|
3949
3962
|
if (task2.sessionViewUrl && playwrightAvailable) {
|
|
3950
3963
|
console.log(` Checking session...`);
|
|
3951
3964
|
const sessionInfo = await monitorSession(task2.sessionViewUrl, {
|
|
@@ -3979,6 +3992,39 @@ Watching... (Ctrl+C to stop)
|
|
|
3979
3992
|
await new Promise((_resolve) => {
|
|
3980
3993
|
});
|
|
3981
3994
|
}
|
|
3995
|
+
async function reconcileTaskStatus(api, task2) {
|
|
3996
|
+
let expectedStatus = null;
|
|
3997
|
+
let reason = "";
|
|
3998
|
+
if (task2.prUrl) {
|
|
3999
|
+
if (!["PR_OPEN", "MERGED", "ARCHIVED", "REVIEW_RUNNING", "REVIEW_DONE", "QA_READY", "QA_APPROVED"].includes(task2.status)) {
|
|
4000
|
+
expectedStatus = "PR_OPEN";
|
|
4001
|
+
reason = `has PR URL but status is ${task2.status}`;
|
|
4002
|
+
}
|
|
4003
|
+
} else if (task2.branchName) {
|
|
4004
|
+
if (["PENDING", "DISPATCHED"].includes(task2.status)) {
|
|
4005
|
+
expectedStatus = "IN_PROGRESS";
|
|
4006
|
+
reason = `has branch but status is ${task2.status}`;
|
|
4007
|
+
}
|
|
4008
|
+
} else if (task2.sessionViewUrl) {
|
|
4009
|
+
if (task2.status === "PENDING") {
|
|
4010
|
+
expectedStatus = "DISPATCHED";
|
|
4011
|
+
reason = `has session URL but status is PENDING`;
|
|
4012
|
+
}
|
|
4013
|
+
}
|
|
4014
|
+
if (expectedStatus) {
|
|
4015
|
+
console.log(` \u{1F527} Status reconciliation: ${reason}`);
|
|
4016
|
+
console.log(` Updating: ${task2.status} \u2192 ${expectedStatus}`);
|
|
4017
|
+
try {
|
|
4018
|
+
await api.updateTask(task2.id, { status: expectedStatus });
|
|
4019
|
+
console.log(" \u2705 Status reconciled");
|
|
4020
|
+
return true;
|
|
4021
|
+
} catch (error) {
|
|
4022
|
+
console.log(` \u274C Failed to reconcile: ${error}`);
|
|
4023
|
+
return false;
|
|
4024
|
+
}
|
|
4025
|
+
}
|
|
4026
|
+
return false;
|
|
4027
|
+
}
|
|
3982
4028
|
async function processSessionInfo(api, task2, info) {
|
|
3983
4029
|
if (info.status === "error") {
|
|
3984
4030
|
console.log(` \u274C Error: ${info.error}`);
|
|
@@ -4676,9 +4722,16 @@ Summary:`);
|
|
|
4676
4722
|
title: session.title,
|
|
4677
4723
|
description: `Imported from Claude Code session`
|
|
4678
4724
|
});
|
|
4725
|
+
let status = "DISPATCHED";
|
|
4726
|
+
if (session.archived) {
|
|
4727
|
+
status = "ARCHIVED";
|
|
4728
|
+
} else if (session.branchName) {
|
|
4729
|
+
status = "IN_PROGRESS";
|
|
4730
|
+
}
|
|
4679
4731
|
await api.updateTask(task2.id, {
|
|
4680
4732
|
branchName: session.branchName,
|
|
4681
|
-
sessionViewUrl: session.url
|
|
4733
|
+
sessionViewUrl: session.url,
|
|
4734
|
+
status
|
|
4682
4735
|
});
|
|
4683
4736
|
console.log(` \u2705 ${session.title.slice(0, 50)}`);
|
|
4684
4737
|
created++;
|
|
@@ -4827,7 +4880,7 @@ ${projects.length} project(s)`);
|
|
|
4827
4880
|
|
|
4828
4881
|
// apps/cli/src/main.ts
|
|
4829
4882
|
var program2 = new Command();
|
|
4830
|
-
program2.name("flightdesk").description("FlightDesk CLI - AI task management for Claude Code sessions").version("0.1.
|
|
4883
|
+
program2.name("flightdesk").description("FlightDesk CLI - AI task management for Claude Code sessions").version("0.1.13").option("--dev", "Use local development API (localhost:3000)").option("--api <url>", "Use custom API URL");
|
|
4831
4884
|
program2.hook("preAction", () => {
|
|
4832
4885
|
const opts = program2.opts();
|
|
4833
4886
|
if (opts.api) {
|