flightdesk 0.1.10 → 0.1.11
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 +13 -12
- package/main.js.map +2 -2
- package/package.json +1 -1
package/main.js
CHANGED
|
@@ -3121,7 +3121,7 @@ function setActiveOrganization(orgId) {
|
|
|
3121
3121
|
function updateOrganizations(orgs) {
|
|
3122
3122
|
const config = loadConfig();
|
|
3123
3123
|
config.organizations = orgs;
|
|
3124
|
-
if (config.activeOrganization && !orgs.
|
|
3124
|
+
if (config.activeOrganization && !orgs.some((o) => o.id === config.activeOrganization)) {
|
|
3125
3125
|
config.activeOrganization = orgs[0]?.id;
|
|
3126
3126
|
}
|
|
3127
3127
|
saveConfig(config);
|
|
@@ -3372,9 +3372,8 @@ var FlightDeskAPI = class _FlightDeskAPI {
|
|
|
3372
3372
|
return result.userTaskPrompts;
|
|
3373
3373
|
}
|
|
3374
3374
|
};
|
|
3375
|
-
async function fetchUserInfo(apiKey, apiUrl) {
|
|
3376
|
-
const
|
|
3377
|
-
const response = await fetch(`${url}/graphql`, {
|
|
3375
|
+
async function fetchUserInfo(apiKey, apiUrl = "https://api.flightdesk.dev") {
|
|
3376
|
+
const response = await fetch(`${apiUrl}/graphql`, {
|
|
3378
3377
|
method: "POST",
|
|
3379
3378
|
headers: {
|
|
3380
3379
|
"Content-Type": "application/json",
|
|
@@ -3451,16 +3450,17 @@ async function initCommand() {
|
|
|
3451
3450
|
console.log("\nConnecting to FlightDesk...");
|
|
3452
3451
|
try {
|
|
3453
3452
|
const userInfo = await fetchUserInfo(apiKey, apiUrl);
|
|
3454
|
-
|
|
3453
|
+
const orgs = userInfo.organizations || [];
|
|
3454
|
+
if (orgs.length === 0) {
|
|
3455
3455
|
console.error("\u274C No organizations found for this user");
|
|
3456
3456
|
console.log("Please make sure you are a member of at least one organization.");
|
|
3457
3457
|
return;
|
|
3458
3458
|
}
|
|
3459
|
-
const primaryEmail = userInfo.emails
|
|
3459
|
+
const primaryEmail = userInfo.emails?.find((e) => e.primary)?.email || userInfo.emails?.[0]?.email || "unknown";
|
|
3460
3460
|
console.log("\u2705 Connection successful!");
|
|
3461
3461
|
console.log(` Logged in as: ${primaryEmail}`);
|
|
3462
|
-
console.log(` Organizations: ${
|
|
3463
|
-
const organizations =
|
|
3462
|
+
console.log(` Organizations: ${orgs.length}`);
|
|
3463
|
+
const organizations = orgs.map((m) => ({
|
|
3464
3464
|
id: m.organization.id,
|
|
3465
3465
|
name: m.organization.name
|
|
3466
3466
|
}));
|
|
@@ -3476,7 +3476,7 @@ async function initCommand() {
|
|
|
3476
3476
|
});
|
|
3477
3477
|
const choice = await question(rl, `
|
|
3478
3478
|
Select active organization (1-${organizations.length}): `);
|
|
3479
|
-
const choiceIndex = parseInt(choice, 10) - 1;
|
|
3479
|
+
const choiceIndex = Number.parseInt(choice, 10) - 1;
|
|
3480
3480
|
if (choiceIndex < 0 || choiceIndex >= organizations.length) {
|
|
3481
3481
|
console.error("Invalid selection, using first organization");
|
|
3482
3482
|
activeOrganization = organizations[0].id;
|
|
@@ -4253,11 +4253,12 @@ async function orgRefreshCommand() {
|
|
|
4253
4253
|
try {
|
|
4254
4254
|
const apiUrl = getApiUrl();
|
|
4255
4255
|
const userInfo = await fetchUserInfo(config.apiKey, apiUrl);
|
|
4256
|
-
|
|
4256
|
+
const orgs = userInfo.organizations || [];
|
|
4257
|
+
if (orgs.length === 0) {
|
|
4257
4258
|
console.log("No organizations found for this user.");
|
|
4258
4259
|
return;
|
|
4259
4260
|
}
|
|
4260
|
-
const organizations =
|
|
4261
|
+
const organizations = orgs.map((m) => ({
|
|
4261
4262
|
id: m.organization.id,
|
|
4262
4263
|
name: m.organization.name
|
|
4263
4264
|
}));
|
|
@@ -4795,7 +4796,7 @@ async function scanClaudeSessions(options) {
|
|
|
4795
4796
|
|
|
4796
4797
|
// apps/cli/src/main.ts
|
|
4797
4798
|
var program2 = new Command();
|
|
4798
|
-
program2.name("flightdesk").description("FlightDesk CLI - AI task management for Claude Code sessions").version("0.1.
|
|
4799
|
+
program2.name("flightdesk").description("FlightDesk CLI - AI task management for Claude Code sessions").version("0.1.11").option("--dev", "Use local development API (localhost:3000)").option("--api <url>", "Use custom API URL");
|
|
4799
4800
|
program2.hook("preAction", () => {
|
|
4800
4801
|
const opts = program2.opts();
|
|
4801
4802
|
if (opts.api) {
|