flightdesk 0.1.6 → 0.1.7

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.
Files changed (3) hide show
  1. package/main.js +46 -24
  2. package/main.js.map +3 -3
  3. package/package.json +1 -1
package/main.js CHANGED
@@ -3035,15 +3035,25 @@ var {
3035
3035
  Help
3036
3036
  } = import_index.default;
3037
3037
 
3038
- // apps/cli/src/commands/init.ts
3039
- var readline = __toESM(require("readline"));
3040
-
3041
3038
  // apps/cli/src/lib/config.ts
3042
3039
  var fs = __toESM(require("fs"));
3043
3040
  var path = __toESM(require("path"));
3044
3041
  var os = __toESM(require("os"));
3045
3042
  var CONFIG_FILE = path.join(os.homedir(), ".flightdeskrc");
3046
- var DEFAULT_API_URL = "https://flightdesk.dev/api";
3043
+ var DEFAULT_API_URL = "https://api.flightdesk.dev";
3044
+ var DEV_API_URL = "http://localhost:3000";
3045
+ var apiUrlOverride = null;
3046
+ function setDevMode(enabled) {
3047
+ if (enabled) {
3048
+ apiUrlOverride = DEV_API_URL;
3049
+ }
3050
+ }
3051
+ function setApiUrl(url) {
3052
+ apiUrlOverride = url;
3053
+ }
3054
+ function getApiUrl() {
3055
+ return apiUrlOverride ?? DEFAULT_API_URL;
3056
+ }
3047
3057
  function loadConfig() {
3048
3058
  try {
3049
3059
  if (fs.existsSync(CONFIG_FILE)) {
@@ -3111,6 +3121,7 @@ function isConfigured() {
3111
3121
  }
3112
3122
 
3113
3123
  // apps/cli/src/commands/init.ts
3124
+ var readline = __toESM(require("readline"));
3114
3125
  function question(rl, prompt) {
3115
3126
  return new Promise((resolve) => {
3116
3127
  rl.question(prompt, (answer) => {
@@ -3151,8 +3162,8 @@ async function initCommand() {
3151
3162
  rl.close();
3152
3163
  return;
3153
3164
  }
3154
- const apiUrlInput = await question(rl, `API URL (${DEFAULT_API_URL}): `);
3155
- const apiUrl = apiUrlInput || DEFAULT_API_URL;
3165
+ const apiUrl = getApiUrl();
3166
+ console.log(`Using API: ${apiUrl}`);
3156
3167
  let orgId;
3157
3168
  const keyMatch = apiKey.match(/^fd_key_([^_]+)_/);
3158
3169
  if (keyMatch) {
@@ -3211,9 +3222,10 @@ async function initCommand() {
3211
3222
  }
3212
3223
 
3213
3224
  // apps/cli/src/lib/session-monitor.ts
3214
- var path2 = __toESM(require("path"));
3215
- var os2 = __toESM(require("os"));
3216
- var fs2 = __toESM(require("fs"));
3225
+ var path2 = __toESM(require("node:path"));
3226
+ var os2 = __toESM(require("node:os"));
3227
+ var fs2 = __toESM(require("node:fs"));
3228
+ var readline2 = __toESM(require("node:readline"));
3217
3229
  var playwright = null;
3218
3230
  var USER_DATA_DIR = path2.join(os2.homedir(), ".flightdesk", "chromium-profile");
3219
3231
  async function isPlaywrightAvailable() {
@@ -3291,8 +3303,7 @@ async function openForLogin() {
3291
3303
  }
3292
3304
  function waitForEnter() {
3293
3305
  return new Promise((resolve) => {
3294
- const readline3 = require("readline");
3295
- const rl = readline3.createInterface({
3306
+ const rl = readline2.createInterface({
3296
3307
  input: process.stdin,
3297
3308
  output: process.stdout
3298
3309
  });
@@ -3352,7 +3363,7 @@ async function monitorSession(sessionUrl, options = {}) {
3352
3363
  }
3353
3364
  async function extractBranchName(page) {
3354
3365
  const primarySelectors = [
3355
- "button.group\\/copy span.truncate"
3366
+ String.raw`button.group\/copy span.truncate`
3356
3367
  // New branch name (verified)
3357
3368
  ];
3358
3369
  for (const selector of primarySelectors) {
@@ -4130,7 +4141,7 @@ async function promptCommand(taskId, options) {
4130
4141
  }
4131
4142
 
4132
4143
  // apps/cli/src/commands/org.ts
4133
- var readline2 = __toESM(require("readline"));
4144
+ var readline3 = __toESM(require("readline"));
4134
4145
  function question2(rl, prompt) {
4135
4146
  return new Promise((resolve) => {
4136
4147
  rl.question(prompt, (answer) => {
@@ -4165,7 +4176,7 @@ async function orgListCommand() {
4165
4176
  }
4166
4177
  }
4167
4178
  async function orgAddCommand() {
4168
- const rl = readline2.createInterface({
4179
+ const rl = readline3.createInterface({
4169
4180
  input: process.stdin,
4170
4181
  output: process.stdout
4171
4182
  });
@@ -4181,8 +4192,8 @@ async function orgAddCommand() {
4181
4192
  console.error("API Key is required");
4182
4193
  return;
4183
4194
  }
4184
- const apiUrlInput = await question2(rl, `API URL (${DEFAULT_API_URL}): `);
4185
- const apiUrl = apiUrlInput || DEFAULT_API_URL;
4195
+ const apiUrl = getApiUrl();
4196
+ console.log(`Using API: ${apiUrl}`);
4186
4197
  let orgId;
4187
4198
  const keyMatch = apiKey.match(/^fd_key_([^_]+)_/);
4188
4199
  if (keyMatch) {
@@ -4246,7 +4257,7 @@ async function orgRemoveCommand(orgId) {
4246
4257
  }
4247
4258
  process.exit(1);
4248
4259
  }
4249
- const rl = readline2.createInterface({
4260
+ const rl = readline3.createInterface({
4250
4261
  input: process.stdin,
4251
4262
  output: process.stdout
4252
4263
  });
@@ -4395,13 +4406,13 @@ var ClaudeSelectors = {
4395
4406
  /** New task input (textarea in sidebar) */
4396
4407
  newTaskInput: 'textarea[placeholder="Ask Claude to write code..."]',
4397
4408
  /** Session list container */
4398
- sessionList: ".flex.flex-col.gap-0\\.5.px-1",
4409
+ sessionList: String.raw`.flex.flex-col.gap-0\.5.px-1`,
4399
4410
  /** Individual session items - use :has-text() with title */
4400
4411
  sessionItem: (title) => `.cursor-pointer:has-text("${title}")`,
4401
4412
  /** All session items (div elements with cursor-pointer class) */
4402
- allSessions: ".flex.flex-col.gap-0\\.5.px-1 .cursor-pointer",
4413
+ allSessions: String.raw`.flex.flex-col.gap-0\.5.px-1 .cursor-pointer`,
4403
4414
  /** Session by index (0-indexed) */
4404
- sessionByIndex: (index) => `.flex.flex-col.gap-0\\.5.px-1 > div:nth-child(${index + 1}) .cursor-pointer`,
4415
+ sessionByIndex: (index) => String.raw`.flex.flex-col.gap-0\.5.px-1` + ` > div:nth-child(${index + 1}) .cursor-pointer`,
4405
4416
  /** Active/selected session (has bg-bg-300 class) */
4406
4417
  activeSession: ".cursor-pointer.bg-bg-300",
4407
4418
  /** Session title within a session item */
@@ -4426,7 +4437,7 @@ var ClaudeSelectors = {
4426
4437
  /** Copy branch button (click to copy branch name) */
4427
4438
  copyBranchButton: "button.group\\/copy",
4428
4439
  /** Diff stats button (+N -M) */
4429
- diffStatsButton: ".flex.items-center.gap-2.w-full.p-2 button.border-0\\.5"
4440
+ diffStatsButton: String.raw`.flex.items-center.gap-2.w-full.p-2 button.border-0\.5`
4430
4441
  },
4431
4442
  // ============================================================================
4432
4443
  // Pull Request Controls - Verified 2026-02-23
@@ -4599,7 +4610,7 @@ Found ${sessions.length} sessions:
4599
4610
  }
4600
4611
  for (const [repoName, repoSessions] of sessionsByRepo) {
4601
4612
  const matchingProject = existingProjects.find(
4602
- (p) => p.githubRepo && p.githubRepo.endsWith(`/${repoName}`)
4613
+ (p) => p.githubRepo?.endsWith(`/${repoName}`)
4603
4614
  );
4604
4615
  if (matchingProject) {
4605
4616
  console.log(`\u{1F4C1} ${repoName} \u2192 Project: ${matchingProject.name} (${matchingProject.id.slice(0, 8)})`);
@@ -4641,7 +4652,7 @@ Summary:`);
4641
4652
  const importableSessions = [];
4642
4653
  for (const [repoName, repoSessions] of sessionsByRepo) {
4643
4654
  const matchingProject = existingProjects.find(
4644
- (p) => p.githubRepo && p.githubRepo.endsWith(`/${repoName}`)
4655
+ (p) => p.githubRepo?.endsWith(`/${repoName}`)
4645
4656
  );
4646
4657
  if (matchingProject) {
4647
4658
  for (const session of repoSessions) {
@@ -4786,7 +4797,18 @@ async function scanClaudeSessions(options) {
4786
4797
 
4787
4798
  // apps/cli/src/main.ts
4788
4799
  var program2 = new Command();
4789
- program2.name("flightdesk").description("FlightDesk CLI - AI task management for Claude Code sessions").version("0.1.5");
4800
+ program2.name("flightdesk").description("FlightDesk CLI - AI task management for Claude Code sessions").version("0.1.7").option("--dev", "Use local development API (localhost:3000)").option("--api <url>", "Use custom API URL");
4801
+ program2.hook("preAction", () => {
4802
+ const opts = program2.opts();
4803
+ if (opts.api) {
4804
+ setApiUrl(opts.api);
4805
+ console.log(`\u{1F527} Using custom API: ${opts.api}
4806
+ `);
4807
+ } else if (opts.dev) {
4808
+ setDevMode(true);
4809
+ console.log("\u{1F527} Development mode: using http://localhost:3000\n");
4810
+ }
4811
+ });
4790
4812
  program2.command("init").description("Configure FlightDesk CLI with your API credentials").action(initCommand);
4791
4813
  program2.command("auth").description("Log in to Claude for session monitoring").action(authCommand);
4792
4814
  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);