@treeport/treeport 0.2.2 → 0.4.0

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Treeport
2
2
 
3
- Treeport is a worktree-first terminal driver for persistent development workspaces.
3
+ Treeport is a tree-first terminal driver for persistent development workspaces.
4
4
 
5
5
  ```sh
6
6
  npm install --global @treeport/treeport
@@ -8,7 +8,7 @@ cd /path/to/repository
8
8
  treeport .
9
9
  ```
10
10
 
11
- Treeport starts its backend if needed, registers the repository and its worktrees, and opens the current worktree in the desktop app or browser. Run `treeport up` to start only the backend.
11
+ Treeport starts its backend if needed, registers the repository and its trees, and opens the current tree in the desktop app or browser. Run `treeport start` to start only the backend. Use `treeport service enable` when a host must start Treeport after reboot.
12
12
 
13
13
  Treeport supports macOS and Linux and requires Node.js 24 or newer, Git, and tmux 3.2 or newer.
14
14
 
package/bin/treeport.mjs CHANGED
@@ -1,2 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import '../dist/node/cli/index.js'
2
+
3
+ process.env.TREEPORT_CLI_ENTRYPOINT ??= process.argv[1]
4
+ await import('../dist/node/cli/index.js')
@@ -12,6 +12,7 @@ const TERMINAL_SELECTION_START_SEQUENCE = "\x1B[9001~";
12
12
  const TERMINAL_SELECTION_STOP_SEQUENCE = "\x1B[9002~";
13
13
  const TERMINAL_SELECTION_CLEAR_SEQUENCE = "\x1B[9003~";
14
14
  const TERMINAL_SELECTION_RESTORE_SEQUENCE = "\x1B[9004~";
15
+ z.unknown();
15
16
  const terminalId = z.string().min(1).max(128);
16
17
  const clientId = z.string().min(1).max(128);
17
18
  const streamId = z.string().min(1).max(128);
@@ -238,6 +239,7 @@ const eventsSnapshotSchema = z.strictObject({
238
239
  terminalMetadata: z.array(terminalRuntimeMetadataSchema),
239
240
  webPanels: z.array(webPanelSnapshotSchema)
240
241
  });
242
+ z.unknown();
241
243
  function parseEventsSnapshot(value) {
242
244
  const parsed = eventsSnapshotSchema.safeParse(value);
243
245
  return parsed.success ? parsed.data : null;
@@ -304,7 +306,7 @@ const createWorktreeSchema = z.object({
304
306
  if (value.base === "current" && !value.sourceWorktreeId) context.addIssue({
305
307
  code: "custom",
306
308
  path: ["sourceWorktreeId"],
307
- message: "A source worktree is required when starting from current"
309
+ message: "A source tree is required when starting from current"
308
310
  });
309
311
  });
310
312
  const terminalCwdSchema = z.string().min(1).max(4096).refine((value) => value.trim().length > 0 && !value.includes("\0"), { message: "Working directory cannot be blank or contain NUL" });
@@ -370,22 +372,25 @@ z.object({
370
372
  if (value.base === "current" && !value.sourceWorktreeId) context.addIssue({
371
373
  code: "custom",
372
374
  path: ["sourceWorktreeId"],
373
- message: "A source worktree is required when starting from current"
375
+ message: "A source tree is required when starting from current"
374
376
  });
375
377
  });
376
378
  //#endregion
377
379
  //#region src/duration.ts
378
- const DURATION_UNITS = {
379
- ms: 1,
380
- s: 1e3,
381
- m: 6e4,
382
- h: 36e5
383
- };
380
+ const DURATION_UNITS = /* @__PURE__ */ new Map([
381
+ ["ms", 1],
382
+ ["s", 1e3],
383
+ ["m", 6e4],
384
+ ["h", 36e5]
385
+ ]);
384
386
  const MAX_DURATION_MS = 2147483647;
385
387
  function parseDurationMs(value) {
386
388
  const match = /^(\d+)(ms|s|m|h)$/.exec(value);
387
389
  if (!match) throw new Error("Timeout must be a positive duration such as 500ms, 30s, 5m, or 1h");
388
- const timeoutMs = Number(match[1]) * DURATION_UNITS[match[2]];
390
+ const amount = Number(match[1]);
391
+ const multiplier = DURATION_UNITS.get(match[2] ?? "");
392
+ if (multiplier === void 0) throw new Error("Timeout has an unsupported duration unit");
393
+ const timeoutMs = amount * multiplier;
389
394
  if (!Number.isSafeInteger(timeoutMs) || timeoutMs <= 0 || timeoutMs > MAX_DURATION_MS) throw new Error("Timeout must be between 1ms and 2147483647ms");
390
395
  return timeoutMs;
391
396
  }
@@ -401,7 +406,7 @@ function isLoopbackHost(host) {
401
406
  }
402
407
  function assertLoopbackHost(host) {
403
408
  if (isLoopbackHost(host)) return;
404
- throw new Error("Treeport supports only loopback listeners. Run `treeport up --host 127.0.0.1`, then use `treeport remote enable` for private remote access.");
409
+ throw new Error("Treeport supports only loopback listeners. Run `treeport start --host 127.0.0.1`, then use `treeport remote enable` for private remote access.");
405
410
  }
406
411
  //#endregion
407
- export { parseProductEvent as A, TERMINAL_SELECTION_RESTORE_SEQUENCE as B, repositoryTerminalPresetsFileSchema as C, updateTerminalPresetSchema as D, updateProjectSchema as E, TERMINAL_OUTPUT_HIGH_WATERMARK as F, terminalBellAcknowledgementSchema as G, TERMINAL_SELECTION_STOP_SEQUENCE as H, TERMINAL_OUTPUT_LOW_WATERMARK as I, terminalLegacyTakeControlSchema as J, terminalBinarySchema as K, TERMINAL_OUTPUT_STALL_TIMEOUT_MS as L, TERMINAL_CONTROLLER_GRACE_MS as M, TERMINAL_MAX_CLIENT_MESSAGE_BYTES as N, updateTerminalSchema as O, TERMINAL_MAX_INPUT_BYTES as P, terminalTakeControlSchema as Q, TERMINAL_SCROLL_EXIT_SEQUENCE as R, repositoryTerminalPresetSchema as S, terminalCaptureQuerySchema as T, parseTerminalAuth as U, TERMINAL_SELECTION_START_SEQUENCE as V, parseTerminalProgress as W, terminalResizeSchema as X, terminalOutputAckSchema as Y, terminalSizeSchema as Z, packageReloadSchema as _, WEB_PANEL_INPUT_MAX_BYTES as a, registerProjectSchema as b, createTerminalSchema as c, deleteTerminalPresetSchema as d, deleteWebPanelStorageSchema as f, packageProjectQuerySchema as g, packageInstallSchema as h, TERMINAL_MAX_UPLOAD_BYTES as i, SOCKET_IO_PATH as j, parseEventsSnapshot as k, createWebPanelSchema as l, openWebPanelSchema as m, parseDurationMs as n, browseDirectoryQuerySchema as o, getWebPanelStorageSchema as p, terminalInputSchema as q, TERMINAL_CAPTURE_MAX_LINES as r, createTerminalPresetSchema as s, assertLoopbackHost as t, createWorktreeSchema as u, packageRemoveSchema as v, setWebPanelStorageSchema as w, removeWorktreeSchema as x, packageUpdateSchema as y, TERMINAL_SELECTION_CLEAR_SEQUENCE as z };
412
+ export { terminalTakeControlSchema as $, parseEventsSnapshot as A, TERMINAL_SELECTION_CLEAR_SEQUENCE as B, repositoryTerminalPresetsFileSchema as C, updateTerminalPresetSchema as D, updateProjectSchema as E, TERMINAL_MAX_INPUT_BYTES as F, parseTerminalProgress as G, TERMINAL_SELECTION_START_SEQUENCE as H, TERMINAL_OUTPUT_HIGH_WATERMARK as I, terminalInputSchema as J, terminalBellAcknowledgementSchema as K, TERMINAL_OUTPUT_LOW_WATERMARK as L, SOCKET_IO_PATH as M, TERMINAL_CONTROLLER_GRACE_MS as N, updateTerminalSchema as O, TERMINAL_MAX_CLIENT_MESSAGE_BYTES as P, terminalSizeSchema as Q, TERMINAL_OUTPUT_STALL_TIMEOUT_MS as R, repositoryTerminalPresetSchema as S, terminalCaptureQuerySchema as T, TERMINAL_SELECTION_STOP_SEQUENCE as U, TERMINAL_SELECTION_RESTORE_SEQUENCE as V, parseTerminalAuth as W, terminalOutputAckSchema as X, terminalLegacyTakeControlSchema as Y, terminalResizeSchema as Z, packageReloadSchema as _, WEB_PANEL_INPUT_MAX_BYTES as a, registerProjectSchema as b, createTerminalSchema as c, deleteTerminalPresetSchema as d, deleteWebPanelStorageSchema as f, packageProjectQuerySchema as g, packageInstallSchema as h, TERMINAL_MAX_UPLOAD_BYTES as i, parseProductEvent as j, webPanelInputSchema as k, createWebPanelSchema as l, openWebPanelSchema as m, parseDurationMs as n, browseDirectoryQuerySchema as o, getWebPanelStorageSchema as p, terminalBinarySchema as q, TERMINAL_CAPTURE_MAX_LINES as r, createTerminalPresetSchema as s, assertLoopbackHost as t, createWorktreeSchema as u, packageRemoveSchema as v, setWebPanelStorageSchema as w, removeWorktreeSchema as x, packageUpdateSchema as y, TERMINAL_SCROLL_EXIT_SEQUENCE as z };