flightdesk 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/main.js +37 -28
- package/main.js.map +2 -2
- package/package.json +1 -1
package/main.js
CHANGED
|
@@ -3059,9 +3059,6 @@ function loadConfig() {
|
|
|
3059
3059
|
if (fs.existsSync(CONFIG_FILE)) {
|
|
3060
3060
|
const content = fs.readFileSync(CONFIG_FILE, "utf-8");
|
|
3061
3061
|
const parsed = JSON.parse(content);
|
|
3062
|
-
if (parsed.organizations?.[0]?.apiKey) {
|
|
3063
|
-
return migrateOldConfig(parsed);
|
|
3064
|
-
}
|
|
3065
3062
|
return {
|
|
3066
3063
|
organizations: [],
|
|
3067
3064
|
repoMapping: {},
|
|
@@ -3076,22 +3073,6 @@ function loadConfig() {
|
|
|
3076
3073
|
repoMapping: {}
|
|
3077
3074
|
};
|
|
3078
3075
|
}
|
|
3079
|
-
function migrateOldConfig(oldConfig) {
|
|
3080
|
-
console.log("\u{1F4E6} Migrating config to new format...");
|
|
3081
|
-
const defaultOrg = oldConfig.defaultOrganization ? oldConfig.organizations.find((o) => o.id === oldConfig.defaultOrganization) : oldConfig.organizations[0];
|
|
3082
|
-
const newConfig = {
|
|
3083
|
-
apiKey: defaultOrg?.apiKey,
|
|
3084
|
-
activeOrganization: defaultOrg?.id,
|
|
3085
|
-
organizations: oldConfig.organizations.map((o) => ({
|
|
3086
|
-
id: o.id,
|
|
3087
|
-
name: o.name
|
|
3088
|
-
})),
|
|
3089
|
-
repoMapping: oldConfig.repoMapping || {}
|
|
3090
|
-
};
|
|
3091
|
-
saveConfig(newConfig);
|
|
3092
|
-
console.log("\u2705 Config migrated successfully");
|
|
3093
|
-
return newConfig;
|
|
3094
|
-
}
|
|
3095
3076
|
function saveConfig(config) {
|
|
3096
3077
|
fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
|
|
3097
3078
|
}
|
|
@@ -3162,6 +3143,9 @@ var readline = __toESM(require("readline"));
|
|
|
3162
3143
|
// apps/cli/src/lib/api.ts
|
|
3163
3144
|
var FlightDeskAPI = class _FlightDeskAPI {
|
|
3164
3145
|
constructor(config, org2) {
|
|
3146
|
+
if (!config.apiKey) {
|
|
3147
|
+
throw new Error("API key is required. Run: flightdesk login");
|
|
3148
|
+
}
|
|
3165
3149
|
this.apiUrl = getApiUrl();
|
|
3166
3150
|
this.apiKey = config.apiKey;
|
|
3167
3151
|
this.organizationId = org2.id;
|
|
@@ -3173,6 +3157,12 @@ var FlightDeskAPI = class _FlightDeskAPI {
|
|
|
3173
3157
|
return new _FlightDeskAPI(config, org2);
|
|
3174
3158
|
}
|
|
3175
3159
|
async graphql(query, variables) {
|
|
3160
|
+
const verbose = process.env.FLIGHTDESK_DEBUG === "1";
|
|
3161
|
+
if (verbose) {
|
|
3162
|
+
console.log("\n--- GraphQL Request ---");
|
|
3163
|
+
console.log("URL:", `${this.apiUrl}/graphql`);
|
|
3164
|
+
console.log("Variables:", JSON.stringify(variables, null, 2));
|
|
3165
|
+
}
|
|
3176
3166
|
const response = await fetch(`${this.apiUrl}/graphql`, {
|
|
3177
3167
|
method: "POST",
|
|
3178
3168
|
headers: {
|
|
@@ -3182,9 +3172,19 @@ var FlightDeskAPI = class _FlightDeskAPI {
|
|
|
3182
3172
|
body: JSON.stringify({ query, variables })
|
|
3183
3173
|
});
|
|
3184
3174
|
if (!response.ok) {
|
|
3185
|
-
|
|
3175
|
+
const body = await response.text();
|
|
3176
|
+
if (verbose) {
|
|
3177
|
+
console.log("--- Error Response ---");
|
|
3178
|
+
console.log("Status:", response.status, response.statusText);
|
|
3179
|
+
console.log("Body:", body);
|
|
3180
|
+
}
|
|
3181
|
+
throw new Error(`API request failed: ${response.status} ${response.statusText}${verbose ? "" : " (set FLIGHTDESK_DEBUG=1 for details)"}`);
|
|
3186
3182
|
}
|
|
3187
3183
|
const result = await response.json();
|
|
3184
|
+
if (verbose) {
|
|
3185
|
+
console.log("--- Response ---");
|
|
3186
|
+
console.log(JSON.stringify(result, null, 2));
|
|
3187
|
+
}
|
|
3188
3188
|
if (result.errors && result.errors.length > 0) {
|
|
3189
3189
|
throw new Error(`GraphQL error: ${result.errors.map((e) => e.message).join(", ")}`);
|
|
3190
3190
|
}
|
|
@@ -3587,12 +3587,21 @@ var PersistentBrowser = class {
|
|
|
3587
3587
|
this.page = null;
|
|
3588
3588
|
this.headless = headless;
|
|
3589
3589
|
}
|
|
3590
|
+
/**
|
|
3591
|
+
* Get page, throwing if not initialized
|
|
3592
|
+
*/
|
|
3593
|
+
get activePage() {
|
|
3594
|
+
if (!this.page) {
|
|
3595
|
+
throw new Error("Browser not initialized. Call init() first.");
|
|
3596
|
+
}
|
|
3597
|
+
return this.page;
|
|
3598
|
+
}
|
|
3590
3599
|
/**
|
|
3591
3600
|
* Initialize the browser context (if not already initialized)
|
|
3592
3601
|
*/
|
|
3593
3602
|
async init() {
|
|
3594
3603
|
if (this.context) return;
|
|
3595
|
-
if (!await isPlaywrightAvailable()) {
|
|
3604
|
+
if (!await isPlaywrightAvailable() || !playwright) {
|
|
3596
3605
|
throw new Error("Playwright not available");
|
|
3597
3606
|
}
|
|
3598
3607
|
ensureUserDataDir();
|
|
@@ -3617,9 +3626,9 @@ var PersistentBrowser = class {
|
|
|
3617
3626
|
async checkAuth() {
|
|
3618
3627
|
await this.init();
|
|
3619
3628
|
try {
|
|
3620
|
-
await this.
|
|
3621
|
-
await this.
|
|
3622
|
-
const url = this.
|
|
3629
|
+
await this.activePage.goto("https://claude.ai/", { waitUntil: "domcontentloaded", timeout: 3e4 });
|
|
3630
|
+
await this.activePage.waitForTimeout(2e3);
|
|
3631
|
+
const url = this.activePage.url();
|
|
3623
3632
|
console.log(" Final URL:", url);
|
|
3624
3633
|
return !url.includes("/login") && !url.includes("/oauth") && !url.includes("accounts.google") && url.includes("claude.ai");
|
|
3625
3634
|
} catch (error) {
|
|
@@ -3713,7 +3722,7 @@ async function checkAuth() {
|
|
|
3713
3722
|
try {
|
|
3714
3723
|
const page = await context.newPage();
|
|
3715
3724
|
page.setDefaultTimeout(3e4);
|
|
3716
|
-
await page.goto("https://claude.ai/", { waitUntil: "
|
|
3725
|
+
await page.goto("https://claude.ai/", { waitUntil: "domcontentloaded", timeout: 3e4 });
|
|
3717
3726
|
await page.waitForTimeout(2e3);
|
|
3718
3727
|
const url = page.url();
|
|
3719
3728
|
console.log(" Final URL:", url);
|
|
@@ -3776,7 +3785,7 @@ async function scrapeSession(page, sessionUrl, options = {}) {
|
|
|
3776
3785
|
const { timeout = 3e4, autoPr = false } = options;
|
|
3777
3786
|
try {
|
|
3778
3787
|
page.setDefaultTimeout(timeout);
|
|
3779
|
-
await page.goto(sessionUrl, { waitUntil: "
|
|
3788
|
+
await page.goto(sessionUrl, { waitUntil: "domcontentloaded", timeout });
|
|
3780
3789
|
await page.waitForSelector('[data-testid="conversation-turn"], .code-spinner-animate, button:has-text("Create PR")', {
|
|
3781
3790
|
timeout: 1e4
|
|
3782
3791
|
}).catch(() => {
|
|
@@ -5214,7 +5223,7 @@ async function scanClaudeSessions(options) {
|
|
|
5214
5223
|
}
|
|
5215
5224
|
|
|
5216
5225
|
// apps/cli/src/commands/project.ts
|
|
5217
|
-
async function projectCommand(action,
|
|
5226
|
+
async function projectCommand(action, _options) {
|
|
5218
5227
|
const { config, org: org2 } = requireActiveOrg();
|
|
5219
5228
|
const api = FlightDeskAPI.fromConfig(config, org2);
|
|
5220
5229
|
switch (action) {
|
|
@@ -5514,7 +5523,7 @@ async function handleTeardown(api, options) {
|
|
|
5514
5523
|
|
|
5515
5524
|
// apps/cli/src/main.ts
|
|
5516
5525
|
var program2 = new Command();
|
|
5517
|
-
program2.name("flightdesk").description("FlightDesk CLI - AI task management for Claude Code sessions").version("0.2.
|
|
5526
|
+
program2.name("flightdesk").description("FlightDesk CLI - AI task management for Claude Code sessions").version("0.2.4").option("--dev", "Use local development API (localhost:3000)").option("--api <url>", "Use custom API URL");
|
|
5518
5527
|
program2.hook("preAction", () => {
|
|
5519
5528
|
const opts = program2.opts();
|
|
5520
5529
|
if (opts.api) {
|