flightdesk 0.4.2 → 0.4.3

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 +32 -14
  2. package/main.js.map +2 -2
  3. package/package.json +1 -1
package/main.js CHANGED
@@ -3640,6 +3640,9 @@ function parseGitRemoteUrl(remoteUrl) {
3640
3640
 
3641
3641
  // apps/cli/src/commands/register.ts
3642
3642
  var import_node_child_process2 = require("node:child_process");
3643
+ var import_node_fs = require("node:fs");
3644
+ var import_node_os = require("node:os");
3645
+ var import_node_path = require("node:path");
3643
3646
  async function registerCommand(taskId, options) {
3644
3647
  const { config, org: org2 } = requireActiveOrg();
3645
3648
  const api = FlightDeskAPI.fromConfig(config, org2);
@@ -3702,25 +3705,40 @@ Task ID: ${actualTaskId}`);
3702
3705
  }
3703
3706
  }
3704
3707
  function spawnClaudeRemote(prompt) {
3708
+ const tmpDir = (0, import_node_fs.mkdtempSync)((0, import_node_path.join)((0, import_node_os.tmpdir)(), "fd-claude-"));
3709
+ const tmpFile = (0, import_node_path.join)(tmpDir, "output.txt");
3710
+ const isMac = process.platform === "darwin";
3711
+ const escaped = prompt.replaceAll("'", `'"'"'`);
3712
+ const scriptArgs = isMac ? ["-q", tmpFile, "claude", "--remote", prompt] : ["-q", "-c", `claude --remote '${escaped}'`, tmpFile];
3705
3713
  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
+ const child = (0, import_node_child_process2.spawn)("script", scriptArgs, {
3715
+ stdio: "inherit"
3716
+ // claude sees real TTY on all streams
3714
3717
  });
3715
3718
  child.on("close", (code) => {
3716
- if (code !== 0) {
3717
- reject(new Error(`claude exited with code ${code}`));
3718
- } else {
3719
- resolve(output);
3719
+ try {
3720
+ let raw = "";
3721
+ try {
3722
+ raw = (0, import_node_fs.readFileSync)(tmpFile, "utf8");
3723
+ } catch {
3724
+ }
3725
+ try {
3726
+ (0, import_node_fs.rmSync)(tmpDir, { recursive: true });
3727
+ } catch {
3728
+ }
3729
+ const output = raw.replace(/\x1b\[[0-9;]*[mGKHFJABCDr]/g, "").replace(/\r/g, "");
3730
+ if (code !== 0) {
3731
+ reject(new Error(`claude exited with code ${code}
3732
+ Output: ${output.slice(0, 500)}`));
3733
+ } else {
3734
+ resolve(output);
3735
+ }
3736
+ } catch (err) {
3737
+ reject(err);
3720
3738
  }
3721
3739
  });
3722
3740
  child.on("error", (err) => {
3723
- reject(new Error(`Failed to spawn claude: ${err.message}`));
3741
+ reject(new Error(`Failed to spawn 'script' command: ${err.message}`));
3724
3742
  });
3725
3743
  });
3726
3744
  }
@@ -4667,7 +4685,7 @@ async function handleTeardown(api, options) {
4667
4685
 
4668
4686
  // apps/cli/src/main.ts
4669
4687
  var program2 = new Command();
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");
4688
+ program2.name("flightdesk").description("FlightDesk CLI - AI task management for Claude Code sessions").version("0.4.3").option("--dev", "Use local development API (localhost:3000)").option("--api <url>", "Use custom API URL");
4671
4689
  program2.hook("preAction", () => {
4672
4690
  const opts = program2.opts();
4673
4691
  if (opts.api) {