flightdesk 0.1.12 → 0.1.14
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 +58 -8
- package/main.js.map +2 -2
- package/package.json +1 -1
package/main.js
CHANGED
|
@@ -3052,8 +3052,7 @@ function setApiUrl(url) {
|
|
|
3052
3052
|
apiUrlOverride = url;
|
|
3053
3053
|
}
|
|
3054
3054
|
function getApiUrl() {
|
|
3055
|
-
|
|
3056
|
-
return apiUrlOverride ?? config.apiUrl ?? DEFAULT_API_URL;
|
|
3055
|
+
return apiUrlOverride ?? DEFAULT_API_URL;
|
|
3057
3056
|
}
|
|
3058
3057
|
function loadConfig() {
|
|
3059
3058
|
try {
|
|
@@ -3064,7 +3063,6 @@ function loadConfig() {
|
|
|
3064
3063
|
return migrateOldConfig(parsed);
|
|
3065
3064
|
}
|
|
3066
3065
|
return {
|
|
3067
|
-
apiUrl: DEFAULT_API_URL,
|
|
3068
3066
|
organizations: [],
|
|
3069
3067
|
repoMapping: {},
|
|
3070
3068
|
...parsed
|
|
@@ -3074,7 +3072,6 @@ function loadConfig() {
|
|
|
3074
3072
|
console.error("Warning: Failed to load config file:", error);
|
|
3075
3073
|
}
|
|
3076
3074
|
return {
|
|
3077
|
-
apiUrl: DEFAULT_API_URL,
|
|
3078
3075
|
organizations: [],
|
|
3079
3076
|
repoMapping: {}
|
|
3080
3077
|
};
|
|
@@ -3084,7 +3081,6 @@ function migrateOldConfig(oldConfig) {
|
|
|
3084
3081
|
const defaultOrg = oldConfig.defaultOrganization ? oldConfig.organizations.find((o) => o.id === oldConfig.defaultOrganization) : oldConfig.organizations[0];
|
|
3085
3082
|
const newConfig = {
|
|
3086
3083
|
apiKey: defaultOrg?.apiKey,
|
|
3087
|
-
apiUrl: defaultOrg?.apiUrl || DEFAULT_API_URL,
|
|
3088
3084
|
activeOrganization: defaultOrg?.id,
|
|
3089
3085
|
organizations: oldConfig.organizations.map((o) => ({
|
|
3090
3086
|
id: o.id,
|
|
@@ -3276,6 +3272,7 @@ var FlightDeskAPI = class _FlightDeskAPI {
|
|
|
3276
3272
|
status
|
|
3277
3273
|
branchName
|
|
3278
3274
|
prUrl
|
|
3275
|
+
sessionViewUrl
|
|
3279
3276
|
createdAt
|
|
3280
3277
|
project {
|
|
3281
3278
|
id
|
|
@@ -3935,17 +3932,30 @@ async function watchCommand(options) {
|
|
|
3935
3932
|
try {
|
|
3936
3933
|
const tasks = await api.listTasks();
|
|
3937
3934
|
const activeTasks = tasks.filter(
|
|
3938
|
-
(t) => ["DISPATCHED", "IN_PROGRESS", "BRANCH_CREATED"].includes(t.status)
|
|
3935
|
+
(t) => ["DISPATCHED", "IN_PROGRESS", "BRANCH_CREATED"].includes(t.status) || t.status === "PENDING" && t.sessionViewUrl
|
|
3939
3936
|
);
|
|
3940
3937
|
if (activeTasks.length === 0) {
|
|
3941
3938
|
console.log(" No active tasks to monitor");
|
|
3942
3939
|
return;
|
|
3943
3940
|
}
|
|
3941
|
+
const needsReconciliation = activeTasks.filter((t) => {
|
|
3942
|
+
if (t.prUrl && !["PR_OPEN", "MERGED", "ARCHIVED"].includes(t.status)) return true;
|
|
3943
|
+
if (t.branchName && t.status === "PENDING") return true;
|
|
3944
|
+
if (t.sessionViewUrl && t.status === "PENDING") return true;
|
|
3945
|
+
return false;
|
|
3946
|
+
});
|
|
3947
|
+
if (needsReconciliation.length > 0) {
|
|
3948
|
+
console.log(` \u26A0\uFE0F ${needsReconciliation.length} task(s) need status reconciliation`);
|
|
3949
|
+
}
|
|
3944
3950
|
console.log(` Found ${activeTasks.length} active task(s)`);
|
|
3945
3951
|
for (const task2 of activeTasks) {
|
|
3946
3952
|
console.log(`
|
|
3947
3953
|
\u{1F4CB} ${task2.title}`);
|
|
3948
3954
|
console.log(` Status: ${task2.status}`);
|
|
3955
|
+
const reconciled = await reconcileTaskStatus(api, task2);
|
|
3956
|
+
if (reconciled) {
|
|
3957
|
+
continue;
|
|
3958
|
+
}
|
|
3949
3959
|
if (task2.sessionViewUrl && playwrightAvailable) {
|
|
3950
3960
|
console.log(` Checking session...`);
|
|
3951
3961
|
const sessionInfo = await monitorSession(task2.sessionViewUrl, {
|
|
@@ -3979,6 +3989,39 @@ Watching... (Ctrl+C to stop)
|
|
|
3979
3989
|
await new Promise((_resolve) => {
|
|
3980
3990
|
});
|
|
3981
3991
|
}
|
|
3992
|
+
async function reconcileTaskStatus(api, task2) {
|
|
3993
|
+
let expectedStatus = null;
|
|
3994
|
+
let reason = "";
|
|
3995
|
+
if (task2.prUrl) {
|
|
3996
|
+
if (!["PR_OPEN", "PREVIEW_STARTING", "PREVIEW_READY", "MERGED", "ARCHIVED", "REVIEW_RUNNING", "REVIEW_DONE", "QA_READY", "QA_APPROVED"].includes(task2.status)) {
|
|
3997
|
+
expectedStatus = "PR_OPEN";
|
|
3998
|
+
reason = `has PR URL but status is ${task2.status}`;
|
|
3999
|
+
}
|
|
4000
|
+
} else if (task2.branchName) {
|
|
4001
|
+
if (["PENDING", "DISPATCHED"].includes(task2.status)) {
|
|
4002
|
+
expectedStatus = "IN_PROGRESS";
|
|
4003
|
+
reason = `has branch but status is ${task2.status}`;
|
|
4004
|
+
}
|
|
4005
|
+
} else if (task2.sessionViewUrl) {
|
|
4006
|
+
if (task2.status === "PENDING") {
|
|
4007
|
+
expectedStatus = "DISPATCHED";
|
|
4008
|
+
reason = `has session URL but status is PENDING`;
|
|
4009
|
+
}
|
|
4010
|
+
}
|
|
4011
|
+
if (expectedStatus) {
|
|
4012
|
+
console.log(` \u{1F527} Status reconciliation: ${reason}`);
|
|
4013
|
+
console.log(` Updating: ${task2.status} \u2192 ${expectedStatus}`);
|
|
4014
|
+
try {
|
|
4015
|
+
await api.updateTask(task2.id, { status: expectedStatus });
|
|
4016
|
+
console.log(" \u2705 Status reconciled");
|
|
4017
|
+
return true;
|
|
4018
|
+
} catch (error) {
|
|
4019
|
+
console.log(` \u274C Failed to reconcile: ${error}`);
|
|
4020
|
+
return false;
|
|
4021
|
+
}
|
|
4022
|
+
}
|
|
4023
|
+
return false;
|
|
4024
|
+
}
|
|
3982
4025
|
async function processSessionInfo(api, task2, info) {
|
|
3983
4026
|
if (info.status === "error") {
|
|
3984
4027
|
console.log(` \u274C Error: ${info.error}`);
|
|
@@ -4676,9 +4719,16 @@ Summary:`);
|
|
|
4676
4719
|
title: session.title,
|
|
4677
4720
|
description: `Imported from Claude Code session`
|
|
4678
4721
|
});
|
|
4722
|
+
let status = "DISPATCHED";
|
|
4723
|
+
if (session.archived) {
|
|
4724
|
+
status = "ARCHIVED";
|
|
4725
|
+
} else if (session.branchName) {
|
|
4726
|
+
status = "IN_PROGRESS";
|
|
4727
|
+
}
|
|
4679
4728
|
await api.updateTask(task2.id, {
|
|
4680
4729
|
branchName: session.branchName,
|
|
4681
|
-
sessionViewUrl: session.url
|
|
4730
|
+
sessionViewUrl: session.url,
|
|
4731
|
+
status
|
|
4682
4732
|
});
|
|
4683
4733
|
console.log(` \u2705 ${session.title.slice(0, 50)}`);
|
|
4684
4734
|
created++;
|
|
@@ -4827,7 +4877,7 @@ ${projects.length} project(s)`);
|
|
|
4827
4877
|
|
|
4828
4878
|
// apps/cli/src/main.ts
|
|
4829
4879
|
var program2 = new Command();
|
|
4830
|
-
program2.name("flightdesk").description("FlightDesk CLI - AI task management for Claude Code sessions").version("0.1.
|
|
4880
|
+
program2.name("flightdesk").description("FlightDesk CLI - AI task management for Claude Code sessions").version("0.1.14").option("--dev", "Use local development API (localhost:3000)").option("--api <url>", "Use custom API URL");
|
|
4831
4881
|
program2.hook("preAction", () => {
|
|
4832
4882
|
const opts = program2.opts();
|
|
4833
4883
|
if (opts.api) {
|