tycono 0.1.96-beta.5 → 0.1.96-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/tycono.ts +18 -8
- package/package.json +1 -1
package/bin/tycono.ts
CHANGED
|
@@ -213,16 +213,26 @@ async function startServerForTui(): Promise<void> {
|
|
|
213
213
|
const port = process.env.PORT ? Number(process.env.PORT) : await findFreePort();
|
|
214
214
|
process.env.PORT = String(port);
|
|
215
215
|
|
|
216
|
-
// Suppress ALL server
|
|
216
|
+
// Suppress ALL server output BEFORE creating server — hijack process streams
|
|
217
217
|
const logFile = path.resolve(process.env.COMPANY_ROOT || process.cwd(), '.tycono', 'server.log');
|
|
218
218
|
try { fs.mkdirSync(path.dirname(logFile), { recursive: true }); } catch {}
|
|
219
|
-
const
|
|
220
|
-
const
|
|
221
|
-
const
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
219
|
+
const logFd = fs.openSync(logFile, 'a');
|
|
220
|
+
const logStream = fs.createWriteStream(logFile, { fd: logFd });
|
|
221
|
+
const origStdoutWrite = process.stdout.write.bind(process.stdout);
|
|
222
|
+
const origStderrWrite = process.stderr.write.bind(process.stderr);
|
|
223
|
+
// Intercept all stdout/stderr — only allow Ink's output (ANSI escape sequences)
|
|
224
|
+
const isInkOutput = (s: string) => s.includes('\x1b[') || s.includes('\x1b(');
|
|
225
|
+
process.stdout.write = ((chunk: any, ...args: any[]) => {
|
|
226
|
+
const str = typeof chunk === 'string' ? chunk : chunk.toString();
|
|
227
|
+
if (isInkOutput(str)) return origStdoutWrite(chunk, ...args);
|
|
228
|
+
logStream.write(str);
|
|
229
|
+
return true;
|
|
230
|
+
}) as any;
|
|
231
|
+
process.stderr.write = ((chunk: any, ...args: any[]) => {
|
|
232
|
+
logStream.write(typeof chunk === 'string' ? chunk : chunk.toString());
|
|
233
|
+
return true;
|
|
234
|
+
}) as any;
|
|
235
|
+
const origLog = (...args: unknown[]) => origStdoutWrite(args.join(' ') + '\n');
|
|
226
236
|
|
|
227
237
|
const { createHttpServer } = await import('../src/api/src/create-server.js');
|
|
228
238
|
const server = createHttpServer();
|