MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / writeReady

Function writeReady

apps/kimi-code/src/cli/sub/server/run.ts:189–211  ·  view source on GitHub ↗
(result: { origin: string; reused?: boolean; host?: string })

Source from the content-addressed store, hash-verified

187 // rides in the opened Web UI URL's `#token=` fragment (M5.5). Falls back to
188 // the plain origin / no token line when unavailable.
189 const writeReady = (result: { origin: string; reused?: boolean; host?: string }): void => {
190 const { origin } = result;
191 const host = result.host ?? parsed.host;
192 const token = deps.resolveToken?.();
193 let output = '';
194 if (result.reused === true) {
195 // A daemon was already running, so this command's --host/--port/etc. did
196 // not start a new one. Say so loudly, then print the actual running
197 // server's URLs (using its real bind host, not the requested one).
198 output += formatReuseNotice(origin);
199 }
200 output +=
201 parsed.logLevel === DEFAULT_FOREGROUND_LOG_LEVEL
202 ? formatReadyBanner(origin, host, {
203 token,
204 networkAddresses: deps.networkAddresses,
205 })
206 : formatReadyLine(origin, token);
207 deps.stdout.write(output);
208 if (opts.open === true) {
209 deps.openUrl(token !== undefined ? buildWebUrl(origin, token) : origin);
210 }
211 };
212 if (opts.foreground === true) {
213 const run = deps.startServerForeground ?? startServerForeground;
214 await run(parsed, {

Callers 1

handleRunCommandFunction · 0.85

Calls 7

formatReuseNoticeFunction · 0.85
formatReadyBannerFunction · 0.85
formatReadyLineFunction · 0.85
buildWebUrlFunction · 0.85
resolveTokenMethod · 0.80
writeMethod · 0.65
openUrlMethod · 0.65

Tested by

no test coverage detected