@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.
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { t as integrateShellLaunch } from "../../../shell-integration-7aBNr-p0.js";
2
+ import { t as integrateShellLaunch } from "../../../shell-integration-Be_c91lw.js";
3
3
  import fs from "node:fs/promises";
4
4
  import path from "node:path";
5
+ import { z } from "zod";
5
6
  import { spawn } from "node:child_process";
6
7
  import { fileURLToPath } from "node:url";
7
8
  //#region src/server/core/launcher.ts
@@ -10,6 +11,22 @@ const FORWARDED_SIGNALS = [
10
11
  "SIGINT",
11
12
  "SIGHUP"
12
13
  ];
14
+ const launchSpecSchema = z.object({
15
+ argv: z.array(z.string()),
16
+ fallbackArgv: z.array(z.string()).optional(),
17
+ cwd: z.string(),
18
+ env: z.record(z.string(), z.string()),
19
+ shellIntegrationDir: z.string().optional(),
20
+ tmuxExecutable: z.string().optional(),
21
+ setupTasks: z.array(z.object({
22
+ label: z.string(),
23
+ argv: z.array(z.string()),
24
+ cwd: z.string(),
25
+ env: z.record(z.string(), z.string()),
26
+ timeoutMs: z.number()
27
+ }).strict()).optional(),
28
+ setupError: z.string().optional()
29
+ }).strict();
13
30
  function safeDiagnostic(value) {
14
31
  return [...value].map((character) => {
15
32
  const codePoint = character.codePointAt(0) ?? 0;
@@ -176,7 +193,7 @@ async function main() {
176
193
  }
177
194
  let spec;
178
195
  try {
179
- spec = JSON.parse(await fs.readFile(specPath, "utf8"));
196
+ spec = launchSpecSchema.parse(JSON.parse(await fs.readFile(specPath, "utf8")));
180
197
  } catch (error) {
181
198
  process.stderr.write(`Treeport launcher: cannot read launch spec: ${error instanceof Error ? error.message : String(error)}\n`);
182
199
  process.exit(127);