MCPcopy
hub / github.com/codeaashu/claude-code / onDone

Function onDone

src/screens/REPL.tsx:3210–3257  ·  view source on GitHub ↗
(result?: string, doneOptions?: {
            display?: CommandResultDisplay;
            metaMessages?: string[];
          })

Source from the content-addressed store, hash-verified

3208 const executeImmediateCommand = async (): Promise<void> => {
3209 let doneWasCalled = false;
3210 const onDone = (result?: string, doneOptions?: {
3211 display?: CommandResultDisplay;
3212 metaMessages?: string[];
3213 }): void => {
3214 doneWasCalled = true;
3215 setToolJSX({
3216 jsx: null,
3217 shouldHidePromptInput: false,
3218 clearLocalJSX: true
3219 });
3220 const newMessages: MessageType[] = [];
3221 if (result && doneOptions?.display !== 'skip') {
3222 addNotification({
3223 key: `immediate-${matchingCommand.name}`,
3224 text: result,
3225 priority: 'immediate'
3226 });
3227 // In fullscreen the command just showed as a centered modal
3228 // pane — the notification above is enough feedback. Adding
3229 // "❯ /config" + "⎿ dismissed" to the transcript is clutter
3230 // (those messages are type:system subtype:local_command —
3231 // user-visible but NOT sent to the model, so skipping them
3232 // doesn't change model context). Outside fullscreen the
3233 // transcript entry stays so scrollback shows what ran.
3234 if (!isFullscreenEnvEnabled()) {
3235 newMessages.push(createCommandInputMessage(formatCommandInputTags(getCommandName(matchingCommand), commandArgs)), createCommandInputMessage(`<${LOCAL_COMMAND_STDOUT_TAG}>${escapeXml(result)}</${LOCAL_COMMAND_STDOUT_TAG}>`));
3236 }
3237 }
3238 // Inject meta messages (model-visible, user-hidden) into the transcript
3239 if (doneOptions?.metaMessages?.length) {
3240 newMessages.push(...doneOptions.metaMessages.map(content => createUserMessage({
3241 content,
3242 isMeta: true
3243 })));
3244 }
3245 if (newMessages.length) {
3246 setMessages(prev => [...prev, ...newMessages]);
3247 }
3248 // Restore stashed prompt after local-jsx command completes.
3249 // The normal stash restoration path (below) is skipped because
3250 // local-jsx commands return early from onSubmit.
3251 if (stashedPrompt !== undefined) {
3252 setInputValue(stashedPrompt.text);
3253 helpers.setCursorOffset(stashedPrompt.cursorOffset);
3254 setPastedContents(stashedPrompt.pastedContents);
3255 setStashedPrompt(undefined);
3256 }
3257 };
3258
3259 // Build context for the command (reuses existing getToolUseContext).
3260 // Read messages via ref to keep onSubmit stable across message

Callers 15

DoctorFunction · 0.70
ClaudeInChromeOnboardingFunction · 0.50
ConsoleOAuthFlowFunction · 0.50
IdleReturnDialogFunction · 0.50
MCPServerApprovalDialogFunction · 0.50
RemoteEnvironmentDialogFunction · 0.50
ExitFlowFunction · 0.50
ApproveApiKeyFunction · 0.50
BridgeDialogFunction · 0.50
WorktreeExitDialogFunction · 0.50

Calls 7

isFullscreenEnvEnabledFunction · 0.85
formatCommandInputTagsFunction · 0.85
escapeXmlFunction · 0.85
createUserMessageFunction · 0.85
getCommandNameFunction · 0.50
pushMethod · 0.45

Tested by

no test coverage detected