@treeport/treeport 0.3.0 → 0.5.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 +3 -3
- package/dist/node/cli/index.js +118 -1612
- package/dist/node/server/core/launcher.js +35 -2
- package/dist/node/server/index.js +1193 -572
- package/dist/{shell-integration-7aBNr-p0.js → shell-integration-Be_c91lw.js} +17 -15
- package/dist/update-BW-a6Bd-.js +3107 -0
- package/dist/web/assets/index-Cr4UkmRD.js +146 -0
- package/dist/web/assets/index-he-SubzL.css +2 -0
- package/dist/web/index.html +2 -2
- package/dist/web/manifest.webmanifest +2 -2
- package/drizzle/0008_recent_project_visibility.sql +4 -0
- package/drizzle/0009_open_folders.sql +148 -0
- package/drizzle/meta/0008_snapshot.json +792 -0
- package/drizzle/meta/0009_snapshot.json +804 -0
- package/drizzle/meta/_journal.json +14 -0
- package/package.json +4 -4
- package/skills/treeport/SKILL.md +31 -22
- package/dist/loopback-Dyv_owrb.js +0 -407
- package/dist/web/assets/index-0q5frbNy.css +0 -2
- package/dist/web/assets/index-CUy0IkGL.js +0 -146
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as integrateShellLaunch } from "../../../shell-integration-
|
|
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;
|
|
@@ -95,6 +112,7 @@ async function runLaunchSpec(spec, dependencies = {}) {
|
|
|
95
112
|
const stdout = dependencies.stdout ?? process.stdout;
|
|
96
113
|
const stderr = dependencies.stderr ?? process.stderr;
|
|
97
114
|
const signalSource = dependencies.signalSource ?? process;
|
|
115
|
+
const tmuxPane = dependencies.tmuxPane === void 0 ? process.env.TMUX_PANE : dependencies.tmuxPane ?? void 0;
|
|
98
116
|
if (spec.setupError) {
|
|
99
117
|
stderr.write(`[Treeport setup] ${safeDiagnostic(spec.setupError) || "setup preparation failed"}\n`);
|
|
100
118
|
return 1;
|
|
@@ -150,6 +168,21 @@ async function runLaunchSpec(spec, dependencies = {}) {
|
|
|
150
168
|
if (result.spawnError) stderr.write(`Treeport launcher: ${safeDiagnostic(result.spawnError.message) || "spawn error"}\n`);
|
|
151
169
|
if (result.forwardedSignal && (!spec.fallbackArgv || result.forwardedSignal !== "SIGINT")) return 1;
|
|
152
170
|
if (spec.fallbackArgv) {
|
|
171
|
+
if (spec.tmuxExecutable && tmuxPane && spec.fallbackArgv[0]) await runChild([
|
|
172
|
+
spec.tmuxExecutable,
|
|
173
|
+
"set-option",
|
|
174
|
+
"-p",
|
|
175
|
+
"-t",
|
|
176
|
+
tmuxPane,
|
|
177
|
+
"--",
|
|
178
|
+
"@treeport-fallback-shell",
|
|
179
|
+
Buffer.from(JSON.stringify(spec.fallbackArgv[0]), "utf8").toString("base64url")
|
|
180
|
+
], {
|
|
181
|
+
cwd: spec.cwd,
|
|
182
|
+
env: process.env,
|
|
183
|
+
spawnProcess,
|
|
184
|
+
signalSource
|
|
185
|
+
});
|
|
153
186
|
const fallback = integrateShellLaunch(spec.fallbackArgv, commandEnvironment, spec.shellIntegrationDir, spec.tmuxExecutable);
|
|
154
187
|
const fallbackResult = await runChild(fallback.argv, {
|
|
155
188
|
cwd: spec.cwd,
|
|
@@ -176,7 +209,7 @@ async function main() {
|
|
|
176
209
|
}
|
|
177
210
|
let spec;
|
|
178
211
|
try {
|
|
179
|
-
spec = JSON.parse(await fs.readFile(specPath, "utf8"));
|
|
212
|
+
spec = launchSpecSchema.parse(JSON.parse(await fs.readFile(specPath, "utf8")));
|
|
180
213
|
} catch (error) {
|
|
181
214
|
process.stderr.write(`Treeport launcher: cannot read launch spec: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
182
215
|
process.exit(127);
|