@danypops/tickets 0.10.0 → 0.10.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danypops/tickets",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "Unified CLI, daemon, and TypeScript library for issue tracking across GitHub, GitLab, and Jira.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -9,8 +9,15 @@ import { spawn } from "node:child_process";
9
9
 
10
10
  export type Spawner = (command: string, args: string[]) => void;
11
11
 
12
- const defaultSpawner: Spawner = (command, args) => {
12
+ // A spawn() failure (e.g. no `xdg-open` on a minimal Linux install) surfaces asynchronously as
13
+ // an unlistened "error" event under Node, which is an uncaught exception that kills the whole
14
+ // host process -- this runs from inside the long-lived pi-tickets extension host (tui.ts), not
15
+ // just the standalone CLI, so that crash is a real live risk, not just a CLI inconvenience.
16
+ export const defaultSpawner: Spawner = (command, args) => {
13
17
  const child = spawn(command, args, { stdio: "ignore", detached: true });
18
+ child.on("error", (error) => {
19
+ console.error(`failed to open URL via ${command}: ${error instanceof Error ? error.message : String(error)}`);
20
+ });
14
21
  child.unref();
15
22
  };
16
23
 
@@ -29,14 +29,22 @@ async function isAlive(handle: DaemonHandle, token: string): Promise<boolean> {
29
29
  }
30
30
  }
31
31
 
32
- /** Absolute path to the daemon's real entry point, resolved from this package's own root. Used both to spawn it on demand and to point a systemd unit's ExecStart at it (see cli/systemd-service.ts). */
32
+ /** Absolute path to the daemon's real entry point, resolved from this package's own root. Used to spawn it on demand -- Armada's own ServiceSpec (see cli/systemd-service.ts) launches the CLI's own `serve` command instead, not this path directly. */
33
33
  export function resolveDaemonEntryPath(): string {
34
34
  const root = packageRoot(dirname(fileURLToPath(import.meta.url)));
35
35
  return join(root, "src", "process", "main.ts");
36
36
  }
37
37
 
38
- function spawnDaemon(): void {
38
+ // A spawn() failure surfaces asynchronously as an unlistened "error" event under Node, which is
39
+ // an uncaught exception that kills the whole host process. createTicketsClient (which calls
40
+ // this via ensureDaemonRunning) runs from inside the long-lived pi-tickets extension host
41
+ // (tui.ts) as well as the CLI, so a missing/misconfigured `bun` binary would otherwise crash
42
+ // the whole Pi session, not just this one connect attempt.
43
+ export function spawnDaemon(): void {
39
44
  const child = spawn("bun", ["run", resolveDaemonEntryPath()], { detached: true, stdio: "ignore" });
45
+ child.on("error", (error) => {
46
+ console.error(`tickets daemon auto-spawn failed: ${error instanceof Error ? error.message : String(error)}`);
47
+ });
40
48
  child.unref();
41
49
  }
42
50