@treeport/treeport 0.6.1 → 0.8.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.
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import "../../../dist-Crk_Xr82.js";
3
- import { t as integrateShellLaunch } from "../../../shell-integration-Be_c91lw.js";
2
+ import "../../../dist-BsLn2Gbc.js";
3
+ import { t as integrateShellLaunch } from "../../../shell-integration-CPmrVa3B.js";
4
4
  import fs from "node:fs/promises";
5
5
  import path from "node:path";
6
- import { z } from "zod";
7
6
  import { spawn } from "node:child_process";
7
+ import { z } from "zod";
8
8
  import { fileURLToPath } from "node:url";
9
9
  //#region src/server/core/launcher.ts
10
10
  const FORWARDED_SIGNALS = [
@@ -19,7 +19,6 @@ const launchSpecSchema = z.object({
19
19
  cwd: z.string(),
20
20
  env: z.record(z.string(), z.string()),
21
21
  shellIntegrationDir: z.string().optional(),
22
- tmuxExecutable: z.string().optional(),
23
22
  setupTasks: z.array(z.object({
24
23
  label: z.string(),
25
24
  argv: z.array(z.string()),
@@ -114,7 +113,6 @@ async function runLaunchSpec(spec, dependencies = {}) {
114
113
  const stdout = dependencies.stdout ?? process.stdout;
115
114
  const stderr = dependencies.stderr ?? process.stderr;
116
115
  const signalSource = dependencies.signalSource ?? process;
117
- const tmuxPane = dependencies.tmuxPane === void 0 ? process.env.TMUX_PANE : dependencies.tmuxPane ?? void 0;
118
116
  if (spec.setupError) {
119
117
  stderr.write(`[Treeport setup] ${safeDiagnostic(spec.setupError) || "setup preparation failed"}\n`);
120
118
  return 1;
@@ -160,25 +158,9 @@ async function runLaunchSpec(spec, dependencies = {}) {
160
158
  ...process.env,
161
159
  ...spec.env
162
160
  };
163
- const command = integrateShellLaunch(spec.argv, commandEnvironment, spec.shellIntegrationDir, spec.tmuxExecutable);
161
+ const command = integrateShellLaunch(spec.argv, commandEnvironment, spec.shellIntegrationDir, Boolean(spec.shellIntegrationDir));
164
162
  const initialTitle = spec.initialTitle ? safeDiagnostic(spec.initialTitle) : "";
165
- if (initialTitle && spec.tmuxExecutable && tmuxPane) {
166
- if ((await runChild([
167
- spec.tmuxExecutable,
168
- "set-option",
169
- "-p",
170
- "-t",
171
- tmuxPane,
172
- "--",
173
- "@treeport-command",
174
- initialTitle
175
- ], {
176
- cwd: spec.cwd,
177
- env: process.env,
178
- spawnProcess,
179
- signalSource
180
- })).forwardedSignal) return 1;
181
- }
163
+ if (initialTitle && spec.shellIntegrationDir) stdout.write(`\u001b]777;command;${initialTitle}\u001b\\`);
182
164
  const result = await runChild(command.argv, {
183
165
  cwd: spec.cwd,
184
166
  env: command.env,
@@ -188,31 +170,8 @@ async function runLaunchSpec(spec, dependencies = {}) {
188
170
  if (result.spawnError) stderr.write(`Treeport launcher: ${safeDiagnostic(result.spawnError.message) || "spawn error"}\n`);
189
171
  if (result.forwardedSignal && (!spec.fallbackArgv || result.forwardedSignal !== "SIGINT")) return 1;
190
172
  if (spec.fallbackArgv) {
191
- if (spec.tmuxExecutable && tmuxPane && spec.fallbackArgv[0]) {
192
- if ((await runChild([
193
- spec.tmuxExecutable,
194
- "set-option",
195
- "-p",
196
- "-u",
197
- "-t",
198
- tmuxPane,
199
- "@treeport-command",
200
- ";",
201
- "set-option",
202
- "-p",
203
- "-t",
204
- tmuxPane,
205
- "--",
206
- "@treeport-fallback-shell",
207
- Buffer.from(JSON.stringify(spec.fallbackArgv[0]), "utf8").toString("base64url")
208
- ], {
209
- cwd: spec.cwd,
210
- env: process.env,
211
- spawnProcess,
212
- signalSource
213
- })).forwardedSignal) return 1;
214
- }
215
- const fallback = integrateShellLaunch(spec.fallbackArgv, commandEnvironment, spec.shellIntegrationDir, spec.tmuxExecutable);
173
+ if (spec.shellIntegrationDir) stdout.write("\x1B]777;command;\x1B\\");
174
+ const fallback = integrateShellLaunch(spec.fallbackArgv, commandEnvironment, spec.shellIntegrationDir, Boolean(spec.shellIntegrationDir));
216
175
  const fallbackResult = await runChild(fallback.argv, {
217
176
  cwd: spec.cwd,
218
177
  env: fallback.env,
@@ -246,6 +205,9 @@ async function main() {
246
205
  process.exit(await runLaunchSpec(spec));
247
206
  }
248
207
  const invokedPath = process.argv[1];
249
- if (invokedPath && path.resolve(invokedPath) === path.resolve(fileURLToPath(import.meta.url))) main();
208
+ if (invokedPath && path.resolve(invokedPath) === path.resolve(fileURLToPath(import.meta.url))) main().catch((error) => {
209
+ process.stderr.write(`Treeport launcher: ${error instanceof Error ? error.message : String(error)}\n`);
210
+ process.exit(127);
211
+ });
250
212
  //#endregion
251
213
  export { runLaunchSpec };