Lines 164-216javascript
165 stdio: ['ignore', bLog, bLog],
169 writePids({ backend: backend.pid });
170 console.log('[meow] 已后台启动');
171 console.log(` 后端 :${backend.pid} → http://localhost:4399`);
172 console.log(` 前端 : http://localhost:4399 (静态文件服务)`);
173 console.log(` 日志 : ${LOG_DIR}/backend.log`);
174 console.log(` 停止 : meow stop`);
176async function stop() {
177 const pids = readPids();
179 console.log('[meow] 未在运行');
182 console.log('[meow] 停止后端(等待后端 shutdown 钩子完成 OSS 上传)...');
183 // 先 HTTP /v1/shutdown 触发后端优雅关闭(Windows detached 进程无法收 SIGINT)
184 // 后端会跑 mcp.disconnectAll + closeDb + pushOnShutdown,然后再 process.exit
185 const port = process.env.PORT ?? '4399';
186 await gracefulShutdownBackend(port, pids.backend);
188 console.log('[meow] 已停止');
192 const port = process.env.PORT ?? '4399';
193 const url = `http://localhost:${port}`;
194 console.log(`[meow] 正在打开浏览器: ${url}`);
196 const cmd = process.platform === 'win32' ? 'start' : process.platform === 'darwin' ? 'open' : 'xdg-open';
197 spawn(cmd, [url], { shell: true, detached: true, stdio: 'ignore' }).unref();
198}
HighSame File Env Network Execution
A single source file combines environment access, network access, and code or shell execution; review context before blocking.
dist/bin/meow.jsView on unpkg · L184 200 // 转发参数到 CLI(默认 chat),每次启动都会创建新 session
201 const args = process.argv.slice(3);
202 if (args.length === 0)
204 // node dist/cli/index.js(编译产物)
205 const child = spawn(process.execPath, ['dist/cli/index.js', ...args], {
209 child.on('exit', (c) => process.exit(c ?? 0));
212 const pids = readPids();
214 console.log('[meow] 未运行');