flightdesk 0.1.10 → 0.1.12
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 +51 -17
- package/main.js.map +4 -4
- 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
|
}));
|
|
@@ -4379,9 +4380,9 @@ async function syncCommand() {
|
|
|
4379
4380
|
const api = FlightDeskAPI.fromConfig(config, org2);
|
|
4380
4381
|
const projects = await api.listProjects();
|
|
4381
4382
|
console.log(` Found ${projects.length} project(s)`);
|
|
4382
|
-
for (const
|
|
4383
|
-
if (
|
|
4384
|
-
newMappings[
|
|
4383
|
+
for (const project2 of projects) {
|
|
4384
|
+
if (project2.githubRepo) {
|
|
4385
|
+
newMappings[project2.githubRepo] = org2.id;
|
|
4385
4386
|
totalProjects++;
|
|
4386
4387
|
}
|
|
4387
4388
|
}
|
|
@@ -4668,10 +4669,10 @@ Summary:`);
|
|
|
4668
4669
|
`);
|
|
4669
4670
|
let created = 0;
|
|
4670
4671
|
let failed = 0;
|
|
4671
|
-
for (const { session, project } of importableSessions) {
|
|
4672
|
+
for (const { session, project: project2 } of importableSessions) {
|
|
4672
4673
|
try {
|
|
4673
4674
|
const task2 = await api.createTask({
|
|
4674
|
-
projectId:
|
|
4675
|
+
projectId: project2.id,
|
|
4675
4676
|
title: session.title,
|
|
4676
4677
|
description: `Imported from Claude Code session`
|
|
4677
4678
|
});
|
|
@@ -4793,9 +4794,40 @@ async function scanClaudeSessions(options) {
|
|
|
4793
4794
|
}
|
|
4794
4795
|
}
|
|
4795
4796
|
|
|
4797
|
+
// apps/cli/src/commands/project.ts
|
|
4798
|
+
async function projectCommand(action, options) {
|
|
4799
|
+
const { config, org: org2 } = requireActiveOrg();
|
|
4800
|
+
const api = FlightDeskAPI.fromConfig(config, org2);
|
|
4801
|
+
switch (action) {
|
|
4802
|
+
case "list":
|
|
4803
|
+
await listProjects(api);
|
|
4804
|
+
break;
|
|
4805
|
+
default:
|
|
4806
|
+
console.error(`Unknown action: ${action}`);
|
|
4807
|
+
process.exit(1);
|
|
4808
|
+
}
|
|
4809
|
+
}
|
|
4810
|
+
async function listProjects(api) {
|
|
4811
|
+
const projects = await api.listProjects();
|
|
4812
|
+
if (projects.length === 0) {
|
|
4813
|
+
console.log("No projects found.");
|
|
4814
|
+
console.log("\nCreate a project at https://app.flightdesk.dev/app/projects/new");
|
|
4815
|
+
return;
|
|
4816
|
+
}
|
|
4817
|
+
console.log("Projects:\n");
|
|
4818
|
+
const maxNameLen = Math.max(...projects.map((p) => p.name.length), 4);
|
|
4819
|
+
for (const project2 of projects) {
|
|
4820
|
+
const name = project2.name.padEnd(maxNameLen);
|
|
4821
|
+
const repo = project2.githubRepo || "(no repo)";
|
|
4822
|
+
console.log(` ${project2.id} ${name} ${repo}`);
|
|
4823
|
+
}
|
|
4824
|
+
console.log(`
|
|
4825
|
+
${projects.length} project(s)`);
|
|
4826
|
+
}
|
|
4827
|
+
|
|
4796
4828
|
// apps/cli/src/main.ts
|
|
4797
4829
|
var program2 = new Command();
|
|
4798
|
-
program2.name("flightdesk").description("FlightDesk CLI - AI task management for Claude Code sessions").version("0.1.
|
|
4830
|
+
program2.name("flightdesk").description("FlightDesk CLI - AI task management for Claude Code sessions").version("0.1.12").option("--dev", "Use local development API (localhost:3000)").option("--api <url>", "Use custom API URL");
|
|
4799
4831
|
program2.hook("preAction", () => {
|
|
4800
4832
|
const opts = program2.opts();
|
|
4801
4833
|
if (opts.api) {
|
|
@@ -4810,6 +4842,8 @@ program2.hook("preAction", () => {
|
|
|
4810
4842
|
program2.command("init").description("Configure FlightDesk CLI with your API credentials").action(initCommand);
|
|
4811
4843
|
program2.command("auth").description("Log in to Claude for session monitoring").action(authCommand);
|
|
4812
4844
|
program2.command("register <project-id> [task-id]").description("Register a Claude Code session with a FlightDesk task").option("--view-url <url>", "Claude Code session view URL").option("--teleport-id <id>", "Claude Code teleport ID").option("--title <title>", "Task title (creates new task if task-id not provided)").option("--description <description>", "Task description").action(registerCommand);
|
|
4845
|
+
var project = program2.command("project").description("Project management commands");
|
|
4846
|
+
project.command("list").description("List projects in the active organization").action(() => projectCommand("list", {}));
|
|
4813
4847
|
var task = program2.command("task").description("Task management commands");
|
|
4814
4848
|
task.command("create").description("Create a new task").requiredOption("-p, --project <id>", "Project ID").requiredOption("-t, --title <title>", "Task title").option("-d, --description <description>", "Task description").action((options) => taskCommand("create", options));
|
|
4815
4849
|
task.command("list").description("List tasks").option("-p, --project <id>", "Filter by project ID").option("--status <status>", "Filter by status").action((options) => taskCommand("list", options));
|