Skip to content

Commit 793da1d

Browse files
committed
refactor: simplify IPC handshake handling in cli-dispatch
Removes complex SEA bootstrap logic and warning messages. The cli-dispatch now simply waits for the IPC handshake if present, which is used by shadow npm/pnpm/yarn operations to pass configuration to subprocesses. Also updates IpcObject import location to shadow.mts and inline minimal Sentry type in errors.mts.
1 parent 958bd9d commit 793da1d

File tree

3 files changed

+7
-26
lines changed

3 files changed

+7
-26
lines changed

packages/cli/src/cli-dispatch.mts

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@
1818

1919
import path from 'node:path'
2020

21-
import {
22-
shouldBypassBootstrap,
23-
waitForBootstrapHandshake,
24-
} from './utils/sea/boot.mjs'
21+
import { waitForBootstrapHandshake } from './utils/sea/boot.mjs'
2522

2623
// Detect how this binary was invoked.
2724
function getInvocationMode(): string {
@@ -81,27 +78,13 @@ function getInvocationMode(): string {
8178

8279
// Route to the appropriate CLI based on invocation mode.
8380
async function main() {
84-
// Check if we need bootstrap logic (SEA binary without IPC handshake).
85-
if (!shouldBypassBootstrap()) {
86-
// We're a SEA binary in initial entry mode.
87-
// Bootstrap logic will delegate to system Node.js or spawn ourselves with IPC.
88-
// This is handled by the bootstrap module - for now, we'll proceed normally.
89-
// TODO: Implement actual bootstrap delegation here.
90-
// For now, we just log a warning and continue.
91-
console.warn(
92-
'Warning: SEA bootstrap not yet implemented - continuing without delegation',
93-
)
94-
}
95-
9681
// If we're a subprocess with IPC, wait for handshake.
9782
// This validates we're running in the correct context.
83+
// Note: The handshake is used by shadow npm/pnpm/yarn operations to pass
84+
// configuration (API token, bin name, etc.) to the subprocess.
9885
try {
99-
const ipcData = await waitForBootstrapHandshake(1000) // 1 second timeout.
100-
if (ipcData) {
101-
// We received IPC handshake - we're a validated subprocess.
102-
// The IPC data contains configuration from the parent process.
103-
// For now, we just acknowledge it. The shadow binaries will use this data.
104-
}
86+
await waitForBootstrapHandshake(1000) // 1 second timeout.
87+
// Handshake received - we're a validated subprocess.
10588
} catch {
10689
// No handshake received, or we're not a subprocess.
10790
// This is normal for initial entry.

packages/cli/src/utils/error/errors.mts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,8 @@ import {
3333
SOCKET_STATUS_URL,
3434
} from '../../constants/socket.mts'
3535

36-
import type { RegistryInternals } from '../../constants/types.mts'
37-
3836
// Access internals via kInternalsSymbol.
39-
const constants = { ENV, [kInternalsSymbol]: {} as RegistryInternals }
37+
const constants = { ENV, [kInternalsSymbol]: {} as { getSentry?: () => any } }
4038
const internals = constants[kInternalsSymbol]
4139
const getSentry = internals.getSentry
4240

packages/cli/src/utils/shadow/runner.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { getErrorCause } from '../error/errors.mts'
2525
import { findUp } from '../fs/find-up.mts'
2626
import { isYarnBerry } from '../yarn/version.mts'
2727

28-
import type { IpcObject } from '../../constants/types.mts'
28+
import type { IpcObject } from '../../constants/shadow.mts'
2929
import type {
3030
ShadowBinOptions,
3131
ShadowBinResult,

0 commit comments

Comments
 (0)