flightdesk 0.4.1 → 0.4.2

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 +40 -10
  2. package/main.js.map +3 -3
  3. package/package.json +1 -1
package/main.js CHANGED
@@ -3639,6 +3639,7 @@ function parseGitRemoteUrl(remoteUrl) {
3639
3639
  }
3640
3640
 
3641
3641
  // apps/cli/src/commands/register.ts
3642
+ var import_node_child_process2 = require("node:child_process");
3642
3643
  async function registerCommand(taskId, options) {
3643
3644
  const { config, org: org2 } = requireActiveOrg();
3644
3645
  const api = FlightDeskAPI.fromConfig(config, org2);
@@ -3649,7 +3650,13 @@ async function registerCommand(taskId, options) {
3649
3650
  }
3650
3651
  let viewUrl = options.viewUrl;
3651
3652
  let teleportId = options.teleportId;
3652
- if (!process.stdin.isTTY) {
3653
+ if (options.prompt) {
3654
+ console.log("\u23F3 Starting Claude remote session...");
3655
+ const claudeOutput = await spawnClaudeRemote(options.prompt);
3656
+ const parsed = parseClaudeOutput(claudeOutput);
3657
+ viewUrl = viewUrl || parsed.viewUrl;
3658
+ teleportId = teleportId || parsed.teleportId;
3659
+ } else if (!process.stdin.isTTY) {
3653
3660
  console.log("\u23F3 Waiting for Claude session output...");
3654
3661
  const input = await readStdin();
3655
3662
  const parsed = parseClaudeOutput(input);
@@ -3694,6 +3701,29 @@ Task ID: ${actualTaskId}`);
3694
3701
  process.exit(1);
3695
3702
  }
3696
3703
  }
3704
+ function spawnClaudeRemote(prompt) {
3705
+ return new Promise((resolve, reject) => {
3706
+ let output = "";
3707
+ const child = (0, import_node_child_process2.spawn)("claude", ["--remote", prompt], {
3708
+ stdio: ["inherit", "pipe", "inherit"]
3709
+ });
3710
+ child.stdout.setEncoding("utf8");
3711
+ child.stdout.on("data", (chunk) => {
3712
+ process.stdout.write(chunk);
3713
+ output += chunk;
3714
+ });
3715
+ child.on("close", (code) => {
3716
+ if (code !== 0) {
3717
+ reject(new Error(`claude exited with code ${code}`));
3718
+ } else {
3719
+ resolve(output);
3720
+ }
3721
+ });
3722
+ child.on("error", (err) => {
3723
+ reject(new Error(`Failed to spawn claude: ${err.message}`));
3724
+ });
3725
+ });
3726
+ }
3697
3727
  function readStdin() {
3698
3728
  return new Promise((resolve) => {
3699
3729
  let data = "";
@@ -4360,7 +4390,7 @@ ${projects.length} project(s)`);
4360
4390
  }
4361
4391
 
4362
4392
  // apps/cli/src/commands/preview.ts
4363
- var import_node_child_process2 = require("node:child_process");
4393
+ var import_node_child_process3 = require("node:child_process");
4364
4394
  var path2 = __toESM(require("node:path"));
4365
4395
  var os2 = __toESM(require("node:os"));
4366
4396
  var fs2 = __toESM(require("node:fs"));
@@ -4474,7 +4504,7 @@ async function handleLogs(api, options) {
4474
4504
  `);
4475
4505
  validateSSHParams(instance);
4476
4506
  const sshCommand = `docker logs -f ${instance.containerId}`;
4477
- const ssh = (0, import_node_child_process2.spawn)("ssh", [
4507
+ const ssh = (0, import_node_child_process3.spawn)("ssh", [
4478
4508
  "-o",
4479
4509
  "StrictHostKeyChecking=no",
4480
4510
  "-o",
@@ -4514,7 +4544,7 @@ async function handleMount(api, options) {
4514
4544
  await new Promise((resolve) => setTimeout(resolve, 3e3));
4515
4545
  }
4516
4546
  try {
4517
- (0, import_node_child_process2.execSync)("which sshfs", { stdio: "ignore" });
4547
+ (0, import_node_child_process3.execSync)("which sshfs", { stdio: "ignore" });
4518
4548
  } catch {
4519
4549
  console.error("\u274C sshfs is not installed.");
4520
4550
  console.error("");
@@ -4535,7 +4565,7 @@ async function handleMount(api, options) {
4535
4565
  fs2.mkdirSync(mountDir, { recursive: true });
4536
4566
  }
4537
4567
  try {
4538
- const mounted = (0, import_node_child_process2.execSync)("mount", { encoding: "utf8" });
4568
+ const mounted = (0, import_node_child_process3.execSync)("mount", { encoding: "utf8" });
4539
4569
  if (mounted.includes(mountDir)) {
4540
4570
  console.log(`\u{1F4C1} Already mounted at ${mountDir}`);
4541
4571
  return;
@@ -4561,7 +4591,7 @@ async function handleMount(api, options) {
4561
4591
  mountDir
4562
4592
  ];
4563
4593
  try {
4564
- const result = (0, import_node_child_process2.spawnSync)("sshfs", sshfsArgs, { stdio: "inherit" });
4594
+ const result = (0, import_node_child_process3.spawnSync)("sshfs", sshfsArgs, { stdio: "inherit" });
4565
4595
  if (result.status !== 0) {
4566
4596
  throw new Error(`sshfs exited with code ${result.status}`);
4567
4597
  }
@@ -4595,9 +4625,9 @@ async function handleUnmount(_api, options) {
4595
4625
  try {
4596
4626
  let result;
4597
4627
  if (process.platform === "darwin") {
4598
- result = (0, import_node_child_process2.spawnSync)("umount", [mountDir], { stdio: "inherit" });
4628
+ result = (0, import_node_child_process3.spawnSync)("umount", [mountDir], { stdio: "inherit" });
4599
4629
  } else {
4600
- result = (0, import_node_child_process2.spawnSync)("fusermount", ["-u", mountDir], { stdio: "inherit" });
4630
+ result = (0, import_node_child_process3.spawnSync)("fusermount", ["-u", mountDir], { stdio: "inherit" });
4601
4631
  }
4602
4632
  if (result.status !== 0) {
4603
4633
  throw new Error(`Unmount exited with code ${result.status}`);
@@ -4637,7 +4667,7 @@ async function handleTeardown(api, options) {
4637
4667
 
4638
4668
  // apps/cli/src/main.ts
4639
4669
  var program2 = new Command();
4640
- program2.name("flightdesk").description("FlightDesk CLI - AI task management for Claude Code sessions").version("0.4.1").option("--dev", "Use local development API (localhost:3000)").option("--api <url>", "Use custom API URL");
4670
+ program2.name("flightdesk").description("FlightDesk CLI - AI task management for Claude Code sessions").version("0.4.2").option("--dev", "Use local development API (localhost:3000)").option("--api <url>", "Use custom API URL");
4641
4671
  program2.hook("preAction", () => {
4642
4672
  const opts = program2.opts();
4643
4673
  if (opts.api) {
@@ -4650,7 +4680,7 @@ program2.hook("preAction", () => {
4650
4680
  }
4651
4681
  });
4652
4682
  program2.command("init").description("Configure FlightDesk CLI with your API credentials").action(initCommand);
4653
- program2.command("register [task-id]").description("Register a Claude Code session with a FlightDesk task (auto-detects project from git repo)").option("-p, --project <id>", "Project ID (auto-detected from git repo if not provided)").option("--subproject <id>", "Subproject ID (required if project has subprojects configured)").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);
4683
+ program2.command("register [task-id]").description("Register a Claude Code session with a FlightDesk task (auto-detects project from git repo)").option("-p, --project <id>", "Project ID (auto-detected from git repo if not provided)").option("--subproject <id>", "Subproject ID (required if project has subprojects configured)").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").option("--prompt <prompt>", "Prompt to pass to claude --remote (avoids pipe detection issues)").action(registerCommand);
4654
4684
  var project = program2.command("project").description("Project management commands");
4655
4685
  project.command("list").description("List projects in the active organization").action(() => projectCommand("list", {}));
4656
4686
  var task = program2.command("task").description("Task management commands");