@monotykamary/localterm-server 2.6.1 → 2.6.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.
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { WorktreeRepoConfig } from "../types.js";
|
|
2
|
+
interface WorktreeInitialCommandInput {
|
|
3
|
+
setupScript: string;
|
|
4
|
+
runScript: string;
|
|
5
|
+
autoRunAfterSetup: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const composeWorktreeInitialCommand: (config: WorktreeInitialCommandInput) => string | null;
|
|
8
|
+
export declare const composeWorktreeInitialCommandFromConfig: (config: Pick<WorktreeRepoConfig, "setupScript" | "runScript" | "autoRunAfterSetup">) => string | null;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=worktree-initial-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worktree-initial-command.d.ts","sourceRoot":"","sources":["../../src/utils/worktree-initial-command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAKtD,UAAU,2BAA2B;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AA0BD,eAAO,MAAM,6BAA6B,GACxC,QAAQ,2BAA2B,KAClC,MAAM,GAAG,IASX,CAAC;AAIF,eAAO,MAAM,uCAAuC,GAClD,QAAQ,IAAI,CAAC,kBAAkB,EAAE,aAAa,GAAG,WAAW,GAAG,mBAAmB,CAAC,KAClF,MAAM,GAAG,IAKR,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Compose the initial command a freshly-created worktree's tab should run as
|
|
2
|
+
// its first prompt input (forwarded to the PTY via the `?cmd=` query param).
|
|
3
|
+
//
|
|
4
|
+
// Setup is the one-shot bootstrap (env copy, install, migrate); run is the
|
|
5
|
+
// long-lived follow-on (a dev server) intended to start once setup succeeds.
|
|
6
|
+
// The composition mirrors Conductor's auto-run-after-setup:
|
|
7
|
+
//
|
|
8
|
+
// setup only -> <setup> (unchanged from pre-run-script behavior)
|
|
9
|
+
// auto-run off (whatever scripts) -> <setup> or null (run never auto-fires; it's launched on demand)
|
|
10
|
+
// auto-run on + run only -> <run>
|
|
11
|
+
// auto-run on + both -> ( set -e\n<setup>\n) && <run> (setup must fully succeed before run starts)
|
|
12
|
+
//
|
|
13
|
+
// The subshell wrapping with `set -e` makes any failed statement in a
|
|
14
|
+
// multi-line setup abort the subshell non-zero, so `&& <run>` correctly gates
|
|
15
|
+
// the long-lived process on the whole setup succeeding — not just its last
|
|
16
|
+
// line (a naive `<setup>\n<run>` or trailing `&& <run>` would only gate on the
|
|
17
|
+
// final statement). Without `set -e`, an earlier `pnpm install` failure would
|
|
18
|
+
// still let `migrate && run` proceed against the broken install. With per-row
|
|
19
|
+
// on-demand run, the manual path skips the gate since the caller chose to start
|
|
20
|
+
// the dev server directly.
|
|
21
|
+
//
|
|
22
|
+
// Returns null when there's nothing to auto-run a tab with (so the create
|
|
23
|
+
// handler keeps a clean `setupCommand: null` and the client opens a bare
|
|
24
|
+
// prompt), preserving the pre-run-script create behavior exactly.
|
|
25
|
+
export const composeWorktreeInitialCommand = (config) => {
|
|
26
|
+
const setup = config.setupScript.trim();
|
|
27
|
+
const run = config.runScript.trim();
|
|
28
|
+
if (!setup && !run)
|
|
29
|
+
return null;
|
|
30
|
+
if (!config.autoRunAfterSetup)
|
|
31
|
+
return setup || null;
|
|
32
|
+
if (!run)
|
|
33
|
+
return setup || null;
|
|
34
|
+
if (!setup)
|
|
35
|
+
return run;
|
|
36
|
+
return `( set -e\n${setup}\n) && ${run}`;
|
|
37
|
+
};
|
|
38
|
+
// Convenience overload taking the full repo config straight from the store,
|
|
39
|
+
// since the create route already has one in hand.
|
|
40
|
+
export const composeWorktreeInitialCommandFromConfig = (config) => composeWorktreeInitialCommand({
|
|
41
|
+
setupScript: config.setupScript,
|
|
42
|
+
runScript: config.runScript,
|
|
43
|
+
autoRunAfterSetup: config.autoRunAfterSetup,
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=worktree-initial-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worktree-initial-command.js","sourceRoot":"","sources":["../../src/utils/worktree-initial-command.ts"],"names":[],"mappings":"AAWA,6EAA6E;AAC7E,6EAA6E;AAC7E,EAAE;AACF,2EAA2E;AAC3E,6EAA6E;AAC7E,4DAA4D;AAC5D,EAAE;AACF,mHAAmH;AACnH,0HAA0H;AAC1H,+CAA+C;AAC/C,uHAAuH;AACvH,EAAE;AACF,sEAAsE;AACtE,8EAA8E;AAC9E,2EAA2E;AAC3E,+EAA+E;AAC/E,8EAA8E;AAC9E,8EAA8E;AAC9E,gFAAgF;AAChF,2BAA2B;AAC3B,EAAE;AACF,0EAA0E;AAC1E,yEAAyE;AACzE,kEAAkE;AAClE,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,MAAmC,EACpB,EAAE;IACjB,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;IACxC,MAAM,GAAG,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;IAEpC,IAAI,CAAC,KAAK,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IAChC,IAAI,CAAC,MAAM,CAAC,iBAAiB;QAAE,OAAO,KAAK,IAAI,IAAI,CAAC;IACpD,IAAI,CAAC,GAAG;QAAE,OAAO,KAAK,IAAI,IAAI,CAAC;IAC/B,IAAI,CAAC,KAAK;QAAE,OAAO,GAAG,CAAC;IACvB,OAAO,aAAa,KAAK,UAAU,GAAG,EAAE,CAAC;AAC3C,CAAC,CAAC;AAEF,4EAA4E;AAC5E,kDAAkD;AAClD,MAAM,CAAC,MAAM,uCAAuC,GAAG,CACrD,MAAmF,EACpE,EAAE,CACjB,6BAA6B,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC,WAAW;IAC/B,SAAS,EAAE,MAAM,CAAC,SAAS;IAC3B,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;CAC5C,CAAC,CAAC"}
|