Skip to content

Commit bd0378b

Browse files
committed
🤖 feat: display init hook script path in banner for debugging
The init hook banner now shows the full path to the script being executed, making it easier for users to debug initialization issues. Changes: - Added `hookPath` field to workspace-init DisplayedMessage type - Updated StreamingMessageAggregator to capture and track hookPath from init-start events - Enhanced InitMessage component to display hookPath below status message - Styled hookPath with muted monospace font for clarity The hookPath appears in smaller, muted text below the main status message, helping users quickly identify which script is running and where to find it. Output streaming already worked - init-output events were already being accumulated and displayed in the InitHookLog component. _Generated with `cmux`_
1 parent 2d26abf commit bd0378b

File tree

3 files changed

+24
-10
lines changed

3 files changed

+24
-10
lines changed

src/components/Messages/InitMessage.tsx

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ const InitHookHeader = styled.div`
2626
color: #ccc;
2727
`;
2828

29+
const InitHookPath = styled.div`
30+
font-size: 11px;
31+
color: #888;
32+
font-family: var(--font-monospace);
33+
margin-top: 2px;
34+
`;
35+
2936
const InitHookLog = styled.pre`
3037
margin: 0;
3138
max-height: 120px;
@@ -44,16 +51,19 @@ export const InitMessage = React.memo<InitMessageProps>(({ message, className })
4451
<InitHookBanner error={isError} className={className}>
4552
<InitHookHeader>
4653
<span>🔧</span>
47-
{message.status === "running" ? (
48-
<span>Running init hook...</span>
49-
) : message.status === "success" ? (
50-
<span>✅ Init hook completed successfully</span>
51-
) : (
52-
<span>
53-
Init hook exited with code {message.exitCode}. Workspace is ready, but some setup
54-
failed.
55-
</span>
56-
)}
54+
<div>
55+
{message.status === "running" ? (
56+
<span>Running init hook...</span>
57+
) : message.status === "success" ? (
58+
<span>✅ Init hook completed successfully</span>
59+
) : (
60+
<span>
61+
Init hook exited with code {message.exitCode}. Workspace is ready, but some setup
62+
failed.
63+
</span>
64+
)}
65+
<InitHookPath>{message.hookPath}</InitHookPath>
66+
</div>
5767
</InitHookHeader>
5868
{message.lines.length > 0 && <InitHookLog>{message.lines.join("\n")}</InitHookLog>}
5969
</InitHookBanner>

src/types/message.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ export type DisplayedMessage =
172172
id: string; // Display ID for UI/React keys
173173
historySequence: number; // Position in message stream (-1 for ephemeral, non-persisted events)
174174
status: "running" | "success" | "error";
175+
hookPath: string; // Path to the init script being executed
175176
lines: string[]; // Accumulated output lines (stderr prefixed with "ERROR:")
176177
exitCode: number | null; // Final exit code (null while running)
177178
timestamp: number;

src/utils/messages/StreamingMessageAggregator.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export class StreamingMessageAggregator {
5454
// Workspace init hook state (ephemeral, not persisted to history)
5555
private initState: {
5656
status: "running" | "success" | "error";
57+
hookPath: string;
5758
lines: string[];
5859
exitCode: number | null;
5960
timestamp: number;
@@ -508,6 +509,7 @@ export class StreamingMessageAggregator {
508509
if (isInitStart(data)) {
509510
this.initState = {
510511
status: "running",
512+
hookPath: data.hookPath,
511513
lines: [],
512514
exitCode: null,
513515
timestamp: data.timestamp,
@@ -771,6 +773,7 @@ export class StreamingMessageAggregator {
771773
id: "workspace-init",
772774
historySequence: -1, // Appears before all history
773775
status: this.initState.status,
776+
hookPath: this.initState.hookPath,
774777
lines: this.initState.lines,
775778
exitCode: this.initState.exitCode,
776779
timestamp: this.initState.timestamp,

0 commit comments

Comments
 (0)