@paleo/worktree-env 0.7.0 → 0.7.1
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/dist/setup-worktree.d.ts +3 -0
- package/dist/setup-worktree.js +2 -2
- package/dist/slots.d.ts +2 -0
- package/dist/slots.js +2 -0
- package/dist/worktree.js +1 -6
- package/package.json +1 -1
package/dist/setup-worktree.d.ts
CHANGED
|
@@ -51,6 +51,9 @@ export interface SetupWorktreeConfig {
|
|
|
51
51
|
* the worktree — this callback will be invoked again with the same context. Re-runs must not
|
|
52
52
|
* error on pre-existing state (created directories, started containers, ran migrations,
|
|
53
53
|
* installed deps, etc.).
|
|
54
|
+
*
|
|
55
|
+
* Runs in a detached child whose stdout/stderr are already redirected to
|
|
56
|
+
* `<runtimeDir>/wt-setup.log`. `console.log` and child-process `stdio: "inherit"` land there.
|
|
54
57
|
*/
|
|
55
58
|
finalizeWorktree: (ctx: SetupContext) => Promise<void> | void;
|
|
56
59
|
/**
|
package/dist/setup-worktree.js
CHANGED
|
@@ -88,6 +88,7 @@ async function runSetup(args, ctx, run, config) {
|
|
|
88
88
|
scheme,
|
|
89
89
|
branch,
|
|
90
90
|
requestedOwner: args.owner,
|
|
91
|
+
isMainWorktree: setupCtx.isMainWorktree,
|
|
91
92
|
});
|
|
92
93
|
const ports = portsFn(slot);
|
|
93
94
|
const runtimeDir = join(setupCtx.currentWorktree, config.runtimeDir);
|
|
@@ -208,8 +209,7 @@ function printWorktreeInfo(config, slot, worktreeForLog, fallback) {
|
|
|
208
209
|
const ports = resolvePortsFn(config)(slot);
|
|
209
210
|
const branch = entry?.branch ?? fallback.branch;
|
|
210
211
|
const owner = entry?.owner ?? fallback.owner;
|
|
211
|
-
|
|
212
|
-
const slotStatus = entry?.status ?? (ctx.isMainWorktree ? "ready" : "pending");
|
|
212
|
+
const slotStatus = entry?.status ?? "pending";
|
|
213
213
|
const logHint = ` (tail ${join(worktreeForLog, config.runtimeDir, "wt-setup.log")})`;
|
|
214
214
|
const display = slotStatus === "ready"
|
|
215
215
|
? "ready"
|
package/dist/slots.d.ts
CHANGED
|
@@ -30,6 +30,8 @@ export interface RegisterSlotInput {
|
|
|
30
30
|
scheme: PortScheme;
|
|
31
31
|
branch: string;
|
|
32
32
|
requestedOwner?: string;
|
|
33
|
+
/** When `true`, the slot is forced to `scheme.basePort` regardless of `slot` arg. */
|
|
34
|
+
isMainWorktree: boolean;
|
|
33
35
|
}
|
|
34
36
|
export declare function resolveAndRegisterSlot(input: RegisterSlotInput): {
|
|
35
37
|
port: number;
|
package/dist/slots.js
CHANGED
|
@@ -104,6 +104,8 @@ export function handleSetOwner(input) {
|
|
|
104
104
|
}
|
|
105
105
|
function pickSlotPort(args, registry) {
|
|
106
106
|
const resolvedCurrent = resolve(args.currentWorktree);
|
|
107
|
+
if (args.isMainWorktree)
|
|
108
|
+
return args.scheme.basePort;
|
|
107
109
|
if (args.slot !== undefined) {
|
|
108
110
|
const port = Number(args.slot);
|
|
109
111
|
if (!isValidPort(port, args.scheme)) {
|
package/dist/worktree.js
CHANGED
|
@@ -17,12 +17,7 @@ export function enforceWorktreeMode(args, ctx) {
|
|
|
17
17
|
process.exit(1);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
if (ctx.isMainWorktree) {
|
|
22
|
-
console.error("Error: --here must be run from a linked worktree, not from the main worktree.");
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
20
|
+
// --here runs in any worktree: linked worktree (retry path) or main (initial bootstrap).
|
|
26
21
|
}
|
|
27
22
|
export function useExistingBranch(branch, ctx, run, dirNameFn = defaultWorktreeDirName) {
|
|
28
23
|
if (!branchExists(branch)) {
|