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

Function call

src/commands/plan/plan.tsx:64–121  ·  view source on GitHub ↗
(onDone: LocalJSXCommandOnDone, context: LocalJSXCommandContext, args: string)

Source from the content-addressed store, hash-verified

62 return t5;
63}
64export async function call(onDone: LocalJSXCommandOnDone, context: LocalJSXCommandContext, args: string): Promise<React.ReactNode> {
65 const {
66 getAppState,
67 setAppState
68 } = context;
69 const appState = getAppState();
70 const currentMode = appState.toolPermissionContext.mode;
71
72 // If not in plan mode, enable it
73 if (currentMode !== 'plan') {
74 handlePlanModeTransition(currentMode, 'plan');
75 setAppState(prev => ({
76 ...prev,
77 toolPermissionContext: applyPermissionUpdate(prepareContextForPlanMode(prev.toolPermissionContext), {
78 type: 'setMode',
79 mode: 'plan',
80 destination: 'session'
81 })
82 }));
83 const description = args.trim();
84 if (description && description !== 'open') {
85 onDone('Enabled plan mode', {
86 shouldQuery: true
87 });
88 } else {
89 onDone('Enabled plan mode');
90 }
91 return null;
92 }
93
94 // Already in plan mode - show the current plan
95 const planContent = getPlan();
96 const planPath = getPlanFilePath();
97 if (!planContent) {
98 onDone('Already in plan mode. No plan written yet.');
99 return null;
100 }
101
102 // If user typed "/plan open", open in editor
103 const argList = args.trim().split(/\s+/);
104 if (argList[0] === 'open') {
105 const result = await editFileInEditor(planPath);
106 if (result.error) {
107 onDone(`Failed to open plan in editor: ${result.error}`);
108 } else {
109 onDone(`Opened plan in editor: ${planPath}`);
110 }
111 return null;
112 }
113 const editor = getExternalEditor();
114 const editorName = editor ? toIDEDisplayName(editor) : undefined;
115 const display = <PlanDisplay planContent={planContent} planPath={planPath} editorName={editorName} />;
116
117 // Render to string and pass to onDone like local commands do
118 const output = await renderToString(display);
119 onDone(output);
120 return null;
121}

Callers

nothing calls this directly

Calls 10

handlePlanModeTransitionFunction · 0.85
applyPermissionUpdateFunction · 0.85
getPlanFunction · 0.85
getPlanFilePathFunction · 0.85
editFileInEditorFunction · 0.85
toIDEDisplayNameFunction · 0.85
renderToStringFunction · 0.85
getAppStateFunction · 0.50
onDoneFunction · 0.50

Tested by

no test coverage detected